function ENotifyUpdateUnreadReplies() { global $context, $smcFunc; // We load up Recent.php, and get the unread replies require_once 'Recent.php'; UnreadTopics(); // Make sure that there are replies and insert them into ENotify table if (!empty($context['topics'])) { foreach ($context['topics'] as $topic) { // This is our query we use ignore to make sure we don't get an error if the record exists (unique field defined to avoid the extra select query) $smcFunc['db_insert']('ignore', '{db_prefix}log_enotify_replies', array('enot_item_id' => 'int', 'enot_title' => 'string-255', 'enot_time' => 'int', 'enot_link' => 'text', 'enot_sender' => 'string-255', 'enot_sender_link' => 'text', 'id_member' => 'int'), array($topic['last_post']['id'], $topic['last_post']['subject'], $topic['last_post']['timestamp'], $topic['last_post']['href'], $topic['last_post']['member']['name'], $topic['last_post']['member']['href'], $context['user']['id']), array('id_enot')); } } }
function ENotifyUpdateUnreadReplies() { global $context, $db_prefix, $ID_MEMBER; // We load up Recent.php, and get the unread replies require_once 'Recent.php'; UnreadTopics(); // Make sure that there are replies and insert them into ENotify table if (!empty($context['topics'])) { foreach ($context['topics'] as $topic) { // This is our query we use ignore to make sure we don't get an error if the record exists (unique field defined to avoid the extra select query) db_query("INSERT IGNORE INTO {$db_prefix}log_enotify_replies\n\t\t(enot_item_id,enot_title,enot_time,enot_link,enot_sender,enot_sender_link,id_member)\n\t\tVALUES\n\t\t('" . $topic['last_post']['id'] . "','" . htmlspecialchars($topic['last_post']['subject'], ENT_QUOTES) . "','" . $topic['last_post']['timestamp'] . "','" . $topic['last_post']['href'] . "','" . $topic['last_post']['member']['name'] . "','" . $topic['last_post']['member']['href'] . "','" . $ID_MEMBER . "')\n\t\t\n\t\t", __FILE__, __LINE__); } } }
function method_get_unread_topic() { global $forum_root, $context, $modSettings; include_once $forum_root . '/Sources/Recent.php'; // Star/end if (isset($context['mob_request']['params'][0])) { $start_num = (int) $context['mob_request']['params'][0][0]; } if (isset($context['mob_request']['params'][1])) { $last_num = (int) $context['mob_request']['params'][1][0]; } list($_REQUEST['start'], $modSettings['defaultMaxTopics']) = process_page($start_num, $last_num); $_REQUEST['action'] = 'unread'; UnreadTopics(); $stids = get_subscribed_tids(); $uids = array(); if (!empty($context['topics'])) { foreach ($context['topics'] as $tid => $topic) { $context['topics'][$tid]['is_marked_notify'] = in_array($tid, $stids); $uids[] = $topic['last_post']['member']['id']; } } if (!empty($uids)) { $avatars = get_avatar_by_ids($uids); foreach ($context['topics'] as $tid => $topic) { $context['topics'][$tid]['last_post']['member']['avatar'] = $avatars[$topic['last_post']['member']['id']]; } } outputRPCSubscribedTopics($context['topics'], $context['num_topics']); }
function mob_get_unread_topic($rpcmsg) { global $mobdb, $scripturl, $user_info, $modSettings, $sourcedir, $context; if ($user_ino['is_guest']) { mob_error('guests not allowed'); } $start = $rpcmsg->getParam(0) ? $rpcmsg->getScalarValParam(0) : 0; $end = $rpcmsg->getParam(1) ? $rpcmsg->getScalarValParam(1) : $start + 20; $count = $end - $start > 50 ? 50 : $end - $start; require_once $sourcedir . '/Recent.php'; $_REQUEST['action'] = 'unread'; $_REQUEST['all'] = true; $_REQUEST['start'] = $start; $modSettings['defaultMaxTopics'] = $count; UnreadTopics(); $stids = get_subscribed_tids(); $uids = array(); if (!empty($context['topics'])) { foreach ($context['topics'] as $tid => $topic) { $context['topics'][$tid]['is_notify'] = in_array($tid, $stids); $uids[] = $topic['last_post']['member']['id']; } } if (!empty($uids)) { $avatars = get_avatar_by_ids($uids); foreach ($context['topics'] as $tid => $topic) { $context['topics'][$tid]['new'] = true; $context['topics'][$tid]['last_post']['member']['avatar']['href'] = $avatars[$topic['last_post']['member']['id']]; } } return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'total_topic_num' => new xmlrpcval($context['num_topics'], 'int'), 'topics' => new xmlrpcval(get_topics_xmlrpc($context['topics'], false), 'array')), 'struct')); }