X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmysql-manager.php;h=a233f5b7ebdf196ec193c83718d59b5f4fdd7ccd;hb=d5ee31ebfc85f22fc691b8c2753c42e188c1c4ef;hp=1e4856595c3ab9a5fdb71470c18166528982673b;hpb=f13b0c89b6dce2dc31ef3c58f0e2ad4821d7bee8;p=mailer.git diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 1e4856595c..a233f5b7eb 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -37,10 +37,13 @@ if (!defined('__SECURITY')) { require($INC); } -// -function ADD_MODULE_TITLE($mod) { - global $cacheArray, $_CONFIG; - $name = ""; $result = false; +// Returns the title for given module +function ADD_MODULE_TITLE ($mod) { + global $cacheArray; + + // Init variables + $name = ""; + $result = false; // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { @@ -50,10 +53,10 @@ function ADD_MODULE_TITLE($mod) { $name = $cacheArray['modules']['title'][$mod]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } - } else { + 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", array($mod), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1", array($mod), __FILE__, __LINE__); list($name) = SQL_FETCHROW($result); SQL_FREERESULT($result); } @@ -65,7 +68,7 @@ function ADD_MODULE_TITLE($mod) { // Still no luck or empty title? if (empty($name)) { // No name found - $name = sprintf("%s (%s)", LANG_UNKNOWN_MODULE, $mod); + $name = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod); if (SQL_NUMROWS($result) == 0) { // Add module to database $dummy = CHECK_MODULE($mod); @@ -79,7 +82,7 @@ function ADD_MODULE_TITLE($mod) { // Check validity of a given module name (no file extension) function CHECK_MODULE ($mod) { // We need them now here... - global $cacheArray, $_CONFIG, $cacheInstance; + global $cacheArray, $cacheInstance; // Filter module name (names with low chars and underlines are fine!) $mod = preg_replace("/[^a-z_]/", "", $mod); @@ -105,7 +108,7 @@ function CHECK_MODULE ($mod) { // Check if cache is latest version $locked = "Y"; $hidden = "N"; $admin = "N"; $mem = "N"; $found = false; - if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module']))) { + if (GET_EXT_VERSION("cache") >= "0.1.2") { // Is the module cached? if (isset($cacheArray['modules']['locked'][$mod_chk])) { // Check cache @@ -115,15 +118,15 @@ function CHECK_MODULE ($mod) { $mem = $cacheArray['modules']['mem_only'][$mod_chk]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); $found = true; } else { // No, then we have to update it! $ret = "cache_miss"; } - } else { + } 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", array($mod_chk), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1", array($mod_chk), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Read data list($locked, $hidden, $admin, $mem) = SQL_FETCHROW($result); @@ -132,37 +135,40 @@ function CHECK_MODULE ($mod) { } } - // Check returned values against current access permissions - // - // Admin access ----- Guest access ----- --- Guest or member? --- - if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_MEMBER())))) { - // If you are admin you are welcome for everything! - $ret = "done"; - } elseif ($locked == "Y") { - // Module is locked - $ret = "locked"; - } elseif (($mem == "Y") && (!IS_MEMBER())) { - // You have to login first! - $ret = "mem_only"; - } elseif (($admin == "Y") && (!IS_ADMIN())) { - // Only the Admin is allowed to enter this module! - $ret = "admin_only"; - } + // Is the module found? + if ($found === true) { + // Check returned values against current access permissions + // + // Admin access ----- Guest access ----- --- Guest or member? --- + if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_MEMBER())))) { + // If you are admin you are welcome for everything! + $ret = "done"; + } elseif ($locked == "Y") { + // Module is locked + $ret = "locked"; + } elseif (($mem == "Y") && (!IS_MEMBER())) { + // You have to login first! + $ret = "mem_only"; + } elseif (($admin == "Y") && (!IS_ADMIN())) { + // Only the Admin is allowed to enter this module! + $ret = "admin_only"; + } + } // END - if // Still no luck or not found? - if (($ret == "major") || ($ret == "cache_miss") || (!$found)) { + if (($ret == "cache_miss") || (!$found)) { // ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name --- - if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", PATH, $extension, $mod)))) { + if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) { // Data is missing so we add it if (GET_EXT_VERSION("sql_patches") >= "0.3.6") { // Since 0.3.6 we have a has_menu column, this took me a half hour // to find a loop here... *sigh* - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_mod_reg + SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mod_reg` (module, locked, hidden, mem_only, admin_only, has_menu) VALUES ('%s','Y','N','N','N','N')", array($mod_chk), __FILE__, __LINE__); } else { // Wrong/missing sql_patches! - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_mod_reg + SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mod_reg` (module, locked, hidden, mem_only, admin_only) VALUES ('%s','Y','N','N','N')", array($mod_chk), __FILE__, __LINE__); } @@ -182,15 +188,26 @@ function CHECK_MODULE ($mod) { // Module not found we don't add it to the database $ret = "404"; } - } // END - if + } elseif (!$found) { + // Problem with module detected + DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s", + $mod, + $ret, + $locked, + $hidden, + $mem, + $admin + )); + } // Return the value return $ret; } // Add menu description pending on given file name (without path!) -function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { - global $NAV_DEPTH, $_CONFIG; +function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) { + global $NAV_DEPTH; + // Use only filename of the file ;) $file = basename($file); @@ -214,7 +231,7 @@ function ADD_DESCR($ACC_LVL, $file, $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"; @@ -230,7 +247,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { case "member": $modCheck = $GLOBALS['module']; if (!IS_ADMIN()) { - $AND = " AND visible='Y' AND locked='N'"; + $AND = " AND `visible`='Y' AND `locked`='N'"; } break; } @@ -251,7 +268,7 @@ function ADD_DESCR($ACC_LVL, $file, $return = false, $output = true) { } if ((!isset($NAV_DEPTH)) && (!$return)) { $NAV_DEPTH = 0; - $prefix = "
".print_r($_CONFIG, true).""); if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview")))) { //* DEBUG: */ echo __LINE__."+".$type."+
"); + if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML(" |
");
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."* \n"; - include ($INC_BLOCK); + LOAD_INC($INC_BLOCK); //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."* \n"; - if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML(" |
-
"; - debug_print_backtrace(); - die(""); - } // END - if - - // Initialize variables - $uid = 0; $rid = 0; $MEM = "N"; $ADMIN = "N"; - - // Valid userid? - if ((!empty($GLOBALS['userid'])) && ($GLOBALS['userid'] > 0) && (IS_MEMBER())) { - // Is valid user - $uid = bigintval($GLOBALS['userid']); - $MEM = "Y"; - } // END - if - - if (IS_ADMIN()) { - // Is administrator - $ADMIN = "Y"; - } // END - if - - if (isSessionVariableSet('refid')) { - // Check cookie - if (get_session('refid') > 0) $rid = bigintval($GLOBALS['refid']); - } // END - if - - // Now search for the user - $result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_online -WHERE sid='%s' LIMIT 1", - array($SID), __FILE__, __LINE__); - // Entry found? - if (SQL_NUMROWS($result) == 1) { - // Then update it - SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_online SET -module='%s', -action='%s', -what='%s', -userid=%s, -refid=%s, -is_member='%s', -is_admin='%s', -timestamp=UNIX_TIMESTAMP() -WHERE sid='%s' LIMIT 1", - array($mod, $act, $wht, $uid, $rid, $MEM, $ADMIN, $SID), __FILE__, __LINE__ - ); - } else { - // No entry does exists so we simply add it! - SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_online (module, action, what, userid, refid, is_member, is_admin, timestamp, sid, ip) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')", - array($mod, $act, $wht, $uid, $rid, $MEM, $ADMIN, $SID, GET_REMOTE_ADDR()), __FILE__, __LINE__ - ); - } - - // Free result - SQL_FREERESULT($result); - - // Purge old entries - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_online WHERE timestamp <= (UNIX_TIMESTAMP() - %s)", - array($_CONFIG['online_timeout']), __FILE__, __LINE__); -} // OBSOLETE: Sends out mail to all administrators function SEND_ADMIN_EMAILS ($subj, $msg) { // Load all admin email addresses - $result = SQL_QUERY("SELECT email FROM "._MYSQL_PREFIX."_admins ORDER BY id ASC", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id` ASC", __FILE__, __LINE__); while (list($email) = SQL_FETCHROW($result)) { // Send the email out SEND_EMAIL($email, $subj, $msg); @@ -1423,19 +1318,20 @@ function SEND_ADMIN_EMAILS ($subj, $msg) { // Really simple... ;-) } + // Get ID number from administrator's login name function GET_ADMIN_ID ($login) { - global $cacheArray, $_CONFIG; + global $cacheArray; $ret = "-1"; - if (!empty($cacheArray['admins']['aid'][$login])) { + if (isset($cacheArray['admins']['aid'][$login])) { // Check cache $ret = $cacheArray['admins']['aid'][$login]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database - $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1", array($login), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { list($ret) = SQL_FETCHROW($result); @@ -1446,21 +1342,33 @@ function GET_ADMIN_ID ($login) { } return $ret; } -// + +// "Getter" for current admin id +function GET_CURRENT_ADMIN_ID () { + // Get the admin login from session + $adminLogin = get_session('admin_login'); + + // "Solve" it into an id + $adminId = GET_ADMIN_ID($adminLogin); + + // Secure and return it + return bigintval($adminId); +} + // Get password hash from administrator's login name function GET_ADMIN_HASH ($aid) { - global $cacheArray, $_CONFIG; + global $cacheArray; $ret = "-1"; - if (!empty($cacheArray['admins']['password'][$aid])) { + if (isset($cacheArray['admins']['password'][$aid])) { // Check cache $ret = $cacheArray['admins']['password'][$aid]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database - $result = SQL_QUERY_ESC("SELECT password FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1", array($aid), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Fetch data @@ -1477,17 +1385,17 @@ function GET_ADMIN_HASH ($aid) } // function GET_ADMIN_LOGIN ($aid) { - global $cacheArray, $_CONFIG; + global $cacheArray; $ret = "***"; - if (!empty($cacheArray['admins']['login'][$aid])) { + if (isset($cacheArray['admins']['login'][$aid])) { // Get cache $ret = $cacheArray['admins']['login'][$aid]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database - $result = SQL_QUERY_ESC("SELECT login FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT login FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1", array(bigintval($aid)), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Fetch data @@ -1504,20 +1412,20 @@ function GET_ADMIN_LOGIN ($aid) { } // Get email address of admin id function GET_ADMIN_EMAIL ($aid) { - global $cacheArray, $_CONFIG; + global $cacheArray; $ret = "***"; - if (!empty($cacheArray['admins']['email'][$aid])) { + if (isset($cacheArray['admins']['email'][$aid])) { // Get cache $ret = $cacheArray['admins']['email'][$aid]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database - $result_aid = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1", - array(bigintval($ret)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + $result_aid = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1", + array(bigintval($aid)), __FILE__, __LINE__); + if (SQL_NUMROWS($result_aid) == 1) { // Get data list($ret) = SQL_FETCHROW($result_aid); @@ -1534,18 +1442,18 @@ function GET_ADMIN_EMAIL ($aid) { } // Get default ACL of admin id function GET_ADMIN_DEFAULT_ACL ($aid) { - global $cacheArray, $_CONFIG; + global $cacheArray; $ret = "***"; - if (!empty($cacheArray['admins']['def_acl'][$aid])) { + if (isset($cacheArray['admins']['def_acl'][$aid])) { // Use cache $ret = $cacheArray['admins']['def_acl'][$aid]; // Update cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } + incrementConfigEntry('cache_hits'); } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database - $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1", + $result_aid = SQL_QUERY_ESC("SELECT default_acl FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1", array(bigintval($aid)), __FILE__, __LINE__); if (SQL_NUMROWS($result_aid) == 1) { // Fetch data @@ -1563,16 +1471,16 @@ function GET_ADMIN_DEFAULT_ACL ($aid) { return $ret; } // -function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") { +function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where="") { $ret = ""; if ($table == "/ARRAY/") { // Selection from array if (is_array($id) && is_array($name) && sizeof($id) == sizeof($name)) { // Both are arrays foreach ($id as $idx => $value) { - $ret .= "\n"; } // END - foreach } // END - if } else { @@ -1581,23 +1489,23 @@ function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") if (!empty($special)) $SPEC = ", ".$special; $ORDER = $name.$SPEC; if ($table == "country") $ORDER = $special; - $result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM "._MYSQL_PREFIX."_%s ".$where." ORDER BY %s", - array($id, $ORDER, $table, $name), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM `{!_MYSQL_PREFIX!}_%s` ".$where." ORDER BY %s", + array($id, $ORDER, $table, $name), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { // Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option while (list($value, $title, $add) = SQL_FETCHROW($result)) { if (empty($special)) $add = ""; - $ret .= "\n"; } // END - while // Free memory SQL_FREERESULT($result); } else { // No data found - $ret = "\n"; + $ret = "\n"; } } @@ -1606,35 +1514,31 @@ function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") } // Activate exchange (DEPERECATED???) function activateExchange() { - global $_CONFIG; - $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__); - if (SQL_NUMROWS($result) >= $_CONFIG['activate_xchange']) - { - // Free memory - SQL_FREERESULT($result); + // Check total amount of users + $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true, " AND max_mails > 0"); + if ($totalUsers >= getConfig('activate_xchange')) { // Activate System $SQLs = array( - "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" + "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" ); // Run SQLs - foreach ($SQLs as $sql) { - $result = SQL_QUERY($sql, __FILE__, __LINE__); - } + RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs)); - // @TODO Destroy cache - } + // Rebuild cache + REBUILD_CACHE("config", "config"); + } // END - if } // function DELETE_USER_ACCOUNT($uid, $reason) { $points = 0; $result = SQL_QUERY_ESC("SELECT (SUM(p.points) - d.used_points) AS points -FROM "._MYSQL_PREFIX."_user_points AS p -LEFT JOIN "._MYSQL_PREFIX."_user_data AS d +FROM `{!_MYSQL_PREFIX!}_user_points` AS p +LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON p.userid=d.userid WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { @@ -1643,7 +1547,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__); SQL_FREERESULT($result); // Delete points entries as well - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s", array(bigintval($uid)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s", array(bigintval($uid)), __FILE__, __LINE__); // Update mediadata as well if (GET_EXT_VERSION("mediadata") >= "0.0.4") { @@ -1656,51 +1560,50 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__); } // Delete category selections as well... - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%s", - array(bigintval($uid)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s", + array(bigintval($uid)), __FILE__, __LINE__); // Remove from rallye if found if (EXT_IS_ACTIVE("rallye")) { - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE userid=%s", - array(bigintval($uid)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE userid=%s", + array(bigintval($uid)), __FILE__, __LINE__); } // Now a mail to the user and that's all... $msg = LOAD_EMAIL_TEMPLATE("del-user", array('text' => $reason), $uid); - SEND_EMAIL($uid, ADMIN_DEL_ACCOUNT, $msg); + SEND_EMAIL($uid, getMessage('ADMIN_DEL_ACCOUNT'), $msg); // Ok, delete the account! - $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__); } + // function META_DESCRIPTION ($mod, $wht) { - global $_CONFIG, $DEPTH; - // Exclude admin and member's area if (($mod != "admin") && ($mod != "login")) { // Construct dynamic description - $DESCR = MAIN_TITLE." ".trim($_CONFIG['title_middle'])." ".ADD_DESCR("guest", "what-".$wht, true); + $DESCR = "{!MAIN_TITLE!} ".trim(getConfig('title_middle'))." ".ADD_DESCR("guest", "what-".$wht, true); // Output it directly OUTPUT_HTML(""); } // END - if // Remove depth - unset($DEPTH); + unset($GLOBALS['ref_level']); } // function ADD_JACKPOT($points) { - $result = SQL_QUERY("SELECT points FROM "._MYSQL_PREFIX."_jackpot WHERE ok='ok' LIMIT 1", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FILE__, __LINE__); if (SQL_NUMROWS($result) == 0) { // Create line - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok','%s')", array($points), __FILE__, __LINE__); + SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_jackpot` (ok, points) VALUES ('ok','%s')", array($points), __FILE__, __LINE__); } else { // Free memory SQL_FREERESULT($result); // Update points - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points+%s WHERE ok='ok' LIMIT 1", - array($points), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_jackpot` SET points=points+%s WHERE ok='ok' LIMIT 1", + array($points), __FILE__, __LINE__); } } // @@ -1709,16 +1612,16 @@ function SUB_JACKPOT($points) { $ret = "-1"; // Get current points - $result = SQL_QUERY("SELECT points FROM "._MYSQL_PREFIX."_jackpot WHERE ok='ok' LIMIT 1", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FILE__, __LINE__); if (SQL_NUMROWS($result) == 0) { // Create line - SQL_QUERY("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok', 0.00000)", __FILE__, __LINE__); + SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_jackpot` (ok, points) VALUES ('ok', 0.00000)", __FILE__, __LINE__); } else { // Read points list($jackpot) = SQL_FETCHROW($result); if ($jackpot >= $points) { // Update points when there are enougth points in jackpot - SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points-%s WHERE ok='ok' LIMIT 1", + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_jackpot` SET points=points-%s WHERE ok='ok' LIMIT 1", array($points), __FILE__, __LINE__); $ret = $jackpot - $points; } // END - if @@ -1728,7 +1631,7 @@ function SUB_JACKPOT($points) { SQL_FREERESULT($result); } // -function IS_DEMO() { +function IS_DEMO () { return ((EXT_IS_ACTIVE("demo")) && (get_session('admin_login') == "demo")); } // @@ -1748,9 +1651,9 @@ function LOAD_CONFIG ($no="0") { if ((isset($CFG_DUMMY['cache_hits'])) && (EXT_IS_ACTIVE("cache"))) { $CFG_DUMMY['cache_hits']++; } // END - if - } else { + } elseif ((!EXT_IS_ACTIVE("cache")) || (!isset($cacheArray['config'][$no]))) { // Load config from DB - $result_config = SQL_QUERY_ESC("SELECT * FROM "._MYSQL_PREFIX."_config WHERE config=%d LIMIT 1", + $result_config = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_config` WHERE config=%d LIMIT 1", array(bigintval($no)), __FILE__, __LINE__); // Get config from database @@ -1768,8 +1671,6 @@ function LOAD_CONFIG ($no="0") { } // Gets the matching what name from module function GET_WHAT($modCheck) { - global $_CONFIG; - $wht = ""; //* DEBUG: */ echo __LINE__."!".$modCheck."!