From 844c5c22b28f649bcc7efed6470b1ade890b140b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 30 Nov 2003 21:05:57 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2723 --- checkin_notes | 33 ++ db/schema.sql | 71 +++- html/forum/forum.inc | 540 ++++++++++++++-------------- html/forum/forum.php | 184 +++++----- html/forum/help_desk.php | 12 +- html/forum/index.php | 23 +- html/forum/post.php | 13 +- html/forum/reply.php | 2 +- html/forum/thread.php | 16 +- html/user/edit_user_info_action.php | 2 +- html/user/index.php | 4 +- html/user/top_hosts.php | 23 +- html/user/user.inc | 4 + html/user/util.inc | 4 +- html/user/white.css | 7 +- 15 files changed, 526 insertions(+), 412 deletions(-) diff --git a/checkin_notes b/checkin_notes index c861920901..fbcb3e7228 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7966,3 +7966,36 @@ Karl 2003-11-28 Makefile.am api/ Makefile.am + +David 29 Nov 2003 + - top hosts shows 10 hosts, lets you page forward/back + - Various stuff related to message boards (formerly known as Forum) + - don't show blue links on blue background + - terminology in message-board interface + "message boards" describes the message system + "questions/problems" describes the FAQ system + - got rid of hard-wired field widths + - removed "activity" stuff (wasn't being used) + - cleaned up names in the beta-test database + - Yahoo-type hierarchical page titles + - made "sort by" work when step through pages + - added category, forum tables to schema.sql + - added comments on PHP-only tables to schema.sql + + db/ + schema.sql + html_user/ + edit_user_info_action.php + index.php + top_hosts.php + user.inc + util.inc + white.css + forum/ + forum.inc + forum.php + help_desk.php + index.php + post.php + reply.php + thread.php diff --git a/db/schema.sql b/db/schema.sql index 5aff28f2ab..33d1e1058c 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -226,6 +226,11 @@ create table workseq ( primary key (id) ); +-- EVERYTHING FROM HERE ON IS USED ONLY FROM PHP, +-- SO NOT IN BOINC_DB.H ETC. + +-- represents a language (so can have message boards in different languages) +-- create table lang ( id integer not null auto_increment, name varchar(254) not null, @@ -233,17 +238,9 @@ create table lang ( primary key (id) ); -create table post ( - id integer not null auto_increment, - thread integer not null, - user integer not null, - timestamp integer not null, - content text not null, - modified integer not null, - parent_post integer not null, - primary key (id) -); +-- user profile (description, pictures) +-- create table profile ( userid integer not null auto_increment, language varchar(254), @@ -256,13 +253,67 @@ create table profile ( primary key (userid) ); +-- message board category +-- help desk is a group of categories that are handled separately +-- +create table category ( + id integer not null auto_increment, + orderID integer not null, + -- order in which to display + lang integer not null, + name varchar(254) binary, + is_helpdesk smallint not null, + primary key (id) +); + +-- message board topic +-- +create table forum ( + id integer not null auto_increment, + category integer not null, + orderID integer not null, + title varchar(254) not null, + description varchar(254) not null, + timestamp integer not null, + threads integer not null, + posts integer not null, + primary key (id) +); + +-- threads in a topic +-- create table thread ( id integer not null auto_increment, forum integer not null, owner integer not null, title varchar(254) not null, timestamp integer not null, + -- creation time (uh, why not call it that?) views integer not null, + -- number of times this has been viewed replies integer not null, + -- number of postings in thread + activity integer not null, + -- not used?? should remove references + sufferers integer not null, + -- in help desk: # people who indicated they had same problem primary key (id) ); + +-- postings in a thread. +-- Each thread has an initial post +-- +create table post ( + id integer not null auto_increment, + thread integer not null, + user integer not null, + timestamp integer not null, + content text not null, + modified integer not null, + -- when last modified + parent_post integer not null, + score double not null, + votes integer not null, + primary key (id) +); + diff --git a/html/forum/forum.inc b/html/forum/forum.inc index edd4d27e1f..b84deac5aa 100644 --- a/html/forum/forum.inc +++ b/html/forum/forum.inc @@ -12,9 +12,9 @@ define ('OFF_TOPIC', 'Off-topic'); $forum_sort_styles['modified-new'] = "Most recent post first"; $forum_sort_styles['modified-old'] = "Least recent post first"; -$forum_sort_styles['activity-most'] = "Most recent activity first"; +//$forum_sort_styles['activity-most'] = "Most recent activity first"; $forum_sort_styles['views-most'] = "Most views first"; -$forum_sort_styles['replies-most'] = "Most replies first"; +$forum_sort_styles['replies-most'] = "Most posts first"; $thread_sort_styles['date-old'] = "Oldest first"; $thread_sort_styles['date-new'] = "Newest first"; @@ -37,202 +37,199 @@ db_init('../'); /* group database functions */ function getCategories() { - $langID = (!empty($_SESSION['lang']['id']))?$_SESSION['lang']['id']:1; - $sql = "SELECT * FROM category WHERE lang = ".$langID." AND is_helpdesk = 0 ORDER BY orderID ASC"; - return mysql_query($sql); + $langID = (!empty($_SESSION['lang']['id']))?$_SESSION['lang']['id']:1; + $sql = "SELECT * FROM category WHERE lang = ".$langID." AND is_helpdesk = 0 ORDER BY orderID ASC"; + return mysql_query($sql); } function getHelpDeskCategories() { - $sql = "SELECT * FROM category WHERE is_helpdesk = 1 ORDER BY orderID ASC"; - return mysql_query($sql); + $sql = "SELECT * FROM category WHERE is_helpdesk = 1 ORDER BY orderID ASC"; + return mysql_query($sql); } function getForums($categoryID) { - $sql = 'SELECT * FROM forum WHERE category = ' . $categoryID . ' ORDER BY orderID ASC'; + $sql = 'SELECT * FROM forum WHERE category = ' . $categoryID . ' ORDER BY orderID ASC'; return mysql_query($sql); } function getThreads($forumID, $min = -1, $nRec = -1, $sort_style='modified-new') { - $sql = 'SELECT * FROM thread WHERE forum = ' . $forumID; - switch($sort_style) { - case 'modified-new': - $sql = $sql . ' ORDER BY timestamp DESC'; - break; - case 'modified-old': - $sql = $sql . ' ORDER BY timestamp ASC'; - break; - case 'views-most': - $sql = $sql . ' ORDER BY views DESC'; - break; - case 'replies-most': - $sql = $sql . ' ORDER BY replies DESC'; - break; - case 'activity-most': - $sql = $sql . ' ORDER by activity DESC, timestamp DESC'; - break; - case 'help-activity-most': - $sql = $sql . ' ORDER by activity DESC, sufferers DESC'; - break; - } - if ($min > -1) { - $sql .= ' LIMIT '.$min; - if ($nRec > -1) { - $sql .= ', '.$nRec; - } - } else if ($nRec > -1) { - $sql .= ' LIMIT '.$nRec; + $sql = 'SELECT * FROM thread WHERE forum = ' . $forumID; + switch($sort_style) { + case 'modified-new': + $sql = $sql . ' ORDER BY timestamp DESC'; + break; + case 'modified-old': + $sql = $sql . ' ORDER BY timestamp ASC'; + break; + case 'views-most': + $sql = $sql . ' ORDER BY views DESC'; + break; + case 'replies-most': + $sql = $sql . ' ORDER BY replies DESC'; + break; +// case 'activity-most': +// $sql = $sql . ' ORDER by activity DESC, timestamp DESC'; +// break; +// case 'help-activity-most': +// $sql = $sql . ' ORDER by activity DESC, sufferers DESC'; +// break; + } + if ($min > -1) { + $sql .= ' LIMIT '.$min; + if ($nRec > -1) { + $sql .= ', '.$nRec; + } + } else if ($nRec > -1) { + $sql .= ' LIMIT '.$nRec; } return mysql_query($sql); } function getPosts($threadID, $min = -1, $nRec = -1, $sort_style="date-old") { - $sql = 'SELECT *, (score * votes) AS rating FROM post WHERE thread = '. $threadID; - switch($sort_style) { - case 'date-old': - $sql = $sql . ' ORDER BY timestamp ASC'; - break; - case 'date-new': - $sql = $sql . ' ORDER BY timestamp DESC'; - break; - case 'score-high': - $sql = $sql . ' ORDER BY score DESC'; - break; - case 'rating-high': - $sql = $sql . ' ORDER BY rating DESC'; - break; + $sql = 'SELECT *, (score * votes) AS rating FROM post WHERE thread = '. $threadID; + switch($sort_style) { + case 'date-old': + $sql = $sql . ' ORDER BY timestamp ASC'; + break; + case 'date-new': + $sql = $sql . ' ORDER BY timestamp DESC'; + break; + case 'score-high': + $sql = $sql . ' ORDER BY score DESC'; + break; + case 'rating-high': + $sql = $sql . ' ORDER BY rating DESC'; + break; } if ($min > -1) { - $sql .= ' LIMIT '.$min; - if ($nRec > -1) { - $sql .= ', '.$nRec; - } - } elseif ($nRec > -1) { - $sql .= ' LIMIT '.$nRec; - } - return mysql_query($sql); + $sql .= ' LIMIT '.$min; + if ($nRec > -1) { + $sql .= ', '.$nRec; + } + } elseif ($nRec > -1) { + $sql .= ' LIMIT '.$nRec; + } + return mysql_query($sql); } /* specific database functions */ function getCategory($categoryID) { - $sql = "SELECT * FROM category WHERE id = ".$categoryID; - $result = mysql_query($sql); - if ($result) { - return mysql_fetch_object($result); - } else { - return NULL; - } + $sql = "SELECT * FROM category WHERE id = ".$categoryID; + $result = mysql_query($sql); + if ($result) { + return mysql_fetch_object($result); + } else { + return NULL; + } } function getForum($forumID) { $sql = "SELECT * FROM forum WHERE id = " . $forumID; $result = mysql_query($sql); if ($result) { - return mysql_fetch_object($result); - } else { - return NULL; - } + return mysql_fetch_object($result); + } else { + return NULL; + } } function getThread($threadID) { $sql = "SELECT * FROM thread WHERE id = ".$threadID; $result = mysql_query($sql); if ($result) { - return mysql_fetch_object($result); - } else { - return NULL; - } + return mysql_fetch_object($result); + } else { + return NULL; + } } function getPost($postID) { $sql = "SELECT * FROM post WHERE id = ".$postID; $result = mysql_query($sql); if ($result) { - return mysql_fetch_object($result); - } else { - return NULL; - } + return mysql_fetch_object($result); + } else { + return NULL; + } } // Returns the post that started the thread with id = $threadId function getFirstPost($threadID) { - $sql = "SELECT * FROM post WHERE thread = " . $threadID ." ORDER BY id ASC"; - $result = mysql_query($sql); - if ($result) { - return mysql_fetch_object($result); - } else { - return NULL; - } + $sql = "SELECT * FROM post WHERE thread = " . $threadID ." ORDER BY id ASC"; + $result = mysql_query($sql); + if ($result) { + return mysql_fetch_object($result); + } else { + return NULL; + } } function incThreadViews($threadID) { - $sql = "UPDATE thread SET views = views + 1 WHERE id = " . $threadID . " LIMIT 1"; - mysql_query($sql); + $sql = "UPDATE thread SET views = views + 1 WHERE id = " . $threadID . " LIMIT 1"; + mysql_query($sql); } /* Forum modifying functions. */ function createThread($forumID, $ownerID, $title, $content) { - $title = addslashes(htmlentities($title)); - $content = addslashes(htmlentities($content)); + $title = addslashes(htmlentities($title)); + $content = addslashes(htmlentities($content)); - $sql = "INSERT INTO thread (forum, owner, title, timestamp) VALUES (" . $forumID . ", " . $ownerID . ", '" . $title . "', UNIX_TIMESTAMP())"; - $result = mysql_query($sql); - if (!$result) - return false; - $threadID = mysql_insert_id(); + $sql = "INSERT INTO thread (forum, owner, title, timestamp) VALUES (" . $forumID . ", " . $ownerID . ", '" . $title . "', UNIX_TIMESTAMP())"; + $result = mysql_query($sql); + if (!$result) return false; + $threadID = mysql_insert_id(); - $postID = addPost($threadID, $ownerID, NULL, $content); + $postID = addPost($threadID, $ownerID, NULL, $content); - $sql = "UPDATE user SET posts = posts + 1 WHERE id = " . $ownerID . " LIMIT 1"; - mysql_query($sql); + $sql = "UPDATE user SET posts = posts + 1 WHERE id = " . $ownerID . " LIMIT 1"; + mysql_query($sql); - $sql = "UPDATE forum SET threads = threads + 1, posts = posts + 1, timestamp = UNIX_TIMESTAMP() WHERE id = " . $forumID . " LIMIT 1"; - mysql_query($sql); + $sql = "UPDATE forum SET threads = threads + 1, posts = posts + 1, timestamp = UNIX_TIMESTAMP() WHERE id = " . $forumID . " LIMIT 1"; + mysql_query($sql); - return $threadID; + return $threadID; } function replyToThread($threadID, $userID, $content, $parent_post=NULL) { - $thread = getThread($threadID); + $thread = getThread($threadID); - $content = addslashes(htmlentities($content)); + $content = addslashes(htmlentities($content)); - addPost($threadID, $userID, $parent_post, $content); + addPost($threadID, $userID, $parent_post, $content); - $sql = "UPDATE user SET posts = posts + 1 WHERE id = " . $userID . " LIMIT 1"; - mysql_query($sql); + $sql = "UPDATE user SET posts = posts + 1 WHERE id = " . $userID . " LIMIT 1"; + mysql_query($sql); - $sql = "UPDATE thread SET replies = replies + 1, timestamp = UNIX_TIMESTAMP() WHERE id = " . $threadID . " LIMIT 1"; - mysql_query($sql); + $sql = "UPDATE thread SET replies = replies + 1, timestamp = UNIX_TIMESTAMP() WHERE id = " . $threadID . " LIMIT 1"; + mysql_query($sql); - $sql = "UPDATE forum SET posts = posts + 1, timestamp = UNIX_TIMESTAMP() WHERE id = " . $thread->forum . " LIMIT 1"; - mysql_query($sql); - } + $sql = "UPDATE forum SET posts = posts + 1, timestamp = UNIX_TIMESTAMP() WHERE id = " . $thread->forum . " LIMIT 1"; + mysql_query($sql); +} function addPost($threadID, $userID, $parentID, $content) { - if ($parentID) { - $sql = "INSERT INTO post (thread, user, timestamp, content, parent_post) VALUES (" . $threadID . ", " . $userID . ", UNIX_TIMESTAMP(), '" . $content . "', " . $parentID . ")"; - } else { - $sql = "INSERT INTO post (thread, user, timestamp, content) VALUES (" . $threadID . ", " . $userID . ", UNIX_TIMESTAMP(), '" . $content . "')"; - } - $result = mysql_query($sql); - if (!$result) - return false; - //return ($post->id = mysql_insert_id()); - mysql_insert_id(); - return true; + if ($parentID) { + $sql = "INSERT INTO post (thread, user, timestamp, content, parent_post) VALUES (" . $threadID . ", " . $userID . ", UNIX_TIMESTAMP(), '" . $content . "', " . $parentID . ")"; + } else { + $sql = "INSERT INTO post (thread, user, timestamp, content) VALUES (" . $threadID . ", " . $userID . ", UNIX_TIMESTAMP(), '" . $content . "')"; + } + $result = mysql_query($sql); + if (!$result) return false; + //return ($post->id = mysql_insert_id()); + mysql_insert_id(); + return true; } function updatePost($postID, $content) { - $sql = "UPDATE post SET content = \"$content\", modified = UNIX_TIMESTAMP() WHERE id = " . $postID; - $result = mysql_query($sql); - if (!$result) - return false; - return true; + $sql = "UPDATE post SET content = \"$content\", modified = UNIX_TIMESTAMP() WHERE id = " . $postID; + $result = mysql_query($sql); + if (!$result) return false; + return true; } /* display functions */ @@ -255,191 +252,192 @@ function show_posts($thread, $sort_style, $filter, $show_controls=true, $do_colo if ($is_helpdesk) { if ($firstPost) { show_post($firstPost, $thread, $logged_in_user, $n, $controls, true); - } + } } while ($post = mysql_fetch_object($posts)) { if ($post->score >= $filter) { if (!$is_helpdesk || ($is_helpdesk && $post->id != $firstPost->id)) { - show_post($post, $thread, $logged_in_user, $n, $controls, false); - if ($do_coloring) $n = ($n+1)%2; + show_post($post, $thread, $logged_in_user, $n, $controls, false); + if ($do_coloring) $n = ($n+1)%2; } } } } function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS, $separate=false) { - global $post_ratings; + global $post_ratings; - $user = lookup_user_id($post->user); - $sql = "SELECT * FROM profile WHERE userid = " . $user->id; - $result2 = mysql_query($sql); - $user->has_profile = (mysql_num_rows($result2) > 0); + $user = lookup_user_id($post->user); + $sql = "SELECT * FROM profile WHERE userid = " . $user->id; + $result2 = mysql_query($sql); + $user->has_profile = (mysql_num_rows($result2) > 0); - $can_edit = $logged_in_user && $user->id == $logged_in_user->id; + $can_edit = $logged_in_user && $user->id == $logged_in_user->id; - echo " - - - id > -

- "; + echo " + + + id > +

+ "; - if ($user->has_profile) { - echo "user\">", $user->name, ""; - } else { - echo $user->name; - } + if ($user->has_profile) { + echo "user\">", $user->name, ""; + } else { + echo $user->name; + } - echo " -

-

- Joined: ", gmdate('M j, Y', $user->create_time), "
Posts: ", $user->posts, " -

- - - "; + echo " +

+

+ Joined: ", gmdate('M j, Y', $user->create_time), "
Posts: ", $user->posts, " +

+ + + "; - if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { - echo "
id, "\" method=\"post\">"; - } - echo " - - - \n

- Posted: ", pretty_time_str($post->timestamp); - ; + if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { + echo "id, "\" method=\"post\">"; + } + echo " + + + \n"; + echo "

\n\n"; - if ($controls == FORUM_CONTROLS) { - echo ""; - } else if ($controls == HELPDESK_CONTROLS && $separate) { - echo " - - "; - } else if ($controls == HELPDESK_CONTROLS && !$separate) { - echo " - - "; - } + if ($controls == FORUM_CONTROLS) { + echo ""; + } else if ($controls == HELPDESK_CONTROLS && $separate) { + echo " + + "; + } else if ($controls == HELPDESK_CONTROLS && !$separate) { + echo " + + "; + } - echo "\n

+ Posted: ", pretty_time_str($post->timestamp); + ; - if ($post->parent_post) echo " in response to parent_post>Message ID $post->parent_post."; - if ($can_edit && $controls != NO_CONTROLS) echo " id\">[Edit this post]"; - if ($post->modified) echo "
Last Modified: ", pretty_time_Str($post->modified); + if ($post->parent_post) echo " in response to parent_post>Message ID $post->parent_post."; + if ($can_edit && $controls != NO_CONTROLS) echo " id\">[Edit this post]"; + if ($post->modified) echo "
Last modified: ", pretty_time_Str($post->modified); - echo "

\n
Rate this post:"; - show_combo_from_array("rating", $post_ratings, "0"); - echo " - - - - - Rate this post:"; + show_combo_from_array("rating", $post_ratings, "0"); + echo " + + + + +
\n"; + echo "

\n"; - if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { - echo "
"; - } - echo "

", nl2br(stripslashes($post->content)), "

"; - echo " - - "; - } else if ($controls == HELPDESK_CONTROLS && !$separate) { - echo " / Score: ", ($post->score * $post->votes), ""; - } else { - echo " / Rating: ", $post->score, ""; - } + if ($controls == FORUM_CONTROLS || $controls == HELPDESK_CONTROLS) { + echo ""; + } + echo "

", nl2br(stripslashes($post->content)), "

"; + echo "
ID: ", $post->id; - if ($controls == HELPDESK_CONTROLS && $separate) { - echo "
+ + "; + } else if ($controls == HELPDESK_CONTROLS && !$separate) { + echo " / Score: ", ($post->score * $post->votes), ""; + } else { + echo " / Rating: ", $post->score, ""; + } - if ($controls == FORUM_CONTROLS) { - echo ""; - } else if ($controls == HELPDESK_CONTROLS && !$separate) { - echo ""; - } + if ($controls == FORUM_CONTROLS) { + echo ""; + } else if ($controls == HELPDESK_CONTROLS && !$separate) { + echo ""; + } - echo "
ID: ", $post->id; + if ($controls == HELPDESK_CONTROLS && $separate) { + echo "[id . "&post=" . $post->id . "#input\">Reply to this post][id . "&post=" . $post->id . "&helpdesk=1#input\">Reply to this answer][id . "&post=" . $post->id . "#input\">Reply to this post][id . "&post=" . $post->id . "&helpdesk=1#input\">Reply to this answer]
"; + echo ""; - if ($separate) { - echo " - -

- - - - - "; - } + if ($separate) { + echo " +
AuthorAnswers
+

+ + + + + "; + } } /* utility functions */ -function start_forum_table($headings, $widths, $span=NULL) { - echo " -

-

AuthorAnswers
- - "; +function start_forum_table($headings, $span=NULL) { + echo " +

+

+ + "; - for ($i = 0; $i < count($headings); $i++) { - $cell = ""; - } else { - $cell = $cell . ">"; - } - echo $cell, $headings[$i], "\n"; - } - echo "\n"; + for ($i = 0; $i < count($headings); $i++) { + $cell = ""; + echo $cell, $headings[$i], "\n"; + } + echo "\n"; } function end_forum_table() { - echo "

\n"; + echo "

\n"; } function show_combo_from_array($name, $array, $selection) { - echo ""; - foreach ($array as $key => $value) { - echo ""; - } - echo ""; + foreach ($array as $key => $value) { + echo ""; + } + echo ""; } function show_forum_title($forum=NULL, $thread=NULL, $helpdesk=false) { - echo "

\n"; - if (!$forum && !$thread) { - echo "

", PROJECT; - if ($helpdesk) { - echo " Help Desk

"; - } else { - echo " Forum

"; - } - } else if ($forum && !$thread) { - echo "", $forum->title, "
"; - if ($helpdesk) { - echo "", PROJECT, " Help Desk"; - } else { - echo "", PROJECT, " Forum"; - } - } else if ($forum && $thread) { - echo "", $thread->title, "
"; - if ($helpdesk) { - echo "", PROJECT, " Help Desk -> id, "\">", $forum->title, ""; - } else { - echo "", PROJECT, " Forum -> id, "\">", $forum->title, ""; - } - } else { - echo "Invalid input to show_forum_title
"; - } - echo "

\n"; + echo "

\n"; + if (!$forum && !$thread) { + echo "

"; + if ($helpdesk) { + echo " Help desk

"; + } else { + echo " Message boards

"; + } + } else if ($forum && !$thread) { + echo ""; + if ($helpdesk) { + echo "", " Help Desk : "; + } else { + echo "", " Message boards : "; + } + echo $forum->title; + echo "
"; + } else if ($forum && $thread) { + echo ""; + if ($helpdesk) { + echo "", " Help Desk : "; + } else { + echo "", " Messages boards : "; + } + echo "id, "\">", $forum->title, " : "; + echo $thread->title; + echo "
"; + } else { + echo "Invalid input to show_forum_title
"; + } + echo "

\n"; } -?> \ No newline at end of file +?> diff --git a/html/forum/forum.php b/html/forum/forum.php index 77d5bc16ac..5a8b0a102d 100644 --- a/html/forum/forum.php +++ b/html/forum/forum.php @@ -10,9 +10,9 @@ define("EXCERPT_LENGTH", "120"); $n = 50; if (empty($_GET['id'])) { - // TODO: Standard error page - echo "Invalid forum ID.
"; - exit(); + // TODO: Standard error page + echo "Invalid forum ID.
"; + exit(); } /* sanitize variable */ @@ -20,26 +20,26 @@ $_GET['id'] = stripslashes(strip_tags($_GET['id'])); $_GET['sort'] = stripslashes(strip_tags($_GET['sort'])); if (!array_key_exists('start', $_GET) || $_GET['start'] < 0) { - $_GET['start'] = 0; + $_GET['start'] = 0; } $forum = getForum($_GET['id']); $category = getCategory($forum->category); if ($category->is_helpdesk) { - page_head('Help Desk'); - $sort_style = 'help-activity-most'; + page_head('Help Desk'); + $sort_style = 'help-activity-most'; } else { - page_head('Forum'); - ($_GET['sort'] != NULL) ? $sort_style = $_GET['sort'] : $sort_style = 'modified-new'; + page_head('Message boards : '.$forum->title); + ($_GET['sort'] != NULL) ? $sort_style = $_GET['sort'] : $sort_style = 'modified-new'; } echo " -
- - - - - + "; - if ($category->is_helpdesk) { - echo ""; - } else { - echo " - - - - - "; - } + echo ""; + if ($category->is_helpdesk) { + echo ""; + } else { + echo " + + + + + "; + } - echo ""; + echo ""; } end_forum_table(); if ($forum->threads > $n) { - echo $gotoStr; + echo $gotoStr; } page_tail(); function show_page_nav($forum) { - global $n; + global $n; - if ($forum->threads > $n) { - $totalPages = floor($forum->threads / $n); - $curPage = floor($_GET['start'] / $n); + if ($forum->threads > $n) { + $totalPages = floor($forum->threads / $n); + $curPage = floor($_GET['start'] / $n); - $pages = array(0, 1, 2); - for ($i = -1 ; $i <= 1 ; $i++) - if ($curPage + $i > 0 && $curPage + $i < $totalPages - 1) - array_push($pages, $curPage + $i); - for ($i = -3 ; $i <= -1 ; $i++) - if ($totalPages + $i > 0) - array_push($pages, $totalPages + $i); - $pages = array_unique($pages); - natsort($pages); - $pages = array_values($pages); + $pages = array(0, 1, 2); + for ($i = -1 ; $i <= 1 ; $i++) { + if ($curPage + $i > 0 && $curPage + $i < $totalPages - 1) { + array_push($pages, $curPage + $i); + } + } + for ($i = -3 ; $i <= -1 ; $i++) { + if ($totalPages + $i > 0) { + array_push($pages, $totalPages + $i); + } + } + $pages = array_unique($pages); + natsort($pages); + $pages = array_values($pages); - $gotoStr = '

Goto page '; + $gotoStr = '

Go to page '; - if ($curPage == 0) - $gotoStr .= '1'; - else - $gotoStr .= 'Previous 1'; + if ($curPage == 0) { + $gotoStr .= '1'; + } else { + $gotoStr .= '1'; + } - for ($i = 1 ; $i < count($pages)-1 ; $i++) { - if ($curPage == $pages[$i]) { - $gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... '; - $gotoStr .= ''.($pages[$i]+1).''; - } else { - $gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... '; - $gotoStr .= ''.($pages[$i]+1).''; - } - } + for ($i = 1 ; $i < count($pages)-1 ; $i++) { + if ($curPage == $pages[$i]) { + $gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... '; + $gotoStr .= ''.($pages[$i]+1).''; + } else { + $gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... '; + $gotoStr .= ''; + } + } - if ($curPage == $totalPages-1) - $gotoStr .= ', '.$totalPages.''; - else - $gotoStr .= ', '.$totalPages.' Next'; + if ($curPage == $totalPages-1) { + $gotoStr .= ', '.$totalPages.''; + } else { + $gotoStr .= ', '; + $gotoStr .= ' \ No newline at end of file +?> diff --git a/html/forum/help_desk.php b/html/forum/help_desk.php index 759cd9b057..99e3474520 100644 --- a/html/forum/help_desk.php +++ b/html/forum/help_desk.php @@ -3,19 +3,19 @@ require_once('forum.inc'); require_once('../util.inc'); -page_head('Forum'); +page_head('Questions and problems'); show_forum_title(NULL, NULL, true); echo "

"; -start_forum_table(array("Help Desk", "Questions", "Last Answer Posted"), array(NULL, 60, 160)); +start_forum_table(array("Topic", "# Questions", "Last answer posted")); $categories = getHelpDeskCategories(); while ($category = mysql_fetch_object($categories)) { echo " -

- + + "; @@ -23,7 +23,7 @@ while ($category = mysql_fetch_object($categories)) { while ($forum = mysql_fetch_object($forums)) { echo " - @@ -40,4 +40,4 @@ echo " "; page_tail(); -?> \ No newline at end of file +?> diff --git a/html/forum/index.php b/html/forum/index.php index d40af3a717..cf825e9caa 100644 --- a/html/forum/index.php +++ b/html/forum/index.php @@ -3,13 +3,16 @@ require_once('forum.inc'); require_once('../util.inc'); -page_head('Forum', NULL, NULL); +page_head('Message boards', NULL, NULL); show_forum_title(NULL, NULL, false); -echo "

Note: For questions or problems pertaining to the ", PROJECT, " client, server, or website, please visit the Help Desk / FAQ.

"; +echo "

Note: For questions or problems about the ".PROJECT." + client, server, or web site, please visit the + Help Desk / FAQ.

+"; -start_forum_table(array("Forum", "Threads", "Posts", "Last Post"), array(NULL, 60, 60, 160)); +start_forum_table(array("Topic", "Threads", "Posts", "Last post")); show_forums(); end_table(); page_tail(); @@ -18,17 +21,19 @@ function show_forums() { $categories = getCategories(); while ($category = mysql_fetch_object($categories)) { echo " - - + + "; $forums = getForums($category->id); while ($forum = mysql_fetch_object($forums)) { echo " - - + @@ -39,4 +44,4 @@ function show_forums() { } } } -?> \ No newline at end of file +?> diff --git a/html/forum/post.php b/html/forum/post.php index be5c4db1e1..e0c2c7e9a4 100644 --- a/html/forum/post.php +++ b/html/forum/post.php @@ -60,7 +60,7 @@ if ($category->is_helpdesk) { } else { $cell = "Post a New Thread / Question"; } -start_forum_table(array($cell), array(NULL), 2); +start_forum_table(array($cell), 2); echo " - - - - "; +row2("", "Add my signature to this post"); +row2("", ""); end_forum_table(); diff --git a/html/forum/reply.php b/html/forum/reply.php index b835ec5709..be3c9dff64 100644 --- a/html/forum/reply.php +++ b/html/forum/reply.php @@ -57,7 +57,7 @@ if ($helpdesk) { show_forum_title($forum, $thread, $helpdesk); -start_forum_table(array("Author", "Message"), array(150, NULL)); +start_forum_table(array("Author", "Message")); // TODO: Use the same sorting method that the user had in the thread view. diff --git a/html/forum/thread.php b/html/forum/thread.php index ce3e033b5b..012f5109c0 100644 --- a/html/forum/thread.php +++ b/html/forum/thread.php @@ -52,11 +52,11 @@ if ($logged_in_user) { // TODO: Include this in show_forum_title? echo " - +
+ + + + + "; // Only show the sort combo box for normal forums, never for the help desk. if (!$category->is_helpdesk) { - echo ""; + echo ""; } echo "\n
"; show_forum_title($forum, NULL, $category->is_helpdesk); @@ -47,30 +47,31 @@ show_forum_title($forum, NULL, $category->is_helpdesk); echo "

\n"; if ($category->is_helpdesk) { - echo "Post a New Question"; + echo "Create a new question"; } else { - echo "Post a New Thread / Question"; + echo "Create a new thread"; } echo "\n

\n
"; - show_combo_from_array("sort", $forum_sort_styles, $sort_style); - echo "\n"; + show_combo_from_array("sort", $forum_sort_styles, $sort_style); + echo "\n
\n"; -// If there are more than the threshold number of threads on the page, only show the -// first $n and display links to the rest +// If there are more than the threshold number of threads on the page, +// show only the first $n and display links to the rest +// show_page_nav($forum); if ($category->is_helpdesk) { - start_forum_table(array("Question", "Answers"), array(NULL, 50)); + start_forum_table(array("Question", "Answers")); } else { - start_forum_table(array("Titles", "Replies", "Author", "Views", "Last Post"), array(NULL, 50, 150, 50, 170)); + start_forum_table(array("Threads", "Posts", "Author", "Views", "Last post")); } // TODO: Move this into its own function? @@ -79,86 +80,105 @@ $threads = getThreads($forum->id, $_GET['start'], $n, $sort_style); $n = 0; while($thread = mysql_fetch_object($threads)) { - $user = lookup_user_id($thread->owner); - $first_post = getFirstPost($thread->id); - $excerpt = sub_sentence($first_post->content, ' ', EXCERPT_LENGTH, true); - echo " -
id, "\">", stripslashes($thread->title), "
- "; - $n = ($n+1)%2; + $user = lookup_user_id($thread->owner); + $first_post = getFirstPost($thread->id); + $excerpt = sub_sentence($first_post->content, ' ', EXCERPT_LENGTH, true); + echo " +
id, "\">", stripslashes($thread->title), "
+ "; + $n = ($n+1)%2; - if ($category->is_helpdesk) { - echo "", stripslashes($excerpt), ""; - } + if ($category->is_helpdesk) { + echo "", stripslashes($excerpt), ""; + } - echo "
", $thread->replies, "", $thread->replies, "owner, "\">", $user->name, "", $thread->views, "", pretty_time_str($thread->timestamp), "", $thread->replies, "", $thread->replies, "owner, "\">", $user->name, "", $thread->views, "", pretty_time_str($thread->timestamp), "
", $category->name, "
", $category->name, "
+ id, "\">", $forum->title, "
", $forum->description, "
", $category->name, "
", $category->name, "
- id, "\">", $forum->title, " +
+ + id, "\">", $forum->title, + "
", $forum->description, "
", $forum->threads, "
Title"; @@ -73,7 +73,7 @@ echo "
Message content + Message "; if ($category->is_helpdesk) { @@ -90,14 +90,9 @@ if ($category->is_helpdesk) { echo "
- Add my signature to this post -     - -
- - + "; if (!$category->is_helpdesk) { - echo ""; + echo ""; } echo "\n
+
"; show_forum_title($forum, $thread, $category->is_helpdesk); @@ -88,10 +88,10 @@ if ($is_subscribed) { echo "Sort / Filter "; - show_combo_from_array("sort", $thread_sort_styles, $sort_style); - show_combo_from_array("filter", $thread_filter_styles, $filter_min); - echo "\nSort / Filter "; + show_combo_from_array("sort", $thread_sort_styles, $sort_style); + show_combo_from_array("filter", $thread_filter_styles, $filter_min); + echo "\n
\n\n"; @@ -102,7 +102,7 @@ if ($category->is_helpdesk) { $headings = array("Author", "Message"); } -start_forum_table($headings, array(150, NULL)); +start_forum_table($headings); show_posts($thread, $sort_style, $filter_min, true, true, $category->is_helpdesk); end_forum_table(); diff --git a/html/user/edit_user_info_action.php b/html/user/edit_user_info_action.php index 7ded116f25..634fc70a0a 100644 --- a/html/user/edit_user_info_action.php +++ b/html/user/edit_user_info_action.php @@ -12,7 +12,7 @@ $postal_code = $HTTP_POST_VARS["postal_code"]; $signature = $HTTP_POST_VARS["signature"]; - $result = mysql_query("update user set name='$name', url='$url', country='$country', postal_code='$postal_code' signature='$signature' where id=$user->id"); + $result = mysql_query("update user set name='$name', url='$url', country='$country', postal_code='$postal_code', signature='$signature' where id=$user->id"); if ($result) { Header("Location: home.php"); } else { diff --git a/html/user/index.php b/html/user/index.php index f208cadecd..c2b287a46b 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -35,8 +35,8 @@

Community

Project totals and leader boards