From 2bda7ccdfd87b065a61ff976b5f9e98e46f73591 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 6 Mar 2009 21:51:44 +0000 Subject: [PATCH] Status codes rewritten to GLOBALS --- beg.php | 8 ++-- inc/code-functions.php | 73 ++++++++++++++++++++++++++++++ inc/databases.php | 68 ++++++++++++++-------------- inc/functions.php | 38 ++++++++-------- inc/libs/user_functions.php | 12 ++--- inc/modules/guest/what-login.php | 14 +++--- inc/modules/member/what-logout.php | 4 +- inc/modules/member/what-order.php | 48 ++++++++++---------- inc/mysql-connect.php | 2 +- inc/mysql-manager.php | 2 +- mailid.php | 16 +++---- 11 files changed, 179 insertions(+), 106 deletions(-) create mode 100644 inc/code-functions.php diff --git a/beg.php b/beg.php index 4446302f51..12c82521bf 100644 --- 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 index 0000000000..313ace68f9 --- /dev/null +++ b/inc/code-functions.php @@ -0,0 +1,73 @@ + diff --git a/inc/databases.php b/inc/databases.php index 42c3be6524..240174765f 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -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"); diff --git a/inc/functions.php b/inc/functions.php index 05cf4378ac..4545846423 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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 = "{--LOGOUT_FAILED--}"; 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 = "{--LOGOUT_FAILED--}"; 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&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=".$ext_name); + LOAD_URL("modules.php?module=index&msg=".getCode('EXTENSION_PROBLEM')."&ext=".$ext_name); } // END - if } diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 84717f3809..95200502da 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -351,11 +351,11 @@ function USER_DO_LOGIN ($uid, $passwd) { } } else { // Cannot update counter! - $URL = "modules.php?module=index&what=login&login=".constant('CODE_CNTR_FAILED'); + $URL = "modules.php?module=index&what=login&login=".getCode('CNTR_FAILED'); } } else { // Cookies not setable! - $URL = "modules.php?module=index&what=login&login=".constant('CODE_NO_COOKIES'); + $URL = "modules.php?module=index&what=login&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&what=login&login=".constant('CODE_WRONG_PASS'); + $URL = "modules.php?module=index&what=login&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&what=login&login=".$ERROR; } else { // ID not found! - $URL = "modules.php?module=index&what=login&login=".constant('CODE_WRONG_ID'); + $URL = "modules.php?module=index&what=login&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? diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 0c942a81ee..e8b3dfc6a9 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -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)) { "; 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 { diff --git a/inc/modules/member/what-logout.php b/inc/modules/member/what-logout.php index d89d0ceeb2..aa9f5bc286 100644 --- a/inc/modules/member/what-logout.php +++ b/inc/modules/member/what-logout.php @@ -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 diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index 54c841fe08..1b7b283a80 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -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&what=order&msg=".constant('CODE_URL_FOUND'); + $URL = "modules.php?module=login&what=order&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&what=order&msg=".constant('CODE_OVERLENGTH'); + $URL = "modules.php?module=login&what=order&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&what=order&msg=".constant('CODE_SUBJ_URL'); + $URL = "modules.php?module=login&what=order&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&what=order&msg=".constant('CODE_BLIST_URL')."&blist=".$blist; + $URL = "modules.php?module=login&what=order&msg=".getCode('BLIST_URL')."&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&what=order&msg=".constant('CODE_MORE_RECEIVERS3'); + $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_RECEIVERS3'); } // END - if // Validate URL if (!VALIDATE_URL(REQUEST_POST('url'))) { // URL is invalid! - $URL = "modules.php?module=login&what=order&msg=".constant('CODE_INVALID_URL'); + $URL = "modules.php?module=login&what=order&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&what=order&msg=".constant('CODE_INVALID_TAGS')."&id=".$id; + if (!REQUEST_ISSET_POST(('text'))) $URL = "modules.php?module=login&what=order&msg=".getCode('INVALID_TAGS')."&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&what=order&msg=".constant('CODE_URL_TLOCK')."&id=".$id; + $URL = "modules.php?module=login&what=order&msg=".getCode('URL_TLOCK')."&id=".$id; } // Still no error? @@ -379,19 +379,19 @@ array( $URL = "modules.php?module=frametester&order=".$id.""; } elseif ($MAX_SEND == 0) { // Not enougth receivers found which can receive mails - $URL = "modules.php?module=login&what=order&msg=".constant('CODE_MORE_RECEIVERS2'); + $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_RECEIVERS2'); } else { // No enougth points left! - $URL = "modules.php?module=login&what=order&msg=".constant('CODE_MORE_POINTS'); + $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_POINTS'); } } else { // Ordered more mails than he can send in this category - $URL = "modules.php?module=login&what=order&msg=".constant('CODE_NO_RECS_LEFT'); + $URL = "modules.php?module=login&what=order&msg=".getCode('NO_RECS_LEFT'); } } } elseif (REQUEST_POST('receiver') == "0") { // Not enougth receivers selected - $URL = "modules.php?module=login&what=order&msg=".constant('CODE_MORE_RECEIVERS1'); + $URL = "modules.php?module=login&what=order&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--}
\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; diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 2a442bf481..e8650d08a2 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -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 diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 5a5724fa1d..4ffb8e4167 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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 diff --git a/mailid.php b/mailid.php index 561d51b9ea..92be8e30ac 100644 --- a/mailid.php +++ b/mailid.php @@ -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&msg=".constant('CODE_UNKNOWN_STATUS')."&ext=mailid"); + LOAD_URL("modules.php?module=index&msg=".getCode('UNKNOWN_STATUS')."&ext=mailid"); break; } } else { -- 2.39.2