public static function setWatching(GWF_ForumThread $thread, $cut) { $tid = $thread->getID(); # Insert current spectator // GDO::table(__CLASS__); $row = new self(array('fowa_sess' => GWF_Session::getSessID(), 'fowa_time' => time(), 'fowa_tid' => $tid)); if (false === $row->replace()) { return false; } # Delete old $cut = time() - $cut; if (false === $row->deleteWhere("fowa_time<{$cut}")) { return false; } # Set new amount if (false === $thread->saveVar('thread_watchers', $row->countRows("fowa_tid={$tid}"))) { return false; } return true; }
private static function getPostCount($userid) { static $cache = array(); if (0 === ($userid = (int) $userid)) { return GWF_HTML::lang('unknown'); } if (!isset($cache[$userid])) { $posts = new self(false); $cache[$userid] = $posts->countRows("post_uid={$userid}"); } return $cache[$userid]; }