From 64436e103915e02f8c926639646002b60055dbbd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 7 Jun 2012 10:09:07 +0400 Subject: [PATCH] prevent session modification in public/share --- classes/public_handler.php | 4 +--- include/functions.php | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/classes/public_handler.php b/classes/public_handler.php index 7db341458..51ba48fed 100644 --- a/classes/public_handler.php +++ b/classes/public_handler.php @@ -256,9 +256,7 @@ class Public_Handler extends Handler { $id = db_fetch_result($result, 0, "ref_id"); $owner_uid = db_fetch_result($result, 0, "owner_uid"); - $_SESSION["uid"] = $owner_uid; - $article = format_article($this->link, $id, false, true); - $_SESSION["uid"] = ""; + $article = format_article($this->link, $id, false, true, $owner_uid); print_r($article['content']); diff --git a/include/functions.php b/include/functions.php index 5eb5b97af..3ad438d86 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3102,7 +3102,7 @@ if ($tag_cache === false) { $result = db_query($link, "SELECT tag_cache FROM ttrss_user_entries - WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); + WHERE ref_id = '$id' AND owner_uid = $owner_uid"); $tag_cache = db_fetch_result($result, 0, "tag_cache"); } @@ -3125,7 +3125,7 @@ db_query($link, "UPDATE ttrss_user_entries SET tag_cache = '$tags_str' WHERE ref_id = '$id' - AND owner_uid = " . $_SESSION["uid"]); + AND owner_uid = $owner_uid"); } if ($memcache) $memcache->add($obj_id, $tags, 0, 3600); @@ -3251,7 +3251,9 @@ return $entry; } - function format_article($link, $id, $mark_as_read = true, $zoom_mode = false) { + function format_article($link, $id, $mark_as_read = true, $zoom_mode = false, $owner_uid = false) { + + if (!$owner_uid) $owner_uid = $_SESSION["uid"]; $rv = array(); @@ -3270,7 +3272,7 @@ //if (!$zoom_mode) { print "
$parsed_updated"; @@ -3378,7 +3380,7 @@ $tag_cache = $line["tag_cache"]; if (!$tag_cache) - $tags = get_article_tags($link, $id); + $tags = get_article_tags($link, $id, $owner_uid); else $tags = explode(",", $tag_cache); @@ -3472,7 +3474,7 @@ $rv['content'] .= "
"; - $article_content = sanitize($link, $line["content"], false, false, + $article_content = sanitize($link, $line["content"], false, $owner_uid, $feed_site_url); $rv['content'] .= $article_content;