diff options
Diffstat (limited to 'usr/local/www')
-rw-r--r-- | usr/local/www/edit.php | 52 | ||||
-rw-r--r-- | usr/local/www/exec.php | 374 | ||||
-rwxr-xr-x | usr/local/www/graph.php | 23 | ||||
-rw-r--r-- | usr/local/www/graph_cpu.php | 13 | ||||
-rw-r--r-- | usr/local/www/help.php | 3 | ||||
-rw-r--r-- | usr/local/www/index.php | 410 | ||||
-rwxr-xr-x | usr/local/www/reboot.php | 12 |
7 files changed, 452 insertions, 435 deletions
diff --git a/usr/local/www/edit.php b/usr/local/www/edit.php index 4d2c34f..7a78974 100644 --- a/usr/local/www/edit.php +++ b/usr/local/www/edit.php @@ -42,41 +42,42 @@ $pgtitle = array(gettext("Diagnostics"), gettext("Edit file")); require("guiconfig.inc"); -if($_POST['action']) { - switch($_POST['action']) { +if ($_POST['action']) { + switch ($_POST['action']) { case 'load': - if(strlen($_POST['file']) < 1) { + if (strlen($_POST['file']) < 1) { echo "|5|" . gettext("No file name specified") . ".|"; - } elseif(is_dir($_POST['file'])) { + } elseif (is_dir($_POST['file'])) { echo "|4|" . gettext("Loading a directory is not supported") . ".|"; - } elseif(! is_file($_POST['file'])) { + } elseif (! is_file($_POST['file'])) { echo "|3|" . gettext("File does not exist or is not a regular file") . ".|"; } else { $data = file_get_contents(urldecode($_POST['file'])); - if($data === false) { + if ($data === false) { echo "|1|" . gettext("Failed to read file") . ".|"; } else { $data = base64_encode($data); - echo "|0|{$_POST['file']}|{$data}|"; + echo "|0|{$_POST['file']}|{$data}|"; } } exit; case 'save': - if(strlen($_POST['file']) < 1) { + if (strlen($_POST['file']) < 1) { echo "|" . gettext("No file name specified") . ".|"; } else { conf_mount_rw(); $_POST['data'] = str_replace("\r", "", base64_decode($_POST['data'])); $ret = file_put_contents($_POST['file'], $_POST['data']); conf_mount_ro(); - if($_POST['file'] == "/conf/config.xml" || $_POST['file'] == "/cf/conf/config.xml") { - if(file_exists("/tmp/config.cache")) + if ($_POST['file'] == "/conf/config.xml" || $_POST['file'] == "/cf/conf/config.xml") { + if (file_exists("/tmp/config.cache")) { unlink("/tmp/config.cache"); + } disable_security_checks(); } - if($ret === false) { + if ($ret === false) { echo "|" . gettext("Failed to write file") . ".|"; - } elseif($ret <> strlen($_POST['data'])) { + } elseif ($ret <> strlen($_POST['data'])) { echo "|" . gettext("Error while writing file") . ".|"; } else { echo "|" . gettext("File successfully saved") . ".|"; @@ -98,7 +99,7 @@ outputJavaScriptFileInline("javascript/base64.js"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> -<script type="text/javascript"> +<script type="text/javascript"> //<![CDATA[ function loadFile() { jQuery("#fileStatus").html("<?=gettext("Loading file"); ?> ..."); @@ -118,25 +119,24 @@ outputJavaScriptFileInline("javascript/base64.js"); var values = req.responseText.split("|"); values.shift(); values.pop(); - if(values.shift() == "0") { + if (values.shift() == "0") { var file = values.shift(); var fileContent = Base64.decode(values.join("|")); jQuery("#fileStatus").html("<?=gettext("File successfully loaded"); ?>."); jQuery("#fileContent").val(fileContent); var lang = "none"; - if(file.indexOf(".php") > 0) lang = "php"; - else if(file.indexOf(".inc") > 0) lang = "php"; - else if(file.indexOf(".xml") > 0) lang = "xml"; - else if(file.indexOf(".js" ) > 0) lang = "js"; - else if(file.indexOf(".css") > 0) lang = "css"; + if (file.indexOf(".php") > 0) lang = "php"; + else if (file.indexOf(".inc") > 0) lang = "php"; + else if (file.indexOf(".xml") > 0) lang = "xml"; + else if (file.indexOf(".js" ) > 0) lang = "js"; + else if (file.indexOf(".css") > 0) lang = "css"; - if(jQuery("#highlight").checked && lang != "none") { + if (jQuery("#highlight").checked && lang != "none") { jQuery("fileContent").prop("className",lang + ":showcolumns"); dp.SyntaxHighlighter.HighlightAll("fileContent", true, false); } - } - else { + } else { jQuery("#fileStatus").html(values[0]); jQuery("#fileContent").val(""); } @@ -146,10 +146,10 @@ outputJavaScriptFileInline("javascript/base64.js"); function saveFile(file) { jQuery("#fileStatus").html("<?=gettext("Saving file"); ?> ..."); jQuery("#fileStatusBox").show(500); - + var fileContent = Base64.encode(jQuery("#fileContent").val()); fileContent = fileContent.replace(/\+/g,"%2B"); - + jQuery.ajax( "<?=$_SERVER['SCRIPT_NAME'];?>", { type: "post", @@ -207,7 +207,7 @@ outputJavaScriptFileInline("javascript/base64.js"); <div style="background:#eeeeee;" id="fileOutput"> <script type="text/javascript"> //<![CDATA[ - window.onload=function(){ + window.onload=function() { document.getElementById("fileContent").wrap='off'; } //]]> @@ -238,7 +238,7 @@ outputJavaScriptFileInline("javascript/base64.js"); } ); - <?php if($_GET['action'] == "load"): ?> + <?php if ($_GET['action'] == "load"): ?> jQuery(window).load( function() { jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path']);?>"); diff --git a/usr/local/www/exec.php b/usr/local/www/exec.php index 61fbcc5..f1da7a1 100644 --- a/usr/local/www/exec.php +++ b/usr/local/www/exec.php @@ -8,26 +8,26 @@ Copyright (C) 2013-2015 Electric Sheep Fencing, LP - 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. + 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. */ /* pfSense_MODULE: shell @@ -67,20 +67,23 @@ if (($_POST['submit'] == "Download") && file_exists($_POST['dlPath'])) { unset($_POST['txtCommand']); } -if($_POST) +if ($_POST) { conf_mount_rw(); +} // Function: is Blank // Returns true or false depending on blankness of argument. -function isBlank( $arg ) { return preg_match( "/^\s*$/", $arg ); } - +function isBlank($arg) { + return preg_match( "/^\s*$/", $arg ); +} // Function: Puts // Put string, Ruby-style. -function puts( $arg ) { echo "$arg\n"; } - +function puts($arg) { + echo "$arg\n"; +} // "Constants". @@ -100,7 +103,7 @@ include("head.inc"); <script type="text/javascript"> //<![CDATA[ - // Create recall buffer array (of encoded strings). + // Create recall buffer array (of encoded strings). <?php @@ -109,114 +112,116 @@ if (isBlank( $_POST['txtRecallBuffer'] )) { } else { puts( " var arrRecallBuffer = new Array(" ); $arrBuffer = explode( "&", $_POST['txtRecallBuffer'] ); - for ($i=0; $i < (count( $arrBuffer ) - 1); $i++) + for ($i=0; $i < (count( $arrBuffer ) - 1); $i++) { puts( " '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "'," ); + } puts( " '" . htmlspecialchars($arrBuffer[count( $arrBuffer ) - 1], ENT_QUOTES | ENT_HTML401) . "'" ); puts( " );" ); } ?> - // Set pointer to end of recall buffer. - var intRecallPtr = arrRecallBuffer.length-1; + // Set pointer to end of recall buffer. + var intRecallPtr = arrRecallBuffer.length-1; - // Functions to extend String class. - function str_encode() { return escape( this ) } - function str_decode() { return unescape( this ) } + // Functions to extend String class. + function str_encode() { return escape( this ) } + function str_decode() { return unescape( this ) } - // Extend string class to include encode() and decode() functions. - String.prototype.encode = str_encode - String.prototype.decode = str_decode + // Extend string class to include encode() and decode() functions. + String.prototype.encode = str_encode + String.prototype.decode = str_decode - // Function: is Blank - // Returns boolean true or false if argument is blank. - function isBlank( strArg ) { return strArg.match( /^\s*$/ ) } + // Function: is Blank + // Returns boolean true or false if argument is blank. + function isBlank( strArg ) { return strArg.match( /^\s*$/ ) } - // Function: frmExecPlus onSubmit (event handler) - // Builds the recall buffer from the command string on submit. - function frmExecPlus_onSubmit( form ) { + // Function: frmExecPlus onSubmit (event handler) + // Builds the recall buffer from the command string on submit. + function frmExecPlus_onSubmit( form ) { - if (!isBlank(form.txtCommand.value)) { - // If this command is repeat of last command, then do not store command. - if (form.txtCommand.value.encode() == arrRecallBuffer[arrRecallBuffer.length-1]) { return true } + if (!isBlank(form.txtCommand.value)) { + // If this command is repeat of last command, then do not store command. + if (form.txtCommand.value.encode() == arrRecallBuffer[arrRecallBuffer.length-1]) { return true } - // Stuff encoded command string into the recall buffer. - if (isBlank(form.txtRecallBuffer.value)) - form.txtRecallBuffer.value = form.txtCommand.value.encode(); - else - form.txtRecallBuffer.value += '&' + form.txtCommand.value.encode(); - } + // Stuff encoded command string into the recall buffer. + if (isBlank(form.txtRecallBuffer.value)) { + form.txtRecallBuffer.value = form.txtCommand.value.encode(); + } else { + form.txtRecallBuffer.value += '&' + form.txtCommand.value.encode(); + } + } - return true; - } + return true; + } - // Function: btnRecall onClick (event handler) - // Recalls command buffer going either up or down. - function btnRecall_onClick( form, n ) { + // Function: btnRecall onClick (event handler) + // Recalls command buffer going either up or down. + function btnRecall_onClick( form, n ) { - // If nothing in recall buffer, then error. - if (!arrRecallBuffer.length) { - alert( '<?=gettext("Nothing to recall"); ?>!' ); - form.txtCommand.focus(); - return; - } + // If nothing in recall buffer, then error. + if (!arrRecallBuffer.length) { + alert( '<?=gettext("Nothing to recall"); ?>!' ); + form.txtCommand.focus(); + return; + } - // Increment recall buffer pointer in positive or negative direction - // according to <n>. - intRecallPtr += n; + // Increment recall buffer pointer in positive or negative direction + // according to <n>. + intRecallPtr += n; - // Make sure the buffer stays circular. - if (intRecallPtr < 0) { intRecallPtr = arrRecallBuffer.length - 1 } - if (intRecallPtr > (arrRecallBuffer.length - 1)) { intRecallPtr = 0 } + // Make sure the buffer stays circular. + if (intRecallPtr < 0) { intRecallPtr = arrRecallBuffer.length - 1 } + if (intRecallPtr > (arrRecallBuffer.length - 1)) { intRecallPtr = 0 } - // Recall the command. - form.txtCommand.value = arrRecallBuffer[intRecallPtr].decode(); - } + // Recall the command. + form.txtCommand.value = arrRecallBuffer[intRecallPtr].decode(); + } - // Function: Reset onClick (event handler) - // Resets form on reset button click event. - function Reset_onClick( form ) { + // Function: Reset onClick (event handler) + // Resets form on reset button click event. + function Reset_onClick( form ) { - // Reset recall buffer pointer. - intRecallPtr = arrRecallBuffer.length; + // Reset recall buffer pointer. + intRecallPtr = arrRecallBuffer.length; - // Clear form (could have spaces in it) and return focus ready for cmd. - form.txtCommand.value = ''; - form.txtCommand.focus(); + // Clear form (could have spaces in it) and return focus ready for cmd. + form.txtCommand.value = ''; + form.txtCommand.focus(); - return true; - } + return true; + } //]]> </script> <style type="text/css"> /*<![CDATA[*/ input { - font-family: courier new, courier; - font-weight: normal; - font-size: 9pt; + font-family: courier new, courier; + font-weight: normal; + font-size: 9pt; } pre { - border: 2px solid #435370; - background: #F0F0F0; - padding: 1em; - font-family: courier new, courier; - white-space: pre; - line-height: 10pt; - font-size: 10pt; + border: 2px solid #435370; + background: #F0F0F0; + padding: 1em; + font-family: courier new, courier; + white-space: pre; + line-height: 10pt; + font-size: 10pt; } .label { - font-family: tahoma, verdana, arial, helvetica; - font-size: 11px; - font-weight: bold; + font-family: tahoma, verdana, arial, helvetica; + font-size: 11px; + font-weight: bold; } .button { - font-family: tahoma, verdana, arial, helvetica; - font-weight: bold; - font-size: 11px; + font-family: tahoma, verdana, arial, helvetica; + font-weight: bold; + font-size: 11px; } /*]]>*/ @@ -232,100 +237,104 @@ pre { <?php if (!isBlank($_POST['txtCommand'])) { - puts("<pre>"); - puts("\$ " . htmlspecialchars($_POST['txtCommand'])); - putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); - putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); /* PHP scripts */ - $ph = popen($_POST['txtCommand'] . ' 2>&1', "r" ); - while ($line = fgets($ph)) echo htmlspecialchars($line); - pclose($ph); - puts(" </pre>"); + puts("<pre>"); + puts("\$ " . htmlspecialchars($_POST['txtCommand'])); + putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); + putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); /* PHP scripts */ + $ph = popen($_POST['txtCommand'] . ' 2>&1', "r" ); + while ($line = fgets($ph)) { + echo htmlspecialchars($line); + } + pclose($ph); + puts(" </pre>"); } if (!isBlank($_POST['txtPHPCommand'])) { - puts("<pre>"); - require_once("config.inc"); - require_once("functions.inc"); - echo eval($_POST['txtPHPCommand']); - puts(" </pre>"); + puts("<pre>"); + require_once("config.inc"); + require_once("functions.inc"); + echo eval($_POST['txtPHPCommand']); + puts(" </pre>"); } ?> <div id="niftyOutter"> <form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit( this );"> - <table summary="exec"> - <tr> - <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Execute Shell command"); ?></td> - </tr> - <tr> - <td class="label" align="right"><?=gettext("Command"); ?>:</td> - <td class="type"><input id="txtCommand" name="txtCommand" type="text" class="formfld unknown" size="80" value="<?=htmlspecialchars($_POST['txtCommand']);?>" /></td> - </tr> - <tr> - <td valign="top"> </td> - <td valign="top" class="label"> - <input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" /> - <input type="button" class="button" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" /> - <input type="submit" class="button" value="<?=gettext("Execute"); ?>" /> - <input type="button" class="button" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" /> - <input type="button" class="button" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" /> - </td> - </tr> - <tr> - <td colspan="2" valign="top" height="16"></td> - </tr> - <tr> - <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Download"); ?></td> - </tr> - <tr> - <td align="right"><?=gettext("File to download"); ?>:</td> - <td> - <input name="dlPath" type="text" class="formfld file" id="dlPath" size="50" /> - </td></tr> - <tr> - <td valign="top"> </td> - <td valign="top" class="label"> - <input name="submit" type="submit" class="button" id="download" value="<?=gettext("Download"); ?>" /> - </td> - </tr> - <tr> - <td colspan="2" valign="top" height="16"></td> - </tr> - <tr> - <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Upload"); ?></td> - </tr> - <tr> - <td align="right"><?=gettext("File to upload"); ?>:</td> - <td valign="top" class="label"> - <input name="ulfile" type="file" class="formfld file" id="ulfile" /> - </td></tr> - <tr> - <td valign="top"> </td> - <td valign="top" class="label"> - <input name="submit" type="submit" class="button" id="upload" value="<?=gettext("Upload"); ?>" /></td> - </tr> - <tr> - <td colspan="2" valign="top" height="16"></td> - </tr> - <tr> - <td colspan="2" valign="top" class="vnsepcell"><?=gettext("PHP Execute"); ?></td> - </tr> - <tr> - <td align="right"><?=gettext("Command"); ?>:</td> - <td class="type"><textarea id="txtPHPCommand" name="txtPHPCommand" rows="9" cols="80"><?=htmlspecialchars($_POST['txtPHPCommand']);?></textarea></td> - </tr> - <tr> - <td valign="top"> </td> - <td valign="top" class="label"> - <input type="submit" class="button" value="<?=gettext("Execute"); ?>" /> - <p> - <strong><?=gettext("Example"); ?>:</strong> interfaces_sync_setup(); - </p> - </td> - </tr> - - </table> + <table summary="exec"> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Execute Shell command"); ?></td> + </tr> + <tr> + <td class="label" align="right"><?=gettext("Command"); ?>:</td> + <td class="type"><input id="txtCommand" name="txtCommand" type="text" class="formfld unknown" size="80" value="<?=htmlspecialchars($_POST['txtCommand']);?>" /></td> + </tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" /> + <input type="button" class="button" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" /> + <input type="submit" class="button" value="<?=gettext("Execute"); ?>" /> + <input type="button" class="button" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" /> + <input type="button" class="button" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" /> + </td> + </tr> + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Download"); ?></td> + </tr> + <tr> + <td align="right"><?=gettext("File to download"); ?>:</td> + <td> + <input name="dlPath" type="text" class="formfld file" id="dlPath" size="50" /> + </td> + </tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input name="submit" type="submit" class="button" id="download" value="<?=gettext("Download"); ?>" /> + </td> + </tr> + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Upload"); ?></td> + </tr> + <tr> + <td align="right"><?=gettext("File to upload"); ?>:</td> + <td valign="top" class="label"> + <input name="ulfile" type="file" class="formfld file" id="ulfile" /> + </td> + </tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input name="submit" type="submit" class="button" id="upload" value="<?=gettext("Upload"); ?>" /></td> + </tr> + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("PHP Execute"); ?></td> + </tr> + <tr> + <td align="right"><?=gettext("Command"); ?>:</td> + <td class="type"><textarea id="txtPHPCommand" name="txtPHPCommand" rows="9" cols="80"><?=htmlspecialchars($_POST['txtPHPCommand']);?></textarea></td> + </tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input type="submit" class="button" value="<?=gettext("Execute"); ?>" /> + <p> + <strong><?=gettext("Example"); ?>:</strong> interfaces_sync_setup(); + </p> + </td> + </tr> + + </table> </form> </div> <?php include("fend.inc"); ?> @@ -339,7 +348,8 @@ document.forms[0].txtCommand.focus(); <?php -if($_POST) +if ($_POST) { conf_mount_ro(); +} ?> diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php index 7862257..cede7d9 100755 --- a/usr/local/www/graph.php +++ b/usr/local/www/graph.php @@ -55,21 +55,24 @@ $ifnum = get_real_interface($ifnum); $ifname=@$_GET["ifname"]?$_GET["ifname"]:"Interface $ifnum"; //Interface name that will be showed on top right of graph /********* Other conf *******/ -if (isset($config["widgets"]["trafficgraphs"]["scale_type"])) +if (isset($config["widgets"]["trafficgraphs"]["scale_type"])) { $scale_type = $config["widgets"]["trafficgraphs"]["scale_type"]; -else +} else { $scale_type = "up"; +} $nb_plot=120; //NB plot in graph -if ($_GET["timeint"]) +if ($_GET["timeint"]) { $time_interval = $_GET["timeint"]; //Refresh time Interval -else +} else { $time_interval = 3; +} -if ($_GET["initdelay"]) +if ($_GET["initdelay"]) { $init_delay = $_GET["initdelay"]; //Initial Delay -else +} else { $init_delay = 3; +} //SVG attributes $attribs['axis']='fill="black" stroke="black"'; @@ -95,7 +98,7 @@ $width=200; //SVG internal width : do not modify $fetch_link = "ifstats.php?if=" . htmlspecialchars($ifnum); /* check for custom theme colors */ -if(file_exists("/usr/local/www/themes/{$g['theme']}/graph.php")) { +if (file_exists("/usr/local/www/themes/{$g['theme']}/graph.php")) { $themetxt = file_get_contents("/usr/local/www/themes/{$g['theme']}/graph.php"); eval($themetxt); } @@ -149,8 +152,7 @@ if (typeof getURL == 'undefined') { var http_request = null; if (typeof XMLHttpRequest != 'undefined') { http_request = new XMLHttpRequest(); - } - else if (typeof ActiveXObject != 'undefined') { + } else if (typeof ActiveXObject != 'undefined') { try { http_request = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { @@ -276,8 +278,7 @@ function plot_data(obj) { max = plot_in[index_plot]; if (plot_out[index_plot] > max) max = plot_out[index_plot]; - } - else if (scale_type == 'follow') { + } else if (scale_type == 'follow') { i = 0; max = 0; while (i < plot_in.length) { diff --git a/usr/local/www/graph_cpu.php b/usr/local/www/graph_cpu.php index 2258f8a..b92c953 100644 --- a/usr/local/www/graph_cpu.php +++ b/usr/local/www/graph_cpu.php @@ -2,22 +2,22 @@ /* $Id$ part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2013-2015 Electric Sheep Fencing, LP Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net> and Jonathan Watt <jwatt@jwatt.org>. 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 @@ -105,8 +105,7 @@ if (typeof getURL == 'undefined') { var http_request = null; if (typeof XMLHttpRequest != 'undefined') { http_request = new XMLHttpRequest(); - } - else if (typeof ActiveXObject != 'undefined') { + } else if (typeof ActiveXObject != 'undefined') { try { http_request = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { diff --git a/usr/local/www/help.php b/usr/local/www/help.php index 26b1203..8374d3b 100644 --- a/usr/local/www/help.php +++ b/usr/local/www/help.php @@ -238,7 +238,7 @@ $helppages = array( 'services_unbound_host_edit.php' => 'https://doc.pfsense.org/index.php/Unbound_DNS_Resolver', 'diag_gmirror.php' => 'https://doc.pfsense.org/index.php/Create_a_Software_RAID1_%28gmirror%29', - /* From here down are packages. Not checking these as strictly, + /* From here down are packages. Not checking these as strictly, any information is better than nothing. */ 'olsrd.xml' => 'https://doc.pfsense.org/index.php/OLSR_Daemon', 'routed.xml' => 'https://doc.pfsense.org/index.php/Routing_Information_Protocol_(RIP)', # RIP @@ -368,7 +368,6 @@ if (array_key_exists($pagename, $helppages)) { if (empty($helppage)) { $helppage = 'https://doc.pfsense.org/index.php/No_Help_Found'; - } /* Redirect to help page. */ diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 33939db..f9f46a4 100644 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -56,33 +56,36 @@ require_once('functions.inc'); require_once('notices.inc'); require_once("pkg-utils.inc"); -if(isset($_REQUEST['closenotice'])){ +if (isset($_REQUEST['closenotice'])) { close_notice($_REQUEST['closenotice']); echo get_menu_messages(); exit; } -if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['aliasid'])){ +if ($_REQUEST['act'] == 'alias_info_popup' && !preg_match("/\D/",$_REQUEST['aliasid'])) { alias_info_popup($_REQUEST['aliasid']); exit; } -if($g['disablecrashreporter'] != true) { +if ($g['disablecrashreporter'] != true) { // Check to see if we have a crash report $x = 0; - if(file_exists("/tmp/PHP_errors.log")) { + if (file_exists("/tmp/PHP_errors.log")) { $total = `/usr/bin/grep -vi warning /tmp/PHP_errors.log | /usr/bin/wc -l | /usr/bin/awk '{ print $1 }'`; - if($total > 0) + if ($total > 0) { $x++; + } } $crash = glob("/var/crash/*"); $skip_files = array(".", "..", "minfree", ""); - if(is_array($crash)) { - foreach($crash as $c) { - if (!in_array(basename($c), $skip_files)) + if (is_array($crash)) { + foreach ($crash as $c) { + if (!in_array(basename($c), $skip_files)) { $x++; + } } - if($x > 0) + if ($x > 0) { $savemsg = "{$g['product_name']} has detected a crash report or programming bug. Click <a href='crash_reporter.php'>here</a> for more information."; + } } } @@ -97,12 +100,14 @@ $widgetlist = array(); while (false !== ($filename = readdir($dirhandle))) { $periodpos = strpos($filename, "."); /* Ignore files not ending in .php */ - if (substr($filename, -4, 4) != ".php") + if (substr($filename, -4, 4) != ".php") { continue; + } $widgetname = substr($filename, 0, $periodpos); $widgetnames[] = $widgetname; - if ($widgetname != "system_information") + if ($widgetname != "system_information") { $widgetfiles[] = $filename; + } } ##sort widgets alphabetically @@ -116,54 +121,56 @@ if (!is_array($config['widgets'])) { $config['widgets'] = array(); } - if ($_POST && $_POST['submit']) { - $config['widgets']['sequence'] = $_POST['sequence']; +if ($_POST && $_POST['submit']) { + $config['widgets']['sequence'] = $_POST['sequence']; - foreach ($widgetnames as $widget){ - if ($_POST[$widget . '-config']){ - $config['widgets'][$widget . '-config'] = $_POST[$widget . '-config']; - } + foreach ($widgetnames as $widget) { + if ($_POST[$widget . '-config']) { + $config['widgets'][$widget . '-config'] = $_POST[$widget . '-config']; } - - write_config(gettext("Widget configuration has been changed.")); - header("Location: index.php"); - exit; } - ## Load Functions Files - require_once('includes/functions.inc.php'); + write_config(gettext("Widget configuration has been changed.")); + header("Location: index.php"); + exit; +} + +## Load Functions Files +require_once('includes/functions.inc.php'); - ## Check to see if we have a swap space, - ## if true, display, if false, hide it ... - if(file_exists("/usr/sbin/swapinfo")) { - $swapinfo = `/usr/sbin/swapinfo`; - if(stristr($swapinfo,'%') == true) $showswap=true; +## Check to see if we have a swap space, +## if true, display, if false, hide it ... +if (file_exists("/usr/sbin/swapinfo")) { + $swapinfo = `/usr/sbin/swapinfo`; + if (stristr($swapinfo,'%') == true) { + $showswap=true; } +} - ## User recently restored his config. - ## If packages are installed lets resync - if(file_exists('/conf/needs_package_sync')) { - if($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) { - if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") { - ## If the user has logged into webGUI quickly while the system is booting then do not redirect them to - ## the package reinstall page. That is about to be done by the boot script anyway. - ## The code in fbegin.inc will put up a notice to the user. - if (!platform_booting()) { - header('Location: pkg_mgr_install.php?mode=reinstallall'); - exit; - } +## User recently restored his config. +## If packages are installed lets resync +if (file_exists('/conf/needs_package_sync')) { + if ($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) { + if ($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") { + ## If the user has logged into webGUI quickly while the system is booting then do not redirect them to + ## the package reinstall page. That is about to be done by the boot script anyway. + ## The code in fbegin.inc will put up a notice to the user. + if (!platform_booting()) { + header('Location: pkg_mgr_install.php?mode=reinstallall'); + exit; } - } else { - conf_mount_rw(); - @unlink('/conf/needs_package_sync'); - conf_mount_ro(); } + } else { + conf_mount_rw(); + @unlink('/conf/needs_package_sync'); + conf_mount_ro(); } +} - ## If it is the first time webConfigurator has been - ## accessed since initial install show this stuff. - if(file_exists('/conf/trigger_initial_wizard')) { - echo <<<EOF +## If it is the first time webConfigurator has been +## accessed since initial install show this stuff. +if (file_exists('/conf/trigger_initial_wizard')) { + echo <<<EOF <!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="<?=system_get_language_code();?>" xml:lang="<?=system_get_language_code();?>"> @@ -176,52 +183,53 @@ if (!is_array($config['widgets'])) { EOF; - echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n"; + echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n"; - if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) - echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n"; - else - echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />"; - - echo "<form>\n"; - echo "<center>\n"; - echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\" alt=\"logo\" /><p>\n"; - echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n"; - echo sprintf(gettext("Welcome to %s!\n"),$g['product_name']) . "<p>"; - echo gettext("One moment while we start the initial setup wizard.") . "<p>\n"; - echo gettext("Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.") . "<p>\n"; - echo sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."),$g['product_name']) . "\n"; - echo "</div>\n"; - echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n"; - echo "<script type=\"text/javascript\">\n"; - echo "//<![CDATA[\n"; - echo "NiftyCheck();\n"; - echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n"; - echo "//]]>\n"; - echo "</script>\n"; - exit; + if (file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) { + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n"; + } else { + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />"; } + echo "<form>\n"; + echo "<center>\n"; + echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\" alt=\"logo\" /><p>\n"; + echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n"; + echo sprintf(gettext("Welcome to %s!\n"),$g['product_name']) . "<p>"; + echo gettext("One moment while we start the initial setup wizard.") . "<p>\n"; + echo gettext("Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.") . "<p>\n"; + echo sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."),$g['product_name']) . "\n"; + echo "</div>\n"; + echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n"; + echo "<script type=\"text/javascript\">\n"; + echo "//<![CDATA[\n"; + echo "NiftyCheck();\n"; + echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n"; + echo "//]]>\n"; + echo "</script>\n"; + exit; +} - ## Find out whether there's hardware encryption or not - unset($hwcrypto); - $fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); - if ($fd) { - while (!feof($fd)) { - $dmesgl = fgets($fd); - if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) - or preg_match("/.*(VIA Padlock)/", $dmesgl, $matches) - or preg_match("/^safe.: (\w.*)/", $dmesgl, $matches) - or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) - or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) - or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches) - or preg_match("/^aesni.: (.*?),/", $dmesgl, $matches)) { - $hwcrypto = $matches[1]; - break; - } + +## Find out whether there's hardware encryption or not +unset($hwcrypto); +$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); +if ($fd) { + while (!feof($fd)) { + $dmesgl = fgets($fd); + if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) or + preg_match("/.*(VIA Padlock)/", $dmesgl, $matches) or + preg_match("/^safe.: (\w.*)/", $dmesgl, $matches) or + preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or + preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) or + preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches) or + preg_match("/^aesni.: (.*?),/", $dmesgl, $matches)) { + $hwcrypto = $matches[1]; + break; } - fclose($fd); } + fclose($fd); +} ##build widget saved list information if ($config['widgets'] && $config['widgets']['sequence'] != "") { @@ -234,7 +242,7 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") { $widgetlist = explode(",",$widgetlist); ##read the widget position and display information - foreach ($widgetlist as $widget){ + foreach ($widgetlist as $widget) { $dashpos = strpos($widget, "-"); $widgetname = substr($widget, 0, $dashpos); $colposition = strpos($widget, ":"); @@ -245,21 +253,21 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") { } ##add widgets that may not be in the saved configuration, in case they are to be displayed later - foreach ($widgetfiles as $defaultwidgets){ - if (!in_array($defaultwidgets, $savedwidgetfiles)){ + foreach ($widgetfiles as $defaultwidgets) { + if (!in_array($defaultwidgets, $savedwidgetfiles)) { $savedwidgetfiles[] = $defaultwidgets; } } ##find custom configurations of a particular widget and load its info to $pconfig - foreach ($widgetnames as $widget){ - if ($config['widgets'][$widget . '-config']){ + foreach ($widgetnames as $widget) { + if ($config['widgets'][$widget . '-config']) { $pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config']; } } $widgetlist = $savedwidgetfiles; -} else{ +} else { // no saved widget sequence found, build default list. $widgetlist = $widgetfiles; } @@ -272,9 +280,10 @@ $filename = ""; while (false !== ($filename = readdir($dirhandle))) { $phpincludefiles[] = $filename; } -foreach($phpincludefiles as $includename) { - if(!stristr($includename, ".inc")) +foreach ($phpincludefiles as $includename) { + if (!stristr($includename, ".inc")) { continue; + } include($directory . $includename); } @@ -301,7 +310,7 @@ function widgetAjax(widget) { }, success: function(data) { widget2 = '#' + widget + "-loader"; - jQuery(widget2).fadeOut(1000,function(){ + jQuery(widget2).fadeOut(1000,function() { jQuery('#' + widget).show(); }); jQuery('#' + widget).html(data); @@ -311,7 +320,7 @@ function widgetAjax(widget) { } -function addWidget(selectedDiv){ +function addWidget(selectedDiv) { selectedDiv2 = '#' + selectedDiv + "-container"; if (jQuery(selectedDiv2).css('display') != "none") { @@ -327,20 +336,21 @@ function addWidget(selectedDiv){ } } -function configureWidget(selectedDiv){ +function configureWidget(selectedDiv) { selectIntLink = '#' + selectedDiv + "-settings"; - if (jQuery(selectIntLink).css('display') == "none") + if (jQuery(selectIntLink).css('display') == "none") { jQuery(selectIntLink).show(); - else + } else { jQuery(selectIntLink).hide(); + } } -function showWidget(selectedDiv,swapButtons){ +function showWidget(selectedDiv,swapButtons) { //appear element jQuery('#' + selectedDiv).show('blind'); showSave(); d = document; - if (swapButtons){ + if (swapButtons) { selectIntLink = selectedDiv + "-min"; textlink = d.getElementById(selectIntLink); textlink.style.display = "inline"; @@ -357,12 +367,12 @@ function showWidget(selectedDiv,swapButtons){ } -function minimizeWidget(selectedDiv,swapButtons){ +function minimizeWidget(selectedDiv,swapButtons) { //fade element jQuery('#' + selectedDiv).hide('blind'); showSave(); d = document; - if (swapButtons){ + if (swapButtons) { selectIntLink = selectedDiv + "-open"; textlink = d.getElementById(selectIntLink); textlink.style.display = "inline"; @@ -377,7 +387,7 @@ function minimizeWidget(selectedDiv,swapButtons){ } -function closeWidget(selectedDiv){ +function closeWidget(selectedDiv) { showSave(); selectedDiv2 = "#" + selectedDiv + "-container"; jQuery(selectedDiv2).hide('blind'); @@ -385,21 +395,22 @@ function closeWidget(selectedDiv){ jQuery(selectIntLink).val("close"); } -function showSave(){ +function showSave() { d = document; selectIntLink = "submit"; textlink = d.getElementById(selectIntLink); textlink.style.display = "inline"; } -function updatePref(){ +function updatePref() { var widgets = document.getElementsByClassName('widgetdiv'); var widgetSequence = ""; var firstprint = false; d = document; - for (i=0; i<widgets.length; i++){ - if (firstprint) + for (i=0; i<widgets.length; i++) { + if (firstprint) { widgetSequence += ","; + } var widget = widgets[i].id; widgetSequence += widget + ":" + widgets[i].parentNode.id + ":"; widget = widget + "-input"; @@ -413,16 +424,16 @@ function updatePref(){ return true; } -function hideAllWidgets(){ - jQuery('#niftyOutter').fadeTo('slow',0.2); +function hideAllWidgets() { + jQuery('#niftyOutter').fadeTo('slow',0.2); } -function showAllWidgets(){ - jQuery('#niftyOutter').fadeTo('slow',1.0); +function showAllWidgets() { + jQuery('#niftyOutter').fadeTo('slow',1.0); } -function changeTabDIV(selectedDiv){ +function changeTabDIV(selectedDiv) { var dashpos = selectedDiv.indexOf("-"); var tabclass = selectedDiv.substring(0,dashpos); d = document; @@ -431,11 +442,11 @@ function changeTabDIV(selectedDiv){ tabclass = tabclass + "-class-tabdeactive"; var tabs = document.getElementsByClassName(tabclass); var incTabSelected = selectedDiv + "-deactive"; - for (i=0; i<tabs.length; i++){ + for (i=0; i<tabs.length; i++) { var tab = tabs[i].id; dashpos = tab.lastIndexOf("-"); var tab2 = tab.substring(0,dashpos) + "-deactive"; - if (tab2 == incTabSelected){ + if (tab2 == incTabSelected) { tablink = d.getElementById(tab2); tablink.style.display = "none"; tab2 = tab.substring(0,dashpos) + "-active"; @@ -485,81 +496,84 @@ columns = ['col1','col2','col3','col4', 'col5','col6','col7','col8','col9','col1 <?php include("fbegin.inc"); echo $jscriptstr; - if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo")) - echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\" alt=\"big logo\" /></center><br />"; +if (!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo")) { + echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\" alt=\"big logo\" /></center><br />"; +} /* Print package server mismatch warning. See https://redmine.pfsense.org/issues/484 */ -if (!verify_all_package_servers()) +if (!verify_all_package_servers()) { print_info_box(package_server_mismatch_message()); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg); +} pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); ?> <div id="widgetcontainer" style="display:none"> - <div id="content1"><h1><?=gettext("Available Widgets"); ?></h1><p><?php - $widgetfiles_add = $widgetfiles; - sort($widgetfiles_add); - foreach($widgetfiles_add as $widget) { - if(!stristr($widget, "widget.php")) - continue; - - $periodpos = strpos($widget, "."); - $widgetname = substr($widget, 0, $periodpos); - $nicename = $widgetname; - $nicename = str_replace("_", " ", $nicename); - //make the title look nice - $nicename = ucwords($nicename); - - $widgettitle = $widgetname . "_title"; - $widgettitlelink = $widgetname . "_title_link"; - if ($$widgettitle != "") - { - //echo widget title - ?> - <span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'> - <u><?php echo $$widgettitle; ?></u></span><br /> - <?php - } - else {?> - <span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'> - <u><?php echo $nicename; ?></u></span><br /><?php - } + <div id="content1"><h1><?=gettext("Available Widgets"); ?></h1><p><?php + $widgetfiles_add = $widgetfiles; + sort($widgetfiles_add); + foreach ($widgetfiles_add as $widget) { + if (!stristr($widget, "widget.php")) { + continue; + } + + $periodpos = strpos($widget, "."); + $widgetname = substr($widget, 0, $periodpos); + $nicename = $widgetname; + $nicename = str_replace("_", " ", $nicename); + //make the title look nice + $nicename = ucwords($nicename); + + $widgettitle = $widgetname . "_title"; + $widgettitlelink = $widgetname . "_title_link"; + if ($$widgettitle != "") { + //echo widget title + ?> + <span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'> + <u><?php echo $$widgettitle; ?></u></span><br /> + <?php + } else { + ?> + <span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'> + <u><?php echo $nicename; ?></u></span><br /><?php } + } ?> </p> </div> </div> <div id="welcomecontainer" style="display:none"> - <div id="welcome-container"> - <div style="float:left;width:100%;padding: 2px"> - <h1><?=gettext("Welcome to the Dashboard page"); ?>!</h1> - </div> - <div onclick="domTT_close(this);showAllWidgets();" style="width:87%; position: absolute; cursor:pointer; padding: 10px;" > - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" alt="close" style="float:right" /> - </div> - <div style="clear:both;"></div> - <p> - <?=gettext("This page allows you to customize the information you want to be displayed!");?><br /> - <?=gettext("To get started click the");?> <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="plus" /> <?=gettext("icon to add widgets.");?><br /> - <br /> - <?=gettext("You can move any widget around by clicking and dragging the title.");?> - </p> + <div id="welcome-container"> + <div style="float:left;width:100%;padding: 2px"> + <h1><?=gettext("Welcome to the Dashboard page"); ?>!</h1> + </div> + <div onclick="domTT_close(this);showAllWidgets();" style="width:87%; position: absolute; cursor:pointer; padding: 10px;" > + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" alt="close" style="float:right" /> + </div> + <div style="clear:both;"> + </div> + <p> + <?=gettext("This page allows you to customize the information you want to be displayed!");?><br /> + <?=gettext("To get started click the");?> <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="plus" /> <?=gettext("icon to add widgets.");?><br /> + <br /> + <?=gettext("You can move any widget around by clicking and dragging the title.");?> + </p> </div> </div> <form action="index.php" method="post"> -<input type="hidden" value="" name="sequence" id="sequence" /> -<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="<?=gettext("Click here to add widgets"); ?>" style="cursor: pointer;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> - -<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" alt="<?=gettext("Click here for help"); ?>" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> + <input type="hidden" value="" name="sequence" id="sequence" /> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="<?=gettext("Click here to add widgets"); ?>" style="cursor: pointer;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" alt="<?=gettext("Click here for help"); ?>" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> - <input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="<?=gettext("Save Settings");?>" /> + <input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="<?=gettext("Save Settings");?>" /> </form> <!-- fakeClass contains no CSS but is used as an identifier in theme pfsense_ng_fs - loader.js --> <div id="niftyOutter" class="fakeClass"> @@ -574,13 +588,14 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); <div id="col1" style="float:left;width:49%;padding-bottom:40px" class="ui-sortable"> <?php - foreach($widgetlist as $widget) { + foreach ($widgetlist as $widget) { - if(!stristr($widget, "widget.php")) - continue; + if (!stristr($widget, "widget.php")) { + continue; + } $periodpos = strpos($widget, "."); $widgetname = substr($widget, 0, $periodpos); - if ($widgetname != ""){ + if ($widgetname != "") { $nicename = $widgetname; $nicename = str_replace("_", " ", $nicename); @@ -588,8 +603,8 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); $nicename = ucwords($nicename); } - if ($config['widgets'] && $pconfig['sequence'] != ""){ - switch($displayarray[$widgetcounter]){ + if ($config['widgets'] && $pconfig['sequence'] != "") { + switch ($displayarray[$widgetcounter]) { case "show": $divdisplay = "block"; $display = "block"; @@ -620,7 +635,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); break; } } else { - if ($firstprint == false){ + if ($firstprint == false) { $divdisplay = "block"; $display = "block"; $inputdisplay = "show"; @@ -648,36 +663,31 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); } } - if( substr($g['theme'], -3) != "_fs") { - if ($config['widgets'] && $pconfig['sequence'] != ""){ - if ($colpos[$widgetcounter] == "col2" && $printed == false) - { + if (substr($g['theme'], -3) != "_fs") { + if ($config['widgets'] && $pconfig['sequence'] != "") { + if ($colpos[$widgetcounter] == "col2" && $printed == false) { $printed = true; ?> </div> <div id="col2" style="float:right;width:49%;padding-bottom:40px" class="ui-sortable"> <?php } - } - else if ($widgetcounter >= $halftotal && $printed == false){ + } else if ($widgetcounter >= $halftotal && $printed == false) { $printed = true; ?> </div> <div id="col2" style="float:right;width:49%;padding-bottom:40px" class="ui-sortable"> <?php } - } - else { + } else { if ($config['widgets'] && $pconfig['sequence'] != "") { - if ($colpos[$widgetcounter] == "col2" && $printed == false) - { + if ($colpos[$widgetcounter] == "col2" && $printed == false) { $printed = true; ?> </div> <div id="col2" style="float:right;width:49%;padding-bottom:40px" class="ui-sortable"> <?php - } - else { ?> + } else { ?> <script type="text/javascript"> //<![CDATA[ var colpos = "<?=$colpos[$widgetcounter]?>"; @@ -685,12 +695,12 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); //]]> </script> <?php } - } + } } ?> <div style="clear:both;"></div> - <div id="<?php echo $widgetname;?>-container" class="widgetdiv" style="display:<?php echo $divdisplay; ?>;"> + <div id="<?php echo $widgetname;?>-container" class="widgetdiv" style="display:<?php echo $divdisplay; ?>;"> <input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-container-input" name="<?php echo $widgetname;?>-container-input" /> <div id="<?php echo $widgetname;?>-topic" class="widgetheader" style="cursor:move"> <div style="float:left;"> @@ -698,24 +708,22 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); $widgettitle = $widgetname . "_title"; $widgettitlelink = $widgetname . "_title_link"; - if ($$widgettitle != "") - { + if ($$widgettitle != "") { //only show link if defined if ($$widgettitlelink != "") {?> <u><span onclick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer"> <?php } - //echo widget title - echo $$widgettitle; + //echo widget title + echo $$widgettitle; if ($$widgettitlelink != "") { ?> </span></u> <?php } - } - else{ + } else { if ($$widgettitlelink != "") {?> <u><span onclick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer"> <?php } echo $nicename; - if ($$widgettitlelink != "") { ?> + if ($$widgettitlelink != "") { ?> </span></u> <?php } } @@ -737,8 +745,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); </div> <?php $display = "none"; } ?> <div id="<?php echo $widgetname;?>" style="display:<?php echo $display; ?>;"> <?php - if ($divdisplay == "block") - { + if ($divdisplay == "block") { include($directory . $widget); } ?> @@ -762,7 +769,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); { jQuery('.ui-sortable').sortable({connectWith: '.ui-sortable', dropOnEmpty: true, handle: '.widgetheader', change: showSave}); - <?php if (!$config['widgets'] && $pconfig['sequence'] != ""){ ?> + <?php if (!$config['widgets'] && $pconfig['sequence'] != "") { ?> hideAllWidgets(); domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle'); <?php } ?> @@ -778,9 +785,10 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); while (false !== ($filename = readdir($dirhandle))) { $jsincludefiles[] = $filename; } - foreach($jsincludefiles as $jsincludename) { - if(!preg_match('/\.js$/', $jsincludename)) + foreach ($jsincludefiles as $jsincludename) { + if (!preg_match('/\.js$/', $jsincludename)) { continue; + } echo "<script src='{$directory}{$jsincludename}' type='text/javascript'></script>\n"; } ?> diff --git a/usr/local/www/reboot.php b/usr/local/www/reboot.php index 088587f..6025648 100755 --- a/usr/local/www/reboot.php +++ b/usr/local/www/reboot.php @@ -1,23 +1,23 @@ -<?php +<?php /* $Id$ */ /* reboot.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2013-2015 Electric Sheep Fencing, LP 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 |