slug = $slug; $this->localVersion = $this->remoteVersion = -1; if (!class_exists('ZipArchive')) { $msg = "This application cannot update itself because your PHP does not have ZIP support. Please update your application using the following steps."; if (EZ::$isInWP) { $pluginLink = "Plugins Page"; $uploadLink = "Upload Page"; $workAround = "
  1. Deactivate and delete your on the $pluginLink. If you do not delete the plugin first, the next step will fail because WordPress will refuse to overwrite the existing plugin folder.
  2. Install the plugin by uploading the zip file on the $uploadLink.
  3. Activate the plugin and you are all set.
"; } else { $realPath = realpath('..'); $workAround = "
  1. Save your dbCfg.php file (in $realPath on your server).
  2. Unzip the downloaded zip file.
  3. Use FTP or other means to manually upload the contents of your zip file (to $realPath) overwriting the existing files.
  4. Restore your dbCfg.php file (in $realPath).
"; } $msg .= $workAround; echo '"; } } function __destruct() { } function Updater($slug) { if (version_compare(PHP_VERSION, "5.0.0", "<")) { $this->__construct($slug); register_shutdown_function(array($this, "__destruct")); } } function getLocalVersion() { if ($this->localVersion < 0) { $readme_file = "../readme.txt"; $readme_text = file_get_contents($readme_file); $lines = explode("\n", $readme_text); $needle = "Stable tag:"; foreach ($lines as $line) { if (strpos($line, $needle) > -1) { $this->localVersion = trim(str_replace($needle, "", $line)); break; } } } return $this->localVersion; } function getRemoteVersion() { if ($this->remoteVersion < 0) { if (empty($this->data)) { $slug = $this->slug; $this->data = unserialize(gzinflate(file_get_contents(self::CDN . "/packages/$slug.dat"))); } if (!empty($this->data)) { $this->remoteVersion = $this->data->version; } } return $this->remoteVersion; } function isOld() { $localVersion = (float) $this->getLocalVersion(); $remoteVersion = (float) $this->getRemoteVersion(); return $remoteVersion > $localVersion; } function getUpdateText() { $data = $this->data; $localVersion = $this->getLocalVersion(); $remoteVersion = $this->getRemoteVersion(); $name = $data->name; if ($this->isOld()) { $text = "You are using $name {$localVersion}. The current version is {$remoteVersion}. Click here to download the update."; } else { $text = "You are using $name {$localVersion}, which is the latest version available. Please visit this page periodically to check for updates."; } return $text; } static function zip($source, $destination) { $zip = new ZipArchive(); if (!$zip->open($destination, ZIPARCHIVE::CREATE)) { return false; } $source = str_replace('\\', '/', realpath($source)); if (is_dir($source) === true) { $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST); foreach ($files as $file) { $file = str_replace('\\', '/', $file); // Ignore "." and ".." folders if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) { continue; } $file = realpath($file); if (is_dir($file) === true) { $zip->addEmptyDir(str_replace($source . '/', '', $file . '/')); } else if (is_file($file) === true) { $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file)); } } } else if (is_file($source) === true) { $zip->addFromString(basename($source), file_get_contents($source)); } return $zip->close(); } function backup() { // TODO: Test this method and use it from admin.php $zipFile = tempnam(sys_get_temp_dir(), 'zip'); $toZip = realpath('../..'); $base = basename($toZip); if (!self::zip($toZip, $zipFile)) { echo "Failed to write files to zip\n"; } else { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $base . '.zip'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($zipFile)); @ob_clean(); // Don't let it throw any notices, which will mess up the zip file flush(); readfile($zipFile); @unlink($zipFile); } } function render() { // admin page renderer require_once 'Ftp.php'; $ftp = new Ftp(); ?>
It is easy to update your application. Once you have downloaded an update package, please use the Browse button in the Upload Your Zip File section. When you have selected the zip file to upload, the updater will take care of the rest.

" . "

If you have purchased a Pro upgrade, the process is identical. Just browse and upload the zip file." . "

In some installations, you may need to provide FTP details for the updater to work. If needed, you will be prompted for the credentials. Contact your hosting provider or system admin for details.

"); $updateBox = ''; ?>
 
getLocalVersion(); $remoteVersion = $this->getRemoteVersion(); $toolTip = $this->getUpdateText(); if ($this->isOld()) { ?>
name V$localVersion"; ?>
Update to V
name V$localVersion"; ?>
Your version is up-to-date
'Allow Update Check', 'value' => 0, 'help' => __("Enable this option to allow automatic update checks. Note that checking for updates requires your server to connect to that of the author. No data is collected from your server during update check; it is a read-only process. If you are okay with connecting to an extenral server, please enable this option to opt in.Click on the Updates button again to reload the page", 'easy-common'), 'type' => 'checkbox'); $updateBox = ''; ?>
Update Check is Disabled
Enable it
Other Plugins and Programs
From the author
Get name; ?> Pro
$price; ?>. Instant Download
Pro
Author Profile
CV from Author's blog
Contact
Enquiries and Support

Upload Your Upgrade/Update

Zip File

printForm(); closeBox(); if (EZ::$isInWP) { $dbSetup = "dbSetup.php?wp&update"; } else { $dbSetup = "dbSetup.php?update"; } ?> class ZipArchive not found.) This updater cannot proceed without it.
You might be able to add zip support via your cPanel/WHM interface. Look for Module Installers, and try installing zip via PHP Pecl installer."; http_response_code(400); die($error); } ob_start(); if (isset($_REQUEST['backup'])) { $this->backup(); exit(); } if (empty($_FILES)) { http_response_code(400); die("File upload error. No files reached the server!"); } $ds = DIRECTORY_SEPARATOR; $target = realpath("..$ds..") . $ds; require_once 'Ftp.php'; $ftp = new Ftp(); if (Ftp::isNeeded($target)) { if (!$ftp->isReady) { $error = "Cannot overwrite the $this->name files! Here are your options to proceed." . "
  1. Enter or edit the FTP credentials below, if available. Contact your server admin for details.
  2. " . "
  3. Unpack the downloaded archive, remove the file dbCfg.php, and upload the rest to your server, overwriting the existing files.
  4. " . "
  5. Make your installation updatable by using this Unix command or equivalent:
    chmod -R 777 $target
"; http_response_code(400); die($error); } } $warning = ''; $dirCount = 0; $zip = new ZipArchive; $tmpName = $_FILES['file']['tmp_name']; if ($zip->open($tmpName) !== TRUE) { $error = "Cannot open the uploaded zip file."; http_response_code(400); die($error); } // ensure that it is the right archive $stat = $zip->statIndex(0); $root = $stat['name']; $isRight = strpos($root, "$this->slug/") === 0; if (!$isRight) { http_response_code(400); $error .= "The uploaded archive does not look like an $this->name update. Root folder is $root."; die($error); } $toVerify = $this->toVerify; foreach ($toVerify as $d) { $idx = $zip->locateName($d, ZipArchive::FL_NODIR); if ($idx === false) { $idx = $zip->locateName($d); } if ($idx === false) { $error = "Cannot locate a critical file ($d) in the uploaded zip file."; http_response_code(400); die($error); } } // files to remove from the archive -- not to overwrite on the user's DB server details $toDelete = array('dbCfg.php'); foreach ($toDelete as $d) { $idx = $zip->locateName($d, ZipArchive::FL_NODIR); if ($idx === false) { $idx = $zip->locateName($d); } if ($idx === false) { $error = "Cannot locate a critical file ($d) in the uploaded zip file."; http_response_code(400); die($error); } if (!$zip->deleteIndex($idx)) { $error = "Cannot delete the empty file ($d) from the archive."; http_response_code(400); die($error); } } $zip->close(); if ($zip->open($tmpName) !== TRUE) { $error = "Cannot reopen the uploaded zip file (after removing config)."; http_response_code(400); die($error); } $zipRoot = $zip->getNameIndex(0); for ($i = 1; $i < $zip->numFiles; $i++) { $filename = $zip->getNameIndex($i); $sourceFile = "zip://$tmpName#$filename"; $targetFile = str_replace($zipRoot, $target, $filename); if (is_dir($targetFile)) { ++$dirCount; continue; } $lastChar = substr($sourceFile, -1); if ($lastChar == $ds || $lastChar == '/') { if (!$ftp->mkdir($targetFile)) { $error = "Error creating the directory $targetFile"; http_response_code(400); die($error); } continue; } $targetDir = dirname($targetFile); if (!is_dir($targetDir) && !@$ftp->mkdir($targetDir)) { $error = "Error creating the new folder $targetDir"; http_response_code(400); die($error); } if (!$ftp->copy($sourceFile, $targetFile)) { $error = "Error copying $filename to $targetFile"; http_response_code(400); die($error); } } if ($dirCount > 0) { $warning = "Ignoring $dirCount folders, which already exist on your server.
"; } $zip->close(); $success = "Congratulations, you have successfully updated $this->name."; ob_end_clean(); http_response_code(200); header('Content-Type: application/json'); echo json_encode(array('success' => $success, 'warning' => $warning)); exit(); } } }