Index: trunk/kernel/units/general/helpers/modules.php =================================================================== diff -u -N -r4590 -r4591 --- trunk/kernel/units/general/helpers/modules.php (.../modules.php) (revision 4590) +++ trunk/kernel/units/general/helpers/modules.php (.../modules.php) (revision 4591) @@ -7,6 +7,23 @@ return $this->_GetModules(); } + function getWhereClause() + { + $where_clause = Array('Loaded = 1'); + + if (!$this->Application->IsAdmin()) return $where_clause; + + $modules = $this->_GetModules(); + if ($modules) { + foreach ($modules as $module_index => $module) { + $modules[$module_index] = $this->Conn->qstr($module); + } + $where_clause[] = 'Name IN ('.implode(',', $modules).')'; + } + + return $where_clause; + } + function _EnableCookieSID() { $session =& $this->Application->recallObject('Session'); Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4590 -r4591 --- trunk/core/kernel/application.php (.../application.php) (revision 4590) +++ trunk/core/kernel/application.php (.../application.php) (revision 4591) @@ -85,13 +85,6 @@ var $ModuleInfo = Array(); /** - * Holds DBConnection (depricated, use Conn instead) - * - * @var kDBConnection - */ - var $DB; - - /** * Holds DBConnection * * @var kDBConnection @@ -198,8 +191,6 @@ $this->Conn->Connect(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB); $this->Conn->debugMode = $this->isDebugMode(); -// $this->DB =& $this->Conn; // for backwards compatibility - $this->ConfigHash = $this->Conn->GetCol('SELECT VariableValue, VariableName FROM '.TABLE_PREFIX.'ConfigurationValues', 'VariableName'); $rewrite_on = $this->ConfigValue('UseModRewrite'); @@ -212,7 +203,7 @@ $this->refreshModuleInfo(); $this->SetDefaultConstants(); - // 1. to read configs before doing any recallObject (called from "SetDefaultConstants" anyway) + // 1. to read configs before doing any recallObject $config_reader =& $this->recallObject('kUnitConfigReader'); // Module items are recalled during url parsing & PhrasesCache is needed already there, @@ -223,25 +214,23 @@ $this->Phrases->Init('phrases'); } - if( !$this->RecallVar('UserGroups') ) - { + if(!$this->RecallVar('UserGroups')) { $session =& $this->recallObject('Session'); $user_groups = trim($session->GetField('GroupList'), ','); if (!$user_groups) $user_groups = $this->ConfigValue('User_GuestGroup'); $this->StoreVar('UserGroups', $user_groups); } - if( $this->GetVar('m_cat_id') === false ) $this->SetVar('m_cat_id', 0); + if ($this->GetVar('m_cat_id') === false) $this->SetVar('m_cat_id', 0); if( !$this->RecallVar('curr_iso') ) $this->StoreVar('curr_iso', $this->GetPrimaryCurrency() ); $this->SetVar('visits_id', $this->RecallVar('visit_id') ); $language =& $this->recallObject( 'lang.current', null, Array('live_table' => true) ); - $this->ValidateLogin(); // TODO: write that method + $this->ValidateLogin(); - if( $this->isDebugMode() ) - { + if($this->isDebugMode()) { $this->Debugger->profileFinish('kernel4_startup'); } @@ -251,24 +240,10 @@ function refreshModuleInfo() { - $where_clause = Array('Loaded = 1'); - - // admin only: filter licensed modules - if ($this->IsAdmin()) { - $modules_helper =& $this->recallObject('ModulesHelper'); - $modules = $modules_helper->checkLogin(); - if ($modules) { - foreach ($modules as $module_index => $module) { - $modules[$module_index] = $this->Conn->qstr($module); - } - $where_clause[] = 'Name IN ('.implode(',', $modules).')'; - } - } - - // front and admin: filter enabled modules + $modules_helper =& $this->recallObject('ModulesHelper'); $sql = 'SELECT * FROM '.TABLE_PREFIX.'Modules - WHERE '.implode(' AND ', $where_clause).' + WHERE '.implode(' AND ', $modules_helper->getWhereClause()).' ORDER BY LoadOrder'; $this->ModuleInfo = $this->Conn->Query($sql, 'Name'); Index: trunk/core/units/general/helpers/modules.php =================================================================== diff -u -N -r4590 -r4591 --- trunk/core/units/general/helpers/modules.php (.../modules.php) (revision 4590) +++ trunk/core/units/general/helpers/modules.php (.../modules.php) (revision 4591) @@ -7,6 +7,23 @@ return $this->_GetModules(); } + function getWhereClause() + { + $where_clause = Array('Loaded = 1'); + + if (!$this->Application->IsAdmin()) return $where_clause; + + $modules = $this->_GetModules(); + if ($modules) { + foreach ($modules as $module_index => $module) { + $modules[$module_index] = $this->Conn->qstr($module); + } + $where_clause[] = 'Name IN ('.implode(',', $modules).')'; + } + + return $where_clause; + } + function _EnableCookieSID() { $session =& $this->Application->recallObject('Session');