![]() |
Bearsampp 2026.9.23
|
Go to the source code of this file.
Variables | |
| $ajaxProcRaw = isset($_POST['proc']) ? $_POST['proc'] : '' | |
| $ajaxReadOnlyProcs | |
| $csrfProtectedEndpoints | |
| $proc = UtilInput::cleanPostVar('proc', 'text') | |
| $procMap | |
| if(in_array( $proc, $csrfProtectedEndpoints, true)) if(isset($procMap[$proc]) &&file_exists($procMap[$proc])) | else |
| if (in_array( $ajaxProcRaw, $ajaxReadOnlyProcs, true)) | |
| $ajaxProcRaw = isset($_POST['proc']) ? $_POST['proc'] : '' |
AJAX request dispatcher for the Bearsampp homepage.
Receives a 'proc' POST parameter, maps it to a whitelisted handler file and includes the matching AJAX handler. Read-only polling handlers run through a silent logging buffer, while state-changing handlers are restricted to POST requests and protected by CSRF validation. Silent logging gate for read-only homepage polls.
Read-only polls (e.g. summary, service status, latest version) are the main source of homepage log growth because root.php re-initialises every class on each 2s poll. To keep the log useful without the noise, such polls run inside a silent logging transaction:
No "heartbeat" entries are produced - identical polls write nothing at all. State-changing endpoints (quickpick, toggleenhancedquickpick, applymoduleconfig) are excluded and always log normally.
| $ajaxReadOnlyProcs |
| $csrfProtectedEndpoints |
Define which endpoints require CSRF protection. Read-only endpoints (GET-like operations) don't need CSRF protection. Write operations (POST that changes state) require CSRF protection.
| $proc = UtilInput::cleanPostVar('proc', 'text') |
Definition at line 130 of file ajax.php.
Referenced by ActionExt\__construct(), ActionQuit\checkForOrphanedProcesses(), Win32Ps\findByPath(), Win32Ps\findByPid(), Win32Native\findProcessesByName(), ActionQuit\generateCleanupReport(), Win32Ps\getListProcs(), Win32Native\getProcessInfo(), Win32Native\getProcessList(), Win32Ps\killBins(), ActionStartup\killOldInstances(), Win32Native\killProcess(), Win32Native\processExists(), ActionStartup\processWindow(), PEAR_RunTest\system_with_timeout(), and ActionQuit\terminatePhpProcesses().
| $procMap |
| if (!empty( $proc)) else |
Validate CSRF token for protected endpoints. Sessions are only started for state-changing endpoints so that read-only polling endpoints (e.g. reload status) never block on a session lock held by a long-running operation such as a module install. Check if the cleaned 'proc' parameter exists in our secure mapping. If valid, include the corresponding AJAX handler file using the pre-defined path. If not valid, return a JSON error message.