diff --git a/cli_scripts/reset.php b/cli_scripts/reset.php index 2cc6f1c..6cd3f1f 100755 --- a/cli_scripts/reset.php +++ b/cli_scripts/reset.php @@ -1,80 +1,28 @@ -#!/usr/bin/env php session reset
';
-require_once __DIR__ . '/../conf/init.php';
-
-// Start a session so reset/destroy have something to work with
-if (session_status() === PHP_SESSION_NONE) {
- session_start();
-}
-
-// --- Session reset ---
-Session::reset();
-
-echo 'Session reset.' . PHP_EOL;
-
-// --- Optional: purge all session folders ---
-$purgeAll = in_array('--all', $argv);
-
-if ($purgeAll) {
- $force = in_array('-f', $argv);
-
- if (!$force) {
- echo 'WARNING: This will permanently delete ALL session folders.' . PHP_EOL;
- echo 'Are you sure? (type "yes" to confirm): ';
- $handle = fopen('php://stdin', 'r');
- $input = trim(fgets($handle));
- fclose($handle);
-
- if (strtolower($input) !== 'yes') {
- echo 'Aborted.' . PHP_EOL;
- exit(0);
- }
- }
-
- $sessionsDir = ZAP_APP_BASE_DIR . DIRECTORY_SEPARATOR . ZAP_SESSIONS_DIR;
- $folders = glob($sessionsDir . DIRECTORY_SEPARATOR . '*');
- $count = 0;
-
- foreach ($folders as $folder) {
- if (!is_dir($folder)) {
- continue;
- }
- $files = glob($folder . DIRECTORY_SEPARATOR . '*');
- foreach ($files as $file) {
- if (is_file($file)) {
- unlink($file);
- }
+if ($_GET['allcollages'] == 'clear') {
+ $sessions = glob('./Sessions/*');
+ foreach($sessions as $folder){
+ $files = glob($folder.'/*');
+ foreach($files as $fileToDelete){
+ echo "$fileToDelete deleted
";
+ unlink($fileToDelete);
}
+ echo "$folder deleted
";
rmdir($folder);
- $count++;
}
-
- echo "Purged $count session folder(s)." . PHP_EOL;
}
+echo '
Invalid or missing security token. Please go back and try again.
'; - die(); - } - $this->folder = $this->createFolder(); $this->words = $this->handleWords(); @@ -61,10 +49,9 @@ class ZAPDisplay implements ZAPHandler { */ private function createFolder() { try { - $suffix = bin2hex(random_bytes(4)); $folder = ZAP_APP_BASE_DIR . DIRECTORY_SEPARATOR - . ZAP_SESSIONS_DIR . DIRECTORY_SEPARATOR . 'zap_' . ZAP_MOMENT . '_' . $suffix; - if (!mkdir($folder, 0777, true)) { + . ZAP_SESSIONS_DIR . DIRECTORY_SEPARATOR . 'zap_' . ZAP_MOMENT; + if (!@mkdir($folder, 0777)) { throw new Exception('' . ERROR_PREFIX . 'Unable to create base dir: ' . $folder . '
'); } return $folder; diff --git a/tpl/404.tpl b/tpl/404.tpl deleted file mode 100644 index 68649d5..0000000 --- a/tpl/404.tpl +++ /dev/null @@ -1,29 +0,0 @@ - - - - -