157         if (is_null($this->_oStateObject)) {
 
  158             $this->_oStateObject = 
oxNew(
'oxState');
 
  174         $this->
init(
'oxuser');
 
  184         $this->_blMallUsers = $blOn;
 
  197         switch ($sParamName) {
 
  201             case 'iCntNoticeListArticles':
 
  204             case 'iCntWishListArticles':
 
  207             case 'iCntRecommLists':
 
  216             case 'oxuser__oxcountry':
 
  235         if ($this->_oNewsSubscription !== null) {
 
  239         $this->_oNewsSubscription = 
oxNew(
'oxnewssubscribed');
 
  242         if (!$this->_oNewsSubscription->loadFromUserId($this->getId())) {
 
  243             if (!$this->_oNewsSubscription->loadFromEmail($this->oxuser__oxusername->value)) {
 
  247                 $this->_oNewsSubscription->oxnewssubscribed__oxemail = 
new oxField($this->oxuser__oxusername->value, 
oxField::T_RAW);
 
  248                 $this->_oNewsSubscription->oxnewssubscribed__oxsal = 
new oxField($this->oxuser__oxsal->value, 
oxField::T_RAW);
 
  249                 $this->_oNewsSubscription->oxnewssubscribed__oxfname = 
new oxField($this->oxuser__oxfname->value, 
oxField::T_RAW);
 
  250                 $this->_oNewsSubscription->oxnewssubscribed__oxlname = 
new oxField($this->oxuser__oxlname->value, 
oxField::T_RAW);
 
  268         if ($this->_oUserCountryTitle == null || $sCountryId) {
 
  269             $sId = $sCountryId ? $sCountryId : $this->oxuser__oxcountryid->value;
 
  272             $sQ = 
"select oxtitle from {$sViewName} where oxid = " . $oDb->quote($sId) . 
" ";
 
  275                 $this->_oUserCountryTitle = $oCountry;
 
  294         $sQ = 
"select oxid from " . getviewName(
"oxcountry") . 
" where oxactive = '1' and oxisoalpha2 = " . $oDb->quote($sCountry) . 
" ";
 
  295         $sCountryId = $oDb->getOne($sQ);
 
  310         if (isset($this->_oGroups)) {
 
  315             $sOXID = $this->
getId();
 
  319         $this->_oGroups = 
oxNew(
'oxList', 
'oxgroups');
 
  320         $sSelect = 
"select {$sViewName}.* from {$sViewName} left join oxobject2group on oxobject2group.oxgroupsid = {$sViewName}.oxid 
  321                      where oxobject2group.oxobjectid = " . 
oxDb::getDb()->quote($sOXID);
 
  322         $this->_oGroups->selectString($sSelect);
 
  336         $sUserId = isset($sUserId) ? $sUserId : $this->
getId();
 
  337         if (!isset($this->_aAddresses[$sUserId])) {
 
  338             $oUserAddressList = 
oxNew(
'oxUserAddressList');
 
  339             $oUserAddressList->load($sUserId);
 
  340             $this->_aAddresses[$sUserId] = $oUserAddressList;
 
  344                 foreach ($this->_aAddresses[$sUserId] as $oAddress) {
 
  345                     if ($oAddress->getId() === $sAddressId) {
 
  346                         $oAddress->setSelected();
 
  353         return $this->_aAddresses[$sUserId];
 
  363         $this->_sSelAddressId = $sAddressId;
 
  373         if ($this->_sSelAddressId !== null) {
 
  392         $this->_sWishId = null;
 
  395         foreach ($oBasket->getContents() as $oBasketItem) {
 
  396             if ($this->_sWishId = $oBasketItem->getWishId()) {
 
  415         if ($this->_oSelAddress !== null) {
 
  419         $oSelectedAddress = null;
 
  421         if ($oAddresses->count()) {
 
  423                 foreach ($oAddresses as $oAddress) {
 
  424                     if ($oAddress->getId() == $sAddressId) {
 
  425                         $oAddress->selected = 1;
 
  426                         $oAddress->setSelected();
 
  427                         $oSelectedAddress = $oAddress;
 
  434             if (!$oSelectedAddress) {
 
  435                 if (!$sAddressId || $sAddressId >= 0) {
 
  436                     $oAddresses->rewind();
 
  437                     $oAddress = $oAddresses->current();
 
  439                     $aAddresses = $oAddresses->getArray();
 
  440                     $oAddress = array_pop($aAddresses);
 
  442                 $oAddress->selected = 1;
 
  443                 $oAddress->setSelected();
 
  444                 $oSelectedAddress = $oAddress;
 
  447         $this->_oSelAddress = $oSelectedAddress;
 
  449         return $oSelectedAddress;
 
  461         if ($this->_oPayments === null) {
 
  464                 $sOXID = $this->
getId();
 
  467             $sSelect = 
'select * from oxuserpayments where oxuserid = ' . 
oxDb::getDb()->quote($sOXID) . 
' ';
 
  469             $this->_oPayments = 
oxNew(
'oxList');
 
  470             $this->_oPayments->init(
'oxUserPayment');
 
  471             $this->_oPayments->selectString($sSelect);
 
  486         $blAddRemark = 
false;
 
  487         if ($this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
 
  497         if (is_array($this->oxuser__oxbirthdate->value)) {
 
  502         if (
$myConfig->getConfigParam(
"bl_showFbConnect")) {
 
  504             if ($oFb->isConnected() && $oFb->getUser()) {
 
  505                 $this->oxuser__oxfbid = 
new oxField($oFb->getUser());
 
  512         if ($blAddRemark && $blRet) {
 
  513             $oRemark = 
oxNew(
'oxremark');
 
  544             $blIn = isset($oGroups[$sGroupID]);
 
  558     public function delete($sOXID = null)
 
  562             $sOXID = $this->
getId();
 
  572             $sOXIDQuoted = $oDb->quote($sOXID);
 
  575             $rs = $oDb->execute(
"delete from oxaddress where oxaddress.oxuserid = {$sOXIDQuoted}");
 
  576             $rs = $oDb->execute(
"delete from oxobject2group where oxobject2group.oxobjectid = {$sOXIDQuoted}");
 
  579             $rs = $oDb->execute(
"delete oxuserbasketitems.* from oxuserbasketitems, oxuserbaskets where oxuserbasketitems.oxbasketid = oxuserbaskets.oxid and oxuserid = {$sOXIDQuoted}");
 
  580             $rs = $oDb->execute(
"delete from oxuserbaskets where oxuserid = {$sOXIDQuoted}");
 
  583             $rs = $oDb->execute(
"delete from oxnewssubscribed where oxuserid = {$sOXIDQuoted}");
 
  586             $rs = $oDb->execute(
"delete from oxobject2delivery where oxobjectid = {$sOXIDQuoted}");
 
  589             $rs = $oDb->execute(
"delete from oxobject2discount where oxobjectid = {$sOXIDQuoted}");
 
  593             $rs = $oDb->execute(
"delete from oxremark where oxparentid = {$sOXIDQuoted} and oxtype !='o'");
 
  595             $blDeleted = $rs->EOF;
 
  614         if (isset($this->oxuser__oxcreate->value)) {
 
  615             $this->oxuser__oxcreate->setValue(
oxRegistry::get(
"oxUtilsDate")->formatDBDate($this->oxuser__oxcreate->value));
 
  619         if (isset($this->_oNewsSubscription)) {
 
  636             $sOXID = $this->
getId();
 
  639         if (parent::exists($sOXID)) {
 
  640             $this->
setId($sOXID);
 
  650         if (!$this->_blMallUsers && $this->oxuser__oxrights->value != 
'malladmin') {
 
  651             $sShopSelect = 
' AND oxshopid = "' . $this->
getConfig()->getShopId() . 
'" ';
 
  654         $sSelect = 
'SELECT oxid FROM ' . $this->
getViewName() . 
' 
  655                     WHERE ( oxusername = ' . $oDb->quote($this->oxuser__oxusername->value) . 
' ) ';
 
  656         $sSelect .= $sShopSelect;
 
  658         if (($sOxid = $oDb->getOne($sSelect, 
false, 
false))) {
 
  660             $this->
setId($sOxid);
 
  678         $oOrders = 
oxNew(
'oxList');
 
  679         $oOrders->init(
'oxorder');
 
  681         if ($iLimit !== 
false) {
 
  682             $oOrders->setSqlLimit($iLimit * $iPage, $iLimit);
 
  692         if ($this->oxuser__oxregister->value > 1) {
 
  694             $sQ = 
'select * from oxorder where oxuserid = ' . $oDb->quote($this->
getId()) . 
' and oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) . 
' ';
 
  698             $sQ .= 
' order by oxorderdate desc ';
 
  699             $oOrders->selectString($sQ);
 
  713         if ($this->
getId() && $this->oxuser__oxregister->value > 1) {
 
  715             $sQ = 
'select count(*) from oxorder where oxuserid = ' . $oDb->quote($this->
getId()) . 
' AND oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) . 
' and oxshopid = "' . $this->
getConfig()->getShopId() . 
'" ';
 
  716             $iCnt = (int) $oDb->getOne($sQ);
 
  729         if ($this->_iCntNoticeListArticles === null) {
 
  730             $this->_iCntNoticeListArticles = 0;
 
  731             if ($this->
getId()) {
 
  732                 $this->_iCntNoticeListArticles = $this->
getBasket(
'noticelist')->getItemCount();
 
  746         if ($this->_iCntWishListArticles === null) {
 
  747             $this->_iCntWishListArticles = 
false;
 
  748             if ($this->
getId()) {
 
  749                 $this->_iCntWishListArticles = $this->
getBasket(
'wishlist')->getItemCount();
 
  774         $sDeliveryCountry = 
'';
 
  777             $oDelAddress = 
oxNew(
'oxaddress');
 
  778             $oDelAddress->load($soxAddressId);
 
  779             $sDeliveryCountry = $oDelAddress->oxaddress__oxcountryid->value;
 
  780         } elseif ($this->
getId()) {
 
  781             $sDeliveryCountry = $this->oxuser__oxcountryid->value;
 
  783             $oUser = 
oxNew(
'oxuser');
 
  784             if ($oUser->loadActiveUser()) {
 
  785                 $sDeliveryCountry = $oUser->oxuser__oxcountryid->value;
 
  789         return $sDeliveryCountry;
 
  802         $sShopID = $this->
getConfig()->getShopId();
 
  805         $sSelect = 
"select oxid from oxuser where oxusername = " . $oDb->quote($this->oxuser__oxusername->value) . 
" and oxpassword = '' ";
 
  806         if (!$this->_blMallUsers) {
 
  807             $sSelect .= 
" and oxshopid = '{$sShopID}' ";
 
  809         $sOXID = $oDb->getOne($sSelect, 
false, 
false);
 
  812         if (isset($sOXID) && $sOXID) {
 
  814             $this->
delete($sOXID);
 
  815         } elseif ($this->_blMallUsers) {
 
  817             $sQ = 
"select oxid from oxuser where oxusername = " . $oDb->quote($this->oxuser__oxusername->value) . 
" and oxusername != '' ";
 
  818             if ($oDb->getOne($sQ, 
false, 
false)) {
 
  820                 $oEx = 
oxNew(
'oxUserException');
 
  822                 $oEx->setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_USER_USEREXISTS', $oLang->getTplLanguage()), $this->oxuser__oxusername->value));
 
  828         if (($blOK = $this->
save())) {
 
  830             $oDb->execute(
"delete from oxaddress where oxaddress.oxuserid = " . $oDb->quote($this->oxuser__oxid->value) . 
" ");
 
  831             $oDb->execute(
"update oxuserpayments set oxuserpayments.oxuserid = " . $oDb->quote($this->oxuser__oxusername->value) . 
" where oxuserpayments.oxuserid = " . $oDb->quote($this->oxuser__oxid->value) . 
" ");
 
  834             $oEx = 
oxNew(
'oxUserException');
 
  835             $oEx->setMessage(
'EXCEPTION_USER_USERCREATIONFAILED');
 
  851         if (!$this->
inGroup($sGroupID)) {
 
  853             $oGroup = 
oxNew(
'oxGroups');
 
  854             if ($oGroup->load($sGroupID)) {
 
  855                 $oNewGroup = 
oxNew(
'oxobject2group');
 
  858                 if ($oNewGroup->save()) {
 
  859                     $this->_oGroups[$sGroupID] = $oGroup;
 
  876         if ($sGroupID != null && $this->
inGroup($sGroupID)) {
 
  877             $oGroups = 
oxNew(
'oxList');
 
  878             $oGroups->init(
'oxobject2group');
 
  879             $sSelect = 
'select * from oxobject2group where oxobject2group.oxobjectid = "' . $this->
getId() . 
'" and oxobject2group.oxgroupsid = "' . $sGroupID . 
'" ';
 
  880             $oGroups->selectString($sSelect);
 
  881             foreach ($oGroups as $oRemgroup) {
 
  882                 if ($oRemgroup->delete()) {
 
  883                     unset($this->_oGroups[$oRemgroup->oxobject2group__oxgroupsid->value]);
 
  898         if (is_numeric($iSuccess) && $iSuccess != 2 && $iSuccess <= 3) {
 
  901             $dMidlleCustPrice = (float) 
$myConfig->getConfigParam(
'sMidlleCustPrice');
 
  902             $dLargeCustPrice = (float) 
$myConfig->getConfigParam(
'sLargeCustPrice');
 
  905             $dBasketPrice = $oBasket->getPrice()->getBruttoPrice();
 
  906             if ($dBasketPrice < $dMidlleCustPrice) {
 
  909             if ($dBasketPrice >= $dMidlleCustPrice && $dBasketPrice < $dLargeCustPrice) {
 
  912             if ($dBasketPrice >= $dLargeCustPrice) {
 
  916             if ($this->
inGroup(
'oxidnotyetordered')) {
 
  931         if (!isset($this->_aBaskets[$sName])) {
 
  932             $oBasket = 
oxNew(
'oxuserbasket');
 
  933             $aWhere = array(
'oxuserbaskets.oxuserid' => $this->
getId(), 
'oxuserbaskets.oxtitle' => $sName);
 
  936             if (!$oBasket->assignRecord($oBasket->buildSelectString($aWhere))) {
 
  937                 $oBasket->oxuserbaskets__oxtitle = 
new oxField($sName);
 
  938                 $oBasket->oxuserbaskets__oxuserid = 
new oxField($this->
getId());
 
  941                 $oBasket->setIsNewBasket();
 
  944             $this->_aBaskets[$sName] = $oBasket;
 
  947         return $this->_aBaskets[$sName];
 
  962         $iYear = isset($aData[
'year']) ? ((int) $aData[
'year']) : 
false;
 
  963         $iMonth = isset($aData[
'month']) ? ((int) $aData[
'month']) : 
false;
 
  964         $iDay = isset($aData[
'day']) ? ((int) $aData[
'day']) : 
false;
 
  967         if (!$iYear && !$iMonth && !$iDay) {
 
  972         if (!$iYear || $iYear < 1000 || $iYear > 9999) {
 
  977         if (!$iMonth || $iMonth < 1 || $iMonth > 12) {
 
  985                 if ($iMaxDays > 28) {
 
  986                     $iMaxDays = ($iYear % 4 == 0 && ($iYear % 100 != 0 || $iYear % 400 == 0)) ? 29 : 28;
 
  993                 $iMaxDays = min(30, $iMaxDays);
 
  998         if (!$iDay || $iDay < 1 || $iDay > $iMaxDays) {
 
 1003         return sprintf(
"%04d-%02d-%02d", $iYear, $iMonth, $iDay);
 
 1013         if (!$iBoni = $this->
getConfig()->getConfigParam(
'iCreditRating')) {
 
 1036     public function checkValues($sLogin, $sPassword, $sPassword2, $aInvAddress, $aDelAddress)
 
 1042         $sLogin = $oInputValidator->checkLogin($this, $sLogin, $aInvAddress);
 
 1045         $oInputValidator->checkEmail($this, $sLogin, $aInvAddress);
 
 1048         $oInputValidator->checkPassword($this, $sPassword, $sPassword2, ((
int) 
oxRegistry::getConfig()->getRequestParameter(
'option') == 3));
 
 1051         $oInputValidator->checkRequiredFields($this, $aInvAddress, $aDelAddress);
 
 1054         $oInputValidator->checkCountries($this, $aInvAddress, $aDelAddress);
 
 1057         $oInputValidator->checkVatId($this, $aInvAddress);
 
 1061         if ($oError = 
oxRegistry::get(
"oxInputValidator")->getFirstValidationError()) {
 
 1084         if ($oNewsSubscription) {
 
 1085             if ($blSubscribe && ($blForceCheckOptIn || ($iOptInStatus = $oNewsSubscription->getOptInStatus()) != 1)) {
 
 1086                 if (!$blSendOptIn) {
 
 1091                     $oNewsSubscription->setOptInStatus(1);
 
 1096                     if ($iOptInStatus != 2) {
 
 1098                         $oEmail = 
oxNew(
'oxemail');
 
 1099                         $blSuccess = $oEmail->sendNewsletterDbOptInMail($this);
 
 1105                     $oNewsSubscription->setOptInStatus(2);
 
 1107             } elseif (!$blSubscribe) {
 
 1110                 $oNewsSubscription->setOptInStatus(0);
 
 1133     public function changeUserData($sUser, $sPassword, $sPassword2, $aInvAddress, $aDelAddress)
 
 1136         $this->
checkValues($sUser, $sPassword, $sPassword2, $aInvAddress, $aDelAddress);
 
 1139         $this->
assign($aInvAddress);
 
 1146         if ($this->
save()) {
 
 1149             $sCountryId = isset($aInvAddress[
'oxuser__oxcountryid']) ? $aInvAddress[
'oxuser__oxcountryid'] : 
'';
 
 1162         $sDelAddress .= $this->oxuser__oxcompany;
 
 1163         $sDelAddress .= $this->oxuser__oxusername;
 
 1164         $sDelAddress .= $this->oxuser__oxfname;
 
 1165         $sDelAddress .= $this->oxuser__oxlname;
 
 1166         $sDelAddress .= $this->oxuser__oxstreet;
 
 1167         $sDelAddress .= $this->oxuser__oxstreetnr;
 
 1168         $sDelAddress .= $this->oxuser__oxaddinfo;
 
 1169         $sDelAddress .= $this->oxuser__oxustid;
 
 1170         $sDelAddress .= $this->oxuser__oxcity;
 
 1171         $sDelAddress .= $this->oxuser__oxcountryid;
 
 1172         $sDelAddress .= $this->oxuser__oxstateid;
 
 1173         $sDelAddress .= $this->oxuser__oxzip;
 
 1174         $sDelAddress .= $this->oxuser__oxfon;
 
 1175         $sDelAddress .= $this->oxuser__oxfax;
 
 1176         $sDelAddress .= $this->oxuser__oxsal;
 
 1178         return $sDelAddress;
 
 1188         if (is_array($aDelAddress) && count($aDelAddress)) {
 
 1190             $sAddressId = $this->
getConfig()->getRequestParameter(
'oxaddressid');
 
 1191             $sAddressId = ($sAddressId === null || $sAddressId == -1 || $sAddressId == -2) ? null : $sAddressId;
 
 1193             $oAddress = 
oxNew(
'oxaddress');
 
 1194             $oAddress->setId($sAddressId);
 
 1195             $oAddress->load($sAddressId);
 
 1196             $oAddress->assign($aDelAddress);
 
 1198             $oAddress->oxaddress__oxcountry = $this->
getUserCountry($oAddress->oxaddress__oxcountryid->value);
 
 1202             $this->_aAddresses = null;
 
 1230         $sUserSelect = 
"oxuser.oxusername = " . $oDb->quote($sUser);
 
 1231         $sPassSelect = 
" oxuser.oxpassword = BINARY MD5( CONCAT( " . $oDb->quote($sPassword) . 
", UNHEX( oxuser.oxpasssalt ) ) ) ";
 
 1237             $sShopSelect = 
" and ( oxrights != 'user' ) ";
 
 1240         $sSelect = 
"select `oxid` from oxuser where oxuser.oxactive = 1 and {$sPassSelect} and {$sUserSelect} {$sShopSelect} ";
 
 1263         $sUserSelect = 
"oxuser.oxusername = " . $oDb->quote($sUser);
 
 1268             $sShopSelect = 
" and ( oxrights != 'user' ) ";
 
 1271         $sSalt = $oDb->getOne(
"SELECT `oxpasssalt` FROM `oxuser` WHERE  " . $sUserSelect . $sShopSelect);
 
 1273         $sPassSelect = 
" oxuser.oxpassword = " . $oDb->quote($this->
encodePassword($sPassword, $sSalt));
 
 1275         $sSelect = 
"select `oxid` from oxuser where oxuser.oxactive = 1 and {$sPassSelect} and {$sUserSelect} {$sShopSelect} ";
 
 1295             $sShopSelect = 
" and ( oxrights != 'user' ) ";
 
 1298         return $sShopSelect;
 
 1315     public function login($sUser, $sPassword, $blCookie = 
false)
 
 1319             $oEx = 
oxNew(
'oxCookieException');
 
 1320             $oEx->setMessage(
'ERROR_MESSAGE_COOKIE_NOCOOKIE');
 
 1329             $sShopID = $oConfig->getShopId();
 
 1330             $this->
_dbLogin($sUser, $sPassword, $sShopID);
 
 1337         if ($this->oxuser__oxid->value) {
 
 1351             if ($blCookie && $oConfig->getConfigParam(
'blShowRememberMe')) {
 
 1352                 oxRegistry::get(
"oxUtilsServer")->setUserCookie($this->oxuser__oxusername->value, $this->oxuser__oxpassword->value, $oConfig->getShopId(), 31536000, $this->oxuser__oxpasssalt->value);
 
 1358             $oEx = 
oxNew(
'oxUserException');
 
 1359             $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');
 
 1410         $blAdmin = $this->
isAdmin() || $blForceAdmin;
 
 1416         $blFoundInCookie = 
false;
 
 1417         if (!$sUserID && !$blAdmin && $oConfig->getConfigParam(
'blShowRememberMe')) {
 
 1419             $blFoundInCookie = $sUserID ? 
true : 
false;
 
 1423         if (!$sUserID && !$blAdmin && $oConfig->getConfigParam(
"bl_showFbConnect")) {
 
 1429             if ($this->
load($sUserID)) {
 
 1438                 $this->_blLoadedFromCookie = $blFoundInCookie;
 
 1464         if ($oFb->isConnected() && $oFb->getUser()) {
 
 1465             $sUserSelect = 
"oxuser.oxfbid = " . $oDb->quote($oFb->getUser());
 
 1469             $sSelect = 
"select oxid from oxuser where oxuser.oxactive = 1 and {$sUserSelect} {$sShopSelect} ";
 
 1470             $sUserID = $oDb->getOne($sSelect);
 
 1485         $sShopID = $oConfig->getShopId();
 
 1486         if (($sSet = 
oxRegistry::get(
"oxUtilsServer")->getUserCookie($sShopID))) {
 
 1488             $aData = explode(
'@@@', $sSet);
 
 1492             $sSelect = 
'select oxid, oxpassword, oxpasssalt from oxuser where oxuser.oxpassword != "" and  oxuser.oxactive = 1 and oxuser.oxusername = ' . $oDb->quote($sUser);
 
 1494             $rs = $oDb->select($sSelect);
 
 1495             if ($rs != 
false && $rs->recordCount() > 0) {
 
 1497                     $sTest = crypt($rs->fields[1], $rs->fields[2]);
 
 1498                     if ($sTest == $sPWD) {
 
 1500                         $sUserID = $rs->fields[0];
 
 1525     protected function _ldapLogin($sUser, $sPassword, $sShopID, $sShopSelect)
 
 1527         $aLDAPParams = $this->
getConfig()->getConfigParam(
'aLDAPParams');
 
 1528         $oLDAP = 
oxNew(
"oxLDAP", $aLDAPParams[
'HOST'], $aLDAPParams[
'PORT']);
 
 1532         $sLDAPKey = $oDb->getOne(
"select oxldapkey from oxuser where oxuser.oxactive = 1 and oxuser.oxusername = " . $oDb->quote($sUser) . 
" $sShopSelect");
 
 1533         if (isset($sLDAPKey) && $sLDAPKey) {
 
 1538         $oLDAP->login($sUser, $sPassword, $aLDAPParams[
'USERQUERY'], $aLDAPParams[
'BASEDN'], $aLDAPParams[
'FILTER']);
 
 1540         $aData = $oLDAP->mapData($aLDAPParams[
'DATAMAP']);
 
 1541         if (isset($aData[
'OXUSERNAME']) && $aData[
'OXUSERNAME']) {
 
 1545             $sSelect = 
"select oxid from oxuser where oxuser.oxusername = " . $oDb->quote($aData[
'OXUSERNAME']) . 
" $sShopSelect";
 
 1546             $sOXID = $oDb->getOne($sSelect);
 
 1548             if (!isset($sOXID) || !$sOXID) {
 
 1554                 foreach ($aData as $fldname => $value) {
 
 1555                     $sField = 
"oxuser__" . strtolower($fldname);
 
 1556                     $this->$sField = 
new oxField($aData[$fldname]);
 
 1559                 $this->oxuser__oxactive = 
new oxField(1);
 
 1560                 $this->oxuser__oxshopid = 
new oxField($sShopID);
 
 1561                 $this->oxuser__oxldapkey = 
new oxField($sUser);
 
 1562                 $this->oxuser__oxrights = 
new oxField(
"user");
 
 1568                 $this->
load($sOXID);
 
 1572             $oEx = 
oxNew(
'oxUserException');
 
 1573             $oEx->setMessage(
'EXCEPTION_USER_NOVALUES');
 
 1587         if (!$this->oxuser__oxrights->value) {
 
 1593         $sAuthRights = null;
 
 1599             $sAuthRights = $oDb->getOne(
'select oxrights from ' . $this->
getViewName() . 
' where oxid=' . $oDb->quote($sAuthUserID));
 
 1606         if ($sCurrRights = $oDb->getOne(
'select oxrights from ' . $this->getViewName() . 
' where oxid=' . $oDb->quote($this->
getId()))) {
 
 1607             $aRights[] = $sCurrRights;
 
 1609         $aRights[] = 
'user';
 
 1611         if (!$sAuthRights || !($sAuthRights == 
'malladmin' || $sAuthRights == 
$myConfig->getShopId())) {
 
 1612             return current($aRights);
 
 1613         } elseif ($sAuthRights == 
$myConfig->getShopId()) {
 
 1614             $aRights[] = $sAuthRights;
 
 1615             if (!in_array($this->oxuser__oxrights->value, $aRights)) {
 
 1616                 return current($aRights);
 
 1621         return $this->oxuser__oxrights->value;
 
 1635         if (!isset($this->oxuser__oxboni->value)) {
 
 1650         if (!$this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
 
 1651             $this->_aSkipSaveFields[] = 
'oxboni';
 
 1655         $this->_aSkipSaveFields[] = 
'oxcreate';
 
 1657             $this->_aSkipSaveFields[] = 
'oxcustnr';
 
 1658             $this->_aSkipSaveFields[] = 
'oxrights';
 
 1662         if (($blUpdate = parent::_update())) {
 
 1683         $sQ = 
'select oxshopid, oxrights, oxpassword from oxuser where oxusername = ' . $oDb->quote($sEmail);
 
 1684         if (($sOxid = $this->
getId())) {
 
 1685             $sQ .= 
" and oxid <> " . $oDb->quote($sOxid);
 
 1687         $oRs = $oDb->select($sQ, 
false, 
false);
 
 1688         if ($oRs != 
false && $oRs->recordCount() > 0) {
 
 1690             if ($this->_blMallUsers) {
 
 1693                 if ($oRs->fields[1] == 
'user' && !$oRs->fields[2]) {
 
 1701                 while (!$oRs->EOF) {
 
 1702                     if ($oRs->fields[1] != 
'user') {
 
 1707                     } elseif ($oRs->fields[0] == $iShopId && $oRs->fields[2]) {
 
 1732             $sOXID = $this->
getId();
 
 1737         $iActPage = ($iActPage < 0) ? 0 : $iActPage;
 
 1740         $iNrofCatArticles = $this->
getConfig()->getConfigParam(
'iNrofCatArticles');
 
 1741         $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 10;
 
 1744         $oRecommList = 
oxNew(
'oxList');
 
 1745         $oRecommList->init(
'oxrecommlist');
 
 1746         $oRecommList->setSqlLimit($iNrofCatArticles * $iActPage, $iNrofCatArticles);
 
 1747         $iShopId = $this->
getConfig()->getShopId();
 
 1748         $sSelect = 
'select * from oxrecommlists where oxuserid =' . 
oxDb::getDb()->quote($sOXID) . 
' and oxshopid ="' . $iShopId . 
'"';
 
 1749         $oRecommList->selectString($sSelect);
 
 1751         return $oRecommList;
 
 1764             $sOx = $this->
getId();
 
 1767         if ($this->_iCntRecommLists === null || $sOx) {
 
 1769             $this->_iCntRecommLists = 0;
 
 1770             $iShopId = $this->
getConfig()->getShopId();
 
 1771             $sSelect = 
'select count(oxid) from oxrecommlists where oxuserid = ' . $oDb->quote($sOx) . 
' and oxshopid ="' . $iShopId . 
'"';
 
 1772             $this->_iCntRecommLists = $oDb->getOne($sSelect);
 
 1787         $blForeigner = 
true;
 
 1788         $blForeignGroupExists = 
false;
 
 1789         $blInlandGroupExists = 
false;
 
 1791         $aHomeCountry = $this->
getConfig()->getConfigParam(
'aHomeCountry');
 
 1793         if (is_array($aHomeCountry)) {
 
 1794             if (in_array($sCountryId, $aHomeCountry)) {
 
 1795                 $blForeigner = 
false;
 
 1797         } elseif ($sCountryId == $aHomeCountry) {
 
 1798             $blForeigner = 
false;
 
 1801         if ($this->
inGroup(
'oxidforeigncustomer')) {
 
 1802             $blForeignGroupExists = 
true;
 
 1803             if (!$blForeigner) {
 
 1808         if ($this->
inGroup(
'oxidnewcustomer')) {
 
 1809             $blInlandGroupExists = 
true;
 
 1815         if (!$blForeignGroupExists && $blForeigner) {
 
 1818         if (!$blInlandGroupExists && !$blForeigner) {
 
 1835         $sQ = 
"select oxid from " . $this->
getViewName() . 
" where oxupdateexp >= " . time() . 
" and MD5( CONCAT( oxid, oxshopid, oxupdatekey ) ) = " . $oDb->quote($sUid);
 
 1836         if ($sUserId = $oDb->getOne($sQ)) {
 
 1837             return $this->
load($sUserId);
 
 1881         $sQ = 
"select 1 from " . $this->
getViewName() . 
" where oxupdateexp >= " . time() . 
" and MD5( CONCAT( oxid, oxshopid, oxupdatekey ) ) = " . $oDb->quote($sKey);
 
 1883         return !((bool) $oDb->getOne($sQ));
 
 1893         if ($this->_sUpdateKey === null) {
 
 1895             $this->_sUpdateKey = md5($this->
getId() . $this->oxuser__oxshopid->value . $this->oxuser__oxupdatekey->value);
 
 1912         $oSha512Hasher = 
oxNew(
'oxSha512Hasher');
 
 1914         $oHasher = 
oxNew(
'oxPasswordHasher', $oSha512Hasher);
 
 1916         return $oHasher->hash($sPassword, $sSalt);
 
 1931         $oOpenSSLFunctionalityChecker = 
oxNew(
'oxOpenSSLFunctionalityChecker');
 
 1933         $oGenerator = 
oxNew(
'oxPasswordSaltGenerator', $oOpenSSLFunctionalityChecker);
 
 1935         return $oGenerator->generate();
 
 1949         return ($sSaltHex ? 
oxDb::getDb()->getOne(
"select UNHEX( '{$sSaltHex}' )") : 
'');
 
 1960         $oOpenSSLFunctionalityChecker = 
oxNew(
'oxOpenSSLFunctionalityChecker');
 
 1963         $oSaltGenerator = 
oxNew(
'oxPasswordSaltGenerator', $oOpenSSLFunctionalityChecker);
 
 1965         $sSalt = $sPassword ? $oSaltGenerator->generate() : 
'';
 
 1968         $sPassword = $sPassword ? $this->
encodePassword($sPassword, $sSalt) : 
'';
 
 1983         return $this->
encodePassword($sNewPass, $this->oxuser__oxpasssalt->value) == $this->oxuser__oxpassword->value;
 
 2007         if ($this->oxuser__oxpassword->value) {
 
 2008             $sHash = $this->oxuser__oxpassword->value;
 
 2024         $sReviewUserHash = $oDb->getOne(
'select md5(concat("oxid", oxpassword, oxusername )) from oxuser where oxid = ' . $oDb->quote($sUserId) . 
'');
 
 2026         return $sReviewUserHash;
 
 2039         $sUserId = $oDb->getOne(
'select oxid from oxuser where md5(concat("oxid", oxpassword, oxusername )) = ' . $oDb->quote($sReviewUserHash) . 
'');
 
 2063         return $this->oxuser__oxstateid->value;
 
 2077         if (is_null($sId)) {
 
 2081         return $oState->getTitleById($sId);
 
 2092         $sShopId = $this->
getConfig()->getShopId();
 
 2093         $sUserId = $oDb->quote($this->
getId());
 
 2095         return (
bool) $oDb->getOne(
"select 1 from oxacceptedterms where oxuserid={$sUserId} and oxshopid='{$sShopId}'");
 
 2104         $sUserId = $oDb->quote($this->
getId());
 
 2105         $sShopId = $this->
getConfig()->getShopId();
 
 2106         $sVersion = 
oxNew(
"oxcontent")->getTermsVersion();
 
 2108         $oDb->execute(
"replace oxacceptedterms set oxuserid={$sUserId}, oxshopid='{$sShopId}', oxtermversion='{$sVersion}'");
 
 2124         $iPoints = $this->
getConfig()->getConfigParam(
'dPointsForRegistration');
 
 2126         $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);
 
 2127         if ($iPoints && $iPending) {
 
 2129             if ($blSet = $this->
save()) {
 
 2131                 $oDb->execute(
"UPDATE oxinvitations SET oxpending = '0', oxaccepted = '1' where oxuserid = " . $oDb->quote($sUserId) . 
" and md5(oxemail) = " . $oDb->quote($sRecEmail));
 
 2132                 $oInvUser = 
oxNew(
"oxuser");
 
 2133                 if ($oInvUser->load($sUserId)) {
 
 2134                     $blSet = $oInvUser->setCreditPointsForInviter();
 
 2152         $iPoints = $this->
getConfig()->getConfigParam(
'dPointsForInvitation');
 
 2154             $iNewPoints = $this->oxuser__oxpoints->value + $iPoints;
 
 2156             $blSet = $this->
save();
 
 2172         if ($oFb->isConnected() && $oFb->getUser()) {
 
 2173             $this->oxuser__oxfbid = 
new oxField($oFb->getUser());
 
 2174             $blRet = $this->
save();
 
 2188         $sUserId = $this->
getId();
 
 2190         if ($sUserId && is_array($aRecEmail) && count($aRecEmail) > 0) {
 
 2192             $sDate = 
oxRegistry::get(
"oxUtilsDate")->formatDBDate(date(
"Y-m-d"), 
true);
 
 2194             foreach ($aRecEmail as $sRecEmail) {
 
 2195                 $sSql = 
"INSERT INTO oxinvitations SET oxuserid = " . $oDb->quote($sUserId) . 
", oxemail = $sRecEmail,  oxdate='$sDate', oxpending = '1', oxaccepted = '0', oxtype = '1' ";
 
 2196                 $oDb->execute($sSql);
 
 2211         $sQ = 
"SELECT `oxid` FROM `oxuser` WHERE `oxusername` = " . $oDb->quote($sUserName);
 
 2212         if (!$this->
getConfig()->getConfigParam(
'blMallUsers')) {
 
 2216         return $oDb->getOne($sQ);
 
 2227         return (
bool) $this->oxuser__oxpassword->value;
 
 2237         return (
bool) $this->
getConfig()->getConfigParam(
'blShowNetPrice');
 
 2249     protected function _dbLogin($sUser, $sPassword, $sShopID)
 
 2265             if (!$this->
load($sUserOxId)) {
 
 2267                 $oEx = 
oxNew(
'oxUserException');
 
 2268                 $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');
 
 2270             } elseif ($blOldHash && $this->
getId()) {
 
 2284         $blDemoMode = 
false;
 
 2305         if ($sPassword == 
"admin" && $sUser == 
"admin") {
 
 2306             $sSelect = 
"SELECT `oxid` FROM `oxuser` WHERE `oxrights` = 'malladmin' ";
 
 2309             $oEx = 
oxNew(
'oxUserException');
 
 2310             $oEx->setMessage(
'ERROR_MESSAGE_USER_NOVALIDLOGIN');