1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/includes/acp/acp_update.php Wed Mar 07 16:41:10 2012 +0400
1.3 @@ -0,0 +1,90 @@
1.4 +<?php
1.5 +/**
1.6 +*
1.7 +* @package acp
1.8 +* @version $Id$
1.9 +* @copyright (c) 2005 phpBB Group
1.10 +* @license http://opensource.org/licenses/gpl-license.php GNU Public License
1.11 +*
1.12 +*/
1.13 +
1.14 +/**
1.15 +* @ignore
1.16 +*/
1.17 +if (!defined('IN_PHPBB'))
1.18 +{
1.19 + exit;
1.20 +}
1.21 +
1.22 +/**
1.23 +* @package acp
1.24 +*/
1.25 +class acp_update
1.26 +{
1.27 + var $u_action;
1.28 +
1.29 + function main($id, $mode)
1.30 + {
1.31 + global $config, $db, $user, $auth, $template, $cache;
1.32 + global $phpbb_root_path, $phpbb_admin_path, $phpEx;
1.33 +
1.34 + $user->add_lang('install');
1.35 +
1.36 + $this->tpl_name = 'acp_update';
1.37 + $this->page_title = 'ACP_VERSION_CHECK';
1.38 +
1.39 + // Get current and latest version
1.40 + $errstr = '';
1.41 + $errno = 0;
1.42 +
1.43 + $info = obtain_latest_version_info(request_var('versioncheck_force', false));
1.44 +
1.45 + if ($info === false)
1.46 + {
1.47 + trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
1.48 + }
1.49 +
1.50 + $info = explode("\n", $info);
1.51 + $latest_version = trim($info[0]);
1.52 +
1.53 + $announcement_url = trim($info[1]);
1.54 + $announcement_url = (strpos($announcement_url, '&') === false) ? str_replace('&', '&', $announcement_url) : $announcement_url;
1.55 + $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
1.56 +
1.57 + // next feature release
1.58 + $next_feature_version = $next_feature_announcement_url = false;
1.59 + if (isset($info[2]) && trim($info[2]) !== '')
1.60 + {
1.61 + $next_feature_version = trim($info[2]);
1.62 + $next_feature_announcement_url = trim($info[3]);
1.63 + }
1.64 +
1.65 + // Determine automatic update...
1.66 + $sql = 'SELECT config_value
1.67 + FROM ' . CONFIG_TABLE . "
1.68 + WHERE config_name = 'version_update_from'";
1.69 + $result = $db->sql_query($sql);
1.70 + $version_update_from = (string) $db->sql_fetchfield('config_value');
1.71 + $db->sql_freeresult($result);
1.72 +
1.73 + $current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
1.74 +
1.75 + $template->assign_vars(array(
1.76 + 'S_UP_TO_DATE' => phpbb_version_compare($latest_version, $config['version'], '<='),
1.77 + 'S_UP_TO_DATE_AUTO' => phpbb_version_compare($latest_version, $current_version, '<='),
1.78 + 'S_VERSION_CHECK' => true,
1.79 + 'U_ACTION' => $this->u_action,
1.80 + 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'),
1.81 +
1.82 + 'LATEST_VERSION' => $latest_version,
1.83 + 'CURRENT_VERSION' => $config['version'],
1.84 + 'AUTO_VERSION' => $version_update_from,
1.85 + 'NEXT_FEATURE_VERSION' => $next_feature_version,
1.86 +
1.87 + 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link),
1.88 + 'UPGRADE_INSTRUCTIONS' => $next_feature_version ? $user->lang('UPGRADE_INSTRUCTIONS', $next_feature_version, $next_feature_announcement_url) : false,
1.89 + ));
1.90 + }
1.91 +}
1.92 +
1.93 +?>
1.94 \ No newline at end of file