443
by dcoles
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0 |
1 |
<?php
|
2 |
/**
|
|
3 |
*
|
|
4 |
* @package acp
|
|
5 |
* @version $Id: acp_update.php,v 1.9 2007/11/19 17:00:13 acydburn Exp $
|
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
8 |
*
|
|
9 |
*/
|
|
10 |
||
11 |
/**
|
|
12 |
* @ignore
|
|
13 |
*/
|
|
14 |
if (!defined('IN_PHPBB')) |
|
15 |
{
|
|
16 |
exit; |
|
17 |
}
|
|
18 |
||
19 |
/**
|
|
20 |
* @package acp
|
|
21 |
*/
|
|
22 |
class acp_update |
|
23 |
{
|
|
24 |
var $u_action; |
|
25 |
||
26 |
function main($id, $mode) |
|
27 |
{
|
|
28 |
global $config, $db, $user, $auth, $template, $cache; |
|
29 |
global $phpbb_root_path, $phpbb_admin_path, $phpEx; |
|
30 |
||
31 |
$user->add_lang('install'); |
|
32 |
||
33 |
$this->tpl_name = 'acp_update'; |
|
34 |
$this->page_title = 'ACP_VERSION_CHECK'; |
|
35 |
||
36 |
// Get current and latest version
|
|
37 |
$errstr = ''; |
|
38 |
$errno = 0; |
|
39 |
||
40 |
$info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); |
|
41 |
||
42 |
if ($info === false) |
|
43 |
{
|
|
44 |
trigger_error($errstr, E_USER_WARNING); |
|
45 |
}
|
|
46 |
||
47 |
$info = explode("\n", $info); |
|
48 |
$latest_version = trim($info[0]); |
|
49 |
||
50 |
$announcement_url = trim($info[1]); |
|
51 |
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); |
|
52 |
||
53 |
// Determine automatic update...
|
|
54 |
$sql = 'SELECT config_value |
|
55 |
FROM ' . CONFIG_TABLE . " |
|
56 |
WHERE config_name = 'version_update_from'"; |
|
57 |
$result = $db->sql_query($sql); |
|
58 |
$version_update_from = (string) $db->sql_fetchfield('config_value'); |
|
59 |
$db->sql_freeresult($result); |
|
60 |
||
61 |
$current_version = (!empty($version_update_from)) ? $version_update_from : $config['version']; |
|
62 |
||
63 |
$up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true; |
|
64 |
$up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true; |
|
65 |
||
66 |
$template->assign_vars(array( |
|
67 |
'S_UP_TO_DATE' => $up_to_date, |
|
68 |
'S_UP_TO_DATE_AUTO' => $up_to_date_automatic, |
|
69 |
'S_VERSION_CHECK' => true, |
|
70 |
'U_ACTION' => $this->u_action, |
|
71 |
||
72 |
'LATEST_VERSION' => $latest_version, |
|
73 |
'CURRENT_VERSION' => $config['version'], |
|
74 |
'AUTO_VERSION' => $version_update_from, |
|
75 |
||
76 |
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), |
|
77 |
));
|
|
78 |
}
|
|
79 |
}
|
|
80 |
||
81 |
?>
|