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         } catch ( oxConnectionException $oEx ) {
00455 
00456             $oEx->debugOut();
00457             if ( defined( 'OXID_PHP_UNIT' ) ) {
00458                 return false;
00459             } elseif ( 0 != $this->iDebug ) {
00460                 oxUtils::getInstance()->showMessageAndExit( $oEx->getString() );
00461             } else {
00462                 header( "HTTP/1.1 500 Internal Server Error");
00463                 header( "Location: offline.html");
00464                 header( "Connection: close");
00465             }
00466         } catch ( oxCookieException $oEx ) {
00467 
00468             $this->_processSeoCall();
00469 
00470             //starting up the session
00471             $this->getSession()->start();
00472 
00473             // redirect to start page and display the error
00474             oxUtilsView::getInstance()->addErrorToDisplay( $oEx );
00475             oxUtils::getInstance()->redirect( $this->getShopHomeURL() .'cl=start', true, 302 );
00476         }
00477 
00478 
00479         $this->_loadVarsFromFile();
00480 
00481         //application initialization
00482         $this->_oStart = new oxStart();
00483         $this->_oStart->appInit();
00484     }
00485 
00491     public static function getInstance()
00492     {
00493 
00494         if ( defined( 'OXID_PHP_UNIT' ) ) {
00495             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00496                 return modConfig::$unitMOD;
00497             }
00498         }
00499 
00500         if ( !self::$_instance instanceof oxConfig ) {
00501                 //exceptions from here go directly to global exception handler
00502                 //if no init is possible whole application has to die!
00503                 self::$_instance = new oxConfig();
00504                 self::$_instance->init();
00505         }
00506         return self::$_instance;
00507     }
00508 
00514     protected function _loadVarsFromFile()
00515     {
00516         //config variables from config.inc.php takes priority over the ones loaded from db
00517         include getShopBasePath().'/config.inc.php';
00518 
00519         //adding trailing slashes
00520         $oFileUtils = oxUtilsFile::getInstance();
00521         $this->sShopDir     = $oFileUtils->normalizeDir($this->sShopDir);
00522         $this->sCompileDir  = $oFileUtils->normalizeDir($this->sCompileDir);
00523         $this->sShopURL     = $oFileUtils->normalizeDir($this->sShopURL);
00524         $this->sSSLShopURL  = $oFileUtils->normalizeDir($this->sSSLShopURL);
00525         $this->sAdminSSLURL = $oFileUtils->normalizeDir($this->sAdminSSLURL);
00526         
00527         $this->_loadCustomConfig();
00528     }
00529 
00535     protected function _loadCustomConfig()
00536     {
00537         $sCustConfig = getShopBasePath().'/cust_config.inc.php';
00538         if ( is_readable( $sCustConfig ) ) {
00539             include $sCustConfig;
00540         }
00541     }
00542     
00552     protected function _loadVarsFromDb( $sShopID, $aOnlyVars = null, $sModule = '' )
00553     {
00554         $oDb = oxDb::getDb();
00555 
00556         if ( !empty($sModule) ) {
00557             $sModuleSql = " oxmodule LIKE " . $oDb->quote($sModule."%");
00558         } else {
00559             $sModuleSql = " oxmodule='' ";
00560         }
00561 
00562         $sQ = "select oxvarname, oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '$sShopID' and " . $sModuleSql;
00563         // dodger, allow loading from some vars only from baseshop
00564         if ( $aOnlyVars !== null ) {
00565             $blSep = false;
00566             $sIn  = '';
00567             foreach ( $aOnlyVars as $sField ) {
00568                 if ( $blSep ) {
00569                     $sIn .= ', ';
00570                 }
00571                 $sIn .= '"'.$sField.'"';
00572                 $blSep = true;
00573             }
00574             $sQ .= ' and oxvarname in ( '.$sIn.' ) ';
00575         }
00576         $oRs = $oDb->select( $sQ );
00577 
00578         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00579             while ( !$oRs->EOF ) {
00580                 $sVarName = $oRs->fields[0];
00581                 $sVarType = $oRs->fields[1];
00582                 $sVarVal  = $oRs->fields[2];
00583 
00584                 //in sShopURL and sSSLShopURL cases we skip (for admin or when URL values are not set)
00585                 if ( ( $sVarName == 'sShopURL' || $sVarName == 'sSSLShopURL' ) &&
00586                     ( !$sVarVal || $this->isAdmin() === true ) ) {
00587                     $oRs->moveNext();
00588                     continue;
00589                 }
00590 
00591                 $this->_setConfVarFromDb($sVarName, $sVarType, $sVarVal);
00592 
00593                 //setting theme options array
00594                 if ( $sModule != '' ) {
00595                     $this->_aThemeConfigParams[$sVarName] = $sModule;
00596                 }
00597 
00598                 $oRs->moveNext();
00599             }
00600 
00601             return true;
00602         } else {
00603             return false;
00604         }
00605     }
00606 
00616     protected function _setConfVarFromDb($sVarName, $sVarType, $sVarVal)
00617     {
00618         switch ( $sVarType ) {
00619             case 'arr':
00620             case 'aarr':
00621                 $this->setConfigParam( $sVarName, unserialize( $sVarVal ) );
00622                 break;
00623             case 'bool':
00624                 $this->setConfigParam( $sVarName, ( $sVarVal == 'true' || $sVarVal == '1' ) );
00625                 break;
00626             default:
00627                 $this->setConfigParam( $sVarName, $sVarVal );
00628                 break;
00629         }
00630     }
00631 
00637     public function pageClose()
00638     {
00639         return $this->_oStart->pageClose();
00640     }
00641 
00653     public static function getParameter(  $sName, $blRaw = false )
00654     {
00655         if ( defined( 'OXID_PHP_UNIT' ) ) {
00656             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00657                 try{
00658                     $sValue = modConfig::getParameter(  $sName, $blRaw );
00659 
00660                     // TODO: remove this after special chars concept implementation
00661                     $blIsAdmin = modConfig::getInstance()->isAdmin() || isAdmin();
00662                     if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00663                         self::checkSpecialChars( $sValue, $blRaw );
00664                     }
00665 
00666                     return $sValue;
00667                 } catch( Exception $e ) {
00668                     // if exception is thrown, use default
00669                 }
00670             }
00671         }
00672 
00673         $sValue = null;
00674 
00675         if ( isset( $_POST[$sName] ) ) {
00676             $sValue = $_POST[$sName];
00677         } elseif ( isset( $_GET[$sName] ) ) {
00678             $sValue = $_GET[$sName];
00679         }
00680 
00681         // TODO: remove this after special chars concept implementation
00682         $blIsAdmin = oxConfig::getInstance()->isAdmin() && oxSession::getVar("blIsAdmin");
00683         if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00684             self::checkSpecialChars( $sValue, $blRaw );
00685         }
00686 
00687         return $sValue;
00688     }
00689 
00697     public function getUploadedFile($sParamName)
00698     {
00699         return $_FILES[$sParamName];
00700     }
00701 
00710     public function setGlobalParameter( $sName, $sValue )
00711     {
00712         $this->_aGlobalParams[$sName] = $sValue;
00713     }
00714 
00722     public function getGlobalParameter( $sName )
00723     {
00724         if ( isset( $this->_aGlobalParams[$sName] ) ) {
00725             return $this->_aGlobalParams[$sName];
00726         } else {
00727             return null;
00728         }
00729     }
00730 
00740     public static function checkSpecialChars( & $sValue, $aRaw = null )
00741     {
00742         if ( is_object( $sValue ) ) {
00743             return $sValue;
00744         }
00745 
00746         if ( is_array( $sValue ) ) {
00747             $newValue = array();
00748             foreach ( $sValue as $sKey => $sVal ) {
00749                 $sValidKey = $sKey;
00750                 if ( !$aRaw || !in_array($sKey, $aRaw) ) {
00751                     self::checkSpecialChars( $sValidKey );
00752                     self::checkSpecialChars( $sVal );
00753                     if ($sValidKey != $sKey) {
00754                         unset ($sValue[$sKey]);
00755                     }
00756                 }
00757                 $newValue[$sValidKey] = $sVal;
00758             }
00759             $sValue = $newValue;
00760         } elseif ( is_string( $sValue ) ) {
00761             $sValue = str_replace( array( '&',     '<',    '>',    '"',      "'",      chr(0), '\\' ),
00762                                    array( '&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '',     '&#092;' ),
00763                                    $sValue );
00764         }
00765         return $sValue;
00766     }
00767 
00773     public function getShopId()
00774     {
00775         if ( $this->_iShopId !== null )
00776             return $this->_iShopId;
00777 
00778             $this->_iShopId = $this->getBaseShopId();
00779 
00780 
00781         oxSession::setVar( 'actshop', $this->_iShopId );
00782         return $this->_iShopId;
00783     }
00784 
00785 
00793     public function setShopId( $sShopId )
00794     {
00795         oxSession::setVar( 'actshop', $sShopId );
00796         $this->_iShopId = $sShopId;
00797     }
00798 
00799 
00805     public function isSsl()
00806     {
00807         if ( is_null( $this->_blIsSsl ) ) {
00808 
00809             $myUtilsServer   = oxUtilsServer::getInstance();
00810             $aServerVars     = $myUtilsServer->getServerVar();
00811             $aHttpsServerVar = $myUtilsServer->getServerVar( 'HTTPS' );
00812 
00813             $this->_blIsSsl = false;
00814             if (isset( $aHttpsServerVar ) && ($aHttpsServerVar === 'on' || $aHttpsServerVar === 'ON' || $aHttpsServerVar == '1' )) {
00815                 // "1&1" hoster provides "1"
00816                 $this->_blIsSsl = ($this->getConfigParam('sSSLShopURL') || $this->getConfigParam('sMallSSLShopURL'));
00817                 if ($this->isAdmin() && !$this->_blIsSsl) {
00818                     //#4026
00819                     $this->_blIsSsl = !is_null($this->getConfigParam('sAdminSSLURL')) ? true : false;
00820                 }
00821             }
00822 
00823             //additional special handling for profihost customers
00824             if ( isset( $aServerVars['HTTP_X_FORWARDED_SERVER'] ) &&
00825                  ( strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'ssl' ) !== false ||
00826                  strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'secure-online-shopping.de' ) !== false ) ) {
00827                 $this->_blIsSsl = true;
00828             }
00829         }
00830 
00831         return $this->_blIsSsl;
00832     }
00833 
00841     public function isCurrentUrl( $sURL )
00842     {
00843         if ( !$sURL ) {
00844             return false;
00845         }
00846 
00847         $oUtilsServer = oxUtilsServer::getInstance();
00848 
00849         // #4010: force_sid added in https to every link
00850         preg_match("/^(https?:\/\/)?([^\/]+)/i", $sURL, $matches);
00851         $sUrlHost = $matches[2];
00852 
00853         // #4010: force_sid added in https to every link
00854         preg_match("/^(https?:\/\/)?([^\/]+)/i", $oUtilsServer->getServerVar( 'HTTP_HOST' ), $matches);
00855         $sRealHost = $matches[2];
00856 
00857         $sCurrentHost = preg_replace( '/\/\w*\.php.*/', '', $oUtilsServer->getServerVar( 'HTTP_HOST' ) . $oUtilsServer->getServerVar( 'SCRIPT_NAME' ) );
00858 
00859         //remove double slashes all the way
00860         $sCurrentHost = str_replace( '/', '', $sCurrentHost );
00861         $sURL = str_replace( '/', '', $sURL );
00862 
00863         if ( getStr()->strpos( $sURL, $sCurrentHost ) !== false ) {
00864 
00865             //bug fix #0002991
00866             if ( $sUrlHost == $sRealHost ) {
00867                 return true;
00868             }
00869         }
00870 
00871         return false;
00872     }
00873 
00882     public function getShopUrl( $iLang = null, $blAdmin = null )
00883     {
00884         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->isAdmin();
00885         if ( $blAdmin ) {
00886             return $this->getConfigParam( 'sShopURL' );
00887         }
00888 
00889         // #680 per language another URL
00890         $iLang = isset( $iLang ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00891         $aLanguageURLs = $this->getConfigParam( 'aLanguageURLs' );
00892         if ( isset( $iLang ) && isset( $aLanguageURLs[$iLang] ) && !empty( $aLanguageURLs[$iLang] ) ) {
00893             $aLanguageURLs[$iLang] = oxUtils::getInstance()->checkUrlEndingSlash( $aLanguageURLs[$iLang] );
00894             return $aLanguageURLs[$iLang];
00895         }
00896 
00897         //normal section
00898         $sMallShopURL = $this->getConfigParam( 'sMallShopURL' );
00899         if ( $sMallShopURL ) {
00900             $sMallShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallShopURL );
00901             return $sMallShopURL;
00902         }
00903 
00904         return $this->getConfigParam( 'sShopURL' );
00905     }
00906 
00914     public function getSslShopUrl( $iLang = null )
00915     {
00916         // #680 per language another URL
00917         $iLang = isset( $iLang ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00918         $aLanguageSSLURLs = $this->getConfigParam( 'aLanguageSSLURLs' );
00919         if ( isset( $iLang ) && isset( $aLanguageSSLURLs[$iLang] ) && !empty( $aLanguageSSLURLs[$iLang] ) ) {
00920             $aLanguageSSLURLs[$iLang] = oxUtils::getInstance()->checkUrlEndingSlash( $aLanguageSSLURLs[$iLang] );
00921             return $aLanguageSSLURLs[$iLang];
00922         }
00923 
00924         //mall mode
00925         if ( ( $sMallSSLShopURL = $this->getConfigParam( 'sMallSSLShopURL' ) ) ) {
00926             $sMallSSLShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallSSLShopURL );
00927             return $sMallSSLShopURL;
00928         }
00929 
00930         if ( ( $sMallShopURL = $this->getConfigParam( 'sMallShopURL' ) ) ) {
00931             $sMallShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallShopURL );
00932             return $sMallShopURL;
00933         }
00934 
00935         //normal section
00936         if ( ( $sSSLShopURL = $this->getConfigParam( 'sSSLShopURL' ) ) ) {
00937             return $sSSLShopURL;
00938         }
00939 
00940         return $this->getShopUrl( $iLang );
00941     }
00942 
00948     public function getCoreUtilsUrl()
00949     {
00950         return $this->getCurrentShopUrl().'core/utils/';
00951     }
00952 
00961     public function getCurrentShopUrl($blAdmin = null)
00962     {
00963         if ($blAdmin===null) {
00964             $blAdmin = $this->isAdmin();
00965         }
00966         if ($blAdmin) {
00967             if ($this->isSsl()) {
00968 
00969                 $sUrl = $this->getConfigParam( 'sAdminSSLURL' );
00970                 if ( !$sUrl ) {
00971                     return $this->getSslShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
00972                 }
00973                 return $sUrl;
00974             } else {
00975                 return $this->getShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
00976             }
00977         } else {
00978             return $this->isSsl() ? $this->getSslShopUrl() : $this->getShopUrl();
00979         }
00980     }
00981 
00989     public function getShopCurrentUrl( $iLang = null )
00990     {
00991         if ( $this->isSsl() ) {
00992             $sURL = $this->getSSLShopURL( $iLang );
00993         } else {
00994             $sURL = $this->getShopURL( $iLang );
00995         }
00996 
00997         return oxUtilsUrl::getInstance()->processUrl( $sURL.'index.php', false );
00998     }
00999 
01008     public function getShopHomeUrl( $iLang = null, $blAdmin = null )
01009     {
01010         return oxUtilsUrl::getInstance()->processUrl($this->getShopUrl( $iLang, $blAdmin).'index.php', false );
01011     }
01012 
01018     public function getShopSecureHomeUrl()
01019     {
01020         return  oxUtilsUrl::getInstance()->processUrl( $this->getSslShopUrl().'index.php', false );
01021     }
01022 
01028     public function getShopCurrency()
01029     {
01030         $iCurr = null;
01031         if ( ( null === ( $iCurr = oxConfig::getParameter( 'cur' ) ) ) ) {
01032             if ( null === ( $iCurr = oxConfig::getParameter( 'currency' ) ) ) {
01033                 $iCurr = oxSession::getVar( 'currency' );
01034             }
01035         }
01036         return (int) $iCurr;
01037     }
01038 
01044     public function getActShopCurrencyObject()
01045     {
01046         //caching currency as it does not change through the script
01047         //but not for unit tests as ther it changes always
01048         if ( !defined( 'OXID_PHP_UNIT' ) ) {
01049             if (!is_null($this->_oActCurrencyObject)) {
01050                 return $this->_oActCurrencyObject;
01051             }
01052         }
01053 
01054         $iCur = $this->getShopCurrency();
01055         $aCurrencies = $this->getCurrencyArray();
01056         if ( !isset( $aCurrencies[$iCur] ) ) {
01057             return $this->_oActCurrencyObject = reset( $aCurrencies ); // reset() returns the first element
01058         }
01059 
01060         return $this->_oActCurrencyObject = $aCurrencies[$iCur];
01061     }
01062 
01070     public function setActShopCurrency( $iCur )
01071     {
01072         $aCurrencies = $this->getCurrencyArray();
01073         if ( isset( $aCurrencies[$iCur] ) ) {
01074             oxSession::setVar( 'currency', $iCur );
01075             $this->_oActCurrencyObject = null;
01076         }
01077     }
01078 
01086     public function getOutDir( $blAbsolute = true)
01087     {
01088         if ($blAbsolute) {
01089             return $this->getConfigParam('sShopDir').$this->_sOutDir.'/';
01090         } else {
01091             return $this->_sOutDir.'/';
01092         }
01093     }
01094 
01104     public function getOutUrl( $blSSL = null , $blAdmin = null, $blNativeImg = false )
01105     {
01106         $blSSL    = is_null($blSSL)?$this->isSsl():$blSSL;
01107         $blAdmin  = is_null($blAdmin)?$this->isAdmin():$blAdmin;
01108 
01109         if ( $blSSL ) {
01110             if ($blNativeImg && !$blAdmin) {
01111                 $sUrl = $this->getSslShopUrl();
01112             } else {
01113                 $sUrl = $this->getConfigParam('sSSLShopURL');
01114                 if (!$sUrl && $blAdmin) {
01115                     $sUrl = $this->getConfigParam('sAdminSSLURL').'../';
01116                 }
01117             }
01118         } else {
01119             $sUrl = ($blNativeImg && !$blAdmin )?$this->getShopUrl():$this->getConfigParam( 'sShopURL' );
01120         }
01121 
01122         return $sUrl.$this->_sOutDir.'/';
01123     }
01124 
01139     public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute = true, $blIgnoreCust = false )
01140     {
01141         if ( is_null($sTheme) ) {
01142             $sTheme = $this->getConfigParam( 'sTheme' );
01143         }
01144 
01145         if ( $blAdmin ) {
01146             $sTheme = 'admin';
01147         }
01148 
01149         $sBase    = $this->getOutDir( $blAbsolute );
01150         $sAbsBase = $this->getOutDir();
01151 
01152         $sLang = '-';
01153         // FALSE means skip language folder check
01154         if ( $iLang !== false ) {
01155             $oLang = oxLang::getInstance();
01156 
01157             if ( is_null( $iLang ) ) {
01158                 $iLang = $oLang->getEditLanguage();
01159             }
01160 
01161             $sLang = $oLang->getLanguageAbbr( $iLang );
01162         }
01163 
01164         if ( is_null($iShop) ) {
01165             $iShop = $this->getShopId();
01166         }
01167 
01168         //Load from
01169         $sPath = "{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
01170         $sCacheKey = $sPath . "_{$blIgnoreCust}{$blAbsolute}";
01171 
01172         if ( ( $sReturn = oxutils::getInstance()->fromStaticCache( $sCacheKey ) ) !== null ) {
01173             return $sReturn;
01174         }
01175 
01176         $sReturn = false;
01177 
01178         // Check for custom template
01179         $sCustomTheme = $this->getConfigParam( 'sCustomTheme' );
01180         if ( !$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
01181             $sReturn = $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute );
01182         }
01183 
01184         //test lang level ..
01185         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01186             $sReturn = $sBase . $sPath;
01187         }
01188 
01189         //test shop level ..
01190         $sPath = "$sTheme/$iShop/$sDir/$sFile";
01191         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01192             $sReturn = $sBase . $sPath;
01193         }
01194 
01195 
01196         //test theme language level ..
01197         $sPath = "$sTheme/$sLang/$sDir/$sFile";
01198         if ( !$sReturn && $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01199             $sReturn = $sBase . $sPath;
01200         }
01201 
01202         //test theme level ..
01203         $sPath = "$sTheme/$sDir/$sFile";
01204         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01205             $sReturn = $sBase . $sPath;
01206         }
01207 
01208         //test out language level ..
01209         $sPath = "$sLang/$sDir/$sFile";
01210         if ( !$sReturn &&  $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01211             $sReturn = $sBase . $sPath;
01212         }
01213 
01214         //test out level ..
01215         $sPath = "$sDir/$sFile";
01216         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01217             $sReturn = $sBase . $sPath;
01218         }
01219 
01220         if ( !$sReturn ) {
01221             // TODO: implement logic to log missing paths
01222         }
01223 
01224         // to cache
01225         oxutils::getInstance()->toStaticCache( $sCacheKey, $sReturn );
01226 
01227         return $sReturn;
01228     }
01229 
01244     public function getUrl($sFile, $sDir , $blAdmin = null, $blSSL = null, $blNativeImg = false, $iLang = null , $iShop = null , $sTheme = null )
01245     {
01246         $sUrl = str_replace(
01247                                 $this->getOutDir(),
01248                                 $this->getOutUrl($blSSL, $blAdmin, $blNativeImg),
01249                                 $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme )
01250                             );
01251         return $sUrl;
01252     }
01253 
01262     public function getImagePath( $sFile, $blAdmin = false )
01263     {
01264         return $this->getDir( $sFile, $this->_sImageDir, $blAdmin );
01265     }
01266 
01277     public function getImageUrl( $blAdmin = false, $blSSL = null, $blNativeImg = null, $sFile = null )
01278     {
01279         $blNativeImg = is_null($blNativeImg)?$this->getConfigParam( 'blNativeImages' ):$blNativeImg;
01280         return $this->getUrl( $sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg );
01281     }
01282 
01290     public function getImageDir( $blAdmin = false )
01291     {
01292         return $this->getDir( null, $this->_sImageDir, $blAdmin );
01293     }
01294 
01306     public function getPicturePath($sFile, $blAdmin = false, $iLang = null , $iShop = null , $sTheme = null)
01307     {
01308         return $this->getDir( $sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme );
01309     }
01310 
01318     public function getMasterPictureDir( $blAdmin = false )
01319     {
01320         return $this->getDir( null, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01321     }
01322 
01331     public function getMasterPicturePath( $sFile, $blAdmin = false )
01332     {
01333         return $this->getDir( $sFile, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01334     }
01335 
01348     public function getPictureUrl( $sFile, $blAdmin = false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01349     {
01350         if ( $sAltUrl = oxPictureHandler::getInstance()->getAltImageUrl('/', $sFile, $blSSL) ) {
01351             return $sAltUrl;
01352         }
01353 
01354         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01355         $sUrl = $this->getUrl( $sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01356 
01357         //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW.
01358         if ( !$sUrl && $sDefPic ) {
01359             $sUrl = $this->getUrl( $sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01360         }
01361         return $sUrl;
01362     }
01363 
01378     public function getIconUrl( $sFile, $blAdmin = false , $blSSL = null , $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01379     {
01380         return $this->getPictureUrl( $sFile, $blAdmin, $blSSL, $iLang, $iShopId, $sDefPic );
01381     }
01382 
01390     public function getPictureDir( $blAdmin )
01391     {
01392         return $this->getDir( null, $this->_sPictureDir, $blAdmin );
01393     }
01394 
01403     public function getTemplatePath( $sFile, $blAdmin )
01404     {
01405         $sTemplatePath = $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin );
01406 
01407         if (!$sTemplatePath) {
01408             $sBasePath        = getShopBasePath();
01409             $aModuleTemplates = $this->getConfigParam('aModuleTemplates');
01410 
01411             $oModulelist = oxNew('oxmodulelist');
01412             $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
01413             if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
01414                 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
01415                     if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
01416                         $sPath = $aTemplates[$sFile];
01417                         $sPath = $sBasePath. 'modules/'.  $sPath;
01418                         if (is_file($sPath) && is_readable($sPath)) {
01419                             $sTemplatePath =  $sPath;
01420                         }
01421                     }
01422                 }
01423             }
01424         }
01425 
01426         return $sTemplatePath;
01427     }
01428 
01436     public function getTemplateDir( $blAdmin = false )
01437     {
01438         return $this->getDir( null, $this->_sTemplateDir, $blAdmin );
01439     }
01440 
01451     public function getTemplateUrl( $sFile = null, $blAdmin = false, $blSSL = null , $iLang = null )
01452     {
01453         return $this->getUrl( $sFile, $this->_sTemplateDir, $blAdmin, $blSSL, false, $iLang );
01454     }
01455 
01463     public function getTemplateBase( $blAdmin = false )
01464     {
01465         // Base template dir is the parent dir of template dir
01466         return str_replace( $this->_sTemplateDir.'/', '', $this->getDir( null, $this->_sTemplateDir, $blAdmin, null, null, null, false ));
01467     }
01468 
01477     public function getResourcePath($sFile = '', $blAdmin = false )
01478     {
01479         return $this->getDir( $sFile, $this->_sResourceDir, $blAdmin );
01480     }
01481 
01489     public function getModulesDir( $blAbsolute = true )
01490     {
01491         if ($blAbsolute) {
01492             return $this->getConfigParam('sShopDir') . $this->_sModulesDir . '/';
01493         } else {
01494             return $this->_sModulesDir . '/';
01495         }
01496     }
01497 
01508     public function getResourceUrl( $sFile = '', $blAdmin = false , $blSSL = null , $iLang = null )
01509     {
01510         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01511         return $this->getUrl( $sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang );
01512     }
01513 
01521     public function getResourceDir( $blAdmin )
01522     {
01523         return $this->getDir( null, $this->_sResourceDir, $blAdmin );
01524     }
01525 
01539     public function getLanguagePath( $sFile, $blAdmin, $iLang = null, $iShop = null, $sTheme = null )
01540     {
01541         return $this->getDir( $sFile, oxLang::getInstance()->getLanguageAbbr( $iLang ), $blAdmin, $iLang, $iShop, $sTheme );
01542     }
01543 
01555     public function getStdLanguagePath( $sFile, $blAdmin, $iLang = null )
01556     {
01557         $sDir = null;
01558         if ( $iLang !== false ) {
01559             $sDir = oxLang::getInstance()->getLanguageAbbr( $iLang );
01560         }
01561 
01562         return $this->getDir( $sFile, $sDir, $blAdmin, $iLang, null, $this->getConfigParam( "sTheme" ), true, true );
01563     }
01564 
01572     public function getLanguageDir( $blAdmin )
01573     {
01574         return $this->getDir( null, null, $blAdmin );
01575     }
01576 
01584     public function getCurrencyArray( $iCurrency = null )
01585     {
01586         $aConfCurrencies = $this->getConfigParam( 'aCurrencies' );
01587         if ( !is_array( $aConfCurrencies ) ) {
01588             return array();
01589         }
01590 
01591         if ( defined( 'OXID_PHP_UNIT' ) ) {
01592             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
01593                 try{
01594                     $aAltCurrencies = modConfig::getInstance()->getConfigParam( 'modaCurrencies' );
01595                     if ( isset( $aAltCurrencies ) ) {
01596                         $aConfCurrencies = $aAltCurrencies;
01597                     }
01598                 } catch( Exception $e ) {
01599                     // if exception is thrown, use default
01600                 }
01601             }
01602         }
01603 
01604         // processing currency configuration data
01605         $aCurrencies = array();
01606         reset( $aConfCurrencies );
01607         while ( list( $key, $val ) = each( $aConfCurrencies ) ) {
01608             if ( $val ) {
01609                 $oCur = new oxStdClass();
01610                 $oCur->id      = $key;
01611                 $sCur = explode( '@', $val);
01612                 $oCur->name     = trim( $sCur[0] );
01613                 $oCur->rate     = trim( $sCur[1] );
01614                 $oCur->dec      = trim( $sCur[2] );
01615                 $oCur->thousand = trim( $sCur[3] );
01616                 $oCur->sign     = trim( $sCur[4] );
01617                 $oCur->decimal  = trim( $sCur[5] );
01618 
01619                 // change for US version
01620                 if ( isset( $sCur[6] ) ) {
01621                     $oCur->side = trim($sCur[6]);
01622                 }
01623 
01624                 if ( isset( $iCurrency) && $key == $iCurrency ) {
01625                     $oCur->selected = 1;
01626                 } else {
01627                     $oCur->selected = 0;
01628                 }
01629                 $aCurrencies[$key]= $oCur;
01630             }
01631 
01632             // #861C -  performance, do not load other currencies
01633             if ( !$this->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01634                 break;
01635             }
01636         }
01637         return $aCurrencies;
01638     }
01639 
01647     public function getCurrencyObject( $sName )
01648     {
01649         $aSearch = $this->getCurrencyArray();
01650         foreach ( $aSearch as $oCur ) {
01651             if ( $oCur->name == $sName ) {
01652                 return $oCur;
01653             }
01654         }
01655     }
01656 
01662     public function isDemoShop()
01663     {
01664         return $this->getConfigParam('blDemoShop');
01665     }
01666 
01667 
01668 
01674     public function getEdition()
01675     {
01676             return "CE";
01677 
01678 
01679     }
01680 
01686     public function getFullEdition()
01687     {
01688         $sEdition = $this->getEdition();
01689 
01690             if ($sEdition == "CE") {
01691                 return "Community Edition";
01692             }
01693 
01694 
01695 
01696         return $sEdition;
01697     }
01698 
01704     public function getVersion()
01705     {
01706         $sVersion = $this->getActiveShop()->oxshops__oxversion->value;
01707         return $sVersion;
01708     }
01709 
01715     public function getRevision()
01716     {
01717         $sFileName = $this->getConfigParam( 'sShopDir' ) . "/pkg.rev";
01718         $iRev = (int) trim(@file_get_contents($sFileName));
01719 
01720         if (!$iRev) {
01721             return false;
01722         }
01723 
01724         return $iRev;
01725     }
01726 
01732     public function getPackageInfo()
01733     {
01734         $sFileName = $this->getConfigParam( 'sShopDir' ) . "/pkg.info";
01735         $iRev = @file_get_contents($sFileName);
01736         $iRev = str_replace("\n", "<br>", $iRev);
01737 
01738         if (!$iRev) {
01739             return false;
01740         }
01741 
01742         return $iRev;
01743     }
01744 
01745 
01751     public function isMall()
01752     {
01753 
01754             return false;
01755     }
01756 
01766     public function detectVersion()
01767     {
01768     }
01769 
01770 
01771 
01784     public function saveShopConfVar( $sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '' )
01785     {
01786         switch ( $sVarType ) {
01787             case 'arr':
01788             case 'aarr':
01789                 if (is_array($sVarVal)) {
01790                     $sValue = serialize( $sVarVal );
01791                 } else {
01792                     // Deprecated functionality
01793                     $sValue  = $sVarVal ;
01794                     $sVarVal = unserialize( $sVarVal );
01795                 }
01796                 break;
01797             case 'num':
01798                 //config param
01799                 $sVarVal = $sVarVal != ''? oxUtils::getInstance()->string2Float( $sVarVal ) : '';
01800                 $sValue = $sVarVal;
01801                 break;
01802             case 'bool':
01803                 //config param
01804                 $sVarVal = (( $sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
01805                 //db value
01806                 $sValue  = $sVarVal?"1":"";
01807                 break;
01808             default:
01809                 $sValue  = $sVarVal;
01810                 break;
01811         }
01812 
01813         if ( !$sShopId ) {
01814             $sShopId = $this->getShopId();
01815         }
01816 
01817         // Update value only for current shop
01818         if ($sShopId == $this->getShopId()) {
01819             $this->setConfigParam( $sVarName, $sVarVal );
01820         }
01821 
01822         $oDb = oxDb::getDb();
01823 
01824         $sShopIdQuoted     = $oDb->quote($sShopId);
01825         $sModuleQuoted     = $oDb->quote($sModule);
01826         $sVarNameQuoted    = $oDb->quote($sVarName);
01827         $sVarTypeQuoted    = $oDb->quote($sVarType);
01828         $sVarValueQuoted   = $oDb->quote($sValue);
01829         $sConfigKeyQuoted  = $oDb->quote($this->getConfigParam('sConfigKey'));
01830         $sNewOXIDdQuoted   = $oDb->quote(oxUtilsObject::getInstance()->generateUID());
01831 
01832         $sQ = "delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
01833         $oDb->execute( $sQ );
01834 
01835         $sQ = "insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
01836                values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
01837         $oDb->execute( $sQ );
01838     }
01839 
01849     public function getShopConfVar( $sVarName, $sShopId = null, $sModule = '' )
01850     {
01851         if ( !$sShopId ) {
01852             $sShopId = $this->getShopId();
01853         }
01854 
01855         if ( $sShopId === $this->getShopId() && ( !$sModule || $sModule == oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') ) ) {
01856             $sVarValue = $this->getConfigParam( $sVarName );
01857             if ( $sVarValue !== null ) {
01858                 return $sVarValue;
01859             }
01860         }
01861 
01862         $oDb = oxDb::getDb( oxDb::FETCH_MODE_ASSOC );
01863 
01864         $sQ  = "select oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = ".$oDb->quote($sVarName);
01865         $oRs = $oDb->select( $sQ );
01866 
01867         $sValue = null;
01868         if ( $oRs != false && $oRs->recordCount() > 0 ) {
01869             $sValue = $this->decodeValue( $oRs->fields['oxvartype'], $oRs->fields['oxvarvalue'] );
01870         }
01871         return $sValue;
01872     }
01873 
01882     public function decodeValue( $sType, $mOrigValue )
01883     {
01884         $sValue = $mOrigValue;
01885         switch ( $sType ) {
01886             case 'arr':
01887             case 'aarr':
01888                 $sValue = unserialize( $mOrigValue );
01889                 break;
01890             case 'bool':
01891                 $sValue = ( $mOrigValue == 'true' || $mOrigValue == '1' );
01892                 break;
01893         }
01894 
01895         return $sValue;
01896     }
01897 
01905     public function getDecodeValueQuery( $sFieldName = "oxvarvalue" )
01906     {
01907         return " DECODE( {$sFieldName}, '".$this->getConfigParam( 'sConfigKey' )."') ";
01908     }
01909 
01915     public function isProductiveMode()
01916     {
01917         $blProductive = false;
01918 
01919         $blProductive = $this->getConfigParam( 'blProductive' );
01920         if ( !isset( $blProductive ) ) {
01921             $sQ = 'select oxproductive from oxshops where oxid = "'.$this->getShopId().'"';
01922             $blProductive = ( bool ) oxDb::getDb()->getOne( $sQ );
01923             $this->setConfigParam( 'blProductive', $blProductive );
01924         }
01925 
01926         return $blProductive;
01927     }
01928 
01929 
01930 
01936     public function getBaseShopId()
01937     {
01938 
01939             return 'oxbaseshop';
01940     }
01941 
01947     public function getActiveShop()
01948     {
01949         if ( $this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
01950              $this->_oActShop->getLanguage() == oxLang::getInstance()->getBaseLanguage() ) {
01951             return $this->_oActShop;
01952         }
01953 
01954         $this->_oActShop = oxNew( 'oxshop' );
01955         $this->_oActShop->load( $this->getShopId() );
01956         return $this->_oActShop;
01957     }
01958 
01964     public function getActiveView()
01965     {
01966         if ( $this->_oActView != null ) {
01967             return $this->_oActView;
01968         }
01969 
01970         $this->_oActView = oxNew( 'oxubase' );
01971         return $this->_oActView;
01972     }
01973 
01981     public function setActiveView( $oView )
01982     {
01983         $this->_oActView = $oView;
01984     }
01985 
01991     public function isUtf()
01992     {
01993         return ( bool ) $this->getConfigParam( 'iUtfMode' );
01994     }
01995 
02001     public function getLogsDir()
02002     {
02003         return $this->getConfigParam( 'sShopDir' ).'log/';
02004     }
02005 
02013     public function isThemeOption( $sName )
02014     {
02015         return (bool) isset( $this->_aThemeConfigParams[$sName] );
02016     }
02017 
02023     public function getShopMainUrl()
02024     {
02025         return $this->isSsl() ? $this->getConfigParam( 'sSSLShopURL' ) : $this->getConfigParam( 'sShopURL' );
02026     }
02027 
02033     public function getAllModules()
02034     {
02035         return $this->parseModuleChains($this->getConfigParam('aModules'));
02036     }
02037 
02045     public function parseModuleChains($aModules)
02046     {
02047         $aModuleArray = array();
02048 
02049         if (is_array($aModules)) {
02050             foreach ($aModules as $sClass => $sModuleChain) {
02051                 if (strstr($sModuleChain, '&')) {
02052                     $aModuleChain = explode('&', $sModuleChain);
02053                 } else {
02054                     $aModuleChain = array($sModuleChain);
02055                 }
02056                 $aModuleArray[$sClass] = $aModuleChain;
02057             }
02058         }
02059 
02060         return $aModuleArray;
02061     }
02062 
02063 }