D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
src
/
rmw
/
whm
/
remotemxwizard
/
data
/
Filename :
checkforupdate.php
back
Copy
<?php ################################################## # # # GK~root - Creating a better web # # Copyright (c) GK~root. All Rights Reserved. # # Software: Remote Mx Wizard # # Version: 1.0.3 # # Create Date: Jan 07 2015 # # Website: http://www.gk-root.com # # # ################################################## # # # This software is released under a license. # # You cannot transfer it to any other person, # # resell it or claim any code as your own. # # By using the software you agree to this terms. # # # ################################################## if (getenv('REMOTE_USER') != 'root') die('Access Denied.'); if ($_GET['upaction'] == 'checkforupdate') { // Start Version status $currentversion = trim(@file_get_contents('http://www.gk-root.com/GK-Apps/Remote-MX-Wizard/version.txt')); if (empty($currentversion)) { $printversion = "<p>Failed to check the current version. Please try to access this page later.</p>"; } else { if ($myversion == $currentversion) { $printversion = "<p><b>Your plugin version is <span class='Active'>$myversion</span></b>.</p><p><b>You are running the latest version!</b></p>"; } else { $printversion = "<p><b>Your plugin version is <span class='Active'>$myversion</span></b>.</p>".@file_get_contents('http://www.gk-root.com/GK-Apps/Remote-MX-Wizard/latestupdate?action=checkforupdate&myversion='.$myversion);; } } ?> <div class="option_box"> <div class="top-heading"> <h4>Check for updates</h4> </div> <div class="option_contents"> <div style="margin:5px"><?php print $printversion; ?></div> </div> </div> <?php } elseif ($_GET['upaction'] == 'runupdate' && !empty($cptoken)) { if (!empty($cptoken)) { if ($_POST['rmwupdate'] == 'dormwupdate') { $dFile = 'http://www.gk-root.com/GK-Apps/Remote-MX-Wizard/latestupdate?action=download&myversion='.$myversion; $sFile = '/usr/local/cpanel/whostmgr/docroot/cgi/remotemxwizard/update/latestupdate.tar'; $gobackbtn = '<br><input class="btn primary" type="button" value="GO Back" onclick="location.href=\'index.php\';" />'; $currentversion = trim(@file_get_contents('http://www.gk-root.com/GK-Apps/Remote-MX-Wizard/version.txt')); $current = @file_get_contents($dFile); if (file_put_contents($sFile, $current) == FALSE) { $outputerror1 = 'ERROR: Download the update file<br><br>'; echo $outputerror1.$gobackbtn; return; } else { $outputcomplete1 = ' * Download the v'.$currentversion.' pack file :: <b><i>complete</i></b><br><br>'; echo $outputcomplete1; } if (empty($outputcomplete1)) { $outputerror2 = 'ERROR: latestupdate.tar file is not exists<br><br>'; echo $outputerror2.$gobackbtn; return; } else { echo exec("tar -xf $sFile -C update", $output); sleep(1); if (file_exists('/usr/local/cpanel/whostmgr/docroot/cgi/remotemxwizard/update/update.sh')) { $outputcomplete2 = ' * Unpack the tar file :: <b><i>complete</i></b><br><br>'; echo $outputcomplete2; } } if (empty($outputcomplete2)) { $outputerror3 = 'ERROR: Unpack the tar file not complete<br><br>'; echo $outputerror3.$gobackbtn; return; } else { if (chmod("/usr/local/cpanel/whostmgr/docroot/cgi/remotemxwizard/update/update.sh", 0755)) { echo exec("sh /usr/local/cpanel/whostmgr/docroot/cgi/remotemxwizard/update/update.sh"); sleep(2); $mynewversion = trim(file_get_contents('version.txt')); if ($mynewversion == $currentversion) { $outputcomplete3 = " * Plugin update :: <b><i>complete</i></b><br><br>"; echo $outputcomplete3; echo 'Remote MX Wizard successfully updated to '.$mynewversion.'<br><br>'.$gobackbtn; } else { $outputerror4 = 'ERROR: Remote MX Wizard did not complete the update!'; echo $outputerror4.$gobackbtn; return; } } } } } } ?>