]> git.mxchange.org Git - mailer.git/commitdiff
A lot eval() commands rewritten to constant() function
authorRoland Häder <roland@mxchange.org>
Sat, 11 Oct 2008 22:50:23 +0000 (22:50 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 11 Oct 2008 22:50:23 +0000 (22:50 +0000)
17 files changed:
inc/databases.php
inc/libs/admins_functions.php
inc/libs/register_functions.php
inc/libs/surfbar_functions.php
inc/mails/beg_mails.php
inc/mails/bonus_mails.php
inc/modules/admin/admin-inc.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-config_admins.php
inc/modules/admin/what-config_register.php
inc/modules/admin/what-list_payouts.php
inc/modules/admin/what-list_task.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-optimize.php
inc/modules/admin/what-updates.php
inc/modules/guest/what-sponsor_login.php
inc/modules/member/what-payout.php

index c9e37c8d86cf8c2f5553466b8665aab47be63239..95ca1709d206f9588e3cea63fb17f9e164596e8d 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "491");
+define('CURR_SVN_REVISION', "492");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 8bb7c27ad46dba54cc4ca395c0c95365cdbe6559..550b8a69bc539399caf339908aafe5b8a0092070 100644 (file)
@@ -328,10 +328,8 @@ function ADMINS_DELETE_ADMIN_ACCOUNTS ($POST) {
                                // Entry found
                                $content = SQL_FETCHARRAY($result);
                                SQL_FREERESULT($result);
-                               $eval = "\$content['mode'] = ADMINS_".strtoupper($content['mode'])."_MODE;";
-                               eval($eval);
-                               $eval = "\$content['la_mode'] = ADMINS_".strtoupper($content['la_mode'])."_LA_SETTING;";
-                               eval($eval);
+                               $content['mode'] = constant('ADMINS_'.strtoupper($content['mode']).'_MODE');
+                               $content['la_mode'] = constant('ADMINS_'.strtoupper($content['la_mode']).'_LA_SETTING');
 
                                // Prepare some more data
                                $content['sw'] = $SW;
@@ -389,10 +387,8 @@ function ADMINS_LIST_ADMIN_ACCOUNTS() {
        $SW = 2; $OUT = "";
        while ($content = SQL_FETCHARRAY($result)) {
                // Compile some variables
-               $eval = "\$content['mode'] = ADMINS_".strtoupper($content['mode'])."_MODE;";
-               eval($eval);
-               $eval = "\$content['la_mode'] = ADMINS_".strtoupper($content['la_mode'])."_LA_SETTING;";
-               eval($eval);
+               $content['mode'] = constant('ADMINS_'.strtoupper($content['mode']).'_MODE');
+               $content['la_mode'] = constant('ADMINS_'.strtoupper($content['la_mode']).'_LA_SETTING');
 
                // Prepare some more data
                $content['sw']         = $SW;
index 7a74af6a32c7fa7ce8ea36740aefe3302fbf1cb6..f90e1b8d3083313fe27b46d4878a18c6db1102bf 100644 (file)
@@ -41,13 +41,12 @@ if (!defined('__SECURITY')) {
 function REGISTER_FILL_MUST_CONSTANTS()
 {
        $result = SQL_QUERY("SELECT field_name, field_required FROM "._MYSQL_PREFIX."_must_register ORDER BY id", __FILE__, __LINE__);
-       while(list($name, $required) = SQL_FETCHROW($result))
-       {
+       while(list($name, $required) = SQL_FETCHROW($result)) {
                $value = "";
                if ($required == "Y") $value = "<FONT class=\\\"guest_failed\\\">&nbsp;(*)</FONT>";
                $eval = "define('MUST_".strtoupper($name)."', \"".$value."\");";
                eval($eval);
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
@@ -91,12 +90,10 @@ function REGISTER_OUTPUT_REQUIRE_CHECK(&$array)
        $result = SQL_QUERY("SELECT field_name, field_required FROM "._MYSQL_PREFIX."_must_register ORDER BY id", __FILE__, __LINE__);
        while(list($name, $required) = SQL_FETCHROW($result))
        {
-               if (($array[$name] == "!") && ($required == "Y"))
-               {
+               if (($array[$name] == "!") && ($required == "Y")) {
                        // Empty entry found
                        $array[$name] = "";
-                       $eval = "\$OUT = REGISTER_".strtoupper($name)."_REQUIRED;";
-                       eval($eval);
+                       $OUT = constant('REGISTER_'.strtoupper($name).'_REQUIRED');
                        OUTPUT_HTML("<STRONG><SPAN class=\"register_failed\">".$OUT."</SPAN></STRONG><br /><br />");
                }
        }
@@ -113,6 +110,7 @@ function REGISTER_ADD_CATEGORY_TABLE ($MODE, $return=false)
        // Guests are mostly not interested in how many members has
        // choosen an individual category
        $AND = "WHERE visible='Y' ";
+
        // Admins are allowed to see every category...
        if (IS_ADMIN()) $AND = "";
        $result = SQL_QUERY("SELECT id, cat, visible FROM "._MYSQL_PREFIX."_cats ".$AND." ORDER BY sort", __FILE__, __LINE__);
index e9c14d7f09013221211a45c00fa59e1a8618c78d..a5f121de430da6cc51c1aaca062c30f444b71af1 100644 (file)
@@ -488,10 +488,9 @@ function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
        $subject = ADMIN_SURFBAR_NOTIFY_DEFAULT_SUBJECT;
 
        // Prepare subject
-       $eval = sprintf("\$subject = ADMIN_SURFBAR_NOTIFY_%s_SUBJECT;",
+       $subject = constant(sprintf("ADMIN_SURFBAR_NOTIFY_%s_SUBJECT",
                strtoupper($messageType)
-       );
-       @eval($eval);
+       ));
 
        // Send the notification out
        return SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
@@ -510,10 +509,9 @@ function SURFBAR_NOTIFY_USER ($messageType, $content) {
        $subject = MEMBER_SURFBAR_NOTIFY_DEFAULT_SUBJECT;
 
        // Prepare subject
-       $eval = sprintf("\$subject = MEMBER_SURFBAR_NOTIFY_%s_SUBJECT;",
+       $subject = constant(sprintf("MEMBER_SURFBAR_NOTIFY_%s_SUBJECT",
                strtoupper($messageType)
-       );
-       @eval($eval);
+       ));
 
        // Load template
        $mailText = LOAD_EMAIL_TEMPLATE($templateName, $content, $content['uid']);
@@ -783,6 +781,8 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
 
        // Finally encrypt it PGP-like and return it
        $valHashedCode = generatePassString($hashedCode);
+
+       // Return hashed value
        //DEBUG_LOG(__FUNCTION__.":finalValCode={$valHashedCode}");
        return $valHashedCode;
 }
index 545b552a69545838e1412004186e71594b191ed3..37272d712ec54187bb41c2cb1918b127e3b4f3fd 100644 (file)
@@ -108,8 +108,7 @@ if (!empty($SQL))
                $MAIL_MODE = (($_CONFIG['beg_notify_bonus'] > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
 
                // Generate subject line
-               $eval = "\$SUBJECT = BEG_RALLYE_".strtoupper($MODE)."_NOTIFY;";
-               eval($eval);
+               $SUBJECT = constant('BEG_RALLYE_'.strtoupper($MODE).'_NOTIFY');
 
                // Load message body for bonus mails
                $MSG = LOAD_EMAIL_TEMPLATE("beg_en_notify_body", "", "{PER}uid{PER}");
index ad84a3454d4148e672fb94478778ba1391027227..0e4e19224b722e24422418f9b275fa55a9b3fbad 100644 (file)
@@ -82,8 +82,7 @@ if (!empty($SQL)) {
        $MAIL_MODE = (($_CONFIG['bonus_notify_points'] > 0) && ($MODE == "en") && (EXT_IS_ACTIVE("bonus")));
 
        // Generate subject line
-       $eval = "\$SUBJECT = BONUS_RALLYE_".strtoupper($MODE)."_NOTIFY;";
-       eval($eval);
+       $SUBJECT = constant('BONUS_RALLYE_'.strtoupper($MODE).'_NOTIFY');
 
        // Load message body for bonus mails
        $MSG = LOAD_EMAIL_TEMPLATE("bonus_en_notify_body", "", "{PER}uid{PER}");
@@ -108,7 +107,7 @@ SET bonus_ral_notify='%s', bonus_ral_%s_notify='%s' WHERE userid=%s LIMIT 1",
                                $MSG = LOAD_EMAIL_TEMPLATE("bonus_".$MODE."_notify", array(), $uid);
                                SEND_EMAIL($uid, $SUBJECT, $MSG);
                        }
-               }
+               } // END - if
 
                // Shall I send out bonus mails?
                if ($MAIL_MODE) {
index de735f5f5cfef9fe7e7b857726b39ec7ddf71573..51c43c1bd8c5711f5b9432a49487ee80cb21bca3 100644 (file)
@@ -847,8 +847,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
        // Is the raw userid set?
        if ($_POST['uid_raw'][$id] > 0) {
                // Generate subject
-               $eval = "\$subjectLine = MEMBER_".$subject."_".strtoupper($table)."_SUBJECT;";
-               eval($eval);
+               $subjectLine = constant('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
 
                // Load email template
                if (!empty($subjectPart)) {
@@ -862,8 +861,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
        } // END - if
 
        // Generate subject
-       $eval = "\$subjectLine = ADMIN_".$subject."_".strtoupper($table)."_SUBJECT;";
-       eval($eval);
+       $subjectLine = constant('ADMIN_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
 
        // Send admin notification out
        if (!empty($subjectPart)) {
index 23501fea9938f4b76b100f23e5a985fa9f8b8c4e..f77e1e00fe14fc484e6fae7b92d0e22ff98ca4e8 100644 (file)
@@ -410,8 +410,10 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
                                        $admin = "<FONT class=\"admin_note\">".ADMIN_ID_404_1.$admin.ADMIN_ID_404_2."</FONT>";
                                }
                        }
-                       $evl = "\$type_out = ADMIN_TASK_IS_".strtoupper($type).";";
-                       eval($evl);
+
+                       // Get task type
+                       $type_out = constant('ADMIN_TASK_IS_'.strtoupper($type).'');
+
                        $type2 = substr($text, 0, strpos($text, ":"));
                        // Generate infos
                        switch ($type)
@@ -421,16 +423,15 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
                                $infos = substr($subj, 1, strpos($subj, ":") - 1);
                                break;
                        }
-                       if ($uid > 0)
-                       {
+
+                       if ($uid > 0) {
                                // Member found otherwise it's a system task
                                $uid = ADMIN_USER_PROFILE_LINK($uid);
-                       }
-                        else
-                       {
+                       } else {
                                $uid = "<I>".ADMIN_IS_SYSTEM_TASK."</I>";
                        }
 
+                       // Prepare content
                        $content = array(
                                'sw'      => $SW,
                                'id'      => $id,
@@ -441,7 +442,10 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
                                'created' => MAKE_DATETIME($created, "2")
                        );
 
+                       // Load row template
                        LOAD_TEMPLATE("admin_overview_list_rows", false, $content);
+
+                       // Switch color
                        $SW = 3 - $SW;
                }
                // Free memory
index 5bd3d2cc85005848fb24d42485b2178ce26282c6..d88a2821f1dddc73c4dc557cbf241e65207628bd 100644 (file)
@@ -110,8 +110,9 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
                // Prepare variables
                if (empty($act)) $act = "---";
                if (empty($wht)) $wht   = "---";
-               $eval = "\$mode = ADMINS_".strtoupper($mode)."_MODE;";
-               eval($eval);
+
+               // Get admin mode
+               $mode = constant('ADMINS_'.strtoupper($mode).'_MODE');
 
                // Load admin's data
                $login = GET_ADMIN_LOGIN($admin);
@@ -225,8 +226,9 @@ VALUES ('%s','%s','%s','%s')",
                        // Prepare variables
                        if (empty($act)) $act = "---";
                        if (empty($wht))   $wht   = "---";
-                       $eval = "\$mode = ADMINS_".strtoupper($mode)."_MODE;";
-                       eval($eval);
+
+                       // Get mode
+                       $mode = constant('ADMINS_'.strtoupper($mode).'_MODE');
 
                        // Load admin's data
                        $login = GET_ADMIN_LOGIN($admin);
index f4b0a39b97d39ecb3687fabf074559101fe6190f..dbc53e62f77efbd1ddbf162a13f7d43c39c8ed72 100644 (file)
@@ -53,8 +53,9 @@ if (isset($_POST['ok'])) {
 $result = SQL_QUERY("SELECT id, field_name, field_required FROM "._MYSQL_PREFIX."_must_register ORDER BY id", __FILE__, __LINE__);
 $SW = 2; $OUT = "";
 while (list($id, $name, $required) = SQL_FETCHROW($result)) {
-       $eval = "\$name = ".strtoupper($name).";";
-       eval($eval);
+       // Get constant value
+       $name =  constant(strtoupper($name));
+
        $OUT .= "<TR>
   <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".$id."</TD>
   <TD class=\"switch_sw".$SW." bottom2 right2\">&nbsp;&nbsp;".$name."</TD>
index 7054963825dc6c172699d79620d17fa42339a57a..289dd508ed21434102a41d411f20a049560107e3 100644 (file)
@@ -243,17 +243,14 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
                         else
                        {
                                // Translate status
-                               $evl = "\$status = PAYOUT_STATUS_".strtoupper($status).";";
-                               eval($evl);
+                               $status = constant('PAYOUT_STATUS_'.strtoupper($status).'');
                                $status = "<FONT class=\"admin_failed\">".$status."</FONT>";
                        }
 
                        // Nothing entered must be secured in member/what-payputs.php !
-                       if ($allow == "Y")
-                       {
+                       if ($allow == "Y") {
                                // Banner/Textlink views/clicks request
-                               if (!empty($banner))
-                               {
+                               if (!empty($banner)) {
                                        // Prepare array for the banner
                                        $content = array(
                                                'banner' => $banner,
@@ -263,9 +260,7 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
 
                                        // Load template for the banner
                                        $account = LOAD_TEMPLATE("admin_list_payouts_banner", true, $content);
-                               }
-                                else
-                               {
+                               } else {
                                        // Textlink
                                        $content = array(
                                                'txt_link' => $alt,
@@ -276,9 +271,7 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__);
 
                                // Admins can addionally test the URL for framekillers
                                $bank = "<A href=\"".FRAMETESTER($url)."\" target=\"_blank\">".CLICK_HERE."</A>";
-                       }
-                        else
-                       {
+                       } else {
                                // e-currency payout request
                                if (empty($account)) $account = "---";
                                if (empty($bank))    $bank    = "---";
index 65ed9bc00466e1117d0f82b1aefac9e969241a0a..c00272e2870ccad4d9b9eadf41dd1edfca2d26b6 100644 (file)
@@ -119,8 +119,7 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __L
                }
 
                // There are uncompleted jobs!
-               $eval = "\$type = ADMIN_OVERVIEW_TASK_".strtoupper($_GET['type'])."_TYPE;";
-               eval($eval);
+               $type = constant('ADMIN_OVERVIEW_TASK_'.strtoupper($_GET['type']).'_TYPE');
                LOAD_TEMPLATE("admin_overview_header_task", false, array(
                        'message' => $type,
                        'type'    => $_GET['type']
@@ -149,8 +148,10 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __L
                                        $admin = "<FONT class=\"admin_note\">".ADMIN_ID_404_1.$admin.ADMIN_ID_404_2."</FONT>";
                                }
                        }
-                       $evl = "\$type_out = ADMIN_TASK_IS_".strtoupper($type).";";
-                       eval($evl);
+
+                       // Get admin task
+                       $type_out = constant('ADMIN_TASK_IS_'.strtoupper($type).'');
+
                        $type2 = substr($text, 0, strpos($text, ":"));
                        // Generate infos
                        switch ($type)
index 58c2147f0a350ff7b0be4ece9e78cb104ae42d9c..ce84588bad234c8522f61b612152a6f4bf5621e7 100644 (file)
@@ -48,8 +48,7 @@ ADD_DESCR("admin", __FILE__);
 $listHeader = ADMIN_ALL_ACCOUNTS;
 if (!empty($_GET['mode'])) {
        // Set title according to the "mode"
-       $eval = sprintf("\$listHeader = ADMIN_LIST_%s_ACCOUNTS;", strtoupper(SQL_ESCAPE($_GET['mode'])));
-       eval($eval);
+       $listHeader = constant(sprintf("ADMIN_LIST_%s_ACCOUNTS", strtoupper(SQL_ESCAPE($_GET['mode']))));
 } // END - if
 
 // Remember it
index e225f6f298d3854a7542b8c8a62ac9bb71fe4a7d..0bb91c5709d330eb3f971b9cf2721dce1ec6e8b9 100644 (file)
@@ -47,22 +47,23 @@ $DATA = REPAIR_OPTIMIZE_DB();
 $SW = 2; $gain_tabs = 0; $OUT = "";
 foreach ($DATA['tables'] as $row_array)
 {
+       // Init variables
+       $B1 = ""; $B2 = "";
+
        // Fixes a bug which causes a parser error on eval'd code
        if (empty($row_array[1])) $row_array[1] = "NONE";
-       $eval = "\$REP = OPTIMIZE_STATUS_".strtoupper($row_array[1]).";";
-       eval($eval); $B1 = ""; $B2 = "";
+
+       // Get optimization status
+       $REP = constant('OPTIMIZE_STATUS_'.strtoupper($row_array[1]).'');
+
        $OPT = OPTIMIZE_STATUS_UNSUPPORTED;
-       if ($row_array[4] > 0)
-       {
+
+       if ($row_array[4] > 0) {
                $OPT = OPTIMIZE_STATUS_OPTIMIZED;
                $B1 = "<STRONG>"; $B2 = "<STRONG>";
                $gain_tabs++;
-       }
-        elseif (count(explode(" ", $row_array[2])) == 0)
-       {
-               $eval = "\$OPT = OPTIMIZE_STATUS_".strtoupper($row_array[2]).";";
-               die($eval);
-               eval($eval);
+       } elseif (count(explode(" ", $row_array[2])) == 0) {
+               $OPT = constant('OPTIMIZE_STATUS_'.strtoupper($row_array[2]).'');
        }
 
        // Prepare data for the row template
index 28fb4d5a57e9c85cf734947b1b480ecfd1b287c0..cd689af7ad6981b0f5acddd2ca46ac878f1ca524 100644 (file)
@@ -132,38 +132,6 @@ if (empty($ONLINE['version'])) {
 
        // Load template
        LOAD_TEMPLATE("admin_update_download");
-/*
- * DEACTIVATED ON 09/11/2008,02:47 AM
- *
-} elseif (sizeof($PATCHES['fname']) > 0) {
-       // Some patches are available
-       $OUT = ""; $SW = "2";
-       foreach ($PATCHES['fname'] as $idx => $file) {
-               $SIZE = TRANSLATE_COMMA(round($PATCHES['fsize'][$idx]/102.4)/10);
-               $content = array(
-                       'sw'          => $SW,
-                       'patch_url'   => SERVER_URL."/patches/".$file,
-                       'patch_title' => str_replace("_", " ", str_replace(".zip", "", $file)),
-                       'patch_ctime' => MAKE_DATETIME($PATCHES['ctime'][$idx], "2"),
-                       'patch_size'  => $SIZE,
-                       'patch_desc'  => COMPILE_CODE($PATCHES['descr'][$idx]),
-               );
-               // Evaluate descrition code
-               $eval = "\$content['patch_desc'] = \"".$content['patch_desc']."\";";
-               eval($eval);
-
-               // Load template, switch color and count total size up
-               $OUT .= LOAD_TEMPLATE("admin_patches_row", true, $content);
-               $SW = 3 - $SW;
-       }
-       define('__PATCH_ROWS', $OUT);
-
-       // Total size
-       define('__TOTAL_SIZE', TRANSLATE_COMMA($TOTAL_SIZE / 1024));
-
-       // Load main template
-       LOAD_TEMPLATE("admin_patches");
-*/
 } else {
        // You have the latest version!
        LOAD_TEMPLATE("admin_settings_saved", false, NO_UPDATES_AVAILABLE);
index cf6f8bd7fd63e9521fde8b0f5d7a60a7087a043c..d224bc3672420452e58905266fdc58b0f7d08a14 100644 (file)
@@ -281,8 +281,7 @@ WHERE id='%s' AND password='%s' LIMIT 1",
                 else
                {
                        // Status is not fine
-                       $eval = "\$content = SPONSOR_LOGIN_FAILED_".strtoupper($status).";";
-                       eval($eval);
+                       $content = constant('SPONSOR_LOGIN_FAILED_'.strtoupper($status).'');
                        LOAD_TEMPLATE("admin_settings_saved", false, $content);
                        OUTPUT_HTML("<br />");
 
index ad7cbd3ee9f88cb66d94825e58ee47647d7ad483..a62131dcc2a47d16fc646d45b9e416e8d3265487 100644 (file)
@@ -102,8 +102,7 @@ ORDER BY p.payout_timestamp DESC",
                        while (list($pid, $total, $account, $bank, $type, $tstamp, $status, $allow, $url, $alt, $banner) = SQL_FETCHROW($result_payouts))
                        {
                                // Translate status
-                               $evl = "\$status = PAYOUT_MEMBER_STATUS_".strtoupper($status).";";
-                               eval($evl);
+                               $status = constant('PAYOUT_MEMBER_STATUS_'.strtoupper($status).'');
                                $status = "<FONT class=\"member_failed\">".$status."</FONT>";
 
                                // Nothing entered must be secured in member/what-payputs.php !