aboutsummaryrefslogtreecommitdiff
path: root/images/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'images/index.php')
-rw-r--r--images/index.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/images/index.php b/images/index.php
new file mode 100644
index 0000000..b839b69
--- /dev/null
+++ b/images/index.php
@@ -0,0 +1,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();
+}