function cleanup_array($arr) { if (is_array($arr) && is_array($arr['gateway'])) { $arr = $arr['gateway']; clean_branch($arr, 'wdp'); clean_branch($arr, 'sms'); clean_branch($arr, 'dlr'); $arr['boxes'] = $arr['boxes'][0]['box']; $arr['smscs'] = $arr['smscs'][0]['smsc']; } return $arr; }
//echo "<tr><td class=text valign=top align=left>\n"; /* get the status.xml URL of one config */ $url = $config["base_url"] . "/status.xml?password="******"status_passwd"]; $xml_data = ""; /* open the file description to the URL */ if ($fp = fopen($url, "r")) { $bgcolor = 'green'; /* read the XML input */ while (!feof($fp)) { $xml_data .= fread($fp, 200000); } fclose($fp); $xml_obj = new XmlToArray($xml_data); $status[$inst] = cleanup_array($xml_obj->createArray()); for ($i = 0; $i < sizeof($status[$inst]['smscs']); $i++) { clean_branch($status[$inst]['smscs'][$i], ''); } /* get the status of this bearerbox */ list($st, $started, $uptime) = parse_uptime($status[$inst]['status']); /* get the info of this bearerbox into a button, to save some screen real-estate*/ $ver = preg_replace("/\n+/", '\\n', $status[$inst]['version']); $ver = preg_replace("/[\\'\\`]/", "\\'", $ver); $ver = 'Url: ' . $config["base_url"] . '\\n\\n' . $ver; $boxstatus = array('name' => '<a class="href" style="color: green; font-weight: bold" href="#" onClick="alert(\'' . $ver . '\'); return false;">' . $config['name'] . '</a>', 'bgcolor' => 'green', 'status' => $st, 'started' => $started, 'uptime' => $uptime); } else { $boxstatus = array('name' => $config['name'], 'bgcolor' => 'red', 'status' => 'error', 'started' => '-', 'uptime' => '-'); } ?> <tr class="<?php echo $boxstatus['bgcolor']; ?>