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
/tools/Connectionink/connlink_bootstrap.php
<?php declare(strict_types=1); const CONNLINK_DATA_DIR = __DIR__ . '/data'; if (!is_dir(CONNLINK_DATA_DIR)) { mkdir(CONNLINK_DATA_DIR, 0775, true); } function connlink_now(): string { return gmdate('c'); } function connlink_uuid(string $prefix = 'id'): string { try { $bytes = random_bytes(8); } catch (Throwable $e) { $bytes = (string) microtime(true) . mt_rand(); } return $prefix . '_' . bin2hex((string) $bytes); } function connlink_strlen(string $text): int { return function_exists('mb_strlen') ? mb_strlen($text) : strlen($text); } function connlink_read_json(string $filename, array $default = []): array { $path = CONNLINK_DATA_DIR . '/' . $filename; if (!is_file($path)) { return $default; } $raw = file_get_contents($path); if ($raw === false || trim($raw) === '') { return $default; } $decoded = json_decode($raw, true); return is_array($decoded) ? $decoded : $default; } function connlink_write_json(string $filename, array $payload): void { $path = CONNLINK_DATA_DIR . '/' . $filename; file_put_contents($path, json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } function connlink_append_ndjson(string $filename, array $payload): void { $path = CONNLINK_DATA_DIR . '/' . $filename; file_put_contents($path, json_encode($payload, JSON_UNESCAPED_SLASHES) . PHP_EOL, FILE_APPEND); } function connlink_is_cli(): bool { return PHP_SAPI === 'cli'; } function connlink_output(array $payload): void { if (!headers_sent()) { header('Content-Type: application/json; charset=utf-8'); } echo json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } function connlink_list_files(string $root): array { $files = []; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS) ); foreach ($iterator as $file) { /** @var SplFileInfo $file */ if ($file->isFile()) { $files[] = $file->getPathname(); } } sort($files); return $files; } function connlink_encrypt_string(string $plaintext, string $keyVersion = 'v1'): array { $masterKey = hash('sha256', 'SIMON_CONNLINK_MASTER_KEY_' . $keyVersion, true); if (function_exists('openssl_encrypt')) { $cipher = 'aes-256-gcm'; $iv = random_bytes(12); $tag = ''; $aad = json_encode(['key_version' => $keyVersion], JSON_UNESCAPED_SLASHES); $ciphertext = openssl_encrypt($plaintext, $cipher, $masterKey, OPENSSL_RAW_DATA, $iv, $tag, $aad); if ($ciphertext !== false) { return [ 'cipher' => strtoupper($cipher), 'key_version' => $keyVersion, 'nonce' => base64_encode($iv), 'ciphertext' => base64_encode($ciphertext), 'tag' => base64_encode($tag), 'aad' => $aad, ]; } } return [ 'cipher' => 'BASE64_FALLBACK', 'key_version' => $keyVersion, 'nonce' => base64_encode(random_bytes(8)), 'ciphertext' => base64_encode($plaintext), 'tag' => '', 'aad' => json_encode(['warning' => 'openssl unavailable'], JSON_UNESCAPED_SLASHES), ]; } function connlink_word_stats(string $text): array { preg_match_all('/[\p{L}\p{N}_-]+/u', $text, $matches); $words = $matches[0] ?? []; $maxWord = ''; $maxLen = 0; foreach ($words as $word) { $len = connlink_strlen($word); if ($len > $maxLen) { $maxLen = $len; $maxWord = $word; } } return [ 'word_count' => count($words), 'longest_word' => $maxWord, 'longest_word_length' => $maxLen, 'character_count' => connlink_strlen($text), 'line_count' => substr_count($text, "\n") + 1, ]; } function connlink_extract_functions(string $code): array { $functions = []; if (preg_match_all('/function\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/', $code, $matches)) { $functions = array_values(array_unique($matches[1])); } return $functions; } function connlink_extract_classes(string $code): array { $classes = []; if (preg_match_all('/class\s+([a-zA-Z_][a-zA-Z0-9_]*)/', $code, $matches)) { $classes = array_values(array_unique($matches[1])); } return $classes; } function connlink_extract_includes(string $code): array { $includes = []; if (preg_match_all('/(?:require|include)(?:_once)?\s*[\(\s]*["\']([^"\']+)["\']/', $code, $matches)) { $includes = array_values(array_unique($matches[1])); } return $includes; } function connlink_guess_file_role(string $path): string { $lower = strtolower(basename($path)); return match (true) { str_contains($lower, 'config') => 'configuration', str_contains($lower, 'auth') => 'authentication', str_contains($lower, 'feed') => 'feed_rendering', str_contains($lower, 'encrypt') => 'encryption', str_contains($lower, 'memory') => 'memory', str_contains($lower, 'scan') => 'scanner', str_contains($lower, 'map') => 'mapper', str_contains($lower, 'predict') => 'prediction', str_contains($lower, 'recommend') => 'recommendation', default => 'general', }; }
Save file
Quick jump
open a path
Open