浏览代码

Adminer: Fix and simplify previous auto-login feature (controlled by Default Setting).

reliberate 9 年之前
父节点
当前提交
1efb80088b
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      themes/default/template.php

+ 9 - 5
themes/default/template.php

@@ -453,13 +453,17 @@
 									echo "<ul class='dropdown-menu'>\n";
 									foreach ($menu_parent['menu_items'] as $index_sub => $menu_sub) {
 										$mod_a_2 = $menu_sub['menu_item_link'];
-										if($mod_a_2 == ''){
+										if ($mod_a_2 == '') {
 											$mod_a_2 = '#';
 										}
-										else if (($menu_sub['menu_item_category'] == 'internal') ||
-											(($menu_sub['menu_item_category'] == 'external') && substr($mod_a_2, 0,1) == "/"))
-										{
-											$mod_a_2 = PROJECT_PATH . $mod_a_2;
+										else if (($menu_sub['menu_item_category'] == 'internal') || (($menu_sub['menu_item_category'] == 'external') && substr($mod_a_2,0,1) == '/')) {
+											// accomodate adminer auto-login, if enabled
+												if (substr($mod_a_2,0,22) == '/app/adminer/index.php') {
+													global $db_type;
+													$mod_a_2 .= '?'.(($db_type == 'mysql') ? 'server' : $db_type).'&db=fusionpbx&ns=public';
+													$mod_a_2 .= ($_SESSION['adminer']['auto_login']['boolean'] == 'true') ? "&username=auto" : null;
+												}
+											$mod_a_2 = PROJECT_PATH.$mod_a_2;
 										}
 										$mod_a_3 = ($menu_sub['menu_item_category'] == 'external') ? "target='_blank' " : null;
 										if ($_SESSION['theme']['menu_sub_icons']['boolean'] != 'false') {