2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2002-2013 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 namespace bugdar
\admin
;
27 require_once HOPLITE_ROOT
. '/http/action.php';
29 class HomeAction
extends http\Action
implements TemplatePreCaching
31 public function TemplateSet()
33 return array('admin_index');
36 public function Invoke(http\Request
$request, http\Response
$response)
38 // TODO(port): Migrate.
41 $response->data
['title'] = T('Home');
43 $response->data
['new_version_number'] = $this->_DoVersionCheck();
44 $response->data
['current_version'] = Bugdar
::$options['trackerversion'];
46 $response->data
['php_version'] = phpversion();
47 $response->data
['mysql_version'] = Bugdar
::$db->Query("SELECT VERSION() AS version")->FetchObject()->version
;
48 $response->data
['web_server'] = $_SERVER['SERVER_SOFTWARE'];
50 $response->data
['mysql_max_packet'] = Bugdar
::$db->Query("SHOW VARIABLES LIKE 'max_allowed_packet'")->FetchObject()->Value
;
51 $response->data
['max_upload_size'] = $funct->fetch_max_attachment_size();
52 $response->data
['mysql_ft_min_length'] = Bugdar
::$db->Query("SHOW VARIABLES LIKE 'ft_min_word_len'")->FetchObject()->Value
;
54 $response->context
['template'] = 'admin_index';
57 // Contacts Blue Static to see if Bugdar is up-to-date. Returns NULL if the
58 // current version is the latest, or a string version number of the latest
60 private function _DoVersionCheck()
64 if (defined('NO_VERSION_CHECK') && constant('NO_VERSION_CHECK'))
67 $check = @file_get_contents('https://www.bluestatic.org/versioncheck.php?prod=bugdar&ver=' . str_replace(' ', '-', Bugdar
::$options['trackerversion']));
68 if (strpos($check, '<version-check>') !== false
) {
69 if (!isset($check['version-check']['update']))
72 // TODO(rsesek): Switch to SimpleXML.
73 $check = $bugsys->xml
->parse($check);
74 return $check['version-check']['update']['value'];