forked from thibaud-rohmer/PhotoLight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
113 lines (100 loc) · 2.51 KB
/
index.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
*
* PHP versions 3, 4 and 5
*
* LICENSE:
*
* This file is part of PhotoLight.
*
* PhotoLight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PhotoLight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhotoLight. If not, see <http://www.gnu.org/licenses/>.
*
* @category Website
* @package Photolight
* @author Thibaud Rohmer <[email protected]>
* @copyright 2011 Thibaud Rohmer
* @license http://www.gnu.org/licenses/
* @link http://github.com/thibaud-rohmer/PhotoLight
*/
// load up config file
require_once("resources/config.php");
require_once(TEMPLATES_PATH . "/functions.php");
$dir = $config['path'];
if(file_exists($config['thumbs_path']."/new.txt")){
$new = file($config['thumbs_path']."/new.txt");
}else{
$new = array();
}
// Get image
if(isset($_GET['i'])){
$i = r2a(stripslashes($_GET['i']),$config['path']);
if(inGoodPlace($i,$config['path'])){
return output($i);
}else{
$err = "Wrong image path";
}
}
// Get thumb
if(isset($_GET['t'])){
$i = r2a(stripslashes($_GET['t']),$config['path']);
$t = r2a(stripslashes($_GET['t']),$config['thumbs_path']);
// Image in good place
if(inGoodPlace($i,$config['path'])){
// No thumb yet
if(!file_exists($t)){
create_thumb($i,$t,$config['thumbs_path']);
}
if(file_exists($t)){
return output($t);
}else{
return output($i);
}
}else{
$err = "Wrong image path";
}
}
// Get folder
if(isset($_GET['f'])){
$d = r2a(stripslashes($_GET['f']),$config['path']);
if(inGoodPlace($d,$config['path'])){
$dir = $d;
}else{
$err = "Wrong path.";
}
}
require_once(TEMPLATES_PATH . "/header.php");
?>
<body>
<div id="container">
<?php
if(isset($err)){
echo "<div id='err'>$err</div>";
}
?>
<div id="breadcrumbs">
<?php require_once(TEMPLATES_PATH . "/breadcrumbs.php"); ?>
</div>
<div id="content">
<?php require_once(TEMPLATES_PATH . "/content.php"); ?>
</div>
<div id="viewer">
<div id="imgviewer">
</div>
</div>
<div id="loading">
Loading...
</div>
</div>
</body>
</html>