function show() { ob_start(); $xml = ''; $xml .= '<GS_XML_Application>' . "\n"; $xml .= '<Display>' . "\n"; $xml .= $this->_specificXML(); $xml .= '</Display>' . "\n"; if (!$this->_softkeys) { $softkeys = new GrandstreamXMLSoftkeys(); $softkeys->add(0, 'Exit', 'quit'); $this->_softkeys = $softkeys; } $xml .= $this->_softkeys->asXML(); if ($this->_events) { $xml .= $this->_events->asXML(); } $xml .= '</GS_XML_Application>' . "\n"; print $xml; if (!headers_sent()) { header('Content-Type: application/xml'); header('Content-Length: ' . (int) @ob_get_length()); } @ob_end_flush; }
require_once GS_DIR . 'inc/db_connect.php'; include 'grandstream-class.php'; $info = trim(@$_REQUEST['info']); if (!preg_match('/(system|user|phone)/', $info)) { $info = 'system'; } $url = 'http://192.168.8.11/gemeinschaft/prov/grandstream/xml/'; # db connect $db = gs_db_slave_connect(); # ip $remote_ip = trim(@$_SERVER['REMOTE_ADDR']); # user_id $user_id = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `current_ip`=\'' . $db->escape($remote_ip) . '\''); # define softkeys $keys = new GrandstreamXMLSoftkeys(); $keys->add(0, 'System Info', 'url', $url . 'test.php?info=system'); $keys->add(1, 'User Info', 'url', $url . 'test.php?info=user'); $keys->add(2, 'Phone Info', 'url', $url . 'test.php?info=phone'); $keys->add(4, 'Exit', 'quit'); $y = 7; $screen = new GrandstreamXMLScreen(); if ($info === 'system') { $screen->addString(0, 'System Info', 107, 0, 'font="f18c" halign="Center" valign="Top"'); # asterisk version $err = 0; $out = array(); @exec('sudo asterisk -rx \'core show version\' 2>>/dev/null', $out, $err); if ($err === 0) { $out = trim(implode(' ', $out)); //$out = htmlEnt($out); $screen->addString(1, $out, 0, $y = $y + 13, 'font="f13h"');