Skip to content

Commit

Permalink
Merge pull request #2190 from PaulBender/fix-2183
Browse files Browse the repository at this point in the history
Fixes #2183 subscriptionkey unnececary?
  • Loading branch information
Destroy666x committed Feb 13, 2016
2 parents 47367b5 + 59fcc79 commit 8fd7fed
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions inc/datahandlers/post.php
Expand Up @@ -1123,7 +1123,7 @@ function insert_post()

// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices
$query = $db->query("
SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.subscriptionkey, s.notification
SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.notification
FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
WHERE (s.notification='1' OR s.notification='2') AND s.tid='{$post['tid']}'
Expand Down Expand Up @@ -1205,7 +1205,7 @@ function insert_post()
$emailsubject = $lang->sprintf($emailsubject, $subject);

$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);
$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $post_code);
$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',
Expand All @@ -1222,7 +1222,7 @@ function insert_post()
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$pm = array(
'subject' => array('pmsubject_subscription', $subject),
'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code),
'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $post_code),
'touid' => $subscribedmember['uid'],
'language' => $subscribedmember['language'],
'language_file' => 'messages'
Expand Down
4 changes: 1 addition & 3 deletions inc/functions_user.php
Expand Up @@ -268,9 +268,7 @@ function add_subscribed_thread($tid, $notification=1, $uid=0)
'uid' => (int)$uid,
'tid' => (int)$tid,
'notification' => (int)$notification,
'dateline' => TIME_NOW,
'subscriptionkey' => md5(TIME_NOW.$uid.$tid)

'dateline' => TIME_NOW
);
$db->insert_query("threadsubscriptions", $insert_array);
}
Expand Down
4 changes: 2 additions & 2 deletions inc/languages/english/messages.lang.php
Expand Up @@ -346,7 +346,7 @@
Unsubscription Information:
If you would not like to receive any more notifications of replies to this thread, visit the following URL in your browser:
{6}/usercp2.php?action=removesubscription&tid={8}&key={9}&my_post_key={10}
{6}/usercp2.php?action=removesubscription&tid={8}&my_post_key={9}
------------------------------------------";
$l['email_reachedpmquota'] = "{1},
Expand Down Expand Up @@ -491,7 +491,7 @@
Unsubscription Information:
If you would not like to receive any more notifications of replies to this thread, visit the following URL in your browser:
[url]{5}/usercp2.php?action=removesubscription&tid={7}&key={8}&my_post_key={9}[/url]
[url]{5}/usercp2.php?action=removesubscription&tid={7}&my_post_key={8}[/url]
------------------------------------------";

Expand Down
1 change: 0 additions & 1 deletion install/resources/mysql_db_tables.php
Expand Up @@ -924,7 +924,6 @@
tid int unsigned NOT NULL default '0',
notification tinyint(1) NOT NULL default '0',
dateline int unsigned NOT NULL default '0',
subscriptionkey varchar(32) NOT NULL default '',
KEY uid (uid),
KEY tid (tid, notification),
PRIMARY KEY (sid)
Expand Down
1 change: 0 additions & 1 deletion install/resources/pgsql_db_tables.php
Expand Up @@ -878,7 +878,6 @@
tid int NOT NULL default '0',
notification smallint NOT NULL default '0',
dateline int NOT NULL default '0',
subscriptionkey varchar(32) NOT NULL default '',
PRIMARY KEY (sid)
);";

Expand Down
3 changes: 1 addition & 2 deletions install/resources/sqlite_db_tables.php
Expand Up @@ -813,8 +813,7 @@
uid int NOT NULL default '0',
tid int NOT NULL default '0',
notification tinyint(1) NOT NULL default '0',
dateline int NOT NULL default '0',
subscriptionkey varchar(32) NOT NULL default ''
dateline int NOT NULL default '0'
);";

$tables[] = "CREATE TABLE mybb_userfields (
Expand Down
5 changes: 5 additions & 0 deletions install/resources/upgrade35.php
Expand Up @@ -28,6 +28,11 @@ function upgrade35_dbchanges()
echo "<p>Performing necessary upgrade queries...</p>";
flush();

if($db->field_exists('subscriptionkey', 'threadsubscriptions'))
{
$db->drop_column("threadsubscriptions", "subscriptionkey");
}

if($db->type != 'pgsql')
{
$db->modify_column('adminsessions', 'useragent', "varchar(200) NOT NULL default ''");
Expand Down

0 comments on commit 8fd7fed

Please sign in to comment.