From 4dccf1ed93948f6e75750c31ba6bb0abf053e52b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 5 Mar 2007 13:50:46 +0100 Subject: more i18n work --- modules/pref-feeds.php | 7 ++++--- modules/pref-filters.php | 52 ++++++++++++++++++++++-------------------------- modules/pref-users.php | 19 ++++++++---------- 3 files changed, 36 insertions(+), 42 deletions(-) (limited to 'modules') diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 1f5a9d9da..5a5d0f0e7 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -443,9 +443,9 @@ } if (subscribe_to_feed($link, $feed_url, $cat_id)) { - print format_notice(sprintf(__("Subscribed to %s."), $feed_url)); + print_notice(T_sprintf("Subscribed to %s.", $feed_url)); } else { - print format_warning(sprintf(__("Already subscribed to %s."), $feed_url)); + print_warning(T_sprintf("Already subscribed to %s.", $feed_url)); } if ($p_from != 'tt-rss') { @@ -547,7 +547,8 @@ } else { - print format_warning(sprintf(__("Category $%s already exists in the database."), $feed_cat)); + print_warning(T_sprintf("Category $%s already exists in the database.", + $feed_cat)); } } diff --git a/modules/pref-filters.php b/modules/pref-filters.php index e3447c1ab..1403464b1 100644 --- a/modules/pref-filters.php +++ b/modules/pref-filters.php @@ -148,49 +148,45 @@ enabled = $enabled, inverse = $inverse, action_param = '$action_param' - WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); + WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); + } if ($subop == "remove") { - if (!WEB_DEMO_MODE) { - - $ids = split(",", db_escape_string($_GET["ids"])); + $ids = split(",", db_escape_string($_GET["ids"])); - foreach ($ids as $id) { - db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]); - - } + foreach ($ids as $id) { + db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]); } } if ($subop == "add") { - if (!WEB_DEMO_MODE) { + $regexp = db_escape_string(trim($_GET["reg_exp"])); + $filter_type = db_escape_string(trim($_GET["filter_type"])); + $feed_id = db_escape_string($_GET["feed_id"]); + $action_id = db_escape_string($_GET["action_id"]); + $action_param = db_escape_string($_GET["action_param"]); - $regexp = db_escape_string(trim($_GET["reg_exp"])); - $filter_type = db_escape_string(trim($_GET["filter_type"])); - $feed_id = db_escape_string($_GET["feed_id"]); - $action_id = db_escape_string($_GET["action_id"]); - $action_param = db_escape_string($_GET["action_param"]); + $inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"])); - $inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"])); + if (!$regexp) return; - if (!$regexp) return; + if (!$feed_id) { + $feed_id = 'NULL'; + } else { + $feed_id = sprintf("'%s'", db_escape_string($feed_id)); + } - if (!$feed_id) { - $feed_id = 'NULL'; - } else { - $feed_id = sprintf("'%s'", db_escape_string($feed_id)); - } + $result = db_query($link, + "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id, + action_id, action_param, inverse) + VALUES + ('$regexp', '$filter_type','".$_SESSION["uid"]."', + $feed_id, '$action_id', '$action_param', $inverse)"); - $result = db_query($link, - "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id, - action_id, action_param, inverse) - VALUES - ('$regexp', '$filter_type','".$_SESSION["uid"]."', - $feed_id, '$action_id', '$action_param', $inverse)"); - } + print_notice(T_sprintf("Created filter %s", htmlspecialchars($regexp))); } if ($quiet) return; diff --git a/modules/pref-users.php b/modules/pref-users.php index be9660a34..fbd6d7762 100644 --- a/modules/pref-users.php +++ b/modules/pref-users.php @@ -68,14 +68,14 @@ $login = db_escape_string(trim($_GET["login"])); $uid = db_escape_string($_GET["id"]); - $access_level = sprintf("%d", $_GET["access_level"]); + $access_level = (int) $_GET["access_level"]; $email = db_escape_string(trim($_GET["email"])); $password = db_escape_string(trim($_GET["password"])); if ($password) { $pwd_hash = 'SHA1:' . sha1($password); $pass_query_part = "pwd_hash = '$pwd_hash', "; - print format_notice(sprintf(__('Changed password of user %s.'), $login)); + print_notice(T_sprintf('Changed password of user %s.', $login)); } else { $pass_query_part = ""; } @@ -120,21 +120,18 @@ $new_uid = db_fetch_result($result, 0, "id"); - print format_notice(sprintf(__("Added user %s - with password %s"), $login, $tmp_user_pwd)); + print_notice(T_sprintf("Added user %s with password %s", + $login, $tmp_user_pwd)); initialize_user($link, $new_uid); } else { - print format_warning(sprintf(__("Could not create user %s"), - $login)); + print_warning(T_sprintf("Could not create user %s", $login)); } } else { - print format_warning(sprintf(__("User %s already exists."), - $login)); - + print_warning(T_sprintf("User %s already exists.", $login)); } } } else if ($subop == "resetPass") { @@ -154,8 +151,8 @@ db_query($link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash' WHERE id = '$uid'"); - print format_notice(sprintf(__("Changed password of user %s - to %s"), $login, $tmp_user_pwd)); + print_notice(T_sprintf("Changed password of user %s + to %s", $login, $tmp_user_pwd)); if (MAIL_RESET_PASS && $email) { print " Notifying $email."; -- cgit v1.2.3