} } if (!$error) { @mkdir($basepath . "/cachefiles/update"); try { $archive = new PclZip($basepath . "/cachefiles/update.zip"); $archive->extract($basepath . "/cachefiles/update"); $updater->upgradeLog("Extracting package content...", true, "Success"); } catch (Exception $e) { $error = true; $updater->upgradeLog("Extracting package content...", false, "Unknown error"); } } if (!$error) { unlink($basepath . "/cachefiles/update.zip"); $new_files = $updater->parseDir($basepath . "/cachefiles/update/public_html"); if (count($new_files)) { foreach ($new_files as $full_path => $file_size) { if (substr_count($full_path, "vars.php") == 0 && (!isset($_POST['no_language']) || !$_POST['no_language'] || !substr_count($full_path, "/language/")) && (!isset($_POST['no_template']) || !$_POST['no_template'] || !substr_count($full_path, "/templates/"))) { $sub_path = str_replace($basepath . "/cachefiles/update/public_html", "", $full_path); $tmp = explode("/", $sub_path); $file_name = $tmp[count($tmp) - 1]; unset($tmp[count($tmp) - 1]); $file_path = implode("/", $tmp); if (!file_exists($basepath . $sub_path)) { $file_content = file_get_contents($full_path); $res = $updater->updateFile($ftp_conn, $root_path, $file_content, $file_path, $file_name); if ($res == 1) { $updater->upgradeLog("New file: {$sub_path}", true, "Added"); } elseif ($res == 2) { $updater->upgradeLog("New file: {$sub_path}", false, "Can't create folder");