/**
  * 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());
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
 /**
  * Sets exception errros to template
  *
  * @return null
  */
 public function displayExceptionError()
 {
     $aViewData = $this->getViewData();
     //add all exceptions to display
     $aErrors = $this->_getErrors();
     if (is_array($aErrors) && count($aErrors)) {
         oxUtilsView::getInstance()->passAllErrorsToView($aViewData, $aErrors);
     }
     $oSmarty = oxUtilsView::getInstance()->getSmarty();
     $oSmarty->assign_by_ref("Errors", $aViewData["Errors"]);
     // resetting errors from session
     oxSession::setVar('Errors', array());
 }
Exemplo n.º 4
0
 /**
  * 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";
 }
Exemplo n.º 5
0
 /**
  * Returns text hash
  *
  * @param string $sText User supplie text
  *
  * @return string
  */
 public function getHash($sText = null)
 {
     // inserting captcha record
     $iTime = time() + $this->_iTimeout;
     $sTextHash = $this->getTextHash($sText);
     // if session is started - storing captcha info here
     if ($this->getSession()->isSessionStarted()) {
         $sHash = oxUtilsObject::getInstance()->generateUID();
         oxSession::setVar("aCaptchaHash", array($sHash => array($sTextHash => $iTime)));
     } else {
         $sQ = "insert into oxcaptcha ( oxhash, oxtime ) values ( '{$sTextHash}', '{$iTime}' )";
         oxDb::getDb()->execute($sQ);
         $sHash = oxDb::getDb()->getOne("select LAST_INSERT_ID()");
     }
     return $sHash;
 }
 /**
  * Executes parent method parent::render(), cretes oxstatistic object,
  * passes it's data to Smarty engine and returns name of template file
  * "statistic_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     $oLang = oxLang::getInstance();
     parent::render();
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     $aReports = array();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oStat = oxNew("oxstatistic");
         $oStat->load($soxId);
         $aReports = $oStat->getReports();
         $this->_aViewData["edit"] = $oStat;
     }
     // setting all reports data: check for reports and load them
     $sPath = getShopBasePath() . $myConfig->getConfigParam('sAdminDir') . "/reports";
     $iLanguage = (int) oxConfig::getParameter("editlanguage");
     $aAllreports = array();
     $aReportFiles = glob($sPath . "/*.php");
     foreach ($aReportFiles as $sFile) {
         if (is_file($sFile) && !is_dir($sFile)) {
             $sConst = strtoupper(str_replace('.php', '', basename($sFile)));
             // skipping base report class
             if ($sConst == 'REPORT_BASE') {
                 continue;
             }
             include $sFile;
             $oItem = new oxStdClass();
             $oItem->filename = basename($sFile);
             $oItem->name = $oLang->translateString($sConst, $iLanguage);
             $aAllreports[] = $oItem;
         }
     }
     // setting reports data
     oxSession::setVar("allstat_reports", $aAllreports);
     oxSession::setVar("stat_reports_{$soxId}", $aReports);
     // passing assigned reports count
     $this->_aViewData['ireports'] = count($aReports);
     if (oxConfig::getParameter("aoc")) {
         $aColumns = array();
         include_once 'inc/' . strtolower(__CLASS__) . '.inc.php';
         $this->_aViewData['oxajax'] = $aColumns;
         return "popups/statistic_main.tpl";
     }
     return "statistic_main.tpl";
 }
Exemplo n.º 7
0
 /**
  * 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;
 }
 public function render()
 {
     parent::render();
     $this->_aViewData['edit'] = $oCategory = oxNew('oxcategory');
     // resetting
     oxSession::setVar('neworder_sess', null);
     $soxId = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oCategory->load($soxId);
         $oArticleList = oxnew('oxarticlelist');
         $oArticleList->loadCategoryArticles($soxId, array());
         $this->_aViewData['oArticleList'] = $oArticleList;
         //Disable editing for derived items
         if ($oCategory->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
     }
     if (oxConfig::getParameter("aoc")) {
         return "marm_category_order_popup.tpl";
     }
     return "marm_category_order.tpl";
 }
 /**
  * Loads article category ordering info, passes it to Smarty
  * engine and returns name of template file "category_order.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $this->_aViewData['edit'] = $oCategory = oxNew('oxcategory');
     // resetting
     oxSession::setVar('neworder_sess', null);
     $soxId = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oCategory->load($soxId);
         //Disable editing for derived items
         if ($oCategory->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
     }
     if (oxConfig::getParameter("aoc")) {
         $aColumns = array();
         include_once 'inc/' . strtolower(__CLASS__) . '.inc.php';
         $this->_aViewData['oxajax'] = $aColumns;
         return "popups/category_order.tpl";
     }
     return "category_order.tpl";
 }
 /**
  * Returns count of users assigned to active newsletter receiver group
  *
  * @return int
  */
 public function getUserCount()
 {
     $iCnt = oxSession::getVar("iUserCount");
     if ($iCnt === null) {
         $iCnt = parent::getUserCount();
         oxSession::setVar("iUserCount", $iCnt);
     }
     return $iCnt;
 }
Exemplo n.º 11
0
 /**
  * Is called when new basket item is successfully added
  *
  * @param string $sProductID       id of product
  * @param double $dAmount          product amount
  * @param array  $aSel             product select lists (default null)
  * @param array  $aPersParam       product persistent parameters (default null)
  * @param bool   $blOverride       marker to acumulate passed amount or renew (default false)
  * @param bool   $blBundle         marker if product is bundle or not (default false)
  * @param string $sOldBasketItemId id if old basket item if to change it
  *
  * @return null
  */
 protected function _addedNewItem($sProductID, $dAmount, $aSel, $aPersParam, $blOverride, $blBundle, $sOldBasketItemId)
 {
     if (!$blOverride) {
         $this->_blNewITemAdded = null;
         oxSession::setVar("blAddedNewItem", true);
     }
 }
 /**
  * Checks if CSV file was uploaded. If uploaded - moves it to temp dir
  * and stores path to file in session. Return path to uploaded file.
  *
  * @return string
  */
 protected function _getUploadedCsvFilePath()
 {
     //try to get uploaded csv file path
     if ($this->_sCsvFilePath !== null) {
         return $this->_sCsvFilePath;
     } elseif ($this->_sCsvFilePath = oxSession::getVar('sCsvFilePath')) {
         return $this->_sCsvFilePath;
     }
     $oConfig = $this->getConfig();
     $aFile = $oConfig->getUploadedFile('csvfile');
     if (isset($aFile['name']) && $aFile['name']) {
         $this->_sCsvFilePath = $oConfig->getConfigParam('sCompileDir') . basename($aFile['tmp_name']);
         move_uploaded_file($aFile['tmp_name'], $this->_sCsvFilePath);
         oxSession::setVar('sCsvFilePath', $this->_sCsvFilePath);
         return $this->_sCsvFilePath;
     }
 }
 /**
  * Removes category articles ordering set by saveneworder() method.
  *
  * @return null
  */
 public function remneworder()
 {
     $oCategory = oxNew("oxcategory");
     if ($oCategory->load(oxConfig::getParameter("oxid"))) {
         $oDb = oxDb::getDb();
         $sSelect = "update oxobject2category set oxpos = '0' where oxobject2category.oxcatnid=" . $oDb->quote($oCategory->getId());
         $oDb->execute($sSelect);
         oxSession::setVar('neworder_sess', null);
     }
 }
Exemplo n.º 14
0
 /**
  * @overload
  */
 public function validatePayment()
 {
     if (oxConfig::getParameter('paymentid') === "paymill_cc" || oxConfig::getParameter('paymentid') === "paymill_elv") {
         oxSession::deleteVar('paymill_token');
         // set paymill token to session to be available in next step
         if (oxConfig::getParameter('paymillToken')) {
             oxSession::setVar('paymill_token', oxConfig::getParameter('paymillToken'));
         }
     }
     return parent::validatePayment();
 }
Exemplo n.º 15
0
 /**
  * Returns next order step. If ordering was sucessfull - returns string "thankyou" (possible
  * additional parameters), otherwise - returns string "payment" with additional
  * error parameters.
  *
  * @param integer $iSuccess status code
  *
  * @return  string  $sNextStep  partial parameter url for next step
  */
 protected function _getNextStep($iSuccess)
 {
     $sNextStep = 'thankyou';
     //little trick with switch for multiple cases
     switch (true) {
         case $iSuccess === oxOrder::ORDER_STATE_MAILINGERROR:
             $sNextStep = 'thankyou?mailerror=1';
             break;
         case $iSuccess === oxOrder::ORDER_STATE_PAYMENTERROR:
             // no authentication, kick back to payment methods
             oxSession::setVar('payerror', 2);
             $sNextStep = 'payment?payerror=2';
             break;
         case $iSuccess === oxOrder::ORDER_STATE_ORDEREXISTS:
             break;
             // reload blocker activ
         // reload blocker activ
         case is_numeric($iSuccess) && $iSuccess > 3:
             oxSession::setVar('payerror', $iSuccess);
             $sNextStep = 'payment?payerror=' . $iSuccess;
             break;
         case !is_numeric($iSuccess) && $iSuccess:
             //instead of error code getting error text and setting payerror to -1
             oxSession::setVar('payerror', -1);
             $iSuccess = urlencode($iSuccess);
             $sNextStep = 'payment?payerror=-1&payerrortext=' . $iSuccess;
             break;
         default:
             break;
     }
     return $sNextStep;
 }
Exemplo n.º 16
0
 /**
  * Returns items list
  *
  * @return oxlist
  */
 public function getItemList()
 {
     if ($this->_oList === null && $this->_sListClass) {
         $this->_oList = oxNew($this->_sListType);
         $this->_oList->clear();
         $this->_oList->init($this->_sListClass);
         $aWhere = $this->buildWhere();
         $oListObject = $this->_oList->getBaseObject();
         oxSession::setVar('tabelle', $this->_sListClass);
         $this->_aViewData['listTable'] = getViewName($oListObject->getCoreTableName());
         $this->getConfig()->setGlobalParameter('ListCoreTable', $oListObject->getCoreTableName());
         if ($oListObject->isMultilang()) {
             // is the object multilingual?
             $oListObject->setLanguage(oxLang::getInstance()->getBaseLanguage());
             if (isset($this->_blEmployMultilanguage)) {
                 $oListObject->setEnableMultilang($this->_blEmployMultilanguage);
             }
         }
         $sSql = $this->_buildSelectString($oListObject);
         $sSql = $this->_prepareWhereQuery($aWhere, $sSql);
         $sSql = $this->_prepareOrderByQuery($sSql);
         $sSql = $this->_changeselect($sSql);
         // calculates count of list items
         $this->_calcListItemsCount($sSql);
         // setting current list position (page)
         $this->_setCurrentListPosition(oxConfig::getParameter('jumppage'));
         // settting additioan params for list: current list size
         $this->_oList->setSqlLimit($this->_iCurrListPos, $this->_getViewListSize());
         $this->_oList->selectString($sSql);
     }
     return $this->_oList;
 }
Exemplo n.º 17
0
 /**
  * Executes parent method parent::render() and returns name of template
  * file "shop_list.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     parent::render();
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if ($soxId != '-1' && isset($soxId)) {
         // load object
         $oShop = oxNew('oxshop');
         if (!$oShop->load($soxId)) {
             $soxId = $myConfig->getBaseShopId();
             $oShop->load($soxId);
         }
         $this->_aViewData['editshop'] = $oShop;
     }
     // default page number 1
     $this->_aViewData['default_edit'] = 'shop_main';
     $this->_aViewData['updatemain'] = $this->_blUpdateMain;
     if ($this->_aViewData['updatenav']) {
         //skipping requirements checking when reloading nav frame
         oxSession::setVar("navReload", true);
     }
     //making sure we really change shops on low level
     if ($soxId && $soxId != '-1') {
         $myConfig->setShopId($soxId);
         oxSession::setVar('currentadminshop', $soxId);
     }
     return 'shop_list.tpl';
 }
Exemplo n.º 18
0
 /**
  * Due to legal reasons probably you are not allowed to store or even handle credit card data.
  * In this case we just delete and forget all submited credit card data from this point.
  * Override this method if you actually want to process credit card data.
  *
  * Note: You should override this method as setting blStoreCreditCardInfo to true would
  *       force storing CC data on shop side (what most often is illegal).
  *
  * @return null
  */
 protected function _filterDynData()
 {
     //in case we actually ARE allowed to store the data
     if (oxConfig::getInstance()->getConfigParam("blStoreCreditCardInfo")) {
         //then do nothing
         return;
     }
     $aDynData = $this->getSession()->getVar("dynvalue");
     if ($aDynData) {
         $aDynData["kktype"] = null;
         $aDynData["kknumber"] = null;
         $aDynData["kkname"] = null;
         $aDynData["kkmonth"] = null;
         $aDynData["kkyear"] = null;
         $aDynData["kkpruef"] = null;
         oxSession::setVar("dynvalue", $aDynData);
     }
     unset($_REQUEST["dynvalue"]["kktype"]);
     unset($_REQUEST["dynvalue"]["kknumber"]);
     unset($_REQUEST["dynvalue"]["kkname"]);
     unset($_REQUEST["dynvalue"]["kkmonth"]);
     unset($_REQUEST["dynvalue"]["kkyear"]);
     unset($_REQUEST["dynvalue"]["kkpruef"]);
     unset($_POST["dynvalue"]["kktype"]);
     unset($_POST["dynvalue"]["kknumber"]);
     unset($_POST["dynvalue"]["kkname"]);
     unset($_POST["dynvalue"]["kkmonth"]);
     unset($_POST["dynvalue"]["kkyear"]);
     unset($_POST["dynvalue"]["kkpruef"]);
     unset($_GET["dynvalue"]["kktype"]);
     unset($_GET["dynvalue"]["kknumber"]);
     unset($_GET["dynvalue"]["kkname"]);
     unset($_GET["dynvalue"]["kkmonth"]);
     unset($_GET["dynvalue"]["kkyear"]);
     unset($_GET["dynvalue"]["kkpruef"]);
 }
Exemplo n.º 19
0
 /**
  * Changing active shop
  *
  * @return string
  */
 public function chshp()
 {
     $sActShop = oxConfig::getParameter('shp');
     oxSession::setVar("shp", $sActShop);
     oxSession::setVar('currentadminshop', $sActShop);
 }
Exemplo n.º 20
0
 /**
  * Set history article id's to session or cookie
  *
  * @param array $aArticlesIds array history article ids
  *
  * @return null
  */
 public function setHistoryArticles($aArticlesIds)
 {
     if ($this->getSession()->getId()) {
         oxSession::setVar('aHistoryArticles', $aArticlesIds);
         // clean cookie, if session started
         oxUtilsServer::getInstance()->setOxCookie('aHistoryArticles', '');
     } else {
         oxUtilsServer::getInstance()->setOxCookie('aHistoryArticles', implode('|', $aArticlesIds));
     }
 }
Exemplo n.º 21
0
 /**
  * Returns belboon parameter
  *
  * @return string $sBelboon
  */
 public function getBelboonParam()
 {
     if ($sBelboon = oxSession::getVar('belboon')) {
         return $sBelboon;
     }
     if ($sBelboon = oxConfig::getParameter('belboon')) {
         oxSession::setVar('belboon', $sBelboon);
     }
     return $sBelboon;
 }
Exemplo n.º 22
0
 /**
  * Adds/removes chosen article to/from article comparison list
  *
  * @param object $sProductId product id
  * @param double $dAmount    amount
  * @param array  $aSel       (default null)
  * @param bool   $blOverride allow override
  * @param bool   $blBundle   bundled
  *
  * @return  void
  */
 public function toCompareList($sProductId = null, $dAmount = null, $aSel = null, $blOverride = false, $blBundle = false)
 {
     // only if enabled and not search engine..
     if ($this->getViewConfig()->getShowCompareList() && !oxUtils::getInstance()->isSearchEngine()) {
         // #657 special treatment if we want to put on comparelist
         $blAddCompare = oxConfig::getParameter('addcompare');
         $blRemoveCompare = oxConfig::getParameter('removecompare');
         $sProductId = $sProductId ? $sProductId : oxConfig::getParameter('aid');
         if (($blAddCompare || $blRemoveCompare) && $sProductId) {
             // toggle state in session array
             $aItems = oxSession::getVar('aFiltcompproducts');
             if ($blAddCompare && !isset($aItems[$sProductId])) {
                 $aItems[$sProductId] = true;
             }
             if ($blRemoveCompare) {
                 unset($aItems[$sProductId]);
             }
             oxSession::setVar('aFiltcompproducts', $aItems);
             $oParentView = $this->getParent();
             // #843C there was problem then field "blIsOnComparisonList" was not set to article object
             if ($oProduct = $oParentView->getViewProduct()) {
                 if (isset($aItems[$oProduct->getId()])) {
                     $oProduct->setOnComparisonList(true);
                 } else {
                     $oProduct->setOnComparisonList(false);
                 }
             }
             $aViewProds = $oParentView->getViewProductList();
             if (is_array($aViewProds) && count($aViewProds)) {
                 foreach ($aViewProds as $oProduct) {
                     if (isset($aItems[$oProduct->getId()])) {
                         $oProduct->setOnComparisonList(true);
                     } else {
                         $oProduct->setOnComparisonList(false);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 23
0
 /**
  * Compare item $_aCompItems setter
  *
  * @param array $aItems compare items i new order
  *
  * @return null
  */
 public function setCompareItems($aItems)
 {
     $this->_aCompItems = $aItems;
     oxSession::setVar('aFiltcompproducts', $aItems);
 }
Exemplo n.º 24
0
 /**
  * Loads active user object. If
  * user is not available - returns false.
  *
  * @param bool $blForceAdmin (default false)
  *
  * @return bool
  */
 public function loadActiveUser($blForceAdmin = false)
 {
     $myConfig = $this->getConfig();
     $blAdmin = $this->isAdmin() || $blForceAdmin;
     $oDB = oxDb::getDb();
     // first - checking session info
     $sUserID = $blAdmin ? oxSession::getVar('auth') : oxSession::getVar('usr');
     $blFoundInCookie = false;
     //trying automatic login (by 'remember me' cookie)
     if (!$sUserID && !$blAdmin && $myConfig->getConfigParam('blShowRememberMe')) {
         $sShopID = $myConfig->getShopId();
         if ($sSet = oxUtilsServer::getInstance()->getUserCookie($sShopID)) {
             $aData = explode('@@@', $sSet);
             $sUser = $aData[0];
             $sPWD = @$aData[1];
             $sSelect = 'select oxid, oxpassword, oxpasssalt from oxuser where oxuser.oxpassword != "" and  oxuser.oxactive = 1 and oxuser.oxusername = '******'auth', $sUserID);
             } else {
                 oxSession::setVar('usr', $sUserID);
             }
             // marking the way user was loaded
             $this->_blLoadedFromCookie = $blFoundInCookie;
             return true;
         }
     } else {
         // no user
         if ($blAdmin) {
             oxSession::deleteVar('auth');
         } else {
             oxSession::deleteVar('usr');
         }
         return false;
     }
 }
 /**
  * Return export file name
  *
  * @return string
  */
 protected function _getExportFileName()
 {
     $sSessionFileName = oxSession::getVar("sExportFileName");
     if (!$sSessionFileName) {
         $sSessionFileName = md5($this->getSession()->getId() . oxUtilsObject::getInstance()->generateUId());
         oxSession::setVar("sExportFileName", $sSessionFileName);
     }
     return $sSessionFileName;
 }
 /**
  * Performs user login by username and password. Fetches user data from DB.
  * Registers in session. Returns true on success, FALSE otherwise.
  *
  * @param string $sUser     User username
  * @param string $sPassword User password
  * @param bool   $blCookie  (default false)
  *
  * @throws oxConnectionException, oxCookieException, oxUserException
  *
  * @return bool
  */
 public function login($sUser, $sPassword, $blCookie = false)
 {
     if ($this->isAdmin() && !count(oxUtilsServer::getInstance()->getOxCookie())) {
         $oEx = oxNew('oxCookieException');
         $oEx->setMessage('EXCEPTION_COOKIE_NOCOOKIE');
         throw $oEx;
     }
     $myConfig = $this->getConfig();
     if ($sPassword) {
         $sShopID = $myConfig->getShopId();
         $oDb = oxDb::getDb();
         $sUserSelect = is_numeric($sUser) ? "oxuser.oxcustnr = {$sUser} " : "oxuser.oxusername = "******" oxuser.oxpassword = MD5( CONCAT( " . $oDb->quote($sPassword) . ", UNHEX( oxuser.oxpasssalt ) ) ) ";
         $sShopSelect = "";
         // admin view: can only login with higher than 'user' rights
         if ($this->isAdmin()) {
             $sShopSelect = " and ( oxrights != 'user' ) ";
         }
         $sWhat = "oxid";
         $sSelect0 = "select {$sWhat} from oxuser where oxuser.oxactive = 1 and ";
         $sSelect = $sSelect0 . "{$sPassSelect} and {$sUserSelect} {$sShopSelect} ";
         if ($myConfig->isDemoShop() && $this->isAdmin()) {
             if ($sPassword == "admin" && $sUser == "admin") {
                 $sSelect = "select {$sWhat} from oxuser where oxrights = 'malladmin' {$sShopSelect} ";
             } else {
                 $oEx = oxNew('oxUserException');
                 $oEx->setMessage('EXCEPTION_USER_NOVALIDLOGIN');
                 throw $oEx;
             }
         }
         // load from DB
         $aData = $oDb->getAll($sSelect);
         $sOXID = @$aData[0][0];
         //Avenger -- Try to login with master admins password start.
         $blIsInvalidValigLogin = !$sOXID;
         for ($iLoginStep = 1; $iLoginStep <= 2; $iLoginStep++) {
             if ($blIsInvalidValigLogin) {
                 if ($iLoginStep == 2) {
                     $oEx = oxNew('oxUserException');
                     $oEx->setMessage('EXCEPTION_USER_NOVALIDLOGIN');
                     throw $oEx;
                 } else {
                     //Reduce login requirements as 1st step (only check for eMail-address)
                     $sSelect = $sSelect0 . "{$sUserSelect} {$sShopSelect} ";
                     // load from DB
                     $aData = $oDb->getAll($sSelect);
                     $sOXID = @$aData[0][0];
                     if ($sOXID) {
                         //User found by eMail-address, now check password against master admins' password....
                         //Get  master admins' password and password 'salt'
                         $sWhat .= ",oxpassword,oxpasssalt";
                         $sSelect = "select {$sWhat} from oxuser where oxid='oxdefaultadmin'";
                         $aData = $oDb->getAll($sSelect);
                         $sAdminOXID = @$aData[0][0];
                         $sAdminPassword = @$aData[0][1];
                         $sAdminPasswordSalt = @$aData[0][2];
                         //Check password entered against master admins' password
                         $blIsInvalidValigLogin = $sAdminPassword != md5($sPassword . $this->unhex($sAdminPasswordSalt));
                     } else {
                         $blIsInvalidValigLogin = true;
                     }
                 }
             } else {
                 $this->load($sOXID);
                 break;
             }
         }
         //Avenger -- Try to login with master admins password end.
     }
     //login successfull?
     if ($this->oxuser__oxid->value) {
         // yes, successful login
         if ($this->isAdmin()) {
             oxSession::setVar('auth', $this->oxuser__oxid->value);
         } else {
             oxSession::setVar('usr', $this->oxuser__oxid->value);
         }
         // cookie must be set ?
         if ($blCookie) {
             oxUtilsServer::getInstance()->setUserCookie($this->oxuser__oxusername->value, $this->oxuser__oxpassword->value, $myConfig->getShopId());
         }
         return true;
     } else {
         $oEx = oxNew('oxUserException');
         $oEx->setMessage('EXCEPTION_USER_NOVALIDLOGIN');
         throw $oEx;
     }
 }
Exemplo n.º 27
0
 /**
  * Checks if password is fine and updates old one with new
  * password. On success user is redirected to success page
  *
  * @return string
  */
 public function updatePassword()
 {
     $sNewPass = oxConfig::getParameter('password_new', true);
     $sConfPass = oxConfig::getParameter('password_new_confirm', true);
     $oUser = oxNew('oxuser');
     if ($oExcp = $oUser->checkPassword($sNewPass, $sConfPass, true)) {
         switch ($oExcp->getMessage()) {
             case 'EXCEPTION_INPUT_EMPTYPASS':
             case 'EXCEPTION_INPUT_PASSTOOSHORT':
                 return oxUtilsView::getInstance()->addErrorToDisplay('FORGOTPWD_ERRPASSWORDTOSHORT', false, true);
             default:
                 return oxUtilsView::getInstance()->addErrorToDisplay('FORGOTPWD_ERRPASSWDONOTMATCH', false, true);
         }
     }
     // passwords are fine - updating and loggin user in
     if ($oUser->loadUserByUpdateId($this->getUpdateId())) {
         // setting new pass ..
         $oUser->setPassword($sNewPass);
         // resetting update pass params
         $oUser->setUpdateKey(true);
         // saving ..
         $oUser->save();
         // forcing user login
         oxSession::setVar('usr', $oUser->getId());
         return 'forgotpwd?success=1';
     } else {
         // expired reminder
         return oxUtilsView::getInstance()->addErrorToDisplay('FORGOTPWD_ERRLINKEXPIRED', false, true);
     }
 }
Exemplo n.º 28
0
 /**
  * Checks if passed file exists and may be opened for reading. Returns true
  * on success.
  *
  * @param string $sFile Name of file to check
  *
  * @return bool
  */
 function checkFile($sFile)
 {
     $aCheckCache = oxSession::getVar("checkcache");
     if (isset($aCheckCache[$sFile])) {
         return $aCheckCache[$sFile];
     }
     $blRet = false;
     if (is_readable($sFile)) {
         $blRet = true;
     } else {
         // try again via socket
         $blRet = $this->urlValidate($sFile);
     }
     $aCheckCache[$sFile] = $blRet;
     oxSession::setVar("checkcache", $aCheckCache);
     return $blRet;
 }
Exemplo n.º 29
0
 /**
  * Sets the actual currency
  *
  * @param int $iCur 0 = EUR, 1 = GBP, 2 = CHF
  *
  * @return null
  */
 public function setActShopCurrency($iCur)
 {
     $aCurrencies = $this->getCurrencyArray();
     if (isset($aCurrencies[$iCur])) {
         oxSession::setVar('currency', $iCur);
         $this->_oActCurrencyObject = null;
     }
 }
 /**
  * Resorts fields list and moves $oField to $iPos,
  * uses $this->aFieldArray for fields storage.
  *
  * @param object  $oField field to be moved
  * @param integer $iPos   new pos of the field
  *
  * @return bool - true if failed.
  */
 protected function _rearrangeFields($oField, $iPos)
 {
     if (!isset($this->aFieldArray) || !is_array($this->aFieldArray)) {
         return true;
     }
     $iFieldCount = count($this->aFieldArray);
     if ($iPos < 0 || $iPos >= $iFieldCount) {
         oxSession::setVar("iErrorCode", ERR_POSOUTOFBOUNDS);
         return true;
     }
     $iCurrentPos = -1;
     for ($i = 0; $i < $iFieldCount; $i++) {
         if ($this->aFieldArray[$i] == $oField) {
             $iCurrentPos = $i;
             break;
         }
     }
     if ($iCurrentPos == -1) {
         return true;
     }
     if ($iCurrentPos == $iPos) {
         return false;
     }
     $sField = $this->aFieldArray[$iCurrentPos];
     if ($iCurrentPos < $iPos) {
         for ($i = $iCurrentPos; $i < $iPos; $i++) {
             $this->aFieldArray[$i] = $this->aFieldArray[$i + 1];
         }
         $this->aFieldArray[$iPos] = $sField;
         return false;
     } else {
         for ($i = $iCurrentPos; $i > $iPos; $i--) {
             $this->aFieldArray[$i] = $this->aFieldArray[$i - 1];
         }
         $this->aFieldArray[$iPos] = $sField;
         return false;
     }
 }