OXID eShop CE  4.9.7
 All Classes Files Functions Variables Pages
oxviewconfig.php
Go to the documentation of this file.
1 <?php
2 
8 class oxViewConfig extends oxSuperCfg
9 {
10 
16  protected $_oShop = null;
17 
23  protected $_aViewData = null;
24 
30  protected $_aConfigParams = array();
31 
37  protected $_sHelpPageLink = null;
38 
44  protected $_oCountryList = null;
45 
51  protected $_aTrustedShopRatings = null;
52 
58  protected $_sActiveTheme = null;
59 
65  protected $_sShopLogo = null;
66 
72  public function getHomeLink()
73  {
74  if (($sValue = $this->getViewConfigParam('homeLink')) === null) {
75  $myConfig = $this->getConfig();
76  $myUtils = oxRegistry::getUtils();
77  $oLang = oxRegistry::getLang();
78  $iLang = $oLang->getBaseLanguage();
79 
80  $sValue = null;
81 
82  $blAddStartCl = $myUtils->seoIsActive() && ($iLang != $myConfig->getConfigParam('sDefaultLang'));
83 
84 
85  if ($blAddStartCl) {
86  $sValue = oxRegistry::get("oxSeoEncoder")->getStaticUrl($this->getSelfLink() . 'cl=start', $iLang);
87  $sValue = oxRegistry::get("oxUtilsUrl")->appendUrl(
88  $sValue,
89  oxRegistry::get("oxUtilsUrl")->getBaseAddUrlParams()
90  );
91  $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
92  }
93 
94  if (!$sValue) {
95  $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
96  }
97 
98  $this->setViewConfigParam('homeLink', $sValue);
99  }
100 
101  return $sValue;
102  }
103 
109  public function getActContentLoadId()
110  {
111  $sTplName = oxRegistry::getConfig()->getRequestParameter('oxloadid');
112  // #M1176: Logout from CMS page
113  if (!$sTplName && $this->getConfig()->getTopActiveView()) {
114  $sTplName = $this->getConfig()->getTopActiveView()->getViewConfig()->getViewConfigParam('oxloadid');
115  }
116 
117  return $sTplName ? basename($sTplName) : null;
118  }
119 
125  public function getActTplName()
126  {
127  return oxRegistry::getConfig()->getRequestParameter('tpl');
128  }
129 
135  public function getActCurrency()
136  {
137  return $this->getConfig()->getShopCurrency();
138  }
139 
145  public function getLogoutLink()
146  {
147  $sClass = $this->getTopActionClassName();
148  $sCatnid = $this->getActCatId();
149  $sMnfid = $this->getActManufacturerId();
150  $sArtnid = $this->getActArticleId();
151  $sTplName = $this->getActTplName();
152  $sContentLoadId = $this->getActContentLoadId();
153  $sSearchParam = $this->getActSearchParam();
154  $sSearchTag = $this->getActSearchTag();
155  $sRecommId = $this->getActRecommendationId();
156  $sListType = $this->getActListType();
157 
158  $oConfig = $this->getConfig();
159 
160  return ($oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl())
161  . "cl={$sClass}"
162  . ($sCatnid ? "&amp;cnid={$sCatnid}" : '')
163  . ($sArtnid ? "&amp;anid={$sArtnid}" : '')
164  . ($sMnfid ? "&amp;mnid={$sMnfid}" : '')
165  . ($sSearchParam ? "&amp;searchparam={$sSearchParam}" : '')
166  . ($sSearchTag ? "&amp;searchtag={$sSearchTag}" : '')
167  . ($sRecommId ? "&amp;recommid={$sRecommId}" : '')
168  . ($sListType ? "&amp;listtype={$sListType}" : '')
169  . "&amp;fnc=logout"
170  . ($sTplName ? "&amp;tpl=" . basename($sTplName) : '')
171  . ($sContentLoadId ? "&amp;oxloadid=" . $sContentLoadId : '')
172  . "&amp;redirect=1";
173  }
174 
180  protected function _getHelpContentIdents()
181  {
182  $sClass = $this->getActiveClassName();
183 
184  return array('oxhelp' . strtolower($sClass), 'oxhelpdefault');
185  }
186 
192  public function getHelpPageLink()
193  {
194  if ($this->_sHelpPageLink === null) {
195  $this->_sHelpPageLink = "";
196  $aContentIdents = $this->_getHelpContentIdents();
197  $oContent = oxNew("oxContent");
198  foreach ($aContentIdents as $sIdent) {
199  if ($oContent->loadByIdent($sIdent)) {
200  $this->_sHelpPageLink = $oContent->getLink();
201  break;
202  }
203  }
204  }
205 
206  return $this->_sHelpPageLink;
207  }
208 
214  public function getActCatId()
215  {
216  return oxRegistry::getConfig()->getRequestParameter('cnid');
217  }
218 
224  public function getActArticleId()
225  {
226  return oxRegistry::getConfig()->getRequestParameter('anid');
227  }
228 
234  public function getActSearchParam()
235  {
236  return oxRegistry::getConfig()->getRequestParameter('searchparam');
237  }
238 
244  public function getActSearchTag()
245  {
246  return oxRegistry::getConfig()->getRequestParameter('searchtag');
247  }
248 
254  public function getActRecommendationId()
255  {
256  return oxRegistry::getConfig()->getRequestParameter('recommid');
257  }
258 
264  public function getActListType()
265  {
266  return oxRegistry::getConfig()->getRequestParameter('listtype');
267  }
268 
274  public function getActManufacturerId()
275  {
276  return oxRegistry::getConfig()->getRequestParameter('mnid');
277  }
278 
284  public function getContentId()
285  {
286  return oxRegistry::getConfig()->getRequestParameter('oxcid');
287  }
288 
297  public function setViewConfigParam($sName, $sValue)
298  {
299  startProfile('oxviewconfig::setViewConfigParam');
300 
301  $this->_aConfigParams[$sName] = $sValue;
302 
303  stopProfile('oxviewconfig::setViewConfigParam');
304  }
305 
313  public function getViewConfigParam($sName)
314  {
315  startProfile('oxviewconfig::getViewConfigParam');
316 
317  if ($this->_oShop && isset($this->_oShop->$sName)) {
318  $sValue = $this->_oShop->$sName;
319  } elseif ($this->_aViewData && isset($this->_aViewData[$sName])) {
320  $sValue = $this->_aViewData[$sName];
321  } else {
322  $sValue = (isset($this->_aConfigParams[$sName]) ? $this->_aConfigParams[$sName] : null);
323  }
324 
325  stopProfile('oxviewconfig::getViewConfigParam');
326 
327  return $sValue;
328  }
329 
337  public function setViewShop($oShop, $aViewData)
338  {
339  $this->_oShop = $oShop;
340  $this->_aViewData = $aViewData;
341  }
342 
350  public function getSessionId()
351  {
352  if (($sValue = $this->getViewConfigParam('sessionid')) === null) {
353  $sValue = $this->getSession()->getId();
354  $this->setViewConfigParam('sessionid', $sValue);
355  }
356 
357  return $sValue;
358  }
359 
365  public function getHiddenSid()
366  {
367  if (($sValue = $this->getViewConfigParam('hiddensid')) === null) {
368  $sValue = $this->getSession()->hiddenSid();
369 
370  // appending language info to form
371  if (($sLang = oxRegistry::getLang()->getFormLang())) {
372  $sValue .= "\n{$sLang}";
373  }
374 
375 
376  $this->setViewConfigParam('hiddensid', $sValue);
377  }
378 
379  return $sValue;
380  }
381 
387  public function getSelfLink()
388  {
389  if (($sValue = $this->getViewConfigParam('selflink')) === null) {
390  $sValue = $this->getConfig()->getShopHomeURL();
391  $this->setViewConfigParam('selflink', $sValue);
392  }
393 
394  return $sValue;
395  }
396 
402  public function getSslSelfLink()
403  {
404  if ($this->isAdmin()) {
405  // using getSelfLink() method in admin mode (#2745)
406  return $this->getSelfLink();
407  }
408 
409  if (($sValue = $this->getViewConfigParam('sslselflink')) === null) {
410  $sValue = $this->getConfig()->getShopSecureHomeURL();
411  $this->setViewConfigParam('sslselflink', $sValue);
412  }
413 
414  return $sValue;
415  }
416 
422  public function getBaseDir()
423  {
424  if (($sValue = $this->getViewConfigParam('basedir')) === null) {
425 
426  if ($this->getConfig()->isSsl()) {
427  $sValue = $this->getConfig()->getSSLShopURL();
428  } else {
429  $sValue = $this->getConfig()->getShopURL();
430  }
431 
432  $this->setViewConfigParam('basedir', $sValue);
433  }
434 
435  return $sValue;
436  }
437 
443  public function getCoreUtilsDir()
444  {
445  if (($sValue = $this->getViewConfigParam('coreutilsdir')) === null) {
446  $sValue = $this->getConfig()->getCoreUtilsURL();
447  $this->setViewConfigParam('coreutilsdir', $sValue);
448  }
449 
450  return $sValue;
451  }
452 
458  public function getSelfActionLink()
459  {
460  if (($sValue = $this->getViewConfigParam('selfactionlink')) === null) {
461  $sValue = $this->getConfig()->getShopCurrentUrl();
462  $this->setViewConfigParam('selfactionlink', $sValue);
463  }
464 
465  return $sValue;
466  }
467 
473  public function getCurrentHomeDir()
474  {
475  if (($sValue = $this->getViewConfigParam('currenthomedir')) === null) {
476  $sValue = $this->getConfig()->getCurrentShopUrl();
477  $this->setViewConfigParam('currenthomedir', $sValue);
478  }
479 
480  return $sValue;
481  }
482 
488  public function getBasketLink()
489  {
490  if (($sValue = $this->getViewConfigParam('basketlink')) === null) {
491  $sValue = $this->getConfig()->getShopHomeURL() . 'cl=basket';
492  $this->setViewConfigParam('basketlink', $sValue);
493  }
494 
495  return $sValue;
496  }
497 
503  public function getOrderLink()
504  {
505  if (($sValue = $this->getViewConfigParam('orderlink')) === null) {
506  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
507  $this->setViewConfigParam('orderlink', $sValue);
508  }
509 
510  return $sValue;
511  }
512 
518  public function getPaymentLink()
519  {
520  if (($sValue = $this->getViewConfigParam('paymentlink')) === null) {
521  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
522  $this->setViewConfigParam('paymentlink', $sValue);
523  }
524 
525  return $sValue;
526  }
527 
533  public function getExeOrderLink()
534  {
535  if (($sValue = $this->getViewConfigParam('exeorderlink')) === null) {
536  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
537  $this->setViewConfigParam('exeorderlink', $sValue);
538  }
539 
540  return $sValue;
541  }
542 
548  public function getOrderConfirmLink()
549  {
550  if (($sValue = $this->getViewConfigParam('orderconfirmlink')) === null) {
551  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
552  $this->setViewConfigParam('orderconfirmlink', $sValue);
553  }
554 
555  return $sValue;
556  }
557 
565  public function getResourceUrl($sFile = null)
566  {
567  if ($sFile) {
568  $sValue = $this->getConfig()->getResourceUrl($sFile, $this->isAdmin());
569  } elseif (($sValue = $this->getViewConfigParam('basetpldir')) === null) {
570  $sValue = $this->getConfig()->getResourceUrl('', $this->isAdmin());
571  $this->setViewConfigParam('basetpldir', $sValue);
572  }
573 
574  return $sValue;
575  }
576 
582  public function getTemplateDir()
583  {
584  if (($sValue = $this->getViewConfigParam('templatedir')) === null) {
585  $sValue = $this->getConfig()->getTemplateDir($this->isAdmin());
586  $this->setViewConfigParam('templatedir', $sValue);
587  }
588 
589  return $sValue;
590  }
591 
597  public function getUrlTemplateDir()
598  {
599  if (($sValue = $this->getViewConfigParam('urltemplatedir')) === null) {
600  $sValue = $this->getConfig()->getTemplateUrl($this->isAdmin());
601  $this->setViewConfigParam('urltemplatedir', $sValue);
602  }
603 
604  return $sValue;
605  }
606 
615  public function getImageUrl($sFile = null, $bSsl = null)
616  {
617  if ($sFile) {
618  $sValue = $this->getConfig()->getImageUrl($this->isAdmin(), $bSsl, null, $sFile);
619  } elseif (($sValue = $this->getViewConfigParam('imagedir')) === null) {
620  $sValue = $this->getConfig()->getImageUrl($this->isAdmin(), $bSsl);
621  $this->setViewConfigParam('imagedir', $sValue);
622  }
623 
624  return $sValue;
625  }
626 
632  public function getNoSslImageDir()
633  {
634  if (($sValue = $this->getViewConfigParam('nossl_imagedir')) === null) {
635  $sValue = $this->getConfig()->getImageUrl($this->isAdmin(), false);
636  $this->setViewConfigParam('nossl_imagedir', $sValue);
637  }
638 
639  return $sValue;
640  }
641 
648  public function getPictureDir()
649  {
650  if (($sValue = $this->getViewConfigParam('picturedir')) === null) {
651  $sValue = $this->getConfig()->getPictureUrl(null, $this->isAdmin());
652  $this->setViewConfigParam('picturedir', $sValue);
653  }
654 
655  return $sValue;
656  }
657 
663  public function getAdminDir()
664  {
665  if (($sValue = $this->getViewConfigParam('sAdminDir')) === null) {
666  $sValue = $this->getConfig()->getConfigParam('sAdminDir');
667  $this->setViewConfigParam('sAdminDir', $sValue);
668  }
669 
670  return $sValue;
671  }
672 
678  public function getActiveShopId()
679  {
680  if (($sValue = $this->getViewConfigParam('shopid')) === null) {
681  $sValue = $this->getConfig()->getShopId();
682  $this->setViewConfigParam('shopid', $sValue);
683  }
684 
685  return $sValue;
686  }
687 
693  public function isSsl()
694  {
695  if (($sValue = $this->getViewConfigParam('isssl')) === null) {
696  $sValue = $this->getConfig()->isSsl();
697  $this->setViewConfigParam('isssl', $sValue);
698  }
699 
700  return $sValue;
701  }
702 
703 
709  public function getRemoteAddress()
710  {
711  if (($sValue = $this->getViewConfigParam('ip')) === null) {
712  $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
713  $this->setViewConfigParam('ip', $sValue);
714  }
715 
716  return $sValue;
717  }
718 
724  public function getPopupIdent()
725  {
726  if (($sValue = $this->getViewConfigParam('popupident')) === null) {
727  $sValue = md5($this->getConfig()->getShopUrl());
728  $this->setViewConfigParam('popupident', $sValue);
729  }
730 
731  return $sValue;
732  }
733 
739  public function getPopupIdentRand()
740  {
741  if (($sValue = $this->getViewConfigParam('popupidentrand')) === null) {
742  $sValue = md5(time());
743  $this->setViewConfigParam('popupidentrand', $sValue);
744  }
745 
746  return $sValue;
747  }
748 
754  public function getArtPerPageForm()
755  {
756  if (($sValue = $this->getViewConfigParam('artperpageform')) === null) {
757  $sValue = $this->getConfig()->getShopCurrentUrl();
758  $this->setViewConfigParam('artperpageform', $sValue);
759  }
760 
761  return $sValue;
762  }
763 
769  public function isBuyableParent()
770  {
771  return $this->getConfig()->getConfigParam('blVariantParentBuyable');
772  }
773 
779  public function showBirthdayFields()
780  {
781  return $this->getConfig()->getConfigParam('blShowBirthdayFields');
782  }
783 
791  public function showFinalStep()
792  {
793  return true;
794  }
795 
801  public function getNrOfCatArticles()
802  {
803  $sListType = oxRegistry::getSession()->getVariable('ldtype');
804 
805  if (is_null($sListType)) {
806  $sListType = oxRegistry::getConfig()->getConfigParam('sDefaultListDisplayType');
807  }
808 
809  if ('grid' === $sListType) {
810  $aNrOfCatArticles = oxRegistry::getConfig()->getConfigParam('aNrofCatArticlesInGrid');
811  } else {
812  $aNrOfCatArticles = oxRegistry::getConfig()->getConfigParam('aNrofCatArticles');
813  }
814 
815  return $aNrOfCatArticles;
816  }
817 
823  public function getShowWishlist()
824  {
825  return $this->getConfig()->getConfigParam('bl_showWishlist');
826  }
827 
833  public function getShowCompareList()
834  {
835  $myConfig = $this->getConfig();
836  $blShowCompareList = true;
837 
838  if (!$myConfig->getConfigParam('bl_showCompareList') ||
839  ($myConfig->getConfigParam('blDisableNavBars') && $myConfig->getActiveView()->getIsOrderStep())
840  ) {
841  $blShowCompareList = false;
842  }
843 
844  return $blShowCompareList;
845  }
846 
852  public function getShowListmania()
853  {
854  return $this->getConfig()->getConfigParam('bl_showListmania');
855  }
856 
862  public function getShowVouchers()
863  {
864  return $this->getConfig()->getConfigParam('bl_showVouchers');
865  }
866 
872  public function getShowGiftWrapping()
873  {
874  return $this->getConfig()->getConfigParam('bl_showGiftWrapping');
875  }
876 
882  public function getActLanguageId()
883  {
884  if (($sValue = $this->getViewConfigParam('lang')) === null) {
885  $iLang = oxRegistry::getConfig()->getRequestParameter('lang');
886  $sValue = ($iLang !== null) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
887  $this->setViewConfigParam('lang', $sValue);
888  }
889 
890  return $sValue;
891  }
892 
898  public function getActLanguageAbbr()
899  {
900  return oxRegistry::getLang()->getLanguageAbbr($this->getActLanguageId());
901  }
902 
908  public function getActiveClassName()
909  {
910  return $this->getConfig()->getActiveView()->getClassName();
911  }
912 
919  public function getTopActiveClassName()
920  {
921  return $this->getConfig()->getTopActiveView()->getClassName();
922  }
923 
929  public function getArtPerPageCount()
930  {
931  return $this->getViewConfigParam('iartPerPage');
932  }
933 
939  public function getNavUrlParams()
940  {
941  if (($sParams = $this->getViewConfigParam('navurlparams')) === null) {
942  $sParams = '';
943  $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
944  foreach ($aNavParams as $sName => $sValue) {
945  if (isset($sValue)) {
946  if ($sParams) {
947  $sParams .= '&amp;';
948  }
949  $sParams .= "{$sName}=" . rawurlencode($sValue);
950  }
951  }
952  if ($sParams) {
953  $sParams = '&amp;' . $sParams;
954  }
955  $this->setViewConfigParam('navurlparams', $sParams);
956  }
957 
958  return $sParams;
959  }
960 
966  public function getNavFormParams()
967  {
968 
969  if (($sParams = $this->getViewConfigParam('navformparams')) === null) {
970  $oStr = getStr();
971  $sParams = '';
972  $aNavParams = $this->getConfig()->getTopActiveView()->getNavigationParams();
973  foreach ($aNavParams as $sName => $sValue) {
974  if (isset($sValue)) {
975  $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"";
976  $sParams .= $oStr->htmlentities($sValue) . "\" />\n";
977  }
978  }
979  $this->setViewConfigParam('navformparams', $sParams);
980  }
981 
982  return $sParams;
983  }
984 
990  public function getStockOnDefaultMessage()
991  {
992  return $this->getConfig()->getConfigParam('blStockOnDefaultMessage');
993  }
994 
1000  public function getStockOffDefaultMessage()
1001  {
1002  return $this->getConfig()->getConfigParam('blStockOffDefaultMessage');
1003  }
1004 
1010  public function getShopVersion()
1011  {
1012  return $this->getViewConfigParam('sShopVersion');
1013  }
1014 
1020  public function getAjaxLink()
1021  {
1022  return $this->getViewConfigParam('ajaxlink');
1023  }
1024 
1030  public function isMultiShop()
1031  {
1032  $oShop = $this->getConfig()->getActiveShop();
1033 
1034  return isset($oShop->oxshops__oxismultishop) ? ((bool) $oShop->oxshops__oxismultishop->value) : false;
1035  }
1036 
1042  public function getServiceUrl()
1043  {
1044  return $this->getViewConfigParam('sServiceUrl');
1045  }
1046 
1053  public function getRemoteAccessToken()
1054  {
1055  $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
1056 
1057  return $sRaToken;
1058  }
1059 
1066  public function getActionClassName()
1067  {
1068  return $this->getConfig()->getActiveView()->getActionClassName();
1069  }
1070 
1077  public function getTopActionClassName()
1078  {
1079  return $this->getConfig()->getTopActiveView()->getActionClassName();
1080  }
1081 
1087  public function getFbAppId()
1088  {
1089  return $this->getConfig()->getConfigParam('sFbAppId');
1090  }
1091 
1097  public function getShowBasketTimeout()
1098  {
1099  return $this->getConfig()->getConfigParam('blPsBasketReservationEnabled')
1100  && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
1101  }
1102 
1108  public function getBasketTimeLeft()
1109  {
1110  if (!isset($this->_dBasketTimeLeft)) {
1111  $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
1112  }
1113 
1114  return $this->_dBasketTimeLeft;
1115  }
1116 
1123  public function getShowFbConnect()
1124  {
1125  $myConfig = $this->getConfig();
1126 
1127  if ($myConfig->getConfigParam('bl_showFbConnect')) {
1128  if ($myConfig->getConfigParam("sFbAppId") && $myConfig->getConfigParam("sFbSecretKey")) {
1129  return true;
1130  }
1131  }
1132 
1133  return false;
1134  }
1135 
1141  public function getTsDomain()
1142  {
1143  $sDomain = false;
1144  $aTsConfig = $this->getConfig()->getConfigParam("aTsConfig");
1145  if (is_array($aTsConfig)) {
1146  $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
1147  }
1148 
1149  return $sDomain;
1150  }
1151 
1157  public function getTsRatings()
1158  {
1159  if ($this->_aTrustedShopRatings === null) {
1160  $sTsId = $this->getTsId();
1161  if ($sTsId) {
1162  $oTsRatings = oxNew("oxTsRatings");
1163  $oTsRatings->setTsId($sTsId);
1164  $this->_aTrustedShopRatings = $oTsRatings->getRatings();
1165 
1167  }
1168  }
1169 
1171  }
1172 
1178  public function getTsRatingUrl()
1179  {
1180  $sUrl = false;
1181  $sTsId = $this->getTsId();
1182  if ($sTsId) {
1183  $sTsUrl = $this->getTsDomain();
1184 
1185  $sLangId = oxRegistry::getLang()->getLanguageAbbr();
1186  $aTsConfig = $this->getConfig()->getConfigParam("aTsConfig");
1187  if (isset($aTsConfig["sTsRatingUri"]) && isset($aTsConfig["sTsRatingUri"][$sLangId])) {
1188  $sTsRateUri = $aTsConfig["sTsRatingUri"][$sLangId];
1189  } else {
1190  $sTsRateUri = false;
1191  }
1192 
1193  if ($sTsUrl && $sTsRateUri) {
1194  $sUrl = sprintf("{$sTsUrl}/{$sTsRateUri}", $sTsId);
1195  }
1196  }
1197 
1198  return $sUrl;
1199  }
1200 
1208  public function showTs($sType)
1209  {
1210  $blShow = false;
1211  switch ($sType) {
1212  case "WIDGET":
1213  $blShow = (bool) $this->getConfig()->getConfigParam("blTsWidget");
1214  break;
1215  case "THANKYOU":
1216  $blShow = (bool) $this->getConfig()->getConfigParam("blTsThankyouReview");
1217  break;
1218  case "ORDEREMAIL":
1219  $blShow = (bool) $this->getConfig()->getConfigParam("blTsOrderEmailReview");
1220  break;
1221  case "ORDERCONFEMAIL":
1222  $blShow = (bool) $this->getConfig()->getConfigParam("blTsOrderSendEmailReview");
1223  break;
1224  }
1225 
1226  return $blShow;
1227  }
1228 
1234  public function getTsId()
1235  {
1236  $sTsId = false;
1237  $oConfig = $this->getConfig();
1238  $aLangIds = $oConfig->getConfigParam("aTsLangIds");
1239  $aActInfo = $oConfig->getConfigParam("aTsActiveLangIds");
1240 
1241  // mapping with language id
1242  $sLangId = oxRegistry::getLang()->getLanguageAbbr();
1243  if (isset($aActInfo[$sLangId]) && $aActInfo[$sLangId] &&
1244  isset($aLangIds[$sLangId]) && $aLangIds[$sLangId]
1245  ) {
1246  $sTsId = $aLangIds[$sLangId];
1247  }
1248 
1249  return $sTsId;
1250  }
1251 
1257  public function isTplBlocksDebugMode()
1258  {
1259  return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
1260  }
1261 
1267  public function getPasswordLength()
1268  {
1269  $iPasswordLength = 6;
1270 
1271  $oConfig = $this->getConfig();
1272 
1273  if ($oConfig->getConfigParam("iPasswordLength")) {
1274  $iPasswordLength = $oConfig->getConfigParam("iPasswordLength");
1275  }
1276 
1277  return $iPasswordLength;
1278  }
1279 
1285  public function getCountryList()
1286  {
1287  if ($this->_oCountryList === null) {
1288  // passing country list
1289  $this->_oCountryList = oxNew('oxcountrylist');
1290  $this->_oCountryList->loadActiveCountries();
1291  }
1292 
1293  return $this->_oCountryList;
1294  }
1295 
1296 
1307  public function getModulePath($sModule, $sFile = '')
1308  {
1309  if (!$sFile || ($sFile[0] != '/')) {
1310  $sFile = '/' . $sFile;
1311  }
1312  $oModule = oxNew("oxmodule");
1313  $sModulePath = $oModule->getModulePath($sModule);
1314  $sFile = $this->getConfig()->getModulesDir() . $sModulePath . $sFile;
1315  if (file_exists($sFile) || is_dir($sFile)) {
1316  return $sFile;
1317  } else {
1319  $oEx = oxNew("oxFileException", "Requested file not found for module $sModule ($sFile)");
1320  $oEx->debugOut();
1321  if (!$this->getConfig()->getConfigParam('iDebug')) {
1322  return '';
1323  }
1324  throw $oEx;
1325  }
1326  }
1327 
1338  public function getModuleUrl($sModule, $sFile = '')
1339  {
1340  $sUrl = str_replace(
1341  rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
1342  rtrim($this->getConfig()->getCurrentShopUrl(false), '/'),
1343  $this->getModulePath($sModule, $sFile)
1344  );
1345 
1346  return $sUrl;
1347  }
1348 
1359  public function isModuleActive($sModuleId, $sVersionFrom = null, $sVersionTo = null)
1360  {
1361  $blModuleIsActive = false;
1362 
1363  // use aModuleVersions instead of aModules, because aModules gives only modules which extend oxid classes
1364  $aModuleVersions = $this->getConfig()->getConfigParam('aModuleVersions');
1365 
1366  if (is_array($aModuleVersions)) {
1367  $blModuleIsActive = $this->_moduleExists($sModuleId, $aModuleVersions);
1368 
1369  if ($blModuleIsActive) {
1370  $blModuleIsActive = $this->_isModuleEnabled($sModuleId) && $this->_isModuleVersionCorrect($sModuleId, $sVersionFrom, $sVersionTo);
1371  }
1372  }
1373 
1374  return $blModuleIsActive;
1375  }
1376 
1384  public function getViewThemeParam($sName)
1385  {
1386  $sValue = false;
1387 
1388  if ($this->getConfig()->isThemeOption($sName)) {
1389  $sValue = $this->getConfig()->getConfigParam($sName);
1390  }
1391 
1392  return $sValue;
1393  }
1394 
1395 
1401  public function showSelectLists()
1402  {
1403  return (bool) $this->getConfig()->getConfigParam('bl_perfLoadSelectLists');
1404  }
1405 
1411  public function showSelectListsInList()
1412  {
1413  return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam('bl_perfLoadSelectListsInAList');
1414  }
1415 
1416 
1417 
1423  public function isAltImageServerConfigured()
1424  {
1425  $oConfig = $this->getConfig();
1426 
1427  return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
1428  $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
1429  }
1430 
1438  public function isFunctionalityEnabled($sParamName)
1439  {
1440  return (bool) $this->getConfig()->getConfigParam($sParamName);
1441  }
1442 
1448  public function getActiveTheme()
1449  {
1450  if ($this->_sActiveTheme === null) {
1451  $oTheme = oxNew('oxTheme');
1452  $this->_sActiveTheme = $oTheme->getActiveThemeId();
1453  }
1454 
1455  return $this->_sActiveTheme;
1456  }
1457 
1463  public function getShopLogo()
1464  {
1465  if (is_null($this->_sShopLogo)) {
1466 
1467  $sLogoImage = $this->getConfig()->getConfigParam('sShopLogo');
1468  if (empty($sLogoImage)) {
1469  $sLogoImage = "logo.png";
1470  }
1471 
1472  $this->setShopLogo($sLogoImage);
1473  }
1474 
1475  return $this->_sShopLogo;
1476  }
1477 
1483  public function setShopLogo($sLogo)
1484  {
1485  $this->_sShopLogo = $sLogo;
1486  }
1487 
1493  public function getSessionChallengeToken()
1494  {
1495  if (oxRegistry::getSession()->isSessionStarted()) {
1496  $sessionChallengeToken = $this->getSession()->getSessionChallengeToken();
1497  } else {
1498  $sessionChallengeToken = "";
1499  }
1500 
1501  return $sessionChallengeToken;
1502  }
1503 
1512  private function _moduleExists($sModuleId, $aModuleVersions)
1513  {
1514  $blModuleExists = false;
1515 
1516  if (in_array($sModuleId, array_keys($aModuleVersions) )) {
1517  $blModuleExists = true;
1518  }
1519 
1520  return $blModuleExists;
1521  }
1522 
1530  private function _isModuleEnabled($sModuleId)
1531  {
1532  $blModuleIsActive = false;
1533 
1534  $aDisabledModules = $this->getConfig()->getConfigParam('aDisabledModules');
1535  if (!(is_array($aDisabledModules) && in_array($sModuleId, $aDisabledModules))) {
1536  $blModuleIsActive = true;
1537  }
1538  return $blModuleIsActive;
1539  }
1540 
1550  private function _isModuleVersionCorrect($sModuleId, $sVersionFrom, $sVersionTo)
1551  {
1552  $blModuleIsActive = true;
1553 
1554  $aModuleVersions = $this->getConfig()->getConfigParam('aModuleVersions');
1555 
1556  if ($sVersionFrom && !version_compare($aModuleVersions[$sModuleId], $sVersionFrom, '>=')) {
1557  $blModuleIsActive = false;
1558  }
1559 
1560  if ($blModuleIsActive && $sVersionTo && !version_compare($aModuleVersions[$sModuleId], $sVersionTo, '<')) {
1561  $blModuleIsActive = false;
1562  }
1563 
1564  return $blModuleIsActive;
1565  }
1566 
1572  public function getEdition()
1573  {
1574  return $this->getConfig()->getEdition();
1575  }
1576 }