|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
*
|
|
|
ef5584 |
* @package acp
|
|
|
ef5584 |
* @version $Id: acp_update.php 8479 2008-03-29 00:22:48Z naderman $
|
|
|
ef5584 |
* @copyright (c) 2005 phpBB Group
|
|
|
ef5584 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
ef5584 |
*
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @ignore
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
if (!defined('IN_PHPBB'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
exit;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @package acp
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
class acp_update
|
|
|
ef5584 |
{
|
|
|
ef5584 |
var $u_action;
|
|
|
ef5584 |
|
|
|
ef5584 |
function main($id, $mode)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
global $config, $db, $user, $auth, $template, $cache;
|
|
|
ef5584 |
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
ef5584 |
|
|
|
ef5584 |
$user->add_lang('install');
|
|
|
ef5584 |
|
|
|
ef5584 |
$this->tpl_name = 'acp_update';
|
|
|
ef5584 |
$this->page_title = 'ACP_VERSION_CHECK';
|
|
|
ef5584 |
|
|
|
ef5584 |
// Get current and latest version
|
|
|
ef5584 |
$errstr = '';
|
|
|
ef5584 |
$errno = 0;
|
|
|
ef5584 |
|
|
|
ef5584 |
$info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($info === false)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
trigger_error($errstr, E_USER_WARNING);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$info = explode("\n", $info);
|
|
|
ef5584 |
$latest_version = trim($info[0]);
|
|
|
ef5584 |
|
|
|
ef5584 |
$announcement_url = trim($info[1]);
|
|
|
ef5584 |
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
|
|
|
ef5584 |
|
|
|
ef5584 |
// Determine automatic update...
|
|
|
ef5584 |
$sql = 'SELECT config_value
|
|
|
ef5584 |
FROM ' . CONFIG_TABLE . "
|
|
|
ef5584 |
WHERE config_name = 'version_update_from'";
|
|
|
ef5584 |
$result = $db->sql_query($sql);
|
|
|
ef5584 |
$version_update_from = (string) $db->sql_fetchfield('config_value');
|
|
|
ef5584 |
$db->sql_freeresult($result);
|
|
|
ef5584 |
|
|
|
ef5584 |
$current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
|
|
|
ef5584 |
|
|
|
ef5584 |
$up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
|
|
|
ef5584 |
$up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'S_UP_TO_DATE' => $up_to_date,
|
|
|
ef5584 |
'S_UP_TO_DATE_AUTO' => $up_to_date_automatic,
|
|
|
ef5584 |
'S_VERSION_CHECK' => true,
|
|
|
ef5584 |
'U_ACTION' => $this->u_action,
|
|
|
ef5584 |
|
|
|
ef5584 |
'LATEST_VERSION' => $latest_version,
|
|
|
ef5584 |
'CURRENT_VERSION' => $config['version'],
|
|
|
ef5584 |
'AUTO_VERSION' => $version_update_from,
|
|
|
ef5584 |
|
|
|
ef5584 |
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link),
|
|
|
ef5584 |
));
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
?>
|