161 if (is_null($this->_oStateObject)) {
162 $this->_oStateObject =
oxNew(
'oxState');
178 $this->
init(
'oxuser');
188 $this->_blMallUsers = $blOn;
201 switch ($sParamName) {
205 case 'iCntNoticeListArticles':
208 case 'iCntWishListArticles':
212 case 'iCntRecommLists':
222 case 'oxuser__oxcountry':
241 if ($this->_oNewsSubscription !== null) {
245 $this->_oNewsSubscription =
oxNew(
'oxnewssubscribed');
248 if (!$this->_oNewsSubscription->loadFromUserId($this->getId())) {
249 if (!$this->_oNewsSubscription->loadFromEmail($this->oxuser__oxusername->value)) {
253 $this->_oNewsSubscription->oxnewssubscribed__oxemail =
new oxField($this->oxuser__oxusername->value,
oxField::T_RAW);
254 $this->_oNewsSubscription->oxnewssubscribed__oxsal =
new oxField($this->oxuser__oxsal->value,
oxField::T_RAW);
255 $this->_oNewsSubscription->oxnewssubscribed__oxfname =
new oxField($this->oxuser__oxfname->value,
oxField::T_RAW);
256 $this->_oNewsSubscription->oxnewssubscribed__oxlname =
new oxField($this->oxuser__oxlname->value,
oxField::T_RAW);
274 if ($this->_oUserCountryTitle == null || $sCountryId) {
275 $sId = $sCountryId ? $sCountryId : $this->oxuser__oxcountryid->value;
278 $sQ =
"select oxtitle from {$sViewName} where oxid = " . $oDb->quote($sId) .
" ";
281 $this->_oUserCountryTitle = $oCountry;
300 $sQ =
"select oxid from " . getviewName(
"oxcountry") .
" where oxactive = '1' and oxisoalpha2 = " . $oDb->quote($sCountry) .
" ";
301 $sCountryId = $oDb->getOne($sQ);
316 if (isset($this->_oGroups)) {
321 $sOXID = $this->
getId();
325 $this->_oGroups =
oxNew(
'oxList',
'oxgroups');
326 $sSelect =
"select {$sViewName}.* from {$sViewName} left join oxobject2group on oxobject2group.oxgroupsid = {$sViewName}.oxid
327 where oxobject2group.oxobjectid = " .
oxDb::getDb()->quote($sOXID);
328 $this->_oGroups->selectString($sSelect);
342 $sUserId = isset($sUserId) ? $sUserId : $this->
getId();
343 if (!isset($this->_aAddresses[$sUserId])) {
344 $oUserAddressList =
oxNew(
'oxUserAddressList');
345 $oUserAddressList->load($sUserId);
346 $this->_aAddresses[$sUserId] = $oUserAddressList;
350 foreach ($this->_aAddresses[$sUserId] as $oAddress) {
351 if ($oAddress->getId() === $sAddressId) {
352 $oAddress->setSelected();
359 return $this->_aAddresses[$sUserId];
369 $this->_sSelAddressId = $sAddressId;
379 if ($this->_sSelAddressId !== null) {
398 $this->_sWishId = null;
401 foreach ($oBasket->getContents() as $oBasketItem) {
402 if ($this->_sWishId = $oBasketItem->getWishId()) {
421 if ($this->_oSelAddress !== null) {
425 $oSelectedAddress = null;
427 if ($oAddresses->count()) {
429 foreach ($oAddresses as $oAddress) {
430 if ($oAddress->getId() == $sAddressId) {
431 $oAddress->selected = 1;
432 $oAddress->setSelected();
433 $oSelectedAddress = $oAddress;
440 if (!$oSelectedAddress) {
441 if (!$sAddressId || $sAddressId >= 0) {
442 $oAddresses->rewind();
443 $oAddress = $oAddresses->current();
445 $aAddresses = $oAddresses->getArray();
446 $oAddress = array_pop($aAddresses);
448 $oAddress->selected = 1;
449 $oAddress->setSelected();
450 $oSelectedAddress = $oAddress;
453 $this->_oSelAddress = $oSelectedAddress;
455 return $oSelectedAddress;
467 if ($this->_oPayments === null) {
470 $sOXID = $this->
getId();
473 $sSelect =
'select * from oxuserpayments where oxuserid = ' .
oxDb::getDb()->quote($sOXID) .
' ';
475 $this->_oPayments =
oxNew(
'oxList');
476 $this->_oPayments->init(
'oxUserPayment');
477 $this->_oPayments->selectString($sSelect);
492 $blAddRemark =
false;
493 if ($this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
503 if (is_array($this->oxuser__oxbirthdate->value)) {
509 if (
$myConfig->getConfigParam(
"bl_showFbConnect")) {
511 if ($oFb->isConnected() && $oFb->getUser()) {
512 $this->oxuser__oxfbid =
new oxField($oFb->getUser());
520 if ($blAddRemark && $blRet) {
521 $oRemark =
oxNew(
'oxremark');
552 $blIn = isset($oGroups[$sGroupID]);
566 public function delete($sOXID = null)
570 $sOXID = $this->
getId();
580 $sOXIDQuoted = $oDb->quote($sOXID);
583 $rs = $oDb->execute(
"delete from oxaddress where oxaddress.oxuserid = {$sOXIDQuoted}");
584 $rs = $oDb->execute(
"delete from oxobject2group where oxobject2group.oxobjectid = {$sOXIDQuoted}");
587 $rs = $oDb->execute(
"delete oxuserbasketitems.* from oxuserbasketitems, oxuserbaskets where oxuserbasketitems.oxbasketid = oxuserbaskets.oxid and oxuserid = {$sOXIDQuoted}");
588 $rs = $oDb->execute(
"delete from oxuserbaskets where oxuserid = {$sOXIDQuoted}");
591 $rs = $oDb->execute(
"delete from oxnewssubscribed where oxuserid = {$sOXIDQuoted}");
594 $rs = $oDb->execute(
"delete from oxobject2delivery where oxobjectid = {$sOXIDQuoted}");
597 $rs = $oDb->execute(
"delete from oxobject2discount where oxobjectid = {$sOXIDQuoted}");
601 $rs = $oDb->execute(
"delete from oxremark where oxparentid = {$sOXIDQuoted} and oxtype !='o'");
603 $blDeleted = $rs->EOF;
622 if (isset($this->oxuser__oxcreate->value)) {
623 $this->oxuser__oxcreate->setValue(
oxRegistry::get(
"oxUtilsDate")->formatDBDate($this->oxuser__oxcreate->value));
627 if (isset($this->_oNewsSubscription)) {
644 $sOXID = $this->
getId();
647 if (parent::exists($sOXID)) {
648 $this->
setId($sOXID);
658 if (!$this->_blMallUsers && $this->oxuser__oxrights->value !=
'malladmin') {
659 $sShopSelect =
' AND oxshopid = "' . $this->
getConfig()->getShopId() .
'" ';
662 $sSelect =
'SELECT oxid FROM ' . $this->
getViewName() .
'
663 WHERE ( oxusername = ' . $oDb->quote($this->oxuser__oxusername->value) .
' ) ';
664 $sSelect .= $sShopSelect;
666 if (($sOxid = $oDb->getOne($sSelect,
false,
false))) {
668 $this->
setId($sOxid);
686 $oOrders =
oxNew(
'oxList');
687 $oOrders->init(
'oxorder');
689 if ($iLimit !==
false) {
690 $oOrders->setSqlLimit($iLimit * $iPage, $iLimit);
700 if ($this->oxuser__oxregister->value > 1) {
702 $sQ =
'select * from oxorder where oxuserid = ' . $oDb->quote($this->
getId()) .
' and oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) .
' ';
706 $sQ .=
' order by oxorderdate desc ';
707 $oOrders->selectString($sQ);
721 if ($this->
getId() && $this->oxuser__oxregister->value > 1) {
723 $sQ =
'select count(*) from oxorder where oxuserid = ' . $oDb->quote($this->
getId()) .
' AND oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) .
' and oxshopid = "' . $this->
getConfig()->getShopId() .
'" ';
724 $iCnt = (int) $oDb->getOne($sQ);
737 if ($this->_iCntNoticeListArticles === null) {
738 $this->_iCntNoticeListArticles = 0;
739 if ($this->
getId()) {
740 $this->_iCntNoticeListArticles = $this->
getBasket(
'noticelist')->getItemCount();
754 if ($this->_iCntWishListArticles === null) {
755 $this->_iCntWishListArticles =
false;
756 if ($this->
getId()) {
757 $this->_iCntWishListArticles = $this->
getBasket(
'wishlist')->getItemCount();
782 $sDeliveryCountry =
'';
785 $oDelAddress =
oxNew(
'oxaddress');
786 $oDelAddress->load($soxAddressId);
787 $sDeliveryCountry = $oDelAddress->oxaddress__oxcountryid->value;
788 } elseif ($this->
getId()) {
789 $sDeliveryCountry = $this->oxuser__oxcountryid->value;
791 $oUser =
oxNew(
'oxuser');
792 if ($oUser->loadActiveUser()) {
793 $sDeliveryCountry = $oUser->oxuser__oxcountryid->value;
797 return $sDeliveryCountry;
810 $sShopID = $this->
getConfig()->getShopId();
813 $sSelect =
"select oxid from oxuser where oxusername = " . $oDb->quote($this->oxuser__oxusername->value) .
" and oxpassword = '' ";
814 if (!$this->_blMallUsers) {
815 $sSelect .=
" and oxshopid = '{$sShopID}' ";
817 $sOXID = $oDb->getOne($sSelect,
false,
false);
820 if (isset($sOXID) && $sOXID) {
822 $this->
delete($sOXID);
823 } elseif ($this->_blMallUsers) {
825 $sQ =
"select oxid from oxuser where oxusername = " . $oDb->quote($this->oxuser__oxusername->value) .
" and oxusername != '' ";
826 if ($oDb->getOne($sQ,
false,
false)) {
828 $oEx =
oxNew(
'oxUserException');
830 $oEx->setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_USER_USEREXISTS', $oLang->getTplLanguage()), $this->oxuser__oxusername->value));
836 if (($blOK = $this->
save())) {
838 $oDb->execute(
"delete from oxaddress where oxaddress.oxuserid = " . $oDb->quote($this->oxuser__oxid->value) .
" ");
839 $oDb->execute(
"update oxuserpayments set oxuserpayments.oxuserid = " . $oDb->quote($this->oxuser__oxusername->value) .
" where oxuserpayments.oxuserid = " . $oDb->quote($this->oxuser__oxid->value) .
" ");
842 $oEx =
oxNew(
'oxUserException');
843 $oEx->setMessage(
'EXCEPTION_USER_USERCREATIONFAILED');
859 if (!$this->
inGroup($sGroupID)) {
861 $oGroup =
oxNew(
'oxGroups');
862 if ($oGroup->load($sGroupID)) {
863 $oNewGroup =
oxNew(
'oxobject2group');
866 if ($oNewGroup->save()) {
867 $this->_oGroups[$sGroupID] = $oGroup;
884 if ($sGroupID != null && $this->
inGroup($sGroupID)) {
885 $oGroups =
oxNew(
'oxList');
886 $oGroups->init(
'oxobject2group');
887 $sSelect =
'select * from oxobject2group where oxobject2group.oxobjectid = "' . $this->
getId() .
'" and oxobject2group.oxgroupsid = "' . $sGroupID .
'" ';
888 $oGroups->selectString($sSelect);
889 foreach ($oGroups as $oRemgroup) {
890 if ($oRemgroup->delete()) {
891 unset($this->_oGroups[$oRemgroup->oxobject2group__oxgroupsid->value]);
906 if (is_numeric($iSuccess) && $iSuccess != 2 && $iSuccess <= 3) {
909 $dMidlleCustPrice = (float)
$myConfig->getConfigParam(
'sMidlleCustPrice');
910 $dLargeCustPrice = (float)
$myConfig->getConfigParam(
'sLargeCustPrice');
913 $dBasketPrice = $oBasket->getPrice()->getBruttoPrice();
914 if ($dBasketPrice < $dMidlleCustPrice) {
917 if ($dBasketPrice >= $dMidlleCustPrice && $dBasketPrice < $dLargeCustPrice) {
920 if ($dBasketPrice >= $dLargeCustPrice) {
924 if ($this->
inGroup(
'oxidnotyetordered')) {
939 if (!isset($this->_aBaskets[$sName])) {
940 $oBasket =
oxNew(
'oxuserbasket');
941 $aWhere = array(
'oxuserbaskets.oxuserid' => $this->
getId(),
'oxuserbaskets.oxtitle' => $sName);
944 if (!$oBasket->assignRecord($oBasket->buildSelectString($aWhere))) {
945 $oBasket->oxuserbaskets__oxtitle =
new oxField($sName);
946 $oBasket->oxuserbaskets__oxuserid =
new oxField($this->
getId());
949 $oBasket->setIsNewBasket();
952 $this->_aBaskets[$sName] = $oBasket;
955 return $this->_aBaskets[$sName];
970 $iYear = isset($aData[
'year']) ? ((int) $aData[
'year']) :
false;
971 $iMonth = isset($aData[
'month']) ? ((int) $aData[
'month']) :
false;
972 $iDay = isset($aData[
'day']) ? ((int) $aData[
'day']) :
false;
975 if (!$iYear && !$iMonth && !$iDay) {
980 if (!$iYear || $iYear < 1000 || $iYear > 9999) {
985 if (!$iMonth || $iMonth < 1 || $iMonth > 12) {
993 if ($iMaxDays > 28) {
994 $iMaxDays = ($iYear % 4 == 0 && ($iYear % 100 != 0 || $iYear % 400 == 0)) ? 29 : 28;
1001 $iMaxDays = min(30, $iMaxDays);
1006 if (!$iDay || $iDay < 1 || $iDay > $iMaxDays) {
1011 return sprintf(
"%04d-%02d-%02d", $iYear, $iMonth, $iDay);
1021 if (!$iBoni = $this->
getConfig()->getConfigParam(
'iCreditRating')) {
1044 public function checkValues($sLogin, $sPassword, $sPassword2, $aInvAddress, $aDelAddress)
1050 $sLogin = $oInputValidator->checkLogin($this, $sLogin, $aInvAddress);
1053 $oInputValidator->checkEmail($this, $sLogin, $aInvAddress);
1056 $oInputValidator->checkPassword($this, $sPassword, $sPassword2, ((
int)
oxRegistry::getConfig()->getRequestParameter(
'option') == 3));
1059 $oInputValidator->checkRequiredFields($this, $aInvAddress, $aDelAddress);
1062 $oInputValidator->checkCountries($this, $aInvAddress, $aDelAddress);
1065 $oInputValidator->checkVatId($this, $aInvAddress);
1069 if ($oError =
oxRegistry::get(
"oxInputValidator")->getFirstValidationError()) {
1092 if ($oNewsSubscription) {
1093 if ($blSubscribe && ($blForceCheckOptIn || ($iOptInStatus = $oNewsSubscription->getOptInStatus()) != 1)) {
1094 if (!$blSendOptIn) {
1099 $oNewsSubscription->setOptInStatus(1);
1104 if ($iOptInStatus != 2) {
1106 $oEmail =
oxNew(
'oxemail');
1107 $blSuccess = $oEmail->sendNewsletterDbOptInMail($this);
1113 $oNewsSubscription->setOptInStatus(2);
1115 } elseif (!$blSubscribe) {
1118 $oNewsSubscription->setOptInStatus(0);
1141 public function changeUserData($sUser, $sPassword, $sPassword2, $aInvAddress, $aDelAddress)
1144 $this->
checkValues($sUser, $sPassword, $sPassword2, $aInvAddress, $aDelAddress);
1147 $this->
assign($aInvAddress);
1154 if ($this->
save()) {
1157 $sCountryId = isset($aInvAddress[
'oxuser__oxcountryid']) ? $aInvAddress[
'oxuser__oxcountryid'] :
'';
1170 $sDelAddress .= $this->oxuser__oxcompany;
1171 $sDelAddress .= $this->oxuser__oxusername;
1172 $sDelAddress .= $this->oxuser__oxfname;
1173 $sDelAddress .= $this->oxuser__oxlname;
1174 $sDelAddress .= $this->oxuser__oxstreet;
1175 $sDelAddress .= $this->oxuser__oxstreetnr;
1176 $sDelAddress .= $this->oxuser__oxaddinfo;
1177 $sDelAddress .= $this->oxuser__oxustid;
1178 $sDelAddress .= $this->oxuser__oxcity;
1179 $sDelAddress .= $this->oxuser__oxcountryid;
1180 $sDelAddress .= $this->oxuser__oxstateid;
1181 $sDelAddress .= $this->oxuser__oxzip;
1182 $sDelAddress .= $this->oxuser__oxfon;
1183 $sDelAddress .= $this->oxuser__oxfax;
1184 $sDelAddress .= $this->oxuser__oxsal;
1186 return $sDelAddress;
1196 if (is_array($aDelAddress) && count($aDelAddress)) {
1198 $sAddressId = $this->
getConfig()->getRequestParameter(
'oxaddressid');
1199 $sAddressId = ($sAddressId === null || $sAddressId == -1 || $sAddressId == -2) ? null : $sAddressId;
1201 $oAddress =
oxNew(
'oxaddress');
1202 $oAddress->setId($sAddressId);
1203 $oAddress->load($sAddressId);
1204 $oAddress->assign($aDelAddress);
1206 $oAddress->oxaddress__oxcountry = $this->
getUserCountry($oAddress->oxaddress__oxcountryid->value);
1210 $this->_aAddresses = null;
1238 $sUserSelect =
"oxuser.oxusername = " . $oDb->quote($sUser);
1239 $sPassSelect =
" oxuser.oxpassword = BINARY MD5( CONCAT( " . $oDb->quote($sPassword) .
", UNHEX( oxuser.oxpasssalt ) ) ) ";
1245 $sShopSelect =
" and ( oxrights != 'user' ) ";
1248 $sSelect =
"select `oxid` from oxuser where oxuser.oxactive = 1 and {$sPassSelect} and {$sUserSelect} {$sShopSelect} ";
1271 $sUserSelect =
"oxuser.oxusername = " . $oDb->quote($sUser);
1276 $sShopSelect =
" and ( oxrights != 'user' ) ";
1279 $sSalt = $oDb->getOne(
"SELECT `oxpasssalt` FROM `oxuser` WHERE " . $sUserSelect . $sShopSelect);
1281 $sPassSelect =
" oxuser.oxpassword = " . $oDb->quote($this->
encodePassword($sPassword, $sSalt));
1283 $sSelect =
"select `oxid` from oxuser where oxuser.oxactive = 1 and {$sPassSelect} and {$sUserSelect} {$sShopSelect} ";
1303 $sShopSelect =
" and ( oxrights != 'user' ) ";
1306 return $sShopSelect;
1323 public function login($sUser, $sPassword, $blCookie =
false)
1327 $oEx =
oxNew(
'oxCookieException');
1328 $oEx->setMessage(
'ERROR_MESSAGE_COOKIE_NOCOOKIE');
1337 $sShopID = $oConfig->getShopId();
1338 $this->
_dbLogin($sUser, $sPassword, $sShopID);
1345 if ($this->oxuser__oxid->value) {
1359 if ($blCookie && $oConfig->getConfigParam(
'blShowRememberMe')) {
1360 oxRegistry::get(
"oxUtilsServer")->setUserCookie($this->oxuser__oxusername->value, $this->oxuser__oxpassword->value, $oConfig->getShopId(), 31536000, $this->oxuser__oxpasssalt->value);
1366 $oEx =
oxNew(
'oxUserException');
1367 $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');
1418 $blAdmin = $this->
isAdmin() || $blForceAdmin;
1424 $blFoundInCookie =
false;
1425 if (!$sUserID && !$blAdmin && $oConfig->getConfigParam(
'blShowRememberMe')) {
1427 $blFoundInCookie = $sUserID ?
true :
false;
1432 if (!$sUserID && !$blAdmin && $oConfig->getConfigParam(
"bl_showFbConnect")) {
1439 if ($this->
load($sUserID)) {
1448 $this->_blLoadedFromCookie = $blFoundInCookie;
1476 if ($oFb->isConnected() && $oFb->getUser()) {
1477 $sUserSelect =
"oxuser.oxfbid = " . $oDb->quote($oFb->getUser());
1481 $sSelect =
"select oxid from oxuser where oxuser.oxactive = 1 and {$sUserSelect} {$sShopSelect} ";
1482 $sUserID = $oDb->getOne($sSelect);
1497 $sShopID = $oConfig->getShopId();
1498 if (($sSet =
oxRegistry::get(
"oxUtilsServer")->getUserCookie($sShopID))) {
1500 $aData = explode(
'@@@', $sSet);
1504 $sSelect =
'select oxid, oxpassword, oxpasssalt from oxuser where oxuser.oxpassword != "" and oxuser.oxactive = 1 and oxuser.oxusername = ' . $oDb->quote($sUser);
1506 $rs = $oDb->select($sSelect);
1507 if ($rs !=
false && $rs->recordCount() > 0) {
1509 $sTest = crypt($rs->fields[1], $rs->fields[2]);
1510 if ($sTest == $sPWD) {
1512 $sUserID = $rs->fields[0];
1539 protected function _ldapLogin($sUser, $sPassword, $sShopID, $sShopSelect)
1541 $aLDAPParams = $this->
getConfig()->getConfigParam(
'aLDAPParams');
1542 $oLDAP =
oxNew(
"oxLDAP", $aLDAPParams[
'HOST'], $aLDAPParams[
'PORT']);
1546 $sLDAPKey = $oDb->getOne(
"select oxldapkey from oxuser where oxuser.oxactive = 1 and oxuser.oxusername = " . $oDb->quote($sUser) .
" $sShopSelect");
1547 if (isset($sLDAPKey) && $sLDAPKey) {
1552 $oLDAP->login($sUser, $sPassword, $aLDAPParams[
'USERQUERY'], $aLDAPParams[
'BASEDN'], $aLDAPParams[
'FILTER']);
1554 $aData = $oLDAP->mapData($aLDAPParams[
'DATAMAP']);
1555 if (isset($aData[
'OXUSERNAME']) && $aData[
'OXUSERNAME']) {
1559 $sSelect =
"select oxid from oxuser where oxuser.oxusername = " . $oDb->quote($aData[
'OXUSERNAME']) .
" $sShopSelect";
1560 $sOXID = $oDb->getOne($sSelect);
1562 if (!isset($sOXID) || !$sOXID) {
1568 foreach ($aData as $fldname => $value) {
1569 $sField =
"oxuser__" . strtolower($fldname);
1570 $this->$sField =
new oxField($aData[$fldname]);
1573 $this->oxuser__oxactive =
new oxField(1);
1574 $this->oxuser__oxshopid =
new oxField($sShopID);
1575 $this->oxuser__oxldapkey =
new oxField($sUser);
1576 $this->oxuser__oxrights =
new oxField(
"user");
1582 $this->
load($sOXID);
1586 $oEx =
oxNew(
'oxUserException');
1587 $oEx->setMessage(
'EXCEPTION_USER_NOVALUES');
1601 if (!$this->oxuser__oxrights->value) {
1607 $sAuthRights = null;
1613 $sAuthRights = $oDb->getOne(
'select oxrights from ' . $this->
getViewName() .
' where oxid=' . $oDb->quote($sAuthUserID));
1620 if ($sCurrRights = $oDb->getOne(
'select oxrights from ' . $this->getViewName() .
' where oxid=' . $oDb->quote($this->
getId()))) {
1621 $aRights[] = $sCurrRights;
1623 $aRights[] =
'user';
1625 if (!$sAuthRights || !($sAuthRights ==
'malladmin' || $sAuthRights ==
$myConfig->getShopId())) {
1626 return current($aRights);
1627 } elseif ($sAuthRights ==
$myConfig->getShopId()) {
1628 $aRights[] = $sAuthRights;
1629 if (!in_array($this->oxuser__oxrights->value, $aRights)) {
1630 return current($aRights);
1635 return $this->oxuser__oxrights->value;
1649 if (!isset($this->oxuser__oxboni->value)) {
1664 if (!$this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
1665 $this->_aSkipSaveFields[] =
'oxboni';
1669 $this->_aSkipSaveFields[] =
'oxcreate';
1671 $this->_aSkipSaveFields[] =
'oxcustnr';
1672 $this->_aSkipSaveFields[] =
'oxrights';
1676 if (($blUpdate = parent::_update())) {
1697 $sQ =
'select oxshopid, oxrights, oxpassword from oxuser where oxusername = ' . $oDb->quote($sEmail);
1698 if (($sOxid = $this->
getId())) {
1699 $sQ .=
" and oxid <> " . $oDb->quote($sOxid);
1701 $oRs = $oDb->select($sQ,
false,
false);
1702 if ($oRs !=
false && $oRs->recordCount() > 0) {
1704 if ($this->_blMallUsers) {
1707 if ($oRs->fields[1] ==
'user' && !$oRs->fields[2]) {
1715 while (!$oRs->EOF) {
1716 if ($oRs->fields[1] !=
'user') {
1721 } elseif ($oRs->fields[0] == $iShopId && $oRs->fields[2]) {
1748 $sOXID = $this->
getId();
1753 $iActPage = ($iActPage < 0) ? 0 : $iActPage;
1756 $iNrofCatArticles = $this->
getConfig()->getConfigParam(
'iNrofCatArticles');
1757 $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 10;
1760 $oRecommList =
oxNew(
'oxList');
1761 $oRecommList->init(
'oxrecommlist');
1762 $oRecommList->setSqlLimit($iNrofCatArticles * $iActPage, $iNrofCatArticles);
1763 $iShopId = $this->
getConfig()->getShopId();
1764 $sSelect =
'select * from oxrecommlists where oxuserid =' .
oxDb::getDb()->quote($sOXID) .
' and oxshopid ="' . $iShopId .
'"';
1765 $oRecommList->selectString($sSelect);
1767 return $oRecommList;
1782 $sOx = $this->
getId();
1785 if ($this->_iCntRecommLists === null || $sOx) {
1787 $this->_iCntRecommLists = 0;
1788 $iShopId = $this->
getConfig()->getShopId();
1789 $sSelect =
'select count(oxid) from oxrecommlists where oxuserid = ' . $oDb->quote($sOx) .
' and oxshopid ="' . $iShopId .
'"';
1790 $this->_iCntRecommLists = $oDb->getOne($sSelect);
1805 $blForeigner =
true;
1806 $blForeignGroupExists =
false;
1807 $blInlandGroupExists =
false;
1809 $aHomeCountry = $this->
getConfig()->getConfigParam(
'aHomeCountry');
1811 if (is_array($aHomeCountry)) {
1812 if (in_array($sCountryId, $aHomeCountry)) {
1813 $blForeigner =
false;
1815 } elseif ($sCountryId == $aHomeCountry) {
1816 $blForeigner =
false;
1819 if ($this->
inGroup(
'oxidforeigncustomer')) {
1820 $blForeignGroupExists =
true;
1821 if (!$blForeigner) {
1826 if ($this->
inGroup(
'oxidnewcustomer')) {
1827 $blInlandGroupExists =
true;
1833 if (!$blForeignGroupExists && $blForeigner) {
1836 if (!$blInlandGroupExists && !$blForeigner) {
1853 $sQ =
"select oxid from " . $this->
getViewName() .
" where oxupdateexp >= " . time() .
" and MD5( CONCAT( oxid, oxshopid, oxupdatekey ) ) = " . $oDb->quote($sUid);
1854 if ($sUserId = $oDb->getOne($sQ)) {
1855 return $this->
load($sUserId);
1899 $sQ =
"select 1 from " . $this->
getViewName() .
" where oxupdateexp >= " . time() .
" and MD5( CONCAT( oxid, oxshopid, oxupdatekey ) ) = " . $oDb->quote($sKey);
1901 return !((bool) $oDb->getOne($sQ));
1911 if ($this->_sUpdateKey === null) {
1913 $this->_sUpdateKey = md5($this->
getId() . $this->oxuser__oxshopid->value . $this->oxuser__oxupdatekey->value);
1930 $oSha512Hasher =
oxNew(
'oxSha512Hasher');
1932 $oHasher =
oxNew(
'oxPasswordHasher', $oSha512Hasher);
1934 return $oHasher->hash($sPassword, $sSalt);
1949 $oOpenSSLFunctionalityChecker =
oxNew(
'oxOpenSSLFunctionalityChecker');
1951 $oGenerator =
oxNew(
'oxPasswordSaltGenerator', $oOpenSSLFunctionalityChecker);
1953 return $oGenerator->generate();
1967 return ($sSaltHex ?
oxDb::getDb()->getOne(
"select UNHEX( '{$sSaltHex}' )") :
'');
1978 $oOpenSSLFunctionalityChecker =
oxNew(
'oxOpenSSLFunctionalityChecker');
1981 $oSaltGenerator =
oxNew(
'oxPasswordSaltGenerator', $oOpenSSLFunctionalityChecker);
1983 $sSalt = $sPassword ? $oSaltGenerator->generate() :
'';
1986 $sPassword = $sPassword ? $this->
encodePassword($sPassword, $sSalt) :
'';
2001 return $this->
encodePassword($sNewPass, $this->oxuser__oxpasssalt->value) == $this->oxuser__oxpassword->value;
2025 if ($this->oxuser__oxpassword->value) {
2026 $sHash = $this->oxuser__oxpassword->value;
2042 $sReviewUserHash = $oDb->getOne(
'select md5(concat("oxid", oxpassword, oxusername )) from oxuser where oxid = ' . $oDb->quote($sUserId) .
'');
2044 return $sReviewUserHash;
2057 $sUserId = $oDb->getOne(
'select oxid from oxuser where md5(concat("oxid", oxpassword, oxusername )) = ' . $oDb->quote($sReviewUserHash) .
'');
2081 return $this->oxuser__oxstateid->value;
2095 if (is_null($sId)) {
2099 return $oState->getTitleById($sId);
2110 $sShopId = $this->
getConfig()->getShopId();
2111 $sUserId = $oDb->quote($this->
getId());
2113 return (
bool) $oDb->getOne(
"select 1 from oxacceptedterms where oxuserid={$sUserId} and oxshopid='{$sShopId}'");
2122 $sUserId = $oDb->quote($this->
getId());
2123 $sShopId = $this->
getConfig()->getShopId();
2124 $sVersion =
oxNew(
"oxcontent")->getTermsVersion();
2126 $oDb->execute(
"replace oxacceptedterms set oxuserid={$sUserId}, oxshopid='{$sShopId}', oxtermversion='{$sVersion}'");
2142 $iPoints = $this->
getConfig()->getConfigParam(
'dPointsForRegistration');
2144 $iPending = $oDb->getOne(
"select count(oxuserid) from oxinvitations where oxuserid = " . $oDb->quote($sUserId) .
" and md5(oxemail) = " . $oDb->quote($sRecEmail) .
" and oxpending = 1 and oxaccepted = 0",
false,
false);
2145 if ($iPoints && $iPending) {
2147 if ($blSet = $this->
save()) {
2149 $oDb->execute(
"UPDATE oxinvitations SET oxpending = '0', oxaccepted = '1' where oxuserid = " . $oDb->quote($sUserId) .
" and md5(oxemail) = " . $oDb->quote($sRecEmail));
2150 $oInvUser =
oxNew(
"oxuser");
2151 if ($oInvUser->load($sUserId)) {
2152 $blSet = $oInvUser->setCreditPointsForInviter();
2170 $iPoints = $this->
getConfig()->getConfigParam(
'dPointsForInvitation');
2172 $iNewPoints = $this->oxuser__oxpoints->value + $iPoints;
2174 $blSet = $this->
save();
2192 if ($oFb->isConnected() && $oFb->getUser()) {
2193 $this->oxuser__oxfbid =
new oxField($oFb->getUser());
2194 $blRet = $this->
save();
2208 $sUserId = $this->
getId();
2210 if ($sUserId && is_array($aRecEmail) && count($aRecEmail) > 0) {
2212 $sDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate(date(
"Y-m-d"),
true);
2214 foreach ($aRecEmail as $sRecEmail) {
2215 $sSql =
"INSERT INTO oxinvitations SET oxuserid = " . $oDb->quote($sUserId) .
", oxemail = $sRecEmail, oxdate='$sDate', oxpending = '1', oxaccepted = '0', oxtype = '1' ";
2216 $oDb->execute($sSql);
2231 $sQ =
"SELECT `oxid` FROM `oxuser` WHERE `oxusername` = " . $oDb->quote($sUserName);
2232 if (!$this->
getConfig()->getConfigParam(
'blMallUsers')) {
2236 return $oDb->getOne($sQ);
2247 return (
bool) $this->oxuser__oxpassword->value;
2257 return (
bool) $this->
getConfig()->getConfigParam(
'blShowNetPrice');
2269 protected function _dbLogin($sUser, $sPassword, $sShopID)
2285 if (!$this->
load($sUserOxId)) {
2287 $oEx =
oxNew(
'oxUserException');
2288 $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');
2290 } elseif ($blOldHash && $this->
getId()) {
2304 $blDemoMode =
false;
2325 if ($sPassword ==
"admin" && $sUser ==
"admin") {
2326 $sSelect =
"SELECT `oxid` FROM `oxuser` WHERE `oxrights` = 'malladmin' ";
2329 $oEx =
oxNew(
'oxUserException');
2330 $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');