From: Roland Häder Date: Thu, 12 Mar 2009 16:56:15 +0000 (+0000) Subject: Several rewrites/fixes which I have done yesterday but not commited, mxchange_die... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3af8b17c962e094e3eaffbd6d111290cdb286c92;p=mailer.git Several rewrites/fixes which I have done yesterday but not commited, mxchange_die->app_die renamed, fixes from stelzi merged --- diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index d14764c076..024908a9df 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -84,7 +84,7 @@ Query string:
// // 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"); @@ -267,7 +267,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true) { // // 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); diff --git a/inc/extensions.php b/inc/extensions.php index eb6ba10c3f..c2dd635325 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -261,7 +261,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr // 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)); @@ -299,7 +299,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr } 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? @@ -361,7 +361,7 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { 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 @@ -398,12 +398,12 @@ function EXT_IS_ACTIVE ($ext_name) { 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) { @@ -455,7 +455,7 @@ function GET_EXT_VERSION ($ext_name) { } 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? @@ -547,7 +547,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { // 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(); @@ -635,7 +635,7 @@ function GET_EXT_NAME ($ext_id) { } 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); } @@ -655,7 +655,7 @@ function GET_EXT_ID ($ext_name) { } 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); } @@ -668,7 +668,7 @@ function GET_EXT_ID ($ext_name) { 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) { @@ -681,7 +681,7 @@ function ACTIVATE_EXTENSION ($ext_name) { 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) { @@ -724,7 +724,7 @@ function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $ext_name, $ext_ver, $notes) { 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 } @@ -759,7 +759,7 @@ VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())", $admin_id, $subject, SQL_ESCAPE($msg), - ), __FILE__, __LINE__, true, false + ), __FUNCTION__, __LINE__, true, false ); } // END - if } @@ -777,7 +777,7 @@ VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())", array( $subject, SQL_ESCAPE(LOAD_TEMPLATE("task_ext_deactivated", true, $ext)), - ), __FILE__, __LINE__, true, false + ), __FUNCTION__, __LINE__, true, false ); } // END - if } @@ -804,8 +804,8 @@ function MODULE_HAS_MENU ($mod, $forceDb = false) { } } 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) { @@ -838,7 +838,7 @@ function DETERMINE_EXTENSION_TASK_ID ($ext_name) { // 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) { @@ -860,7 +860,7 @@ function DETERMINE_TASK_ID_BY_SUBJECT ($subject) { // 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) { diff --git a/inc/extensions/ext-admins.php b/inc/extensions/ext-admins.php index 3699748a38..7e9265b9c0 100644 --- a/inc/extensions/ext-admins.php +++ b/inc/extensions/ext-admins.php @@ -274,7 +274,7 @@ PRIMARY KEY (id) 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."); diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index b8d8005853..4373ea38f6 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -82,14 +82,14 @@ case "activate": // Do stuff when admin activates this extension // 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 diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index be9ffd9248..c57a708353 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -97,14 +97,14 @@ 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`='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 diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 056eb99be6..9b7e64b0a8 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -129,14 +129,14 @@ 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`='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 diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index 919480685f..10fb21a642 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -211,7 +211,7 @@ 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."); diff --git a/inc/extensions/ext-mailid.php b/inc/extensions/ext-mailid.php index 551700a95a..c546b5ab9d 100644 --- a/inc/extensions/ext-mailid.php +++ b/inc/extensions/ext-mailid.php @@ -62,12 +62,12 @@ case "remove": // Do stuff when removing extension 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 diff --git a/inc/extensions/ext-mods.php b/inc/extensions/ext-mods.php index 2a30a9ed62..dfbe5fabf3 100644 --- a/inc/extensions/ext-mods.php +++ b/inc/extensions/ext-mods.php @@ -106,7 +106,7 @@ 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."); diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index 4ad472d541..b78a825731 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -63,13 +63,13 @@ case "remove": // Do stuff when removing extension 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 diff --git a/inc/extensions/ext-payout.php b/inc/extensions/ext-payout.php index 1d8bccaa40..058241cbba 100644 --- a/inc/extensions/ext-payout.php +++ b/inc/extensions/ext-payout.php @@ -227,7 +227,7 @@ 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."); diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index d01946a152..adfdd0f164 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -79,15 +79,15 @@ case "remove": // Do stuff when removing extension 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 @@ -472,7 +472,7 @@ PRIMARY KEY (id) 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!)"); @@ -724,7 +724,7 @@ default: // Do stuff when extension is loaded 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 diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index e09c3a1384..d9a4535db4 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -207,13 +207,13 @@ case "remove": // Do stuff when removing extension 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 diff --git a/inc/filters.php b/inc/filters.php index d0c4398d6e..80e45043c3 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -485,7 +485,7 @@ function FILTER_UPDATE_LOGIN_DATA () { } // 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! diff --git a/inc/functions.php b/inc/functions.php index d6c84e2187..9daec4f80d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -80,7 +80,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { 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("{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}"); + app_die(__FUNCTION__, __LINE__, "{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}"); break; } } elseif ((constant('_OB_CACHING') == "on") && (isset($GLOBALS['footer_sent'])) && ($GLOBALS['footer_sent'] == 1)) { @@ -129,7 +129,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { // Was that eval okay? if (empty($newContent)) { // Something went wrong! - mxchange_die("Evaluation error:
".htmlentities($eval)."
"); + app_die(__FUNCTION__, __LINE__, "Evaluation error:
".htmlentities($eval)."
"); } // END - if $OUTPUT = $newContent; } // END - while @@ -2233,10 +2233,13 @@ function FIX_DELETED_COOKIES ($cookies) { } // 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); @@ -2466,7 +2469,7 @@ function WRITE_FILE ($FQFN, $content) { $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); @@ -2512,7 +2515,10 @@ function clearOutputBuffer () { function searchDirsRecursive ($dir, &$last_changed) { // Get dir as array //* DEBUG: */ print __FUNCTION__."(".__LINE__."):dir=".$dir."
\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__."(".__LINE__."):ds[]=".count($ds)."
\n"; // Walk through all entries @@ -2520,29 +2526,25 @@ function searchDirsRecursive ($dir, &$last_changed) { // 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__."(".__LINE__."):FQFN={$FQFN}
\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__."(".__LINE__."):DESCENT: ".$newDir."
\n"; - searchDirsRecursive($newDir, $last_changed); - } elseif (FILE_READABLE($FQFN)) { - // $FQFN is a filename and no directory - $time = filemtime($FQFN); - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):File: ".$d." found. (".($last_changed['time'] - $time).")
\n"; - if ($last_changed['time'] < $time) { - // This file is newer as the file before - //* DEBUG: */ print __FUNCTION__."(".__LINE__.") - NEWER!
\n"; - $last_changed['path_name'] = $FQFN; - $last_changed['time'] = $time; - } // END - if - } - } // END - if + // Is it a file and readable? + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):FQFN={$FQFN}
\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__."(".__LINE__."):DESCENT: ".$newDir."
\n"; + searchDirsRecursive($newDir, $last_changed); + } elseif (FILE_READABLE($FQFN)) { + // $FQFN is a filename and no directory + $time = filemtime($FQFN); + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):File: ".$d." found. (".($last_changed['time'] - $time).")
\n"; + if ($last_changed['time'] < $time) { + // This file is newer as the file before + //* DEBUG: */ print __FUNCTION__."(".__LINE__.") - NEWER!
\n"; + $last_changed['path_name'] = $FQFN; + $last_changed['time'] = $time; + } // END - if + } } // END - foreach } @@ -2757,7 +2759,7 @@ function debug_report_bug ($message = "") { $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); } @@ -3090,7 +3092,7 @@ function DEBUG_LOG ($funcFile, $line, $message, $force=true) { $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 @@ -3315,7 +3317,7 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") { // 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 diff --git a/inc/handler.php b/inc/handler.php index 6daf6e4766..7bba6be891 100644 --- a/inc/handler.php +++ b/inc/handler.php @@ -58,7 +58,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) { // Output message to user and die if (EXT_IS_ACTIVE("debug")) { // Debug extension found! So Output a small message - mxchange_die("Error message written to debug.log. Please try to call the main page to continue."); + app_die(__FUNCTION__, __LINE__, "Error message written to debug.log. Please try to call the main page to continue."); } else { // No debug extension found, so regular output debug_report_bug($msg); diff --git a/inc/inc-functions.php b/inc/inc-functions.php index 22fd177bdf..14d1ab2639 100644 --- a/inc/inc-functions.php +++ b/inc/inc-functions.php @@ -10,7 +10,7 @@ * -------------------------------------------------------------------- * * 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 $ * @@ -56,20 +56,35 @@ function IS_INC_WRITEABLE ($inc) { } // 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 '
$baseDir:'.print_r($baseDir, true).'
'; + //echo '
$baseDir:'.print_r(constant('PATH') . $baseDir, true).'
'; + //echo '
constant(\'PATH\'):'.print_r(constant('PATH'), true).'
'; + //echo '
$FQFN:'.print_r($FQFN, true).'
'; + 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)))) { diff --git a/inc/language/de.php b/inc/language/de.php index 987403d328..1a1978c2cb 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1073,6 +1073,7 @@ define('_CATEGORY_NONE', "Keine Kategorie"); define('__UNUSED', "Im Aufbau"); define('ADMIN_DELETED_MAILS_COUNT', "Es wurden %s Einträge gelöscht."); define('EMAIL_DELETE_COUNT', "Buchungseinträge gelöscht"); +define('MXCHANGE_HAS_DIED', "{!TITLE!} ist in Script/Funktion %s, Zeile %s mit folgender Meldung gestorben: %s"); define('ADMIN_SEND_RESET_LINK_TITLE', "1/4: Administratorkennwort zurücksetzen"); define('ADMIN_VALIDATE_HASH_TITLE', "2/4: Validierung Iher Logindaten"); diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index d4eccba5a3..d1cc8d2853 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -113,7 +113,7 @@ class CacheSystem { 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, " 0) { // Load every menu and it's sub menus diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 7508d5c027..5efb6f5597 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -271,7 +271,7 @@ function ADMIN_DO_ACTION ($wht) { // 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? @@ -336,7 +336,7 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) { } // 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 = "\n"; @@ -522,7 +522,7 @@ function ADD_MEMBER_SELECTION_BOX ($def="0", $add_all=false, $return=false, $non // 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) { @@ -923,7 +923,7 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct } // 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 diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index 71fd7b8419..9b9479cc66 100644 --- a/inc/modules/admin/what-admin_add.php +++ b/inc/modules/admin/what-admin_add.php @@ -56,7 +56,7 @@ if (!IS_FORM_SENT()) $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)) { diff --git a/inc/modules/admin/what-adminedit.php b/inc/modules/admin/what-adminedit.php index b881b990a8..87a8575d87 100644 --- a/inc/modules/admin/what-adminedit.php +++ b/inc/modules/admin/what-adminedit.php @@ -49,7 +49,7 @@ ADD_DESCR("admin", __FILE__); $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')); } @@ -163,8 +163,8 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { // 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( @@ -215,11 +215,11 @@ WHERE ".$AND." AND id=%s LIMIT 1", 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); @@ -242,7 +242,7 @@ WHERE ".$AND." AND id=%s LIMIT 1", 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); diff --git a/inc/modules/admin/what-guest_add.php b/inc/modules/admin/what-guest_add.php index f16e48835c..6cc9d0b23d 100644 --- a/inc/modules/admin/what-guest_add.php +++ b/inc/modules/admin/what-guest_add.php @@ -56,7 +56,7 @@ if (!IS_FORM_SENT()) { $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)) { diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index 463d73a724..a0136ee33c 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -49,7 +49,7 @@ ADD_DESCR("admin", __FILE__); $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 @@ -248,11 +248,11 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) 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); diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index c30a89b4c8..c88090e171 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -93,7 +93,7 @@ if (REQUEST_ISSET_GET(('access'))) { if (isDirectory($dir)) { // logs directory does exist OUTPUT_HTML("
    "); - $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") { diff --git a/inc/modules/admin/what-mem_add.php b/inc/modules/admin/what-mem_add.php index a0b00cbd28..155609cbde 100644 --- a/inc/modules/admin/what-mem_add.php +++ b/inc/modules/admin/what-mem_add.php @@ -56,7 +56,7 @@ if (!IS_FORM_SENT()) { $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 diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php index e657f36cde..72c27ee5f8 100644 --- a/inc/modules/admin/what-memedit.php +++ b/inc/modules/admin/what-memedit.php @@ -49,7 +49,7 @@ ADD_DESCR("admin", __FILE__); $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')); } @@ -183,7 +183,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { 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 @@ -224,10 +224,10 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { 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); } @@ -246,7 +246,7 @@ if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO())) { $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); diff --git a/inc/modules/admin/what-repair_amenu.php b/inc/modules/admin/what-repair_amenu.php index bed468a7f6..6c4348548a 100644 --- a/inc/modules/admin/what-repair_amenu.php +++ b/inc/modules/admin/what-repair_amenu.php @@ -48,7 +48,7 @@ ADD_DESCR("admin", __FILE__); $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 @@ -64,7 +64,7 @@ while ($content = SQL_FETCHARRAY($result_fix)) { } // 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) { diff --git a/inc/modules/admin/what-repair_gmenu.php b/inc/modules/admin/what-repair_gmenu.php index a91e6d740c..916cc08e5d 100644 --- a/inc/modules/admin/what-repair_gmenu.php +++ b/inc/modules/admin/what-repair_gmenu.php @@ -47,7 +47,7 @@ ADD_DESCR("admin", __FILE__); $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 @@ -61,7 +61,7 @@ while ($content = SQL_FETCHARRAY($result_fix)) { $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) { diff --git a/inc/modules/admin/what-repair_mmenu.php b/inc/modules/admin/what-repair_mmenu.php index 59092aeaad..efcdd59a48 100644 --- a/inc/modules/admin/what-repair_mmenu.php +++ b/inc/modules/admin/what-repair_mmenu.php @@ -48,7 +48,7 @@ ADD_DESCR("admin", __FILE__); $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 @@ -64,7 +64,7 @@ while ($content = SQL_FETCHARRAY($result_fix)) { } // 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) { diff --git a/inc/modules/admin/what-theme_import.php b/inc/modules/admin/what-theme_import.php index 1f75f6654b..0cc67e7c31 100644 --- a/inc/modules/admin/what-theme_import.php +++ b/inc/modules/admin/what-theme_import.php @@ -95,7 +95,7 @@ $THEMES = array( ); // 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); diff --git a/inc/modules/guest/what-sponsor_infos.php b/inc/modules/guest/what-sponsor_infos.php index 24d571776d..a651cee891 100644 --- a/inc/modules/guest/what-sponsor_infos.php +++ b/inc/modules/guest/what-sponsor_infos.php @@ -56,7 +56,7 @@ $result_act = SQL_QUERY("SELECT DISTINCT m.title, c.conv_rate, c.conv_name 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) { diff --git a/inc/modules/member/what-themes.php b/inc/modules/member/what-themes.php index 461b2769ad..9d794f9135 100644 --- a/inc/modules/member/what-themes.php +++ b/inc/modules/member/what-themes.php @@ -76,7 +76,7 @@ $THEMES = array( ); // 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); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 5e97ba5b0c..326edc5ceb 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -60,10 +60,10 @@ if ((empty($MySQL['login'])) && (!isInstalling()) && (!REQUEST_ISSET_GET('instal OUTPUT_HTML("{--LANG_WARNING--}: "); 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!!! diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index d8cbc5e2d1..111c65c3ef 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -59,7 +59,7 @@ function ADD_MODULE_TITLE ($mod) { 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); @@ -142,7 +142,7 @@ function checkModulePermissions ($mod) { } } 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 @@ -255,7 +255,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { $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"; @@ -371,7 +371,7 @@ function ADD_MENU ($MODE, $act, $wht) { } // 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']."*
    \n"; if (SQL_NUMROWS($result_main) > 0) { @@ -706,7 +706,7 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) { 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); } @@ -883,7 +883,7 @@ function SEND_MODE_MAILS($mod, $modes) { 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 } @@ -1554,7 +1554,7 @@ function activateExchange () { 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" )); diff --git a/mailid_top.php b/mailid_top.php index dda1814a29..572b59acc0 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -124,7 +124,7 @@ if (isInstalled()) { 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...