Exemple #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);
}
Exemple #2
0
 public function signUp($user_array)
 {
     //* Check user does not exist
     $sql = 'select count(*) as c from users where email=?';
     $count = $this->db->getOne($sql, $user_array['email']);
     #echo $count."#";
     if ($count > 0) {
         //throw new fgException('user email already exists',
         //						"An account with the email '".$user_array['email']."'is already on the system");
     }
     //** Insert user to database
     $User = new fgUser(0);
     $User->name = $user_array['name'];
     $User->email = $user_array['email'];
     $User->callsign = $user_array['callsign'];
     $User->irc = $user_array['irc'];
     $User->cvs = $user_array['cvs'];
     $User->location = $user_array['location'];
     $User->email = $user_array['email'];
     $User->save();
     //** set up security
     $User->setPassword($user_array['pass']);
     $User->genToken();
     //** Send email
     $User->sendEmail('ack');
 }