// Is the "beg" extension active?
if (!EXT_IS_ACTIVE("beg")) {
// Redirect to index
- LOAD_URL("modules.php?module=index&msg=".CODE_EXTENSION_PROBLEM."&ext=beg");
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=beg");
} // END - if
// Is the script 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 {
// 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! ;-)
}
// Pay points?
- if ($pay) {
+ if ($pay === true) {
// Add points to user or begging rallye account
if (BEG_ADD_POINTS($uid, $points)) {
// Set "done" message
} 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
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
// Is the "birthday" extension active?
if (!EXT_IS_ACTIVE("birthday")) {
// Redirect to index
- LOAD_URL("modules.php?module=index&msg=".CODE_EXTENSION_PROBLEM."&ext=birthday");
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=birthday");
} // END - if
// Is the script installed?
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));
} // 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 {
}
// 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
// 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) {
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
// 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');
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'));
+}
+
//
?>
}
// 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;
{
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:
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
// 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
// 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++) {
// 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');
}
// 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
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("&", "&", $URL));
} else {
// Output error message
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();
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
} // 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
$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 />";
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
$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) {
// Determine URL binder
$BIND = "?";
- if (strpos($URL, "?") !== false) $BIND = "&";
+ if (strpos($URL, "?") !== false) $BIND = "&";
if ((!defined('__COOKIES')) || ((!__COOKIES))) {
// Cookies are not accepted
// 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;
$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;
LOAD_TEMPLATE("admin_settings_saved", false, $msg);
// Load footer
- LOAD_INC("inc/footer.php");
+ LOAD_INC_ONCE("inc/footer.php");
// Exit explicitly
exit;
}
// Both are not arrays
- print(__FUNCTION__.":<pre>");
- debug_print_backtrace();
- die("</pre>");
+ debug_report_bug(__FUNCTION__.":");
}
// Debug message logger
// 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);
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;
}
// 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' , "");
// 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
$value = null;
// Is the entry there?
- if (isset($_CONFIG[$entry])) {
+ if (isConfigEntrySet($entry)) {
// Then use it
$value = $_CONFIG[$entry];
} // END - if
$_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."!";
} 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 {
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
// 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);
// 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
}
}
}
- 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
} // 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 //
//////////////////////////////////////////////////
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üs");
define('IS_LOCKED', "Ist gesperrt");
define('ADMIN_REMOVE_STATS_ENTRY', "Hier klicken, um Mitgliederstatistik zu entfernen!");
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!}-Übersicht derzeit nicht verfügbar.");
define('ADMIN_NOTHING_SELECTED_CHANGE', "Sie haben nichts zum Ändern des Status ausgewählt.");
define('TEMPLATE_CONTENT', "Template-Content:");
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ü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örungen führen.<br />\nBitte aktivieren Sie diese unter <em>Verschiedenes->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->Erweiterungen</em>.");
define('ADMIN_PROXY_SETTINGS_INVALID', "Ihre Proxy-Einstellungen scheinen ungültig zu sein!");
// 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
// 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) {
$MEM,
$ADMIN,
GET_REMOTE_ADDR(),
- $PHPSESSID
+ session_id()
), __FILE__, __LINE__
);
} else {
$rid,
$MEM,
$ADMIN,
- $PHPSESSID,
+ session_id(),
GET_REMOTE_ADDR()
), __FILE__, __LINE__
);
} else { // END - if
print("<pre>");
print_r($SURFBAR_CACHE);
- debug_print_backtrace();
- die("</pre>");
+ print("</pre>");
+ debug_report_bug();
}
// Return result
$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&what=login&login=".$ERROR;
} else {
// ID not found!
- $URL = "modules.php?module=index&what=login&login=".CODE_WRONG_ID;
+ $URL = "modules.php?module=index&what=login&login=".constant('CODE_WRONG_ID');
}
// Return URL
} 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?
$hashedPass = md5($_POST['pass']);
// Kill maybe existing session variables
- DESTROY_ADMIN_SESSION(false);
+ destroyAdminSession(false);
// Do registration
$ret = REGISTER_ADMIN($_POST['login'], $hashedPass);
{
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&action=login®ister=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));
// 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));
$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']),
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&reset_pass=1\">{!ADMIN_RESET_PASS!}</a>]\n";
- DESTROY_ADMIN_SESSION();
+ destroyAdminSession();
break;
default: // Others will be logged
$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;
} // 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
}
} 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?
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"))) {
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;
$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']);
<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>
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);
}
// Base URL for redirection (both cases)
-$URL = "modules.php?module=index";
+$URL = "modules.php?module=index&msg=";
if (destroy_user_session()) {
// Remove theme cookie as well
set_session("mxchange_theme", "");
// Logout completed
- $URL .= "&msg=".CODE_LOGOUT_DONE;
-
- // Destroy session here
- @session_destroy();
+ $URL .= constant('CODE_LOGOUT_DONE');
} else {
// Cannot logout! :-(
- $URL .= "&msg=".CODE_LOGOUT_FAILED;
+ $URL .= constant('CODE_LOGOUT_FAILED');
}
// Load the URL
// 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&what=order&msg=".CODE_URL_FOUND;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_URL_FOUND');
} // END - if
// Remove new-line and carriage-return characters
// Text length within allowed length?
if (strlen($TEST) > getConfig('max_tlength')) {
// Text is too long!
- $URL = "modules.php?module=login&what=order&msg=".CODE_OVERLENGTH;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_OVERLENGTH');
} // END - if
} // END - if
$_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&what=order&msg=".CODE_SUBJ_URL;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_SUBJ_URL');
} // END - if
} // END - if
list($blist) = SQL_FETCHROW($result);
// Create redirect-URL
- $URL = "modules.php?module=login&what=order&msg=".CODE_BLIST_URL."&blist=".$blist;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_BLIST_URL')."&blist=".$blist;
} // END - if
// Free result
// Enougth receivers entered?
if (($_POST['receiver'] < getConfig('order_min')) && (!IS_ADMIN())) {
// Less than allowed receivers entered!
- $URL = "modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS3;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_MORE_RECEIVERS3');
} // END - if
// Validate URL
if (!VALIDATE_URL($_POST['url'])) {
// URL is invalid!
- $URL = "modules.php?module=login&what=order&msg=".CODE_INVALID_URL;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_INVALID_URL');
} // END - if
// Probe for HTML extension
$_POST['text'] = HTML_CHECK_TAGS($_POST['text']);
// Maybe invalid tags found?
- if (empty($_POST['text'])) $URL = "modules.php?module=login&what=order&msg=".CODE_INVALID_TAGS."&id=".$id;
+ if (empty($_POST['text'])) $URL = "modules.php?module=login&what=order&msg=".constant('CODE_INVALID_TAGS')."&id=".$id;
} else {
// Remove any HTML code
$_POST['text'] = str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", $_POST['text']));
}
} elseif (!IS_ADMIN()) {
// He has already sent a mail within a specific time
- $URL = "modules.php?module=login&what=order&msg=".CODE_URL_TLOCK."&id=".$id;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_URL_TLOCK')."&id=".$id;
}
// Still no error?
$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=".CODE_MORE_RECEIVERS2;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_MORE_RECEIVERS2');
} else {
// No enougth points left!
- $URL = "modules.php?module=login&what=order&msg=".CODE_MORE_POINTS;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_MORE_POINTS');
}
} else {
// Ordered more mails than he can send in this category
- $URL = "modules.php?module=login&what=order&msg=".CODE_NO_RECS_LEFT;
+ $URL = "modules.php?module=login&what=order&msg=".constant('CODE_NO_RECS_LEFT');
}
}
} elseif ($_POST['receiver'] == "0") {
// Not enougth receivers selected
- $URL = "modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS1;
+ $URL = "modules.php?module=login&what=order&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'));
// 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)) {
$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__);
$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...
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;
}
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
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;
}
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
// 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
$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!
// 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();
}
}
SQL_CLOSE($link, __FILE__, __LINE__);
} else {
// No database link
- addFatalMessage(NO_DB_LINK);
+ addFatalMessage(getMessage('NO_DB_LINK'));
}
}
// 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
// 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");
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")) {
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)) {
// Is the extension active
if (!EXT_IS_ACTIVE("mailid", true)) {
// Is not activated/installed yet!
- LOAD_URL("modules.php?module=index&msg=".CODE_EXTENSION_PROBLEM."&ext=mailid");
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=mailid");
} // END - if
// Init
// Is the bonus extension active?
if (!EXT_IS_ACTIVE("bonus")) {
// Abort here
- LOAD_URL("modules.php?module=index&msg=".CODE_EXTENSION_PROBLEM."&ext=mailid");
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=mailid");
} // END - if
// Bonus-Mails
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");
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;
// 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?
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=".CODE_UNKNOWN_STATUS."&ext=mailid");
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_UNKNOWN_STATUS')."&ext=mailid");
break;
}
} else {
// Is the "bonus" extension active?
if (!EXT_IS_ACTIVE("bonus")) {
// Redirect to index
- LOAD_URL("modules.php?module=index&msg=".CODE_EXTENSION_PROBLEM."&ext=bonus");
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=bonus");
} // END - if
// List only rankings when script is installed
// Only logged in users may use this surfbar!
if (!EXT_IS_ACTIVE("surfbar")) {
// Surfbar deactivated
- LOAD_URL("modules.php?module=login&msg=".CODE_EXTENSION_PROBLEM."&ext=surfbar");
+ LOAD_URL("modules.php?module=login&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=surfbar");
} elseif (!IS_MEMBER()) {
// Redirect
LOAD_URL("modules.php?module=index");