summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc29
-rw-r--r--modules/system.module2
-rw-r--r--modules/system/system.module2
3 files changed, 17 insertions, 16 deletions
diff --git a/includes/common.inc b/includes/common.inc
index c21036961..c8549b0f3 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -94,25 +94,26 @@ function cache_clear($interval = 0) {
function cache_get() {
global $user, $REQUEST_URI, $REQUEST_METHOD;
- if ($user->id || $REQUEST_METHOD != "GET") {
- return 0;
- }
-
- if ($cache = db_fetch_object(db_query("SELECT * FROM cache WHERE url = '". check_input($REQUEST_URI) ."'"))) {
- cache_clear(variable_get("cache_clear", 30));
-
- return $cache->data;
+ if (!$user->id && $REQUEST_METHOD == "GET") {
+ if ($cache = db_fetch_object(db_query("SELECT * FROM cache WHERE url = '". check_input($REQUEST_URI) ."'"))) {
+ cache_clear(variable_get("cache_clear", 30));
+ }
+ else {
+ ob_start();
+ }
}
- ob_start();
-
- return 0;
+ return $cache->data ? $cache->data : 0;
}
function cache_set() {
- global $REQUEST_URI;
+ global $user, $REQUEST_URI, $REQUEST_METHOD;
- db_query("INSERT INTO cache (url, data, timestamp) VALUES('". check_input($REQUEST_URI) ."', '". check_code(ob_get_contents()) ."', '". time() ."')");
+ if (!$user->id && $REQUEST_METHOD == "GET") {
+ if ($data = ob_get_contents()) {
+ db_query("INSERT INTO cache (url, data, timestamp) VALUES('". addslashes($REQUEST_URI) ."', '". addslashes($data) ."', '". time() ."')");
+ }
+ }
}
function format_interval($timestamp) {
@@ -286,7 +287,7 @@ function page_footer() {
if (variable_get("dev_timer", 0)) {
timer_print();
}
-
+
if (variable_get("cache", 0)) {
cache_set();
}
diff --git a/modules/system.module b/modules/system.module
index 1b459c87f..a3d746705 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -63,7 +63,7 @@ function system_view_options() {
// layout settings:
$output .= "<H3>Layout settings</H3>\n";
foreach ($themes as $key=>$value) $options .= "<OPTION VALUE=\"$key\"". (variable_get("theme_default", key($themes)) == $key ? " SELECTED" : "") .">$key</OPTION>\n";
- $output .= form_item(t("Default theme"), "<SELECT NAME=\"edit[theme_default]\">$options</SELECT>", t("The default theme as seen by new visitors and anonymous users."));
+ $output .= form_item(t("Default theme"), "<SELECT NAME=\"edit[theme_default]\">$options</SELECT>", t("The default theme as seen by visitors or anonymous users."));
$output .= "<HR>\n";
// development settings:
diff --git a/modules/system/system.module b/modules/system/system.module
index 1b459c87f..a3d746705 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -63,7 +63,7 @@ function system_view_options() {
// layout settings:
$output .= "<H3>Layout settings</H3>\n";
foreach ($themes as $key=>$value) $options .= "<OPTION VALUE=\"$key\"". (variable_get("theme_default", key($themes)) == $key ? " SELECTED" : "") .">$key</OPTION>\n";
- $output .= form_item(t("Default theme"), "<SELECT NAME=\"edit[theme_default]\">$options</SELECT>", t("The default theme as seen by new visitors and anonymous users."));
+ $output .= form_item(t("Default theme"), "<SELECT NAME=\"edit[theme_default]\">$options</SELECT>", t("The default theme as seen by visitors or anonymous users."));
$output .= "<HR>\n";
// development settings: