Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.0.6.0
- * @ Author : DeZender
- * @ Release on : 20.09.2018
- * @ Official site : http://DeZender.Net
- *
- */
- class cpanel_manage2_license_3596PDOWrapper
- {
- static private $pdoConnection;
- static private function getDbConnection()
- {
- if (class_exists('Illuminate\\Database\\Capsule\\Manager')) {
- return \Illuminate\Database\Capsule\Manager::connection()->getPdo();
- }
- if (self::$pdoConnection === NULL) {
- self::$pdoConnection = self::setNewConnection();
- }
- return self::$pdoConnection;
- }
- static private function setNewConnection()
- {
- try {
- $includePath = ROOTDIR . DIRECTORY_SEPARATOR . 'configuration.php';
- if (file_exists($includePath)) {
- require $includePath;
- }
- else {
- throw new Exception('No configuration file found');
- }
- $connection = new PDO(sprintf('mysql:host=%s;dbname=%s;port=%s;charset=utf8', $db_host, $db_name, $db_port ? $db_port : 3360), $db_username, $db_password);
- $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return $connection;
- }
- catch (PDOException $exc) {
- }
- }
- static public function query($query, $params = [])
- {
- $statement = self::getDbConnection()->prepare($query);
- $statement->execute($params);
- return $statement;
- }
- static public function real_escape_string($string)
- {
- return substr(self::getDbConnection()->quote($string), 1, -1);
- }
- static public function fetch_assoc($query)
- {
- return $query->fetch(PDO::FETCH_ASSOC);
- }
- static public function fetch_array($query)
- {
- return $query->fetch(PDO::FETCH_BOTH);
- }
- static public function fetch_object($query)
- {
- return $query->fetch(PDO::FETCH_OBJ);
- }
- static public function num_rows($query)
- {
- $query->fetch(PDO::FETCH_BOTH);
- return $query->rowCount();
- }
- static public function insert_id()
- {
- return self::getDbConnection()->lastInsertId();
- }
- static public function errorInfo()
- {
- $tmpErr = self::getDbConnection()->errorInfo();
- if ($tmpErr[0] && ($tmpErr[0] !== '00000')) {
- return $tmpErr;
- }
- return false;
- }
- static public function mysql_get_array($query, $params = [])
- {
- $qRes = self::query($query, $params);
- $arr = [];
- while ($row = self::fetch_assoc($qRes)) {
- $arr[] = $row;
- }
- return $arr;
- }
- static public function mysql_get_row($query, $params = [])
- {
- $qRes = self::query($query, $params);
- return self::fetch_assoc($qRes);
- }
- }
- class mgCpanelClient
- {
- private $error;
- private $username;
- private $password;
- private $format;
- public function getError()
- {
- return $this->error;
- }
- public function __construct($user, $pass)
- {
- $this->username = $user;
- $this->password = $pass;
- $this->format = $format;
- }
- private function get($function, $args = [])
- {
- if (!function_exists('curl_init')) {
- $this->error = 'CURL is not installed!';
- return NULL;
- }
- if (!$function) {
- $this->error = 'No function specified';
- return NULL;
- }
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_USERPWD, $this->username . ':' . $this->password);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- $this->format = 'json';
- $args['output'] = $this->format;
- $query = 'https://manage2.cpanel.net/' . $function . '?' . http_build_query($args);
- curl_setopt($curl, CURLOPT_URL, $query);
- $result = curl_exec($curl);
- if (!$result) {
- $this->error = 'Connection error: ' . curl_error($curl);
- curl_close($curl);
- return NULL;
- }
- curl_close($curl);
- return $result;
- }
- private function validateID($id)
- {
- if (preg_match('/^(L|P|G)?\\d*$/', $id)) {
- return 1;
- }
- else {
- return 0;
- }
- }
- private function validateIP($ip)
- {
- return preg_match('/^\\d*\\.\\d*\\.\\d*\\.\\d*$/', $ip);
- }
- public function reactivateLicense($args)
- {
- if (!array_key_exists('liscid', $args)) {
- $this->error = 'Invalid License ID (2)';
- return NULL;
- }
- if (!$this->validateID($args['liscid'])) {
- $this->error = 'Invalid License ID';
- return NULL;
- }
- return $this->get('XMLlicenseReActivate.cgi', $args);
- }
- public function expireLicense($args)
- {
- if (!array_key_exists('liscid', $args)) {
- $this->error = 'Invalid License ID (2)';
- return NULL;
- }
- if (!$this->validateID($args['liscid'])) {
- $this->error = 'Invalid License ID ';
- return NULL;
- }
- return $this->get('XMLlicenseExpire.cgi', $args);
- }
- public function extendOnetimeUpdates($args)
- {
- if (!array_key_exists('ip', $args)) {
- $this->error = 'Invalid IP (2)';
- return NULL;
- }
- if (!$this->validateIP($args['ip'])) {
- $this->error = 'Invalid IP';
- return NULL;
- }
- return $this->get('XMLonetimeext.cgi', $args);
- }
- public function changeip($args)
- {
- if (!array_key_exists('oldip', $args) || !array_key_exists('newip', $args)) {
- ........................................................................
- ..........................................
- ........................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement