本文整理汇总了PHP中oxRegistry::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP oxRegistry::getSession方法的具体用法?PHP oxRegistry::getSession怎么用?PHP oxRegistry::getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxRegistry
的用法示例。
在下文中一共展示了oxRegistry::getSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 = oxRegistry::getUtils();
//control captcha
$sMac = oxRegistry::getConfig()->getRequestParameter('c_mac');
$sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach');
$oCaptcha = oxNew('oxCaptcha');
if (!$oCaptcha->pass($sMac, $sMacHash)) {
$this->_iPriceAlarmStatus = 2;
return;
}
$aParams = oxRegistry::getConfig()->getRequestParameter('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(oxRegistry::getSession()->getVariable('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(oxRegistry::getLang()->getBaseLanguage());
$oAlarm->save();
// Send Email
$oEmail = oxNew('oxemail');
$this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification($aParams, $oAlarm);
}
示例2: render
/**
* Executes parent method parent::render(), generates menu HTML code,
* passes data to Smarty engine, returns name of template file "nav_frame.tpl".
*
* @return string
*/
public function render()
{
parent::render();
$myUtilsServer = oxRegistry::get("oxUtilsServer");
$sItem = oxRegistry::getConfig()->getRequestParameter("item");
$sItem = $sItem ? basename($sItem) : false;
if (!$sItem) {
$sItem = "nav_frame.tpl";
$aFavorites = oxRegistry::getConfig()->getRequestParameter("favorites");
if (is_array($aFavorites)) {
$myUtilsServer->setOxCookie('oxidadminfavorites', implode('|', $aFavorites));
}
} else {
$oNavTree = $this->getNavigation();
// set menu structure
$this->_aViewData["menustructure"] = $oNavTree->getDomXml()->documentElement->childNodes;
// version patch strin
$sVersion = str_replace(array("EE.", "PE."), "", $this->_sShopVersion);
$this->_aViewData["sVersion"] = trim($sVersion);
//checking requirements if this is not nav frame reload
if (!oxRegistry::getConfig()->getRequestParameter("navReload")) {
// #661 execute stuff we run each time when we start admin once
if ('home.tpl' == $sItem) {
$this->_aViewData['aMessage'] = $this->_doStartUpChecks();
}
} else {
//removing reload param to force requirements checking next time
oxRegistry::getSession()->deleteVariable("navReload");
}
// favorite navigation
$aFavorites = explode('|', $myUtilsServer->getOxCookie('oxidadminfavorites'));
if (is_array($aFavorites) && count($aFavorites)) {
$this->_aViewData["menufavorites"] = $oNavTree->getListNodes($aFavorites);
$this->_aViewData["aFavorites"] = $aFavorites;
}
// history navigation
$aHistory = explode('|', $myUtilsServer->getOxCookie('oxidadminhistory'));
if (is_array($aHistory) && count($aHistory)) {
$this->_aViewData["menuhistory"] = $oNavTree->getListNodes($aHistory);
}
// open history node ?
$this->_aViewData["blOpenHistory"] = oxRegistry::getConfig()->getRequestParameter('openHistory');
}
$sWhere = '';
$blisMallAdmin = oxRegistry::getSession()->getVariable('malladmin');
/** @var oxShopList $oShoplist */
$oShoplist = oxNew('oxShopList');
if (!$blisMallAdmin) {
// we only allow to see our shop
$iShopId = oxRegistry::getSession()->getVariable("actshop");
/** @var oxShop $oShop */
$oShop = oxNew('oxShop');
$oShop->load($iShopId);
$oShoplist->add($oShop);
} else {
$oShoplist->getIdTitleList();
}
$this->_aViewData['shoplist'] = $oShoplist;
return $sItem;
}
示例3: getCaller
/**
* PayPal caller getter.
*
* @return oePayPalCaller
*/
public function getCaller()
{
if (is_null($this->_oCaller)) {
/**
* @var oePayPalCaller $oCaller
*/
$oCaller = oxNew('oePayPalCaller');
$oConfig = $this->getPayPalConfig();
$oCaller->setParameter('VERSION', '84.0');
$oCaller->setParameter('PWD', $oConfig->getPassword());
$oCaller->setParameter('USER', $oConfig->getUserName());
$oCaller->setParameter('SIGNATURE', $oConfig->getSignature());
$oCurl = oxNew('oePayPalCurl');
$oCurl->setDataCharset($oConfig->getCharset());
$oCurl->setHost($oConfig->getHost());
$oCurl->setUrlToCall($oConfig->getApiUrl());
$oCaller->setCurl($oCurl);
if ($oConfig->isLoggingEnabled()) {
$oLogger = oxNew('oePayPalLogger');
$oLogger->setLoggerSessionId(oxRegistry::getSession()->getId());
$oCaller->setLogger($oLogger);
}
$this->setCaller($oCaller);
}
return $this->_oCaller;
}
示例4: request_product
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');
}
示例5: smarty_block_oxhasrights
/**
* Smarty {oxhasrights}{/oxhasrights} block plugin
*
* Type: block function<br>
* Name: oxhasrights<br>
* Purpose: checks if user has rights to view block of data
*
* @param array $params params
* @param string $content contents of the block
* @param Smarty &$smarty clever simulation of a method
* @param bool &$repeat repeat
*
* @return string $content re-formatted
*/
function smarty_block_oxhasrights($params, $content, &$smarty, &$repeat)
{
$sIdent = isset($params['ident']) ? $params['ident'] : null;
$sModulGruppe = oxRegistry::getConfig()->getConfigParam('showcartid');
$ox_User_ID = oxRegistry::getSession()->getVariable("usr");
$ox_User = oxNew("oxUser");
$ox_User->load($ox_User_ID);
$oxGruppen = $ox_User->getUserGroups();
$ppgInSpezGruppe = false;
foreach ($oxGruppen as $oxGruppe) {
if ($oxGruppe->getId() == $sModulGruppe) {
$ppgInSpezGruppe = true;
}
}
if (isset($sIdent) && $sIdent == "TOBASKET") {
$actProduct = $smarty->_tpl_vars['oView']->getProduct();
if ($actProduct->oxarticles__ppghiden->value && $ppgInSpezGruppe == true) {
return $content;
} elseif ($actProduct->oxarticles__ppghiden->value) {
return false;
} else {
return $content;
}
}
/* Eigener oxhasright Ident zum Anzeigen der "Nur im Liefergebiet" Meldung */
if (isset($sIdent) && $sIdent == "PPGKEINVERSAND") {
$actProduct = $smarty->_tpl_vars['oView']->getProduct();
if ($actProduct->oxarticles__ppghiden->value && $ppgInSpezGruppe == true) {
return false;
} elseif ($actProduct->oxarticles__ppghiden->value) {
return $content;
}
}
}
示例6: 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 = 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);
}
}
示例7: _getErrors
/**
* return page errors array
*
* @return array
*/
protected function _getErrors()
{
$aErrors = oxRegistry::getSession()->getVariable('Errors');
if (null === $aErrors) {
$aErrors = array();
}
return $aErrors;
}
示例8: _isPaymentResponseSessionInvalid
/**
* Check payment response in session fot errors.
*
* @return bool True is response is invalid, false otherwise.
*/
protected function _isPaymentResponseSessionInvalid()
{
// Get Paymorrow response from session
$oSession = oxRegistry::getSession();
$aPaymorrowResponse = (array) $oSession->getVariable('pm_response');
// The response must exist and be valid
return !isset($aPaymorrowResponse['order_status'], $aPaymorrowResponse['response_status']) or !in_array($aPaymorrowResponse['order_status'], array('VALIDATED', 'ACCEPTED')) or $aPaymorrowResponse['response_status'] !== 'OK';
}
示例9: testGetWishUser
public function testGetWishUser()
{
$this->setRequestParameter('wishid', '_testId');
$oWishList = oxNew("Wishlist");
$oWishUser = $oWishList->getWishUser();
$this->assertEquals($this->_oUser->getId(), $oWishUser->getId());
$this->assertEquals('_testId', oxRegistry::getSession()->getVariable('wishid'));
}
示例10: updateViews
/**
* Performs full view update
*/
public function updateViews()
{
//preventing edit for anyone except malladmin
if (oxRegistry::getSession()->getVariable("malladmin")) {
$oMetaData = oxNew('oxDbMetaDataHandler');
$this->_aViewData["blViewSuccess"] = $oMetaData->updateViews();
}
}
示例11: testLoginWithNewUser
/**
* @param string $sUserId
*
* @depends testRegisterNewUser
*/
public function testLoginWithNewUser($sUserId)
{
$oCmpUser = $this->_createCmpUserObject();
$oCmpUser->logout();
$this->assertNull(oxRegistry::getSession()->getVariable('usr'), 'User ID should not be in session after logout.');
$this->_login();
$this->assertSame($sUserId, oxRegistry::getSession()->getVariable('usr'), 'User ID is missing in session after log in.');
}
示例12: log
/**
* log the given message
*
* @param string $message
* @param string $debuginfo
*/
public function log($message, $debuginfo)
{
if (oxRegistry::getConfig()->getShopConfVar('PAYMILL_ACTIVATE_LOGGING')) {
$logging = oxNew('paymill_logging');
$logging->assign(array('identifier' => oxRegistry::getSession()->getVariable('paymill_identifier'), 'debug' => $debuginfo, 'message' => $message, 'date' => date('Y-m-d H:i:s', oxRegistry::get('oxUtilsDate')->getTime())));
$logging->save();
}
}
示例13: _getExportFileName
/**
* Return export file name
*
* @return string
*/
protected function _getExportFileName()
{
$sSessionFileName = oxRegistry::getSession()->getVariable("sExportFileName");
if (!$sSessionFileName) {
$sSessionFileName = md5($this->getSession()->getId() . oxUtilsObject::getInstance()->generateUId());
oxRegistry::getSession()->setVariable("sExportFileName", $sSessionFileName);
}
return $sSessionFileName;
}
示例14: remove
/**
* Removes extension metadata from eShop
*
* @return null
*/
public function remove()
{
//if user selected not to update modules, skipping all updates
if (oxRegistry::getConfig()->getRequestParameter("noButton")) {
oxRegistry::getSession()->setVariable("blSkipDeletedExtChecking", true);
return;
}
$oModuleList = oxNew("oxModuleList");
$oModuleList->cleanup();
}
示例15: getSelectedPaymorrowMethod
/**
* Get a code of selected Paymorrow payment method.
* First session is checked for what user have selected, then payment methods configuration is checked.
* It applies only on payment methods linked to Paymorrow.
*
* @return string Paymorrow payment method code or empty string.
*/
public function getSelectedPaymorrowMethod()
{
$sSessionPaymentId = (string) oxRegistry::getSession()->getVariable('paymentid');
/** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */
$oPayment = oxNew('OxpsPaymorrowOxPayment');
if (empty($sSessionPaymentId) or !$oPayment->load($sSessionPaymentId) or !$oPayment->isPaymorrowActiveAndMapped()) {
$oPayment->loadPaymorrowDefault();
}
return (string) $oPayment->getPaymorrowPaymentType();
}