Merge branch 'master' of git.fakecake.org:tt-rss

This commit is contained in:
Andrew Dolgov 2015-07-06 21:31:57 +03:00
commit 74c1ff6065
3 changed files with 25 additions and 11 deletions

View File

@ -65,26 +65,26 @@ class Pref_Prefs extends Handler_Protected {
$con_pw = $_POST["confirm_password"]; $con_pw = $_POST["confirm_password"];
if ($old_pw == "") { if ($old_pw == "") {
print "ERROR: ".__("Old password cannot be blank."); print "ERROR: ".format_error("Old password cannot be blank.");
return; return;
} }
if ($new_pw == "") { if ($new_pw == "") {
print "ERROR: ".__("New password cannot be blank."); print "ERROR: ".format_error("New password cannot be blank.");
return; return;
} }
if ($new_pw != $con_pw) { if ($new_pw != $con_pw) {
print "ERROR: ".__("Entered passwords do not match."); print "ERROR: ".format_error("Entered passwords do not match.");
return; return;
} }
$authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]); $authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
if (method_exists($authenticator, "change_password")) { if (method_exists($authenticator, "change_password")) {
print $authenticator->change_password($_SESSION["uid"], $old_pw, $new_pw); print format_notice($authenticator->change_password($_SESSION["uid"], $old_pw, $new_pw));
} else { } else {
print "ERROR: ".__("Function not supported by authentication module."); print "ERROR: ".format_error("Function not supported by authentication module.");
} }
} }
@ -244,6 +244,8 @@ class Pref_Prefs extends Handler_Protected {
print "<h2>" . __("Password") . "</h2>"; print "<h2>" . __("Password") . "</h2>";
print "<div style='display : none' id='pwd_change_infobox'></div>";
$result = $this->dbh->query("SELECT id FROM ttrss_users $result = $this->dbh->query("SELECT id FROM ttrss_users
WHERE id = ".$_SESSION["uid"]." AND pwd_hash WHERE id = ".$_SESSION["uid"]." AND pwd_hash
= 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'"); = 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'");
@ -264,12 +266,20 @@ class Pref_Prefs extends Handler_Protected {
onComplete: function(transport) { onComplete: function(transport) {
notify(''); notify('');
if (transport.responseText.indexOf('ERROR: ') == 0) { if (transport.responseText.indexOf('ERROR: ') == 0) {
notify_error(transport.responseText.replace('ERROR: ', ''));
$('pwd_change_infobox').innerHTML =
transport.responseText.replace('ERROR: ', '');
} else { } else {
notify_info(transport.responseText); $('pwd_change_infobox').innerHTML =
transport.responseText.replace('ERROR: ', '');
var warn = $('default_pass_warning'); var warn = $('default_pass_warning');
if (warn) Element.hide(warn); if (warn) Element.hide(warn);
} }
new Effect.Appear('pwd_change_infobox');
}}); }});
this.reset(); this.reset();
} }

View File

@ -1483,9 +1483,9 @@
$tag = preg_replace('/[\'\"\+\>\<]/', "", $tag); $tag = preg_replace('/[\'\"\+\>\<]/', "", $tag);
// $tag = str_replace('"', "", $tag); if (DB_TYPE == "mysql") {
// $tag = str_replace("+", " ", $tag); $tag = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $tag);
$tag = str_replace("technorati tag: ", "", $tag); }
return $tag; return $tag;
} }

View File

@ -761,9 +761,13 @@
// Workaround: 4-byte unicode requires utf8mb4 in MySQL. See https://tt-rss.org/forum/viewtopic.php?f=1&t=3377&p=20077#p20077 // Workaround: 4-byte unicode requires utf8mb4 in MySQL. See https://tt-rss.org/forum/viewtopic.php?f=1&t=3377&p=20077#p20077
if (DB_TYPE == "mysql") { if (DB_TYPE == "mysql") {
foreach ($article as $k => $v) { foreach ($article as $k => $v) {
// i guess we'll have to take the risk of 4byte unicode labels & tags here
if (!is_array($article[$k])) {
$article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v); $article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v);
} }
} }
}
$entry_tags = $article["tags"]; $entry_tags = $article["tags"];
$entry_guid = db_escape_string($entry_guid); $entry_guid = db_escape_string($entry_guid);