summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/auth.inc88
-rw-r--r--etc/inc/authgui.inc180
-rw-r--r--etc/inc/functions.inc56
-rw-r--r--etc/inc/globals.inc50
-rw-r--r--etc/inc/gmirror.inc16
-rw-r--r--etc/inc/notices.inc19
-rw-r--r--etc/inc/service-utils.inc80
-rw-r--r--etc/inc/services.inc14
8 files changed, 176 insertions, 327 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index 683d1e5..6de76c1 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -51,7 +51,7 @@ if(!$do_not_include_config_gui_inc)
// Will be changed to false if security checks fail
$security_passed = true;
-/* If this function doesn't exist, we're being called from Captive Portal or
+/* If this function doesn't exist, we're being called from Captive Portal or
another internal subsystem which does not include authgui.inc */
if (function_exists("display_error_form") && !isset($config['system']['webgui']['nodnsrebindcheck'])) {
/* DNS ReBinding attack prevention. https://redmine.pfsense.org/issues/708 */
@@ -117,8 +117,22 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui']['
if($_SERVER['HTTP_REFERER'] == file_get_contents("{$g['tmp_path']}/setupwizard_lastreferrer")) {
unlink("{$g['tmp_path']}/setupwizard_lastreferrer");
header("Refresh: 1; url=index.php");
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
- echo "<html><head><title>" . gettext("Redirecting...") . "</title></head><body>" . gettext("Redirecting to the dashboard...") . "</body></html>";
+?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
+ <title><?=gettext("Redirecting..."); ?></title>
+</head>
+<body id="error" class="no-menu">
+ <div id="jumbotron">
+ <div class="container">
+ <p><?=gettext("Redirecting to the dashboard...")?></p>
+ </div>
+ </div>
+</body>
+</html>
+<?php
exit;
}
}
@@ -389,7 +403,7 @@ function local_user_set(& $user) {
conf_mount_rw();
- $home_base = "/home/";
+ $home_base = "/home/";
$user_uid = $user['uid'];
$user_name = $user['name'];
$user_home = "{$home_base}{$user_name}";
@@ -397,7 +411,7 @@ function local_user_set(& $user) {
$user_group = "nobody";
// Ensure $home_base exists and is writable
- if (!is_dir($home_base))
+ if (!is_dir($home_base))
mkdir($home_base, 0755);
$lock_account = false;
@@ -448,7 +462,7 @@ function local_user_set(& $user) {
$user_op = "usermod";
}
- $comment = str_replace(array(":", "!", "@"), " ", $user['descr']);
+ $comment = str_replace(array(":", "!", "@"), " ", $user['descr']);
/* add or mod pw db */
$cmd = "/usr/sbin/pw {$user_op} -q -u {$user_uid} -n {$user_name}".
" -g {$user_group} -s {$user_shell} -d {$user_home}".
@@ -482,7 +496,7 @@ function local_user_set(& $user) {
$un = $lock_account ? "" : "un";
exec("/usr/sbin/pw {$un}lock {$user_name} -q");
-
+
conf_mount_ro();
}
@@ -554,7 +568,7 @@ function local_user_get_groups($user, $all = false) {
sort($groups);
return $groups;
-
+
}
function local_user_set_groups($user, $new_groups = NULL ) {
@@ -771,7 +785,7 @@ function ldap_test_bind($authcfg) {
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, (int)$ldapver);
-
+
$ldapbindun = isset($authcfg['ldap_utf8']) ? utf8_encode($ldapbindun) : $ldapbindun;
$ldapbindpw = isset($authcfg['ldap_utf8']) ? utf8_encode($ldapbindpw) : $ldapbindpw;
if ($ldapanon == true) {
@@ -889,23 +903,23 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) {
function ldap_get_groups($username, $authcfg) {
global $debug, $config;
-
+
if(!function_exists("ldap_connect"))
return;
-
- if(!$username)
+
+ if(!$username)
return false;
if(!isset($authcfg['ldap_nostrip_at']) && stristr($username, "@")) {
$username_split = explode("@", $username);
- $username = $username_split[0];
+ $username = $username_split[0];
}
if(stristr($username, "\\")) {
$username_split = explode("\\", $username);
- $username = $username_split[0];
- }
-
+ $username = $username_split[0];
+ }
+
//log_error("Getting LDAP groups for {$username}.");
if ($authcfg) {
if (strstr($authcfg['ldap_urltype'], "Standard"))
@@ -953,7 +967,7 @@ function ldap_get_groups($username, $authcfg) {
log_error(sprintf(gettext("ERROR! ldap_get_groups() Could not connect to server %s."), $ldapname));
return memberof;
}
-
+
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, (int)$ldapver);
@@ -985,8 +999,8 @@ function ldap_get_groups($username, $authcfg) {
$search = @$ldapfunc($ldap, $ldapdn, $ldapfilter, array($ldapgroupattribute));
$info = @ldap_get_entries($ldap, $search);
- $countem = $info["count"];
-
+ $countem = $info["count"];
+
if(is_array($info[0][$ldapgroupattribute])) {
/* Iterate through the groups and throw them into an array */
foreach ($info[0][$ldapgroupattribute] as $member) {
@@ -996,14 +1010,14 @@ function ldap_get_groups($username, $authcfg) {
}
}
}
-
+
/* Time to close LDAP connection */
@ldap_unbind($ldap);
-
+
$groups = print_r($memberof,true);
-
+
//log_error("Returning groups ".$groups." for user $username");
-
+
return $memberof;
}
@@ -1013,8 +1027,8 @@ function ldap_format_host($host) {
function ldap_backed($username, $passwd, $authcfg) {
global $debug, $config;
-
- if(!$username)
+
+ if(!$username)
return;
if(!function_exists("ldap_connect"))
@@ -1022,11 +1036,11 @@ function ldap_backed($username, $passwd, $authcfg) {
if(!isset($authcfg['ldap_nostrip_at']) && stristr($username, "@")) {
$username_split = explode("@", $username);
- $username = $username_split[0];
+ $username = $username_split[0];
}
if(stristr($username, "\\")) {
$username_split = explode("\\", $username);
- $username = $username_split[0];
+ $username = $username_split[0];
}
if ($authcfg) {
@@ -1056,9 +1070,9 @@ function ldap_backed($username, $passwd, $authcfg) {
}
else
{
- $ldapfilter =
+ $ldapfilter =
"(&({$ldapnameattribute}={$username})({$ldapextendedquery}))";
- }
+ }
$ldaptype = "";
$ldapver = $authcfg['ldap_protver'];
$ldapname = $authcfg['name'];
@@ -1066,7 +1080,7 @@ function ldap_backed($username, $passwd, $authcfg) {
} else
return false;
- /* first check if there is even an LDAP server populated */
+ /* first check if there is even an LDAP server populated */
if(!$ldapserver) {
if ($ldapfallback) {
log_error(gettext("ERROR! ldap_backed() called with no LDAP authentication server defined. Defaulting to local user database. Visit System -> User Manager."));
@@ -1076,7 +1090,7 @@ function ldap_backed($username, $passwd, $authcfg) {
return false;
}
-
+
/* Setup CA environment if needed. */
ldap_setup_caenv($authcfg);
@@ -1109,10 +1123,10 @@ function ldap_backed($username, $passwd, $authcfg) {
log_error(sprintf(gettext("ERROR! Could not bind to server %s."), $ldapname));
return false;
}
-
+
/* Get LDAP Authcontainers and split em up. */
$ldac_splits = explode(";", $ldapauthcont);
-
+
/* setup the usercount so we think we havn't found anyone yet */
$usercount = 0;
@@ -1160,7 +1174,7 @@ function ldap_backed($username, $passwd, $authcfg) {
if ($usercount != 1){
@ldap_unbind($ldap);
log_error(gettext("ERROR! Either LDAP search failed, or multiple users were found."));
- return false;
+ return false;
}
/* Now lets bind as the user we found */
@@ -1241,7 +1255,7 @@ function radius_backed($username, $passwd, $authcfg, &$attributes = array()) {
function get_user_expiration_date($username) {
$user = getUserEntry($username);
- if ($user['expires'])
+ if ($user['expires'])
return $user['expires'];
}
@@ -1368,7 +1382,7 @@ function session_auth() {
/* Validate incoming login request */
if (isset($_POST['login']) && !empty($_POST['usernamefld']) && !empty($_POST['passwordfld'])) {
$authcfg = auth_get_authserver($config['system']['webgui']['authmode']);
- if (authenticate_user($_POST['usernamefld'], $_POST['passwordfld'], $authcfg) ||
+ if (authenticate_user($_POST['usernamefld'], $_POST['passwordfld'], $authcfg) ||
authenticate_user($_POST['usernamefld'], $_POST['passwordfld'])) {
// Generate a new id to avoid session fixation
session_regenerate_id();
@@ -1409,7 +1423,7 @@ function session_auth() {
$_GET['logout'] = true;
$_SESSION['Logout'] = true;
} else
- $_SESSION['last_access'] = time();
+ $_SESSION['last_access'] = time();
} else if (intval($config['system']['webgui']['session_timeout']) == 0) {
/* only update if it wasn't ajax */
if (!isAjax())
diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc
index e9dc8ad..61dcd42 100644
--- a/etc/inc/authgui.inc
+++ b/etc/inc/authgui.inc
@@ -75,7 +75,7 @@ if (!isAllowedPage($_SERVER['REQUEST_URI'])) {
display_error_form("201", gettext("No page assigned to this user! Click here to logout."));
exit;
}
-} else
+} else
$_SESSION['Post_Login'] = true;
/*
@@ -89,7 +89,7 @@ if (!$_SESSION['Post_Login']) {
exit;
}
-/*
+/*
* Close session data to allow other scripts from same host to come in.
* A session can be reactivated from calling session_start again
*/
@@ -107,49 +107,21 @@ function display_error_form($http_code, $desc) {
}
?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <script type="text/javascript" src="/javascript/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="/javascript/jquery-migrate-1.2.1.min.js"></script>
- <title><?=$http_code?></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="shortcut icon" href="/themes/<?= $g['theme'] ?>/images/icons/favicon.ico" />
- <?php if (file_exists("{$g['www_path']}/themes/{$g['theme']}/login.css")): ?>
- <link rel="stylesheet" type="text/css" href="/themes/<?= $g['theme'] ?>/login.css" media="all" />
- <?php else: ?>
- <link rel="stylesheet" type="text/css" href="/themes/<?= $g['theme'] ?>/all.css" media="all" />
- <?php endif; ?>
- <script type="text/javascript">
- //<![CDATA[
- function page_load() {}
- function clearError() {
- if($('#inputerrors'))
- $('#inputerrors').html('');
- }
- <?php
- require("headjs.php");
- echo getHeadJS();
- ?>
- //]]>
- </script>
- <script type="text/javascript" src="/themes/<?= $g['theme'] ?>/javascript/niftyjsCode.js"></script>
- </head>
- <body onload="page_load();">
- <div id="errordesc">
- <h1>&nbsp</h1>
- <a href="/index.php?logout">
- <p id="errortext" style="vertical-align: middle; text-align: center;">
- <span style="color: #000000; font-weight: bold;">
- <?=$desc;?>
- </span>
- </p>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
+ <title><?=gettext("Error: not allowed"); ?></title>
+</head>
+<body id="error" class="no-menu">
+ <div id="jumbotron">
+ <div class="container">
+ <!-- FIXME: We really need to POST the logout action -->
+ <div class="alert alert-danger" role="alert"><a href="index.php?logout"><?=$desc;?></a></div>
</div>
- </body>
+ </div>
+</body>
</html>
-
<?php
} // end function
@@ -177,7 +149,7 @@ function display_login_form() {
exit;
}
-/* Check against locally configured IP addresses, which will catch when someone
+/* Check against locally configured IP addresses, which will catch when someone
port forwards WebGUI access from WAN to an internal IP on the router. */
global $FilterIflist, $nifty_background;
$local_ip = false;
@@ -229,90 +201,50 @@ setcookie("cookie_test", time() + 3600);
$have_cookies = isset($_COOKIE["cookie_test"]);
?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <script type="text/javascript" src="/javascript/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="/javascript/jquery-migrate-1.2.1.min.js"></script>
- <script type="text/javascript">
- //<![CDATA[
- $(document).ready(function() { jQuery('#usernamefld').focus(); });
- //]]>
- </script>
-
- <title><?=gettext("Login"); ?></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="shortcut icon" href="/themes/<?= $g['theme'] ?>/images/icons/favicon.ico" />
- <?php if (file_exists("{$g['www_path']}/themes/{$g['theme']}/login.css")): ?>
- <link rel="stylesheet" type="text/css" href="/themes/<?= $g['theme'] ?>/login.css" media="all" />
- <?php else: ?>
- <link rel="stylesheet" type="text/css" href="/themes/<?= $g['theme'] ?>/all.css" media="all" />
- <?php endif; ?>
- <script type="text/javascript">
- //<![CDATA[
- function page_load() {}
- function clearError() {
- if($('#inputerrors'))
- $('#inputerrors').html('');
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
+ <title><?=gettext("Login"); ?></title>
+</head>
+<body id="login" class="no-menu">
+ <div id="jumbotron">
+ <div class="container">
+ <?php
+ if(is_ipaddr($http_host) && !$local_ip && !isset($config['system']['webgui']['nohttpreferercheck'])) {
+ $nifty_background = "#999";
+ print_info_box(gettext("You are accessing this router by an IP address not configured locally, which may be forwarded by NAT or other means. <br /><br />If you did not setup this forwarding, you may be the target of a man-in-the-middle attack."));
}
- <?php
- require("headjs.php");
- echo getHeadJS();
- ?>
- //]]>
- </script>
- <script type="text/javascript" src="/themes/<?= $g['theme'] ?>/javascript/niftyjsCode.js"></script>
- </head>
- <body onload="page_load()">
- <div id="login">
- <?php
- if(is_ipaddr($http_host) && !$local_ip && !isset($config['system']['webgui']['nohttpreferercheck'])) {
- $nifty_background = "#999";
- print_info_box(gettext("You are accessing this router by an IP address not configured locally, which may be forwarded by NAT or other means. <br /><br />If you did not setup this forwarding, you may be the target of a man-in-the-middle attack."));
- }
- $loginautocomplete = isset($config['system']['webgui']['loginautocomplete']) ? '' : 'autocomplete="off"';
- ?>
- <form id="iform" name="iform" method="post" <?= $loginautocomplete ?> action="<?=$_SERVER['SCRIPT_NAME'];?>">
- <h1>&nbsp;</h1>
- <div id="inputerrors"><?=$_SESSION['Login_Error'];?></div>
- <p>
- <span style="text-align:left">
- <?=gettext("Username:"); ?><br />
- <input onclick="clearError();" onchange="clearError();" id="usernamefld" type="text" name="usernamefld" class="formfld user" tabindex="1" />
- </span>
- </p>
- <p>
- <br />
- <span style="text-align:left">
- <?=gettext("Password:"); ?> <br />
- <input onclick="clearError();" onchange="clearError();" id="passwordfld" type="password" name="passwordfld" class="formfld pwd" tabindex="2" />
- </span>
- </p>
- <p>
- <br />
- <span style="text-align:center; font-weight: normal ; font-style: italic">
- <?=gettext("Enter username and password to login."); ?>
- </span>
- <?php if (!$have_cookies && isset($_POST['login'])): ?>
- <br /><br />
- <span style="text-align:center; font-weight: normal ; font-style: italic; color: #ff0000">
- <?= gettext("Your browser must support cookies to login."); ?>
- </span>
- <?php endif; ?>
- </p>
- <p>
- <span style="text-align:center">
- <input type="submit" name="login" class="formbtn" value="<?=gettext("Login"); ?>" tabindex="3" />
- </span>
- </p>
- </form>
+ $loginautocomplete = isset($config['system']['webgui']['loginautocomplete']) ? '' : 'autocomplete="off"';
+ ?>
+
+ <form id="iform" name="iform" method="post" <?= $loginautocomplete ?> action="<?=$_SERVER['SCRIPT_NAME'];?>">
+ <?php if (!empty($_SESSION['Login_Error'])): ?>
+ <div class="alert alert-danger" role="alert"><?=$_SESSION['Login_Error'];?></div>
+ <?php endif ?>
+
+ <div class="form-group">
+ <label for="inputEmail">Username</label>
+ <input type="text" class="form-control" name="usernamefld" placeholder="Username">
+ </div>
+ <div class="form-group">
+ <label for="inputPassword">Password</label>
+ <input type="password" class="form-control" name="passwordfld" placeholder="Password">
+ </div>
+ <button type="submit" class="btn btn-primary" name="login">Login</button>
+
+ <?php if (!$have_cookies && isset($_POST['login'])): ?>
+ <div class="alert alert-warning">
+ <?= gettext("Your browser must support cookies to login."); ?>
+ </div>
+ <?php endif; ?>
+ </form>
</div>
- </body>
+ </div>
+</body>
</html>
<?php
} // end function
-?>
+?> \ No newline at end of file
diff --git a/etc/inc/functions.inc b/etc/inc/functions.inc
index a89aeff..d40be18 100644
--- a/etc/inc/functions.inc
+++ b/etc/inc/functions.inc
@@ -57,7 +57,7 @@ if(!function_exists("pfSenseHeader")) {
$protocol = "https";
else
$protocol = "http";
-
+
$port = ":{$_SERVER['SERVER_PORT']}";
if ($_SERVER['SERVER_PORT'] == "80" && $protocol == "http")
$port = "";
@@ -72,60 +72,6 @@ if(!function_exists("pfSenseHeader")) {
}
/* END compatibility goo with HEAD */
-/*fetch menu notices function*/
-if(!function_exists("get_menu_messages")) {
- function get_menu_messages(){
- global $g,$config;
- if (are_notices_pending()) {
- $notices = get_notices();
- $requests=array();
-
- ## Get Query Arguments from URL ###
- foreach ($_REQUEST as $key => $value) {
- if ($key != "PHPSESSID")
- $requests[] = $key.'='.$value;
- }
- if(is_array($requests))
- $request_string = implode("&", $requests);
-
- if(is_array($notices)) {
- $notice_msgs = "<table colspan=\'6\' id=\'notice_table\'>";
- $alert_style="style=\'color:#ffffff; filter:Glow(color=#ff0000, strength=12);\' ";
- $notice = "<a href=\'#\' onclick=notice_action(\'acknowledge\',\'all\');domTT_close(this); {$alert_style}>".gettext("Acknowledge All Notices")."</a>";
- $alert_link="title=\'".gettext("Click to Acknowledge")."\' {$alert_style}";
- $domtt_width=500;
- foreach ($notices as $key => $value) {
- $date = date("m-d-y H:i:s", $key);
- $noticemsg = ($value['notice'] != "" ? $value['notice'] : $value['id']);
- $noticemsg = preg_replace("/(\"|\'|\n|<.?\w+>)/i","",$noticemsg);
- if ((strlen($noticemsg)* 8) > $domtt_width)
- $domtt_width=(strlen($noticemsg) *8);
- if ((strlen($noticemsg)* 8) > 900)
- $domtt_width= 900;
- $alert_action ="onclick=notice_action(\'acknowledge\',\'{$key}\');domTT_close(this);jQuery(this).parent().parent().remove();";
- $notice_msgs .= "<tr><td valign=\'top\' width=\'120\'><a href=\'#\' {$alert_link} {$alert_action}>{$date}</a></td><td valign=\'top\'><a href=\'#\' {$alert_link} {$alert_action}>[ ".htmlspecialchars($noticemsg)."]</a></td></tr>";
- }
- $notice_msgs .="</table>";
-
- $domtt= "onclick=\"domTT_activate(this, event, 'caption', '{$notice}','content', '<br />{$notice_msgs}', 'trail', false, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','width','{$domtt_width}','y',5,'type', 'sticky');\"";
- $menu_messages="<div id='alerts'>\n";
- if(count($notices)==1)
- $msg= sprintf("%1$02d",count($notices))." ".gettext("unread notice");
- else
- $msg= sprintf("%1$02d",count($notices))." ".gettext("unread notices");
- $menu_messages.="<div id='marquee-text' style='z-index:1001;'><a href='#' {$domtt}><b> .:. {$msg} .:. </b></a></div>\n";
- $menu_messages.="</div>\n";
- }
- }
- else {
- $menu_messages='<div id="hostname">';
- $menu_messages.=$config['system']['hostname'] . "." . $config['system']['domain'];
- $menu_messages.='</div>';
- }
- return ($menu_messages);
- }
-}
-
if(!function_exists("dom_title")) {
function dom_title($title_msg,$width=NULL){
$width=preg_replace("/\D+/","",$width);
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc
index 1d7e04d..accbcbd 100644
--- a/etc/inc/globals.inc
+++ b/etc/inc/globals.inc
@@ -36,7 +36,7 @@
global $g;
$g = array(
- "base_packages" => "siproxd",
+ "base_packages" => "siproxd",
"event_address" => "unix:///var/run/check_reload_status",
"factory_shipped_username" => "admin",
"factory_shipped_password" => "pfsense",
@@ -62,7 +62,7 @@ $g = array(
"product_copyright_url" => "http://www.electricsheepfencing.com",
"product_copyright_years" => "2004 - ".date("Y"),
"product_website" => "www.pfsense.org",
- "product_website_footer" => "https://www.pfsense.org/?gui22",
+ "product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
"product_email" => "coreteam@pfsense.org",
"hideplatform" => false,
"hidedownloadbackup" => false,
@@ -77,7 +77,7 @@ $g = array(
"nopkg_platforms" => array("cdrom"),
"minimum_ram_warning" => "101",
"minimum_ram_warning_text" => "128 MB",
- "wan_interface_name" => "wan",
+ "wan_interface_name" => "wan",
"nopccard_platforms" => array("wrap", "net48xx"),
"xmlrpcbaseurl" => "https://packages.pfsense.org",
"captiveportal_path" => "/usr/local/captiveportal",
@@ -117,30 +117,30 @@ if(file_exists("/etc/platform")) {
}
/* Default sysctls */
-$sysctls = array("net.inet.ip.portrange.first" => "1024",
- "net.inet.tcp.blackhole" => "2",
- "net.inet.udp.blackhole" => "1",
- "net.inet.ip.random_id" => "1",
- "net.inet.tcp.drop_synfin" => "1",
- "net.inet.ip.redirect" => "1",
- "net.inet6.ip6.redirect" => "1",
+$sysctls = array("net.inet.ip.portrange.first" => "1024",
+ "net.inet.tcp.blackhole" => "2",
+ "net.inet.udp.blackhole" => "1",
+ "net.inet.ip.random_id" => "1",
+ "net.inet.tcp.drop_synfin" => "1",
+ "net.inet.ip.redirect" => "1",
+ "net.inet6.ip6.redirect" => "1",
"net.inet6.ip6.use_tempaddr" => "0",
"net.inet6.ip6.prefer_tempaddr" => "0",
- "net.inet.tcp.syncookies" => "1",
- "net.inet.tcp.recvspace" => "65228",
- "net.inet.tcp.sendspace" => "65228",
- "net.inet.ip.fastforwarding" => "0",
- "net.inet.tcp.delayed_ack" => "0",
- "net.inet.udp.maxdgram" => "57344",
- "net.link.bridge.pfil_onlyip" => "0",
- "net.link.bridge.pfil_member" => "1",
- "net.link.bridge.pfil_bridge" => "0",
- "net.link.tap.user_open" => "1",
- "kern.randompid" => "347",
- "net.inet.ip.intr_queue_maxlen" => "1000",
- "hw.syscons.kbd_reboot" => "0",
- "net.inet.tcp.log_debug" => "0",
- "net.inet.tcp.tso" => "1",
+ "net.inet.tcp.syncookies" => "1",
+ "net.inet.tcp.recvspace" => "65228",
+ "net.inet.tcp.sendspace" => "65228",
+ "net.inet.ip.fastforwarding" => "0",
+ "net.inet.tcp.delayed_ack" => "0",
+ "net.inet.udp.maxdgram" => "57344",
+ "net.link.bridge.pfil_onlyip" => "0",
+ "net.link.bridge.pfil_member" => "1",
+ "net.link.bridge.pfil_bridge" => "0",
+ "net.link.tap.user_open" => "1",
+ "kern.randompid" => "347",
+ "net.inet.ip.intr_queue_maxlen" => "1000",
+ "hw.syscons.kbd_reboot" => "0",
+ "net.inet.tcp.log_debug" => "0",
+ "net.inet.tcp.tso" => "1",
"net.inet.icmp.icmplim" => "0",
"vfs.read_max" => "32",
"kern.ipc.maxsockbuf" => "4262144",
diff --git a/etc/inc/gmirror.inc b/etc/inc/gmirror.inc
index 9e54a67..88261c4 100644
--- a/etc/inc/gmirror.inc
+++ b/etc/inc/gmirror.inc
@@ -52,7 +52,7 @@ function gmirror_get_status() {
}
}
}
- /* Return an hash of mirrors and components */
+ /* Return an hash of mirrors and components */
return $mirrors;
}
@@ -69,22 +69,22 @@ function gmirror_html_status() {
$output = "";
if (count($mirrors) > 0) {
$output .= "<tr>\n";
- $output .= "<td width=\"40%\" class=\"vncellt\">Name</td>\n";
- $output .= "<td width=\"40%\" class=\"vncellt\">Status</td>\n";
- $output .= "<td width=\"20%\" class=\"vncellt\">Component</td>\n";
+ $output .= "<th>Name</td>\n";
+ $output .= "<th>Status</td>\n";
+ $output .= "<th>Component</td>\n";
$output .= "</tr>\n";
foreach ($mirrors as $mirror => $name) {
$components = count($name["components"]);
$output .= "<tr>\n";
- $output .= "<td width=\"40%\" rowspan=\"{$components}\" class=\"listr\">{$name['name']}</td>\n";
- $output .= "<td width=\"40%\" rowspan=\"{$components}\" class=\"listr\">{$name['status']}</td>\n";
- $output .= "<td width=\"20%\" class=\"listr\">{$name['components'][0]}</td>\n";
+ $output .= "<td rowspan=\"{$components}\">{$name['name']}</td>\n";
+ $output .= "<td rowspan=\"{$components}\" class=\"listr\">{$name['status']}</td>\n";
+ $output .= "<td>{$name['components'][0]}</td>\n";
$output .= "</tr>\n";
if (count($name["components"]) > 1) {
$morecomponents = array_slice($name["components"], 1);
foreach ($morecomponents as $component) {
$output .= "<tr>\n";
- $output .= "<td width=\"20%\" class=\"listr\">{$component}</td>\n";
+ $output .= "<td>{$component}</td>\n";
$output .= "</tr>\n";
}
}
diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc
index 5bffce2..9488cff 100644
--- a/etc/inc/notices.inc
+++ b/etc/inc/notices.inc
@@ -201,7 +201,8 @@ function dump_xml_notices() {
function print_notices($notices, $category = "all") {
foreach($notices as $notice) {
if($category != "all") {
- if(in_array($notice['category'], $category)) $categories[] = $notice['category'];
+ if(in_array($notice['category'], $category))
+ $categories[] = $notice['category'];
} else {
$categories[] = $notice['category'];
}
@@ -209,7 +210,7 @@ function print_notices($notices, $category = "all") {
$categories = array_unique($categories);
sort($categories);
foreach($categories as $category) {
- $toreturn .= "<ul><li>{$category}<ul>";
+ $toreturn .= '<li><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">'.$category.'<span class="caret"></span></a><ul class="dropdown-menu" role="menu">';
foreach($notices as $notice) {
if(strtolower($notice['category']) == strtolower($category)) {
if($notice['id'] != "") {
@@ -221,9 +222,9 @@ function print_notices($notices, $category = "all") {
}
}
}
- $toreturn .= "</ul></li></ul>";
+ $toreturn .= "</ul></li>";
}
- return $toreturn;
+ return '<ul class="dropdown-menu" role="menu">'. $toreturn .'</ul>';
}
/****f* notices/print_notice_box
@@ -314,12 +315,12 @@ function send_smtp_message($message, $subject = "(no subject)") {
$smtp->debug = 0;
$smtp->html_debug = 0;
$smtp->localhost=$config['system']['hostname'].".".$config['system']['domain'];
-
+
if($config['notifications']['smtp']['fromaddress'])
$from = $config['notifications']['smtp']['fromaddress'];
-
+
// Use SMTP Auth if fields are filled out
- if($config['notifications']['smtp']['username'] &&
+ if($config['notifications']['smtp']['username'] &&
$config['notifications']['smtp']['password']) {
$smtp->authentication_mechanism = "PLAIN";
$smtp->user = $config['notifications']['smtp']['username'];
@@ -369,7 +370,7 @@ function notify_via_growl($message, $force=false) {
$growl_password = $config['notifications']['growl']['password'];
$growl_name = $config['notifications']['growl']['name'];
$growl_notification = $config['notifications']['growl']['notification_name'];
-
+
if(!empty($growl_ip)) {
$growl = new Growl($growl_ip, $growl_password, $growl_name);
$growl->notify("{$growl_notification}", gettext(sprintf("%s (%s) - Notification", $g['product_name'], $hostname)), "{$message}");
@@ -396,7 +397,7 @@ function register_via_growl() {
$growl_password = $config['notifications']['growl']['password'];
$growl_name = $config['notifications']['growl']['name'];
$growl_notification = $config['notifications']['growl']['notification_name'];
-
+
if($growl_ip) {
$growl = new Growl($growl_ip, $growl_password, $growl_name);
$growl->addNotification($growl_notification);
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc
index a78446e..094cfcd 100644
--- a/etc/inc/service-utils.inc
+++ b/etc/inc/service-utils.inc
@@ -442,72 +442,36 @@ function get_service_status($service) {
return $running;
}
-function get_service_status_icon($service, $withtext = true, $smallicon = false) {
- global $g;
- $output = "";
- if(get_service_status($service)) {
- $statustext = gettext("Running");
- $output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/";
- $output .= ($smallicon) ? "icon_pass.gif" : "icon_service_running.gif";
- $output .= "\" alt=\"status\" />&nbsp;";
- if ($withtext)
- $output .= "&nbsp;" . $statustext;
- } else {
- $service_enabled = is_service_enabled($service['name']);
- $statustext = ($service_enabled) ? gettext("Stopped") : gettext("Disabled");
- $output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/";
- $output .= ($smallicon) ? "icon_block.gif" : "icon_service_stopped.gif";
- $output .= "\" alt=\"status\" />&nbsp;";
- if ($withtext)
- $output .= "&nbsp;<font color=\"white\">{$statustext}</font>";
- }
- return $output;
-}
-
function get_service_control_links($service, $addname = false) {
- global $g;
$output = "";
$stitle = ($addname) ? $service['name'] . " " : "";
+
+ switch ($service['name']) {
+ case "openvpn":
+ $link = '<a title="%s" href="status_services.php?mode=%s&amp;service='.$service['name'].'.&amp;vpnmode='.$service['mode'].'.&amp;id='.$service['vpnid'].'">';
+ break;
+ case "captiveportal":
+ $link = '<a title="%s" href="status_services.php?mode=%s&amp;service='.$service['name'].'.&amp;zone='.$service['zone'].'">';
+ break;
+ default:
+ $link = '<a title="%s" href="status_services.php?mode=%s&amp;service='.$service['name'].'">';
+ }
+
if(get_service_status($service)) {
- switch ($service['name']) {
- case "openvpn":
- $output .= "<a href='status_services.php?mode=restartservice&amp;service={$service['name']}&amp;vpnmode={$service['mode']}&amp;id={$service['vpnid']}'>";
- break;
- case "captiveportal":
- $output .= "<a href='status_services.php?mode=restartservice&amp;service={$service['name']}&amp;zone={$service['zone']}'>";
- break;
- default:
- $output .= "<a href='status_services.php?mode=restartservice&amp;service={$service['name']}'>";
- }
- $output .= "<img style=\"vertical-align:middle\" title='" . sprintf(gettext("Restart %sService"),$stitle) . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_service_restart.gif' alt='restart' /></a>\n";
- switch ($service['name']) {
- case "openvpn":
- $output .= "<a href='status_services.php?mode=stopservice&amp;service={$service['name']}&amp;vpnmode={$service['mode']}&amp;id={$service['vpnid']}'>";
- break;
- case "captiveportal":
- $output .= "<a href='status_services.php?mode=stopservice&amp;service={$service['name']}&amp;zone={$service['zone']}'>";
- break;
- default:
- $output .= "<a href='status_services.php?mode=stopservice&amp;service={$service['name']}'>";
- }
- $output .= "<img style=\"vertical-align:middle\" title='" . sprintf(gettext("Stop %sService"),$stitle) . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_service_stop.gif' alt='stop' />";
- $output .= "</a>";
+ $output .= sprintf($link, sprintf(gettext("Restart %sService"), $stitle), 'restartservice');
+ $output .= '<i class="icon icon-retweet"></i></a> ';
+
+ $output .= sprintf($link, sprintf(gettext("Stop %sService"), $stitle), 'stopservice');
+ $output .= '<i class="icon icon-off"></i></a> ';
} else {
$service_enabled = is_service_enabled($service['name']);
- switch ($service['name']) {
- case "openvpn":
- $output .= "<a href='status_services.php?mode=startservice&amp;service={$service['name']}&amp;vpnmode={$service['mode']}&amp;id={$service['vpnid']}'>";
- break;
- case "captiveportal":
- $output .= "<a href='status_services.php?mode=startservice&amp;service={$service['name']}&amp;zone={$service['zone']}'>";
- break;
- default:
- if ($service_enabled)
- $output .= "<a href='status_services.php?mode=startservice&amp;service={$service['name']}'>";
+
+ if($service['name'] == 'openvpn' || $service['name'] == 'captiveportal' || $service_enabled) {
+ $output .= sprintf($link, sprintf(gettext("Start %sService"), $stitle), 'startservice');
+ $output .= '<i class="icon icon-play-circle"></i></a> ';
}
- if ($service_enabled)
- $output .= "<img style=\"vertical-align:middle\" title='" . sprintf(gettext("Start %sService"),$stitle) . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_service_start.gif' alt='start' /></a>\n";
}
+
return $output;
}
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 194b4f3..f22e646 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -2363,7 +2363,6 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont
global $config, $g;
$is_installed = false;
- $cron_changed = true;
if (!is_array($config['cron']))
$config['cron'] = array();
@@ -2392,13 +2391,8 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont
$config['cron']['item'][] = $cron_item;
write_config(sprintf(gettext("Installed cron job for %s"), $command));
} else {
- if ($config['cron']['item'][$x] == $cron_item) {
- $cron_changed = false;
- log_error(sprintf(gettext("Checked cron job for %s, no change needed"), $command));
- } else {
- $config['cron']['item'][$x] = $cron_item;
- write_config(sprintf(gettext("Updated cron job for %s"), $command));
- }
+ $config['cron']['item'][$x] = $cron_item;
+ write_config(sprintf(gettext("Updated cron job for %s"), $command));
}
} else {
if($is_installed == true) {
@@ -2406,9 +2400,7 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont
write_config(sprintf(gettext("Removed cron job for %s"), $command));
}
}
-
- if ($cron_changed)
- configure_cron();
+ configure_cron();
}
?>
OpenPOWER on IntegriCloud