- exec: documentation ( source)
- define: documentation ( source)
<?php
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT.'/inc/includes.php');
include_once('../inc/portswitch.class.php');
// Status aktualisieren
if (isset($_SESSION['port_changed'])) {
$changed = $_SESSION['port_changed'];
unset($_SESSION['port_changed']);
if(PluginPortswitchPortswitch::$config_data[$changed]['link'] != '0.0.0.0') {
PluginPortswitchPortswitch::$config_data[$changed]['link'] = exec('../scripts/checkport.sh '.PluginPortswitchPortswitch::$config_data[$changed]['ip'].' '.PluginPortswitchPortswitch::$config_data[$changed]['port'].' '.PluginPortswitchPortswitch::$config_data[$changed]['passwort'].' '.PluginPortswitchPortswitch::$config_data[$changed]['stack'].' '.PluginPortswitchPortswitch::$config_data[$changed]['hostname']);
} else {
PluginPortswitchPortswitch::$config_data[$changed]['link'] = 'Konnte nicht abgefragt werden. (Konfiguration prüfen!)';
}
PluginPortswitchPortswitch::saveConfig();
}
for($i = 0; $i < sizeof(PluginPortswitchPortswitch::$config_data); $i++)
{
?>
<h1><?php echo PluginPortswitchPortswitch::$config_data[$i]['name']; ?> auf Switch <?php echo PluginPortswitchPortswitch::$config_data[$i]['hostname']; ?>:<?php echo PluginPortswitchPortswitch::$config_data[$i]['port']; ?> Kontrolle</h1>
<form method="POST" action="<?php echo GLPI_ROOT; ?>/plugins/portswitch/front/portswitch.form.php">
<p>
Ticketnummern (mit Komma trennen, z.B. <i>"1024,2048,..."</i>: <input type="text" name="kommentar" value="<?php echo PluginPortswitchPortswitch::$config_data[$i]['kommentar']; ?>"><br>
<input type="submit" name="Aktualisieren" value="Aktualisieren">
</p>
<p>
<input type="hidden" name="sent" value="<?php echo $i; ?>">
<input type="submit" name="deactivate" value="Deaktivieren">
<input type="submit" name="activate" value="Aktivieren">
</p>
<p> </p>
<p>
<?php
switch(PluginPortswitchPortswitch::$config_data[$i]['link']) {
case 'Down':
$color = '#FF0000';
break;
case 'Up':
$color = '#00FF00';
break;
default:
$color = '#0000FF';
}
?>
Port Link-Status: <span style="color:<?php echo $color; ?>"><?php echo PluginPortswitchPortswitch::$config_data[$i]['link']; ?></span><br>
Port Status: <?php echo PluginPortswitchPortswitch::getHtmlStatus($i); ?><br><br>
<input type="submit" name="link" value="Update Link Status">
</p>
<?php
Html::closeForm();
}
?>