summaryrefslogtreecommitdiff
path: root/db-prefs.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-08-04 19:38:25 +0400
committerAndrew Dolgov <[email protected]>2011-08-04 19:54:44 +0400
commit7d96bfcd6d6d7ad527b0b78ccf5e8cb0dacad1ab (patch)
treed11c80e526466032b2a8a1be6b56fc1124804d08 /db-prefs.php
parente56beb95fab70161da676cb5d28fd0abd06c11ac (diff)
misc headlines speedup
Diffstat (limited to 'db-prefs.php')
-rw-r--r--db-prefs.php46
1 files changed, 23 insertions, 23 deletions
diff --git a/db-prefs.php b/db-prefs.php
index cc2bb22e2..cf941cebe 100644
--- a/db-prefs.php
+++ b/db-prefs.php
@@ -21,6 +21,13 @@
$prefs_cache = false;
}
+ if ($prefs_cache && !defined('DISABLE_SESSIONS') && !SINGLE_USER_MODE) {
+ if ($_SESSION["prefs_cache"] && @$_SESSION["prefs_cache"][$pref_name]) {
+ $tuple = $_SESSION["prefs_cache"][$pref_name];
+ return convert_pref_type($tuple["value"], $tuple["type"]);
+ }
+ }
+
if ($profile) {
$profile_qpart = "profile = '$profile' AND";
} else {
@@ -29,20 +36,13 @@
if (get_schema_version($link) < 63) $profile_qpart = "";
- if ($prefs_cache && !defined('DISABLE_SESSIONS') && !SINGLE_USER_MODE) {
- if ($_SESSION["prefs_cache"] && @$_SESSION["prefs_cache"][$pref_name]) {
- $tuple = $_SESSION["prefs_cache"][$pref_name];
- return convert_pref_type($tuple["value"], $tuple["type"]);
- }
- }
-
- $result = db_query($link, "SELECT
- value,ttrss_prefs_types.type_name as type_name
- FROM
+ $result = db_query($link, "SELECT
+ value,ttrss_prefs_types.type_name as type_name
+ FROM
ttrss_user_prefs,ttrss_prefs,ttrss_prefs_types
- WHERE
+ WHERE
$profile_qpart
- ttrss_user_prefs.pref_name = '$pref_name' AND
+ ttrss_user_prefs.pref_name = '$pref_name' AND
ttrss_prefs_types.id = type_id AND
owner_uid = '$user_id' AND
ttrss_user_prefs.pref_name = ttrss_prefs.pref_name");
@@ -51,7 +51,7 @@
$value = db_fetch_result($result, 0, "value");
$type_name = db_fetch_result($result, 0, "type_name");
- if (!defined('DISABLE_SESSIONS') && !SINGLE_USER_MODE) {
+ if (!defined('DISABLE_SESSIONS') && !SINGLE_USER_MODE) {
if ($user_id = $_SESSION["uid"]) {
$_SESSION["prefs_cache"][$pref_name]["type"] = $type_name;
$_SESSION["prefs_cache"][$pref_name]["value"] = $value;
@@ -59,8 +59,8 @@
}
return convert_pref_type($value, $type_name);
-
- } else {
+
+ } else {
if ($die_on_error) {
die("Fatal error, unknown preferences key: $pref_name");
} else {
@@ -70,10 +70,10 @@
}
function convert_pref_type($value, $type_name) {
- if ($type_name == "bool") {
- return $value == "true";
- } else if ($type_name == "integer") {
- return sprintf("%d", $value);
+ if ($type_name == "bool") {
+ return $value == "true";
+ } else if ($type_name == "integer") {
+ return sprintf("%d", $value);
} else {
return $value;
}
@@ -99,8 +99,8 @@
if (get_schema_version($link) < 63) $profile_qpart = "";
- $result = db_query($link, "SELECT type_name
- FROM ttrss_prefs,ttrss_prefs_types
+ $result = db_query($link, "SELECT type_name
+ FROM ttrss_prefs,ttrss_prefs_types
WHERE pref_name = '$key' AND type_id = ttrss_prefs_types.id");
if (db_num_rows($result) > 0) {
@@ -125,8 +125,8 @@
$value = 'UTC';
}
- db_query($link, "UPDATE ttrss_user_prefs SET
- value = '$value' WHERE pref_name = '$key'
+ db_query($link, "UPDATE ttrss_user_prefs SET
+ value = '$value' WHERE pref_name = '$key'
$profile_qpart
AND owner_uid = " . $_SESSION["uid"]);