oxconfig.php

Go to the documentation of this file.
00001 <?php
00002 
00003 //max integer
00004 define( 'MAX_64BIT_INTEGER', '18446744073709551615' );
00005 
00010 class oxConfig extends oxSuperCfg
00011 {
00012     // this column of params are defined in config.inc.php file,
00013     // so for backwards compatibility. names starts without underscore
00014 
00020     protected $dbHost = null;
00021 
00027     protected $dbName = null;
00028 
00034     protected $dbUser = null;
00035 
00041     protected $dbPwd  = null;
00042 
00048     protected $dbType = null;
00049 
00055     protected $sShopURL = null;
00056 
00062     protected $sSSLShopURL = null;
00063 
00069     protected $sAdminSSLURL = null;
00070 
00076     protected $sShopDir = null;
00077 
00083     protected $sCompileDir = null;
00084 
00099     protected $iDebug = 0;
00100 
00106     protected $sAdminEmail = null;
00107 
00113     protected $blSessionUseCookies = null;
00114 
00124     protected $blNativeImages = true;
00125 
00131     protected $aMultiShopTables = array( 'oxarticles', 'oxdiscount', 'oxcategories', 'oxattribute',
00132                                          'oxlinks', 'oxvoucherseries', 'oxmanufacturers',
00133                                          'oxnews', 'oxselectlist', 'oxwrapping',
00134                                          'oxdeliveryset', 'oxdelivery', 'oxvendor', 'oxobject2category');
00135 
00141     private static $_instance = null;
00142 
00148     private $_oStart = null;
00149 
00150 
00156     protected $_oActShop       = null;
00157 
00165     protected $_aActiveViews   = array();
00166 
00172     protected $_aGlobalParams = array();
00173 
00179     protected $_aConfigParams = array();
00180 
00186     protected $_aThemeConfigParams = array();
00187 
00193     protected $_iLanguageId = null;
00194 
00200     protected $_iShopId = null;
00201 
00202 
00208     protected $_sOutDir = 'out';
00209 
00215     protected $_sImageDir = 'img';
00216 
00222     protected $_sPictureDir = 'pictures';
00223 
00229     protected $_sMasterPictureDir = 'master';
00230 
00236     protected $_sTemplateDir = 'tpl';
00237 
00243     protected $_sResourceDir = 'src';
00244 
00250     protected $_sModulesDir = 'modules';
00251 
00257     protected $_blIsSsl = null;
00258 
00264     protected $_aAbsDynImageDir = array();
00265 
00271     protected $_oActCurrencyObject = null;
00272 
00280     protected $_blInit = false;
00281 
00287     const OXMODULE_THEME_PREFIX = 'theme:';
00288 
00294     const OXMODULE_MODULE_PREFIX = 'module:';
00295 
00303     public function getConfigParam( $sName )
00304     {
00305 
00306         if ( defined( 'OXID_PHP_UNIT' ) ) {
00307             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00308                 $sValue = modConfig::$unitMOD->getModConfigParam( $sName );
00309                 if ( $sValue !== null ) {
00310                     return $sValue;
00311                 }
00312             }
00313         }
00314 
00315         $this->init();
00316 
00317         if ( isset ( $this->_aConfigParams[$sName] ) ) {
00318             return $this->_aConfigParams[$sName];
00319         }
00320 
00321         if ( isset( $this->$sName ) ) {
00322             return $this->$sName;
00323         }
00324 
00325     }
00326 
00335     public function setConfigParam( $sName, $sValue )
00336     {
00337         if ( isset( $this->$sName ) ) {
00338             $this->$sName = $sValue;
00339         } else {
00340             $this->_aConfigParams[$sName] = $sValue;
00341         }
00342     }
00343 
00349     protected function _processSeoCall()
00350     {
00351         // TODO: refactor shop bootstrap and parse url params as soon as possible
00352         if (isSearchEngineUrl()) {
00353             oxNew('oxSeoDecoder')->processSeoCall();
00354         }
00355     }
00356 
00364     public function init()
00365     {
00366         // Duplicated init protection
00367         if ($this->_blInit) {
00368            return;
00369         }
00370         $this->_blInit = true;
00371 
00372         $this->_loadVarsFromFile();
00373 
00374         include getShopBasePath().'core/oxconfk.php';
00375 
00376         // setting ADODB timeout
00377         global  $ADODB_SESS_LIFE;
00378         $ADODB_SESS_LIFE  = 1;
00379 
00380         // some important defaults
00381         $this->_setDefaults();
00382 
00383         try {
00384             $sShopID = $this->getShopId();
00385             $blConfigLoaded = $this->_loadVarsFromDb( $sShopID );
00386 
00387             // loading shop config
00388             if ( empty($sShopID) || !$blConfigLoaded ) {
00389                 // if no config values where loaded (some problems with DB), throwing an exception
00390                 $oEx = oxNew( "oxConnectionException" );
00391                 $oEx->setMessage( "Unable to load shop config values from database" );
00392                 throw $oEx;
00393             }
00394 
00395             // loading theme config options
00396             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') );
00397 
00398             // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362)
00399             if ( $this->getConfigParam('sCustomTheme') ) {
00400                 $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme') );
00401             }
00402 
00403             // loading modules config
00404             $this->_loadVarsFromDb( $sShopID, null, oxConfig::OXMODULE_MODULE_PREFIX );
00405 
00406 
00407             $this->_processSeoCall();
00408 
00409             //starting up the session
00410             $this->getSession()->start();
00411 
00412         } catch ( oxConnectionException $oEx ) {
00413 
00414             $oEx->debugOut();
00415             if ( defined( 'OXID_PHP_UNIT' ) ) {
00416                 return false;
00417             } elseif ( 0 != $this->iDebug ) {
00418                 oxRegistry::getUtils()->showMessageAndExit( $oEx->getString() );
00419             } else {
00420                 header( "HTTP/1.1 500 Internal Server Error");
00421                 header( "Location: offline.html");
00422                 header( "Connection: close");
00423             }
00424         } catch ( oxCookieException $oEx ) {
00425 
00426             $this->_processSeoCall();
00427 
00428             //starting up the session
00429             $this->getSession()->start();
00430 
00431             // redirect to start page and display the error
00432             oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx );
00433             oxRegistry::getUtils()->redirect( $this->getShopHomeURL() .'cl=start', true, 302 );
00434         }
00435 
00436 
00437         // Admin handling
00438         $this->setConfigParam( 'blAdmin', isAdmin() );
00439 
00440         if ( defined('OX_ADMIN_DIR') ) {
00441             $this->setConfigParam( 'sAdminDir', OX_ADMIN_DIR );
00442         }
00443 
00444         $this->_loadVarsFromFile();
00445 
00446         //application initialization
00447         $this->_oStart = new oxStart();
00448         $this->_oStart->appInit();
00449     }
00450 
00458     public static function getInstance()
00459     {
00460         return oxRegistry::getConfig();
00461     }
00462 
00468     protected function _loadVarsFromFile()
00469     {
00470         //config variables from config.inc.php takes priority over the ones loaded from db
00471         include getShopBasePath().'/config.inc.php';
00472 
00473         //adding trailing slashes
00474         $oFileUtils = oxRegistry::get("oxUtilsFile");
00475         $this->sShopDir     = $oFileUtils->normalizeDir($this->sShopDir);
00476         $this->sCompileDir  = $oFileUtils->normalizeDir($this->sCompileDir);
00477         $this->sShopURL     = $oFileUtils->normalizeDir($this->sShopURL);
00478         $this->sSSLShopURL  = $oFileUtils->normalizeDir($this->sSSLShopURL);
00479         $this->sAdminSSLURL = $oFileUtils->normalizeDir($this->sAdminSSLURL);
00480 
00481         $this->_loadCustomConfig();
00482     }
00483 
00489     protected function _setDefaults()
00490     {
00491 
00492         // some important defaults
00493         if( !$this->getConfigParam( 'sDefaultLang' ) )
00494             $this->setConfigParam( 'sDefaultLang', 0 );
00495 
00496 
00497         $this->setConfigParam( 'sTheme', 'azure' );
00498 
00499 
00500         $blLogChangesInAdmin = $this->getConfigParam( 'blLogChangesInAdmin' );
00501         if( !isset( $blLogChangesInAdmin ) )
00502             $this->setConfigParam( 'blLogChangesInAdmin', false );
00503 
00504         $blCheckTemplates = $this->getConfigParam( 'blCheckTemplates' );
00505         if( !isset( $blCheckTemplates ) )
00506             $this->setConfigParam( 'blCheckTemplates', false );
00507 
00508         $blAllowArticlesubclass = $this->getConfigParam( 'blAllowArticlesubclass' );
00509         if( !isset( $blAllowArticlesubclass ) )
00510             $this->setConfigParam( 'blAllowArticlesubclass', false );
00511 
00512         $iAdminListSize = $this->getConfigParam( 'iAdminListSize' );
00513         if( !isset( $iAdminListSize ) )
00514             $this->setConfigParam( 'iAdminListSize', 9 );
00515 
00516         // #1173M  for EE - not all pic are deleted
00517         $iPicCount = $this->getConfigParam( 'iPicCount' );
00518         if ( !isset( $iPicCount ) )
00519             $this->setConfigParam( 'iPicCount', 7 );
00520 
00521         $iZoomPicCount = $this->getConfigParam( 'iZoomPicCount' );
00522         if ( !isset( $iZoomPicCount ) )
00523             $this->setConfigParam( 'iZoomPicCount', 4 );
00524 
00525         // ADODB cache life time
00526         $iDBCacheLifeTime = $this->getConfigParam( 'iDBCacheLifeTime' );
00527         if ( !isset( $iDBCacheLifeTime ) )
00528             $this->setConfigParam( 'iDBCacheLifeTime', 3600 ); // 1 hour
00529 
00530         $sCoreDir = $this->getConfigParam( 'sShopDir' );
00531         $this->setConfigParam( 'sCoreDir', $sCoreDir.'/core/' );
00532     }
00533 
00539     protected function _loadCustomConfig()
00540     {
00541         $sCustConfig = getShopBasePath().'/cust_config.inc.php';
00542         if ( is_readable( $sCustConfig ) ) {
00543             include $sCustConfig;
00544         }
00545     }
00546 
00556     protected function _loadVarsFromDb( $sShopID, $aOnlyVars = null, $sModule = '' )
00557     {
00558         $oDb = oxDb::getDb();
00559 
00560         if ( !empty($sModule) ) {
00561             $sModuleSql = " oxmodule LIKE " . $oDb->quote($sModule."%");
00562         } else {
00563             $sModuleSql = " oxmodule='' ";
00564         }
00565 
00566         $sQ = "select oxvarname, oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '$sShopID' and " . $sModuleSql;
00567         // dodger, allow loading from some vars only from baseshop
00568         if ( $aOnlyVars !== null ) {
00569             $blSep = false;
00570             $sIn  = '';
00571             foreach ( $aOnlyVars as $sField ) {
00572                 if ( $blSep ) {
00573                     $sIn .= ', ';
00574                 }
00575                 $sIn .= '"'.$sField.'"';
00576                 $blSep = true;
00577             }
00578             $sQ .= ' and oxvarname in ( '.$sIn.' ) ';
00579         }
00580         $oRs = $oDb->select( $sQ );
00581 
00582         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00583             while ( !$oRs->EOF ) {
00584                 $sVarName = $oRs->fields[0];
00585                 $sVarType = $oRs->fields[1];
00586                 $sVarVal  = $oRs->fields[2];
00587 
00588                 //in sShopURL and sSSLShopURL cases we skip (for admin or when URL values are not set)
00589                 if ( ( $sVarName == 'sShopURL' || $sVarName == 'sSSLShopURL' ) &&
00590                     ( !$sVarVal || $this->isAdmin() === true ) ) {
00591                     $oRs->moveNext();
00592                     continue;
00593                 }
00594 
00595                 $this->_setConfVarFromDb($sVarName, $sVarType, $sVarVal);
00596 
00597                 //setting theme options array
00598                 if ( $sModule != '' ) {
00599                     $this->_aThemeConfigParams[$sVarName] = $sModule;
00600                 }
00601 
00602                 $oRs->moveNext();
00603             }
00604 
00605             return true;
00606         } else {
00607             return false;
00608         }
00609     }
00610 
00620     protected function _setConfVarFromDb($sVarName, $sVarType, $sVarVal)
00621     {
00622         switch ( $sVarType ) {
00623             case 'arr':
00624             case 'aarr':
00625                 $this->setConfigParam( $sVarName, unserialize( $sVarVal ) );
00626                 break;
00627             case 'bool':
00628                 $this->setConfigParam( $sVarName, ( $sVarVal == 'true' || $sVarVal == '1' ) );
00629                 break;
00630             default:
00631                 $this->setConfigParam( $sVarName, $sVarVal );
00632                 break;
00633         }
00634     }
00635 
00641     public function pageClose()
00642     {
00643         if ( $this->hasActiveViewsChain() ) {
00644             // do not commit session until active views chain exists
00645             return;
00646         }
00647 
00648         return $this->_oStart->pageClose();
00649     }
00650 
00663     public static function getParameter( $sName, $blRaw = false )
00664     {
00665         return oxRegistry::getConfig()->getRequestParameter( $sName, $blRaw );
00666     }
00667 
00679     public function getRequestParameter( $sName, $blRaw = false )
00680     {
00681         if ( defined( 'OXID_PHP_UNIT' ) ) {
00682             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
00683                 try{
00684                     $sValue = modConfig::getParameter(  $sName, $blRaw );
00685 
00686                     // TODO: remove this after special chars concept implementation
00687                     $blIsAdmin = modConfig::getInstance()->isAdmin() || modSession::getInstance()->getVariable(  "blIsAdmin" );
00688                     if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00689                         $this->checkParamSpecialChars( $sValue, $blRaw );
00690                     }
00691 
00692                     return $sValue;
00693                 } catch( Exception $e ) {
00694                     // if exception is thrown, use default
00695                 }
00696             }
00697         }
00698 
00699         $sValue = null;
00700 
00701         if ( isset( $_POST[$sName] ) ) {
00702             $sValue = $_POST[$sName];
00703         } elseif ( isset( $_GET[$sName] ) ) {
00704             $sValue = $_GET[$sName];
00705         }
00706 
00707         // TODO: remove this after special chars concept implementation
00708         $blIsAdmin = $this->isAdmin() && $this->getSession()->getVariable( "blIsAdmin" );
00709         if ( $sValue !== null && !$blIsAdmin && (!$blRaw || is_array($blRaw))) {
00710             $this->checkParamSpecialChars( $sValue, $blRaw );
00711         }
00712 
00713         return $sValue;
00714     }
00715 
00723     public function getUploadedFile($sParamName)
00724     {
00725         return $_FILES[$sParamName];
00726     }
00727 
00736     public function setGlobalParameter( $sName, $sValue )
00737     {
00738         $this->_aGlobalParams[$sName] = $sValue;
00739     }
00740 
00748     public function getGlobalParameter( $sName )
00749     {
00750         if ( isset( $this->_aGlobalParams[$sName] ) ) {
00751             return $this->_aGlobalParams[$sName];
00752         } else {
00753             return null;
00754         }
00755     }
00756 
00768     public static function checkSpecialChars( & $sValue, $aRaw = null )
00769     {
00770         return oxRegistry::getConfig()->checkParamSpecialChars( $sValue, $aRaw );
00771     }
00772 
00782     public function checkParamSpecialChars( & $sValue, $aRaw = null )
00783     {
00784         if ( is_object( $sValue ) ) {
00785             return $sValue;
00786         }
00787 
00788         if ( is_array( $sValue ) ) {
00789             $newValue = array();
00790             foreach ( $sValue as $sKey => $sVal ) {
00791                 $sValidKey = $sKey;
00792                 if ( !$aRaw || !in_array($sKey, $aRaw) ) {
00793                     $this->checkParamSpecialChars( $sValidKey );
00794                     $this->checkParamSpecialChars( $sVal );
00795                     if ($sValidKey != $sKey) {
00796                         unset ($sValue[$sKey]);
00797                     }
00798                 }
00799                 $newValue[$sValidKey] = $sVal;
00800             }
00801             $sValue = $newValue;
00802         } elseif ( is_string( $sValue ) ) {
00803             $sValue = str_replace( array( '&',     '<',    '>',    '"',      "'",      chr(0), '\\' ),
00804                                    array( '&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '',     '&#092;' ),
00805                                    $sValue );
00806         }
00807         return $sValue;
00808     }
00809 
00815     public function getShopId()
00816     {
00817         if ( $this->_iShopId !== null )
00818             return $this->_iShopId;
00819 
00820             $this->_iShopId = $this->getBaseShopId();
00821 
00822 
00823         $this->getSession()->setVariable( 'actshop', $this->_iShopId );
00824         return $this->_iShopId;
00825     }
00826 
00827 
00835     public function setShopId( $sShopId )
00836     {
00837         $this->getSession()->setVariable( 'actshop', $sShopId );
00838         $this->_iShopId = $sShopId;
00839     }
00840 
00841 
00842 
00850     public function setIsSsl( $blIsSsl = false )
00851     {
00852         $this->_blIsSsl = $blIsSsl;
00853     }
00854 
00860     protected function _checkSsl()
00861     {
00862             $myUtilsServer   = oxRegistry::get("oxUtilsServer");
00863             $aServerVars     = $myUtilsServer->getServerVar();
00864             $aHttpsServerVar = $myUtilsServer->getServerVar( 'HTTPS' );
00865 
00866             $this->setIsSsl();
00867             if (isset( $aHttpsServerVar ) && ($aHttpsServerVar === 'on' || $aHttpsServerVar === 'ON' || $aHttpsServerVar == '1' )) {
00868                 // "1&1" hoster provides "1"
00869                 $this->setIsSsl($this->getConfigParam('sSSLShopURL') || $this->getConfigParam('sMallSSLShopURL')) ;
00870                 if ($this->isAdmin() && !$this->_blIsSsl) {
00871                     //#4026
00872                      $this->setIsSsl( !is_null($this->getConfigParam('sAdminSSLURL')) );
00873                 }
00874             }
00875 
00876             //additional special handling for profihost customers
00877             if ( isset( $aServerVars['HTTP_X_FORWARDED_SERVER'] ) &&
00878                  ( strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'ssl' ) !== false ||
00879                  strpos( $aServerVars['HTTP_X_FORWARDED_SERVER'], 'secure-online-shopping.de' ) !== false ) ) {
00880                  $this->setIsSsl( true );
00881             }
00882 
00883     }
00884 
00885 
00891     public function isSsl()
00892     {
00893         if ( is_null( $this->_blIsSsl ) ) {
00894             $this->_checkSsl();
00895         }
00896         return $this->_blIsSsl;
00897     }
00898 
00906     public function isCurrentUrl( $sURL )
00907     {
00908         // Missing protocol, cannot proceed, assuming true.
00909         if ( !$sURL || (strpos( $sURL, "http" ) !== 0)) {
00910             return true;
00911         }
00912 
00913         return oxRegistry::get("oxUtilsServer")->isCurrentUrl($sURL);
00914     }
00915 
00923     public function isCurrentProtocol( $sURL )
00924     {
00925         // Missing protocol, cannot proceed, assuming true.
00926         if ( !$sURL || (strpos( $sURL, "http" ) !== 0)) {
00927             return true;
00928         }
00929 
00930         return (strpos( $sURL, "https:" ) === 0) == $this->isSsl();
00931     }
00932 
00941     public function getShopUrl( $iLang = null, $blAdmin = null )
00942     {
00943         $blAdmin = isset( $blAdmin ) ? $blAdmin : $this->isAdmin();
00944         if ( $blAdmin ) {
00945             return $this->getConfigParam( 'sShopURL' );
00946         }
00947 
00948         // #680 per language another URL
00949         $iLang = isset( $iLang ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00950         $aLanguageURLs = $this->getConfigParam( 'aLanguageURLs' );
00951         if ( isset( $iLang ) && isset( $aLanguageURLs[$iLang] ) && !empty( $aLanguageURLs[$iLang] ) ) {
00952             $aLanguageURLs[$iLang] = oxRegistry::getUtils()->checkUrlEndingSlash( $aLanguageURLs[$iLang] );
00953             return $aLanguageURLs[$iLang];
00954         }
00955 
00956         //normal section
00957         $sMallShopURL = $this->getConfigParam( 'sMallShopURL' );
00958         if ( $sMallShopURL ) {
00959             $sMallShopURL = oxRegistry::getUtils()->checkUrlEndingSlash( $sMallShopURL );
00960             return $sMallShopURL;
00961         }
00962 
00963         return $this->getConfigParam( 'sShopURL' );
00964     }
00965 
00973     public function getSslShopUrl( $iLang = null )
00974     {
00975         // #680 per language another URL
00976         $iLang = isset( $iLang ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00977         $aLanguageSSLURLs = $this->getConfigParam( 'aLanguageSSLURLs' );
00978         if ( isset( $iLang ) && isset( $aLanguageSSLURLs[$iLang] ) && !empty( $aLanguageSSLURLs[$iLang] ) ) {
00979             $aLanguageSSLURLs[$iLang] = oxRegistry::getUtils()->checkUrlEndingSlash( $aLanguageSSLURLs[$iLang] );
00980             return $aLanguageSSLURLs[$iLang];
00981         }
00982 
00983         //mall mode
00984         if ( ( $sMallSSLShopURL = $this->getConfigParam( 'sMallSSLShopURL' ) ) ) {
00985             $sMallSSLShopURL = oxRegistry::getUtils()->checkUrlEndingSlash( $sMallSSLShopURL );
00986             return $sMallSSLShopURL;
00987         }
00988 
00989         if ( ( $sMallShopURL = $this->getConfigParam( 'sMallShopURL' ) ) ) {
00990             $sMallShopURL = oxRegistry::getUtils()->checkUrlEndingSlash( $sMallShopURL );
00991             return $sMallShopURL;
00992         }
00993 
00994         //normal section
00995         if ( ( $sSSLShopURL = $this->getConfigParam( 'sSSLShopURL' ) ) ) {
00996             return $sSSLShopURL;
00997         }
00998 
00999         return $this->getShopUrl( $iLang );
01000     }
01001 
01007     public function getCoreUtilsUrl()
01008     {
01009         return $this->getCurrentShopUrl().'core/utils/';
01010     }
01011 
01020     public function getCurrentShopUrl($blAdmin = null)
01021     {
01022         if ($blAdmin===null) {
01023             $blAdmin = $this->isAdmin();
01024         }
01025         if ($blAdmin) {
01026             if ($this->isSsl()) {
01027 
01028                 $sUrl = $this->getConfigParam( 'sAdminSSLURL' );
01029                 if ( !$sUrl ) {
01030                     return $this->getSslShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
01031                 }
01032                 return $sUrl;
01033             } else {
01034                 return $this->getShopUrl() . $this->getConfigParam( 'sAdminDir' ) . '/';
01035             }
01036         } else {
01037             return $this->isSsl() ? $this->getSslShopUrl() : $this->getShopUrl();
01038         }
01039     }
01040 
01048     public function getShopCurrentUrl( $iLang = null )
01049     {
01050         if ( $this->isSsl() ) {
01051             $sURL = $this->getSSLShopURL( $iLang );
01052         } else {
01053             $sURL = $this->getShopURL( $iLang );
01054         }
01055 
01056         return oxRegistry::get("oxUtilsUrl")->processUrl( $sURL.'index.php', false );
01057     }
01058 
01067     public function getShopHomeUrl( $iLang = null, $blAdmin = null )
01068     {
01069         return oxRegistry::get("oxUtilsUrl")->processUrl($this->getShopUrl( $iLang, $blAdmin).'index.php', false );
01070     }
01071 
01080     public function getWidgetUrl( $iLang = null, $blAdmin = null )
01081     {
01082         return oxRegistry::get("oxUtilsUrl")->processUrl($this->getShopUrl( $iLang, $blAdmin).'widget.php', false );
01083     }
01084 
01090     public function getShopSecureHomeUrl()
01091     {
01092         return  oxRegistry::get("oxUtilsUrl")->processUrl( $this->getSslShopUrl().'index.php', false );
01093     }
01094 
01100     public function getShopCurrency()
01101     {
01102         $iCurr = null;
01103         if ( ( null === ( $iCurr = $this->getRequestParameter( 'cur' ) ) ) ) {
01104             if ( null === ( $iCurr = $this->getRequestParameter( 'currency' ) ) ) {
01105                 $iCurr = $this->getSession()->getVariable( 'currency' );
01106             }
01107         }
01108         return (int) $iCurr;
01109     }
01110 
01116     public function getActShopCurrencyObject()
01117     {
01118         //caching currency as it does not change through the script
01119         //but not for unit tests as ther it changes always
01120         if ( !defined( 'OXID_PHP_UNIT' ) ) {
01121             if (!is_null($this->_oActCurrencyObject)) {
01122                 return $this->_oActCurrencyObject;
01123             }
01124         }
01125 
01126         $iCur = $this->getShopCurrency();
01127         $aCurrencies = $this->getCurrencyArray();
01128         if ( !isset( $aCurrencies[$iCur] ) ) {
01129             return $this->_oActCurrencyObject = reset( $aCurrencies ); // reset() returns the first element
01130         }
01131 
01132         return $this->_oActCurrencyObject = $aCurrencies[$iCur];
01133     }
01134 
01142     public function setActShopCurrency( $iCur )
01143     {
01144         $aCurrencies = $this->getCurrencyArray();
01145         if ( isset( $aCurrencies[$iCur] ) ) {
01146             $this->getSession()->setVariable( 'currency', $iCur );
01147             $this->_oActCurrencyObject = null;
01148         }
01149     }
01150 
01158     public function getOutDir( $blAbsolute = true)
01159     {
01160         if ($blAbsolute) {
01161             return $this->getConfigParam('sShopDir').$this->_sOutDir.'/';
01162         } else {
01163             return $this->_sOutDir.'/';
01164         }
01165     }
01166 
01174     public function getViewsDir( $blAbsolute = true )
01175     {
01176         if ($blAbsolute) {
01177             return $this->getConfigParam('sShopDir'). 'application/views/';
01178         } else {
01179             return 'application/views/';
01180         }
01181     }
01182 
01192     public function getTranslationsDir( $sFile, $sDir, $blAbsolute = true )
01193     {
01194         $sPath = $blAbsolute ? $this->getConfigParam( 'sShopDir' ) : '';
01195         $sPath .= 'application/translations/';
01196         if ( is_readable( $sPath. $sDir. '/'. $sFile ) ) {
01197             return $sPath. $sDir. '/'. $sFile;
01198         }
01199         return false;
01200     }
01201 
01209     public function getAppDir( $blAbsolute = true )
01210     {
01211         if ($blAbsolute) {
01212             return $this->getConfigParam('sShopDir'). 'application/';
01213         } else {
01214             return 'application/';
01215         }
01216     }
01217 
01227     public function getOutUrl( $blSSL = null , $blAdmin = null, $blNativeImg = false )
01228     {
01229         $blSSL    = is_null($blSSL)?$this->isSsl():$blSSL;
01230         $blAdmin  = is_null($blAdmin)?$this->isAdmin():$blAdmin;
01231 
01232         if ( $blSSL ) {
01233             if ($blNativeImg && !$blAdmin) {
01234                 $sUrl = $this->getSslShopUrl();
01235             } else {
01236                 $sUrl = $this->getConfigParam('sSSLShopURL');
01237                 if (!$sUrl && $blAdmin) {
01238                     $sUrl = $this->getConfigParam('sAdminSSLURL').'../';
01239                 }
01240             }
01241         } else {
01242             $sUrl = ($blNativeImg && !$blAdmin )?$this->getShopUrl():$this->getConfigParam( 'sShopURL' );
01243         }
01244 
01245         return $sUrl.$this->_sOutDir.'/';
01246     }
01247 
01262     public function getDir($sFile, $sDir, $blAdmin, $iLang = null, $iShop = null, $sTheme = null, $blAbsolute = true, $blIgnoreCust = false  )
01263     {
01264         if ( is_null($sTheme) ) {
01265             $sTheme = $this->getConfigParam( 'sTheme' );
01266         }
01267 
01268         if ( $blAdmin ) {
01269             $sTheme = 'admin';
01270         }
01271 
01272         if ( $sDir != $this->_sTemplateDir ) {
01273             $sBase    = $this->getOutDir( $blAbsolute );
01274             $sAbsBase = $this->getOutDir();
01275         } else {
01276             $sBase    = $this->getViewsDir( $blAbsolute );
01277             $sAbsBase = $this->getViewsDir();
01278         }
01279 
01280         $sLang = '-';
01281         // FALSE means skip language folder check
01282         if ( $iLang !== false ) {
01283             $oLang = oxRegistry::getLang();
01284 
01285             if ( is_null( $iLang ) ) {
01286                 $iLang = $oLang->getEditLanguage();
01287             }
01288 
01289             $sLang = $oLang->getLanguageAbbr( $iLang );
01290         }
01291 
01292         if ( is_null($iShop) ) {
01293             $iShop = $this->getShopId();
01294         }
01295 
01296         //Load from
01297         $sPath = "{$sTheme}/{$iShop}/{$sLang}/{$sDir}/{$sFile}";
01298         $sCacheKey = $sPath . "_{$blIgnoreCust}{$blAbsolute}";
01299 
01300         if ( ( $sReturn = oxRegistry::getUtils()->fromStaticCache( $sCacheKey ) ) !== null ) {
01301             return $sReturn;
01302         }
01303 
01304         $sReturn = false;
01305 
01306         // Check for custom template
01307         $sCustomTheme = $this->getConfigParam( 'sCustomTheme' );
01308         if ( !$blAdmin && !$blIgnoreCust && $sCustomTheme && $sCustomTheme != $sTheme) {
01309             $sReturn = $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sCustomTheme, $blAbsolute );
01310         }
01311 
01312         //test lang level ..
01313         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01314             $sReturn = $sBase . $sPath;
01315         }
01316 
01317         //test shop level ..
01318         $sPath = "$sTheme/$iShop/$sDir/$sFile";
01319         if ( !$sReturn && !$blAdmin && is_readable( $sAbsBase.$sPath ) ) {
01320             $sReturn = $sBase . $sPath;
01321         }
01322 
01323 
01324         //test theme language level ..
01325         $sPath = "$sTheme/$sLang/$sDir/$sFile";
01326         if ( !$sReturn && $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01327             $sReturn = $sBase . $sPath;
01328         }
01329 
01330         //test theme level ..
01331         $sPath = "$sTheme/$sDir/$sFile";
01332         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01333             $sReturn = $sBase . $sPath;
01334         }
01335 
01336         //test out language level ..
01337         $sPath = "$sLang/$sDir/$sFile";
01338         if ( !$sReturn &&  $iLang !== false && is_readable( $sAbsBase.$sPath ) ) {
01339             $sReturn = $sBase . $sPath;
01340         }
01341 
01342         //test out level ..
01343         $sPath = "$sDir/$sFile";
01344         if ( !$sReturn && is_readable( $sAbsBase.$sPath ) ) {
01345             $sReturn = $sBase . $sPath;
01346         }
01347 
01348         if ( !$sReturn ) {
01349             // TODO: implement logic to log missing paths
01350         }
01351 
01352         // to cache
01353         oxRegistry::getUtils()->toStaticCache( $sCacheKey, $sReturn );
01354 
01355         return $sReturn;
01356     }
01357 
01372     public function getUrl($sFile, $sDir , $blAdmin = null, $blSSL = null, $blNativeImg = false, $iLang = null , $iShop = null , $sTheme = null )
01373     {
01374         $sUrl = str_replace(
01375                                 $this->getOutDir(),
01376                                 $this->getOutUrl($blSSL, $blAdmin, $blNativeImg),
01377                                 $this->getDir( $sFile, $sDir, $blAdmin, $iLang, $iShop, $sTheme )
01378                             );
01379 
01380         return $sUrl;
01381     }
01382 
01391     public function getImagePath( $sFile, $blAdmin = false )
01392     {
01393         return $this->getDir( $sFile, $this->_sImageDir, $blAdmin );
01394     }
01395 
01406     public function getImageUrl( $blAdmin = false, $blSSL = null, $blNativeImg = null, $sFile = null )
01407     {
01408         $blNativeImg = is_null($blNativeImg)?$this->getConfigParam( 'blNativeImages' ):$blNativeImg;
01409         return $this->getUrl( $sFile, $this->_sImageDir, $blAdmin, $blSSL, $blNativeImg );
01410     }
01411 
01419     public function getImageDir( $blAdmin = false )
01420     {
01421         return $this->getDir( null, $this->_sImageDir, $blAdmin );
01422     }
01423 
01435     public function getPicturePath($sFile, $blAdmin = false, $iLang = null , $iShop = null , $sTheme = null)
01436     {
01437         return $this->getDir( $sFile, $this->_sPictureDir, $blAdmin, $iLang, $iShop, $sTheme );
01438     }
01439 
01447     public function getMasterPictureDir( $blAdmin = false )
01448     {
01449         return $this->getDir( null, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01450     }
01451 
01460     public function getMasterPicturePath( $sFile, $blAdmin = false )
01461     {
01462         return $this->getDir( $sFile, $this->_sPictureDir . "/" . $this->_sMasterPictureDir, $blAdmin );
01463     }
01464 
01477     public function getPictureUrl( $sFile, $blAdmin = false, $blSSL = null, $iLang = null, $iShopId = null, $sDefPic = "master/nopic.jpg" )
01478     {
01479         if ( $sAltUrl = oxRegistry::get("oxPictureHandler")->getAltImageUrl('/', $sFile, $blSSL) ) {
01480             return $sAltUrl;
01481         }
01482 
01483         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01484         $sUrl = $this->getUrl( $sFile, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01485 
01486         //anything is better than empty name, because <img src=""> calls shop once more = x2 SLOW.
01487         if ( !$sUrl && $sDefPic ) {
01488             $sUrl = $this->getUrl( $sDefPic, $this->_sPictureDir, $blAdmin, $blSSL, $blNativeImg, $iLang, $iShopId );
01489         }
01490         return $sUrl;
01491     }
01492 
01500     public function getPictureDir( $blAdmin )
01501     {
01502         return $this->getDir( null, $this->_sPictureDir, $blAdmin );
01503     }
01504 
01513     public function getTemplatePath( $sFile, $blAdmin )
01514     {
01515         $sTemplatePath = $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin );
01516 
01517         if (!$sTemplatePath) {
01518             $sBasePath        = getShopBasePath();
01519             $aModuleTemplates = $this->getConfigParam('aModuleTemplates');
01520 
01521             $oModulelist = oxNew('oxmodulelist');
01522             $aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
01523             if (is_array($aModuleTemplates) && is_array($aActiveModuleInfo)) {
01524                 foreach ($aModuleTemplates as $sModuleId => $aTemplates) {
01525                     if (isset($aTemplates[$sFile]) && isset($aActiveModuleInfo[$sModuleId])) {
01526                         $sPath = $aTemplates[$sFile];
01527                         $sPath = $sBasePath. 'modules/'.  $sPath;
01528                         if (is_file($sPath) && is_readable($sPath)) {
01529                             $sTemplatePath =  $sPath;
01530                         }
01531                     }
01532                 }
01533             }
01534         }
01535 
01536         return $sTemplatePath;
01537     }
01538 
01546     public function getTemplateDir( $blAdmin = false )
01547     {
01548         return $this->getDir( null, $this->_sTemplateDir, $blAdmin );
01549     }
01550 
01561     public function getTemplateUrl( $sFile = null, $blAdmin = false, $blSSL = null , $iLang = null )
01562     {
01563         return $this->getShopMainUrl() . $this->getDir( $sFile, $this->_sTemplateDir, $blAdmin, $iLang, null, null, false );
01564     }
01565 
01573     public function getTemplateBase( $blAdmin = false )
01574     {
01575         // Base template dir is the parent dir of template dir
01576         return str_replace( $this->_sTemplateDir.'/', '', $this->getDir( null, $this->_sTemplateDir, $blAdmin, null, null, null, false ));
01577     }
01578 
01587     public function getResourcePath($sFile = '', $blAdmin = false )
01588     {
01589         return $this->getDir( $sFile, $this->_sResourceDir, $blAdmin );
01590     }
01591 
01599     public function getModulesDir( $blAbsolute = true )
01600     {
01601         if ($blAbsolute) {
01602             return $this->getConfigParam('sShopDir') . $this->_sModulesDir . '/';
01603         } else {
01604             return $this->_sModulesDir . '/';
01605         }
01606     }
01607 
01618     public function getResourceUrl( $sFile = '', $blAdmin = false , $blSSL = null , $iLang = null )
01619     {
01620         $blNativeImg = $this->getConfigParam( 'blNativeImages' );
01621         return $this->getUrl( $sFile, $this->_sResourceDir, $blAdmin, $blSSL, $blNativeImg, $iLang );
01622     }
01623 
01631     public function getResourceDir( $blAdmin )
01632     {
01633         return $this->getDir( null, $this->_sResourceDir, $blAdmin );
01634     }
01635 
01643     public function getCurrencyArray( $iCurrency = null )
01644     {
01645         $aConfCurrencies = $this->getConfigParam( 'aCurrencies' );
01646         if ( !is_array( $aConfCurrencies ) ) {
01647             return array();
01648         }
01649 
01650         if ( defined( 'OXID_PHP_UNIT' ) ) {
01651             if ( isset( modConfig::$unitMOD ) && is_object( modConfig::$unitMOD ) ) {
01652                 try{
01653                     $aAltCurrencies = modConfig::getInstance()->getConfigParam( 'modaCurrencies' );
01654                     if ( isset( $aAltCurrencies ) ) {
01655                         $aConfCurrencies = $aAltCurrencies;
01656                     }
01657                 } catch( Exception $e ) {
01658                     // if exception is thrown, use default
01659                 }
01660             }
01661         }
01662 
01663         // processing currency configuration data
01664         $aCurrencies = array();
01665         reset( $aConfCurrencies );
01666         while ( list( $key, $val ) = each( $aConfCurrencies ) ) {
01667             if ( $val ) {
01668                 $oCur = new stdClass();
01669                 $oCur->id      = $key;
01670                 $sCur = explode( '@', $val);
01671                 $oCur->name     = trim( $sCur[0] );
01672                 $oCur->rate     = trim( $sCur[1] );
01673                 $oCur->dec      = trim( $sCur[2] );
01674                 $oCur->thousand = trim( $sCur[3] );
01675                 $oCur->sign     = trim( $sCur[4] );
01676                 $oCur->decimal  = trim( $sCur[5] );
01677 
01678                 // change for US version
01679                 if ( isset( $sCur[6] ) ) {
01680                     $oCur->side = trim($sCur[6]);
01681                 }
01682 
01683                 if ( isset( $iCurrency) && $key == $iCurrency ) {
01684                     $oCur->selected = 1;
01685                 } else {
01686                     $oCur->selected = 0;
01687                 }
01688                 $aCurrencies[$key]= $oCur;
01689             }
01690 
01691             // #861C -  performance, do not load other currencies
01692             if ( !$this->getConfigParam( 'bl_perfLoadCurrency' ) ) {
01693                 break;
01694             }
01695         }
01696         return $aCurrencies;
01697     }
01698 
01706     public function getCurrencyObject( $sName )
01707     {
01708         $aSearch = $this->getCurrencyArray();
01709         foreach ( $aSearch as $oCur ) {
01710             if ( $oCur->name == $sName ) {
01711                 return $oCur;
01712             }
01713         }
01714     }
01715 
01721     public function isDemoShop()
01722     {
01723         return $this->getConfigParam('blDemoShop');
01724     }
01725 
01726 
01727 
01733     public function getEdition()
01734     {
01735             return "CE";
01736 
01737 
01738     }
01739 
01745     public function getFullEdition()
01746     {
01747         $sEdition = $this->getEdition();
01748 
01749             if ($sEdition == "CE") {
01750                 return "Community Edition";
01751             }
01752 
01753 
01754 
01755         return $sEdition;
01756     }
01757 
01763     public function getVersion()
01764     {
01765         $sVersion = $this->getActiveShop()->oxshops__oxversion->value;
01766         return $sVersion;
01767     }
01768 
01774     public function getRevision()
01775     {
01776         $sFileName = $this->getConfigParam( 'sShopDir' ) . "/pkg.rev";
01777         $sRev = trim(@file_get_contents($sFileName));
01778 
01779         if (!$sRev) {
01780             return false;
01781         }
01782 
01783         return $sRev;
01784     }
01785 
01791     public function getPackageInfo()
01792     {
01793         $sFileName = $this->getConfigParam( 'sShopDir' ) . "/pkg.info";
01794         $sRev = @file_get_contents($sFileName);
01795         $sRev = str_replace("\n", "<br>", $sRev);
01796 
01797         if (!$sRev) {
01798             return false;
01799         }
01800 
01801         return $sRev;
01802     }
01803 
01804 
01810     public function isMall()
01811     {
01812 
01813             return false;
01814     }
01815 
01825     public function detectVersion()
01826     {
01827     }
01828 
01829 
01830 
01843     public function saveShopConfVar( $sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '' )
01844     {
01845         switch ( $sVarType ) {
01846             case 'arr':
01847             case 'aarr':
01848                 $sValue = serialize( $sVarVal );
01849                 break;
01850             case 'bool':
01851                 //config param
01852                 $sVarVal = (( $sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
01853                 //db value
01854                 $sValue  = $sVarVal?"1":"";
01855                 break;
01856             case 'num':
01857                 //config param
01858                 $sVarVal = $sVarVal != ''? oxRegistry::getUtils()->string2Float( $sVarVal ) : '';
01859                 $sValue = $sVarVal;
01860                 break;
01861             default:
01862                 $sValue  = $sVarVal;
01863                 break;
01864         }
01865 
01866         if ( !$sShopId ) {
01867             $sShopId = $this->getShopId();
01868         }
01869 
01870         // Update value only for current shop
01871         if ($sShopId == $this->getShopId()) {
01872             $this->setConfigParam( $sVarName, $sVarVal );
01873         }
01874 
01875         $oDb = oxDb::getDb();
01876 
01877         $sShopIdQuoted     = $oDb->quote($sShopId);
01878         $sModuleQuoted     = $oDb->quote($sModule);
01879         $sVarNameQuoted    = $oDb->quote($sVarName);
01880         $sVarTypeQuoted    = $oDb->quote($sVarType);
01881         $sVarValueQuoted   = $oDb->quote($sValue);
01882         $sConfigKeyQuoted  = $oDb->quote($this->getConfigParam('sConfigKey'));
01883         $sNewOXIDdQuoted   = $oDb->quote(oxUtilsObject::getInstance()->generateUID());
01884 
01885         $sQ = "delete from oxconfig where oxshopid = $sShopIdQuoted and oxvarname = $sVarNameQuoted and oxmodule = $sModuleQuoted";
01886         $oDb->execute( $sQ );
01887 
01888         $sQ = "insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
01889                values($sNewOXIDdQuoted, $sShopIdQuoted, $sModuleQuoted, $sVarNameQuoted, $sVarTypeQuoted, ENCODE( $sVarValueQuoted, $sConfigKeyQuoted) )";
01890         $oDb->execute( $sQ );
01891 
01892 
01893 
01894     }
01895 
01896 
01906     public function getShopConfVar( $sVarName, $sShopId = null, $sModule = '' )
01907     {
01908         if ( !$sShopId ) {
01909             $sShopId = $this->getShopId();
01910         }
01911 
01912         if ( $sShopId === $this->getShopId() && ( !$sModule || $sModule == oxConfig::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme') ) ) {
01913             $sVarValue = $this->getConfigParam( $sVarName );
01914             if ( $sVarValue !== null ) {
01915                 return $sVarValue;
01916             }
01917         }
01918 
01919         $oDb = oxDb::getDb( oxDb::FETCH_MODE_ASSOC );
01920 
01921         $sQ  = "select oxvartype, ".$this->getDecodeValueQuery()." as oxvarvalue from oxconfig where oxshopid = '{$sShopId}' and oxmodule = '{$sModule}' and oxvarname = ".$oDb->quote($sVarName);
01922         $oRs = $oDb->select( $sQ );
01923 
01924         $sValue = null;
01925         if ( $oRs != false && $oRs->recordCount() > 0 ) {
01926             $sValue = $this->decodeValue( $oRs->fields['oxvartype'], $oRs->fields['oxvarvalue'] );
01927         }
01928         return $sValue;
01929     }
01930 
01939     public function decodeValue( $sType, $mOrigValue )
01940     {
01941         $sValue = $mOrigValue;
01942         switch ( $sType ) {
01943             case 'arr':
01944             case 'aarr':
01945                 $sValue = unserialize( $mOrigValue );
01946                 break;
01947             case 'bool':
01948                 $sValue = ( $mOrigValue == 'true' || $mOrigValue == '1' );
01949                 break;
01950         }
01951 
01952         return $sValue;
01953     }
01954 
01962     public function getDecodeValueQuery( $sFieldName = "oxvarvalue" )
01963     {
01964         return " DECODE( {$sFieldName}, '".$this->getConfigParam( 'sConfigKey' )."') ";
01965     }
01966 
01972     public function isProductiveMode()
01973     {
01974         $blProductive = false;
01975 
01976         $blProductive = $this->getConfigParam( 'blProductive' );
01977         if ( !isset( $blProductive ) ) {
01978             $sQ = 'select oxproductive from oxshops where oxid = "'.$this->getShopId().'"';
01979             $blProductive = ( bool ) oxDb::getDb()->getOne( $sQ );
01980             $this->setConfigParam( 'blProductive', $blProductive );
01981         }
01982 
01983         return $blProductive;
01984     }
01985 
01986 
01987 
01993     public function getBaseShopId()
01994     {
01995 
01996             return 'oxbaseshop';
01997     }
01998 
02004     public function getActiveShop()
02005     {
02006         if ( $this->_oActShop && $this->_iShopId == $this->_oActShop->getId() &&
02007              $this->_oActShop->getLanguage() == oxRegistry::getLang()->getBaseLanguage() ) {
02008             return $this->_oActShop;
02009         }
02010 
02011         $this->_oActShop = oxNew( 'oxshop' );
02012         $this->_oActShop->load( $this->getShopId() );
02013         return $this->_oActShop;
02014     }
02015 
02021     public function getActiveView()
02022     {
02023         if ( count( $this->_aActiveViews ) ) {
02024             $oActView = end( $this->_aActiveViews );
02025         }
02026         if ( $oActView == null ) {
02027             $oActView = oxNew( 'oxubase' );
02028             $this->_aActiveViews[] = $oActView;
02029         }
02030 
02031         return $oActView;
02032     }
02033 
02039     public function getTopActiveView()
02040     {
02041         if ( count( $this->_aActiveViews ) ) {
02042             return reset( $this->_aActiveViews );
02043         } else {
02044             return $this->getActiveView();
02045         }
02046     }
02047 
02053     public function getActiveViewsList()
02054     {
02055         return $this->_aActiveViews;
02056     }
02057 
02065     public function setActiveView( $oView )
02066     {
02067         $this->_aActiveViews[] = $oView;
02068     }
02069 
02075     public function dropLastActiveView()
02076     {
02077         array_pop( $this->_aActiveViews );
02078     }
02079 
02085     public function hasActiveViewsChain()
02086     {
02087         return ( count( $this->_aActiveViews ) > 1 );
02088     }
02089 
02095     public function getActiveViewsNames()
02096     {
02097         $aNames = array();
02098 
02099         if ( is_array( $this->getActiveViewsList() ) ) {
02100             foreach ($this->getActiveViewsList() as $oView ) {
02101                 $aNames[] = $oView->getClassName();
02102             }
02103         }
02104 
02105         return $aNames;
02106     }
02107 
02113     public function isUtf()
02114     {
02115         return ( bool ) $this->getConfigParam( 'iUtfMode' );
02116     }
02117 
02123     public function getLogsDir()
02124     {
02125         return $this->getConfigParam( 'sShopDir' ).'log/';
02126     }
02127 
02135     public function isThemeOption( $sName )
02136     {
02137         return (bool) isset( $this->_aThemeConfigParams[$sName] );
02138     }
02139 
02145     public function getShopMainUrl()
02146     {
02147         return $this->_blIsSsl ? $this->getConfigParam( 'sSSLShopURL' ) : $this->getConfigParam( 'sShopURL' );
02148     }
02149 
02155     public function getAllModules()
02156     {
02157         return $this->parseModuleChains($this->getConfigParam('aModules'));
02158     }
02159 
02167     public function parseModuleChains($aModules)
02168     {
02169         $aModuleArray = array();
02170 
02171         if (is_array($aModules)) {
02172             foreach ($aModules as $sClass => $sModuleChain) {
02173                 if (strstr($sModuleChain, '&')) {
02174                     $aModuleChain = explode('&', $sModuleChain);
02175                 } else {
02176                     $aModuleChain = array($sModuleChain);
02177                 }
02178                 $aModuleArray[$sClass] = $aModuleChain;
02179             }
02180         }
02181 
02182         return $aModuleArray;
02183     }
02184 
02190     public function getShopIds()
02191     {
02192         return oxDb::getDb()->getCol( "SELECT `oxid` FROM `oxshops`" );
02193     }
02194 
02195 }