";
if ($_REQUEST['status'] == 1) {
$client->body .= "
Try CMS version $xml->Version
". $Language->update->auth. "
". $Language->update->comment. "
";
$javascript = "
function gosubmit() {
with(document.setupform) {
if (key.value=='' || !Consent.checked) {
alert('". $Language->update->authalert. "');
key.focus();
return;
}
submit();
}
}";
} elseif ($_REQUEST['status'] == 2) {
$client->body .= "
". $Language->update->listtitle. "
*". $Language->update->important. "
";
$url = "http://update.trycms.net/utf/update.php?key=". $_REQUEST['key']. "&Host=". $_SERVER['SERVER_NAME']. "&IP=". $_SERVER['SERVER_ADDR'];
$files = file_get_contents($url);
$Files = split("\n", $files);
clearstatcache();
foreach ($Files as $line) {
if ($line) {
list($path, $file, $flag, $date, $dummy) = split("\t", $line);
if (is_file($path)) {
$mtime = filemtime($path);
$t = date("YmdHis", filemtime($path));
} else {
$mtime = 0;
}
if ($mtime < $date) {
$updateflag = 1;
$icon = "";
$flag && $icon = " *";
$client->body .= "
- $file$icon
";
}
}
}
$client->body .= "
";
if ($updateflag) {
$javascript .= "
function gosubmit() {
if (confirm('". $Language->update->confirm. "')) {
document.setupform.submit();
}
}";
} else {
$client->body .= "
". $Language->update->nofiletitle. "
". $Language->update->nofilemsg;
$javascript .= "
function gosubmit() {
$('#client').fadeOut('slow');
parent.location.href='./';
}";
}
} elseif ($_REQUEST['status'] == 3) {
$cnt = count($_REQUEST['files']);
$Files = $_REQUEST['files'];
$client->body .= "
". $Language->update->comptitle. "
". $Language->update->compmsg. "
";
foreach ($Files as $line) {
if ($src = file_get_contents("http://update.trycms.net/utf/inst.php?key=". $_REQUEST['key']. "&path=$line")) {
if (preg_match("/default\.php/", $line)) {
$src = str_replace("\r", "", $src);
$src = str_replace("\n", "
", $src);
$src = preg_replace("/(\troot[ ]+=> \")([\w\.\-]+)?(\",)/", "$1". $System['root']. "$3", $src);
$src = str_replace("
", "\n", $src);
}
$paths = split("\/", $line);
$cnt = count($paths) - 1;
if ($cnt) {
$path = "";
for($i = 0; $i < $cnt; $i++) {
$path && $path .= "/";
$path = $paths[$i];
!is_dir($path) && mkdir($path);
}
}
file_put_contents($line, $src);
$client->body .= "
- $line
";
}
}
$client->body .= "
";
$javascript = "
function gosubmit() {
document.setupform.status.value=1;
document.setupform.exec.value=1;
document.setupform.submit();
}";
logregist($Language->update->logmsg);
}
$client->body .= "