} // END - if
// Destroy cache here
- if (GET_EXT_VERSION("cache") >= "0.1.2") {
- if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy();
- unset($cacheArray['modules']);
- } // END - if
+ REBUILD_CACHE("mod_reg", "modreg");
// And reload data
$ret = CHECK_MODULE($mod_chk);
$prefix .= " -> ";
- if (ereg(".php", $search)) {
- $search = substr($search, 0, strpos($search, ".php"));
- }
+ // We need to remove .php and the end
+ if (substr($search, -4, 4) == ".php") {
+ // Remove the .php
+ $search = substr($search, 0, -4);
+ } // END - i
+ // Get the title from menu
$result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE %s='%s' ".$AND." LIMIT 1",
array($ACC_LVL, $type, $search), __FILE__, __LINE__);
} elseif (((GET_EXT_VERSION("sql_patches") >= "0.2.3") && ($_CONFIG['youre_here'] == "Y")) || ((IS_ADMIN()) && ($MOD_CHECK == "admin"))) {
// Output HTML code
$OUT = $prefix."<STRONG><A class=\"you_are_here\" href=\"".URL."/modules.php?module=".$MOD_CHECK."&".$type."=".$search.$LINK_ADD."\">".$ret."</A></STRONG>\n";
+
+ // Can we close the you-are-here navigation?
//* DEBUG: */ echo __LINE__."*".$type."/".$GLOBALS['what']."*<br />\n";
- if (($type == "what") || (($type == "action") && (!isset($_GET['what'])) && ($GLOBALS['what'] != "welcome"))) {
+ //* DEBUG: */ die("<pre>".print_r($_CONFIG, true)."</pre>");
+ if (($type == "what") || (($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || (($GLOBALS['what'] == $_CONFIG['index_home']) && ($ACC_LVL == "guest"))))) {
//* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
$OUT .= "</DIV><br />\n";
$DEPTH="0";
// Handle failed logins here if not in guest
- if (($type != "guest") && (GET_EXT_VERSION("sql_patches") >= "0.4.7")) {
+ //* DEBUG: */ echo __FUNCTION__.":type={$type},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$ACC_LVL}<br />\n";
+ if ((($type == "what") || ($type == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == $_CONFIG['index_home']))) && ($ACC_LVL != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
// Handle failture
- $OUT .= HANDLE_LOGIN_FAILTURES($type);
+ $OUT .= HANDLE_LOGIN_FAILTURES($ACC_LVL);
} // END - if
} // END - if
}
}
// Return result of comparision
- //* DEBUG: */ if (!$ret) echo __LINE__."OK!<br>";
+ //* DEBUG: */ if (!$ret) echo __LINE__."OK!<br />";
return $ret;
}
//
if ((!empty($mod)) && (empty($LAST['module']))) { $LAST['module'] = $mod; $LAST['online'] = $onl; }
// So did we now have valid data and an unlocked user?
- //* DEBUG: */ echo $valPass."<br>".get_session('u_hash')."<br>";
+ //* DEBUG: */ echo $valPass."<br />".get_session('u_hash')."<br />";
if (($status == "CONFIRMED") && ($valPass == get_session('u_hash'))) {
// Account is confirmed and all cookie data is valid so he is definely logged in! :-)
$ret = true;
} else {
// Maybe got locked etc.
- //* DEBUG: */ echo __LINE__."!!!<br>";
+ //* DEBUG: */ echo __LINE__."!!!<br />";
destroy_user_session();
// Remove array elements to prevent errors
}
} else {
// Cookie data is invalid!
- //* DEBUG: */ echo __LINE__."***<br>";
+ //* DEBUG: */ echo __LINE__."***<br />";
// Remove array elements to prevent errors
unset($GLOBALS['userid']);
else
{
// Cookie data is invalid!
- //* DEBUG: */ echo __LINE__."///<br>";
+ //* DEBUG: */ echo __LINE__."///<br />";
destroy_user_session();
// Remove array elements to prevent errors
}
//
function UPDATE_LOGIN_DATA ($UPDATE=true) {
- global $LAST;
+ global $LAST, $_CONFIG;
if (!is_array($LAST)) $LAST = array();
// Are the required cookies set?
// This will be displayed on welcome page! :-)
if (empty($LAST['module'])) {
$LAST['module'] = $mod; $LAST['online'] = $onl;
- }
+ } // END - if
+
+ // "what" not set?
if (empty($GLOBALS['what'])) {
+ // Fix it to default
$GLOBALS['what'] = "welcome";
- }
+ if (!empty($_CONFIG['index_home'])) $GLOBALS['what'] = $_CONFIG['index_home'];
+ } // END - if
// Update last module / online time
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_module='%s', last_online=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
return $ret;
}
//
-function GET_MOD_DESCR($MODE, $wht)
+function GET_MOD_DESCR($MODE, $wht, $column="what")
{
- if (empty($wht)) $wht = "welcome";
+ // Fix empty "what"
+ if (empty($wht)) {
+ $wht = "welcome";
+ if (!empty($_CONFIG['index_home'])) $wht = $_CONFIG['index_home'];
+ } // END - if
+
+ // Default is not found
$ret = "??? (".$wht.")";
- $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE what='%s' LIMIT 1", array($MODE, $wht), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+
+ // Look for title
+ $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_%s_menu WHERE %s='%s' LIMIT 1",
+ array($MODE, $column, $wht), __FILE__, __LINE__);
+
+ // Is there an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch the title
list($ret) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- }
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
return $ret;
}
//
// Get action value from mode (admin/guest/member) and what-value
function GET_ACTION ($MODE, &$wht)
{
- global $ret; $ret = "";
- //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br>";
- if ((empty($wht)) && ($MODE != "admin"))
- {
+ global $ret, $_CONFIG;
+ // DEPRECATED: Init status
+ $ret = "";
+
+ //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br />";
+ if ((empty($wht)) && ($MODE != "admin")) {
$wht = "welcome";
- }
- if ($MODE == "admin")
- {
+ if (!empty($_CONFIG['index_home'])) $wht = $_CONFIG['index_home'];
+ } // END - if
+
+ if ($MODE == "admin") {
// Action value for admin area
- if (!empty($GLOBALS['action']))
- {
+ if (!empty($GLOBALS['action'])) {
// Get it directly from URL
return $GLOBALS['action'];
- }
- elseif (($wht == "overview") || (empty($GLOBALS['what'])))
- {
+ } elseif (($wht == "overview") || (empty($GLOBALS['what']))) {
// Default value for admin area
$ret = "login";
}
- }
- elseif (!empty($GLOBALS['action']))
- {
- // Fix welcome value
- if (empty($wht)) $wht = "welcome";
+ } elseif (!empty($GLOBALS['action'])) {
+ // Get it directly from URL
return $GLOBALS['action'];
- }
- else
- {
+ } else {
// Everything else will be touched after checking the module has a menu assigned
}
//* DEBUG: */ echo __LINE__."*".$ret."*<br />\n";
// Load from database
$result = SQL_QUERY_ESC("SELECT action FROM "._MYSQL_PREFIX."_%s_menu WHERE what='%s' LIMIT 1",
array($MODE, $wht), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
list($ret) = SQL_FETCHROW($result);
}
}
// Gets the matching what name from module
function GET_WHAT($MOD_CHECK) {
+ global $_CONFIG;
+
$wht = "";
//* DEBUG: */ echo __LINE__."!".$MOD_CHECK."!<br />\n";
switch ($MOD_CHECK)
case "login":
case "index":
$wht = "welcome";
+ if (($MOD_CHECK == "index") && (!empty($_CONFIG['index_home']))) $wht = $_CONFIG['index_home'];
break;
default:
$affectedRows = SQL_AFFECTEDROWS();
//* DEBUG: */ echo __FUNCTION__.":entries={$entries},affectedRows={$affectedRows}<br />\n";
- // Destroy cache?
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && ($affectedRows == 1)) {
- global $cacheInstance, $_CONFIG, $CSS;
- if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
-
- // Rebuid the cache
- require(PATH."inc/loader/load_cache-config.php");
- } // END - if
+ // Rebuild cache
+ REBUILD_CACHE("config", "config");
}
// Creates a new task for updated extension
function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) {
// Free memory
SQL_FREERESULT($result);
}
-// Handle menu-depending failed logins and return the rendered content
-function HANDLE_LOGIN_FAILTURES ($menuType) {
- // Default output is empty ;-)
- $OUT = "";
-
- // Guest menus doesn't have login failtures so is the session data set?
- if (($menuType != "guest") && (isSessionVariableSet('mxchange_'.$menuType.'_failtures')) && (isSessionVariableSet('mxchange_'.$menuType.'_last_fail'))) {
- // Non-guest has login failtures found, get both data and prepare it for template
- $content = array(
- 'login_failtures' => get_session('mxchange_'.$menuType.'_failtures'),
- 'last_failture' => MAKE_DATETIME(get_session('mxchange_'.$menuType.'_last_fail'), "2")
- );
-
- // Load template
- $OUT = LOAD_TEMPLATE("login_failture", true, $content);
-
- // Reset session data
- set_session('mxchange_'.$menuType.'_failtures', "");
- set_session('mxchange_'.$menuType.'_last_fail', "");
- } // END - if
-
- // Return rendered content
- return $OUT;
-}
//
?>