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);
}
if (isset($_REQUEST['backup'])) {
require_once '../Updater.php';
$updater = new Updater('google-adsense');
$updater->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;
$ftp = new Ftp();
if (Ftp::isNeeded($target)) {
if (!$ftp->isReady) {
$error = "Cannot overwrite the plugin files! Here are your options to proceed."
. "
Upload Pluginchmod -R 777 $target$d) in the uploaded zip file.";
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.