From: Andrew Dolgov Date: Tue, 24 Dec 2013 09:27:57 +0000 (+0400) Subject: remove unnecessary wrapping from share uniqid() keys X-Git-Tag: 1.12~126 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=76d78eb2e75adee00024d3beedaf437c2d91d1c6;p=tt-rss.git remove unnecessary wrapping from share uniqid() keys --- diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 122d4b11..05c2b229 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1891,7 +1891,7 @@ class Pref_Feeds extends Handler_Protected { AND owner_uid = " . $owner_uid); if ($this->dbh->num_rows($result) == 1) { - $key = $this->dbh->escape_string(sha1(uniqid(rand(), true))); + $key = $this->dbh->escape_string(uniqid()); $this->dbh->query("UPDATE ttrss_access_keys SET access_key = '$key' WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat diff --git a/include/functions.php b/include/functions.php index cf9b0510..a64f0978 100644 --- a/include/functions.php +++ b/include/functions.php @@ -80,7 +80,7 @@ "pt_BR" => "Portuguese/Brazil", "zh_CN" => "Simplified Chinese", "sv_SE" => "Svenska", - "fi_FI" => "Suomi", + "fi_FI" => "Suomi", "tr_TR" => "Türkçe"); return $tr; @@ -721,7 +721,7 @@ $_SESSION["name"] = db_fetch_result($result, 0, "login"); $_SESSION["access_level"] = db_fetch_result($result, 0, "access_level"); - $_SESSION["csrf_token"] = sha1(uniqid(rand(), true)); + $_SESSION["csrf_token"] = uniqid(rand(), true); db_query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " . $_SESSION["uid"]); @@ -751,7 +751,7 @@ $_SESSION["auth_module"] = false; if (!$_SESSION["csrf_token"]) { - $_SESSION["csrf_token"] = sha1(uniqid(rand(), true)); + $_SESSION["csrf_token"] = uniqid(rand(), true); } $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; @@ -3747,7 +3747,7 @@ if (db_num_rows($result) == 1) { return db_fetch_result($result, 0, "access_key"); } else { - $key = db_escape_string(sha1(uniqid(rand(), true))); + $key = db_escape_string(uniqid()); $result = db_query("INSERT INTO ttrss_access_keys (access_key, feed_id, is_cat, owner_uid) diff --git a/plugins/instances/init.php b/plugins/instances/init.php index aac28196..069186ad 100644 --- a/plugins/instances/init.php +++ b/plugins/instances/init.php @@ -407,7 +407,7 @@ class Instances extends Plugin implements IHandler { print "
"; - $access_key = sha1(uniqid(rand(), true)); + $access_key = uniqid(); /* Access key */ @@ -439,7 +439,7 @@ class Instances extends Plugin implements IHandler { } function genHash() { - $hash = sha1(uniqid(rand(), true)); + $hash = uniqid(); print json_encode(array("hash" => $hash)); } diff --git a/plugins/share/init.php b/plugins/share/init.php index a000b8eb..5fa99875 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -60,7 +60,7 @@ class Share extends Plugin { function newkey() { $id = db_escape_string($_REQUEST['id']); - $uuid = db_escape_string(sha1(uniqid(rand(), true))); + $uuid = db_escape_string(uniqid()); db_query("UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$id' AND owner_uid = " . $_SESSION['uid']); @@ -91,7 +91,7 @@ class Share extends Plugin { $ref_id = db_fetch_result($result, 0, "ref_id"); if (!$uuid) { - $uuid = db_escape_string(sha1(uniqid(rand(), true))); + $uuid = db_escape_string(uniqid()); db_query("UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param' AND owner_uid = " . $_SESSION['uid']); }