=== SiteIntelix – WordPress Toolkit ===
Contributors:      parag44
Donate link:       https://parag.bd
Tags:              file manager, debug log, diagnostics, code snippets, admin tools
Requires at least: 5.8
Tested up to:      7.0
Requires PHP:      7.4
Stable tag:        2.8.0
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Secure WordPress file management, diagnostics, logs, SMTP, snippets, Safe Mode, and administrator troubleshooting tools.

== Description ==

**SiteIntelix** is a modular diagnostics and troubleshooting toolkit for WordPress administrators, developers, and support teams.

It brings a DirectAdmin-inspired File Manager, private debug logs, outgoing email history, server checks, cron inspection, database browsing, Safe Mode, SMTP, user switching, custom CSS/JavaScript, PHP snippets, and maintenance controls into one organized admin menu. Modules load only when needed, screen-specific assets stay scoped to SiteIntelix pages, and third-party admin banners stay out of the SiteIntelix workspace.

= Key Features =
* 🩺 **Server Diagnostics** — inspect server health, PHP configuration, extensions, filesystem permissions, network access, WordPress, and database limits.
* 🧾 **Debug Log Viewer** — capture, search, group, filter, clear, and download private WordPress debug logs.
* ✉️ **Email Log** — record outgoing WordPress emails with recipients, headers, status, failures, and message previews.
* 📮 **SMTP Mailer** — route WordPress emails through your own SMTP provider for more reliable delivery.
* ⏱️ **Cron Events** — inspect scheduled WP-Cron events, run due events manually, and remove selected events safely.
* 🗄️ **Database Manager** — browse tables, inspect rows, search records, review sizes, and edit selected rows from wp-admin.
* 📦 **Download Manager** — add secure download links for installed plugin and theme ZIP packages.
* 📁 **File Manager** — use a focused DirectAdmin-inspired browser to navigate the WordPress installation, inspect approved files, edit safe text formats only inside configured writable locations, upload allowed files, create ZIP exports, and manage private backups and trash under enforced Safe Mode rules.
* 🛡️ **Safe Mode Debugger** — test plugin and theme conflict scenarios privately without affecting normal visitors.
* 👥 **User Switcher** — temporarily enter an allowed user account for support without requesting or changing its password, then return securely.
* 🎨 **Custom CSS & JS** — manage reusable administrator-authored CSS and JavaScript with frontend/admin scope, placement, priority, and inline or generated-file loading.
* 💻 **Code Snippets** — validate, organize, and run administrator-authored PHP in isolated closures with automatic error deactivation and recovery controls.
* 🚧 **Maintenance Mode** — show a polished public maintenance page while administrators continue working.
* 🧰 **Modular Toolbox** — enable or disable each tool from the SiteIntelix Modules screen.

= Why Use SiteIntelix? =
* Keep troubleshooting tools in one place instead of installing many small utilities.
* Share clean diagnostic reports with support teams.
* See the active PHP configuration and server limits that often explain plugin/import failures.
* Review debug logs, email delivery, cron jobs, database rows, and maintenance mode from wp-admin.
* Keep sensitive data local: SiteIntelix does not upload logs, email contents, database contents, or generated reports.

= Debug Log Module =
* **Modern grouped cards** — grouped errors with occurrence counts, severity styling, timelines, expandable stack traces, and global filters.
* **Classic table** — compact table layout with Type, Datetime, Description, File, and Line columns.
* **Terminal Light** — developer-style log stream with a scrollable terminal-style layout.
* Search and filters for Fatal, Warning, Notice, Deprecated, Database, and Info log types.
* Configurable logs-per-page setting for paginated views.
* Refresh, clear, and download actions protected by WordPress capabilities and nonces.

= Logging =
* **MU Plugin mode** — non-invasive capture layer that writes to randomized protected SiteIntelix storage without editing `wp-config.php`.
* SiteIntelix does not rewrite externally managed debug constants or `wp-config.php`.
* Logs use a cryptographically randomized `.log` filename in protected `wp-content/siteintelix/` storage instead of the default `wp-content/debug.log`.

= Security and Privacy =
* SiteIntelix admin pages require the `manage_options` capability. On Multisite, executable-code and network-sensitive tools require a Multisite super administrator.
* Admin actions use WordPress nonces.
* Output is escaped with WordPress escaping functions.
* No external CDN assets or heavy JavaScript frameworks are loaded.
* Assets are scoped to SiteIntelix admin pages.
* SiteIntelix sends no telemetry and does not upload diagnostics, logs, email contents, database contents, snippets, custom code, or generated reports.
* Server reachability checks may contact WordPress.org endpoints and the site's own loopback or REST URL. They send normal HTTP request metadata, not report contents.
* SMTP sends outgoing mail through the administrator-configured SMTP provider. Its credential is stored locally in a non-autoloaded WordPress option.
* Enabled Code Snippets execute locally authored PHP through the module's isolated runner. SiteIntelix does not retrieve or execute remote snippet code.
* Custom CSS & JS can add administrator-authored executable JavaScript to configured frontend or admin pages.
* User Switcher uses WordPress-native authentication, signed short-lived state, dedicated capabilities, protected roles, and optional local audit logs.
* File Manager canonicalizes every path and provides read-only navigation across the WordPress installation. Writes remain confined to configured safe locations; symbolic-link traversal, private storage access, protected locations, sensitive-file content access, and PHP modification are blocked.
* Debug logs, email logs, database values, diagnostic reports, and switching records can contain sensitive information and should be shared only with trusted people.

= Shortcode =
Use `[siteintelix_panel]` on any page or post to display a compact system information table. The shortcode output is visible only to logged-in administrators.

== Installation ==

= Automatic =
1. Log in to your WordPress admin.
2. Go to **Plugins → Add New**.
3. Search for **SiteIntelix**.
4. Click **Install Now**, then **Activate**.

= Manual Upload =
1. Download the plugin ZIP file.
2. Go to **Plugins → Add New → Upload Plugin**.
3. Select the ZIP file and click **Install Now**.
4. Click **Activate Plugin**.

After activation, open **SiteIntelix** in the WordPress admin menu.

== Frequently Asked Questions ==

= Who can access the plugin screens? =
Users need the `manage_options` capability to access SiteIntelix. On Multisite, Code Snippets, Custom CSS & JS, Debug Log configuration, Database Manager, Download Manager, and Safe Mode require a Multisite super administrator. Code modules also require WordPress' `unfiltered_html` capability.

= Does Code Snippets execute PHP? =
Yes. Enabled administrator-authored PHP runs locally in an isolated closure. Snippets are syntax-checked before saving or activation, controls require capabilities and nonces, and a captured runtime failure deactivates the affected snippet. The executor intentionally uses PHP `eval()` for this local feature and never downloads remote code.

= Where are Custom CSS & JS files stored? =
Entries are stored in a plugin-owned database table. When external-file loading is selected, generated files use the restricted `wp-content/uploads/siteintelix/custom-code/` directory. SiteIntelix only deletes files that match its managed filename pattern.

= Where does SiteIntelix write debug logs? =
Both logging modes write to a randomized file in the protected SiteIntelix content directory. The private filename and physical server path are intentionally not displayed.

= Does SiteIntelix use wp-content/debug.log? =
No. SiteIntelix uses its own randomized private log file so WordPress' default `debug.log` is not used by this plugin.

### Nginx private storage rule

Nginx does not read `.htaccess`. Administrators using the default WordPress content URL should add this rule inside the relevant `server` block:

```
location ^~ /wp-content/siteintelix/ {
	deny all;
	return 403;
}
```

If `WP_CONTENT_URL` is customized, replace `/wp-content/` with that installation's actual content URL path. Keep the rule scoped to the complete SiteIntelix directory, reload Nginx after validating the configuration, and use SiteIntelix's authenticated admin viewer or export handler to access logs.

= Does SiteIntelix edit wp-config.php? =
No. SiteIntelix uses its managed MU plugin and does not rewrite externally controlled debugging constants or `wp-config.php`.

= What is Terminal Light mode? =
Terminal Light mode is a developer-style log screen that shows the all parsed log entries in a light terminal layout. It does not use pagination.

= Can the viewer search logs beyond the current page? =
Yes. Search and server-side filters are applied to the parsed log dataset before pagination.

= Does this plugin collect or send data anywhere? =
SiteIntelix does not collect telemetry or upload diagnostics, logs, email contents, database contents, or generated reports. When an administrator refreshes Server Diagnostics, reachability checks may contact WordPress.org endpoints and the site's own loopback or REST URL. Those checks send normal HTTP request metadata, not SiteIntelix report contents.

= How do I use the shortcode? =
Add `[siteintelix_panel]` to a page or post. Only administrators can see the output.

= Is the plugin Multisite compatible? =
Yes. Site-scoped tools can be activated per site. Tools that can execute code, inspect network-wide database data, read installed source packages, write MU files, or change debug configuration require a Multisite super administrator.

= What happens when I delete the plugin? =
SiteIntelix removes its settings, scheduled events, logs, and only signature-verified SiteIntelix MU bootstrap files. Custom CSS & JS entries, generated assets, Code Snippets, and File Manager-owned backups, trash, metadata, and audit records are removed only when their independent uninstall-retention settings are enabled. SiteIntelix never deletes unverified MU files owned by another plugin and does not automatically undo a previously written `wp-config.php` debug block.

= Can File Manager edit PHP or WordPress core files? =
No. File Manager is Safe Mode-only in this release. PHP files remain view-only, while WordPress core, `wp-config.php` writes, SiteIntelix, must-use plugins, active plugins, and the active theme are protected. WordPress' `DISALLOW_FILE_EDIT` and `DISALLOW_FILE_MODS` constants are also enforced.

== Screenshots ==

1. **Overview Dashboard** — minimal health cards, key system details, report actions, and quick module toggles.
2. **Modules** — enable or disable toolbox modules, open available tools, and review planned modules from one screen.
3. **Modern Debug Log Viewer** — grouped cards, severity filters, occurrence counts, stack traces, clear, refresh, and download actions.
4. **Email Log** — captured email events with delivery status, recipients, previews, filters, bulk actions, and row actions.
5. **Database Manager** — server-rendered database metrics, table search, sorting, pagination, and safe record inspection.
6. **Server Diagnostics** — health score, categorized checks, filters, report actions, and detailed system diagnostics.
7. **User Switcher** — searchable switching activity with session status, duration, and protected log actions.
8. **Settings** — module settings with User Switcher roles, redirects, session duration, logging, and retention.
9. **Cron Events** — scheduled events with search, countdowns, due-now status, run actions, and delete actions.

== Changelog ==

= 2.8.0 — 2026-08-01 =
* Redesigned File Manager as a focused DirectAdmin-inspired workspace with a blue command bar, breadcrumb and search strip, persistent folder rail, denser file table, clearer multi-selection actions, and responsive drawer behavior.
* Added read-only WordPress-root browsing with a working lazy nested folder tree, while confining writes to configured safe locations and blocking sensitive-file content, symbolic-link escapes, encoded traversal, and private SiteIntelix storage.
* Moved debug capture into protected SiteIntelix storage with randomized filenames, Apache and IIS denial files, documented Nginx protection, bounded viewing, authenticated streaming downloads, safer rotation, and verified legacy-log migration.
* Made SCRIPT_DEBUG and SAVEQUERIES independent, default-off temporary diagnostics and stopped SiteIntelix from rewriting externally managed debug constants or wp-config.php.
* Hid third-party admin notice banners inside SiteIntelix screens while preserving SiteIntelix's own inline status and workflow messages.
* Expanded security regression coverage for private logs, migration, File Manager read boundaries, sensitive patterns, tree metadata, traversal, and existing module protections.

= 2.7.3 — 2026-07-28 =
* Added an optional Safe Mode-only File Manager with canonical path controls, view-only PHP, authenticated previews and downloads, backed-up atomic text editing, restricted uploads, private trash, retention, and audit controls.
* Improved File Manager with a DirectAdmin-inspired compact toolbar, an expandable folder tree, read-only WordPress root browsing, multi-selection actions, and bounded private temporary ZIP downloads.
* Added Custom CSS & JS and isolated Code Snippets modules with focused management screens and module-specific settings.
* Added a Media Library artwork selector for Maintenance Mode with responsive image output and automatic built-in SVG fallback.
* Improved User Switcher recovery, admin-bar visibility, activity logging, and secure return-to-administrator handling.
* Hardened sensitive tools, generated files, MU bootstrap ownership checks, transient previews, SMTP credential storage, and download responses.
* Fixed the early Code Snippets bootstrap order so the security policy is available before active snippets run.
* Closed additional audit gaps in snippet request detection, generated-file symlink and entry ownership checks, multisite transient permissions, and uninstall option matching.
* Updated WordPress.org metadata, privacy disclosures, multisite permission boundaries, and release verification coverage.

= 2.7.2 — 2026-07-24 =
* Added the optional User Switcher module with shared SiteIntelix settings, a dedicated activity-log submenu, protected-role rules, secure one-click return, dedicated capabilities, short-lived signed sessions, configurable redirects, and retained audit logs.
* Renamed the public plugin title to SiteIntelix – WordPress Toolkit while preserving the existing `siteintelix` slug and internal identifiers.
* Fixed the Overview quick module switches so enable and disable changes persist through the secured module endpoint and roll back cleanly on failure.
* Redesigned Database Manager and Server Diagnostics with lightweight, server-rendered dashboards, responsive tables, filtering, sorting, pagination, and accessible details.
* Improved Email Log with a complete test-email action, on-demand previews, single and bulk deletion, and a delete-all workflow.
* Improved Debug Log layouts so messages, stack traces, and source paths use the available width without hiding useful context.
* Reduced request overhead with context-aware module loading, memoized module state, screen-specific assets, cached diagnostics, and bounded email-log retention.
* Hardened capabilities, nonces, request validation, output escaping, redacted exports, SQL allow-lists, and package-path validation.
* Updated WordPress.org metadata, privacy disclosures, translations guidance, and Plugin Check compatibility.

= 2.7.1 — 2026-07-21 =
* Refined the Modern Debug Log Viewer with compact, full-width WordPress admin layouts for the mode status, statistics, filters, and log rows.
* Improved grouped log scanning with collapsed rows, structured expanded details, copy actions, and clearer severity indicators.
* Preserved existing debug logging, filtering, pagination, clear, download, mode switching, and native editor-link workflows.

= 2.7.0 — 2026-06-24 =
* Refreshed every SiteIntelix admin screen with a lightweight WordPress-native design system.
* Removed the Custom Error UI module and added safe cleanup for SiteIntelix-owned legacy drop-ins and settings.
* Simplified Server Diagnostics to server, PHP, PHP configuration, filesystem, network, WordPress, and database reporting.
* Reduced decorative styling and kept page-specific assets scoped to the screens that need them.

Earlier release history remains available in previous WordPress.org tags.

== Upgrade Notice ==

= 2.8.0 =
Major File Manager workspace update with read-only WordPress-root browsing, protected randomized debug storage, safer temporary diagnostics, and cleaner SiteIntelix admin screens.

= 2.7.3 =
Security-focused major update with Safe Mode File Manager, Custom CSS & JS, isolated Code Snippets, safer multisite permissions, and improved User Switcher recovery.

= 2.7.2 =
Recommended performance, security, accessibility, and admin workflow update for Debug Log, Email Log, Database Manager, and Server Diagnostics.

== Privacy Policy ==

SiteIntelix sends no telemetry and does not upload logs, email contents, database contents, snippets, custom code, File Manager data, or generated diagnostic reports. Stored logs, SMTP credentials, settings, snippets, custom code, and File Manager backups, trash, metadata, and audit records remain in the WordPress installation and are available only through privileged administration interfaces. Enabled custom JavaScript and PHP snippets execute on the site according to their configured scope.

When an administrator runs or refreshes Server Diagnostics, reachability checks may make HTTP requests to WordPress.org endpoints and to the site's own loopback or REST URL. These requests include normal network metadata such as the site's public IP address and a SiteIntelix version user agent, but they do not include the contents of SiteIntelix reports.

When SMTP is enabled, WordPress sends outgoing email and authentication data to the administrator-selected SMTP provider under that provider's privacy terms. SiteIntelix stores the SMTP credential locally in a non-autoloaded option; it does not transmit the credential anywhere else.
