oxconfig.php

Go to the documentation of this file.
00001 <?php
00002 
00003 //max integer
00004 define( 'MAX_64BIT_INTEGER', '18446744073709551615' );
00005 
00010 class oxConfig extends oxSuperCfg
00011 {
00012     // this column of params are defined in config.inc.php file,
00013     // so for backwards compatibility. names starts without underscore
00014 
00020     protected $dbHost = null;
00021 
00027     protected $dbName = null;
00028 
00034     protected $dbUser = null;
00035 
00041     protected $dbPwd  = null;
00042 
00048     protected $dbType = null;
00049 
00055     protected $sShopURL = null;
00056 
00062     protected $sSSLShopURL = null;
00063 
00069     protected $sAdminSSLURL = null;
00070 
00076     protected $sShopDir = null;
00077 
00083     protected $sCompileDir = null;
00084 
00099     protected $iDebug = 0;
00100 
00106     protected $sAdminEmail = null;
00107 
00113     protected $blSessionUseCookies = null;
00114 
00120     //protected $iMaxArticles = 6000;
00121 
00131     protected $blNativeImages = true;
00132 
00138     protected $aMultiShopTables = array( 'oxarticles', 'oxdiscount', 'oxcategories', 'oxattribute',
00139                                          'oxlinks', 'oxvoucherseries', 'oxmanufacturers',
00140                                          'oxnews', 'oxselectlist', 'oxwrapping',
00141                                          'oxdeliveryset', 'oxdelivery', 'oxvendor', 'oxobject2category');
00142 
00148     private static $_instance = null;
00149 
00155     private $_oStart = null;
00156 
00157 
00163     protected $_oActShop       = null;
00164 
00172     protected $_aActiveViews   = array();
00173 
00179     protected $_aGlobalParams = array();
00180 
00186     protected $_aConfigParams = array();
00187 
00193     protected $_aThemeConfigParams = array();
00194 
00200     protected $_iLanguageId = null;
00201 
00207     protected $_iShopId = null;
00208 
00209 
00215     protected $_sOutDir = 'out';
00216 
00222     protected $_sImageDir = 'img';
00223 
00229     protected $_sPictureDir = 'pictures';
00230 
00236     protected $_sMasterPictureDir = 'master';
00237 
00243     protected $_sTemplateDir = 'tpl';
00244 
00250     protected $_sResourceDir = 'src';
00251 
00257     protected $_sModulesDir = 'modules';
00258 
00264     protected $_blIsSsl = null;
00265 
00271     protected $_aAbsDynImageDir = array();
00272 
00278     protected $_oActCurrencyObject = null;
00279 
00287     protected $_blInit = false;
00288 
00294     const OXMODULE_THEME_PREFIX = 'theme:';
00295 
00301     const OXMODULE_MODULE_PREFIX = 'module:';
00302 
00308     const OXMAX_SHOP_COUNT = 256;
00309 
00317     public function getConfigParam( $sName )
00318     {
00319 
00320         if ( defined( 'OXID_PHP_UNIT' ) ) {
00321             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00322                 $sValue = modConfig::$unitMOD->getModConfigParam( $sName );
00323                 if ( $sValue !== null ) {
00324                     return $sValue;
00325                 }
00326             }
00327         }
00328 
00329         $this->init();
00330 
00331         if ( isset ( $this->_aConfigParams[$sName] ) ) {
00332             return $this->_aConfigParams[$sName];
00333         }
00334 
00335         if ( isset( $this->$sName ) ) {
00336             return $this->$sName;
00337         }
00338 
00339     }
00340 
00349     public function setConfigParam( $sName, $sValue )
00350     {
00351         if ( isset( $this->$sName ) ) {
00352             $this->$sName = $sValue;
00353         } else {
00354             $this->_aConfigParams[$sName] = $sValue;
00355         }
00356     }
00357 
00363     protected function _processSeoCall()
00364     {
00365         // TODO: refactor shop bootstrap and parse url params as soon as possible
00366         if (isSearchEngineUrl()) {
00367             oxNew('oxSeoDecoder')->processSeoCall();
00368         }
00369     }
00370 
00378     public function init()
00379     {
00380         // Duplicated init protection
00381         if ($this->_blInit) {
00382            return;
00383         }
00384         $this->_blInit = true;
00385 
00386         $this->_loadVarsFromFile();
00387 
00388         include getShopBasePath().'core/oxconfk.php';
00389 
00390         // setting ADODB timeout
00391         global  $ADODB_SESS_LIFE;
00392         $ADODB_SESS_LIFE  = 1;
00393 
00394         // some important defaults
00395         $this->_setDefaults();
00396 
00397         try {
00398             $sShopID = $this->getShopId();
00399             $blConfigLoaded = $this->_loadVarsFromDb( $sShopID );
00400 
00401             // loading shop config
00402             if ( empty($sShopID) || !$blConfigLoaded ) {
00403                 // if no config values where loaded (some problems with DB), throwing an exception
00404                 $oEx = oxNew( "oxConnectionException" );
00405                 $oEx->setMessage( "Unable to load shop config values from database" );
00406                 throw $oEx;
00407             }
00408 
00409             // loading theme config options
00410             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') );
00411 
00412             // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362)
00413             if ( $this->getConfigParam('sCustomTheme') ) {
00414                 $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme') );
00415             }
00416 
00417             // loading modules config
00418             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_MODULE_PREFIX );
00419 
00420 
00421             $this->_processSeoCall();
00422 
00423             //starting up the session
00424             $this->getSession()->start();
00425 
00426         } catch ( oxConnectionException $oEx ) {
00427 
00428             $oEx->debugOut();
00429             if ( defined( 'OXID_PHP_UNIT' ) ) {
00430                 return false;
00431             } elseif ( 0 != $this->iDebug ) {
00432                 oxRegistry::getUtils()->showMessageAndExit( $oEx->getString() );
00433             } else {
00434                 header( "HTTP/1.1 500 Internal Server Error");
00435                 header( "Location: offline.html");
00436                 header( "Connection: close");
00437             }
00438         } catch ( oxCookieException $oEx ) {
00439 
00440             $this->_processSeoCall();
00441 
00442             //starting up the session
00443             $this->getSession()->start();
00444 
00445             // redirect to start page and display the error
00446             oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx );
00447             oxRegistry::getUtils()->redirect( $this->getShopHomeURL() .'cl=start', true, 302 );
00448         }
00449 
00450 
00451         // Admin handling
00452         $this->setConfigParam( 'blAdmin', isAdmin() );
00453 
00454         if ( defined('OX_ADMIN_DIR') ) {
00455             $this->setConfigParam( 'sAdminDir', OX_ADMIN_DIR );
00456         }
00457 
00458         $this->_loadVarsFromFile();
00459 
00460         //application initialization
00461         $this->_oStart = new oxStart();
00462         $this->_oStart->appInit();
00463     }
00464 
00472     public static function getInstance()
00473     {
00474         return oxRegistry::getConfig();
00475     }
00476 
00482     protected function _loadVarsFromFile()
00483     {
00484         //config variables from config.inc.php takes priority over the ones loaded from db
00485         include getShopBasePath().'/config.inc.php';
00486 
00487         //adding trailing slashes
00488         $oFileUtils = oxRegistry::get("oxUtilsFile");
00489         $this->sShopDir     = $oFileUtils->normalizeDir($this->sShopDir);
00490         $this->sCompileDir  = $oFileUtils->normalizeDir($this->sCompileDir);
00491         $this->sShopURL     = $oFileUtils->normalizeDir($this->sShopURL);
00492         $this->sSSLShopURL  = $oFileUtils->normalizeDir($this->sSSLShopURL);
00493         $this->sAdminSSLURL = $oFileUtils->normalizeDir($this->sAdminSSLURL);
00494 
00495         $this->_loadCustomConfig();
00496     }
00497 
00503     protected function _setDefaults()
00504     {
00505 
00506         // some important defaults
00507         if( !$this->getConfigParam( 'sDefaultLang' ) )
00508             $this->setConfigParam( 'sDefaultLang', 0 );
00509 
00510 
00511         $this->setConfigParam( 'sTheme', 'azure' );
00512 
00513 
00514         $blLogChangesInAdmin = $this->getConfigParam( 'blLogChangesInAdmin' );
00515         if( !isset( $blLogChangesInAdmin ) )
00516             $this->setConfigParam( 'blLogChangesInAdmin', false );
00517 
00518         $blCheckTemplates = $this->getConfigParam( 'blCheckTemplates' );
00519         if( !isset( $blCheckTemplates ) )
00520             $this->setConfigParam( 'blCheckTemplates', false );
00521 
00522         $blAllowArticlesubclass = $this->getConfigParam( 'blAllowArticlesubclass' );
00523         if( !isset( $blAllowArticlesubclass ) )
00524             $this->setConfigParam( 'blAllowArticlesubclass', false );
00525 
00526         $iAdminListSize = $this->getConfigParam( 'iAdminListSize' );
00527         if( !isset( $iAdminListSize ) )
00528             $this->setConfigParam( 'iAdminListSize', 9 );
00529 
00530         // #1173M  for EE - not all pic are deleted
00531         $iPicCount = $this->getConfigParam( 'iPicCount' );
00532         if ( !isset( $iPicCount ) )
00533             $this->setConfigParam( 'iPicCount', 7 );
00534 
00535         $iZoomPicCount = $this->getConfigParam( 'iZoomPicCount' );
00536         if ( !isset( $iZoomPicCount ) )
00537             $this->setConfigParam( 'iZoomPicCount', 4 );
00538 
00539         //max shop id default value
00540         $iMaxShopId = $this->getConfigParam( 'iMaxShopId' );
00541         if ( !isset( $iMaxShopId ) ) {
00542             $this->setConfigParam( 'iMaxShopId', 128 );
00543         } elseif ( $iMaxShopId > self::OXMAX_SHOP_COUNT ) {
00544             $this->setConfigParam( 'iMaxShopId', self::OXMAX_SHOP_COUNT );
00545         }
00546 
00547         // ADODB cache life time
00548         $iDBCacheLifeTime = $this->getConfigParam( 'iDBCacheLifeTime' );
00549         if ( !isset( $iDBCacheLifeTime ) )
00550             $this->setConfigParam( 'iDBCacheLifeTime', 3600 ); // 1 hour
00551 
00552         $sCoreDir = $this->getConfigParam( 'sShopDir' );
00553         $this->setConfigParam( 'sCoreDir', $sCoreDir.'/core/' );
00554     }
00555 
00561     protected function _loadCustomConfig()
00562     {
00563         $sCustConfig = getShopBasePath().'/cust_config.inc.php';
00564         if ( is_readable( $sCustConfig ) ) {
00565             include $sCustConfig;
00566         }
00567     }
00568 
00578     protected function _loadVarsFromDb( $sShopID, $aOnlyVars = null, $sModule = '' )
00579     {
00580         $oDb = oxDb::getDb();
00581 
00582         if ( !empty($sModule) ) {
00583             $sModuleSql = " oxmodule LIKE " . $oDb->quote($sModule."%");
00584         } else {
00585             $sModuleSql = " oxmodule='' ";
00586         }
00587 
00588         $sQ = "select oxvarname, oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '$sShopID' and " . $sModuleSql;
00589         // dodger, allow loading from some vars only from baseshop
00590         if ( $aOnlyVars !== null ) {
00591             $blSep = false;
00592             $sIn  = '';
00593             foreach ( $aOnlyVars as $sField ) {
00594                 if ( $blSep ) {
00595                     $sIn .= ', ';
00596                 }
00597                 $sIn .= '"'.$sField.'"';
00598                 $blSep = true;
00599             }
00600             $sQ .= ' and oxvarname in ( '.$sIn.' ) ';
00601         }
00602         $oRs = $oDb->select( $sQ );
00603 
00604         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00605             while ( !$oRs->EOF ) {
00606                 $sVarName = $oRs->fields[0];
00607                 $sVarType = $oRs->fields[1];
00608                 $sVarVal  = $oRs->fields[2];
00609 
00610                 //in sShopURL and sSSLShopURL cases we skip (for admin or when URL values are not set)
00611                 if ( ( $sVarName == 'sShopURL' || $sVarName == 'sSSLShopURL' ) &&
00612                     ( !$sVarVal || $this->isAdmin() === true ) ) {
00613                     $oRs->moveNext();
00614                     continue;
00615                 }
00616 
00617                 $this->_setConfVarFromDb($sVarName, $sVarType, $sVarVal);
00618 
00619                 //setting theme options array
00620                 if ( $sModule != '' ) {
00621                     $this->_aThemeConfigParams[$sVarName] = $sModule;
00622                 }
00623 
00624                 $oRs->moveNext();
00625             }
00626 
00627             return true;
00628         } else {
00629             return false;
00630         }
00631     }
00632 
00642     protected function _setConfVarFromDb($sVarName, $sVarType, $sVarVal)
00643     {
00644         switch ( $sVarType ) {
00645             case 'arr':
00646             case 'aarr':
00647                 $this->setConfigParam( $sVarName, unserialize( $sVarVal ) );
00648                 break;
00649             case 'bool':
00650                 $this->setConfigParam( $sVarName, ( $sVarVal == 'true' || $sVarVal == '1' ) );
00651                 break;
00652             default:
00653                 $this->setConfigParam( $sVarName, $sVarVal );
00654                 break;
00655         }
00656     }
00657 
00663     public function pageClose()
00664     {
00665         if ( $this->hasActiveViewsChain() ) {
00666             // do not commit session until active views chain exists
00667             return;
00668         }
00669 
00670         return $this->_oStart->pageClose();
00671     }
00672 
00685     public static function getParameter( $sName, $blRaw = false )
00686     {
00687         return oxRegistry::getConfig()->getRequestParameter( $sName, $blRaw );
00688     }
00689 
00701     public function getRequestParameter( $sName, $blRaw = false )
00702     {
00703         if ( defined( 'OXID_PHP_UNIT' ) ) {
00704             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00705                 try{
00706                     $sValue = modConfig::getParameter(  $sName, $blRaw );
00707 
00708                     // TODO: remove this after special chars concept implementation
00709                     $blIsAdmin = modConfig::getInstance()->isAdmin() || modSession::getInstance()->getVariable(  "blIsAdmin" );
00710                     if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00711                         $this->checkParamSpecialChars( $sValue, $blRaw );
00712                     }
00713 
00714                     return $sValue;
00715                 } catch( Exception $e ) {
00716                     // if exception is thrown, use default
00717                 }
00718             }
00719         }
00720 
00721         $sValue = null;
00722 
00723         if ( isset( $_POST[$sName] ) ) {
00724             $sValue = $_POST[$sName];
00725         } elseif ( isset( $_GET[$sName] ) ) {
00726             $sValue = $_GET[$sName];
00727         }
00728 
00729         // TODO: remove this after special chars concept implementation
00730         $blIsAdmin = $this->isAdmin() && $this->getSession()->getVariable( "blIsAdmin" );
00731         if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00732             $this->checkParamSpecialChars( $sValue, $blRaw );
00733         }
00734 
00735         return $sValue;
00736     }
00737 
00745     public function getUploadedFile($sParamName)
00746     {
00747         return $_FILES[$sParamName];
00748     }
00749 
00758     public function setGlobalParameter( $sName, $sValue )
00759     {
00760         $this->_aGlobalParams[$sName] = $sValue;
00761     }
00762 
00770     public function getGlobalParameter( $sName )
00771     {
00772         if ( isset( $this->_aGlobalParams[$sName] ) ) {
00773             return $this->_aGlobalParams[$sName];
00774         } else {
00775             return null;
00776         }
00777     }
00778 
00790     public static function checkSpecialChars( & $sValue, $aRaw = null )
00791     {
00792         return oxRegistry::getConfig()->checkParamSpecialChars( $sValue, $aRaw );
00793     }
00794 
00804     public function checkParamSpecialChars( & $sValue, $aRaw = null )
00805     {
00806         if ( is_object( $sValue ) ) {
00807             return $sValue;
00808         }
00809 
00810         if ( is_array( $sValue ) ) {
00811             $newValue = array();
00812             foreach ( $sValue as $sKey => $sVal ) {
00813                 $sValidKey = $sKey;
00814                 if ( !$aRaw || !in_array($sKey, $aRaw) ) {
00815                     $this->checkParamSpecialChars( $sValidKey );
00816                     $this->checkParamSpecialChars( $sVal );
00817                     if ($sValidKey != $sKey) {
00818                         unset ($sValue[$sKey]);
00819                     }
00820                 }
00821                 $newValue[$sValidKey] = $sVal;
00822             }
00823             $sValue = $newValue;
00824         } elseif ( is_string( $sValue ) ) {
00825             $sValue = str_replace( array( '&',     '<',    '>',    '"',      "'",      chr(0), '\\' ),
00826                                    array( '&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '',     '&#092;' ),
00827                                    $sValue );
00828         }
00829         return $sValue;
00830     }
00831 
00837     public function getShopId()
00838     {
00839         if ( $this->_iShopId !== null )
00840             return $this->_iShopId;
00841 
00842             $this->_iShopId = $this->getBaseShopId();
00843 
00844 
00845         $this->getSession()->setVariable( 'actshop', $this->_iShopId );
00846         return $this->_iShopId;
00847     }
00848 
00849 
00857     public function setShopId( $sShopId )
00858     {
00859         $this->getSession()->setVariable( 'actshop', $sShopId );
00860         $this->_iShopId = $sShopId;
00861     }
00862 
00863 
00864 
00872     public function setIsSsl( $blIsSsl = false )
00873     {
00874         $this->_blIsSsl = $blIsSsl;
00875     }
00876 
00882     protected function _checkSsl()
00883     {
00884             $myUtilsServer   = oxRegistry::get("oxUtilsServer");
00885             $aServerVars     = $myUtilsServer->getServerVar();
00886             $aHttpsServerVar = $myUtilsServer->getServerVar( 'HTTPS' );
00887 
00888             $this->setIsSsl();
00889             if (isset( $aHttpsServerVar ) && ($aHttpsServerVar === 'on' || $aHttpsServerVar === 'ON' || $aHttpsServerVar == '1' )) {
00890                 // "1&1" hoster provides "1"
00891                 $this->setIsSsl($this->getConfigParam('sSSLShopURL') || $this->getConfigParam('sMallSSLShopURL')) ;
00892                 if ($this->isAdmin() && !$this->_blIsSsl) {
00893                     //#4026
00894                      $this->setIsSsl( !is_null($this->getConfigParam('sAdminSSLURL')) );
00895                 }
00896             }
00897 
00898             //additional special handling for profihost customers
00899             if ( isset( $aServerVars['HTTP_X_FORWARDED_SERVER'] ) &&
00900                  ( strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'ssl' ) !== false ||
00901                  strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'secure-online-shopping.de' ) !== false ) ) {
00902                  $this->setIsSsl( true );
00903             }
00904 
00905     }
00906 
00907 
00913     public function isSsl()
00914     {
00915         if ( is_null( $this->_blIsSsl ) ) {
00916             $this->_checkSsl();
00917         }
00918         return $this->_blIsSsl;
00919     }
00920 
00928     public function isCurrentUrl( $sURL )
00929     {
00930         // Missing protocol, cannot proceed, assuming true.
00931         if ( !$sURL || (strpos( $sURL, "http" ) !== 0)) {
00932             return true;
00933         }
00934 
00935         return oxRegistry::get("oxUtilsServer")->isCurrentUrl($sURL);
00936     }
00937 
00945     public function isCurrentProtocol( $sURL )
00946     {
00947         // Missing protocol, cannot proceed, assuming true.
00948         if ( !$sURL || (strpos( $sURL, "http" ) !== 0)) {
00949             return true;
00950         }
00951 
00952         return (strpos( $sURL, "https:" ) === 0) == $this->isSsl();
00953     }
00954 
00963     public function getShopUrl( $iLang = null, $blAdmin = null )
00964     {
00965         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->isAdmin();
00966         if ( $blAdmin ) {
00967             return $this->getConfigParam( 'sShopURL' );
00968         }
00969 
00970         // #680 per language another URL
00971         $iLang = isset( $iLang ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00972         $aLanguageURLs = $this->getConfigParam( 'aLanguageURLs' );
00973         if ( isset( $iLang ) && isset( $aLanguageURLs[$iLang] ) && !empty( $aLanguageURLs[$iLang] ) ) {
00974             $aLanguageURLs[$iLang] = oxRegistry::getUtils()->checkUrlEndingSlash( $aLanguageURLs[$iLang] );
00975             return $aLanguageURLs[$iLang];
00976         }
00977 
00978         //normal section
00979         $sMallShopURL = $this->getConfigParam( 'sMallShopURL' );
00980         if ( $sMallShopURL ) {
00981             $sMallShopURL = oxRegistry::getUtils()->checkUrlEndingSlash( $sMallShopURL );
00982             return $sMallShopURL;
00983         }
00984 
00985         return $this->getConfigParam( 'sShopURL' );
00986     }
00987 
00995     public function getSslShopUrl( $iLang = null )
00996     {
00997         // #680 per language another URL
00998         $iLang = isset( $iLang ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00999         $aLanguageSSLURLs = $this->getConfigParam( 'aLanguageSSLURLs' );
01000         if ( isset( $iLang ) && isset( $aLanguageSSLURLs[$iLang] ) && !empty( $aLanguageSSLURLs[$iLang] ) ) {
01001             $aLanguageSSLURLs[$iLang] = oxRegistry::getUtils()->checkUrlEndingSlash( $aLanguageSSLURLs[$iLang] );
01002             return $aLanguageSSLURLs[$iLang];
01003         }
01004 
01005         //mall mode
01006         if ( ( $sMallSSLShopURL = $this->getConfigParam( 'sMallSSLShopURL' ) ) ) {
01007             $sMallSSLShopURL = oxRegistry::getUtils()->checkUrlEndingSlash( $sMallSSLShopURL );
01008             return $sMallSSLShopURL;
01009         }
01010 
01011         if ( ( $sMallShopURL = $this->getConfigParam( 'sMallShopURL' ) ) ) {
01012             $sMallShopURL = oxRegistry::getUtils()->checkUrlEndingSlash( $sMallShopURL );
01013             return $sMallShopURL;
01014         }
01015 
01016         //normal section
01017         if ( ( $sSSLShopURL = $this->getConfigParam( 'sSSLShopURL' ) ) ) {
01018             return $sSSLShopURL;
01019         }
01020 
01021         return $this->getShopUrl( $iLang );
01022     }
01023 
01029     public function getCoreUtilsUrl()
01030     {
01031         return $this->getCurrentShopUrl().'core/utils/';
01032     }
01033 
01042     public function getCurrentShopUrl($blAdmin = null)
01043     {
01044         if ($blAdmin===null) {
01045             $blAdmin = $this->isAdmin();
01046         }
01047         if ($blAdmin) {
01048             if ($this->isSsl()) {
01049 
01050                 $sUrl = $this->getConfigParam( 'sAdminSSLURL' );
01051                 if ( !$sUrl ) {
01052                     return $this->getSslShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
01053                 }
01054                 return $sUrl;
01055             } else {
01056                 return $this->getShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
01057             }
01058         } else {
01059             return $this->isSsl() ? $this->getSslShopUrl() : $this->getShopUrl();
01060         }
01061     }
01062 
01070     public function getShopCurrentUrl( $iLang = null )
01071     {
01072         if ( $this->isSsl() ) {
01073             $sURL = $this->getSSLShopURL( $iLang );
01074         } else {
01075             $sURL = $this->getShopURL( $iLang );
01076         }
01077 
01078         return oxRegistry::get("oxUtilsUrl")->processUrl( $sURL.'index.php', false );
01079     }
01080 
01089     public function getShopHomeUrl( $iLang = null, $blAdmin = null )
01090     {
01091         return oxRegistry::get("oxUtilsUrl")->processUrl($this->getShopUrl( $iLang, $blAdmin).'index.php', false );
01092     }
01093 
01102     public function getWidgetUrl( $iLang = null, $blAdmin = null )
01103     {
01104         return oxRegistry::get("oxUtilsUrl")->processUrl($this->getShopUrl( $iLang, $blAdmin).'widget.php', false );
01105     }
01106 
01112     public function getShopSecureHomeUrl()
01113     {
01114         return  oxRegistry::get("oxUtilsUrl")->processUrl( $this->getSslShopUrl().'index.php', false );
01115     }
01116 
01122     public function getShopCurrency()
01123     {
01124         $iCurr = null;
01125         if ( ( null === ( $iCurr = $this->getRequestParameter( 'cur' ) ) ) ) {
01126             if ( null === ( $iCurr = $this->getRequestParameter( 'currency' ) ) ) {
01127                 $iCurr = $this->getSession()->getVariable( 'currency' );
01128             }
01129         }
01130         return (int) $iCurr;
01131     }
01132 
01138     public function getActShopCurrencyObject()
01139     {
01140         //caching currency as it does not change through the script
01141         //but not for unit tests as ther it changes always
01142         if ( !defined( 'OXID_PHP_UNIT' ) ) {
01143             if (!is_null($this->_oActCurrencyObject)) {
01144                 return $this->_oActCurrencyObject;
01145             }
01146         }
01147 
01148         $iCur = $this->getShopCurrency();
01149         $aCurrencies = $this->getCurrencyArray();
01150         if ( !isset( $aCurrencies[$iCur] ) ) {
01151             return $this->_oActCurrencyObject = reset( $aCurrencies ); // reset() returns the first element
01152         }
01153 
01154         return $this->_oActCurrencyObject = $aCurrencies[$iCur];
01155     }
01156 
01164     public function setActShopCurrency( $iCur )
01165     {
01166         $aCurrencies = $this->getCurrencyArray();
01167         if ( isset( $aCurrencies[$iCur] ) ) {
01168             $this->getSession()->setVariable( 'currency', $iCur );
01169             $this->_oActCurrencyObject = null;
01170         }
01171     }
01172 
01180     public function getOutDir( $blAbsolute = true)
01181     {
01182         if ($blAbsolute) {
01183             return $this->getConfigParam('sShopDir').$this->_sOutDir.'/';
01184         } else {
01185             return $this->_sOutDir.'/';
01186         }
01187     }
01188 
01196     public function getViewsDir( $blAbsolute = true )
01197     {
01198         if ($blAbsolute) {
01199             return $this->getConfigParam('sShopDir'). 'application/views/';
01200         } else {
01201             return 'application/views/';
01202         }
01203     }
01204 
01212     public function getAppDir( $blAbsolute = true )
01213     {
01214         if ($blAbsolute) {
01215             return $this->getConfigParam('sShopDir'). 'application/';
01216         } else {
01217             return 'application/';
01218         }
01219     }
01220 
01230     public function getOutUrl( $blSSL = null , $blAdmin = null, $blNativeImg = false )
01231     {
01232         $blSSL    = is_null($blSSL)?$this->isSsl():$blSSL;
01233         $blAdmin  = is_null($blAdmin)?$this->isAdmin():$blAdmin;
01234 
01235         if ( $blSSL ) {
01236             if ($blNativeImg && !$blAdmin) {
01237                 $sUrl = $this->getSslShopUrl();
01238             } else {
01239                 $sUrl = $this->getConfigParam('sSSLShopURL');
01240                 if (!$sUrl && $blAdmin) {
01241                     $sUrl = $this->getConfigParam('sAdminSSLURL').'../';
01242                 }
01243             }
01244         } else {
01245             $sUrl = ($blNativeImg && !$blAdmin )?$this->getShopUrl():$this->getConfigParam( 'sShopURL' );
01246         }
01247 
01248         return $sUrl.$this->_sOutDir.'/';
01249     }
01250 
01265     public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute = true, $blIgnoreCust = false  )
01266     {
01267         if ( is_null($sTheme) ) {
01268             $sTheme = $this->getConfigParam( 'sTheme' );
01269         }
01270 
01271         if ( $blAdmin ) {
01272             $sTheme = 'admin';
01273         }
01274 
01275         if ( $sDir != $this->_sTemplateDir ) {
01276             $sBase    = $this->getOutDir( $blAbsolute );
01277             $sAbsBase = $this->getOutDir();
01278         } else {
01279             $sBase    = $this->getViewsDir( $blAbsolute );
01280             $sAbsBase = $this->getViewsDir();
01281         }
01282 
01283         $sLang = '-';
01284         // FALSE means skip language folder check
01285         if ( $iLang !== false ) {
01286             $oLang = oxRegistry::getLang();
01287 
01288             if ( is_null( $iLang ) ) {
01289                 $iLang = $oLang->getEditLanguage();
01290             }
01291 
01292             $sLang = $oLang->getLanguageAbbr( $iLang );
01293         }
01294 
01295         if ( is_null($iShop) ) {
01296             $iShop = $this->getShopId();
01297         }
01298 
01299         //Load from
01300         $sPath = "{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
01301         $sCacheKey = $sPath . "_{$blIgnoreCust}{$blAbsolute}";
01302 
01303         if ( ( $sReturn = oxRegistry::getUtils()->fromStaticCache( $sCacheKey ) ) !== null ) {
01304             return $sReturn;
01305         }
01306 
01307         $sReturn = false;
01308 
01309         // Check for custom template
01310         $sCustomTheme = $this->getConfigParam( 'sCustomTheme' );
01311         if ( !$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
01312             $sReturn = $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute );
01313         }
01314 
01315         //test lang level ..
01316         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01317             $sReturn = $sBase . $sPath;
01318         }
01319 
01320         //test shop level ..
01321         $sPath = "$sTheme/$iShop/$sDir/$sFile";
01322         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01323             $sReturn = $sBase . $sPath;
01324         }
01325 
01326 
01327         //test theme language level ..
01328         $sPath = "$sTheme/$sLang/$sDir/$sFile";
01329         if ( !$sReturn && $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01330             $sReturn = $sBase . $sPath;
01331         }
01332 
01333         //test theme level ..
01334         $sPath = "$sTheme/$sDir/$sFile";
01335         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01336             $sReturn = $sBase . $sPath;
01337         }
01338 
01339         //test out language level ..
01340         $sPath = "$sLang/$sDir/$sFile";
01341         if ( !$sReturn &&  $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01342             $sReturn = $sBase . $sPath;
01343         }
01344 
01345         //test out level ..
01346         $sPath = "$sDir/$sFile";
01347         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01348             $sReturn = $sBase . $sPath;
01349         }
01350 
01351         if ( !$sReturn ) {
01352             // TODO: implement logic to log missing paths
01353         }
01354 
01355         // to cache
01356         oxRegistry::getUtils()->toStaticCache( $sCacheKey, $sReturn );
01357 
01358         return $sReturn;
01359     }
01360 
01375     public function getUrl($sFile, $sDir , $blAdmin = null, $blSSL = null, $blNativeImg = false, $iLang = null , $iShop = null , $sTheme = null )
01376     {
01377         $sUrl = str_replace(
01378                                 $this->getOutDir(),
01379                                 $this->getOutUrl($blSSL, $blAdmin, $blNativeImg),
01380                                 $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme )
01381                             );
01382 
01383         return $sUrl;
01384     }
01385 
01394     public function getImagePath( $sFile, $blAdmin = false )
01395     {
01396         return $this->getDir( $sFile, $this->_sImageDir, $blAdmin );
01397     }
01398 
01409     public function getImageUrl( $blAdmin = false, $blSSL = null, $blNativeImg = null, $sFile = null )
01410     {
01411         $blNativeImg = is_null($blNativeImg)?$this->getConfigParam( 'blNativeImages' ):$blNativeImg;
01412         return $this->getUrl( $sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg );
01413     }
01414 
01422     public function getImageDir( $blAdmin = false )
01423     {
01424         return $this->getDir( null, $this->_sImageDir, $blAdmin );
01425     }
01426 
01438     public function getPicturePath($sFile, $blAdmin = false, $iLang = null , $iShop = null , $sTheme = null)
01439     {
01440         return $this->getDir( $sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme );
01441     }
01442 
01450     public function getMasterPictureDir( $blAdmin = false )
01451     {
01452         return $this->getDir( null, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01453     }
01454 
01463     public function getMasterPicturePath( $sFile, $blAdmin = false )
01464     {
01465         return $this->getDir( $sFile, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01466     }
01467 
01480     public function getPictureUrl( $sFile, $blAdmin = false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01481     {
01482         if ( $sAltUrl = oxRegistry::get("oxPictureHandler")->getAltImageUrl('/', $sFile, $blSSL) ) {
01483             return $sAltUrl;
01484         }
01485 
01486         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01487         $sUrl = $this->getUrl( $sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01488 
01489         //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW.
01490         if ( !$sUrl && $sDefPic ) {
01491             $sUrl = $this->getUrl( $sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01492         }
01493         return $sUrl;
01494     }
01495 
01503     public function getPictureDir( $blAdmin )
01504     {
01505         return $this->getDir( null, $this->_sPictureDir, $blAdmin );
01506     }
01507 
01516     public function getTemplatePath( $sFile, $blAdmin )
01517     {
01518         $sTemplatePath = $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin );
01519 
01520         if (!$sTemplatePath) {
01521             $sBasePath        = getShopBasePath();
01522             $aModuleTemplates = $this->getConfigParam('aModuleTemplates');
01523 
01524             $oModulelist = oxNew('oxmodulelist');
01525             $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
01526             if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
01527                 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
01528                     if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
01529                         $sPath = $aTemplates[$sFile];
01530                         $sPath = $sBasePath. 'modules/'.  $sPath;
01531                         if (is_file($sPath) && is_readable($sPath)) {
01532                             $sTemplatePath =  $sPath;
01533                         }
01534                     }
01535                 }
01536             }
01537         }
01538 
01539         return $sTemplatePath;
01540     }
01541 
01549     public function getTemplateDir( $blAdmin = false )
01550     {
01551         return $this->getDir( null, $this->_sTemplateDir, $blAdmin );
01552     }
01553 
01564     public function getTemplateUrl( $sFile = null, $blAdmin = false, $blSSL = null , $iLang = null )
01565     {
01566         return $this->getShopMainUrl() . $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin, $iLang, null, null, false );
01567     }
01568 
01576     public function getTemplateBase( $blAdmin = false )
01577     {
01578         // Base template dir is the parent dir of template dir
01579         return str_replace( $this->_sTemplateDir.'/', '', $this->getDir( null, $this->_sTemplateDir, $blAdmin, null, null, null, false ));
01580     }
01581 
01590     public function getResourcePath($sFile = '', $blAdmin = false )
01591     {
01592         return $this->getDir( $sFile, $this->_sResourceDir, $blAdmin );
01593     }
01594 
01602     public function getModulesDir( $blAbsolute = true )
01603     {
01604         if ($blAbsolute) {
01605             return $this->getConfigParam('sShopDir') . $this->_sModulesDir . '/';
01606         } else {
01607             return $this->_sModulesDir . '/';
01608         }
01609     }
01610 
01621     public function getResourceUrl( $sFile = '', $blAdmin = false , $blSSL = null , $iLang = null )
01622     {
01623         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01624         return $this->getUrl( $sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang );
01625     }
01626 
01634     public function getResourceDir( $blAdmin )
01635     {
01636         return $this->getDir( null, $this->_sResourceDir, $blAdmin );
01637     }
01638 
01646     public function getCurrencyArray( $iCurrency = null )
01647     {
01648         $aConfCurrencies = $this->getConfigParam( 'aCurrencies' );
01649         if ( !is_array( $aConfCurrencies ) ) {
01650             return array();
01651         }
01652 
01653         if ( defined( 'OXID_PHP_UNIT' ) ) {
01654             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
01655                 try{
01656                     $aAltCurrencies = modConfig::getInstance()->getConfigParam( 'modaCurrencies' );
01657                     if ( isset( $aAltCurrencies ) ) {
01658                         $aConfCurrencies = $aAltCurrencies;
01659                     }
01660                 } catch( Exception $e ) {
01661                     // if exception is thrown, use default
01662                 }
01663             }
01664         }
01665 
01666         // processing currency configuration data
01667         $aCurrencies = array();
01668         reset( $aConfCurrencies );
01669         while ( list( $key, $val ) = each( $aConfCurrencies ) ) {
01670             if ( $val ) {
01671                 $oCur = new stdClass();
01672                 $oCur->id      = $key;
01673                 $sCur = explode( '@', $val);
01674                 $oCur->name     = trim( $sCur[0] );
01675                 $oCur->rate     = trim( $sCur[1] );
01676                 $oCur->dec      = trim( $sCur[2] );
01677                 $oCur->thousand = trim( $sCur[3] );
01678                 $oCur->sign     = trim( $sCur[4] );
01679                 $oCur->decimal  = trim( $sCur[5] );
01680 
01681                 // change for US version
01682                 if ( isset( $sCur[6] ) ) {
01683                     $oCur->side = trim($sCur[6]);
01684                 }
01685 
01686                 if ( isset( $iCurrency) && $key == $iCurrency ) {
01687                     $oCur->selected = 1;
01688                 } else {
01689                     $oCur->selected = 0;
01690                 }
01691                 $aCurrencies[$key]= $oCur;
01692             }
01693 
01694             // #861C -  performance, do not load other currencies
01695             if ( !$this->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01696                 break;
01697             }
01698         }
01699         return $aCurrencies;
01700     }
01701 
01709     public function getCurrencyObject( $sName )
01710     {
01711         $aSearch = $this->getCurrencyArray();
01712         foreach ( $aSearch as $oCur ) {
01713             if ( $oCur->name == $sName ) {
01714                 return $oCur;
01715             }
01716         }
01717     }
01718 
01724     public function isDemoShop()
01725     {
01726         return $this->getConfigParam('blDemoShop');
01727     }
01728 
01729 
01730 
01736     public function getEdition()
01737     {
01738             return "CE";
01739 
01740 
01741     }
01742 
01748     public function getFullEdition()
01749     {
01750         $sEdition = $this->getEdition();
01751 
01752             if ($sEdition == "CE") {
01753                 return "Community Edition";
01754             }
01755 
01756 
01757 
01758         return $sEdition;
01759     }
01760 
01766     public function getVersion()
01767     {
01768         $sVersion = $this->getActiveShop()->oxshops__oxversion->value;
01769         return $sVersion;
01770     }
01771 
01777     public function getRevision()
01778     {
01779         try {
01780             $sFileName = getShopBasePath() . "/pkg.rev";
01781             $iRev = (int) trim(@file_get_contents($sFileName));
01782         } catch (Exception $e) {
01783             return false;
01784         }
01785 
01786         if (!$iRev) {
01787             return false;
01788         }
01789 
01790         return $iRev;
01791     }
01792 
01793 
01799     public function isMall()
01800     {
01801 
01802             return false;
01803     }
01804 
01814     public function detectVersion()
01815     {
01816     }
01817 
01818 
01819 
01832     public function saveShopConfVar( $sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '' )
01833     {
01834         switch ( $sVarType ) {
01835             case 'arr':
01836             case 'aarr':
01837                 $sValue = serialize( $sVarVal );
01838                 break;
01839             case 'bool':
01840                 //config param
01841                 $sVarVal = (( $sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
01842                 //db value
01843                 $sValue  = $sVarVal?"1":"";
01844                 break;
01845             default:
01846                 $sValue  = $sVarVal;
01847                 break;
01848         }
01849 
01850         if ( !$sShopId ) {
01851             $sShopId = $this->getShopId();
01852         }
01853 
01854         // Update value only for current shop
01855         if ($sShopId == $this->getShopId()) {
01856             $this->setConfigParam( $sVarName, $sVarVal );
01857         }
01858 
01859         $oDb = oxDb::getDb();
01860 
01861         $sShopIdQuoted     = $oDb->quote($sShopId);
01862         $sModuleQuoted     = $oDb->quote($sModule);
01863         $sVarNameQuoted    = $oDb->quote($sVarName);
01864         $sVarTypeQuoted    = $oDb->quote($sVarType);
01865         $sVarValueQuoted   = $oDb->quote($sValue);
01866         $sConfigKeyQuoted  = $oDb->quote($this->getConfigParam('sConfigKey'));
01867         $sNewOXIDdQuoted   = $oDb->quote(oxUtilsObject::getInstance()->generateUID());
01868 
01869         $sQ = "delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
01870         $oDb->execute( $sQ );
01871 
01872         $sQ = "insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
01873                values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
01874 
01875         $oDb->execute( $sQ );
01876 
01877 
01878 
01879     }
01880 
01881 
01891     public function getShopConfVar( $sVarName, $sShopId = null, $sModule = '' )
01892     {
01893         if ( !$sShopId ) {
01894             $sShopId = $this->getShopId();
01895         }
01896 
01897         if ( $sShopId === $this->getShopId() && ( !$sModule || $sModule == oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') ) ) {
01898             $sVarValue = $this->getConfigParam( $sVarName );
01899             if ( $sVarValue !== null ) {
01900                 return $sVarValue;
01901             }
01902         }
01903 
01904         $oDb = oxDb::getDb( oxDb::FETCH_MODE_ASSOC );
01905 
01906         $sQ  = "select oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = ".$oDb->quote($sVarName);
01907         $oRs = $oDb->select( $sQ );
01908 
01909         $sValue = null;
01910         if ( $oRs != false && $oRs->recordCount() > 0 ) {
01911             $sValue = $this->decodeValue( $oRs->fields['oxvartype'], $oRs->fields['oxvarvalue'] );
01912         }
01913         return $sValue;
01914     }
01915 
01924     public function decodeValue( $sType, $mOrigValue )
01925     {
01926         $sValue = $mOrigValue;
01927         switch ( $sType ) {
01928             case 'arr':
01929             case 'aarr':
01930                 $sValue = unserialize( $mOrigValue );
01931                 break;
01932             case 'bool':
01933                 $sValue = ( $mOrigValue == 'true' || $mOrigValue == '1' );
01934                 break;
01935         }
01936 
01937         return $sValue;
01938     }
01939 
01947     public function getDecodeValueQuery( $sFieldName = "oxvarvalue" )
01948     {
01949         return " DECODE( {$sFieldName}, '".$this->getConfigParam( 'sConfigKey' )."') ";
01950     }
01951 
01957     public function isProductiveMode()
01958     {
01959         $blProductive = false;
01960 
01961         $blProductive = $this->getConfigParam( 'blProductive' );
01962         if ( !isset( $blProductive ) ) {
01963             $sQ = 'select oxproductive from oxshops where oxid = "'.$this->getShopId().'"';
01964             $blProductive = ( bool ) oxDb::getDb()->getOne( $sQ );
01965             $this->setConfigParam( 'blProductive', $blProductive );
01966         }
01967 
01968         return $blProductive;
01969     }
01970 
01971 
01972 
01978     public function getBaseShopId()
01979     {
01980 
01981             return 'oxbaseshop';
01982     }
01983 
01989     public function getActiveShop()
01990     {
01991         if ( $this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
01992              $this->_oActShop->getLanguage() == oxRegistry::getLang()->getBaseLanguage() ) {
01993             return $this->_oActShop;
01994         }
01995 
01996         $this->_oActShop = oxNew( 'oxshop' );
01997         $this->_oActShop->load( $this->getShopId() );
01998         return $this->_oActShop;
01999     }
02000 
02006     public function getActiveView()
02007     {
02008         if ( count( $this->_aActiveViews ) ) {
02009             $oActView = end( $this->_aActiveViews );
02010         }
02011         if ( $oActView == null ) {
02012             $oActView = oxNew( 'oxubase' );
02013             $this->_aActiveViews[] = $oActView;
02014         }
02015 
02016         return $oActView;
02017     }
02018 
02024     public function getTopActiveView()
02025     {
02026         if ( count( $this->_aActiveViews ) ) {
02027             return reset( $this->_aActiveViews );
02028         } else {
02029             return $this->getActiveView();
02030         }
02031     }
02032 
02038     public function getActiveViewsList()
02039     {
02040         return $this->_aActiveViews;
02041     }
02042 
02050     public function setActiveView( $oView )
02051     {
02052         $this->_aActiveViews[] = $oView;
02053     }
02054 
02060     public function dropLastActiveView()
02061     {
02062         array_pop( $this->_aActiveViews );
02063     }
02064 
02070     public function hasActiveViewsChain()
02071     {
02072         return ( count( $this->_aActiveViews ) > 1 );
02073     }
02074 
02080     public function getActiveViewsNames()
02081     {
02082         $aNames = array();
02083 
02084         if ( is_array( $this->getActiveViewsList() ) ) {
02085             foreach ($this->getActiveViewsList() as $oView ) {
02086                 $aNames[] = $oView->getClassName();
02087             }
02088         }
02089 
02090         return $aNames;
02091     }
02092 
02098     public function isUtf()
02099     {
02100         return ( bool ) $this->getConfigParam( 'iUtfMode' );
02101     }
02102 
02108     public function getLogsDir()
02109     {
02110         return $this->getConfigParam( 'sShopDir' ).'log/';
02111     }
02112 
02120     public function isThemeOption( $sName )
02121     {
02122         return (bool) isset( $this->_aThemeConfigParams[$sName] );
02123     }
02124 
02130     public function getShopMainUrl()
02131     {
02132         return $this->_blIsSsl ? $this->getConfigParam( 'sSSLShopURL' ) : $this->getConfigParam( 'sShopURL' );
02133     }
02134 
02140     public function getAllModules()
02141     {
02142         return $this->parseModuleChains($this->getConfigParam('aModules'));
02143     }
02144 
02152     public function parseModuleChains($aModules)
02153     {
02154         $aModuleArray = array();
02155 
02156         if (is_array($aModules)) {
02157             foreach ($aModules as $sClass => $sModuleChain) {
02158                 if (strstr($sModuleChain, '&')) {
02159                     $aModuleChain = explode('&', $sModuleChain);
02160                 } else {
02161                     $aModuleChain = array($sModuleChain);
02162                 }
02163                 $aModuleArray[$sClass] = $aModuleChain;
02164             }
02165         }
02166 
02167         return $aModuleArray;
02168     }
02169 
02175     public function getShopIds()
02176     {
02177         return oxDb::getDb()->getCol( "SELECT `oxid` FROM `oxshops`" );
02178     }
02179 
02180 }