|
Revision 2, 1.6 kB
(checked in by sven, 3 years ago)
|
importing elgg-0.1.1a
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
if (isset($parameter)) { |
|---|
| 6 |
|
|---|
| 7 |
$fileid = (int) $parameter; |
|---|
| 8 |
$file = db_query("select * from files where ident = $fileid"); |
|---|
| 9 |
if (sizeof($file) > 0) { |
|---|
| 10 |
if (run("users:access_level_check",$file[0]->access) || $file[0]->owner == $_SESSION['userid']) { |
|---|
| 11 |
if (!in_array(run("files:mimetype:inline",$file[0]->location), $data['mimetype:inline'])) { |
|---|
| 12 |
$run_result .= "<a href=\""; |
|---|
| 13 |
$run_result .= url . run("users:id_to_name",$file[0]->owner) . "/files/" . $file[0]->folder . "/" . $file[0]->ident . "/" . $file[0]->originalname; |
|---|
| 14 |
$run_result .= "\" >"; |
|---|
| 15 |
$run_result .= stripslashes($file[0]->title); |
|---|
| 16 |
$run_result .= "</a>"; |
|---|
| 17 |
} else { |
|---|
| 18 |
list($width, $height, $type, $attr) = getimagesize($file[0]->location); |
|---|
| 19 |
if ($width > 400 || $height > 400) { |
|---|
| 20 |
$run_result .= "<a href=\""; |
|---|
| 21 |
$run_result .= url . run("users:id_to_name",$file[0]->owner) . "/files/" . $file[0]->folder . "/" . $file[0]->ident . "/" . $file[0]->originalname; |
|---|
| 22 |
$run_result .= "\" >"; |
|---|
| 23 |
$run_result .= stripslashes($file[0]->title); |
|---|
| 24 |
$run_result .= "</a>"; |
|---|
| 25 |
} else { |
|---|
| 26 |
$run_result .= "<img src=\""; |
|---|
| 27 |
$run_result .= url . run("users:id_to_name",$file[0]->owner) . "/files/" . $file[0]->folder . "/" . $file[0]->ident . "/" . $file[0]->originalname; |
|---|
| 28 |
$run_result .= "\" $attr alt=\"".htmlentities(stripslashes($file[0]->title))."\" />"; |
|---|
| 29 |
} |
|---|
| 30 |
} |
|---|
| 31 |
} else { |
|---|
| 32 |
$run_result .= "<b>[You do not have permission to access this file]</b>"; |
|---|
| 33 |
} |
|---|
| 34 |
} else { |
|---|
| 35 |
$run_result .= "<b>[File does not exist]</b>"; |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
?> |
|---|