diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..9f1ec53 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,82 @@ +# Cardinal Horizon phpVMS Module Software License + +## Preamble + +This license agreement has been created with the goal of addressing the following concerns: + +* Licensing software for source accessible software (i.e. php is a interpreted language) when DRM and encryption are +practically impossible or too expensive to implement. +* The needs to modify the software to best suit the user with enough protections in place to prevent those modifications +and software from being redistributed. + +To make it simple to read and understand, the license agreement has been broken down into a more "question and answer" +format. The examples provided do not constitute all the situations that may be encountered for a specific clause in the +agreement, and therefore are only intended as guidance. + +If you have any questions, feel free to email taylor@cardinalhorizon.com. + +## Whom is this agreement applicable? + +This license agreement is by and between Taylor Broad, d/b/a Cardinal Horizon (Software Provider) and You (Licensee). + +## What does the agreement apply to? + +This agreement covers the access and use of the phpVMS addons developed by the Software Provider, in both binary and +source code for the addons that references this agreement in the documentation and/or version control, hereafter known as the “Software”. + +## What am I receiving? +The Licensee is receiving a license to use the Software for their personal use. + +The Licensee is **not** receiving ownership of the Software, nor is the Software being created under a work-for-hire agreement. + +## What can I do with the software? + +- Use the software as part of your phpVMS based website. +- Modify the software as needed/desired to best fit your needs. + - Modifications to the software fall under the same terms of this license agreement (i.e. Copy-left) + +## What can I NOT do with the software? + +Unless prior written consent has been obtained from the Software Provider, the following is not permitted. + +- Alteration or removal of any notices, including, but not limited to: copyright notices, attribution, and licenses. +- Use, reverse engineer, or modify for non-phpVMS based environments. +- Redistribute the original software and modifications to anyone other than yourself. + - If the Licensee desires to distribute the software to other individuals to perform work-for-hire for the Licensee, the Licensee +**shall** notify the Software Provider for approval. +- Commercial use, defined as any use where the Licensee receives a monetary benefit for use of the software. + - E.g. you charge a membership fee for your community. +- Advertise the software as their own proprietary (in-house, exclusive) software +- Obfuscate the origins of the software. + +## Am I responsible for anything? +The Licensee shall make the best effort to protect the access to the software to prevent its download and acquisition +by those who didn't accept this license agreement. + +In cases where there is a breach where the software is stolen, the Licensee shall notify the Software Provider as soon +as practical. + +## What if I violate the license agreement? +You will be allotted 15 days to cure the breach upon written notice or face immediate agreement termination. + +In the event of termination the Licensee must destroy any and all copies of the Software, and provide confirmation of +doing so within 7 days of termination of the agreement. + +## The other legal stuff +### Warranties + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### Copyright Notice +Unless prior written permission is granted, The Licensee agrees to display an appropriate copyright and attribution notice +on the website where the software is used. + +### Modification + +The Software Provider retains the right to change the software agreement at any time. + +If the Software Provider notifies you of a change to the license terms, you have 30 days to accept the new license agreement. +Updating or continuing the use of the software constitutes acceptance of the new license terms. diff --git a/Listeners/DeleteFlights.php b/Listeners/DeleteFlights.php index a348b0a..1eced72 100644 --- a/Listeners/DeleteFlights.php +++ b/Listeners/DeleteFlights.php @@ -39,24 +39,38 @@ public function handle($event) // Find all the flights $flights = Flight::where('owner_type', CHFreeFlightProvider::class)->get(); + Log::debug("found ".$flights->count()." CHFreeFlight flights"); // We're going to only delete flights that don't have a bid, or a pirep that's completed. foreach ($flights as $flight) { - + $flight->visible = false; + $flight->save(); + Log::debug("Processing ".$flight->id); // if Pirep is in progress, then don't do anything. $pirep = Pirep::where(['flight_id' => $flight->id, 'user_id' => $flight->user_id])->first(); - if ($pirep->state == PirepState::IN_PROGRESS) { - continue; + + if ($pirep) { + if ($pirep->state == PirepState::IN_PROGRESS) { + continue; + } elseif ($pirep->state == PirepState::PENDING || + $pirep->state == PirepState::ACCEPTED || + $pirep->state == PirepState::REJECTED) + { + Log::debug("Deleted ".$flight->id); + $flight->delete(); + continue; + } } // Check if there's a bid. $bids = Bid::where('flight_id', $flight->id)->count(); if ($bids == 0) { + Log::debug("Deleted ".$flight->id); $flight->delete(); + continue; } - $flight->visible = false; - $flight->save(); + } } } diff --git a/README.md b/README.md index 5063249..4649ad0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # CH Free Flight for phpVMS 7 -Welcome to CH Free Flight, a free flight module for phpVMS 7. This module allows for users to create their own flights, which can be used with SimBreif. +Welcome to CH Free Flight, a free flight module for phpVMS 7. This module allows for users to create their own flights, which can be used with SimBrief. -# Installation -Drag the module into the modules folder, then enable it in the admin panel. +## License Agreement +By downloading and running this software, you agree to the terms and conditions outlined by the Cardinal Horizon phpVMS +Module Software License. A copy is included in this repository +## Installation +Once Downloaded, extract the module folder, with this readme included, into your phpVMS modules folder. + +Once extracted, go into your phpVMS admin panel and enable the module. If the module doesn't appear, clear +your application cache under Admin > Maintenance. + +Finally, enable the module. You should see Free Flight in the default navigation at the top.