$_SESSION["pref_sort_feeds"] = $feeds_sort;
if ($feed_search) {
- $search_qpart = "(UPPER(title) LIKE UPPER('%$feed_search%') OR
- UPPER(feed_url) LIKE UPPER('%$feed_search%')) AND";
+ $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR
+ UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND";
} else {
$search_qpart = "";
}
ttrss_filter_types.description AS filter_type_descr,
feed_id,
ttrss_filter_actions.description AS action_description,
- (SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title
+ ttrss_feeds.title AS feed_title
FROM
- ttrss_filters,ttrss_filter_types,ttrss_filter_actions
+ ttrss_filters,ttrss_filter_types,ttrss_filter_actions LEFT JOIN
+ ttrss_feeds ON (feed_id = ttrss_feeds.id)
WHERE
filter_type = ttrss_filter_types.id AND
ttrss_filter_actions.id = action_id AND
$_SESSION["prefs_op_result"] = "save-config";
+ $_SESSION["prefs_cache"] = false;
+
foreach (array_keys($_POST) as $pref_name) {
$pref_name = db_escape_string($pref_name);
<?
- // TODO cache last query results
-
require_once "config.php";
require_once "db.php";
+ session_start();
+
+ if (!$_SESSION["prefs_cache"])
+ $_SESSION["prefs_cache"] = array();
+
function get_pref($link, $pref_name, $user_id = false) {
$pref_name = db_escape_string($pref_name);
$user_id = $_SESSION["uid"];
} else {
$user_id = sprintf("%d", $user_id);
+ $prefs_cache = false;
+ }
+
+ if ($_SESSION["prefs_cache"] && $_SESSION["prefs_cache"][$pref_name]) {
+ return $_SESSION["prefs_cache"][$pref_name];
}
$result = db_query($link, "SELECT
$type_name = db_fetch_result($result, 0, "type_name");
if ($type_name == "bool") {
- return $value == "true";
+ $retv = $value == "true";
} else if ($type_name == "integer") {
- return sprintf("%d", $value);
+ $retv = sprintf("%d", $value);
} else {
- return $value;
+ $retv = $value;
+ }
+
+ if ($user_id = $_SESSION["uid"]) {
+ $_SESSION["prefs_cache"][$pref_name] = $value;
}
+ return $value;
} else {
die("Fatal error, unknown preferences key: $pref_name");