Guest User

Untitled

a guest
Jan 7th, 2020
1,674
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  14. function WebServerConfiguration()
  15. {
  16. if (file_exists('/usr/local/cwp/.conf/web_server.conf')) {
  17. $_obfuscated_0D2E0F283936151616321E1B071B011B285B0F2A363601_ = ssh_exec('cat /usr/local/cwp/.conf/web_server.conf');
  18. $_obfuscated_0D2E0F283936151616321E1B071B011B285B0F2A363601_ = remove_empty_line($_obfuscated_0D2E0F283936151616321E1B071B011B285B0F2A363601_);
  19.  
  20. if ($_obfuscated_0D2E0F283936151616321E1B071B011B285B0F2A363601_ == 2) {
  21. $_obfuscated_0D180F34062219263233371212100C0131052219343C32_ = array('webserver_settings' => '2', 'apache_port_nonssl' => '8181', 'apache_port_ssl' => '8443', 'nginx_port_nonssl' => '80', 'nginx_port_ssl' => '443', 'nginx_proxy_port' => '8181', 'varnish_port' => '');
  22. } else {
  23. if ($_obfuscated_0D2E0F283936151616321E1B071B011B285B0F2A363601_ == 4) {
  24. $_obfuscated_0D180F34062219263233371212100C0131052219343C32_ = array('webserver_settings' => '4', 'apache_port_nonssl' => '8181', 'apache_port_ssl' => '8443', 'nginx_port_nonssl' => '80', 'nginx_port_ssl' => '443', 'nginx_proxy_port' => '82', 'varnish_port' => '82');
  25. } else {
  26. $_obfuscated_0D180F34062219263233371212100C0131052219343C32_ = array('webserver_settings' => '1', 'apache_port_nonssl' => '80', 'apache_port_ssl' => '443', 'nginx_port_nonssl' => '', 'nginx_port_ssl' => '', 'nginx_proxy_port' => '', 'varnish_port' => '');
  27. }
  28. }
  29. } else {
  30. $_obfuscated_0D180F34062219263233371212100C0131052219343C32_ = array('webserver_settings' => '1', 'apache_port_nonssl' => '80', 'apache_port_ssl' => '443', 'nginx_port_nonssl' => '', 'nginx_port_ssl' => '', 'nginx_proxy_port' => '', 'varnish_port' => '');
  31. }
  32.  
  33. return $_obfuscated_0D180F34062219263233371212100C0131052219343C32_;
  34. }
  35.  
  36. function get_configurationTemplate($template_name)
  37. {
  38. $_obfuscated_0D3C0840011F062914143D36013C15105C0F3119350B11_ = '/usr/local/cwp/.conf/web_servers/conf_templates/' . $template_name . '.conf';
  39.  
  40. if (file_exists((string) $_obfuscated_0D3C0840011F062914143D36013C15105C0F3119350B11_)) {
  41. $filename = $_obfuscated_0D3C0840011F062914143D36013C15105C0F3119350B11_;
  42. } else {
  43. $filename = '/usr/local/cwpsrv/htdocs/resources/conf/web_servers/conf_templates/' . $template_name . '.conf';
  44. }
  45.  
  46. return $filename;
  47. }
  48.  
  49. function checkForApacheErrors()
  50. {
  51. $checkForApacheErrors = ssh_exec('/usr/local/apache/bin/apachectl -t; echo $?');
  52. $checkForApacheErrors = remove_empty_line($checkForApacheErrors);
  53.  
  54. if ($checkForApacheErrors != '0') {
  55. $_obfuscated_0D11243C1C5B113F095B2A3C0A2A3D120A0A38265C0701_ = ssh_exec('/usr/local/apache/bin/apachectl -t 2>&1');
  56. $return_message = "<div class=\"alert alert-danger\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n <strong>Apache ERROR Detected !</strong> " . $_obfuscated_0D11243C1C5B113F095B2A3C0A2A3D120A0A38265C0701_ . "\n </div>";
  57.  
  58. return $return_message;
  59. }
  60. }
  61.  
  62. function checkForNginxErrors()
  63. {
  64. $checkForNginxErrors = ssh_exec('/usr/sbin/nginx -t; echo $?');
  65. $checkForNginxErrors = remove_empty_line($checkForNginxErrors);
  66.  
  67. if ($checkForNginxErrors != '0') {
  68. $_obfuscated_0D11243C1C5B113F095B2A3C0A2A3D120A0A38265C0701_ = ssh_exec('/usr/sbin/nginx -t 2>&1');
  69. $return_message = "<div class=\"alert alert-danger\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n <strong>Nginx ERROR Detected !</strong> " . $_obfuscated_0D11243C1C5B113F095B2A3C0A2A3D120A0A38265C0701_ . "\n </div>";
  70.  
  71. return $return_message;
  72. }
  73. }
  74.  
  75. function RemoveNginxVhost($action, $domain)
  76. {
  77. if (file_exists('/etc/nginx/conf.d/' . $domain . '.conf')) {
  78. ssh_exec('test -h /etc/nginx/conf.d/' . $domain . '.conf || rm -Rf /etc/nginx/conf.d/' . $domain . '.conf');
  79. }
  80.  
  81. if (!empty($action)) {
  82. ManageServices((string) $action, array('nginx'));
  83. }
  84. }
  85.  
  86. function RemoveVarnishVhost($action, $domain)
  87. {
  88. if (file_exists('/etc/varnish/sites.vcl')) {
  89. ssh_exec("sed -i '/\"" . $domain . "\$\"/d' /etc/varnish/sites.vcl");
  90. }
  91.  
  92. if (!empty($action)) {
  93. ManageServices((string) $action, array('varnish'));
  94. }
  95. }
  96.  
  97. function WebServers_ListAllConfigFiles($server_array)
  98. {
  99. $_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ = '/usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts';
  100.  
  101. if (isset($server_array['server_name'])) {
  102. if (isset($server_array['template_type'])) {
  103. if (file_exists($_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ . '/' . $server_array['server_name'] . '/' . $server_array['template_type'])) {
  104. $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_ = ssh_exec('cd ' . $_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ . '/' . $server_array['server_name'] . '/' . $server_array['template_type'] . '; ls *.tpl');
  105.  
  106. return $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_;
  107. }
  108.  
  109. $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_ = ssh_exec('cd ' . $_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ . '/' . $server_array['server_name'] . '; ls *.tpl');
  110.  
  111. return $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_;
  112. }
  113.  
  114. $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_ = ssh_exec('cd ' . $_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ . '/' . $server_array['server_name'] . '; ls *.tpl');
  115.  
  116. return $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_;
  117. }
  118. }
  119.  
  120. function WebServers_ListAllConfigFolders($server_array)
  121. {
  122. $_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ = '/usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts';
  123.  
  124. if (isset($server_array['server_name'])) {
  125. $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_ = ssh_exec('cd ' . $_obfuscated_0D27172D380E06260F0B3D2F3D17011333230A2A2C0622_ . '/' . $server_array['server_name'] . '; ls -d */');
  126.  
  127. return $_obfuscated_0D1A030D04133E290D29065B1E060A5B152139071E5C32_;
  128. }
  129. }
  130.  
  131. function WebServers_Rebuild($array_Data)
  132. {
  133. if (file_exists('/usr/local/cwp/.conf/web_servers.conf')) {
  134. $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_ = json_decode(file_get_contents('/usr/local/cwp/.conf/web_servers.conf'), true);
  135. }
  136.  
  137. $_obfuscated_0D380A01213D39071E0D3E1C155C173C073D1E06140F22_ = '/home/';
  138.  
  139. if (isset($array_Data['invalid_user_conf'])) {
  140. $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_ = $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_;
  141. unset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['varnish']);
  142.  
  143. if ($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-type-default'] == 'php-fpm') {
  144. unset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['php-cgi']);
  145. }
  146. } else {
  147. $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_ = '';
  148.  
  149. if (file_exists('/home/' . $array_Data['username'] . '/.conf/webservers/' . $array_Data['domain'] . '.conf')) {
  150. $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_ = json_decode(file_get_contents('/home/' . $array_Data['username'] . '/.conf/webservers/' . $array_Data['domain'] . '.conf'), true);
  151.  
  152. if (!is_array($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_)) {
  153. $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_ = $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_;
  154. unset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['varnish']);
  155.  
  156. if ($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-type-default'] == 'php-fpm') {
  157. unset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['php-cgi']);
  158. }
  159. }
  160. } else {
  161. $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_ = $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_;
  162. unset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['varnish']);
  163.  
  164. if ($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-type-default'] == 'php-fpm') {
  165. unset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['php-cgi']);
  166. }
  167. }
  168. }
  169.  
  170. if (file_exists($_obfuscated_0D380A01213D39071E0D3E1C155C173C073D1E06140F22_)) {
  171. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['nginx']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx'])) {
  172. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['varnish']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['varnish'])) {
  173. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['apache-additional'])) {
  174. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['php-cgi']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['php-cgi'])) {
  175. $array_Data += array('apache_port' => '8181', 'apache_port-ssl' => '8443', 'apache_template-type-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-type-default'], 'apache_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-name-default'], 'nginx_port' => '80', 'nginx_port-ssl' => '443', 'nginx_proxyto-port-default' => '82', 'nginx_template-type-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-type-default'], 'nginx_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-name-default'], 'varnish_port' => '82', 'varnish_proxyto-port-default' => '8181', 'varnish_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['varnish_template-name-default']);
  176.  
  177. if (!empty($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_)) {
  178. $array_Data += $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_;
  179. }
  180.  
  181. if (isset($array_Data['getconf'])) {
  182. $return_data = array('webservers' => 'nginx->varnish->apache->php-cgi', 'nginx' => true, 'varnish' => true, 'apache' => true, 'php' => 'php-cgi');
  183.  
  184. return $return_data;
  185. }
  186.  
  187. Log_Handler($array_Data['domain'] . ' Running Nginx/Varnish/Apache/PHP-CGI', '/var/log/cwp/webservers.log');
  188. WebServers_CleanDomainConf($array_Data);
  189. WebServers_NginxVhost($array_Data);
  190. WebServers_VarnishVhosts($array_Data);
  191. WebServers_ApacheVhost($array_Data);
  192. } else {
  193. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['php-fpm']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['php-fpm'])) {
  194. $array_Data += array('apache_port' => '8181', 'apache_port-ssl' => '8443', 'apache_template-type-default' => 'php-fpm', 'apache_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-name-default'], 'apache_template-backend-fcgi' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache_template-backend-fcgi'], 'apache-php-fpm_ver-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['apache-php-fpm_ver-default'], 'php-fpm_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['php-fpm_template-name-default'], 'nginx_port' => '80', 'nginx_port-ssl' => '443', 'nginx_template-type-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-type-default'], 'nginx_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-name-default'], 'nginx_proxyto-port-default' => '82', 'varnish_port' => '82', 'varnish_proxyto-port-default' => '8181', 'varnish_template-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['varnish_template-default']);
  195.  
  196. if (!empty($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_)) {
  197. $array_Data += $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_;
  198. }
  199.  
  200. if (isset($array_Data['getconf'])) {
  201. $return_data = array('webservers' => 'nginx->varnish->apache->php-fpm', 'nginx' => true, 'varnish' => true, 'apache' => true, 'php' => 'php-fpm');
  202.  
  203. return $return_data;
  204. }
  205.  
  206. Log_Handler($array_Data['domain'] . ' Running Nginx/Varnish/Apache/PHP-FPM', '/var/log/cwp/webservers.log');
  207. WebServers_CleanDomainConf($array_Data);
  208. WebServers_NginxVhost($array_Data);
  209. WebServers_VarnishVhosts($array_Data);
  210. WebServers_ApacheVhost($array_Data);
  211. WebServers_PHPFPMVhosts($array_Data, null);
  212. } else {
  213. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['tomcat']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['tomcat'])) {
  214. } else {
  215. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['nodejs']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nodejs'])) {
  216. } else {
  217. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['ruby']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['ruby'])) {
  218. } else {
  219. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['custom-ip'])) {
  220. $array_Data += array('apache_port' => '8181', 'apache_port-ssl' => '8443', 'apache_proxyto-ip' => $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['custom-ip'], 'apache_proxyto-port' => $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['custom-port'], 'apache_template-type-default' => $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['apache_template-type'], 'apache_template-name-default' => $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['apache_template-name'], 'nginx_port' => '80', 'nginx_port-ssl' => '443', 'nginx_proxyto-port-default' => '82', 'nginx_template-type-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-type-default'], 'nginx_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-name-default'], 'varnish_port' => '82', 'varnish_proxyto-port-default' => '8181', 'varnish_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['varnish_template-name-default']);
  221.  
  222. if (!empty($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_)) {
  223. $array_Data += $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_;
  224. }
  225.  
  226. if (isset($array_Data['getconf'])) {
  227. $return_data = array('webservers' => 'nginx->varnish->apache->proxy', 'nginx' => true, 'varnish' => true, 'apache' => true);
  228.  
  229. return $return_data;
  230. }
  231.  
  232. Log_Handler($array_Data['domain'] . ' Running Nginx/Varnish/Apache/Proxy', '/var/log/cwp/webservers.log');
  233. WebServers_CleanDomainConf($array_Data);
  234. WebServers_NginxVhost($array_Data);
  235. WebServers_VarnishVhosts($array_Data);
  236. WebServers_ApacheVhost($array_Data);
  237. } else {
  238. Log_Handler($array_Data['domain'] . ' Running Default in50', '/var/log/cwp/webservers.log');
  239. $array_Data += array('invalid_user_conf' => true);
  240.  
  241. return WebServers_Rebuild($array_Data);
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. } else {
  249. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['tomcat']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['tomcat'])) {
  250. } else {
  251. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['nodejs']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nodejs'])) {
  252. } else {
  253. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['ruby']) && isset($_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['ruby'])) {
  254. } else {
  255. if (isset($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['custom-ip'])) {
  256. $array_Data += array('nginx_port' => '80', 'nginx_port-ssl' => '443', 'nginx_proxyto-port-default' => '82', 'nginx_template-type-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-type-default'], 'nginx_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['nginx_template-name-default'], 'varnish_port' => '82', 'varnish_proxyto-ip' => $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['custom-ip'], 'varnish_proxyto-port' => $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_['custom-port'], 'varnish_proxyto-port-default' => '80', 'varnish_template-name-default' => $_obfuscated_0D291921135C1C13141A31370A153039030A233F293C11_['varnish_template-name-default']);
  257.  
  258. if (!empty($_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_)) {
  259. $array_Data += $_obfuscated_0D053C3D29080B38130112142F261A1C5C1F120E3D5C32_;
  260. }
  261.  
  262. if (isset($array_Data['getconf'])) {
  263. $return_data = array('webservers' => 'nginx->varnish->proxy', 'nginx' => true, 'varnish' => true);
  264.  
  265. return $return_data;
  266. ......................................................................
  267. .......................................
  268. ...................
RAW Paste Data