Index: branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php =================================================================== diff -u -r6794 -r6842 --- branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6794) +++ branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6842) @@ -41,7 +41,7 @@ } if (!$this->Application->IsAdmin()) { - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); if ($event->Name == 'OnCreate' && $user_id == -2) { @@ -104,7 +104,8 @@ */ function OnLogin(&$event) { - $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); + $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme + $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true)); $password = $this->Application->GetVar('password'); if(!$password) @@ -136,7 +137,7 @@ $session =& $this->Application->recallObject('Session'); $session->SetField('PortalUserId', $user_id); // $session->SetField('GroupList', implode(',', $groups) ); - $this->Application->SetVar('u_id', $user_id); + $this->Application->SetVar('u.current_id', $user_id); $this->Application->StoreVar('user_id', $user_id); $this->processLoginRedirect($event, $password); @@ -167,7 +168,7 @@ $session =& $this->Application->recallObject('Session'); $session->SetField('PortalUserId', $user_id); $session->SetField('GroupList', implode(',', $groups) ); - $this->Application->SetVar('u_id', $user_id); + $this->Application->SetVar('u.current_id', $user_id); $this->Application->StoreVar('user_id', $user_id); $this->Application->setVisitField('PortalUserId', $user_id); @@ -290,9 +291,9 @@ $session =& $this->Application->recallObject('Session'); $session->SetField('PortalUserId', -2); - $this->Application->SetVar('u_id', -2); + $this->Application->SetVar('u.current_id', -2); $this->Application->StoreVar('user_id', -2); - $object =& $this->Application->recallObject('u'); + $object =& $this->Application->recallObject('u.current', null, Array('skip_autoload' => true)); $object->Load(-2); $this->Application->DestroySession(); @@ -355,7 +356,7 @@ function autoLoginUser(&$event) { $object =& $event->getObject(); - $this->Application->SetVar('u_id', $object->GetID() ); + $this->Application->SetVar('u.current_id', $object->GetID() ); if($object->GetDBField('Status') == STATUS_ACTIVE && !$this->Application->ConfigValue('User_Password_Auto')) { @@ -458,7 +459,7 @@ parent::OnCreate($event); - $this->Application->SetVar('u_id', $object->getID() ); + $this->Application->SetVar('u.current_id', $object->getID() ); // for affil:OnRegisterAffiliate after hook $this->setNextTemplate($event); @@ -552,14 +553,16 @@ $friend_email = $this->Application->GetVar('friend_email'); $friend_name = $this->Application->GetVar('friend_email'); + // used for error reporting only -> rewrite code + theme (by Alex) + $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too + if (preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $friend_email)) { - $send_params = array(); $send_params['to_email']=$friend_email; $send_params['to_name']=$friend_name; - $user_id = $this->Application->GetVar('u_id'); + $user_id = $this->Application->RecallVar('user_id'); $email_event = &$this->Application->EmailEventUser('SITE.SUGGEST', $user_id, $send_params); if ($email_event->status == erSUCCESS){ @@ -569,21 +572,17 @@ else { // $event->redirect_params = array('opener' => 's', 'pass' => 'all'); // $event->redirect = $this->Application->GetVar('template_fail'); - $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['send_error'] = $this->Application->Phrase('lu_email_send_error'); $object->FieldErrors['Email']['pseudo'] = 'send_error'; $event->status = erFAIL; - } } else { - $object =& $this->Application->recallObject('u'); $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); $object->FieldErrors['Email']['pseudo'] = 'invalid_email'; $event->status = erFAIL; } - - } /** @@ -608,8 +607,8 @@ $event->redirect = false; } - function OnSubscribeQuery(&$event){ - + function OnSubscribeQuery(&$event) + { $user_email = $this->Application->GetVar('subscriber_email'); if ( preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $user_email) ){ @@ -619,29 +618,20 @@ if( $object->Load(array('Email'=>$user_email)) ){ $group_info = $this->GetGroupInfo($object->GetID()); - if($group_info){ - $event->redirect = $this->Application->GetVar('unsubscribe_template'); - } - else { - $event->redirect = $this->Application->GetVar('subscribe_template'); - } + $event->redirect = $this->Application->GetVar($group_info ? 'unsubscribe_template' : 'subscribe_template'); } else { $event->redirect = $this->Application->GetVar('subscribe_template'); $this->Application->StoreVar('SubscriberEmail', $user_email); } - } else { - - $object =& $this->Application->recallObject('u'); + // used for error reporting only -> rewrite code + theme (by Alex) + $object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); $object->FieldErrors['SubscribeEmail']['pseudo'] = 'invalid_email'; $event->status = erFAIL; - } - - //subscribe_query_ok_template } @@ -736,10 +726,12 @@ } - function OnForgotPassword(&$event){ - + function OnForgotPassword(&$event) + { $user_object = &$this->Application->recallObject('u.forgot', null, Array('skip_autoload' => true)); - $user_current_object = &$this->Application->recallObject('u'); + + // used for error reporting only -> rewrite code + theme (by Alex) + $user_current_object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too $username = $this->Application->GetVar('username'); $email = $this->Application->GetVar('email'); @@ -843,12 +835,14 @@ } - function OnResetPasswordConfirmed(&$event){ - + function OnResetPasswordConfirmed(&$event) + { $passed_key = $this->Application->GetVar('user_key'); $user_object = &$this->Application->recallObject('u.forgot'); - $user_current_object = &$this->Application->recallObject('u'); + + // used for error reporting only -> rewrite code + theme (by Alex) + $user_current_object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true));// TODO: change theme too if (strlen(trim($passed_key)) == 0) { $event->redirect_params = array('opener' => 's', 'pass' => 'all');