remove unnecessary wrapping from share uniqid() keys

This commit is contained in:
Andrew Dolgov 2013-12-24 13:27:57 +04:00
parent d31d521f79
commit 76d78eb2e7
4 changed files with 9 additions and 9 deletions

View File

@ -1891,7 +1891,7 @@ class Pref_Feeds extends Handler_Protected {
AND owner_uid = " . $owner_uid); AND owner_uid = " . $owner_uid);
if ($this->dbh->num_rows($result) == 1) { 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' $this->dbh->query("UPDATE ttrss_access_keys SET access_key = '$key'
WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat WHERE feed_id = '$feed_id' AND is_cat = $sql_is_cat

View File

@ -721,7 +721,7 @@
$_SESSION["name"] = db_fetch_result($result, 0, "login"); $_SESSION["name"] = db_fetch_result($result, 0, "login");
$_SESSION["access_level"] = db_fetch_result($result, 0, "access_level"); $_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 = " . db_query("UPDATE ttrss_users SET last_login = NOW() WHERE id = " .
$_SESSION["uid"]); $_SESSION["uid"]);
@ -751,7 +751,7 @@
$_SESSION["auth_module"] = false; $_SESSION["auth_module"] = false;
if (!$_SESSION["csrf_token"]) { if (!$_SESSION["csrf_token"]) {
$_SESSION["csrf_token"] = sha1(uniqid(rand(), true)); $_SESSION["csrf_token"] = uniqid(rand(), true);
} }
$_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"]; $_SESSION["ip_address"] = $_SERVER["REMOTE_ADDR"];
@ -3747,7 +3747,7 @@
if (db_num_rows($result) == 1) { if (db_num_rows($result) == 1) {
return db_fetch_result($result, 0, "access_key"); return db_fetch_result($result, 0, "access_key");
} else { } else {
$key = db_escape_string(sha1(uniqid(rand(), true))); $key = db_escape_string(uniqid());
$result = db_query("INSERT INTO ttrss_access_keys $result = db_query("INSERT INTO ttrss_access_keys
(access_key, feed_id, is_cat, owner_uid) (access_key, feed_id, is_cat, owner_uid)

View File

@ -407,7 +407,7 @@ class Instances extends Plugin implements IHandler {
print "<hr/>"; print "<hr/>";
$access_key = sha1(uniqid(rand(), true)); $access_key = uniqid();
/* Access key */ /* Access key */
@ -439,7 +439,7 @@ class Instances extends Plugin implements IHandler {
} }
function genHash() { function genHash() {
$hash = sha1(uniqid(rand(), true)); $hash = uniqid();
print json_encode(array("hash" => $hash)); print json_encode(array("hash" => $hash));
} }

View File

@ -60,7 +60,7 @@ class Share extends Plugin {
function newkey() { function newkey() {
$id = db_escape_string($_REQUEST['id']); $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' db_query("UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$id'
AND owner_uid = " . $_SESSION['uid']); AND owner_uid = " . $_SESSION['uid']);
@ -91,7 +91,7 @@ class Share extends Plugin {
$ref_id = db_fetch_result($result, 0, "ref_id"); $ref_id = db_fetch_result($result, 0, "ref_id");
if (!$uuid) { 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' db_query("UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param'
AND owner_uid = " . $_SESSION['uid']); AND owner_uid = " . $_SESSION['uid']);
} }