2006-09-02 13:39:21 +00:00
|
|
|
<?php
|
2007-06-09 11:11:20 +00:00
|
|
|
/**
|
2006-09-02 13:39:21 +00:00
|
|
|
*
|
|
|
|
* @package acp
|
|
|
|
* @version $Id$
|
2007-06-09 11:11:20 +00:00
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
2006-09-02 13:39:21 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-10-04 12:03:05 +00:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2006-09-02 13:39:21 +00:00
|
|
|
/**
|
|
|
|
* @package acp
|
|
|
|
*/
|
|
|
|
class acp_update
|
|
|
|
{
|
|
|
|
var $u_action;
|
|
|
|
|
|
|
|
function main($id, $mode)
|
|
|
|
{
|
|
|
|
global $config, $db, $user, $auth, $template, $cache;
|
|
|
|
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
|
|
|
|
|
$user->add_lang('install');
|
|
|
|
|
|
|
|
$this->tpl_name = 'acp_update';
|
2006-12-02 13:19:40 +00:00
|
|
|
$this->page_title = 'ACP_VERSION_CHECK';
|
2006-09-02 13:39:21 +00:00
|
|
|
|
|
|
|
// Get current and latest version
|
|
|
|
$errstr = '';
|
|
|
|
$errno = 0;
|
|
|
|
|
2009-07-28 13:58:01 +00:00
|
|
|
$info = obtain_latest_version_info(request_var('versioncheck_force', false), true);
|
2006-09-02 13:39:21 +00:00
|
|
|
|
|
|
|
$info = explode("\n", $info);
|
|
|
|
$latest_version = trim($info[0]);
|
|
|
|
|
|
|
|
$announcement_url = trim($info[1]);
|
|
|
|
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
|
|
|
|
|
2007-06-30 15:04:49 +00:00
|
|
|
// Determine automatic update...
|
|
|
|
$sql = 'SELECT config_value
|
|
|
|
FROM ' . CONFIG_TABLE . "
|
|
|
|
WHERE config_name = 'version_update_from'";
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
$version_update_from = (string) $db->sql_fetchfield('config_value');
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
|
|
|
$current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
|
|
|
|
|
|
|
|
$up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
|
2007-05-17 16:33:52 +00:00
|
|
|
$up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
|
2006-09-02 13:39:21 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
|
|
|
'S_UP_TO_DATE' => $up_to_date,
|
2007-06-30 15:04:49 +00:00
|
|
|
'S_UP_TO_DATE_AUTO' => $up_to_date_automatic,
|
2006-09-02 13:39:21 +00:00
|
|
|
'S_VERSION_CHECK' => true,
|
|
|
|
'U_ACTION' => $this->u_action,
|
2009-07-28 13:58:01 +00:00
|
|
|
'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'),
|
2006-09-02 13:39:21 +00:00
|
|
|
|
|
|
|
'LATEST_VERSION' => $latest_version,
|
|
|
|
'CURRENT_VERSION' => $config['version'],
|
2007-06-30 15:04:49 +00:00
|
|
|
'AUTO_VERSION' => $version_update_from,
|
2006-09-02 13:39:21 +00:00
|
|
|
|
2006-12-10 14:33:21 +00:00
|
|
|
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link),
|
2006-09-02 13:39:21 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|