Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications #988

Merged
merged 2 commits into from
Nov 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions sources/controllers/Emailpost.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@ function pbe_create_post($pbe, $email_message, $topic_info)
// Notify members who have notification turned on for this,
// but only if it's going to be approved
if ($becomesApproved)
{
require_once(SUBSDIR . '/Notification.subs.php');
sendNotifications($topic_info['id_topic'], 'reply', array(), array(), $pbe);
}

return true;
}
Expand Down Expand Up @@ -576,7 +579,10 @@ function pbe_create_topic($pbe, $email_message, $board_info)

// Notify members who have notification turned on for this, (if it's approved)
if ($becomesApproved)
{
require_once(SUBSDIR . '/Notification.subs.php');
sendNotifications($topicOptions['id'], 'reply', array(), array(), $pbe);
}

// Update this users info so the log shows them as active
query_update_member_stats($pbe, $email_message, $topicOptions);
Expand Down
6 changes: 3 additions & 3 deletions sources/controllers/MergeTopics.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ public function action_mergeIndex()
*/
public function action_mergeExecute($topics = array())
{
global $user_info, $txt, $context, $scripturl;
global $language, $modSettings;
global $user_info, $txt, $context, $scripturl, $language, $modSettings;

$db = database();

Expand Down Expand Up @@ -486,9 +485,9 @@ public function action_mergeExecute($topics = array())
}

$enforce_subject = isset($_POST['enforce_subject']) ? Util::htmlspecialchars(trim($_POST['enforce_subject'])): '';

// Merge topic notifications.
$notifications = isset($_POST['notifications']) && is_array($_POST['notifications']) ? array_intersect($topics, $_POST['notifications']) : array();

fixMergedTopics($first_msg, $topics, $id_topic, $target_board, $target_subject, $enforce_subject, $notifications);

// Asssign the properties of the newly merged topic.
Expand Down Expand Up @@ -546,6 +545,7 @@ public function action_mergeExecute($topics = array())
logAction('merge', array('topic' => $id_topic, 'board' => $id_board));

// Notify people that these topics have been merged?
require_once(SUBSDIR . '/Notification.subs.php');
sendNotifications($id_topic, 'merge');

// If there's a search index that needs updating, update it...
Expand Down
2 changes: 1 addition & 1 deletion sources/controllers/MessageIndex.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ public function action_quickmod()

// This is going to be needed to send off the notifications and for updateLastMessages().
require_once(SUBSDIR . '/Post.subs.php');
require_once(SUBSDIR . '/Notification.subs.php');

// Process process process data.
require_once(SUBSDIR . '/Topic.subs.php');
Expand Down Expand Up @@ -991,7 +992,6 @@ public function action_quickmod()

if (!empty($markCache))
{
require_once(SUBSDIR . '/Topic.subs.php');
$logged_topics = getLoggedTopics($user_info['id'], $markCache);

$markArray = array();
Expand Down
1 change: 1 addition & 0 deletions sources/controllers/MoveTopic.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public function action_movetopic2()
logAction('move', array('topic' => $topic, 'board_from' => $board, 'board_to' => $toboard));

// Notify people that this topic has been moved?
require_once(SUBSDIR . '/Notification.subs.php');
sendNotifications($topic, 'move');

// Why not go back to the original board in case they want to keep moving?
Expand Down
3 changes: 2 additions & 1 deletion sources/controllers/Post.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ function action_post2()
// Notify any members who have notification turned on for this topic/board - only do this if it's going to be approved(!)
if ($becomesApproved)
{
require_once(SUBSDIR . '/Notification.subs.php');
if ($newTopic)
{
$notifyData = array(
Expand All @@ -1749,7 +1750,7 @@ function action_post2()
'topic' => $topic,
'signature' => (isset($user_settings['signature']) ? $user_settings['signature'] : ''),
);
notifyMembersBoard($notifyData);
sendBoardNotifications($notifyData);
}
elseif (empty($_REQUEST['msg']))
{
Expand Down
5 changes: 2 additions & 3 deletions sources/controllers/Register.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,8 @@ function action_activate()

if (!isset($_POST['new_email']))
{
require_once(SUBSDIR . '/Post.subs.php');

adminNotify('activation', $row['id_member'], $row['member_name']);
require_once(SUBSDIR . '/Notification.subs.php');
sendAdminNotifications('activation', $row['id_member'], $row['member_name']);
}

$context += array(
Expand Down
2 changes: 1 addition & 1 deletion sources/controllers/RemoveTopic.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function action_removetopic2()
checkSession('get');

// This file needs to be included for sendNotifications().
require_once(SUBSDIR . '/Post.subs.php');
require_once(SUBSDIR . '/Notification.subs.php');

// This needs to be included for all the topic db functions
require_once(SUBSDIR . '/Topic.subs.php');
Expand Down
2 changes: 1 addition & 1 deletion sources/controllers/SplitTopics.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function action_splittopics()
if (empty($topic))
fatal_lang_error('numbers_one_to_nine', false);

// Load up the "dependencies" - the template, getMsgMemberID(), and sendNotifications().
// Load up the "dependencies" - the template, getMsgMemberID().
if (!isset($_REQUEST['xml']))
loadTemplate('SplitTopics');

Expand Down
9 changes: 5 additions & 4 deletions sources/controllers/Topic.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function action_lock()

checkSession('get');

// Get subs/Post.subs.php for sendNotifications.
require_once(SUBSDIR . '/Post.subs.php');
// Load up the helpers
require_once(SUBSDIR . '/Notification.subs.php');
require_once(SUBSDIR . '/Topic.subs.php');

// Find out who started the topic and its lock status
Expand Down Expand Up @@ -129,8 +129,9 @@ public function action_sticky()

checkSession('get');

// We need subs/Post.subs.php for the sendNotifications() function.
require_once(SUBSDIR . '/Post.subs.php');
// We need this for the sendNotifications() function.
require_once(SUBSDIR . '/Notification.subs.php');

// And Topic subs for topic attributes.
require_once(SUBSDIR . '/Topic.subs.php');

Expand Down
8 changes: 4 additions & 4 deletions sources/subs/Members.subs.php
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ function registerMember(&$regOptions, $error_context = 'register')
}

// Send admin their notification.
require_once(SUBSDIR . '/Post.subs.php');
adminNotify('standard', $memberID, $regOptions['username']);
require_once(SUBSDIR . '/Notification.subs.php');
sendAdminNotifications('standard', $memberID, $regOptions['username']);
}
// Need to activate their account - or fall under COPPA.
elseif ($regOptions['require'] == 'activation' || $regOptions['require'] == 'coppa')
Expand Down Expand Up @@ -832,8 +832,8 @@ function registerMember(&$regOptions, $error_context = 'register')
sendmail($regOptions['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 0);

// Admin gets informed here...
require_once(SUBSDIR . '/Post.subs.php');
adminNotify('approval', $memberID, $regOptions['username']);
require_once(SUBSDIR . '/Notification.subs.php');
sendAdminNotifications('approval', $memberID, $regOptions['username']);
}

// Okay, they're for sure registered... make sure the session is aware of this for security. (Just married :P!)
Expand Down