blob: b839b6966bedc30875ca792a083573275b555b97 (
plain)
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
|
<?php
/*
* jQuery File Upload Plugin PHP Example 5.14
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
error_reporting(E_ALL | E_STRICT);
require "../bootstrap.php";
session_name(SESSION);
session_start();
$c = new cache(REDIS_CONNECT, REDIS_DB);
$c->bypassCache = true;
$db = new db();
if ( ! isset($_SESSION["username"]))
$u = null;
else
$u = $_SESSION["username"];
$user = new jg($u);
if ( ! isset($_SESSION["gallery"]) || is_null($_SESSION["gallery"]) || $_SESSION["gallery"] == "" ){
$_SESSION["gallery"] = 1;
}
if ( isset($_GET["thumb"]) ){
if( ! isset($_GET["file"]) || $_GET["file"] == "" ){
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
redirect("404");
exit;
}
if ( is_file(IMAGE_PATH . $_SESSION["gallery"] . '/thumbnail/' . $_GET["file"]) ){
header("X-Accel-Redirect: " . '/protected/' . $_SESSION["gallery"] . '/thumbnail/' . $_GET["file"]);
}
} else {
require('UploadHandler.php');
$upload_handler = new UploadHandler();
$c->flush2();
}
|