idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
37,600
public function getOrderSum ( $ blToday = false ) { $ sSelect = 'select sum(oxtotalordersum / oxcurrate) from oxorder where ' ; $ sSelect .= 'oxshopid = "' . \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) . '" and oxorder.oxstorno != "1" ' ; if ( $ blToday ) { $ sSelect .= 'and oxorderdate like "' . date ( 'Y-m-d' ) . '%" ' ; } return ( double ) \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sSelect ) ; }
Returns orders total price
37,601
public function getOrderCnt ( $ blToday = false ) { $ sSelect = 'select count(*) from oxorder where ' ; $ sSelect .= 'oxshopid = "' . \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) . '" and oxorder.oxstorno != "1" ' ; if ( $ blToday ) { $ sSelect .= 'and oxorderdate like "' . date ( 'Y-m-d' ) . '%" ' ; } return ( int ) \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sSelect ) ; }
Returns orders count
37,602
protected function _checkOrderExist ( $ sOxId = null ) { if ( ! $ sOxId ) { return false ; } $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; if ( $ masterDb -> getOne ( 'select oxid from oxorder where oxid = ' . $ masterDb -> quote ( $ sOxId ) ) ) { return true ; } return false ; }
Checking if this order is already stored .
37,603
protected function _sendOrderByEmail ( $ oUser = null , $ oBasket = null , $ oPayment = null ) { $ iRet = self :: ORDER_STATE_MAILINGERROR ; $ this -> _oUser = $ oUser ; $ this -> _oBasket = $ oBasket ; $ this -> _oPayment = $ oPayment ; $ oxEmail = oxNew ( \ OxidEsales \ Eshop \ Core \ Email :: class ) ; if ( $ oxEmail -> sendOrderEMailToUser ( $ this ) ) { $ iRet = self :: ORDER_STATE_OK ; } $ oxEmail -> sendOrderEMailToOwner ( $ this ) ; return $ iRet ; }
Send order to shop owner and user
37,604
public function getDelSet ( ) { if ( $ this -> _oDelSet == null ) { $ this -> _oDelSet = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ DeliverySet :: class ) ; $ this -> _oDelSet -> load ( $ this -> oxorder__oxdeltype -> value ) ; } return $ this -> _oDelSet ; }
Returns order deliveryset object
37,605
public function getPaymentType ( ) { if ( $ this -> oxorder__oxpaymentid -> value && $ this -> _oPaymentType === null ) { $ this -> _oPaymentType = false ; $ oPaymentType = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ UserPayment :: class ) ; if ( $ oPaymentType -> load ( $ this -> oxorder__oxpaymentid -> value ) ) { $ this -> _oPaymentType = $ oPaymentType ; } } return $ this -> _oPaymentType ; }
Get payment type
37,606
public function getGiftCard ( ) { if ( $ this -> oxorder__oxcardid -> value && $ this -> _oGiftCard == null ) { $ this -> _oGiftCard = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Wrapping :: class ) ; $ this -> _oGiftCard -> load ( $ this -> oxorder__oxcardid -> value ) ; } return $ this -> _oGiftCard ; }
Get gift card
37,607
public function getLastUserPaymentType ( $ sUserId ) { $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; $ sQ = 'select oxorder.oxpaymenttype from oxorder where oxorder.oxshopid="' . \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) . '" and oxorder.oxuserid=' . $ masterDb -> quote ( $ sUserId ) . ' order by oxorder.oxorderdate desc ' ; $ sLastPaymentId = $ masterDb -> getOne ( $ sQ ) ; return $ sLastPaymentId ; }
Get users payment type from last order
37,608
protected function _addOrderArticlesToBasket ( $ oBasket , $ aOrderArticles ) { if ( count ( $ aOrderArticles ) > 0 ) { foreach ( $ aOrderArticles as $ oOrderArticle ) { $ oBasket -> addOrderArticleToBasket ( $ oOrderArticle ) ; } } }
Adds order articles back to virtual basket . Needed for recalculating order .
37,609
public function getTotalOrderSum ( ) { $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; return number_format ( ( double ) $ this -> oxorder__oxtotalordersum -> value , $ oCur -> decimal , '.' , '' ) ; }
Get total sum from last order
37,610
public function getProductVats ( $ blFormatCurrency = true ) { $ aVats = [ ] ; if ( $ this -> oxorder__oxartvat1 -> value ) { $ aVats [ $ this -> oxorder__oxartvat1 -> value ] = $ this -> oxorder__oxartvatprice1 -> value ; } if ( $ this -> oxorder__oxartvat2 -> value ) { $ aVats [ $ this -> oxorder__oxartvat2 -> value ] = $ this -> oxorder__oxartvatprice2 -> value ; } if ( $ blFormatCurrency ) { $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; foreach ( $ aVats as $ sKey => $ dVat ) { $ aVats [ $ sKey ] = $ oLang -> formatCurrency ( $ dVat , $ oCur ) ; } } return $ aVats ; }
Returns array of plain formatted VATs stored in order
37,611
public function getBillCountry ( ) { if ( ! $ this -> oxorder__oxbillcountry -> value ) { $ this -> oxorder__oxbillcountry = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> _getCountryTitle ( $ this -> oxorder__oxbillcountryid -> value ) ) ; } return $ this -> oxorder__oxbillcountry ; }
Get billing country name from billing country id
37,612
public function getDelCountry ( ) { if ( ! $ this -> oxorder__oxdelcountry -> value ) { $ this -> oxorder__oxdelcountry = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> _getCountryTitle ( $ this -> oxorder__oxdelcountryid -> value ) ) ; } return $ this -> oxorder__oxdelcountry ; }
Get delivery country name from delivery country id
37,613
public function cancelOrder ( ) { $ this -> oxorder__oxstorno = new \ OxidEsales \ Eshop \ Core \ Field ( 1 ) ; if ( $ this -> save ( ) ) { foreach ( $ this -> getOrderArticles ( ) as $ oOrderArticle ) { $ oOrderArticle -> cancelOrderArticle ( ) ; } } }
Performs order cancel process
37,614
public function getOrderCurrency ( ) { if ( $ this -> _oOrderCurrency === null ) { $ aCurrencies = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getCurrencyArray ( ) ; $ this -> _oOrderCurrency = current ( $ aCurrencies ) ; foreach ( $ aCurrencies as $ oCurr ) { if ( $ oCurr -> name == $ this -> oxorder__oxcurrency -> value ) { $ this -> _oOrderCurrency = $ oCurr ; break ; } } } return $ this -> _oOrderCurrency ; }
Returns actual order currency object . In case currency was not recognized due to changed name returns first shop currency object
37,615
public function validateOrder ( $ oBasket , $ oUser ) { $ iValidState = $ this -> validateStock ( $ oBasket ) ; if ( ! $ iValidState ) { $ iValidState = $ this -> validateDelivery ( $ oBasket ) ; } if ( ! $ iValidState ) { $ iValidState = $ this -> validatePayment ( $ oBasket ) ; } if ( ! $ iValidState ) { $ iValidState = $ this -> validateDeliveryAddress ( $ oUser ) ; } if ( ! $ iValidState ) { $ iValidState = $ this -> validateBasket ( $ oBasket ) ; } return $ iValidState ; }
Validates order parameters like stock delivery and payment parameters
37,616
public function validatePayment ( $ oBasket ) { $ paymentId = $ oBasket -> getPaymentId ( ) ; if ( ! $ this -> isValidPaymentId ( $ paymentId ) || ! $ this -> isValidPayment ( $ oBasket ) ) { return self :: ORDER_STATE_INVALIDPAYMENT ; } }
Checks if payment used for current order is available and active . Throws exception if not available
37,617
public function getFormattedTotalNetSum ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxtotalnetsum -> value , $ this -> getOrderCurrency ( ) ) ; }
Get total net sum formatted
37,618
public function getFormattedTotalBrutSum ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxtotalbrutsum -> value , $ this -> getOrderCurrency ( ) ) ; }
Get total brut sum formatted
37,619
public function getFormattedDeliveryCost ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxdelcost -> value , $ this -> getOrderCurrency ( ) ) ; }
Get Delivery cost sum formatted
37,620
public function getFormattedPayCost ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxpaycost -> value , $ this -> getOrderCurrency ( ) ) ; }
Get pay cost sum formatted
37,621
public function getFormattedTotalVouchers ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxvoucherdiscount -> value , $ this -> getOrderCurrency ( ) ) ; }
Get total vouchers formatted
37,622
public function getFormattedDiscount ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxdiscount -> value , $ this -> getOrderCurrency ( ) ) ; }
Get Discount formatted
37,623
public function getFormattedTotalOrderSum ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> oxorder__oxtotalordersum -> value , $ this -> getOrderCurrency ( ) ) ; }
Get formatted total sum from last order
37,624
public function getShipmentTrackingUrl ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ this -> _sShipTrackUrl === null ) { $ sParcelService = $ oConfig -> getConfigParam ( 'sParcelService' ) ; $ sTrackingCode = $ this -> getTrackCode ( ) ; if ( $ sParcelService && $ sTrackingCode ) { $ this -> _sShipTrackUrl = str_replace ( "##ID##" , $ sTrackingCode , $ sParcelService ) ; } } return $ this -> _sShipTrackUrl ; }
Returns shipment tracking url if oxtrackcode and shipment tracking url are supplied
37,625
private function isValidPaymentId ( $ paymentId ) { $ masterDb = DatabaseProvider :: getMaster ( ) ; $ paymentModel = oxNew ( EshopPayment :: class ) ; $ tableName = $ paymentModel -> getViewName ( ) ; $ sql = " select 1 from {$tableName} where {$tableName}.oxid = {$masterDb->quote($paymentId)} and {$paymentModel->getSqlActiveSnippet()} " ; return ( bool ) $ masterDb -> getOne ( $ sql ) ; }
Returns true if paymentId is valid .
37,626
private function isValidPayment ( $ basket ) { $ paymentId = $ basket -> getPaymentId ( ) ; $ paymentModel = oxNew ( EshopPayment :: class ) ; $ paymentModel -> load ( $ paymentId ) ; $ dynamicValues = $ this -> getDynamicValues ( ) ; $ shopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; return $ paymentModel -> isValidPayment ( $ dynamicValues , $ shopId , $ this -> getUser ( ) , $ basket -> getPriceForPayment ( ) , $ basket -> getShippingId ( ) ) ; }
Returns true if payment is valid .
37,627
public function toString ( ) { $ sFirstName = $ this -> oxaddress__oxfname -> value ; $ sLastName = $ this -> oxaddress__oxlname -> value ; $ sStreet = $ this -> oxaddress__oxstreet -> value ; $ sStreetNr = $ this -> oxaddress__oxstreetnr -> value ; $ sCity = $ this -> oxaddress__oxcity -> value ; $ sAddress = "" ; if ( $ sFirstName || $ sLastName ) { $ sAddress = $ sFirstName . ( $ sFirstName ? " " : "" ) . "$sLastName, " ; } $ sAddress .= "$sStreet $sStreetNr, $sCity" ; return trim ( $ sAddress ) ; }
Formats address as a single line string
37,628
protected function _getMergedAddressFields ( ) { $ sDelAddress = '' ; $ sDelAddress .= $ this -> oxaddress__oxcompany ; $ sDelAddress .= $ this -> oxaddress__oxfname ; $ sDelAddress .= $ this -> oxaddress__oxlname ; $ sDelAddress .= $ this -> oxaddress__oxstreet ; $ sDelAddress .= $ this -> oxaddress__oxstreetnr ; $ sDelAddress .= $ this -> oxaddress__oxaddinfo ; $ sDelAddress .= $ this -> oxaddress__oxcity ; $ sDelAddress .= $ this -> oxaddress__oxcountryid ; $ sDelAddress .= $ this -> oxaddress__oxstateid ; $ sDelAddress .= $ this -> oxaddress__oxzip ; $ sDelAddress .= $ this -> oxaddress__oxfon ; $ sDelAddress .= $ this -> oxaddress__oxfax ; $ sDelAddress .= $ this -> oxaddress__oxsal ; return $ sDelAddress ; }
Returns merged address fields .
37,629
public function loadAppServer ( $ id ) { $ appServer = $ this -> appServerDao -> findAppServer ( $ id ) ; if ( $ appServer === null ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ NoResultException :: class ) ; throw $ exception ; } return $ appServer ; }
Load the application server for given id .
37,630
protected function filterActiveAppServers ( $ appServerList ) { $ activeServerList = [ ] ; foreach ( $ appServerList as $ server ) { if ( $ server -> isInUse ( $ this -> currentTime ) ) { $ activeServerList [ $ server -> getId ( ) ] = $ server ; } } return $ activeServerList ; }
Filter only active application servers from given list .
37,631
private function cleanupAppServers ( ) { $ allFoundServers = $ this -> loadAppServerList ( ) ; foreach ( $ allFoundServers as $ server ) { if ( $ server -> needToDelete ( $ this -> currentTime ) ) { $ this -> deleteAppServerById ( $ server -> getId ( ) ) ; } } }
Deletes all application servers that are longer not active .
37,632
public function updateAppServerInformation ( $ adminMode ) { $ this -> appServerDao -> startTransaction ( ) ; try { $ appServer = $ this -> appServerDao -> findAppServer ( $ this -> utilsServer -> getServerNodeId ( ) ) ; if ( $ appServer === null ) { $ this -> addNewAppServerData ( $ adminMode ) ; } elseif ( $ appServer -> needToUpdate ( $ this -> currentTime ) ) { $ this -> updateAppServerData ( $ appServer , $ adminMode ) ; } } catch ( \ Exception $ exception ) { $ this -> appServerDao -> rollbackTransaction ( ) ; throw $ exception ; } $ this -> appServerDao -> commitTransaction ( ) ; }
Renews application server information if it is outdated or if it does not exist .
37,633
private function updateAppServerData ( $ appServer , $ adminMode ) { $ appServer -> setId ( $ this -> utilsServer -> getServerNodeId ( ) ) ; $ appServer -> setIp ( $ this -> utilsServer -> getServerIp ( ) ) ; $ appServer -> setTimestamp ( $ this -> currentTime ) ; if ( $ adminMode ) { $ appServer -> setLastAdminUsage ( $ this -> currentTime ) ; } else { $ appServer -> setLastFrontendUsage ( $ this -> currentTime ) ; } $ this -> saveAppServer ( $ appServer ) ; $ this -> cleanupAppServers ( ) ; }
Updates application server with the newest information .
37,634
private function addNewAppServerData ( $ adminMode ) { $ appServer = oxNew ( \ OxidEsales \ Eshop \ Core \ DataObject \ ApplicationServer :: class ) ; $ appServer -> setId ( $ this -> utilsServer -> getServerNodeId ( ) ) ; $ appServer -> setIp ( $ this -> utilsServer -> getServerIp ( ) ) ; $ appServer -> setTimestamp ( $ this -> currentTime ) ; if ( $ adminMode ) { $ appServer -> setLastAdminUsage ( $ this -> currentTime ) ; } else { $ appServer -> setLastFrontendUsage ( $ this -> currentTime ) ; } $ this -> saveAppServer ( $ appServer ) ; $ this -> cleanupAppServers ( ) ; }
Adds new application server .
37,635
public function filterByUpdatableFields ( array $ listToClean ) { $ allowedFields = $ this -> updatableFields -> getUpdatableFields ( ) ; $ cleanedList = $ listToClean ; if ( $ allowedFields -> count ( ) > 0 ) { $ cleanedList = $ this -> filterFieldsByWhiteList ( $ allowedFields , $ listToClean ) ; } return $ cleanedList ; }
Return only those items which exist in both lists .
37,636
private function filterFieldsByWhiteList ( \ ArrayIterator $ allowedFields , array $ listToClean ) { $ allowedFieldsLowerCase = array_map ( 'strtolower' , ( array ) $ allowedFields ) ; $ cleanedList = array_filter ( $ listToClean , function ( $ field ) use ( $ allowedFieldsLowerCase ) { return in_array ( strtolower ( $ field ) , $ allowedFieldsLowerCase ) ; } , ARRAY_FILTER_USE_KEY ) ; return $ cleanedList ; }
Return fields by performing a case - insensitive compare . Does not change original case - sensitivity of fields .
37,637
public function resetUserCount ( ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> deleteVariable ( "iUserCount" ) ; $ this -> _iUserCount = null ; }
Resets users count
37,638
protected function _setupNavigation ( $ sNode ) { $ sNode = 'newsletter_list' ; $ myAdminNavig = $ this -> getNavigation ( ) ; $ iActTab = 3 ; $ this -> _aViewData [ 'editnavi' ] = $ myAdminNavig -> getTabs ( $ sNode , $ iActTab ) ; $ this -> _aViewData [ 'actlocation' ] = $ myAdminNavig -> getActiveTab ( $ sNode , $ iActTab ) ; $ this -> _aViewData [ 'default_edit' ] = $ myAdminNavig -> getActiveTab ( $ sNode , $ this -> _iDefEdit ) ; $ this -> _aViewData [ 'actedit' ] = $ iActTab ; }
Overrides parent method to pass referred id
37,639
public function assign ( $ aData ) { if ( ! is_array ( $ aData ) ) { return ; } foreach ( $ aData as $ sKey => $ sValue ) { $ sFieldName = strtolower ( $ this -> _sTableName . '__' . $ sKey ) ; $ this -> $ sFieldName = new \ OxidEsales \ Eshop \ Core \ Field ( $ sValue ) ; } }
Assigns database record to object
37,640
public function getTemplateOutput ( $ templateName , $ oObject ) { $ smarty = $ this -> getSmarty ( ) ; $ debugMode = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iDebug' ) ; $ viewData = $ oObject -> getViewData ( ) ; if ( is_array ( $ viewData ) ) { foreach ( array_keys ( $ viewData ) as $ viewName ) { if ( $ debugMode == 4 ) { echo ( "TemplateData[$viewName] : \n" ) ; var_export ( $ viewData [ $ viewName ] ) ; } $ smarty -> assign ( $ viewName , $ viewData [ $ viewName ] ) ; } } return $ smarty -> fetch ( $ templateName ) ; }
Returns rendered template output . According to debug configuration outputs debug information .
37,641
public function passAllErrorsToView ( & $ aView , $ errors ) { if ( count ( $ errors ) > 0 ) { foreach ( $ errors as $ sLocation => $ aEx2 ) { foreach ( $ aEx2 as $ sKey => $ oEr ) { $ aView [ 'Errors' ] [ $ sLocation ] [ $ sKey ] = unserialize ( $ oEr ) ; } } } }
adds the given errors to the view array
37,642
public function addErrorToDisplay ( $ oEr , $ blFull = false , $ useCustomDestination = false , $ customDestination = "" , $ activeController = "" ) { $ destination = 'default' ; $ customDestination = $ customDestination ? $ customDestination : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'CustomError' ) ; if ( $ useCustomDestination && $ customDestination ) { $ destination = $ customDestination ; } $ session = $ this -> getSession ( ) ; if ( ! $ session -> getId ( ) && ! $ session -> isHeaderSent ( ) ) { $ session -> setForceNewSession ( ) ; $ session -> start ( ) ; } $ aEx = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'Errors' ) ; if ( $ oEr instanceof \ OxidEsales \ Eshop \ Core \ Exception \ StandardException ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ExceptionToDisplay :: class ) ; $ oEx -> setMessage ( $ oEr -> getMessage ( ) ) ; $ oEx -> setExceptionType ( $ oEr -> getType ( ) ) ; if ( $ oEr instanceof \ OxidEsales \ Eshop \ Core \ Exception \ SystemComponentException ) { $ oEx -> setMessageArgs ( $ oEr -> getComponent ( ) ) ; } $ oEx -> setValues ( $ oEr -> getValues ( ) ) ; $ oEx -> setStackTrace ( $ oEr -> getTraceAsString ( ) ) ; $ oEx -> setDebug ( $ blFull ) ; $ oEr = $ oEx ; } elseif ( $ oEr && ! ( $ oEr instanceof \ OxidEsales \ Eshop \ Core \ Contract \ IDisplayError ) ) { $ sTmp = $ oEr ; $ oEr = oxNew ( \ OxidEsales \ Eshop \ Core \ DisplayError :: class ) ; $ oEr -> setMessage ( $ sTmp ) ; } elseif ( $ oEr instanceof \ OxidEsales \ Eshop \ Core \ Contract \ IDisplayError ) { } else { $ oEr = null ; } if ( $ oEr ) { $ aEx [ $ destination ] [ ] = serialize ( $ oEr ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'Errors' , $ aEx ) ; if ( $ activeController == '' ) { $ activeController = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'actcontrol' ) ; } if ( $ activeController ) { $ aControllerErrors [ $ destination ] = $ activeController ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'ErrorController' , $ aControllerErrors ) ; } } }
Adds an exception to the array of displayed exceptions for the view by default is displayed in the inc_header but with the custom destination set to true the exception won t be displayed by default but can be displayed where ever wanted in the tpl
37,643
public function parseThroughSmarty ( $ sDesc , $ sOxid = null , $ oActView = null , $ blRecompile = false ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> isDemoShop ( ) ) { return $ sDesc ; } startProfile ( "parseThroughSmarty" ) ; if ( ! is_array ( $ sDesc ) && strpos ( $ sDesc , "[{" ) === false ) { stopProfile ( "parseThroughSmarty" ) ; return $ sDesc ; } $ activeLanguageId = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getTplLanguage ( ) ; $ smarty = clone $ this -> getSmarty ( ) ; $ tplVars = $ smarty -> _tpl_vars ; $ forceRecompile = $ smarty -> force_compile ; $ smarty -> force_compile = $ blRecompile ; if ( ! $ oActView ) { $ oActView = oxNew ( \ OxidEsales \ Eshop \ Application \ Controller \ FrontendController :: class ) ; $ oActView -> addGlobalParams ( ) ; } $ viewData = $ oActView -> getViewData ( ) ; foreach ( array_keys ( $ viewData ) as $ name ) { $ smarty -> assign ( $ name , $ viewData [ $ name ] ) ; } if ( is_array ( $ sDesc ) ) { foreach ( $ sDesc as $ name => $ aData ) { $ smarty -> oxidcache = new \ OxidEsales \ Eshop \ Core \ Field ( $ aData [ 1 ] , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ result [ $ name ] = $ smarty -> fetch ( "ox:" . $ aData [ 0 ] . $ activeLanguageId ) ; } } else { $ smarty -> oxidcache = new \ OxidEsales \ Eshop \ Core \ Field ( $ sDesc , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ result = $ smarty -> fetch ( "ox:{$sOxid}{$activeLanguageId}" ) ; } $ smarty -> _tpl_vars = $ tplVars ; $ smarty -> force_compile = $ forceRecompile ; stopProfile ( "parseThroughSmarty" ) ; return $ result ; }
Runs long description through smarty . If you pass array of data to process array will be returned if you pass string - string will be passed as result
37,644
public function setTemplateDir ( $ templatesDirectory ) { if ( $ templatesDirectory && ! in_array ( $ templatesDirectory , $ this -> _aTemplateDir ) ) { $ this -> _aTemplateDir [ ] = $ templatesDirectory ; } }
Templates directory setter
37,645
public function getTemplateDirs ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ mainTemplatesDirectory = $ config -> getTemplateDir ( $ this -> isAdmin ( ) ) ; $ this -> setTemplateDir ( $ mainTemplatesDirectory ) ; if ( ! $ this -> isAdmin ( ) ) { $ this -> setTemplateDir ( $ this -> addActiveThemeId ( $ config -> getOutDir ( true ) ) ) ; } return $ this -> _aTemplateDir ; }
Initializes and returns templates directory info array
37,646
public function getTemplateCompileId ( ) { $ shopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ templateDirectories = $ this -> getTemplateDirs ( ) ; return md5 ( reset ( $ templateDirectories ) . '__' . $ shopId ) ; }
Get template compile id .
37,647
public function getSmartyDir ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ compileDir = $ config -> getConfigParam ( 'sCompileDir' ) ; $ smartyDir = $ compileDir . "/smarty/" ; if ( ! is_dir ( $ smartyDir ) ) { @ mkdir ( $ smartyDir ) ; } if ( ! is_writable ( $ smartyDir ) ) { $ smartyDir = $ compileDir ; } return $ smartyDir ; }
Returns a full path to Smarty compile dir
37,648
protected function _fillCommonSmartyProperties ( $ smarty ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ smarty -> left_delimiter = '[{' ; $ smarty -> right_delimiter = '}]' ; $ smarty -> register_resource ( 'ox' , [ 'ox_get_template' , 'ox_get_timestamp' , 'ox_get_secure' , 'ox_get_trusted' ] ) ; $ smartyDir = $ this -> getSmartyDir ( ) ; $ smarty -> caching = false ; $ smarty -> compile_dir = $ smartyDir ; $ smarty -> cache_dir = $ smartyDir ; $ smarty -> template_dir = $ this -> getTemplateDirs ( ) ; $ smarty -> compile_id = $ this -> getTemplateCompileId ( ) ; $ smarty -> default_template_handler_func = [ \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) , '_smartyDefaultTemplateHandler' ] ; $ smarty -> plugins_dir = array_merge ( $ this -> getModuleSmartyPluginDirectories ( ) , $ this -> getShopSmartyPluginDirectories ( ) , $ smarty -> plugins_dir ) ; $ coreDirectory = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sCoreDir' ) ; include_once $ coreDirectory . 'Smarty/Plugin/prefilter.oxblock.php' ; $ smarty -> register_prefilter ( 'smarty_prefilter_oxblock' ) ; $ debugMode = $ config -> getConfigParam ( 'iDebug' ) ; if ( $ debugMode == 1 || $ debugMode == 3 || $ debugMode == 4 ) { $ smarty -> debugging = true ; } if ( $ debugMode == 8 && ! $ config -> isAdmin ( ) ) { include_once $ coreDirectory . 'Smarty/Plugin/prefilter.oxtpldebug.php' ; $ smarty -> register_prefilter ( 'smarty_prefilter_oxtpldebug' ) ; } if ( ! $ config -> isDemoShop ( ) ) { $ smarty -> php_handling = ( int ) $ config -> getConfigParam ( 'iSmartyPhpHandling' ) ; $ smarty -> security = false ; } else { $ smarty -> php_handling = SMARTY_PHP_REMOVE ; $ smarty -> security = true ; $ smarty -> security_settings [ 'IF_FUNCS' ] [ ] = 'XML_ELEMENT_NODE' ; $ smarty -> security_settings [ 'IF_FUNCS' ] [ ] = 'is_int' ; $ smarty -> security_settings [ 'MODIFIER_FUNCS' ] [ ] = 'round' ; $ smarty -> security_settings [ 'MODIFIER_FUNCS' ] [ ] = 'floor' ; $ smarty -> security_settings [ 'MODIFIER_FUNCS' ] [ ] = 'trim' ; $ smarty -> security_settings [ 'MODIFIER_FUNCS' ] [ ] = 'implode' ; $ smarty -> security_settings [ 'MODIFIER_FUNCS' ] [ ] = 'is_array' ; $ smarty -> security_settings [ 'MODIFIER_FUNCS' ] [ ] = 'getimagesize' ; $ smarty -> security_settings [ 'ALLOW_CONSTANTS' ] = true ; $ smarty -> secure_dir = $ smarty -> template_dir ; } }
sets properties of smarty object
37,649
protected function _smartyCompileCheck ( $ smarty ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ smarty -> compile_check = $ config -> getConfigParam ( 'blCheckTemplates' ) ; }
Sets compile check property to smarty object .
37,650
public function _smartyDefaultTemplateHandler ( $ resourceType , $ resourceName , & $ resourceContent , & $ resourceTimestamp , $ smarty ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ resourceType == 'file' && ! is_readable ( $ resourceName ) ) { $ resourceName = $ config -> getTemplatePath ( $ resourceName , $ config -> isAdmin ( ) ) ; $ resourceContent = $ smarty -> _read_file ( $ resourceName ) ; $ resourceTimestamp = filemtime ( $ resourceName ) ; return is_file ( $ resourceName ) && is_readable ( $ resourceName ) ; } return false ; }
is called when a template cannot be obtained from its resource .
37,651
protected function _getTemplateBlock ( $ moduleId , $ fileName ) { $ pathFormatter = oxNew ( ModuleTemplateBlockPathFormatter :: class ) ; $ pathFormatter -> setModulesPath ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getModulesDir ( ) ) ; $ pathFormatter -> setModuleId ( $ moduleId ) ; $ pathFormatter -> setFileName ( $ fileName ) ; $ blockContentReader = oxNew ( ModuleTemplateBlockContentReader :: class ) ; return $ blockContentReader -> getContent ( $ pathFormatter ) ; }
Retrieve module block contents from active module block file .
37,652
protected function _getActiveModuleInfo ( ) { if ( $ this -> _aActiveModuleInfo === null ) { $ modulelist = oxNew ( \ OxidEsales \ Eshop \ Core \ Module \ ModuleList :: class ) ; $ this -> _aActiveModuleInfo = $ modulelist -> getActiveModuleInfo ( ) ; } return $ this -> _aActiveModuleInfo ; }
Returns active module Ids
37,653
protected function addActiveThemeId ( $ themePath ) { $ themeId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sTheme' ) ; if ( $ this -> isAdmin ( ) ) { $ themeId = 'admin' ; } return $ themePath . $ themeId . "/tpl/" ; }
Add active theme at the end of theme path to form full path to templates .
37,654
private function formListOfDuplicatedBlocks ( $ activeBlockTemplates ) { $ templateBlocksToExchange = [ ] ; $ customThemeId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sCustomTheme' ) ; foreach ( $ activeBlockTemplates as $ activeBlockTemplate ) { if ( $ activeBlockTemplate [ 'OXTHEME' ] ) { if ( $ customThemeId && $ customThemeId === $ activeBlockTemplate [ 'OXTHEME' ] ) { $ templateBlocksToExchange [ 'custom_theme' ] [ ] = $ this -> prepareBlockKey ( $ activeBlockTemplate ) ; } else { $ templateBlocksToExchange [ 'theme' ] [ ] = $ this -> prepareBlockKey ( $ activeBlockTemplate ) ; } } } return $ templateBlocksToExchange ; }
Form list of blocks which has duplicates for specific theme .
37,655
private function removeDefaultBlocks ( $ activeBlockTemplates , $ templateBlocksToExchange ) { $ templateBlocks = [ ] ; foreach ( $ activeBlockTemplates as $ activeBlockTemplate ) { if ( ! in_array ( $ this -> prepareBlockKey ( $ activeBlockTemplate ) , $ templateBlocksToExchange [ 'theme' ] ) || $ activeBlockTemplate [ 'OXTHEME' ] ) { $ templateBlocks [ ] = $ activeBlockTemplate ; } } return $ templateBlocks ; }
Remove default blocks whose have duplicate for specific theme .
37,656
private function removeParentBlocks ( $ templateBlocks , $ templateBlocksToExchange ) { $ activeBlockTemplates = $ templateBlocks ; $ templateBlocks = [ ] ; $ customThemeId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sCustomTheme' ) ; foreach ( $ activeBlockTemplates as $ activeBlockTemplate ) { if ( ! in_array ( $ this -> prepareBlockKey ( $ activeBlockTemplate ) , $ templateBlocksToExchange [ 'custom_theme' ] ) || $ activeBlockTemplate [ 'OXTHEME' ] === $ customThemeId ) { $ templateBlocks [ ] = $ activeBlockTemplate ; } } return $ templateBlocks ; }
Remove parent theme blocks whose have duplicate for custom theme .
37,657
private function fillTemplateBlockWithContent ( $ blockTemplates ) { $ templateBlocksWithContent = [ ] ; foreach ( $ blockTemplates as $ activeBlockTemplate ) { try { if ( ! is_array ( $ templateBlocksWithContent [ $ activeBlockTemplate [ 'OXBLOCKNAME' ] ] ) ) { $ templateBlocksWithContent [ $ activeBlockTemplate [ 'OXBLOCKNAME' ] ] = [ ] ; } $ templateBlocksWithContent [ $ activeBlockTemplate [ 'OXBLOCKNAME' ] ] [ ] = $ this -> _getTemplateBlock ( $ activeBlockTemplate [ 'OXMODULE' ] , $ activeBlockTemplate [ 'OXFILE' ] ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ StandardException $ exception ) { \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> error ( $ exception -> getMessage ( ) , [ $ exception ] ) ; } } return $ templateBlocksWithContent ; }
Fill array with template content or skip if template does not exist . Logs error message if template does not exist .
37,658
protected function _mustSaveToSession ( ) { if ( $ this -> _blSaveToSession === null ) { $ this -> _blSaveToSession = false ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ sSslUrl = $ myConfig -> getSslShopUrl ( ) ) { $ sUrl = $ myConfig -> getShopUrl ( ) ; $ sHost = parse_url ( $ sUrl , PHP_URL_HOST ) ; $ sSslHost = parse_url ( $ sSslUrl , PHP_URL_HOST ) ; if ( $ sHost != $ sSslHost ) { $ oUtils = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) ; $ this -> _blSaveToSession = $ oUtils -> extractDomain ( $ sHost ) != $ oUtils -> extractDomain ( $ sSslHost ) ; } } } return $ this -> _blSaveToSession ; }
Checks if cookie must be saved to session in order to transfer it to different domain
37,659
protected function _getSessionCookieKey ( $ blGet ) { $ blSsl = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> isSsl ( ) ; $ sKey = $ blSsl ? 'nossl' : 'ssl' ; if ( $ blGet ) { $ sKey = $ blSsl ? 'ssl' : 'nossl' ; } return $ sKey ; }
Returns session cookie key
37,660
protected function _saveSessionCookie ( $ sName , $ sValue , $ iExpire , $ sPath , $ sDomain ) { if ( $ this -> _mustSaveToSession ( ) ) { $ aCookieData = [ 'value' => $ sValue , 'expire' => $ iExpire , 'path' => $ sPath , 'domain' => $ sDomain ] ; $ aSessionCookies = ( array ) \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( $ this -> _sSessionCookiesName ) ; $ aSessionCookies [ $ this -> _getSessionCookieKey ( false ) ] [ $ sName ] = $ aCookieData ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( $ this -> _sSessionCookiesName , $ aSessionCookies ) ; } }
Copies cookie info to session
37,661
public function loadSessionCookies ( ) { if ( ( $ aSessionCookies = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( $ this -> _sSessionCookiesName ) ) ) { $ sKey = $ this -> _getSessionCookieKey ( true ) ; if ( isset ( $ aSessionCookies [ $ sKey ] ) ) { foreach ( $ aSessionCookies [ $ sKey ] as $ sName => $ aCookieData ) { $ this -> setOxCookie ( $ sName , $ aCookieData [ 'value' ] , $ aCookieData [ 'expire' ] , $ aCookieData [ 'path' ] , $ aCookieData [ 'domain' ] , false ) ; $ this -> _sSessionCookies [ $ sName ] = $ aCookieData [ 'value' ] ; } unset ( $ aSessionCookies [ $ sKey ] ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( $ this -> _sSessionCookiesName , $ aSessionCookies ) ; } } }
Stored all session cookie info to cookies
37,662
protected function _getCookiePath ( $ sPath ) { if ( $ aCookiePaths = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aCookiePaths' ) ) { $ sShopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ sPath = isset ( $ aCookiePaths [ $ sShopId ] ) ? $ aCookiePaths [ $ sShopId ] : $ sPath ; } return $ sPath ? $ sPath : "" ; }
Returns cookie path . If user did not set path or set it to null according to php documentation empty string will be returned marking to skip argument . Additionally path can be defined in config . inc . php file as sCookiePath param . Please check cookie documentation for more details about current parameter
37,663
protected function _getCookieDomain ( $ sDomain ) { $ sDomain = $ sDomain ? $ sDomain : "" ; if ( ! $ sDomain ) { if ( $ aCookieDomains = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aCookieDomains' ) ) { $ sShopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ sDomain = isset ( $ aCookieDomains [ $ sShopId ] ) ? $ aCookieDomains [ $ sShopId ] : $ sDomain ; } } return $ sDomain ; }
Returns domain that cookie available . If user did not set domain or set it to null according to php documentation empty string will be returned marking to skip argument . Additionally domain can be defined in config . inc . php file as sCookieDomain param . Please check cookie documentation for more details about current parameter
37,664
public function getRemoteAddress ( ) { if ( isset ( $ _SERVER [ "HTTP_X_FORWARDED_FOR" ] ) ) { $ sIP = $ _SERVER [ "HTTP_X_FORWARDED_FOR" ] ; $ sIP = preg_replace ( '/,.*$/' , '' , $ sIP ) ; } elseif ( isset ( $ _SERVER [ "HTTP_CLIENT_IP" ] ) ) { $ sIP = $ _SERVER [ "HTTP_CLIENT_IP" ] ; } else { $ sIP = $ _SERVER [ "REMOTE_ADDR" ] ; } return $ sIP ; }
Returns remote IP address
37,665
public function getServerVar ( $ sServVar = null ) { $ sValue = null ; if ( isset ( $ _SERVER ) ) { if ( $ sServVar && isset ( $ _SERVER [ $ sServVar ] ) ) { $ sValue = $ _SERVER [ $ sServVar ] ; } elseif ( ! $ sServVar ) { $ sValue = $ _SERVER ; } } return $ sValue ; }
returns a server constant
37,666
public function setUserCookie ( $ userName , $ passwordHash , $ shopId = null , $ timeout = 31536000 , $ salt = User :: USER_COOKIE_SALT ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ shopId = $ shopId ?? $ myConfig -> getShopId ( ) ; $ sSslUrl = $ myConfig -> getSslShopUrl ( ) ; if ( stripos ( $ sSslUrl , 'https' ) === 0 ) { $ blSsl = true ; } else { $ blSsl = false ; } $ this -> _aUserCookie [ $ shopId ] = $ userName . '@@@' . crypt ( $ passwordHash , $ salt ) ; $ this -> setOxCookie ( 'oxid_' . $ shopId , $ this -> _aUserCookie [ $ shopId ] , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) + $ timeout , '/' , null , true , $ blSsl ) ; $ this -> setOxCookie ( 'oxid_' . $ shopId . '_autologin' , '1' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) + $ timeout , '/' , null , true , false ) ; }
Sets user info into cookie
37,667
public function deleteUserCookie ( $ sShopId = null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sShopId = ( ! $ sShopId ) ? \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) : $ sShopId ; $ sSslUrl = $ myConfig -> getSslShopUrl ( ) ; if ( stripos ( $ sSslUrl , 'https' ) === 0 ) { $ blSsl = true ; } else { $ blSsl = false ; } $ this -> _aUserCookie [ $ sShopId ] = '' ; $ this -> setOxCookie ( 'oxid_' . $ sShopId , '' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) - 3600 , '/' , null , true , $ blSsl ) ; $ this -> setOxCookie ( 'oxid_' . $ sShopId . '_autologin' , '0' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) - 3600 , '/' , null , true , false ) ; }
Deletes user cookie data
37,668
public function getUserCookie ( $ sShopId = null ) { $ myConfig = Registry :: getConfig ( ) ; $ sShopId = ( ! $ sShopId ) ? $ myConfig -> getShopId ( ) : $ sShopId ; if ( ! $ myConfig -> isSsl ( ) && $ this -> getOxCookie ( 'oxid_' . $ sShopId . '_autologin' ) == '1' ) { $ sSslUrl = rtrim ( $ myConfig -> getSslShopUrl ( ) , '/' ) . $ _SERVER [ 'REQUEST_URI' ] ; if ( stripos ( $ sSslUrl , 'https' ) === 0 ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> redirect ( $ sSslUrl , true , 302 ) ; } } if ( array_key_exists ( $ sShopId , $ this -> _aUserCookie ) && $ this -> _aUserCookie [ $ sShopId ] !== null ) { return $ this -> _aUserCookie [ $ sShopId ] ? $ this -> _aUserCookie [ $ sShopId ] : null ; } return $ this -> _aUserCookie [ $ sShopId ] = $ this -> getOxCookie ( 'oxid_' . $ sShopId ) ; }
Returns cookie stored used login data
37,669
public function isTrustedClientIp ( ) { $ blTrusted = false ; $ aTrustedIPs = ( array ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( "aTrustedIPs" ) ; if ( count ( $ aTrustedIPs ) ) { $ blTrusted = in_array ( $ this -> getRemoteAddress ( ) , $ aTrustedIPs ) ; } return $ blTrusted ; }
Checks if current client ip is in trusted IPs list . IP list is defined in config file as aTrustedIPs parameter
37,670
public function isCurrentUrl ( $ sURL ) { if ( ! $ sURL || ( strpos ( $ sURL , "http" ) !== 0 ) ) { return true ; } $ sServerHost = $ this -> getServerVar ( 'HTTP_HOST' ) ; $ blIsCurrentUrl = $ this -> _isCurrentUrl ( $ sURL , $ sServerHost ) ; if ( ! $ blIsCurrentUrl ) { $ sServerHost = $ this -> getServerVar ( 'HTTP_X_FORWARDED_HOST' ) ; if ( $ sServerHost ) { $ blIsCurrentUrl = $ this -> _isCurrentUrl ( $ sURL , $ sServerHost ) ; } } return $ blIsCurrentUrl ; }
Compares current URL to supplied string
37,671
public function import ( $ data ) { if ( isset ( $ data [ 'OXUSERNAME' ] ) ) { $ id = $ data [ 'OXID' ] ; $ userName = $ data [ 'OXUSERNAME' ] ; $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class , "core" ) ; $ user -> oxuser__oxusername = new \ OxidEsales \ Eshop \ Core \ Field ( $ userName , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; if ( $ user -> exists ( $ id ) && $ id != $ user -> getId ( ) ) { throw new Exception ( "USER $userName already exists!" ) ; } } return parent :: import ( $ data ) ; }
Imports user . Returns import status .
37,672
public function jsonEncode ( $ data ) { if ( is_array ( $ data ) ) { $ ret = "" ; $ blWasOne = false ; $ blNumerical = true ; reset ( $ data ) ; while ( $ blNumerical && $ key = key ( $ data ) ) { $ blNumerical = ! is_string ( $ key ) ; } if ( $ blNumerical ) { return '[' . implode ( ',' , array_map ( [ $ this , 'jsonEncode' ] , $ data ) ) . ']' ; } else { foreach ( $ data as $ key => $ val ) { if ( $ blWasOne ) { $ ret .= ',' ; } else { $ blWasOne = true ; } $ ret .= '"' . addslashes ( $ key ) . '":' . $ this -> jsonEncode ( $ val ) ; } return "{" . $ ret . "}" ; } } else { return '"' . addcslashes ( ( string ) $ data , "\r\n\t\"\\" ) . '"' ; } }
wrapper for json encode which does not work with non utf8 characters
37,673
protected function _loadSessionUser ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oUser = $ this -> getUser ( ) ; if ( ! $ oUser ) { return ; } if ( $ oUser -> inGroup ( 'oxidblocked' ) ) { $ sUrl = $ myConfig -> getShopHomeUrl ( ) . 'cl=content&tpl=user_blocked.tpl' ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> redirect ( $ sUrl , true , 302 ) ; } if ( $ oUser -> isLoadedFromCookie ( ) && ! $ myConfig -> getConfigParam ( 'blPerfNoBasketSaving' ) ) { if ( $ oBasket = $ this -> getSession ( ) -> getBasket ( ) ) { $ oBasket -> load ( ) ; $ oBasket -> onUpdate ( ) ; } } }
Tries to load user ID from session .
37,674
public function registerUser ( ) { if ( $ this -> createUser ( ) != false && $ this -> _blIsNewUser ) { if ( $ this -> _blNewsSubscriptionStatus === null || $ this -> _blNewsSubscriptionStatus ) { return 'register?success=1' ; } else { return 'register?success=1&newslettererror=4' ; } } else { $ this -> logout ( ) ; } }
Creates new oxid user
37,675
public function deleteShippingAddress ( ) { $ request = oxNew ( Request :: class ) ; $ addressId = $ request -> getRequestParameter ( 'oxaddressid' ) ; $ address = oxNew ( Address :: class ) ; $ address -> load ( $ addressId ) ; if ( $ this -> canUserDeleteShippingAddress ( $ address ) && $ this -> getSession ( ) -> checkSessionChallenge ( ) ) { $ address -> delete ( $ addressId ) ; } }
Deletes user shipping address .
37,676
private function canUserDeleteShippingAddress ( $ address ) { $ canDelete = false ; $ user = $ this -> getUser ( ) ; if ( $ address -> oxaddress__oxuserid -> value === $ user -> getId ( ) ) { $ canDelete = true ; } return $ canDelete ; }
Checks if shipping address is assigned to user .
37,677
protected function _saveInvitor ( ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blInvitationsEnabled' ) ) { $ this -> getInvitor ( ) ; $ this -> setRecipient ( ) ; } }
Saves invitor ID
37,678
protected function _getDelAddressData ( ) { $ blShowShipAddressParameter = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'blshowshipaddress' ) ; $ blShowShipAddressVariable = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'blshowshipaddress' ) ; $ sDeliveryAddressParameter = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'deladr' , true ) ; $ aDeladr = ( $ blShowShipAddressParameter || $ blShowShipAddressVariable ) ? $ sDeliveryAddressParameter : [ ] ; $ aDelAdress = $ aDeladr ; if ( is_array ( $ aDeladr ) ) { if ( isset ( $ aDeladr [ 'oxaddress__oxsal' ] ) ) { unset ( $ aDeladr [ 'oxaddress__oxsal' ] ) ; } if ( ! count ( $ aDeladr ) || implode ( '' , $ aDeladr ) == '' ) { $ aDelAdress = [ ] ; } } return $ aDelAdress ; }
Returns delivery address from request . Before returning array is checked if all needed data is there
37,679
protected function _getLogoutLink ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sLogoutLink = $ oConfig -> isSsl ( ) ? $ oConfig -> getShopSecureHomeUrl ( ) : $ oConfig -> getShopHomeUrl ( ) ; $ sLogoutLink .= 'cl=' . $ oConfig -> getRequestControllerId ( ) . $ this -> getParent ( ) -> getDynUrlParams ( ) ; if ( $ sParam = $ oConfig -> getRequestParameter ( 'anid' ) ) { $ sLogoutLink .= '&anid=' . $ sParam ; } if ( $ sParam = $ oConfig -> getRequestParameter ( 'cnid' ) ) { $ sLogoutLink .= '&cnid=' . $ sParam ; } if ( $ sParam = $ oConfig -> getRequestParameter ( 'mnid' ) ) { $ sLogoutLink .= '&mnid=' . $ sParam ; } if ( $ sParam = $ oConfig -> getRequestParameter ( 'tpl' ) ) { $ sLogoutLink .= '&tpl=' . $ sParam ; } if ( $ sParam = $ oConfig -> getRequestParameter ( 'oxloadid' ) ) { $ sLogoutLink .= '&oxloadid=' . $ sParam ; } if ( $ sParam = $ oConfig -> getRequestParameter ( 'recommid' ) ) { $ sLogoutLink .= '&recommid=' . $ sParam ; } return $ sLogoutLink . '&fnc=logout' ; }
Returns logout link with additional params
37,680
public function getInvitor ( ) { $ sSu = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'su' ) ; if ( ! $ sSu && ( $ sSuNew = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'su' ) ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'su' , $ sSuNew ) ; } }
Sets invitor id to session from URL
37,681
public function setRecipient ( ) { $ sRe = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 're' ) ; if ( ! $ sRe && ( $ sReNew = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 're' ) ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 're' , $ sReNew ) ; } }
sets from URL invitor id
37,682
private function trimAddress ( $ address ) { if ( is_array ( $ address ) ) { $ fields = oxNew ( FormFields :: class , $ address ) ; $ trimmer = oxNew ( FormFieldsTrimmer :: class ) ; $ address = ( array ) $ trimmer -> trim ( $ fields ) ; } return $ address ; }
Returns trimmed address .
37,683
public function getArticles ( ) { if ( is_null ( $ this -> _aArtIds ) ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select oxobjectid from oxobject2delivery where oxdeliveryid=" . $ oDb -> quote ( $ this -> getId ( ) ) . " and oxtype = 'oxarticles'" ; $ aArtIds = $ oDb -> getCol ( $ sQ ) ; $ this -> _aArtIds = $ aArtIds ; } return $ this -> _aArtIds ; }
Collects article Ids which are assigned to current delivery
37,684
public function getCategories ( ) { if ( is_null ( $ this -> _aCatIds ) ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select oxobjectid from oxobject2delivery where oxdeliveryid=" . $ oDb -> quote ( $ this -> getId ( ) ) . " and oxtype = 'oxcategories'" ; $ aCatIds = $ oDb -> getCol ( $ sQ ) ; $ this -> _aCatIds = $ aCatIds ; } return $ this -> _aCatIds ; }
Collects category Ids which are assigned to current delivery
37,685
public function getDeliveryPrice ( $ dVat = null ) { if ( $ this -> _oPrice === null ) { $ oPrice = oxNew ( \ OxidEsales \ Eshop \ Core \ Price :: class ) ; $ oPrice -> setNettoMode ( $ this -> _blDelVatOnTop ) ; $ oPrice -> setVat ( $ dVat ) ; if ( ! $ this -> _blFreeShipping ) { $ oPrice -> add ( $ this -> _getCostSum ( ) ) ; } $ this -> setDeliveryPrice ( $ oPrice ) ; } return $ this -> _oPrice ; }
Returns oxPrice object for delivery costs
37,686
protected function _checkDeliveryAmount ( $ iAmount ) { $ blResult = false ; if ( $ this -> getConditionType ( ) == self :: CONDITION_TYPE_PRICE ) { $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; $ iAmount /= $ oCur -> rate ; } if ( $ iAmount >= $ this -> getConditionFrom ( ) && $ iAmount <= $ this -> getConditionTo ( ) ) { $ blResult = true ; } return $ blResult ; }
checks if amount param is ok for this delivery
37,687
public function getIdByName ( $ sTitle ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "SELECT `oxid` FROM `" . getViewName ( 'oxdelivery' ) . "` WHERE `oxtitle` = " . $ oDb -> quote ( $ sTitle ) ; $ sId = $ oDb -> getOne ( $ sQ ) ; return $ sId ; }
returns delivery id
37,688
public function getCountriesISO ( ) { if ( $ this -> _aCountriesISO === null ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ this -> _aCountriesISO = [ ] ; $ sSelect = " SELECT `oxcountry`.`oxisoalpha2` FROM `oxcountry` LEFT JOIN `oxobject2delivery` ON `oxobject2delivery`.`oxobjectid` = `oxcountry`.`oxid` WHERE `oxobject2delivery`.`oxdeliveryid` = " . $ oDb -> quote ( $ this -> getId ( ) ) . " AND `oxobject2delivery`.`oxtype` = 'oxcountry'" ; $ rs = $ oDb -> getCol ( $ sSelect ) ; $ this -> _aCountriesISO = $ rs ; } return $ this -> _aCountriesISO ; }
Returns array of country ISO s which are assigned to current delivery
37,689
protected function _getMultiplier ( ) { $ dAmount = 0 ; if ( $ this -> getCalculationRule ( ) == self :: CALCULATION_RULE_ONCE_PER_CART ) { $ dAmount = 1 ; } elseif ( $ this -> getCalculationRule ( ) == self :: CALCULATION_RULE_FOR_EACH_DIFFERENT_PRODUCT ) { $ dAmount = $ this -> _iProdCnt ; } elseif ( $ this -> getCalculationRule ( ) == self :: CALCULATION_RULE_FOR_EACH_PRODUCT ) { $ dAmount = $ this -> _iItemCnt ; } return $ dAmount ; }
Calculate multiplier for price calculation
37,690
protected function _getCostSum ( ) { if ( $ this -> getAddSumType ( ) == 'abs' ) { $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; $ dPrice = $ this -> getAddSum ( ) * $ oCur -> rate * $ this -> _getMultiplier ( ) ; } else { $ dPrice = $ this -> _dPrice / 100 * $ this -> getAddSum ( ) ; } return $ dPrice ; }
Calculate cost sum
37,691
protected function isDeliveryRuleFitByArticle ( $ artAmount ) { $ result = false ; if ( $ this -> getCalculationRule ( ) != self :: CALCULATION_RULE_ONCE_PER_CART ) { if ( ! $ this -> _blFreeShipping && $ this -> _checkDeliveryAmount ( $ artAmount ) ) { $ result = true ; } } return $ result ; }
Checks if delivery rule applies for basket because of one article s amount . Delivery rules that are to be applied once per cart can be ruled out here .
37,692
public function queryFile ( $ sFilename ) { $ fp = @ fopen ( $ sFilename , "r" ) ; if ( ! $ fp ) { $ oSetup = $ this -> getInstance ( "Setup" ) ; $ oSetup -> setNextStep ( $ oSetup -> getStep ( 'STEP_DB_INFO' ) ) ; throw new Exception ( sprintf ( $ this -> getInstance ( "Language" ) -> getText ( 'ERROR_OPENING_SQL_FILE' ) , $ sFilename ) , Database :: ERROR_OPENING_SQL_FILE ) ; } $ sQuery = fread ( $ fp , filesize ( $ sFilename ) ) ; fclose ( $ fp ) ; if ( version_compare ( $ this -> getDatabaseVersion ( ) , "5" ) > 0 ) { $ this -> execSql ( "SET @@session.sql_mode = ''" ) ; } $ aQueries = $ this -> parseQuery ( $ sQuery ) ; foreach ( $ aQueries as $ sQuery ) { $ this -> execSql ( $ sQuery ) ; } }
Executes queries stored in passed file
37,693
public function getConnection ( ) { if ( $ this -> _oConn === null ) { $ this -> _oConn = $ this -> openDatabase ( null ) ; } return $ this -> _oConn ; }
Returns connection resource object
37,694
public function openDatabase ( $ aParams ) { $ aParams = ( is_array ( $ aParams ) && count ( $ aParams ) ) ? $ aParams : $ this -> getInstance ( "Session" ) -> getSessionParam ( 'aDB' ) ; if ( $ this -> _oConn === null ) { try { $ dsn = sprintf ( 'mysql:host=%s;port=%s' , $ aParams [ 'dbHost' ] , $ aParams [ 'dbPort' ] ) ; $ this -> _oConn = new PDO ( $ dsn , $ aParams [ 'dbUser' ] , $ aParams [ 'dbPwd' ] , [ PDO :: MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' ] ) ; $ this -> _oConn -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; $ this -> _oConn -> setAttribute ( PDO :: ATTR_DEFAULT_FETCH_MODE , PDO :: FETCH_ASSOC ) ; } catch ( PDOException $ e ) { $ oSetup = $ this -> getInstance ( "Setup" ) ; $ oSetup -> setNextStep ( $ oSetup -> getStep ( 'STEP_DB_INFO' ) ) ; throw new Exception ( $ this -> getInstance ( "Language" ) -> getText ( 'ERROR_DB_CONNECT' ) . " - " . $ e -> getMessage ( ) , Database :: ERROR_DB_CONNECT , $ e ) ; } $ oSysReq = getSystemReqCheck ( ) ; if ( 0 === $ oSysReq -> checkMysqlVersion ( $ this -> getDatabaseVersion ( ) ) ) { throw new Exception ( $ this -> getInstance ( "Language" ) -> getText ( 'ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS' ) , Database :: ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS ) ; } $ databaseConnectProblem = null ; try { $ this -> _oConn -> exec ( "USE `{$aParams['dbName']}`" ) ; } catch ( Exception $ e ) { $ databaseConnectException = new Exception ( $ this -> getInstance ( "Language" ) -> getText ( 'ERROR_COULD_NOT_CREATE_DB' ) . " - " . $ e -> getMessage ( ) , Database :: ERROR_COULD_NOT_CREATE_DB , $ e ) ; } if ( ( 1 === $ oSysReq -> checkMysqlVersion ( $ this -> getDatabaseVersion ( ) ) ) && ! $ this -> userDecidedIgnoreDBWarning ( ) ) { throw new Exception ( $ this -> getInstance ( "Language" ) -> getText ( 'ERROR_MYSQL_VERSION_DOES_NOT_FIT_RECOMMENDATIONS' ) , Database :: ERROR_MYSQL_VERSION_DOES_NOT_FIT_RECOMMENDATIONS ) ; } if ( is_a ( $ databaseConnectException , 'Exception' ) ) { throw $ databaseConnectException ; } } else { $ this -> connectDb ( $ aParams [ 'dbName' ] ) ; } return $ this -> _oConn ; }
Opens database connection and returns connection resource object
37,695
public function parseQuery ( $ sSQL ) { $ aRet = [ ] ; $ blComment = false ; $ blQuote = false ; $ sThisSQL = "" ; $ aLines = explode ( "\n" , $ sSQL ) ; foreach ( $ aLines as $ sLine ) { $ iLen = strlen ( $ sLine ) ; for ( $ i = 0 ; $ i < $ iLen ; $ i ++ ) { if ( ! $ blQuote && ( $ sLine [ $ i ] == '#' || ( $ sLine [ 0 ] == '-' && $ sLine [ 1 ] == '-' ) ) ) { $ blComment = true ; } if ( ! $ blComment ) { $ sThisSQL .= $ sLine [ $ i ] ; } if ( ( $ sLine [ $ i ] == '\'' && $ sLine [ $ i - 1 ] != '\\' ) ) { $ blQuote = ! $ blQuote ; } if ( ! $ blQuote && $ sLine [ $ i ] == ';' ) { $ sThisSQL = trim ( $ sThisSQL ) ; if ( $ sThisSQL ) { $ sThisSQL = str_replace ( "\r" , "" , $ sThisSQL ) ; $ aRet [ ] = $ sThisSQL ; } $ sThisSQL = "" ; } } $ blComment = false ; $ blQuote = false ; } return $ aRet ; }
Parses query string into sql sentences
37,696
public function writeAdminLoginData ( $ sLoginName , $ sPassword ) { $ sPassSalt = $ this -> getInstance ( "Utilities" ) -> generateUID ( ) ; $ sPassword = hash ( 'sha512' , $ sPassword . $ sPassSalt ) ; $ sQ = "update oxuser set oxusername='{$sLoginName}', oxpassword='{$sPassword}', oxpasssalt='{$sPassSalt}' where OXUSERNAME='admin'" ; $ this -> execSql ( $ sQ ) ; $ sQ = "update oxnewssubscribed set oxemail='{$sLoginName}' where OXEMAIL='admin'" ; $ this -> execSql ( $ sQ ) ; }
Updates default admin user login name and password
37,697
protected function addConfigValueIfShopInfoShouldBeSent ( $ utilities , $ baseShopId , $ parameters , $ configKey , $ session ) { $ blSendShopDataToOxid = isset ( $ parameters [ "blSendShopDataToOxid" ] ) ? $ parameters [ "blSendShopDataToOxid" ] : $ session -> getSessionParam ( 'blSendShopDataToOxid' ) ; $ sID = $ utilities -> generateUid ( ) ; $ this -> execSql ( "delete from oxconfig where oxvarname = 'blSendShopDataToOxid'" ) ; $ this -> execSql ( "insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue) values('$sID', '$baseShopId', 'blSendShopDataToOxid', 'bool', ENCODE( '$blSendShopDataToOxid', '" . $ configKey -> sConfigKey . "'))" ) ; }
Adds config value if shop info should be set .
37,698
public function getModuleStateMap ( ) { $ moduleStateMap = $ this -> convertFromSystemRequirementsInfo ( ) ; $ moduleStateMap = $ this -> applyModuleStateHtmlClassConvertFunction ( $ moduleStateMap ) ; $ moduleStateMap = $ this -> applyModuleNameTranslateFunction ( $ moduleStateMap ) ; $ moduleStateMap = $ this -> applyModuleGroupNameTranslateFunction ( $ moduleStateMap ) ; return $ moduleStateMap ; }
Returns module state map with all applied external functions .
37,699
private function applyModuleStateHtmlClassConvertFunction ( $ moduleStateMap ) { return $ this -> applyModuleStateMapFilterFunction ( $ moduleStateMap , $ this -> moduleStateHtmlClassConvertFunction , function ( $ moduleData , $ convertFunction ) { $ moduleState = $ moduleData [ self :: MODULE_STATE_KEY ] ; $ moduleData [ self :: MODULE_STATE_HTML_CLASS_KEY ] = $ convertFunction ( $ moduleState ) ; return $ moduleData ; } ) ; }
Apply function which converts module state into HTML class of given state .