source: branches/posledni/forum/includes/acp/acp_update.php

Last change on this file was 702, checked in by george, 15 years ago
  • Upraveno: Aktualizace fóra.
File size: 2.3 KB
Line 
1<?php
2/**
3*
4* @package acp
5* @version $Id$
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*/
14if (!defined('IN_PHPBB'))
15{
16 exit;
17}
18
19/**
20* @package acp
21*/
22class 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), true);
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 // Determine automatic update...
55 $sql = 'SELECT config_value
56 FROM ' . CONFIG_TABLE . "
57 WHERE config_name = 'version_update_from'";
58 $result = $db->sql_query($sql);
59 $version_update_from = (string) $db->sql_fetchfield('config_value');
60 $db->sql_freeresult($result);
61
62 $current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
63
64 $up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
65 $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
66
67 $template->assign_vars(array(
68 'S_UP_TO_DATE' => $up_to_date,
69 'S_UP_TO_DATE_AUTO' => $up_to_date_automatic,
70 'S_VERSION_CHECK' => true,
71 'U_ACTION' => $this->u_action,
72 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'),
73
74 'LATEST_VERSION' => $latest_version,
75 'CURRENT_VERSION' => $config['version'],
76 'AUTO_VERSION' => $version_update_from,
77
78 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link),
79 ));
80 }
81}
82
83?>
Note: See TracBrowser for help on using the repository browser.