oxconfig.php

Go to the documentation of this file.
00001 <?php
00002 
00003 define( 'MAX_64BIT_INTEGER', '18446744073709551615' );
00004 
00009 class oxConfig extends oxSuperCfg
00010 {
00011     // this column of params are defined in config.inc.php file,
00012     // so for backwards compat. names starts without underscore
00013 
00019     protected $dbHost = null;
00020 
00026     protected $dbName = null;
00027 
00033     protected $dbUser = null;
00034 
00040     protected $dbPwd  = null;
00041 
00047     protected $dbType = null;
00048 
00054     protected $sShopURL = null;
00055 
00061     protected $sSSLShopURL = null;
00062 
00068     protected $sAdminSSLURL = null;
00069 
00075     protected $sShopDir = null;
00076 
00082     protected $sCompileDir = null;
00083 
00098     protected $iDebug = 0;
00099 
00105     protected $sAdminEmail = null;
00106 
00112     protected $blSessionUseCookies = null;
00113 
00119     //protected $iMaxArticles = 6000;
00120 
00130     protected $blNativeImages = true;
00131 
00137     protected $aMultiShopTables = array( 'oxarticles', 'oxdiscount', 'oxcategories', 'oxattribute',
00138                                          'oxlinks', 'oxvoucherseries', 'oxmanufacturers',
00139                                          'oxnews', 'oxselectlist', 'oxwrapping',
00140                                          'oxdeliveryset', 'oxdelivery', 'oxvendor', 'oxobject2category');
00141 
00147     private static $_instance = null;
00148 
00154     private $_oStart = null;
00155 
00156 
00162     protected $_oActShop       = null;
00163 
00171     protected $_oActView       = null;
00172 
00178     protected $_aGlobalParams = array();
00179 
00185     protected $_aConfigParams = array();
00186 
00192     protected $_aThemeConfigParams = array();
00193 
00199     protected $_iLanguageId = null;
00200 
00206     protected $_iShopId = null;
00207 
00208 
00214     protected $_sOutDir = 'out';
00215 
00221     protected $_sImageDir = 'img';
00222 
00228     protected $_sPictureDir = 'pictures';
00229 
00235     protected $_sMasterPictureDir = 'master';
00236 
00242     protected $_sTemplateDir = 'tpl';
00243 
00249     protected $_sResourceDir = 'src';
00250 
00256     protected $_sModulesDir = 'modules';
00257 
00263     protected $_blIsSsl = null;
00264 
00270     protected $_aAbsDynImageDir = array();
00271 
00277     protected $_oActCurrencyObject = null;
00278 
00284     const OXMODULE_THEME_PREFIX = 'theme:';
00285 
00291     const OXMODULE_MODULE_PREFIX = 'module:';
00292 
00298     const OXMAX_SHOP_COUNT = 256;
00299 
00307     public function getConfigParam( $sName )
00308     {
00309         if ( defined( 'OXID_PHP_UNIT' ) ) {
00310             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00311                 $sValue = modConfig::$unitMOD->getModConfigParam( $sName );
00312                 if ( $sValue !== null ) {
00313                     return $sValue;
00314                 }
00315             }
00316         }
00317 
00318         if ( isset( $this->$sName ) ) {
00319             return $this->$sName;
00320         } elseif ( isset ( $this->_aConfigParams[$sName] ) ) {
00321             return $this->_aConfigParams[$sName];
00322         }
00323     }
00324 
00333     public function setConfigParam( $sName, $sValue )
00334     {
00335         if ( isset( $this->$sName ) ) {
00336             $this->$sName = $sValue;
00337         } else {
00338             $this->_aConfigParams[$sName] = $sValue;
00339         }
00340     }
00341 
00347     protected function _processSeoCall()
00348     {
00349         // TODO: refactor shop bootstrap and parse url params as soon as possible
00350         if (isSearchEngineUrl()) {
00351             oxNew('oxSeoDecoder')->processSeoCall();
00352         }
00353     }
00354 
00362     public function init()
00363     {
00364         $this->_loadVarsFromFile();
00365 
00366         include getShopBasePath().'core/oxconfk.php';
00367 
00368 
00369         // some important defaults
00370         if( !$this->getConfigParam( 'sDefaultLang' ) )
00371             $this->setConfigParam( 'sDefaultLang', 0 );
00372 
00373 
00374         $this->setConfigParam( 'sTheme', 'basic' );
00375 
00376 
00377         $blLogChangesInAdmin = $this->getConfigParam( 'blLogChangesInAdmin' );
00378         if( !isset( $blLogChangesInAdmin ) )
00379             $this->setConfigParam( 'blLogChangesInAdmin', false );
00380 
00381         $blCheckTemplates = $this->getConfigParam( 'blCheckTemplates' );
00382         if( !isset( $blCheckTemplates ) )
00383             $this->setConfigParam( 'blCheckTemplates', false );
00384 
00385         $blAllowArticlesubclass = $this->getConfigParam( 'blAllowArticlesubclass' );
00386         if( !isset( $blAllowArticlesubclass ) )
00387             $this->setConfigParam( 'blAllowArticlesubclass', false );
00388 
00389         $iAdminListSize = $this->getConfigParam( 'iAdminListSize' );
00390         if( !isset( $iAdminListSize ) )
00391             $this->setConfigParam( 'iAdminListSize', 9 );
00392 
00393         // #1173M  for EE - not all pic are deleted
00394         $iPicCount = $this->getConfigParam( 'iPicCount' );
00395         if ( !isset( $iPicCount ) )
00396             $this->setConfigParam( 'iPicCount', 7 );
00397 
00398         $iZoomPicCount = $this->getConfigParam( 'iZoomPicCount' );
00399         if ( !isset( $iZoomPicCount ) )
00400             $this->setConfigParam( 'iZoomPicCount', 4 );
00401 
00402         //max shop id default value
00403         $iMaxShopId = $this->getConfigParam( 'iMaxShopId' );
00404         if ( !isset( $iMaxShopId ) ) {
00405             $this->setConfigParam( 'iMaxShopId', 128 );
00406         } elseif ( $iMaxShopId > self::OXMAX_SHOP_COUNT ) {
00407             $this->setConfigParam( 'iMaxShopId', self::OXMAX_SHOP_COUNT );
00408         }
00409 
00410         // disabling caching according to DODGER #655 : disable Caching as it doesnt work good enought
00411         $this->setConfigParam( 'blTemplateCaching', false );
00412 
00413         //setting ADODB timeout
00414         global  $ADODB_SESS_LIFE;
00415         $ADODB_SESS_LIFE  = 1;
00416 
00417         // ADODB cachelifetime
00418         $iDBCacheLifeTime = $this->getConfigParam( 'iDBCacheLifeTime' );
00419         if ( !isset( $iDBCacheLifeTime ) )
00420             $this->setConfigParam( 'iDBCacheLifeTime', 3600 ); // 1 hour
00421 
00422         $sCoreDir = $this->getConfigParam( 'sShopDir' );
00423         $this->setConfigParam( 'sCoreDir', $sCoreDir.'/core/' );
00424 
00425         try {
00426             $sShopID = $this->getShopId();
00427             $blConfigLoaded = $this->_loadVarsFromDb( $sShopID );
00428 
00429             // loading shop config
00430             if ( empty($sShopID) || !$blConfigLoaded ) {
00431                 // if no config values where loaded (some problmems with DB), throwing an exception
00432                 $oEx = oxNew( "oxConnectionException" );
00433                 $oEx->setMessage( "Unable to load shop config values from database" );
00434                 throw $oEx;
00435             }
00436 
00437             // loading theme config options
00438             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') );
00439 
00440             // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362)
00441             if ( $this->getConfigParam('sCustomTheme') ) {
00442                 $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme') );
00443             }
00444 
00445             // loading modules config
00446             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_MODULE_PREFIX );
00447 
00448 
00449             $this->_processSeoCall();
00450 
00451             //starting up the session
00452             $this->getSession()->start();
00453 
00454 
00455             $this->_loadVarsFromFile();
00456 
00457             //application initialization
00458             $this->_oStart = new oxStart();
00459             $this->_oStart->appInit();
00460 
00461         } catch ( oxConnectionException $oEx ) {
00462             return $this->_handleDbConnectionException( $oEx );
00463         } catch ( oxCookieException $oEx ) {
00464             return $this->_handleCookieException( $oEx );
00465         }
00466     }
00467 
00473     public static function getInstance()
00474     {
00475 
00476         if ( defined( 'OXID_PHP_UNIT' ) ) {
00477             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00478                 return modConfig::$unitMOD;
00479             }
00480         }
00481 
00482         if ( !self::$_instance instanceof oxConfig ) {
00483                 //exceptions from here go directly to global exception handler
00484                 //if no init is possible whole application has to die!
00485                 self::$_instance = new oxConfig();
00486                 self::$_instance->init();
00487         }
00488         return self::$_instance;
00489     }
00490 
00496     protected function _loadVarsFromFile()
00497     {
00498         //config variables from config.inc.php takes priority over the ones loaded from db
00499         include getShopBasePath().'/config.inc.php';
00500 
00501         //adding trailing slashes
00502         $oFileUtils = oxUtilsFile::getInstance();
00503         $this->sShopDir     = $oFileUtils->normalizeDir($this->sShopDir);
00504         $this->sCompileDir  = $oFileUtils->normalizeDir($this->sCompileDir);
00505         $this->sShopURL     = $oFileUtils->normalizeDir($this->sShopURL);
00506         $this->sSSLShopURL  = $oFileUtils->normalizeDir($this->sSSLShopURL);
00507         $this->sAdminSSLURL = $oFileUtils->normalizeDir($this->sAdminSSLURL);
00508         
00509         $this->_loadCustomConfig();
00510     }
00511 
00517     protected function _loadCustomConfig()
00518     {
00519         $sCustConfig = getShopBasePath().'/cust_config.inc.php';
00520         if ( is_readable( $sCustConfig ) ) {
00521             include $sCustConfig;
00522         }
00523     }
00524     
00534     protected function _loadVarsFromDb( $sShopID, $aOnlyVars = null, $sModule = '' )
00535     {
00536         $oDb = oxDb::getDb();
00537 
00538         if ( !empty($sModule) ) {
00539             $sModuleSql = " oxmodule LIKE " . $oDb->quote($sModule."%");
00540         } else {
00541             $sModuleSql = " oxmodule='' ";
00542         }
00543 
00544         $sQ = "select oxvarname, oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '$sShopID' and " . $sModuleSql;
00545         // dodger, allow loading from some vars only from baseshop
00546         if ( $aOnlyVars !== null ) {
00547             $blSep = false;
00548             $sIn  = '';
00549             foreach ( $aOnlyVars as $sField ) {
00550                 if ( $blSep ) {
00551                     $sIn .= ', ';
00552                 }
00553                 $sIn .= '"'.$sField.'"';
00554                 $blSep = true;
00555             }
00556             $sQ .= ' and oxvarname in ( '.$sIn.' ) ';
00557         }
00558         $oRs = $oDb->select( $sQ );
00559 
00560         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00561             while ( !$oRs->EOF ) {
00562                 $sVarName = $oRs->fields[0];
00563                 $sVarType = $oRs->fields[1];
00564                 $sVarVal  = $oRs->fields[2];
00565 
00566                 //in sShopURL and sSSLShopURL cases we skip (for admin or when URL values are not set)
00567                 if ( ( $sVarName == 'sShopURL' || $sVarName == 'sSSLShopURL' ) &&
00568                     ( !$sVarVal || $this->isAdmin() === true ) ) {
00569                     $oRs->moveNext();
00570                     continue;
00571                 }
00572 
00573                 $this->_setConfVarFromDb($sVarName, $sVarType, $sVarVal);
00574 
00575                 //setting theme options array
00576                 if ( $sModule != '' ) {
00577                     $this->_aThemeConfigParams[$sVarName] = $sModule;
00578                 }
00579 
00580                 $oRs->moveNext();
00581             }
00582 
00583             return true;
00584         } else {
00585             return false;
00586         }
00587     }
00588 
00598     protected function _setConfVarFromDb($sVarName, $sVarType, $sVarVal)
00599     {
00600         switch ( $sVarType ) {
00601             case 'arr':
00602             case 'aarr':
00603                 $this->setConfigParam( $sVarName, unserialize( $sVarVal ) );
00604                 break;
00605             case 'bool':
00606                 $this->setConfigParam( $sVarName, ( $sVarVal == 'true' || $sVarVal == '1' ) );
00607                 break;
00608             default:
00609                 $this->setConfigParam( $sVarName, $sVarVal );
00610                 break;
00611         }
00612     }
00613 
00619     public function pageClose()
00620     {
00621         return $this->_oStart->pageClose();
00622     }
00623 
00635     public static function getParameter(  $sName, $blRaw = false )
00636     {
00637         if ( defined( 'OXID_PHP_UNIT' ) ) {
00638             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00639                 try{
00640                     $sValue = modConfig::getParameter(  $sName, $blRaw );
00641 
00642                     // TODO: remove this after special chars concept implementation
00643                     $blIsAdmin = modConfig::getInstance()->isAdmin() || isAdmin();
00644                     if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00645                         self::checkSpecialChars( $sValue, $blRaw );
00646                     }
00647 
00648                     return $sValue;
00649                 } catch( Exception $e ) {
00650                     // if exception is thrown, use default
00651                 }
00652             }
00653         }
00654 
00655         $sValue = null;
00656 
00657         if ( isset( $_POST[$sName] ) ) {
00658             $sValue = $_POST[$sName];
00659         } elseif ( isset( $_GET[$sName] ) ) {
00660             $sValue = $_GET[$sName];
00661         }
00662 
00663         // TODO: remove this after special chars concept implementation
00664         $blIsAdmin = oxConfig::getInstance()->isAdmin() && oxSession::getVar("blIsAdmin");
00665         if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00666             self::checkSpecialChars( $sValue, $blRaw );
00667         }
00668 
00669         return $sValue;
00670     }
00671 
00679     public function getUploadedFile($sParamName)
00680     {
00681         return $_FILES[$sParamName];
00682     }
00683 
00692     public function setGlobalParameter( $sName, $sValue )
00693     {
00694         $this->_aGlobalParams[$sName] = $sValue;
00695     }
00696 
00704     public function getGlobalParameter( $sName )
00705     {
00706         if ( isset( $this->_aGlobalParams[$sName] ) ) {
00707             return $this->_aGlobalParams[$sName];
00708         } else {
00709             return null;
00710         }
00711     }
00712 
00722     public static function checkSpecialChars( & $sValue, $aRaw = null )
00723     {
00724         if ( is_object( $sValue ) ) {
00725             return $sValue;
00726         }
00727 
00728         if ( is_array( $sValue ) ) {
00729             $newValue = array();
00730             foreach ( $sValue as $sKey => $sVal ) {
00731                 $sValidKey = $sKey;
00732                 if ( !$aRaw || !in_array($sKey, $aRaw) ) {
00733                     self::checkSpecialChars( $sValidKey );
00734                     self::checkSpecialChars( $sVal );
00735                     if ($sValidKey != $sKey) {
00736                         unset ($sValue[$sKey]);
00737                     }
00738                 }
00739                 $newValue[$sValidKey] = $sVal;
00740             }
00741             $sValue = $newValue;
00742         } elseif ( is_string( $sValue ) ) {
00743             $sValue = str_replace( array( '&',     '<',    '>',    '"',      "'",      chr(0), '\\' ),
00744                                    array( '&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '',     '&#092;' ),
00745                                    $sValue );
00746         }
00747         return $sValue;
00748     }
00749 
00755     public function getShopId()
00756     {
00757         if ( $this->_iShopId !== null )
00758             return $this->_iShopId;
00759 
00760             $this->_iShopId = $this->getBaseShopId();
00761 
00762 
00763         oxSession::setVar( 'actshop', $this->_iShopId );
00764         return $this->_iShopId;
00765     }
00766 
00767 
00775     public function setShopId( $sShopId )
00776     {
00777         oxSession::setVar( 'actshop', $sShopId );
00778         $this->_iShopId = $sShopId;
00779     }
00780 
00781 
00787     public function isSsl()
00788     {
00789         if ( is_null( $this->_blIsSsl ) ) {
00790 
00791             $myUtilsServer   = oxUtilsServer::getInstance();
00792             $aServerVars     = $myUtilsServer->getServerVar();
00793             $aHttpsServerVar = $myUtilsServer->getServerVar( 'HTTPS' );
00794 
00795             $this->_blIsSsl = false;
00796             if (isset( $aHttpsServerVar ) && ($aHttpsServerVar === 'on' || $aHttpsServerVar === 'ON' || $aHttpsServerVar == '1' )) {
00797                 // "1&1" hoster provides "1"
00798                 $this->_blIsSsl = ($this->getConfigParam('sSSLShopURL') || $this->getConfigParam('sMallSSLShopURL'));
00799                 if ($this->isAdmin() && !$this->_blIsSsl) {
00800                     //#4026
00801                     $this->_blIsSsl = !is_null($this->getConfigParam('sAdminSSLURL')) ? true : false;
00802                 }
00803             }
00804 
00805             //additional special handling for profihost customers
00806             if ( isset( $aServerVars['HTTP_X_FORWARDED_SERVER'] ) &&
00807                  ( strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'ssl' ) !== false ||
00808                  strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'secure-online-shopping.de' ) !== false ) ) {
00809                 $this->_blIsSsl = true;
00810             }
00811         }
00812 
00813         return $this->_blIsSsl;
00814     }
00815 
00823     public function isCurrentUrl( $sURL )
00824     {
00825         if ( !$sURL ) {
00826             return false;
00827         }
00828 
00829         $oUtilsServer = oxUtilsServer::getInstance();
00830 
00831         // #4010: force_sid added in https to every link
00832         preg_match("/^(https?:\/\/)?([^\/]+)/i", $sURL, $matches);
00833         $sUrlHost = $matches[2];
00834 
00835         // #4010: force_sid added in https to every link
00836         preg_match("/^(https?:\/\/)?([^\/]+)/i", $oUtilsServer->getServerVar( 'HTTP_HOST' ), $matches);
00837         $sRealHost = $matches[2];
00838 
00839         $sCurrentHost = preg_replace( '/\/\w*\.php.*/', '', $oUtilsServer->getServerVar( 'HTTP_HOST' ) . $oUtilsServer->getServerVar( 'SCRIPT_NAME' ) );
00840 
00841         //remove double slashes all the way
00842         $sCurrentHost = str_replace( '/', '', $sCurrentHost );
00843         $sURL = str_replace( '/', '', $sURL );
00844 
00845         if ( getStr()->strpos( $sURL, $sCurrentHost ) !== false ) {
00846 
00847             //bug fix #0002991
00848             if ( $sUrlHost == $sRealHost ) {
00849                 return true;
00850             }
00851         }
00852 
00853         return false;
00854     }
00855 
00864     public function getShopUrl( $iLang = null, $blAdmin = null )
00865     {
00866         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->isAdmin();
00867         if ( $blAdmin ) {
00868             return $this->getConfigParam( 'sShopURL' );
00869         }
00870 
00871         // #680 per language another URL
00872         $iLang = isset( $iLang ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00873         $aLanguageURLs = $this->getConfigParam( 'aLanguageURLs' );
00874         if ( isset( $iLang ) && isset( $aLanguageURLs[$iLang] ) && !empty( $aLanguageURLs[$iLang] ) ) {
00875             $aLanguageURLs[$iLang] = oxUtils::getInstance()->checkUrlEndingSlash( $aLanguageURLs[$iLang] );
00876             return $aLanguageURLs[$iLang];
00877         }
00878 
00879         //normal section
00880         $sMallShopURL = $this->getConfigParam( 'sMallShopURL' );
00881         if ( $sMallShopURL ) {
00882             $sMallShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallShopURL );
00883             return $sMallShopURL;
00884         }
00885 
00886         return $this->getConfigParam( 'sShopURL' );
00887     }
00888 
00896     public function getSslShopUrl( $iLang = null )
00897     {
00898         // #680 per language another URL
00899         $iLang = isset( $iLang ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00900         $aLanguageSSLURLs = $this->getConfigParam( 'aLanguageSSLURLs' );
00901         if ( isset( $iLang ) && isset( $aLanguageSSLURLs[$iLang] ) && !empty( $aLanguageSSLURLs[$iLang] ) ) {
00902             $aLanguageSSLURLs[$iLang] = oxUtils::getInstance()->checkUrlEndingSlash( $aLanguageSSLURLs[$iLang] );
00903             return $aLanguageSSLURLs[$iLang];
00904         }
00905 
00906         //mall mode
00907         if ( ( $sMallSSLShopURL = $this->getConfigParam( 'sMallSSLShopURL' ) ) ) {
00908             $sMallSSLShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallSSLShopURL );
00909             return $sMallSSLShopURL;
00910         }
00911 
00912         if ( ( $sMallShopURL = $this->getConfigParam( 'sMallShopURL' ) ) ) {
00913             $sMallShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallShopURL );
00914             return $sMallShopURL;
00915         }
00916 
00917         //normal section
00918         if ( ( $sSSLShopURL = $this->getConfigParam( 'sSSLShopURL' ) ) ) {
00919             return $sSSLShopURL;
00920         }
00921 
00922         return $this->getShopUrl( $iLang );
00923     }
00924 
00930     public function getCoreUtilsUrl()
00931     {
00932         return $this->getCurrentShopUrl().'core/utils/';
00933     }
00934 
00943     public function getCurrentShopUrl($blAdmin = null)
00944     {
00945         if ($blAdmin===null) {
00946             $blAdmin = $this->isAdmin();
00947         }
00948         if ($blAdmin) {
00949             if ($this->isSsl()) {
00950 
00951                 $sUrl = $this->getConfigParam( 'sAdminSSLURL' );
00952                 if ( !$sUrl ) {
00953                     return $this->getSslShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
00954                 }
00955                 return $sUrl;
00956             } else {
00957                 return $this->getShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
00958             }
00959         } else {
00960             return $this->isSsl() ? $this->getSslShopUrl() : $this->getShopUrl();
00961         }
00962     }
00963 
00971     public function getShopCurrentUrl( $iLang = null )
00972     {
00973         if ( $this->isSsl() ) {
00974             $sURL = $this->getSSLShopURL( $iLang );
00975         } else {
00976             $sURL = $this->getShopURL( $iLang );
00977         }
00978 
00979         return oxUtilsUrl::getInstance()->processUrl( $sURL.'index.php', false );
00980     }
00981 
00990     public function getShopHomeUrl( $iLang = null, $blAdmin = null )
00991     {
00992         return oxUtilsUrl::getInstance()->processUrl($this->getShopUrl( $iLang, $blAdmin).'index.php', false );
00993     }
00994 
01000     public function getShopSecureHomeUrl()
01001     {
01002         return  oxUtilsUrl::getInstance()->processUrl( $this->getSslShopUrl().'index.php', false );
01003     }
01004 
01010     public function getShopCurrency()
01011     {
01012         $iCurr = null;
01013         if ( ( null === ( $iCurr = oxConfig::getParameter( 'cur' ) ) ) ) {
01014             if ( null === ( $iCurr = oxConfig::getParameter( 'currency' ) ) ) {
01015                 $iCurr = oxSession::getVar( 'currency' );
01016             }
01017         }
01018         return (int) $iCurr;
01019     }
01020 
01026     public function getActShopCurrencyObject()
01027     {
01028         //caching currency as it does not change through the script
01029         //but not for unit tests as ther it changes always
01030         if ( !defined( 'OXID_PHP_UNIT' ) ) {
01031             if (!is_null($this->_oActCurrencyObject)) {
01032                 return $this->_oActCurrencyObject;
01033             }
01034         }
01035 
01036         $iCur = $this->getShopCurrency();
01037         $aCurrencies = $this->getCurrencyArray();
01038         if ( !isset( $aCurrencies[$iCur] ) ) {
01039             return $this->_oActCurrencyObject = reset( $aCurrencies ); // reset() returns the first element
01040         }
01041 
01042         return $this->_oActCurrencyObject = $aCurrencies[$iCur];
01043     }
01044 
01052     public function setActShopCurrency( $iCur )
01053     {
01054         $aCurrencies = $this->getCurrencyArray();
01055         if ( isset( $aCurrencies[$iCur] ) ) {
01056             oxSession::setVar( 'currency', $iCur );
01057             $this->_oActCurrencyObject = null;
01058         }
01059     }
01060 
01068     public function getOutDir( $blAbsolute = true)
01069     {
01070         if ($blAbsolute) {
01071             return $this->getConfigParam('sShopDir').$this->_sOutDir.'/';
01072         } else {
01073             return $this->_sOutDir.'/';
01074         }
01075     }
01076 
01086     public function getOutUrl( $blSSL = null , $blAdmin = null, $blNativeImg = false )
01087     {
01088         $blSSL    = is_null($blSSL)?$this->isSsl():$blSSL;
01089         $blAdmin  = is_null($blAdmin)?$this->isAdmin():$blAdmin;
01090 
01091         if ( $blSSL ) {
01092             if ($blNativeImg && !$blAdmin) {
01093                 $sUrl = $this->getSslShopUrl();
01094             } else {
01095                 $sUrl = $this->getConfigParam('sSSLShopURL');
01096                 if (!$sUrl && $blAdmin) {
01097                     $sUrl = $this->getConfigParam('sAdminSSLURL').'../';
01098                 }
01099             }
01100         } else {
01101             $sUrl = ($blNativeImg && !$blAdmin )?$this->getShopUrl():$this->getConfigParam( 'sShopURL' );
01102         }
01103 
01104         return $sUrl.$this->_sOutDir.'/';
01105     }
01106 
01121     public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute = true, $blIgnoreCust = false )
01122     {
01123         if ( is_null($sTheme) ) {
01124             $sTheme = $this->getConfigParam( 'sTheme' );
01125         }
01126 
01127         if ( $blAdmin ) {
01128             $sTheme = 'admin';
01129         }
01130 
01131         $sBase    = $this->getOutDir( $blAbsolute );
01132         $sAbsBase = $this->getOutDir();
01133 
01134         $sLang = '-';
01135         // FALSE means skip language folder check
01136         if ( $iLang !== false ) {
01137             $oLang = oxLang::getInstance();
01138 
01139             if ( is_null( $iLang ) ) {
01140                 $iLang = $oLang->getEditLanguage();
01141             }
01142 
01143             $sLang = $oLang->getLanguageAbbr( $iLang );
01144         }
01145 
01146         if ( is_null($iShop) ) {
01147             $iShop = $this->getShopId();
01148         }
01149 
01150         //Load from
01151         $sPath = "{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
01152         $sCacheKey = $sPath . "_{$blIgnoreCust}{$blAbsolute}";
01153 
01154         if ( ( $sReturn = oxutils::getInstance()->fromStaticCache( $sCacheKey ) ) !== null ) {
01155             return $sReturn;
01156         }
01157 
01158         $sReturn = false;
01159 
01160         // Check for custom template
01161         $sCustomTheme = $this->getConfigParam( 'sCustomTheme' );
01162         if ( !$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
01163             $sReturn = $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute );
01164         }
01165 
01166         //test lang level ..
01167         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01168             $sReturn = $sBase . $sPath;
01169         }
01170 
01171         //test shop level ..
01172         $sPath = "$sTheme/$iShop/$sDir/$sFile";
01173         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01174             $sReturn = $sBase . $sPath;
01175         }
01176 
01177 
01178         //test theme language level ..
01179         $sPath = "$sTheme/$sLang/$sDir/$sFile";
01180         if ( !$sReturn && $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01181             $sReturn = $sBase . $sPath;
01182         }
01183 
01184         //test theme level ..
01185         $sPath = "$sTheme/$sDir/$sFile";
01186         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01187             $sReturn = $sBase . $sPath;
01188         }
01189 
01190         //test out language level ..
01191         $sPath = "$sLang/$sDir/$sFile";
01192         if ( !$sReturn &&  $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01193             $sReturn = $sBase . $sPath;
01194         }
01195 
01196         //test out level ..
01197         $sPath = "$sDir/$sFile";
01198         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01199             $sReturn = $sBase . $sPath;
01200         }
01201 
01202         if ( !$sReturn ) {
01203             // TODO: implement logic to log missing paths
01204         }
01205 
01206         // to cache
01207         oxutils::getInstance()->toStaticCache( $sCacheKey, $sReturn );
01208 
01209         return $sReturn;
01210     }
01211 
01226     public function getUrl($sFile, $sDir , $blAdmin = null, $blSSL = null, $blNativeImg = false, $iLang = null , $iShop = null , $sTheme = null )
01227     {
01228         $sUrl = str_replace(
01229                                 $this->getOutDir(),
01230                                 $this->getOutUrl($blSSL, $blAdmin, $blNativeImg),
01231                                 $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme )
01232                             );
01233         return $sUrl;
01234     }
01235 
01244     public function getImagePath( $sFile, $blAdmin = false )
01245     {
01246         return $this->getDir( $sFile, $this->_sImageDir, $blAdmin );
01247     }
01248 
01259     public function getImageUrl( $blAdmin = false, $blSSL = null, $blNativeImg = null, $sFile = null )
01260     {
01261         $blNativeImg = is_null($blNativeImg)?$this->getConfigParam( 'blNativeImages' ):$blNativeImg;
01262         return $this->getUrl( $sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg );
01263     }
01264 
01272     public function getImageDir( $blAdmin = false )
01273     {
01274         return $this->getDir( null, $this->_sImageDir, $blAdmin );
01275     }
01276 
01288     public function getPicturePath($sFile, $blAdmin = false, $iLang = null , $iShop = null , $sTheme = null)
01289     {
01290         return $this->getDir( $sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme );
01291     }
01292 
01300     public function getMasterPictureDir( $blAdmin = false )
01301     {
01302         return $this->getDir( null, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01303     }
01304 
01313     public function getMasterPicturePath( $sFile, $blAdmin = false )
01314     {
01315         return $this->getDir( $sFile, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01316     }
01317 
01330     public function getPictureUrl( $sFile, $blAdmin = false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01331     {
01332         if ( $sAltUrl = oxPictureHandler::getInstance()->getAltImageUrl('/', $sFile, $blSSL) ) {
01333             return $sAltUrl;
01334         }
01335 
01336         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01337         $sUrl = $this->getUrl( $sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01338 
01339         //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW.
01340         if ( !$sUrl && $sDefPic ) {
01341             $sUrl = $this->getUrl( $sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01342         }
01343         return $sUrl;
01344     }
01345 
01360     public function getIconUrl( $sFile, $blAdmin = false , $blSSL = null , $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01361     {
01362         return $this->getPictureUrl( $sFile, $blAdmin, $blSSL, $iLang, $iShopId, $sDefPic );
01363     }
01364 
01372     public function getPictureDir( $blAdmin )
01373     {
01374         return $this->getDir( null, $this->_sPictureDir, $blAdmin );
01375     }
01376 
01385     public function getTemplatePath( $sFile, $blAdmin )
01386     {
01387         $sTemplatePath = $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin );
01388 
01389         if (!$sTemplatePath) {
01390             $sBasePath        = getShopBasePath();
01391             $aModuleTemplates = $this->getConfigParam('aModuleTemplates');
01392 
01393             $oModulelist = oxNew('oxmodulelist');
01394             $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
01395             if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
01396                 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
01397                     if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
01398                         $sPath = $aTemplates[$sFile];
01399                         $sPath = $sBasePath. 'modules/'.  $sPath;
01400                         if (is_file($sPath) && is_readable($sPath)) {
01401                             $sTemplatePath =  $sPath;
01402                         }
01403                     }
01404                 }
01405             }
01406         }
01407 
01408         return $sTemplatePath;
01409     }
01410 
01418     public function getTemplateDir( $blAdmin = false )
01419     {
01420         return $this->getDir( null, $this->_sTemplateDir, $blAdmin );
01421     }
01422 
01433     public function getTemplateUrl( $sFile = null, $blAdmin = false, $blSSL = null , $iLang = null )
01434     {
01435         return $this->getUrl( $sFile, $this->_sTemplateDir, $blAdmin, $blSSL, false, $iLang );
01436     }
01437 
01445     public function getTemplateBase( $blAdmin = false )
01446     {
01447         // Base template dir is the parent dir of template dir
01448         return str_replace( $this->_sTemplateDir.'/', '', $this->getDir( null, $this->_sTemplateDir, $blAdmin, null, null, null, false ));
01449     }
01450 
01459     public function getResourcePath($sFile = '', $blAdmin = false )
01460     {
01461         return $this->getDir( $sFile, $this->_sResourceDir, $blAdmin );
01462     }
01463 
01471     public function getModulesDir( $blAbsolute = true )
01472     {
01473         if ($blAbsolute) {
01474             return $this->getConfigParam('sShopDir') . $this->_sModulesDir . '/';
01475         } else {
01476             return $this->_sModulesDir . '/';
01477         }
01478     }
01479 
01490     public function getResourceUrl( $sFile = '', $blAdmin = false , $blSSL = null , $iLang = null )
01491     {
01492         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01493         return $this->getUrl( $sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang );
01494     }
01495 
01503     public function getResourceDir( $blAdmin )
01504     {
01505         return $this->getDir( null, $this->_sResourceDir, $blAdmin );
01506     }
01507 
01521     public function getLanguagePath( $sFile, $blAdmin, $iLang = null, $iShop = null, $sTheme = null )
01522     {
01523         return $this->getDir( $sFile, oxLang::getInstance()->getLanguageAbbr( $iLang ), $blAdmin, $iLang, $iShop, $sTheme );
01524     }
01525 
01537     public function getStdLanguagePath( $sFile, $blAdmin, $iLang = null )
01538     {
01539         $sDir = null;
01540         if ( $iLang !== false ) {
01541             $sDir = oxLang::getInstance()->getLanguageAbbr( $iLang );
01542         }
01543 
01544         return $this->getDir( $sFile, $sDir, $blAdmin, $iLang, null, $this->getConfigParam( "sTheme" ), true, true );
01545     }
01546 
01554     public function getLanguageDir( $blAdmin )
01555     {
01556         return $this->getDir( null, null, $blAdmin );
01557     }
01558 
01566     public function getCurrencyArray( $iCurrency = null )
01567     {
01568         $aConfCurrencies = $this->getConfigParam( 'aCurrencies' );
01569         if ( !is_array( $aConfCurrencies ) ) {
01570             return array();
01571         }
01572 
01573         if ( defined( 'OXID_PHP_UNIT' ) ) {
01574             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
01575                 try{
01576                     $aAltCurrencies = modConfig::getInstance()->getConfigParam( 'modaCurrencies' );
01577                     if ( isset( $aAltCurrencies ) ) {
01578                         $aConfCurrencies = $aAltCurrencies;
01579                     }
01580                 } catch( Exception $e ) {
01581                     // if exception is thrown, use default
01582                 }
01583             }
01584         }
01585 
01586         // processing currency configuration data
01587         $aCurrencies = array();
01588         reset( $aConfCurrencies );
01589         while ( list( $key, $val ) = each( $aConfCurrencies ) ) {
01590             if ( $val ) {
01591                 $oCur = new oxStdClass();
01592                 $oCur->id      = $key;
01593                 $sCur = explode( '@', $val);
01594                 $oCur->name     = trim( $sCur[0] );
01595                 $oCur->rate     = trim( $sCur[1] );
01596                 $oCur->dec      = trim( $sCur[2] );
01597                 $oCur->thousand = trim( $sCur[3] );
01598                 $oCur->sign     = trim( $sCur[4] );
01599                 $oCur->decimal  = trim( $sCur[5] );
01600 
01601                 // change for US version
01602                 if ( isset( $sCur[6] ) ) {
01603                     $oCur->side = trim($sCur[6]);
01604                 }
01605 
01606                 if ( isset( $iCurrency) && $key == $iCurrency ) {
01607                     $oCur->selected = 1;
01608                 } else {
01609                     $oCur->selected = 0;
01610                 }
01611                 $aCurrencies[$key]= $oCur;
01612             }
01613 
01614             // #861C -  performance, do not load other currencies
01615             if ( !$this->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01616                 break;
01617             }
01618         }
01619         return $aCurrencies;
01620     }
01621 
01629     public function getCurrencyObject( $sName )
01630     {
01631         $aSearch = $this->getCurrencyArray();
01632         foreach ( $aSearch as $oCur ) {
01633             if ( $oCur->name == $sName ) {
01634                 return $oCur;
01635             }
01636         }
01637     }
01638 
01644     public function isDemoShop()
01645     {
01646         return $this->getConfigParam('blDemoShop');
01647     }
01648 
01649 
01650 
01656     public function getEdition()
01657     {
01658             return "CE";
01659 
01660 
01661     }
01662 
01668     public function getFullEdition()
01669     {
01670         $sEdition = $this->getEdition();
01671 
01672             if ($sEdition == "CE") {
01673                 return "Community Edition";
01674             }
01675 
01676 
01677 
01678         return $sEdition;
01679     }
01680 
01686     public function getVersion()
01687     {
01688         $sVersion = $this->getActiveShop()->oxshops__oxversion->value;
01689         return $sVersion;
01690     }
01691 
01697     public function getRevision()
01698     {
01699         $sFileName = $this->getConfigParam( 'sShopDir' ) . "/pkg.rev";
01700         $iRev = (int) trim(@file_get_contents($sFileName));
01701 
01702         if (!$iRev) {
01703             return false;
01704         }
01705 
01706         return $iRev;
01707     }
01708 
01714     public function getPackageInfo()
01715     {
01716         $sFileName = $this->getConfigParam( 'sShopDir' ) . "/pkg.info";
01717         $iRev = @file_get_contents($sFileName);
01718         $iRev = str_replace("\n", "<br>", $iRev);
01719 
01720         if (!$iRev) {
01721             return false;
01722         }
01723 
01724         return $iRev;
01725     }
01726 
01727 
01733     public function isMall()
01734     {
01735 
01736             return false;
01737     }
01738 
01748     public function detectVersion()
01749     {
01750     }
01751 
01752 
01753 
01766     public function saveShopConfVar( $sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '' )
01767     {
01768         switch ( $sVarType ) {
01769             case 'arr':
01770             case 'aarr':
01771                 if (is_array($sVarVal)) {
01772                     $sValue = serialize( $sVarVal );
01773                 } else {
01774                     // Deprecated functionality
01775                     $sValue  = $sVarVal ;
01776                     $sVarVal = unserialize( $sVarVal );
01777                 }
01778                 break;
01779             case 'num':
01780                 //config param
01781                 $sVarVal = $sVarVal != ''? oxUtils::getInstance()->string2Float( $sVarVal ) : '';
01782                 $sValue = $sVarVal;
01783                 break;
01784             case 'bool':
01785                 //config param
01786                 $sVarVal = (( $sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
01787                 //db value
01788                 $sValue  = $sVarVal?"1":"";
01789                 break;
01790             default:
01791                 $sValue  = $sVarVal;
01792                 break;
01793         }
01794 
01795         if ( !$sShopId ) {
01796             $sShopId = $this->getShopId();
01797         }
01798 
01799         // Update value only for current shop
01800         if ($sShopId == $this->getShopId()) {
01801             $this->setConfigParam( $sVarName, $sVarVal );
01802         }
01803 
01804         $oDb = oxDb::getDb();
01805 
01806         $sShopIdQuoted     = $oDb->quote($sShopId);
01807         $sModuleQuoted     = $oDb->quote($sModule);
01808         $sVarNameQuoted    = $oDb->quote($sVarName);
01809         $sVarTypeQuoted    = $oDb->quote($sVarType);
01810         $sVarValueQuoted   = $oDb->quote($sValue);
01811         $sConfigKeyQuoted  = $oDb->quote($this->getConfigParam('sConfigKey'));
01812         $sNewOXIDdQuoted   = $oDb->quote(oxUtilsObject::getInstance()->generateUID());
01813 
01814         $sQ = "delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
01815         $oDb->execute( $sQ );
01816 
01817         $sQ = "insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
01818                values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
01819         $oDb->execute( $sQ );
01820     }
01821 
01831     public function getShopConfVar( $sVarName, $sShopId = null, $sModule = '' )
01832     {
01833         if ( !$sShopId ) {
01834             $sShopId = $this->getShopId();
01835         }
01836 
01837         if ( $sShopId === $this->getShopId() && ( !$sModule || $sModule == oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') ) ) {
01838             $sVarValue = $this->getConfigParam( $sVarName );
01839             if ( $sVarValue !== null ) {
01840                 return $sVarValue;
01841             }
01842         }
01843 
01844         $oDb = oxDb::getDb( oxDb::FETCH_MODE_ASSOC );
01845 
01846         $sQ  = "select oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = ".$oDb->quote($sVarName);
01847         $oRs = $oDb->select( $sQ );
01848 
01849         $sValue = null;
01850         if ( $oRs != false && $oRs->recordCount() > 0 ) {
01851             $sValue = $this->decodeValue( $oRs->fields['oxvartype'], $oRs->fields['oxvarvalue'] );
01852         }
01853         return $sValue;
01854     }
01855 
01864     public function decodeValue( $sType, $mOrigValue )
01865     {
01866         $sValue = $mOrigValue;
01867         switch ( $sType ) {
01868             case 'arr':
01869             case 'aarr':
01870                 $sValue = unserialize( $mOrigValue );
01871                 break;
01872             case 'bool':
01873                 $sValue = ( $mOrigValue == 'true' || $mOrigValue == '1' );
01874                 break;
01875         }
01876 
01877         return $sValue;
01878     }
01879 
01887     public function getDecodeValueQuery( $sFieldName = "oxvarvalue" )
01888     {
01889         return " DECODE( {$sFieldName}, '".$this->getConfigParam( 'sConfigKey' )."') ";
01890     }
01891 
01897     public function isProductiveMode()
01898     {
01899         $blProductive = false;
01900 
01901         $blProductive = $this->getConfigParam( 'blProductive' );
01902         if ( !isset( $blProductive ) ) {
01903             $sQ = 'select oxproductive from oxshops where oxid = "'.$this->getShopId().'"';
01904             $blProductive = ( bool ) oxDb::getDb()->getOne( $sQ );
01905             $this->setConfigParam( 'blProductive', $blProductive );
01906         }
01907 
01908         return $blProductive;
01909     }
01910 
01911 
01912 
01918     public function getBaseShopId()
01919     {
01920 
01921             return 'oxbaseshop';
01922     }
01923 
01929     public function getActiveShop()
01930     {
01931         if ( $this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
01932              $this->_oActShop->getLanguage() == oxLang::getInstance()->getBaseLanguage() ) {
01933             return $this->_oActShop;
01934         }
01935 
01936         $this->_oActShop = oxNew( 'oxshop' );
01937         $this->_oActShop->load( $this->getShopId() );
01938         return $this->_oActShop;
01939     }
01940 
01946     public function getActiveView()
01947     {
01948         if ( $this->_oActView != null ) {
01949             return $this->_oActView;
01950         }
01951 
01952         $this->_oActView = oxNew( 'oxubase' );
01953         return $this->_oActView;
01954     }
01955 
01963     public function setActiveView( $oView )
01964     {
01965         $this->_oActView = $oView;
01966     }
01967 
01973     public function isUtf()
01974     {
01975         return ( bool ) $this->getConfigParam( 'iUtfMode' );
01976     }
01977 
01983     public function getLogsDir()
01984     {
01985         return $this->getConfigParam( 'sShopDir' ).'log/';
01986     }
01987 
01995     public function isThemeOption( $sName )
01996     {
01997         return (bool) isset( $this->_aThemeConfigParams[$sName] );
01998     }
01999 
02005     public function getShopMainUrl()
02006     {
02007         return $this->isSsl() ? $this->getConfigParam( 'sSSLShopURL' ) : $this->getConfigParam( 'sShopURL' );
02008     }
02009 
02015     public function getAllModules()
02016     {
02017         return $this->parseModuleChains($this->getConfigParam('aModules'));
02018     }
02019 
02027     public function parseModuleChains($aModules)
02028     {
02029         $aModuleArray = array();
02030 
02031         if (is_array($aModules)) {
02032             foreach ($aModules as $sClass => $sModuleChain) {
02033                 if (strstr($sModuleChain, '&')) {
02034                     $aModuleChain = explode('&', $sModuleChain);
02035                 } else {
02036                     $aModuleChain = array($sModuleChain);
02037                 }
02038                 $aModuleArray[$sClass] = $aModuleChain;
02039             }
02040         }
02041 
02042         return $aModuleArray;
02043     }
02044 
02051     protected function _handleDbConnectionException( $oEx )
02052     {
02053         $oEx->debugOut();
02054 
02055         if ( defined( 'OXID_PHP_UNIT' ) ) {
02056             return false;
02057         } elseif ( 0 != $this->iDebug ) {
02058             oxUtils::getInstance()->showMessageAndExit( $oEx->getString() );
02059         } else {
02060             header( "HTTP/1.1 500 Internal Server Error");
02061             header( "Location: offline.html");
02062             header( "Connection: close");
02063         }
02064     }
02065 
02072     protected function _handleCookieException( $oEx )
02073     {
02074         $this->_processSeoCall();
02075 
02076         $this->getSession()->start();
02077 
02078         oxUtilsView::getInstance()->addErrorToDisplay( $oEx );
02079         oxUtils::getInstance()->redirect( $this->getShopHomeURL() .'cl=start', true, 302 );
02080     }
02081 }