[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3  
   4     /**
   5     
   6     * Permet configurer la sauvegarde (Backuppc)
   7     * @Version $Id: new_host_suite.php 4187 2009-06-19 09:22:12Z gnumdk $ 
   8     
   9     * @Projet LCS / SambaEdu 
  10     
  11     * @auteurs Philippe Chadefaux
  12  
  13     * @Licence Distribue selon les termes de la licence GPL
  14     
  15     * @note 
  16     
  17     */
  18  
  19     /**
  20  
  21     * @Repertoire: sauvegarde
  22     * file: new_host_suite.php
  23  
  24    */    
  25  
  26  
  27  include ("fonction_backup.inc.php");
  28  
  29  // HTMLPurifier
  30  require_once  ("traitement_data.inc.php");
  31  
  32      
  33  // if ((is_admin("system_is_admin",$login)=="Y") or (is_admin("inventaire_can_read",$login)=="Y")) {
  34  $HostServer = $_GET['HostServer'];
  35  $TypeServer = $_GET['TypeServer'];
  36  $XferMethod = $_GET['XferMethod'];
  37  $dhcp = $_GET['dhcp'];
  38  $Share = $_GET['Share'];
  39  $defo = $_GET['defo'];
  40  $Compte = $_GET['Compte'];
  41  $PassWord = $_GET['PassWord'];
  42  $AclName = $_GET['AclName'];
  43  $LdapName = $_GET['LdapName'];
  44  $MysqlName = $_GET['MysqlName'];
  45  $Secrets = $_GET['Secrets'];
  46  $BackupFilesExclude = $_GET['BackupFilesExclude'];
  47  $TypeServerOld = $_GET['TypeServerOld'];
  48  $err = $_GET['err'];
  49  $ArchiveDest = $_GET['ArchiveDest'];
  50  $ArchiveSplit = $_GET['ArchiveSplit'];        
  51  
  52  if ($Share != "") {
  53      $Share = stripslashes($Share);
  54  }    
  55  if ($BackupFilesExclude != "") {
  56      $BackupFilesExclude = stripslashes($BackupFilesExclude);
  57  }
  58  
  59  // Test si le nom donn&#233; n'est pas deja utilis&#233;
  60  
  61  if ($HostServer != "") {
  62          if (HostExist($HostServer)=="true") { 
  63          $err="1"; 
  64          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&TypeServerOld=$TypeServerOld&err=$err\">";
  65      exit;
  66      }
  67  }
  68  
  69  if (($HostServer != "") and ($XferMethod=="archive") and ($ArchiveDest!="")) {
  70      if ($ArchiveSplit=="") { $ArchiveSplit="0"; }
  71      echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host_valid.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&ArchiveDest=$ArchiveDest&ArchiveSplit=$ArchiveSplit&dhcp=$dhcp&TypeServerOld=$TypeServerOld\">";
  72      exit;
  73  }
  74  
  75  
  76  if (($HostServer == "") or ($TypeServer == "") or ($XferMethod == "") or ($dhcp == "") or ($Share == "") or ($defo == "")) {
  77      $err="4";
  78      echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&TypeServerOld=$TypeServerOld&err=$err\">";
  79      exit;
  80  }    
  81  
  82  
  83  // On teste si le compte et mot de passe sont remplis
  84  if (($XferMethod == "smb") or ($XferMethod == "rsyncd")) {
  85      if (($Compte == "") or ($PassWord == "")) {
  86          $err = "2";
  87          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&TypeServerOld=$TypeServerOld&err=$err\">";
  88          exit;
  89          }
  90  }    
  91  /*
  92  if ($XferMethod == "rsync") {
  93      if ($Compte == "") {
  94          $err = "3";
  95          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&TypeServerOld=$TypeServerOld&err=$err\">";
  96      exit;
  97      }
  98  }
  99  */
 100  
 101  /********************* Tout est Ok  Suite de la conf ***************************************/
 102  
 103  if ($defo=="N") { // Dans le cas ou on veut faire une conf particuli&#233;re    
 104      include  "entete.inc.php";
 105        require ("config.inc.php");
 106        require  ("ldap.inc.php");
 107        require  ("ihm.inc.php");
 108  
 109        require_once ("lang.inc.php");
 110        bindtextdomain('sauvegarde',"/var/www/se3/locale");
 111        textdomain ('sauvegarde');
 112      
 113      // Rechercche les valeurs par defaut
 114      $WakeupSchedule = variables(WakeupSchedule,config);
 115          $FullPeriod = variables(FullPeriod,config);
 116      $IncrPeriod = variables(IncrPeriod,config);
 117      $FullKeepCnt = variables(FullKeepCnt,config);
 118      $FullKeepCntMin = variables(FullKeepCntMin,config);
 119      $IncrKeepCnt = variables(IncrKeepCnt,config);
 120      $IncrKeepCntMin = variables(IncrKeepCntMin,config);
 121      $FullAgeMax = variables(FullAgeMax,config);
 122      $IncrAgeMax = variables(IncrAgeMax,config);
 123      $EMailAdminUserName = variables(EMailAdminUserName,config);
 124      $hourBegin = variables(hourBegin,config);
 125      $hourEnd = variables(hourEnd,config);
 126      $weekDays = variables(weekDays,config);
 127  
 128        echo "<P><h1>".gettext("Configuration sp&#233;cifique &#224; la machine")." $HostServer</h1></P>";
 129      echo "<form method=\"get\" action=\"new_host_valid.php\" >";
 130        echo "<br><br>\n";
 131        echo "<table align=center width=\"70%\" border=1 cellspacing=\"1\" cellpadding=\"0\">\n";
 132        echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\" align=\"center\">".gettext("Nombre de jours entre deux Sauvegardes")."</td></tr>\n";
 133        echo "<tr><td>".gettext("Entre deux sauvegardes compl&#232;tes :")."</td>";
 134        echo "<td><input name=\"FullPeriod\" type=\"text\" size=\"30\" value=\"$FullPeriod\" >&nbsp;<u onmouseover=\"return escape".gettext("('Pr&#233;ciser ici le nombre de jours entre deux sauvegardes compl&#233;tes.<br><br>D&#233;faut 6.97 (Soit 7 jours).')")."\"><img name=\"action_image2\"  src=\"../elements/images/system-help.png\"></u>&nbsp;</td></tr>\n";
 135        echo "<tr><td>".gettext("Entre deux sauvegardes incr&#233;mentales :")."</td>";
 136    
 137        echo "<td><input name=\"IncrPeriod\" type=\"text\" size=\"30\" value=\"$IncrPeriod\" >&nbsp;<u onmouseover=\"return escape".gettext("('Pr&#233;ciser ici le nombre de jours entre deux sauvegardes incr&#233;mentales.<br><br>D&#233;faut 0,97 (Soit 1 jour).')")."\"><img name=\"action_image2\"  src=\"../elements/images/system-help.png\"></u>&nbsp;</td>";
 138        echo "</tr></table>\n";
 139    
 140        echo "<br><br>";
 141  
 142        echo "<table align=center width=\"70%\" border=1 cellspacing=\"0\" cellpadding=\"0\">";
 143        echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\"  align=\"center\">Nombre de sauvegardes conserv&#233;es&nbsp;<u onmouseover=\"return escape".gettext("('Indiquer ici le nombre de sauvegardes &#224; conserver, lorsque tout est normal, ou au minimum.<br><br>Les valeurs par d&#233;faut sont en temps normal : 1 compl&#233;te, 6 incr&#233;mentales.<br>Et au minimum, 1 compl&#233;te, et 1 incr&#233;mentale. ')")."\"><img name=\"action_image2\"  src=\"../elements/images/system-help.png\"></u>&nbsp;</td></tr>\n";
 144        echo "<tr><td>";
 145        echo "<table align=center width=\"100%\" border=1>\n";
 146        echo "<tr><td colspan=2 bgcolor=#E0E0E0>".gettext("En temps normal")."</td><td colspan=2 bgcolor=#E0E0E0>".gettext("Au minimum")."</td></tr>";
 147        echo "<tr><td>".gettext("Complete :")."</td><td><input name=\"FullKeepCnt\" type=\"text\" size=\"10\" value=\"$FullKeepCnt\"  ></td>\n";
 148        echo "<td>".gettext("Complete :")."</td><td><input name=\"FullKeepCntMin\" type=\"text\" size=\"10\" value=\"$FullKeepCntMin\"  ></td>\n";  
 149        echo "</tr><tr><td>".gettext("Incr&#233;mentale :")."</td><td><input name=\"IncrKeepCnt\" type=\"text\" size=\"10\" value=\"$IncrKeepCnt\"  ></td>\n";
 150        echo "<td>".gettext("Incr&#233;mentale :")."</td><td><input name=\"IncrKeepCntMin\" type=\"text\" size=\"10\" value=\"$IncrKeepCntMin\"  ></td>";
 151        echo "</tr></table>\n";
 152        echo "</td></tr></table>\n";
 153  
 154        echo "<br><br>";
 155  
 156        echo "<table align=center width=\"70%\" border=1 cellspacing=\"1\" cellpadding=\"0\">\n";
 157        echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\"  align=\"center\">".gettext("Suppression des anciennes sauvegardes")."&nbsp;<u onmouseover=\"return escape".gettext("('Vous permet de pr&#233;ciser la dur&#233;e de conservation des sauvegardes. Toutefois les valeurs minimales seront toujours conserv&#233;es.<br><br>D&#233;faut 90 jours pour les compl&#233;tes,<br>30 pour les incr&#233;mentales')")."\"><img name=\"action_image2\"  src=\"../elements/images/system-help.png\"></u>&nbsp;</td></tr>\n";
 158        echo "<tr><td>".gettext("Nb de jours apres lesquels les sauvegardes<br> compl&#232;tes seront supprim&#233;es")."</td>";
 159        echo "<td><select name=\"FullAgeMax\">\n";
 160        echo "<option value=$FullAgeMax>$FullAgeMax<option value=1>1<option value=2>2<option value=3>3<option value=4>4<option value=5>5<option value=6>6<option value=7>7<option value=8>8<option value=9>9<option value=10>10<option value=11>11<option value=12>12<option value=13>13<option value=14>14<option value=15>15<option value=16>16<option value=17>17<option value=18>18<option value=19>19<option value=20>20</select></td></tr>\n";
 161        echo " <tr><td>".gettext("Nb de jours apres lesquel les sauvegardes<br> incr&#233;mentielles seront supprim&#233;es")."</td>\n";
 162        echo "<td><select name=\"IncrAgeMax\"><option value=$IncrAgeMax>$IncrAgeMax<option value=1>1<option value=2>2<option value=3>3<option value=4>4<option value=5>5<option value=6>6<option value=7>7<option value=8>8<option value=9>8<option value=10>10<option value=11>11<option value=12>12<option value=13>13<option value=14>14<option value=15>15<option value=16>16<option value=17>17<option value=18>18<option value=19>19<option value=20>20</select></td>\n";
 163        echo "</tr></table>\n";
 164    
 165        echo "<br><br>";
 166  
 167        echo "<table align=center width=\"70%\" border=1 cellspacing=\"0\" cellpadding=\"0\">";
 168        echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\"  align=\"center\">Gestion des alertes&nbsp;<u onmouseover=\"return escape".gettext("('Indiquqer ici, l\'adresse mail de la personne qui doit recevoir les alertes de la sauvegarde. <br>Cette information peut &#234;tre remplie par machine.<br><br>Remarque : ne pas oublier de configurer Se3 afin de pouvoir envoyer des mails.')")."\"><img name=\"action_image2\"  src=\"../elements/images/system-help.png\"></u>&nbsp;</td></tr>\n";
 169        echo "<tr><td>";
 170        echo gettext("Mail envoy&#233; &#224; :")." </td><td><input type=\"text\" name=\"EMailAdminUserName\" size=\"50\" value=\"$EMailAdminUserName\"></td></tr>";
 171        echo "</table>\n";
 172    
 173        echo "<br><br>";
 174  
 175        echo "<input type=\"hidden\" name=\"HostServer\" value=\"$HostServer\" />";
 176        echo "<input type=\"hidden\" name=\"TypeServer\" value=\"$TypeServer\" />";
 177        echo "<input type=\"hidden\" name=\"XferMethod\" value=\"$XferMethod\" />";
 178        echo "<input type=\"hidden\" name=\"Share\" value=\"$Share\" />";
 179        echo "<input type=\"hidden\" name=\"Compte\" value=\"$Compte\" />";
 180        echo "<input type=\"hidden\" name=\"PassWord\" value=\"$PassWord\" />";
 181        echo "<input type=\"hidden\" name=\"AclName\" value=\"$AclName\" />";
 182        echo "<input type=\"hidden\" name=\"LdapName\" value=\"$LdapName\" />";
 183        echo "<input type=\"hidden\" name=\"MysqlName\" value=\"$MysqlName\" />";
 184        echo "<input type=\"hidden\" name=\"Secrets\" value=\"$Secrets\" />";
 185        echo "<input type=\"hidden\" name=\"dhcp\" value=\"$dhcp\" />";
 186        echo "<input type=\"hidden\" name=\"BackupFilesExclude\" value=\"$BackupFilesExclude\" />";
 187  
 188        echo "<center><u onmouseover=\"return escape".gettext("('La validation va cr&#233;er le fichier de configuration par d&#233;faut, et relancer le serveur de sauvegarde.<br>Les champs vides, seront automatiquement compl&#233;t&#233;s, avec les valeurs par d&#233;faut.<br><br>Si celui-ci ne se relance pas, cela implique tr&#232;s probablement une erreur dans le fichier.<br><br>Si vous savez pas comment remplir les champs, vous pouvez les laisser libre et simplement valider')")."\"><input type=\"submit\"  value=\"".gettext("Valider")."\"></u></center>";
 189        echo "</form>\n";
 190  
 191        require ("pdp.inc.php");
 192  
 193  } elseif ($defo == "Y") {
 194      echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host_valid.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude\">";
 195  }
 196  
 197  ?>              
 198    


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