Example #1
0
function GetFiles($dir, $orderby)
{
    $files = array();
    if ($dh = @opendir($dir)) {
        while ($file = readdir($dh)) {
            if (!preg_match("/^\\.+\$/", $file)) {
                if (is_file($dir . $file) && (IsFileExt($file, "jpg") || IsFileExt($file, "jpeg") || IsFileExt($file, "gif") || IsFileExt($file, "png"))) {
                    $files[0][] = $file;
                    $files[1][] = filemtime($dir . $file);
                    $files[2][] = filesize($dir . $file);
                    $files[3][] = Image_GetWidth($dir . $file);
                }
            }
        }
        closedir($dh);
    }
    switch ($orderby) {
        case "0":
            @array_multisort($files[1], SORT_NUMERIC, SORT_DESC, $files[0], SORT_STRING, SORT_DESC);
            break;
        case "1":
            @array_multisort($files[0], SORT_STRING, SORT_ASC);
            break;
        case "2":
            @array_multisort($files[0], SORT_STRING, SORT_DESC);
            break;
        case "3":
            @array_multisort($files[2], SORT_NUMERIC, SORT_ASC, $files[0], SORT_STRING, SORT_DESC);
            break;
        case "4":
            @array_multisort($files[2], SORT_NUMERIC, SORT_DESC, $files[0], SORT_STRING, SORT_DESC);
            break;
        case "5":
            @array_multisort($files[3], SORT_NUMERIC, SORT_ASC, $files[0], SORT_STRING, SORT_DESC);
            break;
        case "6":
            @array_multisort($files[3], SORT_NUMERIC, SORT_DESC, $files[0], SORT_STRING, SORT_DESC);
            break;
        case "7":
            @array_multisort($files[1], SORT_NUMERIC, SORT_ASC, $files[0], SORT_STRING, SORT_DESC);
            break;
        case "8":
            @array_multisort($files[1], SORT_NUMERIC, SORT_DESC, $files[0], SORT_STRING, SORT_DESC);
            break;
    }
    // Server-Cache löschen
    clearstatcache();
    // Datei-Array zurückgeben
    return $files[0];
}
Example #2
0
             // Dateiname
             if ($SESSION["show_image_menu"] == 1) {
                 echo "<td><input class=\"edit\" style=\"width:98%;\" type=\"text\" value=\"" . $FILES[$j] . "\" title=\"" . $FILES[$j] . "\" onclick=\"SMImage_InputFileClick(this);\" onblur=\"SMImage_InputFileBlur(this, '" . $FILES[$j] . "');\" onkeypress=\"SMImage_InputFileEnter(event, this, '" . $FILES[$j] . "', '" . bin2hex(RC4("id=1&" . $GET)) . "')\"></td>";
             } else {
                 echo "<td><input class=\"edit\" style=\"width:98%;\" type=\"text\" value=\"" . $FILES[$j] . "\" title=\"" . $FILES[$j] . "\" readonly=\"1\"></td>";
             }
             // Icon "Bild einfügen"
             echo "<td style=\"width:16px; text-align:center;\"><img id=\"i1" . $i . "\" style=\"cursor:pointer;\" src=\"img/icon_insert_16x16.png\" border=\"0\" title=\"\" onclick=\"SMImage_Insert('" . $SESSION["server"] . "', '" . $IMAGE_PATH_2 . $FILES[$j] . "', '" . Image_GetWidth($IMAGE_PATH . $FILES[$j]) . "', '" . Image_GetHeight($IMAGE_PATH . $FILES[$j]) . "', '" . $CONFIG["style"] . "');\" /></td>";
             // Icon "Bilddatei löschen"
             if ($SESSION["show_image_menu"] == 1) {
                 echo "<td style=\"width:16px; text-align:center;\"><img id=\"i2" . $i . "\" style=\"cursor:pointer;\" src=\"img/icon_delete_16x16.png\" border=\"0\" title=\"\" onclick=\"SMImage_DeleteImage('" . bin2hex(RC4("id=1&" . $GET)) . "', '" . $FILES[$j] . "');\" /></td>";
             }
             // Dateigröße
             echo "<td style=\"width:102px; text-align:right;\">" . number_format(@filesize($IMAGE_PATH . $FILES[$j]) / 1024, 2, ",", ".") . "&nbsp;KB</td>";
             // Bildgröße
             echo "<td style=\"width:102px; text-align:right;\">" . Image_GetWidth($IMAGE_PATH . $FILES[$j]) . "&nbsp;x&nbsp;" . Image_GetHeight($IMAGE_PATH . $FILES[$j]) . "</td>";
             // Datum
             echo "<td style=\"width:122px; text-align:center;\">" . date(GetDateFormat() . ' H:i', @filemtime($IMAGE_PATH . $FILES[$j])) . "</td>";
             // ScrollBar
             echo "<td style=\"width:10px;\">&nbsp;</td>";
             echo "</tr>";
             // Hinweis hinzufügen
             echo "<script language=\"javascript\" type=\"text/javascript\">document.getElementById('i1" . $i . "').title = tinyMCEPopup.getLang('smimage.image_menu_hint_1', '?'); document.getElementById('i2" . $i . "').title = tinyMCEPopup.getLang('smimage.image_menu_hint_2', '?');</script>";
             $i++;
         }
         echo "</table></div>";
     }
     break;
 case 2:
     include "php/upload.php";
     break;