From df9f1c2f78fd5d4a0524951c97ed1c6f85be4eb4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 5 Jan 2009 22:14:28 -0800 Subject: [PATCH] Redesign index.php * index.php: Rewrote for the template system * templates/main.html: New file --- admin/index.php | 65 ++++++++++------------------- admin/templates/main.html | 88 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 42 deletions(-) create mode 100644 admin/templates/main.html diff --git a/admin/index.php b/admin/index.php index 10d1d24..2ccd9f1 100755 --- a/admin/index.php +++ b/admin/index.php @@ -21,67 +21,48 @@ require_once('./global.php'); -NavLinks::optionsPages(); -$navigator->set_focus('tab', 'options', null); -$navigator->set_focus('link', 'options-pages-home', 'options-pages'); - -$admin->page_start(T('Home')); +$template = new BSTemplate('main'); // ################################################################### +// do version check if (!(defined('NO_VERSION_CHECK') AND constant('NO_VERSION_CHECK') == true)) { + $template->vars['versionCheck'] = true; + $check = @file_get_contents('http://www.bluestatic.org/versioncheck.php?prod=bugdar&ver=' . str_replace(' ', '-', bugdar::$options['trackerversion'])); if (strpos($check, '') !== false) { - $check = $bugsys->xml->parse($check); - if (isset($check['version-check']['update'])) + $check = simplexml_load_string($check); + if ($check->update) { - $admin->page_code('
' . T('Update Avaliable') . ':
' . sprintf(T('Your installation of Bugdar is out-of-date. You are running version %1$s and the latest version is %2$s. You can download the update at Blue Static\'s website. You are strongly encouraged to apply all updates to fix bugs and any security issues (if present).'), bugdar::$options['trackerversion'], $check['version-check']['update']['value']) . '
'); + $template->vars['upToDate'] = false; + $template->vars['updateTitle'] = T('Update Avaliable'); + $template->vars['updateString'] = sprintf(T('Your installation of Bugdar is out-of-date. You are running version %1$s and the latest version is %2$s. You can download the update at Blue Static\'s website. You are strongly encouraged to apply all updates to fix bugs and any security issues (if present).'), bugdar::$options['trackerversion'], $check->update); } - else if (isset($check['version-check']['up-to-date'])) + else { - $admin->page_code('
' . T('Up-to-Date') . ':
' . sprintf(T('Your installation of Bugdar is up-to-date. You are running version %1$s.'), bugdar::$options['trackerversion']) . '
'); + $template->vars['upToDate'] = true; + $template->vars['updateTitle'] = T('Up-to-Date'); + $template->vars['updateString'] = sprintf(T('Your installation of Bugdar is up-to-date. You are running version %1$s.'), bugdar::$options['trackerversion']); } } } // ################################################################### +// some option information -$admin->table_start(); -$admin->table_head(T('Welcome to the Bugdar Admin Panel')); - -// ------------------------------------------------------------------- -$admin->row_span(T('Version Information'), 'thead'); -$admin->row_text(T('Bugdar Version'), bugdar::$options['trackerversion']); -$admin->row_text(T('PHP Version'), phpversion()); - -$mysql = $db->queryFirst("SELECT VERSION() AS version"); -$admin->row_text(T('MySQL Version'), $mysql['version']); - -$admin->row_text(T('Web Server'), ($_SERVER['SERVER_SOFTWARE'] ? $_SERVER['SERVER_SOFTWARE'] : $SERVER['SERVER_SOFTWARE'])); - -// ------------------------------------------------------------------- -$admin->row_span(T('Server Options'), 'thead'); - -$mysql = $db->queryFirst("SHOW VARIABLES LIKE 'max_allowed_packet'"); -$admin->row_text(T('MySQL: Maximum Packet Size'), $mysql['Value']); - -$admin->row_text(T('MySQL: Maximum Upload Size'), BSFunctions::fetch_max_php_file_size()); - -$mysql = $db->queryFirst("SHOW VARIABLES LIKE 'ft_min_word_len'"); -$admin->row_text(T('MySQL: Full-Text Search Minimum Word Length'), $mysql['Value']); - -$admin->row_text(T('PHP: Safe Mode'), ((ini_get('safe_mode') == 1 OR strtolower(ini_get('safe_mode')) == 'on') ? T('Yes') : T('No'))); -$admin->row_text(T('PHP: Register Globals'), ((ini_get('register_globals') == 1 OR strtolower(ini_get('register_globals')) == 'on') ? T('Yes') : T('No'))); -$admin->row_text(T('PHP: Magic Quotes GPC'), ((ini_get('magic_quotes_gpc') == 1 OR strtolower(ini_get('magic_quotes_gpc')) == 'on') ? T('Yes') : T('No'))); -$admin->row_text(T('PHP: Magic Quotes Sybase'), ((ini_get('magic_quotes_sybase') == 1 OR strtolower(ini_get('magic_quotes_sybase')) == 'on') ? T('Yes') : T('No'))); -$admin->row_text(T('PHP: Gettext Installed'), (function_exists('ngettext') ? T('Yes') : T('No'))); +$template->vars['mysqlVersion'] = $db->queryFirst("SELECT VERSION() AS version", 'fetchObject')->version; +$template->vars['webServer'] = ($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : $SERVER['SERVER_SOFTWARE']; -// ------------------------------------------------------------------- +$template->vars['mysqlPacketSize'] = $db->queryFirst("SHOW VARIABLES LIKE 'max_allowed_packet'", 'fetchObject')->Value; +$template->vars['mysqlWordLength'] = $db->queryFirst("SHOW VARIABLES LIKE 'ft_min_word_len'", 'fetchObject')->Value; -$admin->table_end(); +$template->vars['phpSafeMode'] = (ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on'); +$template->vars['phpRegGlobals'] = (ini_get('register_globals') == 1 || strtolower(ini_get('register_globals')) == 'on'); +$template->vars['phpMagicQuotesGPC'] = (ini_get('magic_quotes_gpc') == 1 || strtolower(ini_get('magic_quotes_gpc')) == 'on'); +$template->vars['phpMagicQuotesSybase'] = (ini_get('magic_quotes_sybase') == 1 || strtolower(ini_get('magic_quotes_sybase')) == 'on'); -$admin->page_end(); +$template->evaluate()->flush(); ?> \ No newline at end of file diff --git a/admin/templates/main.html b/admin/templates/main.html new file mode 100644 index 0000000..ce0416e --- /dev/null +++ b/admin/templates/main.html @@ -0,0 +1,88 @@ +<%- $templates['doctype'] %> + + + <%- $templates['headinclude'] %> + <%- $templates['title'] %> - <%- T('Home') %> + + + + +<%- $templates['nav'] %> + +
<%- T('Administration') %>
+ +
+ +<% if ($versionCheck): %> +
+

<%- $updateTitle %>

+ <%- $updateString %> +
+<% endif; %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<%- T('Welcome to the Bugdar Admin Panel') %>
<%- T('Version Information') %>
<%- T('Bugdar Version') %><%- bugdar::$options['trackerversion'] %>
<%- T('PHP Version') %><%- phpversion() %>
<%- T('MySQL Version') %><%- $mysqlVersion %>
<%- T('Web Server') %><%- $webServer %>
<%- T('Server Options') %>
<%- T('MySQL: Maximum Packet Size') %><%- $mysqlPacketSize %>
<%- T('MySQL: Maximum Upload Size') %><%- BSFunctions::fetch_max_php_file_size() %>
<%- T('MySQL: Full-Text Search Minimum Word Length') %><%- $mysqlWordLength %>
<%- T('PHP: Safe Mode') %><%- BSFunctions::bool_to_string($phpSafeMode) %>
<%- T('PHP: Register Globals') %><%- BSFunctions::bool_to_string($phpRegGlobals) %>
<%- T('PHP: Magic Quotes GPC') %><%- BSFunctions::bool_to_string($phpMagicQuotesGPC) %>
<%- T('PHP: Magic Quotes Sybase') %><%- BSFunctions::bool_to_string($phpMagicQuotesSybase) %>
<%- T('PHP: Gettext Installed') %><%- BSFunctions::bool_to_string(function_exists('ngettext')) %>
+ +
+ + + + + + \ No newline at end of file -- 2.43.5