Status codes rewritten to GLOBALS
authorRoland Häder <roland@mxchange.org>
Fri, 6 Mar 2009 21:51:44 +0000 (21:51 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Mar 2009 21:51:44 +0000 (21:51 +0000)
beg.php
inc/code-functions.php [new file with mode: 0644]
inc/databases.php
inc/functions.php
inc/libs/user_functions.php
inc/modules/guest/what-login.php
inc/modules/member/what-logout.php
inc/modules/member/what-order.php
inc/mysql-connect.php
inc/mysql-manager.php
mailid.php

diff --git a/beg.php b/beg.php
index 4446302f5190a711fd93fa163fc05c14c56f87ac..12c82521bf205efd5574a1062637e54caf7d56f4 100644 (file)
--- a/beg.php
+++ b/beg.php
@@ -76,7 +76,7 @@ if (isInstalled()) {
                                        array(REQUEST_GET('uid')), __FILE__, __LINE__);
                        } else {
                                // Nickname entered but nickname is not active
-                               $msg = constant('CODE_EXTENSION_PROBLEM');
+                               $msg = getCode('EXTENSION_PROBLEM');
                                $uid = -1;
                        }
                } else {
@@ -215,17 +215,17 @@ if (isInstalled()) {
                                array(REQUEST_GET('uid')), __FILE__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // Locked account
-                               $msg = constant('CODE_ACCOUNT_LOCKED');
+                               $msg = getCode('ACCOUNT_LOCKED');
                        } else {
                                // Invalid nickname! (404)
-                               $msg = constant('CODE_USER_404');
+                               $msg = getCode('USER_404');
                        }
 
                        // Free memory
                        SQL_FREERESULT($result);
                } elseif ($uid == getConfig('beg_uid')) {
                        // Webmaster's ID cannot beg for points!
-                       $msg = constant('CODE_BEG_SAME_AS_OWN');
+                       $msg = getCode('BEG_SAME_AS_OWN');
                }
 
                // Reload to index module
diff --git a/inc/code-functions.php b/inc/code-functions.php
new file mode 100644 (file)
index 0000000..313ace6
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 02/28/2009 *
+ * ===============                              Last change: 02/28/2009 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : code-functions.php                               *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for handling status codes              *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Funktionen zum Umgang mit Status-Funktionen      *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 856                                                    $ *
+ * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: stelzi                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
+       require($INC);
+}
+
+// Adds a code key/value pair to $GLOBALS
+function addCode ($key, $value) {
+       $GLOBALS['status_codes'][$key] = $value;
+}
+
+// Gets a code from the $GLOBALS registry or triggers an error if not found
+function getCode ($key) {
+       // Is the key set?
+       if (!isCodeSet($key)) {
+               // Abort here
+               trigger_error(sprintf("%s[%s:] Code %s is not set.",
+                       __FUNCTION__,
+                       __LINE__,
+                       $key
+               ));
+       } // END - if
+
+       // Return it
+       return $GLOBALS['status_codes'][$key];
+}
+
+// Checks wether a specified status code is set
+function isCodeSet ($key) {
+       // Simply use isset()
+       return (isset($GLOBALS['status_codes'][$key]));
+}
+
+// [EOF]
+?>
index 42c3be65247ba5be4dc10ac81b076e0cfe7a59ba..240174765f7914424da400fd2dd001c07b254128 100644 (file)
@@ -43,40 +43,40 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // System-wide return codes
-define('CODE_WRONG_PASS'       , 0x001);
-define('CODE_WRONG_ID'         , 0x002);
-define('CODE_ID_LOCKED'        , 0x003);
-define('CODE_ID_UNCONFIRMED'   , 0x004);
-define('CODE_UNKNOWN_STATUS'   , 0x005);
-define('CODE_NO_COOKIES'       , 0x006);
-define('CODE_CNTR_FAILED'      , 0x008);
-define('CODE_LOGOUT_DONE'      , 0x008);
-define('CODE_LOGOUT_FAILED'    , 0x009);
-define('CODE_URL_TLOCK'        , 0x00a);
-define('CODE_URL_FOUND'        , 0x00b);
-define('CODE_OVERLENGTH'       , 0x00c);
-define('CODE_SUBJ_URL'         , 0x00d);
-define('CODE_BLIST_URL'        , 0x00e);
-define('CODE_NO_RECS_LEFT'     , 0x00f);
-define('CODE_INVALID_TAGS'     , 0x010);
-define('CODE_MORE_POINTS'      , 0x011);
-define('CODE_COOKIES_DISABLED' , 0x012);
-define('CODE_DATA_INVALID'     , 0x013);
-define('CODE_POSSIBLE_INVALID' , 0x014);
-define('CODE_ACCOUNT_LOCKED'   , 0x015);
-define('CODE_USER_404'         , 0x016);
-define('CODE_STATS_404'        , 0x017);
-define('CODE_ALREADY_CONFIRMED', 0x018);
-define('CODE_ERROR_MAILID'     , 0x019);
-define('CODE_EXTENSION_PROBLEM', 0x01a);
-define('CODE_MORE_RECEIVERS1'  , 0x01b);
-define('CODE_MORE_RECEIVERS2'  , 0x01c);
-define('CODE_MORE_RECEIVERS3'  , 0x01d);
-define('CODE_INVALID_URL'      , 0x01e);
-define('CODE_MENU_NOT_VALID'   , 0x01f);
-define('CODE_LOGIN_FAILED'     , 0x020);
-define('CODE_BEG_SAME_AS_OWN'  , 0x021);
-define('CODE_UNHANDLED_STATUS' , 0x022);
+addCode('WRONG_PASS'       , 0x001);
+addCode('WRONG_ID'         , 0x002);
+addCode('ID_LOCKED'        , 0x003);
+addCode('ID_UNCONFIRMED'   , 0x004);
+addCode('UNKNOWN_STATUS'   , 0x005);
+addCode('NO_COOKIES'       , 0x006);
+addCode('CNTR_FAILED'      , 0x008);
+addCode('LOGOUT_DONE'      , 0x008);
+addCode('LOGOUT_FAILED'    , 0x009);
+addCode('URL_TLOCK'        , 0x00a);
+addCode('URL_FOUND'        , 0x00b);
+addCode('OVERLENGTH'       , 0x00c);
+addCode('SUBJ_URL'         , 0x00d);
+addCode('BLIST_URL'        , 0x00e);
+addCode('NO_RECS_LEFT'     , 0x00f);
+addCode('INVALID_TAGS'     , 0x010);
+addCode('MORE_POINTS'      , 0x011);
+addCode('COOKIES_DISABLED' , 0x012);
+addCode('DATA_INVALID'     , 0x013);
+addCode('POSSIBLE_INVALID' , 0x014);
+addCode('ACCOUNT_LOCKED'   , 0x015);
+addCode('USER_404'         , 0x016);
+addCode('STATS_404'        , 0x017);
+addCode('ALREADY_CONFIRMED', 0x018);
+addCode('ERROR_MAILID'     , 0x019);
+addCode('EXTENSION_PROBLEM', 0x01a);
+addCode('MORE_RECEIVERS1'  , 0x01b);
+addCode('MORE_RECEIVERS2'  , 0x01c);
+addCode('MORE_RECEIVERS3'  , 0x01d);
+addCode('INVALID_URL'      , 0x01e);
+addCode('MENU_NOT_VALID'   , 0x01f);
+addCode('LOGIN_FAILED'     , 0x020);
+addCode('BEG_SAME_AS_OWN'  , 0x021);
+addCode('UNHANDLED_STATUS' , 0x022);
 
 // Server-URL (DO NOT CHANGE THIS OR YOU CANNOT CHECK FOR UPDATES/EXTENSIONS!)
 define('SERVER_URL', "http://www.mxchange.org");
index 05cf4378aca2cccaf13b748751c61d0420ec2f75..4545846423668f31b61935d1a004fa80c1cf823c 100644 (file)
@@ -2498,15 +2498,15 @@ 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 = constant('CODE_UNKNOWN_STATUS');
+       $ERROR = getCode('UNKNOWN_STATUS');
 
        // Generate constant name
-       $constantName = sprintf("CODE_ID_%s", $status);
+       $constantName = sprintf("ID_%s", $status);
 
        // Is the constant there?
-       if (defined($constantName)) {
+       if (isCodeSet($constantName)) {
                // Then get it!
-               $ERROR = constant($constantName);
+               $ERROR = getCode($constantName);
        } else {
                // Unknown status
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown error status %s detected.", $status));
@@ -2732,16 +2732,16 @@ function generateSeed () {
 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'):
+               case getCode('LOGOUT_DONE')      : $msg = getMessage('LOGOUT_DONE'); break;
+               case getCode('LOGOUT_FAILED')    : $msg = "<span class=\"guest_failed\">{--LOGOUT_FAILED--}</span>"; break;
+               case getCode('DATA_INVALID')     : $msg = getMessage('MAIL_DATA_INVALID'); break;
+               case getCode('POSSIBLE_INVALID') : $msg = getMessage('MAIL_POSSIBLE_INVALID'); break;
+               case getCode('ACCOUNT_LOCKED')   : $msg = getMessage('MEMBER_ACCOUNT_LOCKED_UNC'); break;
+               case getCode('USER_404')         : $msg = getMessage('USER_NOT_FOUND'); break;
+               case getCode('STATS_404')        : $msg = getMessage('MAIL_STATS_404'); break;
+               case getCode('ALREADY_CONFIRMED'): $msg = getMessage('MAIL_ALREADY_CONFIRMED'); break;
+
+               case getCode('ERROR_MAILID'):
                        if (EXT_IS_ACTIVE($ext, true)) {
                                $msg = getMessage('ERROR_CONFIRMING_MAIL');
                        } else {
@@ -2749,7 +2749,7 @@ function convertCodeToMessage ($code) {
                        }
                        break;
 
-               case constant('CODE_EXTENSION_PROBLEM'):
+               case getCode('EXTENSION_PROBLEM'):
                        if (REQUEST_ISSET_GET(('ext'))) {
                                $msg = sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), REQUEST_GET(('ext')));
                        } else {
@@ -2757,9 +2757,9 @@ function convertCodeToMessage ($code) {
                        }
                        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;
+               case getCode('COOKIES_DISABLED') : $msg = getMessage('LOGIN_NO_COOKIES'); break;
+               case getCode('BEG_SAME_AS_OWN')  : $msg = getMessage('BEG_SAME_UID_AS_OWN'); break;
+               case getCode('LOGIN_FAILED')     : $msg = getMessage('LOGIN_FAILED_GENERAL'); break;
                default                                : $msg = sprintf(getMessage('UNKNOWN_MAILID_CODE'), $code); break;
        } // END - switch
 
@@ -2773,7 +2773,7 @@ function REDIRCT_ON_UNINSTALLED_EXTENSION ($ext_name) {
        // Is the extension uninstalled/inactive?
        if (!EXT_IS_ACTIVE($ext_name)) {
                // Redirect to index
-               LOAD_URL("modules.php?module=index&amp;msg=".constant('CODE_EXTENSION_PROBLEM')."&amp;ext=".$ext_name);
+               LOAD_URL("modules.php?module=index&amp;msg=".getCode('EXTENSION_PROBLEM')."&amp;ext=".$ext_name);
        } // END - if
 }
 
index 84717f3809b8ad7e9ab27502a5baf42f221de2f2..95200502da5d21970edc5bd03620e751d44b7208 100644 (file)
@@ -351,11 +351,11 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                        }
                                } else {
                                        // Cannot update counter!
-                                       $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_CNTR_FAILED');
+                                       $URL = "modules.php?module=index&amp;what=login&amp;login=".getCode('CNTR_FAILED');
                                }
                        } else {
                                // Cookies not setable!
-                               $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_NO_COOKIES');
+                               $URL = "modules.php?module=index&amp;what=login&amp;login=".getCode('NO_COOKIES');
                        }
                } elseif (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
                        // Update failture counter
@@ -363,7 +363,7 @@ function USER_DO_LOGIN ($uid, $passwd) {
                                array($uid), __FUNCTION__, __LINE__);
 
                        // Wrong password!
-                       $URL = "modules.php?module=index&amp;what=login&amp;login=".constant('CODE_WRONG_PASS');
+                       $URL = "modules.php?module=index&amp;what=login&amp;login=".getCode('WRONG_PASS');
                }
        } elseif ((($probe_nickname) && (!empty($uid2))) || ($uid2 == $uid)) {
                // Other account status?
@@ -380,14 +380,14 @@ function USER_DO_LOGIN ($uid, $passwd) {
                        $ERROR = GEN_ERROR_CODE_FROM_ACCOUNT_STATUS($status);
                } else {
                        // ID not found!
-                       $ERROR = constant('CODE_WRONG_ID');
+                       $ERROR = getCode('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=".constant('CODE_WRONG_ID');
+               $URL = "modules.php?module=index&amp;what=login&amp;login=".getCode('WRONG_ID');
        }
 
        // Return URL
@@ -419,7 +419,7 @@ function USER_DO_NEW_PASSWORD ($email, $uid) {
        } else {
                // Userid not set!
                DEBUG_LOG(__FUNCTION__, __LINE__, "Userid is not set! BUG!");
-               $ERROR = constant('CODE_WRONG_ID');
+               $ERROR = getCode('WRONG_ID');
        }
 
        // Any entry found?
index 0c942a81ee5558fcea3461e88ba57e6caa934fb2..e8b3dfc6a9206d1c33318f01348ad774892f45ef 100644 (file)
@@ -90,7 +90,7 @@ if (IS_MEMBER()) {
        $URL = "modules.php?module=login";
 } elseif ((IS_FORM_SENT()) && ("".$uid."" != "".REQUEST_POST('id')."")) {
        // Invalid input (no nickname extension installed but nickname entered)
-       $ERROR = constant('CODE_EXTENSION_PROBLEM');
+       $ERROR = getCode('EXTENSION_PROBLEM');
 } elseif (IS_FORM_SENT()) {
        // Try the login (see inc/libs/user_functions.php)
        $URL = USER_DO_LOGIN(REQUEST_POST('id'), REQUEST_POST('password'));
@@ -114,27 +114,27 @@ if (!empty($ERROR)) {
     <span class=\"guest_failed\">";
 
        switch ($ERROR) {
-               case constant('CODE_WRONG_PASS'):
+               case getCode('WRONG_PASS'):
                        $MSG .= getMessage('LOGIN_WRONG_PASS');
                        break;
 
-               case constant('CODE_WRONG_ID'):
+               case getCode('WRONG_ID'):
                        $MSG .= getMessage('LOGIN_WRONG_ID');
                        break;
 
-               case constant('CODE_ID_LOCKED'):
+               case getCode('ID_LOCKED'):
                        $MSG .= getMessage('LOGIN_ID_LOCKED');
                        break;
 
-               case constant('CODE_ID_UNCONFIRMED'):
+               case getCode('ID_UNCONFIRMED'):
                        $MSG .= getMessage('LOGIN_ID_UNCONFIRMED');
                        break;
 
-               case constant('CODE_NO_COOKIES'):
+               case getCode('NO_COOKIES'):
                        $MSG .= getMessage('LOGIN_NO_COOKIES');
                        break;
 
-               case constant('CODE_EXTENSION_PROBLEM'):
+               case getCode('EXTENSION_PROBLEM'):
                        if (IS_ADMIN()) {
                                $MSG .= sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), "nickname");
                        } else {
index d89d0ceeb2a410c4dd06a83ad72a214bff80efa7..aa9f5bc2869a81e2179cac5914ad2b2450f4ba27 100644 (file)
@@ -52,10 +52,10 @@ if (destroy_user_session()) {
        set_session("mxchange_theme", "");
 
        // Logout completed
-       $URL .= constant('CODE_LOGOUT_DONE');
+       $URL .= getCode('LOGOUT_DONE');
 } else {
        // Cannot logout! :-(
-       $URL .= constant('CODE_LOGOUT_FAILED');
+       $URL .= getCode('LOGOUT_FAILED');
 }
 
 // Load the URL
index 54c841fe089437da886e28d5956e6543cec2b95a..1b7b283a805bca9cda0b9f4bebd54ce4d82f1160 100644 (file)
@@ -118,7 +118,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(REQUEST_POST('text')), "https://") > -1) || (strpos(strtolower(REQUEST_POST('text')), "http://") > -1) || (strpos(strtolower(REQUEST_POST('text')), "www") > -1)) {
                                // URL found!
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_URL_FOUND');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('URL_FOUND');
                        } // END - if
 
                        // Remove new-line and carriage-return characters
@@ -127,7 +127,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=".constant('CODE_OVERLENGTH');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('OVERLENGTH');
                        } // END - if
                } // END - if
 
@@ -137,7 +137,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        REQUEST_SET_POST('subject', str_replace("\\", "[nl]", substr(REQUEST_POST('subject'), 0, 200)));
                        if ((strpos(strtolower(REQUEST_POST('subject')), "http://") > -1) || (strpos(strtolower(REQUEST_POST('subject')), "www") > -1)) {
                                // URL in subject found
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_SUBJ_URL');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('SUBJ_URL');
                        } // END - if
                } // END - if
 
@@ -152,7 +152,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=".constant('CODE_BLIST_URL')."&amp;blist=".$blist;
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('BLIST_URL')."&amp;blist=".$blist;
                        } // END - if
 
                        // Free result
@@ -162,13 +162,13 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                // Enougth receivers entered?
                if ((REQUEST_POST('receiver') < getConfig('order_min')) && (!IS_ADMIN())) {
                        // Less than allowed receivers entered!
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS3');
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_RECEIVERS3');
                } // END - if
 
                // Validate URL
                if (!VALIDATE_URL(REQUEST_POST('url'))) {
                        // URL is invalid!
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_INVALID_URL');
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('INVALID_URL');
                } // END - if
 
                // Probe for HTML extension
@@ -179,7 +179,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                                REQUEST_SET_POST('text', HTML_CHECK_TAGS(REQUEST_POST('text')));
 
                                // Maybe invalid tags found?
-                               if (!REQUEST_ISSET_POST(('text'))) $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_INVALID_TAGS')."&amp;id=".$id;
+                               if (!REQUEST_ISSET_POST(('text'))) $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('INVALID_TAGS')."&amp;id=".$id;
                        } else {
                                // Remove any HTML code
                                REQUEST_SET_POST('text', str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", REQUEST_POST('text'))));
@@ -187,7 +187,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=".constant('CODE_URL_TLOCK')."&amp;id=".$id;
+               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('URL_TLOCK')."&amp;id=".$id;
        }
 
        // Still no error?
@@ -379,19 +379,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=".constant('CODE_MORE_RECEIVERS2');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_RECEIVERS2');
                        } else {
                                // No enougth points left!
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_POINTS');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_POINTS');
                        }
                } else  {
                        // Ordered more mails than he can send in this category
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_NO_RECS_LEFT');
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('NO_RECS_LEFT');
                }
        }
 } elseif (REQUEST_POST('receiver') == "0") {
        // Not enougth receivers selected
-       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS1');
+       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('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'));
@@ -481,7 +481,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                $MSG = "";
                                switch (REQUEST_GET('msg'))
                                {
-                               case constant('CODE_URL_TLOCK'):
+                               case getCode('URL_TLOCK'):
                                        $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
                                         array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
@@ -508,47 +508,47 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                                {--MEMBER_LAST_TLOCK--}: ".$LORDER;
                                        break;
 
-                               case constant('CODE_OVERLENGTH'):
+                               case getCode('OVERLENGTH'):
                                        $MSG = getMessage('MEMBER_TEXT_OVERLENGTH');
                                        break;
 
-                               case constant('CODE_URL_FOUND'):
+                               case getCode('URL_FOUND'):
                                        $MSG = getMessage('MEMBER_TEXT_CONTAINS_URL');
                                        break;
 
-                               case constant('CODE_SUBJ_URL'):
+                               case getCode('SUBJ_URL'):
                                        $MSG = getMessage('MEMBER_SUBJ_CONTAINS_URL');
                                        break;
 
-                               case constant('CODE_BLIST_URL'):
+                               case getCode('BLIST_URL'):
                                        $MSG = "{--MEMBER_URL_BLACK_LISTED--}<br />\n{--MEMBER_BLIST_TIME--}: ".MAKE_DATETIME(REQUEST_GET('blist'), "0");
                                        break;
 
-                               case constant('CODE_NO_RECS_LEFT'):
+                               case getCode('NO_RECS_LEFT'):
                                        $MSG = getMessage('MEMBER_SELECTED_MORE_RECS');
                                        break;
 
-                               case constant('CODE_INVALID_TAGS'):
+                               case getCode('INVALID_TAGS'):
                                        $MSG = getMessage('MEMBER_HTML_INVALID_TAGS');
                                        break;
 
-                               case constant('CODE_MORE_POINTS'):
+                               case getCode('MORE_POINTS'):
                                        $MSG = getMessage('MEMBER_MORE_POINTS_NEEDED');
                                        break;
 
-                               case constant('CODE_MORE_RECEIVERS1'):
+                               case getCode('MORE_RECEIVERS1'):
                                        $MSG = getMessage('MEMBER_ENTER_MORE_RECEIVERS');
                                        break;
 
-                               case constant('CODE_MORE_RECEIVERS2'):
+                               case getCode('MORE_RECEIVERS2'):
                                        $MSG = getMessage('MEMBER_NO_MORE_RECEIVERS_FOUND');
                                        break;
 
-                               case constant('CODE_MORE_RECEIVERS3'):
+                               case getCode('MORE_RECEIVERS3'):
                                        $MSG = sprintf(getMessage('MEMBER_ENTER_MORE_MIN_RECEIVERS'), getConfig('order_min'));
                                        break;
 
-                               case constant('CODE_INVALID_URL'):
+                               case getCode('INVALID_URL'):
                                        $MSG = getMessage('MEMBER_ENTER_INVALID_URL');
                                        break;
 
index 2a442bf48170a7589aa01404d595f9a88928a096..e8650d08a26ba70836d396d633080bd731edae20 100644 (file)
@@ -49,7 +49,7 @@ define('DEBUG_SQL', false);
 require("inc/functions.php");
 
 // Load more function libraries or includes
-foreach (array('request-functions', 'session-functions', 'config-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks') as $lib) {
+foreach (array('request-functions', 'session-functions', 'config-functions', 'code-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks') as $lib) {
        // Load special functions
        LOAD_INC_ONCE(sprintf("inc/%s.php", $lib));
 } // END - foreach
index 5a5724fa1d3c150d37e0d43be5bcc0f8322b71b7..4ffb8e4167a311c7647a452fdcfad9e74266d3ea 100644 (file)
@@ -362,7 +362,7 @@ function ADD_MENU ($MODE, $act, $wht) {
 
        // is the menu action valid?
        if (!VALIDATE_MENU_ACTION($MODE, $act, $wht, true)) {
-               return getMessage('CODE_MENU_NOT_VALID');
+               return getCode('MENU_NOT_VALID');
        } // END - if
 
        // Non-admin shall not see all menus
index 561d51b9eabf035d71474e41332f021a4542cf8e..92be8e30ac9d878d737e5bed78eeef7659386166 100644 (file)
@@ -171,29 +171,29 @@ if (isInstalled()) {
                                                                // Load template
                                                                LOAD_TEMPLATE("mailid_frames");
                                                        } else {
-                                                               $msg = constant('CODE_DATA_INVALID');
+                                                               $msg = getCode('DATA_INVALID');
                                                        }
                                                } else {
-                                                       $msg = constant('CODE_POSSIBLE_INVALID');
+                                                       $msg = getCode('POSSIBLE_INVALID');
                                                }
                                        } else {
-                                               $msg = constant('CODE_ACCOUNT_LOCKED');
+                                               $msg = getCode('ACCOUNT_LOCKED');
                                        }
                                } else {
                                        SQL_FREERESULT($result);
-                                       $msg = constant('CODE_USER_404');
+                                       $msg = getCode('USER_404');
                                }
                        } else {
                                SQL_FREERESULT($result);
-                               $msg = constant('CODE_STATS_404');
+                               $msg = getCode('STATS_404');
                        }
                } else {
                        SQL_FREERESULT($result);
-                       $msg = constant('CODE_ALREADY_CONFIRMED');
+                       $msg = getCode('ALREADY_CONFIRMED');
                }
        } else {
                // Nothing entered
-               $msg = constant('CODE_ERROR_MAILID');
+               $msg = getCode('ERROR_MAILID');
        }
 
        // Error code is set?
@@ -209,7 +209,7 @@ if (isInstalled()) {
 
                        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=".constant('CODE_UNKNOWN_STATUS')."&amp;ext=mailid");
+                               LOAD_URL("modules.php?module=index&amp;msg=".getCode('UNKNOWN_STATUS')."&amp;ext=mailid");
                                break;
                }
        } else {