Ejemplo n.º 1
0
<?php

require_once '../config/config.inc.php';
//$url = "sshttp://mpmap02.flightgear.org/fg_server_xml.cgi?mpserver02.flightgear.org:5001s";
//$xml_string = file_get_contents($url);
//echo "<pre>";
//print_r($xml_string);
//die;
//* Feed object
$Feed = new fgFeed();
$Response = new fgResponse();
try {
    //*  Process Request
    $feed_requested = isset($_REQUEST['feed']) ? $_REQUEST['feed'] : null;
    if ($feed_requested) {
        $Feed->validateFeed($feed_requested);
        $Response->add($Feed->getFeed($feed_requested));
    } else {
        $Response->add($Feed->welcomeIndex());
    }
    //header('Content-type: text/plain');
    //echo json_encode($data);
    $Response->sendPayload();
} catch (fgException $e) {
    //echo 'Caught exception: ',  $e->getMessage(), "\n";
    $Response->sendError($e);
}
Ejemplo n.º 2
0
            //echo "aer_id=".$aero_id;
            $obj = new fgAero($aero_id > 0 ? $aero_id : 0);
            $obj->aero = $Req->aero;
            $obj->directory = $Req->directory;
            $obj->name = $Req->description;
            $obj->description = '';
            $obj->xml_set = $Req->xml_set;
            $obj->splash = $Req->splash;
            $obj->fdm = $Req->get('flight-model');
            $obj->status = $Req->status;
            $obj->active = $Req->active;
            $obj->save();
            //$db->debug=0;
            if ($Req->author != '') {
                $user_id = fgUser::find('name', $Req->author);
                if (!$user_id) {
                    $User = new fgUser(0);
                    $User->name = $Req->author;
                    $user_id = $User->save();
                }
                $obj->addAuthor($user_id);
                $Response->add('aero_id', $aero_id);
            }
            break;
        default:
            throw new fgException('unhandled action', "The action '" . $action . "'is not handled");
    }
    $Response->sendPayload();
} catch (fgException $e) {
    $Response->sendError($e);
}
Ejemplo n.º 3
0
//***************************************************
require_once '../config/config.inc.php';
$Response = new fgResponse();
//print_R($smarty);
//$Site = new fgSite('rpc','RPC');
fgHelper::plain();
try {
    //* check action is set
    $fetch = isset($_REQUEST['fetch']) ? $_REQUEST['fetch'] : null;
    if (!$fetch) {
        throw new fgException('no fetch', 'fetch variable set');
    }
    //* perform on action
    switch ($fetch) {
        case 'servers':
            $Response->add('servers', fgServer::index());
            break;
        case 'users':
            $Response->add('users', fgUser::index());
            break;
        case 'aircraft':
            $Response->add('aircraft', fgAero::index());
            break;
        case 'aero_info':
            $Aero = new fgAero($_REQUEST['aero_id']);
            $smarty->assign('Aero', $Aero);
            $html = $smarty->fetch("aircraft/ajax.aero.html");
            //echo $html;
            $Response->add('images', $Aero->images());
            $Response->add('aero', $Aero->data());
            $Response->add('html', $html);