Módulo VPSManager para WHMCS con configuración externa, acceso seguro al panel y métricas Graphite para LX.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

43 líneas
1.9 KiB

  1. <?php
  2. // Representative WHMCS boundary only: not an implementation of the encrypted router.
  3. namespace WHMCS\User { class Client {} }
  4. namespace WHMCS\Authentication {
  5. class CurrentUser {
  6. public function isAuthenticatedAdmin() { return $GLOBALS['isAdmin'] ?? false; }
  7. public function user() { return new \BackupTestUser(); }
  8. public function client() { return $GLOBALS['actor'] ?? null; }
  9. public function isAuthenticatedUser() { return isset($GLOBALS['actor']); }
  10. }
  11. }
  12. namespace WHMCS\Database {
  13. class Capsule {
  14. public static function table($table) { return new Query($table); }
  15. }
  16. class Query {
  17. private $table; private $where = [];
  18. public function __construct($table) { $this->table = $table; }
  19. public function where($key, $value) { $this->where[$key] = $value; return $this; }
  20. public function get() {
  21. return array_values(array_filter($GLOBALS['db'][$this->table] ?? [], function ($row) {
  22. foreach ($this->where as $key => $value) if ($row->$key != $value) return false;
  23. return true;
  24. }));
  25. }
  26. public function first() { return $this->get()[0] ?? null; }
  27. }
  28. }
  29. namespace {
  30. class BackupTestClient extends \WHMCS\User\Client {
  31. public $id; public $permitted;
  32. public function __construct($id, $permitted = true) { $this->id = $id; $this->permitted = $permitted; }
  33. public function hasPermission($permission) { throw new \RuntimeException('Unsupported client permission API'); }
  34. }
  35. class BackupTestUser {
  36. public function getClientsByPermission($permission) {
  37. if (isset($GLOBALS['permissionClients'])) return $GLOBALS['permissionClients'];
  38. $c=$GLOBALS['actor']??null; return $permission==='products' && $c && $c->permitted ? [$c] : [];
  39. }
  40. }
  41. function logActivity($message) { $GLOBALS['safeLogs'][] = $message; }
  42. }