} $hostname = htmlspecialchars_uni(gethostbyaddr($ipaddress)); ($hook = vBulletinHook::fetch_hook('blog_viewip_complete')) ? eval($hook) : false; standard_error(fetch_error('thread_displayip', $ipaddress, $hostname, '', 0)); } // ####################################################################### if ($_REQUEST['do'] == 'markread') { $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT, 'readhash' => TYPE_STR)); // verify the userid exists, don't want useless entries in our table. if (!($userinfo = fetch_userinfo($vbulletin->GPC['userid']))) { standard_error(fetch_error('invalidid', $vbphrase['user'], $vbulletin->options['contactuslink'])); } if ($vbulletin->userinfo['userid'] != 0 and !verify_security_token($vbulletin->GPC['readhash'], $vbulletin->userinfo['securitytoken_raw'])) { standard_error(fetch_error('blog_markread_error', $vbulletin->session->vars['sessionurl'], $userinfo['userid'], $vbulletin->userinfo['logouthash'], $userinfo['username'])); } mark_user_blog_read($userinfo['userid'], $vbulletin->userinfo['userid'], TIMENOW); require_once DIR . '/includes/functions_login.php'; $vbulletin->url = fetch_replaced_session_url($vbulletin->url); if (strpos($vbulletin->url, 'do=markread') !== false) { $vbulletin->url = fetch_seo_url('blog', $userinfo, null, 'userid', 'blog_title'); } eval(print_standard_redirect('blog_markread', true, true)); } // ############################################################################ // ############################### GROUP MEMBERS ########################## // ############################################################################ if ($_REQUEST['do'] == 'members') { $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT)); $userinfo = verify_id('user', $vbulletin->GPC['userid'], true, true); cache_permissions($userinfo, false); if ($vbulletin->userinfo['userid'] != $userinfo['userid'] and !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers']) or $vbulletin->userinfo['userid'] == $userinfo['userid'] and !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']) or !($userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canhavegroupblog']) or !$userinfo['memberids']) {
/** * Marks a blog as read using the appropriate method. * * @param array Array of data for the blog being marked * @param integer User ID this thread is being marked read for * @param integer Unix timestamp that the thread is being marked read * * @return void */ function mark_blog_read(&$bloginfo, $userid, $time) { global $vbulletin, $db; $userid = intval($userid); $time = intval($time); if ($vbulletin->options['threadmarking'] AND $userid) { // can't be shutdown as we do a read query below on this table $db->query_write(" REPLACE INTO " . TABLE_PREFIX . "blog_read (userid, blogid, readtime) VALUES ($userid, $bloginfo[blogid], $time) "); } else { set_bbarray_cookie('blog_lastview', $bloginfo['blogid'], $time); } // now if applicable search to see if this was the last entry requiring marking in this blog if ($vbulletin->options['threadmarking'] == 2 AND $userid) { $privatecheck = ''; if (!can_moderate_blog() AND $userid != $bloginfo['userid'] AND !$bloginfo['buddyid']) { $privatecheck = "AND ~blog.options & " . $vbulletin->bf_misc_vbblogoptions['private']; } $cutoff = TIMENOW - ($vbulletin->options['markinglimit'] * 86400); $unread = $db->query_first(" SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "blog AS blog LEFT JOIN " . TABLE_PREFIX . "blog_read AS blog_read ON (blog_read.blogid = blog.blogid AND blog_read.userid = $userid) LEFT JOIN " . TABLE_PREFIX . "blog_userread AS blog_userread ON (blog_userread.bloguserid = blog.userid AND blog_userread.userid = $userid) WHERE blog.userid = $bloginfo[userid] AND blog.state = 'visible' $privatecheck AND blog.lastcomment > IF(blog_read.readtime IS NULL, $cutoff, blog_read.readtime) AND blog.lastcomment > IF(blog_userread.readtime IS NULL, $cutoff, blog_userread.readtime) AND blog.lastcomment > $cutoff "); if ($unread['count'] == 0) { mark_user_blog_read($bloginfo['userid'], $userid, TIMENOW); } } }