function gw_waitForStartup() { $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); $kannelSmscOnlineStatus = "online"; $kannelStatusUrl = loadKannelStatusUrl(); // first get the total number of SMSCs $kannelStatusXml = file_get_contents($kannelStatusUrl); $ids = explode(' ', get_smscids('', $kannelStatusXml)); $numIds = count($ids); // now keep waiting until the number of // online SMSCs equals the total number // echo "waiting..."; while ($numIds != check_status($kannelSmscOnlineStatus, $kannelStatusXml)) { echo "."; sleep(5); $kannelStatusXml = file_get_contents($kannelStatusUrl); } echo "\n"; xml_parser_free($xml_parser); }
echo "<hr size=1>\n"; echo "(all) {$sum} links <br />\n"; ?> </td><td valign=top align=right class=text> <?php $sum = 0; foreach ($configs as $inst => $config) { $x = check_status("unknown", $status[$inst]); $sum += $x; echo "({$inst}) "; if ($x == 0) { echo "<span class=text>none</span>"; } else { echo "<a href=\"#\" class=href onClick=\"do_alert('"; echo "smsc-ids in unknown state are\\n\\n"; echo get_smscids("unknown", $status[$inst]); echo "');\"><span class=text><b>{$x}</b> links</span></a>"; } echo "<br />\n"; } echo "<hr size=1>\n"; echo "(all) {$sum} links <br />\n"; ?> </td><td valign=top align=right class=text> </td></tr> </table> </p> <?php if (!empty($HTTP_GET_VARS[details])) {
function make_link($smsc_status, $state, $mode = 'red') { global $status, $inst; if ($state == 'total') { return $smsc_status > 0 ? "{$smsc_status} links" : "none"; } elseif ($smsc_status[$state] == 0) { return "none"; } else { switch ($mode) { case 'red': return "<a href=\"#\" class=href onClick=\"do_alert('" . "smsc-ids in {$state} state are\\n\\n" . get_smscids($state, $status[$inst]['smscs']) . "');\"><span class=red><b>" . $smsc_status[$state] . "</b> links</span></a>"; break; case 'green': return "<span class=green><b>" . $smsc_status[$state] . "</b> links</span></a>"; break; } } }