whmcsAPI.php 934 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace MGModule\DNSManager2\mgLibs\whmcsAPI;
  3. use MGModule\DNSManager2 as main;
  4. class whmcsAPI{
  5. static function getAdmin(){
  6. static $username;
  7. if(empty($username))
  8. {
  9. $data = main\mgLibs\MySQL\query::select(
  10. array('username')
  11. , 'tbladmins'
  12. , array()
  13. , array()
  14. , 1
  15. )->fetch();
  16. $username = $data['username'];
  17. }
  18. return $username;
  19. }
  20. static function request($command,$config){
  21. $result = localAPI($command,$config,self::getAdmin());
  22. if($result['result'] == 'error')
  23. {
  24. throw new main\mgLibs\exceptions\whmcsAPI($result['message']);
  25. }
  26. return $result;
  27. }
  28. }