· 7 years ago · Jan 21, 2019, 11:02 PM
1Godaddy is installing password protected Obfuscator PHP Coded files within their customers accounts now?
2
3Filename: catt.php
4The unencrypted code is shown below.
5
6++++
7
8
9<?php define("VERSION", '2.2');
10 define("TOOL", 'CATT');
11 define("HTPASSWDFILE", shell_exec("curl gdsupport:GjfFqt6*7@216.69.136.144/".TOOL."/htpasswd"));
12 $GLOBALS['time'] = date("Y-m-d-H:i:s");
13 session_start();
14 function load_htpasswd(){ $res = Array();
15 $array = preg_split( '/(\n|:)/',HTPASSWDFILE);
16 for($i = 0;
17 $i < count($array) -1;
18 $i++) { if($i % 2 == 0){ $user = $array[$i];
19 } else{ $pass = chop($array[$i]);
20 } $res[$user] = $pass;
21 } return $res;
22 } function test_htpasswd( $pass_array, $user, $pass ){ if ( !isset($pass_array[$user])) return False;
23 $crypted = $pass_array[$user];
24 $salt = explode('$', $crypted);
25 $salt = $salt[2];
26 $check = trim(shell_exec("openssl passwd -apr1 -salt ".$salt." ".$pass));
27 if($check == $crypted){ return True;
28 } else{ return False;
29 } } $pass_array = load_htpasswd();
30 if (!isset($_SESSION['username']) && !isset($_SESSION['password']) && !isset($_GET['killself'])) { if(isset($_POST["user"]) && isset($_POST["pass"])){ $_SESSION['username'] = $_POST["user"];
31 $_SESSION['password'] = $_POST["pass"];
32 if(!test_htpasswd( $pass_array, $_SESSION['username'], $_SESSION['password'])){ $cuser= $_SESSION['username'];
33 $time = date("Y-m-d H:i:s");
34 $log = "../.wpc.log";
35 $action = "LoginFail";
36 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
37 shell_exec($cmd);
38 session_destroy();
39 shell_exec('rm -f '.$_SERVER['SCRIPT_FILENAME']);
40 header("Refresh:0");
41 } else{ header("Refresh:0");
42 } } else{ echo "
43 <html>
44 <head>
45 <title> ".TOOL." - Login </title>
46 </head>
47 <body>
48 <form action='".basename($_SERVER['PHP_SELF'])."' method='post'>
49 Username: <input type='text' name='user'><br>
50 Password: <input type='password' name='pass'><br>
51 <input type='submit' value='Submit'>
52 </form>
53 </body>
54 </html>";
55 } } else { $masterVersion = (float) shell_exec("curl http://216.69.136.144/toolkit/".TOOL."_version_master.txt");
56 $currentVersion = (float) VERSION;
57 if($currentVersion < $masterVersion && !isset($_GET['killself'])){ echo "<html>
58 <head>
59 <title>New Version Required!</title>
60 </head>
61 <body>
62 <h1>Your version of ".TOOL." is out of date</h1>
63 <p>Your current version is <b>".$currentVersion."</b>. Please download version <b>".$masterVersion."</b> at <a href='http://managedtoolkit.cloud.phx3.gdg/".TOOL."/'>http://managedtoolkit.cloud.phx3.gdg/".TOOL."/</a>.</p>
64 </body>
65</html>";
66 exit;
67 } if(isset($_GET['logs'])){ echo '<HTML> <header> <title> '.TOOL.' LOG REVIEW! </title> <H1>WordPress Debug Log:</H1><H4>This field is showing you the WordPress debug.log file held within wp-content.<p> <iframe src="./wp-content/debug.log" width="100%" height="30%"></iframe><p> <p> <H1>File Scan:</H1><p> <iframe src="./wp-content/file_scan.log" width="100%" height="30%"></iframe><p> <H1>Database Scan:</H1><p> <iframe src="./wp-content/db_scan.log" width="100%" height="30%"></iframe>';
68 } elseif(isset($_GET['mail'])){ $cuser= $_SESSION['username'];
69 $time = date("Y-m-d H:i:s");
70 $log = "../.wpc.log";
71 $action = "phpmail";
72 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
73 shell_exec($cmd);
74
75?>
76<html>
77
78<body>
79
80<?php if (isset($_REQUEST['from'])) { $apsub = 'apsubmit@secureserver.net';
81 $subject = time().' - Managed WordPress Mail Check - delete me -';
82 $message = 'This message was generated by an automated tool by support. If you can read this please delete this message.';
83 if (mail($to,$subject,$message)) { echo "Email sent! PHP mail() function is working properly!";
84 } else { echo "Error - Mail not sent! Please troubleshoot possible causes. Ensure relay limit is not reached and account is not blocked in Splunk.";
85 } } else { $apsub = 'apsubmit@secureserver.net';
86 $subject = time().' - Managed WordPress Mail Check - delete me -';
87 $message = 'This message was generated by an automated tool by support. If you can read this please delete this message';
88 if (mail($to,$subject,$message)) { echo "Email sent! PHP mail() function is working properly!";
89 } else { echo "Error - Mail not sent! Please troubleshoot possible causes. Ensure relay limit not reached and account not blocked in Splunk";
90 } }
91?>
92
93</body>
94</html>
95
96<?php } elseif(isset($_GET['phpinfo'])){
97?>
98<style type="text/css">
99 @import url(http://fonts.googleapis.com/css?family=PT+Mono);
100 #phpinfo body,
101 body,
102 html,
103 div {
104 cursor: default;
105 background-color: #13488A
106 }
107
108 #phpinfo body,
109 #phpinfo pre,
110 h1,
111 h2,
112 td,
113 th {
114 font-family: 'PT Mono', Tahoma, Geneva, sans-serif
115 }
116
117 #phpinfo .e,
118 #phpinfo .h {
119 font-weight: 700;
120 color: #FFF;
121 min-width:
122 }
123
124 #phpinfo body,
125 body {
126 color: #FFF
127 }
128
129 #phpinfo pre {
130 margin: 2px
131 }
132
133 #phpinfo a:link {
134 color: #FFF;
135 text-decoration: none;
136 background-color: #fff
137 }
138
139 #phpinfo a:hover {
140 text-decoration: underline
141 }
142
143 #phpinfo table {
144 border-collapse: collapse;
145 }
146
147 #phpinfo .center {
148 text-align: center
149 }
150
151 #phpinfo .center table {
152 margin-left: auto;
153 margin-right: auto;
154 text-align: left;
155 width: 50%;
156 margin-top: 1%;
157 }
158
159 #phpinfo .center th {
160 text-align: center!important
161 }
162
163 #phpinfo td,
164 th {
165 border: 1px solid #222;
166 font-size: 90%;
167 vertical-align: middle
168 }
169
170 #phpinfo h1 {
171 font-size: 150%
172 }
173
174 #phpinfo h2 {
175 font-size: 125%
176 }
177
178 #phpinfo .p {
179 text-align: center
180 }
181
182 #phpinfo .e {
183 background-color: #333
184 }
185
186 #phpinfo .e:hover {
187 background-color: #373737
188 }
189
190 #phpinfo .h {
191 background-color: #236AC3
192 }
193
194 #phpinfo .v {
195 background-color: #333;
196 color: #89E14A
197 }
198
199 #phpinfo .v:hover {
200 background-color: #373737;
201 color: #89E14A
202 }
203
204 #phpinfo .vr,
205 #phpinfo hr {
206 background-color: #333;
207 color: #FFF
208 }
209
210 #phpinfo .vr {
211 text-align: right
212 }
213
214 #phpinfo img {
215 float: right;
216 border: 0
217 }
218
219 #phpinfo hr {
220 width: 600px;
221 border: 0;
222 height: 1px
223 }
224</style>
225
226<div id="phpinfo">
227
228<?php $cuser= $_SESSION['username'];
229 $time = date("Y-m-d H:i:s");
230 $log = "../.wpc.log";
231 $action = "phpinfo";
232 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
233 shell_exec($cmd);
234 ob_start () ;
235 phpinfo () ;
236 $pinfo = ob_get_contents () ;
237 ob_end_clean () ;
238 echo ( str_replace ( "module_Zend Optimizer", "module_Zend_Optimizer", preg_replace ( '%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo ) ) ) ;
239
240?>
241</div>
242
243
244<?php } elseif(isset($_GET['integrity'])){ $cuser= $_SESSION['username'];
245 $time = date("Y-m-d H:i:s");
246 $log = "../.wpc.log";
247 $action = "integrity";
248 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
249 shell_exec($cmd);
250 define('ABSPATH', './');
251 if ( defined( 'ABSPATH' ) ) { include( ABSPATH . 'wp-includes/version.php' );
252 $wp_locale = isset( $wp_local_package ) ? $wp_local_package : 'en_US';
253 $apiurl = 'https://api.wordpress.org/core/checksums/1.0/?version=' . $wp_version . '&locale=' . $wp_locale;
254 $json = json_decode ( file_get_contents ( $apiurl ) );
255 $checksums = $json->checksums;
256 $pass = "";
257 $fail = "";
258 foreach( $checksums as $file => $checksum ) { $file_path = ABSPATH . $file;
259 if ( file_exists( $file_path ) ) { if ( md5_file ($file_path) !== $checksum ) { $fail .= "<font color='red'>".$file."</font><br>";
260 } else{ $pass .= "<font color='green'>".$file."</font><br>";
261 } } } if ($fail == ""){ $fail = "None";
262 } echo "
263 <style type='text/css'>
264#wrap {
265 width:600px;
266
267 margin:0 auto;
268
269}
270#left_col {
271 float:left;
272
273 width:300px;
274
275}
276#right_col {
277 float:right;
278
279 width:300px;
280
281}
282</style>
283
284<div id='wrap'>
285 <div id='left_col'>
286 <h1>Failed:</h1><br>
287 ".$fail."
288 </div>
289 <div id='right_col'>
290 <h1>Passed:</h1><br>
291 ".$pass."
292 </div>
293</div>
294 ";
295 } } elseif(isset($_GET['core'])){ $cuser= $_SESSION['username'];
296 $time = date("Y-m-d H:i:s");
297 $log = "../.wpc.log";
298 $action = "core";
299 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
300 shell_exec($cmd);
301
302?>
303 <h1>WARNING</h1>
304 <h4>This will replace the core files.
305 <font color='red'>Do not use this function with Managed WordPress</font>
306 </h4><br />
307
308
309<?php $config['WP_VER'] = shell_exec("cat wp-includes/version.php | grep \"wp_version =\" | cut -d\' -f 2");
310 $config['WORD_WGET'] = 'wget --no-check-certificate https://wordpress.org/wordpress-'.trim($config['WP_VER']).'.zip';
311 $config['TIME'] = time();
312 $config['CUR_URL'] = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}&coreOK={$config['TIME']}";
313
314?>
315 <a href='https://wordpress.org/wordpress-
316<?php echo $config[' WP_VER '];
317
318?>.zip'>Manually download Wordpress
319<?php echo $config['WP_VER'];
320
321?></a>
322 <br /><strong>or</strong><br />
323 <a href='
324<?php echo $config['CUR_URL']
325?>'>Click here to complete the core file replacement</a>
326 <br /><br />
327 <pre>
328
329<?php $time = date("_His_mdY");
330 $coreback = ".core_backup".$time."/";
331 if (isset($_REQUEST['coreOK'])){ shell_exec("mkdir -p ".$coreback);
332 echo "<br />mkdir -p ".$coreback;
333 shell_exec("mv {wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ".$coreback);
334 echo "<br />mv {wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ".$coreback;
335 shell_exec("cp ".$coreback."wp-config.php ./");
336 echo "<br />cp ".$coreback."wp-config.php ./";
337 shell_exec($config['WORD_WGET']);
338 echo "<br />".$config['WORD_WGET'];
339 shell_exec("unzip wordpress*.zip");
340 echo "<br />unzip wordpress*.zip";
341 shell_exec("mv wordpress/{wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ./");
342 echo "<br />mv wordpress/{wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ./";
343 shell_exec("rm wordpress*.zip");
344 echo "<br />rm wordpress*.zip";
345 shell_exec("rm -rf wordpress");
346 echo "<br />rm -rf wordpress";
347 shell_exec("chmod 700 ".$coreback);
348 echo "<br />chmod 700 ".$coreback." (in-case there's malicious code)";
349 echo "<br /><br />All Done!";
350 }
351?></pre>
352
353<?php }else{ $max_execution = ini_get('max_execution_time');
354 $memory_limit = ini_get('memory_limit');
355 ini_set('max_execution_time', 0);
356 ini_set('memory_limit', '256M');
357 class get_started{ public $display;
358 private $db_exists;
359 public $db_output;
360 public function __construct(){ session_start();
361 session_regenerate_id(true);
362 if((!isset($_SESSION['sql_backup']))||(empty($_SESSION['sql_backup']))) $_SESSION['sql_backup'] = 'None';
363 if((!isset($_SESSION['tarball']))||(empty($_SESSION['tarball']))) $_SESSION['tarball'] = 'None';
364 $started = $this->initialize();
365 $this->display = new display();
366 if($started === true){ $this->check_database();
367 }else{ $started = $this->display->set_error_box($started);
368 } $this->display->msg = $started;
369 } private function initialize(){ if(PHP_SHLIB_SUFFIX == 'dll'){ return '<h1>'.TOOL.' does not currently support Windows</h1>';
370 } if(!is_callable('shell_exec')||(strpos(ini_get('disable_functions'), 'shell_exec') === true)){ return '<h1>Shell_exec is not enabled! Cannot parse config file!</h1><h2>Please manually remove '.TOOL.'.</h1>';
371 } if(!class_exists('PDO')){ return '<h1>PDO is not installed!</h1><p>We will eventually add in fallbacks to MySQLi and regular MySQL if necessary</p>';
372 } $directory = dirname($_SERVER['SCRIPT_FILENAME']);
373 $lock = $directory.'/'.TOOL.'lock';
374 if(file_exists($lock)){ $stage = shell_exec('cat '.$lock.' 2>&1');
375 return '<h1>'.TOOL.' IS WORKING BEHIND THE SCENES!</h1><h2>Current Step: '.$stage.'</h1>';
376 } $s = new selector();
377 if(file_exists('wp-config.php')){ $config['DB_NAME'] = shell_exec("cat wp-config.php | grep DB_NAME |cut -d '\"' -f2| cut -d \' -f 4");
378 $config['DB_USER'] = shell_exec("cat wp-config.php | grep DB_USER |cut -d '\"' -f2| cut -d \' -f 4");
379 $config['DB_PASSWORD'] = shell_exec("cat wp-config.php | grep DB_PASSWORD |cut -d '\"' -f2| cut -d \' -f 4");
380 $config['DB_HOST'] = shell_exec("cat wp-config.php | grep DB_HOST |cut -d '\"' -f2| cut -d \' -f 4");
381 $config['DB_HOST_DEBUG'] = shell_exec("cat wp-config.php | grep DB_HOST |cut -d '\"' -f2| cut -d \' -f 4");
382 $config['DB_PORT'] = '';
383 $config['PREFIX'] = shell_exec("cat wp-config.php | grep table_prefix |cut -d '\"' -f 2 | cut -d \' -f2");
384 $config['WP_VER'] = shell_exec("cat wp-includes/version.php | grep \"wp_version =\" | cut -d\' -f 2");
385 $GLOBALS['WP_VER'] = $config['WP_VER'];
386 if(strpos($config['DB_HOST'], ':') !== false){ $config['DB_PORT'] = str_replace(':', '', substr($config['DB_HOST'], strpos($config['DB_HOST'], ':')));
387 $config['DB_HOST'] = substr($config['DB_HOST'], 0, strpos($config['DB_HOST'], ':'));
388 }else{ $config['DB_PORT'] = 3306;
389 } $dsn = 'mysql:host='.trim($config['DB_HOST']).';
390port='.trim($config['DB_PORT']).';
391dbname='.trim($config['DB_NAME']);
392 try{ $GLOBALS['pdo'] = new PDO($dsn, trim($config['DB_USER']), trim($config['DB_PASSWORD']));
393 }catch(PDOException $e){ die('There is an error in the wp-config file! Connection failed: '.$e->getMessage());
394 } $query = $GLOBALS['pdo']->prepare('SELECT SUM( DATA_FREE ) FROM INFORMATION_SCHEMA.PARTITIONS;
395');
396 $query->execute();
397 $sum = "SUM( DATA_FREE )";
398 $GLOBALS['DBOverhead'] = $query->fetch();
399 $GLOBALS['DBOverhead'] = $GLOBALS['DBOverhead'][$sum];
400 shell_exec("curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar;
401 chmod +x wp-cli.phar");
402 $wnode = shell_exec('hostname');
403 $GLOBALS['Web_Server'] = $wnode;
404 $config['W_NODE'] = $wnode;
405 if (strpos($wnode, 'nlwpweb') !== false){ $ismwp = 'true';
406 $GLOBALS['ismwp'] = $ismwp;
407 $GLOBALS['platform'] = 'Managed WordPress';
408 } else{ $ismwp = '0';
409 $GLOBALS['ismwp'] = $ismwp;
410 if (strpos($wnode, 'plcpnl') !== false){ $GLOBALS['platform'] = 'cPanel';
411 } else if (strpos($_SERVER['DOCUMENT_ROOT'], '/home/content/') !== false){ $GLOBALS['platform'] = '2/4GH';
412 } else if(strpos($wnode, 'secureserver.net') !== false){ $GLOBALS['platform'] = 'VPS/DED';
413 } else{ $GLOBALS['platform'] = 'Unknown';
414 $to = 'managedops@godaddy.com';
415 $subject = '['.TOOL.'] Unauthorized Host';
416 $message = "User: ".$_SESSION['username']." has uploaded ".TOOL." to an unrecognized system. Please review ".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."";
417 $headers = 'From: '.TOOL.'@'.$_SERVER['SERVER_NAME'].'' . "\r\n" . 'Reply-To: '.TOOL.'@'.$_SERVER['SERVER_NAME'].'' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
418 mail($to, $subject, $message, $headers);
419 $s->killself();
420 exit("Unrecognized platform detected, self-destructing. This action has been logged.");
421 } } $checkcli = shell_exec('wp cli version');
422 if (strpos($checkcli, 'WP-CLI') !== false){ $cancli = 'true';
423 $GLOBALS['cancli'] = $cancli;
424 } else{ $cancli = '0';
425 $GLOBALS['cancli'] = $cancli;
426 } $cwd = getcwd();
427 $file = 'mailquota.log';
428 $swap = str_replace('content', 'mailquota', $cwd);
429 $almost = str_replace('html', $file, $swap);
430 $last = substr($almost, 0, strpos($almost, ".log"));
431 $fin = $last.'.log';
432 $cmd = "grep 'COUNT' $fin | sed 's/\[COUNT\]//g'";
433 if (file_exists($fin)){ $relays = shell_exec($cmd);
434 $config['E_RELAY'] = $relays;
435 } else{ $relays = "Failed";
436 $config['E_RELAY'] = $relays;
437 } if((isset($_SERVER['HTTPS']))&&(!empty($_SERVER['HTTPS']))) $config['SITE_URL'] = 'https://';
438 else $config['SITE_URL'] = 'http://';
439 $config['SITE_URL'] .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
440 $config['SITE_URL'] = str_replace(basename($_SERVER['PHP_SELF']), '', $config['SITE_URL']);
441 $config['SITE_URL'] = substr($config['SITE_URL'], 0, -1);
442 $config['FILEOWNER'] = fileowner("".basename($_SERVER["SCRIPT_FILENAME"])."");
443 foreach($config as $k => $v){ $v = trim($v);
444 if(empty($v) && ($k !== 'DB_PORT') && ($k !== 'WP_VER')&& ($k !== 'E_RELAY') && ($k !== 'FILEOWNER')){ return '<h1>Error: Check wp-config.php file for empty '.$k.'!</h1>';
445 } define($k, $v);
446 } $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+-=";
447 $length = 20;
448 $len = strlen($chars);
449 $pw = '';
450 for ($i=0;
451$i<$length;
452$i++){ $pw .= substr($chars, rand(0, $len-1), 1);
453 } $pw = str_shuffle($pw);
454 define('WPPS_PW', $pw);
455 function get_headers_from_curl_response($response){ $headers = array();
456 $header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
457 foreach (explode("\r\n", $header_text) as $i => $line) if ($i === 0) $headers['http_code'] = $line;
458 else{ list ($key, $value) = explode(': ', $line);
459 $headers[$key] = $value;
460 } return $headers;
461 } $ch = curl_init("".SITE_URL."/?gddebug=1");
462 curl_setopt($ch, CURLOPT_HEADER, 1);
463 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
464 $response = curl_exec($ch);
465 $headers = get_headers_from_curl_response($response);
466 foreach($headers as $k => $v) { define($k, $v);
467 } $GLOBALS['http_status'] = $headers['http_code'];
468 if($GLOBALS['ismwp'] == false){ $GLOBALS['Proxy_Server'] = "N/A - this is not a MWP account";
469 $GLOBALS['Cache_Server'] = "N/A";
470 $GLOBALS['is_cached'] = "N/A";
471 }else{ $GLOBALS['Cache_Server'] = $headers['X-Cache-Server'];
472 $GLOBALS['Proxy_Server'] = $headers['X-Proxy-Server'];
473 $GLOBALS['is_cached'] = $headers['X-Cache'];
474 } $plugs = shell_exec('./wp-cli.phar plugin status');
475 if(strpos($plugs, 'A worker ') !== false){ $GLOBALS['WORKER'] = "true";
476 }else{ $GLOBALS['WORKER'] = "0";
477 } function doMaths($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB');
478 $bytes = max($bytes, 0);
479 $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
480 $pow = min($pow, count($units) - 1);
481 $bytes /= pow(1024, $pow);
482 return round($bytes, $precision) . ' ' . $units[$pow];
483 } return true;
484 }else{ return '<h1>We could not find the wp-config.php file!</h1><p>Please be sure to drop this script into the directory where the wp-config.php file lives.</p>';
485 } } public function check_database(){ $check_db = new fix_things();
486 $sql_result = $check_db->table_check();
487 if($sql_result !== false){ $this->db_exists = true;
488 $this->db_output = '<h3>Create Backup</h3><p></p>
489 <p>This option exports a compressed (.sql.gz) dump file to the host. Effectively backs up the database.</p><br>
490 <div class="row">
491 <div class="col-sm-12">
492 <form id="create_backup" name="create_backup" role="form" method="post">
493 <input type="hidden" name="selector" value="create_backup">
494 <button type="submit" class="btn btn-default"><font color="white">CREATE BACKUP</font></button>
495 </form>
496 </div>
497 </div>';
498 }else{ $this->db_exists = false;
499 $this->db_output = $this->display->set_error_box('<p>Database is missing critical data!</p><p class="small"><i>Check to make sure that there is a database and that it is a WordPress application!</i></p><p>It Might be missing tables and/or other critical WordPress data!</p>');
500 } } } class display{ public $msg = '';
501 public function set_warning_txt($msg){ return $this->msg = '<p class="text-warning">'.$msg.'</p>';
502 } public function set_warning_box($msg){ return $this->msg = '<div id="alertBox" class="alert alert-warning" role="alert"><b>'.$msg.'</b></div>';
503 } public function set_error_txt($msg){ return $this->msg = '<p class="text-danger">'.$msg.'</p>';
504 } public function set_error_box($msg){ return $this->msg = '<div id="alertBox" class="alert alert-danger" role="alert"><b>'.$msg.'</b></div>';
505 } public function set_success_txt($msg){ return $this->msg = '<p class="text-success"><b>'.$msg.'</b></p>';
506 } public function set_success_box($msg){ return $this->msg = '<div id="alertBox" class="alert alert-success" role="alert">'.$msg.'</div>';
507 } public function set_success_box_left($msg){ return $this->msg = '<div id="alertBox" class="alert alert-success" role="alert"><p align="left">'.$msg.'</p></div>';
508 } public function del_box(){ return $this->msg = '<script>setTimeout(function(){var element = document.getElementById("alertBox");
509element.parentNode.removeChild(element);
510}, 2000);
511</script>';
512 } } class selector { public $fix = '';
513 public $display;
514 public $archive;
515 public $mySQL;
516 private $lock;
517 public function __construct($selection = ''){ $this->fix = new fix_things();
518 $this->display = new display();
519 $this->mySQL = new mysqlStuffs();
520 $this->archive = new MyArchive($this->fix, $this->mySQL);
521 $this->lock = new lockFile();
522 if(!empty($selection)){ if(($selection !== 'fix_things')){ $this->$selection();
523 }else{ $response = '';
524 foreach($_POST as $method => $v){ if(($method !== 'selector')&&($v !== 'false')&&(is_callable($this->$method()))){ $response .= $this->$method();
525 } } $response .= $this->display->set_warning_box('<p>'.TOOL.' has completed the operation.</p>');
526 echo $response;
527 echo $this->display->del_box();
528 } } if(isset($_GET['killself'])){ $this->killself();
529 } } public function create_backup(){ $this->logAction("create_backup");
530 if(($file = $this->mySQL->create_sql_backup()) !== false){ $cmd = $this->lock->updateLock('Backing up MySQL database'). $this->mySQL->cmd. $this->lock->removeLock();
531 shell_exec($cmd);
532 echo $this->display->set_success_box('<p>MySQL Backup created: '.$file.'</p>');
533 echo "<script>var btn = document.getElementById('restoreSubmit');
534var select = document.getElementById('dbDumps');
535 var opt = document.createElement('option');
536 opt.value = '".$file."';
537 opt.innerHTML = '".$file."';
538 select.appendChild(opt);
539btn.disabled = false;
540</script>";
541 echo $this->display->del_box();
542 }else{ echo $this->display->set_error_box('<p>An error has occurred while trying to create the backup!</p>');
543 echo $this->display->del_box();
544 } } public function select_sql_backup(){ $response = '';
545 $file_list = $this->mySQL->select_sql_backup();
546 if(isset($_SESSION['sql_backup'])){ $response = $this->display->set_success_txt('Last backup file created this session: '. $_SESSION['sql_backup']);
547 } $response .= '
548 <form role="form" class="form-horizontal" method="post">
549 <div class="form-group">
550 <label for="backup_file" class="col-sm-4 control-label">Select Backup File:</label>
551 <div class="col-sm-8">
552 <select id="dbDumps" class="form-control" name="backup_file">';
553 foreach($file_list as $k=>$v){ $response .= '<option value="'.$v.'"selected>'.$v.'</option>';
554 } $response .= '
555 </select>
556 </div>
557 </div>
558 <input type="hidden" name="selector" value="restore_backup">
559 <div class="col-sm-12">';
560 if(!empty($file_list)){ $response .= '<button id="restoreSubmit" type="submit" class="btn btn-default pull-right"><font color="white">RESTORE BACKUP</font></button>
561 </div>
562 </form>';
563 } else{ $response .= '<button id="restoreSubmit" type="submit" class="btn btn-default pull-right" disabled><font color="white">RESTORE BACKUP</font></button>
564 </div>
565 </form>';
566 } echo $response;
567 } public function restore_backup(){ $this->logAction("restore_backup");
568 if($this->mySQL->restore_sql_backup($_POST['backup_file']) !== false){ $cmd = $this->lock->updateLock('Restoring MySQL database'). $this->mySQL->cmd. $this->lock->removeLock();
569 shell_exec($cmd);
570 echo $this->display->set_success_box('<p>Restored the MySQL database from '.$_POST['backup_file'].' successfully!</p>');
571 echo $this->display->del_box();
572 }else{ echo $this->display->set_error_box('<p>An error has occurred!</p><p>Unable to restore the database from file '.$_POST['backup_file'].'!</p>');
573 echo $this->display->del_box();
574 } } public function create_archive(){ $this->logAction("create_archive");
575 if($this->mySQL->create_sql_backup('./wp-content') !== false){ $file = $this->archive->create_archive();
576 $_SESSION['tarball'] = $file;
577 $cmd = $this->lock->updateLock('Backing up MySQL database'). $this->mySQL->cmd. $this->lock->updateLock('Creating tarball for transport'). $this->archive->cmd. $this->lock->removeLock();
578 shell_exec($cmd);
579 $response = $this->display->set_success_box('Archive completed: '.$file);
580 echo "<script>var btn = document.getElementById('archiveSubmit');
581var select = document.getElementById('archiveList');
582 var opt = document.createElement('option');
583 opt.value = '".$file."';
584 opt.innerHTML = '".$file."';
585 select.appendChild(opt);
586btn.disabled = false;
587</script>";
588 }else{ $response = $this->display->set_error_box('<p>Unable to back up the MySQL database!</p><p>MySQL backup and file archive for this process were aborted!</p>');
589 } echo $response;
590 echo $this->display->del_box();
591 } public function select_archive(){ $disabled = '';
592 $response = '';
593 $archive_list = $this->archive->select_archive();
594 $response = '
595 <form role="form" method="post" class="form-horizontal">
596 <div class="form-group">
597 <label for="archive_file" class="col-sm-3 control-label">Select Archive:</label>
598 <div class="col-sm-8">
599 <select id="archiveList" name="archive_file" class="form-control">
600 <option selected disabled>-- Choose an Archive --</option>';
601 foreach($archive_list as $k=>$v){ $response .= '<option value="'.$v.'">'.$v.'</option>';
602 } $response .= '
603 </select>
604 </div>
605 </div>
606 <input type="hidden" name="selector" value="unpack_archive">
607 <div class="col-sm-12">';
608 if(!empty($archive_list)){ $response .= '<button id="archiveSubmit" type="submit" class="btn btn-default pull-right"><font color ="white">UNPACK ARCHIVE</font></button>
609 </div>
610 </form>';
611 } else{ $response .= '<button id="archiveSubmit" type="submit" class="btn btn-default pull-right" disabled><font color ="white">UNPACK ARCHIVE</font></button>
612 </div>
613 </form>';
614 } echo $response;
615 } public function child_theme(){ $parent_sel = $_POST['child_theme_select'];
616 $parent_theme = basename($parent_sel);
617 $mkchild = './wp-cli.phar scaffold child-theme '.$parent_theme.'-child --parent_theme='.$parent_theme.' --theme_name='.$parent_theme.'-child --author="This child theme was generated from the parent theme by WPPS. All Theme credit belongs to original creator(s)" --activate';
618 shell_exec($mkchild);
619 echo $this->display->set_success_box("Successfully created the child theme");
620 echo $this->display->del_box();
621 } public function permalinks(){ if($_POST['permalink_select'] == "blank"){ $structure = "";
622 }else{ $structure = $_POST['permalink_select'];
623 } echo $this->display->set_success_box(shell_exec("Rewrite structure set to '".$structure."'"));
624 echo $this->display->del_box();
625 } public function install_ionCube(){ $this->logAction("install_ionCube");
626 if (!defined('PHP_VERSION_ID')) { $version = explode('.', PHP_VERSION);
627 define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
628 } if (PHP_VERSION_ID < 50207) { define('PHP_MAJOR_VERSION', $version[0]);
629 define('PHP_MINOR_VERSION', $version[1]);
630 define('PHP_RELEASE_VERSION', $version[2]);
631 } $inipath = php_ini_loaded_file();
632 $ini_name = basename($inipath);
633 $cmd = "cp ".$inipath.$ini_name;
634 shell_exec($cmd);
635 if($GLOBALS['platform'] == "2/4GH"){ shell_exec("wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz -O ioncube_loaders_lin_x86.tar.gz");
636 shell_exec("tar -xzvf ioncube_loaders_lin_x86.tar.gz");
637 }else{ shell_exec("wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O ioncube_loaders_lin_x86-64.tar.gz");
638 shell_exec("tar -xzvf ioncube_loaders_lin_x86-64.tar.gz");
639 } $file_data = "[ZEND]\nzend_extension=\"/usr/local/Zend/lib/Guard-6.0.0/php-".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION.".x/ZendGuardLoader.so\"\nzend_extension = ".$_SERVER['DOCUMENT_ROOT']."/ioncube/ioncube_loader_lin_".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION.".so\n";
640 if(file_exists($ini_name)){ $file_data .= file_get_contents($ini_name);
641 } file_put_contents($ini_name, $file_data);
642 shell_exec("rm -f ioncube_loaders_lin_x86*.tar.gz");
643 shell_exec('pkill -U '.FILEOWNER.';
644');
645 echo $this->display->set_success_box("ionCube has been enabled!");
646 echo $this->display->del_box();
647 } public function unpack_archive(){ $this->logAction("unpack_archive");
648 $import = (isset($_POST['import']) ? true : false);
649 $automagic = (isset($_POST['automagic']) ? true : false);
650 $archive_file = (isset($_POST['archive_file']) ? $_POST['archive_file'] : false);
651 $response = '';
652 if($archive_file !== false){ if($this->archive->unpack_all_archives($_POST['archive_file'], $import) !== false){ $cmd = $this->lock->updateLock('Unpacking file archive'). $this->archive->cmd;
653 $reponse = '<p>During this processes we have:</p><ul class="list-unstyled">
654 <li>- Extracted the wp-content folder</li>';
655 if($import){ $backup = $this->mySQL->locate_own_sql();
656 if($backup !== false){ $this->mySQL->restore_sql_backup($backup);
657 $cmd .= $this->lock->updateLock('Restoring MySQL database'). $this->mySQL->cmd;
658 $response .= '<li>- Imported the MySQL database</li>';
659 } } if($automagic){ $cmd .= $this->lock->updateLock('Applying fixes to the database');
660 $response .= '<li>- Updated table prefixes, usermeta, and options</li>';
661 } $cmd .= $this->lock->removeLock();
662 shell_exec($cmd);
663 $response .= '</ul>';
664 $response = $this->display->set_success_box($response);
665 }else{ $response = $this->display->set_error_box('<p>Unable to decompress the archive.</p><p>Please attempt to decompress the archive manually or upload the archive again.</p>');
666 } }else{ $response = $this->display->set_error_box('<p>Please select an archive.</p>');
667 } echo $response;
668 echo $this->display->del_box();
669 } public function createINI(){ $this->logAction("createINI");
670 $phpini = new iniGenerator($_POST);
671 if($phpini->generate() !== false){ $this->killProcesses();
672 $response = $this->display->set_warning_box($_POST['ini_select'].' successfully created! Processes have been restarted!');
673 }else{ $response = $this->display->set_error_box('<p>An error has occurred! The new INI was not created!</p>');
674 } echo $response;
675 echo $this->display->del_box();
676 } public function get_url(){ $result = $this->fix->get_url();
677 if($result !== false){ $response = '<span class="glyphicon glyphicon-globe glyphicon-size-massive" aria-hidden="true"></span>
678 <p id="urlOld" class="small">Old: <i>'.$result.'</i></p>
679 <p id="urlNew" class="small">New: <i>'.SITE_URL.'</i></p>
680 <input type="hidden" name="set_url" value="false" />';
681 }else{ $response = $this->display->set_error_txt('Could not locate the site URL!');
682 } return $response;
683 } public function set_url(){ $this->logAction("set_url");
684 $old_url = $this->fix->get_url();
685 $this->fix->set_url();
686 $response = $this->display->set_success_box('<p><b>Site URL Updated!</b></p><p>Old Site URL: '.$old_url.'</p><p>Site URL is '.SITE_URL.'</p>');
687 echo "<script>var urlOld = document.getElementById('urlOld');
688 var urlNew = document.getElementById('urlNew');
689 urlOld.innerHTML = 'Old: ".$this->fix->get_url()."';
690 urlNew.innerHTML = 'New: ".SITE_URL."';
691</script>";
692 echo $response;
693 echo $this->display->del_box();
694 } public function get_prefixes(){ if($this->fix->get_prefix_list() !== false){ $response = '<span class="glyphicon glyphicon-th-list glyphicon-size-massive" aria-hidden="true"></span>
695 <p id="prefixOld" class="small">Old: <i>'.$this->fix->old_prefix.'</i></p>
696 <p id="prefixNew" class="small">New: <i>'.PREFIX.'</i></p>
697 <input type="hidden" name="set_prefixes" value="false" />';
698 }else{ $response = $this->display->set_error_box('<p>Could not parse prefixes!</p><p>This function will not run until there is only one COMPLETE WordPress database present</p>');
699 } return $response;
700 } public function set_prefixes(){ $this->logAction("set_prefixes");
701 if($this->fix->rename_tables()){ $response = $this->display->set_success_box('<p><b>Table Prefixes Updated!</b></p><p>Prefix "'.$this->fix->old_prefix.'" updated to "'.$this->fix->new_prefix.'" on all tables and database entries</p>');
702 $this->fix->get_prefix_list();
703 echo "<script>var prefixOld = document.getElementById('prefixOld');
704 var prefixNew = document.getElementById('prefixNew');
705 prefixOld.innerHTML = 'Old: ".$this->fix->old_prefix."';
706 prefixNew.innerHTML = 'New: ".PREFIX."'</script>";
707 } else{ $response = $this->display->set_error_box('<p>Multiple prefixes were detected! No queries were ran!</p><p>Check the database for multiple usermeta tables</p>');
708 } echo $response;
709 echo $this->display->del_box();
710 } public function killself(){ $this->logAction("kill_script");
711 $killsql = "find * -type f -name '".TOOL."-SQL_*' -mtime +3 -exec rm {} \;
712";
713 $killarch = "find * -type f -name '".TOOL."-Archive*' -mtime +3 -exec rm {} \;
714";
715 $killdebug = "mv wp-config.php wp-config.php.debug;
716 find . -type f -name 'wp-config.php.".TOOL."-debug-bak*' -print0 | xargs --null -I{} mv {} wp-config.php;
717";
718 $killreview = "rm ".TOOL."-review.html";
719 $logprot = `echo '\n\n# Protect the log files\n<Files ~ "\.log$">\nOrder Allow,Deny\nDeny from all\n</Files>' >> ./wp-content/.htaccess`;
720 $htFile = @file_get_contents("./wp-content/.htaccess");
721 $expression = '(.*Protect(.*\n)+.*Files>)';
722 $protCheck = preg_match('/'.$expression.'/', $htFile);
723 $path = $_SERVER['SCRIPT_FILENAME'];
724 if(isset($_SESSION['sql_backup'])&&!empty($_SESSION['sql_backup'])){ $sql_backup = dirname($path).$_SESSION['sql_backup'];
725 } $debug = glob('./wp-config.php.'.TOOL.'-debug-bak*');
726 $filter = array_filter($debug);
727 if (!empty($filter)) { shell_exec($killdebug);
728 } if (file_exists($review)){ shell_exec($killreview);
729 if ($protCheck == 0){ shell_exec($logprot);
730 } } shell_exec($killsql);
731 shell_exec($killarch);
732 shell_exec('rm -f wp-cli.phar');
733 shell_exec('rm -f '.$path);
734 header("Refresh:0");
735 } private function ResetUpload(){ $this->logAction("Reset_Upload");
736 $sql = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
737 $cmd = "\"UPDATE \`".PREFIX."options\` SET option_value = 'wp-content/uploads' WHERE option_name = 'upload_path';
738\"";
739 shell_exec($sql.$cmd);
740 echo $this->display->set_success_box("Upload path has been reset!");
741 echo $this->display->del_box();
742 } private function LoginReset(){ $this->logAction("Reset_Lockout");
743 $sql = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
744 $cmd = "\"UPDATE \`".PREFIX."options\` SET option_value = '' WHERE option_name = 'limit_login_lockouts' LIMIT 1;
745\"";
746 shell_exec($sql.$cmd);
747 echo $this->display->set_success_box("Login lockout has been reset!");
748 echo $this->display->del_box();
749 } private function regenthumbs(){ $this->logAction("Regen_Thumbnails");
750 $sql = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
751 $cmd = "\"UPDATE \`".PREFIX."options\` SET option_value = '' WHERE option_name = 'upload_url_path' LIMIT 1;
752\"";
753 shell_exec($sql.$cmd);
754 shell_exec('./wp-cli.phar media regenerate --only-missing');
755 echo $this->display->set_success_box("Media thumbnails have been regenerated!");
756 echo $this->display->del_box();
757 } private function EnableWorker(){ $this->logAction("Enable_Worker");
758 shell_exec('./wp-cli.phar plugin install worker --activate');
759 echo $this->display->set_success_box("ManageWP Worker Plugin has been enabled!");
760 echo $this->display->del_box();
761 } private function UpdateCore(){ $this->logAction("Update_Core");
762 shell_exec('./wp-cli.phar core update --force');
763 echo $this->display->set_success_box("WordPress Core have been updated!");
764 echo $this->display->del_box();
765 } private function DisComms(){ $this->logAction("Disable_Comments");
766 $sql = "\"UPDATE \`".PREFIX."posts\` SET comment_status='closed';
767UPDATE \`".PREFIX."options\` SET option_value='closed' WHERE option_name='default_comment_status';
768\"";
769 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
770 shell_exec($cmd.$sql);
771 echo $this->display->set_success_box("Comments have been disabled!");
772 echo $this->display->del_box();
773 } public function redraw (){ $response = "<script>var archives = document.getElementById('archiveList');
774 archives.innerHTML='";
775 $archive_list = $this->archive->select_archive();
776 if(count($archive_list) > 0){ echo '<script>var archivebtn = document.getElementById("archiveSubmit");
777 archivebtn.disabled = false;
778</script>';
779 } foreach($archive_list as $k=>$v){ $response .= '<option value="'.$v.'">'.$v.'</option>';
780 } $response .= "';
781</script>";
782 echo $response;
783 $response = "<script>var databases = document.getElementById('dbDumps');
784 databases.innerHTML='";
785 $file_list = $this->mySQL->select_sql_backup();
786 if(count($file_list) > 0){ echo '<script>var dbbtn = document.getElementById("restoreSubmit");
787 dbbtn.disabled = false;
788</script>';
789 } foreach($file_list as $k=>$v){ $response .= '<option value="'.$v.'">'.$v.'</option>';
790 } $response .= "';
791</script>";
792 echo $response;
793 echo $this->fix->old_prefix;
794 echo "<script>var prefixOld = document.getElementById('prefixOld');
795 var prefixNew = document.getElementById('prefixNew');
796 prefixOld.innerHTML = 'Old: ".$this->fix->get_prefix_list()."';
797 prefixNew.innerHTML = 'New: ".PREFIX."'</script>";
798 echo "<script>var urlOld = document.getElementById('urlOld');
799 var urlNew = document.getElementById('urlNew');
800 urlOld.innerHTML = 'Old: ".$this->fix->get_url()."';
801 urlNew.innerHTML = 'New: ".SITE_URL."';
802</script>";
803 $query = $GLOBALS['pdo']->prepare('SELECT SUM( DATA_FREE ) FROM INFORMATION_SCHEMA.PARTITIONS;
804');
805 $query->execute();
806 $sum = "SUM( DATA_FREE )";
807 $GLOBALS['DBOverhead'] = $query->fetch();
808 $GLOBALS['DBOverhead'] = $GLOBALS['DBOverhead'][$sum];
809 echo "<script>var overhead = document.getElementById('overhead');
810 overhead.innerHTML = '".strval(doMaths($GLOBALS['DBOverhead']))."'</script>";
811 echo "<script>var latestSQL = document.getElementById('last_sql_backup');
812var latestTAR = document.getElementById('last_tar_backup');
813 latestSQL.innerHTML = '".$_SESSION['sql_backup']."';
814 latestTAR.innerHTML = '".$_SESSION['tarball']."';
815</script>";
816 if(E_RELAY !== "Failed"){ $cwd = getcwd();
817 $file = 'mailquota.log';
818 $swap = str_replace('content', 'mailquota', $cwd);
819 $almost = str_replace('html', $file, $swap);
820 $last = substr($almost, 0, strpos($almost, ".log"));
821 $fin = $last.'.log';
822 $cmd = "grep 'COUNT' $fin | sed 's/\[COUNT\]//g'";
823 if (file_exists($fin)){ $relays = shell_exec($cmd);
824 $config['E_RELAY'] = $relays;
825 } echo "<script>var relay = document.getElementById('relays');
826 relay.innerHTML = '".E_RELAY."'</script>";
827 } } private function killProcesses(){ $this->logAction("killProcesses");
828 shell_exec('pkill -U '.FILEOWNER.';
829');
830 echo $this->display->set_success_box('Processes ran by '.FILEOWNER.' terminated!');
831 echo $this->display->del_box();
832 } private function roleReset(){ $this->logAction("roleReset");
833 shell_exec('./wp-cli.phar role reset --all');
834 echo $this->display->set_success_box("Roles have been reset!");
835 echo $this->display->del_box();
836 } private function PluginUpdate(){ $this->logAction("PluginUpdate");
837 shell_exec('./wp-cli.phar plugin update --all');
838 echo $this->display->set_success_box("Plugins have been updated!");
839 echo $this->display->del_box();
840 } private function ThemeUpdate(){ $this->logAction("ThemeUpdate");
841 shell_exec('./wp-cli.phar theme update --all');
842 echo $this->display->set_success_box("Themes have been updated!");
843 echo $this->display->del_box();
844 } private function PurgeComms(){ $this->logAction("Purge_Comments");
845 $sql = "\"TRUNCATE \`".PREFIX."commentmeta\`;
846TRUNCATE \`".PREFIX."comments\`;
847\"";
848 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
849 shell_exec($cmd.$sql);
850 echo $this->display->set_success_box("Comments have been purged!");
851 echo $this->display->del_box();
852 } private function PurgeSpam(){ $this->logAction("Purge_Spam");
853 $sql = "\"DELETE FROM \`".PREFIX."comments\` WHERE comment_approved = 'spam';
854\"";
855 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
856 shell_exec($cmd.$sql);
857 echo $this->display->set_success_box("Comments marked as spam have been purged!");
858 echo $this->display->del_box();
859 } private function PurgeUnapproved(){ $this->logAction("Purge_Unapproved");
860 $sql = "\"DELETE FROM \`".PREFIX."comments\` WHERE comment_approved = '0';
861\"";
862 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
863 shell_exec($cmd.$sql);
864 echo $this->display->set_success_box("All comments awaiting moderation have been purged!");
865 echo $this->display->del_box();
866 } private function OptDB(){ $this->logAction("OptDB");
867 $OptDB = "mysqlcheck -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --optimize";
868 shell_exec($OptDB);
869 echo $this->display->set_success_box("Database tables have been optimized!");
870 echo $this->display->del_box();
871 } private function RepairDB(){ $this->logAction("Repair_DB");
872 $RepairDB = "mysqlcheck -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." -A --auto-repair";
873 shell_exec($RepairDB);
874 echo $this->display->set_success_box("Database tables have checked and repaired!");
875 echo $this->display->del_box();
876 } public function supportUser(){ $this->logAction("Support_User_Updated");
877 $sql = "\"SELECT \`user_login\` FROM \`".PREFIX."users\` WHERE \`user_login\` = 'wpps-support' AND \`user_email\` = 'wpps-noreply@secureserver.net';
878\"";
879 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
880 session_start();
881 if (strpos(shell_exec($cmd.$sql), 'wpps-support') !== false){ $updatepass = "./wp-cli.phar user update wpps-support --user_pass='".WPPS_PW."'";
882 shell_exec($updatepass);
883 $_SESSION['wpps-support'] = $pw;
884 echo "<script>var element = document.getElementById('supportPass');
885 element.innerHTML = 'Pass: ".WPPS_PW."';
886</script>";
887 echo $this->display->set_success_box('Copy the user/password quickly: wpps-support | ' . WPPS_PW);
888 echo $this->display->del_box();
889 } else { $cmd = './wp-cli.phar user create wpps-support wpps-noreply@secureserver.net --role=administrator --user_pass="'.WPPS_PW.'"';
890 shell_exec($cmd);
891 $this->logAction("Support_User_Created");
892 echo "<script>var element = document.getElementById('supportPass');
893 element.innerHTML = 'Pass: ".WPPS_PW."';
894</script>";
895 echo $this->display->set_success_box('Copy the user/password quickly: wpps-support | ' . WPPS_PW);
896 echo $this->display->del_box();
897 session_start();
898 $_SESSION['wpps-support'] = WPPS_PW;
899 } } public function AutoLogin(){ define( 'WP_USE_THEMES', false );
900 define( 'COOKIE_DOMAIN', false );
901 define( 'DISABLE_WP_CRON', true );
902 include_once("wp-load.php");
903 if ( is_user_logged_in() ) { $user = wp_get_current_user();
904 echo "<script>window.open('".SITE_URL."/wp-admin/', '_blank');
905</script>";
906 } else{ $creds = array();
907 $creds['user_login'] = "wpps-support";
908 $creds['user_password'] = "'".WPPS_PW."'";
909 $creds['remember'] = true;
910 $user = wp_signon( $creds, false );
911 if(is_wp_error( $user )){ echo $this->display->set_error_box($user->get_error_message());
912 echo $this->display->del_box();
913 } else{ wp_set_auth_cookie( $user->ID, true );
914 echo "<script>window.open('".SITE_URL."/wp-admin/', '_blank');
915</script>";
916 } } } public function killTransient(){ $this->logAction("killTransient");
917 if($this->fix->get_prefix_list() !== false){ $this->mySQL->killTransient($this->fix->old_prefix);
918 $cmd = $this->lock->updateLock('Clearing cache from database and varnish...'). $this->mySQL->cmd. $this->lock->removeLock();
919 shell_exec($cmd);
920 $response = $this->display->set_success_box('Cache and transients have been flushed!');
921 }else{ $response = $this->display->set_error_box('An error has occurred while attempting to clear the transient data!');
922 } echo $response;
923 echo $this->display->del_box();
924 } private function cleanup($directory = '.'){ $this->logAction("cleanup");
925 $remove = '';
926 if ($dh = opendir($directory)) { while (false !== ($file = readdir($dh)) ){ if((strpos($file, ''.TOOL.'-Archive') !== false)||(strpos($file, ''.TOOL.'-SQL') !== false)){ $remove .= 'rm -f '.$file.';
927';
928 } } closedir($dh);
929 } return $remove;
930 } public function database_scan(){ $this->logAction("database_scan");
931 $time = date("_His_mdY");
932 $sql = 'SELECT * FROM '.PREFIX.'posts WHERE post_content LIKE "%iframe%" UNION SELECT * FROM '.PREFIX.'posts WHERE post_content LIKE "%noscript%" UNION SELECT * FROM '.PREFIX.'posts WHERE post_content LIKE "%display:%";
933';
934 $file = './wp-content/db_scan.log';
935 $cmd = "mysql -B -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e '".$sql."' > ".$file.";
936 echo '\n\n\n\n\n\n\t\t\t\t ****** SCAN COMPLETED @ ".$time." ******' >> ".$file.";
937";
938 shell_exec($cmd);
939 if (file_exists($file)) { echo $this->display->set_success_box('<p>Database Scan Complete - please review '.$file.'</p>');
940 echo $this->display->del_box();
941 }else{ echo $this->display->set_error_box('<p>An error has occurred while trying to create the output file!</p>');
942 echo $this->display->del_box();
943 } } public function sel_db_scan(){ $response = '<span class="glyphicon glyphicon-tasks glyphicon-size-massive" aria-hidden="true"></span>
944 <p class="medium">Run Database Scan</p>
945 <input type="hidden" name="database_scan" value="false" />';
946 return $response;
947 } public function file_scan(){ $this->logAction("file_scan");
948 $time = date("_His_mdY");
949 $file = $_SERVER['SCRIPT_FILENAME'];
950 $scan = 'echo -e "The following files have been marked for manual review by an automated scan performed by Support. However, as we are not able\nto support custom scripting or the inner workings of third-party applications, we are unable to provide specific solutions.\nTherefore, we respectfully suggest the use of your favorite Internet search engine in order to further research this issue.\n\n*** Please note this scan checks common compromise signatures but that does NOT always mean the file has been compromised *** \n\t \n\t ## FILES FOUND WITH BASE64 CODE ##\n" > ./wp-content/file_scan.log;
951 grep -ri --include=*.php --exclude='.$file.' -lPHn "base64" . >> ./wp-content/file_scan.log;
952 echo -e "\n\t \n\t ## FILES FOUND WITH 46ESAB(base64 backwards) CODE ##\n" >> ./wp-content/file_scan.log;
953 grep -ri --include=*.php --exclude='.$file.' -lPHn "46esab" . >> ./wp-content/file_scan.log;
954 echo -e "\n\t \n\t ## FILES FOUND WITH EVAL CODE ##\n" >> ./wp-content/file_scan.log;
955 grep -ri --include=*.php --exclude=".$file." -lPHn "(eval\(.*\);
956)" . >> ./wp-content/file_scan.log;
957 echo -e "\n\t \n\t ## FILES FOUND WITH GZINFLATE CODE ##\n" >> ./wp-content/file_scan.log;
958 grep -ri --include=*.php --exclude='.$file.' -lPHn "gzinflate" . >> ./wp-content/file_scan.log;
959 echo -e "\n\t \n\t ## PHP FILES FOUND WITHIN WP-CONTENT/UPLOADS ##\n" >> ./wp-content/file_scan.log;
960 find ./wp-content/uploads -name "*.php" >> ./wp-content/file_scan.log;
961 echo -e "\n\n\n\n\n\n\t\t\t\t ****** SCAN COMPLETED @ '.$time.' ******" >> ./wp-content/file_scan.log;
962';
963 shell_exec($scan);
964 $fscan = './wp-content/file_scan.log';
965 if (file_exists($fscan)) { $response = $this->display->set_success_box('<p>File Scan Complete - please review '.$fscan.'</p>');
966 }else{ $response = $this->display->set_error_box('<p>An error has occurred while trying to create the output file!</p>');
967 } echo $response;
968 echo $this->display->del_box();
969 } public function sel_f_scan(){ $response = '<span class="glyphicon glyphicon-folder-open glyphicon-size-massive" aria-hidden="true"></span>
970 <p class="medium">Run File Scan</p>
971 <input type="hidden" name="file_scan" value="false" />';
972 return $response;
973 } public function wp_debug(){ $this->logAction("wp_debug");
974 function Salty($length = 32) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
975 $string = '';
976 for ($i = 0;
977 $i < $length;
978 $i++) { $string .= $characters[mt_rand(0, strlen($characters) - 1)];
979 } return $string;
980 } $authk = Salty();
981 $sauthk = Salty();
982 $logink = Salty();
983 $noncek = Salty();
984$asalt = Salty();
985$sasalt = Salty();
986$logsalt = Salty();
987$nonsalt = Salty();
988 $debug = "./wp-config.php.".TOOL."-debug-bak".$GLOBALS['time'];
989 if ($GLOBALS['ismwp'] == 'true'){ $dbconf = "
990<?php\n/**\n * The base configurations of the WordPress.\n *\n * This file has the following configurations: MySQL settings, Table Prefix,\n * Secret Keys, and ABSPATH. You can find more information by visiting\n * {@link http://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}\n * Codex page. You can get the MySQL settings from your web host.\n *\n * This file is used by the wp-config.php creation script during the\n * installation. You don't have to use the web site, you can just copy this file\n * to 'wp-config.php' and fill in the values.\n *\n * @package WordPress\n */\n\n// ** MySQL settings - You can get this info from your web host ** //\n/** The name of the database for WordPress */\ndefine('DB_NAME', '".DB_NAME."');
991\n\n/** MySQL database username */\ndefine('DB_USER', '".DB_USER."');
992\n\n/** MySQL database password */\ndefine('DB_PASSWORD', '".DB_PASSWORD."');
993\n\n/** MySQL hostname */\ndefine('DB_HOST', '".DB_HOST_DEBUG."');
994\n\n/** Database Charset to use in creating database tables. */\ndefine('DB_CHARSET', 'utf8');
995\n\n/** The Database Collate type. Don't change this if in doubt. */\ndefine('DB_COLLATE', '');
996\n\n/**#@+\n * Authentication Unique Keys and Salts.\n *\n * Change these to different unique phrases!\n * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}\n * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.\n *\n * @since 2.6.0\n */\ndefine('AUTH_KEY', '".$authk."');
997\ndefine('SECURE_AUTH_KEY', '".$sauthk."');
998\ndefine('LOGGED_IN_KEY', '".$logink."');
999\ndefine('NONCE_KEY', '".$noncek."');
1000\ndefine('AUTH_SALT', '".$asalt."');
1001\ndefine('SECURE_AUTH_SALT', '".$sasalt."');
1002\ndefine('LOGGED_IN_SALT', '".$logsalt."');
1003\ndefine('NONCE_SALT', '".$nonsalt."');
1004\n\n/**#@-*/\n\n/**\n * WordPress Database Table prefix.\n *\n * You can have multiple installations in one database if you give each a unique\n * prefix. Only numbers, letters, and underscores please!\n */\n\$table_prefix = '".PREFIX."';
1005\n\n/**\n * For developers: WordPress debugging mode.\n *\n * Change this to true to enable the display of notices during development.\n * It is strongly recommended that plugin and theme developers use WP_DEBUG\n * in their development environments.\n */\n// Enable WP_DEBUG mode\ndefine('WP_DEBUG', true);
1006 \ndefine('WP_DEBUG_LOG', true);
1007 // Enable Debug logging to the /wp-content/debug.log file\ndefine('WP_DEBUG_DISPLAY', false);
1008@ini_set('display_errors',0);
1009\ndefine('SCRIPT_DEBUG', true);
1010\n\n//define( 'WP_CACHE', true );
1011\ninclude_once( dirname( __FILE__ ) . '/gd-config.php' );
1012\ndefine( 'FS_METHOD', 'direct');
1013\ndefine('FS_CHMOD_DIR', (0705 & ~ umask()));
1014\ndefine('FS_CHMOD_FILE', (0604 & ~ umask()));
1015\n\n\n/* That's all, stop editing! Happy blogging. */\n\n/** Absolute path to the WordPress directory. */\nif ( !defined('ABSPATH') )\n define('ABSPATH', dirname(__FILE__) . '/');
1016\n\n/** Sets up WordPress vars and included files. */\nrequire_once(ABSPATH . 'wp-settings.php');
1017";
1018 } else{ $dbconf = "
1019<?php\n/**\n * The base configurations of the WordPress.\n *\n * This file has the following configurations: MySQL settings, Table Prefix,\n * Secret Keys, and ABSPATH. You can find more information by visiting\n * {@link http://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}\n * Codex page. You can get the MySQL settings from your web host.\n *\n * This file is used by the wp-config.php creation script during the\n * installation. You don't have to use the web site, you can just copy this file\n * to 'wp-config.php' and fill in the values.\n *\n * @package WordPress\n */\n\n// ** MySQL settings - You can get this info from your web host ** //\n/** The name of the database for WordPress */\ndefine('DB_NAME', '".DB_NAME."');
1020\n\n/** MySQL database username */\ndefine('DB_USER', '".DB_USER."');
1021\n\n/** MySQL database password */\ndefine('DB_PASSWORD', '".DB_PASSWORD."');
1022\n\n/** MySQL hostname */\ndefine('DB_HOST', '".DB_HOST_DEBUG."');
1023\n\n/** Database Charset to use in creating database tables. */\ndefine('DB_CHARSET', 'utf8');
1024\n\n/** The Database Collate type. Don't change this if in doubt. */\ndefine('DB_COLLATE', '');
1025\n\n/**#@+\n * Authentication Unique Keys and Salts.\n *\n * Change these to different unique phrases!\n * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}\n * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.\n *\n * @since 2.6.0\n */\ndefine('AUTH_KEY', '".$authk."');
1026\ndefine('SECURE_AUTH_KEY', '".$sauthk."');
1027\ndefine('LOGGED_IN_KEY', '".$logink."');
1028\ndefine('NONCE_KEY', '".$noncek."');
1029\ndefine('AUTH_SALT', '".$asalt."');
1030\ndefine('SECURE_AUTH_SALT', '".$sasalt."');
1031\ndefine('LOGGED_IN_SALT', '".$logsalt."');
1032\ndefine('NONCE_SALT', '".$nonsalt."');
1033\n\n/**#@-*/\n\n/**\n * WordPress Database Table prefix.\n *\n * You can have multiple installations in one database if you give each a unique\n * prefix. Only numbers, letters, and underscores please!\n */\n\$table_prefix = '".PREFIX."';
1034\n\n/**\n * For developers: WordPress debugging mode.\n *\n * Change this to true to enable the display of notices during development.\n * It is strongly recommended that plugin and theme developers use WP_DEBUG\n * in their development environments.\n */\n// Enable WP_DEBUG mode\ndefine('WP_DEBUG', true);
1035 \ndefine('WP_DEBUG_LOG', true);
1036 // Enable Debug logging to the /wp-content/debug.log file\ndefine('WP_DEBUG_DISPLAY', false);
1037@ini_set('display_errors',0);
1038\ndefine('SCRIPT_DEBUG', true);
1039\n\n//define( 'WP_CACHE', true );
1040\ndefine( 'FS_METHOD', 'direct');
1041\ndefine('FS_CHMOD_DIR', (0705 & ~ umask()));
1042\ndefine('FS_CHMOD_FILE', (0604 & ~ umask()));
1043\n\n\n/* That's all, stop editing! Happy blogging. */\n\n/** Absolute path to the WordPress directory. */\nif ( !defined('ABSPATH') )\n define('ABSPATH', dirname(__FILE__) . '/');
1044\n\n/** Sets up WordPress vars and included files. */\nrequire_once(ABSPATH . 'wp-settings.php');
1045";
1046 } $move = "mv ./wp-config.php ".$debug;
1047 shell_exec($move);
1048 $file = 'wp-config.php';
1049 $handle = fopen($file, 'w');
1050 fwrite($handle, $dbconf);
1051 fclose($handle);
1052 if (file_exists($debug)) { echo $this->display->set_success_box('<p>WordPress Debugging Enabled - Please review ./wp-content/debug.log</p>');
1053 echo $this->display->del_box();
1054 }else{ echo $this->display->set_error_box('<p>An error has occurred while trying to backup the configuration file!</p>');
1055 echo $this->display->del_box();
1056 } } public function sel_wp_debug(){ $response = '<span class="glyphicon glyphicon-cog glyphicon-size-massive" aria-hidden="true"></span>
1057 <p class="medium">Enable Debugging Mode</p><p>(WordPress/PHP)</p>
1058 <input type="hidden" name="wp_debug" value="false" />';
1059 return $response;
1060 } public function disable_plugins(){ $sqLogin = "mysql -B -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." -s -N -e '";
1061 $curPlugins = 'SELECT option_value FROM '.PREFIX.'options WHERE option_name LIKE "active_plugins"\'';
1062 $curPlug = shell_exec($sqLogin.$curPlugins);
1063 $disPlug = 'a:0:{}';
1064 if(trim($curPlug) == $disPlug){ $response = '<span class="glyphicon glyphicon-ok-circle glyphicon-size-massive" aria-hidden="true"></span>
1065 <p class="medium">Restore Plugins</p>
1066 <input type="hidden" name="dis_plugins" value="false" />';
1067 return $response;
1068 }else{ $response = '<span class="glyphicon glyphicon-remove-circle glyphicon-size-massive" aria-hidden="true"></span>
1069 <p class="medium">Disable Plugins</p>
1070 <input type="hidden" name="dis_plugins" value="false" />';
1071 return $response;
1072 } } public function dis_plugins(){ $this->logAction("dis_plugins");
1073 $time = date("_His_mdY");
1074 $file = "./support_logs/active_plugins.txt";
1075 $sqLogin = "mysql -B -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." -s -N -e '";
1076 $plugins = 'SELECT option_value FROM '.PREFIX.'options WHERE option_name LIKE "active_plugins";
1077';
1078 $trunc = 'UPDATE '.PREFIX.'options SET option_value = "a:0:{}" WHERE option_name LIKE "active_plugins"';
1079 $curPlugins = $sqLogin.'SELECT option_value FROM '.PREFIX.'options WHERE option_name LIKE "active_plugins"\'';
1080 $curPlug = shell_exec($curPlugins);
1081 if(trim($curPlug) != "a:0:{}"){ $unPlug = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "'.TOOL.'-active_plugins-toggled" WHERE option_name = "active_plugins"\'';
1082 shell_exec($unPlug);
1083 $MyPlug = $sqLogin.'INSERT INTO '.PREFIX.'options(option_id, option_name, option_value, autoload) VALUES (LAST_INSERT_ID( ), "active_plugins", "a:0:{}", "yes");
1084\'';
1085 shell_exec($MyPlug);
1086 }else{ $checkMyPlug = $sqLogin.'SELECT option_name FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-active_plugins-toggled"\'';
1087 $checkFP = shell_exec($checkMyPlug);
1088 if(!empty($checkFP) && $checkFP != NULL){ $mvMyPlug = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "'.TOOL.'-active_plugins-remove" WHERE option_name = "active_plugins"\'';
1089 shell_exec($mvMyPlug);
1090 $rePlug = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "active_plugins" WHERE option_name = "'.TOOL.'-active_plugins-toggled"\'';
1091 shell_exec($rePlug);
1092 $unMyPlug = $sqLogin.'DELETE FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-active_plugins-remove"\'';
1093 shell_exec($unMyPlug);
1094 } } } public function default_theme(){ $sqLogin = "mysql -B -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." -s -N -e '";
1095 $defaultTheme = 'twentysixteen';
1096 $checkTemplate = $sqLogin.'SELECT option_value FROM '.PREFIX.'options WHERE option_name LIKE "template"\'';
1097 $checkStyle = $sqLogin.'SELECT option_value FROM '.PREFIX.'options WHERE option_name LIKE "stylesheet"\'';
1098 $curTemp = shell_exec($checkTemplate);
1099 $curStyle = shell_exec($checkStyle);
1100 $checkMyTemp = $sqLogin.'SELECT option_name FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-template-toggled"\'';
1101 $checkFT = shell_exec($checkMyTemp);
1102 if($checkFT != NULL ){ $response = '<span class="glyphicon glyphicon-ok-circle glyphicon-size-massive" aria-hidden="true"></span>
1103 <p class="medium">Restore Theme</p>
1104 <input type="hidden" name="dis_theme" value="false" />';
1105 return $response;
1106 }else{ $response = '<span class="glyphicon glyphicon-home glyphicon-size-massive" aria-hidden="true"></span>
1107 <p class="medium">Set Default Theme</p>
1108 <input type="hidden" name="dis_theme" value="false" />';
1109 return $response;
1110 } } public function dis_theme(){ $this->logAction("dis_theme");
1111 $sqLogin = "mysql -B -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." -s -N -e '";
1112 $defaultTheme = 'twentysixteen';
1113 $template = $sqLogin.'SELECT option_value FROM '.PREFIX.'options WHERE option_name = "template" \'';
1114 $style = $sqLogin.'SELECT option_value FROM '.PREFIX.'options WHERE option_name = "stylesheet" \'';
1115 $curTemp = shell_exec($template);
1116 $curStyle = shell_exec($style);
1117 if(trim($curTemp) != $defaultTheme && trim($curStyle) != $defaultTheme){ $MyTemp = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "'.TOOL.'-template-toggled" WHERE option_name LIKE "template" \'';
1118 $MyStyle = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "'.TOOL.'-stylesheet-toggled" WHERE option_name LIKE "stylesheet" \'';
1119 $MyDefTemp = $sqLogin.'INSERT INTO '.PREFIX.'options(option_id, option_name, option_value, autoload) VALUES (LAST_INSERT_ID( ), "template", "twentysixteen", "yes");
1120\'';
1121 $MyDefStyle = $sqLogin.'INSERT INTO '.PREFIX.'options(option_id, option_name, option_value, autoload) VALUES (LAST_INSERT_ID( ), "stylesheet", "twentysixteen", "yes");
1122\'';
1123 shell_exec($MyTemp);
1124 shell_exec($MyStyle);
1125 shell_exec($MyDefTemp);
1126 shell_exec($MyDefStyle);
1127 $dtheme = "twentysixteen-".TOOL.".zip";
1128 $move ="mv ./wp-content/themes/twentysixteen ./wp-content/themes/twentysixteen.bak;
1129";
1130 $wget = "wget https://downloads.wordpress.org/theme/twentysixteen.1.3.zip;
1131 unzip twentysixteen.1.3.zip -d ./wp-content/themes/";
1132 $theme = "./wp-content/themes/twentysixteen";
1133 if (file_exists($dtheme)) { $bye = "rm twentysixteen.1.3.zip";
1134 shell_exec($bye);
1135 } if (file_exists($theme)) { shell_exec($move);
1136 shell_exec($wget);
1137 }else{ shell_exec($wget);
1138 } }else{ $checkMyTemp = $sqLogin.'SELECT option_id FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-template-toggled"\'';
1139 $checkMyStyle = $sqLogin.'SELECT option_id FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-stylesheet-toggled"\'';
1140 $checkFT = shell_exec($checkMyTemp);
1141 $checkFS = shell_exec($checkMyStyle);
1142 if(checkFS != NULL && $checkFT != NULL){ $mvTemp = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "'.TOOL.'-template-remove" WHERE option_name LIKE "template" \'';
1143 $mvStyle = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "'.TOOL.'-stylesheet-remove" WHERE option_name LIKE "stylesheet" \'';
1144 shell_exec($mvTemp);
1145 shell_exec($mvStyle);
1146 $reTemp = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "template" WHERE option_name = "'.TOOL.'-template-toggled"\'';
1147 $reStyle = $sqLogin.'UPDATE '.PREFIX.'options SET option_name = "stylesheet" WHERE option_name = "'.TOOL.'-stylesheet-toggled"\'';
1148 shell_exec($reTemp);
1149 shell_exec($reStyle);
1150 $unMyTemp = $sqLogin.'DELETE FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-template-remove" \'';
1151 $unMyStyle = $sqLogin.'DELETE FROM '.PREFIX.'options WHERE option_name = "'.TOOL.'-stylesheet-remove" \'';
1152 shell_exec($unMyTemp);
1153 shell_exec($unMyStyle);
1154 } } } public function logAction($action){ $cuser= $_SESSION['username'];
1155 $time = date("Y-m-d H:i:s");
1156 $log = "../.wpc.log";
1157 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
1158 shell_exec($cmd);
1159 return;
1160 } } class lockFile { private $lockfile = '';
1161 public function __construct(){ $directory = dirname($_SERVER['SCRIPT_FILENAME']);
1162 $this->lockfile = $directory.'/'.TOOL.'lock';
1163 } public function updateLock($process = ''){ if(!empty($process)){ return 'echo "'.$process.'" > '.$this->lockfile.';
1164';
1165 } } public function removeLock(){ return 'rm -f '.$this->lockfile.';
1166';
1167 } } class iniGenerator{ private $phpconfig = array();
1168 public $filename = '';
1169 public function __construct($data){ $directory = $_SERVER['DOCUMENT_ROOT'];
1170 $this->filename = $directory.'/'.$data['ini_select'];
1171 foreach($data as $k => $v){ if(strpos($k, 'php_') !== false){ $key = substr($k, 4);
1172 $this->phpconfig[$key] = $v;
1173 } } } public function generate(){ if($this->backupINI()){ $content = '';
1174 foreach($this->phpconfig as $k => $v){ $content .= 'echo "'.$k.' = '.$v.'" >> '.$this->filename.';
1175';
1176 } shell_exec('touch '.$this->filename.' && '.$content);
1177 if(file_exists($this->filename)){ return true;
1178 }else{ return false;
1179 } }else{ return false;
1180 } } private function backupINI(){ if(file_exists($this->filename)){ if(rename($this->filename, $this->filename.'-backup')){ return true;
1181 }else{ return false;
1182 } }else{ return true;
1183 } } } class MyArchive{ private $fix;
1184 private $mySQL;
1185 public $cmd;
1186 public $lock;
1187 public function __construct($fix = '', $mySQL = ''){ $this->fix = (empty($fix) ? false: $fix);
1188 $this->mySQL = (empty($mySQL) ? false : $mySQL);
1189 if((!$this->fix)||(!$this->mySQL)) die('An error has occurred in the '.TOOL.' archives!');
1190 } public function select_archive(){ $directory = dirname($_SERVER['SCRIPT_FILENAME']);
1191 $archive_list = array();
1192 $allowed = array( '.tar', '.zip', '.gz', '.tar', '.bz2' );
1193 if(is_dir($directory)){ if ($dh = opendir($directory)) { while (false !== ($file = readdir($dh)) ){ foreach($allowed as $check){ if(!in_array($file, $archive_list)){ if((strpos($file, $check) !== false)&&(strpos($file, '.sql') === false)){ $archive_list[] = $file;
1194 } } } } closedir($dh);
1195 } } return $archive_list;
1196 } public function create_archive(){ $fdom = $_SERVER['HTTP_HOST'];
1197 $dom = str_replace(".","_", $fdom);
1198 $time = date("_His_mdY");
1199 $filename = ''.TOOL.'-Archive_'.$dom.''.$time.'.tar.gz';
1200 $this->cmd = 'tar -zcf '.$filename.' ./wp-content/;
1201';
1202 return $filename;
1203 } public function unpack_all_archives($archive_backup = '', $import){ $match = explode('.', $archive_backup);
1204 $numFound = count($match);
1205 $ext = array();
1206 $cmd = false;
1207 switch(true){ default: case ($numFound <= 1): break;
1208 case ($numFound == 2): $ext[0] = '.'.$match[1];
1209 break;
1210 case ($numFound <= 3): $ext[0] = '.'.$match[$numFound - 1];
1211 $ext[1] = '.'.$match[$numFound - 2].$ext[0];
1212 $ext = array_reverse($ext);
1213 break;
1214 } if(!empty($ext)){ foreach($ext as $extension){ if(!$cmd){ switch($extension){ case '.tar.gz': case '.tgz': $cmd = 'tar -xzf ';
1215 break;
1216 case '.gz': $cmd = 'gunzip -d < ';
1217 break;
1218 case '.zip': $cmd = 'unzip ';
1219 break;
1220 case '.tar': $cmd = 'tar -xf ';
1221 break;
1222 case '.bz2': $cmd = 'bunzip2 ';
1223 break;
1224 } } } } if($cmd){ $this->cmd .= $cmd.$archive_backup.';
1225';
1226 return true;
1227 }else{ return false;
1228 } } } class wpaas_connection { public $pdo;
1229 public $query;
1230 private $bind = array();
1231 protected $table;
1232 public function __construct(){} public function __destruct(){ if($this->pdo !== null) $this->disconnect();
1233 } public function connect(){ $dsn = 'mysql:host='.DB_HOST.';
1234port='.DB_PORT.';
1235dbname='.DB_NAME;
1236 try{ $this->pdo = new PDO($dsn, DB_USER, DB_PASSWORD);
1237 }catch(PDOException $e){ die('There is an error in the wp-config file! Connection failed: '.$e->getMessage());
1238 } } public function run($sql = ''){ $this->connect();
1239 $query = $this->pdo->prepare($sql);
1240 $result = $query->execute();
1241 $result = $query->fetch(PDO::FETCH_ASSOC);
1242 return $result;
1243 } public function runAll($sql = ''){ $this->connect();
1244 $query = $this->pdo->prepare($sql);
1245 $result = $query->execute();
1246 $result = $query->fetchAll(PDO::FETCH_ASSOC);
1247 return $result;
1248 } public function disconnect(){ $this->pdo = null;
1249 } } class mysqlStuffs{ public $mysqlBackup = '';
1250 public $cmd = '';
1251 public function create_sql_backup($dir = ''){ $time = date("_His_mdY");
1252 $filename = ''.TOOL.'-SQL_'.DB_NAME.$time.'.sql';
1253 $this->cmd = "mysqldump -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' -P ".DB_PORT." ".DB_NAME." > ";
1254 if(!empty($dir)){ $dir = $this->formatDir($dir);
1255 if($dir !== false){ $filename = $dir.'/'.$filename;
1256 }else{ return false;
1257 } }else{ $_SESSION['sql_backup'] = $filename;
1258 } $this->cmd .= $filename.';
1259';
1260 return $filename;
1261 } public function select_sql_backup($directory = ''){ if(empty($directory)) $directory = dirname($_SERVER['SCRIPT_FILENAME']);
1262 $contdir = $directory.'/wp-content/';
1263 $file_list = array();
1264 $contsql = array();
1265 if(is_dir($directory)){ if ($dh = opendir($directory)) { while (false !== ($file = readdir($dh)) ){ if(strpos($file, '.sql')) $file_list[] = $file;
1266 } closedir($dh);
1267 } } return $file_list;
1268 } public function restore_sql_backup($sql_backup){ $precmd = '';
1269 $sql_check = strpos($sql_backup, '.sql');
1270 if(!$sql_check){ $ext = '.tar.gz';
1271 }else{ $ext = substr($sql_backup, $sql_check);
1272 } $base_name = str_replace($ext, '', $sql_backup).'_'.TOOL.'.sql';
1273 $auth = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' -P ".DB_PORT." ".DB_NAME;
1274 $drop = "SET FOREIGN_KEY_CHECKS = 0;
1275 SET @tables = NULL;
1276 SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables FROM information_schema.tables WHERE table_schema = '".DB_NAME."';
1277 SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
1278 PREPARE stmt FROM @tables;
1279 EXECUTE stmt;
1280 DEALLOCATE PREPARE stmt;
1281 SET FOREIGN_KEY_CHECKS = 1;
1282";
1283 $cmd = $auth."< ./";
1284 if($ext !== '.sql'){ switch($ext){ case '.sql.tgz': $precmd = '';
1285 break;
1286 case '.sql.gz': $precmd = "gunzip -dc < ".$sql_backup;
1287 break;
1288 case '.sql.zip': $precmd = 'unzip -p '.$sql_backup;
1289 break;
1290 case '.tar.gz': $precmd = 'tar -xzOf '.$sql_backup;
1291 break;
1292 } $precmd .= " | sed 's/CREATE DATABASE/-- CREATE DATABASE/g' | sed 's/USE/-- USE/g' >> ./".$base_name.' ;
1293 ';
1294 }else{ $precmd = "sed 's/CREATE DATABASE/-- CREATE DATABASE/g' ./".$sql_backup." | sed 's/USE/-- USE/g' >> ./".$base_name.' ;
1295 ';
1296 } $postcmd = ';
1297 rm -f ./'.$base_name.';
1298';
1299 $this->cmd = $auth.' -e "'.$drop.'" ;
1300 '.$precmd.$cmd.$base_name.$postcmd;
1301 } public function killTransient(){ if ($GLOBALS['ismwp'] == 'true'){ $cmd = 'wp godaddy cache flush;
1302./wp-cli.phar transient delete-expired;
1303';
1304 $xban = "curl -XBAN ".SITE_URL."";
1305 shell_exec($xban);
1306 shell_exec($cmd);
1307 } else{ $cmd = './wp-cli.phar cache flush;
1308./wp-cli.phar transient delete-expired;
1309';
1310 shell_exec($cmd);
1311 } } public function locate_own_sql(){ $needle = ''.TOOL.'-SQL_';
1312 $directory = 'wp-content';
1313 $sql_backup = '';
1314 if(is_dir($directory)){ if($dh = opendir($directory)){ while(false !==($file = readdir($dh))){ if((strpos($file, $needle) !== false)&&(empty($sql_backup))){ return 'wp-content/'.$file;
1315 } } } } return false;
1316 } private function formatDir($directory){ if(substr($directory, -1) === '/') $directory = substr($dir, 0, -1);
1317 if(substr($directory, 0, 1) === '/') $directory = substr($directory, 1);
1318 if(is_dir($directory)){ return $directory;
1319 }else{ return false;
1320 } } } class fix_things { public $new_prefix = '';
1321 public $old_prefix = '';
1322 public $good_tables = array();
1323 public $prefix_array = array();
1324 private $pdo = null;
1325 public $display;
1326 public function __construct(){ $this->pdo = new wpaas_connection();
1327 $this->display = new display();
1328 } public function get_prefix_list(){ $sql = "SHOW TABLES LIKE '%_usermeta'";
1329 $result = $this->pdo->run($sql);
1330 $this->pdo->disconnect();
1331 if((count($result) > 1)||(empty($result))) $this->old_prefix = false;
1332 else $this->old_prefix = str_replace('usermeta', '', reset($result));
1333 return $this->old_prefix;
1334 } private function get_table_list(){ if(empty($this->old_prefix)){ $this->get_prefix_list();
1335 } $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = '".DB_NAME."' AND table_name LIKE '".$this->old_prefix."%'";
1336 if($this->old_prefix !== false){ $sql .= $this->screen_wp('table_name');
1337 $table_array = $this->pdo->runAll($sql);
1338 $this->pdo->disconnect();
1339 foreach($table_array as $database => $nested){ foreach($nested as $k => $table){ if(!in_array($table, $this->good_tables)){ $this->good_tables[] .= $table;
1340 } } } } } public function rename_tables(){ if($this->old_prefix !== false){ $this->get_table_list();
1341 $this->new_prefix = PREFIX;
1342 $sql = 'RENAME TABLE ';
1343 foreach($this->good_tables as $tbl){ $tbl_name = preg_replace('/'.$this->old_prefix.'/', '', $tbl, 1);
1344 $b_value = $this->new_prefix.$tbl_name;
1345 $sql .= $tbl.' TO '.$b_value.', ';
1346 } $sql = substr($sql, 0, -2);
1347 $this->pdo->run($sql);
1348 $this->fix_usermeta();
1349 $this->fix_options();
1350 $this->pdo->disconnect();
1351 return true;
1352 }else{ return false;
1353 } } private function fix_usermeta(){ $table = $this->new_prefix."usermeta";
1354 $sql = "UPDATE ".$table." SET meta_key = REPLACE (meta_key, '".$this->old_prefix."', '".PREFIX."') WHERE meta_key LIKE '".$this->old_prefix."%'";
1355 $sql .= $this->screen_wp('meta_key');
1356 $this->pdo->run($sql);
1357 $this->pdo->disconnect();
1358 } private function fix_options(){ $table = $this->new_prefix."options";
1359 $sql = "UPDATE ".$table." SET option_name = REPLACE (option_name, '".$this->old_prefix."', '".PREFIX."') WHERE option_name LIKE '".$this->old_prefix."%'";
1360 $sql .= $this->screen_wp('option_name');
1361 $this->pdo->run($sql);
1362 } private function screen_wp($key){ $sql = '';
1363 if(($this->old_prefix !== 'wp_')&&(PREFIX !== 'wp_')&&($this->old_prefix !== PREFIX)){ $sql .= " AND ".$key." NOT LIKE '".PREFIX."%'";
1364 } return $sql;
1365 } public function get_url(){ if(empty($this->old_prefix)) $this->get_prefix_list();
1366 if($this->old_prefix === false){ return false;
1367 }else{ $prefix = (empty($this->new_prefix) ? $this->old_prefix : $this->new_prefix);
1368 $sql = "SELECT option_value FROM ".$prefix."options WHERE option_name = 'siteurl'";
1369 $result = $this->pdo->run($sql);
1370 $this->pdo->disconnect();
1371 if(!empty($result)) $result = reset($result);
1372 else $result = false;
1373 return $result;
1374 } } public function set_url(){ if(!empty($this->new_prefix)) $prefix = $this->new_prefix;
1375 else $prefix = $this->old_prefix;
1376 $sql = "UPDATE ".$prefix."options SET option_value = '".SITE_URL."' WHERE option_name = 'siteurl';
1377
1378 UPDATE ".$prefix."options SET option_value = '".SITE_URL."' WHERE option_name = 'home';
1379";
1380 $this->pdo->run($sql);
1381 $this->pdo->disconnect();
1382 } public function table_check(){ $required_tables = array( 'commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'terms', 'term_relationships', 'term_taxonomy', 'usermeta', 'users' );
1383 $sql = 'SHOW TABLES;
1384';
1385 $result = $this->pdo->runAll($sql);
1386 $this->pdo->disconnect();
1387 foreach($result as $key => $database){ foreach($database as $k=> $dbtable){ foreach($required_tables as $rk => $table){ if(strpos($dbtable, $table) !== false) unset($required_tables[$rk]);
1388 } } } if(empty($required_tables)){ if($this->get_url() !== false) return true;
1389 } return false;
1390 } } $get_started = new get_started();
1391 if(!isset($_POST['selector'])){
1392?>
1393
1394 <!DOCTYPE html>
1395 <html lang="en">
1396 <head>
1397 <meta charset="utf-8">
1398 <meta http-equiv="X-UA-Compatible" content="IE=edge">
1399 <meta name="viewport" content="width=device-width, initial-scale=1">
1400 <title>
1401<?php echo TOOL;
1402
1403?> - a tool for WordPress</title>
1404
1405 <!-- Bootstrap -->
1406 <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
1407
1408 <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
1409 <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
1410 <!--[if lt IE 9]>
1411 <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
1412 <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
1413 <![endif]-->
1414 <style>
1415 @font-face {
1416 font-family: Walsheim-Light;
1417 font-style: normal;
1418 font-weight: 400;
1419 src: url(//img1.wsimg.com/ux/fonts/1.0/eot/w3.eot?#iefix) format("embedded-opentype"), url(//img1.wsimg.com/ux/fonts/1.0/woff/w3.woff) format("woff"), url(//img1.wsimg.com/ux/fonts/1.0/ttf/w3.ttf) format("truetype")
1420 }
1421
1422 @font-face {
1423 font-family: Walsheim-Regular;
1424 font-style: normal;
1425 font-weight: 400;
1426 src: url(//img1.wsimg.com/ux/fonts/1.0/eot/w4.eot?#iefix) format("embedded-opentype"), url(//img1.wsimg.com/ux/fonts/1.0/woff/w4.woff) format("woff"), url(//img1.wsimg.com/ux/fonts/1.0/ttf/w4.ttf) format("truetype")
1427 }
1428
1429 @font-face {
1430 font-family: Walsheim-Medium;
1431 font-style: normal;
1432 font-weight: 400;
1433 src: url(//img1.wsimg.com/ux/fonts/1.0/eot/w5.eot?#iefix) format("embedded-opentype"), url(//img1.wsimg.com/ux/fonts/1.0/woff/w5.woff) format("woff"), url(//img1.wsimg.com/ux/fonts/1.0/ttf/w5.ttf) format("truetype")
1434 }
1435
1436 @font-face {
1437 font-family: Walsheim-Bold;
1438 font-style: normal;
1439 font-weight: 400;
1440 src: url(//img1.wsimg.com/ux/fonts/1.0/eot/w7.eot?#iefix) format("embedded-opentype"), url(//img1.wsimg.com/ux/fonts/1.0/woff/w7.woff) format("woff"), url(//img1.wsimg.com/ux/fonts/1.0/ttf/w7.ttf) format("truetype")
1441 }
1442
1443 @font-face {
1444 font-family: Walsheim-Black;
1445 font-style: normal;
1446 font-weight: 400;
1447 src: url(//img1.wsimg.com/ux/fonts/1.0/eot/w8.eot?#iefix) format("embedded-opentype"), url(//img1.wsimg.com/ux/fonts/1.0/woff/w8.woff) format("woff"), url(//img1.wsimg.com/ux/fonts/1.0/ttf/w8.ttf) format("truetype")
1448 }
1449
1450 h1,
1451 h2,
1452 h3,
1453 .h1,
1454 .h2,
1455 .h3 {
1456 font-family: "Walsheim-Black";
1457 }
1458
1459 h4,
1460 h5,
1461 h6,
1462 .h4,
1463 .h5,
1464 .h6 {
1465 font-family: "Walsheim-Medium";
1466 }
1467
1468 p {
1469 font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
1470 }
1471
1472 label,
1473 .list-group-item,
1474 .list-group-item-text {
1475 font-family: "Walsheim-Regular";
1476 }
1477
1478 .alert {
1479 border-radius: 0;
1480 z-index: 99999;
1481 }
1482
1483 .alert-success {
1484 text-align: center;
1485 z-index: 99999;
1486 position: absolute;
1487 margin: 1% 10% 20px 10%;
1488 width: 75%;
1489 border: 10px solid #333;
1490 }
1491
1492 .btn {
1493 font-family: "Walsheim-Medium", Arial, sans-serif;
1494 }
1495
1496 body {
1497 background-color: #e8e8e8;
1498 }
1499
1500 .update-notice {
1501 border-radius: 0;
1502 margin-bottom: 0;
1503 }
1504
1505 .col-no-pad {
1506 padding: 0;
1507 }
1508
1509 .my-navbar {
1510 background-color: #1d6ccd;
1511 border-radius: 0;
1512 border: none;
1513 }
1514
1515 .navbar-danger {
1516 background-color: #f44242;
1517 border-radius: 0;
1518 border: none;
1519 }
1520
1521 .navbar-brand {
1522 color: #FFF;
1523 }
1524
1525 .navbar-brand:hover,
1526 .navbar-brand:focus {
1527 outline: 0;
1528 color: #FFF;
1529 background-color: #3B90F7;
1530 }
1531
1532 #main-content {
1533 font-family: "Helvetica Neue", "Segoe UI", Segoe, Helvetica, Arial, "Lucida Grande", sans-serif;
1534 }
1535
1536 .btn-default,
1537 .btn-default:hover,
1538 .btn-default:focus,
1539 .btn-default:active,
1540 .btn-default.active,
1541 .open .dropdown-toggle.btn-default {
1542 margin: 5px 3px;
1543 background-color: #13488A;
1544 border-radius: 0;
1545 color: #333;
1546 font-weight: bold;
1547 border-bottom: 4px solid #333;
1548 }
1549
1550 .btn-default.disabled,
1551 .btn-default[disabled],
1552 fieldset[disabled] .btn-default,
1553 .btn-default.disabled:hover,
1554 .btn-default[disabled]:hover,
1555 fieldset[disabled] .btn-default:hover,
1556 .btn-default.disabled:focus,
1557 .btn-default[disabled]:focus,
1558 fieldset[disabled] .btn-default:focus,
1559 .btn-default.disabled:active,
1560 .btn-default[disabled]:active,
1561 fieldset[disabled] .btn-default:active,
1562 .btn-default.disabled.active,
1563 .btn-default.active[disabled],
1564 fieldset[disabled] .btn-default.active {
1565 background-color: #CCC;
1566 }
1567
1568 .btn-default:hover,
1569 .btn-default:focus,
1570 .btn-default:active,
1571 .btn-default.active,
1572 .open .dropdown-toggle.btn-default {
1573 background-color: #333;
1574 }
1575
1576 .btn-primary,
1577 .btn-primary:hover,
1578 .btn-primary:focus,
1579 .btn-primary:active,
1580 .btn-primary.active,
1581 .open .dropdown-toggle.btn-primary {
1582 background-color: #13488A;
1583 color: #FFF;
1584 font-weight: bold;
1585 }
1586
1587 .btn-primary.disabled,
1588 .btn-primary[disabled],
1589 fieldset[disabled] .btn-primary,
1590 .btn-primary.disabled:hover,
1591 .btn-primary[disabled]:hover,
1592 fieldset[disabled] .btn-primary:hover,
1593 .btn-primary.disabled:focus,
1594 .btn-primary[disabled]:focus,
1595 fieldset[disabled] .btn-primary:focus,
1596 .btn-primary.disabled:active,
1597 .btn-primary[disabled]:active,
1598 fieldset[disabled] .btn-primary:active,
1599 .btn-primary.disabled.active,
1600 .btn-primary.active[disabled],
1601 fieldset[disabled] .btn-primary.active {
1602 background-color: #CCC;
1603 }
1604
1605 .btn-primary:hover,
1606 .btn-primary:focus,
1607 .btn-primary:active,
1608 .btn-primary.active,
1609 .open .dropdown-toggle.btn-primary {
1610 background-color: #333;
1611 }
1612
1613 .nav>li>a:hover,
1614 .nav>li>a:focus,
1615 .nav-pills>li.active>a,
1616 .nav-pills>li.active>a:hover,
1617 .nav-pills>li.active>a:focus {
1618 background-color: #1d6ccd;
1619 color: #FFF;
1620 outline: none;
1621 }
1622
1623 .btn-info {
1624 border-color: #000;
1625 background-color: #333;
1626 border-radius: 0;
1627 font-size: 18px;
1628 line-height: 20px;
1629 margin: 0;
1630 padding: 15px 0;
1631 width: 100%;
1632 }
1633
1634 .btn-info:hover,
1635 .btn-info:focus,
1636 .btn-info:active,
1637 .btn-info.active,
1638 .open .dropdown-toggle.btn-info {
1639 background-color: #13488A;
1640 border-color: #000;
1641 }
1642
1643 .btn-inf {
1644 border-color: #000;
1645 background-color: #13488A;
1646 border-radius: 0;
1647 font-size: 18px;
1648 line-height: 20px;
1649 margin: 0;
1650 padding: 15px 0;
1651 width: 100%;
1652 }
1653
1654 .btn-inf:hover,
1655 .btn-info:focus,
1656 .btn-info:active,
1657 .btn-info.active,
1658 .open .dropdown-toggle.btn-info {
1659 background-color: #333;
1660 border-color: #000;
1661 }
1662
1663 .btn-danger {
1664 border-color: #000;
1665 background-color: #333;
1666 border-radius: 0;
1667 font-size: 18px;
1668 line-height: 20px;
1669 margin: 0;
1670 padding: 15px 0;
1671 width: 100%;
1672 }
1673
1674 .btn-danger:hover,
1675 .btn-danger:focus,
1676 .btn-danger:active,
1677 .btn-danger.active,
1678 .open .dropdown-toggle.btn-danger {
1679 background-color: #333;
1680 border-color: #000;
1681 }
1682
1683 .btn-danger {
1684 border-color: #000;
1685 background-color: #f44242;
1686 border-radius: 0;
1687 font-size: 18px;
1688 line-height: 20px;
1689 margin: 0;
1690 padding: 15px 0;
1691 width: 100%;
1692 }
1693
1694 .btn-inf:hover,
1695 .btn-danger:focus,
1696 .btn-danger:active,
1697 .btn-danger.active,
1698 .open .dropdown-toggle.btn-danger {
1699 background-color: #333;
1700 border-color: #000;
1701 }
1702
1703 .box-select {
1704 cursor: pointer;
1705 margin-top: 7px;
1706 margin-bottom: 7px;
1707 padding: 10px 5px;
1708 text-align: center;
1709 background-color: #f5f5f5;
1710 border-radius: 10px;
1711 color: #333;
1712 font-weight: bold;
1713 }
1714
1715 .box-select:hover {}
1716
1717 .box-select.active,
1718 button-select.active:hover {
1719 background-color: #1d6ccd;
1720 color: #FFF;
1721 border-color: #e67c00;
1722 }
1723
1724 .alert-heading {
1725 background-color: #333;
1726 color: #FFF;
1727 border-radius: 0;
1728 }
1729
1730 .well {
1731 background-color: #FFF;
1732 border-radius: 0;
1733 box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.1);
1734 padding: 10px;
1735 }
1736
1737 a.jumbotron-links {
1738 color: #000;
1739 }
1740
1741 a.jumbotron-links:hover,
1742 a.jumbotron-links:hover .alert {
1743 background-color: #1d6ccd;
1744 text-decoration: none;
1745 }
1746
1747 .jumbotron-links .well {
1748 cursor: pointer;
1749 padding: 0;
1750 }
1751
1752 .jumbotron-links .alert {
1753 margin: 0;
1754 }
1755
1756 .jumbotron-links .jumbotron {
1757 background-color: transparent;
1758 margin-bottom: 0;
1759 padding-left: 0;
1760 padding-right: 0;
1761 }
1762
1763 .glyphicon-size-massive {
1764 font-size: 5em;
1765 }
1766
1767 .glyphicon-size-large {
1768 font-size: 3em;
1769 }
1770
1771 .ux-pagetitle {
1772 background-color: #fff;
1773 box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
1774 color: #333;
1775 margin-bottom: 30px;
1776 margin-top: -20px !important;
1777 padding: 15px 0;
1778 }
1779
1780 p {
1781 word-wrap: break-word;
1782 }
1783 </style>
1784
1785
1786 </head>
1787 <body>
1788
1789<?php $s = new selector();
1790 $s->logAction("init");
1791
1792?>
1793 <header>
1794 <div class="navbar my-navbar col-no-pad" role="navigation">
1795 <div class="col-sm-12">
1796 <div class="row">
1797 <div class="col-md-3 text-center col-no-pad">
1798 <form role="form" method="post">
1799 <input type="hidden" name="selector" value="killTransient" />
1800 <div id="cache1"><button type="submit" id="cache" class="btn btn-inf"><font color="white">Clear Cache (SQL/Varnish)</button></div></font>
1801 </form>
1802 </div>
1803 <div class="col-md-3 text-center col-no-pad">
1804 <form role="form" method="post">
1805 <input type="hidden" name="selector" value="redraw" />
1806 <div id="redraw1"><button type="submit" id="redraw" class="btn btn-inf"><font color="white">Refresh Values</button></div></font>
1807 </form>
1808 </div>
1809 <div class="col-md-3 text-center col-no-pad">
1810 <form role="form" method="post">
1811 <input type="hidden" name="selector" value="killProcesses" />
1812 <div id="kill1"><button type="submit" id="kill" class="btn btn-inf"><font color="white">Kill PHP Processes</button></div></font>
1813 </form>
1814 </div>
1815 <div class="col-md-3 text-center col-no-pad navbar-danger">
1816 <form role="form" method="post">
1817 <input type="hidden" name="selector" value="killself" />
1818 <div id="killself1"><button type="submit" id="killself" class="btn btn-danger"><font color="white">Remove
1819<?php echo TOOL;
1820
1821?></button></div></font>
1822 </form>
1823 </div>
1824 </div>
1825 </div>
1826 </div>
1827 </header>
1828 <div id="main-content">
1829
1830<?php if($get_started->display->msg === true){
1831?>
1832 <div class="container-fluid">
1833 <div class="row">
1834 <div class="col-xs-12">
1835 <div class="row ux-pagetitle">
1836 <div class="col-md-offset-1 col-md-5">
1837 <h3><b>DATABASE NAME:</b><font color ="#1d6ccd">
1838<?php echo DB_NAME;
1839
1840?></font></h3>
1841 <h4><b>WordPress v:</b><font color ="#1d6ccd">
1842<?php echo WP_VER;
1843
1844?></font><b> PHP v:</b><font color ="#1d6ccd">
1845<?php echo phpversion();
1846
1847?></h4></font>
1848 <h4><b>Abs. Path: </b><font color ="#1d6ccd">
1849<?php echo getcwd();
1850
1851?></h4></font>
1852 <h4><b>Web Node: </b><font color ="#1d6ccd">
1853<?php echo $GLOBALS['Web_Server'];
1854
1855?></font></h4>
1856 <h4><b>Proxy Server: </b><font color ="#1d6ccd">
1857<?php echo $GLOBALS['Proxy_Server'];
1858
1859?></font></h4>
1860 <h4><b>Cache Server: </b><font color ="#1d6ccd">
1861<?php echo $GLOBALS['Cache_Server'];
1862
1863?></font><b> Status: </b><font color ="#1d6ccd">
1864<?php echo $GLOBALS['is_cached'];
1865
1866?></font>
1867
1868<?php if($GLOBALS['WORKER'] == false){ echo '<form role="form" method="post"><input type="hidden" name="selector" value="EnableWorker" /><button type="submit" id="EnableWorker" class="btn btn-primary pull-right" style="background-color:#ef1313;
1869">Enable Worker</button></form>';
1870 }
1871?>
1872 </h4>
1873 </div>
1874 <div class="col-md-5 pull-right">
1875 <h3>WordPress
1876<?php echo TOOL;
1877
1878?> <font color ="#1d6ccd">
1879<?php echo VERSION;
1880
1881?></font></h3>
1882 <h4><b>
1883<?php echo TOOL;
1884
1885?> Archive:</b><font id="latest_tar_backup" color ="#1d6ccd">
1886<?php echo $_SESSION['tarball'];
1887
1888?></font></h4>
1889 <h4><b>
1890<?php echo TOOL;
1891
1892?> DB Backup:</b><font id="latest_sql_backup" color ="#1d6ccd">
1893<?php echo $_SESSION['sql_backup'];
1894
1895?></font></h4>
1896 <h4><b>Site Preview: </b><font color ="#1d6ccd"><a onclick="$('#preview1').toggle();
1897 $('#MainMenu').toggle();
1898 document.getElementById('preFrame').contentWindow.location.reload();
1899var iframe = document.getElementById('preFrame');
1900 iframe.setAttribute('src', '/?nocache='+d.getTime());
1901 document.getElementById('preFrame').src = document.getElementById('preFrame').src;
1902">
1903<?php echo $_SERVER['HTTP_HOST'];
1904
1905?></font></a> Status: </b><font color ="#1d6ccd">
1906<?php echo $GLOBALS['http_status'];
1907
1908?></h4></font></a>
1909 <h4><b>DB Overhead: </b>
1910 <font id="overhead" color="#1d6ccd">
1911
1912<?php echo doMaths($GLOBALS['DBOverhead']);
1913
1914?> </font> <b>Email Relays: </b><font id="relays" color ="#1d6ccd">
1915<?php echo E_RELAY;
1916
1917?></h4></font>
1918
1919 <!-- Single button -->
1920 <div class="btn-group">
1921 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
1922 MySQL <span class="caret"></span>
1923 </button>
1924 <ul class="dropdown-menu">
1925 <li>
1926 <form role="form" method="post">
1927 <input type="hidden" name="selector" value="PurgeSpam" />
1928 <div id="PurgeSpam1">
1929 <button type="submit" id="PurgeSpam" class="btn btn-block" style="background-color:#F0F0F0;
1930">
1931 Delete Spam Comments
1932 </button>
1933 </div>
1934 </form>
1935 </li>
1936 <li>
1937 <form role="form" method="post">
1938 <input type="hidden" name="selector" value="PurgeUnapproved" />
1939 <div id="PurgeUnapproved1">
1940 <button type="submit" id="PurgeUnapproved" class="btn btn-block" style="background-color:#F0F0F0;
1941">
1942 Delete Unapproved Comments
1943 </button>
1944 </div>
1945 </form>
1946 </li>
1947 <li>
1948 <form role="form" method="post">
1949 <input type="hidden" name="selector" value="RepairDB" />
1950 <div id="RepairDB1">
1951 <button type="submit" id="RepairDB" class="btn btn-block" style="background-color:#F0F0F0;
1952">
1953 Repair Tables
1954 </button>
1955 </div>
1956 </form>
1957 </li>
1958 <li>
1959 <form role="form" method="post">
1960 <input type="hidden" name="selector" value="PurgeComms" />
1961 <div id="PurgeComms1">
1962 <button type="submit" id="PurgeComms" class="btn btn-block" style="background-color:#F0F0F0;
1963">
1964 Delete ALL Comments
1965 </button>
1966 </div>
1967 </form>
1968 </li>
1969
1970 <li>
1971 <form role="form" method="post">
1972 <input type="hidden" name="selector" value="DisComms" />
1973 <div id="DisComms1">
1974 <button type="submit" id="DisComms" class="btn btn-block" style="background-color:#F0F0F0;
1975">
1976 Disable Comments
1977 </button>
1978 </div>
1979 </form>
1980 </li>
1981 <li>
1982 <form role="form" method="post">
1983 <input type="hidden" name="selector" value="OptDB" />
1984 <div id="OptDB1">
1985 <button type="submit" id="OptDB" class="btn btn-block" style="background-color:#F0F0F0;
1986">
1987 Optimize MySQL
1988 </button>
1989 </div>
1990 </form>
1991 </li>
1992
1993
1994 </div>
1995 <div class="btn-group">
1996 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
1997 PHP <span class="caret"></span>
1998 </button>
1999 <ul class="dropdown-menu">
2000 <li>
2001 <form role="form" method="post">
2002 <input type="hidden" name="selector" value="install_ionCube" />
2003 <div id="install_ionCube1">
2004 <button type="submit" id="install_ionCube" class="btn btn-block" style="background-color:#F0F0F0;
2005">
2006 Enable ionCube
2007 </button>
2008 </div>
2009 </form>
2010 </li>
2011
2012 <li>
2013 <a href="./
2014<?php echo basename($_SERVER["SCRIPT_FILENAME"])
2015?>?phpinfo=
2016<?php echo time();
2017
2018?>" target="_blank"
2019 style="background-color:#F0F0F0;
2020">
2021 <center><b>PHP Info</b></center>
2022 </a>
2023 </li>
2024 <li>
2025 <a href="./
2026<?php echo basename($_SERVER["SCRIPT_FILENAME"])
2027?>?mail=
2028<?php echo time();
2029
2030?>" target="_blank"
2031 style="background-color:#F0F0F0;
2032">
2033 <center><b>PHP Mail Test</b></center>
2034 </a>
2035 </li>
2036
2037 </ul>
2038
2039 </div>
2040 <div class="btn-group">
2041 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2042 WordPress <span class="caret"></span>
2043 </button>
2044 <ul class="dropdown-menu">
2045 <li>
2046 <form role="form" method="post">
2047 <input type="hidden" name="selector" value="regenthumbs" />
2048 <div id="regenthumbs1">
2049 <button type="submit" id="regenthumbs" class="btn btn-block" style="background-color:#F0F0F0;
2050">
2051 Regenerate Thumbnails
2052 </button>
2053 </div>
2054 </form>
2055 </li>
2056 <li>
2057 <form role="form" method="post">
2058 <input type="hidden" name="selector" value="ResetUpload" />
2059 <div id="ResetUpload1">
2060 <button type="submit" id="ResetUpload" class="btn btn-block" style="background-color:#F0F0F0;
2061">
2062 Reset Upload Path
2063 </button>
2064 </div>
2065 </form>
2066 </li>
2067 <li>
2068 <form role="form" method="post">
2069 <input type="hidden" name="selector" value="LoginReset" />
2070 <div id="LoginReset1">
2071 <button type="submit" id="LoginReset" class="btn btn-block" style="background-color:#F0F0F0;
2072">
2073 Reset Login Lockout
2074 </button>
2075 </div>
2076 </form>
2077 </li>
2078 <li>
2079 <form role="form" method="post">
2080 <input type="hidden" name="selector" value="roleReset" />
2081 <div id="roleReset1">
2082 <button type="submit" id="roleReset" class="btn btn-block" style="background-color:#F0F0F0;
2083">
2084 Reset All User Roles
2085 </button>
2086 </div>
2087 </form>
2088 </li>
2089 <li>
2090 <form role="form" method="post">
2091 <input type="hidden" name="selector" value="PluginUpdate" />
2092 <div id="PluginUpdate1">
2093 <button type="submit" id="PluginUpdate" class="btn btn-block" style="background-color:#F0F0F0;
2094">
2095 Update Plugins
2096 </button>
2097 </div>
2098 </form>
2099 </li>
2100 <li>
2101 <form role="form" method="post">
2102 <input type="hidden" name="selector" value="ThemeUpdate" />
2103 <div id="ThemeUpdate1">
2104 <button type="submit" id="ThemeUpdate" class="btn btn-block" style="background-color:#F0F0F0;
2105">
2106 Update Themes
2107 </button>
2108 </div>
2109 </form>
2110 </li>
2111 <li>
2112 <form role="form" method="post">
2113 <input type="hidden" name="selector" value="UpdateCore" />
2114 <div id="UpdateCore1">
2115 <button type="submit" id="UpdateCore" class="btn btn-block" style="background-color:#F0F0F0;
2116">
2117 Update WP-Core
2118 </button>
2119 </div>
2120 </form>
2121 </li>
2122 <li>
2123 <a href='./
2124<?php echo basename($_SERVER["SCRIPT_FILENAME"])
2125?>?integrity' target='_blank' class="btn btn-block" style="background-color:#F0F0F0;
2126">Check WP-Core</a>
2127 </li>
2128
2129<?php if($GLOBALS['ismwp'] == false){ echo '<li><a href="./'.basename($_SERVER["SCRIPT_FILENAME"]).'?core='.time().'" target="_blank" class="btn btn-block" style="background-color:#F0F0F0;
2130">Repair WP-Core</a></li>';
2131 }
2132?>
2133 </ul>
2134 </div>
2135 <!-- <div class="btn-group">
2136 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2137 Sign-In <span class="caret"></span>
2138 </button>
2139 <ul class="dropdown-menu">
2140 <li>
2141 <form role="form" method="post">
2142 <input type="hidden" name="selector" value="supportUser" />
2143 <div id="supportUser1">
2144 <button type="submit" id="supportUser" class="btn btn-block" style="background-color:#F0F0F0;
2145">Create/Update User</button>
2146 </div>
2147 </form>
2148 </li>
2149 <li>
2150 <form role="form" method="post">
2151 <input type="hidden" name="selector" value="AutoLogin" />
2152 <div id="AutoLogin1">
2153 <button type="submit" id="AutoLogin" class="btn btn-block">
2154 Sign into WordPress
2155 </button>
2156 </div>
2157 </form>
2158 </li>
2159 <li class="dropdown-header">User: wpps-support</li>
2160 <li id='supportPass' class="dropdown-header">Pass: </li>
2161 </ul>
2162 </div>
2163
2164 </div> -->
2165 </div>
2166
2167 <div id="preview1" class="preview1" align="center" style=" display:none;
2168 height:600px;
2169 width:850px;
2170 margin-left:auto;
2171 margin-right:auto;
2172 ">
2173 <iframe id="preFrame" height="100%" width="100%" src=""></iframe>
2174 </div>
2175 </div>
2176
2177 </div>
2178
2179 <div id="MainMenu" class="row">
2180 <div class="col-sm-offset-2 col-sm-8">
2181 <div class="row">
2182 <div id="primary-menu" class="carousel slide" data-ride="carousel">
2183 <!-- Wrapper for carousel panes -->
2184 <div class="carousel-inner" role="listbox">
2185 <!-- Main Menu -->
2186 <div class="item active">
2187 <div class="col-xs-12">
2188
2189 <!-- Menu items -->
2190 <div class="row">
2191
2192 <a class="jumbotron-links" data-target="#primary-menu" data-slide-to="1">
2193 <div class="col-sm-4">
2194 <div class="well">
2195 <h4 class="alert alert-heading">DATABASE THE THINGS!</h4>
2196 <div class="row">
2197 <div class="col-lg-12 text-center jumbotron">
2198 <span class="glyphicon glyphicon-transfer glyphicon-size-massive"></span>
2199 </div>
2200 </div>
2201 <div class="row">
2202 <div class="col-lg-12">
2203 <div class="alert alert-heading small">
2204 <p class="list-group-item-text hidden-xs">
2205 Import/Export Database Content
2206 </p>
2207 </div>
2208 </div>
2209 </div>
2210 </div>
2211 </div>
2212 </a>
2213
2214 <a class="jumbotron-links" data-target="#primary-menu" data-slide-to="2">
2215 <div class="col-sm-4">
2216 <div class="well">
2217 <h4 class="alert alert-heading">ARCHIVE THE THINGS!</h4>
2218 <div class="row">
2219 <div class="col-lg-12 text-center jumbotron">
2220 <span class="glyphicon glyphicon-compressed glyphicon-size-massive"></span>
2221 </div>
2222 </div>
2223 <div class="row">
2224 <div class="col-lg-12">
2225 <div class="alert alert-heading small">
2226 <p class="list-group-item-text hidden-xs">
2227 Pack / unpack a plethora of archive types!
2228 </p>
2229 </div>
2230 </div>
2231 </div>
2232 </div>
2233 </div>
2234 </a>
2235
2236 <a class="jumbotron-links" data-target="#primary-menu" data-slide-to="3">
2237 <div class="col-sm-4">
2238 <div class="well">
2239 <h4 class="alert alert-heading">UPDATE THE THINGS!</h4>
2240 <div class="row">
2241 <div class="col-lg-12 text-center jumbotron">
2242 <span class="glyphicon glyphicon-wrench glyphicon-size-massive"></span>
2243 </div>
2244 </div>
2245 <div class="row">
2246 <div class="col-lg-12">
2247 <div class="alert alert-heading small">
2248 <p class="list-group-item-text hidden-xs">
2249 Synchronize Table Prefixes and Update Site / Home URL
2250 </p>
2251 </div>
2252 </div>
2253 </div>
2254 </div>
2255 </div>
2256 </a>
2257
2258 <a class="jumbotron-links" data-target="#primary-menu" data-slide-to="4">
2259 <div class="col-sm-4">
2260 <div class="well">
2261 <h4 class="alert alert-heading">INI THE THINGS!</h4>
2262 <div class="row">
2263 <div class="col-lg-12 text-center jumbotron">
2264 <span class="glyphicon glyphicon-list-alt glyphicon-size-massive"></span>
2265 </div>
2266 </div>
2267 <div class="row">
2268 <div class="col-lg-12">
2269 <div class="alert alert-heading small">
2270 <p class="list-group-item-text hidden-xs">
2271 Create a PHP initialization file
2272 </p>
2273 </div>
2274 </div>
2275 </div>
2276 </div>
2277 </div>
2278 </a>
2279
2280 <a class="jumbotron-links" data-target="#primary-menu" data-slide-to="5">
2281 <div class="col-sm-4">
2282 <div class="well">
2283 <h4 class="alert alert-heading">TROUBLESHOOT THINGS!</h4>
2284 <div class="row">
2285 <div class="col-lg-12 text-center jumbotron">
2286 <span class="glyphicon glyphicon-screenshot glyphicon-size-massive"></span>
2287 </div>
2288 </div>
2289 <div class="row">
2290 <div class="col-lg-12">
2291 <div class="alert alert-heading small">
2292 <p class="list-group-item-text hidden-xs">
2293 Enable WordPress Debugging and Toggle Plugins/Themes
2294 </p>
2295 </div>
2296 </div>
2297 </div>
2298 </div>
2299 </div>
2300 </a>
2301 <a class="jumbotron-links" data-target="#primary-menu" data-slide-to="6">
2302 <div class="col-sm-4">
2303 <div class="well">
2304 <h4 class="alert alert-heading">SERVICE THE THINGS!</h4>
2305 <div class="row">
2306 <div class="col-lg-12 text-center jumbotron">
2307 <span class="glyphicon glyphicon-list-alt glyphicon-size-massive"></span>
2308 </div>
2309 </div>
2310 <div class="row">
2311 <div class="col-lg-12">
2312 <div class="alert alert-heading small">
2313 <p class="list-group-item-text hidden-xs">
2314 Perform one-click expert services
2315 </p>
2316 </div>
2317 </div>
2318 </div>
2319 </div>
2320 </div>
2321 </a>
2322
2323 </div>
2324 </div>
2325 </div>
2326
2327 <!-- Backup / Import MySQL Databases -->
2328 <div class="item">
2329 <div class="col-sm-12">
2330 <h2 class="alert alert-heading">
2331 <a class="btn btn-warning" data-target="#primary-menu" data-slide-to="0"><span class="glyphicon glyphicon-chevron-left"></span></a> BACKUP/RESTORE THE THINGS!
2332 </h2>
2333
2334 <div class="row">
2335 <div class="col-md-4">
2336 <div class="well">
2337
2338<?php echo $get_started->db_output;
2339
2340?>
2341 </div>
2342 </div>
2343
2344 <div class="col-md-8">
2345 <div class="well">
2346 <div class="row">
2347 <div id='dbRestore' class="col-sm-12">
2348 <h3>Restore Backup</h3>
2349
2350<?php echo $s->select_sql_backup();
2351
2352?>
2353 </div>
2354 </div>
2355 </div>
2356 </div>
2357
2358 </div>
2359 </div>
2360 </div>
2361
2362 <!-- Tarball Archive -->
2363 <div class="item">
2364 <div class="col-sm-12">
2365 <h2 class="alert alert-heading">
2366 <a class="btn btn-warning" data-target="#primary-menu" data-slide-to="0"><span class="glyphicon glyphicon-chevron-left"></span></a> PACK THE THINGS!
2367 </h2>
2368 <div class="row">
2369 <div class="col-md-5">
2370 <div class="well">
2371 <h3>Create Tarball Archive</h3><br>
2372 <p>This goes through the following steps:</p>
2373 <ol>
2374 <li>Creates a .sql.gz dump within wp-content/</li>
2375 <p>
2376 <li>Archives the MySQL backup AND wp-content/ as a .tar.gz file within wp-content/ for easy transferring</li><br>
2377 </ol>
2378 <div class="row">
2379 <div class="col-sm-12">
2380 <form id="create_archive" name="create_archive" role="form" method="post">
2381 <input type="hidden" name="selector" value="create_archive">
2382 <button type="submit" class="btn btn-default"><font color ="white">CREATE ARCHIVE</font></button>
2383 </form>
2384 </div>
2385 </div>
2386 </div>
2387 </div>
2388 <div class="col-md-7">
2389 <div class="well">
2390 <h3>Unpack Archive</h3>
2391 <div class="row">
2392 <div class="col-sm-12 text-info">
2393 <p>This will unarchive the following extensions:</p>
2394 <div class="row">
2395 <div class="col-sm-6">
2396 <ul class="list-unstyled">
2397 <li>.zip</li>
2398 <li>.tar</li>
2399 <li>.gz</li>
2400 </ul>
2401 </div>
2402 <div class="col-sm-6">
2403 <ul class="list-unstyled">
2404 <li>.tar.gz</li>
2405 <li>.bz2</li>
2406 </ul>
2407 </div>
2408 </div>
2409 </div>
2410
2411 </div>
2412
2413 <div class="row">
2414 <div class="col-sm-12">
2415
2416<?php echo $s->select_archive();
2417
2418?>
2419 </div>
2420 </div>
2421 </div>
2422 </div>
2423 </div>
2424 </div>
2425 </div>
2426
2427 <!-- Update Prefixes / Site URL -->
2428 <div class="item">
2429 <div class="col-sm-12">
2430 <h2 class="alert alert-heading">
2431 <a class="btn btn-warning" data-target="#primary-menu" data-slide-to="0"><span class="glyphicon glyphicon-chevron-left"></span></a> UPDATE THE THINGS!
2432 </h2>
2433 <form name="fix_things" class="form-horizontal" role="form" method="post">
2434 <div class="row">
2435 <div class="col-sm-6">
2436 <div class="well">
2437 <h3>Update Table Prefixes</h3>
2438 <p>
2439 This option will update the table prefixes and all of the database entries for capabilities, user_roles, etc. that are necessary
2440 for WordPress to operate normally.
2441 </p>
2442 <div class="row">
2443 <div class="col-xs-offset-2 col-xs-8 box-select">
2444
2445<?php echo $s->get_prefixes();
2446
2447?>
2448 </div>
2449 </div>
2450 </div>
2451 </div>
2452 <div class="col-sm-6">
2453 <div class="well">
2454 <h3>Update Site URL</h3>
2455 <p>This option will update the siteurl and home database values to reflect the domain being currently used
2456 in the address bar. <b>Ensure the 'New:' value is correct before updating!</b></p>
2457 <div class="row">
2458 <div class="col-xs-offset-2 col-xs-8 box-select">
2459
2460<?php echo $s->get_url();
2461
2462?>
2463 </div>
2464 </div>
2465 </div>
2466 </div>
2467
2468 <input type="hidden" name="selector" value="fix_things">
2469 </div>
2470 <div class="row">
2471 <div class="col-sm-12 text-center">
2472 <button type="submit" class="btn btn-default">
2473 <font color ="white">UPDATE
2474 <span class="small"></span></font>
2475 </button>
2476 </div>
2477 </div>
2478 </form>
2479 </div>
2480 </div>
2481
2482 <!-- Simple INI Generator -->
2483 <div class="item">
2484 <div class="col-sm-12">
2485 <h2 class="alert alert-heading">
2486 <a class="btn btn-warning" data-target="#primary-menu" data-slide-to="0"><span class="glyphicon glyphicon-chevron-left"></span></a> INI THE THINGS!
2487 </h2>
2488 </div>
2489 <form name="create-ini" class="form-horizontal" role="form" method="post">
2490 <div class="col-sm-12">
2491 <div class="well">
2492 <div class="row">
2493 <div class="col-md-4 hidden-xs">
2494 <p>
2495 This function will create a PHP initialization file using the PHP directives from the form below. When 'CREATE INI' is clicked
2496 it will create the file, kill PHP processes and self-destruct. You may need to reupload the file if this
2497 is not the only function you are using
2498<?php echo TOOL;
2499
2500?> for.
2501 </p>
2502 <table class="table table-hover">
2503 <thead>
2504 <tr>
2505 <th>Environment</th>
2506 <th>INI file</th>
2507 </tr>
2508 </thead>
2509 <tbody>
2510 <tr>
2511 <td>Shared cPanel
2512 <a href="#" data-toggle="tooltip" title="cPanel also supports php.ini">
2513 <span class="small glyphicon glyphicon-info-sign"></span>
2514 </a>
2515 </td>
2516 <td>.user.ini</td>
2517 </tr>
2518 <tr>
2519 <td>Shared Plesk</td>
2520 <td>.user.ini</td>
2521 </tr>
2522 <tr>
2523 <td>
2524 Managed WordPress
2525 <a href="#" data-toggle="tooltip" title="WPaaS also supports php.ini, but .user.ini is recommended">
2526 <span class="small glyphicon glyphicon-info-sign"></span>
2527 </a>
2528 </td>
2529 <td>.user.ini</td>
2530 </tr>
2531 <tr>
2532 <td>Other Legacy Shared</td>
2533 <td>php5.ini</td>
2534 </tr>
2535 </tbody>
2536 </table>
2537 <p class="text-info small">
2538 .user.ini files do not let customers modify ALL of the same settings as a php.ini file. The .user.ini file is only valid
2539 for PHP 5.3+ installations.
2540 </p>
2541 <!--#DMZ<p class="text-info small">
2542 See <a href='http://php.net/manual/en/configuration.file.per-user.php' target='_blank'>http://php.net/manual/en/configuration.file.per-user.php</a> for more information.
2543
2544 <a href='https://www.godaddy.com/help/what-filename-does-my-php-initialization-file-need-to-use-8913' target='_blank'>https://www.godaddy.com/help/what-filename-does-my-php-initialization-file-need-to-use-8913</a>
2545 </p>-->
2546 </div>
2547
2548 <div class="col-md-8">
2549 <div class="row">
2550 <div class="col-md-12">
2551 <div class="form-group">
2552 <label for="ini_select" class="col-md-6 control-label">INI File</label>
2553 <div class="col-md-3">
2554 <select class="form-control" name="ini_select">
2555 <option value=".user.ini">.user.ini</option>
2556 <option value="php.ini">php.ini</option>
2557 <option value="php5.ini">php5.ini</option>
2558 </select>
2559 </div>
2560 </div>
2561 <div class="form-group">
2562 <label for="php_memory_limit" class="col-md-6 control-label">
2563 Memory Limit
2564 <a href="#" data-toggle="tooltip" title="The amount of memory allocated in megabytes to a single PHP processes.">
2565 <span class="small glyphicon glyphicon-question-sign"></span>
2566 </a>
2567 </label>
2568
2569
2570<?php $ini_value = $memory_limit;
2571
2572?>
2573 <div class="col-md-3">
2574 <select class="form-control" name="php_memory_limit" selected>
2575 <option value="
2576<?php echo $ini_value;
2577
2578?>">
2579 *
2580<?php echo $ini_value;
2581
2582?> *
2583 </option>
2584 <option value="64M">64M</option>
2585
2586 <option value="128M">128M</option>
2587 <option value="256M">256M</option>
2588 <option value="512M">512M</option>
2589 <option value="1024M">1024M</option>
2590 </select>
2591 </div>
2592 </div>
2593
2594 <div class="form-group">
2595 <label for="php_max_execution_time" class="col-md-6 control-label">
2596 Max Execution Time
2597 <a href="#" data-toggle="tooltip" title="The time allowed in seconds for the entire script to execute before timing out.">
2598 <span class="small glyphicon glyphicon-question-sign"></span>
2599 </a>
2600 </label>
2601
2602
2603<?php $ini_value = $max_execution;
2604
2605?>
2606 <div class="col-md-3">
2607 <select class="form-control" name="php_max_execution_time">
2608 <option value="
2609<?php echo $ini_value;
2610
2611?>" selected>
2612 *
2613<?php echo $ini_value;
2614
2615?> *
2616 </option>
2617 <option value="30">30</option>
2618 <option value="60">60</option>
2619 <option value="90">90</option>
2620 <option value="120">120</option>
2621 <option value="300">300</option>
2622 </select>
2623 </div>
2624 </div>
2625
2626 <div class="form-group">
2627 <label for="php_max_input_time" class="col-md-6 control-label">
2628 Max Input Time
2629 <a href="#" data-toggle="tooltip" title="The time allowed in seconds for PHP to parse input variables (like GET and POST) before timing out.">
2630 <span class="small glyphicon glyphicon-question-sign"></span>
2631 </a>
2632 </label>
2633
2634
2635<?php $ini_value = ini_get('max_input_time');
2636
2637?>
2638 <div class="col-md-3">
2639 <select class="form-control" name="php_max_input_time">
2640 <option value="
2641<?php echo $ini_value;
2642
2643?>" selected>
2644 *
2645<?php echo $ini_value;
2646
2647?> *
2648 </option>
2649 <option value="60">60</option>
2650 <option value="90">90</option>
2651 <option value="120">120</option>
2652 <option value="120">150</option>
2653 <option value="300">300</option>
2654 </select>
2655 </div>
2656 </div>
2657
2658 <div class="form-group">
2659 <label for="php_post_max_size" class="col-md-6 control-label">
2660 POST Max Size
2661 <a href="#" data-toggle="tooltip" title="The largest size in megabytes a POST request can be (often related to uploads since uploads typically utilize a POST request)">
2662 <span class="small glyphicon glyphicon-question-sign"></span>
2663 </a>
2664 </label>
2665
2666
2667<?php $ini_value = ini_get('post_max_size');
2668
2669?>
2670 <div class="col-md-3">
2671 <select class="form-control" name="php_post_max_size">
2672 <option value="
2673<?php echo $ini_value;
2674
2675?>" selected>
2676 *
2677<?php echo $ini_value;
2678
2679?> *
2680 </option>
2681 <option value="65M">65M</option>
2682 <option value="75M">75M</option>
2683 <option value="85M">85M</option>
2684 <option value="100M">100M</option>
2685 </select>
2686 </div>
2687 </div>
2688
2689 <div class="form-group">
2690 <label for="php_max_input_vars" class="col-md-6 control-label">
2691 Max Input Variables
2692 <a href="#" data-toggle="tooltip" title="The total number of input variables (GET or POST) you can assign in a PHP script.">
2693 <span class="small glyphicon glyphicon-question-sign"></span>
2694 </a>
2695 </label>
2696
2697
2698<?php $ini_value = ini_get('max_input_vars');
2699
2700?>
2701 <div class="col-md-3">
2702 <select class="form-control" name="php_max_input_vars">
2703 <option value="
2704<?php echo $ini_value;
2705
2706?>" selected>
2707 *
2708<?php echo $ini_value;
2709
2710?> *
2711 </option>
2712 <option value="1000">1000</option>
2713 <option value="2500">2500</option>
2714 <option value="4000">4000</option>
2715 <option value="5000">5000</option>
2716 <option value="10000">10000</option>
2717 </select>
2718 </div>
2719 </div>
2720
2721 <div class="form-group">
2722 <label for="php_file_uploads" class="col-md-6 control-label">
2723 File Uploads
2724 <a href="#" data-toggle="tooltip" title="Disable (OFF) or Enable (ON) file uploads in PHP.">
2725 <span class="small glyphicon glyphicon-question-sign"></span>
2726 </a>
2727 </label>
2728
2729
2730<?php $ini_value = ini_get('file_uploads');
2731
2732?>
2733 <div class="col-md-3">
2734 <select class="form-control" name="php_file_uploads">
2735 <option value="
2736<?php echo $ini_value;
2737
2738?>" selected>
2739 *
2740<?php echo ($ini_value ? '1 - ON' : '0 - OFF');
2741
2742?> *
2743 </option>
2744 <option value="1">1 - ON</option>
2745 <option value="0">0 - OFF</option>
2746 </select>
2747 </div>
2748 </div>
2749
2750 <div class="form-group">
2751 <label for="php_max_file_uploads" class="col-md-6 control-label">
2752 Max File Uploads
2753 <a href="#" data-toggle="tooltip" title="Maximum number of concurrent uploads that can be performed in PHP.">
2754 <span class="small glyphicon glyphicon-question-sign"></span>
2755 </a>
2756 </label>
2757
2758
2759<?php $ini_value = ini_get('max_file_uploads');
2760
2761?>
2762 <div class="col-md-3">
2763 <select class="form-control" name="php_max_file_uploads">
2764 <option value="
2765<?php echo $ini_value;
2766
2767?>" selected>
2768 *
2769<?php echo $ini_value;
2770
2771?> *
2772 </option>
2773 <option value="20">20</option>
2774 <option value="25">25</option>
2775 <option value="30">30</option>
2776 <option value="35">35</option>
2777 </select>
2778 </div>
2779 </div>
2780
2781 <div class="form-group">
2782 <label for="php_upload_max_filesize" class="col-md-6 control-label">
2783 Max Upload Filesize
2784 <a href="#" data-toggle="tooltip" title="Maximum size in megabytes PHP will allow per uploaded file.">
2785 <span class="small glyphicon glyphicon-question-sign"></span>
2786 </a>
2787 </label>
2788
2789
2790<?php $ini_value = ini_get('upload_max_filesize');
2791
2792?>
2793 <div class="col-md-3">
2794 <select class="form-control" name="php_upload_max_filesize">
2795 <option value="
2796<?php echo $ini_value;
2797
2798?>" selected>
2799 *
2800<?php echo $ini_value;
2801
2802?> *
2803 </option>
2804 <option value="64M">64M</option>
2805 <option value="100M">100M</option>
2806 <option value="150M">150M</option>
2807 <option value="200M">200M</option>
2808 </select>
2809 </div>
2810 </div>
2811 </div>
2812 </div>
2813
2814 <div class="row">
2815 <div class="col-md-12 text-center">
2816 <p class="text-small text-muted">
2817 <strong>* value *</strong> denotes the current active setting for that variable
2818 </p>
2819 </div>
2820 </div>
2821
2822 </div>
2823 <!-- End Select options column -->
2824 </div>
2825 </div>
2826 </div>
2827
2828 <div class="col-sm-12 text-center">
2829 <button type="submit" class="btn btn-default">
2830 <font color ="white">CREATE INI
2831 <span class="small"></span></font>
2832 </button><br>
2833 </div>
2834 <input type="hidden" name="selector" value="createINI">
2835 </form>
2836 </div>
2837
2838 <!-- Troubleshoot Things! -->
2839 <div class="item">
2840 <div class="col-sm-12">
2841 <h2 class="alert alert-heading">
2842 <a class="btn btn-warning" data-target="#primary-menu" data-slide-to="0"><span class="glyphicon glyphicon-chevron-left"></span></a> Troubleshoot Things!
2843 </h2>
2844 <form name="wp_debug" class="form-horizontal" role="form" method="post">
2845 <div class="row">
2846 <div class="col-sm-6">
2847 <div class="well">
2848 <h3>Debug Things!</h3>
2849 <p>
2850 This tool will assist in enabling debugging for troubleshooting purposes. This will enable WordPress/PHP debugging. You can
2851 review at:<b> /wp-content/debug.log</b> * please note that this is the default location
2852 </p>
2853 <div class="row">
2854 <div class="col-xs-offset-2 col-xs-8 box-select">
2855
2856<?php echo $s->sel_wp_debug();
2857
2858?>
2859 </div>
2860 </div>
2861 </div>
2862 </div>
2863 <div class="col-sm-6">
2864 <div class="well">
2865 <h3>Toggle Things!</h3>
2866 <p>
2867 If you are troubleshooting what is going wrong in a plugin or theme, you have found the right place. Many people may think
2868 they need to review their server logs, but you should always start by debugging your application!
2869 <p>
2870 <center>
2871 <h4>Toggle Plugins and/or Theme on and off</h4>
2872 </center>
2873 </p>
2874 <div class="row">
2875 <div class="col-xs-offset-1 col-xs-4 box-select">
2876
2877<?php echo $s->disable_plugins();
2878
2879?>
2880 </div>
2881 <div class="row">
2882 <div class="col-xs-offset-1 col-xs-4 box-select">
2883
2884<?php echo $s->default_theme();
2885
2886?>
2887 </div>
2888 </div>
2889 </div>
2890 </div>
2891 </div>
2892
2893
2894 <input type="hidden" name="selector" value="fix_things">
2895 </div>
2896 <div class="row">
2897 <div class="col-sm-12 text-center">
2898 <button type="submit" class="btn btn-default">
2899 <font color ="white">Update</font>
2900 </button>
2901 </div>
2902 </div>
2903 </form>
2904
2905 </div>
2906 </div>
2907 <!-- #service -->
2908 <div class="item">
2909 <div class="col-sm-12">
2910 <h2 class="alert alert-heading">
2911 <a class="btn btn-warning" data-target="#primary-menu" data-slide-to="0"><span class="glyphicon glyphicon-chevron-left"></span></a> Service Things!
2912 </h2>
2913
2914 <div class="row">
2915 <div class="col-sm-6">
2916 <div class="well">
2917 <h3>Create Child Theme!</h3>
2918 <p>
2919 Choose a theme from the drop down to create a child theme of it.
2920 </p>
2921 <div class="row">
2922 <div class="col-xs-offset-2 col-xs-8">
2923 <form name="child_theme" class="form-horizontal" role="form" method="post">
2924 <input type="hidden" name="selector" value="child_theme" />
2925 <select class="form-control" name="child_theme_select">
2926
2927<?php $themes = array_filter(glob('./wp-content/themes/*'), 'is_dir');
2928 foreach ($themes as $theme) { echo "<option value='".$theme."'>".basename($theme)."</option>";
2929 }
2930?>
2931 </select>
2932 <button type="submit" class="btn btn-default">
2933 <font color ="white">Create Child Theme</font>
2934 </button>
2935 </form>
2936 </div>
2937 </div>
2938 </div>
2939 </div>
2940 </div>
2941
2942 <div class="row">
2943 <div class="col-sm-6">
2944 <div class="well">
2945 <h3>Permalinks!</h3>
2946 <form name="permalinks" class="form-horizontal" role="form" method="post">
2947 <input type="hidden" name="selector" value="permalinks" /> Permalink Structure: <select class="form-control"
2948 name="permalink_select">
2949 <option value="blank">Plain</option>
2950 <option value="/%year%/%monthnum%/%day%/%postname%/">Day and Name</option>
2951 <option value="/%year%/%monthnum%/%postname%/">Month and Name</option>
2952 <option value="/archives/%post_id%">Numeric</option>
2953 <option value="/%postname%/">Post Name</option>
2954 </select>
2955 <button type="submit" class="btn btn-default">
2956 <font color ="white">Set Permalinks</font>
2957 </button>
2958 </form>
2959 </div>
2960 </div>
2961 </div>
2962 </div>
2963 </div>
2964 </div>
2965
2966 </div>
2967 </div>
2968 <!-- End Panes -->
2969 </div>
2970 </div>
2971 <!-- End column offset wrapper -->
2972 </div>
2973 </div>
2974
2975<?php }else{ echo '<div class="row text-center">'.$get_started->display->msg.'</div>';
2976 }
2977?>
2978
2979 <!-- JS CDNs for Bootstrap and jQuery -->
2980 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
2981 <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
2982
2983 <!-- This function is to show/hide elements on the page -->
2984 <script>
2985 var d = new Date();
2986
2987 $(document).keydown(function (e) {
2988 if (e.keyCode == 80) {
2989 var srcAttr = $('#preFrame').attr('src');
2990
2991 if (!srcAttr) {
2992 var iframe = document.getElementById('preFrame');
2993
2994 iframe.setAttribute('src', '/?nocache=' + d.getTime());
2995
2996 document.getElementById('preFrame').src = document.getElementById('preFrame').src;
2997
2998 }
2999 $("#preview1").toggle();
3000
3001 $("#MainMenu").toggle();
3002
3003 }
3004 });
3005
3006 $(document).keyup(function (r) {
3007 if (r.keyCode == 80) {
3008 var srcAttr = $('#preFrame').attr('src');
3009
3010 if (!srcAttr) {
3011 $('preFrame').attr('src', $('preFrame').attr('src'));
3012
3013 }
3014 }
3015 });
3016
3017 $("#cache").click(function () {
3018 // assumes element with id='cache'
3019 $("#cache1").toggle();
3020
3021 $("#cache1").toggle();
3022
3023 });
3024
3025 $("#kill").click(function () {
3026 // assumes element with id='kill'
3027 $("#kill1").toggle();
3028
3029 $("#kill1").toggle();
3030
3031 });
3032
3033 $("#remove").click(function () {
3034 // assumes element with id='remove'
3035 $("#remove1").toggle();
3036
3037 $("#remove1").toggle();
3038
3039 });
3040
3041 $("#supportUser").click(function () {
3042 // assumes element with id='remove'
3043 $("#supportUser1").toggle();
3044
3045 $("#supportUser1").toggle();
3046
3047 });
3048 </script>
3049<script>
3050 $(function(){
3051 $('[data-toggle="tooltip"]').tooltip() // Enable tooltips
3052 $('#primary-menu').carousel({interval:0});
3053 // Set the cycle time to zero for the menu
3054 // Sets true / false to hidden values for box-select (on/off) toggles
3055 $('.box-select').on('click', function(){
3056 var input = $(this).find('input:hidden');
3057 console.log(input.val());
3058 $(this).toggleClass('active');
3059 if($(this).hasClass('active'))
3060 input.val('true');
3061 else
3062 input.val('false');
3063 });
3064 <!-- Universal AJAX submission for forms -->
3065 $("form").submit(function(e){
3066 e.preventDefault();
3067 var form = $(this),
3068 sButton = form.find(':submit');
3069
3070 if(!sButton.hasClass('btn-info')){
3071 var fContainer = sButton.closest('div[class^="col-"]')
3072 }else{
3073 var fContainer = sButton.closest('div[class="row"]');
3074
3075 }
3076 serializedData = form.serialize();
3077 if(fContainer.find('.response').length == 0){
3078 fContainer.prepend('<div class="row response"><div style="margin-bottom:-25px;
3079" class="col-sm-12"></div></div>');
3080 }
3081 // Disable all buttons
3082 $(':button').each(function(){
3083 //$(this).addClass('disabled');
3084 });
3085 var output = fContainer.find('.response').find('.col-sm-12');
3086 output.html('<div class="alert alert-info" role="alert" style="margin-bottom:-15px;
3087" >Please wait patiently while the request is processed.</div>');
3088 $.ajax({
3089 type: $(form).attr('method'),
3090 url: $(form).attr('action'),
3091 data: serializedData,
3092 success: function(response){
3093 output.html(response);
3094 // Re-enable all buttons
3095 $(':button').each(function(){
3096 //$(this).removeClass('disabled');
3097 });
3098 },
3099 error: function(x, t, m) {
3100 if(t==="timeout") {
3101 output.html('<div class="alert alert-warning" role="alert"><b>Request Timed Out!</b></div>');
3102 } else if(x.status === 500){
3103 output.html('<div class="alert alert-warning" role="alert"><p><b>Internal Server Error:</b> It\'s likely the script timed out.</p><p>If you are executing a BASH command (like restoring a database), give it time to complete. If you refresh the page and the command is still running you will be met with an alert.</div>')
3104 } else if(x.status > 200){
3105 output.html('<div class="alert alert-warning" role="alert"><p>Something went wrong that we did not account for. The HTTP Status code is: ' + x.status + '.</p><p>Please troubleshoot accordingly.</p></div>');
3106 }
3107 }
3108 });
3109 //e.preventDefault();
3110 });
3111
3112 });
3113
3114 </script>
3115 <script>
3116 window.addEventListener('beforeunload', function (event) {
3117 img = new Image();
3118 img.src = '
3119<?php echo $_SERVER["SCRIPT_NAME"]
3120?>?killself';
3121 });
3122
3123 window.addEventListener('unload', function (event) {
3124 img = new Image();
3125 img.src = '
3126<?php echo $_SERVER["SCRIPT_NAME"]
3127?>?killself';
3128 });
3129 </script>
3130 </body>
3131 </html>
3132
3133<?php }else{ $select = new selector($_POST['selector']);
3134 } } }