$tp['subject'] = str_replace(' ', '', wap_cv($tp['subject'])); $refer = "post.php?action=reply&tid={$tid}&tmp={$timestamp}"; wap_header('post', $db_bbsname); require_once PrintEot('wap_post'); wap_footer(); } else { if (!$tp['ifcheck']) { wap_msg('reply_ifcheck'); } if ($tp['locked'] > 0) { wap_msg("reply_lockatc"); } InitGP(array('subject', 'content'), 'P', 0); wap_check($fid, 'reply'); $subject = wap_cv($subject); $content = wap_cv($content); $ipfrom = Char_cv(cvipfrom($onlineip)); $pw_posts = GetPtable($tp['ptable']); if ($db_plist && count($db_plist) > 1) { $db->update("INSERT INTO pw_pidtmp(pid) values('')"); $pid = $db->insert_id(); } else { $pid = ''; } $db->update("INSERT INTO {$pw_posts}" . " SET " . pwSqlSingle(array('pid' => $pid, 'tid' => $tid, 'fid' => $fid, 'ifcheck' => 1, 'subject' => $subject, 'author' => $windid, 'authorid' => $winduid, 'postdate' => $timestamp, 'userip' => $onlineip, 'ipfrom' => $ipfrom, 'content' => $content))); !$pid && ($pid = $db->insert_id()); $db->update("UPDATE pw_threads" . " SET " . pwSqlSingle(array('lastpost' => $timestamp, 'lastposter' => $windid)) . ",replies=replies+1,hits=hits+1" . " WHERE tid=" . pwEscape($tid)); #增加高楼索引 if ($openIndex && $pid) { $db->update("INSERT INTO pw_postsfloor SET pid=" . pwEscape($pid) . ", tid=" . pwEscape($tid)); }
$orderby = "ORDER BY replies DESC"; } elseif ($type == 'new') { $orderby = "ORDER BY postdate DESC"; } else { $orderby = "ORDER BY specialsort DESC,lastpost DESC, postdate DESC"; } $result = $db->query("SELECT * FROM pw_threads WHERE fid != 0 and tid IN (" . pwImplode($tidsCatche) . ") {$orderby}"); while ($rt = $db->fetch_array($result)) { $id++; if ($rt['anonymous'] && $rt['authorid'] != $winduid && !$pwAnonyHide) { $rt['author'] = $db_anonymousname; $rt['authorid'] = 0; } $rt['postdate'] = get_date($rt['postdate']); $rt['id'] = $id; $rt['subject'] = wap_cv(str_replace(' ', '', $rt['subject'])); $tids[] = $rt; } } if (!$tids && $page > 1) { header("Location: index.php?a=forum" . ($fid ? "&fid={$fid}" : "") . ($type ? "&type={$type}" : "")); } $nextp = $page + 1; $prevp = $page - 1; if (count($tids) < $per) { $nextp = 1; } $prevurl = "index.php?a=forum&" . ($fid ? "&fid={$fid}" : "") . ($prevp ? "&page={$prevp}" : "") . ($type ? "&type={$type}" : ""); $nexturl = "index.php?a=forum&" . ($fid ? "&fid={$fid}" : "") . ($nextp ? "&page={$nextp}" : "") . ($type ? "&type={$type}" : ""); if ($t) { $prevurl .= '&t=' . $t;
//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; } $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 . "&all=1&page={$nextp}'>下一页</a>"; } elseif ($page == $maxp) { $yxqw = "<a href='index.php?a=read&tid=" . $tid . "&all=1&page={$prep}'>上一页</a> ";
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; }
if (!$pwpost->isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($pwpost->isBM, 'replylock')) { wap_msg('reply_lockatc', $rurl); } InitGP(array('subject', 'content'), 'P', 0); checkWapPost(0); require_once R_P . 'lib/forum/replypost.class.php'; $replypost = new replyPost($pwpost); $replypost->setTpc($tpcarray); $replypost->check(); !empty($pwpost->errMsg) && wap_msg($pwpost->errMsg); require_once R_P . 'require/bbscode.php'; $replypost->setTpc($tpcarray); $content = $content . "\r\n\r\n[size=2][color=#a5a5a5]内容来自[/color][color=#4f81bd][url=" . $db_bbsurl . "/m/index.php][手机版][/url][/color] [/size]"; $postdata = new replyPostData($pwpost); $postdata->setTitle(wap_cv($subject, false)); $postdata->setContent(wap_cv($content, false)); $postdata->conentCheck(); $postdata->checkdata(); !empty($pwpost->errMsg) && wap_msg($pwpost->errMsg); $replypost->execute($postdata); $pid = $replypost->getNewId(); pwHook::runHook('after_reply'); $rurl = "index.php?a=read&tid={$tid}&fid={$fid}&page=e"; if ($postdata->getIfcheck() == '0') { wap_msg("发帖成功,请等待管理员审核", $rurl); } if ($_POST['upload']) { $rurl = "index.php?a=upload&tid={$tid}&fid={$fid}&page=e"; header("Location:{$rurl}"); } /*删除缓存*/
} if (!$rt) { wap_msg('illegal_tid'); } $fid = $rt['fid']; forumCheck($fid, 'read'); $forumName = wap_cv(strip_tags($forum[$fid]['name'])); $page == 'e' && ($page = 65535); (int) $page < 1 && ($page = 1); $content = $rt['content']; $replies = $rt['replies']; $per = 10; $total = ceil($replies / $per); $total == 0 ? $page = 1 : ($page > $total ? $page = $total : ''); $nextp = $page + 1; if ($nextp > $total) { $nextp = 1; } $prep = $page - 1; if ($prep < 1) { $prep = $total; } $rt['subject'] = str_replace(' ', '', wap_cv($rt['subject'])); $postdb = viewReply($tid, $page, $replies, $per, 90, $rt['ptable'], $order); } else { wap_msg('illegal_tid'); } Cookie("wap_scr", serialize(array("page" => "reply", "extra" => array("tid" => $tid)))); wap_header(); require_once PrintWAP('reply_all'); wap_footer();
$currentPosts[$value]['author'] = wap_cv($currentPosts[$value]['author']); $postdb[] = $currentPosts[$value]; } else { $postdb[] = array('postdate' => 'N', 'content' => getLangInfo('bbscode', 'post_deleted')); } } } } else { $query = $db->query("SELECT subject,author,content,postdate,anonymous FROM {$pw_posts} WHERE tid=" . pwEscape($rt[tid]) . " AND ifcheck=1 ORDER BY postdate {$limit}"); while ($ct = $db->fetch_array($query)) { if ($ct['content']) { $id++; $ct['subject'] = str_replace(' ', '', wap_cv($ct['subject'])); $ct['content'] = strip_tags($ct['content']); $ct['content'] = substrs($ct['content'], $db_waplimit); $ct['content'] = wap_cv($ct['content']); $ct['content'] = wap_code($ct['content']); $ct['postdate'] = get_date($ct['postdate'], "m-d H:i"); $ct['id'] = $id; $ct['author'] = $ct['anonymous'] ? $db_anonymousname : $ct['author']; $ct['author'] = wap_cv($ct['author']); $postdb[] = $ct; } } } } else { wap_msg('illegal_tid'); } wap_header('read', $db_bbsname); require_once PrintEot('wap_read'); wap_footer();
$prer = nextReply($tid, $pid, $rt['ptable'], -1); } else { wap_msg('illegal_tid'); } } elseif ($action == 'modify') { InitGP(array('step'), 'GP', 2); $pw_tmsgs = GetTtable($tid); $rt = $db->get_one("SELECT t.fid,t.tid,t.subject,t.author,t.authorid,t.replies,t.locked,t.postdate,t.anonymous,t.ptable,tm.content FROM pw_threads t LEFT JOIN {$pw_tmsgs} tm ON tm.tid=t.tid WHERE t.tid=" . pwEscape($tid) . " AND ifcheck=1"); //读取板块信息 if (!($foruminfo = L::forum($rt[fid]))) { wap_msg('data_error'); } $isBM = admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid); //获得管理权限 $pw_posts = GetPtable($rt['ptable']); $reply = $db->get_one("SELECT * FROM {$pw_posts} WHERE pid = " . pwEscape($pid)); $editright = $isGM || pwRights($isBM, 'deltpcs') || $reply['authorid'] == $winduid; !$editright && wap_msg('您没有权限编辑此回复', 'index.php?a=reply&tid=' . $tid . '&pid=' . $pid); if (empty($step)) { $reply['content'] = str_replace(array('<', '>', ' '), array('<', '>', ' '), $reply['content']); } elseif ($step == 2) { InitGP(array('content'), 'GP'); $pw_posts = GetPtable('N', $tid); $db->update("UPDATE {$pw_posts} SET content = " . pwEscape(wap_cv($content)) . " WHERE pid = " . pwEscape($pid)); wap_msg('operate_success', 'index.php?a=reply&tid=' . $tid . '&pid=' . $pid); } } Cookie("wap_scr", serialize(array("page" => "reply", "extra" => array("tid" => $tid, "pid" => $pid)))); wap_header(); require_once PrintWAP('reply'); wap_footer();
!defined('W_P') && exit('Forbidden'); if ($db_waphottopictoday) { $element = L::loadclass('element'); $hots24 = $element->replySortDay(0, 4); } if ($db_waphottopicweek) { $element = L::loadclass('element'); $hotsw7 = $element->replySortWeek(0, 4); } $defaultType = ''; if ($db_waprecommend) { InitGP(array('type'), 'GP'); require_once W_P . 'include/db/recommend.db.php'; $recommend = new RecommendDB(); $recommend->setPerPage(4); $recommendTypes = $recommend->getRecommendActiveType(); $recommendbs = $recommend->getRecommendByType($type); } $wapfids = array(); if ($db_wapfids) { $tmpwapfids = explode(',', $db_wapfids); foreach ($tmpwapfids as $val) { $wapfids[$val] = wap_cv(strip_tags($forum[$val]['name'])); } } else { $wapfids = pwGetShortcut(); } Cookie("wap_scr", serialize(array("page" => "index"))); wap_header(); require_once PrintWAP('index'); wap_footer();
$listdb = array(); if ($fid) { InitGP(array('page')); $per = 10; $fm = $db->get_one("SELECT topic FROM pw_forumdata WHERE fid=" . pwEscape($fid)); $db_maxpage && $page > $db_maxpage && ($page = $db_maxpage); (!is_numeric($page) || $page < 1) && ($page = 1); $totle = ceil($fm['topic'] / $per); $totle == 0 ? $page = 1 : ($page > $totle ? $page = $totle : ''); $next = $page + 1; $pre = $page == 1 ? 1 : $page - 1; $pages = wap_numofpage($page, $totle, "list.php?fid={$fid}&", $db_maxpage); forumcheck($fid, 'list'); $list = ''; $satrt = ($page - 1) * $per; $id = $satrt; $limit = pwLimit($satrt, $per); $query = $db->query("SELECT tid,author,subject,postdate,hits,replies,anonymous FROM pw_threads WHERE fid=" . pwEscape($fid) . " AND topped<3 AND ifcheck=1 ORDER BY topped DESC,lastpost DESC {$limit}"); while ($rt = $db->fetch_array($query)) { $id++; $rt['anonymous'] && ($rt['author'] = $db_anonymousname); $rt['postdate'] = get_date($rt['postdate'], "m-d H:i"); $rt['id'] = $id; $rt['subject'] = substrs(str_replace(' ', '', $rt['subject']), 30, 'N'); $listdb[] = $rt; } $forumname = wap_cv(strip_tags($forum[$fid]['name'])); } wap_header('list', $db_bbsname); require_once PrintEot('wap_list'); wap_footer();