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];
1537 protected function _ldapLogin($sUser, $sPassword, $sShopID, $sShopSelect)
1539 $aLDAPParams = $this->
getConfig()->getConfigParam(
'aLDAPParams');
1540 $oLDAP =
oxNew(
"oxLDAP", $aLDAPParams[
'HOST'], $aLDAPParams[
'PORT']);
1544 $sLDAPKey = $oDb->getOne(
"select oxldapkey from oxuser where oxuser.oxactive = 1 and oxuser.oxusername = " . $oDb->quote($sUser) .
" $sShopSelect");
1545 if (isset($sLDAPKey) && $sLDAPKey) {
1550 $oLDAP->login($sUser, $sPassword, $aLDAPParams[
'USERQUERY'], $aLDAPParams[
'BASEDN'], $aLDAPParams[
'FILTER']);
1552 $aData = $oLDAP->mapData($aLDAPParams[
'DATAMAP']);
1553 if (isset($aData[
'OXUSERNAME']) && $aData[
'OXUSERNAME']) {
1557 $sSelect =
"select oxid from oxuser where oxuser.oxusername = " . $oDb->quote($aData[
'OXUSERNAME']) .
" $sShopSelect";
1558 $sOXID = $oDb->getOne($sSelect);
1560 if (!isset($sOXID) || !$sOXID) {
1566 foreach ($aData as $fldname => $value) {
1567 $sField =
"oxuser__" . strtolower($fldname);
1568 $this->$sField =
new oxField($aData[$fldname]);
1571 $this->oxuser__oxactive =
new oxField(1);
1572 $this->oxuser__oxshopid =
new oxField($sShopID);
1573 $this->oxuser__oxldapkey =
new oxField($sUser);
1574 $this->oxuser__oxrights =
new oxField(
"user");
1580 $this->
load($sOXID);
1584 $oEx =
oxNew(
'oxUserException');
1585 $oEx->setMessage(
'EXCEPTION_USER_NOVALUES');
1599 if (!$this->oxuser__oxrights->value) {
1605 $sAuthRights = null;
1611 $sAuthRights = $oDb->getOne(
'select oxrights from ' . $this->
getViewName() .
' where oxid=' . $oDb->quote($sAuthUserID));
1618 if ($sCurrRights = $oDb->getOne(
'select oxrights from ' . $this->getViewName() .
' where oxid=' . $oDb->quote($this->
getId()))) {
1619 $aRights[] = $sCurrRights;
1621 $aRights[] =
'user';
1623 if (!$sAuthRights || !($sAuthRights ==
'malladmin' || $sAuthRights ==
$myConfig->getShopId())) {
1624 return current($aRights);
1625 } elseif ($sAuthRights ==
$myConfig->getShopId()) {
1626 $aRights[] = $sAuthRights;
1627 if (!in_array($this->oxuser__oxrights->value, $aRights)) {
1628 return current($aRights);
1633 return $this->oxuser__oxrights->value;
1647 if (!isset($this->oxuser__oxboni->value)) {
1662 if (!$this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
1663 $this->_aSkipSaveFields[] =
'oxboni';
1667 $this->_aSkipSaveFields[] =
'oxcreate';
1669 $this->_aSkipSaveFields[] =
'oxcustnr';
1670 $this->_aSkipSaveFields[] =
'oxrights';
1674 if (($blUpdate = parent::_update())) {
1695 $sQ =
'select oxshopid, oxrights, oxpassword from oxuser where oxusername = ' . $oDb->quote($sEmail);
1696 if (($sOxid = $this->
getId())) {
1697 $sQ .=
" and oxid <> " . $oDb->quote($sOxid);
1699 $oRs = $oDb->select($sQ,
false,
false);
1700 if ($oRs !=
false && $oRs->recordCount() > 0) {
1702 if ($this->_blMallUsers) {
1705 if ($oRs->fields[1] ==
'user' && !$oRs->fields[2]) {
1713 while (!$oRs->EOF) {
1714 if ($oRs->fields[1] !=
'user') {
1719 } elseif ($oRs->fields[0] == $iShopId && $oRs->fields[2]) {
1746 $sOXID = $this->
getId();
1751 $iActPage = ($iActPage < 0) ? 0 : $iActPage;
1754 $iNrofCatArticles = $this->
getConfig()->getConfigParam(
'iNrofCatArticles');
1755 $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 10;
1758 $oRecommList =
oxNew(
'oxList');
1759 $oRecommList->init(
'oxrecommlist');
1760 $oRecommList->setSqlLimit($iNrofCatArticles * $iActPage, $iNrofCatArticles);
1761 $iShopId = $this->
getConfig()->getShopId();
1762 $sSelect =
'select * from oxrecommlists where oxuserid =' .
oxDb::getDb()->quote($sOXID) .
' and oxshopid ="' . $iShopId .
'"';
1763 $oRecommList->selectString($sSelect);
1765 return $oRecommList;
1780 $sOx = $this->
getId();
1783 if ($this->_iCntRecommLists === null || $sOx) {
1785 $this->_iCntRecommLists = 0;
1786 $iShopId = $this->
getConfig()->getShopId();
1787 $sSelect =
'select count(oxid) from oxrecommlists where oxuserid = ' . $oDb->quote($sOx) .
' and oxshopid ="' . $iShopId .
'"';
1788 $this->_iCntRecommLists = $oDb->getOne($sSelect);
1803 $blForeigner =
true;
1804 $blForeignGroupExists =
false;
1805 $blInlandGroupExists =
false;
1807 $aHomeCountry = $this->
getConfig()->getConfigParam(
'aHomeCountry');
1809 if (is_array($aHomeCountry)) {
1810 if (in_array($sCountryId, $aHomeCountry)) {
1811 $blForeigner =
false;
1813 } elseif ($sCountryId == $aHomeCountry) {
1814 $blForeigner =
false;
1817 if ($this->
inGroup(
'oxidforeigncustomer')) {
1818 $blForeignGroupExists =
true;
1819 if (!$blForeigner) {
1824 if ($this->
inGroup(
'oxidnewcustomer')) {
1825 $blInlandGroupExists =
true;
1831 if (!$blForeignGroupExists && $blForeigner) {
1834 if (!$blInlandGroupExists && !$blForeigner) {
1851 $sQ =
"select oxid from " . $this->
getViewName() .
" where oxupdateexp >= " . time() .
" and MD5( CONCAT( oxid, oxshopid, oxupdatekey ) ) = " . $oDb->quote($sUid);
1852 if ($sUserId = $oDb->getOne($sQ)) {
1853 return $this->
load($sUserId);
1897 $sQ =
"select 1 from " . $this->
getViewName() .
" where oxupdateexp >= " . time() .
" and MD5( CONCAT( oxid, oxshopid, oxupdatekey ) ) = " . $oDb->quote($sKey);
1899 return !((bool) $oDb->getOne($sQ));
1909 if ($this->_sUpdateKey === null) {
1911 $this->_sUpdateKey = md5($this->
getId() . $this->oxuser__oxshopid->value . $this->oxuser__oxupdatekey->value);
1928 $oSha512Hasher =
oxNew(
'oxSha512Hasher');
1930 $oHasher =
oxNew(
'oxPasswordHasher', $oSha512Hasher);
1932 return $oHasher->hash($sPassword, $sSalt);
1947 $oOpenSSLFunctionalityChecker =
oxNew(
'oxOpenSSLFunctionalityChecker');
1949 $oGenerator =
oxNew(
'oxPasswordSaltGenerator', $oOpenSSLFunctionalityChecker);
1951 return $oGenerator->generate();
1965 return ($sSaltHex ?
oxDb::getDb()->getOne(
"select UNHEX( '{$sSaltHex}' )") :
'');
1976 $oOpenSSLFunctionalityChecker =
oxNew(
'oxOpenSSLFunctionalityChecker');
1979 $oSaltGenerator =
oxNew(
'oxPasswordSaltGenerator', $oOpenSSLFunctionalityChecker);
1981 $sSalt = $sPassword ? $oSaltGenerator->generate() :
'';
1984 $sPassword = $sPassword ? $this->
encodePassword($sPassword, $sSalt) :
'';
1999 return $this->
encodePassword($sNewPass, $this->oxuser__oxpasssalt->value) == $this->oxuser__oxpassword->value;
2023 if ($this->oxuser__oxpassword->value) {
2024 $sHash = $this->oxuser__oxpassword->value;
2040 $sReviewUserHash = $oDb->getOne(
'select md5(concat("oxid", oxpassword, oxusername )) from oxuser where oxid = ' . $oDb->quote($sUserId) .
'');
2042 return $sReviewUserHash;
2055 $sUserId = $oDb->getOne(
'select oxid from oxuser where md5(concat("oxid", oxpassword, oxusername )) = ' . $oDb->quote($sReviewUserHash) .
'');
2079 return $this->oxuser__oxstateid->value;
2093 if (is_null($sId)) {
2097 return $oState->getTitleById($sId);
2108 $sShopId = $this->
getConfig()->getShopId();
2109 $sUserId = $oDb->quote($this->
getId());
2111 return (
bool) $oDb->getOne(
"select 1 from oxacceptedterms where oxuserid={$sUserId} and oxshopid='{$sShopId}'");
2120 $sUserId = $oDb->quote($this->
getId());
2121 $sShopId = $this->
getConfig()->getShopId();
2122 $sVersion =
oxNew(
"oxcontent")->getTermsVersion();
2124 $oDb->execute(
"replace oxacceptedterms set oxuserid={$sUserId}, oxshopid='{$sShopId}', oxtermversion='{$sVersion}'");
2140 $iPoints = $this->
getConfig()->getConfigParam(
'dPointsForRegistration');
2142 $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);
2143 if ($iPoints && $iPending) {
2145 if ($blSet = $this->
save()) {
2147 $oDb->execute(
"UPDATE oxinvitations SET oxpending = '0', oxaccepted = '1' where oxuserid = " . $oDb->quote($sUserId) .
" and md5(oxemail) = " . $oDb->quote($sRecEmail));
2148 $oInvUser =
oxNew(
"oxuser");
2149 if ($oInvUser->load($sUserId)) {
2150 $blSet = $oInvUser->setCreditPointsForInviter();
2168 $iPoints = $this->
getConfig()->getConfigParam(
'dPointsForInvitation');
2170 $iNewPoints = $this->oxuser__oxpoints->value + $iPoints;
2172 $blSet = $this->
save();
2190 if ($oFb->isConnected() && $oFb->getUser()) {
2191 $this->oxuser__oxfbid =
new oxField($oFb->getUser());
2192 $blRet = $this->
save();
2206 $sUserId = $this->
getId();
2208 if ($sUserId && is_array($aRecEmail) && count($aRecEmail) > 0) {
2210 $sDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate(date(
"Y-m-d"),
true);
2212 foreach ($aRecEmail as $sRecEmail) {
2213 $sSql =
"INSERT INTO oxinvitations SET oxuserid = " . $oDb->quote($sUserId) .
", oxemail = $sRecEmail, oxdate='$sDate', oxpending = '1', oxaccepted = '0', oxtype = '1' ";
2214 $oDb->execute($sSql);
2229 $sQ =
"SELECT `oxid` FROM `oxuser` WHERE `oxusername` = " . $oDb->quote($sUserName);
2230 if (!$this->
getConfig()->getConfigParam(
'blMallUsers')) {
2234 return $oDb->getOne($sQ);
2245 return (
bool) $this->oxuser__oxpassword->value;
2255 return (
bool) $this->
getConfig()->getConfigParam(
'blShowNetPrice');
2267 protected function _dbLogin($sUser, $sPassword, $sShopID)
2283 if (!$this->
load($sUserOxId)) {
2285 $oEx =
oxNew(
'oxUserException');
2286 $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');
2288 } elseif ($blOldHash && $this->
getId()) {
2302 $blDemoMode =
false;
2323 if ($sPassword ==
"admin" && $sUser ==
"admin") {
2324 $sSelect =
"SELECT `oxid` FROM `oxuser` WHERE `oxrights` = 'malladmin' ";
2327 $oEx =
oxNew(
'oxUserException');
2328 $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');