[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-backup/var/www/se3/sauvegarde/supports/ -> support3.php (source)

   1  <?php
   2  
   3   /**
   4  
   5     * Permet configurer la sauvegarde sur NAS (Backuppc)
   6     * @Version $Id: support3.php 8470 2015-02-13 20:29:49Z plouf $
   7  
   8     * @Projet LCS / SambaEdu
   9  
  10     * @auteurs
  11  
  12     * @Licence Distribue selon les termes de la licence GPL
  13  
  14     * @note
  15  
  16     */
  17  
  18     /**
  19  
  20     * @Repertoire: sauvegarde/supports
  21     * file: support3.php
  22  
  23    */
  24  
  25  
  26      require ("config.inc.php");
  27         require_once  ("functions.inc.php");
  28      require  ("ldap.inc.php");
  29      require  ("ihm.inc.php");
  30      include ("fonction_backup.inc.php");
  31  
  32      require_once ("lang.inc.php");
  33      bindtextdomain('sauvegarde',"/var/www/se3/locale");
  34      textdomain ('sauvegarde');
  35  
  36  
  37      // Verifie les droits
  38      $login =isauth();
  39      if (ldap_get_right("system_is_admin",$login)!="Y")
  40             die (gettext("Vous n'avez pas les droits suffisants pour acc&#233;der &#224; cette fonction")."</BODY></HTML>");
  41  
  42      ###################################################################################
  43      # Fix Bpcmedia
  44      ###################################################################################
  45      $sql2 = "UPDATE `params` SET `value` = '3' WHERE `params`.`name` ='bpcmedia' ;";
  46      $c2 = mysql_query($sql2) or die("ERREUR: $sql2");
  47  
  48      
  49      ###################################################################################
  50  
  51  
  52              $drive='/var/lib/backuppc/'.$NAS_mntsuffix;
  53              
  54              echo "<table align=\"center\" width=\"80%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">";
  55              echo "<tr><td>&nbsp;";
  56              echo gettext("Etat connexion au disque NAS :  ");
  57              if (exec ('sudo /usr/share/se3/sbin/testbackup.sh')==false) {
  58                  $msg = 'La connexion au serveur de sauvegarde est fonctionnelle<BR>En cliquant sur ce bouton, vous deconnecterez le disque NAS afin de pouvoir proc&#233;der par exemple &#224; son &#233;change.';
  59                     echo "<a  onmouseout=\"UnTip()\" onmouseover=\"Tip('$msg')"."\"  href=sauv.php?action=umountUSB><IMG id=\"status_media\" style=\"border: 0px solid;\" SRC=\"../elements/images/enabled.png\" ></a>"; 
  60      
  61                  echo "</td><td align=\"center\">";
  62                  echo "<span onmouseout=\"UnTip()\" onmouseover=\"Tip('Taille disponible en Gb du disque sur lequel se trouve votre sauvegarde.')"."\">";
  63                  #echo round(diskfreespace("$drive")/1024/1024/1024,2); 
  64                  
  65                  #echo " Gb ";
  66                  exec ("sudo /usr/share/se3/scripts/dfbck.sh",$output);
  67                  echo $output[0]."</span></td></tr>";
  68                  $test_button = 'disabled="disabled"';
  69                                                  
  70              } else {
  71                  echo "</td><td align=\"center\">";
  72                  $msg = gettext("Acc&#232;s au NAS impossible.<BR />En cliquant sur ce bouton, <BR /> SE3 tentera de s\'y reconnecter.");
  73                  echo "<a  onmouseout=\"UnTip()\" onmouseover=\"Tip('$msg')"."\"  href=sauv.php?action=restoreUSB><IMG id=\"status_media\" style=\"border: 0px solid;\" SRC=\"../elements/images/disabled.png\" ></a>";
  74                  echo "</td></tr>";
  75                  $test_button = '';
  76                          }
  77          
  78              
  79          $msg3 = 'Il faut songer &agrave; d&#233;connecter le disque <BR />pour rendre ce bouton accessible.';
  80          echo "<tr class=\"nas_config\"><td colspan=\"2\" align=\"center\" >&nbsp;<strong>".gettext("Configuration du NAS")."</strong></td></tr>";
  81          
  82  
  83          //params d�j� positionn�s ?
  84          $sql = "select * from `params` where cat='7'";
  85          $c = mysql_query($sql) or die("ERREUR $sql");
  86          for ($x=0;$x<mysql_num_rows($c);$x++) {
  87              $R = mysql_fetch_object($c);
  88              if ($R->name == 'NAS_protocol')
  89                   $NAS_protocol= $R->value;
  90              if ($R->name == 'NAS_ip')
  91                   $NAS_ip= $R->value;
  92              if ($R->name == 'NAS_share')
  93                   $NAS_share= $R->value;
  94              if ($R->name == 'NAS_login')
  95                   $NAS_login= $R->value;
  96              if ($R->name == 'NAS_pass')
  97                   $NAS_pass= $R->value;
  98  
  99          }
 100          
 101          //if (!isset($NAS_protocol))
 102          //    $NAS_protocol='nfs';
 103          if (!isset($NAS_ip))
 104              $NAS_ip='192.168.234.10';
 105          if (!isset($NAS_share))
 106              $NAS_share='wawa_share';
 107          if (!isset($NAS_login))
 108              $NAS_login='wawa';
 109          if (!isset($NAS_pass))
 110              $NAS_pass='wawa';
 111  
 112          if (!isset($NAS_mntsuffix))
 113              $NAS_mntsuffix ="";
 114  
 115          if ($NAS_protocol == 'cifs') {
 116              $test = 'checked';
 117              $test2 = '';
 118          } elseif ($NAS_protocol == 'nfs') {
 119              $test = '';
 120              $test2 = 'checked';
 121          }
 122  
 123          
 124  
 125          $choixProtocole =  "<input type=\"radio\"  id=\"NAS_protocol1\" name=\"NAS_protocol\" value=\"cifs\" $test>CIFS</input>";
 126           $choixProtocole .= "&nbsp;&nbsp;<img onmouseover=\"Tip('Ce choix convient pour le montage d\'un partage samba.')\" onmouseout=\"UnTip()\" src=\"../elements/images/system-help.png\"></img>";
 127          $choixProtocole .= "<BR /><input type=\"radio\" id=\"NAS_protocol2\"name=\"NAS_protocol\" value=\"nfs\" $test2>NFS</input>";
 128          $choixProtocole .= "&nbsp;&nbsp; <img onmouseover=\"Tip('Ce protocole est fortement recommand&#233;.')\" onmouseout=\"UnTip()\" src=\"../elements/images/system-help.png\"></img>";
 129  
 130      
 131          $choixIP = "<input id=\"NAS_ip\" value=\"$NAS_ip\" />";
 132          $choixNomPartage = "<input id=\"NAS_share\" value=\"$NAS_share\" />";
 133          $choixLogin = "<input id=\"NAS_login\" value=\"$NAS_login\" />";
 134          $choixPasse = "<input type=\"password\" id=\"NAS_pass\" value=\"$NAS_pass\" />";
 135  
 136          if ($NAS_mntsuffix == '') {
 137              $test = 'checked';
 138              $test2 = '';
 139          } elseif ($NAS_mntsuffix == 'pc') {
 140              $test = '';
 141              $test2 = 'checked';
 142          }
 143  
 144  
 145          $choixSufX = "<input type=\"radio\"  id=\"NAS_suf1\" name=\"NAS_mountsuffix\" value=\"\" $test>/var/lib/backuppc</input>";
 146          $choixSufX .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img onmouseover=\"Tip('Convient dans la plupart des cas.')\" onmouseout=\"UnTip()\" src=\"../elements/images/system-help.png\"></img>";
 147          
 148          $choixSufX .= "<BR /><input type=\"radio\" id=\"NAS_suf2\"name=\"NAS_mountsuffix\" value=\"pc\" $test2>/var/lib/backuppc/pc</input>";
 149          $choixSufX .= "&nbsp;&nbsp; <img onmouseover=\"Tip('N&eacute;cessaire pour certains NAS.')\" onmouseout=\"UnTip()\" src=\"../elements/images/system-help.png\"></img>";
 150      
 151  
 152          echo "<tr class=\"nas_config\"><td width=\"66%\">&nbsp;&nbsp;".gettext("Protocole:")."</td><td align=\"center\" >$choixProtocole</td></tr>";
 153          echo "<tr class=\"nas_config\"><td width=\"66%\">&nbsp;&nbsp;".gettext("Point de montage:")."</td><td align=\"center\" >$choixSufX</td></tr>";
 154          echo "<tr class=\"nas_config\"><td>&nbsp;&nbsp;".gettext("Adresse IP du NAS:")."</td><td align=\"center\" >$choixIP</td></tr>";
 155          echo "<tr class=\"nas_config\"><td>&nbsp;&nbsp;".gettext("Nom du partage:")."</td><td align=\"center\" >$choixNomPartage</td></tr>";
 156          echo "<tr id=\"ligne_nas_user\" class=\"nas_config\"><td>&nbsp;&nbsp;".gettext("Login:")."</td><td align=\"center\" >$choixLogin</td></tr>";
 157          echo "<tr id=\"ligne_nas_passe\" class=\"nas_config\"><td>&nbsp;&nbsp;".gettext("Mot de passe:")."</td><td align=\"center\" >$choixPasse</td></tr>";
 158          echo "<tr class=\"nas_config\"><td colspan=\"2\" align=\"center\"><input id=\"wantSave\" type=\"button\" value=\"Enregistrer\" $test_button >"
 159          ."<span  onmouseout=\"UnTip()\" onmouseover=\"Tip('$msg3')"."\" > <IMG valign=\"center\" style=\"border: 0px solid;\" SRC=\"../elements/images/system-help.png\" ></span>"
 160          ."</td></tr>";
 161  
 162          echo "</table>";
 163  
 164  ?>


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