mirror of
https://github.com/e107inc/e107.git
synced 2025-01-29 10:38:08 +01:00
Bugtracker #4173 - try and improve operation of secure image rendering
This commit is contained in:
parent
1d58d92af2
commit
053f02d40e
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/secure_img_handler.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:33:57 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-11-05 20:12:28 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -30,13 +30,18 @@ class secure_image {
|
||||
function create_code() {
|
||||
global $pref, $sql, $IMAGES_DIRECTORY, $HANDLERS_DIRECTORY;
|
||||
|
||||
/*
|
||||
require_once('e107_class.php');
|
||||
$e107 = new e107(false, false);
|
||||
$e107->set_paths();
|
||||
|
||||
$imgpy = str_replace($HANDLERS_DIRECTORY, "", $e107->file_path);
|
||||
*/
|
||||
$imgp = dirname(__FILE__);
|
||||
if (substr($imgp,-1,1) != '/') $imgp .= '/';
|
||||
if (!isset($HANDLERS_DIRECTORY)) require_once($imgp.'../e107_config.php');
|
||||
$imgp = str_replace($HANDLERS_DIRECTORY,$IMAGES_DIRECTORY,$imgp);
|
||||
|
||||
$imgp = $imgpy.$IMAGES_DIRECTORY;
|
||||
mt_srand ((double)microtime() * 1000000);
|
||||
$maxran = 1000000;
|
||||
$rand_num = mt_rand(0, $maxran);
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/secure_img_render.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:33:57 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-11-05 20:12:28 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -52,15 +52,18 @@ if($recnum == false){
|
||||
|
||||
$mySQLserver = "";
|
||||
|
||||
@include_once(dirname(__FILE__)."e107_config.php");
|
||||
|
||||
$a = 0;
|
||||
$p = "";
|
||||
|
||||
while(!$mySQLserver && $a < 5){
|
||||
$a ++;
|
||||
$p .= "../";
|
||||
@include_once($p."e107_config.php");
|
||||
$ifile = dirname(__FILE__);
|
||||
if (substr($ifile,-1,1) != '/') $ifile .= '/';
|
||||
@include_once($ifile."e107_config.php");
|
||||
|
||||
while(!$mySQLserver && $a < 5)
|
||||
{
|
||||
$a ++;
|
||||
$p .= "../";
|
||||
@include_once($ifile.$p.'e107_config.php'); // *** Revised
|
||||
}
|
||||
|
||||
mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
|
||||
@ -94,7 +97,7 @@ if(is_readable($path."secure_image_custom.php")) {
|
||||
$secureimg['x'] = "6";
|
||||
$secureimg['y'] = "22";
|
||||
$secureimg['font'] = "imagecode.ttf";
|
||||
$secureimg['color'] = array(90,90,90); // red,green,blue
|
||||
$secureimg['color'] = "90,90,90"; // red,green,blue
|
||||
|
||||
*/
|
||||
$bg_file = $secureimg['image'];
|
||||
@ -114,10 +117,13 @@ switch($type) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($secureimg['color'])) {
|
||||
if(isset($secureimg['color']))
|
||||
{
|
||||
$tmp = explode(",",$secureimg['color']);
|
||||
$text_color = ImageColorAllocate($image,$tmp[0],$tmp[1],$tmp[2]);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$text_color = ImageColorAllocate($image, 90, 90, 90);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user