From 4c27e412e6cb2847671b9d97e75ff655010420e3 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 28 Jan 2016 21:08:21 +0100 Subject: [PATCH] src: simplify to close #702 o $g['theme'] usage converted o $g['language'] usage zapped o globals.inc removed --- src/etc/inc/authgui.inc | 16 +++++++------- src/etc/inc/config.lib.inc | 17 ++++++++++++++- src/etc/inc/globals.inc | 44 -------------------------------------- src/etc/rc.installer | 21 ++++++------------ src/www/fbegin.inc | 4 ++-- src/www/guiconfig.inc | 20 ++++++++--------- src/www/head.inc | 12 +++++------ src/www/index.php | 2 +- src/www/system_general.php | 3 ++- 9 files changed, 50 insertions(+), 89 deletions(-) delete mode 100644 src/etc/inc/globals.inc diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index c7fa51e19..c212d017e 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -290,8 +290,7 @@ if (!isAllowedPage($_SERVER['REQUEST_URI'])) { */ function display_error_form($http_code, $desc) { - global $config, $g; - $g['theme'] = get_current_theme(); + $themename = htmlspecialchars(get_current_theme()); ?> @@ -310,8 +309,8 @@ function display_error_form($http_code, $desc) <?=$http_code?> - - + + @@ -333,7 +332,8 @@ function display_error_form($http_code, $desc) function display_login_form($Login_Error = '') { global $config, $g; - $g['theme'] = get_current_theme(); + + $themename = htmlspecialchars(get_current_theme()); unset($input_errors); @@ -377,8 +377,8 @@ function display_login_form($Login_Error = '') <?=gettext("Login"); ?> - - + + @@ -397,7 +397,7 @@ function display_login_form($Login_Error = '')
diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index 25d22af92..580483651 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -32,7 +32,22 @@ openlog('opnsense', LOG_ODELAY, LOG_USER); register_shutdown_function('closelog'); -require_once("globals.inc"); +global $g; /* XXX make this a getter function for traceability */ + +$g = array( + "factory_shipped_username" => "root", + "factory_shipped_password" => "opnsense", + "dhcpd_chroot_path" => "/var/dhcpd", + "unbound_chroot_path" => "/var/unbound", + "product_name" => "OPNsense", + "product_website" => "https://opnsense.org", + "product_email" => "project@opnsense.org", + "product_copyright_owner" => "Deciso B.V.", + "product_copyright_years" => "2014-2016", + "product_copyright_url" => "https://www.deciso.com/", + "latest_config" => "11.2", +); + require_once("xmlparse.inc"); require_once("crypt.inc"); require_once("notices.inc"); diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc deleted file mode 100644 index 3ff8c180e..000000000 --- a/src/etc/inc/globals.inc +++ /dev/null @@ -1,44 +0,0 @@ -. - 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. 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. -*/ - -global $g; - -$g = array( - "factory_shipped_username" => "root", - "factory_shipped_password" => "opnsense", - "dhcpd_chroot_path" => "/var/dhcpd", - "unbound_chroot_path" => "/var/unbound", - "product_name" => "OPNsense", - "product_website" => "https://opnsense.org", - "product_email" => "project@opnsense.org", - "product_copyright_owner" => "Deciso B.V.", - "product_copyright_years" => "2014-2016", - "product_copyright_url" => "https://www.deciso.com/", - "latest_config" => "11.2", -); diff --git a/src/etc/rc.installer b/src/etc/rc.installer index 88ba45018..88e60b1b6 100755 --- a/src/etc/rc.installer +++ b/src/etc/rc.installer @@ -1,6 +1,5 @@ #!/bin/sh -# -# Launch BSD Installer with fake "installer root" + # Copyright 2004-2009 Scott Ullrich # # Redistribution and use in source and binary forms, with or without @@ -24,10 +23,6 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -PRODUCT=`grep product_name /usr/local/etc/inc/globals.inc | cut -d'"' -f4` -USERNAME=`grep factory_shipped_username /usr/local/etc/inc/globals.inc | cut -d'"' -f4` -PASSWORD=`grep factory_shipped_password /usr/local/etc/inc/globals.inc | cut -d'"' -f4` - sysctl kern.geom.debugflags=16 >/dev/null sysctl net.link.ether.inet.log_arp_wrong_iface=0 >/dev/null @@ -70,23 +65,19 @@ echo echo echo echo -echo "${PRODUCT} is now rebooting" +echo "The installation finished successfully." echo -echo "After the reboot is complete, open a web browser and" -echo "enter https://192.168.1.1 (or the LAN IP Address) in the" -echo "location bar." +echo "After reboot, open a web browser and navigate to" +echo "https://192.168.1.1 (or the LAN IP address)." echo echo "You might need to acknowledge the HTTPS certificate if " echo "your browser reports it as untrusted. This is normal" echo "as a self-signed certificate is used by default." echo -echo "*DEFAULT Username*: ${USERNAME}" -echo "*DEFAULT Password*: ${PASSWORD}" -echo - +echo -n "Rebooting in 5 seconds. CTRL-C to abort" for n in 5 4 3 2 1; do - echo Rebooting in $n seconds. CTRL-C to abort. sleep 1 + echo -n "." done echo diff --git a/src/www/fbegin.inc b/src/www/fbegin.inc index b3e6c4afb..134a17d56 100644 --- a/src/www/fbegin.inc +++ b/src/www/fbegin.inc @@ -99,8 +99,8 @@ if($need_alert_display == true) {