Пример #1
0
 public static function initialize()
 {
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('PDO', PDO::initialize());
     foreach (OSCOM::callDB('Shop\\GetConfiguration', null, 'Site') as $param) {
         define($param['cfgKey'], $param['cfgValue']);
     }
     Registry::set('Session', Session::load('adminSid'));
     Registry::get('Session')->start();
     Registry::get('MessageStack')->loadFromSession();
     Registry::set('Language', new Language());
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         Registry::get('MessageStack')->add('header', 'No access.', 'error');
         OSCOM::redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
     // HPDL move following checks elsewhere
     // check if a default currency is set
     if (!defined('DEFAULT_CURRENCY')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
     }
     // check if a default language is set
     if (!defined('DEFAULT_LANGUAGE')) {
         Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
     }
     if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
     }
     // check if Work directories are writable
     $work_dirs = array();
     foreach (array('Cache', 'CoreUpdate', 'Database', 'Logs', 'Session', 'Temp') as $w) {
         if (!is_writable(OSCOM::BASE_DIRECTORY . 'Work/' . $w)) {
             $work_dirs[] = $w;
         }
     }
     if (!empty($work_dirs)) {
         Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_work_directories_not_writable'), OSCOM::BASE_DIRECTORY . 'Work/', implode(', ', $work_dirs)), 'error');
     }
     if (!OSCOM::configExists('time_zone', 'OSCOM')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_time_zone_not_defined'), 'warning');
     }
     if (!OSCOM::configExists('dir_fs_public', 'OSCOM') || !file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM'))) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_dir_fs_public_not_defined'), 'warning');
     }
     // check if the upload directory exists
     if (is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
         if (!is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
             Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
         }
     } else {
         Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
     }
 }
Пример #2
0
 public static function initialize()
 {
     OSCOM::loadConfig();
     if (strlen(DB_SERVER) < 1) {
         osc_redirect(OSCOM::getLink('Setup'));
     }
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('Database', Database::initialize());
     $Qcfg = Registry::get('Database')->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
     $Qcfg->setCache('configuration');
     $Qcfg->execute();
     while ($Qcfg->next()) {
         define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
     }
     $Qcfg->freeResult();
     Registry::set('Session', Session::load('adminSid'));
     Registry::get('Session')->start();
     Registry::get('MessageStack')->loadFromSession();
     Registry::set('Language', new Language());
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         Registry::get('MessageStack')->add('header', 'No access.', 'error');
         osc_redirect_admin(OSCOM::getLink(null, 'Index'));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
     // HPDL move following checks elsewhere
     // check if a default currency is set
     if (!defined('DEFAULT_CURRENCY')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
     }
     // check if a default language is set
     if (!defined('DEFAULT_LANGUAGE')) {
         Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
     }
     if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
     }
 }
Пример #3
0
 public static function initialize()
 {
     if (strlen(DB_SERVER) < 1) {
         osc_redirect(OSCOM::getLink('Setup'));
     }
     Registry::set('MessageStack', new MessageStack());
     Registry::set('Cache', new Cache());
     Registry::set('Database', Database::initialize());
     Registry::set('PDO', DatabasePDO::initialize());
     foreach (OSCOM::callDB('Admin\\GetConfiguration', null, 'Site') as $param) {
         define($param['cfgKey'], $param['cfgValue']);
     }
     Registry::set('Session', Session::load('adminSid'));
     Registry::get('Session')->start();
     Registry::get('MessageStack')->loadFromSession();
     Registry::set('Language', new Language());
     if (!self::hasAccess(OSCOM::getSiteApplication())) {
         Registry::get('MessageStack')->add('header', 'No access.', 'error');
         osc_redirect_admin(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
     }
     $application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
     Registry::set('Application', new $application());
     Registry::set('Template', new Template());
     Registry::get('Template')->setApplication(Registry::get('Application'));
     // HPDL move following checks elsewhere
     // check if a default currency is set
     if (!defined('DEFAULT_CURRENCY')) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
     }
     // check if a default language is set
     if (!defined('DEFAULT_LANGUAGE')) {
         Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
     }
     if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
         Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
     }
 }
Пример #4
0
 public static function start()
 {
     Registry::set('Session', SessionClass::load());
     $OSCOM_Session = Registry::get('Session');
     $OSCOM_Session->setLifeTime(SERVICE_SESSION_EXPIRATION_TIME * 60);
     if (SERVICE_SESSION_FORCE_COOKIE_USAGE == '1' || (bool) ini_get('session.use_only_cookies') === true) {
         OSCOM::setCookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 90);
         if (isset($_COOKIE['cookie_test'])) {
             $OSCOM_Session->start();
         }
     } elseif (SERVICE_SESSION_BLOCK_SPIDERS == '1') {
         $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
         $spider_flag = false;
         if (!empty($user_agent)) {
             $spiders = file(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/spiders.txt');
             foreach ($spiders as $spider) {
                 if (!empty($spider)) {
                     if (strpos($user_agent, trim($spider)) !== false) {
                         $spider_flag = true;
                         break;
                     }
                 }
             }
         }
         if ($spider_flag === false) {
             $OSCOM_Session->start();
         }
     } else {
         $OSCOM_Session->start();
     }
     // verify the ssl_session_id
     if (OSCOM::getRequestType() == 'SSL' && SERVICE_SESSION_CHECK_SSL_SESSION_ID == '1' && OSCOM::getConfig('enable_ssl') == 'true') {
         if (isset($_SERVER['SSL_SESSION_ID']) && ctype_xdigit($_SERVER['SSL_SESSION_ID'])) {
             if (!isset($_SESSION['SESSION_SSL_ID'])) {
                 $_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
             }
             if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
                 $OSCOM_Session->destroy();
                 OSCOM::redirect(OSCOM::getLink(null, 'Info', 'SSLcheck', 'AUTO'));
             }
         }
     }
     // verify the browser user agent
     if (SERVICE_SESSION_CHECK_USER_AGENT == '1') {
         $http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
         if (!isset($_SESSION['SESSION_USER_AGENT'])) {
             $_SESSION['SESSION_USER_AGENT'] = $http_user_agent;
         }
         if ($_SESSION['SESSION_USER_AGENT'] != $http_user_agent) {
             $OSCOM_Session->destroy();
             OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
         }
     }
     // verify the IP address
     if (SERVICE_SESSION_CHECK_IP_ADDRESS == '1') {
         if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
             $_SESSION['SESSION_IP_ADDRESS'] = OSCOM::getIPAddress();
         }
         if ($_SESSION['SESSION_IP_ADDRESS'] != OSCOM::getIPAddress()) {
             $OSCOM_Session->destroy();
             OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL'));
         }
     }
     Registry::get('MessageStack')->loadFromSession();
     return true;
 }