/** * 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); } }
/** * 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(); } }
/** * Returns session Remote Access token. Later you can pass the token over rtoken URL param * when you want to access the shop, for example, from different client. * * @return string */ public function getRemoteAccessToken() { $sRaToken = oxSession::getInstance()->getRemoteAccessToken(); return $sRaToken; }
/** * loads the paymentlist * * @overload */ public function getPaymentList() { //clear values oxSession::deleteVar('paymill_authorized_amount'); $differentAmount = intval(round(oxConfig::getInstance()->getShopConfVar('PAYMILL_ACTIVATE_DIFFERENTAMOUNT'), 2) * 100); //save authorized Amount for secure Paymentprocessing $amount = intval(round(oxSession::getInstance()->getBasket()->getPrice()->getBruttoPrice() * 100) + $differentAmount); oxSession::setVar('paymill_authorized_amount', $amount); $this->addTplParam('paymillAmount', $amount); $paymentList = parent::getPaymentList(); $privateKey = oxConfig::getInstance()->getShopConfVar('PAYMILL_PRIVATEKEY'); $publicKey = oxConfig::getInstance()->getShopConfVar('PAYMILL_PUBLICKEY'); if (empty($privateKey) || empty($publicKey)) { // @TODO log message so user knows that payment was deactivated because of missing private or public key unset($paymentList['paymill_elv']); unset($paymentList['paymill_cc']); } return $paymentList; }
/** * Performs base url processing - adds required parameters to given url * * @param string $sUrl url to process * @param bool $blFinalUrl should url be finalized or should it end with ? or & (default true) * @param array $aParams additional parameters (default null) * @param int $iLang url target language (default null) * * @return string */ public function processUrl($sUrl, $blFinalUrl = true, $aParams = null, $iLang = null) { $aAddParams = $this->getAddUrlParams(); if (is_array($aParams) && count($aParams)) { $aAddParams = array_merge($aAddParams, $aParams); } $ret = oxSession::getInstance()->processUrl(oxLang::getInstance()->processUrl($this->appendUrl($sUrl, $aAddParams), $iLang)); if ($blFinalUrl) { $ret = getStr()->preg_replace('/(\\?|&(amp;)?)$/', '', $ret); } return $ret; }
function render() { $myConfig = oxConfig::getInstance(); $mySession = oxSession::getInstance(); parent::render(); }
function modAttach($oObj = null) { parent::modAttach($oObj); $this->_oRealInstance = oxSession::getInstance(); if (!$oObj) { $oObj = $this; } self::$unitMOD = $oObj; $this->_id = $this->_oRealInstance->getId(); }
function modAttach() { parent::modAttach(); $this->_oRealInstance = oxSession::getInstance(); self::$unitMOD = $this; $this->_id = $this->_oRealInstance->getId(); }
/** * Main import method, whole import of all types via a given csv file is done here * * @param string $sPath full path of the CSV file. * @param string $sUserName user name * @param string $sUserPassword password * @param integer $sShopId shop ID * @param integer $sShopLanguage language ID * * @return string * */ public function doImport($sPath = null, $sUserName = null, $sUserPassword = null, $sShopId = null, $sShopLanguage = null) { $myConfig = oxConfig::getInstance(); $mySession = oxSession::getInstance(); $this->_sReturn = ""; $iMaxLineLength = 8192; //TODO change $this->_sPath = $sPath; //init with given data try { $this->init(null, null); } catch (Exception $ex) { return $this->_sReturn = 'ERPGENIMPORT_ERROR_USER_NO_RIGHTS'; } $file = @fopen($this->_sPath, "r"); if (isset($file) && $file) { $iRow = 0; $aRow = array(); while (($aRow = fgetcsv($file, $iMaxLineLength, $this->_getCsvFieldsTerminator(), $this->_getCsvFieldsEncolser())) !== false) { $this->_aData[] = $aRow; } if ($this->_blCsvContainsHeader) { //skipping first row - it's header array_shift($this->_aData); } try { $this->Import(); } catch (Exception $ex) { echo $ex->getMessage(); $this->_sReturn = 'ERPGENIMPORT_ERROR_DURING_IMPORT'; } } else { $this->_sReturn = 'ERPGENIMPORT_ERROR_WRONG_FILE'; } @fclose($file); return $this->_sReturn; }
/** * Returns the OXID session object. * * @return oxSession */ public function getSession() { return oxSession::getInstance(); }
/** * oxSession instance getter * * @return oxsession */ public function getSession() { if (defined('OXID_PHP_UNIT')) { if (isset($this->unitCustModSess)) { return $this->unitCustModSess; } return oxSession::getInstance(); } if (self::$_oSession == null) { self::$_oSession = oxSession::getInstance(); } return self::$_oSession; }
include_once $sBasePath . 'modules/functions.php'; include_once $sBasePath . 'core/oxfunctions.php'; include_once $sBasePath . 'core/adodblite/adodb.inc.php'; include_once $sBasePath . 'core/oxconfig.php'; include_once $sBasePath . 'core/oxsupercfg.php'; include_once $sBasePath . "core/oxutils.php"; $myConfig = oxConfig::getInstance(); // Includes Utility module. $sUtilModule = $myConfig->getConfigParam('sUtilModule'); if ($sUtilModule && file_exists(getShopBasePath() . "modules/" . $sUtilModule)) { include_once getShopBasePath() . "modules/" . $sUtilModule; } $myConfig->setConfigParam('blAdmin', true); $myConfig->setConfigParam('blTemplateCaching', false); // authorization if (!(oxSession::getInstance()->checkSessionChallenge() && count(oxUtilsServer::getInstance()->getOxCookie()) && oxUtils::getInstance()->checkAccessRights())) { header("location:index.php"); oxUtils::getInstance()->showMessageAndExit(""); } if ($sContainer = oxConfig::getParameter('container')) { $sContainer = trim(strtolower(basename($sContainer))); $aColumns = array(); include_once 'inc/' . $sContainer . '.inc.php'; //$oAjaxComponent = new ajaxcomponent( $aColumns ); $oAjaxComponent = oxNew("ajaxcomponent"); $oAjaxComponent->init($aColumns); $oAjaxComponent->setName($sContainer); $oAjaxComponent->processRequest(oxConfig::getParameter('fnc')); } else { } $myConfig->pageClose();
/** * oxERPBase::loadSessionData() * load session - should be called on init * * @param string $sSessionID session id * * @return null */ public function loadSessionData($sSessionID) { if (!$sSessionID) { throw new Exception("ERROR: Session ID not valid!"); } $_COOKIE = array('admin_sid' => $sSessionID); // start session $myConfig = oxConfig::getInstance(); $myConfig->setConfigParam('blAdmin', 1); $myConfig->setAdminMode(true); $mySession = oxSession::getInstance(); // change session if needed if ($sSessionID != session_id()) { if (session_id()) { session_write_close(); } session_id($sSessionID); session_start(); } $sAuth = $mySession->getVar('auth'); if (!isset($sAuth) || !$sAuth) { throw new Exception("ERROR: Session ID not valid!"); } $this->_iLanguage = $mySession->getVar('lang'); $this->_sUserID = $sAuth; $this->_blInit = true; }