From 26077f1eebdc4885994e45773b12c533cadb04a2 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 1 Dec 2004 22:28:52 +0000 Subject: [PATCH] Add an admin page that will display all of the appdb comments, the earliest comments first, so it is easier to find and delete out of date comments without removing potentially useful information. --- admin/adminCommentView.php | 116 +++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 admin/adminCommentView.php diff --git a/admin/adminCommentView.php b/admin/adminCommentView.php new file mode 100644 index 0000000..217014e --- /dev/null +++ b/admin/adminCommentView.php @@ -0,0 +1,116 @@ +Previous "; + } else + echo "Previous "; + + /* display the next 10 and previous 10 pages */ + $pageRange = 10; + + if($currentPage > $pageRange) + $startPage = $currentPage - $pageRange; + else + $startPage = 0; + + if($currentPage + $pageRange < $totalPages) + $endPage = $currentPage + $pageRange; + else + $endPage = $totalPages; + + /* display the desired range */ + for($x = $startPage; $x <= $endPage; $x++) + { + if($x != $currentPage) + echo "$x "; + else + echo "$x "; + } + + if($currentPage < $totalPages) + { + $nextPage = $currentPage + 1; + echo "Next "; + } else + echo "Next "; +} + +$commentsPerPage = 10; +$currentPage = 0; + +if($_REQUEST['page']) + $currentPage = $_REQUEST['page']; + +if($_REQUEST['commentsPerPage']) + $commentsPerPage = $_REQUEST['commentsPerPage']; + +$totalPages = floor(getNumberOfComments()/$commentsPerPage); + +if($commentsPerPage > 100) $commentsPerPage = 100; + +/* display page selection links */ +echo "
"; +echo "Page $currentPage of $totalPages
"; +display_range($currentPage, $pageRange, $totalPages, $commentsPerPage); +echo "
"; +echo "
"; + +/* display the option to choose how many comments per-page to disable */ +echo "
"; +echo "Number of comments per page:"; +echo ""; + +echo ""; +echo ""; +echo "
"; + +echo "
"; + +/* query for all of the commentId's, ordering by their time in reverse order */ +$offset = $currentPage * $commentsPerPage; +$commentIds = mysql_query("SELECT commentId from appComments ORDER BY ". + "appComments.time ASC LIMIT $offset, $commentsPerPage;"); +while ($ob = mysql_fetch_object($commentIds)) +{ + $qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ". + "commentId, parentId, appId, versionId, userid, subject, body ". + "FROM appComments WHERE commentId = $ob->commentId;"; + $result = mysql_query($qstring); + + /* call view_app_comment to display the comment */ + $comment_ob = mysql_fetch_object($result); + view_app_comment($comment_ob); +} + +/* display page selection links */ +echo "
"; +display_range($currentPage, $pageRange, $totalPages, $commentsPerPage); +echo "
"; + +apidb_footer(); + +?>