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 
00360     public function init()
00361     {
00362         $this->_loadVarsFromFile();
00363 
00364         include getShopBasePath().'core/oxconfk.php';
00365 
00366 
00367         // some important defaults
00368         if( !$this->getConfigParam( 'sDefaultLang' ) )
00369             $this->setConfigParam( 'sDefaultLang', 0 );
00370 
00371 
00372         $this->setConfigParam( 'sTheme', 'basic' );
00373 
00374 
00375         $blLogChangesInAdmin = $this->getConfigParam( 'blLogChangesInAdmin' );
00376         if( !isset( $blLogChangesInAdmin ) )
00377             $this->setConfigParam( 'blLogChangesInAdmin', false );
00378 
00379         $blCheckTemplates = $this->getConfigParam( 'blCheckTemplates' );
00380         if( !isset( $blCheckTemplates ) )
00381             $this->setConfigParam( 'blCheckTemplates', false );
00382 
00383         $blAllowArticlesubclass = $this->getConfigParam( 'blAllowArticlesubclass' );
00384         if( !isset( $blAllowArticlesubclass ) )
00385             $this->setConfigParam( 'blAllowArticlesubclass', false );
00386 
00387         $iAdminListSize = $this->getConfigParam( 'iAdminListSize' );
00388         if( !isset( $iAdminListSize ) )
00389             $this->setConfigParam( 'iAdminListSize', 9 );
00390 
00391         // #1173M  for EE - not all pic are deleted
00392         $iPicCount = $this->getConfigParam( 'iPicCount' );
00393         if ( !isset( $iPicCount ) )
00394             $this->setConfigParam( 'iPicCount', 7 );
00395 
00396         $iZoomPicCount = $this->getConfigParam( 'iZoomPicCount' );
00397         if ( !isset( $iZoomPicCount ) )
00398             $this->setConfigParam( 'iZoomPicCount', 4 );
00399 
00400         //max shop id default value
00401         $iMaxShopId = $this->getConfigParam( 'iMaxShopId' );
00402         if ( !isset( $iMaxShopId ) ) {
00403             $this->setConfigParam( 'iMaxShopId', 128 );
00404         } elseif ( $iMaxShopId > self::OXMAX_SHOP_COUNT ) {
00405             $this->setConfigParam( 'iMaxShopId', self::OXMAX_SHOP_COUNT );
00406         }
00407 
00408         // disabling caching according to DODGER #655 : disable Caching as it doesnt work good enought
00409         $this->setConfigParam( 'blTemplateCaching', false );
00410 
00411         //setting ADODB timeout
00412         global  $ADODB_SESS_LIFE;
00413         $ADODB_SESS_LIFE  = 1;
00414 
00415         // ADODB cachelifetime
00416         $iDBCacheLifeTime = $this->getConfigParam( 'iDBCacheLifeTime' );
00417         if ( !isset( $iDBCacheLifeTime ) )
00418             $this->setConfigParam( 'iDBCacheLifeTime', 3600 ); // 1 hour
00419 
00420         $sCoreDir = $this->getConfigParam( 'sShopDir' );
00421         $this->setConfigParam( 'sCoreDir', $sCoreDir.'/core/' );
00422 
00423         try {
00424             $sShopID = $this->getShopId();
00425             $blConfigLoaded = $this->_loadVarsFromDb( $sShopID );
00426 
00427             // loading shop config
00428             if ( empty($sShopID) || !$blConfigLoaded ) {
00429                 // if no config values where loaded (some problmems with DB), throwing an exception
00430                 $oEx = oxNew( "oxConnectionException" );
00431                 $oEx->setMessage( "Unable to load shop config values from database" );
00432                 throw $oEx;
00433             }
00434 
00435             // loading theme config options
00436             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') );
00437 
00438             // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362)
00439             if ( $this->getConfigParam('sCustomTheme') ) {
00440                 $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme') );
00441             }
00442 
00443             // loading modules config
00444             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_MODULE_PREFIX );
00445 
00446 
00447             $this->_processSeoCall();
00448 
00449             //starting up the session
00450             $this->getSession()->start();
00451 
00452         } catch ( oxConnectionException $oEx ) {
00453 
00454             $oEx->debugOut();
00455             if ( defined( 'OXID_PHP_UNIT' ) ) {
00456                 return false;
00457             } elseif ( 0 != $this->iDebug ) {
00458                 oxUtils::getInstance()->showMessageAndExit( $oEx->getString() );
00459             } else {
00460                 header( "HTTP/1.1 500 Internal Server Error");
00461                 header( "Location: offline.html");
00462                 header( "Connection: close");
00463             }
00464         } catch ( oxCookieException $oEx ) {
00465 
00466             $this->_processSeoCall();
00467 
00468             //starting up the session
00469             $this->getSession()->start();
00470 
00471             // redirect to start page and display the error
00472             oxUtilsView::getInstance()->addErrorToDisplay( $oEx );
00473             oxUtils::getInstance()->redirect( $this->getShopHomeURL() .'cl=start', true, 302 );
00474         }
00475 
00476 
00477         $this->_loadVarsFromFile();
00478 
00479         //application initialization
00480         $this->_oStart = new oxStart();
00481         $this->_oStart->appInit();
00482     }
00483 
00489     public static function getInstance()
00490     {
00491 
00492         if ( defined( 'OXID_PHP_UNIT' ) ) {
00493             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00494                 return modConfig::$unitMOD;
00495             }
00496         }
00497 
00498         if ( !self::$_instance instanceof oxConfig ) {
00499                 //exceptions from here go directly to global exception handler
00500                 //if no init is possible whole application has to die!
00501                 self::$_instance = new oxConfig();
00502                 self::$_instance->init();
00503         }
00504         return self::$_instance;
00505     }
00506 
00512     protected function _loadVarsFromFile()
00513     {
00514         //config variables from config.inc.php takes priority over the ones loaded from db
00515         include getShopBasePath().'/config.inc.php';
00516 
00517         //adding trailing slashes
00518         $oFileUtils = oxUtilsFile::getInstance();
00519         $this->sShopDir     = $oFileUtils->normalizeDir($this->sShopDir);
00520         $this->sCompileDir  = $oFileUtils->normalizeDir($this->sCompileDir);
00521         $this->sShopURL     = $oFileUtils->normalizeDir($this->sShopURL);
00522         $this->sSSLShopURL  = $oFileUtils->normalizeDir($this->sSSLShopURL);
00523         $this->sAdminSSLURL = $oFileUtils->normalizeDir($this->sAdminSSLURL);
00524         
00525         $this->_loadCustomConfig();
00526     }
00527 
00533     protected function _loadCustomConfig()
00534     {
00535         $sCustConfig = getShopBasePath().'/cust_config.inc.php';
00536         if ( is_readable( $sCustConfig ) ) {
00537             include $sCustConfig;
00538         }
00539     }
00540     
00550     protected function _loadVarsFromDb( $sShopID, $aOnlyVars = null, $sModule = '' )
00551     {
00552         $oDb = oxDb::getDb();
00553 
00554         if ( !empty($sModule) ) {
00555             $sModuleSql = " oxmodule LIKE " . $oDb->quote($sModule."%");
00556         } else {
00557             $sModuleSql = " oxmodule='' ";
00558         }
00559 
00560         $sQ = "select oxvarname, oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '$sShopID' and " . $sModuleSql;
00561         // dodger, allow loading from some vars only from baseshop
00562         if ( $aOnlyVars !== null ) {
00563             $blSep = false;
00564             $sIn  = '';
00565             foreach ( $aOnlyVars as $sField ) {
00566                 if ( $blSep ) {
00567                     $sIn .= ', ';
00568                 }
00569                 $sIn .= '"'.$sField.'"';
00570                 $blSep = true;
00571             }
00572             $sQ .= ' and oxvarname in ( '.$sIn.' ) ';
00573         }
00574         $oRs = $oDb->select( $sQ );
00575 
00576         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00577             while ( !$oRs->EOF ) {
00578                 $sVarName = $oRs->fields[0];
00579                 $sVarType = $oRs->fields[1];
00580                 $sVarVal  = $oRs->fields[2];
00581 
00582                 //in sShopURL and sSSLShopURL cases we skip (for admin or when URL values are not set)
00583                 if ( ( $sVarName == 'sShopURL' || $sVarName == 'sSSLShopURL' ) &&
00584                     ( !$sVarVal || $this->isAdmin() === true ) ) {
00585                     $oRs->moveNext();
00586                     continue;
00587                 }
00588 
00589                 $this->_setConfVarFromDb($sVarName, $sVarType, $sVarVal);
00590 
00591                 //setting theme options array
00592                 if ( $sModule != '' ) {
00593                     $this->_aThemeConfigParams[$sVarName] = $sModule;
00594                 }
00595 
00596                 $oRs->moveNext();
00597             }
00598 
00599             return true;
00600         } else {
00601             return false;
00602         }
00603     }
00604 
00614     protected function _setConfVarFromDb($sVarName, $sVarType, $sVarVal)
00615     {
00616         switch ( $sVarType ) {
00617             case 'arr':
00618             case 'aarr':
00619                 $this->setConfigParam( $sVarName, unserialize( $sVarVal ) );
00620                 break;
00621             case 'bool':
00622                 $this->setConfigParam( $sVarName, ( $sVarVal == 'true' || $sVarVal == '1' ) );
00623                 break;
00624             default:
00625                 $this->setConfigParam( $sVarName, $sVarVal );
00626                 break;
00627         }
00628     }
00629 
00635     public function pageClose()
00636     {
00637         return $this->_oStart->pageClose();
00638     }
00639 
00651     public static function getParameter(  $sName, $blRaw = false )
00652     {
00653         if ( defined( 'OXID_PHP_UNIT' ) ) {
00654             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00655                 try{
00656                     $sValue = modConfig::getParameter(  $sName, $blRaw );
00657 
00658                     // TODO: remove this after special chars concept implementation
00659                     $blIsAdmin = modConfig::getInstance()->isAdmin() || isAdmin();
00660                     if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00661                         self::checkSpecialChars( $sValue, $blRaw );
00662                     }
00663 
00664                     return $sValue;
00665                 } catch( Exception $e ) {
00666                     // if exception is thrown, use default
00667                 }
00668             }
00669         }
00670 
00671         $sValue = null;
00672 
00673         if ( isset( $_POST[$sName] ) ) {
00674             $sValue = $_POST[$sName];
00675         } elseif ( isset( $_GET[$sName] ) ) {
00676             $sValue = $_GET[$sName];
00677         }
00678 
00679         // TODO: remove this after special chars concept implementation
00680         $blIsAdmin = oxConfig::getInstance()->isAdmin() && oxSession::getVar("blIsAdmin");
00681         if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00682             self::checkSpecialChars( $sValue, $blRaw );
00683         }
00684 
00685         return $sValue;
00686     }
00687 
00695     public function getUploadedFile($sParamName)
00696     {
00697         return $_FILES[$sParamName];
00698     }
00699 
00708     public function setGlobalParameter( $sName, $sValue )
00709     {
00710         $this->_aGlobalParams[$sName] = $sValue;
00711     }
00712 
00720     public function getGlobalParameter( $sName )
00721     {
00722         if ( isset( $this->_aGlobalParams[$sName] ) ) {
00723             return $this->_aGlobalParams[$sName];
00724         } else {
00725             return null;
00726         }
00727     }
00728 
00738     public static function checkSpecialChars( & $sValue, $aRaw = null )
00739     {
00740         if ( is_object( $sValue ) ) {
00741             return $sValue;
00742         }
00743 
00744         if ( is_array( $sValue ) ) {
00745             $newValue = array();
00746             foreach ( $sValue as $sKey => $sVal ) {
00747                 $sValidKey = $sKey;
00748                 if ( !$aRaw || !in_array($sKey, $aRaw) ) {
00749                     self::checkSpecialChars( $sValidKey );
00750                     self::checkSpecialChars( $sVal );
00751                     if ($sValidKey != $sKey) {
00752                         unset ($sValue[$sKey]);
00753                     }
00754                 }
00755                 $newValue[$sValidKey] = $sVal;
00756             }
00757             $sValue = $newValue;
00758         } elseif ( is_string( $sValue ) ) {
00759             $sValue = str_replace( array( '&',     '<',    '>',    '"',      "'",      chr(0), '\\' ),
00760                                    array( '&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '',     '&#092;' ),
00761                                    $sValue );
00762         }
00763         return $sValue;
00764     }
00765 
00771     public function getShopId()
00772     {
00773         if ( $this->_iShopId !== null )
00774             return $this->_iShopId;
00775 
00776             $this->_iShopId = $this->getBaseShopId();
00777 
00778 
00779         oxSession::setVar( 'actshop', $this->_iShopId );
00780         return $this->_iShopId;
00781     }
00782 
00783 
00791     public function setShopId( $sShopId )
00792     {
00793         oxSession::setVar( 'actshop', $sShopId );
00794         $this->_iShopId = $sShopId;
00795     }
00796 
00797 
00803     public function isSsl()
00804     {
00805         if ( is_null( $this->_blIsSsl ) ) {
00806 
00807             $myUtilsServer   = oxUtilsServer::getInstance();
00808             $aServerVars     = $myUtilsServer->getServerVar();
00809             $aHttpsServerVar = $myUtilsServer->getServerVar( 'HTTPS' );
00810 
00811             $this->_blIsSsl = false;
00812             if (isset( $aHttpsServerVar ) && ($aHttpsServerVar === 'on' || $aHttpsServerVar === 'ON' || $aHttpsServerVar == '1' )) {
00813                 // "1&1" hoster provides "1"
00814                 $this->_blIsSsl = ($this->getConfigParam('sSSLShopURL') || $this->getConfigParam('sMallSSLShopURL'));
00815                 if ($this->isAdmin() && !$this->_blIsSsl) {
00816                     //#4026
00817                     $this->_blIsSsl = !is_null($this->getConfigParam('sAdminSSLURL')) ? true : false;
00818                 }
00819             }
00820 
00821             //additional special handling for profihost customers
00822             if ( isset( $aServerVars['HTTP_X_FORWARDED_SERVER'] ) &&
00823                  ( strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'ssl' ) !== false ||
00824                  strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'secure-online-shopping.de' ) !== false ) ) {
00825                 $this->_blIsSsl = true;
00826             }
00827         }
00828 
00829         return $this->_blIsSsl;
00830     }
00831 
00839     public function isCurrentUrl( $sURL )
00840     {
00841         if ( !$sURL ) {
00842             return false;
00843         }
00844 
00845         $oUtilsServer = oxUtilsServer::getInstance();
00846 
00847         // #4010: force_sid added in https to every link
00848         preg_match("/^(https?:\/\/)?([^\/]+)/i", $sURL, $matches);
00849         $sUrlHost = $matches[2];
00850 
00851         // #4010: force_sid added in https to every link
00852         preg_match("/^(https?:\/\/)?([^\/]+)/i", $oUtilsServer->getServerVar( 'HTTP_HOST' ), $matches);
00853         $sRealHost = $matches[2];
00854 
00855         $sCurrentHost = preg_replace( '/\/\w*\.php.*/', '', $oUtilsServer->getServerVar( 'HTTP_HOST' ) . $oUtilsServer->getServerVar( 'SCRIPT_NAME' ) );
00856 
00857         //remove double slashes all the way
00858         $sCurrentHost = str_replace( '/', '', $sCurrentHost );
00859         $sURL = str_replace( '/', '', $sURL );
00860 
00861         if ( getStr()->strpos( $sURL, $sCurrentHost ) !== false ) {
00862 
00863             //bug fix #0002991
00864             if ( $sUrlHost == $sRealHost ) {
00865                 return true;
00866             }
00867         }
00868 
00869         return false;
00870     }
00871 
00880     public function getShopUrl( $iLang = null, $blAdmin = null )
00881     {
00882         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->isAdmin();
00883         if ( $blAdmin ) {
00884             return $this->getConfigParam( 'sShopURL' );
00885         }
00886 
00887         // #680 per language another URL
00888         $iLang = isset( $iLang ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00889         $aLanguageURLs = $this->getConfigParam( 'aLanguageURLs' );
00890         if ( isset( $iLang ) && isset( $aLanguageURLs[$iLang] ) && !empty( $aLanguageURLs[$iLang] ) ) {
00891             $aLanguageURLs[$iLang] = oxUtils::getInstance()->checkUrlEndingSlash( $aLanguageURLs[$iLang] );
00892             return $aLanguageURLs[$iLang];
00893         }
00894 
00895         //normal section
00896         $sMallShopURL = $this->getConfigParam( 'sMallShopURL' );
00897         if ( $sMallShopURL ) {
00898             $sMallShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallShopURL );
00899             return $sMallShopURL;
00900         }
00901 
00902         return $this->getConfigParam( 'sShopURL' );
00903     }
00904 
00912     public function getSslShopUrl( $iLang = null )
00913     {
00914         // #680 per language another URL
00915         $iLang = isset( $iLang ) ? $iLang : oxLang::getInstance()->getBaseLanguage();
00916         $aLanguageSSLURLs = $this->getConfigParam( 'aLanguageSSLURLs' );
00917         if ( isset( $iLang ) && isset( $aLanguageSSLURLs[$iLang] ) && !empty( $aLanguageSSLURLs[$iLang] ) ) {
00918             $aLanguageSSLURLs[$iLang] = oxUtils::getInstance()->checkUrlEndingSlash( $aLanguageSSLURLs[$iLang] );
00919             return $aLanguageSSLURLs[$iLang];
00920         }
00921 
00922         //mall mode
00923         if ( ( $sMallSSLShopURL = $this->getConfigParam( 'sMallSSLShopURL' ) ) ) {
00924             $sMallSSLShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallSSLShopURL );
00925             return $sMallSSLShopURL;
00926         }
00927 
00928         if ( ( $sMallShopURL = $this->getConfigParam( 'sMallShopURL' ) ) ) {
00929             $sMallShopURL = oxUtils::getInstance()->checkUrlEndingSlash( $sMallShopURL );
00930             return $sMallShopURL;
00931         }
00932 
00933         //normal section
00934         if ( ( $sSSLShopURL = $this->getConfigParam( 'sSSLShopURL' ) ) ) {
00935             return $sSSLShopURL;
00936         }
00937 
00938         return $this->getShopUrl( $iLang );
00939     }
00940 
00946     public function getCoreUtilsUrl()
00947     {
00948         return $this->getCurrentShopUrl().'core/utils/';
00949     }
00950 
00959     public function getCurrentShopUrl($blAdmin = null)
00960     {
00961         if ($blAdmin===null) {
00962             $blAdmin = $this->isAdmin();
00963         }
00964         if ($blAdmin) {
00965             if ($this->isSsl()) {
00966 
00967                 $sUrl = $this->getConfigParam( 'sAdminSSLURL' );
00968                 if ( !$sUrl ) {
00969                     return $this->getSslShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
00970                 }
00971                 return $sUrl;
00972             } else {
00973                 return $this->getShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
00974             }
00975         } else {
00976             return $this->isSsl() ? $this->getSslShopUrl() : $this->getShopUrl();
00977         }
00978     }
00979 
00987     public function getShopCurrentUrl( $iLang = null )
00988     {
00989         if ( $this->isSsl() ) {
00990             $sURL = $this->getSSLShopURL( $iLang );
00991         } else {
00992             $sURL = $this->getShopURL( $iLang );
00993         }
00994 
00995         return oxUtilsUrl::getInstance()->processUrl( $sURL.'index.php', false );
00996     }
00997 
01006     public function getShopHomeUrl( $iLang = null, $blAdmin = null )
01007     {
01008         return oxUtilsUrl::getInstance()->processUrl($this->getShopUrl( $iLang, $blAdmin).'index.php', false );
01009     }
01010 
01016     public function getShopSecureHomeUrl()
01017     {
01018         return  oxUtilsUrl::getInstance()->processUrl( $this->getSslShopUrl().'index.php', false );
01019     }
01020 
01026     public function getShopCurrency()
01027     {
01028         $iCurr = null;
01029         if ( ( null === ( $iCurr = oxConfig::getParameter( 'cur' ) ) ) ) {
01030             if ( null === ( $iCurr = oxConfig::getParameter( 'currency' ) ) ) {
01031                 $iCurr = oxSession::getVar( 'currency' );
01032             }
01033         }
01034         return (int) $iCurr;
01035     }
01036 
01042     public function getActShopCurrencyObject()
01043     {
01044         //caching currency as it does not change through the script
01045         //but not for unit tests as ther it changes always
01046         if ( !defined( 'OXID_PHP_UNIT' ) ) {
01047             if (!is_null($this->_oActCurrencyObject)) {
01048                 return $this->_oActCurrencyObject;
01049             }
01050         }
01051 
01052         $iCur = $this->getShopCurrency();
01053         $aCurrencies = $this->getCurrencyArray();
01054         if ( !isset( $aCurrencies[$iCur] ) ) {
01055             return $this->_oActCurrencyObject = reset( $aCurrencies ); // reset() returns the first element
01056         }
01057 
01058         return $this->_oActCurrencyObject = $aCurrencies[$iCur];
01059     }
01060 
01068     public function setActShopCurrency( $iCur )
01069     {
01070         $aCurrencies = $this->getCurrencyArray();
01071         if ( isset( $aCurrencies[$iCur] ) ) {
01072             oxSession::setVar( 'currency', $iCur );
01073             $this->_oActCurrencyObject = null;
01074         }
01075     }
01076 
01084     public function getOutDir( $blAbsolute = true)
01085     {
01086         if ($blAbsolute) {
01087             return $this->getConfigParam('sShopDir').$this->_sOutDir.'/';
01088         } else {
01089             return $this->_sOutDir.'/';
01090         }
01091     }
01092 
01102     public function getOutUrl( $blSSL = null , $blAdmin = null, $blNativeImg = false )
01103     {
01104         $blSSL    = is_null($blSSL)?$this->isSsl():$blSSL;
01105         $blAdmin  = is_null($blAdmin)?$this->isAdmin():$blAdmin;
01106 
01107         if ( $blSSL ) {
01108             if ($blNativeImg && !$blAdmin) {
01109                 $sUrl = $this->getSslShopUrl();
01110             } else {
01111                 $sUrl = $this->getConfigParam('sSSLShopURL');
01112                 if (!$sUrl && $blAdmin) {
01113                     $sUrl = $this->getConfigParam('sAdminSSLURL').'../';
01114                 }
01115             }
01116         } else {
01117             $sUrl = ($blNativeImg && !$blAdmin )?$this->getShopUrl():$this->getConfigParam( 'sShopURL' );
01118         }
01119 
01120         return $sUrl.$this->_sOutDir.'/';
01121     }
01122 
01137     public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute = true, $blIgnoreCust = false )
01138     {
01139         if ( is_null($sTheme) ) {
01140             $sTheme = $this->getConfigParam( 'sTheme' );
01141         }
01142 
01143         if ( $blAdmin ) {
01144             $sTheme = 'admin';
01145         }
01146 
01147         $sBase    = $this->getOutDir( $blAbsolute );
01148         $sAbsBase = $this->getOutDir();
01149 
01150         $sLang = '-';
01151         // FALSE means skip language folder check
01152         if ( $iLang !== false ) {
01153             $oLang = oxLang::getInstance();
01154 
01155             if ( is_null( $iLang ) ) {
01156                 $iLang = $oLang->getEditLanguage();
01157             }
01158 
01159             $sLang = $oLang->getLanguageAbbr( $iLang );
01160         }
01161 
01162         if ( is_null($iShop) ) {
01163             $iShop = $this->getShopId();
01164         }
01165 
01166         //Load from
01167         $sPath = "{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
01168         $sCacheKey = $sPath . "_{$blIgnoreCust}{$blAbsolute}";
01169 
01170         if ( ( $sReturn = oxutils::getInstance()->fromStaticCache( $sCacheKey ) ) !== null ) {
01171             return $sReturn;
01172         }
01173 
01174         $sReturn = false;
01175 
01176         // Check for custom template
01177         $sCustomTheme = $this->getConfigParam( 'sCustomTheme' );
01178         if ( !$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
01179             $sReturn = $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute );
01180         }
01181 
01182         //test lang level ..
01183         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01184             $sReturn = $sBase . $sPath;
01185         }
01186 
01187         //test shop level ..
01188         $sPath = "$sTheme/$iShop/$sDir/$sFile";
01189         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01190             $sReturn = $sBase . $sPath;
01191         }
01192 
01193 
01194         //test theme language level ..
01195         $sPath = "$sTheme/$sLang/$sDir/$sFile";
01196         if ( !$sReturn && $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01197             $sReturn = $sBase . $sPath;
01198         }
01199 
01200         //test theme level ..
01201         $sPath = "$sTheme/$sDir/$sFile";
01202         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01203             $sReturn = $sBase . $sPath;
01204         }
01205 
01206         //test out language level ..
01207         $sPath = "$sLang/$sDir/$sFile";
01208         if ( !$sReturn &&  $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01209             $sReturn = $sBase . $sPath;
01210         }
01211 
01212         //test out level ..
01213         $sPath = "$sDir/$sFile";
01214         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01215             $sReturn = $sBase . $sPath;
01216         }
01217 
01218         if ( !$sReturn ) {
01219             // TODO: implement logic to log missing paths
01220         }
01221 
01222         // to cache
01223         oxutils::getInstance()->toStaticCache( $sCacheKey, $sReturn );
01224 
01225         return $sReturn;
01226     }
01227 
01242     public function getUrl($sFile, $sDir , $blAdmin = null, $blSSL = null, $blNativeImg = false, $iLang = null , $iShop = null , $sTheme = null )
01243     {
01244         $sUrl = str_replace(
01245                                 $this->getOutDir(),
01246                                 $this->getOutUrl($blSSL, $blAdmin, $blNativeImg),
01247                                 $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme )
01248                             );
01249         return $sUrl;
01250     }
01251 
01260     public function getImagePath( $sFile, $blAdmin = false )
01261     {
01262         return $this->getDir( $sFile, $this->_sImageDir, $blAdmin );
01263     }
01264 
01275     public function getImageUrl( $blAdmin = false, $blSSL = null, $blNativeImg = null, $sFile = null )
01276     {
01277         $blNativeImg = is_null($blNativeImg)?$this->getConfigParam( 'blNativeImages' ):$blNativeImg;
01278         return $this->getUrl( $sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg );
01279     }
01280 
01288     public function getImageDir( $blAdmin = false )
01289     {
01290         return $this->getDir( null, $this->_sImageDir, $blAdmin );
01291     }
01292 
01304     public function getPicturePath($sFile, $blAdmin = false, $iLang = null , $iShop = null , $sTheme = null)
01305     {
01306         return $this->getDir( $sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme );
01307     }
01308 
01316     public function getMasterPictureDir( $blAdmin = false )
01317     {
01318         return $this->getDir( null, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01319     }
01320 
01329     public function getMasterPicturePath( $sFile, $blAdmin = false )
01330     {
01331         return $this->getDir( $sFile, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01332     }
01333 
01346     public function getPictureUrl( $sFile, $blAdmin = false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01347     {
01348         if ( $sAltUrl = oxPictureHandler::getInstance()->getAltImageUrl('/', $sFile, $blSSL) ) {
01349             return $sAltUrl;
01350         }
01351 
01352         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01353         $sUrl = $this->getUrl( $sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01354 
01355         //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW.
01356         if ( !$sUrl && $sDefPic ) {
01357             $sUrl = $this->getUrl( $sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01358         }
01359         return $sUrl;
01360     }
01361 
01376     public function getIconUrl( $sFile, $blAdmin = false , $blSSL = null , $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01377     {
01378         return $this->getPictureUrl( $sFile, $blAdmin, $blSSL, $iLang, $iShopId, $sDefPic );
01379     }
01380 
01388     public function getPictureDir( $blAdmin )
01389     {
01390         return $this->getDir( null, $this->_sPictureDir, $blAdmin );
01391     }
01392 
01401     public function getTemplatePath( $sFile, $blAdmin )
01402     {
01403         $sTemplatePath = $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin );
01404 
01405         if (!$sTemplatePath) {
01406             $sBasePath        = getShopBasePath();
01407             $aModuleTemplates = $this->getConfigParam('aModuleTemplates');
01408 
01409             $oModulelist = oxNew('oxmodulelist');
01410             $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
01411             if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
01412                 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
01413                     if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
01414                         $sPath = $aTemplates[$sFile];
01415                         $sPath = $sBasePath. 'modules/'.  $sPath;
01416                         if (is_file($sPath) && is_readable($sPath)) {
01417                             $sTemplatePath =  $sPath;
01418                         }
01419                     }
01420                 }
01421             }
01422         }
01423 
01424         return $sTemplatePath;
01425     }
01426 
01434     public function getTemplateDir( $blAdmin = false )
01435     {
01436         return $this->getDir( null, $this->_sTemplateDir, $blAdmin );
01437     }
01438 
01449     public function getTemplateUrl( $sFile = null, $blAdmin = false, $blSSL = null , $iLang = null )
01450     {
01451         return $this->getUrl( $sFile, $this->_sTemplateDir, $blAdmin, $blSSL, false, $iLang );
01452     }
01453 
01461     public function getTemplateBase( $blAdmin = false )
01462     {
01463         // Base template dir is the parent dir of template dir
01464         return str_replace( $this->_sTemplateDir.'/', '', $this->getDir( null, $this->_sTemplateDir, $blAdmin, null, null, null, false ));
01465     }
01466 
01475     public function getResourcePath($sFile = '', $blAdmin = false )
01476     {
01477         return $this->getDir( $sFile, $this->_sResourceDir, $blAdmin );
01478     }
01479 
01487     public function getModulesDir( $blAbsolute = true )
01488     {
01489         if ($blAbsolute) {
01490             return $this->getConfigParam('sShopDir') . $this->_sModulesDir . '/';
01491         } else {
01492             return $this->_sModulesDir . '/';
01493         }
01494     }
01495 
01506     public function getResourceUrl( $sFile = '', $blAdmin = false , $blSSL = null , $iLang = null )
01507     {
01508         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01509         return $this->getUrl( $sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang );
01510     }
01511 
01519     public function getResourceDir( $blAdmin )
01520     {
01521         return $this->getDir( null, $this->_sResourceDir, $blAdmin );
01522     }
01523 
01537     public function getLanguagePath( $sFile, $blAdmin, $iLang = null, $iShop = null, $sTheme = null )
01538     {
01539         return $this->getDir( $sFile, oxLang::getInstance()->getLanguageAbbr( $iLang ), $blAdmin, $iLang, $iShop, $sTheme );
01540     }
01541 
01553     public function getStdLanguagePath( $sFile, $blAdmin, $iLang = null )
01554     {
01555         $sDir = null;
01556         if ( $iLang !== false ) {
01557             $sDir = oxLang::getInstance()->getLanguageAbbr( $iLang );
01558         }
01559 
01560         return $this->getDir( $sFile, $sDir, $blAdmin, $iLang, null, $this->getConfigParam( "sTheme" ), true, true );
01561     }
01562 
01570     public function getLanguageDir( $blAdmin )
01571     {
01572         return $this->getDir( null, null, $blAdmin );
01573     }
01574 
01582     public function getCurrencyArray( $iCurrency = null )
01583     {
01584         $aConfCurrencies = $this->getConfigParam( 'aCurrencies' );
01585         if ( !is_array( $aConfCurrencies ) ) {
01586             return array();
01587         }
01588 
01589         if ( defined( 'OXID_PHP_UNIT' ) ) {
01590             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
01591                 try{
01592                     $aAltCurrencies = modConfig::getInstance()->getConfigParam( 'modaCurrencies' );
01593                     if ( isset( $aAltCurrencies ) ) {
01594                         $aConfCurrencies = $aAltCurrencies;
01595                     }
01596                 } catch( Exception $e ) {
01597                     // if exception is thrown, use default
01598                 }
01599             }
01600         }
01601 
01602         // processing currency configuration data
01603         $aCurrencies = array();
01604         reset( $aConfCurrencies );
01605         while ( list( $key, $val ) = each( $aConfCurrencies ) ) {
01606             if ( $val ) {
01607                 $oCur = new oxStdClass();
01608                 $oCur->id      = $key;
01609                 $sCur = explode( '@', $val);
01610                 $oCur->name     = trim( $sCur[0] );
01611                 $oCur->rate     = trim( $sCur[1] );
01612                 $oCur->dec      = trim( $sCur[2] );
01613                 $oCur->thousand = trim( $sCur[3] );
01614                 $oCur->sign     = trim( $sCur[4] );
01615                 $oCur->decimal  = trim( $sCur[5] );
01616 
01617                 // change for US version
01618                 if ( isset( $sCur[6] ) ) {
01619                     $oCur->side = trim($sCur[6]);
01620                 }
01621 
01622                 if ( isset( $iCurrency) && $key == $iCurrency ) {
01623                     $oCur->selected = 1;
01624                 } else {
01625                     $oCur->selected = 0;
01626                 }
01627                 $aCurrencies[$key]= $oCur;
01628             }
01629 
01630             // #861C -  performance, do not load other currencies
01631             if ( !$this->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01632                 break;
01633             }
01634         }
01635         return $aCurrencies;
01636     }
01637 
01645     public function getCurrencyObject( $sName )
01646     {
01647         $aSearch = $this->getCurrencyArray();
01648         foreach ( $aSearch as $oCur ) {
01649             if ( $oCur->name == $sName ) {
01650                 return $oCur;
01651             }
01652         }
01653     }
01654 
01660     public function isDemoShop()
01661     {
01662         return $this->getConfigParam('blDemoShop');
01663     }
01664 
01665 
01666 
01672     public function getEdition()
01673     {
01674             return "CE";
01675 
01676 
01677     }
01678 
01684     public function getFullEdition()
01685     {
01686         $sEdition = $this->getEdition();
01687 
01688             if ($sEdition == "CE") {
01689                 return "Community Edition";
01690             }
01691 
01692 
01693 
01694         return $sEdition;
01695     }
01696 
01702     public function getVersion()
01703     {
01704         $sVersion = $this->getActiveShop()->oxshops__oxversion->value;
01705         return $sVersion;
01706     }
01707 
01713     public function getRevision()
01714     {
01715         try {
01716             $sFileName = getShopBasePath() . "/pkg.rev";
01717             $iRev = (int) trim(@file_get_contents($sFileName));
01718         } catch (Exception $e) {
01719             return false;
01720         }
01721 
01722         if (!$iRev) {
01723             return false;
01724         }
01725 
01726         return $iRev;
01727     }
01728 
01729 
01735     public function isMall()
01736     {
01737 
01738             return false;
01739     }
01740 
01750     public function detectVersion()
01751     {
01752     }
01753 
01754 
01755 
01768     public function saveShopConfVar( $sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '' )
01769     {
01770         switch ( $sVarType ) {
01771             case 'arr':
01772             case 'aarr':
01773                 if (is_array($sVarVal)) {
01774                     $sValue = serialize( $sVarVal );
01775                 } else {
01776                     // Deprecated functionality
01777                     $sValue  = $sVarVal ;
01778                     $sVarVal = unserialize( $sVarVal );
01779                 }
01780                 break;
01781             case 'bool':
01782                 //config param
01783                 $sVarVal = (( $sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
01784                 //db value
01785                 $sValue  = $sVarVal?"1":"";
01786                 break;
01787             default:
01788                 $sValue  = $sVarVal;
01789                 break;
01790         }
01791 
01792         if ( !$sShopId ) {
01793             $sShopId = $this->getShopId();
01794         }
01795 
01796         // Update value only for current shop
01797         if ($sShopId == $this->getShopId()) {
01798             $this->setConfigParam( $sVarName, $sVarVal );
01799         }
01800 
01801         $oDb = oxDb::getDb();
01802 
01803         $sShopIdQuoted     = $oDb->quote($sShopId);
01804         $sModuleQuoted     = $oDb->quote($sModule);
01805         $sVarNameQuoted    = $oDb->quote($sVarName);
01806         $sVarTypeQuoted    = $oDb->quote($sVarType);
01807         $sVarValueQuoted   = $oDb->quote($sValue);
01808         $sConfigKeyQuoted  = $oDb->quote($this->getConfigParam('sConfigKey'));
01809         $sNewOXIDdQuoted   = $oDb->quote(oxUtilsObject::getInstance()->generateUID());
01810 
01811         $sQ = "delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
01812         $oDb->execute( $sQ );
01813 
01814         $sQ = "insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
01815                values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
01816 
01817         $oDb->execute( $sQ );
01818     }
01819 
01829     public function getShopConfVar( $sVarName, $sShopId = null, $sModule = '' )
01830     {
01831         if ( !$sShopId ) {
01832             $sShopId = $this->getShopId();
01833         }
01834 
01835         if ( $sShopId === $this->getShopId() && ( !$sModule || $sModule == oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') ) ) {
01836             $sVarValue = $this->getConfigParam( $sVarName );
01837             if ( $sVarValue !== null ) {
01838                 return $sVarValue;
01839             }
01840         }
01841 
01842         $oDb = oxDb::getDb( oxDb::FETCH_MODE_ASSOC );
01843 
01844         $sQ  = "select oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = ".$oDb->quote($sVarName);
01845         $oRs = $oDb->select( $sQ );
01846 
01847         $sValue = null;
01848         if ( $oRs != false && $oRs->recordCount() > 0 ) {
01849             $sValue = $this->decodeValue( $oRs->fields['oxvartype'], $oRs->fields['oxvarvalue'] );
01850         }
01851         return $sValue;
01852     }
01853 
01862     public function decodeValue( $sType, $mOrigValue )
01863     {
01864         $sValue = $mOrigValue;
01865         switch ( $sType ) {
01866             case 'arr':
01867             case 'aarr':
01868                 $sValue = unserialize( $mOrigValue );
01869                 break;
01870             case 'bool':
01871                 $sValue = ( $mOrigValue == 'true' || $mOrigValue == '1' );
01872                 break;
01873         }
01874 
01875         return $sValue;
01876     }
01877 
01885     public function getDecodeValueQuery( $sFieldName = "oxvarvalue" )
01886     {
01887         return " DECODE( {$sFieldName}, '".$this->getConfigParam( 'sConfigKey' )."') ";
01888     }
01889 
01895     public function isProductiveMode()
01896     {
01897         $blProductive = false;
01898 
01899         $blProductive = $this->getConfigParam( 'blProductive' );
01900         if ( !isset( $blProductive ) ) {
01901             $sQ = 'select oxproductive from oxshops where oxid = "'.$this->getShopId().'"';
01902             $blProductive = ( bool ) oxDb::getDb()->getOne( $sQ );
01903             $this->setConfigParam( 'blProductive', $blProductive );
01904         }
01905 
01906         return $blProductive;
01907     }
01908 
01909 
01910 
01916     public function getBaseShopId()
01917     {
01918 
01919             return 'oxbaseshop';
01920     }
01921 
01927     public function getActiveShop()
01928     {
01929         if ( $this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
01930              $this->_oActShop->getLanguage() == oxLang::getInstance()->getBaseLanguage() ) {
01931             return $this->_oActShop;
01932         }
01933 
01934         $this->_oActShop = oxNew( 'oxshop' );
01935         $this->_oActShop->load( $this->getShopId() );
01936         return $this->_oActShop;
01937     }
01938 
01944     public function getActiveView()
01945     {
01946         if ( $this->_oActView != null ) {
01947             return $this->_oActView;
01948         }
01949 
01950         $this->_oActView = oxNew( 'oxubase' );
01951         return $this->_oActView;
01952     }
01953 
01961     public function setActiveView( $oView )
01962     {
01963         $this->_oActView = $oView;
01964     }
01965 
01971     public function isUtf()
01972     {
01973         return ( bool ) $this->getConfigParam( 'iUtfMode' );
01974     }
01975 
01981     public function getLogsDir()
01982     {
01983         return $this->getConfigParam( 'sShopDir' ).'log/';
01984     }
01985 
01993     public function isThemeOption( $sName )
01994     {
01995         return (bool) isset( $this->_aThemeConfigParams[$sName] );
01996     }
01997 
02003     public function getShopMainUrl()
02004     {
02005         return $this->isSsl() ? $this->getConfigParam( 'sSSLShopURL' ) : $this->getConfigParam( 'sShopURL' );
02006     }
02007 
02013     public function getAllModules()
02014     {
02015         return $this->parseModuleChains($this->getConfigParam('aModules'));
02016     }
02017 
02025     public function parseModuleChains($aModules)
02026     {
02027         $aModuleArray = array();
02028 
02029         if (is_array($aModules)) {
02030             foreach ($aModules as $sClass => $sModuleChain) {
02031                 if (strstr($sModuleChain, '&')) {
02032                     $aModuleChain = explode('&', $sModuleChain);
02033                 } else {
02034                     $aModuleChain = array($sModuleChain);
02035                 }
02036                 $aModuleArray[$sClass] = $aModuleChain;
02037             }
02038         }
02039 
02040         return $aModuleArray;
02041     }
02042 
02043 }