[add] file and dir are now sort by name

This commit is contained in:
Knah Tsaeb 2013-08-06 11:40:48 +02:00
parent c87db70f55
commit 3a6726fa8e
2 changed files with 29 additions and 11 deletions

View file

@ -119,21 +119,23 @@ if (!empty($breadcrumb)) {
echo '</div>'; echo '</div>';
echo '<div id="listFile">'; echo '<div id="listFile">';
if (!empty($listCurrentDir) && $ci['ac'] !== 'view') { if (!empty($listCurrentDir) && $ci['ac'] !== 'view') {
foreach ($listCurrentDir as $value) { $listCurrentDir = sortDir($listCurrentDir,$fullListDir);
$thumbnail = getThumbnail($path, $value); foreach ($listCurrentDir as $key => $value) {
$thumbnail = getThumbnail($path, $key);
if (empty($thumbnail)) { if (empty($thumbnail)) {
echo '<a href="?bc=', $ci['bc'].$value, '"><span class="fulldir"></span>', $fullListDir[$value], '</a> '; echo '<a href="?bc=', $ci['bc'].$key, '"><span class="fulldir"></span>', $value, '</a> ';
} else { } else {
echo '<a href="?bc=', $ci['bc'].$value, '"><span class="dir"></span><img alt="Thumbnail of video" src="', $thumbnail, '" />', $fullListDir[$value], '</a> '; echo '<a href="?bc=', $ci['bc'].$key, '"><span class="dir"></span><img alt="Thumbnail of video" src="', $thumbnail, '" />', $value, '</a> ';
} }
} }
} }
if (!empty($listCurrentFile) && $ci['ac'] !== 'view') { if (!empty($listCurrentFile) && $ci['ac'] !== 'view') {
foreach ($listCurrentFile as $value) { $listCurrentFile = sortFile($listCurrentFile, $fullListFile);
if ($value == 'thumb.jpg') { foreach ($listCurrentFile as $key => $value) {
if ($key == 'thumb') {
continue; continue;
} }
echo '<a href="?bc=', $ci['bc'], '&amp;file=', $value, '&amp;ac=view"><span class="video"></span><img alt="', $path.$value, '" src="', $path.$value, '" />', $fullListFile[str_replace('.jpg', '', $value)]['title'], '</a>'; echo '<a href="?bc=', $ci['bc'], '&amp;file=', $key, '&amp;ac=view"><span class="video"></span><img alt="', $path.$key, '" src="', $path.$key, '.jpg" />', $value, '</a>';
} }
} }
echo '</div>'; echo '</div>';

View file

@ -34,8 +34,8 @@ $GLOBALS['config']['PAGECACHE'] = 'pagecache';
// php // php
$GLOBALS['config']['DOWNLOAD_METHOD'] = 'xsendfile'; $GLOBALS['config']['DOWNLOAD_METHOD'] = 'xsendfile';
if(file_exists('option.php')){ if (file_exists('option.php')) {
require_once 'option.php'; require_once 'option.php';
} }
if (get_magic_quotes_gpc()) { if (get_magic_quotes_gpc()) {
@ -186,9 +186,9 @@ function n_print($data, $name = '') {
<fieldset style="border: 1px solid orange; padding: 5px;color:#1E1915; background-color: #fff;">'; <fieldset style="border: 1px solid orange; padding: 5px;color:#1E1915; background-color: #fff;">';
echo ' echo '
<legend style="border:1px solid orange;padding: 1px;background-color:#eee;color:orange;"> <legend style="border:1px solid orange;padding: 1px;background-color:#eee;color:orange;">
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], ' ', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
</legend>'; </legend>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>'; echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo ' echo '
</fieldset> </fieldset>
<br />'; <br />';
@ -276,6 +276,22 @@ function listCurrentDir($breadcrumb) {
return glob("*", GLOB_ONLYDIR); return glob("*", GLOB_ONLYDIR);
} }
function sortDir($listCurrentDir, $fullListDir) {
foreach ($listCurrentDir as $value) {
$rows[$value] = $fullListDir[$value];
}
asort($rows);
return $rows;
}
function sortFile($listCurrentFile, $fullListFile) {
foreach ($listCurrentFile as $value) {
$rows[str_replace('.jpg', '', $value)] = $fullListFile[str_replace('.jpg', '', $value)]['title'];
}
asort($rows);
return $rows;
}
function getQueue() { function getQueue() {
$allHash = glob("tmp/*.hash"); $allHash = glob("tmp/*.hash");
if ($allHash) { if ($allHash) {