diff options
author | Andrew Dolgov <[email protected]> | 2010-01-14 12:04:38 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-01-14 12:04:38 +0300 |
commit | 6ba506224e8eead2bbb456180b0f15773506c9b9 (patch) | |
tree | e375fe5cb47349810ab5f3347d57b5ff8d87ad43 | |
parent | c3b7b797f51793825b5fa992635d951736df239a (diff) |
get_user_theme_path: cache data
-rw-r--r-- | functions.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/functions.php b/functions.php index 2156d8f9f..71f3cbb16 100644 --- a/functions.php +++ b/functions.php @@ -1999,12 +1999,18 @@ $theme_id = 1; } - $result = db_query($link, "SELECT theme_path - FROM ttrss_themes WHERE id = '$theme_id'"); - if (db_num_rows($result) != 0) { - return db_fetch_result($result, 0, "theme_path"); + if (!$_SESSION["theme_path"][$theme_id]) { + $result = db_query($link, "SELECT theme_path + FROM ttrss_themes WHERE id = '$theme_id'"); + if (db_num_rows($result) != 0) { + $theme = db_fetch_result($result, 0, "theme_path"); + $_SESSION["theme_path"][$theme_id] = $theme; + return $theme; + } else { + return null; + } } else { - return null; + return $_SESSION["theme_path"][$theme_id]; } } |