· 7 years ago · Jan 22, 2019, 09:26 PM
1<?php
2/*
3 *
4 * @ This file is created by http://DeZender.Net
5 * @ deZender (PHP5 Decoder for ionCube Encoder)
6 *
7 * @ Version : 3.5.0.0
8 * @ Author : DeZender
9 * @ Release on : 22.06.2018
10 * @ Official site : http://DeZender.Net
11 *
12 */
13
14if (!defined('WHMCS')) {
15 exit('This file cannot be accessed directly');
16}
17
18function serverpilot_sh_config()
19{
20 $configarray = array('name' => 'ServerPilot: Shared Hosting', 'description' => 'Module for provisioning ServerPilot apps', 'version' => '1.1.0', 'author' => '<a href="http://www.hypnotic-monkey.com" target="_blank">Hypnotic Monkey</a>', 'language' => 'english', 'fields' => array('sp_licence' => array('FriendlyName' => 'Licence Key', 'Type' => 'text', 'Size' => '25', 'Description' => 'Licence key provided by Hypnotic Monkey'), 'sp_clientid' => array('FriendlyName' => 'Client ID', 'Type' => 'text', 'Size' => '25', 'Description' => 'Client ID provided by ServerPilot (https://manage.serverpilot.io/#account/api)'), 'sp_apikey' => array('FriendlyName' => 'API Key', 'Type' => 'text', 'Size' => '25', 'Description' => 'API Key provided by ServerPilot (https://manage.serverpilot.io/#account/api)')));
21
22 return $configarray;
23}
24
25function serverpilot_sh_activate()
26{
27 $query = "CREATE TABLE IF NOT EXISTS `mod_spsh_settings` (\n\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t `setting` varchar(255) NOT NULL,\n\t\t\t `value` varchar(255) NOT NULL,\n\t\t\t PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2\n\t\t\t";
28 $result = full_query($query);
29 $query = "INSERT INTO `mod_spsh_settings` (`id`, `setting`, `value`) VALUES (1, 'localkey', '')";
30 $result = full_query($query);
31 $query = "INSERT INTO `mod_spsh_settings` (`id`, `setting`, `value`) VALUES (2, 'disable_ssl', 'no')";
32 $result = full_query($query);
33 $query = "CREATE TABLE IF NOT EXISTS `mod_spsh_users` (\n\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t `user_id` varchar(255) NOT NULL,\n\t\t\t `service_id` varchar(255) NOT NULL,\n\t\t\t PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2\n\t\t\t";
34 $result = full_query($query);
35 $query = "CREATE TABLE IF NOT EXISTS `mod_spsh_apps` (\n\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t `app_id` varchar(255) NOT NULL,\n\t\t\t `service_id` varchar(255) NOT NULL,\n\t\t\t PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2\n\t\t\t";
36 $result = full_query($query);
37
38 return array('status' => 'success', 'description' => 'Digital Ocean has been setup properly. ');
39}
40
41function serverpilot_sh_deactivate()
42{
43 $query = 'DROP TABLE `mod_spsh_settings`;';
44 $result = full_query($query);
45
46 return array('status' => 'success', 'description' => 'Digital Ocean has been removed properly. ');
47}
48
49function serverpilot_sh_upgrade($vars)
50{
51 $version = $vars['version'];
52}
53
54function serverpilot_sh_getDisableSsl()
55{
56 $result = select_query('mod_spsh_settings', '', array('setting' => 'disable_ssl'));
57 $data = mysql_fetch_array($result);
58
59 return $data['value'];
60}
61
62function serverpilot_sh_getClientId()
63{
64 $result = select_query('tbladdonmodules', '', array('module' => 'serverpilot_sh', 'setting' => 'sp_clientid'));
65 $data = mysql_fetch_array($result);
66
67 return $data['value'];
68}
69
70function serverpilot_sh_getApiKey()
71{
72 $result = select_query('tbladdonmodules', '', array('module' => 'serverpilot_sh', 'setting' => 'sp_apikey'));
73 $data = mysql_fetch_array($result);
74
75 return $data['value'];
76}
77
78function serverpilot_sh_getLicence()
79{
80 $result = select_query('tbladdonmodules', '', array('module' => 'serverpilot_sh', 'setting' => 'sp_licence'));
81 $data = mysql_fetch_array($result);
82
83 return $data['value'];
84}
85
86function serverpilot_sh_getLocalKey()
87{
88 $result = select_query('mod_spsh_settings', '', array('setting' => 'localkey'));
89 $data = mysql_fetch_array($result);
90
91 return $data['value'];
92}
93
94function serverplot_sh_apiCall($endpoint, $http_method, $postfields)
95{
96 $disable_ssl = serverpilot_sh_getdisablessl();
97 $sp_clientid = serverpilot_sh_getclientid();
98 $sp_apikey = serverpilot_sh_getapikey();
99
100 if ($disable_ssl == 'yes') {
101 $verifypeer = false;
102 } else {
103 $verifypeer = true;
104 }
105
106 $req = curl_init('https://api.serverpilot.io/v1/' . $endpoint);
107 curl_setopt($req, CURLOPT_USERAGENT, 'ServerPilot-WHMCS');
108.................................................................
109...................................
110.........