//
// Debugging stuff...
//
- $fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or mxchange_die("Cannot write mysql.log!");
+ $fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or app_die(__FILE__, __LINE__, "Cannot write mysql.log!");
if (!isset($GLOBALS['sql_first_entry'])) {
// Write first entry
fwrite($fp, "Module=".$GLOBALS['module']."\n");
//
// Debugging
//
- //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or mxchange_die("Cannot write debug.log!");
+ //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!");
//* DEBUG: */ fwrite($fp, $F."(".$L."): ".str_replace("\r", "", str_replace("\n", " ", $eval))."\n");
//* DEBUG: */ fclose($fp);
// Register extension
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_extensions` (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
- array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FILE__, __LINE__);
+ array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
// Remove cache file(s) if extension is active
runFilterChain('post_extension_installed', array('ext_name' => EXT_GET_CURR_NAME(), 'task_id' => $task_id));
} elseif (($task_id > 0) && (EXT_GET_CURR_NAME() != "")) {
// Remove task from system when id and extension's name is valid
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_task_system` WHERE id=%s AND `status`='NEW' LIMIT 1",
- array(bigintval($task_id)), __FILE__, __LINE__);
+ array(bigintval($task_id)), __FUNCTION__, __LINE__);
}
// Is this the sql_patches?
if ($load_mode == "remove") {
// Delete this extension (remember to remove it from your server *before* you click on welcome!
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
- array(EXT_GET_CURR_NAME()), __FILE__, __LINE__);
+ array(EXT_GET_CURR_NAME()), __FUNCTION__, __LINE__);
} // END - if
} // END - if
incrementConfigEntry('cache_hits');
} elseif (isset($GLOBALS['ext_loaded'][$ext_name])) {
// @TODO Extension is loaded, what next?
- mxchange_die("LOADED:$ext_name");
+ app_die(__FUNCTION__, __LINE__, "LOADED:$ext_name");
} elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}");
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_active FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
+ array($ext_name), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
} elseif (!isCacheInstanceValid()) {
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
+ array($ext_name), __FUNCTION__, __LINE__);
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
// Is the extension there?
// Update extension's version
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
- array($GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], EXT_GET_CURR_NAME()), __FILE__, __LINE__);
+ array($GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], EXT_GET_CURR_NAME()), __FUNCTION__, __LINE__);
// Remove arrays
UNSET_SQLS();
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_name FROM `{!_MYSQL_PREFIX!}_extensions` WHERE id=%s LIMIT 1",
- array(bigintval($ext_id)), __FILE__, __LINE__);
+ array(bigintval($ext_id)), __FUNCTION__, __LINE__);
list($ret) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
+ array($ext_name), __FUNCTION__, __LINE__);
list($ret) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}
function ACTIVATE_EXTENSION ($ext_name) {
// Activate the extension
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='Y' WHERE ext_name='%s' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
+ array($ext_name), __FUNCTION__, __LINE__);
// Extension has been activated?
if (SQL_AFFECTEDROWS() == 1) {
function DEACTIVATE_EXTENSION($ext_name) {
// Activate the extension
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_active='N' WHERE ext_name='%s' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
+ array($ext_name), __FUNCTION__, __LINE__);
// Extension has been activated?
if (SQL_AFFECTEDROWS() == 1) {
if (DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) {
// Task not created so it's a brand-new extension which we need to register and create a task for!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())",
- array($admin_id, $subject, $notes), __FILE__, __LINE__);
+ array($admin_id, $subject, $notes), __FUNCTION__, __LINE__);
} // END - if
} // END - if
}
$admin_id,
$subject,
SQL_ESCAPE($msg),
- ), __FILE__, __LINE__, true, false
+ ), __FUNCTION__, __LINE__, true, false
);
} // END - if
}
array(
$subject,
SQL_ESCAPE(LOAD_TEMPLATE("task_ext_deactivated", true, $ext)),
- ), __FILE__, __LINE__, true, false
+ ), __FUNCTION__, __LINE__, true, false
);
} // END - if
}
}
} elseif ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ((!EXT_IS_ACTIVE("cache")) || ($forceDb === true))) {
// Check database for entry
- $result = SQL_QUERY_ESC("SELECT has_menu FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
- array($mod), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT has_menu FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
+ array($mod), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Search for extension task's id
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_task_system` WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
- array($ext_name), __FILE__, __LINE__);
+ array($ext_name), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Search for task id
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_task_system` WHERE subject LIKE '%s%%' LIMIT 1",
- array($subject), __FILE__, __LINE__);
+ array($subject), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
break;
case "0.6.9": // SQL queries for v0.6.9
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Admin-Management' WHERE action = 'admins' AND (what='' OR `what` IS NULL) LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Admin-Management' WHERE action = 'admins' AND (`what`='' OR `what` IS NULL) LIMIT 1");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Verwaltung nach Management umbenannt.");
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `what`='beg' LIMIT 1");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='beg' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE module='beg' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE `module`='beg' LIMIT 1");
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `what`='beg' LIMIT 1");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE what IN('beg','beg2') LIMIT 2");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE module='beg' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE `module`='beg' LIMIT 1");
break;
case "update": // Update an extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='bonus' LIMIT 1");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `action`='bonus' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE module='show_bonus' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE `module`='show_bonus' LIMIT 1");
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='bonus' LIMIT 1");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `action`='bonus' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE module='show_bonus' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE `module`='show_bonus' LIMIT 1");
break;
case "update": // Update an extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='doubler' LIMIT 1");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `what`='doubler' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE module='doubler' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE `module`='doubler' LIMIT 1");
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='doubler' LIMIT 1");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `what`='doubler' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE module='doubler' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE `module`='doubler' LIMIT 1");
break;
case "update": // Update an extension
break;
case "0.2.0": // SQL queries for v0.2.0
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (what='' OR `what` IS NULL) LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND (`what`='' OR `what` IS NULL) LIMIT 1");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Mitgliedsmenü komplett umgebaut.");
case "activate": // Do stuff when admin activates this extension
// SQL commands to run
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE module='mailid' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='N' WHERE `module`='mailid' LIMIT 1");
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE module='mailid' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE `module`='mailid' LIMIT 1");
break;
case "update": // Update an extension
break;
case "0.0.8": // SQL queries for v0.0.8
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Modul-Management' WHERE action = 'mods' AND (what='' OR `what` IS NULL) LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Modul-Management' WHERE action = 'mods' AND (`what`='' OR `what` IS NULL) LIMIT 1");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Verwaltung auf Management umgestellt.");
case "activate": // Do stuff when admin activates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='order' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='Y' WHERE `module`='order' LIMIT 1");
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `what`='order' LIMIT 1");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `visible`='N', `locked`='Y' WHERE module='order' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `visible`='N', `locked`='Y' WHERE `module`='order' LIMIT 1");
break;
case "update": // Update an extension
break;
case "0.3.7": // SQL queries for v0.3.7
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Auszahlungsmanagement' WHERE action = 'payouts' AND (what='' OR `what` IS NULL) LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET title = 'Auszahlungsmanagement' WHERE action = 'payouts' AND (`what`='' OR `what` IS NULL) LIMIT 1");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Verwaltung nach Management umgestellt.");
ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE
`what`='stats2' OR
`what`='reflist' OR
-(action='stats' AND (`what`='' OR `what` IS NULL)) OR
-(action='extras' AND (`what`='' OR `what` IS NULL)) OR
-(action='rals' AND (`what`='' OR `what` IS NULL)) OR
-(action='account' AND (`what`='' OR `what` IS NULL))");
+(`action`='stats' AND (`what`='' OR `what` IS NULL)) OR
+(`action`='extras' AND (`what`='' OR `what` IS NULL)) OR
+(`action`='rals' AND (`what`='' OR `what` IS NULL)) OR
+(`action`='account' AND (`what`='' OR `what` IS NULL))");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `action`='main' WHERE
-action='stats' OR
-action='extras' OR
-action='rals' OR
-action='account'");
+`action`='stats' OR
+`action`='extras' OR
+`action`='rals' OR
+`action`='account'");
// Drop indexes
/* @TODO SQL_ALTER_TABLE() should work now properly
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD master_salt VARCHAR(255) NOT NULL DEFAULT ''");
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_config` SET rand_no=(ROUND(RAND() * 99999) + 100000) WHERE config=0 LIMIT 1");
ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_mod_reg` ADD has_menu ENUM('Y','N') NOT NULL DEFAULT 'N'");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET has_menu='Y' WHERE module='admin' OR module='index' OR module='login' LIMIT 3");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET has_menu='Y' WHERE `module`='admin' OR `module`='index' OR `module`='login' LIMIT 3");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Passwort-System mit Zufallshash erweitert (Schutzt gegen Dictionary-Attacks!)");
UPDATE_CONFIG("file_hash", "");
// Cannot read secret file!
- mxchange_die("Cannot read secret file! Please try to reload");
+ app_die(__FILE__, __LINE__, "Cannot read secret file! Please try to reload");
}
} // END - if
case "activate": // Do stuff when admin activates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `action`='surfbar' LIMIT 5");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='surfbar' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', admin_only='N', mem_only='Y' WHERE `module`='surfbar' LIMIT 1");
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='N', `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5");
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE module='surfbar' LIMIT 1");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='Y' WHERE `module`='surfbar' LIMIT 1");
break;
case "update": // Update an extension
} // END - if
// Update last module / online time
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_module='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
array($GLOBALS['what'], GET_REMOTE_ADDR(), getUserId()), __FUNCTION__, __LINE__);
} else {
// Destroy session, we cannot update!
default:
// Huh, something goes wrong or maybe you have edited config.php ???
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", constant('OUTPUT_MODE')));
- mxchange_die("<strong>{--FATAL_ERROR--}:</strong> {--LANG_NO_RENDER_DIRECT--}");
+ app_die(__FUNCTION__, __LINE__, "<strong>{--FATAL_ERROR--}:</strong> {--LANG_NO_RENDER_DIRECT--}");
break;
}
} elseif ((constant('_OB_CACHING') == "on") && (isset($GLOBALS['footer_sent'])) && ($GLOBALS['footer_sent'] == 1)) {
// Was that eval okay?
if (empty($newContent)) {
// Something went wrong!
- mxchange_die("Evaluation error:<pre>".htmlentities($eval)."</pre>");
+ app_die(__FUNCTION__, __LINE__, "Evaluation error:<pre>".htmlentities($eval)."</pre>");
} // END - if
$OUTPUT = $newContent;
} // END - while
}
// Output error messages in a fasioned way and die...
-function mxchange_die ($msg) {
+function app_die ($F, $L, $msg) {
// Load header
LOAD_INC_ONCE("inc/header.php");
+ // Prepare message for output
+ $msg = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $msg);
+
// Load the message template
LOAD_TEMPLATE("admin_settings_saved", false, $msg);
$return = file_put_contents($FQFN, $content);
} else {
// Write it with fopen
- $fp = fopen($FQFN, 'w') or mxchange_die("Cannot write file ".basename($FQFN)."!");
+ $fp = fopen($FQFN, 'w') or app_die(__FUNCTION__, __LINE__, "Cannot write file ".basename($FQFN)."!");
fwrite($fp, $content);
fclose($fp);
function searchDirsRecursive ($dir, &$last_changed) {
// Get dir as array
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):dir=".$dir."<br />\n";
- $ds = GET_DIR_AS_ARRAY($dir, "", true, false);
+ // Does it match what we are looking for? (We skip a lot files already!)
+ // RegexPattern to exclude ., .., .revision, .svn, debug.log or .cache in the filenames
+ $excludePattern = '@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache|config\.php)$@';
+ $ds = GET_DIR_AS_ARRAY($dir, "", true, false, $excludePattern);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds)."<br />\n";
// Walk through all entries
// Generate proper FQFN
$FQFN = str_replace("//", "/", constant('PATH') . $dir. "/". $d);
- // Does it match what we are looking for? (We skip a lot files already!)
- if (!preg_match('@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache|config\.php)$@', $d)) { // no ., .., .revision, .svn, debug.log or .cache in the filename
-
- // Is it a file and readable?
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
- if (isDirectory($FQFN)) {
- // $FQFN is a directory so also crawl into this directory
- $newDir = $d;
- if (!empty($dir)) $newDir = $dir . "/". $d;
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):DESCENT: ".$newDir."<br />\n";
- searchDirsRecursive($newDir, $last_changed);
- } elseif (FILE_READABLE($FQFN)) {
- // $FQFN is a filename and no directory
- $time = filemtime($FQFN);
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):File: ".$d." found. (".($last_changed['time'] - $time).")<br />\n";
- if ($last_changed['time'] < $time) {
- // This file is newer as the file before
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>) - NEWER!<br />\n";
- $last_changed['path_name'] = $FQFN;
- $last_changed['time'] = $time;
- } // END - if
- }
- } // END - if
+ // Is it a file and readable?
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
+ if (isDirectory($FQFN)) {
+ // $FQFN is a directory so also crawl into this directory
+ $newDir = $d;
+ if (!empty($dir)) $newDir = $dir . "/". $d;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):DESCENT: ".$newDir."<br />\n";
+ searchDirsRecursive($newDir, $last_changed);
+ } elseif (FILE_READABLE($FQFN)) {
+ // $FQFN is a filename and no directory
+ $time = filemtime($FQFN);
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):File: ".$d." found. (".($last_changed['time'] - $time).")<br />\n";
+ if ($last_changed['time'] < $time) {
+ // This file is newer as the file before
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>) - NEWER!<br />\n";
+ $last_changed['path_name'] = $FQFN;
+ $last_changed['time'] = $time;
+ } // END - if
+ }
} // END - foreach
}
$debug .= "Thank you for finding bugs.";
// And abort here
- // @TODO This cannot be rewritten to mxchange_die(), try to find a solution for this.
+ // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
die($debug);
}
$message = str_replace("\r", "", str_replace("\n", "", $message));
// Log this message away
- $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
+ $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or app_die(__FUNCTION__, __LINE__, "Cannot write logfile debug.log!");
fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($funcFile)."|".$line."|".strip_tags($message)."\n");
fclose($fp);
} // END - if
// Translates the "pool type" into human-readable
function TRANSLATE_POOL_TYPE ($type) {
- // Default type is unknown
+ // Default?type is unknown
$translated = sprintf(getMessage('POOL_TYPE_UNKNOWN'), $type);
// Generate constant
// 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.");
+ app_die(__FUNCTION__, __LINE__, "Error message written to debug.log. Please try to call <a href=\"{!URL!}\">the main page</a> to continue.");
} else {
// No debug extension found, so regular output
debug_report_bug($msg);
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Spezielle Funktionen fuer Include-Dateien *
* -------------------------------------------------------------------- *
- * $Revision:: 905 $ *
+ * $Revision:: 999 $ *
* $Date:: 2009-03-10 17:24:54 +0100 (Tue, 10 Mar 2009) $ *
* $Tag:: 0.2.1-FINAL $ *
* $Author:: quix0r $ *
}
// Reads a directory with PHP files in and gets only files back
-function GET_DIR_AS_ARRAY ($baseDir, $prefix, $includeDirs = false, $addBaseDir = true) {
+function GET_DIR_AS_ARRAY ($baseDir, $prefix, $includeDirs = false, $addBaseDir = true, $excludePattern = '@(\.|\.\.)$@') {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
// Init includes
$INCs = array();
// Open directory
- $dirPointer = opendir(constant('PATH') . $baseDir) or mxchange_die("Cannot read ".basename($baseDir)." path!");
+ $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, "Cannot read ".basename($baseDir)." path!");
// Read all entries
while ($baseFile = readdir($dirPointer)) {
+ // Steps over this returned $baseFile-Name, when it matches the $excludePattern
+ if (preg_match($excludePattern, $baseFile, $match)) {
+ // These Lines are only for debugging!!
+ //$INC = $baseDir . "/" . $baseFile;
+ //$FQFN = constant('PATH') . $INC;
+ //echo '<pre>$baseDir:'.print_r($baseDir, true).'</pre>';
+ //echo '<pre>$baseDir:'.print_r(constant('PATH') . $baseDir, true).'</pre>';
+ //echo '<pre>constant(\'PATH\'):'.print_r(constant('PATH'), true).'</pre>';
+ //echo '<pre>$FQFN:'.print_r($FQFN, true).'</pre>';
+ break;
+ } // END - if
+
// Construct include filename and FQFN
$INC = $baseDir . "/" . $baseFile;
$FQFN = constant('PATH') . $INC;
+ // repalecment of // to / is needed, whenn $baseDir is an emty String
+ $FQFN = str_replace('//', '/', $FQFN);
+
// Is this a valid reset file?
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}");
if (((FILE_READABLE($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) || (($includeDirs) && (isDirectory($FQFN)))) {
define('__UNUSED', "Im Aufbau");
define('ADMIN_DELETED_MAILS_COUNT', "Es wurden <u>%s</u> Einträge gelöscht.");
define('EMAIL_DELETE_COUNT', "Buchungseinträge gelöscht");
+define('MXCHANGE_HAS_DIED', "{!TITLE!} ist in Script/Funktion <u>%s</u>, Zeile <u>%s</u> mit folgender Meldung gestorben: <u>%s</u>");
define('ADMIN_SEND_RESET_LINK_TITLE', "1/4: Administratorkennwort zurücksetzen");
define('ADMIN_VALIDATE_HASH_TITLE', "2/4: Validierung Iher Logindaten");
if ($this->ret == "done") {
// Create file
if ($this->isCacheReadable()) chmod($this->fqfn, 0666);
- $this->pointer = fopen($this->fqfn, 'w') or mxchange_die("Cannot write to cache ".$this->fqfn." !");
+ $this->pointer = fopen($this->fqfn, 'w') or app_die(__METHOD__, __LINE__, "Cannot write to cache ".$this->fqfn." !");
// Add open PHP tag
fwrite($this->pointer, "<?php\n");
if (SQL_NUMROWS($result) == 1) {
// Then update it
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_online` SET
-module='%s',
-action='%s',
-what='%s',
+`module`='%s',
+`action`='%s',
+`what`='%s',
userid=%s,
refid=%s,
is_member='%s',
// Load main menu entries
$result_main = SQL_QUERY("SELECT action AS main_action, title AS main_title FROM `{!_MYSQL_PREFIX!}_sponsor_menu`
-WHERE (what='' OR `what` IS NULL) ".$WHERE."
+WHERE (`what`='' OR `what` IS NULL) ".$WHERE."
ORDER BY `sort`", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_main) > 0) {
// Load every menu and it's sub menus
// Check if action/what pair is valid
$result_action = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu`
-WHERE `action`='%s' AND ((what='%s' AND what != 'overview') OR ((what='' OR `what` IS NULL) AND '%s'='overview'))
+WHERE `action`='%s' AND ((`what`='%s' AND what != 'overview') OR ((`what`='' OR `what` IS NULL) AND '%s'='overview'))
LIMIT 1", array($act, $wht, $wht), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_action) == 1) {
// Is valid but does the inlcude file exists?
} // END - if
// Build main menu
- $result_main = SQL_QUERY("SELECT action, title, descr FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`, id DESC", __FUNCTION__, __LINE__);
+ $result_main = SQL_QUERY("SELECT action, title, descr FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`, id DESC", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_main) > 0) {
$OUT = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_main\">
<tr><td colspan=\"2\" height=\"7\" class=\"seperator\"> </td></tr>\n";
// Create a menu selection box for given menu system
function ADMIN_MENU_SELECTION ($MODE, $default="", $defid="") {
$wht = "`what` != ''";
- if ($MODE == "action") $wht = "(what='' OR `what` IS NULL) AND action !='login'";
+ if ($MODE == "action") $wht = "(`what`='' OR `what` IS NULL) AND action !='login'";
$result = SQL_QUERY_ESC("SELECT %s, title FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE ".$wht." ORDER BY `sort`",
array($MODE), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
} // END - if
} elseif (isset($content[$column])) {
// Unfinished!
- mxchange_die("{--".__FUNCTION__."--}:".__LINE__.":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}");
+ app_die(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}");
}
} // END - foreach
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Read menu structure
while ($content = SQL_FETCHARRAY($result)) {
$AND = "(`what` = '' OR `what` IS NULL)"; $SUB = "";
if (REQUEST_ISSET_GET(('sub')))
{
- $AND = sprintf("action='%s' AND `what` IS NOT NULL", REQUEST_GET(('sub')));
+ $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", REQUEST_GET(('sub')));
$SUB = REQUEST_GET(('sub'));
}
// Update entry
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET
title='%s',
-action='%s',
-what='%s',
+`action`='%s',
+`what`='%s',
descr='%s'
WHERE ".$AND." AND id=%s LIMIT 1",
array(
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
array($SUB), __FILE__, __LINE__);
} else {
// Main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
}
$max = SQL_NUMROWS($result);
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Read menu structure
while ($content = SQL_FETCHARRAY($result)) {
$AND = "(`what` = '' OR `what` IS NULL)"; $SUB = "";
if (REQUEST_ISSET_GET(('sub'))) {
- $AND = sprintf("action='%s' AND `what` IS NOT NULL", REQUEST_GET(('sub')));
+ $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", REQUEST_GET(('sub')));
$SUB = REQUEST_GET(('sub'));
} // END - if
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (isDirectory($dir)) {
// logs directory does exist
OUTPUT_HTML("<ol>");
- $handle = opendir($dir) or mxchange_die("Cannot open directory ".getConfig('logs_base')."!");
+ $handle = opendir($dir) or app_die(__FILE__, __LINE__, "Cannot open directory ".getConfig('logs_base')."!");
while ($file = readdir($handle)) {
// We currenly only like files with "access" as prefix, should be more flexible!
if (substr($file, 0, 6) == "access") {
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`",
+ $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`",
__FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Read menu structure
$AND = "(`what` = '' OR `what` IS NULL)"; $SUB = "";
if (REQUEST_ISSET_GET(('sub'))) {
- $AND = sprintf("action='%s' AND `what` IS NOT NULL", REQUEST_GET(('sub')));
+ $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", REQUEST_GET(('sub')));
$SUB = REQUEST_GET(('sub'));
}
foreach (REQUEST_POST('sel') as $sel => $menu) {
$AND = "(`what` = '' OR `what` IS NULL)";
$sel = bigintval($sel);
- if (!empty($SUB)) $AND = "action='".$SUB."'";
+ if (!empty($SUB)) $AND = "`action`='".$SUB."'";
switch (REQUEST_POST('ok'))
{
case "edit": // Edit menu
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
}
$result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE ".$AND." AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC", __FILE__, __LINE__);
} else {
// Edit main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
}
$max = SQL_NUMROWS($result);
$ACTIONS = array();
// First fix all main menus (what="")...
-$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (what='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
+$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Store act value for later usage in sorting sub menus
}
// Set logout weight to 999
-SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='999' WHERE `action`='logout' AND (what='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
+SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_admin_menu` SET `sort`='999' WHERE `action`='logout' AND (`what`='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
foreach ($ACTIONS as $act) {
$ACTIONS = array();
// First fix all main menus (what="")...
-$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
+$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Store act value for later usage in sorting sub menus
$cnt++;
}
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort='999' WHERE `action`='logout' AND (what='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
+$result_sort = SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET sort='999' WHERE `action`='logout' AND (`what`='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
foreach ($ACTIONS as $act) {
$ACTIONS = array();
// First fix all main menus (what="")...
-$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
+$result_fix = SQL_QUERY("SELECT id, action FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND action != 'logout' ORDER BY `sort` ASC", __FILE__, __LINE__);
$cnt = 0; $REP = 0;
while ($content = SQL_FETCHARRAY($result_fix)) {
// Store action value for later usage in sorting sub menus
}
// Set logout weight to 999
-SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort='999' WHERE `action`='logout' AND (what='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
+SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET sort='999' WHERE `action`='logout' AND (`what`='' OR `what` IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
foreach ($ACTIONS as $act) {
);
// Read directory "themes"
-$handle = opendir(constant('PATH')."theme/") or mxchange_die("Cannot read themes dir!");
+$handle = opendir(constant('PATH')."theme/") or app_die(__FILE__, __LINE__, "Cannot read themes dir!");
while ($dir = readdir($handle)) {
// Construct absolute theme.php file name
$INC = sprintf("theme/%s/theme.php", $dir);
FROM `{!_MYSQL_PREFIX!}_sponsor_menu` AS m
LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_action_convert` AS c ON m.what=c.ext_name
LEFT JOIN `{!_MYSQL_PREFIX!}_sponsor_registry` AS r ON m.what=r.ext_name
-WHERE m.action='actions' AND r.is_active='Y'
+WHERE m.`action`='actions' AND r.is_active='Y'
ORDER BY m.sort ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result_act) > 0) {
);
// Read directory "themes"
-$handle = opendir(constant('PATH')."theme/") or mxchange_die("Cannot read themes dir!");
+$handle = opendir(constant('PATH')."theme/") or app_die(__FILE__, __LINE__, "Cannot read themes dir!");
while ($entry = readdir($handle)) {
// Construct absolute theme.php file name
$INC = sprintf("theme/%s/theme.php", $entry);
OUTPUT_HTML("<strong>{--LANG_WARNING--}:</strong> ");
if (isInstalled()) {
// You have changed my configuration file!
- mxchange_die("{--DIE_CONFIG_CHANGED_YOU--}");
+ app_die(__FILE__, __LINE__, "{--DIE_CONFIG_CHANGED_YOU--}");
} else {
// Please run the installation script (maybe again)
- mxchange_die("{--DIE_RUN_INSTALL_MYSQL--}");
+ app_die(__FILE__, __LINE__, "{--DIE_RUN_INSTALL_MYSQL--}");
}
} elseif ((!isInstalling()) && (empty($MySQL['password'])) && (isBooleanConstantAndTrue('warn_no_pass'))) {
// No database password entered!!!
incrementConfigEntry('cache_hits');
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
- $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
array($mod), __FUNCTION__, __LINE__);
list($name) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}
} elseif (!EXT_IS_ACTIVE("cache")) {
// Check for module in database
- $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
array($mod_chk), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Read data
$modCheck = $GLOBALS['module'];
break;
}
- $AND = " AND (what='' OR `what` IS NULL)";
+ $AND = " AND (`what`='' OR `what` IS NULL)";
} elseif (substr($file, 0, 5) == "what-") {
// This is an admin what file!
$type = "what";
} // END - if
// Load SQL data and add the menu to the output stream...
- $result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (what='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
+ $result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
array($MODE), __FUNCTION__, __LINE__);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
} else {
// Admin login overview
- $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (what='' OR `what` IS NULL)".$add." ORDER BY action DESC LIMIT 1",
+ $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (`what`='' OR `what` IS NULL)".$add." ORDER BY action DESC LIMIT 1",
array($MODE, $act), __FUNCTION__, __LINE__, false);
}
function countModuleHit($mod) {
if ($mod != "css") {
// Do count all other modules but not accesses on CSS file css.php!
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE `module`='%s' LIMIT 1",
array($mod), __FUNCTION__, __LINE__);
} // END - if
}
if ($totalUsers >= getConfig('activate_xchange')) {
// Activate System
SET_SQLS(array(
- "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', mem_only='Y' WHERE module='order' LIMIT 1",
+ "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', mem_only='Y' WHERE `module`='order' LIMIT 1",
"UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' OR `what`='unconfirmed' LIMIT 2",
"UPDATE `{!_MYSQL_PREFIX!}_config` SET activate_xchange='0' WHERE config=0 LIMIT 1"
));
if ($status == "CONFIRMED") {
// Update last activity
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_online=UNIX_TIMESTAMP(), `last_module`='mailid_top' WHERE userid=%s LIMIT 1",
array($url_uid), __FILE__, __LINE__);
// User has confirmed his account so we can procede...