[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3     /**
   4     
   5     * Permet configurer la sauvegarde (Backuppc)
   6     * @Version $Id: modif_host_suite.php 4600 2009-10-22 08:40:36Z gnumdk $ 
   7     
   8     * @Projet LCS / SambaEdu 
   9     
  10     * @auteurs Philippe Chadefaux
  11  
  12     * @Licence Distribue selon les termes de la licence GPL
  13     
  14     * @note 
  15     
  16     */
  17  
  18     /**
  19  
  20     * @Repertoire: sauvegarde
  21     * file: modif_host_suite.php
  22  
  23    */    
  24  
  25  
  26  include ("fonction_backup.inc.php");
  27  require ("config.inc.php");
  28  
  29  // HTMLPurifier
  30  require_once  ("traitement_data.inc.php");
  31  
  32  $HostServer = $_GET['HostServer'];
  33  $TypeServer = $_GET['TypeServer'];
  34  $XferMethod = $_GET['XferMethod'];
  35  $dhcp = $_GET['dhcp'];
  36  $Share = $_GET['Share'];
  37  
  38  $ShareName1 = $_GET['ShareName1'];
  39  $ShareName2 = $_GET['ShareName2'];
  40  $defo = $_GET['defo'];
  41  $Compte = $_GET['Compte'];
  42  $PassWord = $_GET['PassWord'];
  43  $AclName = $_GET['AclName'];
  44  $LdapName = $_GET['LdapName'];
  45  $MysqlName = $_GET['MysqlName'];
  46  $Secrets = $_GET['Secrets'];
  47  $BackupFilesExclude = $_GET['BackupFilesExclude'];
  48  $TypeServerOld = $_GET['TypeServerOld'];
  49  $ArchiveDest = $_GET['ArchiveDest'];
  50  $ArchiveSplit = $_GET['ArchiveSplit'];
  51  $err = $_GET['err'];
  52  
  53  if ($Share != "") {
  54      $Share = stripslashes($Share);
  55  }
  56  
  57  if ($BackupFilesExclude != "") {
  58          $BackupFilesExclude = stripslashes($BackupFilesExclude);
  59  }
  60          
  61  
  62  $sql="Delete from params where name='mysql_all_save';";
  63  mysql_query($sql);
  64  $sql="Insert into params values ('', 'mysql_all_save', '".$MysqlName."', '5', '0', 'Sauvegarde de l ensemble des base SQL pour localhost');";
  65  mysql_query($sql);
  66  mysql_close ();
  67  
  68  if (($HostServer != "") and ($XferMethod=="archive") and ($ArchiveDest!="")) {
  69          if ($ArchiveSplit=="") { $ArchiveSplit="0"; }
  70      echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=new_host_valid.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&ArchiveDest=$ArchiveDest&ArchiveSplit=$ArchiveSplit&dhcp=$dhcp\">";
  71          exit;
  72  }
  73              
  74  
  75  if (($HostServer == "") or ($TypeServer == "") or ($XferMethod == "") or ($dhcp == "") or (($Share == "") and ($ShareName1 =="") and ($ShareName2 == "")) or ($defo == "")) {
  76      echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=modif_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&ShareName1=$ShareName1&ShareName2=$ShareName2&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&err=$err\">";
  77      exit;
  78  }    
  79  
  80  
  81  // On teste si le compte et mot de passe sont remplis
  82  if (($XferMethod == "smb") or ($XferMethod == "rsyncd")) {
  83      if (($Compte == "") or ($PassWord == "")) {
  84          $err = "2";
  85          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=modif_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&ShareName1=$ShareName1&ShareName2=$ShareName2&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&err=$err\">";
  86          exit;
  87          }
  88  }    
  89  if ($XferMethod == "rsync") {
  90      if ($Compte == "") {
  91          $err = "3";
  92          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=modif_host.php?HostServer=$HostServer&TypeServer=$TypeServer&XferMethod=$XferMethod&Share=$Share&ShareName1=$ShareName1&ShareName2=$ShareName2&defo=$defo&Compte=$Compte&PassWord=$PassWord&AclName=$AclName&LdapName=$LdapName&MysqlName=$MysqlName&Secrets=$Secrets&dhcp=$dhcp&BackupFilesExclude=$BackupFilesExclude&err=$err\">";
  93          exit;
  94      }
  95  }
  96  
  97  /********************* Tout est Ok  Suite de la conf ******************************************************/
  98  
  99  
 100  if ($defo=="N") { // Dans le cas ou on veut faire une conf particuli&#233;re    
 101      include  "entete.inc.php";
 102        require ("config.inc.php");
 103        require  ("ldap.inc.php");
 104        require  ("ihm.inc.php");
 105    
 106        require_once ("lang.inc.php");
 107  
 108        bindtextdomain('sauvegarde',"/var/www/se3/locale");
 109        textdomain ('sauvegarde');
 110  
 111  
 112        // Verifie les droits
 113        if ((is_admin("computers_is_admin",$login)=="Y") or (is_admin("inventaire_can_read",$login)=="Y")) {
 114  
 115          // relecture des variables
 116            $FullPeriod = variables(FullPeriod,$HostServer);
 117            if ($FullPeriod == "") { $FullPeriod = variables(FullPeriod,config); }
 118            $IncrPeriod = variables(IncrPeriod,$HostServer);
 119            if ($IncrPeriod == "") {$IncrPeriod = variables(IncrPeriod,config); }
 120            $FullKeepCnt = variables(FullKeepCnt,$HostServer);
 121            if ($FullKeepCnt == "") { $FullKeepCnt = variables(FullKeepCnt,config);}
 122            $FullKeepCntMin = variables(FullKeepCntMin,$HostServer);
 123            if ($FullKeepCntMin == "") {$FullKeepCntMin = variables(FullKeepCntMin,config);}
 124            $IncrKeepCnt = variables(IncrKeepCnt,$HostServer);
 125            if ($IncrKeepCnt == "") {$IncrKeepCnt = variables(IncrKeepCnt,config); }
 126            $IncrKeepCntMin = variables(IncrKeepCntMin,$HostServer);
 127            if ($IncrKeepCntMin == "") {$IncrKeepCntMin = variables(IncrKeepCntMin,config); }
 128            $FullAgeMax = variables(FullAgeMax,$HostServer);
 129            if ($FullAgeMax == "") { $FullAgeMax = variables(FullAgeMax,config);}
 130            $IncrAgeMax = variables(IncrAgeMax,$HostServer);
 131            if ($IncrAgeMax == "") {$IncrAgeMax = variables(IncrAgeMax,config);}
 132            $EMailAdminUserName = variables(EMailAdminUserName,$HostServer);
 133            if ($EMailAdminUserName == "") {$EMailAdminUserName = variables(EMailAdminUserName,config);}
 134            $hourBegin = variables(hourBegin,$HostServer);
 135            if ($hourBegin == "") { $hourBegin = variables(hourBegin,config);}
 136            $hourEnd = variables(hourEnd,$HostServer);
 137            if ($hourEnd == "") {$hourEnd = variables(hourEnd,config);}
 138            $weekDays = variables(weekDays,$HostServer);
 139            if ($weekDays == "") {$weekDays = variables(weekDays,config);}
 140                  
 141  
 142            echo "<P><h1>".gettext("Configuration sp&#233;cifique &#224; la machine")." $HostServer</h1></P>";
 143            echo "<form method=\"get\" action=\"new_host_valid.php\" >";
 144            echo "<br><br>";
 145            echo "<table align=center width=\"70%\" border=1 cellspacing=\"1\" cellpadding=\"0\">";
 146            echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\" align=\"center\">".gettext("Nombre de jours entre deux Sauvegardes")."</td></tr>\n";
 147            echo "<tr><td>".gettext("Entre deux sauvegardes compl&#232;tes :")."</td>";
 148            echo "<td><input name=\"FullPeriod\" type=\"text\" size=\"40\" 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";
 149            echo "<tr><td>".gettext("Entre deux sauvegardes incr&#233;mentales :")."</td>";
 150            echo "<td><input name=\"IncrPeriod\" type=\"text\" size=\"40\" 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>";
 151            echo "</tr></table>\n";
 152        
 153            echo "<br><br>";
 154  
 155            
 156          echo "<table align=center width=\"70%\" border=1 cellspacing=\"0\" cellpadding=\"0\">";
 157            echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\" align=\"center\">".gettext("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";
 158            echo "<tr><td>";
 159            
 160          
 161          echo "<table align=center width=\"100%\" border=1>\n";
 162            echo "<tr><td colspan=2 bgcolor=#E0E0E0>".gettext("En temps normal")."</td><td colspan=2 bgcolor=#E0E0E0>".gettext("Au minimum")." </td></tr>";
 163            echo "<tr><td>".gettext("Complete :")."</td><td><input name=\"FullKeepCnt\" type=\"text\" size=\"10\" value=\"$FullKeepCnt\"  ></td>\n";
 164            echo "<td>".gettext("Complete :")."</td><td><input name=\"FullKeepCntMin\" type=\"text\" size=\"10\" value=\"$FullKeepCntMin\"  ></td>\n";  
 165            echo "</tr><tr><td>".gettext("Incr&#233;mentale :")."</td><td><input name=\"IncrKeepCnt\" type=\"text\" size=\"10\" value=\"$IncrKeepCnt\"  ></td>\n";
 166            echo "<td>".gettext("Incr&#233;mentale :")."</td><td><input name=\"IncrKeepCntMin\" type=\"text\" size=\"10\" value=\"$IncrKeepCntMin\"  ></td>";
 167            echo "</tr></table>\n";
 168            echo "</td></tr></table>\n";
 169  
 170            echo "<br><br>";
 171  
 172            
 173          echo "<table align=center width=\"70%\" border=1 cellspacing=\"1\" cellpadding=\"0\">\n";
 174            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";
 175            echo "<tr><td>".gettext("Nb de jours apres lesquels les sauvegardes compl&#232;tes seront supprim&#233;es")."</td>";
 176            echo "<td><select name=\"FullAgeMax\">\n";
 177            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<option value=30>30<option value=60>60<option value=120>120</select></td></tr>\n";
 178            echo " <tr><td>".gettext("Nb de jours apres lesquel les sauvegardes incr&#233;mentielles seront supprim&#233;es")."</td>\n";
 179            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<option value=30>30</select></td>\n";
 180            echo "</tr></table>\n";
 181    
 182            echo "<br><br>";
 183  
 184            
 185          echo "<table align=center width=\"70%\" border=1 cellspacing=\"0\" cellpadding=\"0\">";
 186            echo "<tr><td colspan=\"2\" class='menuheader' height=\"30\" align=\"center\">".gettext("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";
 187            echo "<tr><td>";
 188            echo gettext("Mail envoy&#233; &#224; :")." </td><td><input type=\"text\" name=\"EMailAdminUserName\" size=\"50\" value=\"$EMailAdminUserName\"></td></tr>";
 189            echo "</table>\n";
 190    
 191            echo "<br><br>";
 192  
 193            echo "<input type=\"hidden\" name=\"HostServer\" value=\"$HostServer\" />";
 194            echo "<input type=\"hidden\" name=\"TypeServer\" value=\"$TypeServer\" />";
 195            echo "<input type=\"hidden\" name=\"XferMethod\" value=\"$XferMethod\" />";
 196            echo "<input type=\"hidden\" name=\"Share\" value=\"$Share\" />";
 197            echo "<input type=\"hidden\" name=\"Compte\" value=\"$Compte\" />";
 198            echo "<input type=\"hidden\" name=\"PassWord\" value=\"$PassWord\" />";
 199            echo "<input type=\"hidden\" name=\"AclName\" value=\"$AclName\" />";
 200            echo "<input type=\"hidden\" name=\"LdapName\" value=\"$LdapName\" />";
 201            echo "<input type=\"hidden\" name=\"MysqlName\" value=\"$MysqlName\" />";
 202            echo "<input type=\"hidden\" name=\"Secrets\" value=\"$Secrets\" />";
 203            echo "<input type=\"hidden\" name=\"dhcp\" value=\"$dhcp\" />";
 204            echo "<input type=\"hidden\" name=\"BackupFilesExclude\" value=\"$BackupFilesExclude\" />";
 205            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=\"Valider\"></u></center>";
 206            echo "</form>\n";
 207  
 208            require ("pdp.inc.php");
 209      }    
 210  
 211  } elseif ($defo == "Y") {
 212      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\">";
 213      exit;
 214  }
 215  
 216  ?>              
 217    


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