mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 02:25:05 +00:00
src: simplify to close #702
o $g['theme'] usage converted o $g['language'] usage zapped o globals.inc removed
This commit is contained in:
parent
3920ec3135
commit
4c27e412e6
@ -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());
|
||||
|
||||
?><!doctype html>
|
||||
<!--[if IE 8 ]><html lang="en" class="ie ie8 lte9 lte8 no-js"><![endif]-->
|
||||
@ -310,8 +309,8 @@ function display_error_form($http_code, $desc)
|
||||
|
||||
<title><?=$http_code?></title>
|
||||
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/css/main.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon">
|
||||
<link href="/ui/themes/<?= $themename ?>/build/css/main.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/ui/themes/<?= $themename ?>/build/images/favicon.png" rel="shortcut icon">
|
||||
|
||||
<!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script><![endif]-->
|
||||
</head>
|
||||
@ -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 = '')
|
||||
|
||||
<title><?=gettext("Login"); ?></title>
|
||||
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/css/main.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon">
|
||||
<link href="/ui/themes/<?= $themename ?>/build/css/main.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/ui/themes/<?= $themename ?>/build/images/favicon.png" rel="shortcut icon">
|
||||
|
||||
<!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script><![endif]-->
|
||||
|
||||
@ -397,7 +397,7 @@ function display_login_form($Login_Error = '')
|
||||
<main class="login-modal-container">
|
||||
<header class="login-modal-head" style="height:55px;">
|
||||
<div class="navbar-brand">
|
||||
<img src="/ui/themes/<?=$g['theme'];?>/build/images/default-logo.png" height="30"/>
|
||||
<img src="/ui/themes/<?= $themename ?>/build/images/default-logo.png" height="30"/>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2004-2010 Scott Ullrich
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
||||
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",
|
||||
);
|
||||
@ -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
|
||||
|
||||
|
||||
@ -99,8 +99,8 @@ if($need_alert_display == true) {
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="/index.php">
|
||||
<img class="brand-logo" src="/ui/themes/<?=$g['theme'];?>/build/images/default-logo.png" height="30"/>
|
||||
<img class="brand-icon" src="/ui/themes/<?=$g['theme'];?>/build/images/icon-logo.png" height="30"/>
|
||||
<img class="brand-logo" src="/ui/themes/<?= $themename ?>/build/images/default-logo.png" height="30"/>
|
||||
<img class="brand-icon" src="/ui/themes/<?= $themename ?>/build/images/icon-logo.png" height="30"/>
|
||||
</a>
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
|
||||
@ -48,8 +48,15 @@ if (empty($nocsrf)) {
|
||||
}
|
||||
}
|
||||
|
||||
function set_language($lang)
|
||||
function set_language()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$lang = 'en_US';
|
||||
if (!empty($config['system']['language'])) {
|
||||
$lang = $config['system']['language'];
|
||||
}
|
||||
|
||||
$lang_encoding = $lang . '.UTF-8';
|
||||
$textdomain = 'OPNsense';
|
||||
|
||||
@ -90,16 +97,7 @@ if (isset($omit_nocacheheaders) && $omit_nocacheheaders) {
|
||||
|
||||
header("X-Frame-Options: SAMEORIGIN");
|
||||
|
||||
$g['theme'] = get_current_theme();
|
||||
|
||||
/* Set the default interface language */
|
||||
if(isset($config['system']['language']) && $config['system']['language'] <> "") {
|
||||
$g['language'] = $config['system']['language'];
|
||||
} elseif (!isset($g['language']) || $g['language'] == "") {
|
||||
$g['language'] = 'en_US';
|
||||
}
|
||||
|
||||
set_language($g['language']);
|
||||
set_language();
|
||||
|
||||
require_once("authgui.inc");
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ if (!isset($menuBreadcrumbs)) {
|
||||
$menuBreadcrumbs = $menu->getBreadcrumbs();
|
||||
}
|
||||
|
||||
$g['theme'] = get_current_theme();
|
||||
$themename = htmlspecialchars(get_current_theme());
|
||||
|
||||
$pagetitle = gentitle(array_reverse($menuBreadcrumbs), ' | ');
|
||||
$pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system']['domain']);
|
||||
@ -63,7 +63,7 @@ $pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system
|
||||
<title><?= $pagetitle ?></title>
|
||||
|
||||
<!-- include (theme) style -->
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/css/main.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/ui/themes/<?= $themename ?>/build/css/main.css" media="screen, projection" rel="stylesheet">
|
||||
|
||||
<!-- TODO: move to theme style -->
|
||||
<style>
|
||||
@ -78,13 +78,13 @@ $pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system
|
||||
</style>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon">
|
||||
<link href="/ui/themes/<?= $themename ?>/build/images/favicon.png" rel="shortcut icon">
|
||||
|
||||
<!-- Stylesheet for fancy select/dropdown -->
|
||||
<link rel="stylesheet" type="text/css" href="/ui/themes/<?=$g['theme'];?>/build/css/bootstrap-select.css">
|
||||
<link rel="stylesheet" type="text/css" href="/ui/themes/<?= $themename ?>/build/css/bootstrap-select.css">
|
||||
|
||||
<!-- bootstrap dialog -->
|
||||
<link href="/ui/themes/<?=$g['theme'];?>/build/css/bootstrap-dialog.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/ui/themes/<?= $themename ?>/build/css/bootstrap-dialog.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<!-- Font awesome -->
|
||||
@ -95,7 +95,7 @@ $pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system
|
||||
<!-- nvd3 -->
|
||||
<link rel="stylesheet" href="/ui/css/nv.d3.css">
|
||||
|
||||
<script>var theme = '<?=$g['theme'];?>'; </script>
|
||||
<script>var theme = "<?= $themename ?>"; </script>
|
||||
|
||||
<!-- JQuery -->
|
||||
<script type="text/javascript" src="/ui/js/jquery-1.11.2.min.js"></script>
|
||||
|
||||
@ -383,7 +383,7 @@ if (isset($config['trigger_initial_wizard'])) :
|
||||
<div class="content-box" style="padding: 20px;">
|
||||
<div class="table-responsive">
|
||||
<?php
|
||||
echo "<img src=\"/ui/themes/{$g['theme']}/build/images/default-logo.png\" border=\"0\" alt=\"logo\" /><p>\n";
|
||||
echo "<img src=\"/ui/themes/{$themename}/build/images/default-logo.png\" border=\"0\" alt=\"logo\" /><p>\n";
|
||||
?>
|
||||
<br />
|
||||
<div class="content-box-main">
|
||||
|
||||
@ -173,7 +173,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
if (!empty($pconfig['language']) && $pconfig['language'] != $config['system']['language']) {
|
||||
$config['system']['language'] = $pconfig['language'];
|
||||
set_language($config['system']['language']);
|
||||
/* XXX while this is very proactive, we should defer in favour of a unified language transition point ;) */
|
||||
set_language();
|
||||
}
|
||||
|
||||
if (!isset($config['system']['firmware'])) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user