diff --git a/inc/content.php b/inc/content.php
index ec597e6..874e2b5 100644
--- a/inc/content.php
+++ b/inc/content.php
@@ -119,21 +119,23 @@ if (!empty($breadcrumb)) {
echo '';
echo '
';
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 '
', $fullListDir[$value], ' ';
+ echo '
', $value, ' ';
} else {
- echo '
', $fullListDir[$value], ' ';
+ echo '
', $value, ' ';
}
}
}
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 '
', $fullListFile[str_replace('.jpg', '', $value)]['title'], '';
+ echo '
', $value, '';
}
}
echo '
';
diff --git a/index.php b/index.php
index 6dac2d1..0f67774 100644
--- a/index.php
+++ b/index.php
@@ -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 = '') {
';
@@ -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) {