-
Notifications
You must be signed in to change notification settings - Fork 151
/
index.php
86 lines (75 loc) · 2.45 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
<?php
/**
* This file implements the index.
*
* PHP versions 4 and 5
*
* LICENSE:
*
* This file is part of PhotoShow.
*
* PhotoShow 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.
*
* PhotoShow 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 PhotoShow. If not, see <http://www.gnu.org/licenses/>.
*
* @category Website
* @package Photoshow
* @author Thibaud Rohmer <[email protected]>
* @copyright 2011 Thibaud Rohmer
* @license http://www.gnu.org/licenses/
* @link http://github.com/thibaud-rohmer/PhotoShow-v2
*/
/// Start session
session_start();
/// Because we don't care about notices
if(function_exists("error_reporting")){
error_reporting(E_ERROR | E_WARNING);
}
/// Autoload classes
function my_autoload($class){
if(file_exists(dirname(__FILE__)."/src/classes/$class.php")){
require(dirname(__FILE__)."/src/classes/$class.php");
}else{
return FALSE;
}
}
spl_autoload_register("my_autoload");
/// Take care of nasty exceptions
function exception_handler($exception) {
echo "<div class='exception'>" , $exception->getMessage(), "</div>\n";
}
set_exception_handler('exception_handler');
ini_set('upload_max_filesize','10M');
function protect_user_send_var($var){
if(is_array($var))
return array_map('protect_user_send_var', $var);
else
return addslashes($var);
}
/// workaround for splitting basename whith beginning utf8 multibyte char
/// See https://bugs.php.net/bug.php?id=37268
function mb_basename($filepath, $suffix = NULL) {
$splited = preg_split ( '/\//', rtrim ( $filepath, '/ ' ) );
return substr ( basename ( 'X' . $splited [count ( $splited ) - 1], $suffix ), 1 );
}
if (!get_magic_quotes_gpc()){
$_POST = protect_user_send_var($_POST);
$_COOKIE = protect_user_send_var($_COOKIE);
$_GET = protect_user_send_var($_GET);
}
if(isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] == 'text/xml'){
// Nope, definitely not ready yet.
// new API();
}else{
new Index();
}
?>