-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicon.php
More file actions
40 lines (32 loc) · 994 Bytes
/
icon.php
File metadata and controls
40 lines (32 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Icon display
*
* @package Elggwikis
*/
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
$wiki_guid = get_input('wiki_guid');
$wiki = get_entity($wiki_guid);
$size = strtolower(get_input('size'));
if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
$size = "medium";
$success = false;
$filehandler = new ElggFile();
$filehandler->owner_guid = $wiki->owner_guid;
$filehandler->setFilename("wikis/" . $wiki->guid . $size . ".jpg");
$success = false;
if ($filehandler->open("read")) {
if ($contents = $filehandler->read($filehandler->size())) {
$success = true;
}
}
if (!$success) {
$location = elgg_get_plugins_path() . "socialwiki/graphics/default{$size}.jpg";
$contents = @file_get_contents($location);
}
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;