Index: trunk/kernel/include/modules.php =================================================================== diff -u -r2848 -r2850 --- trunk/kernel/include/modules.php (.../modules.php) (revision 2848) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 2850) @@ -1,14 +1,14 @@ $value) { if(strlen($key)) @@ -33,7 +33,7 @@ } } } - + } } else @@ -44,14 +44,14 @@ if(strlen($key)) { $parsed=FALSE; - + $parser_name = $key . "_ParseEnv"; for($i=1; $i $value) - { + { $function_name = $key."_".$basename; if(function_exists($function_name)) { @@ -246,7 +246,7 @@ { global $ExtraVars; - $ExtraVars[$Var] = $Value; + $ExtraVars[$Var] = $Value; } function UnregisterEnv($Var) @@ -294,7 +294,7 @@ global $mod_prefix, $modules_loaded; $mod = array(); if(is_array($mod_prefix) && is_array($modules_loaded)) - { + { foreach ($mod_prefix as $key=>$value) { if($key != 'bbcat' && _ModuleLicensed($modules_loaded[$key]) || $key=="m") @@ -320,33 +320,33 @@ } function admin_login() -{ +{ global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny; // echo "
"; print_r($objSession); echo "
"; - + if( GetVar('help_usage') == 'install' ) return true; - + $env_arr = explode('-', $_GET['env']); $get_session_key = $env_arr[0]; $admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && !$admin_login)) { - if( isset($_GET['expired']) && ($_GET['expired'] == 1) ) + if( isset($_GET['expired']) && ($_GET['expired'] == 1) ) $login_error = admin_language("la_text_sess_expired"); - + return FALSE; //echo "Expired
"; } - + if ($objSession->HasSystemPermission("ADMIN") == 1) return TRUE; if(count($_POST)==0 || $_POST["adminlogin"]!=1) - return FALSE; + return FALSE; $login=$_POST["login"]; $password = $_POST["password"]; - + if (strlen($login) && strlen($password)) - { + { if(!_IpAccess($_SERVER['REMOTE_ADDR'],$g_Allow,$g_Deny)) { $login_error = admin_language("la_text_address_denied"); @@ -355,9 +355,9 @@ $valid = $objSession->Login($login, md5($password)); $hasperm = ($objSession->HasSystemPermission("ADMIN") == 1); if (($login=="root" || $hasperm) && $valid) - { + { if(_ValidateModules()) - { + { return TRUE; } else @@ -396,13 +396,13 @@ { global $var_list, $objConfig; - if((!$_COOKIE["sid"] && $objConfig->Get("CookieSessions")>0 && strlen($var_list["sid"])<2 && !headers_sent()) + if((!$_COOKIE["sid"] && $objConfig->Get("CookieSessions")>0 && strlen($var_list["sid"])<2 && !headers_sent()) || strlen($_COOKIE["sid"])>0) { - return TRUE; + return TRUE; } else - return FALSE; + return FALSE; } function _IsSpider($UserAgent) @@ -412,10 +412,10 @@ $lines = file($pathtoroot."robots_list.txt"); if(!is_array($robots)) - { + { $robots = array(); for($i=0;$i1 && !$IsIp) { @@ -452,7 +452,7 @@ function _MatchIp($ip1,$ip2) { $matched = TRUE; - + $ip = explode(".",$ip1); $MatchIp = explode(".",$ip2); for($i=0;$i"; - $domain = _GetDomain(); + $domain = _GetDomain(); //echo "Domain: ".$domain."
"; if(!_IsLocalSite($domain)) - { + { $domain = _StripDomainHost($domain); //echo "New domain: $domain
"; // echo "
"; print_r($i_Keys); echo "
"; for($x=0;$x0) - { + { return TRUE; } } - else - return TRUE; + else + return TRUE; return FALSE; } @@ -542,23 +542,23 @@ { $GLOBALS["g_".$key] = current($vars); next($vars); - } + } $lic = base64_decode($GLOBALS['g_License']); - + _ParseLicense($lic); $modules = array(); if(!_IsLocalSite(_GetDomain())) - { + { for($x=0;$x"; - $modules = explode(",",$key["mod"]); + $modules = explode(",",$key["mod"]); } - } - //print_pre($modules); + } + //print_pre($modules); if(in_array($name,$modules)) { //echo "ok
"; return TRUE; @@ -574,15 +574,15 @@ function _GetDomain() { global $objConfig, $g_Domain; - + if($objConfig->Get("DomainDetect")) { $d = $_SERVER['HTTP_HOST']; } else $d = $g_Domain; - - return $d; + + return $d; } function _keyED($txt,$encrypt_key) @@ -593,7 +593,7 @@ for ($i=0;$i"; LogEntry("Loading Modules\n"); /* get the module list from the database */ -$adodbConnection = &GetADODBConnection(); +$adodbConnection = &GetADODBConnection(); $sql = "SELECT Name, Path, Var,TemplatePath, RootCat from ".GetTablePrefix()."Modules where Loaded=1 ORDER BY LoadOrder"; $rs = $adodbConnection->Execute($sql); @@ -777,12 +777,12 @@ if(is_array($mod_prefix)) { foreach($mod_prefix as $key => $value) - { + { - $mod = $pathtoroot . $value . "parser.php"; + $mod = $pathtoroot . $value . "parser.php"; // LogEntry("Loading parser $mod \n"); require_once($mod); - + } } $LogLevel--; @@ -797,7 +797,7 @@ $SessionQueryString = TRUE; if(is_array($mod_prefix)) - ParseEnv(); + ParseEnv(); /* create the session object */ @@ -807,9 +807,9 @@ if ( !isset($_GET['env']) ) $_GET['env'] = ''; if(strlen($var_list["sid"])==0 && strlen($_GET["env"])>0 && $objConfig->Get("CookieSessions")==2) -{ +{ if(_IsSpider($_SERVER["HTTP_USER_AGENT"])) - { + { $UseSession = FALSE; } else @@ -827,9 +827,9 @@ else { $UseSession = TRUE; } - + if($var_list["sid"]=="_") - $var_list["sid"]=""; + $var_list["sid"]=""; /*setup action variable*/ $Action = isset($_REQUEST['Action']) ? $_REQUEST['Action'] : ''; @@ -838,12 +838,12 @@ { $u = new clsUserSession($var_list["sid"] ,($SessionQueryString && $FrontEnd==1)); $u->Logout(); - unset($u); - $var_list_update["t"] = "index"; + unset($u); + $var_list_update["t"] = "index"; $var_list["t"] = ""; $var_list["sid"]=""; setcookie("login","",time()-3600, '', $_SERVER['HTTP_HOST']); - setcookie("sid","",time()-3600, '', $_SERVER['HTTP_HOST']); + setcookie("sid","",time()-3600, '', $_SERVER['HTTP_HOST']); } $CookieTest = isset($_COOKIE["cookies_on"]) ? $_COOKIE["cookies_on"] : ''; @@ -860,17 +860,17 @@ $objSession = new clsUserSession($var_list["sid"],($SessionQueryString && $FrontEnd==1)); if($UseSession) -{ +{ if(!$objSession->ValidSession()) - { + { /* Get rid of Invalid Session and make a brand new one*/ // echo "Dumping Session ".$var_list["sid"]."
"; unset($var_list["sid"]); $objSession->GetNewSession(); $var_list["sid"] = $objSession->GetSessionKey(); $var_list_update["sid"]=$objSession->GetSessionKey(); - if(is_numeric($m_var_list["theme"])) - $objSession->SetThemeName($m_var_list["theme"]); + if(is_numeric($m_var_list["theme"])) + $objSession->SetThemeName($m_var_list["theme"]); if($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent()) setcookie("sid",$var_list["sid"], 0, '', $_SERVER['HTTP_HOST']); //echo "New Session: ".$objSession->GetSessionKey()."
\n"; @@ -883,13 +883,13 @@ } } else - { + { if($objSession->Get("Language")!=$m_var_list["lang"]) { $objSession->Set("Language",$m_var_list["lang"]); } $objSession->LoadSessionData(); - $objSession->UpdateAccessTime(); + $objSession->UpdateAccessTime(); $objSession->Update(); LoadEnv(); } @@ -900,7 +900,7 @@ if( !isset($CurrentTheme) ) $CurrentTheme = null; if(!is_object($CurrentTheme)) $CurrentTheme = $objThemes->GetItem($m_var_list["theme"]); - + $var_list["t"] = $CurrentTheme->GetTemplateById($var_list["t"]); $objSession->Set("Theme",$CurrentTheme->Get("Name")); } @@ -913,45 +913,45 @@ LogEntry("Loading Module action scripts\n"); ## Global Referer Template -$_local_t = isset($var_list['t']) ? $var_list['t'] : ''; +$_local_t = isset($var_list['t']) ? $var_list['t'] : ''; if(is_array($mod_prefix)) { foreach($mod_prefix as $key => $folder_name) { $var_to_global = $key.'_var_list'; global $$var_to_global; - + if( $FrontEnd==0 || !is_numeric($FrontEnd) || $FrontEnd==2) - { + { $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); $admin = $objConfig->Get("AdminDirectory"); if( !strlen($admin) ) $admin = "admin"; $adminURL = $rootURL.$admin; - $imagesURL = $adminURL."/images"; - + $imagesURL = $adminURL."/images"; + if( $key != 'bbcat' && _ModuleLicensed($modules_loaded[$key]) ) - { + { $mod = $pathtoroot.$folder_name."module_init.php"; - if( file_exists($mod) ) require_once($mod); - + if( file_exists($mod) ) require_once($mod); + $mod = $pathtoroot.$folder_name."action.php"; - if( file_exists($mod) ) require_once($mod); + if( file_exists($mod) ) require_once($mod); $mod = $pathtoroot.$folder_name."searchaction.php"; if( file_exists($mod) ) require_once($mod); - + } - + } if($FrontEnd==1 || $FrontEnd==2) { $mod = $pathtoroot.$folder_name."module_init.php"; if(file_exists($mod)) - require_once($mod); + require_once($mod); $mod = $pathtoroot.$folder_name."frontaction.php"; if(file_exists($mod)) - require_once($mod); + require_once($mod); } } }