break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ unset($dummy);
break;
}
break;
case "0.6.9": // SQL queries for v0.6.9
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Admin-Management' WHERE action = 'admins' AND what='' LIMIT 1";
+ $SQLs[] = "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!)
$UPDATE_NOTES = "Verwaltung nach Management umbenannt.";
break;
case "0.2.0": // SQL queries for v0.2.0
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Urlaubsmanagement' WHERE action = 'holiday' AND what='' LIMIT 1";
+ $SQLs[] = "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!)
$UPDATE_NOTES = "Mitgliedsmenü komplett umgebaut.";
break;
case "0.0.8": // SQL queries for v0.0.8
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Modul-Management' WHERE action = 'mods' AND what='' LIMIT 1";
+ $SQLs[] = "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!)
$UPDATE_NOTES = "Verwaltung auf Management umgestellt.";
break;
case "0.3.7": // SQL queries for v0.3.7
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Auszahlungsmanagement' WHERE action = 'payouts' AND what='' LIMIT 1";
+ $SQLs[] = "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!)
$UPDATE_NOTES = "Verwaltung nach Management umgestellt.";
break;
default: // Do stuff when extension is loaded
- $result_user = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX."_config WHERE config='0' LIMIT 1", __FILE__, __LINE__);
- $DUMMY = SQL_FETCHARRAY($result_user);
- $CONFIG['sponsor_min_points'] = $DUMMY['sponsor_min_points']; // Minimum points to order
- $CONFIG['sponsor_ref_points'] = $DUMMY['sponsor_ref_points']; // Additional points when a sponsor brings you another sponsor
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ $_CONFIG = array_merge($_CONFIG, $dummy);
+ unset($dummy);
break;
}
}
// Version number
-$EXT_VERSION = "0.4.3";
+$EXT_VERSION = "0.4.4";
// Auto-set extension version
if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4");
switch ($EXT_LOAD_MODE)
{
$SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE
action='themes' OR
what='themes' OR
-(action='stats' AND what='') OR
-(action='extras' AND what='') OR
-(action='rals' AND what='') OR
-(action='account' AND what='') LIMIT 7";
+(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)) LIMIT 7";
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='main' WHERE
action='stats' OR
action='extras' OR
break;
case "0.4.0": // SQL queries for v0.4.0
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Email-Management' WHERE action = 'email' AND what='' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Email-Management' WHERE action = 'email' AND (what='' OR what IS NULL) LIMIT 1";
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Email-Verwaltung nach Email-Management umbenannt.";
case "0.4.2": // SQL queries for v0.4.2
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_online` ADD INDEX `admin_member` (`is_admin`, `is_member`)";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Neuen Schlüssel zur Online-Tabelle hinzugefügt.";
break;
case "0.4.3": // SQL queries for v0.4.3
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_username` VARCHAR(255) NOT NULL DEFAULT ''";
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `proxy_password` VARCHAR(255) NOT NULL DEFAULT ''";
$SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('setup', 'config_proxy', 'Proxy-Einstellungen', 'Sollte Ihr Webserver sich hinter einem Proxy befinden, so können Sie hier MXChange so konfigurieren, dass es Updates durch diesen hindurch sucht!', 15)";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Proxy-Einstellungen hinzugefügt.";
+ break;
+
+ case "0.4.4": // SQL queries for v0.4.4
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` CHANGE `what` `what` VARCHAR(255) NULL DEFAULT NULL";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET what=NULL WHERE what=''";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET what=NULL WHERE what=''";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET what=NULL WHERE what=''";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` ADD INDEX `action` (`action`)";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `what`, ADD UNIQUE (`what`)";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Schlüssel in Admin-, Gast- und Mitgliedsmenü verbessert.";
break;
}
break;
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
-{
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
{
case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
// SQL commands to run
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`";
+ $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_urls` (
+`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) NOT NULL DEFAULT '0',
+`url` VARCHAR(255) NOT NULL DEFAULT '',
+`reward` double(20,5) NOT NULL DEFAULT '0.00000',
+`views_total` BIGINT(20) NOT NULL DEFAULT '0',
+`status` ENUM('PENDING','CONFIRMED', 'LOCKED') NOT NULL DEFAULT 'CONFIRMED',
+`registered` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+`last_locked` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
+`lock_reason` VARCHAR(255) NOT NULL DEFAULT '',
+PRIMARY KEY(`id`),
+UNIQUE KEY `userid_url` (`userid`, `url`)
+) TYPE=MyISAM COMMENT='Surfbar URLs'";
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
+ $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_locks` (
+`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) NOT NULL DEFAULT '0',
+`url_id` BIGINT(20) NOT NULL DEFAULT '0',
+`last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY(`id`),
+INDEX(`userid`),
+INDEX(`url_id`)
+) TYPE=MyISAM COMMENT='Surfbar reload locks'";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('extras','surfbar','Surfbar starten','Y','Y',5)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('surfbar','','Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('surfbar','surfbar_list_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',1)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('surfbar','surfbar_unlock_urls','Surfbar URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',2)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar ändern, wie Festvergütung, prozentuale Ref-Vergütung und vieles mehr.',3)";
// Load CSS file?
- $EXT_CSS = 'Y';
+ $EXT_CSS = "Y";
break;
case "remove": // Do stuff when removing extension
// SQL commands to run
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`";
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
+ $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `what` = 'surfbar' LIMIT 1";
+ $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 4";
break;
case "activate": // Do stuff when admin activates this extension
// SQL commands to run
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `visible` = 'Y'`, `locked` = 'N' WHERE `what` = 'surfbar' LIMIT 1";
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `locked` = 'Y' WHERE `what` = 'surfbar' LIMIT 1";
break;
case "update": // Update an extension
break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ $_CONFIG = array_merge($_CONFIG, $dummy);
+ unset($dummy);
break;
}
break;
case "0.3.1": // SQL queries for v0.3.1
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Mitglieder-Management' WHERE action = 'user' AND what='' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title = 'Mitglieder-Management' WHERE action = 'user' AND (what='' OR what IS NULL) LIMIT 1";
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Verwaltung auf Management umgestellt";
break;
default: // Do stuff when extension is loaded
- $DUMMY = LOAD_CONFIG("0");
- unset($DUMMY);
+ $dummy = LOAD_CONFIG();
+ unset($dummy);
break;
}
// Deprecated : $length
// Optional : $DATA
//
-function GEN_RANDOM_CODE($length, $code, $uid, $DATA="")
-{
+function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") {
global $_CONFIG;
+ // Fix missing _MAX constant
+ if (!defined('_MAX')) define('_MAX', 15235);
+
// Build server string
$server = $_SERVER['PHP_SELF'].":".getenv('HTTP_USER_AGENT').":".getenv('SERVER_SOFTWARE').":".getenv('REMOTE_ADDR').":".":".filemtime(PATH."inc/databases.php");
// Build key string
- $keys = SITE_KEY.":".DATE_KEY.":".$_CONFIG['secret_key'].":".$_CONFIG['file_hash'].":".date("d-m-Y (l-F-T)", $_CONFIG['patch_ctime']).":".$_CONFIG['master_salt'];
+ $keys = SITE_KEY.":".DATE_KEY;
+ if (isset($_CONFIG['secret_key'])) $keys .= ":".$_CONFIG['secret_key'];
+ if (isset($_CONFIG['file_hash'])) $keys .= ":".$_CONFIG['file_hash'];
+ $keys .= ":".date("d-m-Y (l-F-T)", $_CONFIG['patch_ctime']);
+ if (isset($_CONFIG['master_salt'])) $keys .= ":".$_CONFIG['master_salt'];
// Build string from misc data
$data = $code.":".$uid.":".$DATA;
// Calculate number for generating the code
$a = $code + _ADD - 1;
- // Generate hash with master salt from modula of number with the prime number and other data
- $saltedHash = generateHash(($a % _PRIME).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, $_CONFIG['master_salt']);
+ if (isset($_CONFIG['master_hash'])) {
+ // Generate hash with master salt from modula of number with the prime number and other data
+ $saltedHash = generateHash(($a % _PRIME).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, $_CONFIG['master_salt']);
- // Create number from hash
- $rcode = hexdec(substr($saltedHash, strlen($_CONFIG['master_salt']), 9)) / abs(_MAX - $a + sqrt(_ADD)) / pi();
+ // Create number from hash
+ $rcode = hexdec(substr($saltedHash, strlen($_CONFIG['master_salt']), 9)) / abs(_MAX - $a + sqrt(_ADD)) / pi();
+ } else {
+ // Generate hash with "hash of site key" from modula of number with the prime number and other data
+ $saltedHash = generateHash(($a % _PRIME).":".$server.":".$keys.":".$data.":".date("d-m-Y (l-F-T)", time()).":".$a, substr(sha1(SITE_KEY), 0, 8));
+
+ // Create number from hash
+ $rcode = hexdec(substr($saltedHash, 8, 9)) / abs(_MAX - $a + sqrt(_ADD)) / pi();
+ }
// At least 10 numbers shall be secure enought!
$len = $_CONFIG['code_length'];
$TITLE .= MAIN_TITLE;
// Add title of module? (middle decoration will also be added!)
- if (($_CONFIG['enable_mod_title'] == 'Y') || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == "admin")) $TITLE .= " ".trim($_CONFIG['title_middle'])." ".ADD_MODULE_TITLE($GLOBALS['module']);
+ if (isset($_CONFIG['enable_mod_title'])) {
+ if (($_CONFIG['enable_mod_title'] == 'Y') || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == "admin")) $TITLE .= " ".trim($_CONFIG['title_middle'])." ".ADD_MODULE_TITLE($GLOBALS['module']);
+ } // END - if
// Add title from what file
$MODE = "";
// Load main menu entries
$result_main = SQL_QUERY("SELECT action, title FROM "._MYSQL_PREFIX."_sponsor_menu
-WHERE what='' ".$WHERE."
+WHERE (what='' OR what IS NULL) ".$WHERE."
ORDER BY sort", __FILE__, __LINE__);
if (SQL_NUMROWS($result_main) > 0)
{
//
// Load extensions
//
-if (EXT_IS_ACTIVE("cache"))
-{
+if (EXT_IS_ACTIVE("cache")) {
// Load cache extension alone
include_once(PATH."inc/libs/cache_functions.php");
$cacheMode = "";
include_once(PATH."inc/extensions/ext-cache.php");
- switch($cacheInstance->cache_file("extensions", true))
- {
+ switch($cacheInstance->cache_file("extensions", true)) {
case true : $cacheMode = "load"; break;
case false: $cacheMode = "init"; break;
}
$cacheMode = "no";
}
-if ($cacheMode == "load")
-{
+if ($cacheMode == "load") {
// Load more cache files (like admins)
require_once(PATH."inc/load_cache.php");
// Load extension data from cache file
$EXT_DUMMY = $cacheInstance->cache_load();
- foreach ($EXT_DUMMY['ext_name'] as $k=>$name)
- {
+ foreach ($EXT_DUMMY['ext_name'] as $k=>$name) {
// Load functions file
if ($EXT_DUMMY['ext_funcs'][$k] == 'Y') require_once(PATH."inc/libs/".$name."_functions.php");
// Load Language file
- if ($EXT_DUMMY['ext_lang'][$k] == 'Y')
- {
+ if ($EXT_DUMMY['ext_lang'][$k] == 'Y') {
$INC = sprintf(PATH."inc/language/%s_%s.php", $name, GET_LANGUAGE());
if (file_exists($INC)) require_once($INC);
}
if ($EXT_DUMMY['ext_css'][$k] == 'Y') $EXT_CSS_FILES[] = "".$name.".css";
// Load extension file itself
- if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y') || (IS_ADMIN()))
- {
+ if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y') || (IS_ADMIN())) {
require_once(PATH."inc/extensions/ext-".$name.".php");
}
// No database load needed
$res_ext_crt = false;
-}
- else
-{
+} else {
// If current user is not admin load only activated extensions
// The admin shall use every available extension for testing purposes
if ((!IS_ADMIN()) && ($cacheMode != "init")) $ADD = " WHERE ext_active='Y'";
- if (GET_EXT_VERSION("sql_patches") >= "0.0.6")
- {
+ if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
// Query with CSS file from DB
$res_ext_crt = SQL_QUERY("SELECT id, ext_name, ext_lang_file, ext_has_css, ext_active, ext_version
FROM "._MYSQL_PREFIX."_extensions".$ADD."
ORDER BY ext_name", __FILE__, __LINE__);
- }
- else
- {
+ } else {
// Old obsulete query string
$res_ext_crt = SQL_QUERY("SELECT id, ext_name, ext_lang_file, ext_name, ext_active, ext_version
FROM "._MYSQL_PREFIX."_extensions".$ADD."
// Check if action/what pair is valid
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu
-WHERE action='%s' AND ((what='%s' AND what != 'overview') OR (what='' 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), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1)
{
$menuTitle = array();
// Build main menu
- $result_main = SQL_QUERY("SELECT action, title, descr FROM "._MYSQL_PREFIX."_admin_menu WHERE what='' ORDER BY sort, id DESC", __FILE__, __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", __FILE__, __LINE__);
$OUT = "";
if (SQL_NUMROWS($result_main) > 0)
{
//
function ADMIN_MENU_SELECTION($MODE, $default="", $defid="") {
$wht = "what != ''";
- if ($MODE == "action") $wht = "what='' 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), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0)
$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='' 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
else
{
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE what='' 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($_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='' 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($_GET['fid'])), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
else
{
// Main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE what='' 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);
if ($max > 0)
$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='' 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
else
{
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE what='' 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($_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='' 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($_GET['fid'])), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (empty($SUB))
{
// List only main menus
- $query = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_guest_menu WHERE what='' ORDER BY sort ASC", __FILE__, __LINE__);
+ $query = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_guest_menu WHERE (what='' OR what IS NULL) ORDER BY sort ASC", __FILE__, __LINE__);
}
else
{
$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='' ORDER BY sort", __FILE__, __LINE__);
+ $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
else
{
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE what='' 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($_GET['tid'])), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE what='' 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($_GET['fid'])), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
}
else
{
// Edit main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_menu WHERE what='' 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);
if ($max > 0)
global $link;
$ACTIONS = array();
// First fix all main menus (what="")...
-$result_fix = SQL_QUERY("SELECT id, action FROM "._MYSQL_PREFIX."_admin_menu WHERE what='' 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(list($id, $act) = SQL_FETCHROW($result_fix))
{
$cnt++;
}
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHERE act='logout' AND what='' LIMIT 1", __FILE__, __LINE__);
+$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHERE act='logout' AND (what='' OR what IS NULL) LIMIT 1", __FILE__, __LINE__);
// Now sort every each menu
foreach ($ACTIONS as $act)
global $link;
$ACTIONs = array();
// First fix all main menus (what="")...
-$result_fix = SQL_QUERY("SELECT id, action FROM "._MYSQL_PREFIX."_admin_menu WHERE what='' 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(list($id, $act) = SQL_FETCHROW($result_fix))
{
SQL_FREERESULT($result_fix);
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHERE action='logout' AND what='' LIMIT 1", __FILE__, __LINE__);
+$result_sort = 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='' 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(list($id, $act) = SQL_FETCHROW($result_fix))
{
$cnt++;
}
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHERE act='logout' AND what='' LIMIT 1", __FILE__, __LINE__);
+$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHERE act='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='' 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(list($id, $act) = SQL_FETCHROW($result_fix))
{
SQL_FREERESULT($result_fix);
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHERE action='logout' AND what='' 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='' 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(list($id, $act) = SQL_FETCHROW($result_fix))
{
$cnt++;
}
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='999' WHERE action='logout' AND what='' LIMIT 1", __FILE__, __LINE__);
+$result_sort = 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)
$ACTIONS = array();
// First fix all main menus (what="")...
-$result_fix = SQL_QUERY("SELECT id, action FROM "._MYSQL_PREFIX."_member_menu WHERE what='' 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(list($id, $act) = SQL_FETCHROW($result_fix))
{
SQL_FREERESULT($result_fix);
// Set logout weight to 999
-$result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='999' WHERE action='logout' AND what='' LIMIT 1", __FILE__, __LINE__);
+$result_sort = 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)
define('__DAILY_RESET', "1");
}
- // Load all extensions
- require_once(PATH."inc/load_extensions.php");
-
// Load "databases" aka static arrays
require_once(PATH."inc/databases.php");
// Include required files
require_once(PATH."inc/databases.php");
require_once(PATH."inc/theme-manager.php");
- require_once(PATH."inc/load_extensions.php");
// Check if we are in installation routine
$installPhp = basename($_SERVER['PHP_SELF']);
$MOD_CHECK = $GLOBALS['module'];
break;
}
- $AND = " AND what=''";
+ $AND = " AND (what='' OR what IS NULL)";
} elseif (ereg("what-", $file)) {
// This is an admin what file!
$type = "what";
}
// 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='' ".$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), __FILE__, __LINE__);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
else
{
// Admin login overview
- $SQL = SQL_QUERY_ESC("SELECT id, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s' AND what=''".$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), __FILE__, __LINE__, false);
}