/** * Returns SQL query for data to fetc * * @return string */ protected function _getQuery() { // looking for table/view $sArtTable = $this->_getViewName('oxarticles'); $sO2CView = $this->_getViewName('oxobject2category'); $oDb = oxDb::getDb(); $oConfig = oxRegistry::getConfig(); $sVendorId = $oConfig->getRequestParameter('oxid'); $sSynchVendorId = $oConfig->getRequestParameter('synchoxid'); // vendor selected or not ? if (!$sVendorId) { $sQAdd = ' from ' . $sArtTable . ' where ' . $sArtTable . '.oxshopid="' . $oConfig->getShopId() . '" and 1 '; $sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArtTable}.oxparentid = '' and {$sArtTable}.oxvendorid != " . $oDb->quote($sSynchVendorId); } else { // selected category ? if ($sSynchVendorId && $sSynchVendorId != $sVendorId) { $sQAdd = " from {$sO2CView} left join {$sArtTable} on "; $sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? " ( {$sArtTable}.oxid = {$sO2CView}.oxobjectid or {$sArtTable}.oxparentid = oxobject2category.oxobjectid )" : " {$sArtTable}.oxid = {$sO2CView}.oxobjectid "; $sQAdd .= 'where ' . $sArtTable . '.oxshopid="' . $oConfig->getShopId() . '" and ' . $sO2CView . '.oxcatnid = ' . $oDb->quote($sVendorId) . ' and ' . $sArtTable . '.oxvendorid != ' . $oDb->quote($sSynchVendorId); } else { $sQAdd = " from {$sArtTable} where {$sArtTable}.oxvendorid = " . $oDb->quote($sVendorId); } $sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArtTable}.oxparentid = '' "; } return $sQAdd; }
/** * Adds active promotion check * * @param array $aWhere SQL condition array * @param string $sqlFull SQL query string * * @return $sQ */ protected function _prepareWhereQuery($aWhere, $sqlFull) { $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull); $sDisplayType = (int) oxRegistry::getConfig()->getRequestParameter('displaytype'); $sTable = getViewName("oxactions"); //searchong for empty oxfolder fields if ($sDisplayType) { $sNow = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime()); switch ($sDisplayType) { case 1: // active $sQ .= " and {$sTable}.oxactivefrom < '{$sNow}' and {$sTable}.oxactiveto > '{$sNow}' "; break; case 2: // upcoming $sQ .= " and {$sTable}.oxactivefrom > '{$sNow}' "; break; case 3: // expired $sQ .= " and {$sTable}.oxactiveto < '{$sNow}' and {$sTable}.oxactiveto != '0000-00-00 00:00:00' "; break; } } return $sQ; }
/** * Collects article crosselling and attributes information, passes * them to Smarty engine and returns name or template file * "article_crossselling.tpl". * * @return string */ public function render() { parent::render(); $this->_aViewData['edit'] = $oArticle = oxNew('oxarticle'); // crossselling $this->_createCategoryTree("artcattree"); // accessoires $this->_createCategoryTree("artcattree2"); $soxId = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oArticle->load($soxId); if ($oArticle->isDerived()) { $this->_aViewData['readonly'] = true; } } $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc"); if ($iAoc == 1) { $oArticleCrossellingAjax = oxNew('article_crossselling_ajax'); $this->_aViewData['oxajax'] = $oArticleCrossellingAjax->getColumns(); return "popups/article_crossselling.tpl"; } elseif ($iAoc == 2) { $oArticleAccessoriesAjax = oxNew('article_accessories_ajax'); $this->_aViewData['oxajax'] = $oArticleAccessoriesAjax->getColumns(); return "popups/article_accessories.tpl"; } return "article_crossselling.tpl"; }
/** * Executes parent method parent::render(), creates deliveryset category tree, * passes data to Smarty engine and returns name of template file "deliveryset_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); $sTheme = $this->_sTheme = $this->getEditObjectId(); $sShopId = $myConfig->getShopId(); if (!isset($sTheme)) { $sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme'); } $oTheme = oxNew('oxTheme'); if ($oTheme->load($sTheme)) { $this->_aViewData["oTheme"] = $oTheme; try { $aDbVariables = $this->loadConfVars($sShopId, $this->_getModuleForConfigVars()); $this->_aViewData["var_constraints"] = $aDbVariables['constraints']; $this->_aViewData["var_grouping"] = $aDbVariables['grouping']; foreach ($this->_aConfParams as $sType => $sParam) { $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType]; } } catch (oxException $oEx) { oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx); $oEx->debugOut(); } } else { oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED')); } return 'theme_config.tpl'; }
/** * Smarty plugin * ------------------------------------------------------------- * File: insert.oxid_nocache.php * Type: string, html * Name: oxid_nocache * Purpose: Inserts Items not cached * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_insert_oxid_nocache($params, &$smarty) { $myConfig = oxRegistry::getConfig(); $smarty->caching = false; /* if( isset( $smarty->oxobject->oProduct)) $smarty->assign_by_ref( "product", $smarty->oxobject->oProduct);*/ // #1184M - specialchar search $sSearchParamForHTML = oxRegistry::getConfig()->getRequestParameter("searchparam"); $sSearchParamForLink = rawurlencode(oxRegistry::getConfig()->getRequestParameter("searchparam", true)); if ($sSearchParamForHTML) { $smarty->assign_by_ref("searchparamforhtml", $sSearchParamForHTML); $smarty->assign_by_ref("searchparam", $sSearchParamForLink); } $sSearchCat = oxRegistry::getConfig()->getRequestParameter("searchcnid"); if ($sSearchCat) { $smarty->assign_by_ref("searchcnid", rawurldecode($sSearchCat)); } foreach (array_keys($params) as $key) { $viewData =& $params[$key]; $smarty->assign_by_ref($key, $viewData); } $sOutput = $smarty->fetch($params['tpl']); $smarty->caching = false; return $sOutput; }
/** * Adds selection lists to article. */ public function addSel() { $aAddSel = $this->_getActionIds('oxselectlist.oxid'); $soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid'); // adding if (oxRegistry::getConfig()->getRequestParameter('all')) { $sSLViewName = $this->_getViewName('oxselectlist'); $aAddSel = $this->_getAll($this->_addFilter("select {$sSLViewName}.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aAddSel)) { $oDb = oxDb::getDb(); foreach ($aAddSel as $sAdd) { $oNew = oxNew("oxbase"); $oNew->init("oxobject2selectlist"); $sObjectIdField = 'oxobject2selectlist__oxobjectid'; $sSelectetionIdField = 'oxobject2selectlist__oxselnid'; $sOxSortField = 'oxobject2selectlist__oxsort'; $oNew->{$sObjectIdField} = new oxField($soxId); $oNew->{$sSelectetionIdField} = new oxField($sAdd); $sSql = "select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = {$oDb->quote($soxId)} "; $oNew->{$sOxSortField} = new oxField((int) $oDb->getOne($sSql, false, false)); $oNew->save(); } } }
/** * Setup routine */ public static function onActivate() { if (class_exists('oxRegistry')) { $myConfig = oxRegistry::getConfig(); } else { $myConfig = oxConfig::getInstance()->getConfig(); } $bIsEE = $myConfig->getEdition() === "EE"; try { $db = oxDb::getDb(); // create oxjson groups if ($bIsEE) { $maxRRId = intval($db->getOne("select MAX(OXRRID) from oxgroups")); $nextRRId = $maxRRId + 1; $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only', '{$nextRRId}');"; $db->Execute($sQ); $nextRRId++; $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full', '{$nextRRId}');"; $db->Execute($sQ); } else { $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only');"; $db->Execute($sQ); $nextRRId++; $sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full');"; $db->Execute($sQ); } } catch (Exception $ex) { error_log("Error activating module: " . $ex->getMessage()); } }
/** * Runs all asserts * * @param array $aExpectedResult */ protected function runAsserts($aExpectedResult) { $oConfig = oxRegistry::getConfig(); $oValidator = new Validator($oConfig); if (isset($aExpectedResult['blocks'])) { $this->assertTrue($oValidator->checkBlocks($aExpectedResult['blocks']), 'Blocks do not match expectations'); } if (isset($aExpectedResult['extend'])) { $this->assertTrue($oValidator->checkExtensions($aExpectedResult['extend']), 'Extensions do not match expectations'); } if (isset($aExpectedResult['files'])) { $this->assertTrue($oValidator->checkFiles($aExpectedResult['files']), 'Files do not match expectations'); } if (isset($aExpectedResult['events'])) { $this->assertTrue($oValidator->checkEvents($aExpectedResult['events']), 'Events do not match expectations'); } if (isset($aExpectedResult['settings'])) { $this->assertTrue($oValidator->checkConfigAmount($aExpectedResult['settings']), 'Configs do not match expectations'); } if (isset($aExpectedResult['versions'])) { $this->assertTrue($oValidator->checkVersions($aExpectedResult['versions']), 'Versions do not match expectations'); } if (isset($aExpectedResult['templates'])) { $this->assertTrue($oValidator->checkTemplates($aExpectedResult['templates']), 'Templates do not match expectations'); } if (isset($aExpectedResult['disabledModules'])) { $this->assertTrue($oValidator->checkDisabledModules($aExpectedResult['disabledModules']), 'Disabled modules do not match expectations'); } if (isset($aExpectedResult['settings_values'])) { $this->assertTrue($oValidator->checkConfigValues($aExpectedResult['settings_values']), 'Config values does not match expectations'); } }
function smarty_function_newestCategoryArticles($params, &$smarty) { // default values $oxid = $params['oxid'] ? $params['oxid'] : oxRegistry::getConfig()->getRequestParameter('cnid'); $am = $params['amount'] ? $params['amount'] : null; $head = $params['head'] ? $params['head'] : "vtnca_newestarticles"; $file = $params['file'] ? $params['file'] : "widget/product/boxproducts.tpl"; //_oBoxProducts=$oView->getTop5ArticleList() _sHeaderIdent="TOP_OF_THE_SHOP"}] if (!$oxid) { return "<!-- vt-nca: no category id given -->"; } // exit if no oxID given // getting newest category articles $oArtList = oxNew('oxarticlelist'); $oArtList->loadNewestCategoryArticles($oxid, $am); if (!$oArtList->count()) { return; } // exit if no products in category if ($params['assign']) { $smarty->assign($params['assign'], $oArtList); return; } // for default boxproducts $smarty->assign("_sHeaderIdent", $head); $smarty->assign("_oBoxProducts", $oArtList); // for stabdard list.tpl $smarty->assign("head", $head); $smarty->assign("products", $oArtList); $html = $smarty->fetch($file); //$smarty->clear_assign("__nca_".$oxid); return $html; }
/** * Extends the startup checks with Barzahlen plugin version check. * * @return array */ protected function _doStartUpChecks() { $aMessage = parent::_doStartUpChecks(); $oxConfig = $this->getConfig(); $sShopId = $oxConfig->getShopId(); $sModule = oxConfig::OXMODULE_MODULE_PREFIX . $this->_sModuleId; $sPluginCheck = $oxConfig->getShopConfVar('bzPluginCheck', $sShopId, $sModule); // only check once a week if ($sPluginCheck != null && $sPluginCheck > strtotime("-1 week")) { return $aMessage; } $oxConfig->saveShopConfVar('str', 'bzPluginCheck', time(), $sShopId, $sModule); $sBzShopId = $oxConfig->getShopConfVar('bzShopId', $sShopId, $sModule); $sShopsystem = 'OXID 4.7/5.0'; $sShopsystemVersion = $oxConfig->getVersion(); $sPluginVersion = self::CURRENTVERSION; try { $oChecker = new Barzahlen_Version_Check(); $newAvailable = $oChecker->isNewVersionAvailable($sBzShopId, $sShopsystem, $sShopsystemVersion, $sPluginVersion); } catch (Exception $e) { oxRegistry::getUtils()->writeToLog(date('c') . " " . $e . "\r\r", self::LOGFILE); } if ($newAvailable) { $aMessage['warning'] .= (!empty($aMessage['warning']) ? "<br>" : '') . sprintf(oxRegistry::getLang()->translateString('BZ__NEW_PLUGIN_AVAILABLE'), $oChecker->getNewPluginVersion(), $oChecker->getNewPluginUrl()); } return $aMessage; }
/** * Smarty plugin * ------------------------------------------------------------- * File: insert.oxid_newbasketitem.php * Type: string, html * Name: newbasketitem * Purpose: Used for tracking in econda, etracker etc. * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_insert_oxid_newbasketitem($params, &$smarty) { $myConfig = oxRegistry::getConfig(); $aTypes = array('0' => 'none', '1' => 'message', '2' => 'popup', '3' => 'basket'); $iType = $myConfig->getConfigParam('iNewBasketItemMessage'); // If corect type of message is expected if ($iType && $params['type'] && $params['type'] != $aTypes[$iType]) { return ''; } //name of template file where is stored message text $sTemplate = $params['tpl'] ? $params['tpl'] : 'inc_newbasketitem.snippet.tpl'; //allways render for ajaxstyle popup $blRender = $params['ajax'] && $iType == 2; //fetching article data $oNewItem = oxRegistry::getSession()->getVariable('_newitem'); $oBasket = oxRegistry::getSession()->getBasket(); if ($oNewItem) { // loading article object here because on some system passing article by session couses problems $oNewItem->oArticle = oxNew('oxarticle'); $oNewItem->oArticle->Load($oNewItem->sId); // passing variable to template with unique name $smarty->assign('_newitem', $oNewItem); // deleting article object data oxRegistry::getSession()->deleteVariable('_newitem'); $blRender = true; } // returning generated message content if ($blRender) { return $smarty->fetch($sTemplate); } }
/** * Vergibt eine ArtikelID für den Pfandartikel und schreibt den Pfandpreis in die DB */ protected function PfandArtikelID($price) { /* $oxLang = oxLang::getInstance(); */ // bis CE 4.8.9 $oxLang = oxRegistry::getLang(); // ab CE 4.9.0 $title = $oxLang->translateString('VTEC_PFAND', 0); /* $vtec_mwst = oxConfig::getInstance()->getConfigParam('vtec_pfand_mwst'); */ // bis CE 4.8.9 $vtec_mwst = oxRegistry::getConfig()->getConfigParam('vtec_pfand_mwst'); // ab CE 4.9.0 $sSelect = "SELECT oxid FROM oxarticles WHERE oxtitle = '" . $title . "' AND oxprice = '" . $price . "' LIMIT 1"; $qResult = oxDb::getDb(ADODB_FETCH_ASSOC)->getOne($sSelect); if ($qResult == false || $qResult == null) { $oArticle = oxNew("oxarticle"); $aLangs = $oxLang->getLanguageIds(); $oArticle->assign(array('oxarticles__active' => 1, 'oxarticles__oxissearch' => 0, 'oxarticles__oxprice' => $price, 'oxarticles__oxpricea' => $price, 'oxarticles__oxpriceb' => $price, 'oxarticels__oxpricec' => $price, 'oxarticles__oxpic1' => 'pfand.jpg', 'oxarticles__oxvat' => $vtec_mwst)); $oArticle->save(); //foreach ($aLangs as $iLang){ for ($i = 0; $i < count($aLangs); $i++) { $oArticle->setLanguage($i); $oArticle->assign(array("oxarticles__oxtitle" => $oxLang->translateString('VTEC_PFAND', $i))); $oArticle->save(); } $qResult = $oArticle->oxarticles__oxid->value; } return $qResult; }
/** * Saves news text. * * @return mixed */ public function save() { parent::save(); $soxId = $this->getEditObjectId(); $aParams = oxRegistry::getConfig()->getRequestParameter("editval"); $oNews = oxNew("oxnews"); $iNewsLang = oxRegistry::getConfig()->getRequestParameter("newslang"); if (!isset($iNewsLang)) { $iNewsLang = $this->_iEditLang; } if ($soxId != "-1") { $oNews->loadInLang($iNewsLang, $soxId); } else { $aParams['oxnews__oxid'] = null; } // Disable editing for derived items. if ($oNews->isDerived()) { return; } $oNews->setLanguage(0); $oNews->assign($aParams); $oNews->setLanguage($iNewsLang); $oNews->save(); // set oxid if inserted $this->setEditObjectId($oNews->getId()); }
/** * Saves changed shop configuration parameters. */ public function save() { $myConfig = $this->getConfig(); $sOxId = $this->getEditObjectId(); // base parameters $aConfStrs = oxRegistry::getConfig()->getRequestParameter("confstrs"); $aConfAArs = oxRegistry::getConfig()->getRequestParameter("confaarrs"); $aConfBools = oxRegistry::getConfig()->getRequestParameter("confbools"); // validating language Ids if (is_array($aConfAArs['aTsLangIds'])) { $blActive = isset($aConfBools["blTsWidget"]) && $aConfBools["blTsWidget"] == "true" ? true : false; $sPkg = "OXID_ESALES"; $aActiveLangs = array(); foreach ($aConfAArs['aTsLangIds'] as $sLangId => $sId) { $aActiveLangs[$sLangId] = false; if ($sId) { $sTsUser = $myConfig->getConfigParam('sTsUser'); $sTsPass = $myConfig->getConfigParam('sTsPass'); // validating and switching on/off $sResult = $this->_validateId($sId, (bool) $blActive, $sTsUser, $sTsPass, $sPkg); // keeping activation state $aActiveLangs[$sLangId] = $sResult == "OK" ? true : false; // error message if ($sResult && $sResult != "OK") { $this->_aViewData["errorsaving"] = "DYN_TRUSTED_RATINGS_ERR_{$sResult}"; } } } $myConfig->saveShopConfVar("arr", "aTsActiveLangIds", $aActiveLangs, $sOxId); } parent::save(); }
/** * Is called on module deactivation. Deletes the theme settings. Note that after deactivation the settings * will be lost. */ public static function onDeactivate() { $iShopId = oxRegistry::getConfig()->getShopId(); $sThemeName = self::_getThemeName(); $sDeleteSQL = "\n DELETE\n oxconfig.*,\n oxconfigdisplay.*\n FROM `oxconfig`\n LEFT JOIN `oxconfigdisplay`\n ON ( `oxconfig`.`OXID` = `oxconfigdisplay`.`OXID` )\n WHERE `oxconfig`.`OXMODULE` = ? AND `oxconfig`.`oxshopid` = ?\n "; oxDb::getDb()->Execute($sDeleteSQL, array('theme:' . $sThemeName, $iShopId)); }
/** * Executes parent method parent::render(), creates deliveryset category tree, * passes data to Smarty engine and returns name of template file "deliveryset_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); $sModuleId = $this->_sModuleId = $this->getEditObjectId(); $sShopId = $myConfig->getShopId(); $oModule = oxNew('oxModule'); if ($sModuleId && $oModule->load($sModuleId)) { try { $aDbVariables = $this->_loadMetadataConfVars($oModule->getInfo("settings")); $this->_aViewData["var_constraints"] = $aDbVariables['constraints']; $this->_aViewData["var_grouping"] = $aDbVariables['grouping']; $iCount = 0; foreach ($this->_aConfParams as $sType => $sParam) { $this->_aViewData[$sParam] = $aDbVariables['vars'][$sType]; $iCount += count($aDbVariables['vars'][$sType]); } } catch (oxException $oEx) { oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx); $oEx->debugOut(); } } else { oxRegistry::get("oxUtilsView")->addErrorToDisplay(new oxException('EXCEPTION_MODULE_NOT_LOADED')); } $this->_aViewData["oModule"] = $oModule; return 'module_config.tpl'; }
/** * Non static getter returning str handler. The sense of getStr() and _getStrHandler() is * to be possible to call this method statically ( oxStr::getStr() ), yet leaving the * possibility to extend it in modules by overriding _getStrHandler() method. * * @return object */ protected function _getStrHandler() { if (oxRegistry::getConfig()->isUtf() && function_exists('mb_strlen')) { return oxNew("oxStrMb"); } return oxNew("oxStrRegular"); }
public function setLangCache($sCacheName, $aLangCache) { if (oxRegistry::getConfig()->getConfigParam("bl_VtDev_disableLangCache")) { return true; } return parent::setLangCache($sCacheName, $aLangCache); }
/** * Magic call method making a default workflow call to Paymorrow API. * * @param string $sMethodName * @param array $aArguments * * @return array */ public function __call($sMethodName, $aArguments) { // Get all gateway related instances: client, data provider and response, handler /** @var OxpsOxid2Paymorrow $oOxidToPm */ $oOxidToPm = oxNew('OxpsOxid2Paymorrow'); /** @var OxpsPaymorrowClient|PaymorrowClient $oClient */ $oClient = $this->getPmClient(); /** @var OxpsPaymorrowEshopDataProvider $oDataProvider */ $oDataProvider = $oOxidToPm->getEshopDataProvider(); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxRegistry::get('OxpsPaymorrowResponseHandler'); // Set method URL $oClient->setEndPoint($this->getEndPointUrl() . $sMethodName); // Collect auth data and perform a request $aResponseData = $oClient->sendRequest(array_merge($oDataProvider->collectCommonData(), (array) reset($aArguments))); // Check it response is OK or an error if (isset($aResponseData['response_status']) and $aResponseData['response_status'] === 'OK') { $sResponseHandlerMethodFormat = 'handle%sResponseOK'; } else { $sResponseHandlerMethodFormat = 'handle%sResponseError'; } // Call the response handler method $sResponseHandlerMethod = sprintf($sResponseHandlerMethodFormat, ucfirst($sMethodName)); $oResponseHandler->{$sResponseHandlerMethod}($aResponseData); // Return formatted response data return $this->prepareResponseData($aResponseData); }
public static function cleanup() { $oDb = oxDb::getDb(); $sShopId = oxRegistry::getConfig()->getShopId(); $sQuery = "DELETE FROM `oxseo` WHERE `OXSTDURL` LIKE '%StylaSEO_Output%' and oxshopid = " . $oDb->quote($sShopId) . " ;"; $oDb->Execute($sQuery); }
/** * Smarty function * ------------------------------------------------------------- * Purpose: Modifies provided language constant with it's translation * usage: [{$val|oxmultilangassign}] * ------------------------------------------------------------- * * @param string $sIdent language constant ident * @param mixed $args for constants using %s notations * * @return string */ function smarty_modifier_oxmultilangassign($sIdent, $args = null) { if (!isset($sIdent)) { $sIdent = 'IDENT MISSING'; } $oLang = oxRegistry::getLang(); $oConfig = oxRegistry::getConfig(); $oShop = $oConfig->getActiveShop(); $iLang = $oLang->getTplLanguage(); $blShowError = true; if ($oShop->isProductiveMode()) { $blShowError = false; } try { $sTranslation = $oLang->translateString($sIdent, $iLang, $oLang->isAdmin()); $blTranslationNotFound = !$oLang->isTranslated(); } catch (\OxidEsales\EshopCommunity\Core\Exception\LanguageException $oEx) { // is thrown in debug mode and has to be caught here, as smarty hangs otherwise! } if (!$blTranslationNotFound) { if ($args) { if (is_array($args)) { $sTranslation = vsprintf($sTranslation, $args); } else { $sTranslation = sprintf($sTranslation, $args); } } } elseif ($blShowError) { $sTranslation = 'ERROR: Translation for ' . $sIdent . ' not found!'; } return $sTranslation; }
/** * Returns SEO uri for content object. Includes parent category path info if * content is assigned to it * * @param oxcontent $oCont content category object * @param int $iLang language * @param bool $blRegenerate if TRUE forces seo url regeneration * * @return string */ public function getContentUri($oCont, $iLang = null, $blRegenerate = false) { if (!isset($iLang)) { $iLang = $oCont->getLanguage(); } //load details link from DB if ($blRegenerate || !($sSeoUrl = $this->_loadFromDb('oxContent', $oCont->getId(), $iLang))) { if ($iLang != $oCont->getLanguage()) { $sId = $oCont->getId(); $oCont = oxNew('oxContent'); $oCont->loadInLang($iLang, $sId); } $sSeoUrl = ''; if ($oCont->getCategoryId() && $oCont->getType() === 2) { $oCat = oxNew('oxCategory'); if ($oCat->loadInLang($iLang, $oCont->oxcontents__oxcatid->value)) { $sParentId = $oCat->oxcategories__oxparentid->value; if ($sParentId && $sParentId != 'oxrootid') { $oParentCat = oxNew('oxCategory'); if ($oParentCat->loadInLang($iLang, $oCat->oxcategories__oxparentid->value)) { $sSeoUrl .= oxRegistry::get("oxSeoEncoderCategory")->getCategoryUri($oParentCat); } } } } $sSeoUrl .= $this->_prepareTitle($oCont->oxcontents__oxtitle->value, false, $oCont->getLanguage()) . '/'; $sSeoUrl = $this->_processSeoUrl($sSeoUrl, $oCont->getId(), $iLang); $this->_saveToDb('oxcontent', $oCont->getId(), $oCont->getBaseStdLink($iLang), $sSeoUrl, $iLang); } return $sSeoUrl; }
/** * Executes the current command. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance */ protected function execute(InputInterface $input, OutputInterface $output) { // allow empty password $dbPwd = \oxRegistry::getConfig()->getConfigParam('dbPwd'); if (!empty($dbPwd)) { $dbPwd = '-p' . $dbPwd; } $file = $input->getOption('file'); if (!empty($file)) { $file = "> " . $file; } else { $file = ""; } if ($input->getOption('ignoreViews')) { $dbName = \oxRegistry::getConfig()->getConfigParam('dbName'); $viewsResultArray = \oxDb::getDb()->getArray("SHOW FULL TABLES IN {$dbName} WHERE TABLE_TYPE LIKE 'VIEW'"); $ignoreViewTables = array(); foreach ($viewsResultArray as $viewArray) { $ignoreViewTables[] = '--ignore-table=' . $dbName . '.' . $viewArray[0]; } $ignoreViewTables = implode(' ', $ignoreViewTables); } $exec = sprintf("mysqldump -h%s %s -u%s %s %s %s 2>&1", \oxRegistry::getConfig()->getConfigParam('dbHost'), $dbPwd, \oxRegistry::getConfig()->getConfigParam('dbUser'), \oxRegistry::getConfig()->getConfigParam('dbName'), $ignoreViewTables, $file); exec($exec, $commandOutput, $returnValue); if ($returnValue > 0) { $output->writeln('<error>' . implode(PHP_EOL, $commandOutput) . '</error>'); return; } if (!empty($file)) { $output->writeln("<info>Dump {$input->getOption('file')} created.</info>"); } else { $output->writeln($commandOutput); } }
/** * Saves category description text to DB. * * @return mixed */ public function save() { parent::save(); $myConfig = $this->getConfig(); $soxId = $this->getEditObjectId(); $aParams = oxRegistry::getConfig()->getRequestParameter("editval"); $oCategory = oxNew("oxCategory"); $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang"); $iCatLang = $iCatLang ? $iCatLang : 0; if ($soxId != "-1") { $oCategory->loadInLang($iCatLang, $soxId); } else { $aParams['oxcategories__oxid'] = null; } //Disable editing for derived items if ($oCategory->isDerived()) { return; } $oCategory->setLanguage(0); $oCategory->assign($aParams); $oCategory->setLanguage($iCatLang); $oCategory->save(); // set oxid if inserted $this->setEditObjectId($oCategory->getId()); }
/** * Parse response message received from Online License Key Check web service and save it to response object. * * @param string $sRawResponse * * @throws oxException * * @return oxOnlineLicenseCheckResponse */ protected function _formResponse($sRawResponse) { /** @var oxUtilsXml $oUtilsXml */ $oUtilsXml = oxRegistry::get("oxUtilsXml"); if (empty($sRawResponse) || !($oDomDoc = $oUtilsXml->loadXml($sRawResponse))) { throw new oxException('OLC_ERROR_RESPONSE_NOT_VALID'); } if ($oDomDoc->documentElement->nodeName != $this->_sResponseElement) { throw new oxException('OLC_ERROR_RESPONSE_UNEXPECTED'); } $oResponseNode = $oDomDoc->firstChild; if (!$oResponseNode->hasChildNodes()) { throw new oxException('OLC_ERROR_RESPONSE_NOT_VALID'); } $oNodes = $oResponseNode->childNodes; /** @var oxOnlineLicenseCheckResponse $oResponse */ $oResponse = oxNew('oxOnlineLicenseCheckResponse'); // iterate through response node to get response parameters for ($i = 0; $i < $oNodes->length; $i++) { $sNodeName = $oNodes->item($i)->nodeName; $sNodeValue = $oNodes->item($i)->nodeValue; $oResponse->{$sNodeName} = $sNodeValue; } return $oResponse; }
public function request_product() { $myConfig = $this->getConfig(); $myUtils = oxRegistry::getUtils(); //control captcha $sMac = oxRegistry::getConfig()->getRequestParameter('c_mac'); $sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach'); $oCaptcha = $this->getCaptcha(); if (!$oCaptcha->pass($sMac, $sMacHash)) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE'); return; } /** @var oxMailValidator $oMailValidator */ $oMailValidator = oxNew('oxMailValidator'); $aParams = oxRegistry::getConfig()->getRequestParameter('pa'); if (!isset($aParams['email']) || !$oMailValidator->isValidEmail($aParams['email'])) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_INVALID_EMAIL'); return; } $aParams['aid'] = $this->getProduct()->getId(); $oArticleRequest = oxNew("psarticlerequest"); $oArticleRequest->psarticlerequest__oxuserid = new oxField(oxRegistry::getSession()->getVariable('usr')); $oArticleRequest->psarticlerequest__oxemail = new oxField($aParams['email']); $oArticleRequest->psarticlerequest__oxartid = new oxField($aParams['aid']); $oArticleRequest->psarticlerequest__oxshopid = new oxField($myConfig->getShopId()); $oArticleRequest->psarticlerequest__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage()); $oArticleRequest->psarticlerequest__oxstatus = new oxField(psArticleRequest::STATUS_RECEIVED); $oArticleRequest->save(); $oEmail = oxNew("oxEmail"); $oEmail->sendArticleRequestNotification($aParams, $oArticleRequest); $this->_iArticleRequestStatus = 1; oxRegistry::get("oxUtilsView")->addErrorToDisplay('PS_ARTICLEREQUEST_SUCCESS'); }
/** * Kicks off the notification process and sends out the header after a * successful or not successful hash validation. * * @return string current template file name */ public function render() { parent::render(); $oUpdateHandler = $this->_getUpdateHandler(); if (!$oUpdateHandler->checkData($_GET)) { $this->_sendHeader(self::STATUS_BAD_REQUEST); return; } switch ($oUpdateHandler->getState()) { case self::STATE_PAID: case self::STATE_EXPIRED: $success = $oUpdateHandler->updatePayment(); break; case self::STATE_REFUND_COMPLETED: case self::STATE_REFUND_EXPIRED: $success = $oUpdateHandler->updateRefund(); break; default: oxRegistry::getUtils()->writeToLog(date('c') . 'Notification failed: Unknown state - ' . $oUpdateHandler->getState() . "\r\r", self::LOGFILE); $success = false; break; } if (!$success) { $this->_sendHeader(self::STATUS_BAD_REQUEST); return; } $this->_sendHeader(self::STATUS_OK); return 'page/shop/start.tpl'; }
/** * Gets path to module directory. * * @return string */ public function getPathToModuleDirectory() { if (is_null($this->_sPathToModuleDirectory)) { $this->setPathToModuleDirectory(oxRegistry::getConfig()->getModulesDir()); } return $this->_sPathToModuleDirectory; }
public function testPrepareStrForSearch() { $this->assertEquals(' ä ö ü Ä Ö Ü ß &', oxRegistry::get("oxUtilsString")->prepareStrForSearch(' ä ö ü Ä Ö Ü ß &')); $this->assertEquals(' häuser', oxRegistry::get("oxUtilsString")->prepareStrForSearch(' häuser')); $this->assertEquals('', oxRegistry::get("oxUtilsString")->prepareStrForSearch('qwertz')); $this->assertEquals('', oxRegistry::get("oxUtilsString")->prepareStrforSearch('')); }
/** * Executes parent method parent::render(), creates discount category tree, * passes data to Smarty engine and returns name of template file "discount_main.tpl". * * @return string */ public function render() { parent::render(); $soxId = $this->getEditObjectId(); if (isset($soxId) && $soxId != '-1') { // load object $oDiscount = oxNew('oxdiscount'); $oDiscount->load($soxId); $this->_aViewData['edit'] = $oDiscount; //disabling derived items if ($oDiscount->isDerived()) { $this->_aViewData['readonly'] = true; } // generating category tree for artikel choose select list $this->_createCategoryTree("artcattree"); } $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc"); if ($iAoc == 1) { $oDiscountArticlesAjax = oxNew('discount_articles_ajax'); $this->_aViewData['oxajax'] = $oDiscountArticlesAjax->getColumns(); return "popups/discount_articles.tpl"; } elseif ($iAoc == 2) { $oDiscountCategoriesAjax = oxNew('discount_categories_ajax'); $this->_aViewData['oxajax'] = $oDiscountCategoriesAjax->getColumns(); return "popups/discount_categories.tpl"; } return 'discount_articles.tpl'; }