oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00007 // view indexing state for search engines:
00008 define('VIEW_INDEXSTATE_INDEX', 0); //  index without limitations
00009 define('VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1); //  no index / no follow
00010 define('VIEW_INDEXSTATE_NOINDEXFOLLOW', 2); //  no index / follow
00011 
00017 class oxUBase extends oxView
00018 {
00019 
00025     protected $_blFbWidgetsOn = null;
00026 
00032     protected $_sRemoveMetaChars = '.\+*?[^]$(){}=!<>|:&';
00033 
00039     protected $_oaComponents = array();
00040 
00046     protected $_blIsOrderStep = false;
00047 
00053     protected $_sListType = null;
00054 
00060     protected $_aListDisplayTypes = array('grid', 'line', 'infogrid');
00061 
00067     protected $_sListDisplayType = null;
00068 
00074     protected $_sCustomListDisplayType = null;
00075 
00081     protected $_oActCategory = null;
00082 
00088     protected $_oActManufacturer = null;
00089 
00095     protected $_oActVendor = null;
00096 
00102     protected $_oActiveRecommList = null;
00103 
00109     protected $_oActSearch = null;
00110 
00116     protected $_blShowSorting = false;
00117 
00123     protected $_blLoadCurrency = null;
00124 
00130     protected $_blLoadManufacturerTree = null;
00131 
00137     protected $_blDontShowEmptyCats = null;
00138 
00144     protected $_blLoadLanguage = null;
00145 
00151     protected $_iTopCatNavItmCnt = null;
00152 
00158     protected $_aRssLinks = null;
00159 
00165     protected $_sListOrderBy = null;
00166 
00172     protected $_sListOrderDir = null;
00173 
00179     protected $_sMetaDescription = null;
00180 
00186     protected $_sMetaKeywords = null;
00187 
00193     protected $_sMetaDescriptionIdent = null;
00194 
00200     protected $_sMetaKeywordsIdent = null;
00201 
00207     protected $_sAdditionalParams = null;
00208 
00214     protected $_oActCurrency = null;
00215 
00221     protected $_blEnabledPrivateSales = null;
00222 
00230     protected $_blCommonAdded = false;
00231 
00238     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00239 
00246     protected $_blForceNoIndex = false;
00247 
00253     protected $_iCompItemsCnt = null;
00254 
00260     protected $_sContentId = null;
00261 
00267     protected $_oContent = null;
00268 
00274     protected $_sViewResetID = null;
00275 
00281     protected $_aMenueList = null;
00282 
00289     protected $_aComponentNames = array(
00290         'oxcmp_user'       => 1, // 0 means dont init if cached
00291         'oxcmp_lang'       => 0,
00292         'oxcmp_cur'        => 1,
00293         'oxcmp_shop'       => 1,
00294         'oxcmp_categories' => 0,
00295         'oxcmp_utils'      => 1,
00296         'oxcmp_news'       => 0,
00297         'oxcmp_basket'     => 1
00298     );
00299 
00306     protected $_aUserComponentNames = array();
00307 
00313     protected $_oProduct = null;
00314 
00320     protected $_iActPage = null;
00321 
00327     protected $_aArticleList = null;
00328 
00334     protected $_oManufacturerTree = null;
00335 
00341     protected $_oCategoryTree = null;
00342 
00348     protected $_aTop5ArticleList = null;
00349 
00355     protected $_aBargainArticleList = null;
00356 
00362     protected $_blLowOrderPrice = null;
00363 
00369     protected $_sMinOrderPrice = null;
00370 
00376     protected $_iNewsRealStatus = null;
00377 
00383     protected $_aBlockRedirectParams = array('fnc', 'stoken', 'force_sid', 'force_admin_sid');
00384 
00390     protected $_oRootVendor = null;
00391 
00397     protected $_sVendorId = null;
00398 
00404     protected $_aManufacturerlist = null;
00405 
00411     protected $_oRootManufacturer = null;
00412 
00418     protected $_sManufacturerId = null;
00419 
00425     protected $_blNewsSubscribed = null;
00426 
00432     protected $_oDelAddress = null;
00433 
00439     protected $_sCatTreePath = null;
00440 
00446     protected $_aContents = array();
00447 
00453     protected $_blTop5Action = false;
00454 
00460     protected $_blBargainAction = false;
00461 
00467     protected $_aMustFillFields = null;
00468 
00474     protected $_blShowTagCloud = true;
00475 
00481     protected $_blRootCatChanged = false;
00482 
00488     protected $_aInvoiceAddress = null;
00489 
00495     protected $_aDeliveryAddress = null;
00496 
00502     protected $_sActiveUsername = null;
00503 
00510     protected static $_aCollectedComponentNames = null;
00511 
00518     protected $_blLoadComponents = true;
00519 
00520 
00526     protected $_aSortColumns = null;
00527 
00533     protected function _getComponentNames()
00534     {
00535         if (self::$_aCollectedComponentNames === null) {
00536             self::$_aCollectedComponentNames = array_merge($this->_aComponentNames, $this->_aUserComponentNames);
00537 
00538             // #1721: custom component handling. At the moment it is not possible to override this variable in oxubase,
00539             // so we added this array to config.inc.php file
00540             if (($aUserCmps = $this->getConfig()->getConfigParam('aUserComponentNames'))) {
00541                 self::$_aCollectedComponentNames = array_merge(self::$_aCollectedComponentNames, $aUserCmps);
00542             }
00543 
00544             if (oxRegistry::getConfig()->getRequestParameter('_force_no_basket_cmp')) {
00545                 unset(self::$_aCollectedComponentNames['oxcmp_basket']);
00546             }
00547         }
00548 
00549         // resetting array pointer
00550         reset(self::$_aCollectedComponentNames);
00551 
00552         return self::$_aCollectedComponentNames;
00553     }
00554 
00561     protected function _processRequest()
00562     {
00563         $myUtils = oxRegistry::getUtils();
00564 
00565         // non admin, request is not empty and was not processed by seo engine
00566         if (!isSearchEngineUrl() && $myUtils->seoIsActive() && ($sStdUrl = getRequestUrl('', true))) {
00567 
00568             // fetching standard url and looking for it in seo table
00569             if ($this->_canRedirect() && ($sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl($sStdUrl))) {
00570                 $myUtils->redirect($this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false);
00571             } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00572                 // forcing to set no index/follow meta
00573                 $this->_forceNoIndex();
00574 
00575                 if ($this->getConfig()->getConfigParam('blSeoLogging')) {
00576                     $sShopId = $this->getConfig()->getShopId();
00577                     $sLangId = oxRegistry::getLang()->getBaseLanguage();
00578                     $sIdent = md5(strtolower($sStdUrl) . $sShopId . $sLangId);
00579 
00580                     // logging "not found" url
00581                     $oDb = oxDb::getDb();
00582                     $oDb->execute(
00583                         "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00584                                values ( " . $oDb->quote($sStdUrl) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) "
00585                     );
00586                 }
00587             }
00588         }
00589     }
00590 
00595     public function init()
00596     {
00597         $this->_processRequest();
00598 
00599         // storing current view
00600         $blInit = true;
00601 
00602 
00603         // init all components if there are any
00604         if ($this->_blLoadComponents) {
00605             foreach ($this->_getComponentNames() as $sComponentName => $blNotCacheable) {
00606                 // do not override initiated components
00607                 if (!isset($this->_oaComponents[$sComponentName])) {
00608                     // component objects MUST be created to support user called functions
00609                     $oComponent = oxNew($sComponentName);
00610                     $oComponent->setParent($this);
00611                     $oComponent->setThisAction($sComponentName);
00612                     $this->_oaComponents[$sComponentName] = $oComponent;
00613                 }
00614 
00615                 // do we really need to initiate them ?
00616                 if ($blInit) {
00617                     $this->_oaComponents[$sComponentName]->init();
00618 
00619                     // executing only is view does not have action method
00620                     if (!method_exists($this, $this->getFncName())) {
00621                         $this->_oaComponents[$sComponentName]->executeFunction($this->getFncName());
00622                     }
00623                 }
00624             }
00625         }
00626 
00627         parent::init();
00628     }
00629 
00636     public function getViewId()
00637     {
00638         if ($this->_sViewId) {
00639             return $this->_sViewId;
00640         }
00641 
00642         $oConfig = $this->getConfig();
00643         $iLang = oxRegistry::getLang()->getBaseLanguage();
00644         $iCur = (int) $oConfig->getShopCurrency();
00645 
00646 
00647         $this->_sViewId = "ox|$iLang|$iCur";
00648 
00649         $this->_sViewId .= "|" . ((int) $this->_blForceNoIndex) . '|' . ((int) $this->isRootCatChanged());
00650 
00651         // #0004798: SSL should be included in viewId
00652         if ($oConfig->isSsl()) {
00653             $this->_sViewId .= "|ssl";
00654         }
00655 
00656         // #0002866: external global viewID addition
00657         if (function_exists('customGetViewId')) {
00658             $oExtViewId = customGetViewId();
00659 
00660             if ($oExtViewId !== null) {
00661                 $this->_sViewId .= '|' . md5(serialize($oExtViewId));
00662             }
00663         }
00664 
00665         return $this->_sViewId;
00666     }
00667 
00668 
00674     public function showSorting()
00675     {
00676         return $this->_blShowSorting && $this->getConfig()->getConfigParam('blShowSorting');
00677     }
00678 
00684     public function setComponents($aComponents = null)
00685     {
00686         $this->_oaComponents = $aComponents;
00687     }
00688 
00694     public function getComponents()
00695     {
00696         return $this->_oaComponents;
00697     }
00698 
00706     public function getComponent($sName)
00707     {
00708         if (isset($sName) && isset($this->_oaComponents[$sName])) {
00709             return $this->_oaComponents[$sName];
00710         }
00711     }
00712 
00718     public function setIsOrderStep($blIsOrderStep = null)
00719     {
00720         $this->_blIsOrderStep = $blIsOrderStep;
00721     }
00722 
00728     public function getIsOrderStep()
00729     {
00730         return $this->_blIsOrderStep;
00731     }
00732 
00733 
00739     public function setActiveCategory($oCategory)
00740     {
00741         $this->_oActCategory = $oCategory;
00742     }
00743 
00749     public function getActiveCategory()
00750     {
00751         return $this->_oActCategory;
00752     }
00753 
00759     public function getListType()
00760     {
00761         if ($this->_sListType == null) {
00762             if ($sListType = $this->getConfig()->getRequestParameter('listtype')) {
00763                 $this->_sListType = $sListType;
00764             } elseif ($sListType = $this->getConfig()->getGlobalParameter('listtype')) {
00765                 $this->_sListType = $sListType;
00766             }
00767         }
00768 
00769         return $this->_sListType;
00770     }
00771 
00777     public function getListDisplayType()
00778     {
00779         if ($this->_sListDisplayType == null) {
00780             $this->_sListDisplayType = $this->getCustomListDisplayType();
00781 
00782             if (!$this->_sListDisplayType) {
00783                 $this->_sListDisplayType = $this->getConfig()->getConfigParam('sDefaultListDisplayType');
00784             }
00785 
00786             $this->_sListDisplayType = in_array(( string ) $this->_sListDisplayType, $this->_aListDisplayTypes) ?
00787                                                                             $this->_sListDisplayType : 'infogrid';
00788 
00789             // writing to session
00790             if ($this->getConfig()->getRequestParameter('ldtype')) {
00791                 oxRegistry::getSession()->setVariable('ldtype', $this->_sListDisplayType);
00792             }
00793         }
00794 
00795         return $this->_sListDisplayType;
00796     }
00797 
00803     public function getCustomListDisplayType()
00804     {
00805         if ($this->_sCustomListDisplayType == null) {
00806             $this->_sCustomListDisplayType = $this->getConfig()->getRequestParameter('ldtype');
00807 
00808             if (!$this->_sCustomListDisplayType) {
00809                 $this->_sCustomListDisplayType = oxRegistry::getSession()->getVariable('ldtype');
00810             }
00811         }
00812 
00813         return $this->_sCustomListDisplayType;
00814     }
00815 
00821     public function setListType($sType)
00822     {
00823         $this->_sListType = $sType;
00824         $this->getConfig()->setGlobalParameter('listtype', $sType);
00825     }
00826 
00832     public function loadCurrency()
00833     {
00834         if ($this->_blLoadCurrency == null) {
00835             $this->_blLoadCurrency = false;
00836             if ($blLoadCurrency = $this->getConfig()->getConfigParam('bl_perfLoadCurrency')) {
00837                 $this->_blLoadCurrency = $blLoadCurrency;
00838             }
00839         }
00840 
00841         return $this->_blLoadCurrency;
00842     }
00843 
00849     public function dontShowEmptyCategories()
00850     {
00851         if ($this->_blDontShowEmptyCats == null) {
00852             $this->_blDontShowEmptyCats = false;
00853             if ($blDontShowEmptyCats = $this->getConfig()->getConfigParam('blDontShowEmptyCategories')) {
00854                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00855             }
00856         }
00857 
00858         return $this->_blDontShowEmptyCats;
00859     }
00860 
00866     public function showCategoryArticlesCount()
00867     {
00868         return $this->getConfig()->getConfigParam('bl_perfShowActionCatArticleCnt');
00869     }
00870 
00876     public function isLanguageLoaded()
00877     {
00878         if ($this->_blLoadLanguage == null) {
00879             $this->_blLoadLanguage = false;
00880             if ($blLoadLanguage = $this->getConfig()->getConfigParam('bl_perfLoadLanguages')) {
00881                 $this->_blLoadLanguage = $blLoadLanguage;
00882             }
00883         }
00884 
00885         return $this->_blLoadLanguage;
00886     }
00887 
00893     public function getTopNavigationCatCnt()
00894     {
00895         if ($this->_iTopCatNavItmCnt == null) {
00896             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam('iTopNaviCatCount');
00897             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00898         }
00899 
00900         return $this->_iTopCatNavItmCnt;
00901     }
00902 
00910     public function addRssFeed($sTitle, $sUrl, $key = null)
00911     {
00912         if (!is_array($this->_aRssLinks)) {
00913             $this->_aRssLinks = array();
00914         }
00915 
00916         $sUrl = oxRegistry::get("oxUtilsUrl")->prepareUrlForNoSession($sUrl);
00917 
00918         if ($key === null) {
00919             $this->_aRssLinks[] = array('title' => $sTitle, 'link' => $sUrl);
00920         } else {
00921             $this->_aRssLinks[$key] = array('title' => $sTitle, 'link' => $sUrl);
00922         }
00923     }
00924 
00930     public function getSortOrderByParameterName()
00931     {
00932         return 'listorderby';
00933     }
00934 
00940     public function getSortOrderParameterName()
00941     {
00942         return 'listorder';
00943     }
00944 
00945 
00951     public function getSortIdent()
00952     {
00953         return 'alist';
00954     }
00955 
00961     public function getDefaultSorting()
00962     {
00963         return null;
00964     }
00965 
00971     public function getUserSelectedSorting()
00972     {
00973         $aSorting = null;
00974         $oStr = getStr();
00975         $oConfig = oxRegistry::getConfig();
00976         $aSortDirections = array('desc', 'asc');
00977 
00978         $sSortBy = $oConfig->getRequestParameter($this->getSortOrderByParameterName());
00979         $sSortDir = $oConfig->getRequestParameter($this->getSortOrderParameterName());
00980 
00981         if ($sSortBy && oxDb::getInstance()->isValidFieldName($sSortBy) && $sSortDir &&
00982             oxRegistry::getUtils()->isValidAlpha($sSortDir) && in_array($oStr->strtolower($sSortDir), $aSortDirections)
00983         ) {
00984             $aSorting = array('sortby' => $sSortBy, 'sortdir' => $sSortDir);
00985         }
00986 
00987         return $aSorting;
00988     }
00989 
00990 
00998     public function getSavedSorting($sSortIdent)
00999     {
01000         $aSorting = oxRegistry::getSession()->getVariable('aSorting');
01001         if (isset($aSorting[$sSortIdent])) {
01002             return $aSorting[$sSortIdent];
01003         }
01004     }
01005 
01011     public function setListOrderBy($sColumn)
01012     {
01013         $this->_sListOrderBy = $sColumn;
01014     }
01015 
01021     public function setListOrderDirection($sDirection)
01022     {
01023         $this->_sListOrderDir = $sDirection;
01024     }
01025 
01031     public function getListOrderBy()
01032     {
01033         //if column is with table name split it
01034         $aColumns = explode('.', $this->_sListOrderBy);
01035 
01036         if (is_array($aColumns) && count($aColumns) > 1) {
01037             return $aColumns[1];
01038         }
01039 
01040         return $this->_sListOrderBy;
01041     }
01042 
01048     public function getListOrderDirection()
01049     {
01050         return $this->_sListOrderDir;
01051     }
01052 
01060     public function setMetaDescription($sDescription)
01061     {
01062         return $this->_sMetaDescription = $sDescription;
01063     }
01064 
01072     public function setMetaKeywords($sKeywords)
01073     {
01074         return $this->_sMetaKeywords = $sKeywords;
01075     }
01076 
01084     protected function _getMetaFromSeo($sDataType)
01085     {
01086         $sOxId = $this->_getSeoObjectId();
01087         $iLang = oxRegistry::getLang()->getBaseLanguage();
01088         $sShop = $this->getConfig()->getShopId();
01089 
01090         if ($sOxId && oxRegistry::getUtils()->seoIsActive() &&
01091             ($sKeywords = oxRegistry::get("oxSeoEncoder")->getMetaData($sOxId, $sDataType, $sShop, $iLang))
01092         ) {
01093             return $sKeywords;
01094         }
01095     }
01096 
01104     protected function _getMetaFromContent($sMetaIdent)
01105     {
01106         if ($sMetaIdent) {
01107             $oContent = oxNew('oxContent');
01108             if ($oContent->loadByIdent($sMetaIdent) &&
01109                 $oContent->oxcontents__oxactive->value
01110             ) {
01111                 return getStr()->strip_tags($oContent->oxcontents__oxcontent->value);
01112             }
01113         }
01114     }
01115 
01121     public function getMetaKeywords()
01122     {
01123         if ($this->_sMetaKeywords === null) {
01124             $this->_sMetaKeywords = false;
01125 
01126             // set special meta keywords ?
01127             if (($sKeywords = $this->_getMetaFromSeo('oxkeywords'))) {
01128                 $this->_sMetaKeywords = $sKeywords;
01129             } elseif (($sKeywords = $this->_getMetaFromContent($this->_sMetaKeywordsIdent))) {
01130                 $this->_sMetaKeywords = $this->_prepareMetaKeyword($sKeywords, false);
01131             } else {
01132                 $this->_sMetaKeywords = $this->_prepareMetaKeyword(false, true);
01133             }
01134         }
01135 
01136         return $this->_sMetaKeywords;
01137     }
01138 
01144     public function getMetaDescription()
01145     {
01146         if ($this->_sMetaDescription === null) {
01147             $this->_sMetaDescription = false;
01148 
01149             // set special meta description ?
01150             if (($sDescription = $this->_getMetaFromSeo('oxdescription'))) {
01151                 $this->_sMetaDescription = $sDescription;
01152             } elseif (($sDescription = $this->_getMetaFromContent($this->_sMetaDescriptionIdent))) {
01153                 $this->_sMetaDescription = $this->_prepareMetaDescription($sDescription);
01154             } else {
01155                 $this->_sMetaDescription = $this->_prepareMetaDescription(false);
01156             }
01157         }
01158 
01159         return $this->_sMetaDescription;
01160     }
01161 
01167     public function getActCurrency()
01168     {
01169         return $this->_oActCurrency;
01170     }
01171 
01177     public function setActCurrency($oCur)
01178     {
01179         $this->_oActCurrency = $oCur;
01180     }
01181 
01187     public function getCompareItemCount()
01188     {
01189         if ($this->_iCompItemsCnt === null) {
01190             $aItems = oxRegistry::getSession()->getVariable('aFiltcompproducts');
01191             $this->_iCompItemsCnt = is_array($aItems) ? count($aItems) : 0;
01192         }
01193 
01194         return $this->_iCompItemsCnt;
01195     }
01196 
01200     protected function _forceNoIndex()
01201     {
01202         $this->_blForceNoIndex = true;
01203     }
01204 
01211     public function noIndex()
01212     {
01213         if ($this->_blForceNoIndex) {
01214             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01215         } elseif ($this->getConfig()->getRequestParameter('cur')) {
01216             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01217         } else {
01218             switch ($this->getConfig()->getRequestParameter('fnc')) {
01219                 case 'tocomparelist':
01220                 case 'tobasket':
01221                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01222                     break;
01223             }
01224         }
01225 
01226         return $this->_iViewIndexState;
01227     }
01228 
01234     public function getMenueList()
01235     {
01236         return $this->_aMenueList;
01237     }
01238 
01244     public function setMenueList($aMenu)
01245     {
01246         $this->_aMenueList = $aMenu;
01247     }
01248 
01252     protected function _setNrOfArtPerPage()
01253     {
01254         $myConfig = $this->getConfig();
01255 
01256         //setting default values to avoid possible errors showing article list
01257         $iNrofCatArticles = $myConfig->getConfigParam('iNrofCatArticles');
01258 
01259         $iNrofCatArticles = ($iNrofCatArticles) ? $iNrofCatArticles : 10;
01260 
01261         // checking if all needed data is set
01262         switch ($this->getListDisplayType()) {
01263             case 'grid':
01264                 $aNrofCatArticles = $myConfig->getConfigParam('aNrofCatArticlesInGrid');
01265                 break;
01266             case 'line':
01267             case 'infogrid':
01268             default:
01269                 $aNrofCatArticles = $myConfig->getConfigParam('aNrofCatArticles');
01270         }
01271 
01272         if (!is_array($aNrofCatArticles) || !isset($aNrofCatArticles[0])) {
01273             $aNrofCatArticles = array($iNrofCatArticles);
01274             $myConfig->setConfigParam('aNrofCatArticles', $aNrofCatArticles);
01275         } else {
01276             $iNrofCatArticles = $aNrofCatArticles[0];
01277         }
01278 
01279         $oViewConf = $this->getViewConfig();
01280         //value from user input
01281         $oSession = oxRegistry::getSession();
01282         if (($iNrofArticles = (int) oxRegistry::getConfig()->getRequestParameter('_artperpage'))) {
01283             // M45 Possibility to push any "Show articles per page" number parameter
01284             $iNrofCatArticles = (in_array($iNrofArticles, $aNrofCatArticles)) ? $iNrofArticles : $iNrofCatArticles;
01285             $oViewConf->setViewConfigParam('iartPerPage', $iNrofCatArticles);
01286             $oSession->setVariable('_artperpage', $iNrofCatArticles);
01287         } elseif (($iSessArtPerPage = $oSession->getVariable('_artperpage')) && is_numeric($iSessArtPerPage)) {
01288             // M45 Possibility to push any "Show articles per page" number parameter
01289             $iNrofCatArticles = (in_array($iSessArtPerPage, $aNrofCatArticles)) ? $iSessArtPerPage : $iNrofCatArticles;
01290             $oViewConf->setViewConfigParam('iartPerPage', $iSessArtPerPage);
01291             $iNrofCatArticles = $iSessArtPerPage;
01292         } else {
01293             $oViewConf->setViewConfigParam('iartPerPage', $iNrofCatArticles);
01294         }
01295 
01296         //setting number of articles per page to config value
01297         $myConfig->setConfigParam('iNrofCatArticles', $iNrofCatArticles);
01298     }
01299 
01303     protected function _getSeoObjectId()
01304     {
01305     }
01306 
01316     protected function _prepareMetaDescription($sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false)
01317     {
01318         if ($sMeta) {
01319 
01320             $oStr = getStr();
01321             if ($iLength != -1) {
01322                 /* *
01323                  * performance - we do not need a huge amount of initial text.
01324                  * assume that effective text may be double longer than $iLength
01325                  * and simple truncate it
01326                  */
01327                 $iELength = ($iLength * 2);
01328                 $sMeta = $oStr->substr($sMeta, 0, $iELength);
01329             }
01330 
01331             // decoding html entities
01332             $sMeta = $oStr->html_entity_decode($sMeta);
01333             // stripping HTML tags
01334             $sMeta = $oStr->strip_tags($sMeta);
01335 
01336             // removing some special chars
01337             $sMeta = $oStr->cleanStr($sMeta);
01338 
01339             // removing duplicate words
01340             if ($blRemoveDuplicatedWords) {
01341                 $sMeta = $this->_removeDuplicatedWords($sMeta, $this->getConfig()->getConfigParam('aSkipTags'));
01342             }
01343 
01344             // some special cases
01345             $sMeta = str_replace(' ,', ',', $sMeta);
01346             $aPattern = array("/,[\s\+\-\*]*,/", "/\s+,/");
01347             $sMeta = $oStr->preg_replace($aPattern, ',', $sMeta);
01348             $sMeta = oxRegistry::get("oxUtilsString")->minimizeTruncateString($sMeta, $iLength);
01349             $sMeta = $oStr->htmlspecialchars($sMeta);
01350 
01351             return trim($sMeta);
01352         }
01353     }
01354 
01363     protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
01364     {
01365 
01366         $sString = $this->_prepareMetaDescription($sKeywords, -1, false);
01367 
01368         if ($blRemoveDuplicatedWords) {
01369             $sString = $this->_removeDuplicatedWords($sString, $this->getConfig()->getConfigParam('aSkipTags'));
01370         }
01371 
01372         return trim($sString);
01373     }
01374 
01383     protected function _removeDuplicatedWords($aInput, $aSkipTags = array())
01384     {
01385         $oStr = getStr();
01386         if (is_array($aInput)) {
01387             $aInput = implode(" ", $aInput);
01388         }
01389 
01390         // removing some usually met characters..
01391         $aInput = $oStr->preg_replace("/[" . preg_quote($this->_sRemoveMetaChars, "/") . "]/", " ", $aInput);
01392 
01393         // splitting by word
01394         $aStrings = $oStr->preg_split("/[\s,]+/", $aInput);
01395 
01396         if ($sCount = count($aSkipTags)) {
01397             for ($iNum = 0; $iNum < $sCount; $iNum++) {
01398                 $aSkipTags[$iNum] = $oStr->strtolower($aSkipTags[$iNum]);
01399             }
01400         }
01401         $sCount = count($aStrings);
01402         for ($iNum = 0; $iNum < $sCount; $iNum++) {
01403             $aStrings[$iNum] = $oStr->strtolower($aStrings[$iNum]);
01404             // removing in admin defined strings
01405             if (!$aStrings[$iNum] || in_array($aStrings[$iNum], $aSkipTags)) {
01406                 unset($aStrings[$iNum]);
01407             }
01408         }
01409 
01410         // duplicates
01411         return implode(', ', array_unique($aStrings));
01412     }
01413 
01421     public function getNavigationParams()
01422     {
01423         $oConfig = $this->getConfig();
01424         $aParams['cnid'] = $this->getCategoryId();
01425         $aParams['mnid'] = $oConfig->getRequestParameter('mnid');
01426 
01427         $aParams['listtype'] = $this->getListType();
01428         $aParams['ldtype'] = $this->getCustomListDisplayType();
01429         $aParams['actcontrol'] = $this->getClassName();
01430 
01431         $aParams['recommid'] = $oConfig->getRequestParameter('recommid');
01432 
01433         $aParams['searchrecomm'] = $oConfig->getRequestParameter('searchrecomm', true);
01434         $aParams['searchparam'] = $oConfig->getRequestParameter('searchparam', true);
01435         $aParams['searchtag'] = $oConfig->getRequestParameter('searchtag', true);
01436 
01437         $aParams['searchvendor'] = $oConfig->getRequestParameter('searchvendor');
01438         $aParams['searchcnid'] = $oConfig->getRequestParameter('searchcnid');
01439         $aParams['searchmanufacturer'] = $oConfig->getRequestParameter('searchmanufacturer');
01440 
01441         return $aParams;
01442     }
01443 
01451     public function setItemSorting($sSortIdent, $sSortBy, $sSortDir = null)
01452     {
01453         $aSorting = oxRegistry::getSession()->getVariable('aSorting');
01454         $aSorting[$sSortIdent]['sortby'] = $sSortBy;
01455         $aSorting[$sSortIdent]['sortdir'] = $sSortDir ? $sSortDir : null;
01456 
01457         oxRegistry::getSession()->setVariable('aSorting', $aSorting);
01458     }
01459 
01467     public function getSorting($sSortIdent)
01468     {
01469         $aSorting = null;
01470 
01471         if ($aSorting = $this->getUserSelectedSorting()) {
01472             $this->setItemSorting($sSortIdent, $aSorting['sortby'], $aSorting['sortdir']);
01473         } elseif (!$aSorting = $this->getSavedSorting($sSortIdent)) {
01474             $aSorting = $this->getDefaultSorting();
01475         }
01476 
01477         if ($aSorting) {
01478             $this->setListOrderBy($aSorting['sortby']);
01479             $this->setListOrderDirection($aSorting['sortdir']);
01480         }
01481 
01482         return $aSorting;
01483     }
01484 
01492     public function getSortingSql($sIdent)
01493     {
01494         $aSorting = $this->getSorting($sIdent);
01495         if (is_array($aSorting)) {
01496             return implode(" ", $aSorting);
01497         }
01498     }
01499 
01505     public function getTitleSuffix()
01506     {
01507         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01508     }
01509 
01513     public function getTitlePageSuffix()
01514     {
01515     }
01516 
01522     public function getTitlePrefix()
01523     {
01524         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01525     }
01526 
01527 
01533     public function getPageTitle()
01534     {
01535         $sTitle = '';
01536 
01537         $aTitleParts = array();
01538         $aTitleParts[] = $this->getTitlePrefix();
01539         $aTitleParts[] = $this->getTitle();
01540         $aTitleParts[] = $this->getTitleSuffix();
01541         $aTitleParts[] = $this->getTitlePageSuffix();
01542 
01543         $aTitleParts = array_filter($aTitleParts);
01544 
01545         if (count($aTitleParts)) {
01546             $sTitle = implode(' | ', $aTitleParts);
01547         }
01548 
01549 
01550         return $sTitle;
01551     }
01552 
01553 
01562     protected function _getSubject($iLang)
01563     {
01564         return null;
01565     }
01566 
01572     public function getDynUrlParams()
01573     {
01574         $sRet = '';
01575         $sListType = $this->getListType();
01576         $oConfig = $this->getConfig();
01577 
01578         switch ($sListType) {
01579             default:
01580                 break;
01581             case 'search':
01582                 $sRet .= "&amp;listtype={$sListType}";
01583                 if ($sSearchParamForLink = rawurlencode($oConfig->getRequestParameter('searchparam', true))) {
01584                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01585                 }
01586 
01587                 if (($sVar = $oConfig->getRequestParameter('searchcnid', true))) {
01588                     $sRet .= '&amp;searchcnid=' . rawurlencode(rawurldecode($sVar));
01589                 }
01590                 if (($sVar = $oConfig->getRequestParameter('searchvendor', true))) {
01591                     $sRet .= '&amp;searchvendor=' . rawurlencode(rawurldecode($sVar));
01592                 }
01593                 if (($sVar = $oConfig->getRequestParameter('searchmanufacturer', true))) {
01594                     $sRet .= '&amp;searchmanufacturer=' . rawurlencode(rawurldecode($sVar));
01595                 }
01596                 break;
01597             case 'tag':
01598                 $sRet .= "&amp;listtype={$sListType}";
01599                 if ($sParam = rawurlencode($oConfig->getRequestParameter('searchtag', true))) {
01600                     $sRet .= "&amp;searchtag={$sParam}";
01601                 }
01602                 break;
01603         }
01604 
01605         return $sRet;
01606     }
01607 
01615     public function getBaseLink($iLang = null)
01616     {
01617         if (!isset($iLang)) {
01618             $iLang = oxRegistry::getLang()->getBaseLanguage();
01619         }
01620 
01621         $oConfig = $this->getConfig();
01622 
01623         if (oxRegistry::getUtils()->seoIsActive()) {
01624             if ($oDisplayObj = $this->_getSubject($iLang)) {
01625                 $sUrl = $oDisplayObj->getLink($iLang);
01626             } else {
01627                 $oEncoder = oxRegistry::get("oxSeoEncoder");
01628                 $sConstructedUrl = $oConfig->getShopHomeURL($iLang) . $this->_getSeoRequestParams();
01629                 $sUrl = $oEncoder->getStaticUrl($sConstructedUrl, $iLang);
01630             }
01631         }
01632 
01633         if (!$sUrl) {
01634             $sConstructedUrl = $oConfig->getShopCurrentURL($iLang) . $this->_getRequestParams();
01635             $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl($sConstructedUrl, true, null, $iLang);
01636         }
01637 
01638         return $sUrl;
01639     }
01640 
01641 
01649     public function getLink($iLang = null)
01650     {
01651         return $this->_addPageNrParam($this->getBaseLink($iLang), $this->getActPage());
01652     }
01653 
01657     public function getCanonicalUrl()
01658     {
01659     }
01660 
01667     public function getSimilarRecommListIds()
01668     {
01669         return false;
01670     }
01671 
01676     public function getSearchParamForHtml()
01677     {
01678     }
01679 
01687     protected function _getRequestParams($blAddPageNr = true)
01688     {
01689         $sClass = $this->getClassName();
01690         $sFnc = $this->getFncName();
01691 
01692         $aFnc = array('tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright');
01693         if (in_array($sFnc, $aFnc)) {
01694             $sFnc = '';
01695         }
01696 
01697         // #680
01698         $sURL = "cl={$sClass}";
01699         if ($sFnc) {
01700             $sURL .= "&amp;fnc={$sFnc}";
01701         }
01702         if ($sVal = oxRegistry::getConfig()->getRequestParameter('cnid')) {
01703             $sURL .= "&amp;cnid={$sVal}";
01704         }
01705         if ($sVal = oxRegistry::getConfig()->getRequestParameter('mnid')) {
01706             $sURL .= "&amp;mnid={$sVal}";
01707         }
01708         if ($sVal = oxRegistry::getConfig()->getRequestParameter('anid')) {
01709             $sURL .= "&amp;anid={$sVal}";
01710         }
01711 
01712         if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('page'))) {
01713             $sURL .= "&amp;page={$sVal}";
01714         }
01715 
01716         if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('tpl'))) {
01717             $sURL .= "&amp;tpl={$sVal}";
01718         }
01719 
01720         if ($sVal = oxRegistry::getConfig()->getRequestParameter('oxloadid')) {
01721             $sURL .= "&amp;oxloadid={$sVal}";
01722         }
01723 
01724         $iPgNr = (int) oxRegistry::getConfig()->getRequestParameter('pgNr');
01725         // don't include page number for navigation
01726         // it will be done in oxubase::generatePageNavigation
01727         if ($blAddPageNr && $iPgNr > 0) {
01728             $sURL .= "&amp;pgNr={$iPgNr}";
01729         }
01730 
01731         // #1184M - specialchar search
01732         if ($sVal = rawurlencode(oxRegistry::getConfig()->getRequestParameter('searchparam', true))) {
01733             $sURL .= "&amp;searchparam={$sVal}";
01734         }
01735 
01736         if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchcnid')) {
01737             $sURL .= "&amp;searchcnid={$sVal}";
01738         }
01739 
01740         if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchvendor')) {
01741             $sURL .= "&amp;searchvendor={$sVal}";
01742         }
01743 
01744         if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchmanufacturer')) {
01745             $sURL .= "&amp;searchmanufacturer={$sVal}";
01746         }
01747 
01748         if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchrecomm')) {
01749             $sURL .= "&amp;searchrecomm={$sVal}";
01750         }
01751 
01752         if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchtag')) {
01753             $sURL .= "&amp;searchtag={$sVal}";
01754         }
01755 
01756         if ($sVal = oxRegistry::getConfig()->getRequestParameter('recommid')) {
01757             $sURL .= "&amp;recommid={$sVal}";
01758         }
01759 
01760         return $sURL;
01761     }
01762 
01768     protected function _getSeoRequestParams()
01769     {
01770         $sClass = $this->getClassName();
01771         $sFnc = $this->getFncName();
01772 
01773         // #921 S
01774         $aFnc = array('tobasket', 'login_noredirect', 'addVoucher');
01775         if (in_array($sFnc, $aFnc)) {
01776             $sFnc = '';
01777         }
01778 
01779         // #680
01780         $sURL = "cl={$sClass}";
01781         if ($sFnc) {
01782             $sURL .= "&amp;fnc={$sFnc}";
01783         }
01784         if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('page'))) {
01785             $sURL .= "&amp;page={$sVal}";
01786         }
01787 
01788         if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('tpl'))) {
01789             $sURL .= "&amp;tpl={$sVal}";
01790         }
01791 
01792         if ($sVal = oxRegistry::getConfig()->getRequestParameter('oxloadid')) {
01793             $sURL .= "&amp;oxloadid={$sVal}";
01794         }
01795 
01796         $iPgNr = (int) oxRegistry::getConfig()->getRequestParameter('pgNr');
01797         if ($iPgNr > 0) {
01798             $sURL .= "&amp;pgNr={$iPgNr}";
01799         }
01800 
01801         return $sURL;
01802     }
01803 
01809     public function showSearch()
01810     {
01811         $blShow = true;
01812         if ($this->getConfig()->getConfigParam('blDisableNavBars') && $this->getIsOrderStep()) {
01813             $blShow = false;
01814         }
01815 
01816         return (int) $blShow;
01817     }
01818 
01824     public function getRssLinks()
01825     {
01826         return $this->_aRssLinks;
01827     }
01828 
01834     public function getSortColumns()
01835     {
01836         if ($this->_aSortColumns === null) {
01837             $this->setSortColumns($this->getConfig()->getConfigParam('aSortCols'));
01838         }
01839 
01840         return $this->_aSortColumns;
01841     }
01842 
01843 
01849     public function setSortColumns($aSortColumns)
01850     {
01851         $this->_aSortColumns = $aSortColumns;
01852     }
01853 
01857     public function getEditTags()
01858     {
01859     }
01860 
01864     public function getRecommSearch()
01865     {
01866     }
01867 
01871     public function getPaymentList()
01872     {
01873     }
01874 
01880     public function getActiveRecommList()
01881     {
01882         if ($this->_oActiveRecommList === null) {
01883             $this->_oActiveRecommList = false;
01884             if ($sOxId = $this->getConfig()->getRequestParameter('recommid')) {
01885                 $this->_oActiveRecommList = oxNew('oxrecommlist');
01886                 $this->_oActiveRecommList->load($sOxId);
01887             }
01888         }
01889 
01890         return $this->_oActiveRecommList;
01891     }
01892 
01896     public function getAccessoires()
01897     {
01898     }
01899 
01903     public function getCrossSelling()
01904     {
01905     }
01906 
01910     public function getSimilarProducts()
01911     {
01912     }
01913 
01917     public function getAlsoBoughtTheseProducts()
01918     {
01919     }
01920 
01924     public function getArticleId()
01925     {
01926     }
01927 
01933     public function getTitle()
01934     {
01935         $oLang = oxRegistry::getLang();
01936         $sTranslationName = 'PAGE_TITLE_' . strtoupper($this->getConfig()->getActiveView()->getClassName());
01937         $sTranslated = $oLang->translateString($sTranslationName, oxRegistry::getLang()->getBaseLanguage(), false);
01938 
01939         return $sTranslationName == $sTranslated ? null : $sTranslated;
01940     }
01941 
01947     public function getActiveLangAbbr()
01948     {
01949         // Performance
01950         if (!$this->getConfig()->getConfigParam('bl_perfLoadLanguages')) {
01951             return;
01952         }
01953 
01954         if (!isset($this->_sActiveLangAbbr)) {
01955             $aLanguages = oxRegistry::getLang()->getLanguageArray();
01956             while (list($sKey, $oVal) = each($aLanguages)) {
01957                 if ($oVal->selected) {
01958                     $this->_sActiveLangAbbr = $oVal->abbr;
01959                     break;
01960                 }
01961             }
01962         }
01963 
01964         return $this->_sActiveLangAbbr;
01965     }
01966 
01974     public function addGlobalParams($oShop = null)
01975     {
01976         $oViewConf = parent::addGlobalParams($oShop);
01977 
01978         $this->_setNrOfArtPerPage();
01979 
01980         return $oViewConf;
01981     }
01982 
01988     public function getAdditionalParams()
01989     {
01990         if ($this->_sAdditionalParams === null) {
01991             // #1018A
01992             $this->_sAdditionalParams = parent::getAdditionalParams();
01993             $this->_sAdditionalParams .= 'cl=' . $this->getConfig()->getTopActiveView()->getClassName();
01994 
01995             // #1834M - specialchar search
01996             $sSearchParamForLink = rawurlencode(oxRegistry::getConfig()->getRequestParameter('searchparam', true));
01997             if (isset($sSearchParamForLink)) {
01998                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01999             }
02000             if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchtag'))) {
02001                 $this->_sAdditionalParams .= '&amp;searchtag=' . rawurlencode(rawurldecode($sVar));
02002             }
02003             if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchcnid'))) {
02004                 $this->_sAdditionalParams .= '&amp;searchcnid=' . rawurlencode(rawurldecode($sVar));
02005             }
02006             if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchvendor'))) {
02007                 $this->_sAdditionalParams .= '&amp;searchvendor=' . rawurlencode(rawurldecode($sVar));
02008             }
02009             if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchmanufacturer'))) {
02010                 $this->_sAdditionalParams .= '&amp;searchmanufacturer=' . rawurlencode(rawurldecode($sVar));
02011             }
02012             if (($sVar = oxRegistry::getConfig()->getRequestParameter('cnid'))) {
02013                 $this->_sAdditionalParams .= '&amp;cnid=' . rawurlencode(rawurldecode($sVar));
02014             }
02015             if (($sVar = oxRegistry::getConfig()->getRequestParameter('mnid'))) {
02016                 $this->_sAdditionalParams .= '&amp;mnid=' . rawurlencode(rawurldecode($sVar));
02017             }
02018         }
02019 
02020         return $this->_sAdditionalParams;
02021     }
02022 
02028     public function generatePageNavigationUrl()
02029     {
02030         return $this->getConfig()->getShopHomeURL() . $this->_getRequestParams(false);
02031     }
02032 
02042     protected function _addPageNrParam($sUrl, $iPage, $iLang = null)
02043     {
02044         if ($iPage) {
02045             if ((strpos($sUrl, 'pgNr='))) {
02046                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr=' . $iPage, $sUrl);
02047             } else {
02048                 $sUrl .= ((strpos($sUrl, '?') === false) ? '?' : '&amp;') . 'pgNr=' . $iPage;
02049             }
02050         } else {
02051             $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02052             $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
02053             $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
02054             $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
02055         }
02056 
02057         return $sUrl;
02058     }
02059 
02063     public function getPageNavigation()
02064     {
02065 
02066     }
02067 
02075     public function getPageNavigationLimitedTop($iPositionCount = 7)
02076     {
02077         $this->_oPageNavigation = $this->generatePageNavigation($iPositionCount);
02078 
02079         return $this->_oPageNavigation;
02080     }
02081 
02089     public function getPageNavigationLimitedBottom($iPositionCount = 11)
02090     {
02091         $this->_oPageNavigation = $this->generatePageNavigation($iPositionCount);
02092 
02093         return $this->_oPageNavigation;
02094     }
02095 
02096 
02104     public function generatePageNavigation($iPositionCount = 0)
02105     {
02106         startProfile('generatePageNavigation');
02107 
02108         $pageNavigation = new stdClass();
02109 
02110         $pageNavigation->NrOfPages = $this->_iCntPages;
02111         $iActPage = $this->getActPage();
02112         $pageNavigation->actPage = $iActPage + 1;
02113         $sUrl = $this->generatePageNavigationUrl();
02114 
02115         if ($iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages)) {
02116             $iStartNo = 2;
02117             $iFinishNo = $pageNavigation->NrOfPages;
02118         } else {
02119             $iTmpVal = $iPositionCount - 3;
02120             $iTmpVal2 = floor(($iPositionCount - 4) / 2);
02121 
02122             // actual page is at the start
02123             if ($pageNavigation->actPage <= $iTmpVal) {
02124                 $iStartNo = 2;
02125                 $iFinishNo = $iTmpVal + 1;
02126                 // actual page is at the end
02127             } elseif ($pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal) {
02128                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02129                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02130                 // actual page is in the middle
02131             } else {
02132                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02133                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02134             }
02135         }
02136 
02137         if ($iActPage > 0) {
02138             $pageNavigation->previousPage = $this->_addPageNrParam($sUrl, $iActPage - 1);
02139         }
02140 
02141         if ($iActPage < $pageNavigation->NrOfPages - 1) {
02142             $pageNavigation->nextPage = $this->_addPageNrParam($sUrl, $iActPage + 1);
02143         }
02144 
02145         if ($pageNavigation->NrOfPages > 1) {
02146 
02147             for ($i = 1; $i < $pageNavigation->NrOfPages + 1; $i++) {
02148 
02149                 if ($i == 1 || $i == $pageNavigation->NrOfPages || ($i >= $iStartNo && $i <= $iFinishNo)) {
02150                     $page = new stdClass();
02151                     $page->url = $this->_addPageNrParam($sUrl, $i - 1);
02152                     $page->selected = ($i == $pageNavigation->actPage) ? 1 : 0;
02153                     $pageNavigation->changePage[$i] = $page;
02154                 }
02155             }
02156 
02157             // first/last one
02158             $pageNavigation->firstpage = $this->_addPageNrParam($sUrl, 0);
02159             $pageNavigation->lastpage = $this->_addPageNrParam($sUrl, $pageNavigation->NrOfPages - 1);
02160         }
02161 
02162         stopProfile('generatePageNavigation');
02163 
02164         return $pageNavigation;
02165     }
02166 
02173     public function render()
02174     {
02175         foreach (array_keys($this->_oaComponents) as $sComponentName) {
02176             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02177         }
02178 
02179         parent::render();
02180 
02181         if ($this->getIsOrderStep()) {
02182 
02183             // disabling navigation during order ...
02184             if ($this->getConfig()->getConfigParam('blDisableNavBars')) {
02185                 $this->_iNewsRealStatus = 1;
02186                 $this->setShowNewsletter(0);
02187             }
02188         }
02189 
02190         return $this->_sThisTemplate;
02191     }
02192 
02198     public function getViewProduct()
02199     {
02200         return $this->getProduct();
02201     }
02202 
02208     public function setViewProduct($oProduct)
02209     {
02210         $this->_oProduct = $oProduct;
02211     }
02212 
02218     public function getViewProductList()
02219     {
02220         return $this->_aArticleList;
02221     }
02222 
02228     public function getActPage()
02229     {
02230         if ($this->_iActPage === null) {
02231             $this->_iActPage = ( int ) $this->getConfig()->getRequestParameter('pgNr');
02232             $this->_iActPage = ($this->_iActPage < 0) ? 0 : $this->_iActPage;
02233         }
02234 
02235         return $this->_iActPage;
02236     }
02237 
02245     public function getActTag()
02246     {
02247         if ($this->_oActTag === null) {
02248             $this->_oActTag = new stdClass();
02249             $this->_oActTag->sTag = $sTag = $this->getConfig()->getRequestParameter("searchtag", 1);
02250             $oSeoEncoderTag = oxRegistry::get("oxSeoEncoderTag");
02251 
02252             $sLink = false;
02253             if (oxRegistry::getUtils()->seoIsActive()) {
02254                 $sLink = $oSeoEncoderTag->getTagUrl($sTag, oxRegistry::getLang()->getBaseLanguage());
02255             }
02256 
02257             $sConstructedUrl = $this->getConfig()->getShopHomeURL() . $oSeoEncoderTag->getStdTagUri($sTag, false);
02258             $this->_oActTag->link = $sLink ? $sLink : $sConstructedUrl;
02259         }
02260 
02261         return $this->_oActTag;
02262     }
02263 
02271     public function getActVendor()
02272     {
02273         // if active vendor is not set yet - trying to load it from request params
02274         // this may be useful when category component was unable to load active vendor
02275         // and we still need some object to mount navigation info
02276         if ($this->_oActVendor === null) {
02277             $this->_oActVendor = false;
02278             $sVendorId = $this->getConfig()->getRequestParameter('cnid');
02279             $sVendorId = $sVendorId ? str_replace('v_', '', $sVendorId) : $sVendorId;
02280             $oVendor = oxNew('oxVendor');
02281             if ($oVendor->load($sVendorId)) {
02282                 $this->_oActVendor = $oVendor;
02283             }
02284         }
02285 
02286         return $this->_oActVendor;
02287     }
02288 
02296     public function getActManufacturer()
02297     {
02298         // if active Manufacturer is not set yet - trying to load it from request params
02299         // this may be useful when category component was unable to load active Manufacturer
02300         // and we still need some object to mount navigation info
02301         if ($this->_oActManufacturer === null) {
02302 
02303             $this->_oActManufacturer = false;
02304             $sManufacturerId = $this->getConfig()->getRequestParameter('mnid');
02305             $oManufacturer = oxNew('oxManufacturer');
02306             if ($oManufacturer->load($sManufacturerId)) {
02307                 $this->_oActManufacturer = $oManufacturer;
02308             }
02309         }
02310 
02311         return $this->_oActManufacturer;
02312     }
02313 
02319     public function setActVendor($oVendor)
02320     {
02321         $this->_oActVendor = $oVendor;
02322     }
02323 
02329     public function setActManufacturer($oManufacturer)
02330     {
02331         $this->_oActManufacturer = $oManufacturer;
02332     }
02333 
02339     public function getActSearch()
02340     {
02341         if ($this->_oActSearch === null) {
02342             $this->_oActSearch = new stdClass();
02343             $sUrl = $this->getConfig()->getShopHomeURL();
02344             $this->_oActSearch->link = "{$sUrl}cl=search";
02345         }
02346 
02347         return $this->_oActSearch;
02348     }
02349 
02355     public function getCategoryTree()
02356     {
02357         return $this->_oCategoryTree;
02358     }
02359 
02365     public function setCategoryTree($oCatTree)
02366     {
02367         $this->_oCategoryTree = $oCatTree;
02368     }
02369 
02375     public function getManufacturerTree()
02376     {
02377         return $this->_oManufacturerTree;
02378     }
02379 
02385     public function setManufacturerTree($oManufacturerTree)
02386     {
02387         $this->_oManufacturerTree = $oManufacturerTree;
02388     }
02389 
02393     public function getAddUrlParams()
02394     {
02395     }
02396 
02405     public function getTop5ArticleList($iCount = null)
02406     {
02407         if ($this->_blTop5Action) {
02408             if ($this->_aTop5ArticleList === null) {
02409                 $this->_aTop5ArticleList = false;
02410                 $myConfig = $this->getConfig();
02411                 if ($myConfig->getConfigParam('bl_perfLoadAktion')) {
02412                     // top 5 articles
02413                     $oArtList = oxNew('oxArticleList');
02414                     $oArtList->loadTop5Articles($iCount);
02415                     if ($oArtList->count()) {
02416                         $this->_aTop5ArticleList = $oArtList;
02417                     }
02418                 }
02419             }
02420         }
02421 
02422         return $this->_aTop5ArticleList;
02423     }
02424 
02431     public function getBargainArticleList()
02432     {
02433         if ($this->_blBargainAction) {
02434             if ($this->_aBargainArticleList === null) {
02435                 $this->_aBargainArticleList = array();
02436                 if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
02437                     $oArtList = oxNew('oxArticleList');
02438                     $oArtList->loadActionArticles('OXBARGAIN');
02439                     if ($oArtList->count()) {
02440                         $this->_aBargainArticleList = $oArtList;
02441                     }
02442                 }
02443             }
02444         }
02445 
02446         return $this->_aBargainArticleList;
02447     }
02448 
02457     public function isLowOrderPrice()
02458     {
02459         if ($this->_blLowOrderPrice === null && ($oBasket = $this->getSession()->getBasket())) {
02460             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02461         }
02462 
02463         return $this->_blLowOrderPrice;
02464     }
02465 
02473     public function getMinOrderPrice()
02474     {
02475         if ($this->_sMinOrderPrice === null && $this->isLowOrderPrice()) {
02476             $dMinOrderPrice = oxPrice::getPriceInActCurrency($this->getConfig()->getConfigParam('iMinOrderPrice'));
02477             $this->_sMinOrderPrice = oxRegistry::getLang()->formatCurrency($dMinOrderPrice);
02478         }
02479 
02480         return $this->_sMinOrderPrice;
02481     }
02482 
02488     public function getNewsRealStatus()
02489     {
02490         return $this->_iNewsRealStatus;
02491     }
02492 
02498     protected function _canRedirect()
02499     {
02500         foreach ($this->_aBlockRedirectParams as $sParam) {
02501             if ($this->getConfig()->getRequestParameter($sParam) !== null) {
02502                 return false;
02503             }
02504         }
02505 
02506         return true;
02507     }
02508 
02512     public function getProduct()
02513     {
02514     }
02515 
02521     public function getManufacturerlist()
02522     {
02523         return $this->_aManufacturerlist;
02524     }
02525 
02531     public function setManufacturerlist($aList)
02532     {
02533         $this->_aManufacturerlist = $aList;
02534     }
02535 
02541     public function setRootVendor($oVendor)
02542     {
02543         $this->_oRootVendor = $oVendor;
02544     }
02545 
02551     public function getRootVendor()
02552     {
02553         return $this->_oRootVendor;
02554     }
02555 
02561     public function setRootManufacturer($oManufacturer)
02562     {
02563         $this->_oRootManufacturer = $oManufacturer;
02564     }
02565 
02571     public function getRootManufacturer()
02572     {
02573         return $this->_oRootManufacturer;
02574     }
02575 
02581     public function getVendorId()
02582     {
02583         if ($this->_sVendorId === null) {
02584             $this->_sVendorId = false;
02585             if (($oVendor = $this->getActVendor())) {
02586                 $this->_sVendorId = $oVendor->getId();
02587             }
02588         }
02589 
02590         return $this->_sVendorId;
02591     }
02592 
02598     public function getManufacturerId()
02599     {
02600         if ($this->_sManufacturerId === null) {
02601             $this->_sManufacturerId = false;
02602             if (($oManufacturer = $this->getActManufacturer())) {
02603                 $this->_sManufacturerId = $oManufacturer->getId();
02604             }
02605         }
02606 
02607         return $this->_sManufacturerId;
02608     }
02609 
02615     public function getCatMoreUrl()
02616     {
02617         return $this->getConfig()->getShopHomeURL() . 'cnid=oxmore';
02618     }
02619 
02625     public function getCatTreePath()
02626     {
02627         return $this->_sCatTreePath;
02628     }
02629 
02637     public function getContentByIdent($sIdent)
02638     {
02639         if (!isset($this->_aContents[$sIdent])) {
02640             $this->_aContents[$sIdent] = oxNew('oxContent');
02641             $this->_aContents[$sIdent]->loadByIdent($sIdent);
02642         }
02643 
02644         return $this->_aContents[$sIdent];
02645     }
02646 
02652     public function getContentCategory()
02653     {
02654         return false;
02655     }
02656 
02662     public function getMustFillFields()
02663     {
02664         if ($this->_aMustFillFields === null) {
02665             $this->_aMustFillFields = false;
02666 
02667             // passing must-be-filled-fields info
02668             $aMustFillFields = $this->getConfig()->getConfigParam('aMustFillFields');
02669             if (is_array($aMustFillFields)) {
02670                 $this->_aMustFillFields = array_flip($aMustFillFields);
02671             }
02672         }
02673 
02674         return $this->_aMustFillFields;
02675     }
02676 
02684     public function isFieldRequired($sField)
02685     {
02686         if ($aMustFillFields = $this->getMustFillFields()) {
02687             if (isset($aMustFillFields[$sField])) {
02688                 return true;
02689             }
02690         }
02691 
02692         return false;
02693     }
02694 
02700     public function getFormId()
02701     {
02702         if ($this->_sFormId === null) {
02703             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02704             oxRegistry::getSession()->setVariable('sessionuformid', $this->_sFormId);
02705         }
02706 
02707         return $this->_sFormId;
02708     }
02709 
02715     public function canAcceptFormData()
02716     {
02717         if ($this->_blCanAcceptFormData === null) {
02718             $this->_blCanAcceptFormData = false;
02719 
02720             $sFormId = $this->getConfig()->getRequestParameter("uformid");
02721             $sSessionFormId = oxRegistry::getSession()->getVariable("sessionuformid");
02722 
02723             // testing if form and session ids matches
02724             if ($sFormId && $sFormId === $sSessionFormId) {
02725                 $this->_blCanAcceptFormData = true;
02726             }
02727 
02728             // regenerating form data
02729             $this->getFormId();
02730         }
02731 
02732         return $this->_blCanAcceptFormData;
02733     }
02734 
02740     public function getPromoFinishedList()
02741     {
02742         if (isset($this->_oPromoFinishedList)) {
02743             return $this->_oPromoFinishedList;
02744         }
02745         $this->_oPromoFinishedList = oxNew('oxActionList');
02746         $this->_oPromoFinishedList->loadFinishedByCount(2);
02747 
02748         return $this->_oPromoFinishedList;
02749     }
02750 
02756     public function getPromoCurrentList()
02757     {
02758         if (isset($this->_oPromoCurrentList)) {
02759             return $this->_oPromoCurrentList;
02760         }
02761         $this->_oPromoCurrentList = oxNew('oxActionList');
02762         $this->_oPromoCurrentList->loadCurrent();
02763 
02764         return $this->_oPromoCurrentList;
02765     }
02766 
02772     public function getPromoFutureList()
02773     {
02774         if (isset($this->_oPromoFutureList)) {
02775             return $this->_oPromoFutureList;
02776         }
02777         $this->_oPromoFutureList = oxNew('oxActionList');
02778         $this->_oPromoFutureList->loadFutureByCount(2);
02779 
02780         return $this->_oPromoFutureList;
02781     }
02782 
02788     public function getShowPromotionList()
02789     {
02790         if (isset($this->_blShowPromotions)) {
02791             return $this->_blShowPromotions;
02792         }
02793         $this->_blShowPromotions = false;
02794         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02795             $this->_blShowPromotions = (count($this->getPromoFinishedList()) + count($this->getPromoCurrentList()) +
02796                                         count($this->getPromoFutureList())) > 0;
02797         }
02798 
02799         return $this->_blShowPromotions;
02800     }
02801 
02807     public function isEnabledPrivateSales()
02808     {
02809         if ($this->_blEnabledPrivateSales === null) {
02810             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam('blPsLoginEnabled');
02811             if ($this->_blEnabledPrivateSales && ($blCanPreview = oxRegistry::getUtils()->canPreview()) !== null) {
02812                 $this->_blEnabledPrivateSales = !$blCanPreview;
02813             }
02814         }
02815 
02816         return $this->_blEnabledPrivateSales;
02817     }
02818 
02824     public function getFieldValidationErrors()
02825     {
02826         return oxRegistry::get("oxInputValidator")->getFieldValidationErrors();
02827     }
02828 
02834     public function getBreadCrumb()
02835     {
02836         return null;
02837     }
02838 
02844     public function setRootCatChanged($blRootCatChanged)
02845     {
02846         $this->_blRootCatChanged = $blRootCatChanged;
02847     }
02848 
02854     public function isRootCatChanged()
02855     {
02856         return $this->_blRootCatChanged;
02857     }
02858 
02864     public function getInvoiceAddress()
02865     {
02866         if ($this->_aInvoiceAddress == null) {
02867             $aAddress = $this->getConfig()->getRequestParameter('invadr');
02868             if ($aAddress) {
02869                 $this->_aInvoiceAddress = $aAddress;
02870             }
02871         }
02872 
02873         return $this->_aInvoiceAddress;
02874     }
02875 
02881     public function getDeliveryAddress()
02882     {
02883         if ($this->_aDeliveryAddress == null) {
02884             $oConfig = $this->getConfig();
02885             //do not show deladr if address was reloaded
02886             if (!$oConfig->getRequestParameter('reloadaddress')) {
02887                 $this->_aDeliveryAddress = $oConfig->getRequestParameter('deladr');
02888             }
02889         }
02890 
02891         return $this->_aDeliveryAddress;
02892     }
02893 
02899     public function setDeliveryAddress($aDeliveryAddress)
02900     {
02901         $this->_aDeliveryAddress = $aDeliveryAddress;
02902     }
02903 
02909     public function setInvoiceAddress($aAddress)
02910     {
02911         $this->_aInvoiceAddress = $aAddress;
02912     }
02913 
02919     public function getActiveUsername()
02920     {
02921         if ($this->_sActiveUsername == null) {
02922             $this->_sActiveUsername = false;
02923             $sUsername = $this->getConfig()->getRequestParameter('lgn_usr');
02924             if ($sUsername) {
02925                 $this->_sActiveUsername = $sUsername;
02926             } elseif ($oUser = $this->getUser()) {
02927                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
02928             }
02929         }
02930 
02931         return $this->_sActiveUsername;
02932     }
02933 
02939     public function getWishlistUserId()
02940     {
02941         return $this->getConfig()->getRequestParameter('wishid');
02942     }
02943 
02947     public function getSearchCatId()
02948     {
02949     }
02950 
02954     public function getSearchVendor()
02955     {
02956     }
02957 
02961     public function getSearchManufacturer()
02962     {
02963     }
02964 
02968     public function getLastProducts()
02969     {
02970 
02971     }
02972 
02978     public function getNewBasketItemMsgType()
02979     {
02980         return (int) $this->getConfig()->getConfigParam("iNewBasketItemMessage");
02981     }
02982 
02990     public function isActive($sName)
02991     {
02992         return $this->getConfig()->getConfigParam("bl" . $sName . "Enabled");
02993     }
02994 
03000     public function isFbWidgetVisible()
03001     {
03002         if ($this->_blFbWidgetsOn === null) {
03003             $oUtils = oxRegistry::get("oxUtilsServer");
03004 
03005             // reading ..
03006             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie("fbwidgetson");
03007         }
03008 
03009         return $this->_blFbWidgetsOn;
03010     }
03011 
03017     public function isEnabledDownloadableFiles()
03018     {
03019         return (bool) $this->getConfig()->getConfigParam("blEnableDownloads");
03020     }
03021 
03027     public function showRememberMe()
03028     {
03029         return (bool) $this->getConfig()->getConfigParam('blShowRememberMe');
03030     }
03031 
03038     public function isVatIncluded()
03039     {
03040         $blResult = true;
03041         $oUser = $this->getUser();
03042         $oConfig = $this->getConfig();
03043 
03044         $blShowNetPriceParameter = $oConfig->getConfigParam('blShowNetPrice');
03045         $blPerfCalcVatOnlyForBasketOrderParameter = $oConfig->getConfigParam('bl_perfCalcVatOnlyForBasketOrder');
03046         if ($blShowNetPriceParameter || $blPerfCalcVatOnlyForBasketOrderParameter) {
03047             $blResult = false;
03048         } elseif ($oUser && $oUser->isPriceViewModeNetto()) {
03049             $blResult = false;
03050         }
03051 
03052         return $blResult;
03053     }
03054 
03060     public function isPriceCalculated()
03061     {
03062         return (bool) $this->getConfig()->getConfigParam('bl_perfLoadPrice');
03063     }
03064 
03070     public function showTags()
03071     {
03072         return (bool) $this->_blShowTagCloud && $this->getConfig()->getConfigParam("blShowTags");
03073     }
03074 
03080     public function getWishlistName()
03081     {
03082         if ($this->getUser()) {
03083             $sWishId = $this->getConfig()->getRequestParameter('wishid');
03084             $sUserId = ($sWishId) ? $sWishId : oxRegistry::getSession()->getVariable('wishid');
03085             if ($sUserId) {
03086                 $oWishUser = oxNew('oxUser');
03087                 if ($oWishUser->load($sUserId)) {
03088                     return $oWishUser;
03089                 }
03090             }
03091         }
03092 
03093         return false;
03094     }
03095 
03101     public function getWidgetLink()
03102     {
03103         return oxRegistry::getConfig()->getWidgetUrl();
03104     }
03105 }