Commit 4e2ee96d authored by Dries's avatar Dries

- Removed left-overs from the rating module. Patch by Gerhard. Updated the

  PostgreSQL and MSSQL database scheme as well.

- Made sure the update script updates the correct tables when database
  prefixing is enabled.  Patch by Bart Jansens.

- Improved the breadcrumb navigation of the book and the forum module as per
  Keith Instone's suggestions.

- Updated page titles (or block titles) and links to match.  Suggested by
  Keith Instone.

- Added missing 'thread' field to the comment table of the MySQL database scheme.
  Fixes bug #2590.
parent 134c9eb8
......@@ -345,7 +345,6 @@ CREATE TABLE [dbo].[users] (
[timestamp] [float] NOT NULL ,
[status] [smallint] NOT NULL ,
[timezone] [varchar] (8) NULL ,
[rating] [float] NULL ,
[language] [char] (2) NULL ,
[init] [varchar] (128) NULL ,
[data] [varchar] (8000) NULL ,
......
......@@ -125,6 +125,7 @@ CREATE TABLE comments (
link varchar(16) NOT NULL default '',
score mediumint(9) NOT NULL default '0',
status tinyint(3) unsigned NOT NULL default '0',
thread varchar(255) NOT NULL,
users mediumtext,
PRIMARY KEY (cid),
KEY lid (nid)
......@@ -509,7 +510,6 @@ CREATE TABLE users (
timestamp int(11) NOT NULL default '0',
status tinyint(4) NOT NULL default '0',
timezone varchar(8) default NULL,
rating decimal(8,2) default NULL,
language char(2) NOT NULL default '',
init varchar(64) default '',
data text,
......
......@@ -509,7 +509,6 @@ CREATE TABLE users (
timestamp integer NOT NULL default '0',
status smallint NOT NULL default '0',
timezone varchar(8) default NULL,
rating decimal(8,2) default NULL,
language char(2) NOT NULL default '',
init varchar(64) default '',
data text default '',
......
......@@ -127,7 +127,7 @@ th {
font-size: 0.9em;
margin: 0.5em;
}
#forum td.created, #forum td.posts, #forum td.topics, #forum td.last-reply, #forum td.replies, #forum td.statistics, #forum td.settings, #forum td.pager {
#forum td.created, #forum td.posts, #forum td.topics, #forum td.last-reply, #forum td.replies, #forum td.pager {
text-align: center;
white-space: nowrap;
}
......
......@@ -411,7 +411,8 @@ function book_view($node, $main = 0) {
// build the tree from bottom to top to have the book index in $level for navigation later
$path = book_location($node);
$trail[] = l(t("Books"), "book");
$trail[] = l(t("Home"), "");
$trail[] = l(t("books"), "book");
foreach ($path as $level) {
$trail[] = l($level->title, "node/view/$level->nid");
}
......
......@@ -411,7 +411,8 @@ function book_view($node, $main = 0) {
// build the tree from bottom to top to have the book index in $level for navigation later
$path = book_location($node);
$trail[] = l(t("Books"), "book");
$trail[] = l(t("Home"), "");
$trail[] = l(t("books"), "book");
foreach ($path as $level) {
$trail[] = l($level->title, "node/view/$level->nid");
}
......
......@@ -455,32 +455,29 @@ function forum_page() {
function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset) {
// forum list, topics list, topic browser and "add new topic" link
theme("header");
/*
** Breadcrumb navigation:
*/
if ($tid) {
$trail[] = l(t("Forums"), "forum");
}
else {
$trail[] = t("Forums");
}
$trail[] = l(t("Home"), "");
$trail[] = l(t("forums"), "forum");
if ($parents) {
$parents = array_reverse($parents);
foreach ($parents as $p) {
if ($tid != $p->tid) {
$trail[] = l($p->name, "forum/$p->tid");
if ($p->tid == $tid) {
$title = $p->name;
}
else {
$trail[] = $p->name;
$trail[] = l(strtolower($p->name), "forum/$p->tid");
}
}
}
$output = "<div id=\"forum\">";
$output .= "<div class=\"path\">". implode($trail, " &raquo; ") ."</div>";
$output .= "<div class=\"title\">$title</div>";
$output .= theme("forum_theme_list", $forums, $parents, $tid);
if ($tid) {
......@@ -489,7 +486,8 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
$output .= "</div>";
theme("box", implode($trail, " &raquo; "), $output);
theme("header");
theme("box", NULL, $output);
theme("footer");
}
......
......@@ -455,32 +455,29 @@ function forum_page() {
function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset) {
// forum list, topics list, topic browser and "add new topic" link
theme("header");
/*
** Breadcrumb navigation:
*/
if ($tid) {
$trail[] = l(t("Forums"), "forum");
}
else {
$trail[] = t("Forums");
}
$trail[] = l(t("Home"), "");
$trail[] = l(t("forums"), "forum");
if ($parents) {
$parents = array_reverse($parents);
foreach ($parents as $p) {
if ($tid != $p->tid) {
$trail[] = l($p->name, "forum/$p->tid");
if ($p->tid == $tid) {
$title = $p->name;
}
else {
$trail[] = $p->name;
$trail[] = l(strtolower($p->name), "forum/$p->tid");
}
}
}
$output = "<div id=\"forum\">";
$output .= "<div class=\"path\">". implode($trail, " &raquo; ") ."</div>";
$output .= "<div class=\"title\">$title</div>";
$output .= theme("forum_theme_list", $forums, $parents, $tid);
if ($tid) {
......@@ -489,7 +486,8 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
$output .= "</div>";
theme("box", implode($trail, " &raquo; "), $output);
theme("header");
theme("box", NULL, $output);
theme("footer");
}
......
......@@ -1553,7 +1553,7 @@ function node_page() {
switch ($op) {
case "add":
theme("box", t("Create new $name"), node_add(arg(2)));
theme("box", t("Submit $name"), node_add(arg(2)));
break;
case "edit":
theme("box", t("Edit $name"), node_edit(arg(2)));
......
......@@ -1553,7 +1553,7 @@ function node_page() {
switch ($op) {
case "add":
theme("box", t("Create new $name"), node_add(arg(2)));
theme("box", t("Submit $name"), node_add(arg(2)));
break;
case "edit":
theme("box", t("Edit $name"), node_edit(arg(2)));
......
......@@ -9,12 +9,12 @@ function story_help($section = "admin/story/help") {
case "admin/system/modules/story":
$output = "Stories are like newspaper articles. They tend to follow a publishing flow of <b>submit -&gt; moderate -&gt; post to the main page -&gt; comments</b>. Below you may fix a minimum word count for stories and also write some submission or content guidelines for users wanting to post a story.";
break;
case "admin/story/help":
case "admin/story/help":
$output = "<p>The story module lets your users submit articles for consideration by the rest of the community, who can vote on them if moderation is enabled. Stories usually follow a publishing flow of <b>submit -&gt; moderate -&gt; post to the main page -&gt; comments</b>. Administrators are able to shortcut this flow as desired.</p>";
$output .= "In ". l("site configuration &gt;&gt; modules &gt;&gt; story", "admin/system/modules/story") ." you can set up an introductory text for story authors, and a floor on the number of words which may be included in a story. This is designed to help discourage the submission of trivially short stories.";
break;
}
return t($output);
}
......
......@@ -9,12 +9,12 @@ function story_help($section = "admin/story/help") {
case "admin/system/modules/story":
$output = "Stories are like newspaper articles. They tend to follow a publishing flow of <b>submit -&gt; moderate -&gt; post to the main page -&gt; comments</b>. Below you may fix a minimum word count for stories and also write some submission or content guidelines for users wanting to post a story.";
break;
case "admin/story/help":
case "admin/story/help":
$output = "<p>The story module lets your users submit articles for consideration by the rest of the community, who can vote on them if moderation is enabled. Stories usually follow a publishing flow of <b>submit -&gt; moderate -&gt; post to the main page -&gt; comments</b>. Administrators are able to shortcut this flow as desired.</p>";
$output .= "In ". l("site configuration &gt;&gt; modules &gt;&gt; story", "admin/system/modules/story") ." you can set up an introductory text for story authors, and a floor on the number of words which may be included in a story. This is designed to help discourage the submission of trivially short stories.";
break;
}
return t($output);
}
......
......@@ -334,7 +334,7 @@ function user_fields() {
}
// Make sure we return the default fields at least
return is_array($fields) ? $fields: array("uid", "name", "pass", "mail", "homepage", "mode", "sort", "threshold", "theme", "signature", "timestamp", "status", "timezone", "rating", "language", "init", "data", "rid");
return is_array($fields) ? $fields: array("uid", "name", "pass", "mail", "homepage", "mode", "sort", "threshold", "theme", "signature", "timestamp", "status", "timezone", "language", "init", "data", "rid");
}
/*** Module hooks **********************************************************/
......@@ -886,7 +886,7 @@ function user_register($edit = array()) {
user_role_init();
// TODO: is this necessary? Won't session_write replicate this?
unset($edit["session"]);
$account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "rating" => 0, "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data));
$account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data));
watchdog("user", "new user: '". $edit["name"] ."' &lt;". $edit["mail"] ."&gt;", l(t("edit user"), "admin/user/edit/$account->uid"));
$variables = array("%username" => $edit["name"], "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => $base_url, "%uri_brief" => substr($base_url, strlen("http://")), "%mailto" => $edit["mail"], "%date" => format_date(time()));
......@@ -1012,13 +1012,12 @@ function user_edit($edit = array()) {
*/
if (!user_access("administer users")) {
if (array_intersect(array_keys($edit), array("rid", "init", "rating", "session"))) {
if (array_intersect(array_keys($edit), array("rid", "init", "session"))) {
watchdog("warning", "detected malicious attempt to alter a protected database field");
}
$edit["rid"] = $user->rid;
$edit["init"] = $user->init;
$edit["rating"] = $user->rating;
$edit["session"] = $user->session;
}
......
......@@ -334,7 +334,7 @@ function user_fields() {
}
// Make sure we return the default fields at least
return is_array($fields) ? $fields: array("uid", "name", "pass", "mail", "homepage", "mode", "sort", "threshold", "theme", "signature", "timestamp", "status", "timezone", "rating", "language", "init", "data", "rid");
return is_array($fields) ? $fields: array("uid", "name", "pass", "mail", "homepage", "mode", "sort", "threshold", "theme", "signature", "timestamp", "status", "timezone", "language", "init", "data", "rid");
}
/*** Module hooks **********************************************************/
......@@ -886,7 +886,7 @@ function user_register($edit = array()) {
user_role_init();
// TODO: is this necessary? Won't session_write replicate this?
unset($edit["session"]);
$account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "rating" => 0, "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data));
$account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data));
watchdog("user", "new user: '". $edit["name"] ."' &lt;". $edit["mail"] ."&gt;", l(t("edit user"), "admin/user/edit/$account->uid"));
$variables = array("%username" => $edit["name"], "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => $base_url, "%uri_brief" => substr($base_url, strlen("http://")), "%mailto" => $edit["mail"], "%date" => format_date(time()));
......@@ -1012,13 +1012,12 @@ function user_edit($edit = array()) {
*/
if (!user_access("administer users")) {
if (array_intersect(array_keys($edit), array("rid", "init", "rating", "session"))) {
if (array_intersect(array_keys($edit), array("rid", "init", "session"))) {
watchdog("warning", "detected malicious attempt to alter a protected database field");
}
$edit["rid"] = $user->rid;
$edit["init"] = $user->init;
$edit["rating"] = $user->rating;
$edit["session"] = $user->session;
}
......
......@@ -171,6 +171,9 @@ table {
.node .links a, .comment .links a {
font-weight: bold;
}
.path a, .path a:visited {
color: #777;
}
.comment .title {
font-weight: bold;
font-size: 1.1em;
......
......@@ -329,11 +329,11 @@ function _update_thread_structure($comments, $pid, $depth, $structure) {
}
function update_60() {
update_sql("ALTER TABLE forum DROP icon");
update_sql("ALTER TABLE {forum} DROP icon");
}
function update_61() {
update_sql("CREATE TABLE IF NOT EXISTS sessions (
update_sql("CREATE TABLE IF NOT EXISTS {sessions} (
uid int(10) unsigned NOT NULL,
sid varchar(32) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
......@@ -344,9 +344,9 @@ function update_61() {
KEY timestamp (timestamp)
)");
update_sql("ALTER TABLE users DROP session;");
update_sql("ALTER TABLE users DROP hostname;");
update_sql("ALTER TABLE users DROP sid;");
update_sql("ALTER TABLE {users} DROP session;");
update_sql("ALTER TABLE {users} DROP hostname;");
update_sql("ALTER TABLE {users} DROP sid;");
}
function _update_next_thread($structure, $parent) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment