[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 5 * Action sur un parc (arret - start) 6 * @Version $Id: action_parc.php 8336 2014-12-20 17:25:10Z keyser $ 7 * @Projet LCS / SambaEdu 8 9 * @auteurs sandrine dangreville matice creteil 2005 - MrT Novembre 2008 10 11 * @Licence Distribue selon les termes de la licence GPL 12 13 * @note 14 * Ajaxification des pings - script parc_ajax_lib.php sur une proposition de St�phane Boireau 15 * Gestion des infobulles nouvelle mouture Tip et UnTip 16 * Modification des fonctions ts et vnc 17 * Externalisation des messages dans messages/fr/action_parc_messages.php dans un hash global 18 * 19 */ 20 /** 21 22 * @Repertoire: parcs/ 23 * file: action_parc.php 24 25 */ 26 include "entete.inc.php"; 27 require_once ("ldap.inc.php"); 28 require_once ("ihm.inc.php"); 29 require_once ("fonc_parc.inc.php"); 30 31 ########### 32 // Internationnalisation 33 $prefix = "action_parc"; 34 //$lang="en"; 35 require_once("messages/$lang/" . $prefix . "_messages.php"); 36 ########### 37 //aide 38 $_SESSION["pageaide"] = "Gestion_des_parcs#Action_sur_parcs"; 39 //** Ajout de javascript local 40 ########## 41 ?> 42 <script type="text/javascript" src="/elements/js/wz_tooltip_new.js"></script> 43 <? 44 45 ######### 46 //***************Definition des droits de lecture et aide en ligne 47 // Verifie les droits 48 if ((is_admin("computers_is_admin", $login) == "Y") or (is_admin("parc_can_view", $login) == "Y") or (is_admin("parc_can_manage", $login) == "Y") or 49 (is_admin("inventaire_can_read", $login) == "Y")) { 50 51 echo "<h1>" . gettext("$action_parc[pageTitre]") . "</h1>"; 52 53 //*****************cas des parcs delegues***********************************/ 54 if ((is_admin("computers_is_admin", $login) == "N") and ((is_admin("parc_can_view", $login) == "Y") or (is_admin("parc_can_manage", $login) == "Y"))) { 55 echo "<h3>" . gettext($action_parc['msgDelegationAccept']) . "</h3>"; 56 $acces_restreint = 1; 57 58 $list_delegate = list_parc_delegate($login); 59 60 if (count($list_delegate) > 0) { 61 $delegate = "yes"; 62 } else { 63 echo "<center>"; 64 echo $action_parc['msgNoDelegation']; 65 echo "</center>\n"; 66 exit; 67 } 68 } 69 70 /* * *********************** Declaration des variables *********************************** */ 71 $action = $_POST['action']; 72 if (!$action) { 73 $action = $_GET['action']; 74 } 75 $parc = $_POST['parc']; 76 if (!$parc) { 77 $parc = $_GET['parc']; 78 } 79 80 if ($action == "") { 81 $action = "detail"; 82 } 83 if ($action == "choix_time") { 84 $action = "detail"; 85 } 86 87 switch ($action) { 88 89 case "detail": 90 91 $list_parcs = search_machines("objectclass=groupOfNames", "parcs"); 92 if (count($list_parcs) > 0) { 93 sort($list_parcs); 94 echo "<CENTER>"; 95 echo "<FORM method=\"post\" action=\"action_parc.php\">\n"; 96 echo "<SELECT NAME=\"parc\" SIZE=\"1\" onchange=submit()>"; 97 echo "<option value=\"SELECTIONNER\">" . $action_parc['msgSelect'] . "</option>"; 98 if ($delegate == "yes") { 99 100 foreach ($list_delegate as $info_parc_delegate) { 101 echo "<option value=\"" . $info_parc_delegate . "\""; 102 if ($parc == $info_parc_delegate) { 103 echo " selected"; 104 } 105 echo ">$info_parc_delegate</option>\n"; 106 } 107 } else { 108 for ($loop = 0; $loop < count($list_parcs); $loop++) { 109 echo "<option value=\"" . $list_parcs[$loop]["cn"] . "\""; 110 if ($parc == $list_parcs[$loop]["cn"]) { 111 echo " selected"; 112 } 113 echo ">" . $list_parcs[$loop]["cn"] . "\n"; 114 echo "</option>"; 115 } 116 } 117 echo "</SELECT> \n"; 118 echo "<img onmouseout=\"UnTip();\" onmouseover=\"Tip('" . gettext($action_parc['msgSelectParc']) . "',WIDTH,250,SHADOW,true,DURATION,5000);\" name=\"action_image2\" src=\"../elements/images/system-help.png\" alt=\"help\"> "; 119 // echo "<input type=\"submit\" value=\"".gettext("Valider")."\">\n"; 120 echo "</FORM>\n"; 121 echo "</CENTER>\n"; 122 echo "<br>"; 123 } else { 124 echo "<br><center>"; 125 echo gettext($action_parc['msgNoParc']); 126 echo "</center>\n"; 127 } 128 129 130 if (($parc != "") && ($parc != "SELECTIONNER")) { 131 // smbstatus(); 132 echo "<CENTER><table align=center><tr>\n"; 133 echo "<td><form action=\"wolstop_station.php\" method=\"post\">\n"; 134 echo "<input type=\"hidden\" name=\"wolstop_station.php\" value=\"shutdown\" />"; 135 echo "<input type=\"hidden\" name=\"parc\" value=\"$parc\" />"; 136 echo "<input type=\"hidden\" name=\"action\" value=\"stop\" />"; 137 echo "<input type=\"submit\" value=\"" . gettext($action_parc['btnEteindreTitre']) . "\" onclick=\"if (window.confirm('" . $action_parc['msgConfirmEteindre'] . "')) {return true;} else {return false;}\" />"; 138 echo "</form></td>"; 139 140 echo "<td><form action=\"wolstop_station.php\" method=\"post\">\n"; 141 echo "<input type=\"hidden\" name=\"action_poste\" value=\"wol\" />"; 142 echo "<input type=\"hidden\" name=\"parc\" value=\"$parc\" />"; 143 echo "<input type=\"hidden\" name=\"action\" value=\"start\" />"; 144 echo "<input type=\"submit\" value=\"" . gettext($action_parc['btnAllumerTitre']) . "\" />"; 145 echo "</form></td>"; 146 147 //=================================== 148 echo "<td><form action=\"wolstop_station.php\" method=\"post\">\n"; 149 echo "<input type=\"hidden\" name=\"action_poste\" value=\"reboot\" />"; 150 echo "<input type=\"hidden\" name=\"parc\" value=\"$parc\" />"; 151 echo "<input type=\"hidden\" name=\"action\" value=\"reboot\" />"; 152 echo "<input type=\"submit\" value=\"" . gettext($action_parc['btnRebooterTitre']) . "\" onclick=\"if (window.confirm('" . $action_parc['msgConfirmRebooter'] . "')) {return true;} else {return false;}\" />"; 153 echo "</form></td>"; 154 //=================================== 155 // Test le niveau de delegation 156 // manage ou view 157 // Si manage on peut aller sur programmer 158 $niveau_delegation = niveau_parc_delegate($login, $parc); 159 if ($niveau_delegation != "view") { 160 echo "<td><form action=\"wolstop_station.php\" method=\"post\">\n"; 161 echo "<input type=\"hidden\" name=\"programmation\" value=\"check\" />"; 162 echo "<input type=\"hidden\" name=\"parc\" value=\"$parc\" />"; 163 echo "<input type=\"hidden\" name=\"action\" value=\"timing\" />"; 164 echo "<input type=\"submit\" value=\"" . gettext($action_parc['btnProgrammerTitre']) . "\" />"; 165 echo "</form>\n"; 166 echo "</td>\n"; 167 } 168 echo "<td><form action=\"show_parc.php\" method=\"post\">\n"; 169 echo "<input type=\"hidden\" name=\"parc\" value=\"$parc\" />"; 170 echo "<input type=\"submit\" value=\"".gettext($action_parc['btnListerTitre'])."\" />"; 171 echo "</form>\n"; 172 echo "</td>\n"; 173 echo "</tr>\n"; 174 175 echo "<tr>\n"; 176 // echo "<td colspan=\"3\" align=\"center\"><form action=\"action_parc.php\" method=\"post\">\n"; 177 echo "<td colspan=\"4\" align=\"center\"><form action=\"action_parc.php\" method=\"post\">\n"; 178 echo "<input type=\"hidden\" name=\"action_poste\" value=\"check\" />"; 179 echo "<input type=\"hidden\" name=\"parc\" value=\"$parc\" />"; 180 echo "<input type=\"hidden\" name=\"action\" value=\"detail\" />"; 181 echo "<input type=\"submit\" value=\"" . gettext($action_parc['btnRafraichirTitre']) . "\" />"; 182 echo "</form>\n"; 183 184 echo "</td></tr></table>\n"; 185 186 echo "</center>\n"; 187 188 189 require_once ("printers.inc.php"); 190 191 192 global $smbversion; 193 echo "\n<br>\n<CENTER>\n"; 194 echo "<TABLE border=1 width=\"60%\">\n<tr class=menuheader style=\"height: 30\">\n"; 195 echo "<td align=\"center\"></td>\n"; 196 echo "<td align=\"center\">" . $action_parc['arrayStationTitre'] . "</td>\n"; 197 echo "<td align=\"center\">" . $action_parc['arrayIp'] . "</td>\n"; 198 echo "<td align=\"center\">" . $action_parc['arrayEtatTitre'] . "</td>\n"; 199 echo "<td align=\"center\">" . $action_parc['arrayConnexionTitre'] . "</td>\n"; 200 echo "<td align=\"center\">" . $action_parc['arrayControleTitre'] . "</td>\n"; 201 echo "<td align=\"center\">" . $action_parc['arrayLogonTitre'] . "</td></tr>\n"; 202 203 $mp_all = gof_members($parc, "parcs", 1); 204 205 // Filtrage selon critere 206 if ("$filtrecomp" == "") { 207 $mp = $mp_all; 208 } else { 209 $lmloop = 0; 210 $mpcount = count($mp_all); 211 for ($loop = 0; $loop < count($mp_all); $loop++) { 212 $mach = $mp_all[$loop]; 213 if (preg_match("/$filtrecomp/", $mach)) { 214 $mp[$lmloop++] = $mach; 215 } 216 } 217 } 218 219 if (count($mp) > 0) { 220 sort($mp); 221 for ($loop = 0; $loop < count($mp); $loop++) { 222 $mpenc = urlencode($mp[$loop]); 223 $mp_en_cours = urldecode($mpenc); 224 $mp_curr = search_machines("(&(cn=$mp_en_cours)(objectClass=ipHost))", "computers"); 225 226 // Test si on a une imprimante ou une machine 227 $resultat = search_imprimantes("printer-name=$mp_en_cours", "printers"); 228 $suisje_printer = "0"; 229 for ($loopp = 0; $loopp < count($resultat); $loopp++) { 230 if ($mp_en_cours == $resultat[$loopp]['printer-name']) { 231 $suisje_printer = "1"; 232 continue; 233 } 234 } 235 236 // On teste si la machine a des connexions actives 237 // en fonction de la version de samba 238 // On ne rentre dedans que si on est pas une imprimante 239 240 if ($suisje_printer != "1") { 241 // Inventaire 242 //$sessid=session_id(); 243 if (file_exists("/var/www/se3/includes/dbconfig.inc.php")) { 244 include_once "fonc_outils.inc.php"; 245 $sessid=session_id(); 246 $systemid=avoir_systemid($mpenc); 247 } 248 249 250 // Affichage du tableau 251 echo "<tr>\n"; 252 // Affichage de l'icone informatique 253 echo "<td align=\"center\">\n"; 254 if (isset($systemid)) { 255 // Type d'icone en fonction de l'OS - modif keyser 256 $retourOs = type_os($mpenc); 257 if($retourOs == "0") { $icone="computer_disable.png"; } 258 elseif($retourOs == "Linux") { $icone="linux.png"; } 259 elseif($retourOs == "XP") { $icone="winxp.png"; } 260 elseif($retourOs == "7") { $icone="win7.png"; } 261 elseif($retourOs == "98") { $icone="win.png"; } 262 else { $icone="computer_disable.png"; } 263 $ip=avoir_ip($mpenc); 264 echo "<img style=\"border: 0px solid ;\" src=\"../elements/images/$icone\" title=\"".$retourOs." - ".$ip."\" alt=\"$retourOs\" WIDTH=20 HEIGHT=20 onclick=\"popuprecherche('../ocsreports/machine.php?sessid=$sessid&systemid=$systemid','popuprecherche','scrollbars=yes,width=500,height=500');\">"; 265 266 //echo "<img style=\"border: 0px solid ;\" src=\"../elements/images/computer.png\" onclick=\"popuprecherche('../ocsreports/machine.php?sessid=$sessid&systemid=$systemid','popuprecherche','scrollbars=yes,width=500,height=500');\" title=\"Station\" alt=\"Station\"></td>\n"; 267 } else { 268 echo "<img style=\"border: 0px solid ;\" src=\"../elements/images/computer_disable.png\" alt=\"Ordinateur\" WIDTH=20 HEIGHT=20 >"; 269 270 //echo "<img style=\"border: 0px solid ;\" src=\"../elements/images/computer.png\" title=\"Station\" alt=\"Station\"></td>\n"; 271 } 272 echo "<td align=center ><a href=show_histo.php?selectionne=2&mpenc=$mp_en_cours>$mp_en_cours</a></td>\n"; 273 $iphost = $mp_curr[0]["ipHostNumber"]; 274 echo "<td align=center>$iphost</td>\n"; 275 echo "<td align=center>\n"; 276 //$etat 277 278 279 echo "<div id='divip$loop'><img src=\"../elements/images/spinner.gif\"></img></div>\n"; 280 281 echo "<script type='text/javascript'> 282 // <![CDATA[ 283 new Ajax.Updater($('divip$loop'),'parcs_ajax_lib.php',{method: 'post', parameters: '?ip=$iphost&parc=$parc&nom_machine=" . $mp[$loop] . "&mode=ping_ip' }); 284 //]]> 285 </script>\n"; 286 287 echo "</td>\n"; 288 echo "<td align=center>\n"; 289 //$etat_session 290 291 echo "<div id='divsession$loop'><img src=\"../elements/images/spinner.gif\"></img></div>\n"; 292 293 echo "<script type='text/javascript'> 294 // <![CDATA[ 295 new Ajax.Updater($('divsession$loop'),'parcs_ajax_lib.php',{method: 'post', parameters: '?nom_machine=" . $mp[$loop] . "&mode=session'}); 296 //]]> 297 </script>\n"; 298 299 echo "</td>\n"; 300 echo "<td align=\"center\">"; 301 302 echo "<div id='divtsvnc$loop'><img src=\"../elements/images/spinner.gif\"></img></div>\n"; 303 304 echo "<script type='text/javascript'> 305 // <![CDATA[ 306 new Ajax.Updater($('divtsvnc$loop'),'parcs_ajax_lib.php',{method: 'post', parameters: '?ip=$iphost&mode=ts_vnc'}); 307 //]]> 308 </script>\n"; 309 310 echo "</td>"; 311 echo "</td>\n"; 312 echo "<td align=\"center\">"; 313 314 echo "<div id='divlogon$loop'><img src=\"../elements/images/spinner.gif\"></img></div>\n"; 315 316 echo "<script type='text/javascript'> 317 // <![CDATA[ 318 new Ajax.Updater($('divlogon$loop'),'parcs_ajax_lib.php',{method: 'post', parameters: '?nom_machine=" . $mp[$loop] . "&ip=" . $iphost . "&mode=test_logon'}); 319 //]]> 320 </script>\n"; 321 322 echo "</td></tr>\n"; 323 } 324 } 325 } 326 echo "</table>\n"; 327 echo "</center>\n"; 328 echo "<br>"; 329 detail_parc_printer($parc); 330 //$heure_act=date("H"); 331 $nomjour = date("l"); 332 // echo $nomjour; 333 } 334 335 switch ($nomjour) { 336 337 case "Monday": 338 $nomjour = "l"; 339 break; 340 341 case "Tuesday": 342 $nomjour = "ma"; 343 break; 344 345 case "Wednesday": 346 $nomjour = "me"; 347 break; 348 349 case "Thursday": 350 $nomjour = "j"; 351 break; 352 353 case "Friday": 354 $nomjour = "v"; 355 break; 356 357 case "Saturday": 358 $nomjour = "s"; 359 break; 360 361 case "Sunday": 362 $nomjour = "d"; 363 break; 364 } 365 366 $resultf = mysql_query("select heure,action from actionse3 where parc='$parc' and jour='$nomjour' ;", $authlink) or die("Impossible d'effectuer la requete"); 367 if ($resultf) { 368 if (mysql_num_rows($resultf) > 0) { 369 while ($row = mysql_fetch_row($resultf)) { 370 if ($row[1] == "wol") { 371 echo "<h3>" . gettext($action_parc['msgPoweronAction']) . " $row[0] " . gettext("ce jour") . "</h3>"; 372 } 373 if ($row[1] == "stop") { 374 echo "<h3>" . gettext($action_parc['msgShutdownAction']) . " $row[0] " . gettext("ce jour") . "</h3>"; 375 } 376 } 377 } else { 378 if (($parc != "") && ($parc != "SELECTIONNER")) { 379 echo "<h3>" . gettext($action_parc['msgNoActions']) . " $parc</h3>"; 380 } 381 } 382 } 383 break; 384 } 385 386 // echo "</div>"; 387 } 388 389 require ("pdp2.inc.php"); 390 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |