(int) $page < 1 && ($page = 1); if ($rt['ifshield'] || $rt['groupid'] == 6 && $db_shield) { if ($rt['ifshield'] == 2) { $rt['content'] = shield('shield_del_article'); $rt['subject'] = ''; $tpc_shield = 1; } else { $rt['content'] = shield($rt['ifshield'] ? 'shield_article' : 'ban_article'); $rt['subject'] = ''; $tpc_shield = 1; } } $content = viewContent($rt['content']); $forumName = wap_cv(strip_tags($forum[$fid]['name'])); $db_waplimit = $db_waplimit ? $db_waplimit : ''; $clen = wap_strlen($content, $db_charset); //TODO mbstring $maxp = ceil($clen / $db_waplimit); $nextp = $page + 1; $prep = $page - 1; if ($nextp > $maxp) { $nextp = $maxp; } if ($prep <= 0) { $prep = 1; } $rt['postdate'] = get_date($rt['postdate']); if ($rt['anonymous'] && $rt['authorid'] != $winduid && !$pwAnonyHide) { $rt['author'] = $db_anonymousname; $rt['authorid'] = 0; }
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; }