From f27d955a58bffbb9f24c82fcca427e0ac7d37312 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 1 Oct 2006 11:19:39 +0100 Subject: module fixes --- modules/pref-feed-browser.php | 158 ++++++++++++++++++++++++++++++++++++++++++ modules/pref-prefs.php | 40 ++++------- 2 files changed, 172 insertions(+), 26 deletions(-) create mode 100644 modules/pref-feed-browser.php (limited to 'modules') diff --git a/modules/pref-feed-browser.php b/modules/pref-feed-browser.php new file mode 100644 index 000000000..4086822b8 --- /dev/null +++ b/modules/pref-feed-browser.php @@ -0,0 +1,158 @@ +"; + print "Feed information:"; + print "
"; + + $result = db_query($link, "SELECT + feed_url,site_url, + SUBSTRING(last_updated,1,19) AS last_updated + FROM ttrss_feeds WHERE id = '$id'"); + + $feed_url = db_fetch_result($result, 0, "feed_url"); + $site_url = db_fetch_result($result, 0, "site_url"); + $last_updated = db_fetch_result($result, 0, "last_updated"); + + if (get_pref($link, 'HEADLINES_SMART_DATE')) { + $last_updated = smart_date_time(strtotime($last_updated)); + } else { + $short_date = get_pref($link, 'SHORT_DATE_FORMAT'); + $last_updated = date($short_date, strtotime($last_updated)); + } + + print "Site: $site_url ". + "(feed), ". + "Last updated: $last_updated"; + + print "
"; + + $result = db_query($link, "SELECT + ttrss_entries.title, + content,link, + substring(date_entered,1,19) as date_entered, + substring(updated,1,19) as updated + FROM ttrss_entries,ttrss_user_entries + WHERE ttrss_entries.id = ref_id AND feed_id = '$id' + ORDER BY updated DESC LIMIT 5"); + + if (db_num_rows($result) > 0) { + + print "Last headlines:
"; + + print "
"; + print "
"; + } + + print ""; + + return; + } + + print "

This panel shows feeds subscribed by other users of this system, just in case you are interested in some of them too.

"; + + $limit = db_escape_string($_GET["limit"]); + + if (!$limit) $limit = 25; + + $owner_uid = $_SESSION["uid"]; + + $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers + FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf + WHERE tf.feed_url = ttrss_feeds.feed_url + AND owner_uid = '$owner_uid') GROUP BY feed_url + ORDER BY subscribers DESC LIMIT $limit"); + + + print "
+ Top + +
"; + + print "

Selection: + "; + + print "

"; + + print ""; + } +?> + diff --git a/modules/pref-prefs.php b/modules/pref-prefs.php index 8573b4c1c..78bee5fa2 100644 --- a/modules/pref-prefs.php +++ b/modules/pref-prefs.php @@ -1,14 +1,17 @@ + + "; + } + function module_pref_prefs($link) { $subop = $_REQUEST["subop"]; if ($subop == "Save configuration") { - if (WEB_DEMO_MODE) { - header("Location: prefs.php"); - return; - } - $_SESSION["prefs_op_result"] = "save-config"; $_SESSION["prefs_cache"] = false; @@ -45,10 +48,10 @@ } - header("Location: prefs.php"); - } + return prefs_js_redirect(); + } else if ($subop == "getHelp") { $pref_name = db_escape_string($_GET["pn"]); @@ -65,11 +68,6 @@ } else if ($subop == "Change e-mail") { - if (WEB_DEMO_MODE) { - header("Location: prefs.php"); - return; - } - $email = db_escape_string($_GET["email"]); $active_uid = $_SESSION["uid"]; @@ -78,15 +76,10 @@ WHERE id = '$active_uid'"); } - header("Location: prefs.php"); + return prefs_js_redirect(); } else if ($subop == "Change password") { - if (WEB_DEMO_MODE) { - header("Location: prefs.php"); - return; - } - $old_pw = $_POST["OLD_PASSWORD"]; $new_pw = $_POST["OLD_PASSWORD"]; @@ -113,15 +106,10 @@ } } - header("Location: prefs.php"); + return prefs_js_redirect(); } else if ($subop == "Reset to defaults") { - if (WEB_DEMO_MODE) { - header("Location: prefs.php"); - return; - } - $_SESSION["prefs_op_result"] = "reset-to-defaults"; if (DB_TYPE == "pgsql") { @@ -135,7 +123,7 @@ initialize_user_prefs($link, $_SESSION["uid"]); } - header("Location: prefs.php"); + return prefs_js_redirect(); } else if ($subop == "Change theme") { @@ -163,7 +151,7 @@ $_SESSION["theme"] = $theme_path; - header("Location: prefs.php"); + return prefs_js_redirect(); } else { -- cgit v1.2.3