forked from PHPFusion/PHPFusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
showphoto.php
71 lines (67 loc) · 3 KB
/
showphoto.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: showphoto.php
| Author: Nick Jones (Digitanium)
| Co-Author: Robert Gaudyn (Wooya)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
if (!db_exists(DB_PHOTO_ALBUMS)) {
$_GET['code'] = 404;
require_once __DIR__.'/error.php';
exit;
}
include LOCALE.LOCALESET."photogallery.php";
define("SAFEMODE", @ini_get("safe_mode") ? TRUE : FALSE);
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n";
echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='".$locale['xml_lang']."' lang='".$locale['xml_lang']."'>\n";
echo "<head>\n<title>".$settings['sitename']."</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=".$locale['charset']."' />\n";
echo "<meta name='description' content='".$settings['description']."' />\n";
echo "<meta name='keywords' content='".$settings['keywords']."' />\n";
echo "<link rel='stylesheet' href='".THEME."styles.css' type='text/css' />\n";
echo "<script type='text/javascript' src='".INCLUDES."jscript.js'></script>\n";
echo "</head>\n<body style='margin:0'>\n";
if (isset($_GET['photo_id']) && isnum($_GET['photo_id'])) {
$result = dbquery("SELECT tp.photo_filename, ta.album_id, ta.album_access FROM ".DB_PHOTOS." tp
LEFT JOIN ".DB_PHOTO_ALBUMS." ta USING (album_id)
WHERE photo_id='".$_GET['photo_id']."' GROUP BY tp.photo_id
");
if (dbrows($result)) {
$data = dbarray($result);
if (!checkgroup($data['album_access'])) {
redirect(FUSION_SELF);
} else {
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
if ($settings['photo_watermark'] == 1) {
$parts = explode(".", $data['photo_filename']);
$wm_file2 = $parts[0]."_w2.".$parts[1];
if (!file_exists(PHOTODIR.$wm_file2)) {
$photo_file = "photo.php?photo_id=".$_GET['photo_id']."&full";
} else {
$photo_file = PHOTODIR.$wm_file2;
}
} else {
$photo_file = PHOTODIR.$data['photo_filename'];
}
echo "<div style='text-align:center;vertical-align:middle;'><a href=\"javascript:;\" onclick=\"window.close();\"><img src='$photo_file' alt='".$data['photo_filename']."' title='".$locale['458']."' style='border:0px' /></a></div>\n";
}
} else {
echo "<script type='text/javascript'>window.close();</script>\n";
}
} else {
redirect("photogallery.php");
}
echo "</body>\n</html>\n";
?>