diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-10-22 18:46:43 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-10-22 18:46:43 +0000 |
commit | 66c5b70736553b2c84eb8835e7b4c3ad7c34c8f8 (patch) | |
tree | 605fc52b5bd8fa8e2411dee975e34c2e83276595 | |
parent | 88d6ef3a2ad99a0872b00f40e84c083b098ad21c (diff) | |
download | brdo-66c5b70736553b2c84eb8835e7b4c3ad7c34c8f8.tar.gz brdo-66c5b70736553b2c84eb8835e7b4c3ad7c34c8f8.tar.bz2 |
- Wrapped some hardcoded colors in "theme_invoke()"s; we can still create
a drupal_error() later on but I think we better get used to theme_invoke().
- Fixed translation bug. Patch by Moshe.
- Fixed PHP warning. Patch by ax.
-rw-r--r-- | database/database.mysql | 2 | ||||
-rw-r--r-- | includes/theme.inc | 19 | ||||
-rw-r--r-- | modules/blog.module | 2 | ||||
-rw-r--r-- | modules/blog/blog.module | 2 | ||||
-rw-r--r-- | modules/node.module | 8 | ||||
-rw-r--r-- | modules/node/node.module | 8 | ||||
-rw-r--r-- | modules/poll.module | 7 | ||||
-rw-r--r-- | modules/poll/poll.module | 7 | ||||
-rw-r--r-- | modules/profile.module | 10 | ||||
-rw-r--r-- | modules/profile/profile.module | 10 | ||||
-rw-r--r-- | modules/tracker.module | 2 | ||||
-rw-r--r-- | modules/tracker/tracker.module | 2 | ||||
-rw-r--r-- | modules/user.module | 16 | ||||
-rw-r--r-- | modules/user/user.module | 16 |
14 files changed, 64 insertions, 47 deletions
diff --git a/database/database.mysql b/database/database.mysql index c35019bc6..994ea4f91 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -2,7 +2,7 @@ -- -- Host: localhost Database: drupal_devel --------------------------------------------------------- --- Server version 3.23.52-nt +-- Server version 3.23.52-nt -- -- Table structure for table 'access' diff --git a/includes/theme.inc b/includes/theme.inc index 108347da7..62239da12 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -75,6 +75,21 @@ class BaseTheme { } +function theme_mark() { + /* + ** Return a marker. Used to indicate new comments or required form + ** fields. + */ + return "<span style=\"color: red;\">*</span>"; +} + +function theme_error($message) { + /* + ** Return an error message. + */ + return "<div style=\"color: red;\">$message</div>"; +} + function theme_list() { static $list; @@ -125,12 +140,12 @@ function theme_blocks($region, &$theme) { function theme_invoke() { global $theme; $args = func_get_args(); - + $function = array_shift($args); if (method_exists($theme, $function)) { return call_user_method_array($function, $theme, $args); - } + } else { return call_user_func_array($function, $args); } diff --git a/modules/blog.module b/modules/blog.module index 7aba6d5dc..0869fe19e 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -228,7 +228,7 @@ function blog_form(&$node, &$help, &$error) { */ if (count(explode(" ", $node->body)) < variable_get("minimum_blog_size", 0)) { - $error["body"] = "<div style=\"color: red;\">". t("The body of your blog is too short.") ."</div>"; + $error["body"] = theme_invoke("theme_error", t("The body of your blog is too short.")); } } else { diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 7aba6d5dc..0869fe19e 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -228,7 +228,7 @@ function blog_form(&$node, &$help, &$error) { */ if (count(explode(" ", $node->body)) < variable_get("minimum_blog_size", 0)) { - $error["body"] = "<div style=\"color: red;\">". t("The body of your blog is too short.") ."</div>"; + $error["body"] = theme_invoke("theme_error", t("The body of your blog is too short.")); } } else { diff --git a/modules/node.module b/modules/node.module index 398404aee..d337687ad 100644 --- a/modules/node.module +++ b/modules/node.module @@ -727,7 +727,7 @@ function node_validate($node, &$error) { */ if (isset($node->title) && !$node->title) { - $error["title"] = "<div style=\"color: red;\">". t("You have to specify a valid title.") ."</div>"; + $error["title"] = theme_invoke("theme_error", t("You have to specify a valid title.")); } if (user_access("administer nodes")) { @@ -760,7 +760,7 @@ function node_validate($node, &$error) { $node->uid = $account->uid; } else { - $error["name"] = "<div style=\"color: red;\">". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."</div>"; + $error["name"] = theme_invoke("theme_error", t("The name '%u' does not exist.", array ("%u" => $node->name))); } /* @@ -771,7 +771,7 @@ function node_validate($node, &$error) { $node->created = strtotime($node->date); } else { - $error["date"] = "<div style=\"color: red;\">". t("You have to specifiy a valid date.") ."</div>"; + $error["date"] = theme_invoke("theme_error", t("You have to specifiy a valid date.")); } } @@ -933,7 +933,7 @@ function node_add($type) { if ($edit[$field]) { $node[$field] = check_input($edit[$field]); } - } + } $output = node_form($node); } else { diff --git a/modules/node/node.module b/modules/node/node.module index 398404aee..d337687ad 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -727,7 +727,7 @@ function node_validate($node, &$error) { */ if (isset($node->title) && !$node->title) { - $error["title"] = "<div style=\"color: red;\">". t("You have to specify a valid title.") ."</div>"; + $error["title"] = theme_invoke("theme_error", t("You have to specify a valid title.")); } if (user_access("administer nodes")) { @@ -760,7 +760,7 @@ function node_validate($node, &$error) { $node->uid = $account->uid; } else { - $error["name"] = "<div style=\"color: red;\">". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."</div>"; + $error["name"] = theme_invoke("theme_error", t("The name '%u' does not exist.", array ("%u" => $node->name))); } /* @@ -771,7 +771,7 @@ function node_validate($node, &$error) { $node->created = strtotime($node->date); } else { - $error["date"] = "<div style=\"color: red;\">". t("You have to specifiy a valid date.") ."</div>"; + $error["date"] = theme_invoke("theme_error", t("You have to specifiy a valid date.")); } } @@ -933,7 +933,7 @@ function node_add($type) { if ($edit[$field]) { $node[$field] = check_input($edit[$field]); } - } + } $output = node_form($node); } else { diff --git a/modules/poll.module b/modules/poll.module index f6dca48df..7c22e041c 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -86,12 +86,12 @@ function poll_form(&$node, &$help, &$error) { } if ($node->chvotes[$i] < 0) { - $error["chvotes][$i"] = "<span style=\"color: red;\">". t("Negative values are not allowed.") ."</span>"; + $error["chvotes][$i"] = theme_invoke("theme_error", t("Negative values are not allowed.")); } } if ($actualchoices < 2) { - $error["choice][0"] = "<span style=\"color: red;\">". t("You must fill in at least two choices.") ."</span>"; + $error["choice][0"] = theme_invoke("theme_error", t("You must fill in at least two choices.")); } } else { @@ -125,7 +125,8 @@ function poll_form(&$node, &$help, &$error) { } function poll_help() { - ?><p>Drupal's poll module allows users with at least content posting privileges to submit multiple-choice questions that others can vote on. Any user with sufficient privileges can vote. Please note that this is fully controlled by Drupal's access control features. For example, users might be required to login before voting (or even seeing the page where the voting occurs) or it could be open to the world.</p> + ?> + <p>Drupal's poll module allows users with at least content posting privileges to submit multiple-choice questions that others can vote on. Any user with sufficient privileges can vote. Please note that this is fully controlled by Drupal's access control features. For example, users might be required to login before voting (or even seeing the page where the voting occurs) or it could be open to the world.</p> <?php } diff --git a/modules/poll/poll.module b/modules/poll/poll.module index f6dca48df..7c22e041c 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -86,12 +86,12 @@ function poll_form(&$node, &$help, &$error) { } if ($node->chvotes[$i] < 0) { - $error["chvotes][$i"] = "<span style=\"color: red;\">". t("Negative values are not allowed.") ."</span>"; + $error["chvotes][$i"] = theme_invoke("theme_error", t("Negative values are not allowed.")); } } if ($actualchoices < 2) { - $error["choice][0"] = "<span style=\"color: red;\">". t("You must fill in at least two choices.") ."</span>"; + $error["choice][0"] = theme_invoke("theme_error", t("You must fill in at least two choices.")); } } else { @@ -125,7 +125,8 @@ function poll_form(&$node, &$help, &$error) { } function poll_help() { - ?><p>Drupal's poll module allows users with at least content posting privileges to submit multiple-choice questions that others can vote on. Any user with sufficient privileges can vote. Please note that this is fully controlled by Drupal's access control features. For example, users might be required to login before voting (or even seeing the page where the voting occurs) or it could be open to the world.</p> + ?> + <p>Drupal's poll module allows users with at least content posting privileges to submit multiple-choice questions that others can vote on. Any user with sufficient privileges can vote. Please note that this is fully controlled by Drupal's access control features. For example, users might be required to login before voting (or even seeing the page where the voting occurs) or it could be open to the world.</p> <?php } diff --git a/modules/profile.module b/modules/profile.module index 5503d7ee9..58c2882ab 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -54,9 +54,9 @@ function profile_conf_options() { $output .= form_select(t("Publicly accessible fields"), "profile_public_fields", variable_get("profile_public_fields", array()), $fields, t("The fields users will be able to set and that will be publicly visible."), "size=\"6\"", 1); $output .= form_select(t("Private fields"), "profile_private_fields", variable_get("profile_private_fields", array()), $fields, t("The fields users will be able to set, but which are kept private."), "size=\"6\"", 1); - $output .= form_textfield(t("Avatar image path"), "profile_avatar_path", variable_get("profile_avatar_path", "misc/avatars/"), 30, 255, t("Path for avatar directory; it must be writeable and visible from the web.")); - $output .= form_textfield(t("Avatar max size"), "profile_avatar_size", variable_get("profile_avatar_size", "85x85"), 10, 10, t("Maximum size for avatars.")); - $output .= form_textfield(t("Avatar max filesize"), "profile_avatar_filesize", variable_get("profile_avatar_filesize", "30"), 10, 10, t("Maximum filesize for avatars, in kb.")); + $output .= form_textfield(t("Avatar image path"), "profile_avatar_path", variable_get("profile_avatar_path", "misc/avatars/"), 30, 255, t("Path for avatar directory; it must be writeable and visible from the web.")); + $output .= form_textfield(t("Avatar max size"), "profile_avatar_size", variable_get("profile_avatar_size", "85x85"), 10, 10, t("Maximum size for avatars.")); + $output .= form_textfield(t("Avatar max filesize"), "profile_avatar_filesize", variable_get("profile_avatar_filesize", "30"), 10, 10, t("Maximum filesize for avatars, in kb.")); return $output; } @@ -86,12 +86,12 @@ function profile_user($type, $edit, &$user) { case "view_private": // when user looks at his own data return _profile_user_view($user, "private"); - } + } } function profile_required($title) { // this pleads "theme_invoke, theme_invoke" ;) - return $title ." <span style=\"color: red;\">*</span>"; + return $title ." ". theme_invoke("theme_mark"); } function _profile_form($edit, $mode) { diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 5503d7ee9..58c2882ab 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -54,9 +54,9 @@ function profile_conf_options() { $output .= form_select(t("Publicly accessible fields"), "profile_public_fields", variable_get("profile_public_fields", array()), $fields, t("The fields users will be able to set and that will be publicly visible."), "size=\"6\"", 1); $output .= form_select(t("Private fields"), "profile_private_fields", variable_get("profile_private_fields", array()), $fields, t("The fields users will be able to set, but which are kept private."), "size=\"6\"", 1); - $output .= form_textfield(t("Avatar image path"), "profile_avatar_path", variable_get("profile_avatar_path", "misc/avatars/"), 30, 255, t("Path for avatar directory; it must be writeable and visible from the web.")); - $output .= form_textfield(t("Avatar max size"), "profile_avatar_size", variable_get("profile_avatar_size", "85x85"), 10, 10, t("Maximum size for avatars.")); - $output .= form_textfield(t("Avatar max filesize"), "profile_avatar_filesize", variable_get("profile_avatar_filesize", "30"), 10, 10, t("Maximum filesize for avatars, in kb.")); + $output .= form_textfield(t("Avatar image path"), "profile_avatar_path", variable_get("profile_avatar_path", "misc/avatars/"), 30, 255, t("Path for avatar directory; it must be writeable and visible from the web.")); + $output .= form_textfield(t("Avatar max size"), "profile_avatar_size", variable_get("profile_avatar_size", "85x85"), 10, 10, t("Maximum size for avatars.")); + $output .= form_textfield(t("Avatar max filesize"), "profile_avatar_filesize", variable_get("profile_avatar_filesize", "30"), 10, 10, t("Maximum filesize for avatars, in kb.")); return $output; } @@ -86,12 +86,12 @@ function profile_user($type, $edit, &$user) { case "view_private": // when user looks at his own data return _profile_user_view($user, "private"); - } + } } function profile_required($title) { // this pleads "theme_invoke, theme_invoke" ;) - return $title ." <span style=\"color: red;\">*</span>"; + return $title ." ". theme_invoke("theme_mark"); } function _profile_form($edit, $mode) { diff --git a/modules/tracker.module b/modules/tracker.module index 32a8a0885..e663ea798 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -48,7 +48,7 @@ function tracker_comments($id = 0) { $output .= "<ul>"; while ($comment = db_fetch_object($cresult)) { - $output .= " <li>". l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n"; + $output .= " <li>". l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? theme_invoke("theme_mark") : "") ."</li>\n"; } $output .= " </ul>\n"; } diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index 32a8a0885..e663ea798 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -48,7 +48,7 @@ function tracker_comments($id = 0) { $output .= "<ul>"; while ($comment = db_fetch_object($cresult)) { - $output .= " <li>". l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n"; + $output .= " <li>". l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid), "node", $comment->cid) ." ". t("by") ." ". format_name($comment) ." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? theme_invoke("theme_mark") : "") ."</li>\n"; } $output .= " </ul>\n"; } diff --git a/modules/user.module b/modules/user.module index d2c4d1734..835b8a996 100644 --- a/modules/user.module +++ b/modules/user.module @@ -77,7 +77,7 @@ function user_load($array = array()) { $result = db_query("SELECT u.*, r.name AS role FROM users u LEFT JOIN role r ON u.rid = r.rid WHERE $query u.status < 3 LIMIT 1"); $user = db_fetch_object($result); - if ($data = unserialize($user->data)) { + if ($user->data && $data = unserialize($user->data)) { foreach ($data as $key => $value) { if (!isset($user->$key)) { $user->$key = $value; @@ -188,7 +188,7 @@ function user_validate_mail($mail) { */ if ($mail && !eregi("^[0-9a-z_\.-]+@(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,})$", $mail)) { - return t("The e-mail address '$mail' is not valid."); + return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail)); } } @@ -579,7 +579,7 @@ function user_login($edit = array(), $msg = "") { */ if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } /* @@ -678,7 +678,7 @@ function user_pass($edit = array()) { // Display error message if necessary. if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } /* @@ -800,7 +800,7 @@ function user_register($edit = array()) { } else { if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } } @@ -917,7 +917,7 @@ function user_edit($edit = array()) { } if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } if (!$edit) { @@ -1141,7 +1141,7 @@ function user_admin_create($edit = array()) { else { if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } $output .= form_textfield("Username", "name", $edit["name"], 30, 55); @@ -1396,7 +1396,7 @@ function user_admin_edit($edit = array()) { $output .= status(t("your user information changes have been saved.")); } else { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } } else if ($op == "Delete account") { diff --git a/modules/user/user.module b/modules/user/user.module index d2c4d1734..835b8a996 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -77,7 +77,7 @@ function user_load($array = array()) { $result = db_query("SELECT u.*, r.name AS role FROM users u LEFT JOIN role r ON u.rid = r.rid WHERE $query u.status < 3 LIMIT 1"); $user = db_fetch_object($result); - if ($data = unserialize($user->data)) { + if ($user->data && $data = unserialize($user->data)) { foreach ($data as $key => $value) { if (!isset($user->$key)) { $user->$key = $value; @@ -188,7 +188,7 @@ function user_validate_mail($mail) { */ if ($mail && !eregi("^[0-9a-z_\.-]+@(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,})$", $mail)) { - return t("The e-mail address '$mail' is not valid."); + return t("The e-mail address '%mail' is not valid.", array("%mail" => $mail)); } } @@ -579,7 +579,7 @@ function user_login($edit = array(), $msg = "") { */ if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } /* @@ -678,7 +678,7 @@ function user_pass($edit = array()) { // Display error message if necessary. if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } /* @@ -800,7 +800,7 @@ function user_register($edit = array()) { } else { if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } } @@ -917,7 +917,7 @@ function user_edit($edit = array()) { } if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } if (!$edit) { @@ -1141,7 +1141,7 @@ function user_admin_create($edit = array()) { else { if ($error) { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } $output .= form_textfield("Username", "name", $edit["name"], 30, 55); @@ -1396,7 +1396,7 @@ function user_admin_edit($edit = array()) { $output .= status(t("your user information changes have been saved.")); } else { - $output .= "<p><span style=\"color: red;\" class=\"error\">". check_output($error) ."</span></p>"; + $output .= theme_invoke("theme_error", check_output($error)); } } else if ($op == "Delete account") { |