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'); }
//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); }
//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); $Response->add('info', $Aero->info()); break; default: