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);
+ }
}