function replySubject($s) { $max = 90; $s = viewContent($s); $clen = strlen($s); if ($max < $clen) { $s = substrs($s, $max); $s = wap_img2($s); } return $s; }
if ($rt['ifupload'] != 0) { $imgs = viewAids($tid, 0); $downloads = viewDownloads($tid, 0); } $yxqw = ""; if ($maxp > 1) { $content = wap_substr($content, $db_waplimit * ($page - 1), $db_waplimit, $db_charset); $content = wap_img2($content); if (empty($content)) { wap_msg("已到最后一页", "index.php?a=read&tid={$tid}"); } if ($page == 1) { $yxqw = "<a href='index.php?a=read&tid=" . $tid . "&all=1&page={$nextp}'>下一页</a>"; } elseif ($page == $maxp) { $yxqw = "<a href='index.php?a=read&tid=" . $tid . "&all=1&page={$prep}'>上一页</a> "; } else { $yxqw = "<a href='index.php?a=read&tid=" . $tid . "&all=1&page={$nextp}'>下一页</a>"; $yxqw .= "<a href='index.php?a=read&tid=" . $tid . "&all=1&page={$prep}'>上一页</a> "; } $yxqw .= " ({$page}/{$maxp})<br/>"; } else { $content = wap_img2($content); } $postdb = viewReply($tid, 1, $rt['replies'], 3, 90, $rt['ptable'], 2); } else { wap_msg('illegal_tid'); } Cookie("wap_scr", serialize(array("page" => "read", "extra" => array("tid" => $tid)))); wap_header(); require_once PrintWAP('read'); wap_footer();
function viewOneReply($tid, $pid, $ptable) { global $db, $db_waplimit, $c_page, $db_anonymousname, $pwAnonyHide, $winduid; $pw_posts = GetPtable($ptable); $sql = "SELECT pid,subject,author,authorid,content,postdate,anonymous,aid FROM {$pw_posts} WHERE pid=" . pwEscape($pid); $ct = $db->get_one($sql); if ($ct) { $ct['subject'] = str_replace(' ', '', wap_cv($ct['subject'])); $content = viewContent($ct['content']); $yxqw = ""; /*************对内容进行分页**********/ (int) $c_page < 1 && ($c_page = 1); $clen = wap_strlen($content, $db_charset); //TODO mbstring $maxp = ceil($clen / $db_waplimit); $c_nextp = $c_page + 1; $c_prep = $c_page - 1; if ($c_nextp > $maxp) { $c_nextp = $maxp; } if ($c_prep <= 0) { $c_prep = 1; } $yxqw = ""; if ($maxp > 1) { $content = wap_substr($content, $db_waplimit * ($c_page - 1), $db_waplimit, $db_charset); $content = wap_img2($content); if (empty($content)) { wap_msg("已到最后一页", "index.php?a=read&tid={$tid}"); } if ($c_page == 1) { $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_nextp}'>下一页</a>"; } elseif ($c_page == $maxp) { $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_prep}'>上一页</a> "; } else { $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_nextp}'>下一页</a>"; $yxqw .= "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_prep}'>上一页</a> "; } $yxqw .= " ({$c_page}/{$maxp})<br/>"; } else { $content = wap_img2($content); } $ct['content'] = $content; /*************对内容进行分页**********/ if ($ct['anonymous'] && $ct['authorid'] != $winduid && !$pwAnonyHide) { $ct['author'] = $db_anonymousname; $ct['authorid'] = 0; } list(, $ct['postdate']) = getLastDate($ct['postdate']); $ct['id'] = $id; //$ct ['author'] = $ct ['anonymous'] ? $db_anonymousname : $ct ['author']; $ct['author'] = wap_cv($ct['author']); $ct['yxqw'] = $yxqw; if ($ct['aid'] && $ct['aid'] != '') { $ct['aidimgs'] = viewAidsForHtml($tid, $pid); $ct['aidatts'] = viewDownloads($tid, $pid); } else { $ct['aidimgs'] = ''; $ct['aidatts'] = ''; } } return $ct; }