} } else { $ThreadID = $_GET['threadid']; } if (isset($_GET['pp'])) { $PerPage = $_GET['pp']; } else { if (isset($LoggedUser['PostsPerPage'])) { $PerPage = $LoggedUser['PostsPerPage']; } else { $PerPage = POSTS_PER_PAGE; } } //---------- Get some data to start processing // Thread information, constant across all pages $ThreadInfo = get_thread_info($ThreadID, true, true); $ForumID = $ThreadInfo['ForumID']; // Make sure they're allowed to look at the page if (!check_forumperm($ForumID)) { print json_encode(array('status' => 'failure')); } //Post links utilize the catalogue & key params to prevent issues with custom posts per page if ($ThreadInfo['Posts'] > $PerPage) { if (isset($_GET['post']) && is_number($_GET['post'])) { $PostNum = $_GET['post']; } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) { $DB->query("SELECT COUNT(ID) FROM forums_posts WHERE TopicID = {$ThreadID} AND ID <= {$_GET['postid']}"); list($PostNum) = $DB->next_record(); } else { $PostNum = 1; }
/** * スレッド情報を取得する * * @param string $host * @param string $bbs * @param string $key * @return string JSONエンコードされたスレッド情報 */ function info_js_get_thread_info($host, $bbs, $key) { return info_js_json_encode(get_thread_info($host, $bbs, $key)); }
* rep2 - スレッド表示 - ヘッダ部分 - iPhone用 for read.php */ require_once P2_LIB_DIR . '/get_info.inc.php'; require_once P2_LIB_DIR . '/spm_k.inc.php'; // {{{ 変数 // {{{ 基本変数 $motothre_url = $aThread->getMotoThread(false, '1-10'); $ttitle_en = UrlSafeBase64::encode($aThread->ttitle); $ttitle_en_q = '&ttitle_en=' . $ttitle_en; $bbs_q = '&bbs=' . $aThread->bbs; $key_q = '&key=' . $aThread->key; $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $offline_q = '&offline=1'; $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES); $rnum_range = $_conf['mobile.rnum_range']; $thread_info = get_thread_info($aThread->host, $aThread->bbs, $aThread->key); // }}} // {{{ レスナビ設定 if ($do_filtering) { include P2_LIB_DIR . '/read_filter_k.inc.php'; } else { // {{{ ナビ - 前 $before_rnum = max(1, $aThread->resrange['start'] - $rnum_range); if ($aThread->resrange['start'] == 1) { $read_navi_previous_isInvisible = true; } else { $read_navi_previous_isInvisible = false; } if ($read_navi_previous_isInvisible) { $read_navi_previous_url = ''; } else {
if (!isset($Forums[$ForumID])) { print json_encode(array('status' => 'failure')); die; } // Make sure they're allowed to look at the page if (!check_perms('site_moderate_forums')) { if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { error(403); } } if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); } $JsonSpecificRules = array(); foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) { $Thread = get_thread_info($ThreadIDs); $JsonSpecificRules[] = array('threadId' => $ThreadIDs, 'thread' => $Thread['Title']); } $Pages = get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9); if (count($Forum) == 0) { print json_encode(array('status' => 'success', 'forumName' => $Forums[$ForumID]['Name'], 'threads' => array())); } else { // forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on $DB->query('SELECT l.TopicID, l.PostID, CEIL((SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = l.TopicID AND forums_posts.ID<=l.PostID)/' . $PerPage . ') AS Page FROM forums_last_read_topics AS l WHERE TopicID IN(' . implode(', ', array_keys($Forum)) . ') AND UserID=\'' . $LoggedUser['ID'] . '\''); // Turns the result set into a multi-dimensional array, with