{
public function Invoke(http\Request $request, http\Response $response)
{
+ $response->data['title'] = T('Home');
+
+ $response->data['new_version_number'] = $this->_DoVersionCheck();
+ $response->data['current_version'] = Bugdar::$options['trackerversion'];
+
$response->context['template'] = 'admin_index';
}
-}
-
-/*
-require_once('./global.php');
-NavLinks::optionsPages();
-$navigator->set_focus('tab', 'options', null);
-$navigator->set_focus('link', 'options-pages-home', 'options-pages');
+ // Contacts Blue Static to see if Bugdar is up-to-date. Returns NULL if the
+ // current version is the latest, or a string version number of the latest
+ // version.
+ private function _DoVersionCheck()
+ {
+ global $bugsys;
-$admin->page_start(T('Home'));
+ if (defined('NO_VERSION_CHECK') && constant('NO_VERSION_CHECK'))
+ return;
-// ###################################################################
+ $check = @file_get_contents('https://www.bluestatic.org/versioncheck.php?prod=bugdar&ver=' . str_replace(' ', '-', Bugdar::$options['trackerversion']));
+ if (strpos($check, '<version-check>') !== false) {
+ if (!isset($check['version-check']['update']))
+ return NULL;
-if (!(defined('NO_VERSION_CHECK') AND constant('NO_VERSION_CHECK') == true))
-{
- $check = @file_get_contents('http://www.bluestatic.org/versioncheck.php?prod=bugdar&ver=' . str_replace(' ', '-', $bugsys->options['trackerversion']));
- if (strpos($check, '<version-check>') !== false)
- {
- $check = $bugsys->xml->parse($check);
- if (isset($check['version-check']['update']))
- {
- $admin->page_code('<div style="background-color: white; border-color: red; border-width: 2px; border-style: solid; color: red; padding: 4px"><div style="font-size: 18px; font-weight: bold">' . T('Update Avaliable') . ':</div>' . sprintf(T('Your installation of Bugdar is out-of-date. You are running version <strong>%1$s</strong> and the latest version is <strong>%2$s</strong>. You can download the update at <a href="http://www.bluestatic.org">Blue Static\'s website</a>. You are strongly encouraged to apply all updates to fix bugs and any security issues (if present).'), $bugsys->options['trackerversion'], $check['version-check']['update']['value']) . '</div>');
- }
- else if (isset($check['version-check']['up-to-date']))
- {
- $admin->page_code('<div style="background-color: white; border-color: green; border-width: 2px; border-style: solid; color: green; padding: 4px"><div style="font-size: 18px; font-weight: bold">' . T('Up-to-Date') . ':</div>' . sprintf(T('Your installation of Bugdar is up-to-date. You are running version <strong>%1$s</strong>.'), $bugsys->options['trackerversion']) . '</div>');
+ // TODO(rsesek): Switch to SimpleXML.
+ $check = $bugsys->xml->parse($check);
+ return $check['version-check']['update']['value'];
}
}
}
-// ###################################################################
+/*
$admin->table_start();
$admin->table_head(T('Welcome to the Bugdar Admin Panel'));
--- /dev/null
+{%#import 'admin_header'%}
+
+Hello World via Templates
+
+{% if ($new_version_number): %}
+<div style="background-color: white; border-color: red; border-width: 2px; border-style: solid; color: red; padding: 4px">
+ <div style="font-size: 18px; font-weight: bold">{%=T('Update Avaliable')%}:</div>
+ {%=sprintf(T('Your installation of Bugdar is out-of-date. You are running version <strong>%1$s</strong> and the latest version is <strong>%2$s</strong>. You can download the update at <a href="https://www.bluestatic.org">Blue Static\'s website</a>. You are strongly encouraged to apply all updates to fix bugs and any security issues (if present).'), $current_version, $new_version_number) | raw %}
+</div>
+{% else: %}
+<div style="background-color: white; border-color: green; border-width: 2px; border-style: solid; color: green; padding: 4px">
+ <div style="font-size: 18px; font-weight: bold">{%=T('Up-to-Date')%}:</div>
+ {%=sprintf(T('Your installation of Bugdar is up-to-date. You are running version <strong>%1$s</strong>.'), $current_version) | raw %}
+</div>
+{% endif %}
+
+{%= Bugdar::$db->ConstructHTMLDebugBlock() | raw %}
\ No newline at end of file