예제 #1
0
 $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;
 }
 $rt['author'] = wap_cv($rt['author']);
 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 . "&amp;all=1&amp;page={$nextp}'>下一页</a>";
     } elseif ($page == $maxp) {
         $yxqw = "<a href='index.php?a=read&tid=" . $tid . "&amp;all=1&amp;page={$prep}'>上一页</a>&nbsp;";
     } else {
         $yxqw = "<a href='index.php?a=read&tid=" . $tid . "&amp;all=1&amp;page={$nextp}'>下一页</a>";
         $yxqw .= "<a href='index.php?a=read&tid=" . $tid . "&amp;all=1&amp;page={$prep}'>上一页</a>&nbsp;";
예제 #2
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('&nbsp;', '', 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 . "&amp;tid=" . $tid . "&amp;c_page={$c_nextp}'>下一页</a>";
            } elseif ($c_page == $maxp) {
                $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&amp;tid=" . $tid . "&amp;c_page={$c_prep}'>上一页</a>&nbsp;";
            } else {
                $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&amp;tid=" . $tid . "&amp;c_page={$c_nextp}'>下一页</a>";
                $yxqw .= "<a href='index.php?a=reply&pid=" . $pid . "&amp;tid=" . $tid . "&amp;c_page={$c_prep}'>上一页</a>&nbsp;";
            }
            $yxqw .= "&nbsp;({$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;
}