aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/icondirect.php
diff options
context:
space:
mode:
authorkevinjardine <kevinjardine@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-23 21:29:14 +0000
committerkevinjardine <kevinjardine@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-23 21:29:14 +0000
commit0139841a1c0836f738fe0917ad09d84e356b68ea (patch)
treeaa9d7bb53e90b9e5a80cfaa4d96f83a556268557 /mod/profile/icondirect.php
parent592d51e94bd7071e9b75c069ff91da311ec001ff (diff)
downloadelgg-0139841a1c0836f738fe0917ad09d84e356b68ea.tar.gz
elgg-0139841a1c0836f738fe0917ad09d84e356b68ea.tar.bz2
Added the ability to turn simplecache on and off.
git-svn-id: https://code.elgg.org/elgg/trunk@2908 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/profile/icondirect.php')
-rw-r--r--mod/profile/icondirect.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php
index ee7f0a5e3..49d230efa 100644
--- a/mod/profile/icondirect.php
+++ b/mod/profile/icondirect.php
@@ -17,7 +17,7 @@
$contents = '';
- if ($dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass)) {
+ if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass)) {
$username = $_GET['username'];
@@ -57,10 +57,19 @@
$size = "medium";
// Try and get the icon
- if (@mysql_select_db($CONFIG->dbname,$dblink)) {
- if ($result = mysql_query("select value from {$CONFIG->dbprefix}datalists where name = 'dataroot'",$dblink)) {
+ if (@mysql_select_db($CONFIG->dbname,$mysql_dblink)) {
+ // get dataroot and simplecache_enabled in one select for efficiency
+ if ($result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name in ('dataroot','simplecache_enabled')",$mysql_dblink)) {
+ $simplecache_enabled = true;
$row = mysql_fetch_object($result);
- $dataroot = $row->value;
+ while ($row) {
+ if ($row->name == 'dataroot') {
+ $dataroot = $row->value;
+ } else if ($row->name == 'simplecache_enabled') {
+ $simplecache_enabled = $row->value;
+ }
+ $row = mysql_fetch_object($result);
+ }
}
$filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg";
$contents = @file_get_contents($filename);
@@ -70,13 +79,18 @@
global $CONFIG, $viewinput;
$viewinput['view'] = 'icon/user/default/'.$size;
- ob_start();
- include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php');
- $loc = ob_get_clean();
+ if ($simplecache_enabled) {
+ ob_start();
+ include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php');
+ $loc = ob_get_clean();
+ //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg");
+ } else {
+ mysql_close($mysql_dblink);
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ $loc = elgg_view($viewinput['view']);
+ }
header('Location: ' . $loc);
- exit;
- //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg");
-
+ exit;
}
header("Content-type: image/jpeg");