/** * Helper method to set the given currencies. * * @param array $aCurrencies The currencies we want to set. */ protected function _setCurrencies($aCurrencies) { if (!empty($aCurrencies) || is_null($aCurrencies)) { $oConfig = Registry::getConfig(); $oConfig->setConfigParam('aCurrencies', $aCurrencies); } }
/** * Returns language table name * * @param string $sTable table name * @param int $iLangId language id * * @return string */ function getLangTableName($sTable, $iLangId) { $iTableIdx = getLangTableIdx($iLangId); if ($iTableIdx && in_array($sTable, Registry::getLang()->getMultiLangTables())) { $sLangTableSuffix = Registry::getConfig()->getConfigParam("sLangTableSuffix"); $sLangTableSuffix = $sLangTableSuffix ? $sLangTableSuffix : "_set"; $sTable .= $sLangTableSuffix . $iTableIdx; } return $sTable; }
/** * Checks if main folder matches requested * * @param string $path image path name to check * * @return bool */ protected function _isValidPath($path) { $valid = false; list($width, $height, $quality) = $this->_getImageInfo(); if ($width && $height && $quality) { $config = Registry::getConfig(); $db = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); // parameter names $names = []; foreach ($this->_aConfParamToPath as $paramName => $pathReg) { if (preg_match($pathReg, $path)) { $names[] = $db->quote($paramName); if ($paramName == "sManufacturerIconsize" || $paramName == "sCatIconsize") { $names[] = $db->quote("sIconsize"); } } } $names = implode(', ', $names); // any name matching path? if ($names) { $decodeField = $config->getDecodeValueQuery(); // selecting shop which image quality matches user given $q = "select oxshopid from oxconfig where oxvarname = 'sDefaultImageQuality' and\n {$decodeField} = " . $db->quote($quality); $shopIdsArray = $db->getAll($q); // building query: // shop id $shopIds = implode(', ', array_map(function ($shopId) use($db) { // probably here we can resolve and check shop id to shorten check? return $db->quote($shopId['oxshopid']); }, $shopIdsArray)); // any shop matching quality if ($shopIds) { // $checkSize = "{$width}*{$height}"; // selecting config variables to check $q = "select oxvartype, {$decodeField} as oxvarvalue from oxconfig\n where oxvarname in ( {$names} ) and oxshopid in ( {$shopIds} ) order by oxshopid"; $values = $db->getAll($q); foreach ($values as $value) { $confValues = (array) $config->decodeValue($value["oxvartype"], $value["oxvarvalue"]); foreach ($confValues as $confValue) { if (strcmp($checkSize, $confValue) == 0) { $valid = true; break; } } } } } } return $valid; }