[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4  
   5   * Gestion des cles pour clients Windows (affiche les restrictions pour un groupe donne)
   6   * @Version $Id: affiche_restrictions.php 4126 2009-06-10 13:53:01Z crob $ 
   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   * @Repertoire: registre
  21   * file: affiche_restrictions.php
  22  
  23   */
  24  $cat = $_GET['cat'];
  25  if (!$cat) {
  26      $cat = $_POST['cat'];
  27  }
  28  $sscat = $_GET['sscat'];
  29  if (!$cat) {
  30      $cat = $HTTP_COOKIE_VARS["Categorie"];
  31  }
  32  if ($cat) {
  33      setcookie("Categorie", "", time() - 3600);
  34      setcookie("Categorie", $cat, time() + 3600);
  35  }
  36  if (!$sscat) {
  37      $sscat = $HTTP_COOKIE_VARS["Sous-Categorie"];
  38  }
  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  $testniveau = getintlevel();
  60  $salle = $_POST['salles'];
  61  $rest = $_POST['poser'];
  62  $salle1 = $_GET['salles'];
  63  $rest1 = $_POST['poser'];
  64  
  65  if (!$rest) {
  66      $rest = $rest1;
  67  };
  68  if (!$salle) {
  69      $salle = $salle1;
  70  }
  71  
  72  if (isset($_GET['clean'])) {
  73      connexion ();
  74      $deleteSQL = "delete from restrictions where groupe='$salle';";
  75      mysql_query($deleteSQL);
  76      mysql_close();
  77  }
  78  connexion();
  79  
  80  echo "<h1>" . gettext("Gestion du template ") . $salle . "</h1>\n";
  81  
  82  //si la salle est passe en parametre !
  83  if ($salle) {
  84      echo "<center><form action=\"choisir_protect.php\" name=\"choix niveau\" method=\"post\">\n";
  85      echo "<select name=\"mod\" size=\"1\"><option value=\"norestrict\">" . gettext("Aucune protection") . "</option>\n";
  86  
  87      $query = "SELECT `mod` FROM modele GROUP BY `mod`;";
  88      $resultat = mysql_query($query);
  89  
  90      while ($row = mysql_fetch_array($resultat, MYSQL_BOTH)) {
  91          if ($salle == "base" or $row[0] <> "norestrict") {
  92              echo "<option value=\"$row[0]\">$row[0]</option>\n";
  93          }
  94      }
  95  
  96      echo "</select>\n<input type=\"hidden\" name=\"salles\" value=\"$salle\" />\n";
  97      echo "<input type=\"submit\" value=\"J'ai choisi ce niveau de s&#233;curit&#233;\" />\n</form>\n</div>\n";
  98      echo "<div align=\"center\">\n";
  99      echo "<FORM METHOD=POST ACTION=\"ajout_cle_groupe.php\" >\n";
 100      echo "<INPUT TYPE=\"hidden\" name=\"salles\" value=\"$salle\">\n";
 101      echo "<INPUT TYPE=\"hidden\" name=\"retour\" value=\"choisir_protect.php\">\n";
 102      echo "<INPUT TYPE=\"hidden\" name=\"keygroupe\" value=\"4\" >\n";
 103      echo "<INPUT TYPE=\"submit\" value=\"" . gettext("Incorporer des groupes de cl&#233s") . "\" name=\"modifcle\">\n";
 104      echo "</form>\n</div>\n";
 105  
 106      affichelistecat("affiche_restrictions.php?salles=$salle", $testniveau, $cat);
 107      if ($cat != "" and $cat != "tout") {
 108          $ajout = "and corresp.categorie = '$cat'";
 109          if ($_GET['sscat']) {
 110              $ajoutsscat = " and corresp.sscat='$sscat'";
 111          } else {
 112              $ajoutsscat = "";
 113          }
 114  
 115          if (($testniveau == 2) and !($sscat)) {
 116              $ajoutpasaffiche = " and corresp.sscat= '' ";
 117          }
 118      } else if ($cat == "tout") {
 119  
 120          if ($cat == "tout") {
 121              $ajout = "";
 122              if ($sscat) {
 123                  $ajoutsscat = "";
 124              }
 125          }
 126      } else {
 127          echo "<h3>" . gettext("Choisissez une cat&#233gorie ci-dessus") . "</h3><br>\n";
 128          exit(0);
 129      }
 130  
 131      connexion();
 132      $query = "Select Intitule,corresp.CleID,corresp.valeur,genre,OS,antidote,type,chemin,restrictions.valeur,restrictions.groupe
 133          from corresp
 134          left outer join restrictions 
 135          on corresp.CleID = restrictions.cleID  
 136          where restrictions.groupe  = '" . $salle . "' " . $ajout . $ajoutsscatvide . $ajoutsscat . "
 137          order by ISNULL(restrictions.valeur) desc,type,OS,corresp.valeur,antidote,genre asc";
 138      $resultat = mysql_query($query);
 139  
 140      if (mysql_num_rows($resultat)) {
 141          //affichage de l'en-tete du tableau en fonction des cas
 142          echo "<table border=\"1\" ><tr BGCOLOR=#fff9d3><td><img src=\"/elements/images/system-help.png\" alt=\"" . gettext("Aide") . "\" title=\"Aide\" width=\"16\" height=\"18\" border=\"0\" />\n";
 143          echo "</td>$affichetout <td><DIV ALIGN=CENTER>" . gettext("Intitul&#233") . "</DIV></td>\n";
 144          echo "<td><DIV ALIGN=CENTER>" . gettext("OS") . "</DIV></td><td><DIV ALIGN=CENTER>" . gettext("Etat") . "</DIV></td><td><DIV ALIGN=CENTER>" . gettext("Supprimer") . "</DIV></td>\n";
 145      }
 146  
 147      while ($row = mysql_fetch_array($resultat, MYSQL_BOTH)) {
 148          //bouton aide
 149          echo "<tr><td><a href=\"#\" onClick=\"window.open('aide_cle.php?cle=$row[1]','aide','scrollbars=yes,width=600,height=620')\">\n";
 150          echo "<img src=\"/elements/images/system-help.png\" alt=\"aide\" title=\"$row[7]\" width=\"15\" height=\"15\" border=\"0\"></a></td>\n";
 151          echo "<td><DIV ALIGN=CENTER>$row[0]</DIV></td>\n";
 152          echo "<td><DIV ALIGN=CENTER>$row[4]</DIV></td>\n";
 153          if ($row['type'] == "config") {
 154              $state = 1;
 155              echo "<td BGCOLOR=#a5d6ff><DIV ALIGN=CENTER>
 156                      <a href=\"#\" onClick=\"window.open('edit_cle.php?cle=$row[1]&template=$salle&state=$state','Editer','scrollbars=no,width=400,height=200')\">$row[8]</a></DIV></td>";
 157          } elseif ($row['type'] == "restrict") {
 158              if ($row[8] == $row[5]) {
 159                  echo "<td BGCOLOR=#e0dfde><DIV ALIGN=CENTER>
 160                          <a href=\"#\" onClick=\"window.open('edit_cle.php?cle=$row[1]&template=$salle&state=0&choix=Active&value=$row[2]','Editer','scrollbars=no,width=400,height=200')\">
 161                          Inactive</a></DIV></td>";
 162              } elseif ($row[8] == $row[2]) {
 163                  echo "<td BGCOLOR=#a5d6ff><DIV ALIGN=CENTER>
 164                          <a href=\"#\" onClick=\"window.open('edit_cle.php?cle=$row[1]&template=$salle&state=1&choix=Inactive&antidote=$row[5]','Editer','scrollbars=no,width=400,height=200')\">            
 165                          Active</a></DIV></td>";
 166              } else {
 167                  echo "<td><DIV ALIGN=CENTER>Non configur&eacute;e</DIV></td>";
 168                  $state = -1;
 169              }
 170          }
 171          echo "<td><DIV ALIGN=CENTER><a href=\"#\" onClick=\"window.open('edit_cle.php?cle=$row[1]&template=$salle&choix=del','Supprimer','scrollbars=yes,width=600,height=620')\">\n";
 172          echo "<img src=\"/elements/images/edittrash.png\" alt=\"Supprimer\" title=\"$row[7]\" width=\"15\" height=\"15\" border=\"0\"></a></DIV></td>\n";
 173      }
 174  }
 175  echo"</table> ";
 176  
 177  mysql_close();
 178  echo "<br/><a href=\"affiche_restrictions.php?clean=1&salles=$salle\" onclick=\"return getconfirm();\"> Remise &agrave; z&eacute;ro</a><br/><br/>\n";
 179  echo "</center>\n";
 180  
 181  include("pdp.inc.php");
 182  ?>


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