From 692c8277c00304c8a56f49fa5a2a3b9274cae984 Mon Sep 17 00:00:00 2001 From: monaco Date: Sat, 15 May 2021 19:51:57 +0200 Subject: Update archive.php --- archive.php | 100 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 26 deletions(-) (limited to 'archive.php') diff --git a/archive.php b/archive.php index 92c17f8..4b43a8b 100644 --- a/archive.php +++ b/archive.php @@ -1,7 +1,7 @@ KISSmo Archive @@ -14,42 +14,90 @@ "; -system('grep -l ' . escapeshellarg($_POST['query']) . ' *p/*.txt'); -echo "
"; -} -?> -
Paste | Archive
+$input = $_POST['query']; -$filename
"; + echo $link; + echo implode("
", $matches[0]); + echo '
'; + echo '-----------------
'; + $found = 1; + } +} + +if($found == 0) +{ + echo 'No match found'; } -echo "Currently archiving: "; -echo $filecount . " paste files "; -echo "

"; -$dir_open = opendir('./p/'); -while(false !== ($filename = readdir($dir_open))){ - if($filename != "." && $filename != ".."){ - $link = " $filename
"; + +echo "
"; +} +?> +
Paste | Archive
+ + 15, // how many item to display for each page + 'around' => 2, // how many page btn to show around the current page btn + 'directory' => './p', // dir to scan for items + ); + + $page = isset($_GET['page']) ? $_GET['page'] : 1; + $offset = ($page - 1) * $options['quantity']; // $page base index is 1 + $filelist = array_diff(scandir($options['directory']), array('..', '.','index.txt')); + + //get subset of file array + $selectedFiles = array_slice($filelist, $offset, $options['quantity']); + + foreach ($selectedFiles as $file) { + $path = $options['directory'] . '/' . $file; + + $link = " $file
"; echo $link; + } -} + ?> + + -closedir($dir_open); -?> -- cgit v1.2.3