00001 <?php
00002
00008 class oxViewConfig extends oxSuperCfg
00009 {
00010
00016 protected $_oShop = null;
00017
00023 protected $_aViewData = null;
00024
00030 protected $_aConfigParams = array();
00031
00037 protected $_sHelpPageLink = null;
00038
00044 protected $_oCountryList = null;
00045
00051 protected $_aTrustedShopRatings = null;
00052
00058 protected $_sActiveTheme = null;
00059
00065 protected $_sShopLogo = null;
00066
00072 public function getHomeLink()
00073 {
00074 if (($sValue = $this->getViewConfigParam('homeLink')) === null) {
00075 $myConfig = $this->getConfig();
00076 $myUtils = oxRegistry::getUtils();
00077 $oLang = oxRegistry::getLang();
00078 $iLang = $oLang->getBaseLanguage();
00079
00080 $sValue = null;
00081
00082 $blAddStartCl = $myUtils->seoIsActive() && ($iLang != $myConfig->getConfigParam('sDefaultLang'));
00083
00084
00085 if ($blAddStartCl) {
00086 $sValue = oxRegistry::get("oxSeoEncoder")->getStaticUrl($this->getSelfLink() . 'cl=start', $iLang);
00087 $sValue = oxRegistry::get("oxUtilsUrl")->appendUrl(
00088 $sValue,
00089 oxRegistry::get("oxUtilsUrl")->getBaseAddUrlParams()
00090 );
00091 $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
00092 }
00093
00094 if (!$sValue) {
00095 $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
00096 }
00097
00098 $this->setViewConfigParam('homeLink', $sValue);
00099 }
00100
00101 return $sValue;
00102 }
00103
00109 public function getActContentLoadId()
00110 {
00111 $sTplName = oxRegistry::getConfig()->getRequestParameter('oxloadid');
00112
00113 if (!$sTplName && $this->getConfig()->getTopActiveView()) {
00114 $sTplName = $this->getConfig()->getTopActiveView()->getViewConfig()->getViewConfigParam('oxloadid');
00115 }
00116
00117 return $sTplName ? basename($sTplName) : null;
00118 }
00119
00125 public function getActTplName()
00126 {
00127 return oxRegistry::getConfig()->getRequestParameter('tpl');
00128 }
00129
00135 public function getActCurrency()
00136 {
00137 return $this->getConfig()->getShopCurrency();
00138 }
00139
00145 public function getLogoutLink()
00146 {
00147 $sClass = $this->getTopActionClassName();
00148 $sCatnid = $this->getActCatId();
00149 $sMnfid = $this->getActManufacturerId();
00150 $sArtnid = $this->getActArticleId();
00151 $sTplName = $this->getActTplName();
00152 $sContentLoadId = $this->getActContentLoadId();
00153 $sSearchParam = $this->getActSearchParam();
00154 $sSearchTag = $this->getActSearchTag();
00155 $sRecommId = $this->getActRecommendationId();
00156 $sListType = $this->getActListType();
00157
00158 $oConfig = $this->getConfig();
00159
00160 return ($oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl())
00161 . "cl={$sClass}"
00162 . ($sCatnid ? "&cnid={$sCatnid}" : '')
00163 . ($sArtnid ? "&anid={$sArtnid}" : '')
00164 . ($sMnfid ? "&mnid={$sMnfid}" : '')
00165 . ($sSearchParam ? "&searchparam={$sSearchParam}" : '')
00166 . ($sSearchTag ? "&searchtag={$sSearchTag}" : '')
00167 . ($sRecommId ? "&recommid={$sRecommId}" : '')
00168 . ($sListType ? "&listtype={$sListType}" : '')
00169 . "&fnc=logout"
00170 . ($sTplName ? "&tpl=" . basename($sTplName) : '')
00171 . ($sContentLoadId ? "&oxloadid=" . $sContentLoadId : '')
00172 . "&redirect=1";
00173 }
00174
00180 protected function _getHelpContentIdents()
00181 {
00182 $sClass = $this->getActiveClassName();
00183
00184 return array('oxhelp' . strtolower($sClass), 'oxhelpdefault');
00185 }
00186
00192 public function getHelpPageLink()
00193 {
00194 if ($this->_sHelpPageLink === null) {
00195 $this->_sHelpPageLink = "";
00196 $aContentIdents = $this->_getHelpContentIdents();
00197 $oContent = oxNew("oxContent");
00198 foreach ($aContentIdents as $sIdent) {
00199 if ($oContent->loadByIdent($sIdent)) {
00200 $this->_sHelpPageLink = $oContent->getLink();
00201 break;
00202 }
00203 }
00204 }
00205
00206 return $this->_sHelpPageLink;
00207 }
00208
00214 public function getActCatId()
00215 {
00216 return oxRegistry::getConfig()->getRequestParameter('cnid');
00217 }
00218
00224 public function getActArticleId()
00225 {
00226 return oxRegistry::getConfig()->getRequestParameter('anid');
00227 }
00228
00234 public function getActSearchParam()
00235 {
00236 return oxRegistry::getConfig()->getRequestParameter('searchparam');
00237 }
00238
00244 public function getActSearchTag()
00245 {
00246 return oxRegistry::getConfig()->getRequestParameter('searchtag');
00247 }
00248
00254 public function getActRecommendationId()
00255 {
00256 return oxRegistry::getConfig()->getRequestParameter('recommid');
00257 }
00258
00264 public function getActListType()
00265 {
00266 return oxRegistry::getConfig()->getRequestParameter('listtype');
00267 }
00268
00274 public function getActManufacturerId()
00275 {
00276 return oxRegistry::getConfig()->getRequestParameter('mnid');
00277 }
00278
00284 public function getContentId()
00285 {
00286 return oxRegistry::getConfig()->getRequestParameter('oxcid');
00287 }
00288
00297 public function setViewConfigParam($sName, $sValue)
00298 {
00299 startProfile('oxviewconfig::setViewConfigParam');
00300
00301 $this->_aConfigParams[$sName] = $sValue;
00302
00303 stopProfile('oxviewconfig::setViewConfigParam');
00304 }
00305
00313 public function getViewConfigParam($sName)
00314 {
00315 startProfile('oxviewconfig::getViewConfigParam');
00316
00317 if ($this->_oShop && isset($this->_oShop->$sName)) {
00318 $sValue = $this->_oShop->$sName;
00319 } elseif ($this->_aViewData && isset($this->_aViewData[$sName])) {
00320 $sValue = $this->_aViewData[$sName];
00321 } else {
00322 $sValue = (isset($this->_aConfigParams[$sName]) ? $this->_aConfigParams[$sName] : null);
00323 }
00324
00325 stopProfile('oxviewconfig::getViewConfigParam');
00326
00327 return $sValue;
00328 }
00329
00337 public function setViewShop($oShop, $aViewData)
00338 {
00339 $this->_oShop = $oShop;
00340 $this->_aViewData = $aViewData;
00341 }
00342
00350 public function getSessionId()
00351 {
00352 if (($sValue = $this->getViewConfigParam('sessionid')) === null) {
00353 $sValue = $this->getSession()->getId();
00354 $this->setViewConfigParam('sessionid', $sValue);
00355 }
00356
00357 return $sValue;
00358 }
00359
00365 public function getHiddenSid()
00366 {
00367 if (($sValue = $this->getViewConfigParam('hiddensid')) === null) {
00368 $sValue = $this->getSession()->hiddenSid();
00369
00370
00371 if (($sLang = oxRegistry::getLang()->getFormLang())) {
00372 $sValue .= "\n{$sLang}";
00373 }
00374
00375
00376 $this->setViewConfigParam('hiddensid', $sValue);
00377 }
00378
00379 return $sValue;
00380 }
00381
00387 public function getSelfLink()
00388 {
00389 if (($sValue = $this->getViewConfigParam('selflink')) === null) {
00390 $sValue = $this->getConfig()->getShopHomeURL();
00391 $this->setViewConfigParam('selflink', $sValue);
00392 }
00393
00394 return $sValue;
00395 }
00396
00402 public function getSslSelfLink()
00403 {
00404 if ($this->isAdmin()) {
00405
00406 return $this->getSelfLink();
00407 }
00408
00409 if (($sValue = $this->getViewConfigParam('sslselflink')) === null) {
00410 $sValue = $this->getConfig()->getShopSecureHomeURL();
00411 $this->setViewConfigParam('sslselflink', $sValue);
00412 }
00413
00414 return $sValue;
00415 }
00416
00422 public function getBaseDir()
00423 {
00424 if (($sValue = $this->getViewConfigParam('basedir')) === null) {
00425
00426 if ($this->getConfig()->isSsl()) {
00427 $sValue = $this->getConfig()->getSSLShopURL();
00428 } else {
00429 $sValue = $this->getConfig()->getShopURL();
00430 }
00431
00432 $this->setViewConfigParam('basedir', $sValue);
00433 }
00434
00435 return $sValue;
00436 }
00437
00443 public function getCoreUtilsDir()
00444 {
00445 if (($sValue = $this->getViewConfigParam('coreutilsdir')) === null) {
00446 $sValue = $this->getConfig()->getCoreUtilsURL();
00447 $this->setViewConfigParam('coreutilsdir', $sValue);
00448 }
00449
00450 return $sValue;
00451 }
00452
00458 public function getSelfActionLink()
00459 {
00460 if (($sValue = $this->getViewConfigParam('selfactionlink')) === null) {
00461 $sValue = $this->getConfig()->getShopCurrentUrl();
00462 $this->setViewConfigParam('selfactionlink', $sValue);
00463 }
00464
00465 return $sValue;
00466 }
00467
00473 public function getCurrentHomeDir()
00474 {
00475 if (($sValue = $this->getViewConfigParam('currenthomedir')) === null) {
00476 $sValue = $this->getConfig()->getCurrentShopUrl();
00477 $this->setViewConfigParam('currenthomedir', $sValue);
00478 }
00479
00480 return $sValue;
00481 }
00482
00488 public function getBasketLink()
00489 {
00490 if (($sValue = $this->getViewConfigParam('basketlink')) === null) {
00491 $sValue = $this->getConfig()->getShopHomeURL() . 'cl=basket';
00492 $this->setViewConfigParam('basketlink', $sValue);
00493 }
00494
00495 return $sValue;
00496 }
00497
00503 public function getOrderLink()
00504 {
00505 if (($sValue = $this->getViewConfigParam('orderlink')) === null) {
00506 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00507 $this->setViewConfigParam('orderlink', $sValue);
00508 }
00509
00510 return $sValue;
00511 }
00512
00518 public function getPaymentLink()
00519 {
00520 if (($sValue = $this->getViewConfigParam('paymentlink')) === null) {
00521 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00522 $this->setViewConfigParam('paymentlink', $sValue);
00523 }
00524
00525 return $sValue;
00526 }
00527
00533 public function getExeOrderLink()
00534 {
00535 if (($sValue = $this->getViewConfigParam('exeorderlink')) === null) {
00536 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&fnc=execute';
00537 $this->setViewConfigParam('exeorderlink', $sValue);
00538 }
00539
00540 return $sValue;
00541 }
00542
00548 public function getOrderConfirmLink()
00549 {
00550 if (($sValue = $this->getViewConfigParam('orderconfirmlink')) === null) {
00551 $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00552 $this->setViewConfigParam('orderconfirmlink', $sValue);
00553 }
00554
00555 return $sValue;
00556 }
00557
00565 public function getResourceUrl($sFile = null)
00566 {
00567 if ($sFile) {
00568 $sValue = $this->getConfig()->getResourceUrl($sFile, $this->isAdmin());
00569 } elseif (($sValue = $this->getViewConfigParam('basetpldir')) === null) {
00570 $sValue = $this->getConfig()->getResourceUrl('', $this->isAdmin());
00571 $this->setViewConfigParam('basetpldir', $sValue);
00572 }
00573
00574 return $sValue;
00575 }
00576
00582 public function getTemplateDir()
00583 {
00584 if (($sValue = $this->getViewConfigParam('templatedir')) === null) {
00585 $sValue = $this->getConfig()->getTemplateDir($this->isAdmin());
00586 $this->setViewConfigParam('templatedir', $sValue);
00587 }
00588
00589 return $sValue;
00590 }
00591
00597 public function getUrlTemplateDir()
00598 {
00599 if (($sValue = $this->getViewConfigParam('urltemplatedir')) === null) {
00600 $sValue = $this->getConfig()->getTemplateUrl($this->isAdmin());
00601 $this->setViewConfigParam('urltemplatedir', $sValue);
00602 }
00603
00604 return $sValue;
00605 }
00606
00615 public function getImageUrl($sFile = null, $bSsl = null)
00616 {
00617 if ($sFile) {
00618 $sValue = $this->getConfig()->getImageUrl($this->isAdmin(), $bSsl, null, $sFile);
00619 } elseif (($sValue = $this->getViewConfigParam('imagedir')) === null) {
00620 $sValue = $this->getConfig()->getImageUrl($this->isAdmin(), $bSsl);
00621 $this->setViewConfigParam('imagedir', $sValue);
00622 }
00623
00624 return $sValue;
00625 }
00626
00632 public function getNoSslImageDir()
00633 {
00634 if (($sValue = $this->getViewConfigParam('nossl_imagedir')) === null) {
00635 $sValue = $this->getConfig()->getImageUrl($this->isAdmin(), false);
00636 $this->setViewConfigParam('nossl_imagedir', $sValue);
00637 }
00638
00639 return $sValue;
00640 }
00641
00648 public function getPictureDir()
00649 {
00650 if (($sValue = $this->getViewConfigParam('picturedir')) === null) {
00651 $sValue = $this->getConfig()->getPictureUrl(null, $this->isAdmin());
00652 $this->setViewConfigParam('picturedir', $sValue);
00653 }
00654
00655 return $sValue;
00656 }
00657
00663 public function getAdminDir()
00664 {
00665 if (($sValue = $this->getViewConfigParam('sAdminDir')) === null) {
00666 $sValue = $this->getConfig()->getConfigParam('sAdminDir');
00667 $this->setViewConfigParam('sAdminDir', $sValue);
00668 }
00669
00670 return $sValue;
00671 }
00672
00678 public function getActiveShopId()
00679 {
00680 if (($sValue = $this->getViewConfigParam('shopid')) === null) {
00681 $sValue = $this->getConfig()->getShopId();
00682 $this->setViewConfigParam('shopid', $sValue);
00683 }
00684
00685 return $sValue;
00686 }
00687
00693 public function isSsl()
00694 {
00695 if (($sValue = $this->getViewConfigParam('isssl')) === null) {
00696 $sValue = $this->getConfig()->isSsl();
00697 $this->setViewConfigParam('isssl', $sValue);
00698 }
00699
00700 return $sValue;
00701 }
00702
00703
00709 public function getRemoteAddress()
00710 {
00711 if (($sValue = $this->getViewConfigParam('ip')) === null) {
00712 $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
00713 $this->setViewConfigParam('ip', $sValue);
00714 }
00715
00716 return $sValue;
00717 }
00718
00724 public function getPopupIdent()
00725 {
00726 if (($sValue = $this->getViewConfigParam('popupident')) === null) {
00727 $sValue = md5($this->getConfig()->getShopUrl());
00728 $this->setViewConfigParam('popupident', $sValue);
00729 }
00730
00731 return $sValue;
00732 }
00733
00739 public function getPopupIdentRand()
00740 {
00741 if (($sValue = $this->getViewConfigParam('popupidentrand')) === null) {
00742 $sValue = md5(time());
00743 $this->setViewConfigParam('popupidentrand', $sValue);
00744 }
00745
00746 return $sValue;
00747 }
00748
00754 public function getArtPerPageForm()
00755 {
00756 if (($sValue = $this->getViewConfigParam('artperpageform')) === null) {
00757 $sValue = $this->getConfig()->getShopCurrentUrl();
00758 $this->setViewConfigParam('artperpageform', $sValue);
00759 }
00760
00761 return $sValue;
00762 }
00763
00769 public function isBuyableParent()
00770 {
00771 return $this->getConfig()->getConfigParam('blVariantParentBuyable');
00772 }
00773
00779 public function showBirthdayFields()
00780 {
00781 return $this->getConfig()->getConfigParam('blShowBirthdayFields');
00782 }
00783
00791 public function showFinalStep()
00792 {
00793 return true;
00794 }
00795
00801 public function getNrOfCatArticles()
00802 {
00803 $sListType = oxRegistry::getSession()->getVariable('ldtype');
00804
00805 if (is_null($sListType)) {
00806 $sListType = oxRegistry::getConfig()->getConfigParam('sDefaultListDisplayType');
00807 }
00808
00809 if ('grid' === $sListType) {
00810 $aNrOfCatArticles = oxRegistry::getConfig()->getConfigParam('aNrofCatArticlesInGrid');
00811 } else {
00812 $aNrOfCatArticles = oxRegistry::getConfig()->getConfigParam('aNrofCatArticles');
00813 }
00814
00815 return $aNrOfCatArticles;
00816 }
00817
00823 public function getShowWishlist()
00824 {
00825 return $this->getConfig()->getConfigParam('bl_showWishlist');
00826 }
00827
00833 public function getShowCompareList()
00834 {
00835 $myConfig = $this->getConfig();
00836 $blShowCompareList = true;
00837
00838 if (!$myConfig->getConfigParam('bl_showCompareList') ||
00839 ($myConfig->getConfigParam('blDisableNavBars') && $myConfig->getActiveView()->getIsOrderStep())
00840 ) {
00841 $blShowCompareList = false;
00842 }
00843
00844 return $blShowCompareList;
00845 }
00846
00852 public function getShowListmania()
00853 {
00854 return $this->getConfig()->getConfigParam('bl_showListmania');
00855 }
00856
00862 public function getShowVouchers()
00863 {
00864 return $this->getConfig()->getConfigParam('bl_showVouchers');
00865 }
00866
00872 public function getShowGiftWrapping()
00873 {
00874 return $this->getConfig()->getConfigParam('bl_showGiftWrapping');
00875 }
00876
00882 public function getActLanguageId()
00883 {
00884 if (($sValue = $this->getViewConfigParam('lang')) === null) {
00885 $iLang = oxRegistry::getConfig()->getRequestParameter('lang');
00886 $sValue = ($iLang !== null) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00887 $this->setViewConfigParam('lang', $sValue);
00888 }
00889
00890 return $sValue;
00891 }
00892
00898 public function getActLanguageAbbr()
00899 {
00900 return oxRegistry::getLang()->getLanguageAbbr($this->getActLanguageId());
00901 }
00902
00908 public function getActiveClassName()
00909 {
00910 return $this->getConfig()->getActiveView()->getClassName();
00911 }
00912
00919 public function getTopActiveClassName()
00920 {
00921 return $this->getConfig()->getTopActiveView()->getClassName();
00922 }
00923
00929 public function getArtPerPageCount()
00930 {
00931 return $this->getViewConfigParam('iartPerPage');
00932 }
00933
00939 public function getNavUrlParams()
00940 {
00941 if (($sParams = $this->getViewConfigParam('navurlparams')) === null) {
00942 $sParams = '';
00943 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00944 foreach ($aNavParams as $sName => $sValue) {
00945 if (isset($sValue)) {
00946 if ($sParams) {
00947 $sParams .= '&';
00948 }
00949 $sParams .= "{$sName}=" . rawurlencode($sValue);
00950 }
00951 }
00952 if ($sParams) {
00953 $sParams = '&' . $sParams;
00954 }
00955 $this->setViewConfigParam('navurlparams', $sParams);
00956 }
00957
00958 return $sParams;
00959 }
00960
00966 public function getNavFormParams()
00967 {
00968
00969 if (($sParams = $this->getViewConfigParam('navformparams')) === null) {
00970 $oStr = getStr();
00971 $sParams = '';
00972 $aNavParams = $this->getConfig()->getTopActiveView()->getNavigationParams();
00973 foreach ($aNavParams as $sName => $sValue) {
00974 if (isset($sValue)) {
00975 $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"";
00976 $sParams .= $oStr->htmlentities($sValue) . "\" />\n";
00977 }
00978 }
00979 $this->setViewConfigParam('navformparams', $sParams);
00980 }
00981
00982 return $sParams;
00983 }
00984
00990 public function getStockOnDefaultMessage()
00991 {
00992 return $this->getConfig()->getConfigParam('blStockOnDefaultMessage');
00993 }
00994
01000 public function getStockOffDefaultMessage()
01001 {
01002 return $this->getConfig()->getConfigParam('blStockOffDefaultMessage');
01003 }
01004
01010 public function getShopVersion()
01011 {
01012 return $this->getViewConfigParam('sShopVersion');
01013 }
01014
01020 public function getAjaxLink()
01021 {
01022 return $this->getViewConfigParam('ajaxlink');
01023 }
01024
01030 public function isMultiShop()
01031 {
01032 $oShop = $this->getConfig()->getActiveShop();
01033
01034 return isset($oShop->oxshops__oxismultishop) ? ((bool) $oShop->oxshops__oxismultishop->value) : false;
01035 }
01036
01042 public function getServiceUrl()
01043 {
01044 return $this->getViewConfigParam('sServiceUrl');
01045 }
01046
01053 public function getRemoteAccessToken()
01054 {
01055 $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
01056
01057 return $sRaToken;
01058 }
01059
01066 public function getActionClassName()
01067 {
01068 return $this->getConfig()->getActiveView()->getActionClassName();
01069 }
01070
01077 public function getTopActionClassName()
01078 {
01079 return $this->getConfig()->getTopActiveView()->getActionClassName();
01080 }
01081
01087 public function getFbAppId()
01088 {
01089 return $this->getConfig()->getConfigParam('sFbAppId');
01090 }
01091
01097 public function getShowBasketTimeout()
01098 {
01099 return $this->getConfig()->getConfigParam('blPsBasketReservationEnabled')
01100 && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
01101 }
01102
01108 public function getBasketTimeLeft()
01109 {
01110 if (!isset($this->_dBasketTimeLeft)) {
01111 $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01112 }
01113
01114 return $this->_dBasketTimeLeft;
01115 }
01116
01123 public function getShowFbConnect()
01124 {
01125 $myConfig = $this->getConfig();
01126
01127 if ($myConfig->getConfigParam('bl_showFbConnect')) {
01128 if ($myConfig->getConfigParam("sFbAppId") && $myConfig->getConfigParam("sFbSecretKey")) {
01129 return true;
01130 }
01131 }
01132
01133 return false;
01134 }
01135
01141 public function getTsDomain()
01142 {
01143 $sDomain = false;
01144 $aTsConfig = $this->getConfig()->getConfigParam("aTsConfig");
01145 if (is_array($aTsConfig)) {
01146 $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01147 }
01148
01149 return $sDomain;
01150 }
01151
01157 public function getTsRatings()
01158 {
01159 if ($this->_aTrustedShopRatings === null) {
01160 $sTsId = $this->getTsId();
01161 if ($sTsId) {
01162 $oTsRatings = oxNew("oxTsRatings");
01163 $oTsRatings->setTsId($sTsId);
01164 $this->_aTrustedShopRatings = $oTsRatings->getRatings();
01165
01166 return $this->_aTrustedShopRatings;
01167 }
01168 }
01169
01170 return $this->_aTrustedShopRatings;
01171 }
01172
01178 public function getTsRatingUrl()
01179 {
01180 $sUrl = false;
01181 $sTsId = $this->getTsId();
01182 if ($sTsId) {
01183 $sTsUrl = $this->getTsDomain();
01184
01185 $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01186 $aTsConfig = $this->getConfig()->getConfigParam("aTsConfig");
01187 if (isset($aTsConfig["sTsRatingUri"]) && isset($aTsConfig["sTsRatingUri"][$sLangId])) {
01188 $sTsRateUri = $aTsConfig["sTsRatingUri"][$sLangId];
01189 } else {
01190 $sTsRateUri = false;
01191 }
01192
01193 if ($sTsUrl && $sTsRateUri) {
01194 $sUrl = sprintf("{$sTsUrl}/{$sTsRateUri}", $sTsId);
01195 }
01196 }
01197
01198 return $sUrl;
01199 }
01200
01208 public function showTs($sType)
01209 {
01210 $blShow = false;
01211 switch ($sType) {
01212 case "WIDGET":
01213 $blShow = (bool) $this->getConfig()->getConfigParam("blTsWidget");
01214 break;
01215 case "THANKYOU":
01216 $blShow = (bool) $this->getConfig()->getConfigParam("blTsThankyouReview");
01217 break;
01218 case "ORDEREMAIL":
01219 $blShow = (bool) $this->getConfig()->getConfigParam("blTsOrderEmailReview");
01220 break;
01221 case "ORDERCONFEMAIL":
01222 $blShow = (bool) $this->getConfig()->getConfigParam("blTsOrderSendEmailReview");
01223 break;
01224 }
01225
01226 return $blShow;
01227 }
01228
01234 public function getTsId()
01235 {
01236 $sTsId = false;
01237 $oConfig = $this->getConfig();
01238 $aLangIds = $oConfig->getConfigParam("aTsLangIds");
01239 $aActInfo = $oConfig->getConfigParam("aTsActiveLangIds");
01240
01241
01242 $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01243 if (isset($aActInfo[$sLangId]) && $aActInfo[$sLangId] &&
01244 isset($aLangIds[$sLangId]) && $aLangIds[$sLangId]
01245 ) {
01246 $sTsId = $aLangIds[$sLangId];
01247 }
01248
01249 return $sTsId;
01250 }
01251
01257 public function isTplBlocksDebugMode()
01258 {
01259 return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01260 }
01261
01267 public function getPasswordLength()
01268 {
01269 $iPasswordLength = 6;
01270
01271 $oConfig = $this->getConfig();
01272
01273 if ($oConfig->getConfigParam("iPasswordLength")) {
01274 $iPasswordLength = $oConfig->getConfigParam("iPasswordLength");
01275 }
01276
01277 return $iPasswordLength;
01278 }
01279
01285 public function getCountryList()
01286 {
01287 if ($this->_oCountryList === null) {
01288
01289 $this->_oCountryList = oxNew('oxcountrylist');
01290 $this->_oCountryList->loadActiveCountries();
01291 }
01292
01293 return $this->_oCountryList;
01294 }
01295
01296
01307 public function getModulePath($sModule, $sFile = '')
01308 {
01309 if (!$sFile || ($sFile[0] != '/')) {
01310 $sFile = '/' . $sFile;
01311 }
01312 $oModule = oxNew("oxmodule");
01313 $sModulePath = $oModule->getModulePath($sModule);
01314 $sFile = $this->getConfig()->getModulesDir() . $sModulePath . $sFile;
01315 if (file_exists($sFile) || is_dir($sFile)) {
01316 return $sFile;
01317 } else {
01319 $oEx = oxNew("oxFileException", "Requested file not found for module $sModule ($sFile)");
01320 $oEx->debugOut();
01321 if (!$this->getConfig()->getConfigParam('iDebug')) {
01322 return '';
01323 }
01324 throw $oEx;
01325 }
01326 }
01327
01338 public function getModuleUrl($sModule, $sFile = '')
01339 {
01340 $sUrl = str_replace(
01341 rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01342 rtrim($this->getConfig()->getCurrentShopUrl(false), '/'),
01343 $this->getModulePath($sModule, $sFile)
01344 );
01345
01346 return $sUrl;
01347 }
01348
01359 public function isModuleActive($sModuleId, $sVersionFrom = null, $sVersionTo = null)
01360 {
01361 $blModuleIsActive = false;
01362
01363 $aModules = $this->getConfig()->getConfigParam('aModules');
01364
01365 if (is_array($aModules)) {
01366 $blModuleIsActive = $this->_moduleExists($sModuleId, $aModules);
01367
01368 if ($blModuleIsActive) {
01369 $blModuleIsActive = $this->_isModuleEnabled($sModuleId) && $this->_isModuleVersionCorrect($sModuleId, $sVersionFrom, $sVersionTo);
01370 }
01371 }
01372
01373 return $blModuleIsActive;
01374 }
01375
01383 public function getViewThemeParam($sName)
01384 {
01385 $sValue = false;
01386
01387 if ($this->getConfig()->isThemeOption($sName)) {
01388 $sValue = $this->getConfig()->getConfigParam($sName);
01389 }
01390
01391 return $sValue;
01392 }
01393
01394
01400 public function showSelectLists()
01401 {
01402 return (bool) $this->getConfig()->getConfigParam('bl_perfLoadSelectLists');
01403 }
01404
01410 public function showSelectListsInList()
01411 {
01412 return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam('bl_perfLoadSelectListsInAList');
01413 }
01414
01415
01416
01422 public function isAltImageServerConfigured()
01423 {
01424 $oConfig = $this->getConfig();
01425
01426 return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01427 $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01428 }
01429
01437 public function isFunctionalityEnabled($sParamName)
01438 {
01439 return (bool) $this->getConfig()->getConfigParam($sParamName);
01440 }
01441
01447 public function getActiveTheme()
01448 {
01449 if ($this->_sActiveTheme === null) {
01450 $oTheme = oxNew('oxTheme');
01451 $this->_sActiveTheme = $oTheme->getActiveThemeId();
01452 }
01453
01454 return $this->_sActiveTheme;
01455 }
01456
01462 public function getShopLogo()
01463 {
01464 if (is_null($this->_sShopLogo)) {
01465
01466 $sLogoImage = $this->getConfig()->getConfigParam('sShopLogo');
01467 if (empty($sLogoImage)) {
01468 $sLogoImage = "logo.png";
01469 }
01470
01471 $this->setShopLogo($sLogoImage);
01472 }
01473
01474 return $this->_sShopLogo;
01475 }
01476
01482 public function setShopLogo($sLogo)
01483 {
01484 $this->_sShopLogo = $sLogo;
01485 }
01486
01492 public function getSessionChallengeToken()
01493 {
01494 if (oxRegistry::getSession()->isSessionStarted()) {
01495 $sessionChallengeToken = $this->getSession()->getSessionChallengeToken();
01496 } else {
01497 $sessionChallengeToken = "";
01498 }
01499
01500 return $sessionChallengeToken;
01501 }
01502
01511 private function _moduleExists($sModuleId, $aModules)
01512 {
01513 $blModuleExists = false;
01514 foreach ($aModules as $sExtendPath) {
01515 if (false !== strpos($sExtendPath, '/' . $sModuleId . '/')) {
01516 $blModuleExists = true;
01517 break;
01518 }
01519 }
01520 return $blModuleExists;
01521 }
01522
01530 private function _isModuleEnabled($sModuleId)
01531 {
01532 $blModuleIsActive = false;
01533
01534 $aDisabledModules = $this->getConfig()->getConfigParam('aDisabledModules');
01535 if (!(is_array($aDisabledModules) && in_array($sModuleId, $aDisabledModules))) {
01536 $blModuleIsActive = true;
01537 }
01538 return $blModuleIsActive;
01539 }
01540
01550 private function _isModuleVersionCorrect($sModuleId, $sVersionFrom, $sVersionTo)
01551 {
01552 $blModuleIsActive = true;
01553
01554 $aModuleVersions = $this->getConfig()->getConfigParam('aModuleVersions');
01555
01556 if ($sVersionFrom && !version_compare($aModuleVersions[$sModuleId], $sVersionFrom, '>=')) {
01557 $blModuleIsActive = false;
01558 }
01559
01560 if ($blModuleIsActive && $sVersionTo && !version_compare($aModuleVersions[$sModuleId], $sVersionTo, '<')) {
01561 $blModuleIsActive = false;
01562 }
01563
01564 return $blModuleIsActive;
01565 }
01566
01572 public function getEdition()
01573 {
01574 return $this->getConfig()->getEdition();
01575 }
01576 }