|
- <?php
- // Representative WHMCS boundary only: not an implementation of the encrypted router.
- namespace WHMCS\Authentication {
- class CurrentUser {
- public function isAuthenticatedAdmin() { return $GLOBALS['isAdmin'] ?? false; }
- public function client() { return $GLOBALS['actor'] ?? null; }
- public function isAuthenticatedUser() { return isset($GLOBALS['actor']); }
- }
- }
- namespace WHMCS\Database {
- class Capsule {
- public static function table($table) { return new Query($table); }
- }
- class Query {
- private $table; private $where = [];
- public function __construct($table) { $this->table = $table; }
- public function where($key, $value) { $this->where[$key] = $value; return $this; }
- public function get() {
- return array_values(array_filter($GLOBALS['db'][$this->table] ?? [], function ($row) {
- foreach ($this->where as $key => $value) if ($row->$key != $value) return false;
- return true;
- }));
- }
- public function first() { return $this->get()[0] ?? null; }
- }
- }
- namespace {
- class BackupTestClient {
- public $id; public $permitted;
- public function __construct($id, $permitted = true) { $this->id = $id; $this->permitted = $permitted; }
- public function hasPermission($permission) { return $permission === 'products' && $this->permitted; }
- }
- function logActivity($message) { $GLOBALS['safeLogs'][] = $message; }
- }
|