|
|
|
@ -158,7 +158,7 @@ function linkorselect($link, $img, $filename) { |
|
|
|
|
echo '<input type="checkbox" id="'.htmlentities($filename).'" name="elements[]" value="'.htmlentities($filename).'" />'; |
|
|
|
|
echo '<label for="'.htmlentities($filename).'"><img src="'.$img.'" alt="'.htmlentities($filename).'"/></label>'; |
|
|
|
|
} else { |
|
|
|
|
makelink($link, $img, $filename); |
|
|
|
|
makelink($link, $img, $filename, 'class="thumbnail"'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!isset($_REQUEST['secret'])) { |
|
|
|
@ -234,6 +234,8 @@ if (!isset($_REQUEST['secret'])) { |
|
|
|
|
<html> |
|
|
|
|
<header> |
|
|
|
|
<meta charset="utf-8"> |
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
|
|
<link rel="stylesheet" href="style.css"> |
|
|
|
|
</header> |
|
|
|
|
<body> |
|
|
|
|
<?php
|
|
|
|
@ -269,7 +271,7 @@ if (!isset($_REQUEST['secret'])) { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
?> |
|
|
|
|
<h1>Gallery: <?php echo htmlentities($username).' @ '.htmlentities($subpath) ?></h1>
|
|
|
|
|
<h1>Gallery: <?php echo htmlentities($username).($subpath?'@'.htmlentities($subpath):'') ?></h1>
|
|
|
|
|
<?php |
|
|
|
|
if (isset($_REQUEST['share'])) { |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'"><img src="?folder=←" alt="←"/></a><br/>'; |
|
|
|
@ -327,45 +329,45 @@ if (!isset($_REQUEST['secret'])) { |
|
|
|
|
</form> |
|
|
|
|
<?php |
|
|
|
|
foreach ($key['elements'] as $f) |
|
|
|
|
makelink('?path='.urlencode($subpath).'&file='.urlencode($f).'&view', '?path='.urlencode($subpath).'&file='.urlencode($f).'&thumb', $f); |
|
|
|
|
} else { |
|
|
|
|
if (isset($_REQUEST['view'])) { // view single image |
|
|
|
|
$objects = extractDir($imagepath); |
|
|
|
|
$pos = array_search($imgfile, $objects['files']); |
|
|
|
|
if ($pos>0) |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'&file='.urlencode($objects['files'][$pos-1]).'&view"><img src="?folder=←" alt="previous"/></a>'; |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'"><img src="?folder=↑" alt="↑"/></a>'; |
|
|
|
|
if ($pos<count($objects['files'])-1) |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'&file='.urlencode($objects['files'][$pos+1]).'&view"><img src="?folder=→" alt="next"/></a>'; |
|
|
|
|
echo '<div class="image"><img style="width: 100%" src="?path='.urlencode($subpath).'&file='.urlencode($imgfile).'" alt="'.urlencode($imgfile).'"/></div>'; |
|
|
|
|
if ($pos!==NULL) { |
|
|
|
|
$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).'%"'); |
|
|
|
|
} |
|
|
|
|
} else { // gallery view |
|
|
|
|
if (isset($_REQUEST['select'])) { |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'">Normal-Modus</a>'; |
|
|
|
|
echo '<form method="POST">'; |
|
|
|
|
echo '<input type="hidden" name="path" value="'.htmlentities($subpath).'">'; |
|
|
|
|
echo '<label for="password">Passwort:</label>'; |
|
|
|
|
echo '<input type="text" size="5" name="password" value="'.substr(str_shuffle(strtolower(sha1(rand().time()."SeAG6"))),0,4).'">'; |
|
|
|
|
echo '<label for="valid-until">Gültig bis:</label>'; |
|
|
|
|
echo '<input type="date" size="10" name="valid-until" max="'.date('Y-m-d', time()+((int)$max_validity_days)*86400).'" value="'.date('Y-m-d', time()+14*86400).'"/>'; |
|
|
|
|
echo '<input type="submit" name="share" value="Teilen"/>'; |
|
|
|
|
} else { |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'&select">Auswahl-Modus</a>'; |
|
|
|
|
} |
|
|
|
|
echo '<div class="dirs">'; |
|
|
|
|
if (preg_match('/\//', $subpath)) { |
|
|
|
|
echo '<a href="?path='.urlencode(preg_replace('/\/[^\/]+$/', '', $subpath)).'"><img src="?folder=↑" alt="↑"/></a>'; |
|
|
|
|
} elseif ($subpath!="") { |
|
|
|
|
echo '<a href="?"><img src="?folder=↑" alt="↑"/></a>'; |
|
|
|
|
} |
|
|
|
|
$objects = extractDir($imagepath); |
|
|
|
|
foreach ($objects['dirs'] as $f) |
|
|
|
|
makelink('?path='.urlencode($subpath.($subpath!=""?'/':'').$f), '?path='.urlencode($subpath).'&folder='.urlencode($f), $f); |
|
|
|
|
makelink('?path='.urlencode($subpath).'&file='.urlencode($f).'&view', '?path='.urlencode($subpath).'&file='.urlencode($f).'&thumb', $f, 'class="thumbnail"'); |
|
|
|
|
} else { |
|
|
|
|
if (isset($_REQUEST['view'])) { // view single image |
|
|
|
|
$objects = extractDir($imagepath); |
|
|
|
|
$pos = array_search($imgfile, $objects['files']); |
|
|
|
|
if ($pos>0) |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'&file='.urlencode($objects['files'][$pos-1]).'&view"><img src="?folder=←" alt="previous"/></a>'; |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'"><img src="?folder=↑" alt="up"/></a>'; |
|
|
|
|
if ($pos<count($objects['files'])-1) |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'&file='.urlencode($objects['files'][$pos+1]).'&view"><img src="?folder=→" alt="next"/></a>'; |
|
|
|
|
echo '<img class="image" src="?path='.urlencode($subpath).'&file='.urlencode($imgfile).'" alt="'.urlencode($imgfile).'"/>'; |
|
|
|
|
if ($pos!==NULL) { |
|
|
|
|
$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"'); |
|
|
|
|
} |
|
|
|
|
} else { // gallery view |
|
|
|
|
if (isset($_REQUEST['select'])) { |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'">Normal-Modus</a>'; |
|
|
|
|
echo '<form method="POST">'; |
|
|
|
|
echo '<input type="hidden" name="path" value="'.htmlentities($subpath).'">'; |
|
|
|
|
echo '<label for="password">Passwort:</label>'; |
|
|
|
|
echo '<input type="text" size="5" name="password" value="'.substr(str_shuffle(strtolower(sha1(rand().time()."SeAG6"))),0,4).'">'; |
|
|
|
|
echo '<label for="valid-until">Gültig bis:</label>'; |
|
|
|
|
echo '<input type="date" size="10" name="valid-until" max="'.date('Y-m-d', time()+((int)$max_validity_days)*86400).'" value="'.date('Y-m-d', time()+14*86400).'"/>'; |
|
|
|
|
echo '<input type="submit" name="share" value="Teilen"/>'; |
|
|
|
|
} else { |
|
|
|
|
echo '<a href="?path='.urlencode($subpath).'&select">Auswahl-Modus</a>'; |
|
|
|
|
} |
|
|
|
|
echo '<div class="dirs">'; |
|
|
|
|
if (preg_match('/\//', $subpath)) { |
|
|
|
|
echo '<a href="?path='.urlencode(preg_replace('/\/[^\/]+$/', '', $subpath)).'"><img src="?folder=↑" alt="↑"/></a>'; |
|
|
|
|
} elseif ($subpath!="") { |
|
|
|
|
echo '<a href="?"><img src="?folder=↑" alt="↑"/></a>'; |
|
|
|
|
} |
|
|
|
|
$objects = extractDir($imagepath); |
|
|
|
|
foreach ($objects['dirs'] as $f) |
|
|
|
|
makelink('?path='.urlencode($subpath.($subpath!=""?'/':'').$f), '?path='.urlencode($subpath).'&folder='.urlencode($f), $f, 'class="folder"'); |
|
|
|
|
echo '</div><div class="images">'; |
|
|
|
|
foreach ($objects['files'] as $f) |
|
|
|
|
linkorselect('?path='.urlencode($subpath).'&file='.urlencode($f).'&view', '?path='.urlencode($subpath).'&file='.urlencode($f).'&thumb', $f); |
|
|
|
|