[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3     /**
   4  
   5     * Page qui teste les differents services
   6     * @Version $Id: test.php 8552 2015-03-15 12:27:31Z plouf $
   7     * @Projet LCS / SambaEdu
   8     * @auteurs Philippe Chadefaux  MrT
   9     * @Licence Distribue selon les termes de la licence GPL
  10     * @note
  11     * Modifications proposées par Sébastien Tack (MrT)
  12     * Optimisation du lancement des scripts bash par la technologie asynchrone Ajax.
  13     * Modification du systéme d'infos bulles.(Nouvelle version de wz-tooltip) Ancienne version incompatible avec ajax
  14     * Externalisation des messages contenus dans les infos-bulles
  15     * Fonctions Tip('msg') et UnTip();
  16     * Nouvelle organisation de l'arborescence.
  17     * Migration des messages dans un script php
  18  
  19     */
  20  
  21     /**
  22  
  23     * @Repertoire: /
  24     * file: test.php
  25     */
  26  
  27  
  28  
  29  require ("config.inc.php");
  30  require ("entete.inc.php");
  31  
  32  $prefix = "tests";
  33  require_once("$prefix/messages/$lang/".$prefix."_messages.php");
  34          
  35  
  36    
  37  $action=isset($_GET['action']) ? $_GET['action'] : "";
  38    
  39  
  40  //aide
  41  $_SESSION["pageaide"]="Informations_syst%C3%A8me#Diagnostic";
  42  
  43  // Si pas se3_is_admin    
  44  if (ldap_get_right("se3_is_admin",$login)!="Y")
  45          die (gettext("Vous n'avez pas les droits suffisants pour acc&#233;der &#224; cette fonction")."</BODY></HTML>");
  46  //    if (ldap_get_right("se3_is_admin",$login)=="Y")  {
  47  
  48      if ((isset($action))&&($action == "setadminse3smbpass")) {
  49              exec('/usr/bin/sudo /usr/share/se3/scripts/change_adminse3_smbpass.sh');
  50      }
  51  
  52          //if ($_GET['action'] == "updatesystem") {
  53          //    exec('/usr/bin/sudo /usr/share/se3/scripts/se3_update_system.sh --auto');
  54          //    unset($action);
  55          // }
  56      if ((isset($action))&&($action == "updatesystem")) {
  57          $info_1 = gettext("Mise &#224; jour syst&#232;me lanc&#233;e, ne fermez pas cette fen&#234;tre avant que le script ne soit termin&#233;. vous recevrez un mail r&#233;capitulatif de tout ce qui sera effectu&#233;...");
  58          echo $info_1;
  59          system('sleep 1; /usr/bin/sudo /usr/share/se3/scripts/se3_update_system.sh --auto &');
  60          unset($action);
  61      }
  62      if ((isset($action))&&($action == "settime")) {
  63          exec('/usr/bin/sudo /usr/share/se3/sbin/settime.sh');
  64      }
  65      if ((isset($action))&&($action == "startsamba")) {
  66          exec('/usr/bin/sudo /usr/share/se3/scripts/services.sh samba restart');
  67      }
  68      if ((isset($action))&&($action == "installse3-domain")) {
  69          $info_1 = gettext("Mise &#224; jour lanc&#233;e, ne fermez pas cette fen&#234;tre avant que le script ne soit termin&#233;. vous recevrez un mail r&#233;capitulatif de tout ce qui sera effectu&#233;...");
  70      echo $info_1;
  71      system("/usr/bin/sudo /usr/share/se3/scripts/install_se3-module.sh se3-domain");
  72      }
  73      
  74      if ((isset($action))&&($action == "exim_mod")) {
  75          $fichier = "/etc/ssmtp/ssmtp.conf";
  76          $fp=fopen("$fichier","w+");
  77          $DEFAUT = "
  78          root=$dc_root
  79          mailhub=$dc_smarthost
  80          rewriteDomain=$dc_readhost
  81          ";
  82          fwrite($fp,$DEFAUT);
  83          fclose($fp);
  84          $action="mail_test";
  85      }
  86  
  87  
  88      if ((isset($action))&&($action == "mail_test")) {
  89             $dc_root=exec('cat /etc/ssmtp/ssmtp.conf | grep root= | cut -d= -f2');
  90             $subject = gettext("Test de la configuration de votre serveur Se3");
  91              $message = gettext("Message envoy&#233; par le serveur Se3");
  92             mail ($dc_root, $subject, $message);
  93             unset($action);
  94      }
  95  
  96  
  97  
  98  ?>
  99      <script language="JavaScript">
 100      <!--
 101         svbg=""
 102  	   function chng(obj,i) {
 103         if(i==0) obj.setAttribute("BGCOLOR", "#A8A8A8", false)
 104         if(i==1)
 105            if(obj==svbg) obj.setAttribute("BGCOLOR", "#CDCDCD", false)
 106          else obj.setAttribute("BGCOLOR", "#CDCDCD", false)
 107         if(i==2) {
 108            if(svbg!="") svbg.setAttribute("BGCOLOR", "white", false)
 109            svbg=obj
 110            obj.setAttribute("BGCOLOR", "lime", false)
 111         }
 112       }
 113      //--></script>
 114      <script type="text/javascript" src="/elements/js/wz_tooltip_new.js"></script>
 115      <script type="text/javascript" src="/tests/js/tests_messages_ajax.php"></script>
 116      <script type="text/javascript" src="/tests/js/gest_messages.js"></script>
 117      <script type="text/javascript" src="/tests/js/tests.js"></script>
 118  
 119      <?php 
 120      /********** Test de la conf du serveur **********************/
 121      echo "<H1>".gettext("Etat du serveur")."</H1>";
 122      $phpv2=preg_replace("/[^0-9\.]+/","",phpversion());
 123      $phpv=$phpv2-0;
 124  
 125      /*******************************************************/
 126  
 127      // =======================================
 128      // Affichage d'un lien de rafraichissement du cadre.
 129      if(file_exists('/etc/se3/temoin_test_refresh.txt')){
 130          echo "<div style='position:fixed; top:5px; left:5px; width:20px; height:20px; border:1x solid black;'>\n";
 131          echo "<a href='".$_SERVER['PHP_SELF']."'><img src='elements/images/rafraichir.png' width='16' height='16' border='0' alt='Rafraichir' /></a>\n";
 132          echo "</div>\n";
 133      }
 134      // =======================================
 135  
 136  
 137      // Verifie la connexion a internet si ligne_internet = 0% alors on a internet
 138      $PING_INTERNET="195.98.246.50";
 139      if ($phpv>=4.2) {
 140          $PING="ping -c 1 -w 1 $PING_INTERNET | awk '/packet/ {print $6}'";
 141      } else {
 142          $PING="ping -c 1 $PING_INTERNET | awk '/packet/ {print $7}'";
 143      }
 144  
 145      $ligne_internet=exec("$PING",$test,$testretour);
 146      if ($ligne_internet != "0%") { // on teste sur un autre serveur
 147         $PING_INTERNET="www.free.fr";
 148         if ($phpv>=4.2) {
 149          $PING="ping -c 1 -w 1 $PING_INTERNET | awk '/packet/ {print $6}'";
 150         } else {
 151          $PING="ping -c 1 $PING_INTERNET | awk '/packet/ {print $7}'";
 152         }
 153         $ligne_internet=exec("$PING",$test,$testretour);
 154      }
 155  
 156      // leb 30sept2007
 157      if ($ligne_internet != "0%") { // test acces http
 158         //$http=exec("cd /tmp; wget -q ---tries=1 --connect-timeout=1 http://wawadeb.crdp.ac-caen.fr && echo \$? | rm -f /tmp/index.html.1*",$out,$retour);
 159         $http=exec("cd /tmp; wget -q --tries=1 --timeout=2 http://wawadeb.crdp.ac-caen.fr && echo \$? | rm -f /tmp/index.html.1*",$out,$retour);
 160         if ($retour=="0") {
 161             $ligne_internet = "0%";
 162         }
 163      }
 164      // fin-leb 30sept2007
 165      // Verifie si proxy defini
 166      $proxy=exec("cat /etc/profile | grep http_proxy= | cut -d= -f2");
 167      if ($proxy != "") {
 168          preg_match("/http:\/\/(.*)\"/i",$proxy,$rest);
 169          putenv("http_proxy=$rest[1]");
 170      }
 171  
 172  
 173  
 174      $os=exec("cat /etc/debian_version | cut -d. -f1-2");
 175      $vers=exec("dpkg -s se3|grep Version|cut -d ' ' -f2");
 176  ?>
 177  
 178          <center><TABLE border="1" width="80%"><TR><TD colspan="3" align="center" class="menuheader">
 179      Version SambaEdu</TD></TR><TR><TD>Version OS</TD><TD align="center" colspan="2">
 180  <?php
 181      if ($os=="6.0") { echo "Squeeze"; } else { echo "Wheezy"; } echo "<I> <img src=\"../elements/images/debian.png\">($os)</I></TD></TR>\n";
 182  ?>
 183      </TD>
 184      </TR>
 185      <TR>
 186          <TD>Mise &#224; jour de votre serveur Se3 <I>(Version actuelle <?php echo $vers; ?>)</I></TD>
 187          <TD align="center">
 188              <a id=link_maj href="#"><IMG id="check_maj" style="border: 0px solid ;" SRC="../elements/images/info.png" ></a>
 189          </TD>
 190          <TD align="center">
 191              <a id="help_maj_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 192          </TD>
 193      </TR>
 194          
 195          <?php
 196          if ($clonage == "1") {
 197              echo '<TR>';
 198          } else {
 199              echo '<TR id="ligne_clonage" style="display: none;">';
 200  //            echo '<TR>';
 201          }
 202          ?>
 203                          
 204                      <TD>Contr&#244;le des mise a jour des dispositifs de Se3-clonage</TD>
 205                      <TD align="center">
 206                              <a id=link_clonage href="#"><IMG id="check_clonage" style="border: 0px solid ;" SRC="../elements/images/info.png" /></a>
 207                      </TD>
 208                      <TD align="center">
 209                              <A id="help_clonage_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 210                      </TD>
 211          </TR>
 212          
 213      <TR>
 214          <TD>Importation des cl&#233;s</TD>
 215          <TD align="center">
 216              <a id=link_keys href="#"><IMG id="check_keys" style="border: 0px solid ;" SRC="../elements/images/info.png" /></A>
 217          </TD>
 218          <TD align="center">
 219              <A id="help_keys_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 220          </TD>
 221      </TR>
 222          <TR>
 223          <TD>Contr&#244;le la pr&#233;sence de Se3-domain</TD>
 224          <TD align="center">
 225              <a id=link_vbs href="#"><IMG id="check_vbs" style="border: 0px solid ;" SRC="../elements/images/info.png" /></a>
 226          </TD>
 227          <TD align="center">
 228              <A id="help_vbs_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 229          </TD>
 230      </TR>
 231      
 232          <TR>
 233          <TD colspan="3" align="center" class="menuheader">
 234              V&#233;rification des connexions</TD></TR><TR><TD>V&#233;rifie la connexion &#224; la passerelle <I>(
 235      <?php
 236      // Ping passerelle
 237      $PING_ROUTEUR=`cat /etc/network/interfaces | grep gateway | grep -v broadcast | cut -d" " -f 2`;
 238      $PING_ROUTEUR=trim($PING_ROUTEUR);
 239      echo $PING_ROUTEUR;
 240      ?>
 241      )</I>
 242          </TD>
 243          <TD align="center"><IMG id="check_gateway" style="border: 0px solid ;" SRC="../elements/images/info.png"></TD>
 244          <TD align="center">
 245              <a id="help_gateway_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 246          </TD>
 247      </TR>
 248  
 249      <TR>
 250          <TD>V&#233;rification de la connexion &#224; internet</TD>
 251          <TD align="center">
 252              <IMG id="check_internet" style="border: 0px solid ;" SRC="../elements/images/info.png">
 253          </TD>
 254          <TD align="center">
 255              <a id="help_net_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 256          </TD>
 257      </TR>
 258      <TR>
 259          <TD>V&#233;rification de la r&#233;solution de nom (DNS)</TD>
 260          <TD align="center">
 261              <IMG id="check_dns" style="border: 0px solid ;" SRC="../elements/images/info.png">
 262          </TD>
 263          <TD align="center">
 264              <a id="help_dns_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 265          </TD>
 266      </TR>
 267      <TR>
 268          <TD>V&#233;rification du nom DNS du serveur Se3 <span id="urlse3" style="font-style: italic;">(<?php echo $urlse3 ?>)</span></TD>
 269          <TD align="center"><IMG id="check_dns_se3" style="border: 0px solid ;" SRC="../elements/images/info.png"></TD>
 270          <TD align="center">
 271              <a id="help_dns2_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 272          </TD>
 273      </TR>
 274      <TR>
 275          <TD>Connexion au serveur FTP de mises &#224; jour <I>(<?php echo $ftpmaj ?>)</I></TD>
 276          <TD align="center"><IMG id="check_ftp" style="border: 0px solid ;" SRC="../elements/images/info.png"></TD>
 277          <TD align="center">
 278              <a id="help_ftp_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 279          </TD>
 280      </TR>
 281  
 282      <TR>
 283          <TD>V&#233;rifie l'acc&#232;s au web</TD>
 284          <TD align="center"><IMG id="check_web" style="border: 0px solid ;" SRC="../elements/images/info.png"></TD>
 285          <TD align="center">
 286              <a id="help_web_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 287          </TD>
 288      </TR>
 289      <TR>
 290          <TD>V&#233;rifie la connexion au serveur de temps <span id="ntp_server" style="font-style: italic;">(<?php echo $ntpserv ?>)</span></TD>
 291          <TD align="center"><IMG id="check_ntp" style="border: 0px solid ;" SRC="../elements/images/info.png"></TD>
 292          <TD align="center">
 293              <a id="help_ntp_se3"><img name="action_image2"  src="../elements/images/system-help.png"></a>
 294          </TD>
 295      </TR>
 296  
 297      <TR><TD colspan="3" align="center" class="menuheader">Contr&#244;le des services</TD></TR>
 298  
 299      <?php
 300          $la=date("G:i:s d/m/Y");
 301      ?>
 302      <TR id="ligne_date" style="display: none;">
 303          <TD>Contr&#244;le la date et l'heure du serveur <I>(date actuelle <?php echo $la; ?>)</I></TD>
 304          <TD align="center">
 305              <A id="link_time"><img id="check_time" style="border: 0px solid ;" SRC="../elements/images/info.png"></A>
 306          </TD>
 307          <TD align="center">
 308              <A id="help_time_se3"><img iname="action_image2"  src="../elements/images/system-help.png"></A>
 309          </TD>
 310      </TR>
 311  
 312  
 313      <TR>
 314          <TD>Configuration de l'exp&#233;dition des mails</TD>
 315          <TD align="center">
 316              <IMG id="check_mail" style="border: 0px solid ;" id="check_mail" SRC="../elements/images/info.png">
 317          </TD>
 318          <TD align="center">
 319              <A id="help_mail_se3"><img  name="action_image2"  src="../elements/images/system-help.png"></A>
 320          </TD>
 321      </TR>
 322      <TR>
 323          <TD>Etat du serveur Samba Version: <span id="smb_version" style="font-style: italic;">(<?php echo $smbversion ?>)</span></TD>
 324          <TD align="center">
 325              <a id="link_samba" href="#"><IMG id="check_smb" style="border: 0px solid ;" SRC="../elements/images/info.png"></a>
 326          </TD>
 327          <TD align="center">
 328              <a id="help_samba_se3"><img src="../elements/images/system-help.png"></a>
 329          </TD>
 330      </TR>
 331  
 332      <TR>
 333          <TD>Controle du SID samba</TD>
 334          <TD align="center">
 335              <IMG id="check_sid" style="border: 0px solid ;" SRC="../elements/images/info.png">
 336          </TD>
 337          <TD align="center">
 338              <A id="help_sid_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 339          </TD>
 340      </TR>
 341      <TR>
 342          <TD>Etat de la base MySQL</TD>
 343          <TD align="center">
 344              <IMG id="check_mysql" style="border: 0px solid ;" SRC="../elements/images/info.png">
 345          </TD>
 346          <TD align="center">
 347              <A id="help_mysql_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 348          </TD>
 349      </TR>
 350  
 351          <TR id="ligne_dhcp" style="display: none;">
 352  
 353              <TD>Etat du serveur DHCP</TD>
 354              <TD align="center">
 355                  <IMG id="check_dhcp" style="border: 0px solid ;" SRC="../elements/images/info.png">
 356              </TD>
 357              <TD align="center">
 358                  <A id="help_dhcp_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 359              </TD>
 360          </TR>
 361  
 362  
 363      <TR>
 364          <TD>Onduleur</TD>
 365          <TD align="center">
 366              <A id="link_ondul"><IMG id="check_ondul" style="border: 0px solid ;" SRC="../elements/images/info.png"></A>
 367          </TD>
 368          <TD align="center">
 369              <A id="help_ondul_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 370          </TD>
 371      </TR>
 372      <TR><TD colspan="3" align="center" class="menuheader">Etat des disques</TD></TR>
 373  
 374      <TR>
 375          <TD>Partition : / <span id="space_disk1"><span><br></TD>
 376          <TD align="center">
 377              <IMG id="check_disk1" style="border: 0px solid ;" SRC="../elements/images/info.png">
 378          </TD>
 379          <TD align="center">
 380  
 381              <A id="help_disk1"><img  src="../elements/images/system-help.png" /></A>
 382  
 383      </TD>
 384      </TR>
 385      <TR>
 386          <TD>Partition : /var/se3 <span id="space_disk2"><span></TD>
 387          <TD align="center">
 388              <IMG id="check_disk2" style="border: 0px solid ;" SRC="../elements/images/info.png">
 389          </TD>
 390          <TD align="center">
 391              <A id="help_disk2"><img src="../elements/images/system-help.png"></A>
 392          </TD>
 393      </TR>
 394      <TR>
 395          <TD>Partition : /home <span id="space_disk3"><span><br></TD>
 396          <TD align="center">
 397              <IMG id="check_disk3" style="border: 0px solid ;" SRC="../elements/images/info.png">
 398          </TD>
 399          <TD align="center">
 400              <A id="help_disk3"><img src="../elements/images/system-help.png"></A>
 401          </TD>
 402      </TR>
 403      <TR>
 404          <TD>Partition : /var <span id="space_disk4"><span><br></TD>
 405          <TD align="center">
 406              <IMG id="check_disk4" style="border: 0px solid ;" SRC="../elements/images/info.png">
 407          </TD>
 408          <TD align="center">
 409              <A id="help_disk4"><img src="../elements/images/system-help.png"></A>
 410          </TD>
 411      </TR>
 412  
 413      <TR><TD colspan="3" align="center" class="menuheader">S&#233;curit&#233;</TD></TR>
 414      <TR>
 415          <TD>Mises &#224; jour de s&#233;curit&#233; Debian</TD>
 416          <TD align="center">
 417              <A id="link_secu" ><IMG id="check_secu" style="border: 0px solid ;" SRC="../elements/images/info.png"></A>
 418          </TD>
 419          <TD align="center">
 420              <A id="help_secu_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 421          </TD>
 422      </TR>
 423      <TR><TD colspan="3" align="center" class="menuheader">Clients</TD></TR>
 424      <TR>
 425          <TD>V&#233;rifie le compte d'int&#233;gration des clients</TD>
 426          <TD align="center">
 427              <A id="link_client"><IMG id="check_client" style="border: 0px solid ;" SRC="../elements/images/info.png"></A>
 428          </TD>
 429          <TD align="center">
 430              <A id="help_client_se3"><img name="action_image2"  src="../elements/images/system-help.png"></A>
 431          </TD>
 432      </TR>
 433  
 434      </TABLE></center>
 435  
 436  
 437      <!-- //Menu pour mail. -->
 438      <div  id="mail_menu" style="width: 100%; display: none;" ><table width=100%><tr><td colspan=2 align=center bgcolor=#6699CC><font face=Verdana size=-1  color=#000000><b>Menu</b></font></td></tr><tr><td><IMG width=15 height=15 SRC=../elements/temp/command.png></td><td onmouseover=chng(this,0) onmouseout=chng(this,1)><a href=conf_smtp.php><font face=Verdana size=-1  color=#000000>Tester envoi</font></a></td></tr><td><IMG width=15 height=15 SRC=../elements/temp/comment.gif></td><td  onmouseover=chng(this,0) onmouseout=chng(this,1)><a href=../conf_smtp.php><font face=Verdana size=-1  color=#000000>Configurer</font></a></td></tr></table></div>
 439  
 440  
 441  <?php
 442      echo "</center>";
 443      require ("pdp2.inc.php");
 444  //    } // fin de pas se3_is_admin
 445  
 446  ?>


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