[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 id="listFile">';
if (!empty($listCurrentDir) && $ci['ac'] !== 'view') {
foreach ($listCurrentDir as $value) {
$thumbnail = getThumbnail($path, $value);
$listCurrentDir = sortDir($listCurrentDir,$fullListDir);
foreach ($listCurrentDir as $key => $value) {
$thumbnail = getThumbnail($path, $key);
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 {
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') {
foreach ($listCurrentFile as $value) {
if ($value == 'thumb.jpg') {
$listCurrentFile = sortFile($listCurrentFile, $fullListFile);
foreach ($listCurrentFile as $key => $value) {
if ($key == 'thumb') {
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>';

View File

@ -34,8 +34,8 @@ $GLOBALS['config']['PAGECACHE'] = 'pagecache';
// php
$GLOBALS['config']['DOWNLOAD_METHOD'] = 'xsendfile';
if(file_exists('option.php')){
require_once 'option.php';
if (file_exists('option.php')) {
require_once 'option.php';
}
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;">';
echo '
<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>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo '
</fieldset>
<br />';
@ -276,6 +276,22 @@ function listCurrentDir($breadcrumb) {
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() {
$allHash = glob("tmp/*.hash");
if ($allHash) {