";
$reg_admin_login = isset($_GET["reg_admin_login"]) ? $_GET["reg_admin_login"] : NULL;
$action = isset($_GET["action"]) ? $_GET["action"] : NULL;
$msg='';
if ($reg_admin_login) {
// On commence par vérifier que le professeur n'est pas déjà présent dans cette liste.
if ($room !=-1) {
// Ressource
// On vérifie que la ressource $room existe
$test = sql_query1("select id from grr_room where id='".$room."'");
if ($test == -1) {
showAccessDenied($day, $month, $year, $area,$back);
exit();
}
// La ressource existe : on vérifie les privilèges de l'utilisateur
if(authGetUserLevel(getUserName(),$room) < 4)
{
showAccessDenied($day, $month, $year, $area,$back);
exit();
}
$sql = "SELECT * FROM grr_j_mailuser_room WHERE (login = '$reg_admin_login' and id_room = '$room')";
$res = sql_query($sql);
$test = sql_count($res);
if ($test != "0") {
$msg = $vocab["warning_exist"];
} else {
if ($reg_admin_login != '') {
$sql = "INSERT INTO grr_j_mailuser_room SET login= '$reg_admin_login', id_room = '$room'";
if (sql_command($sql) < 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();
}
$sql = "DELETE FROM grr_j_mailuser_room WHERE (login='".$_GET['login_admin']."' and id_room = '$room')";
if (sql_command($sql) < 0) {fatal_error(1, "
" . sql_error());} else {$msg=$vocab["del_user_succeed"];}
}
}
echo "";
if ($msg) {
echo "";
}
if (empty($area)) $area = get_default_area();
if (empty($room)) $room = -1;
echo "
".$vocab['admin_email_manager.php']."
";
echo "
".$vocab["explain_automatic_mail3"]."
";
echo "
".$vocab["explain_automatic_mail2"]."
";
echo $msg;
# Table with areas, rooms.
echo "
";
$this_area_name = "";
$this_room_name = "";
# Show all areas
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 "
\n";
# Don't continue if this area has no rooms:
if ($area <= 0)
{
echo "
$vocab[no_area]
";
exit;
}
# Show area and room:
if ($this_room_name_des!='-1') {$this_room_name_des = " (".$this_room_name_des.")";} else {$this_room_name_des='';}
if ($room=='-1') {
echo "
$vocab[no_room]
";
exit;
} else {
echo "
";
$sql = "SELECT u.login, u.nom, u.prenom FROM grr_utilisateurs u, grr_j_mailuser_room j WHERE (j.id_room='$room' and u.login=j.login) order by u.nom, u.prenom";
$res = sql_query($sql);
$nombre = sql_count($res);
if ($nombre!=0) echo "