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');
|
2013-11-18 11:53:33 +00:00
|
|
|
require './lib/init.php';
|
2010-01-26 08:59:19 +00:00
|
|
|
|
2013-04-27 07:18:35 +00:00
|
|
|
if ($page == 'overview') {
|
2010-01-26 08:59:19 +00:00
|
|
|
$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
|
2013-11-02 09:19:19 +00:00
|
|
|
* have any version/dbversion in the database (don't know why)
|
2010-02-23 13:24:56 +00:00
|
|
|
* so we have to set them both to run a correct upgrade
|
|
|
|
*/
|
2010-02-23 13:33:51 +00:00
|
|
|
if (!isFroxlor()) {
|
2013-12-15 10:47:23 +00:00
|
|
|
if (Settings::Get('panel.version') == null
|
|
|
|
|| Settings::Get('panel.version') == ''
|
2010-02-23 13:33:51 +00:00
|
|
|
) {
|
2013-12-15 10:47:23 +00:00
|
|
|
Settings::Set('panel.version', '1.4.2.1');
|
2010-02-23 13:33:51 +00:00
|
|
|
}
|
2013-12-15 10:47:23 +00:00
|
|
|
if (Settings::Get('system.dbversion') == null
|
|
|
|
|| Settings::Get('system.dbversion') == ''
|
2010-02-23 13:33:51 +00:00
|
|
|
) {
|
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
|
|
|
|
*/
|
2013-11-02 09:19:19 +00:00
|
|
|
$result_stmt = Database::query("
|
|
|
|
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'"
|
|
|
|
);
|
|
|
|
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
2013-04-27 07:18:35 +00:00
|
|
|
|
|
|
|
if (isset($result['value'])) {
|
2013-12-15 10:47:23 +00:00
|
|
|
Settings::Set('system.dbversion', (int)$result['value'], false);
|
2010-03-10 07:30:53 +00:00
|
|
|
} else {
|
2013-12-15 10:47:23 +00:00
|
|
|
Settings::Set('system.dbversion', 0, false);
|
2010-03-10 07:30:53 +00:00
|
|
|
}
|
2010-02-23 13:33:51 +00:00
|
|
|
}
|
2010-02-23 13:24:56 +00:00
|
|
|
}
|
|
|
|
|
2013-04-27 07:18:35 +00:00
|
|
|
if (hasUpdates($version)) {
|
2010-04-14 06:42:14 +00:00
|
|
|
$successful_update = false;
|
|
|
|
$message = '';
|
|
|
|
|
2013-04-27 07:18:35 +00:00
|
|
|
if (isset($_POST['send'])
|
|
|
|
&& $_POST['send'] == 'send'
|
|
|
|
) {
|
|
|
|
if ((isset($_POST['update_preconfig'])
|
2010-04-14 06:42:14 +00:00
|
|
|
&& isset($_POST['update_changesagreed'])
|
|
|
|
&& intval($_POST['update_changesagreed']) != 0)
|
|
|
|
|| !isset($_POST['update_preconfig'])
|
|
|
|
) {
|
2013-04-27 07:18:35 +00:00
|
|
|
eval("echo \"" . getTemplate('update/update_start') . "\";");
|
2010-04-14 06:42:14 +00:00
|
|
|
|
|
|
|
include_once './install/updatesql.php';
|
|
|
|
|
2010-04-21 07:02:25 +00:00
|
|
|
$redirect_url = 'admin_index.php?s=' . $s;
|
2013-04-27 07:18:35 +00:00
|
|
|
eval("echo \"" . getTemplate('update/update_end') . "\";");
|
2010-04-14 06:42:14 +00:00
|
|
|
|
|
|
|
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;
|
2013-04-27 07:18:35 +00:00
|
|
|
} else {
|
2014-12-29 19:48:56 +00:00
|
|
|
$message = '<br /><strong class="red">You have to agree that you have read the update notifications.</strong>';
|
2010-04-14 06:42:14 +00:00
|
|
|
}
|
2010-01-26 08:59:19 +00:00
|
|
|
}
|
2010-04-14 06:42:14 +00:00
|
|
|
|
2013-04-27 07:18:35 +00:00
|
|
|
if (!$successful_update) {
|
2013-12-15 10:47:23 +00:00
|
|
|
$current_version = Settings::Get('panel.version');
|
2010-01-26 08:59:19 +00:00
|
|
|
$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;
|
2013-04-27 07:18:35 +00:00
|
|
|
|
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);
|
2013-04-27 07:18:35 +00:00
|
|
|
if ($preconfig != '') {
|
|
|
|
$update_information .= '<br />' . $preconfig . $message;
|
2010-04-14 06:42:14 +00:00
|
|
|
}
|
2013-04-27 07:18:35 +00:00
|
|
|
|
2010-04-14 06:42:14 +00:00
|
|
|
$update_information .= $lng['update']['update_information']['part_b'];
|
2010-02-23 13:24:56 +00:00
|
|
|
|
2013-04-27 07:18:35 +00:00
|
|
|
eval("echo \"" . getTemplate('update/index') . "\";");
|
2010-01-26 08:59:19 +00:00
|
|
|
}
|
2013-04-27 07:18:35 +00:00
|
|
|
} else {
|
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;
|
2013-04-27 07:18:35 +00:00
|
|
|
eval("echo \"" . getTemplate('update/noupdatesavail') . "\";");
|
2010-01-26 08:59:19 +00:00
|
|
|
}
|
|
|
|
}
|