aboutsummaryrefslogtreecommitdiff
path: root/simplecache/view.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-16 11:22:15 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-16 11:22:15 +0000
commit67961769f46444e5462f63212409ae0e69e217f1 (patch)
treef3e3b9d6521b2155a924be08746401d7eb621339 /simplecache/view.php
parent0a6d410bb02de58fe7c9d80b0642cdc12d982939 (diff)
downloadelgg-67961769f46444e5462f63212409ae0e69e217f1.tar.gz
elgg-67961769f46444e5462f63212409ae0e69e217f1.tar.bz2
Committing the simplecache for views.
git-svn-id: https://code.elgg.org/elgg/trunk@2759 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'simplecache/view.php')
-rw-r--r--simplecache/view.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/simplecache/view.php b/simplecache/view.php
new file mode 100644
index 000000000..b7e4e7fe5
--- /dev/null
+++ b/simplecache/view.php
@@ -0,0 +1,44 @@
+<?php
+
+ /**
+ * Simple cache viewer
+ * Bypasses the engine to view simple cached CSS views.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ // Get DB settings, connect
+ require_once(dirname(dirname(__FILE__)). '/engine/settings.php');
+
+ global $CONFIG, $viewinput;
+
+ $contents = '';
+ if (!isset($viewinput)) $viewinput = $_GET;
+
+ if ($dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass)) {
+
+ $view = $viewinput['view'];
+
+ // Get the dataroot
+ if (@mysql_select_db($CONFIG->dbname,$dblink)) {
+ if ($result = mysql_query("select value from {$CONFIG->dbprefix}datalists where name = 'dataroot'",$dblink)) {
+ $row = mysql_fetch_object($result);
+ $dataroot = $row->value;
+ }
+ $filename = $dataroot . 'views_simplecache/' . md5($view);
+ if (file_exists($filename))
+ $contents = @file_get_contents($filename);
+ else {
+ echo ''; exit;
+ }
+ }
+ }
+
+ echo $contents;
+
+?> \ No newline at end of file