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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
<?php
/**********************************************************************/
/* letzte Update am : Sonntag, 6. April 2003 */
/**********************************************************************/
/* Script: Webmaster Flash-PHP-MAIL (APACHE 2 - PHP5.0 Flash MX) */
/* Version: 1.1-dev */
/* Datum: 2003 */
/* Autor: Juergen Heinemann */
/* E-Mail: [EMAIL]mingmaster@gmx.de[/EMAIL] */
/* URL: [URL]http://www.flash-php-mail.de[/URL] */
/**********************************************************************/
Class jheiuploads
{
// Einnstellbare Variablen
var $DATUMSCON = "d m Y, H:i"; // Datumsconvertierung
/**********************************************************************/
// Bitte ab hier nichts mehr Editieren !!! //
/**********************************************************************/
var $JHUPLOADDIR = "";
var $zeigebild;
var $dateiupload;
var $error = "";
function jheiuploads($JHUPLOADDIR, $MAXBREIT, $MAXHOCH, $MAXUPSIZE, $SPELL) {
if(is_string($JHUPLOADDIR)) {
$this->JHUPLOADDIR = $JHUPLOADDIR;
}
$this->JHMAXBREIT = intval($JHMAXBREIT = (isset($MAXBREIT) ? $MAXBREIT : "450"));
$this->JHMAXHOCH = intval($JHMAXHOCH = (isset($MAXHOCH) ? $MAXHOCH : "450"));
$this->JHMAXUPSIZE = intval($JHMAXUPSIZE = (isset($MAXUPSIZE) ? $MAXUPSIZE : "125"));
$this->JHSPELL = intval($JHSPELL = (isset($SPELL) ? $SPELL : "0"));
}
function fehler($error,$zeile) {
$spr = $this->JHSPELL;
$errors = array("1" => array("Kann Konfigurationsdatei nicht lesen!","no configuration file found"),
"2" => array("Kann Verzeichnis nicht öffnen!","cant open file"),
"3" => array("Falsche Eingabe - Album ausgewählt?","not legal input or no category selected"),
"4" => array("Verzeichnis Existiert nicht!","file does not exists"),
"5" => array("Datei Existiert nicht","file does not exists"),
"6" => array("Die Dateigröße ist höher als die zulässigen Kilo Bytes!","not legal filesize"),
"7" => array("Die Bilddatei ist zu Breit!","image file to width"),
"8" => array("Die Bilddatei ist zu Hoch!","image file to height"),
"9" => array("Der Server unterstützt nur JPG und PNG Bildformate!","only image jpg and png files supportet"));
echo $errors[$error][$spr]." Error Nr. ".$zeile;
exit;
}
function filerechte($file) {
$perms = ($file & 00400) ? "r" : "-";
$perms .= ($file & 00200) ? "w" : "-";
$perms .= ($file & 00100) ? "x" : "-";
$perms .= ($file & 00040) ? "r" : "-";
$perms .= ($file & 00020) ? "w" : "-";
$perms .= ($file & 00010) ? "x" : "-";
$perms .= ($file & 00004) ? "r" : "-";
$perms .= ($file & 00002) ? "w" : "-";
$perms .= ($file & 00001) ? "x" : "-";
return $perms;
}
function fileinfo($album,$file) {
$directory = $this->JHUPLOADDIR."/".$album."/".$file;
if(!file_exists($directory)) {
$this->fehler(4, __LINE__);
return false;
}
$dateiInfos = array("1" => (basename($directory)),
"2" => (dirname($directory)),
"3" => (date($this->DATUMSCON)),
"4" => (filemtime($directory)),
"5" => ($this->filerechte(fileperms($directory))),
"6" => (filesize($directory)),
"7" => ($this->speicherplatz($directory)));
return $dateiInfos;
}
function speicherplatz($directory) {
$freeSpace = diskfreespace($directory);
if ($freeSpace/(1024*1024) > 1024) {
$space = printf("%.2f ".$txt[8], $freeSpace/(1024*1024*1024));
} else {
$space = (int)($freeSpace/(1024*1024)).$txt[7];
}
return $space;
}
function leseverzeich($file) {
if(!file_exists($file)) {
$this->fehler(4, __LINE__);
return false;
}
$alben = array();
$files = opendir($file);
while($ordner = readdir($files)) {
if(($ordner != ".") && ($ordner != "..") && (!is_file($file."/".$ordner)) && (is_writeable($file."/".$ordner))) {
clearstatcache();
array_push($alben, $ordner);
}
}
closedir($files);
sort($alben, SORT_STRING);
return $alben;
}
function leseinhalte($file) {
if(!file_exists($file)) {
$this->fehler(4,__LINE__);
return false;
}
$bilder = array();
$files = opendir($file);
while($datei = readdir($files)) {
if(($datei != ".") && ($datei != "..") && (is_file($datei)) || (eregi(".jpg", $datei)) || (eregi(".png", $datei))) {
clearstatcache();
array_push($bilder,$datei);
}
}
closedir($files);
sort($bilder, SORT_NUMERIC);
return $bilder;
}
function lesealben($read) {
if (is_integer($read)) {
$alben = $this->leseverzeich($this->JHUPLOADDIR);
return $alben;
} else {
$this->fehler(3, __LINE__);
return false;
}
}
function lesebilder($read) {
if(empty($read)) {
$this->fehler(3, __LINE__);
return false;
}
$rootpfad = $this->JHUPLOADDIR."/".$read;
if(!file_exists($rootpfad)) {
$this->fehler(5, __LINE__);
return false;
}
$alben = $this->leseinhalte($rootpfad);
return $alben;
}
function suchebisluecke($alben) {
if(!is_array($alben)) {
$this->fehler(3, __LINE__);
return false;
}
$result = array();
$int = 1;
foreach ($alben AS $value) {
if(substr($value, 0, 5) == sprintf("%05d", $int++)) {
array_push($result, $value);
} else {
continue;
}
}
$neuBild = sprintf("%05d", substr(end($result), 0, 5) +1 );
$ausgabe = array(end($result), count($result), count($alben), $neuBild);
return $ausgabe;
}
function dateiupload($album,$_FILES) {
$bildtyp = array("1" => ".gif", "2" => ".jpg", "3" => ".png", "4" => ".swf");
$directory = $this->JHUPLOADDIR."/".$album;
if(!file_exists($directory)) {
echo $directory;
$this->fehler(4, __LINE__);
return false;
}
$maxuploadsize = $this->JHMAXUPSIZE."000";
$neuBILD = $this->suchebisluecke($this->lesebilder($album));
if ($_FILES['imageupload']['size'] > $maxuploadsize) {
$this->fehler(6, __LINE__);
return false;
}
$typ = getimagesize($_FILES['imageupload']['tmp_name']);
$Image_Neu = $directory."/".$neuBILD[3].$bildtyp[$typ[2]];
if($typ[0] > $this->JHMAXBREIT) {
$this->fehler(7, __LINE__);
} else if($typ[1] > $this->JHMAXHOCH) {
$this->fehler(8, __LINE__);
}
if(($typ[2] < 2) || ($typ[2] > 3)) {
$this->fehler(9, __LINE__);
unlink ($_FILES['imageupload']['name']);
return false;
}
if (isset($_FILES['imageupload']) && ! $_FILES['imageupload']['error']) {
move_uploaded_file($_FILES['imageupload']['tmp_name'], $Image_Neu);
@chmod($Image_Neu, 0644);
$ausgabe = array($_FILES['imageupload']['name'], $typ, $this->fileinfo($album, $neuBILD[3].$bildtyp[$typ[2]]));
return $ausgabe;
} else {
$this->fehler(7, __LINE__);
return false;
}
}
}
?>
|