[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/www/se3/registre/ -> ajout_cle_groupe.php (source)

   1  <?php
   2  
   3     /**
   4     
   5     * Gestion des cles pour clients Windows (effectue les actions sur la table restrictions c'est a dire sur les templates)
   6     * @Version $Id: ajout_cle_groupe.php 4209 2009-06-22 13:56:08Z gnumdk $ 
   7     
   8    
   9     * @Projet LCS / SambaEdu 
  10     
  11     * @auteurs  Sandrine Dangreville
  12     
  13     * @Licence Distribue selon les termes de la licence GPL
  14     
  15     * @note 
  16     
  17     */
  18  
  19     /**
  20  
  21     * @Repertoire: registre
  22     * file: ajout_cle_groupe.php
  23  
  24    */    
  25  
  26  
  27  
  28  
  29  $cat=$_GET['cat'];
  30  if (!$cat) { $cat=$_POST['cat']; }
  31  $sscat=$_GET['sscat'];
  32  if (!$cat) { $cat=$HTTP_COOKIE_VARS["Categorie"]; }
  33  if ($cat) {
  34      setcookie ("Categorie", "", time() - 3600);
  35      setcookie("Categorie",$cat,time()+3600);
  36  }
  37  
  38  if (!$sscat) { $sscat=$HTTP_COOKIE_VARS["Sous-Categorie"]; }
  39  if ($sscat) {
  40      setcookie ("Sous-Categorie", "", time() - 3600);
  41      setcookie("Sous-Categorie",$sscat,time()+3600);
  42  }
  43  
  44  require  "include.inc.php";
  45  include  "entete.inc.php";
  46  include  "ldap.inc.php";
  47  include  "ihm.inc.php";
  48  
  49  require_once  ("lang.inc.php");
  50  bindtextdomain('se3-registre',"/var/www/se3/locale");
  51  textdomain ('se3-registre');
  52  
  53  if (ldap_get_right("computers_is_admin",$login)!="Y")
  54          die (gettext("Vous n'avez pas les droits suffisants pour acc&#233;der &#224; cette fonction")."</BODY></HTML>");
  55  
  56  $_SESSION["pageaide"]="Gestion_des_clients_windows#Description_du_processus_de_configuration_du_registre_Windows";
  57  
  58  
  59  echo "<h1>".gettext("Gestion des cl&#233;")."</h1>";
  60  
  61  $testniveau=getintlevel();
  62  $act=$_POST['ajoutcle'];
  63  $autre=$_POST['modifcle'];
  64  $salle=$_POST['salles'];
  65  
  66  if (!$salle) { $salle=$_GET['salles']; }
  67  
  68  connexion();
  69  
  70  if (! isset($_POST['groups'])) {
  71      //incorporation d'un modele
  72      $query="SELECT `mod` FROM modele GROUP BY `mod`;";
  73      $resultat = mysql_query($query);
  74      echo gettext("Choisir le modele &#224 incorporer au groupe")." $salle <br><FORM METHOD=POST ACTION=\"ajout_cle_groupe.php\" >";
  75      $i=0;
  76      while ($row = mysql_fetch_array($resultat)) {    
  77          echo " <input type=\"checkbox\" name=\"modele$i\" id=\"modele$i\" value=\"$row[0]\"/><label for='modele$i'> $row[0]</label><br/>\n";
  78          $choix[$i]=$row[0];
  79          $i++;
  80      }
  81      echo "</select>";
  82      echo "<INPUT TYPE=\"hidden\" name=\"groups\" value=\"1\">";
  83      echo "<INPUT TYPE=\"hidden\" name=\"salles\" value=\"$salle\">";
  84      echo "<INPUT TYPE=\"hidden\" name=\"nombre\" value=\"$i\">";
  85      echo "<INPUT TYPE=\"submit\" name=\"inscrire\" value=\"".gettext("Ajouter ces groupes de cl&#233s au template")."\"></FORM>";
  86  
  87      echo "<br>".gettext("Attention, toute cl&#233 non pr&#233sente dans base y sera &#233galement ajout&#233e afin de respecter la coh&#233rence de vos restrictions")." <br>";
  88  }
  89  else {
  90      $nombre=$_POST['nombre'];
  91          $priorite = priorite($salle);
  92      for ($n=0;$n<$nombre;$n++) {
  93          $mod=$_POST['modele'.$n];
  94          $query="SELECT `cle`,`etat` FROM `modele` WHERE `mod`= '$mod' ;";
  95          $resultat = mysql_query($query);
  96          while ($row=mysql_fetch_row($resultat)) {
  97              $cle=$row[0];
  98              $query = "SELECT cleID,Intitule,valeur,antidote,type FROM corresp WHERE cleID='$cle';";
  99              $insert = mysql_query($query);
 100              $row1 = mysql_fetch_row($insert);
 101              $query = "SELECT cleID,valeur FROM restrictions WHERE cleID='$cle' AND groupe='$salle';";
 102              $verif = mysql_query($query);
 103              $row2=mysql_fetch_row($verif);
 104              
 105              if ($row[1] == "1") {
 106                  $row1[2]=ajoutedoublebarre($row1[2]);
 107                  if ($row2[0]) {
 108                      $query = "UPDATE `restrictions` SET `valeur` = '$row1[2]',priorite='$priorite' WHERE `cleID` = '$cle' AND `groupe` = '$salle';";
 109                      $insert = mysql_query($query);
 110                  } else {
 111                      $query="INSERT INTO restrictions (resID,valeur,cleID,groupe,priorite) VALUES ('','$row1[2]','$row[0]','$salle','$priorite');";
 112                      $insert = mysql_query($query);
 113                  }
 114              }
 115              else{
 116                  if ($row1[4] == "config") {
 117                      $query="DELETE FROM restrictions where cleID='$cle';";
 118                      $insert = mysql_query($query);
 119                  }
 120                  else {
 121                      if ($row2[0]) {
 122                          $query = "UPDATE `restrictions` SET `valeur` = '$row1[3]',priorite='$priorite' WHERE `cleID` = '$cle' AND `groupe` = '$salle';";
 123                          $insert = mysql_query($query);
 124                      } else {
 125                          $query="INSERT INTO restrictions (resID,valeur,cleID,groupe,priorite) VALUES ('','$row1[3]','$row[0]','$salle','$priorite');";
 126                          $insert = mysql_query($query);
 127                      }
 128                  }
 129              }
 130          }
 131      }
 132      echo "<HEAD><META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=affiche_restrictions.php?salles=$salle\"></HEAD>";
 133  }
 134  
 135  
 136  include("pdp.inc.php");
 137  ?>


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1