[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4  
   5   * Action sur un parc (arret - start)
   6   * @Version $Id: parcs_ajax_lib.php 7163 2012-05-10 23:24:37Z keyser $
   7  
   8   * @Projet LCS / SambaEdu
   9  
  10   * @auteurs  Stephane Boireau - MrT Novembre 2008
  11  
  12   * @Licence Distribue selon les termes de la licence GPL
  13  
  14   * @note
  15   * Ajaxification des pings - script parc_ajax_lib.php sur une proposition de St�phane Boireau
  16   * Gestion des infobulles nouvelle mouture Tip et UnTip
  17   * Modification des fonctions ts et vnc qui se trouvent desormais dans /var/www/se3/includes/fonc_parc.inc.php
  18   * Externalisation des messages dans messages/fr/action_parc_messages.php dans un hash global
  19   * 
  20   */
  21  /**
  22  
  23   * @Repertoire: parcs/
  24   * file: parcs_ajax_lib.php
  25  
  26   */
  27  require ("config.inc.php");
  28  require_once  ("functions.inc.php");
  29  require_once  ("lang.inc.php");
  30  require_once ("fonc_outils.inc.php");
  31  require_once  ("ldap.inc.php");
  32  require_once  ("ihm.inc.php");
  33  require_once ('fonc_parc.inc.php');
  34  $prefix = "action_parc";
  35  //$lang = "en";
  36  require_once("messages/$lang/" . $prefix . "_messages.php");
  37  
  38  //echo "<script type='text/javascript' src='position.js'></script>\n";
  39  
  40  
  41  
  42  if ($_POST['mode'] == 'ping_ip') {
  43      $resultat = fping($_POST['ip']);
  44      if ($resultat) {
  45          //echo "<img type=\"image\" src=\"../elements/images/enabled.png\" border='0' title='".$_POST['ip']."' title='".$_POST['ip']."' />";
  46          //echo "<img type=\"image\" src=\"../elements/images/enabled.png\" border=\"0\" title=\"".$_POST['ip']."\" title=\"".$_POST['ip']."\" />";
  47  
  48          $nom_machine = isset($_POST['nom_machine']) ? $_POST['nom_machine'] : NULL;
  49          $parc = isset($_POST['parc']) ? $_POST['parc'] : NULL;
  50          if ((isset($nom_machine)) && (isset($parc))) {
  51              //echo gettext($action_parc['msgStationIsOn']),
  52              echo "<a target=\"main\" href=\"action_machine.php?machine=$nom_machine&action=shutdown&parc=$parc&retour=action_parc\""
  53              . "onmouseout=\"UnTip();\" onmouseover=\"Tip('" . $action_parc['msgStationIsOn'] . "',WIDTH,250,SHADOW,true,DURATION,5000);\""
  54              . "onclick=\"if (window.confirm('" . $action_parc['msgConfirmEteindreMachine'] . " $mp_en_cours ?')) {return true;} else {return false;}\"/>"
  55              . "<img type=\"image\" border=\"0\" title=\"" . $action_parc['msgStationIsOn'] . "\" src=\"../elements/images/enabled.png\"></a>\n";
  56          } else {
  57              echo "<img type=\"image\" src=\"../elements/images/enabled.png\" border=\"0\" title=\"" . $_POST['ip'] . "\" title=\"" . $_POST['ip'] . "\" />";
  58          }
  59      } else {
  60          //echo "<img type=\"image\" src=\"../elements/images/disabled.png\" border='0' title='".$_POST['ip']."' title='".$_POST['ip']."' />";
  61          //echo "<img type=\"image\" src=\"../elements/images/disabled.png\" border=\"0\" title=\"".$_POST['ip']."\" title=\"".$_POST['ip']."\" />";
  62  
  63          $nom_machine = isset($_POST['nom_machine']) ? $_POST['nom_machine'] : NULL;
  64          $parc = isset($_POST['parc']) ? $_POST['parc'] : NULL;
  65          if ((isset($nom_machine)) && (isset($parc))) {
  66  
  67              echo "<a target=\"main\" href=\"action_machine.php?machine=$nom_machine&action=wol&parc=$parc&retour=action_parc\" target='_blank' "
  68              . "onmouseout=\"UnTip();\" onmouseover=\"Tip('" . $action_parc['msgStationIsOff'] . "',WIDTH,250,SHADOW,true,DURATION,5000);\" >"
  69              . "<img type=\"image\" border=\"0\" title=\"" . $action_parc['msgStationIsOff'] . "\" src=\"../elements/images/disabled.png\">"
  70              . "</a>\n";
  71          } else {
  72              echo "<img type=\"image\" src=\"../elements/images/disabled.png\" border=\"0\" title=\"" . $_POST['ip'] . "\" title=\"" . $_POST['ip'] . "\" />";
  73          }
  74      }
  75  } elseif ($_POST['mode'] == 'session') {
  76      $session = get_smbsess($_POST['nom_machine']);
  77      echo $session['html'];
  78  } elseif ($_POST['mode'] == 'wake_shutdown_or_reboot') {
  79      wake_shutdown_or_reboot($_POST['ip'], $_POST['nom'], $_POST['wake'], $_POST['shutdown_reboot']);
  80  } elseif ($_POST['mode'] == 'test_logon') {
  81      $machine = $_POST['nom_machine'];
  82      if (is_dir('/home/netlogon/machine/' . $machine)) {
  83          if (is_file('/home/netlogon/machine/' . $machine . '/gpt.ini')) {
  84              echo "<img type=\"image\" src=\"../elements/images/enabled.png\" border=\"0\" title=\"" . $machine . " : int&#233;gration OK \"/>";
  85          } else {
  86              echo "<img type=\"image\" src=\"../elements/images/warning.png\" border=\"0\" title=\"" . $machine . " : probl&#232;me avec les domscripts\"/>";
  87          }
  88      } else {
  89          $session = get_smbsess($machine);
  90          if ($session['login']) {
  91              echo "<img type=\"image\" src=\"../elements/images/warning.png\" border=\"0\" title=\"" . $machine . " : probl&#232;me avec les domscripts, le script de logon ne se lance pas \"/>";
  92          } elseif (fping($_POST['ip'])) {
  93              unset($texte);
  94              exec("sudo /usr/share/se3/scripts/force_gpo.sh " . $machine . " " . $_POST['ip'], $texte, $ret);
  95              if ($ret) {
  96                  // afficher les codes d'erreur en fonction des r�sultats du script
  97                  echo "<img type=\"image\" src=\"../elements/images/warning.png\" border=\"0\" title=\"" . $machine . " : probl&#232;me avec les domscripts, le script de logon a renvoy&#233; une erreur " . $ret;
  98                  foreach ($texte as $ligne) {
  99                      echo $ligne . "<br>";
 100                  }
 101                  echo "\"/>";
 102              } else {
 103                  echo "<img type=\"image\" src=\"../elements/images/enabled.png\" border=\"0\" title=\"" . $machine . " : int&#233;gration OK \"/>";
 104              }
 105          } else {
 106              echo "<img type=\"image\" src=\"../elements/images/disabled.png\" border=\"0\" title=\"" . $machine . " : il faut allumer la machine \"/>";
 107          }
 108      }
 109  } elseif ($_POST['mode'] == 'ts_vnc') {
 110  
 111      $resultat = fping($_POST['ip']);
 112      if ($resultat) {
 113          $ts = ts($_POST['ip']);
 114  
 115          $vnc = vnc($_POST['ip']);
 116          if ($ts) {
 117              echo $ts;
 118          }
 119          if ($vnc) {
 120              echo $vnc;
 121          }
 122          if ((!$ts) and (!$vnc)) {
 123              $ret = "<span onmouseout=\"UnTip();\" onmouseover=\"Tip('" . $action_parc['msgPortsClosed'] . "',WIDTH,250,SHADOW,true,DURATION,5000);\"" .
 124                      "><img type=\"image\" border=\"0\" title=\"" . $action_parc['msgPortsClosed'] . "\" src=\"../elements/images/disabled.png\">"
 125                      . "</span>\n";
 126              echo($ret);
 127          }
 128      } else {
 129          $ret = "<span onmouseout=\"UnTip();\" onmouseover=\"Tip('" . $action_parc['msgPingKo'] . "',WIDTH,250,SHADOW,true,DURATION,5000);\">" .
 130                  "<img type=\"image\" border=\"0\" title=\"" . $action_parc['msgPingKo'] . "\" src=\"../elements/images/disabled.png\">"
 131                  . "</span>\n";
 132          echo($ret);
 133      }
 134  }
 135  ?>


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