2010-01-26 08:59:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the Froxlor project.
|
|
|
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the COPYING
|
|
|
|
* file that was distributed with this source code. You can also view the
|
|
|
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
*
|
|
|
|
* @copyright (c) the authors
|
|
|
|
* @author Froxlor team <team@froxlor.org> (2010-)
|
|
|
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
* @package Panel
|
2011-05-04 09:59:20 +00:00
|
|
|
*
|
2010-01-26 08:59:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
define('AREA', 'admin');
|
|
|
|
require ("./lib/init.php");
|
|
|
|
|
|
|
|
if($page == 'overview')
|
|
|
|
{
|
|
|
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
2010-02-23 13:24:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* this is a dirty hack but syscp 1.4.2.1 does not
|
|
|
|
* has any version/dbversion in the database (don't know why)
|
|
|
|
* so we have to set them both to run a correct upgrade
|
|
|
|
*/
|
2010-02-23 13:33:51 +00:00
|
|
|
if (!isFroxlor()) {
|
|
|
|
if (!isset($settings['panel']['version'])
|
|
|
|
|| $settings['panel']['version'] == ''
|
|
|
|
) {
|
|
|
|
$settings['panel']['version'] = '1.4.2.1';
|
|
|
|
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('panel','version','".$settings['panel']['version']."')");
|
|
|
|
}
|
|
|
|
if (!isset($settings['system']['dbversion'])
|
|
|
|
|| $settings['system']['dbversion'] == ''
|
|
|
|
) {
|
2010-03-10 07:30:53 +00:00
|
|
|
/**
|
|
|
|
* for syscp-stable (1.4.2.1) this value has to be 0
|
|
|
|
* so the required table-fields are added correctly
|
|
|
|
* and the svn-version has its value in the database
|
|
|
|
* -> bug #54
|
|
|
|
*/
|
|
|
|
|
|
|
|
$result = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
|
|
|
|
|
|
|
|
if(isset($result['value']))
|
|
|
|
{
|
|
|
|
$settings['system']['dbversion'] = (int)$result['value'];
|
|
|
|
} else {
|
|
|
|
$settings['system']['dbversion'] = 0;
|
|
|
|
}
|
2010-02-23 13:33:51 +00:00
|
|
|
}
|
2010-02-23 13:24:56 +00:00
|
|
|
}
|
|
|
|
|
2010-01-26 08:59:19 +00:00
|
|
|
if(hasUpdates($version))
|
|
|
|
{
|
2010-04-14 06:42:14 +00:00
|
|
|
$successful_update = false;
|
|
|
|
$message = '';
|
|
|
|
|
2010-01-26 08:59:19 +00:00
|
|
|
if(isset($_POST['send'])
|
|
|
|
&& $_POST['send'] == 'send')
|
|
|
|
{
|
2010-04-14 06:42:14 +00:00
|
|
|
if((isset($_POST['update_preconfig'])
|
|
|
|
&& isset($_POST['update_changesagreed'])
|
|
|
|
&& intval($_POST['update_changesagreed']) != 0)
|
|
|
|
|| !isset($_POST['update_preconfig'])
|
|
|
|
) {
|
|
|
|
eval("echo \"" . getTemplate("update/update_start") . "\";");
|
|
|
|
|
|
|
|
include_once './install/updatesql.php';
|
|
|
|
|
2010-04-21 07:02:25 +00:00
|
|
|
$redirect_url = 'admin_index.php?s=' . $s;
|
2010-04-14 06:42:14 +00:00
|
|
|
eval("echo \"" . getTemplate("update/update_end") . "\";");
|
|
|
|
|
|
|
|
updateCounters();
|
2010-10-23 10:20:23 +00:00
|
|
|
inserttask('1');
|
2010-04-14 06:42:14 +00:00
|
|
|
@chmod('./lib/userdata.inc.php', 0440);
|
|
|
|
|
|
|
|
$successful_update = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message = '<br /><strong style="color:#ff0000;">You have to agree that you have read the update notifications.</strong>';
|
|
|
|
}
|
2010-01-26 08:59:19 +00:00
|
|
|
}
|
2010-04-14 06:42:14 +00:00
|
|
|
|
|
|
|
if(!$successful_update)
|
2010-01-26 08:59:19 +00:00
|
|
|
{
|
|
|
|
$current_version = $settings['panel']['version'];
|
|
|
|
$new_version = $version;
|
2010-02-23 13:24:56 +00:00
|
|
|
|
2010-04-14 06:42:14 +00:00
|
|
|
$ui_text = $lng['update']['update_information']['part_a'];
|
2010-01-26 08:59:19 +00:00
|
|
|
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
|
|
|
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
|
|
|
$update_information = $ui_text;
|
2010-04-14 06:42:14 +00:00
|
|
|
|
|
|
|
include_once './install/updates/preconfig.php';
|
2010-04-14 07:36:38 +00:00
|
|
|
$preconfig = getPreConfig($current_version);
|
2010-04-14 06:42:14 +00:00
|
|
|
if($preconfig != '')
|
|
|
|
{
|
|
|
|
$update_information .= '<br />'.$preconfig.$message;
|
|
|
|
}
|
|
|
|
|
|
|
|
$update_information .= $lng['update']['update_information']['part_b'];
|
2010-02-23 13:24:56 +00:00
|
|
|
|
2010-01-26 08:59:19 +00:00
|
|
|
eval("echo \"" . getTemplate("update/index") . "\";");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
2010-02-23 13:24:56 +00:00
|
|
|
* @TODO version-webcheck check here
|
2010-01-26 08:59:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
$success_message = $lng['update']['noupdatesavail'];
|
2010-04-29 06:50:35 +00:00
|
|
|
$redirect_url = 'admin_index.php?s=' . $s;
|
2010-01-26 08:59:19 +00:00
|
|
|
eval("echo \"" . getTemplate("update/noupdatesavail") . "\";");
|
|
|
|
}
|
|
|
|
}
|
2010-02-23 13:24:56 +00:00
|
|
|
|
2010-01-26 08:59:19 +00:00
|
|
|
?>
|