phpBB
Statistics
| Revision:

root / branches / phpBB-3_0_0 / phpBB / includes / acp / acp_update.php

History | View | Annotate | Download (2.5 kB)

1
<?php
2
/**
3
*
4
* @package acp
5
* @version $Id: acp_update.php 11468 2011-10-14 01:00:14Z git-gate $
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 = obtain_latest_version_info(request_var('versioncheck_force', false));
41
42
                if ($info === false)
43
                {
44
                        trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
45
                }
46
47
                $info = explode("\n", $info);
48
                $latest_version = trim($info[0]);
49
50
                $announcement_url = trim($info[1]);
51
                $announcement_url = (strpos($announcement_url, '&amp;') === false) ? str_replace('&', '&amp;', $announcement_url) : $announcement_url;
52
                $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
53
54
                // next feature release
55
                $next_feature_version = $next_feature_announcement_url = false;
56
                if (isset($info[2]) && trim($info[2]) !== '')
57
                {
58
                        $next_feature_version = trim($info[2]);
59
                        $next_feature_announcement_url = trim($info[3]);
60
                }
61
62
                // Determine automatic update...
63
                $sql = 'SELECT config_value
64
                        FROM ' . CONFIG_TABLE . "
65
                        WHERE config_name = 'version_update_from'";
66
                $result = $db->sql_query($sql);
67
                $version_update_from = (string) $db->sql_fetchfield('config_value');
68
                $db->sql_freeresult($result);
69
70
                $current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
71
72
                $template->assign_vars(array(
73
                        'S_UP_TO_DATE'                => phpbb_version_compare($latest_version, $config['version'], '<='),
74
                        'S_UP_TO_DATE_AUTO'        => phpbb_version_compare($latest_version, $current_version, '<='),
75
                        'S_VERSION_CHECK'        => true,
76
                        'U_ACTION'                        => $this->u_action,
77
                        'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'),
78
79
                        'LATEST_VERSION'        => $latest_version,
80
                        'CURRENT_VERSION'        => $config['version'],
81
                        'AUTO_VERSION'                => $version_update_from,
82
                        'NEXT_FEATURE_VERSION'        => $next_feature_version,
83
84
                        'UPDATE_INSTRUCTIONS'        => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link),
85
                        'UPGRADE_INSTRUCTIONS'        => $next_feature_version ? $user->lang('UPGRADE_INSTRUCTIONS', $next_feature_version, $next_feature_announcement_url) : false,
86
                ));
87
        }
88
}
89
90
?>