*/ require_once '../include/common.php'; require_once '../include/language.php'; require_once 'ws/classes/WifidogWS.php'; require_once 'ws/classes/WSOutput.php'; include_once 'ws/classes/Exceptions/WSException.php'; /** * Process the input parameter **/ if (isset($_GET['v'])) { $version = $_GET['v']; unset($_GET['v']); } else { $version = 1; } $service = WifidogWS::webServiceFactory($version); /** * This custom exception handler returns the exception */ function wifidog_exception_handler($e) { global $service; $output = $service->getOutput(); $exceptionClass = get_class($e); if (!is_null($output)) { if ($exceptionClass == 'WSException') { echo $output->outputError(array('type' => $exceptionClass, 'message' => sprintf(_("Web service exception: %s (%s)"), $e->getMessage(), $e->getCode()))); } else { echo $output->outputError(array('type' => $exceptionClass, 'message' => sprintf(_("Detailed error was: Uncaught %s %s (%s) thrown in file %s, line %d"), get_class($e), $e->getMessage(), $e->getCode(), $e->getFile(), $e->getLine()))); } } else {
/** * Set the web service parameters * @param $params the arrray of GET parameters */ public function setParams($params = array()) { if (isset($params['action'])) { $this->_action = $params['action']; unset($params['action']); } if (isset($params['object_class'])) { $this->_objectClass = $params['object_class']; unset($params['object_class']); } if (isset($params['object_id'])) { $this->_objectId = $params['object_id']; unset($params['object_id']); } if (isset($params['fields'])) { $this->_fields = $params['fields']; unset($params['fields']); } parent::setParams($params); }