From dea94d966389092be57ea517065c8822242711ae Mon Sep 17 00:00:00 2001 From: kevinjardine Date: Tue, 24 Feb 2009 10:36:23 +0000 Subject: Made icon views work properly for non-default icons, and introduced elgg_view_enable_simplecache and elgg_view_disable_simplecache functions. git-svn-id: https://code.elgg.org/elgg/trunk@2910 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/icondirect.php | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'mod/profile/icondirect.php') diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index 49d230efa..497420f55 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -71,33 +71,30 @@ $row = mysql_fetch_object($result); } } - $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg"; - $contents = @file_get_contents($filename); } } - if (empty($contents)) { - - global $CONFIG, $viewinput; - $viewinput['view'] = 'icon/user/default/'.$size; - if ($simplecache_enabled) { + if ($simplecache_enabled) { + $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg"; + $contents = @file_get_contents($filename); + if (empty($contents)) { + global $viewinput; + $viewinput['view'] = 'icon/user/default/'.$size; ob_start(); include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php'); $loc = ob_get_clean(); + header('Location: ' . $loc); + exit; //$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']); + } else { + header("Content-type: image/jpeg"); + header('Expires: ' . date('r',time() + 864000)); + header("Pragma: public"); + header("Cache-Control: public"); + header("Content-Length: " . strlen($contents)); + echo $contents; } - header('Location: ' . $loc); - exit; + } else { + mysql_close($mysql_dblink); + require_once(dirname(__FILE__).'/icon.php'); } - - header("Content-type: image/jpeg"); - header('Expires: ' . date('r',time() + 864000)); - header("Pragma: public"); - header("Cache-Control: public"); - header("Content-Length: " . strlen($contents)); - echo $contents; - ?> \ No newline at end of file -- cgit v1.2.3