From 044cff2d74ece46256201695346d1a0d1d66c746 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 13 Apr 2013 18:24:27 +0400 Subject: implement basic feed authentication parameter encryption in the database (FEED_CRYPT_KEY) --- include/functions.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index f5685b89a..73ed97d08 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1614,12 +1614,20 @@ "SELECT id FROM ttrss_feeds WHERE feed_url = '$url' AND owner_uid = ".$_SESSION["uid"]); + if (strlen(FEED_CRYPT_KEY) > 0) { + require_once "crypt.php"; + $auth_pass = substr(encrypt_string($auth_pass), 0, 250); + $auth_pass_encrypted = 'true'; + } else { + $auth_pass_encrypted = 'false'; + } + if (db_num_rows($result) == 0) { $result = db_query($link, "INSERT INTO ttrss_feeds - (owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method) + (owner_uid,feed_url,title,cat_id, auth_login,auth_pass,update_method,auth_pass_encrypted) VALUES ('".$_SESSION["uid"]."', '$url', - '[Unknown]', $cat_qpart, '$auth_login', '$auth_pass', 0)"); + '[Unknown]', $cat_qpart, '$auth_login', '$auth_pass', 0, $auth_pass_encrypted)"); $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE feed_url = '$url' -- cgit v1.2.3