$marque]
\r\n"; array_push($lselect,$marque); } } } /** * Parser * @Parametres * @Return */ function characterData0($parser, $data) { } /** * Parser * @Parametres * @Return */ function finElement($parser, $name) { global $filiation; array_pop($filiation); } /** * Parser * @Parametres * @Return */ Function debutElement1($parser, $name, $attrs) { global $marqueOk,$version,$versionOk,$filiation,$lselect,$pmarque,$pversion; array_push($filiation,$name); if ($name=="MARQUE") { if ($attrs['NOM']==$pmarque){$marqueOk=true;}else{$marqueOk=false;}; } if ($name=="VERSION" and $marqueOk) { if ($attrs['VER']!='') {$version=$attrs['VER']; // echo "[$pmarque] $version"; $versionOk=true; $version=$attrs['VER']; if ($pmarque!='' and $pversion==''){ array_push($lselect,$version);} } else { $versionOk=false; } } } /** * parser * @Parametres * @Return */ function characterData1($parser, $data) { global $marqueOk,$filiation; end($filiation); $element=current($filiation); // if ($element=="DRIVER" and $marqueOk) // {print " (driver : $data)
\r\n"; // } } /** * parser * @Parametres $parser $name $attrs * @Return */ function debutElement2($parser, $name, $attrs) { global $pversion,$versionOk,$pmarque,$marqueOk,$filiation; array_push($filiation,$name); if ($name=="MARQUE") { if ($attrs['NOM']==$pmarque){$marqueOk=true;}else{$marqueOk=false;}; } if ($name=="VERSION") { if ($attrs['VER']==$pversion and $marqueOk) { $versionOk=true; // echo "[$pmarque] $pversion
\r\n"; } else { $versionOk=false; } } } /** * Parse a partir de parser les data * @Parametres $parser $data * @Return */ function characterData2($parser, $data) { global $versionOk,$filiation,$lselect,$pmarque,$pversion,$pdriver,$pport,$ptype; end($filiation); $element=current($filiation); if ($element=="DRIVER" and $versionOk){$pdriver=$data;} if ($element=="TYPE" and $versionOk) {$ptype=$data;} if ($element=="CABLE" and $versionOk){ // echo "$data
\r\n"; array_push($lselect,$data); } } /** * Genere un etat sous forme de tableau de l'onduleur * @Parametres $ups_location nom de l'onduleur * @Return Un tableau HTML */ function affichage_ups($ups_location) { // Genere un etat sous forme de tableau de l'onduleur // $ups_location = "myups@127.0.0.1"; $text .= "

"; if(file_exists("/etc/nut/ipmaster")) { $ip=exec("cat /etc/nut/ipmaster"); $text .= gettext("Connected on ups of $ip"); $text .= "

"; } if(file_exists("/etc/nut/ipslave")) { $ip=exec("cat /etc/nut/ipslave"); $text .= gettext("UPS master for $ip"); $text .= "

"; } $text .= ""; $text .= ""; $text .= ""; $ups_test = exec("upsc $ups_location"); if ($ups_test=="") { $text .= ""; } else { $text .= ""; $ups_status = exec("upsc $ups_location ups.status"); if (preg_match("/OL/i","$ups_status")) { $text .= ""; $ups_battery = exec("upsc $ups_location battery.charge"); if ($ups_battery > 30) { $text .= ""; } $text .= "
ModelStatusBatteryInputOutputLoad
"; $text .= "NO UPS DETECTED"; $text .= ""; $text .= exec ("upsc $ups_location ups.mfr"); $text .= " - "; $text .= exec ("upsc $ups_location ups.model"); $text .= ""; $text .= "ONLINE"; } elseif (preg_match("/OB/i","$ups_status")) { $text .= ""; $text .= "ON BATTERY"; } else { $text .= ""; } $text .= ""; } else { $text .= ""; } $text .= "$ups_battery"; $text .= " %"; $text .= exec("upsc $ups_location input.voltage"); $text .= " VAC"; $text .= exec("upsc $ups_location output.voltage"); $text .= " VAC"; $text .= exec("upsc $ups_location ups.load"); $text .= " %
"; return $text; }