Created
November 5, 2012 16:21
-
-
Save KANekT/4018083 to your computer and use it in GitHub Desktop.
PunBB Sub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get any subscribed users that should be notified (banned users are excluded) | |
$query = array( | |
'SELECT' => 'u.id, u.email, u.notify_with_post, u.language, u.username', | |
'FROM' => 'users AS u', | |
'JOINS' => array( | |
array( | |
'INNER JOIN' => 'subscriptions AS s', | |
'ON' => 'u.id=s.user_id' | |
), | |
array( | |
'LEFT JOIN' => 'forum_perms AS fp', | |
'ON' => '(fp.forum_id='.$post_info['forum_id'].' AND fp.group_id=u.group_id)' | |
), | |
array( | |
'LEFT JOIN' => 'online AS o', | |
'ON' => 'u.id=o.user_id' | |
) | |
), | |
'WHERE' => 'COALESCE(o.logged, u.last_visit)>'.$previous_post_time.' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id='.$post_info['topic_id'].' AND u.id!='.$post_info['poster_id'] | |
); | |
($hook = get_hook('fn_send_subscriptions_qr_get_users_to_notify')) ? eval($hook) : null; | |
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | |
// Load cached bans | |
if (file_exists(FORUM_CACHE_DIR.'cache_bans.php')) | |
include FORUM_CACHE_DIR.'cache_bans.php'; | |
if (!defined('FORUM_BANS_LOADED')) | |
{ | |
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) | |
require FORUM_ROOT.'include/cache.php'; | |
generate_bans_cache(); | |
require FORUM_CACHE_DIR.'cache_bans.php'; | |
} | |
$subscribers = array(); | |
while ($row = $forum_db->fetch_assoc($result)) | |
{ | |
if(in_array($row['username'],$forum_bans,false)) | |
$subscribers[] = $row; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment