Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Feb 1, 8:41 PM

in-portal

Index: trunk/kernel/include/modules.php
===================================================================
--- trunk/kernel/include/modules.php (revision 267)
+++ trunk/kernel/include/modules.php (revision 268)
@@ -1,901 +1,902 @@
<?php
/* List of installed modules and module-specific variables
Copyright 2002, Intechnic Corporation, All rights reserved
*/
setcookie("CookiesTest", "1");
$ExtraVars = array();
function ParseEnv()
{
global $env, $var_list, $mod_prefix,$objSession, $SessionQueryString;
/* parse individual sections */
$env = isset($_GET['env']) ? $_GET['env'] : '';
if ($env == "")
{
$var_list["t"] = "index";
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parser_name = $key . "_ParseEnv";
if(function_exists($parser_name))
{
@$parser_name();
}
}
}
}
}
else
{
$envsections = explode(":", $env);
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parsed=FALSE;
$parser_name = $key . "_ParseEnv";
for($i=1; $i<sizeof($envsections); $i++)
{
$pieces = explode("-", $envsections[$i]);
if(substr($pieces[0],0,strlen($key))==$key)
{
$parsed=TRUE;
if(function_exists($parser_name))
{
$parser_name($envsections[$i]);
}
}
}
if(!$parsed)
{
if(function_exists($parser_name))
{
@$parser_name();
}
}
}
}
$req_vars = explode("-", $envsections[0]);
$sid = $req_vars[0];
if(!$SessionQueryString)
{
if(!strlen($sid) || $sid=="_")
{
if($sid != "_")
$sid = $_COOKIE["sid"];
}
else
$SessionQueryString = TRUE;
}
$var_list["sid"] = $sid;
$var_list["t"] = $req_vars[1];
if( isset($_GET['dest']) )
$var_list['dest'] = $_GET['dest'];
}
}
function LoadEnv()
{
global $env, $var_list, $mod_prefix,$objSession;
$env = $_GET["env"];
// echo "Loading Variables..<br>\n";
if ($env != "")
{
$envsections = explode(":", $env);
foreach($mod_prefix as $key => $value)
{
if(strlen($key))
{
$parsed=FALSE;
for($i=1; $i<sizeof($envsections); $i++)
{
$pieces = explode("-", $envsections[$i]);
if(substr($pieces[0],0,strlen($key))==$key)
{
$parsed=TRUE;
break;
}
}
if(!$parsed)
{
$parser_name = $key . "_LoadEnv";
//echo $parser_name;
if(function_exists($parser_name))
{
$parser_name();
}
}
else
{
$parser_name = $key . "_SaveEnv";
//echo $parser_name;
if(function_exists($parser_name))
{
$parser_name($envsections[$i]);
}
}
}
}
}
}
function BuildEnv($mod_prefix = false)
{
global $var_list,$m_var_list, $var_list_update, $mod_prefix, $objSession, $objConfig,
$ExtraVars, $objThemes, $CurrentTheme, $SessionQueryString, $FrontEnd;
static $theme;
$env = "";
//echo "Query String: $SessionQueryString<br>\n";
if(($objConfig->Get("CookieSessions")==0 || !$FrontEnd || ($objConfig->Get("CookieSessions")==2 && $SessionQueryString==TRUE)))
{
if(!$objSession->UseTempKeys)
{
$sessionkey = $objSession->GetSessionKey();
}
else
$sessionkey = $objSession->Get("CurrentTempKey");
$env = $sessionkey;
}
$env .= "-";
if (isset($var_list_update["t"]))
{
if($var_list_update["t"]=="_referer_")
{
$var_list_update["t"] =$objSession->GetVariable("Template_Referer");
}
$t = $var_list_update["t"];
if(!is_numeric($t))
{
if(!is_object($theme))
$theme = $objThemes->GetItem($m_var_list["theme"]);
$id = $theme->GetTemplateId($t);
$var_list_update["t"] = $id;
}
$env .= $var_list_update["t"];
}
else
{
$t = $var_list["t"];
if(!is_numeric($t))
{
if(!is_object($theme))
$theme = $objThemes->GetItem($m_var_list["theme"]);
$id = $theme->GetTemplateId($t);
$t = $id;
}
$env .= $t;
}
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
$builder_name = $key . "_BuildEnv";
if(function_exists($builder_name))
{
$GLOBALS[$key.'_var_list_update']['test'] = 'test';
$env .= $builder_name();
}
}
}
$extra = "";
$keys = array_keys($ExtraVars);
if(is_array($keys))
{
for($i=0;$i<count($keys);$i++)
{
$key = $keys[$i];
$e = "&".$key."=".$ExtraVars[$key];
$extra .= $e;
$e = "";
}
}
$env .= $extra;
return $env;
}
function CategoryActionFunc($basename,$CatList)
{
global $mod_prefix;
foreach($mod_prefix as $key => $value)
{
$function_name = $key."_".$basename;
if(function_exists($function_name))
{
$function_name($CatList);
}
}
}
function RegisterEnv($Var,$Value)
{
global $ExtraVars;
$ExtraVars[$Var] = $Value;
}
function UnregisterEnv($Var)
{
global $ExtraVars;
unset($ExtraVars[$Var]);
}
function ModuleTagPrefix($name)
{
global $modules_loaded;
$ret = "";
foreach($modules_loaded as $prefix=>$mod_name)
{
if($name==$mod_name)
{
$ret = $prefix;
break;
}
}
return $ret;
}
function ModuleEnabled($name)
{
global $template_path;
$a = array_keys($template_path);
if(in_array($name,$a))
return TRUE;
return FALSE;
}
function GetModuleArray($array_name="mod_prefix")
{
switch($array_name)
{
case "mod_prefix":
global $mod_prefix;
return $mod_prefix;
break;
case "admin":
global $mod_prefix, $modules_loaded;
$mod = array();
if(is_array($mod_prefix) && is_array($modules_loaded))
{
foreach ($mod_prefix as $key=>$value)
{
if(_ModuleLicensed($modules_loaded[$key]) || $key=="m")
{
$mod[$key] = $value;
}
}
}
return $mod;
break;
case "loaded":
global $modules_loaded;
return $modules_loaded;
break;
case "template":
global $template_path;
return $template_path;
case "rootcat":
global $mod_root_cats;
return $mod_root_cats;
break;
}
}
function admin_login()
{
global $objSession,$login_error, $objConfig,$g_Allow,$g_Deny;
//echo "<pre>"; print_r($objSession); echo "</pre>";
if( GetVar('help_usage') == 'install' ) return true;
$env_arr = explode('-', $_GET['env']);
$get_session_key = $env_arr[0];
- if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && $_POST['adminlogin'] != 1)) {
- if ($_GET['expired'] == 1) {
+ $admin_login = isset($_POST['adminlogin']) && $_POST['adminlogin']; // $_POST['adminlogin'] != 1
+ if(!$objSession->ValidSession() || ($objSession->GetSessionKey() != $get_session_key && !$admin_login)) {
+ if( isset($_GET['expired']) && ($_GET['expired'] == 1) )
$login_error = admin_language("la_text_sess_expired");
- }
+
return FALSE;
//echo "Expired<br>";
}
if ($objSession->HasSystemPermission("ADMIN") == 1)
return TRUE;
if(count($_POST)==0 || $_POST["adminlogin"]!=1)
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");
return FALSE;
}
$valid = $objSession->Login($login, md5($password));
$hasperm = ($objSession->HasSystemPermission("ADMIN") == 1);
if (($login=="root" || $hasperm) && $valid)
{
if(_ValidateModules())
{
return TRUE;
}
else
$login_error = "Missing or invalid In-Portal License";
}
else
{
if(!$hasperm && $valid)
{
$login_error = admin_language("la_text_nopermissions");
}
else
{
$login_error = admin_language("la_Text_Access_Denied");
}
return FALSE;
}
}
else
{
if(!strlen($login))
{
$login_error = admin_language("la_Text_Missing_Username");
}
else
if(!strlen($password))
$login_error = admin_language("la_Text_Missing_Password");
return FALSE;
}
}
#---------------------------------------------------------------------------
function _EnableCookieSID()
{
global $var_list, $objConfig;
if((!$_COOKIE["sid"] && $objConfig->Get("CookieSessions")>0 && strlen($var_list["sid"])<2 && !headers_sent())
|| strlen($_COOKIE["sid"])>0)
{
return TRUE;
}
else
return FALSE;
}
function _IsSpider($UserAgent)
{
global $robots, $pathtoroot;
$lines = file($pathtoroot."robots_list.txt");
if(!is_array($robots))
{
$robots = array();
for($i=0;$i<count($lines);$i++)
{
$l = $lines[$i];
$p = explode("\t",$l,3);
$robots[] = $p[2];
}
}
return in_array($UserAgent,$robots);
}
function _StripDomainHost($d)
{
$dotcount = substr_count($d,".");
if($dotcount==3)
{
$IsIp = TRUE;
for($x=0;$x<strlen($d);$x++)
{
if(!is_numeric(substr($d,$x,1)) && substr($d,$x,1)!=".")
{
$IsIp = FALSE;
break;
}
}
}
if($dotcount>1 && !$IsIp)
{
$p = explode(".",$d);
$ret = $p[count($p)-2].".".$p[count($p)-1];
}
else
$ret = $d;
return $ret;
}
function _MatchIp($ip1,$ip2)
{
$matched = TRUE;
$ip = explode(".",$ip1);
$MatchIp = explode(".",$ip2);
for($i=0;$i<count($ip);$i++)
{
if($i==count($MatchIp))
break;
if(trim($ip[$i]) != trim($MatchIp[$i]) || trim($ip[$i])=="*")
{
$matched=FALSE;
break;
}
}
return $matched;
}
function _IpAccess($IpAddress,$AllowList,$DenyList)
{
$allowed = explode(",",$AllowList);
$denied = explode(",",$DenyList);
$MatchAllowed = FALSE;
for($x=0;$x<count($allowed);$x++)
{
$ip = explode(".",$allowed[$x]);
$MatchAllowed = _MatchIp($IpAddress,$allowed[$x]);
if($MatchAllowed)
break;
}
$MatchDenied = FALSE;
for($x=0;$x<count($denied);$x++)
{
$ip = explode(".",$denied[$x]);
$MatchDenied = _MatchIp($IpAddress,$denied[$x]);
if($MatchDenied)
break;
}
$Result = (($MatchAllowed && !$MatchDenied) || (!$MatchAllowed && !$MatchDenied) ||
($MatchAllowed && $MatchDenied));
return $Result;
}
function _ValidateModules()
{
global $i_Keys, $objConfig, $g_License;
$lic = base64_decode($g_License);
_ParseLicense($lic);
$modules = array();
//echo "License: ".$lic."<br>";
$domain = _GetDomain();
//echo "Domain: ".$domain."<br>";
if(!_IsLocalSite($domain))
{
$domain = _StripDomainHost($domain);
//echo "New domain: $domain<br>";
// echo "<pre>"; print_r($i_Keys); echo "</pre>";
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if(strlen(stristr($key["domain"],$domain)))
{
$modules = explode(",",$key["mod"]);
//echo "Modules: $modules";
}
}
if(count($modules)>0)
{
return TRUE;
}
}
else
return TRUE;
return FALSE;
}
function _ModuleLicensed($name)
{
global $i_Keys, $objConfig, $pathtoroot;
$vars = parse_portal_ini($pathtoroot."config.php");
while($key = key($vars))
{
$key = "g_".$key;
global $$key;
$$key = current($vars); //variable variables
if(strlen($$key)>80)
{
$lic = base64_decode($$key);
}
next($vars);
}
//$lic = base64_decode($g_License);
_ParseLicense($lic);
$modules = array();
if(!_IsLocalSite(_GetDomain()))
{
for($x=0;$x<count($i_Keys);$x++)
{
$key = $i_Keys[$x];
if(strlen(stristr(_GetDomain(),$key["domain"])))
{
//echo "ok<br>";
$modules = explode(",",$key["mod"]);
}
}
if(in_array($name,$modules)) {
//echo "ok<br>";
return TRUE;
}
}
else {
return TRUE;
}
return FALSE;
}
function _GetDomain()
{
global $objConfig, $g_Domain;
if($objConfig->Get("DomainDetect"))
{
$d = $_SERVER['HTTP_HOST'];
}
else
$d = $g_Domain;
return $d;
}
function _keyED($txt,$encrypt_key)
{
$encrypt_key = md5($encrypt_key);
$ctr=0;
$tmp = "";
for ($i=0;$i<strlen($txt);$i++)
{
if ($ctr==strlen($encrypt_key)) $ctr=0;
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
$ctr++;
}
return $tmp;
}
function _decrypt($txt,$key)
{
$txt = _keyED($txt,$key);
$tmp = "";
for ($i=0;$i<strlen($txt);$i++)
{
$md5 = substr($txt,$i,1);
$i++;
$tmp.= (substr($txt,$i,1) ^ $md5);
}
return $tmp;
}
function LoadFromRemote()
{
return "";
}
function DLid()
{
global $lid;
echo $lid."\n";
die();
}
function _LoadLicense($LoadRemote=FALSE)
{
global $pathtoroot, $objConfig;
$f = $pathtoroot."intechnic.php";
if(file_exists($f))
{
$contents = file($f);
$data = base64_decode($contents[1]);
}
else
if($LoadRemote)
return $LoadFromRemote;
return $data;
}
function _VerifyKey($domain,$k)
{
$key = md5($domain);
$lkey = substr($key,0,strlen($key)/2);
$rkey = substr($key,strlen($key)/2);
$r = $rkey.$lkey;
if($k==$r)
return TRUE;
return FALSE;
}
function _ParseLicense($txt)
{
global $i_User, $i_Pswd, $i_Keys;
$data = _decrypt($txt,"beagle");
$i_Keys = array();
$lines = explode("\n",$data);
for($x=0;$x<count($lines);$x++)
{
$l = $lines[$x];
$p = explode("=",$l,2);
switch($p[0])
{
case "Username":
$i_User = $p[1];
break;
case "UserPass":
$i_Pswd = $p[1];
break;
default:
if(substr($p[0],0,3)=="key")
{
$parts = explode("|",$p[1]);
if(_VerifyKey($parts[0],$parts[1]))
{
unset($K);
$k["domain"]=$parts[0];
$k["key"]=$parts[1];
$k["desc"]=$parts[2];
$k["mod"]=$parts[3];
$i_Keys[] = $k;
}
}
break;
}
}
}
function _IsLocalSite($domain)
{
$localb = FALSE;
if(substr($domain,0,3)=="172")
{
$b = substr($domain,0,6);
$p = explode(".",$domain);
$subnet = $p[1];
if($p[1]>15 && $p[1]<32)
$localb=TRUE;
}
if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" ||
substr($domain,0,3)=="10." || $localb || strpos($domain,".")==0)
{
return TRUE;
}
return FALSE;
}
LogEntry("Loading Modules\n");
/* get the module list from the database */
$adodbConnection = GetADODBConnection();
$sql = "SELECT Name, Path, Var,TemplatePath, RootCat from ".GetTablePrefix()."Modules where Loaded=1 ORDER BY LoadOrder";
$rs = $adodbConnection->Execute($sql);
while($rs && !$rs->EOF)
{
$key = $rs->fields["Var"];
$mod_prefix[$key] = $rs->fields["Path"];
$modules_loaded[$key] = $rs->fields["Name"];
$name = $rs->fields["Name"];
$template_path[$name] = $rs->fields["TemplatePath"];
$mod_root_cats[$name] = $rs->fields["RootCat"];
// echo $key . "=". $modules_loaded[$key]."<br>\n";
$rs->MoveNext();
}
LogEntry("Loading Module Parser scripts\n");
/* for each module enabled, load up parser.php */
//foreach($mod_prefix as $key => $value)
$LogLevel++;
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $value)
{
$mod = $pathtoroot . $value . "parser.php";
// LogEntry("Loading parser $mod \n");
require_once($mod);
}
}
$LogLevel--;
LogEntry("Finished Loading Module Parser scripts\n");
/*now each module gets a look at the environment string */
$SessionQueryString = FALSE;
if(!isset($FrontEnd)) $FrontEnd = false;
if($FrontEnd != 1)
$SessionQueryString = TRUE;
if(is_array($mod_prefix))
ParseEnv();
/* create the session object */
$ip = $_SERVER["REMOTE_ADDR"];
if ( !isset($var_list['sid']) ) $var_list['sid'] = '';
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
{
/* switch user to GET session var */
if (!$_COOKIE['sid']) {
$SessionQueryString = TRUE;
}
//else {
//$SessionQueryString = FALSE;
//}
$UseSession = TRUE;
}
}
else {
$UseSession = TRUE;
}
if($var_list["sid"]=="_")
$var_list["sid"]="";
/*setup action variable*/
$Action = isset($_REQUEST['Action']) ? $_REQUEST['Action'] : '';
if($Action=="m_logout")
{
$u = new clsUserSession($var_list["sid"] ,($SessionQueryString && $FrontEnd==1));
$u->Logout();
unset($u);
$var_list_update["t"] = "index";
$var_list["t"] = "";
$var_list["sid"]="";
setcookie("login","",time()-3600);
setcookie("sid","",time()-3600);
}
$CookieTest = isset($_COOKIE["CookiesTest"]) ? $_COOKIE["CookiesTest"] : '';
$HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if ( ($CookieTest == 1) || !strstr($HTTP_REFERER, $_SERVER['SERVER_NAME'].$objConfig->Get("Site_Path"))) {
$SessionQueryString = FALSE;
}
if ($FrontEnd != 1) {
$SessionQueryString = TRUE;
}
$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"]."<br>";
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($objConfig->Get("CookieSessions")>0 && !$SessionQueryString && !headers_sent())
setcookie("sid",$var_list["sid"]);
//echo "New Session: ".$objSession->GetSessionKey()."<br>\n";
if(isset($_COOKIE["login"]) && $Action != "m_logout" && $FrontEnd==1)
{
$parts = explode("|",$_COOKIE["login"]);
$username = $parts[0];
$pass = $parts[1];
$objSession->Login($username,$pass);
}
}
else
{ //echo "Update Session<br>";
if($objSession->Get("Language")!=$m_var_list["lang"])
{
$objSession->Set("Language",$m_var_list["lang"]);
}
$objSession->LoadSessionData();
$objSession->UpdateAccessTime();
$objSession->Update();
LoadEnv();
}
}
if(is_numeric($var_list["t"]))
{
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"));
}
/*create the global current user object */
$UserID=$objSession->Get("PortalUserId");
$objCurrentUser = new clsPortalUser($UserID);
$objLanguageCache = new clsLanguageCache($m_var_list["lang"]);
/* include each module's action.php script */
LogEntry("Loading Module action scripts\n");
## Global Referer Template
$_local_t = $var_list["t"];
if(is_array($mod_prefix))
{
foreach($mod_prefix as $key => $folder_name)
{
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";
if(_ModuleLicensed($modules_loaded[$key]))
{
$mod = $pathtoroot.$folder_name."module_init.php";
if( file_exists($mod) ) require_once($mod);
$mod = $pathtoroot.$folder_name."action.php";
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);
$mod = $pathtoroot.$folder_name."frontaction.php";
if(file_exists($mod))
require_once($mod);
}
}
}
if (strstr($_SERVER['SCRIPT_NAME'], 'install')) {
$objSession->Delete();
}
if( !isset($SearchPerformed) ) $SearchPerformed = false;
if($SearchPerformed == true) $objSearch->BuildIndexes();
LogEntry("Finished Loading Module action scripts\n");
?>
Property changes on: trunk/kernel/include/modules.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/kernel/startup.php
===================================================================
--- trunk/kernel/startup.php (revision 267)
+++ trunk/kernel/startup.php (revision 268)
@@ -1,149 +1,144 @@
<?php
/*
startup.php: this is the primary startup sequence for in-portal services
*/
if( file_exists($pathtoroot.'debug.php') && !defined('DEBUG_MODE') ) include_once($pathtoroot.'debug.php');
if( !defined('DEBUG_MODE') ) error_reporting(0);
ini_set('memory_limit', '16M');
$kernel_version = "1.0.0";
$FormError = array();
$FormValues = array();
/* include PHP version compatibility functions */
require_once($pathtoroot."compat.php");
/* set global variables and module lists */
require_once($pathtoroot."globals.php");
LogEntry("Initalizing System..\n");
/* for 64 bit timestamps */
require_once($pathtoroot."kernel/include/adodb/adodb-time.inc.php");
require_once($pathtoroot."kernel/include/dates.php");
/* create the global error object */
require_once($pathtoroot."kernel/include/error.php");
$Errors = new clsErrorManager();
require_once($pathtoroot."kernel/include/itemdb.php");
require_once($pathtoroot."kernel/include/config.php");
/* create the global configuration object */
LogEntry("Creating Config Object..\n");
$objConfig = new clsConfig();
$objConfig->Load(); /* Populate our configuration data */
LogEntry("Done Loading Configuration\n");
if( defined('ADODB_EXTENSION') && constant('ADODB_EXTENSION') > 0 )
LogEntry("ADO Extension: ".ADODB_EXTENSION."\n");
require_once($pathtoroot."kernel/include/parseditem.php");
require_once($pathtoroot."kernel/include/item.php");
require_once($pathtoroot."kernel/include/syscache.php");
require_once($pathtoroot."kernel/include/modlist.php");
require_once($pathtoroot."kernel/include/searchconfig.php");
require_once($pathtoroot."kernel/include/banrules.php");
$objModules = new clsModList();
$objSystemCache = new clsSysCacheList();
$objSystemCache->PurgeExpired();
$objBanList = new clsBanRuleList();
require_once($pathtoroot."kernel/include/image.php");
require_once($pathtoroot."kernel/include/itemtypes.php");
$objItemTypes = new clsItemTypeList();
require_once($pathtoroot."kernel/include/theme.php");
$objThemes = new clsThemeList();
require_once($pathtoroot."kernel/include/language.php");
$objLanguages = new clsLanguageList();
$objImageList = new clsImageList();
/* Load session and user class definitions */
//require_once("include/customfield.php");
//require_once("include/custommetadata.php");
require_once($pathtoroot."kernel/include/usersession.php");
require_once($pathtoroot."kernel/include/favorites.php");
require_once($pathtoroot."kernel/include/portaluser.php");
require_once($pathtoroot."kernel/include/portalgroup.php");
/* create the user management class */
$objFavorites = new clsFavoriteList();
$objUsers = new clsUserManager();
$objGroups = new clsGroupList();
require_once($pathtoroot."kernel/include/cachecount.php");
require_once($pathtoroot."kernel/include/customfield.php");
require_once($pathtoroot."kernel/include/custommetadata.php");
require_once($pathtoroot."kernel/include/permissions.php");
require_once($pathtoroot."kernel/include/relationship.php");
require_once($pathtoroot."kernel/include/category.php");
require_once($pathtoroot."kernel/include/statitem.php");
/* category base class, used by all the modules at some point */
$objPermissions = new clsPermList();
$objPermCache = new clsPermCacheList();
$objCatList = new clsCatList();
$objCustomFieldList = new clsCustomFieldList();
$objCustomDataList = new clsCustomDataList();
$objCountCache = new clsCacheCountList();
require_once($pathtoroot."kernel/include/smtp.php");
require_once($pathtoroot."kernel/include/emailmessage.php");
require_once($pathtoroot."kernel/include/events.php");
LogEntry("Creating Mail Queue..\n");
$objMessageList = new clsEmailMessageList();
$objEmailQueue = new clsEmailQueue();
LogEntry("Done creating Mail Queue Objects\n");
require_once($pathtoroot."kernel/include/searchitems.php");
require_once($pathtoroot."kernel/include/advsearch.php");
require_once($pathtoroot."kernel/include/parse.php");
require_once($pathtoroot."kernel/include/socket.php");
/* responsible for including module code as required
This script also creates an instance of the user session onject and
handles all session management. The global session object is created
and populated, then the global user object is created and populated
each module's parser functions and action code is included here
*/
LogEntry("Startup complete\n");
include_once("include/modules.php");
/* startup is complete, so now check the mail queue to see if there's anything that needs to be sent*/
$objEmailQueue->SendMailQeue();
$ado=GetADODBConnection();
$rs = $ado->Execute("SELECT * FROM ".GetTablePrefix()."Modules WHERE LoadOrder = 0");
$kernel_version = $rs->fields['Version'];
$adminDir = $objConfig->Get("AdminDirectory");
if ($adminDir == '') {
$adminDir = 'admin';
}
if (strstr($_SERVER['SCRIPT_FILENAME'], $adminDir) && !GetVar('logout') && !strstr($_SERVER['SCRIPT_FILENAME'], "install") && !strstr($_SERVER['SCRIPT_FILENAME'], "index")) {
//echo "testz [".admin_login()."]<br>";
if (!admin_login())
{
- if(!headers_sent())
- setcookie("sid"," ",time()-3600);
+ if( !headers_sent() ) setcookie("sid"," ",time()-3600);
$objSession->Logout();
- if ($_GET['expired']) {
- header("Location: ".$adminURL."/login.php?expired=1");
- }
- else {
- header("Location: ".$adminURL."/login.php");
- }
+ $url_add = isset($_GET['expired']) && $_GET['expired'] ? '?expired=1' : '';
+ header("Location: ".$adminURL.'/login.php'.$url_add);
die();
//require_once($pathtoroot."admin/login.php");
}
}
?>
Property changes on: trunk/kernel/startup.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/include/tabs.js
===================================================================
--- trunk/admin/include/tabs.js (revision 267)
+++ trunk/admin/include/tabs.js (revision 268)
@@ -1,274 +1,272 @@
//parses input tags looking for validation attributes
function DataIsValid(f)
{
var ValType = '';
var span_id = '';
var form_result = true;
var field_result = true;
var j = 0;
for (var i = 0; i < f.elements.length; i++)
{
ValType = '';
Field = f.elements[i];
ValType = Field.getAttribute('ValidationType');
if(ValType)
{
ValType = TransformValidationType(ValType); // for capability with old forms
span_id = 'prompt_' + Field.name;
span = document.getElementById(span_id);
if(span)
{
field_result = true;
ValType = ValType.split(',');
j = 0;
while(j < ValType.length)
{
//alert('Validating ['+Field.name+'] as ['+ValType[j]+']');
if(ValType[j] == 'password')
{
var repasswd = document.getElementById(Field.name + '_verify');
if(repasswd)
{
field_result &= ValidateField(Field.value, ValType[j], repasswd.value);
document.getElementById('prompt_' + Field.name + '_verify').className = field_result ? 'text' : 'validation_error';
}
}
else
field_result &= ValidateField(Field.value, ValType[j]);
j++;
}
span.className = field_result ? 'text' : 'validation_error';
form_result &= field_result;
}
}
}
return form_result;
}
function TransformValidationType(OldType)
{
// replace old validation types with new
// on the fly in case if we have some forms
// that still use old validation types
var NewType = '';
switch(OldType)
{
case 'optional_date':
NewType = 'date';
break;
default:
NewType = OldType;
break;
}
return NewType;
}
function ValidateField(FieldValue, ValidateAs, RePasswdValue)
{
// validate FieldValue based on ValidateAs rule specified;
// in case if password field compare it with RePasswdValue
var result = true;
switch(ValidateAs)
{
case 'exists': // field is required
if(FieldValue.length == 0) result = false;
break;
case 'integer': // field must be integer number
result = ValidateNumber(FieldValue, ValidateAs);
break;
case 'password': // validate as password field
result = (FieldValue == RePasswdValue) || (FieldValue.length == 0);
break;
case 'date': // text must be a formatted date
result = ValidDate(FieldValue);
break;
case 'time': // text must be a formatted time
result = ValidTime(FieldValue);
break;
}
return result;
}
function MarkAsRequired(f)
{
var ValType = '';
var span_id = '';
var result = true;
for (var i = 0; i < f.elements.length; i++)
{
ValType = '';
Field = f.elements[i];
ValType = Field.getAttribute('ValidationType');
if(ValType)
{
ValType = ValType.split(',');
if( InArray(ValType,'exists') !== false )
{
span_id = 'prompt_' + Field.name;
span = document.getElementById(span_id);
span.innerHTML = span.innerHTML + '<span class="error">*</span>';
}
}
}
}
function InArray(aArray, aValue)
{
// checks if element in array
var k = 0;
while(k < aArray.length)
{
if(aArray[k] == aValue) return k;
k++;
}
return false;
}
//Used to submit the form when a tab is clicked on
function edit_submit(formname, status_field, targetURL, save_value, env_str, new_target)
{
- var full_env = env;
- if( HasParam(env_str) ) full_env += env_str;
+ var full_env = env;
+ if( HasParam(env_str) ) full_env += env_str;
- if(full_env.substr(0,3)!="env")
- full_env = 'env='+full_env;
-
- f = document.getElementById(formname);
+ if(full_env.substr(0,3) != "env") full_env = 'env=' + full_env;
+ f = document.getElementById(formname);
- if(f)
- {
- var valid = false;
+ if(f)
+ {
+ var valid = false;
if(save_value != 2 && save_value !=-1)
{
valid = DataIsValid(f);
}
else
{
var a = f.Action;
if(a)
{
a.value='';
}
}
if(valid || save_value==2 || save_value==-1)
{
- f.action = rootURL + targetURL + '?' + full_env;
- if(status_field.length>0)
- {
- f.elements[status_field].value = save_value; //0= stay in temp, 1=save to perm, 2 = purge no save
- }
- alert('action: '+f.action);
- if(new_target != null && typeof(new_target) != 'undefined') f.target = new_target;
+ var URLPrefix = '';
+ if( targetURL.substring(0, rootURL.length) != rootURL ) URLPrefix = rootURL;
+
+ f.action = URLPrefix + targetURL + '?' + full_env;
+ if(status_field.length > 0)
+ {
+ f.elements[status_field].value = save_value; //0= stay in temp, 1=save to perm, 2 = purge no save
+ }
- f.submit();
+ if(new_target != null && typeof(new_target) != 'undefined') f.target = new_target;
+ f.submit();
}
else
- if(!valid)
- alert(ErrorMsg);
-
- }
- else
- alert('Form '+formname+' was not found.');
+ if(!valid) alert(ErrorMsg);
+ }
+ else
+ alert('Form '+formname+' was not found.');
}
//Used when the save or cancel buttin is hit
function do_edit_save(formname, status_field, targetURL, save_value, env_str)
{
var full_env = env;
if( HasParam(env_str) ) full_env += env_str;
if(full_env.substr(0,3)!="env")
full_env = 'env='+full_env;
f = document.getElementById(formname);
if(f)
{
f.action = rootURL + targetURL + '?' + full_env;
//alert(f.action);
if(status_field.length>0)
{
f.elements[status_field].value = save_value; //0= stay in temp, 1=save to perm, 2 = purge no save
}
f.submit();
}
else
alert('Form '+formname+' was not found.');
}
function jump_to_url(targetURL, env_str)
{
var full_env = env;
if( HasParam(env_str) ) full_env += env_str;
if(full_env.substr(0,3)!="env")
full_env = 'env='+full_env;
document.location = rootURL + targetURL + '?' + full_env;
}
// -------------------------------------------------------------------------------------------------------------
function submit_form(formname, status_field, targetURL, save_value, env_str)
{
// by Alex, submits form.
var full_env = env;
if( HasParam(env_str) ) full_env += env_str;
if(full_env.substr(0,3)!="env")
full_env = 'env='+full_env;
f = document.getElementById(formname);
if(f)
{
var valid = false;
if(save_value != 2 && save_value !=-1)
{
valid = DataIsValid(f);
}
else
{
var a = f.Action;
if(a)
{
a.value='';
}
}
if(valid || save_value==2 || save_value==-1)
{
f.action = rootURL + targetURL + '?' + full_env;
if(status_field.length>0)
{
f.elements[status_field].value = save_value; //0= stay in temp, 1=save to perm, 2 = purge no save
}
f.submit();
}
else
if(!valid)
alert(ErrorMsg);
}
else
alert('Form '+formname+' was not found.');
}
function HasParam(param)
{
// checks of parameter is passed to function (cross-browser)
return typeof(param) == 'undefined' ? false : true;
}
function SetBackground(element_id, img_url)
{
// set background image of element specified by id
var el = document.getElementById(element_id);
el.style.backgroundImage = 'url('+img_url+')';
}
\ No newline at end of file
Property changes on: trunk/admin/include/tabs.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/admin/listview/listview.js
===================================================================
--- trunk/admin/listview/listview.js (revision 267)
+++ trunk/admin/listview/listview.js (revision 268)
@@ -1,239 +1,238 @@
var lcp = 0;
var cbContainers = new Array();
getEventSrcElement = window.event ? function(e){var targ=e.target;return targ.nodeType==1?targ:targ.parentNode} : function() {return event.srcElement}
function initSelectiorContainers()
{
var selectorType;
var inputs = document.getElementsByTagName("INPUT");
for (var i = 0; i < inputs.length; i++)
if (inputs[i].getAttribute("isSelector"))
{
selectorType = inputs[i].type;
break;
}
if (!selectorType) return;
for (var i = 0; i < inputs.length; i++)
if (inputs[i].type == selectorType && inputs[i].getAttribute("isSelector"))
{
var container = inputs[i].parentNode.parentNode;
inputs[i].container = container;
container.chB = inputs[i];
cbContainers[cbContainers.length] = container;
inputs[i].checked=false;
if (selectorType != "radio")
container.chB.onclick = function(e)
{
this.lcp = lcp++;
eval(this.getAttribute("onclicksrc"));
var evt = (e) ? e : window.event;
if (!evt) return;
evt.cancelBubble = true;
}
else container.chB.onclick = container.onclick;
container.chB.onclickA = function()
{
eval(this.getAttribute("onclicksrc"));
}
container.onclick = function(e)
{
var evt = (e) ? e : window.event;
if (!evt) return;
if (evt.ctrlKey && selectorType != "radio")
{
this.chB.checked = !this.chB.checked;
this.chB.onclick();
if (document.selection) document.selection.empty();
return;
}
if (evt.shiftKey && selectorType != "radio")
{
var maxLcp = 0;
var maxIndex = 0;
var cIndex = 0;
for (var i = 0; i < cbContainers.length; i++)
{
if (cbContainers[i].chB.lcp > maxLcp)
{
maxLcp = cbContainers[i].chB.lcp;
maxIndex = i;
}
if (cbContainers[i] == this) cIndex = i;
}
for (var i = 0; i < cbContainers.length; i++)
{
var cChb = (i <= cIndex && i >= maxIndex && maxIndex <= cIndex || i >= cIndex && i <= maxIndex && maxIndex > cIndex);
if (cChb != cbContainers[i].chB.checked)
{
cbContainers[i].chB.checked = cChb;
cbContainers[i].chB.onclickA();
}
}
if (document.selection) document.selection.empty();
return;
}
selectAll(false);
this.chB.checked = !this.chB.checked;
if (selectorType != "radio") this.chB.onclick()
else
{
var checkArray;
this.chB.onclickA();
for (var i = 0; i < cbContainers.length; i++)
if (this.id != cbContainers[i].id)
{
var rowId = cbContainers[i].chB.getAttribute('rowId')
try
{
if (!checkArray) checkArray = eval(cbContainers[i].chB.getAttribute('checkArrayName'))
}
catch (err)
{
}
checkArray.CheckValues[rowId]=0;
cbContainers[i].className = "table_color" + (i % 2 + 1);
}
if (checkArray) checkArray.itemschecked = (this.chB.checked) ? 1 : 0;
}
}
container.ondblclick = function(e)
{ if (selectorType == "radio") return;
selectAll(false);
if (this.chB.checked != true) this.chB.checked = true;
this.chB.onclick();
handleDoubleClick();
}
container.oncontextmenu = function(e)
{ if (selectorType == "radio") return;
var evt = (e) ? e : window.event;
if (!evt) return;
evt.cancelBubble = true;
evt.returnValue = false;
if (!this.chB.checked)
{
selectAll(false);
this.chB.checked = !this.chB.checked;
this.chB.onclick();
}
showContextMenu();
return false;
}
}
document.onkeydown = function(e)
{ if (selectorType == "radio") return;
var evt = (e) ? e : window.event;
if (!evt) return;
var keyCode = (e) ? e.which : window.event.keyCode;
if (keyCode == 65 && evt.ctrlKey)
{
selectAll(true)
if (document.selection) document.selection.empty();
evt.returnValue = false;
evt.cancelBubble = true;
return false;
}
}
}
function selectAll(value)
{
for (var i = 0; i < cbContainers.length; i++)
if (value != cbContainers[i].chB.checked)
{
cbContainers[i].chB.checked = value;
cbContainers[i].chB.onclickA();
}
}
function showContextMenu()
{
if(initContextMenu())
{
window.FW_showMenu(window.contextMenu,window.event.clientX,window.event.clientY);
window.event.returnValue = false;
window.event.cancelBubble = true;
}
return false;
}
//unchanged
function ShowViewMenu()
{
button = document.getElementById('viewmenubutton');
if(button)
{
x = getRealLeft(button);
y = getRealTop(button);
fwLoadMenus();
window.FW_showMenu(window.view_menu,x,y+32);
}
return false;
}
//This overrides the function in tabs.js for use in lists
function edit_submit(formname, status_field, targetURL, save_value,env_str)
{
- var full_env = env
- if( !((env_str == null) && typeof(env_str) == 'undefined') ) full_env += env_str;
-
- if(full_env.substr(0,3)!="env")
- full_env = 'env='+full_env;
-
- var loc = rootURL + targetURL + '?' + full_env;
+ var full_env = env;
+ if( HasParam(env_str) ) full_env += env_str;
+ if(full_env.substr(0,3) != "env") full_env = 'env='+full_env;
+ var URLPrefix = '';
+ if( targetURL.substring(0, rootURL.length) != rootURL ) URLPrefix = rootURL;
+ var loc = URLPrefix + targetURL + '?' + full_env;
document.location = loc;
}
function HandleKeyPress(e)
{
alert(e.which);
}
// Event Handling Stuff Cross-Browser
getEvent = window.Event
? function(e){return e}
: function() {return event}
getEventSrcElement = window.Event
? function(e){var targ=e.target;return targ.nodeType==1?targ:targ.parentNode}
: function() {return event.srcElement}
function getKeyCode(e){return e.charCode||e.keyCode}
function getKey(eMoz)
{
var e = getEvent(eMoz)
var keyCode = getKeyCode(e)
if(keyCode == 13)
{
var el = document.getElementById('imgSearch');
el.onclick();
}
}
d = document.getElementById('ListSearchWord');
if(d) d.onkeyup = getKey
Property changes on: trunk/admin/listview/listview.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property

Event Timeline