예제 #1
0
     }
 }
 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");
                     } else {
                         $updater->upgradeLog("New file: {$sub_path}", false, "Unexpected error");
                     }
                 } else {
                     $new_md5 = md5(file_get_contents($full_path));
                     $old_md5 = md5(file_get_contents($basepath . $sub_path));
                     if ($new_md5 != $old_md5) {
                         $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("File changed: {$sub_path}", true, "Added");