diff --git a/html/do.php b/html/do.php index ff85bca97..d696cd44b 100644 --- a/html/do.php +++ b/html/do.php @@ -32,6 +32,14 @@ require_once 'function_javascript.php'; html_page_start(); global $g_user, $cn; +// if gDossier is not set redirect to form to choose a folder +if ( ! isset($_REQUEST['gDossier'])) +{ + redirect('user_login.php'); + exit(); +} + + $cn = new Database(Dossier::id()); $g_user = new User($cn); diff --git a/include/ac_common.php b/include/ac_common.php index a60d65dc7..e489801ac 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -760,13 +760,21 @@ function show_menu($module,$idx) me_menu,me_code from v_all_menu where - me_code_dep=$1 order by p_order",array($module[$idx])); + me_code_dep=$1 and user_name=$2 order by p_order",array($module[$idx],$g_user->login)); - if (! empty ($amenu)) + if (! empty ($amenu) && count($amenu)>1) { require 'template/menu.php'; } - else + elseif (count($amenu)==1) + { + echo '
'; + echo h2info($amenu[0]['me_menu']); + echo '
'; + $module[$idx]=$amenu[0]['me_code']; + } + + if (empty($amenu) || count($amenu)==1) { /** * @todo add security @@ -784,6 +792,7 @@ function show_menu($module,$idx) echo '
'; require_once "$file"; echo '
'; + exit(); } } } diff --git a/include/template/menu.php b/include/template/menu.php index 60e11b4aa..93810bfe4 100644 --- a/include/template/menu.php +++ b/include/template/menu.php @@ -14,7 +14,7 @@ global $g_user; // Display the menu for($i=0;$i < count($amenu);$i++): - if ( isset($module[$idx+1]) && $module[$idx+1]==$amenu[$i]['me_code']): + if ( (count($amenu)==1)|| (isset($module[$idx+1]) && $module[$idx+1]==$amenu[$i]['me_code'])): $class="selectedcell"; ?>