Fisheye: Tag 8729 refers to a dead (removed) revision in file `trunk/themes/default2007/platform/mailing_list/unsubscribe_error.tpl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: trunk/themes/default2007/platform/mailing_list/subscribe.tpl
===================================================================
diff -u -r8714 -r8729
--- trunk/themes/default2007/platform/mailing_list/subscribe.tpl (.../subscribe.tpl) (revision 8714)
+++ trunk/themes/default2007/platform/mailing_list/subscribe.tpl (.../subscribe.tpl) (revision 8729)
@@ -1,33 +1,29 @@
-
-
-
-
+
-
+
+
-
-
+
\ No newline at end of file
Index: trunk/themes/default2007/platform/mailing_list/unsubscribe_ok.tpl
===================================================================
diff -u -r8714 -r8729
--- trunk/themes/default2007/platform/mailing_list/unsubscribe_ok.tpl (.../unsubscribe_ok.tpl) (revision 8714)
+++ trunk/themes/default2007/platform/mailing_list/unsubscribe_ok.tpl (.../unsubscribe_ok.tpl) (revision 8729)
@@ -1,13 +1,10 @@
-
-
-
@@ -19,16 +16,10 @@
-
- " onClick="window.location.href=''" />
+
+ " onClick="window.location.href=''" />
-
-
-
-
-
-
-
+
\ No newline at end of file
Index: trunk/core/units/users/users_event_handler.php
===================================================================
diff -u -r8620 -r8729
--- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 8620)
+++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 8729)
@@ -692,16 +692,23 @@
$event->redirect = false;
}
+ /**
+ * Validate subscriber's email & store it to session -> redirect to confirmation template
+ *
+ * @param kEvent $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) ){
+ if (preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $user_email)) {
- $object = &$this->Application->recallObject($this->Prefix.'.subscriber', null, Array('skip_autoload' => true));
+ $object =& $this->Application->recallObject($this->Prefix.'.subscriber', null, Array('skip_autoload' => true));
+ /* @var $object UsersItem */
$this->Application->StoreVar('SubscriberEmail', $user_email);
- if( $object->Load(array('Email'=>$user_email)) ){
+ $object->Load($user_email, 'Email');
+ if ($object->isLoaded()) {
$group_info = $this->GetGroupInfo($object->GetID());
$event->redirect = $this->Application->GetVar($group_info ? 'unsubscribe_template' : 'subscribe_template');
}
@@ -717,19 +724,24 @@
$object->FieldErrors['SubscribeEmail']['pseudo'] = 'invalid_email';
$event->status = erFAIL;
}
- //subscribe_query_ok_template
}
- function OnSubscribeUser(&$event){
-
+ /**
+ * Subscribe/Unsubscribe user based on email stored in previous step
+ *
+ * @param kEvent $event
+ */
+ function OnSubscribeUser(&$event)
+ {
$object = &$this->Application->recallObject($this->Prefix.'.subscriber', null, Array('skip_autoload' => true));
+ /* @var $object UsersItem */
$user_email = $this->Application->RecallVar('SubscriberEmail');
-
- if (preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $user_email)){
+ if (preg_match("/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/", $user_email)) {
$this->RemoveRequiredFields($object);
- if($object->Load(array('Email'=>$user_email))){
+ $object->Load($user_email, 'Email');
+ if ($object->isLoaded()) {
$group_info = $this->GetGroupInfo($object->GetID());
if ($group_info){
@@ -744,17 +756,13 @@
}
$event->redirect = $this->Application->GetVar('unsubscribe_ok_template');
-
}
else {
$this->AddSubscriberGroup($object->GetID(), 0);
$event->redirect = $this->Application->GetVar('subscribe_ok_template');
}
-
-
}
else {
-
$object->SetField('Email', $user_email);
$object->SetField('Login', $user_email);
$object->SetDBField('dob', 1);
@@ -766,20 +774,13 @@
$this->Application->SetVar('IsSubscriber', 1);
if ($object->Create()) {
-
$this->AddSubscriberGroup($object->GetID(), 1);
$event->redirect = $this->Application->GetVar('subscribe_ok_template');
}
$this->Application->SetVar('IsSubscriber', 0);
}
}
- else {
- // error handling here
- $event->redirect = $this->Application->GetVar('subscribe_fail_template');
- }
-
-
}
function AddSubscriberGroup($user_id, $is_primary){
@@ -802,13 +803,18 @@
}
- function GetGroupInfo($user_id){
-
- $group_info = $this->Conn->GetRow('SELECT * FROM '.TABLE_PREFIX.'UserGroup
- WHERE PortalUserId='.$user_id.'
- AND GroupId='.$this->Application->ConfigValue('User_SubscriberGroup'));
- return $group_info;
-
+ /**
+ * Allows to detect user subscription status (subscribed or not)
+ *
+ * @param int $user_id
+ * @return bool
+ */
+ function GetGroupInfo($user_id)
+ {
+ $sql = 'SELECT *
+ FROM '.TABLE_PREFIX.'UserGroup
+ WHERE (PortalUserId = '.$user_id.') AND (GroupId = '.$this->Application->ConfigValue('User_SubscriberGroup').')';
+ return $this->Conn->GetRow($sql);
}
function OnForgotPassword(&$event)
Index: trunk/themes/default2007/platform/mailing_list/unsubscribe.tpl
===================================================================
diff -u -r8714 -r8729
--- trunk/themes/default2007/platform/mailing_list/unsubscribe.tpl (.../unsubscribe.tpl) (revision 8714)
+++ trunk/themes/default2007/platform/mailing_list/unsubscribe.tpl (.../unsubscribe.tpl) (revision 8729)
@@ -1,34 +1,29 @@
-
-
-
-
+
-
+
+
-
-
-
+
\ No newline at end of file
Index: trunk/themes/default2007/phrases_edit.tpl
===================================================================
diff -u -r8693 -r8729
--- trunk/themes/default2007/phrases_edit.tpl (.../phrases_edit.tpl) (revision 8693)
+++ trunk/themes/default2007/phrases_edit.tpl (.../phrases_edit.tpl) (revision 8729)
@@ -16,25 +16,38 @@
+ *
+
-
+
- *