[Openfirst-cvscommit] forum editpost.php,1.2,1.3 index.php,1.4,1.5 newpost.php,1.2,1.3 thread.php,1.
Brought to you by:
xtimg
From: <i-...@us...> - 2003-10-22 00:06:01
|
Update of /cvsroot/openfirst/forum In directory sc8-pr-cvs1:/tmp/cvs-serv20688/forum Modified Files: editpost.php index.php newpost.php thread.php Log Message: Full multiple page functionality for entire forum. Index: editpost.php =================================================================== RCS file: /cvsroot/openfirst/forum/editpost.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editpost.php 15 Oct 2003 00:50:08 -0000 1.2 --- editpost.php 21 Oct 2003 23:47:42 -0000 1.3 *************** *** 69,73 **** if(isset($_POST["message"])){ ! if($_POST["delete"]==1){ if($msg->ReplyTo==0){ if(!$admin){ --- 69,73 ---- if(isset($_POST["message"])){ ! if(isset($_POST["delete"])&&$_POST["delete"]==1){ if($msg->ReplyTo==0){ if(!$admin){ *************** *** 101,105 **** } } ! $query=ofirst_dbquery("UPDATE ofirst_forumposts SET Title='".$_POST["title"]."', Message='".strip_tags($msgtext,allowed_tags)."', DatePosted='".date("Y-m-d H:i:s")."' WHERE ID='".$msg->ID."'"); //redirect back to forum header("Location: thread.php?id=".$forumid); --- 101,105 ---- } } ! $query=ofirst_dbquery("UPDATE ofirst_forumposts SET Title='".$_POST["title"]."', Message='".strip_tags($msgtext,allowed_tags)."' WHERE ID='".$msg->ID."'"); //redirect back to forum header("Location: thread.php?id=".$forumid); Index: index.php =================================================================== RCS file: /cvsroot/openfirst/forum/index.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.php 21 Oct 2003 21:51:37 -0000 1.4 --- index.php 21 Oct 2003 23:47:42 -0000 1.5 *************** *** 226,229 **** --- 226,232 ---- if($num>posts_page){ echo("<tr><td class=sub colspan=3 align=right>"); + if($page>1){ + echo('<a href="index.php?forum='.$forum.'&page=1">[First]</a> ... '); + } if($page>0){ echo('<a href="index.php?forum='.$forum.'&page='.($page).'"><<Prev</a> '); *************** *** 232,235 **** --- 235,241 ---- if($page<ceil($num/posts_page)-1){ echo(' <a href="index.php?forum='.$forum.'&page='.($page+2).'">Next>></a>'); + } + if($page<ceil($num/posts_page)-2){ + echo(' ... <a href="index.php?forum='.$forum.'&page='.ceil($num/posts_page).'">[Last]</a>'); } echo("</td></tr>"); Index: newpost.php =================================================================== RCS file: /cvsroot/openfirst/forum/newpost.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** newpost.php 15 Oct 2003 00:50:08 -0000 1.2 --- newpost.php 21 Oct 2003 23:47:42 -0000 1.3 *************** *** 84,88 **** } else{ ! header("Location: thread.php?id=".$reply); } exit; --- 84,88 ---- } else{ ! header("Location: thread.php?page=last&id=".$reply); } exit; Index: thread.php =================================================================== RCS file: /cvsroot/openfirst/forum/thread.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** thread.php 13 Oct 2003 20:10:37 -0000 1.1 --- thread.php 21 Oct 2003 23:47:42 -0000 1.2 *************** *** 27,30 **** --- 27,33 ---- */ + //number of threads per page + define("posts_page",10); + include("../config/globals.php"); include($header); *************** *** 74,92 **** echo("<table width=600><tr><th colspan=2>$msg->Title</th></tr>"); echo("<tr><td width=200 valign=top class=sub>".userdetails($msg->Author)."<div>Date: $msg->DatePosted</div></td><td valign=top>".$msg->Message."</td></tr>"); ! echo("<tr><td colspan=2 align=right class=sub><a href=".$basepath."/members/profile.php?id=".urlencode($msg->Author).'>Profile</a> | <a href="editpost.php?id='.$msg->ID.'&threadid='.$thread.'">Edit</a></td></tr>'); $query = ofirst_dbquery("SELECT * FROM ofirst_forumposts WHERE ReplyTo=$thread ORDER BY DatePosted"); ! if(ofirst_dbnum_rows($query)!=0){ ! while($msg=ofirst_dbfetch_object($query)){ ! echo('<tr><td width=200 valign=top class=sub>'.userdetails($msg->Author)."<div>Date: $msg->DatePosted</div></td>"); ! echo("<td valign=top>"); ! if($msg->Title!=""){ ! echo("<p><b>$msg->Title</b></p>"); } - echo("<div>$msg->Message</div></td></tr>"); - echo("<tr><td colspan=2 align=right class=sub><a href=".$basepath."/members/profile.php?id=".urlencode($msg->Author).'>Profile</a> | <a href="editpost.php?id='.$msg->ID.'&threadid='.$thread.'">Edit</a></td></tr>'); } } - echo("<tr><th colspan=2> </th></tr></table>"); echo('<br /><div><a href="newpost.php?forumid='.urlencode($forum).'&replyto='.$reply.'">New Reply</a></div>'); } --- 77,141 ---- echo("<table width=600><tr><th colspan=2>$msg->Title</th></tr>"); echo("<tr><td width=200 valign=top class=sub>".userdetails($msg->Author)."<div>Date: $msg->DatePosted</div></td><td valign=top>".$msg->Message."</td></tr>"); ! echo("<tr><td colspan=2 align=right class=sub><a href=".$basepath."/members/profile.php?id=".urlencode($msg->Author).'>Profile</a> | <a href="editpost.php?id='.$msg->ID.'&threadid='.$thread.'">Edit</a></td></tr></table><br />'); $query = ofirst_dbquery("SELECT * FROM ofirst_forumposts WHERE ReplyTo=$thread ORDER BY DatePosted"); ! $num=ofirst_dbnum_rows($query); ! $page=0; ! if(isset($_GET["page"])){ ! if($_GET["page"]=="last"){ ! $page=ceil($num/posts_page)-1; ! }else{ ! $page=$_GET["page"]-1; ! } ! } ! if($page<0){ ! $page=0; ! } ! ! if($num!=0){ ! echo("<table width=600><tr><th colspan=2>"); ! if($num==1){ ! echo("1 Reply"); ! }else{ ! echo("$num Replies"); ! } ! echo("</th></tr>"); ! //skip ! for($i=0;$i<$page*posts_page;$i++){ ! if(!ofirst_dbfetch_object($query)){ ! break; } } + for($i=0;$i<posts_page;$i++){ + if($msg=ofirst_dbfetch_object($query)){ + echo('<tr><td width=200 valign=top class=sub>'.userdetails($msg->Author)."<div>Date: $msg->DatePosted</div></td>"); + echo("<td valign=top>"); + if($msg->Title!=""){ + echo("<p><b>$msg->Title</b></p>"); + } + echo("<div>$msg->Message</div></td></tr>"); + echo("<tr><td colspan=2 align=right class=sub><a href=".$basepath."/members/profile.php?id=".urlencode($msg->Author).'>Profile</a> | <a href="editpost.php?id='.$msg->ID.'&threadid='.$thread.'">Edit</a></td></tr>'); + }else{ + break; + } + } + echo('<tr><th colspan=2><div style="font-size:12px" align=right> '); + if($num>posts_page){ + if($page>1){ + echo('<a href="thread.php?id='.$thread.'&page=1">[First]</a> ... '); + } + if($page>0){ + echo('<a href="thread.php?id='.$thread.'&page='.($page).'"><<Prev</a> '); + } + echo("Page ".($page+1)." of ".ceil($num/posts_page)); + if($page<ceil($num/posts_page)-1){ + echo(' <a href="thread.php?id='.$thread.'&page='.($page+2).'">Next>></a>'); + } + if($page<ceil($num/posts_page)-2){ + echo(' ... <a href="thread.php?id='.$thread.'&page='.ceil($num/posts_page).'">[Last]</a>'); + } + } + echo("</div></th></tr></table>"); } echo('<br /><div><a href="newpost.php?forumid='.urlencode($forum).'&replyto='.$reply.'">New Reply</a></div>'); } |