SIMON Master Console Rebuild
True command center for SIMON + WEB360
This rebuild gives you a cleaner production spine: interactive tree, live viewer, guarded editor, dynamic graphics, architecture map, and note storage. It is designed to sit beside your existing
console.php
and become the stronger replacement path.
Dashboard
Tree
Viewer
System Map
File Registry
Notes
Files
15,312
Folders
410
Scanned Size
3.85 GB
PHP Files
891
Editable Text Files
12,573
File viewer
guarded to /htdocs
/web360/Demo/core/bootstrap.php
<?php declare(strict_types=1); define('WEB360_VERSION', '6.2.0-repair-v2'); define('WEB360_ROOT', dirname(__DIR__)); define('WEB360_STORAGE', WEB360_ROOT . '/storage'); define('WEB360_PROJECTS', WEB360_ROOT . '/projects'); define('WEB360_SNAPSHOTS', WEB360_ROOT . '/snapshots'); define('WEB360_LOGS', WEB360_ROOT . '/logs'); define('WEB360_UPLOADS', WEB360_ROOT . '/workspace/uploads'); error_reporting(E_ALL); ini_set('display_errors', '0'); ini_set('log_errors', '1'); foreach ([WEB360_STORAGE, WEB360_PROJECTS, WEB360_SNAPSHOTS, WEB360_LOGS, WEB360_UPLOADS] as $dir) { if (!is_dir($dir)) { @mkdir($dir, 0775, true); } } ini_set('error_log', WEB360_LOGS . '/php-error.log'); if (session_status() !== PHP_SESSION_ACTIVE) { session_start(); } if (!function_exists('w360_contains')) { function w360_contains(string $haystack, string $needle): bool { return $needle === '' || strpos($haystack, $needle) !== false; } } if (!function_exists('w360_starts')) { function w360_starts(string $haystack, string $needle): bool { return $needle === '' || strpos($haystack, $needle) === 0; } } function w360_csrf(): string { if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(random_bytes(16)); } return $_SESSION['csrf']; } function w360_require_csrf(): void { $token = $_POST['csrf'] ?? $_SERVER['HTTP_X_CSRF_TOKEN'] ?? ''; if (!$token || !hash_equals($_SESSION['csrf'] ?? '', $token)) { w360_json(['ok' => false, 'error' => 'CSRF failed. Reload the page and try again.'], 403); } } function w360_json(array $data, int $code = 200): void { http_response_code($code); header('Content-Type: application/json; charset=UTF-8'); echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); exit; } function w360_read_json(string $name, array $default = []): array { $file = WEB360_STORAGE . '/' . basename($name) . '.json'; if (!file_exists($file)) return $default; $json = json_decode((string)file_get_contents($file), true); return is_array($json) ? $json : $default; } function w360_write_json(string $name, array $data): bool { $file = WEB360_STORAGE . '/' . basename($name) . '.json'; return file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) !== false; } function w360_allowed_file(string $path): bool { return (bool)preg_match('/\.(php|html|htm|css|js|json|txt|md|xml|svg|sql)$/i', $path); } function w360_safe_path(string $rel): string { $rel = str_replace(["\0", "\\"], ['', '/'], $rel); $rel = preg_replace('#/+#', '/', $rel); $rel = ltrim($rel, '/'); if ($rel === '' || w360_contains($rel, '..')) { throw new RuntimeException('Invalid path.'); } $root = realpath(WEB360_ROOT); if (!$root) { throw new RuntimeException('WEB360 root not found.'); } $full = $root . '/' . $rel; $parent = dirname($full); if (!is_dir($parent)) { @mkdir($parent, 0775, true); } $realParent = realpath($parent); if (!$realParent || !w360_starts($realParent, $root)) { throw new RuntimeException('Path blocked outside WEB360 root.'); } return $full; } function w360_snapshot(string $path): ?string { $full = w360_safe_path($path); if (!file_exists($full)) return null; $safe = preg_replace('/[^a-zA-Z0-9_.-]+/', '_', $path); $snap = WEB360_SNAPSHOTS . '/' . date('Ymd_His') . '_' . $safe; if (@copy($full, $snap)) { return str_replace(WEB360_ROOT . '/', '', $snap); } return null; } function w360_log(string $type, array $payload = []): void { $logs = w360_read_json('events', []); $logs[] = [ 'id' => bin2hex(random_bytes(6)), 'type' => $type, 'payload' => $payload, 'at' => gmdate('c') ]; if (count($logs) > 1500) $logs = array_slice($logs, -1500); w360_write_json('events', $logs); } function w360_php_check(string $path): array { if (!preg_match('/\.php$/i', $path)) { return ['ok' => true, 'message' => 'Not a PHP file.']; } $full = w360_safe_path($path); if (!file_exists($full)) return ['ok' => false, 'message' => 'File does not exist.']; $cmd = 'php -l ' . escapeshellarg($full) . ' 2>&1'; $out = []; $code = 0; @exec($cmd, $out, $code); return ['ok' => $code === 0, 'message' => implode("\n", $out), 'code' => $code]; }
Save file
Quick jump
open a path
Open