|
From: <luc...@us...> - 2013-10-04 16:52:02
|
Revision: 12126
http://sourceforge.net/p/xoops/svn/12126
Author: luciorota
Date: 2013-10-04 16:51:59 +0000 (Fri, 04 Oct 2013)
Log Message:
-----------
bug fix
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php 2013-10-04 16:48:46 UTC (rev 12125)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php 2013-10-04 16:51:59 UTC (rev 12126)
@@ -52,7 +52,7 @@
$message = "";
if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($cloneDirname))) {
- $message .= sprintf(_AM_WFDOWNLOADS_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(strtolower($cloneDirname)) . "</a>") . "<br />\n";
+ $message .= sprintf(_AM_WFDOWNLOADS_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=installlist'>" . ucfirst(strtolower($cloneDirname)) . "</a>") . "<br />\n";
if (!$logocreated) {
$message .= _AM_WFDOWNLOADS_CLONE_IMAGEFAIL;
}
@@ -131,6 +131,8 @@
function wfdownloads_createLogo($dirname)
{
+ $wfdownloads = WfdownloadsWfdownloads::getInstance();
+ // Check extension/functions
if (!extension_loaded("gd")) {
return false;
} else {
@@ -148,26 +150,27 @@
}
}
}
-
- if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png") || !file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/VeraBd.ttf")) {
+ // Check original image/font
+ if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png")) {
return false;
}
-
+ if (!file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $wfdownloads->getModule()->dirname() . "/images/VeraBd.ttf")) {
+ return false;
+ }
+ // Create image
$imageModule = imagecreatefrompng($imageBase);
-
- //Erase old text
- $grey_color = imagecolorallocate($imageModule, 237, 237, 237);
- imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color);
-
+ // Erase old text
+ $greyColor = imagecolorallocate($imageModule, 237, 237, 237);
+ imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor);
// Write text
- $text_color = imagecolorallocate($imageModule, 0, 0, 0);
+ $textColor = imagecolorallocate($imageModule, 0, 0, 0);
$space_to_border = (80 - strlen($dirname) * 6.5) / 2;
- imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array());
-
+ imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $textColor, $font, ucfirst($dirname), array());
// Set transparency color
- $white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
- imagefill($imageModule, 0, 0, $white);
- imagecolortransparent($imageModule, $white);
+ $whiteColor = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
+ imagefill($imageModule, 0, 0, $whiteColor);
+ imagecolortransparent($imageModule, $whiteColor);
+ // Save new image
imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png");
imagedestroy($imageModule);
return true;
|