Two tickets resolved (57/89)
authorRoland Häder <roland@mxchange.org>
Sun, 22 Feb 2009 16:31:44 +0000 (16:31 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 22 Feb 2009 16:31:44 +0000 (16:31 +0000)
- debug backtrace rewritten which adds links in bugtracker (resolves #57)
- Code like "if (getConfig('foo_entry') == null)" rewritten to use
  isConfigEntrySet() (resolves #89)
- More constants and language strings rewritten

25 files changed:
beg.php
birthday_confirm.php
inc/databases.php
inc/db/lib-mysql3.php
inc/extensions/ext-birthday.php
inc/filters.php
inc/functions.php
inc/language/de.php
inc/libs/online_functions.php
inc/libs/surfbar_functions.php
inc/libs/user_functions.php
inc/modules/admin.php
inc/modules/guest/what-login.php
inc/modules/index.php
inc/modules/member/what-logout.php
inc/modules/member/what-order.php
inc/modules/sponsor.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/session.php
inc/stylesheet.php
index.php
mailid.php
show_bonus.php
surfbar.php

diff --git a/beg.php b/beg.php
index 123ff8054fe87e51bf0dfbd2c96d2fece20b44ec..ccf6edf2525eb1d5af30863ab89729205a657c82 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -51,7 +51,7 @@ require("inc/config.php");
 // Is the "beg" extension active?
 if (!EXT_IS_ACTIVE("beg")) {
        // Redirect to index
-       LOAD_URL("modules.php?module=index&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=beg");
+       LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=beg");
 } // END - if
 
 // Is the script installed?
@@ -74,7 +74,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                        array($_GET['uid']), __FILE__, __LINE__);
                        } else {
                                // Nickname entered but nickname is not active
-                               $msg = CODE_EXTENSION_PROBLEM;
+                               $msg = constant('CODE_EXTENSION_PROBLEM');
                                $uid = -1;
                        }
                } else {
@@ -96,9 +96,6 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                // Secure userid
                                $uid = bigintval($uid);
 
-                               // Calculate beg points
-                               mt_srand((double)microtime() * 10000000000 / time());
-
                                // Multiply configured values with 100000 and divide with 100000 so we can also handle small values
                                // If we need more number behind the decimal dot then we just need to increase all these three
                                // numbers matching to the numbers behind the decimal dot. Simple! ;-)
@@ -150,7 +147,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                }
 
                                // Pay points?
-                               if ($pay) {
+                               if ($pay === true) {
                                        // Add points to user or begging rallye account
                                        if (BEG_ADD_POINTS($uid, $points)) {
                                                // Set "done" message
@@ -169,9 +166,9 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                        } elseif (getConfig('beg_pay_mode') != "NONE") { // Other pay-mode active!
                                // Prepare content for template
                                $content = array(
-                                       'clicks' => __BEG_CLICKS,
-                                       'points' => __BEG_POINTS,
-                                       'uid'    => __BEG_UID
+                                       'clicks' => constant('__BEG_CLICKS'),
+                                       'points' => constant('__BEG_POINTS'),
+                                       'uid'    => constant('__BEG_UID')
                                );
 
                                // Load message template depending on pay-mode
@@ -215,17 +212,17 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                array($_GET['uid']), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Locked account
-                               $msg = CODE_ACCOUNT_LOCKED;
+                               $msg = constant('CODE_ACCOUNT_LOCKED');
                        } else {
                                // Invalid nickname! (404)
-                               $msg = CODE_USER_404;
+                               $msg = constant('CODE_USER_404');
                        }
 
                        // Free memory
                        SQL_FREERESULT($result);
                } elseif ($uid == getConfig('beg_uid')) {
                        // Webmaster's ID cannot beg for points!
-                       $msg = CODE_BEG_SAME_AS_OWN;
+                       $msg = constant('CODE_BEG_SAME_AS_OWN');
                }
 
                // Reload to index module
index f6f17c746d0fc50f9a85ddc8dd3255acace51853..ca7d8243bea41756e6fab757c2bfa7337169fe7f 100644 (file)
@@ -47,7 +47,7 @@ require("inc/config.php");
 // Is the "birthday" extension active?
 if (!EXT_IS_ACTIVE("birthday")) {
        // Redirect to index
-       LOAD_URL("modules.php?module=index&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=birthday");
+       LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=birthday");
 } // END - if
 
 // Is the script installed?
index df92e0ae1f264bd93f5aea38eb9962a814df0b22..81b40f415b1f389e7ebdae7a8e8ce2b37b774ead 100644 (file)
@@ -105,7 +105,7 @@ define('CURR_SVN_VERSION' , getActualVersion(2));
 define('_PRIME', 591623);
 
 // Calculate "entropy" with the prime number (for code generation)
-define('_ADD', (_PRIME * _PRIME / (pi() * getConfig('code_length') + 1)));
+define('_ADD', (constant('_PRIME') * constant('_PRIME') / (pi() * getConfig('code_length') + 1)));
 
 // Random number for e.g. the "cache-buster" used in OpenX script
 define('CACHE_BUSTER', mt_rand(1000000, 9999999));
index 58bdc436b241c7b869fadfe1709d57d813c18dc1..61d9be17fa1305e720669059823f380a1851389e 100644 (file)
@@ -90,7 +90,7 @@ Query string:<br />
        } // END - if
 
        // Count DB hits
-       if (getConfig('db_hits_run') == null) {
+       if (!isConfigEntrySet('db_hits_run')) {
                // Count in dummy variable
                setConfigEntry('db_hits_run', 1);
        } else {
@@ -103,7 +103,7 @@ Query string:<br />
 }
 
 // SQL num rows
-function SQL_NUMROWS($result) {
+function SQL_NUMROWS ($result) {
        // Is the result a valid resource?
        if (is_resource($result)) {
                // Get the count of rows from database
@@ -266,9 +266,13 @@ function SQL_QUERY_ESC ($qstring, $data, $file, $line, $run=true, $strip=true) {
        // Was the eval() command fine?
        if ($query == "failed") {
                // Something went wrong?
-               print "eval=".htmlentities($eval)."<pre>";
-               debug_print_backtrace();
-               die("</pre>");
+               printf("eval=%s\n<pre>%s</pre>",
+                       htmlentities($eval),
+                       debug_get_printable_backtrace()
+               );
+
+               // Abort further code executions
+               exit;
        } // END - if
 
        if ($run) {
index 07cdfd488f8eff5ad8f8444195c8ee08be6c5bb8..4a0e9d2612c0dd9ed24fba56445bdbc4cca71015 100644 (file)
@@ -122,7 +122,7 @@ PRIMARY KEY(id)
 
        case "0.2.8": // SQL queries for v0.2.8
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Vergessenes _OB_CACHING gesetzt.";
+               $UPDATE_NOTES = "Vergessenes <strong>_OB_CACHING</strong> gesetzt.";
                break;
 
        case "0.2.9": // SQL queries for v0.2.9
index 846668aa081dc65bc0457b484ba7fe8132bd84c4..8715aed08f4d3e0af8c05fdf5c4af5f37cc9375b 100644 (file)
@@ -104,6 +104,7 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
 
        // Init filters
        REGISTER_FILTER('init', 'UPDATE_LOGIN_DATA');
+       REGISTER_FILTER('init', 'INIT_RANDOMIZER');
 
        // Login failures handler
        REGISTER_FILTER('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES');
@@ -508,5 +509,11 @@ function FILTER_CHECK_ADMIN_ACL () {
        return $ret;
 }
 
+// Filter for initializing randomizer
+function FILTER_INIT_RANDOMIZER () {
+       // Simply init the randomizer with seed and _ADD value
+       mt_srand(make_seed() + constant('_ADD'));
+}
+
 //
 ?>
index 492bd3e90c4e59d0f2ea4f9c3b9ea2ced0ff7274..2ee2e1e2648972fae280c075f2c5f2596276302e 100644 (file)
@@ -60,7 +60,7 @@ function IS_INC_WRITEABLE($inc) {
 }
 
 // Output HTML code directly or "render" it. You addionally switch the new-line character off
-function OUTPUT_HTML ($HTML, $NEW_LINE = true) {
+function OUTPUT_HTML ($HTML, $newLine = true) {
        // Some global variables
        global $OUTPUT, $footer, $CSS;
 
@@ -71,28 +71,28 @@ function OUTPUT_HTML ($HTML, $NEW_LINE = true) {
                {
                case "render":
                        // That's why you don't need any \n at the end of your HTML code... :-)
-                       if (_OB_CACHING == "on") {
+                       if (constant('_OB_CACHING') == "on") {
                                // Output into PHP's internal buffer
                                OUTPUT_RAW($HTML);
 
                                // That's why you don't need any \n at the end of your HTML code... :-)
-                               if ($NEW_LINE) echo "\n";
+                               if ($newLine) echo "\n";
                        } else {
                                // Render mode for old or lame servers...
                                $OUTPUT .= $HTML;
 
                                // That's why you don't need any \n at the end of your HTML code... :-)
-                               if ($NEW_LINE) $OUTPUT .= "\n";
+                               if ($newLine) $OUTPUT .= "\n";
                        }
                        break;
 
                case "direct":
                        // If we are switching from render to direct output rendered code
-                       if ((!empty($OUTPUT)) && (_OB_CACHING != "on")) { OUTPUT_RAW($OUTPUT); $OUTPUT = ""; }
+                       if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != "on")) { OUTPUT_RAW($OUTPUT); $OUTPUT = ""; }
 
                        // The same as above... ^
                        OUTPUT_RAW($HTML);
-                       if ($NEW_LINE) echo "\n";
+                       if ($newLine) echo "\n";
                        break;
 
                default:
@@ -101,14 +101,14 @@ function OUTPUT_HTML ($HTML, $NEW_LINE = true) {
                        mxchange_die("<strong>{!FATAL_ERROR!}:</strong> {!LANG_NO_RENDER_DIRECT!}");
                        break;
                }
-       } elseif ((_OB_CACHING == "on") && ($footer == 1)) {
+       } elseif ((constant('_OB_CACHING') == "on") && ($footer == 1)) {
                // Headers already sent?
                if (headers_sent()) {
                        // Log this error
                        DEBUG_LOG(__FUNCTION__, __LINE__, "Headers already sent! We need debug backtrace here.");
 
                        // Trigger an user error
-                       trigger_error("Headers are already sent!");
+                       debug_report_bug("Headers are already sent!");
                } // END - if
 
                // Output cached HTML code
@@ -174,8 +174,8 @@ function OUTPUT_RAW ($HTML) {
        // Output stripped HTML code to avoid broken JavaScript code, etc.
        echo stripslashes(stripslashes($HTML));
 
-       // Flush the output if only _OB_CACHING is not "on"
-       if (_OB_CACHING != "on") {
+       // Flush the output if only constant('_OB_CACHING') is not "on"
+       if (constant('_OB_CACHING') != "on") {
                // Flush it
                flush();
        } // END - if
@@ -524,9 +524,6 @@ function GEN_PASS ($LEN = 0) {
        // Initialize array with all allowed chars
        $ABC = explode(",", "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9,-,+,_,/");
 
-       // Initialize randomizer
-       mt_srand((double) microtime() * 1000000);
-
        // Start creating password
        $PASS = "";
        for ($i = 0; $i < $LEN; $i++) {
@@ -584,7 +581,7 @@ function MAKE_DATETIME ($time, $mode="0")
 // Translates the american decimal dot into a german comma
 function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) {
        // Default is 3 you can change this in admin area "Misc -> Misc Options"
-       if (getConfig('max_comma') == null) setConfigEntry('max_comma', "3");
+       if (!isConfigEntrySet('max_comma')) setConfigEntry('max_comma', "3");
 
        // Use from config is default
        $maxComma = getConfig('max_comma');
@@ -913,11 +910,7 @@ function LOAD_URL($URL, $addUrlData=true) {
        }
 
        // Get output buffer
-       /*
-       print "<pre>";
-       debug_print_backtrace();
-       die("</pre>");
-       */
+       //* DEBUG: */ debug_report_bug();
        $OUTPUT = ob_get_contents();
 
        // Clear it only if there is content
@@ -937,11 +930,7 @@ function LOAD_URL($URL, $addUrlData=true) {
                OUTPUT_HTML("<a href=\"".$URL."\">".$URL."</a>");
        } elseif (!headers_sent()) {
                // Load URL when headers are not sent
-               /*
-               print("<pre>");
-               debug_print_backtrace();
-               die("</pre>URL={$URL}");
-               */
+               //* DEBUG: */ debug_report_bug("URL={$URL}");
                header ("Location: ".str_replace("&amp;", "&", $URL));
        } else {
                // Output error message
@@ -1256,17 +1245,17 @@ function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") {
        if (isset($GLOBALS['refid']))                           $data .= ":".$GLOBALS['refid'];
 
        // Calculate number for generating the code
-       $a = $code + _ADD - 1;
+       $a = $code + constant('_ADD') - 1;
 
        if (getConfig('master_hash') != null) {
                // Generate hash with master salt from modula of number with the prime number and other data
-               $saltedHash = generateHash(($a % _PRIME).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, getConfig('master_salt'));
+               $saltedHash = generateHash(($a % constant('_PRIME')).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, getConfig('master_salt'));
 
                // Create number from hash
                $rcode = hexdec(substr($saltedHash, strlen(getConfig('master_salt')), 9)) / abs(_MAX - $a + sqrt(_ADD)) / pi();
        } else {
                // Generate hash with "hash of site key" from modula of number with the prime number and other data
-               $saltedHash = generateHash(($a % _PRIME).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, substr(sha1(SITE_KEY), 0, 8));
+               $saltedHash = generateHash(($a % constant('_PRIME')).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, substr(sha1(SITE_KEY), 0, 8));
 
                // Create number from hash
                $rcode = hexdec(substr($saltedHash, 8, 9)) / abs(_MAX - $a + sqrt(_ADD)) / pi();
@@ -1292,12 +1281,10 @@ function bigintval($num, $castValue = true) {
        if ($castValue) $ret = (double)$ret;
 
        // Has the whole value changed?
+       // @TODO Remove this if() block if all is working fine
        if ("".$ret."" != "".$num."") {
                // Log the values
-               print("<pre>");
-               debug_print_backtrace();
-               die("</pre>");
-               DEBUG_LOG(__FUNCTION__, __LINE__, " num={$num},ret={$ret}");
+               debug_report_bug();
        } // END - if
 
        // Return result
@@ -2024,11 +2011,9 @@ function generateHash ($plainText, $salt = "") {
        } // END - if
 
        // Do we miss an arry element here?
-       if (getConfig('file_hash') == null) {
+       if (!isConfigEntrySet('file_hash')) {
                // Stop here
-               print("Missing file_hash in ".__FUNCTION__.". Backtrace:<pre>");
-               debug_print_backtrace();
-               die("</pre>");
+               debug_report_bug("Missing file_hash in ".__FUNCTION__.".");
        } // END - if
 
        // When the salt is empty build a new one, else use the first x configured characters as the salt
@@ -2037,16 +2022,16 @@ function generateHash ($plainText, $salt = "") {
                $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(PATH."inc/databases.php");
 
                // Build key string
-               $keys   = SITE_KEY.":".DATE_KEY.":".getConfig('secret_key').":".getConfig('file_hash').":".date("d-m-Y (l-F-T)", bigintval(getConfig('patch_ctime'))).":".getConfig('master_salt');
+               $keys   = constant('SITE_KEY').":".constant('DATE_KEY').":".getConfig('secret_key').":".getConfig('file_hash').":".date("d-m-Y (l-F-T)", bigintval(getConfig('patch_ctime'))).":".getConfig('master_salt');
 
                // Additional data
                $data = $plainText.":".uniqid(mt_rand(), true).":".time();
 
                // Calculate number for generating the code
-               $a = time() + _ADD - 1;
+               $a = time() + constant('_ADD') - 1;
 
                // Generate SHA1 sum from modula of number and the prime number
-               $sha1 = sha1(($a % _PRIME).$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a);
+               $sha1 = sha1(($a % constant('_PRIME')).$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a);
                //* DEBUG: */ echo "SHA1=".$sha1." (".strlen($sha1).")<br />";
                $sha1 = scrambleString($sha1);
                //* DEBUG: */ echo "Scrambled=".$sha1." (".strlen($sha1).")<br />";
@@ -2120,9 +2105,8 @@ function descrambleString($str) {
        return $orig;
 }
 //
-function genScrambleString($len) {
-       // Prepare randomizer and array for the numbers
-       mt_srand((double) microtime() * 1000000);
+function genScrambleString ($len) {
+       // Prepare array for the numbers
        $scrambleNumbers = array();
 
        // First we need to setup randomized numbers from 0 to 31
@@ -2143,6 +2127,7 @@ function genScrambleString($len) {
        $scrambleString = implode(":", $scrambleNumbers);
        return $scrambleString;
 }
+
 // Append data like session ID or referal ID to the given URL which would
 // normally be stored in cookies
 function ADD_URL_DATA ($URL) {
@@ -2151,7 +2136,7 @@ function ADD_URL_DATA ($URL) {
 
        // Determine URL binder
        $BIND = "?";
-       if (strpos($URL, "?") !== false) $BIND = "&";
+       if (strpos($URL, "?") !== false) $BIND = "&amp;";
 
        if ((!defined('__COOKIES')) || ((!__COOKIES))) {
                // Cookies are not accepted
@@ -2162,25 +2147,14 @@ function ADD_URL_DATA ($URL) {
                        // Not found! So let's set default here
                        $ADD .= $BIND."refid=".getConfig('def_refid');
                }
-
-               // Is there already added data? Then change the binder
-               if (!empty($ADD)) $BIND = "&";
-
-               // Add session ID
-               if ((!empty($_GET['PHPSESSID'])) && (strpos($URL, "PHPSESSID=") == 0)) {
-                       // Add session from URL
-                       $ADD .= $BIND."PHPSESSID=".SQL_ESCAPE(strip_tags($_GET['PHPSESSID']));
-               } else {
-                       // Add current session
-                       $ADD .= $BIND."PHPSESSID=".session_id();
-               }
        } // END - if
 
        // Add all together and return it
-       return $URL.$ADD;
+       return $URL . $ADD;
 }
+
 // Generate an PGP-like encrypted hash of given hash for e.g. cookies
-function generatePassString($passHash) {
+function generatePassString ($passHash) {
        // Return vanilla password hash
        $ret = $passHash;
 
@@ -2193,9 +2167,9 @@ function generatePassString($passHash) {
                        $part2 = hexdec(substr(getConfig('secret_key'), $start, 4));
                        $mod = dechex($idx);
                        if ($part1 > $part2) {
-                               $mod = dechex(sqrt(($part1 - $part2) * _PRIME / pi()));
+                               $mod = dechex(sqrt(($part1 - $part2) * constant('_PRIME') / pi()));
                        } elseif ($part2 > $part1) {
-                               $mod = dechex(sqrt(($part2 - $part1) * _PRIME / pi()));
+                               $mod = dechex(sqrt(($part2 - $part1) * constant('_PRIME') / pi()));
                        }
                        $mod = substr(round($mod), 0, 4);
                        $mod = str_repeat('0', 4-strlen($mod)).$mod;
@@ -2241,7 +2215,7 @@ function mxchange_die ($msg) {
        LOAD_TEMPLATE("admin_settings_saved", false, $msg);
 
        // Load footer
-       LOAD_INC("inc/footer.php");
+       LOAD_INC_ONCE("inc/footer.php");
 
        // Exit explicitly
        exit;
@@ -2404,9 +2378,7 @@ function merge_array ($array1, $array2) {
        }
 
        // Both are not arrays
-       print(__FUNCTION__.":<pre>");
-       debug_print_backtrace();
-       die("</pre>");
+       debug_report_bug(__FUNCTION__.":");
 }
 
 // Debug message logger
@@ -2666,19 +2638,19 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
                // No cache instance!
                DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
                return false;
-       } elseif ((getConfig('cache_admin_menu') == null) || (getConfig('cache_admin_menu') == "N")) {
+       } elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') == "N")) {
                // Caching disabled (currently experiemental!)
                return false;
        }
 
        // Experiemental feature!
-       trigger_error("<strong>Experimental feature:</strong> You have to delete the admin_*.cache files by yourself at this point.");
+       debug_report_bug("<strong>Experimental feature:</strong> You have to delete the admin_*.cache files by yourself at this point.");
 }
 
 // Translates the "pool type" into human-readable
 function TRANSLATE_POOL_TYPE ($type) {
-       // Default type is unknown
-       $translated = sprintf(POOL_TYPE_UNKNOWN, $type);
+       // Default type is unknown
+       $translated = sprintf(getMessage('POOL_TYPE_UNKNOWN'), $type);
 
        // Generate constant
        $constName = sprintf("POOL_TYPE_%s", $type);
@@ -2784,6 +2756,7 @@ function ADD_NEW_BONUS_MAIL ($data, $mode="", $output=true) {
                DEBUG_LOG(__FUNCTION__, __LINE__, " cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
        }
 }
+
 // Determines referal id and sets it
 function DETERMINE_REFID () {
        global $CLICK, $_SERVER;
@@ -2826,7 +2799,7 @@ function DETERMINE_REFID () {
 }
 
 // Destroys the admin session
-function DESTROY_ADMIN_SESSION ($destroy = true) {
+function destroyAdminSession ($destroy = true) {
        // Kill maybe existing session variables including array elements
        set_session('admin_login', "");
        set_session('admin_md5'  , "");
@@ -2835,7 +2808,7 @@ function DESTROY_ADMIN_SESSION ($destroy = true) {
 
        // Destroy session and return status
        if ($destroy) {
-               return @session_destroy();
+               return session_destroy();
        } // END - if
 
        // All fine if we shall not really destroy the session
@@ -2856,7 +2829,7 @@ function getConfig ($entry) {
        $value = null;
 
        // Is the entry there?
-       if (isset($_CONFIG[$entry])) {
+       if (isConfigEntrySet($entry)) {
                // Then use it
                $value = $_CONFIG[$entry];
        } // END - if
@@ -2876,8 +2849,26 @@ function setConfigEntry ($entry, $value) {
        $_CONFIG[$entry] = $value;
 }
 
-// @TODO Rewrite all language constants to this function.
+// Checks wether the given config entry is set
+function isConfigEntrySet ($entry) {
+       global $_CONFIG;
+       return (isset($_CONFIG[$entry]));
+}
+
+// Increment or init with given value or 1 as default the given config entry
+function incrementConfigEntry ($configEntry, $value=1) {
+       global $_CONFIG;
+
+       // Increment it if set or init it with 1
+       if (getConfig($configEntry) > 0) {
+               $_CONFIG[$configEntry] += $value;
+       } else {
+               $_CONFIG[$configEntry] = $value;
+       }
+}
+
 // "Getter" for language strings
+// @TODO Rewrite all language constants to this function.
 function getMessage ($messageId) {
        // Default is not found!
        $return = "!".$messageId."!";
@@ -2889,7 +2880,7 @@ function getMessage ($messageId) {
        } elseif (isset($GLOBALS['msg'][strtoupper($messageId)])) {
                // @DEPRECATED Language array element found in BIG_LETTERS
                $return = $GLOBALS['msg'][$messageId];
-       } elseif (defined(strtoupper($messageId))) {
+       } elseif (defined($messageId)) {
                // @DEPRECATED Deprecated constant found
                $return = constant($messageId);
        } else {
@@ -2993,18 +2984,6 @@ function THEME_GET_ID ($name) {
        return $id;
 }
 
-// Increment or init with given value or 1 as default the given config entry
-function incrementConfigEntry ($configEntry, $value=1) {
-       global $_CONFIG;
-
-       // Increment it if set or init it with 1
-       if (getConfig($configEntry) > 0) {
-               $_CONFIG[$configEntry] += $value;
-       } else {
-               $_CONFIG[$configEntry] = $value;
-       }
-}
-
 // Read a given file
 function READ_FILE ($FQFN, $sqlPrepare = false) {
        // Load the file
@@ -3047,7 +3026,7 @@ function WRITE_FILE ($FQFN, $content) {
 // Generates an error code from given account status
 function GEN_ERROR_CODE_FROM_ACCOUNT_STATUS ($status) {
        // Default error code if unknown account status
-       $ERROR = CODE_UNKNOWN_STATUS;
+       $ERROR = constant('CODE_UNKNOWN_STATUS');
 
        // Generate constant name
        $constantName = sprintf("CODE_ID_%s", $status);
@@ -3070,7 +3049,7 @@ function clearOutputBuffer () {
        // Trigger an error on failure
        if (!ob_end_clean()) {
                // Failed!
-               trigger_error(__FUNCTION__.": Failed to clean output buffer.");
+               debug_report_bug(__FUNCTION__.": Failed to clean output buffer.");
        } // END - if
 }
 
@@ -3100,8 +3079,9 @@ function getActualVersion ($type = 0) {
                }
        }
 
-       if ($new)  {
-               // no Revision-File or has no valid Data so read the Revision from the Server.
+       // Has it been updated?
+       if ($new === true)  {
+               // No Revision-File or has no valid Data so read the Revision from the Server.
                $version = GET_URL("check-updates3.php");
 
                // Prepare content
@@ -3158,6 +3138,96 @@ function LOAD_INC_ONCE ($INC) {
        } // END - if
 }
 
+// Back-ported from the new ship-simu engine. :-)
+function debug_get_printable_backtrace () {
+       // Init variable
+       $backtrace = "<ol>\n";
+
+       // Get and prepare backtrace for output
+       $backtraceArray = debug_backtrace();
+       foreach ($backtraceArray as $key => $trace) {
+               if (!isset($trace['file'])) $trace['file'] = __FILE__;
+               if (!isset($trace['line'])) $trace['line'] = __LINE__;
+               if (!isset($trace['args'])) $trace['args'] = array();
+               $backtrace .= "<li class=\"debug_list\"><span class=\"backtrace_file\">".basename($trace['file'])."</span>:".$trace['line'].", <span class=\"backtrace_function\">".$trace['function']."(".count($trace['args']).")</span></li>\n";
+       } // END - foreach
+
+       // Close it
+       $backtrace .= "</ol>\n";
+
+       // Return the backtrace
+       return $backtrace;
+}
+
+// Output a debug backtrace to the user
+function debug_report_bug ($message = "") {
+       // Init message
+       $debug = "";
+       // Is the optional message set?
+       if (!empty($message)) {
+               // Use and log it
+               $debug = sprintf("Note: %s<br />\n",
+                       $message
+               );
+
+               // @TODO Add a little more infos here
+               DEBUG_LOG(__FUNCTION__, __LINE__, $message);
+       } // END - if
+
+       // Add output
+       $debug .= ("Please report this error at <a href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a>:<pre>");
+       $debug .= (debug_get_printable_backtrace());
+       $debug .= ("</pre>Thank you for your help finding bugs.");
+
+       // And abort here
+       die($debug);
+}
+
+// Generates a ***weak*** seed (taken from de.php.net/mt_srand)
+function make_seed () {
+       list($usec, $sec) = explode(" ", microtime());
+       return ((float)$sec + (float)$usec);
+}
+
+// Converts a message code to a human-readable message
+function convertCodeToMessage ($code) {
+       $msg = "";
+       switch ($code) {
+               case constant('CODE_LOGOUT_DONE')      : $msg = getMessage('LOGOUT_DONE'); break;
+               case constant('CODE_LOGOUT_FAILED')    : $msg = "<span class=\"guest_failed\">{!LOGOUT_FAILED!}</span>"; break;
+               case constant('CODE_DATA_INVALID')     : $msg = getMessage('MAIL_DATA_INVALID'); break;
+               case constant('CODE_POSSIBLE_INVALID') : $msg = getMessage('MAIL_POSSIBLE_INVALID'); break;
+               case constant('CODE_ACCOUNT_LOCKED')   : $msg = getMessage('MEMBER_ACCOUNT_LOCKED_UNC'); break;
+               case constant('CODE_USER_404')         : $msg = getMessage('USER_NOT_FOUND'); break;
+               case constant('CODE_STATS_404')        : $msg = getMessage('MAIL_STATS_404'); break;
+               case constant('CODE_ALREADY_CONFIRMED'): $msg = getMessage('MAIL_ALREADY_CONFIRMED'); break;
+
+               case constant('CODE_ERROR_MAILID'):
+                       if (EXT_IS_ACTIVE($ext, true)) {
+                               $msg = getMessage('ERROR_CONFIRMING_MAIL');
+                       } else {
+                               $msg = sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), "mailid");
+                       }
+                       break;
+
+               case constant('CODE_EXTENSION_PROBLEM'):
+                       if (isset($_GET['ext'])) {
+                               $msg = sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), SQL_ESCAPE($_GET['ext']));
+                       } else {
+                               $msg = getMessage('EXTENSION_PROBLEM_UNSET_EXT');
+                       }
+                       break;
+
+               case constant('CODE_COOKIES_DISABLED') : $msg = getMessage('LOGIN_NO_COOKIES'); break;
+               case constant('CODE_BEG_SAME_AS_OWN')  : $msg = getMessage('BEG_SAME_UID_AS_OWN'); break;
+               case constant('CODE_LOGIN_FAILED')     : $msg = getMessage('LOGIN_FAILED_GENERAL'); break;
+               default                                : $msg = UNKNOWN_MAILID_CODE_1.$code.UNKNOWN_MAILID_CODE_2; break;
+       } // END - switch
+
+       // Return the message
+       return $msg;
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
index c71ee82fe33b3e268ade1b57bd06ebb607896b46..371a5c21b5e1419d63f3ff59c9920a312c94c172 100644 (file)
@@ -984,7 +984,6 @@ define('CLICK_NOW', "Klick!");
 define('MAILID_LINK', "Best.-Link");
 define('UNKNOWN_MAILID_CODE_1', "Unbekannter Fehler-Code <strong>");
 define('UNKNOWN_MAILID_CODE_2', "</strong> erkannt!");
-define('EXTENSION_PROBLEM_EXT_INACTIVE', "Erweiterung <strong>%s</strong> deaktiviert! Fehler: Kann nicht fortfahren!");
 define('CHANGE_GUEST_MENU', "Verdecken, anzeigen, deaktivieren, aktivieren des Gastmen&uuml;s");
 define('IS_LOCKED', "Ist gesperrt");
 define('ADMIN_REMOVE_STATS_ENTRY', "Hier klicken, um Mitgliederstatistik zu entfernen!");
@@ -1074,7 +1073,6 @@ define('DEFAULT_MT_WORD', "Mailtausch");
 define('DEFAULT_MT_WORD2', "Mailtausches");
 define('DEFAULT_MT_WORD3', "Mailtauscher");
 define('DEFAULT_POINTS', "Punkte");
-define('EXTENSION_PROBLEM_NOT_INSTALLED', "Erweiterung <span class=\"data\">%s</span> nicht installiert.");
 define('PROBLEM_POINTS_OVERVIEW_UNAVAILABLE', "{!POINTS!}-&Uuml;bersicht derzeit nicht verf&uuml;gbar.");
 define('ADMIN_NOTHING_SELECTED_CHANGE', "Sie haben nichts zum &Auml;ndern des Status ausgew&auml;hlt.");
 define('TEMPLATE_CONTENT', "Template-Content:");
@@ -1113,6 +1111,9 @@ define('ADMIN_POINTS_REPAYED', "Es wurden dem Mitglied <span class=\"data\">%s</
 define('ADMIN_POINTS_TO_JACKPOT', "Es wurden <span class=\"data\">%s</span> {!POINTS!} in den Jackpot gelegt.");
 define('ADMIN_NO_POINTS_REPAYED', "Die Mailbuchung hatte keine {!POINTS!} zum zur&uuml;ckbuchen!");
 define('ADMIN_POINTS_SHREDDED', "Es wurden <span class=\"data\">%s</span> {!POINTS!} geschrettert.");
+define('EXTENSION_PROBLEM_EXT_INACTIVE', "Erweiterung <strong>%s</strong> deaktiviert! Fehler: Kann nicht fortfahren!");
+define('EXTENSION_PROBLEM_NOT_INSTALLED', "Erweiterung <span class=\"data\">%s</span> nicht installiert.");
+define('EXTENSION_PROBLEM_UNSET_EXT', "Skriptfehler: Parameter <strong>ext</strong> nicht gesetzt!");
 define('EXTENSION_WARNING_EXT_INACTIVE', "Die Erweiterung <span class=\"data\">%s</span> ist nicht aktiv. Dies kann zu St&ouml;rungen f&uuml;hren.<br />\nBitte aktivieren Sie diese unter <em>Verschiedenes-&gt;Erweiterungen</em>.");
 define('EXTENSION_WARNING_USER_LIMIT', "Die Erweiterung <u>user</u> ist nicht aktiv. Die Anzahl User pro Seite wurde auf 100 gesetzt. Bitte aktivieren Sie diese unter <em>Verschiedenes-&gt;Erweiterungen</em>.");
 define('ADMIN_PROXY_SETTINGS_INVALID', "Ihre Proxy-Einstellungen scheinen ung&uuml;ltig zu sein!");
index 4e43875e37ba39023023ebd862532f89f6a7d915..96400dc2b1cfa6fe47533a29d061fa94a9d4d571 100644 (file)
@@ -39,17 +39,13 @@ if (!defined('__SECURITY')) {
 
 // Filter for updates/extends on the online list
 function FILTER_UPDATE_ONLINE_LIST () {
-       global $PHPSESSID;
-
        // Do not update online list when extension is deactivated
        if (!EXT_IS_ACTIVE("online", true)) return;
 
        // Empty session?
-       if (empty($PHPSESSID)) {
+       if (session_id() == "") {
                // This is invalid here!
-               print "Invalid session. Backtrace:<pre>";
-               debug_print_backtrace();
-               die("</pre>");
+               debug_report_bug("Invalid session.");
        } // END - if
 
        // Initialize variables
@@ -74,7 +70,7 @@ function FILTER_UPDATE_ONLINE_LIST () {
 
        // Now search for the user
        $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_online` WHERE sid='%s' LIMIT 1",
-               array($PHPSESSID), __FILE__, __LINE__);
+               array(session_id()), __FILE__, __LINE__);
 
        // Entry found?
        if (SQL_NUMROWS($result) == 1) {
@@ -99,7 +95,7 @@ WHERE sid='%s' LIMIT 1",
                                $MEM,
                                $ADMIN,
                                GET_REMOTE_ADDR(),
-                               $PHPSESSID
+                               session_id()
                        ), __FILE__, __LINE__
                );
        } else {
@@ -113,7 +109,7 @@ WHERE sid='%s' LIMIT 1",
                                $rid,
                                $MEM,
                                $ADMIN,
-                               $PHPSESSID,
+                               session_id(),
                                GET_REMOTE_ADDR()
                        ), __FILE__, __LINE__
                );
index 2dffd31ac940d5a143cec34c20e9a18604eb7e1e..fd99af7bf89f043399851ba0dbcc9261aeae73f3 100644 (file)
@@ -1621,8 +1621,8 @@ function SURFBAR_GET_DATA ($element) {
        } else { // END - if
                print("<pre>");
                print_r($SURFBAR_CACHE);
-               debug_print_backtrace();
-               die("</pre>");
+               print("</pre>");
+               debug_report_bug();
        }
 
        // Return result
index e5ecb1b7a8a507063b73b15c9d88e3e8ac6d68d0..bab177e564f7fb57ab7477956abd346ac5c92f08 100644 (file)
@@ -378,14 +378,14 @@ function USER_DO_LOGIN ($uid, $passwd) {
                        $ERROR = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
                } else {
                        // ID not found!
-                       $ERROR = CODE_WRONG_ID;
+                       $ERROR = constant('CODE_WRONG_ID');
                }
 
                // Construct URL
                $URL = "modules.php?module=index&amp;what=login&amp;login=".$ERROR;
        } else {
                // ID not found!
-               $URL = "modules.php?module=index&amp;what=login&amp;login=".CODE_WRONG_ID;
+               $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_WRONG_ID');
        }
 
        // Return URL
@@ -417,7 +417,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        } else {
                // Userid not set!
                DEBUG_LOG(__FUNCTION__, __LINE__, "Userid is not set! BUG!");
-               $ERROR = CODE_WRONG_ID;
+               $ERROR = constant('CODE_WRONG_ID');
        }
 
        // Any entry found?
index 30d4372fbcdc1a60432d6942b98d6139adcc7073..05336033fc0f9d58c1b52bf2f47078d6c27d09af 100644 (file)
@@ -61,7 +61,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                $hashedPass = md5($_POST['pass']);
 
                // Kill maybe existing session variables
-               DESTROY_ADMIN_SESSION(false);
+               destroyAdminSession(false);
 
                // Do registration
                $ret = REGISTER_ADMIN($_POST['login'], $hashedPass);
@@ -69,23 +69,23 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                {
                case "done":
                        admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
-                       if (!_FATAL) {
+                       if (!constant('_FATAL')) {
                                // Registering is done
                                LOAD_URL("modules.php?module=admin&amp;action=login&register=done");
                        } else {
-                               $ret = ADMIN_CANNOT_COMPLETE;
+                               $ret = getMessage('ADMIN_CANNOT_COMPLETE');
                        }
                        break;
 
                case "failed":
-                       $ret = ADMIN_REGISTER_FAILED;
+                       $ret = getMessage('ADMIN_REGISTER_FAILED');
                        break;
 
                case "already":
                default:
                        if ($ret == "already") {
                                // Admin does already exists!
-                               $ret = ADMIN_LOGIN_ALREADY_REG;
+                               $ret = getMessage('ADMIN_LOGIN_ALREADY_REG');
                        } else {
                                // Any other kind will be logged and interpreted as 'done'
                                DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown return code %s from CHECK_ADMIN_LOGIN()", $ret));
@@ -117,16 +117,16 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                // Yet-another "Notice" fix
                if ((!empty($_POST['ok'])) && ($_POST['ok'] == "***")) {
                        // No login entered?
-                       if (empty($_POST['login'])) $MSG1 = ADMIN_NO_LOGIN;
+                       if (empty($_POST['login'])) $MSG1 = getMessage('ADMIN_NO_LOGIN');
 
                        // An error comes back from registration?
                        if (!empty($ret)) $MSG1 = $ret;
 
                        // No password entered?
-                       if (empty($_POST['pass'])) $MSG2 = ADMIN_NO_PASS;
+                       if (empty($_POST['pass'])) $MSG2 = getMessage('ADMIN_NO_PASS');
 
                        // Or password too short?
-                       if (strlen($_POST['pass']) < 4) $MSG2 = ADMIN_SHORT_PASS;
+                       if (strlen($_POST['pass']) < 4) $MSG2 = getMessage('ADMIN_SHORT_PASS');
 
                        // Output error messages
                        define('__MSG_LOGIN', LOAD_TEMPLATE("admin_login_msg", true, $MSG1));
@@ -159,7 +159,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                $valid = ADMIN_VALIDATE_RESET_LINK_HASH_LOGIN($_POST['hash'], $_POST['login']);
 
                // Valid?
-               if ($valid) {
+               if ($valid === true) {
                        // Prepare content first
                        $content = array(
                                'hash'  => SQL_ESCAPE($_POST['hash']),
@@ -230,13 +230,13 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                case "404": // Administrator login not found
                        $_POST['ok'] = $ret;
                        $ret = getMessage('ADMIN_NOT_FOUND');
-                       DESTROY_ADMIN_SESSION();
+                       destroyAdminSession();
                        break;
 
                case "pass": // Wrong password
                        $_POST['ok'] = $ret;
                        $ret = "{!WRONG_PASS!} [<a href=\"{!URL!}/modules.php?module=admin&amp;reset_pass=1\">{!ADMIN_RESET_PASS!}</a>]\n";
-                       DESTROY_ADMIN_SESSION();
+                       destroyAdminSession();
                        break;
 
                default: // Others will be logged
@@ -258,16 +258,16 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                        $MSG1 = ""; $MSG2 = "";
 
                        // No login entered?
-                       if (empty($_POST['login'])) $MSG1 = ADMIN_NO_LOGIN;
+                       if (empty($_POST['login'])) $MSG1 = getMessage('ADMIN_NO_LOGIN');
 
                        // An error comes back from login?
                        if ((!empty($ret)) && ($_POST['ok'] == "404")) $MSG1 = $ret;
 
                        // No password entered?
-                       if (empty($_POST['pass'])) $MSG2 = ADMIN_NO_PASS;
+                       if (empty($_POST['pass'])) $MSG2 = getMessage('ADMIN_NO_PASS');
 
                        // Or password too short?
-                       if (strlen($_POST['pass']) < 4) $MSG2 = ADMIN_SHORT_PASS;
+                       if (strlen($_POST['pass']) < 4) $MSG2 = getMessage('ADMIN_SHORT_PASS');
 
                        // An error comes back from login?
                        if ((!empty($ret)) && ($_POST['ok'] == "pass")) $MSG2 = $ret;
@@ -309,7 +309,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
        } // END - if
 } elseif (isset($_GET['logout'])) {
        // Only try to remove cookies
-       if (DESTROY_ADMIN_SESSION()) {
+       if (destroyAdminSession()) {
                // Load logout template
                if (isset($_GET['register'])) {
                        // Secure input
@@ -329,10 +329,10 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                }
        } else {
                // Something went wrong here...
-               LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_fatal\">".ADMIN_LOGOUT_FAILED."</div>");
+               LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_fatal\">{!ADMIN_LOGOUT_FAILED!}</div>");
 
                // Add fatal message
-               addFatalMessage(CANNOT_UNREG_SESS);
+               addFatalMessage(getMessage('CANNOT_UNREG_SESS'));
        }
 } else {
        // Maybe an Admin want's to login?
@@ -344,7 +344,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                define('__ACL_ALLOW', RUN_FILTER('check_admin_acl'));
 
                // When type of admin menu is not set fallback to old menu system
-               if (getConfig('admin_menu') == null) setConfigEntry('admin_menu', "OLD");
+               if (!isConfigEntrySet('admin_menu')) setConfigEntry('admin_menu', "OLD");
 
                // Check for version and switch between old menu system and new "intelligent menu system"
                if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (FILE_READABLE(PATH."inc/modules/admin/lasys-inc.php"))) {
@@ -368,13 +368,13 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
 
        case "404": // Administrator login not found
                $_POST['ok'] = $ret;
-               DESTROY_ADMIN_SESSION();
+               destroyAdminSession();
                addFatalMessage(getMessage('ADMIN_NOT_FOUND'));
                break;
 
        case "pass": // Wrong password
                $_POST['ok'] = $ret;
-               DESTROY_ADMIN_SESSION();
+               destroyAdminSession();
                addFatalMessage(getMessage('WRONG_PASS'));
                break;
 
index 9b7ffe5dfc1e357def652d1ba75d1542b436b50d..0b6002d9ce7d294b6d4c568aec1dc22ba3fc7047 100644 (file)
@@ -85,7 +85,7 @@ if (IS_MEMBER()) {
        $URL = "modules.php?module=login";
 } elseif ((isset($_POST['ok'])) && ("".$uid."" != "".$_POST['id']."")) {
        // Invalid input (no nickname extension installed but nickname entered)
-       $ERROR = CODE_EXTENSION_PROBLEM;
+       $ERROR = constant('CODE_EXTENSION_PROBLEM');
 } elseif (isset($_POST['ok'])) {
        // Try the login (see inc/libs/user_functions.php)
        $URL = USER_DO_LOGIN($_POST['id'], $_POST['password']);
@@ -109,37 +109,37 @@ if (!empty($ERROR)) {
     <span class=\"guest_failed\">";
 
        switch ($ERROR) {
-               case CODE_WRONG_PASS:
-                       $MSG .= LOGIN_WRONG_PASS;
+               case constant('CODE_WRONG_PASS'):
+                       $MSG .= getMessage('LOGIN_WRONG_PASS');
                        break;
 
-               case CODE_WRONG_ID:
-                       $MSG .= LOGIN_WRONG_ID;
+               case constant('CODE_WRONG_ID'):
+                       $MSG .= getMessage('LOGIN_WRONG_ID');
                        break;
 
-               case CODE_ID_LOCKED:
-                       $MSG .= LOGIN_ID_LOCKED;
+               case constant('CODE_ID_LOCKED'):
+                       $MSG .= getMessage('LOGIN_ID_LOCKED');
                        break;
 
-               case CODE_ID_UNCONFIRMED:
-                       $MSG .= LOGIN_ID_UNCONFIRMED;
+               case constant('CODE_ID_UNCONFIRMED'):
+                       $MSG .= getMessage('LOGIN_ID_UNCONFIRMED');
                        break;
 
-               case CODE_NO_COOKIES:
-                       $MSG .= LOGIN_NO_COOKIES;
+               case constant('CODE_NO_COOKIES'):
+                       $MSG .= getMessage('LOGIN_NO_COOKIES');
                        break;
 
-               case CODE_EXTENSION_PROBLEM:
+               case constant('CODE_EXTENSION_PROBLEM'):
                        if (IS_ADMIN()) {
-                               $MSG .= sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "nickname");
+                               $MSG .= sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), "nickname");
                        } else {
-                               $MSG .= LOGIN_WRONG_ID;
+                               $MSG .= getMessage('LOGIN_WRONG_ID');
                        }
                        break;
 
                default:
                        DEBUG_LOG(__FILE__, __LINE__, sprintf("Unhandled error code %s detected.", $ERROR));
-                       $MSG .= LOGIN_WRONG_ID;
+                       $MSG .= getMessage('LOGIN_WRONG_ID');
                        break;
                }
                $MSG .= "</span>
index 686da74754c1ffd8b86c28e1e24bb542ec548978..27111a3f10b3b72ff64de8f1a7bdd80bb160e0f1 100644 (file)
@@ -55,29 +55,7 @@ if (!empty($_GET['msg'])) {
        if (!empty($_GET['ext'])) $ext = SQL_ESCAPE($_GET['ext']);
 
        // Which message shall we output?
-       switch ($_GET['msg']) {
-               case CODE_LOGOUT_DONE      : $msg = LOGOUT_DONE; break;
-               case CODE_LOGOUT_FAILED    : $msg = "<span class=\"guest_failed\">".LOGOUT_FAILED."</span>"; break;
-               case CODE_DATA_INVALID     : $msg = MAIL_DATA_INVALID; break;
-               case CODE_POSSIBLE_INVALID : $msg = MAIL_POSSIBLE_INVALID; break;
-               case CODE_ACCOUNT_LOCKED   : $msg = MEMBER_ACCOUNT_LOCKED_UNC; break;
-               case CODE_USER_404         : $msg = USER_NOT_FOUND; break;
-               case CODE_STATS_404        : $msg = MAIL_STATS_404; break;
-               case CODE_ALREADY_CONFIRMED: $msg = MAIL_ALREADY_CONFIRMED; break;
-
-               case CODE_ERROR_MAILID:
-                       if (EXT_IS_ACTIVE($ext, true)) { $msg = ERROR_CONFIRMING_MAIL; } else { $msg = sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid"); }
-                       break;
-
-               case CODE_EXTENSION_PROBLEM:
-                       $msg = sprintf(EXTENSION_PROBLEM_EXT_INACTIVE, $ext);
-                       break;
-
-               case CODE_COOKIES_DISABLED : $msg = LOGIN_NO_COOKIES; break;
-               case CODE_BEG_SAME_AS_OWN  : $msg = BEG_SAME_UID_AS_OWN; break;
-               case CODE_LOGIN_FAILED     : $msg = LOGIN_FAILED_GENERAL; break;
-               default                    : $msg = UNKNOWN_MAILID_CODE_1.$_GET['msg'].UNKNOWN_MAILID_CODE_2; break;
-       } // END - switch
+       $msg = convertCodeToMessage($_GET['msg']);
 
        // Load message template
        LOAD_TEMPLATE("message", false, $msg);
index 3eaf9e7583a136495b0e1bffc7814c03cd7d1971..39829c6c76bb075292b49707ee9c271fa9d59d4d 100644 (file)
@@ -40,20 +40,17 @@ if (!defined('__SECURITY')) {
 }
 
 // Base URL for redirection (both cases)
-$URL = "modules.php?module=index";
+$URL = "modules.php?module=index&amp;msg=";
 
 if (destroy_user_session()) {
        // Remove theme cookie as well
        set_session("mxchange_theme", "");
 
        // Logout completed
-       $URL .= "&amp;msg=".CODE_LOGOUT_DONE;
-
-       // Destroy session here
-       @session_destroy();
+       $URL .= constant('CODE_LOGOUT_DONE');
 } else {
        // Cannot logout! :-(
-       $URL .= "&amp;msg=".CODE_LOGOUT_FAILED;
+       $URL .= constant('CODE_LOGOUT_FAILED');
 }
 
 // Load the URL
index 3f39d1517ebb246835eff61b529c4a110ac20d6b..f55e82999df39b0c135e867cf82f58d13f1fb735 100644 (file)
@@ -113,7 +113,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        // Test submitted text against some filters (length, URLs in text etc.)
                        if ((strpos(strtolower($_POST['text']), "https://") > -1) || (strpos(strtolower($_POST['text']), "http://") > -1) || (strpos(strtolower($_POST['text']), "www") > -1)) {
                                // URL found!
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_URL_FOUND;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_URL_FOUND');
                        } // END - if
 
                        // Remove new-line and carriage-return characters
@@ -122,7 +122,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        // Text length within allowed length?
                        if (strlen($TEST) > getConfig('max_tlength')) {
                                // Text is too long!
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_OVERLENGTH;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_OVERLENGTH');
                        } // END - if
                } // END - if
 
@@ -132,7 +132,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        $_POST['subject'] = str_replace("\\", "[nl]", substr($_POST['subject'], 0, 200));
                        if ((strpos(strtolower($_POST['subject']), "http://") > -1) || (strpos(strtolower($_POST['subject']), "www") > -1)) {
                                // URL in subject found
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_SUBJ_URL;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_SUBJ_URL');
                        } // END - if
                } // END - if
 
@@ -147,7 +147,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                                list($blist) = SQL_FETCHROW($result);
 
                                // Create redirect-URL
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_BLIST_URL."&blist=".$blist;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_BLIST_URL')."&blist=".$blist;
                        } // END - if
 
                        // Free result
@@ -157,13 +157,13 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                // Enougth receivers entered?
                if (($_POST['receiver'] < getConfig('order_min')) && (!IS_ADMIN())) {
                        // Less than allowed receivers entered!
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_MORE_RECEIVERS3;
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS3');
                } // END - if
 
                // Validate URL
                if (!VALIDATE_URL($_POST['url'])) {
                        // URL is invalid!
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_INVALID_URL;
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_INVALID_URL');
                } // END - if
 
                // Probe for HTML extension
@@ -174,7 +174,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                                $_POST['text'] = HTML_CHECK_TAGS($_POST['text']);
 
                                // Maybe invalid tags found?
-                               if (empty($_POST['text'])) $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_INVALID_TAGS."&amp;id=".$id;
+                               if (empty($_POST['text'])) $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_INVALID_TAGS')."&amp;id=".$id;
                        } else {
                                // Remove any HTML code
                                $_POST['text'] = str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", $_POST['text']));
@@ -182,7 +182,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                }
        } elseif (!IS_ADMIN()) {
                // He has already sent a mail within a specific time
-               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_URL_TLOCK."&amp;id=".$id;
+               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_URL_TLOCK')."&amp;id=".$id;
        }
 
        // Still no error?
@@ -374,19 +374,19 @@ array(
                                $URL = "modules.php?module=frametester&amp;order=".$id."";
                        } elseif ($MAX_SEND == 0) {
                                // Not enougth receivers found which can receive mails
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_MORE_RECEIVERS2;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS2');
                        } else {
                                // No enougth points left!
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_MORE_POINTS;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_POINTS');
                        }
                } else  {
                        // Ordered more mails than he can send in this category
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_NO_RECS_LEFT;
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_NO_RECS_LEFT');
                }
        }
 } elseif ($_POST['receiver'] == "0") {
        // Not enougth receivers selected
-       $URL = "modules.php?module=login&amp;what=order&amp;msg=".CODE_MORE_RECEIVERS1;
+       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS1');
 } elseif (($ALLOWED == 0) && (getConfig('order_max_full') == "ORDER")) {
        // No more mail orders allowed
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_ORDER_ALLOWED_EXHAUSTED'));
@@ -417,7 +417,7 @@ array(
 
                                // Select users in current category
                                $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
-                                array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__);
+                                       array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__);
 
                                $uid_cnt = 0;
                                while (list($ucat) = SQL_FETCHROW($result_uids)) {
@@ -476,7 +476,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                $MSG = "";
                                switch ($_GET['msg'])
                                {
-                               case CODE_URL_TLOCK:
+                               case constant('CODE_URL_TLOCK'):
                                        $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
                                         array(bigintval($_GET['id'])), __FILE__, __LINE__);
 
@@ -497,53 +497,54 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        $SEC = getConfig('url_tlock') - $STD * 60 * 60 - $MIN * 60;
 
                                        // Finally contruct the message
-                                       $MSG = MEMBER_URL_TIME_LOCK."<br />".CONFIG_URL_TLOCK." ".$STD." ".
-                                               _HOURS.", ".$MIN." "._MINUTES." "._AND." ".$SEC." "._SECONDS."<br />".
-                                               MEMBER_LAST_TLOCK.": ".$LORDER;
+                                       // @TODO Rewrite this old lost code to a template
+                                       $MSG = "{!MEMBER_URL_TIME_LOCK!}<br />{!CONFIG_URL_TLOCK!} ".$STD."
+                                               {!_HOURS!}, ".$MIN." {!_MINUTES!} {!_AND!} ".$SEC." {!_SECONDS!}<br />
+                                               {!MEMBER_LAST_TLOCK!}: ".$LORDER;
                                        break;
 
-                               case CODE_OVERLENGTH:
-                                       $MSG = MEMBER_TEXT_OVERLENGTH;
+                               case constant('CODE_OVERLENGTH'):
+                                       $MSG = getMessage('MEMBER_TEXT_OVERLENGTH');
                                        break;
 
-                               case CODE_URL_FOUND:
-                                       $MSG = MEMBER_TEXT_CONTAINS_URL;
+                               case constant('CODE_URL_FOUND'):
+                                       $MSG = getMessage('MEMBER_TEXT_CONTAINS_URL');
                                        break;
 
-                               case CODE_SUBJ_URL:
-                                       $MSG = MEMBER_SUBJ_CONTAINS_URL;
+                               case constant('CODE_SUBJ_URL'):
+                                       $MSG = getMessage('MEMBER_SUBJ_CONTAINS_URL');
                                        break;
 
-                               case CODE_BLIST_URL:
-                                       $MSG = MEMBER_URL_BLACK_LISTED."<br />\n".MEMBER_BLIST_TIME.": ".MAKE_DATETIME($_GET['blist'], "0");
+                               case constant('CODE_BLIST_URL'):
+                                       $MSG = "{!MEMBER_URL_BLACK_LISTED!}<br />\n{!MEMBER_BLIST_TIME!}: ".MAKE_DATETIME($_GET['blist'], "0");
                                        break;
 
-                               case CODE_NO_RECS_LEFT:
-                                       $MSG = MEMBER_SELECTED_MORE_RECS;
+                               case constant('CODE_NO_RECS_LEFT'):
+                                       $MSG = getMessage('MEMBER_SELECTED_MORE_RECS');
                                        break;
 
-                               case CODE_INVALID_TAGS:
-                                       $MSG = MEMBER_HTML_INVALID_TAGS;
+                               case constant('CODE_INVALID_TAGS'):
+                                       $MSG = getMessage('MEMBER_HTML_INVALID_TAGS');
                                        break;
 
-                               case CODE_MORE_POINTS:
-                                       $MSG = MEMBER_MORE_POINTS_NEEDED;
+                               case constant('CODE_MORE_POINTS'):
+                                       $MSG = getMessage('MEMBER_MORE_POINTS_NEEDED');
                                        break;
 
-                               case CODE_MORE_RECEIVERS1:
-                                       $MSG = MEMBER_ENTER_MORE_RECEIVERS;
+                               case constant('CODE_MORE_RECEIVERS1'):
+                                       $MSG = getMessage('MEMBER_ENTER_MORE_RECEIVERS');
                                        break;
 
-                               case CODE_MORE_RECEIVERS2:
-                                       $MSG = MEMBER_NO_MORE_RECEIVERS_FOUND;
+                               case constant('CODE_MORE_RECEIVERS2'):
+                                       $MSG = getMessage('MEMBER_NO_MORE_RECEIVERS_FOUND');
                                        break;
 
-                               case CODE_MORE_RECEIVERS3:
-                                       $MSG = MEMBER_ENTER_MORE_MIN_RECEIVERS_1.getConfig('order_min').MEMBER_ENTER_MORE_MIN_RECEIVERS_2;
+                               case constant('CODE_MORE_RECEIVERS3'):
+                                       $MSG = "{!MEMBER_ENTER_MORE_MIN_RECEIVERS_1!}".getConfig('order_min')."{!MEMBER_ENTER_MORE_MIN_RECEIVERS_2!}";
                                        break;
 
-                               case CODE_INVALID_URL:
-                                       $MSG = MEMBER_ENTER_INVALID_URL;
+                               case constant('CODE_INVALID_URL'):
+                                       $MSG = getMessage('MEMBER_ENTER_INVALID_URL');
                                        break;
 
                                case "": // When no error code is included in the URL we do not need to output an error message as well...
@@ -551,7 +552,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
 
                                default:
                                        DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown error code %s detected.", $_GET['msg']));
-                                       $MSG = UNKNOWN_CODE_1.$_GET['msg'].UNKNOWN_CODE_2;
+                                       $MSG = "{!UNKNOWN_CODE_1!}".$_GET['msg']."{!UNKNOWN_CODE_2!}";
                                        break;
                                }
 
@@ -575,7 +576,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                switch (getConfig('order_max_full'))
                                {
                                case "MAX": // He is allowed to send as much as possible
-                                       define('ORDER_MAX_VALUE', ORDER_ALLOED_MAX);
+                                       define('ORDER_MAX_VALUE', getMessage('ORDER_ALLOED_MAX'));
                                        break;
 
                                case "ORDER": // He is allowed to send as much as he setup the receiving value
@@ -584,7 +585,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
 
                                default: // Unknown/invalid
                                        DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown order_mas_full config detected.", getConfig('order_max_full')));
-                                       define('ORDER_MAX_VALUE', ORDER_ALLOED_UNKNOWN);
+                                       define('ORDER_MAX_VALUE', getMessage('ORDER_ALLOED_UNKNOWN'));
                                        break;
                                }
 
@@ -622,7 +623,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        foreach ($CATS['id'] as $key => $value) {
                                                $CAT .= "      <option value=\"".$value."\"";
                                                if (($OLD_ORDER) && ($cat == $value)) $CAT .= " selected=\"selected\"";
-                                               $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." ".USER_IN_CAT.")</option>\n";
+                                               $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." {!USER_IN_CAT!})</option>\n";
                                        } // END - foreach
 
                                        // Mail type
@@ -633,7 +634,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                                        // Output option line
                                                        $type .= "      <option value=\"".$typeS[$key][0]."\"";
                                                        if (($OLD_ORDER) && ($payment == $typeS[$key][0])) $type .= " selected=\"selected\"";
-                                                       $type .= ">".$P." ".PER_MAIL." - ".$typeS[$key][3]." - ".round($typeS[$key][2])." ".PAYMENT."</option>\n";
+                                                       $type .= ">".$P." {!PER_MAIL!} - ".$typeS[$key][3]." - ".round($typeS[$key][2])." {!PAYMENT!}</option>\n";
                                                } // END - if
                                        } // END - foreach
 
index 4abb280e8553e007a30d0f1a4d7ba487d804d8e0..48ad6970cd6540bfaa7e930d7e40de8b36de0dd6 100644 (file)
@@ -35,11 +35,11 @@ if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
        require($INC);
 } elseif ((!EXT_IS_ACTIVE("sponsor"))
-       addFatalMessage(EXTENSION_PROBLEM_EXT_INACTIVE);
+       addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'));
        return;
 } elseif (!IS_SPONSOR()) {
        // No sponsor!
-       addFatalMessage(SPONSOR_ONLY_AREA_ENTERED);
+       addFatalMessage(getMessage('SPONSOR_ONLY_AREA_ENTERED'));
        return;
 } elseif (empty($GLOBALS['what'])) {
        // Empty what value detected!
index 697481ec2e48674f0d6af19a757eb61591047296..a84a8336c4ed6178e05c5cff11ddcf9ecfbea0f6 100644 (file)
@@ -71,14 +71,10 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) {
        // Output message to user and die
        if (EXT_IS_ACTIVE("debug")) {
                // Debug extension found! So Output a small message
-               mxchange_die("Error message written to debug.log. Please try to call <a href=\"".URL."\">the main page</a> to continue.");
+               mxchange_die("Error message written to debug.log. Please try to call <a href=\"{!URL!}\">the main page</a> to continue.");
        } else {
-               // No debug extension found
-               // @TODO Find a way to rewrite debug_print_backtrace() so we can maybe
-               // @TODO (?) rewrite this to mxchange_die()
-               print("Please report this error at <a href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a>:<pre>");
-               debug_print_backtrace();
-               die("</pre>Thank you for your help finding bugs.");
+               // No debug extension found, so regular output
+               debug_report_bug();
        }
 }
 
@@ -97,7 +93,7 @@ function __SHUTDOWN_HOOK () {
                SQL_CLOSE($link, __FILE__, __LINE__);
        } else {
                // No database link
-               addFatalMessage(NO_DB_LINK);
+               addFatalMessage(getMessage('NO_DB_LINK'));
        }
 }
 
index 6413d766877b4076ddb0a7e58799d0362b5eaf09..9484506fc9896cfc92060df76c2e21ef76a5f9a3 100644 (file)
@@ -681,14 +681,11 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false)
        // Run SQL command
        $result = SQL_QUERY($SQL, __FILE__, __LINE__);
        if ($UPDATE) {
-               if (SQL_AFFECTEDROWS() == 1) $ret = true;
-               //* DEBUG: */ debug_print_backtrace();
+               // Check updated/affected rows
+               $ret = (SQL_AFFECTEDROWS() == 1);
        } else {
-               if (SQL_NUMROWS($result) == 1) {
-                       //* DEBUG: */ echo __LINE__."+".$SQL."+<br />\n";
-                       //* DEBUG: */ echo __LINE__."*".$id."/".$wht."/".$wht2."*<br />\n";
-                       $ret = true;
-               }
+               // Check found rows
+               $ret = (SQL_NUMROWS($result) == 1);
        }
 
        // Free memory
index 37f988dd229cc3ed7f8639f868645aa8b09a30b5..9e0876c97fee12ee0203882fa82a138059b2214e 100644 (file)
@@ -48,13 +48,11 @@ if (($VIEW == 1) && ($_SERVER['PHP_SELF'])) return;
 // Set session save path if set
 if (getConfig('session_save_path') != "") {
        // Please make sure this valid!
-       @session_save_path(getConfig('session_save_path'));
+       session_save_path(getConfig('session_save_path'));
 } // END - if
 
 // Start the session
-@session_start();
-global $PHPSESSID;
-$PHPSESSID = @session_id();
+session_start();
 
 // Load language system
 LOAD_INC_ONCE("inc/language.php");
index 5c56b5632070c09f748812e1dfbf7400a6bb4b53..a84660c803eefb80d5ba1b4c1d2dc39594acab00 100644 (file)
@@ -46,7 +46,7 @@ $STYLES = array(
 if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css";
 
 // When no CSS output-mode is set, set it to file-output
-if (getConfig('css_php') == null) setConfigEntry('css_php', "FILE");
+if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', "FILE");
 
 // Output CSS files or content or link to css.php ?
 if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) {
index aed7b1e9c5aae036b64c9211ca9c2db32c9b7742..c19e9a2f7700ba38b02a3ecfa66fb67a3c0127fb 100644 (file)
--- a/index.php
+++ b/index.php
@@ -51,8 +51,8 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
        LOAD_INC("inc/header.php");
 
        // Fix missing array elements here
-       if (getConfig('index_delay') == null)  setConfigEntry('index_delay' , 0);
-       if (getConfig('index_cookie') == null) setConfigEntry('index_cookie', 0);
+       if (!isConfigEntrySet('index_delay'))  setConfigEntry('index_delay' , 0);
+       if (!isConfigEntrySet('index_cookie')) setConfigEntry('index_cookie', 0);
 
        // Check for cookies
        if ((isSessionVariableSet('visited')) || (getConfig('index_delay') == 0) || (getConfig('index_cookie') == 0)) {
index 5a33578dea7c3db9ff156e507018b0f8a8e60a87..e6002741710f8754ef42212b11f27a81534d473b 100644 (file)
@@ -48,7 +48,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
        // Is the extension active
        if (!EXT_IS_ACTIVE("mailid", true)) {
                // Is not activated/installed yet!
-               LOAD_URL("modules.php?module=index&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=mailid");
+               LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=mailid");
        } // END - if
 
        // Init
@@ -96,7 +96,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                // Is the bonus extension active?
                                if (!EXT_IS_ACTIVE("bonus")) {
                                        // Abort here
-                                       LOAD_URL("modules.php?module=index&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=mailid");
+                                       LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=mailid");
                                } // END - if
 
                                // Bonus-Mails
@@ -128,8 +128,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                case "NORMAL":
                                                        $result = SQL_QUERY_ESC("SELECT payment_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1",
                                                                array(bigintval($pool)), __FILE__, __LINE__);
-                                                       if (SQL_NUMROWS($result) == 1)
-                                                       {
+                                                       if (SQL_NUMROWS($result) == 1) {
                                                                list($pay) = SQL_FETCHROW($result);
                                                                $time      = GET_PAY_POINTS($pay, "time");
                                                                $payment   = GET_PAY_POINTS($pay, "payment");
@@ -143,8 +142,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                case "BONUS":
                                                        $result = SQL_QUERY_ESC("SELECT points, time FROM `{!_MYSQL_PREFIX!}_bonus` WHERE id=%s LIMIT 1",
                                                                array($url_bid), __FILE__, __LINE__);
-                                                       if (SQL_NUMROWS($result) == 1)
-                                                       {
+                                                       if (SQL_NUMROWS($result) == 1) {
                                                                list($points, $time) = SQL_FETCHROW($result);
                                                                $payment = "0.00000";
                                                                $VALID = true;
@@ -173,29 +171,29 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
                                                                // Load template
                                                                LOAD_TEMPLATE("mailid_frames");
                                                        } else {
-                                                               $msg = CODE_DATA_INVALID;
+                                                               $msg = constant('CODE_DATA_INVALID');
                                                        }
                                                } else {
-                                                       $msg = CODE_POSSIBLE_INVALID;
+                                                       $msg = constant('CODE_POSSIBLE_INVALID');
                                                }
                                        } else {
-                                               $msg = CODE_ACCOUNT_LOCKED;
+                                               $msg = constant('CODE_ACCOUNT_LOCKED');
                                        }
                                } else {
                                        SQL_FREERESULT($result);
-                                       $msg = CODE_USER_404;
+                                       $msg = constant('CODE_USER_404');
                                }
                        } else {
                                SQL_FREERESULT($result);
-                               $msg = CODE_STATS_404;
+                               $msg = constant('CODE_STATS_404');
                        }
                } else {
                        SQL_FREERESULT($result);
-                       $msg = CODE_ALREADY_CONFIRMED;
+                       $msg = constant('CODE_ALREADY_CONFIRMED');
                }
        } else {
                // Nothing entered
-               $msg = CODE_ERROR_MAILID;
+               $msg = constant('CODE_ERROR_MAILID');
        }
 
        // Error code is set?
@@ -211,7 +209,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
 
                        default:
                                DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s detected in mailid_error_redirect.", getConfig('mailid_error_redirect')));
-                               LOAD_URL("modules.php?module=index&amp;msg=".CODE_UNKNOWN_STATUS."&amp;ext=mailid");
+                               LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_UNKNOWN_STATUS')."&amp;ext=mailid");
                                break;
                }
        } else {
index 2987ae3f11fa6ff0250d3f660491ae6e15e20037..12629fb9d981d3c53565ef6f4ea9aae5544a9f62 100644 (file)
@@ -49,7 +49,7 @@ require("inc/config.php");
 // Is the "bonus" extension active?
 if (!EXT_IS_ACTIVE("bonus")) {
        // Redirect to index
-       LOAD_URL("modules.php?module=index&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=bonus");
+       LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=bonus");
 } // END - if
 
 // List only rankings when script is installed
index 6b458b247a23b36119fb92829e20fd87a7258b02..5adb2f674e61a21edcc48d880a8cb96aaea72631 100644 (file)
@@ -54,7 +54,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
        // Only logged in users may use this surfbar!
        if (!EXT_IS_ACTIVE("surfbar")) {
                // Surfbar deactivated
-               LOAD_URL("modules.php?module=login&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=surfbar");
+               LOAD_URL("modules.php?module=login&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=surfbar");
        } elseif (!IS_MEMBER()) {
                // Redirect
                LOAD_URL("modules.php?module=index");