" . sql_error());} else {$msg=$vocab["add_user_succeed"];} } } } else { // Domaine // On vérifie que le domaine $area existe $test = sql_query1("select id from grr_area where id='".$area."'"); if ($test == -1) { showAccessDenied($day, $month, $year, $area,$back); exit(); } // Le domaine existe : on vérifie les privilèges de l'utilisateur if(authGetUserLevel(getUserName(),$area,'area') < 4) { showAccessDenied($day, $month, $year, $area,$back); exit(); } $sql = "select id from grr_room where area_id=$area"; $res = sql_query($sql); if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) { $sql2 = "select login from grr_j_user_room where (login = '$reg_admin_login' and id_room = '$row[0]')"; $res2 = sql_query($sql2); $nb = sql_count($res2); if ($nb==0) { $sql3 = "insert into grr_j_user_room (login, id_room) values ('$reg_admin_login',$row[0])"; if (sql_command($sql3) < 0) {fatal_error(1, "
" . sql_error());} else {$msg=$vocab["add_user_succeed"];} } } } } if ($action) { if ($action == "del_admin") { if(authGetUserLevel(getUserName(),$room) < 4) { showAccessDenied($day, $month, $year, $area,$back); exit(); } unset($login_admin); $login_admin = $_GET["login_admin"]; $sql = "DELETE FROM grr_j_user_room WHERE (login='$login_admin' and id_room = '$room')"; if (sql_command($sql) < 0) {fatal_error(1, "
" . sql_error());} else {$msg=$vocab["del_user_succeed"];} } if ($action == "del_admin_all") { if(authGetUserLevel(getUserName(),$area,'area') < 4) { showAccessDenied($day, $month, $year, $area,$back); exit(); } $sql = "select id from grr_room where area_id=$area order by room_name"; $res = sql_query($sql); if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) { $sql2 = "DELETE FROM grr_j_user_room WHERE (login='".$_GET['login_admin']."' and id_room = '$row[0]')"; if (sql_command($sql2) < 0) {fatal_error(1, "
" . sql_error());} else {$msg=$vocab["del_user_succeed"];} } } } if ((empty($area)) and (isset($row[0]))) { if(authGetUserLevel(getUserName(),$row[0],'area') >= 5) $area = get_default_area(); else { # Retourne le domaine par défaut; Utilisé si aucun domaine n'a été défini. // On cherche le premier domaine à accès non restreint $area = sql_query1("SELECT a.id FROM grr_area a, grr_j_useradmin_area j WHERE a.id=j.id_area and j.login='".getUserName()."' ORDER BY a.access, a.order_display, a.area_name LIMIT 1"); } } if (empty($room)) $room = -1; echo "
".$vocab["admin_right_explain"]."
"; echo ""; if ($msg) { echo ""; } # Table with areas, rooms. echo "$vocab[areas] "; $out_html = ""; echo $out_html; $this_area_name = sql_query1("select area_name from grr_area where id=$area"); $this_room_name = sql_query1("select room_name from grr_room where id=$room"); $this_room_name_des = sql_query1("select description from grr_room where id=$room"); echo " | \n";
# Show all rooms in the current area
echo "".$vocab['rooms']." "; # should we show a drop-down for the room list, or not? $out_html = ""; echo $out_html; echo " | \n";
echo "
";
if ($room!='-1') {
echo "$vocab[administration1]"; echo "$this_room_name $this_room_name_des \n"; } else { $is_admin='yes'; echo "$vocab[administration2]"; $sql = "select id, room_name, description from grr_room where area_id=$area order by room_name"; $res = sql_query($sql); if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) { if ($row[2]) {$temp = " ($row[2])";} else {$temp="";} echo $row[1].$temp.""; } } ?> |
".$vocab["user_list"]."";
if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++)
{
$login_admin = $row[0];
$nom_admin = $row[1];
$prenom_admin = $row[2];
echo "";
echo "$nom_admin $prenom_admin | ".$vocab["delete"]." "; } if ($nombre == 0) { echo " ".$vocab["no_admin"].""; } } else { $exist_admin='no'; $sql = "select login, nom, prenom from grr_utilisateurs where statut='utilisateur'"; $res = sql_query($sql); if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) { $is_admin='yes'; $sql2 = "select id, room_name, description from grr_room where area_id=$area order by room_name"; $res2 = sql_query($sql2); if ($res2) { $test = sql_count($res2); if ($test != 0) { for ($j = 0; ($row2 = sql_row($res2, $j)); $j++) { $sql3 = "SELECT login FROM grr_j_user_room WHERE (id_room='".$row2[0]."' and login='".$row[0]."')"; $res3 = sql_query($sql3); $nombre = sql_count($res3); if ($nombre==0) $is_admin='no'; } } else { $is_admin='no'; } } if ($is_admin=='yes') { if ($exist_admin=='no') { echo "".$vocab["user_list"].""; $exist_admin='yes'; } echo ""; echo "$row[1] $row[2] | ".$vocab["delete"].""; } } if ($exist_admin=='no') { echo " ".$vocab["no_admin_all"].""; } } ?> |