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')); }