From 8aadeb2807e7b1c58829cfab92d53e4886685d42 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <42928941+MichaelDeciso@users.noreply.github.com> Date: Fri, 11 Jan 2019 11:52:59 +0100 Subject: [PATCH] Port license page to MVC (#3118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Port license page to MVC * Use more template variables on the license page. Also make sure to handle cases where someone changes one of the variables (e.g. when creating their own product based on OPNsense). Discussed with Jos Schellevis. * Move legacy menu to Core * Use another approach to display ® * ACL fix --- plist | 5 +- .../OPNsense/Core/LicenseController.php | 46 +++++++++++++ .../mvc/app/models/OPNsense/Core/ACL/ACL.xml | 6 +- .../OPNsense/{Base => Core}/Menu/Menu.xml | 8 +-- .../mvc/app/views/OPNsense/Core/license.volt | 25 +++++++ src/www/license.php | 65 ------------------- 6 files changed, 81 insertions(+), 74 deletions(-) create mode 100644 src/opnsense/mvc/app/controllers/OPNsense/Core/LicenseController.php rename src/opnsense/mvc/app/models/OPNsense/{Base => Core}/Menu/Menu.xml (97%) create mode 100644 src/opnsense/mvc/app/views/OPNsense/Core/license.volt delete mode 100644 src/www/license.php diff --git a/plist b/plist index 1855ed0a3..fe25a28a7 100644 --- a/plist +++ b/plist @@ -332,6 +332,7 @@ /usr/local/opnsense/mvc/app/controllers/OPNsense/Core/Api/repositories/opnsense.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Core/FirmwareController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Core/IndexController.php +/usr/local/opnsense/mvc/app/controllers/OPNsense/Core/LicenseController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Cron/Api/ServiceController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Cron/Api/SettingsController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Cron/IndexController.php @@ -476,7 +477,6 @@ /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/UniqueIdField.php /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/UpdateOnlyTextField.php /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/UrlField.php -/usr/local/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml /usr/local/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuInitException.php /usr/local/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuItem.php /usr/local/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php @@ -495,6 +495,7 @@ /usr/local/opnsense/mvc/app/models/OPNsense/Core/ACL.php /usr/local/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.php /usr/local/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml +/usr/local/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml /usr/local/opnsense/mvc/app/models/OPNsense/Cron/ACL/ACL.xml /usr/local/opnsense/mvc/app/models/OPNsense/Cron/Cron.php /usr/local/opnsense/mvc/app/models/OPNsense/Cron/Cron.xml @@ -547,6 +548,7 @@ /usr/local/opnsense/mvc/app/views/OPNsense/CaptivePortal/index.volt /usr/local/opnsense/mvc/app/views/OPNsense/CaptivePortal/vouchers.volt /usr/local/opnsense/mvc/app/views/OPNsense/Core/firmware.volt +/usr/local/opnsense/mvc/app/views/OPNsense/Core/license.volt /usr/local/opnsense/mvc/app/views/OPNsense/Core/not_found.volt /usr/local/opnsense/mvc/app/views/OPNsense/Cron/index.volt /usr/local/opnsense/mvc/app/views/OPNsense/Diagnostics/arp.volt @@ -1656,7 +1658,6 @@ /usr/local/www/javascript/wizard/autosuggest.js /usr/local/www/javascript/wizard/disablekeys.js /usr/local/www/javascript/wizard/suggestions.js -/usr/local/www/license.php /usr/local/www/reboot.php /usr/local/www/reporting_settings.php /usr/local/www/services_dhcp.php diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Core/LicenseController.php b/src/opnsense/mvc/app/controllers/OPNsense/Core/LicenseController.php new file mode 100644 index 000000000..bf5d6a778 --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Core/LicenseController.php @@ -0,0 +1,46 @@ +view->pick('OPNsense/Core/license'); + } +} diff --git a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml index 78393b976..c0a979d44 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml @@ -20,14 +20,14 @@ AJAX: Get Service Providers - license.php + ui/core/license getserviceproviders.php* AJAX: Get Stats - license.php + ui/core/license widgets/api/get.php* @@ -705,7 +705,7 @@ System: License - license.php* + ui/core/license* diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml similarity index 97% rename from src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml rename to src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml index d1d3576ba..197d00367 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml @@ -5,7 +5,7 @@ - + @@ -149,13 +149,13 @@ - + - + - + diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/license.volt b/src/opnsense/mvc/app/views/OPNsense/Core/license.volt new file mode 100644 index 000000000..840a692b3 --- /dev/null +++ b/src/opnsense/mvc/app/views/OPNsense/Core/license.volt @@ -0,0 +1,25 @@ +
+

{{ product_name }}{% if product_name == 'OPNsense' %}®{% endif %} is Copyright © {{ product_copyright_years }} {{ product_copyright_owner }}
All rights reserved.

+

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

+
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ {% if product_name != 'OPNsense' %} +

{{ product_name }} is based on OPNsense®, copyright © Deciso B.V. All rights reserved.

+ {% endif %} +

OPNsense is based on FreeBSD, copyright © The FreeBSD Project. All rights reserved.

+

OPNsense is a fork of pfSense® (Copyright © 2004-2014 Electric Sheep Fencing, LLC. All rights reserved.), which is a fork of m0n0wall® (Copyright © 2002-2013 Manuel Kasper).

+

OPNsense includes various freely available software packages and ports. + The incorporated third party tools are listed here.

+

The authors of OPNsense would like to thank all contributors for their efforts.

+
+' \ No newline at end of file diff --git a/src/www/license.php b/src/www/license.php deleted file mode 100644 index 2134542fa..000000000 --- a/src/www/license.php +++ /dev/null @@ -1,65 +0,0 @@ - - - - - -
-
-
-
-

OPNsense® is Copyright ©
All rights reserved.

-

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. -
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-

OPNsense is based on FreeBSD Copyright © The FreeBSD Project. All rights reserved.

-

OPNsense is a fork of pfSense® (Copyright © 2004-2014 Electric Sheep Fencing, LLC. All rights reserved.) a fork from m0n0wall® (Copyright © 2002-2013 Manuel Kasper).

-

OPNsense includes various freely available software packages and ports. - The incorporated third party tools are listed here.

-

The authors of OPNsense would like to thank all contributors for their efforts.

-
-
-
-
- -