Index: trunk/core/kernel/startup.php
===================================================================
diff -u -r3282 -r3330
--- trunk/core/kernel/startup.php (.../startup.php) (revision 3282)
+++ trunk/core/kernel/startup.php (.../startup.php) (revision 3330)
@@ -93,14 +93,7 @@
// up to here
// global constants
- define('HAVING_FILTER', 1);
- define('WHERE_FILTER', 2);
-
- define('FLT_TYPE_AND', 'AND');
- define('FLT_TYPE_OR', 'OR');
-
- safeDefine('STATUS_DISABLED', 0);
- safeDefine('STATUS_ACTIVE', 1);
- safeDefine('STATUS_PENDING', 2);
+ define ('FALSE_ON_NULL', 1);
+ define ('EMPTY_ON_NULL', 2);
?>
\ No newline at end of file
Index: trunk/core/kernel/session/session.php
===================================================================
diff -u -r3282 -r3330
--- trunk/core/kernel/session/session.php (.../session.php) (revision 3282)
+++ trunk/core/kernel/session/session.php (.../session.php) (revision 3330)
@@ -589,24 +589,22 @@
function NeedQueryString($use_cache = 1)
{
if ($this->CachedNeedQueryString != null && $use_cache) return $this->CachedNeedQueryString;
- switch ($this->Mode) {
+
+ $result = false;
+ switch ($this->Mode)
+ {
case smAUTO:
- if ($this->CookiesEnabled) {
- $res = 0;
- }
- else {
- $res = 1;
- }
+ if (!$this->CookiesEnabled) $result = true;
break;
- case smCOOKIES_ONLY:
- break;
+ /*case smCOOKIES_ONLY:
+ break;*/
case smGET_ONLY:
case smCOOKIES_AND_GET:
- $res = 1;
+ $result = true;
break;
}
- $this->CachedNeedQueryString = $res;
- return $res;
+ $this->CachedNeedQueryString = $result;
+ return $result;
}
function LoadData()
Index: trunk/admin/install.php
===================================================================
diff -u -r3216 -r3330
--- trunk/admin/install.php (.../install.php) (revision 3216)
+++ trunk/admin/install.php (.../install.php) (revision 3330)
@@ -72,8 +72,9 @@
ini_set('include_path', '.');
+if (!defined('IS_INSTALL')) define('IS_INSTALL',1);
if( file_exists($pathtoroot.'debug.php') && !(defined('DEBUG_MODE') && DEBUG_MODE) ) include_once($pathtoroot.'debug.php');
-if(!defined('IS_INSTALL'))define('IS_INSTALL',1);
+
$admin = substr($path,strlen($pathtoroot));
$state = isset($_GET["state"]) ? $_GET["state"] : '';
if(!strlen($state))
@@ -146,7 +147,8 @@
$db_savings = Array('dbinfo', 'db_config_save', 'db_reconfig_save'); //, 'reinstall_process'
if( isset($g_DBType) && $g_DBType && strlen($state)>0 && !in_array($state, $db_savings) )
{
- require_once($pathtoroot."kernel/startup.php");
+ define('REL_PATH', 'admin');
+ require_once($pathtoroot."kernel/startup.php");
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
@@ -158,6 +160,8 @@
//require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
+
+ set_cookie(SESSION_COOKIE_NAME, '', adodb_mktime() - 3600, rtrim(BASE_PATH, '/') );
}
function GetPathChar($path = null)
Index: trunk/core/units/general/inp_ses_storage.php
===================================================================
diff -u -r3282 -r3330
--- trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3282)
+++ trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3330)
@@ -10,12 +10,14 @@
if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin';
$this->SetCookiePath($path);
- $this->SetCookieName( $this->Application->ConfigValue('SessionCookieName') );
+ $cookie_name = $this->Application->ConfigValue('SessionCookieName');
+ $this->SetCookieName($cookie_name ? $cookie_name : 'sid');
+
$this->SetCookieDomain(SERVER_NAME);
if( $this->Application->IsAdmin() )
{
- $mode = smAUTO;
+ $mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO;
}
else
{
Index: trunk/core/kernel/utility/factory.php
===================================================================
diff -u -r2600 -r3330
--- trunk/core/kernel/utility/factory.php (.../factory.php) (revision 2600)
+++ trunk/core/kernel/utility/factory.php (.../factory.php) (revision 3330)
@@ -83,10 +83,13 @@
$name=rtrim($name,'.');
if( isset($this->Storage[$name]) ) return $this->Storage[$name];
- if(!isset($this->realClasses[$pseudo_class]))
+ if (!isset($this->realClasses[$pseudo_class]))
{
- if( $this->Application->isDebugMode() ) $GLOBALS['debugger']->appendTrace();
- trigger_error('RealClass not defined for pseudo_class '.$pseudo_class.'', E_USER_ERROR);
+ if( $this->Application->isDebugMode() ) $this->Application->Debugger->appendTrace();
+ $error_level = $this->Application->isInstalled() ? E_USER_ERROR : E_USER_WARNING;
+ trigger_error('RealClass not defined for pseudo_class '.$pseudo_class.'', $error_level);
+ $false = false;
+ return $false;
}
$funs_args = func_get_args();
Index: trunk/admin/logs/session_list.php
===================================================================
diff -u -r2853 -r3330
--- trunk/admin/logs/session_list.php (.../session_list.php) (revision 2853)
+++ trunk/admin/logs/session_list.php (.../session_list.php) (revision 3330)
@@ -146,12 +146,12 @@
$sql = "SELECT us.*,if (p.Login IS NULL,'".admin_language("la_Text_Guest")."',p.Login) as UserName, ";
$sql .="if(g.Name IS NULL,'".admin_language("la_Text_GuestUsers")."',g.Name) as GroupName, ";
$sql .="ELT(us.Status+1,'".admin_language("la_Text_Expired")."','".admin_language("la_Text_Active")."') as SessionStatus, ";
-$sql .="FROM_UNIXTIME(us.LastAccessed,'%m-%d-%Y') as DateCreated ";
+$sql .="FROM_UNIXTIME(us.LastAccessed,'%m-%d-%Y %h:%i:%s') as DateCreated ";
$sql .="FROM ".GetTablePrefix()."UserSession ";
$sql .=" as us LEFT JOIN ".GetTablePrefix()."PortalUser as p USING (PortalUserId) ";
$sql .="LEFT JOIN ".GetTablePrefix()."UserGroup as u ON (p.PortalUserId=u.PortalUserId AND u.PrimaryGroup=1) ";
$sql .="LEFT JOIN ".GetTablePrefix()."PortalGroup as g ON (u.GroupId=g.GroupId) ";
-$sql .= " WHERE us.Status = 1 AND us.PortalUserId <> -1 ";
+$sql .= " WHERE (us.Status = 1) AND (us.PortalUserId <> -1) AND ( LENGTH(us.PortalUserId) > 0) ";
if(strlen($where)) {
$sql .= "AND ".$where;
}
@@ -188,6 +188,12 @@
$objListView->ColumnHeaders->Add("UserName",admin_language("la_prompt_Username"),1,0,$order,"width=\"35%\"","Session_SortField","Session_SortOrder","UserName");
$objListView->ColumnHeaders->Add("GroupName",admin_language("la_prompt_PrimaryGroup"),1,0,$order,"width=\"20%\"","Session_SortField","Session_SortOrder","GroupName");
+
+if (IsDebugMode())
+{
+ $objListView->ColumnHeaders->Add('SessionKey', admin_language('la_prompt_SessionKey'), 1, 0, $order, 'width="10%"', 'Session_SortField', 'Session_SortOrder', 'SessionKey');
+}
+
$objListView->ColumnHeaders->Add("SessionStatus",admin_language("la_prompt_Status"),1,0,$order,"width=\"10%\"","Session_SortField","Session_SortOrder","SessionStatus");
$objListView->ColumnHeaders->Add("IpAddress",admin_language("la_prompt_IPAddress"),1,0,$order,"width=\"15%\"","Session_SortField","Session_SortOrder","IPAddress");
$objListView->ColumnHeaders->Add("DateCreated",admin_language("la_prompt_CreatedOn"),1,0,$order,"width=\"20%\"","Session_SortField","Session_SortOrder","us.LastAccessed");
Index: trunk/kernel/constants.php
===================================================================
diff -u
--- trunk/kernel/constants.php (revision 0)
+++ trunk/kernel/constants.php (revision 3330)
@@ -0,0 +1,13 @@
+
\ No newline at end of file
Index: trunk/kernel/include/itemdb.php
===================================================================
diff -u -r3268 -r3330
--- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 3268)
+++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 3330)
@@ -397,7 +397,9 @@
if( !is_object($objSession) ) return false;
//echo "class: ".get_class($this)."
";
- if ($this->Data[$name] != $value && $value != '') {
+ if (!isset($this->Data[$name]) ) return false;
+
+ if ( getArrayValue($this->Data, $name) != $value && $value != '') {
//echo "$name Modified tt ".$this->Data[$name]." tt $value
";
if ($objSession->GetVariable("HasChanges") != 1) {
$objSession->SetVariable("HasChanges", 2);
Index: trunk/kernel/include/image.php
===================================================================
diff -u -r1098 -r3330
--- trunk/kernel/include/image.php (.../image.php) (revision 1098)
+++ trunk/kernel/include/image.php (.../image.php) (revision 3330)
@@ -24,7 +24,8 @@
{
global $objSession;
//print_pre($_POST);
-
+ if (!isset($this->Data[$name]) ) return false;
+
if ($this->Data[$name] != $value) {
//echo "$name Modified tt ".$this->Data[$name]." tt $value
";
if (!stristr($name, 'Resource') && !stristr($name, 'ImageId')) {
Index: trunk/admin/install/install_lib.php
===================================================================
diff -u -r3244 -r3330
--- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 3244)
+++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 3330)
@@ -887,4 +887,35 @@
return $filename;
}
+
+ /**
+ * Perform operations required for each module separate install (from admin)
+ *
+ * @param string $module_name
+ * @param bool $has_theme
+ * @return bool
+ */
+ function finalizeModuleInstall($module_name, $has_theme = true)
+ {
+ global $objThemes;
+
+ $app =& kApplication::Instance();
+ if (!$app->GetVar('redirect')) return false;
+
+ if ($has_theme)
+ {
+ $objThemes->CreateMissingThemes(true);
+ }
+
+ // 2. import languagepack in case of separate install
+ $lang_xml =& $app->recallObject('LangXML');
+ $lang_xml->tables['phrases'] = TABLE_PREFIX.'Phrase';
+ $lang_xml->tables['emailmessages'] = TABLE_PREFIX.'EmailMessage';
+
+ $lang_path = FULL_PATH.'/'.$module_name.'/admin/install/langpacks';
+ $lang_xml->Parse($lang_path.'/english.lang', '|0|1|2|', '');
+
+ $app->Redirect('', Array('pass' => 'all', 'admin' => 1, 'Refresh' => 1), '', 'modules/mod_status.php');
+
+ }
?>
Index: trunk/core/kernel/application.php
===================================================================
diff -u -r3316 -r3330
--- trunk/core/kernel/application.php (.../application.php) (revision 3316)
+++ trunk/core/kernel/application.php (.../application.php) (revision 3330)
@@ -213,6 +213,10 @@
$this->VerifyThemeId();
}
+ $this->SetVar('lang.current_id', $this->GetVar('m_lang') );
+ $this->SetVar('theme.current_id', $this->GetVar('m_theme') );
+ if( $this->GetVar('m_cat_id') === false ) $this->SetVar('m_cat_id', 0);
+
if( !$this->RecallVar('UserGroups') )
{
$session =& $this->recallObject('Session');
@@ -224,10 +228,7 @@
if( !$this->RecallVar('curr_iso') ) $this->StoreVar('curr_iso', $this->GetPrimaryCurrency() );
$this->SetVar('visits_id', $this->RecallVar('visit_id') );
-
- $this->SetVar('lang.current_id', $this->GetVar('m_lang') );
- $this->SetVar('theme.current_id', $this->GetVar('m_theme') );
- if( $this->GetVar('m_cat_id') === false ) $this->SetVar('m_cat_id', 0);
+
$language =& $this->recallObject( 'lang.current', null, Array('live_table' => true) );
$this->ValidateLogin(); // TODO: write that method
@@ -285,7 +286,7 @@
{
static $language_id = 0;
- if($language_id > 0) return $language_id;
+ if ($language_id > 0) return $language_id;
$table = $this->getUnitOption('lang','TableName');
$id_field = $this->getUnitOption('lang','IDField');
@@ -436,12 +437,15 @@
*/
function registerModuleConstants()
{
- $modules_installed = $this->DB->GetCol('SELECT CONCAT(\'/\',Path) AS Path, Name FROM '.TABLE_PREFIX.'Modules WHERE Loaded = 1','Name');
- foreach($modules_installed as $module_path)
+ if (!$this->ModuleInfo) return false;
+
+ foreach($this->ModuleInfo as $module_name => $module_info)
{
+ $module_path = '/'.$module_info['Path'];
$contants_file = FULL_PATH.$module_path.'constants.php';
if( file_exists($contants_file) ) k4_include_once($contants_file);
}
+ return true;
}
function ProcessRequest()
@@ -583,10 +587,10 @@
* @param string $var Variable name
* @return mixed
*/
- function GetVar($var,$mode=FALSE_ON_NULL)
+ function GetVar($var, $mode = FALSE_ON_NULL)
{
$http_query =& $this->recallObject('HTTPQuery');
- return $http_query->Get($var,$mode);
+ return $http_query->Get($var, $mode);
}
/**
@@ -1407,17 +1411,16 @@
* @access private
* @author Alex
*/
- function handleSQLError($code,$msg,$sql)
+ function handleSQLError($code, $msg, $sql)
{
- global $debugger;
- if($debugger)
+ if ( isset($this->Debugger) )
{
$errorLevel = constOn('DBG_SQL_FAILURE') ? E_USER_ERROR : E_USER_WARNING;
- $debugger->dumpVars($_REQUEST);
- $debugger->appendTrace();
+ $this->Debugger->dumpVars($_REQUEST);
+ $this->Debugger->appendTrace();
- $error_msg = ''.$msg.' ('.$code.')
SQL: '.$debugger->formatSQL($sql);
- $long_id=$debugger->mapLongError($error_msg);
+ $error_msg = ''.$msg.' ('.$code.')
SQL: '.$this->Debugger->formatSQL($sql);
+ $long_id = $this->Debugger->mapLongError($error_msg);
trigger_error( substr($msg.' ('.$code.') ['.$sql.']',0,1000).' #'.$long_id, $errorLevel);
return true;
}
@@ -1594,6 +1597,16 @@
$visit->SetDBField($field, $value);
$visit->Update();
}
+
+ /**
+ * Allows to check if in-portal is installed
+ *
+ * @return bool
+ */
+ function isInstalled()
+ {
+ return $this->InitDone && (count($this->ModuleInfo) > 0);
+ }
}
Index: trunk/globals.php
===================================================================
diff -u -r3282 -r3330
--- trunk/globals.php (.../globals.php) (revision 3282)
+++ trunk/globals.php (.../globals.php) (revision 3330)
@@ -1946,9 +1946,12 @@
* @param int $expire
* @author Alex
*/
- function set_cookie($name, $value, $expire = 0)
+ function set_cookie($name, $value, $expire = 0, $cookie_path = null)
{
- $cookie_path = IsAdmin() ? rtrim(BASE_PATH, '/').'/admin' : BASE_PATH;
+ if (!isset($cookie_path))
+ {
+ $cookie_path = IsAdmin() ? rtrim(BASE_PATH, '/').'/admin' : BASE_PATH;
+ }
setcookie($name, $value, $expire, $cookie_path, $_SERVER['HTTP_HOST']);
}
Index: trunk/kernel/include/language.php
===================================================================
diff -u -r3282 -r3330
--- trunk/kernel/include/language.php (.../language.php) (revision 3282)
+++ trunk/kernel/include/language.php (.../language.php) (revision 3330)
@@ -349,26 +349,22 @@
$l->Set('PrimaryLang', 1);
$l->Set('Enabled', 1);
$l->Update();
- $this->m_Primary =$lang_id;
+ $this->m_Primary = $lang_id;
}
- function GetPrimary($Field="LanguageId")
+ function GetPrimary($Field = 'LanguageId')
{
- if(!$this->m_Primary)
- {
- $sql = "SELECT * FROM ".$this->SourceTable." WHERE PrimaryLang=1";
- $rs = $this->adodbConnection->Execute($sql);
- if($rs && !$rs->EOF)
- {
- $l = $rs->fields[$Field];
- }
- else
- $l = 0;
- $this->m_Primary=$l;
- }
- else
- $l = $this->m_Primary;
- return $l;
+ static $skip_quering = false;
+ if ($skip_quering) return $this->m_Primary;
+
+ if(!$this->m_Primary)
+ {
+ $sql = 'SELECT '.$Field.' FROM '.$this->SourceTable.' WHERE PrimaryLang = 1';
+ $this->m_Primary = $this->adodbConnection->GetOne($sql);
+ $skip_quering = true;
+ }
+
+ return $this->m_Primary;
}
function LoadAllLanguages()
Index: trunk/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r3299 -r3330
--- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 3299)
+++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 3330)
@@ -142,7 +142,11 @@
$first_id = getArrayValue($ret,0);
if($first_id === false)
{
-// $this->Application->Debugger->appendTrace();
+ /*if ($event->getPrefixSpecial() == 'lang.current ')
+ {
+ $this->Application->Debugger->appendTrace();
+ }*/
+
trigger_error('Requested ID for prefix '.$event->getPrefixSpecial().' not passed',E_USER_NOTICE);
}
$this->Application->SetVar($event->getPrefixSpecial(true).'_id', $first_id);
Index: trunk/core/kernel/utility/unit_config_reader.php
===================================================================
diff -u -r3282 -r3330
--- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 3282)
+++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 3330)
@@ -14,14 +14,6 @@
var $CacheExpired = false;
/**
- * Module names found during
- * config reading
- *
- * @var Array
- */
- var $modules_installed = Array();
-
- /**
* Scan kernel and user classes
* for available configs
*
@@ -30,9 +22,6 @@
function Init($prefix,$special)
{
parent::Init($prefix,$special);
-
- $db =& $this->Application->GetADODBConnection();
- $this->modules_installed = $db->GetCol('SELECT CONCAT(\'/\',Path) AS Path, Name FROM '.TABLE_PREFIX.'Modules WHERE Loaded = 1','Name');
$this->scanModules(MODULES_PATH);
}
@@ -44,8 +33,11 @@
function configAllowed($config_path)
{
$module_found = false;
- foreach($this->modules_installed as $module_path)
+ if (!$this->Application->ModuleInfo) return false;
+
+ foreach($this->Application->ModuleInfo as $module_name => $module_info)
{
+ $module_path = '/'.$module_info['Path'];
if( substr($config_path, 0, strlen($module_path)) == $module_path )
{
$module_found = true;
@@ -151,7 +143,7 @@
$fh=opendir(FULL_PATH.$folderPath);
while(($sub_folder=readdir($fh)))
{
- $full_path=FULL_PATH.$folderPath.'/'.$sub_folder;
+ $full_path = FULL_PATH.$folderPath.'/'.$sub_folder;
if( $this->isDir($full_path))
{
if ( file_exists(FULL_PATH.$this->getConfigName($folderPath.'/'.$sub_folder)) ) {
Index: trunk/kernel/startup.php
===================================================================
diff -u -r3287 -r3330
--- trunk/kernel/startup.php (.../startup.php) (revision 3287)
+++ trunk/kernel/startup.php (.../startup.php) (revision 3330)
@@ -31,7 +31,7 @@
$pathtoroot = FULL_PATH.'/';
$admin = 'admin';
- $rootURL = PROTOCOL.SERVER_NAME.(defined('PORT')?':'.PORT : '').BASE_PATH.'/';
+ $rootURL = PROTOCOL.SERVER_NAME.(defined('PORT')?':'.PORT : '').rtrim(BASE_PATH, '/').'/';
$localURL = $rootURL.'kernel/';
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL.'/images';
Index: trunk/core/kernel/utility/params.php
===================================================================
diff -u -r2348 -r3330
--- trunk/core/kernel/utility/params.php (.../params.php) (revision 2348)
+++ trunk/core/kernel/utility/params.php (.../params.php) (revision 3330)
@@ -1,8 +1,5 @@
\n";
+ //echo "function $name:
\n";
- $data = array();
- $attribs = array();
- $field = '';
- for($l=0;$l0)
- {
- $p = explode($parts[0],"=",2);
- $attr = $p[0];
- $attr_default_val = $p[1];
- }
- else
- {
- $attr = $parts[0];
- $attr_default="";
- }
- if(count($parts)==3)
- {
- $atype=$parts[1];
- $attr_desc=$parts[2];
- }
- else
- {
- $attr_desc = $parts[1];
- $atype="";
- }
- $attribs[$attr] = $attr_desc;
- $attr_default[$attr] = $attr_default_val;
- $attr_type[$attr] = $atype;
- }
- else
- {
- $parts = explode(":",$line,2);
- $field = strtolower(substr($parts[0],1));
- $data[$field] = htmlentities($parts[1]);
- }
- }
- else
- {
- if(substr($line,0,2)!="*/")
- {
- if(strlen($field))
- {
- if($field=="attrib")
- {
- $attribs[$attr] .= $line;
- }
- else
- $data[$field] .=$line;
- }
- }
- }
- }
- if(strlen($name)>0)
- {
- $data["name"] = $name;
- $data["scope"]="global";
- }
- else
- {
- if( isset($data["field"]) ) // process something, but don't work
- {
- $field = $data["field"];
- $fparts = explode(".",$field,2);
- $data["name"]=$fparts[1];
- $data["scope"]=$fparts[0];
- unset($data["field"]);
- }
- }
- $t =& $this->AddItemFromArray($data);
- //echo "";print_r($data); echo "
";
- $t->Dirty();
- if(strlen($t->get("name"))>0 && strlen($t->Get("description"))>0)
- {
- $t->Create();
- if(count($attribs)>0)
- {
- foreach($attribs as $field=>$desc)
- {
- $req = (substr($field,0,1)=="*");
- $t->AddAttribute($field, getArrayValue($attr_type,$field),$desc,getArrayValue($attr_default,$field),$req);
- }
- }
- }
+ $data = array();
+ $attribs = array();
+ $field = '';
+ for ($l = 0; $l < count($code); $l++)
+ {
+ $attr_default_val = '';
+ $line = trim($code[$l]);
+ if (substr($line, 0, 1) == '@')
+ {
+ if (substr($line, 1, 6) == 'attrib')
+ {
+ $field = 'attrib';
+ $line = trim( substr($line, 8) );
+ $parts = explode(':', $line, 3);
+ if (strpos($parts[0], '=') > 0)
+ {
+ $p = explode($parts[0], '=', 2);
+ $attr = $p[0];
+ $attr_default_val = $p[1];
+ }
+ else
+ {
+ $attr = $parts[0];
+ $attr_default = '';
+ }
+
+ if (count($parts) == 3)
+ {
+ $atype = $parts[1];
+ $attr_desc = $parts[2];
+ }
+ else
+ {
+ $attr_desc = $parts[1];
+ $atype = '';
+ }
+ $attribs[$attr] = $attr_desc;
+ $attr_default[$attr] = $attr_default_val;
+ $attr_type[$attr] = $atype;
+ }
+ else
+ {
+ $parts = explode(':', $line, 2);
+ $field = strtolower( substr($parts[0], 1) );
+ $data[$field] = htmlentities($parts[1]);
+ }
+ }
+ else
+ {
+ if(substr($line,0,2)!="*/")
+ {
+ if(strlen($field))
+ {
+ if($field=="attrib")
+ {
+ $attribs[$attr] .= $line;
+ }
+ else
+ $data[$field] .=$line;
+ }
+ }
+ }
+ }
+ if(strlen($name)>0)
+ {
+ $data["name"] = $name;
+ $data["scope"]="global";
+ }
+ else
+ {
+ if( isset($data["field"]) ) // process something, but don't work
+ {
+ $field = $data["field"];
+ $fparts = explode(".",$field,2);
+ $data["name"]=$fparts[1];
+ $data["scope"]=$fparts[0];
+ unset($data["field"]);
+ }
+ }
+ $t =& $this->AddItemFromArray($data);
+ //echo "";print_r($data); echo "
";
+ $t->Dirty();
+ if(strlen($t->get("name"))>0 && strlen($t->Get("description"))>0)
+ {
+ $t->Create();
+ if(count($attribs)>0)
+ {
+ foreach($attribs as $field=>$desc)
+ {
+ $req = (substr($field,0,1)=="*");
+ $t->AddAttribute($field, getArrayValue($attr_type,$field),$desc,getArrayValue($attr_default,$field),$req);
+ }
+ }
+ }
}
function ParseFile($file)
Index: trunk/kernel/include/category.php
===================================================================
diff -u -r3282 -r3330
--- trunk/kernel/include/category.php (.../category.php) (revision 3282)
+++ trunk/kernel/include/category.php (.../category.php) (revision 3330)
@@ -112,7 +112,8 @@
{
global $objSession;
//print_pre($_POST);
-
+ if (!isset($this->Data[$name]) ) return false;
+
if ($this->Data[$name] != $value) {
//echo "$name Modified tt ".$this->Data[$name]." tt $value
";
if (!stristr($name, 'Modif') && !stristr($name, 'Created')) {
Index: trunk/kernel/include/modules.php
===================================================================
diff -u -r3282 -r3330
--- trunk/kernel/include/modules.php (.../modules.php) (revision 3282)
+++ trunk/kernel/include/modules.php (.../modules.php) (revision 3330)
@@ -5,7 +5,7 @@
$ado =& GetADODBConnection();
$session_cookie_name = $ado->GetOne('SELECT VariableValue FROM '.$g_TablePrefix.'ConfigurationValues WHERE VariableName = "SessionCookieName"');
-define('SESSION_COOKIE_NAME', $session_cookie_name);
+define('SESSION_COOKIE_NAME', $session_cookie_name ? $session_cookie_name : 'sid');
set_cookie('cookies_on', '1', adodb_mktime() + 31104000);
Index: trunk/kernel/include/theme.php
===================================================================
diff -u -r3124 -r3330
--- trunk/kernel/include/theme.php (.../theme.php) (revision 3124)
+++ trunk/kernel/include/theme.php (.../theme.php) (revision 3330)
@@ -23,7 +23,9 @@
{
global $objSession;
- if ($this->Data[$name] != $value) {
+ if (!isset($this->Data[$name]) ) return false;
+
+ if ( $this->Data[$name] != $value) {
//echo "$name Modified tt ".$this->Data[$name]." tt $value
";
if (!stristr($name, 'File') && !stristr($name, 'Theme')) {
if ($objSession->GetVariable("HasChanges") != 1) {
@@ -683,17 +685,18 @@
}
}
- function GetPrimaryTheme($field="ThemeId")
+ function GetPrimaryTheme($field = 'ThemeId')
{
- $sql = "SELECT * FROM ".$this->SourceTable." WHERE PrimaryTheme=1";
- $rs = $this->adodbConnection->Execute($sql);
- if($rs && !$rs->EOF)
- {
- $l = $rs->fields[$field];
- }
- else
- $l = 0;
- return $l;
+ static $primary_theme = 0, $skip_quering = false;
+ if ($skip_quering) return $primary_theme;
+
+ if (!$primary_theme)
+ {
+ $sql = 'SELECT '.$field.' FROM '.$this->SourceTable.' WHERE PrimaryTheme = 1';
+ $primary_theme = $this->adodbConnection->GetOne($sql);
+ $skip_quering = true;
+ }
+ return $primary_theme;
}
function CreateMissingThemes($compile_css = false)
@@ -755,19 +758,13 @@
if($compile_css)
{
- define('FULL_PATH', realpath(dirname(__FILE__).'/../..'));
- define('APPLICATION_CLASS', 'MyApplication');
- include_once(FULL_PATH.'/kernel/kernel4/startup.php');
$application =& kApplication::Instance();
- $application->Init();
-
- $application->setUnitOption('css', 'AutoLoad', false);
$css_table = $application->getUnitOption('css','TableName');
$css_idfield = $application->getUnitOption('css','IDField');
foreach($css_hash as $stylesheet_id)
{
- $css_item =& $application->recallObject('css');
+ $css_item =& $application->recallObject('css', null, Array('skip_autoload' => true) );
$css_item->Load($stylesheet_id);
$css_item->Compile();
}
Index: trunk/kernel/units/general/inp_ses_storage.php
===================================================================
diff -u -r3282 -r3330
--- trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3282)
+++ trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3330)
@@ -10,12 +10,14 @@
if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin';
$this->SetCookiePath($path);
- $this->SetCookieName( $this->Application->ConfigValue('SessionCookieName') );
+ $cookie_name = $this->Application->ConfigValue('SessionCookieName');
+ $this->SetCookieName($cookie_name ? $cookie_name : 'sid');
+
$this->SetCookieDomain(SERVER_NAME);
if( $this->Application->IsAdmin() )
{
- $mode = smAUTO;
+ $mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO;
}
else
{