本文整理汇总了PHP中oxSession类的典型用法代码示例。如果您正苦于以下问题:PHP oxSession类的具体用法?PHP oxSession怎么用?PHP oxSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了oxSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Saves main orders configuration parameters.
*
* @return string
*/
public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = oxConfig::getParameter("editval");
// shopid
$sShopID = oxSession::getVar("actshop");
$aParams['oxorder__oxshopid'] = $sShopID;
$oOrder = oxNew("oxorder");
if ($soxId != "-1") {
$oOrder->load($soxId);
} else {
$aParams['oxorder__oxid'] = null;
}
$oOrder->assign($aParams);
$aDynvalues = oxConfig::getParameter("dynvalue");
if (isset($aDynvalues)) {
// #411 Dodger
$oPayment = oxNew("oxuserpayment");
$oPayment->load($oOrder->oxorder__oxpaymentid->value);
$oPayment->oxuserpayments__oxvalue->setValue(oxUtils::getInstance()->assignValuesToText($aDynvalues));
$oPayment->save();
}
// keeps old delivery cost
$oOrder->reloadDelivery(false);
// keeps old discount
$oOrder->reloadDiscount(false);
$oOrder->recalculateOrder();
// set oxid if inserted
$this->setEditObjectId($oOrder->getId());
}
示例2: addme
/**
* Validates email
* address. If email is wrong - returns false and exits. If email
* address is OK - creates prcealarm object and saves it
* (oxpricealarm::save()). Sends pricealarm notification mail
* to shop owner.
*
* @return bool false on error
*/
public function addme()
{
$myConfig = $this->getConfig();
$myUtils = oxUtils::getInstance();
//control captcha
$sMac = oxConfig::getParameter('c_mac');
$sMacHash = oxConfig::getParameter('c_mach');
$oCaptcha = oxNew('oxCaptcha');
if (!$oCaptcha->pass($sMac, $sMacHash)) {
$this->_iPriceAlarmStatus = 2;
return;
}
$aParams = oxConfig::getParameter('pa');
if (!isset($aParams['email']) || !$myUtils->isValidEmail($aParams['email'])) {
$this->_iPriceAlarmStatus = 0;
return;
}
$oCur = $myConfig->getActShopCurrencyObject();
// convert currency to default
$dPrice = $myUtils->currency2Float($aParams['price']);
$oAlarm = oxNew("oxpricealarm");
$oAlarm->oxpricealarm__oxuserid = new oxField(oxSession::getVar('usr'));
$oAlarm->oxpricealarm__oxemail = new oxField($aParams['email']);
$oAlarm->oxpricealarm__oxartid = new oxField($aParams['aid']);
$oAlarm->oxpricealarm__oxprice = new oxField($myUtils->fRound($dPrice, $oCur));
$oAlarm->oxpricealarm__oxshopid = new oxField($myConfig->getShopId());
$oAlarm->oxpricealarm__oxcurrency = new oxField($oCur->name);
$oAlarm->oxpricealarm__oxlang = new oxField(oxLang::getInstance()->getBaseLanguage());
$oAlarm->save();
// Send Email
$oEmail = oxNew('oxemail');
$this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification($aParams, $oAlarm);
}
示例3: smarty_insert_oxid_newbasketitem
/**
* 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);
}
}
示例4: _getFileName
protected function _getFileName()
{
$sFileName = '';
if (oxSession::hasVar('debugPHP') && oxSession::getVar('debugPHP') !== true) {
$sFileName = oxSession::getVar('debugPHP');
}
return $sFileName .= isAdmin() ? '_admin' : '_shop';
}
示例5: log
/**
* 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();
}
}
示例6: updateViews
/**
* Performs full view update
*
* @return mixed
*/
public function updateViews()
{
//preventing edit for anyone except malladmin
if (oxSession::getVar("malladmin")) {
oxDb::getInstance()->updateViews();
$this->_aViewData["blViewSuccess"] = true;
}
}
示例7: _getErrors
/**
* return page errors array
*
* @return array
*/
protected function _getErrors()
{
$aErrors = oxSession::getVar('Errors');
if (null === $aErrors) {
$aErrors = array();
}
return $aErrors;
}
示例8: render
/**
* Creates shop object, passes shop data to Smarty engine and returns name of
* template file "dyn_adbutler.tpl".
*
* @return string
*/
public function render()
{
parent::render();
$oShop = oxNew("oxshop");
$oShop->load(oxSession::getVar("actshop"));
$this->_aViewData["edit"] = $oShop;
return "dyn_adbutler.tpl";
}
示例9: testInit
/**
* Testing initiation of the received payment information.
*/
public function testInit()
{
$oView = new bz_barzahlen_thankyou();
$oView->init();
$this->assertEquals('', $oView->getInfotextOne());
oxSession::setVar('barzahlenInfotextOne', 'Hallo <b>Welt</b>! <a href="http://www.barzahlen.de">Bar zahlen</a> Infütöxt Äinß');
$oView->init();
$this->assertEquals('Hallo <b>Welt</b>! <a href="http://www.barzahlen.de">Bar zahlen</a> Infütöxt Äinß', $oView->getInfotextOne());
}
示例10: _canUpdate
/**
* Checks if the license key update is allowed.
*
* @return bool
*/
protected function _canUpdate()
{
$myConfig = $this->getConfig();
$blIsMallAdmin = oxSession::getVar('malladmin');
if (!$blIsMallAdmin) {
return false;
}
if ($myConfig->isDemoShop()) {
return false;
}
return true;
}
示例11: info
/**
* Class constructor, assigns template file name passed by URL
* or stored in session ("tpl", "infotpl").
*
* Template variables:
* <b>tpl</b>
*
* Session variables:
* <b>infotpl</b>
*/
public function info()
{
// assign template name
$sTplName = oxConfig::getParameter('tpl');
$sTplName = $sTplName ? $sTplName : oxSession::getVar('infotpl');
if ($sTplName) {
// security fix so that you cant access files from outside template dir
$sTplName = basename($sTplName);
oxSession::setVar('infotpl', $sTplName);
}
$this->_sThisTemplate = $sTplName;
}
示例12: getViewName
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;
}
示例13: render
/**
* Executes parent method parent::render() and returns name of template
* file "shop.tpl".
*
* @return string
*/
public function render()
{
parent::render();
$sCurrentAdminShop = oxSession::getVar("currentadminshop");
if (!$sCurrentAdminShop) {
if (oxSession::getVar("malladmin")) {
$sCurrentAdminShop = "oxbaseshop";
} else {
$sCurrentAdminShop = oxSession::getVar("actshop");
}
}
$this->_aViewData["currentadminshop"] = $sCurrentAdminShop;
oxSession::setVar("currentadminshop", $sCurrentAdminShop);
return "shop.tpl";
}
示例14: getWishUser
/**
* return the user which is owner of the wish list
*
* @return object | bool
*/
public function getWishUser()
{
if ($this->_oWishUser === null) {
$this->_oWishUser = false;
$sUserId = oxConfig::getParameter('wishid') ? oxConfig::getParameter('wishid') : oxSession::getVar('wishid');
if ($sUserId) {
$oUser = oxNew('oxuser');
if ($oUser->load($sUserId)) {
// passing wishlist information
$this->_oWishUser = $oUser;
// store this one to session
oxSession::setVar('wishid', $sUserId);
}
}
}
return $this->_oWishUser;
}
示例15: executePayment
/**
* @overload
*/
public function executePayment($dAmount, &$oOrder)
{
if (!in_array($oOrder->oxorder__oxpaymenttype->rawValue, array("paymill_cc", "paymill_elv"))) {
return parent::executePayment($dAmount, $oOrder);
}
if (oxSession::hasVar('paymill_token')) {
$this->_token = oxSession::getVar('paymill_token');
} else {
oxUtilsView::getInstance()->addErrorToDisplay("No Token was provided");
oxUtils::getInstance()->redirect($this->getConfig()->getSslShopUrl() . 'index.php?cl=payment', false);
}
$this->getSession()->setVar("paymill_identifier", time());
$this->_apiUrl = paymill_util::API_ENDPOINT;
$this->_iLastErrorNo = null;
$this->_sLastError = null;
$this->_initializePaymentProcessor($dAmount, $oOrder);
if ($this->_getPaymentShortCode($oOrder->oxorder__oxpaymenttype->rawValue) === 'cc') {
$this->_paymentProcessor->setPreAuthAmount((int) oxSession::getVar('paymill_authorized_amount'));
}
$this->_loadFastCheckoutData();
$this->_existingClientHandling($oOrder);
if ($this->_token === 'dummyToken') {
$prop = 'paymill_fastcheckout__paymentid_' . $this->_getPaymentShortCode($oOrder->oxorder__oxpaymenttype->rawValue);
$this->_paymentProcessor->setPaymentId($this->_fastCheckoutData->{$prop}->rawValue);
}
$result = $this->_paymentProcessor->processPayment();
$this->log($result ? 'Payment results in success' : 'Payment results in failure', null);
if ($result) {
$saveData = array('oxid' => $oOrder->oxorder__oxuserid->rawValue, 'clientid' => $this->_paymentProcessor->getClientId());
if (oxConfig::getInstance()->getShopConfVar('PAYMILL_ACTIVATE_FASTCHECKOUT')) {
$paymentColumn = 'paymentID_' . strtoupper($this->_getPaymentShortCode($oOrder->oxorder__oxpaymenttype->rawValue));
$saveData[$paymentColumn] = $this->_paymentProcessor->getPaymentId();
}
$this->_fastCheckoutData->assign($saveData);
$this->_fastCheckoutData->save();
if (oxConfig::getInstance()->getShopConfVar('PAYMILL_SET_PAYMENTDATE')) {
$this->_setPaymentDate($oOrder);
}
// set transactionId to session for updating the description after order execute
$transactionId = $this->_paymentProcessor->getTransactionId();
$this->getSession()->setVar('paymillPgTransId', $transactionId);
} else {
oxUtilsView::getInstance()->addErrorToDisplay($this->_getErrorMessage($this->_paymentProcessor->getErrorCode()));
}
return $result;
}