/** * 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 = oxConfig::getInstance(); $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 = oxSession::getVar('_newitem'); $oBasket = oxSession::getInstance()->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 oxSession::deleteVar('_newitem'); $blRender = true; } // returning generated message content if ($blRender) { return $smarty->fetch($sTemplate); } }
/** * Testing that the right sandbox value is returned. */ public function testGetSandbox() { $oxConfig = oxConfig::getInstance(); $sandbox = $oxConfig->getShopConfVar('bzSandbox', $oxConfig->getShopId, oxConfig::OXMODULE_MODULE_PREFIX . 'bz_barzahlen'); $oView = new bz_barzahlen_payment(); $this->assertEquals($sandbox, $oView->getSandbox()); }
/** * 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 = oxConfig::getInstance(); $smarty->caching = false; /* if( isset( $smarty->oxobject->oProduct)) $smarty->assign_by_ref( "product", $smarty->oxobject->oProduct);*/ // #1184M - specialchar search $sSearchParamForHTML = oxConfig::getParameter("searchparam"); $sSearchParamForLink = rawurlencode(oxConfig::getParameter("searchparam", true)); if ($sSearchParamForHTML) { $smarty->assign_by_ref("searchparamforhtml", $sSearchParamForHTML); $smarty->assign_by_ref("searchparam", $sSearchParamForLink); } $sSearchCat = oxConfig::getParameter("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; }
/** * 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()); } }
/** * 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 (oxConfig::getInstance()->isUtf() && function_exists('mb_strlen')) { return oxNew("oxStrMb"); } return oxNew("oxStrRegular"); }
public function convertToUtf($value) { if (!oxConfig::getInstance()->isUtf()) { $value = utf8_decode($value); } return $value; }
/** * Basic access check for writing data, checks for same shopid, should be overridden if field oxshopid does not exist * * @param oxBase $oObj loaded shop object * @param array $aData fields to be written, null for default * * @throws Exception on now access * * @return null */ public function checkWriteAccess($oObj, $aData = null) { return; $myConfig = oxConfig::getInstance(); if (!$myConfig->getConfigParam('blMallUsers')) { parent::checkWriteAccess($oObj, $aData); } }
/** * log the given message * * @param string $message * @param string $debuginfo */ public function log($message, $debuginfo) { if (oxConfig::getInstance()->getShopConfVar('PAYMILL_ACTIVATE_LOGGING')) { $logging = oxNew('paymill_logging'); $logging->assign(array('identifier' => oxSession::getInstance()->getVar('paymill_identifier'), 'debug' => $debuginfo, 'message' => $message, 'date' => date('Y-m-d H:i:s', oxUtilsDate::getInstance()->getTime()))); $logging->save(); } }
protected function _writeHeader($data) { $sFileName = $this->_getFileName(); $this->_writeFile($data, $sFileName); $sFileUrl = oxConfig::getInstance()->getShopUrl() . 'modules/debugax/tmp/file/' . $sFileName . '.json'; header('filedebug :' . $sFileUrl); return true; }
/** * check for write access for id * * @param oxBase $oObj loaded shop object * @param array $aData fields to be written, null for default * * @throws Exception on now access * * @return null */ public function checkWriteAccess($oObj, $aData = null) { return; if ($oObj->oxorderarticles__oxordershopid->value != oxConfig::getInstance()->getShopId()) { throw new Exception(oxERPBase::$ERROR_USER_NO_RIGHTS); } parent::checkWriteAccess($oObj, $aData); }
public function getPassword() { if (!$this->isBackendUser) { return parent::getPassword(); } $oConfig = class_exists('oxRegistry') ? \oxRegistry::getConfig() : \oxConfig::getInstance(); return $oConfig->getConfigParam('sSwFFAdminPassword'); }
/** * Starts shop framework and returns config instance * * @return oxconfig */ function getConfig() { // custom functions file include_once getShopBasePath() . 'modules/functions.php'; // Generic utility method file include_once getShopBasePath() . 'core/oxfunctions.php'; // initializes singleton config class return oxConfig::getInstance(); }
/** * Smarty plugin * ------------------------------------------------------------- * File: function.oxstyle.php * Type: string, html * Name: oxstyle * Purpose: Collect given css files. but include them only at the top of the page. * * Add [{oxstyle include="oxid.css"}] to include local css file. * Add [{oxstyle include="oxid.css?20120413"}] to include local css file with query string part. * Add [{oxstyle include="http://www.oxid-esales.com/oxid.css"}] to include externall css file. * * IMPORTANT! * Do not forget to add plain [{oxstyle}] tag where you need to output all collected css includes. * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_function_oxstyle($params, &$smarty) { $myConfig = oxConfig::getInstance(); $sSufix = $smarty->_tpl_vars["__oxid_include_dynamic"] ? '_dynamic' : ''; $sCtyles = 'conditional_styles' . $sSufix; $sStyles = 'styles' . $sSufix; $aCtyles = (array) $myConfig->getGlobalParameter($sCtyles); $aStyles = (array) $myConfig->getGlobalParameter($sStyles); $sOutput = ''; if ($params['include']) { $sStyle = $params['include']; if (!preg_match('#^https?://#', $sStyle)) { // Separate query part #3305. $aStyle = explode('?', $sStyle); $sStyle = $aStyle[0] = $myConfig->getResourceUrl($aStyle[0], $myConfig->isAdmin()); // psCDN | start // note: changes in core-files is normally not the right way, but in this case the best ;-) $sShopCssURL = $myConfig->getConfigParam('sShopURLPsCss'); $sShopURL = $myConfig->getConfigParam('sShopURL'); if (!empty($sShopCssURL)) { $sStyle = str_replace($sShopURL, $sShopCssURL . '/', $sStyle); } // psCDN | end // Append query part if still needed #3305. if ($sStyle && count($aStyle) > 1) { $sStyle .= '?' . $aStyle[1]; } } // File not found ? if (!$sStyle) { if ($myConfig->getConfigParam('iDebug') != 0) { $sError = "{oxstyle} resource not found: " . htmlspecialchars($params['include']); trigger_error($sError, E_USER_WARNING); } return; } // Conditional comment ? if ($params['if']) { $aCtyles[$sStyle] = $params['if']; $myConfig->setGlobalParameter($sCtyles, $aCtyles); } else { $aStyles[] = $sStyle; $aStyles = array_unique($aStyles); $myConfig->setGlobalParameter($sStyles, $aStyles); } } else { foreach ($aStyles as $sSrc) { $sOutput .= '<link rel="stylesheet" type="text/css" href="' . $sSrc . '">' . PHP_EOL; } foreach ($aCtyles as $sSrc => $sCondition) { $sOutput .= '<!--[if ' . $sCondition . ']><link rel="stylesheet" type="text/css" href="' . $sSrc . '"><![endif]-->' . PHP_EOL; } } return $sOutput; }
/** * Smarty function * ------------------------------------------------------------- * Purpose: eval given string * add [{ oxeval var="..." }] where you want to display content * ------------------------------------------------------------- * * @param array $aParams parameters to process * @param smarty &$oSmarty smarty object * * @return string */ function smarty_function_oxeval($aParams, &$oSmarty) { if ($aParams['var'] && $aParams['var'] instanceof oxField) { $aParams['var'] = trim($aParams['var']->getRawValue()); } // processign only if enabled if (oxConfig::getInstance()->getConfigParam('bl_perfParseLongDescinSmarty') || isset($aParams['force'])) { include_once $oSmarty->_get_plugin_filepath('function', 'eval'); return smarty_function_eval($aParams, $oSmarty); } return $aParams['var']; }
/** * Smarty plugin * ------------------------------------------------------------- * File: insert.oxid_tracker.php * Type: string, html * Name: oxid_tracker * Purpose: Output etracker code or Econda Code * add [{ insert name="oxid_tracker" title="..." }] after Body Tag in Templates * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_insert_oxid_tracker($params, &$smarty) { $myConfig = oxConfig::getInstance(); // econda is on ? if ($myConfig->getConfigParam('blEcondaActive')) { include_once $myConfig->getConfigParam('sCoreDir') . 'smarty/plugins/oxemosadapter.php'; $sOutput = oxEmosAdapter::getInstance()->getCode($params, $smarty); // returning JS code to output if (strlen(trim($sOutput))) { return "<div style=\"display:none;\">{$sOutput}</div>"; } } }
function getViewName($sTable, $iLangId = null, $sShopId = null) { $myConfig = oxRegistry::getConfig(); // Benutzergruppe aus Moduleinstellungen auslesen bis CE 4.8.9 !!! // ab CE 4.9.0 ist die Funktion oxConfig::getInstance() nicht mehr verfügbar!! $vtec_GruppenID = oxConfig::getInstance()->getConfigParam('vtec_spezialgruppe'); // Ab CE 4.9.0 gilt dieser Eintrag! Obigen Code bitte auskommentieren!!! /* $vtec_GruppenID = oxRegistry::getConfig()->getConfigParam('vtec_spezialgruppe'); */ // Ansicht... $sVtecAnsicht = $sTable; //This config option should only be used in emergency case. //Originally it was planned for the case when admin area is not reached due to the broken views. if (!$myConfig->getConfigParam('blSkipViewUsage')) { $sViewSfx = ""; $sAnsichtSfx = ""; // neue Ansichtsendung $blIsMultiLang = in_array($sTable, oxRegistry::getLang()->getMultiLangTables()); if ($iLangId != -1 && $blIsMultiLang) { $oLang = oxRegistry::getLang(); $iLangId = $iLangId !== null ? $iLangId : oxRegistry::getLang()->getBaseLanguage(); $sAbbr = $oLang->getLanguageAbbr($iLangId); $sViewSfx .= "_" . $sAbbr; } if ($sVtecAnsicht == "oxarticles") { $ox_User_ID = oxSession::getVar("usr"); // bis CE 4.8.9 /* $ox_User_ID = oxRegistry::getSession()->getVariable("usr"); */ // ab CE 4.9.0, obigen Code auskommentieren!! $ox_User = oxNew("oxUser"); $ox_User->load($ox_User_ID); if (!$ox_User->isAdmin()) { $oxGruppen = $ox_User->getUserGroups(); $vtecInSpezGruppe = false; foreach ($oxGruppen as $oxGruppe) { if ($oxGruppe->getId() == $vtec_GruppenID) { $vtecInSpezGruppe = true; } } if (!$vtecInSpezGruppe) { $sAnsichtSfx = "_vsg"; } } } if ($sViewSfx || ($iLangId == -1 || $sShopId == -1) && $blIsMultiLang) { return "oxv_" . $sTable . $sViewSfx . $sAnsichtSfx; } } return $sTable; }
/** * Smarty plugin * ------------------------------------------------------------- * File: block.oxid_content.php * Type: string, html * Name: block_oxifcontent * Purpose: Output content snippet if content exists * add [{oxifcontent ident="..." }][{/oxifcontent}] where you want to display content * ------------------------------------------------------------- * * @param array $params params * @param string $content rendered content * @param Smarty &$smarty clever simulation of a method * @param bool &$repeat repeat * * @return string */ function smarty_block_oxifcontent($params, $content, &$smarty, &$repeat) { $myConfig = oxConfig::getInstance(); $sIdent = isset($params['ident']) ? $params['ident'] : null; $sOxid = isset($params['oxid']) ? $params['oxid'] : null; $sAssign = isset($params['assign']) ? $params['assign'] : null; $sObject = isset($params['object']) ? $params['object'] : 'oCont'; if ($repeat) { if ($sIdent || $sOxid) { static $aContentCache = array(); if ($sIdent && isset($aContentCache[$sIdent]) || $sOxid && isset($aContentCache[$sOxid])) { $oContent = $sOxid ? $aContentCache[$sOxid] : $aContentCache[$sIdent]; } else { $oContent = oxNew("oxcontent"); $blLoaded = $sOxid ? $oContent->load($sOxid) : $oContent->loadbyIdent($sIdent); if ($blLoaded) { $aContentCache[$oContent->getId()] = $aContentCache[$oContent->oxcontents__oxloadid->value] = $oContent; } else { $oContent = false; if ($sOxid) { $aContentCache[$sOxid] = $oContent; } else { $aContentCache[$sIdent] = $oContent; } } } $blLoaded = false; if ($oContent && $oContent->oxcontents__oxactive->value) { $smarty->assign($sObject, $oContent); $blLoaded = true; } } else { $blLoaded = false; } $repeat = $blLoaded; } else { $oStr = getStr(); $blHasSmarty = $oStr->strstr($content, '[{'); if ($blHasSmarty) { $content = oxUtilsView::getInstance()->parseThroughSmarty($content, $sIdent . md5($content), $myConfig->getActiveView()); } if ($sAssign) { $smarty->assign($sAssign, $content); } else { return $content; } } }
/** * Does Export line by line on position iCnt * * @param integer $iCnt export position * * @return bool */ public function nextTick($iCnt) { $iExportedItems = $iCnt; $blContinue = false; if ($oArticle = $this->getOneArticle($iCnt, $blContinue)) { $myConfig = oxConfig::getInstance(); $oSmarty = oxUtilsView::getInstance()->getSmarty(); $oSmarty->assign("sCustomHeader", oxSession::getVar("sExportCustomHeader")); $oSmarty->assign_by_ref("linenr", $iCnt); $oSmarty->assign_by_ref("article", $oArticle); $oSmarty->assign("spr", $myConfig->getConfigParam('sCSVSign')); $oSmarty->assign("encl", $myConfig->getConfigParam('sGiCsvFieldEncloser')); $this->write($oSmarty->fetch("genexport.tpl", $this->getViewId())); return ++$iExportedItems; } return $blContinue; }
/** * Checks if query is allready in log file * * @param string $sSql sql query to check * * @return bool */ protected static function _isSkipped($sSql) { if (!count(self::$_aSkipSqls)) { $sFile = oxConfig::getInstance()->getLogsDir() . 'oxdebugdb_skipped.sql'; if (is_readable($sFile)) { $aSkip = explode('-- -- ENTRY END', file_get_contents($sFile)); foreach ($aSkip as $sQ) { if ($sQ = self::_skipWhiteSpace($sQ)) { self::$_aSkipSqls[md5($sQ)] = true; } } } } $checkTpl = md5(self::_skipWhiteSpace(self::_getSqlTemplate($sSql))); $check = md5(self::_skipWhiteSpace($sSql)); return self::$_aSkipSqls[$check] || self::$_aSkipSqls[$checkTpl]; }
public function init() { $sShopDir = oxConfig::getInstance()->getConfigParam('sShopDir'); $sModulPath = $sShopDir . 'modules' . DS . 'debugax' . DS; $this->_sTmpPath = $sModulPath . 'tmp' . DS; $this->_sSourcePath = $sModulPath . 'source' . DS; $sAdodblitePath = $sShopDir . 'core' . DS . 'adodblite' . DS; $this->_sMysqlDriverPath = $sAdodblitePath . 'adodbSQL_drivers' . DS . 'mysql' . DS . 'mysql_driver.inc'; $this->_sAdodbPath = $sAdodblitePath . 'adodb.inc.php'; $this->_sAdodbPerfPath = $sAdodblitePath . 'adodb-perf.inc.php'; $this->_sPearModulePath = $sAdodblitePath . 'generic_modules' . DS . 'pear_module.inc'; $sBackupDirPath = $sModulPath . 'backup' . DS; $this->_sBackupMysqlDriverPath = $sBackupDirPath . 'mysql_driver.inc'; $this->_sBackupAdodbPath = $sBackupDirPath . DS . 'adodb.inc.php'; $this->_sBackupAdodbPerfPath = $sBackupDirPath . DS . 'adodb-perf.inc.php'; $this->_sBackupPearModulePath = $sBackupDirPath . DS . 'pear_module.inc'; $this->_bBackupStatus = $this->checkBackup(); }
/** * Executes parent::render() and returns active shop object. * * @return object $this->oActShop active shop object */ public function render() { parent::render(); $myConfig = $this->getConfig(); $sShopLogo = $myConfig->getConfigParam('sShopLogo'); if ($sShopLogo && file_exists($myConfig->getImageDir() . '/' . $sShopLogo)) { $oParentView = $this->getParent(); $oParentView->setShopLogo($sShopLogo); } // is shop active? $oShop = $myConfig->getActiveShop(); if (!$oShop->oxshops__oxactive->value && 'oxstart' != $myConfig->getActiveView()->getClassName() && !$this->isAdmin()) { // redirect to offline if there is no active shop $sShopUrl = oxConfig::getInstance()->getShopMainUrl(); oxUtils::getInstance()->redirect($sShopUrl . 'offline.html', false); } return $oShop; }
/** * Does Export line by line on position iCnt * * @param integer $iCnt export position * * @return bool */ public function nextTick($iCnt) { $myConfig = oxConfig::getInstance(); $iExportedItems = $iCnt; if ($oArticle = $this->getOneArticle($iCnt, $blContinue)) { $smarty = oxUtilsView::getInstance()->getSmarty(); $smarty->assign_by_ref("linenr", $iCnt); $smarty->assign_by_ref("article", $oArticle); $smarty->assign("spr", $myConfig->getConfigParam('sCSVSign')); $smarty->assign("encl", $myConfig->getConfigParam('sGiCsvFieldEncloser')); $smarty->assign("sManufacturer", $this->_getManufactorTitle($oArticle->oxarticles__oxmanufacturerid->value)); $smarty->assign("sPictureUrl", $this->_checkPictureUrl($oArticle)); $smarty->assign("sCategory", $oArticle->getCategory()->oxcategories__oxtitle->value); $this->write($smarty->fetch("googlebase_genexport.tpl", $this->getViewID())); return ++$iExportedItems; } return $blContinue; }
/** * Smarty function * ------------------------------------------------------------- * Purpose: Output help popup icon and help text * add [{ oxinputhelp ident="..." }] where you want to display content * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_function_oxinputhelp($params, &$smarty) { $sIdent = $params['ident']; $myConfig = oxConfig::getInstance(); $oLang = oxLang::getInstance(); $iLang = $oLang->getTplLanguage(); try { $sTranslation = $oLang->translateString($sIdent, $iLang, $blAdmin); } catch (oxLanguageException $oEx) { // is thrown in debug mode and has to be caught here, as smarty hangs otherwise! } if (!$sTranslation || $sTranslation == $sIdent) { //no translation, return empty string return ''; } //name of template file where is stored message text $sTemplate = 'inputhelp.tpl'; $smarty->assign('sHelpId', $sIdent); $smarty->assign('sHelpText', $sTranslation); return $smarty->fetch($sTemplate); }
/** * 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_fblogin($params, &$smarty) { $myConfig = oxConfig::getInstance(); $oView = $myConfig->getActiveView(); if (!$myConfig->getConfigParam("bl_showFbConnect")) { return; } // user logged in using facebook account so showing additional // popup about connecting facebook user id to existing shop account $oFb = oxFb::getInstance(); if ($oFb->isConnected() && $oFb->getUser()) { //name of template $sTemplate = 'inc/popup_fblogin.tpl'; // checking, if Facebeook User Id was successfully added if (oxSession::getVar('_blFbUserIdUpdated')) { $sTemplate = 'inc/popup_fblogin_msg.tpl'; oxSession::deleteVar('_blFbUserIdUpdated'); } return $smarty->fetch($sTemplate); } }
/** * Smarty plugin * ------------------------------------------------------------- * File: insert.oxid_cssmanager.php * Type: string, html * Name: oxid_cmpbasket * Purpose: Includes css style file according to template file or sets default * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_insert_oxid_cssmanager($params, &$smarty) { $myConfig = oxConfig::getInstance(); $smarty->caching = false; // template file name $sTplName = $smarty->oxobject->getTemplateName(); // css file extension $sCssExt = "css"; // sets name of alternative CSS file passed template parameters if (isset($params["cssname"]) && $params["cssname"]) { $sAltCss = $params["cssname"]; // possible CSS file for current template } else { $sAltCss = $sTplName . "." . $sCssExt; } // user defined alternative CSS files dir $sAltCssDir = "styles/"; // URL to templates, there may be stored and css files if (isset($params["cssurl"]) && $params["cssurl"]) { $sTplURL = $params["cssurl"]; } else { $sTplURL = $myConfig->getResourceUrl($sAltCssDir, isAdmin()); } // direct path to templates, there may be stored and css files if (isset($params["csspath"]) && $params["csspath"]) { $sTplPath = $params["csspath"]; } else { $sTplPath = $myConfig->getResourcePath($sAltCssDir, isAdmin()); } // full path to alternavive CSS file $sAltFullPath = $sTplPath . $sAltCss; $sOutput = ""; // checking if alternative CSS file exists and returning URL to CSS file if ($sTplName && file_exists($sAltFullPath) && is_file($sAltFullPath)) { $sOutput = '<link rel="stylesheet" href="' . $sTplURL . $sAltCss . '">'; } $smarty->caching = false; return $sOutput; }
/** * Does Export line by line on position iCnt * * @param integer $iCnt export position * * @return bool */ public function nextTick($iCnt) { $myConfig = oxConfig::getInstance(); $iExportedItems = $iCnt; if ($oArticle = $this->getOneArticle($iCnt, $blContinue)) { $smarty = oxUtilsView::getInstance()->getSmarty(); $smarty->assign_by_ref("linenr", $iCnt); $smarty->assign_by_ref("article", $oArticle); #TODO: find out why its not working from config #$smarty->assign( "spr", $myConfig->getConfigParam( 'sCSVSign' ) ); #$smarty->assign( "encl", $myConfig->getConfigParam( 'sGiCsvFieldEncloser' ) ); $smarty->assign("spr", ";"); $smarty->assign("encl", '"'); $smarty->assign("sManufacturer", $this->_getManufactorTitle($oArticle->oxarticles__oxmanufacturerid->value)); $smarty->assign("sPictureUrl", $this->_checkPictureUrl($oArticle)); $smarty->assign("sCategory", $oArticle->getCategory()->oxcategories__oxtitle->value); $smarty->assign("sPriceBrut", $oArticle->getPrice(1)->getBruttoPrice()); $smarty->assign("sPriceNet", $oArticle->getPrice(1)->getNettoPrice()); $this->write($smarty->fetch("superclix_genexport.tpl", $this->getViewID())); return ++$iExportedItems; } return $blContinue; }
/** * Smarty modifier * ------------------------------------------------------------- * Name: smarty_modifier_oxformdate<br> * Purpose: Conterts date/timestamp/datetime type value to user defined format * Example: {$object|oxformdate:"foo"} * ------------------------------------------------------------- * * @param object $oConvObject oxField object * @param string $sFieldType additional type if field (this may help to force formatting) * @param bool $blPassedValue bool if true, will simulate object as sometimes we need to apply formatting to some regulat values * * @return string */ function smarty_modifier_oxformdate($oConvObject, $sFieldType = null, $blPassedValue = false) { // creating fake bject if ($blPassedValue || is_string($oConvObject)) { $sValue = $oConvObject; $oConvObject = new oxField(); $oConvObject->fldmax_length = "0"; $oConvObject->fldtype = $sFieldType; $oConvObject->setValue($sValue); } $myConfig = oxConfig::getInstance(); // if such format applies to this type of field - sets formatted value to passed object if (!$myConfig->getConfigParam('blSkipFormatConversion')) { if ($oConvObject->fldtype == "datetime" || $sFieldType == "datetime") { oxDb::getInstance()->convertDBDateTime($oConvObject); } elseif ($oConvObject->fldtype == "timestamp" || $sFieldType == "timestamp") { oxDb::getInstance()->convertDBTimestamp($oConvObject); } elseif ($oConvObject->fldtype == "date" || $sFieldType == "date") { oxDb::getInstance()->convertDBDate($oConvObject); } } return $oConvObject->value; }
/** * Smarty plugin * ------------------------------------------------------------- * File: insert.oxid_content.php * Type: string, html * Name: oxid_content * Purpose: Output content snippet * add [{ insert name="oxid_content" ident="..." }] where you want to display content * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_function_oxcontent($params, &$smarty) { $myConfig = oxConfig::getInstance(); $sText = $myConfig->getActiveShop()->oxshops__oxproductive->value ? null : "<b>content not found ! check ident(" . $params['ident'] . ") !</b>"; $smarty->oxidcache = new oxField($sText, oxField::T_RAW); $sIdent = isset($params['ident']) ? $params['ident'] : null; $sOxid = isset($params['oxid']) ? $params['oxid'] : null; if ($sIdent || $sOxid) { $oContent = oxNew("oxcontent"); if ($sOxid) { $blLoaded = $oContent->load($sOxid); } else { $blLoaded = $oContent->loadbyIdent($sIdent); } if ($blLoaded && $oContent->oxcontents__oxactive->value) { // set value $sField = "oxcontent"; if ($params['field']) { $sField = $params['field']; } // set value $sProp = 'oxcontents__' . $sField; $smarty->oxidcache = clone $oContent->{$sProp}; $smarty->compile_check = true; $sCacheId = oxLang::getInstance()->getBaseLanguage() . $myConfig->getShopId(); $sText = $smarty->fetch("ox:" . (string) $sIdent . (string) $sOxid . $sField . $sCacheId); $smarty->compile_check = $myConfig->getConfigParam('blCheckTemplates'); } } // if we write '[{oxcontent ident="oxfirststart" assign="fs_text"}]' the content wont be outputed. // instead of this the content will be assignet to variable. if (isset($params['assign']) && $params['assign']) { $smarty->assign($params['assign'], $sText); } else { return $sText; } }
function &adodb_log_sql(&$conn, $sql, $inputarr) { /** OXID changes - create separate mysql connection for logging for not loosing info from last query (R) */ $_logSqlDbInstance = $conn->_logSqlDbInstance; $perf_table = adodb_perf::table(); $conn->_logsql = false; // replaces setting ::fnExecute=false in ADOdb $t0 = microtime(); $rs =& $conn->Execute($sql, $inputarr); $t1 = microtime(); $conn->_logsql = true; // reverse setting ::_logsql=false if (!$_logSqlDbInstance) { $myConfig = oxConfig::getInstance(); $conn->_logSqlDbInstance = $_logSqlDbInstance =& NewADOConnection($myConfig->getConfigParam("dbType")); $_logSqlDbInstance->_connect($conn->host, $conn->username, $conn->password, $conn->database, false, true); } if (!empty($conn->_logsql)) { //$conn->_logsql = false; // disable logsql error simulation $dbT = $conn->dbtype; $a0 = explode(' ', $t0); $a0 = (double) $a0[1] + (double) $a0[0]; $a1 = explode(' ', $t1); $a1 = (double) $a1[1] + (double) $a1[0]; $time = $a1 - $a0; if (!$rs) { $errM = $conn->ErrorMsg(); $errN = $conn->ErrorNo(); $tracer = substr('ERROR: ' . htmlspecialchars($errM), 0, 250); } else { $tracer = ''; $errM = ''; $errN = 0; } if (isset($_SERVER['HTTP_HOST'])) { $tracer .= '<br>' . $_SERVER['HTTP_HOST']; if (isset($_SERVER['PHP_SELF'])) { $tracer .= $_SERVER['PHP_SELF']; } } elseif (isset($_SERVER['PHP_SELF'])) { $tracer .= '<br>' . $_SERVER['PHP_SELF']; } // OXID - added backtrace $_aTrace = debug_backtrace(); $_sTrace = ''; foreach ($_aTrace as $_trace) { $_sTrace .= "{$_trace['file']} - {$_trace['function']}:{$_trace['line']}\n"; } $tracer .= "\n\nBacktrace:\n" . $_sTrace; $tracer = (string) substr($tracer, 0, 5000); if (is_array($inputarr)) { if (is_array(reset($inputarr))) { $params = 'Array sizeof=' . sizeof($inputarr); } else { // Quote string parameters so we can see them in the // performance stats. This helps spot disabled indexes. $xar_params = $inputarr; foreach ($xar_params as $xar_param_key => $xar_param) { if (gettype($xar_param) == 'string') { $xar_params[$xar_param_key] = '"' . $xar_param . '"'; } } $params = implode(', ', $xar_params); if (strlen($params) >= 3000) { $params = substr($params, 0, 3000); } } } else { $params = ''; } if (is_array($sql)) { $sql = $sql[0]; } $arr = array('b' => strlen($sql) . '.' . crc32($sql), 'c' => substr($sql, 0, 3900), 'd' => $params, 'e' => $tracer, 'f' => adodb_round($time, 6)); //$saved = $_logSqlDbInstance->debug; //$_logSqlDbInstance->debug = 0; $d = $conn->sysTimeStamp; if (empty($d)) { $d = date("'Y-m-d H:i:s'"); } /* // OCI/Informix/ODBC_MSSQL - not sure if/how available in adodb-lite so I've commented out the section for now - (Pádraic) */ /*if ($dbT == 'oci8' && $dbT != 'oci8po') { $isql = "insert into $perf_table values($d,:b,:c,:d,:e,:f)"; } elseif($dbT == 'odbc_mssql' || $dbT == 'informix') { $timer = $arr['f']; if ($dbT == 'informix') $sql2 = substr($sql2,0,230); $sql1 = $conn->qstr($arr['b']); $sql2 = $conn->qstr($arr['c']); $params = $conn->qstr($arr['d']); $tracer = $conn->qstr($arr['e']); $isql = "insert into $perf_table (created,sql0,sql1,params,tracer,timer) values($d,$sql1,$sql2,$params,$tracer,$timer)"; if ($dbT == 'informix') $isql = str_replace(chr(10),' ',$isql); $arr = false; } else {*/ $isql = "insert into {$perf_table} (created,sql0,sql1,params,tracer,timer) values( {$d},?,?,?,?,?)"; //} // OXID change - added try catch wrapping try { $ok = $_logSqlDbInstance->Execute($isql, $arr); } catch (Exception $e) { $ok = false; } //$_logSqlDbInstance->debug = $saved; if ($ok) { //$_logSqlDbInstance->_logsql = true; } else { $err2 = $_logSqlDbInstance->ErrorMsg(); //$_logSqlDbInstance->_logsql = true; // enable logsql error simulation $perf =& NewPerfMonitor($_logSqlDbInstance); if ($perf) { if ($perf->CreateLogTable()) { $ok = $_logSqlDbInstance->Execute($isql, $arr); } } else { $ok = $_logSqlDbInstance->Execute("create table {$perf_table} (\r\n created varchar(50),\r\n sql0 varchar(250),\r\n sql1 varchar(4000),\r\n params varchar(3000),\r\n tracer varchar(5000),\r\n timer decimal(16,6))"); } /*if (!$ok) { ADOConnection::outp( "<p><b>LOGSQL Insert Failed</b>: $isql<br>$err2</p>"); $conn->_logsql = false; }*/ } //$conn->_errorMsg = $errM; //$conn->_errorCode = $errN; } return $rs; }
protected function _getAdminUrl() { return oxConfig::getInstance()->getShopUrl(null, true) . 'admin/index.php?stoken=' . oxConfig::getParameter('stoken') . '&force_admin_sid=' . oxConfig::getParameter('force_admin_sid'); }