コード例 #1
0
ファイル: pricealarm.php プロジェクト: ioanok/symfoxid
 /**
  * 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
0
ファイル: navigation.php プロジェクト: ioanok/symfoxid
 /**
  * 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
0
ファイル: oepaypalservice.php プロジェクト: ioanok/symfoxid
 /**
  * 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
0
 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
0
/**
 * 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
0
/**
 * 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
0
ファイル: exceptionerror.php プロジェクト: ioanok/symfoxid
 /**
  * return page errors array
  *
  * @return array
  */
 protected function _getErrors()
 {
     $aErrors = oxRegistry::getSession()->getVariable('Errors');
     if (null === $aErrors) {
         $aErrors = array();
     }
     return $aErrors;
 }
コード例 #8
0
 /**
  * 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
0
 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
0
ファイル: tools_list.php プロジェクト: Crease29/oxideshop_ce
 /**
  * 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
0
 /**
  * @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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
ファイル: oxpspaymorrowinit.php プロジェクト: ioanok/symfoxid
 /**
  * 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();
 }
コード例 #16
0
 public function testSetGetSession()
 {
     $oOxSuperCfg = oxNew('oxSuperCfg');
     $oOxSuperCfg->setSession(null);
     $oSession = oxRegistry::getSession();
     $this->assertEquals($oSession, $oOxSuperCfg->getSession());
     $oSession = $this->getMock('oxConfig', array('getId'));
     $oSession->expects($this->once())->method('getId')->will($this->returnValue('xxx'));
     $oOxSuperCfg->setSession($oSession);
     $this->assertEquals('xxx', $oOxSuperCfg->getSession()->getId());
 }
コード例 #17
0
 /**
  * Loads order associated with current PayPal order
  *
  * @return bool
  */
 public function loadPayPalOrder()
 {
     $sOrderId = oxRegistry::getSession()->getVariable("sess_challenge");
     // if order is not created yet - generating it
     if ($sOrderId === null) {
         $sOrderId = oxUtilsObject::getInstance()->generateUID();
         $this->setId($sOrderId);
         $this->save();
         oxRegistry::getSession()->setVariable("sess_challenge", $sOrderId);
     }
     return $this->load($sOrderId);
 }
コード例 #18
0
 /**
  * Checks if the license key update is allowed.
  *
  * @return bool
  */
 protected function _canUpdate()
 {
     $myConfig = $this->getConfig();
     $blIsMallAdmin = oxRegistry::getSession()->getVariable('malladmin');
     if (!$blIsMallAdmin) {
         return false;
     }
     if ($myConfig->isDemoShop()) {
         return false;
     }
     return true;
 }
コード例 #19
0
ファイル: contactTest.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Test if send mail is not executed if user data is not entered
  * and warning message is displayed
  *
  * @return null
  */
 public function testSave_withoutUserData()
 {
     oxRegistry::getSession()->deleteVariable('Errors');
     $aParams['oxuser__oxusername'] = '******';
     $this->setRequestParameter('editval', $aParams);
     $oContact = oxNew('Contact');
     $this->assertFalse($oContact->send());
     //checking if warning was added to errors list
     $sErr = oxRegistry::getLang()->translateString('ERROR_MESSAGE_INPUT_NOTALLFIELDS');
     $aEx = oxRegistry::getSession()->getVariable('Errors');
     $oErr = unserialize($aEx['default'][0]);
     $this->assertEquals($sErr, $oErr->getOxMessage());
 }
コード例 #20
0
 /**
  * Get Paymorrow dynamic JavaScript.
  */
 public function getPaymorrowSessionMonitorJavaScript()
 {
     /**
      * From Paymorrow documentation:
      *
      * 6.5 Paymorrow session monitoring
      * Paymorrow needs to monitor customer’s behavior in the eshop during the full shopping session for qualified decision whether accept or decline customer’s order.
      * Paymorrow requires for this session monitoring to place on every single page session monitroring JS.
      * <script type="text/javascript" src="pmResource.php?path=/pmsession.js&amp;session_id=xxxxx"></script>
      * session_id is customer’s http sessionId which is sent to prepareOrder as attribute client_browser_session_id.
      * This pmsession.js must NOT be cached.
      */
     $this->_getResource('/pmsession.js?session_id=' . oxRegistry::getSession()->getId(), true);
 }
コード例 #21
0
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
            $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;
}
コード例 #22
0
ファイル: OxRestBase.php プロジェクト: rahsm/oxidjson
 /**
  * @throws Tonic\UnauthorizedException
  */
 public function setup()
 {
     $oSession = oxRegistry::getSession();
     $oUtilsServer = oxRegistry::get('oxUtilsServer');
     $oUser = oxNew('oxuser');
     // user already signed in?
     if ($oUser->loadActiveUser() && $this->hasValidLogin($oUser)) {
         // set user
         $this->_oUser = $oUser;
         return;
     }
     // get auth header and check login data submitted
     $authHeader = $oUtilsServer->getServerVar('HTTP_AUTHORIZATION');
     if (!isset($authHeader) || '' === $authHeader) {
         $authHeader = $oUtilsServer->getServerVar('REDIRECT_HTTP_AUTHORIZATION');
     }
     if ($authHeader) {
         $this->_doLog("Auth header: " . $authHeader);
     }
     // Auth comes as "Ox <base64_encoded username:password>"...
     // So strip the "Ox " prefix, base64_decode the remaining string
     // and split username and password at the ":" char
     $userNamePassword = explode(":", base64_decode(substr($authHeader, 3)));
     if (!is_array($userNamePassword) || count($userNamePassword) < 2) {
         throw new Tonic\UnauthorizedException();
     }
     $sUser = $userNamePassword[0];
     $sPassword = $userNamePassword[1];
     try {
         if (!$oSession->isSessionStarted()) {
             $oSession->start();
         }
         if ($oUser->login($sUser, $sPassword)) {
             // set user
             $this->_oUser = $oUser;
             // check groups
             if (!$this->hasValidLogin()) {
                 $this->_doLog("Login NOT successful for user {$sUser}");
                 throw new Tonic\UnauthorizedException();
             } else {
                 $this->_doLog("Login successful for user {$sUser} - " . $oSession->getVariable('usr'));
                 $oSession->regenerateSessionId();
             }
         }
     } catch (Exception $ex) {
         $this->_doLog("Login NOT successful for user {$sUser}, Error: " . $ex->getMessage());
         throw new Tonic\UnauthorizedException();
     }
 }
コード例 #23
0
 /**
  * Removes or adds user to newsletter group according to
  * current subscription status. Returns true on success.
  *
  * @return bool
  */
 public function subscribe()
 {
     if (!oxRegistry::getSession()->checkSessionChallenge()) {
         return false;
     }
     // is logged in ?
     $oUser = $this->getUser();
     if (!$oUser) {
         return false;
     }
     $iStatus = $this->getConfig()->getRequestParameter('status');
     if ($oUser->setNewsSubscription($iStatus, $this->getConfig()->getConfigParam('blOrderOptInEmail'))) {
         $this->_iSubscriptionStatus = $iStatus == 0 && $iStatus !== null ? -1 : 1;
     }
 }
コード例 #24
0
ファイル: shop.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * Executes parent method parent::render() and returns name of template
  * file "shop.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $sCurrentAdminShop = oxRegistry::getSession()->getVariable("currentadminshop");
     if (!$sCurrentAdminShop) {
         if (oxRegistry::getSession()->getVariable("malladmin")) {
             $sCurrentAdminShop = "oxbaseshop";
         } else {
             $sCurrentAdminShop = oxRegistry::getSession()->getVariable("actshop");
         }
     }
     $this->_aViewData["currentadminshop"] = $sCurrentAdminShop;
     oxRegistry::getSession()->setVariable("currentadminshop", $sCurrentAdminShop);
     return "shop.tpl";
 }
コード例 #25
0
 /**
  * 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 = oxRegistry::getConfig();
         $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
         $oSmarty->assign("sCustomHeader", oxRegistry::getSession()->getVariable("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;
 }
コード例 #26
0
ファイル: vtdev_mails.php プロジェクト: kermie/vt-devutils
 public function preview()
 {
     $cfg = oxRegistry::getConfig();
     if (!($fnc = $cfg->getRequestParameter("mail"))) {
         die("missing mail parameter");
     }
     $oUser = oxRegistry::getSession()->getUser();
     $this->setAdminMode(false);
     $oEmail = oxNew('oxemail');
     $oEmail->setDebug();
     if (in_array($fnc, ["sendRegisterEmail", "sendRegisterConfirmEmail", "sendNewsletterDbOptInMail"])) {
         // diese Funktionen benötigen oxUser als param
         $oEmail->{$fnc}($oUser);
     } elseif (in_array($fnc, ["sendOrderEmailToUser", "sendOrderEmailToOwner"])) {
         // diese Funktionen benötigen oxOrder als param
         $oOrder = $this->fakeOrder();
         $oEmail->{$fnc}($oOrder);
     } elseif ($fnc == "sendSendedNowMail") {
         $oOrder = array_shift($oUser->getOrders(1)->getArray());
         $this->setAdminMode(true);
         $oEmail->{$fnc}($oOrder);
     } elseif ($fnc == "sendForgotPwdEmail") {
         // diese Funktionen benötigen eine E-Mail Adresse als param
         $oEmail->{$fnc}($oUser->oxuser__oxusername->value);
     } elseif ($fnc == "sendContactMail") {
         // diese Funktionen benötigen E-Mail Adresse, Subject und Text als params
         $sMail = $oUser->oxuser__oxusername->value;
         $sSubject = "mail subject";
         $sBody = "dear {$sMail}, we miss you very hard here, at OXID eShop.\n Please, don't forget us!";
         $oEmail->{$fnc}($sMail, $sSubject, $sBody);
     } elseif ($fnc == "sendSuggestMail") {
         exit;
     } else {
         exit;
     }
     $this->setAdminMode(true);
     if (oxRegistry::getConfig()->getRequestParameter("html")) {
         echo $oEmail->getBody();
     } elseif (oxRegistry::getConfig()->getRequestParameter("text")) {
         echo $oEmail->getAltBody();
     } else {
         echo json_encode($oEmail);
     }
     exit;
 }
コード例 #27
0
 /**
  * Generates and saves vouchers. Returns number of saved records
  *
  * @param int $iCnt voucher counter offset
  *
  * @return int saved record count
  */
 public function generateVoucher($iCnt)
 {
     $iAmount = abs((int) oxRegistry::getSession()->getVariable("voucherAmount"));
     // creating new vouchers
     if ($iCnt < $iAmount && ($oVoucherSerie = $this->_getVoucherSerie())) {
         if (!$this->_iGenerated) {
             $this->_iGenerated = $iCnt;
         }
         $blRandomNr = (bool) oxRegistry::getSession()->getVariable("randomVoucherNr");
         $sVoucherNr = $blRandomNr ? oxUtilsObject::getInstance()->generateUID() : oxRegistry::getSession()->getVariable("voucherNr");
         $oNewVoucher = oxNew("oxvoucher");
         $oNewVoucher->oxvouchers__oxvoucherserieid = new oxField($oVoucherSerie->getId());
         $oNewVoucher->oxvouchers__oxvouchernr = new oxField($sVoucherNr);
         $oNewVoucher->save();
         $this->_iGenerated++;
     }
     return $this->_iGenerated;
 }
コード例 #28
0
 /**
  * Executes parent method parent::render(), creates oxnewsletter object
  * and passes it's data to Smarty engine, returns name of template file
  * "newsletter_preview.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $soxId = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oNewsletter = oxNew("oxnewsletter");
         $oNewsletter->load($soxId);
         $this->_aViewData["edit"] = $oNewsletter;
         // user
         $sUserID = oxRegistry::getSession()->getVariable("auth");
         // assign values to the newsletter and show it
         $oNewsletter->prepare($sUserID, $this->getConfig()->getConfigParam('bl_perfLoadAktion'));
         $this->_aViewData["previewhtml"] = $oNewsletter->getHtmlText();
         $this->_aViewData["previewtext"] = $oNewsletter->getPlainText();
     }
     return "newsletter_preview.tpl";
 }
コード例 #29
0
ファイル: statistic_main.php プロジェクト: ioanok/symfoxid
 /**
  * Saves statistic parameters changes.
  */
 public function save()
 {
     $soxId = $this->getEditObjectId();
     $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
     // shopid
     $sShopID = oxRegistry::getSession()->getVariable("actshop");
     $oStat = oxNew("oxstatistic");
     if ($soxId != "-1") {
         $oStat->load($soxId);
     } else {
         $aParams['oxstatistics__oxid'] = null;
     }
     $aParams['oxstatistics__oxshopid'] = $sShopID;
     $oStat->assign($aParams);
     $oStat->save();
     // set oxid if inserted
     $this->setEditObjectId($oStat->getId());
 }
コード例 #30
0
ファイル: wishlist.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * return the user which is owner of the wish list
  *
  * @return object | bool
  */
 public function getWishUser()
 {
     if ($this->_oWishUser === null) {
         $this->_oWishUser = false;
         $sWishIdParameter = oxRegistry::getConfig()->getRequestParameter('wishid');
         $sUserId = $sWishIdParameter ? $sWishIdParameter : oxRegistry::getSession()->getVariable('wishid');
         if ($sUserId) {
             $oUser = oxNew('oxuser');
             if ($oUser->load($sUserId)) {
                 // passing wishlist information
                 $this->_oWishUser = $oUser;
                 // store this one to session
                 oxRegistry::getSession()->setVariable('wishid', $sUserId);
             }
         }
     }
     return $this->_oWishUser;
 }