Ejemplo n.º 1
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);
}