Error: '.$status.'

'.$reason.'

'); } require('configuration.php'); function alt(&$p1 = NULL, &$p2 = NULL, &$p3 = NULL) { if (isset($p1)) return $p1; if (isset($p2)) return $p2; return $p2; } function computeUnsignedChecksum($bytestring) { $unsigned_chksum = 0; for($i=0; $i<512; $i++) $unsigned_chksum += ord($bytestring[$i]); for($i=0; $i<8; $i++) $unsigned_chksum -= ord($bytestring[148 + $i]); $unsigned_chksum += ord(" ") * 8; return $unsigned_chksum; } function tarHeader($Name, $Size, $information=NULL) { if (strlen($Name)>99) { $ext = preg_replace('/.*\./', '', $Name); $Name = substr($Name, 0, 98-strlen($ext)).'.'.$ext; } $header = str_pad($Name,100,chr(0)); $header .= str_pad("777",7,"0",STR_PAD_LEFT) . chr(0); $header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0); $header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0); $header .= str_pad(decoct($Size),11,"0",STR_PAD_LEFT) . chr(0); $header .= str_pad(decoct(time(0)),11,"0",STR_PAD_LEFT) . chr(0); $header .= str_repeat(" ",8); $header .= "0"; $header .= str_repeat(chr(0),100); $header .= str_pad("ustar",6,chr(32)); $header .= chr(32) . chr(0); $header .= str_pad($information["user_name"],32,chr(0)); $header .= str_pad($information["group_name"],32,chr(0)); $header .= str_repeat(chr(0),8); $header .= str_repeat(chr(0),8); $header .= str_repeat(chr(0),155); $header .= str_repeat(chr(0),12); $checksum = str_pad(decoct(computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT); for($i=0; $i<6; $i++) { $header[(148 + $i)] = substr($checksum,$i,1); } $header[154] = chr(0); $header[155] = chr(32); return $header; } function checkPath($pathToCheck) { global $imagepath, $subpath; $fullpath = preg_replace('/\/$/', '', $imagepath.'/'.$pathToCheck); if ($fullpath==realpath($fullpath) && is_dir($fullpath)) { $subpath=$pathToCheck; $imagepath = $fullpath; } else { error_die('path not allowed: '.htmlentities($pathToCheck)); } } function checkFile($fileToCheck, $thumb = false) { global $imagepath, $file, $subpath, $thumbpath, $imgfile; if (!preg_match('/\//', $fileToCheck) && is_file($imagepath.'/'.$fileToCheck)) { $imgfile = $fileToCheck; } else { error_die('file not found', '404 Not Found'); } if ($thumb) { // image from thumbnail path $file = $thumbpath.'/'.$subpath.'/'.$fileToCheck; if (!is_dir($thumbpath.'/'.$subpath)) mkdir($thumbpath.'/'.$subpath, 0777, true); if (!is_file($file)) { // create thumbnail $image = new Imagick(); $image->readImage($imagepath.'/'.$fileToCheck); $image->thumbnailImage(200, 200, true); $image->writeImage($file); } } else { $file = $imagepath.'/'.$fileToCheck; } } function returnFile($file) { $ext=strtolower(preg_replace('/.*\./', '', $file)); switch ($ext) { case 'jpg': case 'jpeg': $type="image/jpeg"; break; case 'tif': case 'tiff': $type="image/tiff"; break; case 'gif': $type="image/gif"; break; case 'png': $type="image/png"; break; case 'bmp': $type="image/bmp"; break; } if (!is_file($file)) { error_die('file does not exist', '404 Not Found'); } if (!isset($_REQUEST['view'])) { header('Content-type: '.$type); header('Content-Length: '.filesize($file)); header('Content-Transfer-Encoding: binary'); flush(); readfile($file); exit; } } function extractDir($path) { $res['dirs'] = array(); $res['files'] = array(); if ($d=opendir($path)) { while (false!==($f=readdir($d))) if (!preg_match('/^\./', $f) && is_dir($path.'/'.$f)) $res['dirs'][] = $f; elseif (!preg_match('/^\./', $f) && is_file($path.'/'.$f)) switch (strtolower(preg_replace('/.*\./', '', $f))) { case "jpg": case "jpeg": case "png": $res['files'][] = $f; } } closedir($d); asort($res['dirs']); asort($res['dirs']); return $res; } /*function encrypt2($text) { global $_REQUEST, $server_password; return bin2hex(mcrypt_encrypt(MCRYPT_BLOWFISH, $_REQUEST['password']+$server_password, bzcompress(serialize($text)), MCRYPT_MODE_ECB)); } function decrypt2($text) { global $_REQUEST, $server_password; return unserialize(bzdecompress(mcrypt_decrypt(MCRYPT_BLOWFISH, $_REQUEST['password']+$server_password, hex2bin($text), MCRYPT_MODE_ECB))); }*/ function encrypt($text, $password = NULL) { global $_REQUEST, $server_password; if (!$password) $password = $_REQUEST['password']; return base64_encode(mcrypt_encrypt(MCRYPT_BLOWFISH, $password+$server_password, bzcompress(serialize($text)), MCRYPT_MODE_ECB)); } function decrypt($text) { global $_REQUEST, $server_password; $res = @unserialize(bzdecompress(mcrypt_decrypt(MCRYPT_BLOWFISH, $_REQUEST['password']+$server_password, base64_decode($text), MCRYPT_MODE_ECB))); if (!$res) $res = @unserialize(bzdecompress(mcrypt_decrypt(MCRYPT_BLOWFISH, $_REQUEST['password']+$server_password, hex2bin($text), MCRYPT_MODE_ECB))); return $res; } function makelink($link, $img, $filename, $style="") { echo ''.htmlentities($filename).''; } function linkorselect($link, $img, $filename) { if (isset($_REQUEST['select'])) { echo ''; echo ''; } else { makelink($link, $img, $filename, 'class="thumbnail"'); } } function pageheader($arrows=NULL, $class="") { global $username, $subpath; ?> ↑'; } elseif ($subpath!="") { $arrows = ''; } pageheader($arrows); if (isset($_REQUEST['select'])) { echo 'Normal-Modus'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } else { echo 'Auswahl-Modus'; } echo '
'; $objects = extractDir($imagepath); foreach ($objects['dirs'] as $f) makelink('?path='.urlencode($subpath.($subpath!=""?'/':'').$f), '?path='.urlencode($subpath).'&folder='.urlencode($f), $f, 'class="folder"'); echo '
'; foreach ($objects['files'] as $f) linkorselect('?path='.urlencode($subpath).'&file='.urlencode($f).'&view', '?path='.urlencode($subpath).'&file='.urlencode($f).'&thumb', $f); echo '
'; if (isset($_REQUEST['select'])) echo '
'; } function singleimage() { global $subpath, $imagepath, $imgfile, $preview_num; $objects = extractDir($imagepath); $pos = array_search($imgfile, $objects['files']); $arrows=''; if ($pos>0) { $arrows .= ''; } $arrows .= ''; if ($pos→'; } pageheader($arrows, 'class="single"'); echo '
'.urlencode($imgfile).'
'; echo '
'.($pos+1).'
'; if ($pos!==NULL) { echo '
'; $lower = max(0, $pos-floor(((int)$preview_num)/2)); $higher = min(count($objects['files']), $lower+((int)$preview_num)); for ($i=$lower; $i<$higher; ++$i) makelink('?path='.urlencode($subpath).'&file='.urlencode($objects['files'][$i]).'&view', '?path='.urlencode($subpath).'&file='.urlencode($objects['files'][$i]).'&thumb', $objects['files'][$i], 'style="width: '.round(100/($higher-$lower), 3).'%" class="thumbnail"'); echo '
'; } ?> ←'); $key = $_REQUEST; unset($key['password']); unset($key['share']); unset($key['select']); $secret=urlencode(encrypt($key)); $default_mailto = ""; if (isset($_REQUEST['mailto'])) { if (preg_match('/PASSWORD/', $_REQUEST['mailtext'])) $message = preg_replace('/PASSWORD/', $_REQUEST['password'], $_REQUEST['mailtext']); else $message = $_REQUEST['mailtext']."\n\npassword: ".$_REQUEST['password']; $link = $myurl.'?secret='.$secret; if (preg_match('/LINK/', $message)) $message = preg_replace('/LINK/', $link, $message); else $message .= "\n\n".$link; if (mail($_REQUEST['mailto'], $_REQUEST['subject'], $message, 'From: '.$_REQUEST['replyto']."\r\n".'Reply-To: '.$_REQUEST['replyto'])) { echo '

Mail Successfully Sent

'; echo '

Mail sent to '.$_REQUEST['mailto'].'.

'; echo '

You can send more mails, if you want ...

'; } else { echo '

Send Mail Failed

'; echo '

Try again ...

'; } } echo '

Share Files

'; echo '

Share files: Tell your friend the password on a separate channel and send this: Link to Share

'; ?>

or Send Link in E-Mail:

'; ?>
$v) switch ($k) { case 'replyto': case 'mailto': case 'subject': case 'mailtext': break; default: if (is_array($v)) foreach ($v as $e) echo ''; else echo ''; } ?>

Password Required

Enter password to start download of images as a Tape-ARchive (tar) file.

Shared Files

Download shared files as a Tape-ARchive (tar) file.

'; } } if (!isset($_REQUEST['secret'])) { if ($username=="") error_die('not authorized', '403 Forbidden'); if (isset($_REQUEST['qrcode'])) { QRcode::png($myurl.'?secret='.$_REQUEST['qrcode']); exit; } else { if (isset($_REQUEST['path'])) checkPath($_REQUEST['path']); if (isset($_REQUEST['folder']) && !preg_match('/\//', $_REQUEST['folder'])) { $file = $thumbpath.'/folders/'.$subpath.'/'.$_REQUEST['folder'].'.png'; $type="image/png"; if (!is_dir($thumbpath.'/folders/'.$subpath)) mkdir($thumbpath.'/folders/'.$subpath, 0777, true); if (!is_file($file)) { // create folder image $txt = wordwrap(preg_replace('/ +/', ' ', preg_replace('/-/', ' - ', preg_replace('/_/', " ", $_REQUEST['folder']))), 16, "\n", true); $image = new Imagick(); $image->readImage('folder.png'); // read local template file $draw = new ImagickDraw(); $draw->setFillColor('black'); $draw->setFont($font); if (mb_strlen($txt)<2) { $draw->setFontSize(60); $x = 75; } else { $draw->setFontSize(15); $x = 50; } $image->annotateImage($draw, 10, $x, 0, $txt); $image->writeImage($file); } } elseif (isset($_REQUEST['file'])) checkFile($_REQUEST['file'], isset($_REQUEST['thumb'])); if ($file!="") returnFile($file); } } else { if (isset($_REQUEST['password'])) { $secret = decrypt($_REQUEST['secret']) or error_die('bad password', '403 Forbidden'); if (!isset($secret['valid-until'])) error_die('missing validation date'); if (!isset($max_validity_days)) error_die('maximum validity days not set'); if (strtotime($secret['valid-until'])>time()+((int)$max_validity_days)*86400) error_die('validity limitation not respected'); if (strtotime($secret['valid-until'])