summaryrefslogtreecommitdiff
path: root/forum/htdocs
diff options
context:
space:
mode:
authordeva <deva>2008-10-11 10:55:28 +0000
committerdeva <deva>2008-10-11 10:55:28 +0000
commit07882614bfd402132d2f8df23cc23c2c013b5f14 (patch)
treec66a6cd2ce98d04921882176e90a2226c7db5350 /forum/htdocs
parentf6d90d8d3504fc1ba428da81e77c4484c4646f30 (diff)
Did a lot of work on the imagecache, and the filehandler. Now both are functional, and used indirectly throught index.php, thus requiering login for access.
Diffstat (limited to 'forum/htdocs')
-rw-r--r--forum/htdocs/imagecache.php62
-rw-r--r--forum/htdocs/index.php26
2 files changed, 18 insertions, 70 deletions
diff --git a/forum/htdocs/imagecache.php b/forum/htdocs/imagecache.php
deleted file mode 100644
index f23a51d..0000000
--- a/forum/htdocs/imagecache.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-include_once("config.php");
-include_once($UTIL_DIR . "/ping.php");
-
-
-function rescale($image) {
-
- $maxwidth = 300;
- $maxheight = 240;
-
- $width = imagesx($image);
- $height = imagesy($image);
-
- if($width > $maxwidth) $scale = $width / $maxwidth;
- if($height / $scale > $maxheight) $scale = $height / $maxheight;
-
- $image_p = imagecreatetruecolor($width / $scale, $height / $scale);
- imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width / $scale, $height / $scale, $width, $height);
-
- return $image_p;
-}
-
-
-$fullfilename = $IMAGECACHE . "/" . urlencode($filename);
-
-if(!file_exists($fullfilename)) {
-
- $url = parse_url($filename);
- $filetype = strrchr($url["path"], '.');
-
- if( true || ping($url["hostname"], 1000) != -1) {
-
- if(strcasecmp($filetype, ".jpeg") == 0 || strcasecmp($filetype, ".jpg") == 0) {
- $image = imagecreatefromjpeg(urldecode($filename));
- if(!$image) die(404);
- $image = rescale($image);
- imagejpeg($image, $fullfilename, 90);
- } else if(strcasecmp($filetype, ".gif") == 0) {
- $image = imagecreatefromgif(urldecode($filename));
- if(!$image) die(404);
- $image = rescale($image);
- imagegif($image, $fullfilename);
- } else if(strcasecmp($filetype, ".png") == 0) {
- $image = imagecreatefrompng(urldecode($filename));
- if(!$image) die(404);
- $image = rescale($image);
- imagepng($image, $fullfilename);
- } else {
- echo "<p>Unknown image format " . $filetype . "</p>";
- }
-
- }
-}
-
-header('Content-Description: File Transfer');
-header('Content-Type: image/jpeg');
-header('Content-Length: ' . filesize($fullfilename));
-header('Content-Disposition: inline; filename=' . basename($filename));
-readfile($fullfilename);
-
-?> \ No newline at end of file
diff --git a/forum/htdocs/index.php b/forum/htdocs/index.php
index a452f20..f4d2ed7 100644
--- a/forum/htdocs/index.php
+++ b/forum/htdocs/index.php
@@ -1,17 +1,27 @@
<?php
header("Content-Type: text/html; charset=UTF-8");
-/*
-Jonas Mobil:
-"SonyEricssonW660i/R6BC Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
-
-Rasmus Mobil:
-"Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN81-3/11.0.045 Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413"
-*/
include_once("config.php");
+
+// Check login
include_once($UTIL_DIR . "/login.php");
checklogin();
+// Catch the modes that must not output any html.
+if($current_user) {
+ switch($mode) {
+ case "imagecache":
+ include_once($UTIL_DIR. "/imagecache.php");
+ getCachedImage($uri);
+ return;
+
+ case "file":
+ include_once($UTIL_DIR. "/file.php");
+ getFile($filename);
+ return;
+ }
+}
+
include_once($UTIL_DIR . "/clientinfo.php");
?>
<?xml version="1.0" encoding="UTF-8"?>
@@ -66,7 +76,7 @@ if($current_user) {
include_once($UTIL_DIR. "/edit.php");
break;
- case "files":
+ case "filehandler":
include_once($UTIL_DIR. "/filehandler.php");
break;