Simbrief Edit & Download Latest OFP (#1228)
* SimBrief OFP Edit Changes aim to have ability of editing generated SimBrief Flight Plans and re-downloading. * Move url to config * Blade update and $uri change * Update simbrief_form.blade.php Used `$flight->id` along with `$user->ident` to have a more unique static id value. No details given for that fields uniqueness requirements, this will be ok I think though. Also we are passing user's simbrief userid with api to find the flight plan, both combined, no chance to get another users plan and/or any other plan of same user. * Update SimBriefController.php Move `static_id` to controller * Update simbrief_form.blade.php Read `static_id` from controller * StyleFix * Update phpvms.php * Update SimBriefService.php Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
This commit is contained in:
@@ -26,11 +26,13 @@ class SimBriefService extends Service
|
||||
* Check to see if the OFP exists server-side. If it does, download it and
|
||||
* cache it immediately
|
||||
*
|
||||
* @param string $user_id User who generated this
|
||||
* @param string $ofp_id The SimBrief OFP ID
|
||||
* @param string $flight_id The flight ID
|
||||
* @param string $ac_id The aircraft ID
|
||||
* @param array $fares Full list of fares for the flightß
|
||||
* @param string $user_id User who generated this
|
||||
* @param string $ofp_id The SimBrief OFP ID
|
||||
* @param string $flight_id The flight ID
|
||||
* @param string $ac_id The aircraft ID
|
||||
* @param array $fares Full list of fares for the flight
|
||||
* @param string $sb_userid User's Simbrief ID (Used for Update)
|
||||
* @param string $sb_static_id Static ID for the generated OFP (Used for Update)
|
||||
*
|
||||
* @return SimBrief|null
|
||||
*/
|
||||
@@ -39,10 +41,18 @@ class SimBriefService extends Service
|
||||
string $ofp_id,
|
||||
string $flight_id,
|
||||
string $ac_id,
|
||||
array $fares = []
|
||||
array $fares = [],
|
||||
string $sb_user_id = null,
|
||||
string $sb_static_id = null
|
||||
) {
|
||||
$uri = str_replace('{id}', $ofp_id, config('phpvms.simbrief_url'));
|
||||
|
||||
if ($sb_user_id && $sb_static_id) {
|
||||
// $uri = str_replace('{sb_user_id}', $sb_user_id, config('phpvms.simbrief_update_url'));
|
||||
// $uri = str_replace('{sb_static_id}', $sb_static_id, $uri);
|
||||
$uri = 'https://www.simbrief.com/api/xml.fetcher.php?userid='.$sb_user_id.'&static_id='.$sb_static_id;
|
||||
}
|
||||
|
||||
$opts = [
|
||||
'connect_timeout' => 2, // wait two seconds by default
|
||||
'allow_redirects' => false,
|
||||
|
||||
Reference in New Issue
Block a user