Commit:    46e4e0ae2183823c203ed7058c2e61d4403d7ca7
Author:    Kalle Sommer Nielsen <[email protected]>         Sat, 19 Nov 2016 
12:05:34 +0100
Parents:   aa123e45a789159e8092586f8050009f9231221d
Branches:  master

Link:       
http://git.php.net/?p=web/bugs.git;a=commitdiff;h=46e4e0ae2183823c203ed7058c2e61d4403d7ca7

Log:
Added an inline content menu for /admin/ so it is easier to navigate

Changed paths:
  M  include/functions.php
  M  www/admin/index.php


Diff:
diff --git a/include/functions.php b/include/functions.php
index de52fa9..64f26a7 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1907,3 +1907,32 @@ function bugs_get_hash($passwd)
 {
        return hash_hmac('sha256', $passwd, getenv('USER_PWD_SALT'));
 }
+
+
+/**
+ * Inline content menu
+ *
+ * . The base_url is a prefix for the location, currently does not support 
_SERVER['QUERY_STRING']
+ * . The current_action is used to indicate which page is currently being 
displayed
+ * . Menu items are in (action_name => Title) array pairs
+ */
+function inline_content_menu($base_url, $current_action, array $menu)
+{
+       if (!$menu) {
+               return;
+       }
+
+       $buffer = '';
+
+       foreach ($menu as $action => $title) {
+               if ($current_action === $action) {
+                       $buffer .= sprintf('<strong>%s</strong> | ', $title);
+               } else {
+                       $buffer .= sprintf('<a href="%s?action=%s">%s</a> | ', 
$base_url, $action, $title);
+               }
+       }
+
+       echo "<p>";
+       echo rtrim($buffer, ' | ');
+       echo "</p>\n";
+}
diff --git a/www/admin/index.php b/www/admin/index.php
index 24972d3..b689fa0 100644
--- a/www/admin/index.php
+++ b/www/admin/index.php
@@ -22,6 +22,12 @@ if ($action === 'phpinfo') {
 
 response_header("Bugs admin suite");
 
+inline_content_menu('/admin/', $action, array(
+                                               'phpinfo'               => 
'phpinfo()', 
+                                               'list_lists'            => 
'Package mailing lists', 
+                                               'list_responses'        => 
'Quick fix responses'
+                                               ));
+
 if ($action === 'list_lists') {
 
        $res = $dbh->query("


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to