From 66c5b70736553b2c84eb8835e7b4c3ad7c34c8f8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 22 Oct 2002 18:46:43 +0000 Subject: - 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. --- modules/blog.module | 2 +- modules/blog/blog.module | 2 +- modules/node.module | 8 ++++---- modules/node/node.module | 8 ++++---- modules/poll.module | 7 ++++--- modules/poll/poll.module | 7 ++++--- modules/profile.module | 10 +++++----- modules/profile/profile.module | 10 +++++----- modules/tracker.module | 2 +- modules/tracker/tracker.module | 2 +- modules/user.module | 16 ++++++++-------- modules/user/user.module | 16 ++++++++-------- 12 files changed, 46 insertions(+), 44 deletions(-) (limited to 'modules') 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"] = "
". t("The body of your blog is too short.") ."
"; + $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"] = "
". t("The body of your blog is too short.") ."
"; + $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"] = "
". t("You have to specify a valid title.") ."
"; + $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"] = "
". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."
"; + $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"] = "
". t("You have to specifiy a valid date.") ."
"; + $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"] = "
". t("You have to specify a valid title.") ."
"; + $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"] = "
". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."
"; + $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"] = "
". t("You have to specifiy a valid date.") ."
"; + $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"] = "". t("Negative values are not allowed.") .""; + $error["chvotes][$i"] = theme_invoke("theme_error", t("Negative values are not allowed.")); } } if ($actualchoices < 2) { - $error["choice][0"] = "". t("You must fill in at least two choices.") .""; + $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() { - ?>

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.

+ ?> +

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.

chvotes[$i] < 0) { - $error["chvotes][$i"] = "". t("Negative values are not allowed.") .""; + $error["chvotes][$i"] = theme_invoke("theme_error", t("Negative values are not allowed.")); } } if ($actualchoices < 2) { - $error["choice][0"] = "". t("You must fill in at least two choices.") .""; + $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() { - ?>

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.

+ ?> +

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.

*"; + 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 ." *"; + 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 .= "\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 .= "\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 .= "

". check_output($error) ."

"; + $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 .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } /* @@ -800,7 +800,7 @@ function user_register($edit = array()) { } else { if ($error) { - $output .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } } @@ -917,7 +917,7 @@ function user_edit($edit = array()) { } if ($error) { - $output .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } if (!$edit) { @@ -1141,7 +1141,7 @@ function user_admin_create($edit = array()) { else { if ($error) { - $output .= "

". check_output($error) ."

"; + $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 .= "

". check_output($error) ."

"; + $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 .= "

". check_output($error) ."

"; + $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 .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } /* @@ -800,7 +800,7 @@ function user_register($edit = array()) { } else { if ($error) { - $output .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } } @@ -917,7 +917,7 @@ function user_edit($edit = array()) { } if ($error) { - $output .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } if (!$edit) { @@ -1141,7 +1141,7 @@ function user_admin_create($edit = array()) { else { if ($error) { - $output .= "

". check_output($error) ."

"; + $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 .= "

". check_output($error) ."

"; + $output .= theme_invoke("theme_error", check_output($error)); } } else if ($op == "Delete account") { -- cgit v1.2.3