Index: trunk/core/kernel/application.php
===================================================================
diff -u -r7635 -r7855
--- trunk/core/kernel/application.php (.../application.php) (revision 7635)
+++ trunk/core/kernel/application.php (.../application.php) (revision 7855)
@@ -320,6 +320,11 @@
function refreshModuleInfo()
{
+ if (defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('Modules')) {
+ $this->registerModuleConstants();
+ return false;
+ }
+
$modules_helper =& $this->recallObject('ModulesHelper');
$sql = 'SELECT *
FROM '.TABLE_PREFIX.'Modules
@@ -365,7 +370,7 @@
$path = $this->GetFrontThemePath();
if ($path === false) {
- $this->ApplicationDie('No Primary Theme Selected or Current Theme is Unknonw or Disabled');
+ $this->ApplicationDie('No Primary Theme Selected or Current Theme is Unknown or Disabled');
}
safeDefine('THEMES_PATH', $path);
/*
@@ -504,8 +509,8 @@
$this->registerClass('Template', KERNEL_PATH.'/parser/template.php');
$this->registerClass('TemplateParser', KERNEL_PATH.'/parser/template_parser.php',null, 'kDBTagProcessor');
- $this->registerClass('kEmailMessage', KERNEL_PATH.'/utility/email.php');
- $this->registerClass('kSmtpClient', KERNEL_PATH.'/utility/smtp_client.php');
+ $this->registerClass('kEmailSendingHelper', KERNEL_PATH.'/utility/email_send.php', 'EmailSender', Array('kHelper'));
+ $this->registerClass('kSocket', KERNEL_PATH.'/utility/socket.php', 'Socket');
if (file_exists(MODULES_PATH.'/in-commerce/units/currencies/currency_rates.php')) {
$this->registerClass('kCurrencyRates', MODULES_PATH.'/in-commerce/units/currencies/currency_rates.php');
@@ -713,9 +718,6 @@
if (!$this->TemplatesCache->TemplateExists($t) && !$this->IsAdmin()) {
$t = $cms_handler->GetDesignTemplate();
}
- /*else {
- $cms_handler->SetCatByTemplate();
- }*/
}
@@ -1013,7 +1015,7 @@
function ProcessParsedTag($prefix, $tag, $params)
{
-
+
$a_tag = new Tag('',$this->Parser);
$a_tag->Tag = $tag;
$tmp=$this->Application->processPrefix($prefix);
@@ -1587,11 +1589,13 @@
}
ob_end_flush();
+
// session expiration is called from session initialization,
// that's why $this->Session may be not defined here
- if (is_object($this->Session)) {
- $this->Session->SaveData();
- }
+ $session =& $this->Application->recallObject('Session');
+ /* @var $session Session */
+
+ $session->SaveData();
exit;
}
@@ -1664,7 +1668,7 @@
}
-
+
function LoadCache() {
$cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->IsAdmin();
$query = sprintf("SELECT PhraseList, ConfigVariables FROM %s WHERE Template = %s",
@@ -1724,6 +1728,10 @@
$res = isset($this->ConfigHash[$name]) ? $this->ConfigHash[$name] : false;
if ($res !== false) return $res;
+ if (defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('ConfigurationValues')) {
+ return false;
+ }
+
$res = $this->Conn->GetRow('SELECT VariableId, VariableValue FROM '.TABLE_PREFIX.'ConfigurationValues WHERE VariableName = '.$this->Conn->qstr($name));
if ($res) {
$this->ConfigHash[$name] = $res['VariableValue'];
@@ -1918,8 +1926,7 @@
function isDebugMode($check_debugger = true)
{
$debug_mode = defined('DEBUG_MODE') && DEBUG_MODE;
- if($check_debugger)
- {
+ if ($check_debugger) {
$debug_mode = $debug_mode && is_object($this->Debugger);
}
return $debug_mode;
@@ -2067,7 +2074,6 @@
if ( isset($this->Debugger) )
{
$errorLevel = constOn('DBG_SQL_FAILURE') && !defined('IS_INSTALL') ? E_USER_ERROR : E_USER_WARNING;
- $this->Debugger->dumpVars($_REQUEST);
$this->Debugger->appendTrace();
$error_msg = ''.$msg.' ('.$code.')
SQL: '.$this->Debugger->formatSQL($sql);
@@ -2191,7 +2197,8 @@
*/
function &EmailEventAdmin($email_event_name, $to_user_id = -1, $send_params = false)
{
- return $this->EmailEvent($email_event_name, 1, $to_user_id, $send_params);
+ $event =& $this->EmailEvent($email_event_name, 1, $to_user_id, $send_params);
+ return $event;
}
/**
@@ -2204,7 +2211,8 @@
*/
function &EmailEventUser($email_event_name, $to_user_id = -1, $send_params = false)
{
- return $this->EmailEvent($email_event_name, 0, $to_user_id, $send_params);
+ $event =& $this->EmailEvent($email_event_name, 0, $to_user_id, $send_params);
+ return $event;
}
/**
@@ -2233,16 +2241,14 @@
return $event;
}
-
+ /**
+ * Allows to check if user in this session is logged in or not
+ *
+ * @return bool
+ */
function LoggedIn()
{
- $user_id = $this->Application->RecallVar('user_id');
-
- $ret = $user_id > 0;
- if ($this->IsAdmin() && ($user_id == -1)) {
- $ret = true;
- }
- return $ret;
+ return $this->Session->LoggedIn();
}
/**
@@ -2415,7 +2421,52 @@
}
return $user_groups;
}
+
+ /**
+ * Allows to detect if page is browsed by spider (293 agents supported)
+ *
+ * @return bool
+ */
+ function IsSpider()
+ {
+ static $is_spider = null;
+
+ if (!isset($is_spider)) {
+ $user_agent = trim($_SERVER['HTTP_USER_AGENT']);
+ $robots = file(FULL_PATH.'/core/robots_list.txt');
+ foreach ($robots as $robot_info) {
+ $robot_info = explode("\t", $robot_info, 3);
+ if ($user_agent == trim($robot_info[2])) {
+ $is_spider = true;
+ break;
+ }
+ }
+ }
+
+ return $is_spider;
+ }
+
+ /**
+ * Allows to detect table's presense in database
+ *
+ * @param string $table_name
+ * @return bool
+ */
+ function TableFound($table_name)
+ {
+ static $table_found = Array();
+
+ if (!preg_match('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', $table_name)) {
+ $table_name = TABLE_PREFIX.$table_name;
+ }
+
+ if (!isset($table_found[$table_name])) {
+ $table_found[$table_name] = $this->Conn->Query('SHOW TABLES LIKE "'.$table_name.'"');
+ }
+
+ return $table_found[$table_name];
+ }
}
?>
\ No newline at end of file