Commit 67601e0d authored by Franco Fichtner's avatar Franco Fichtner

globals: prune softcoded paths that are never gonna change anyway

Enables us to find all paths better using grep.  Always trying to
use the full path, even for system utility invoke in case those
move from ports to base or vice versa, related to #1.
parent 0d905150
<?php
/****h* pfSense/config
* NAME
* config.inc - Functions to manipulate config.xml
* DESCRIPTION
* This include contains various config.xml specific functions.
* HISTORY
* $Id$
******
config.inc
Copyright (C) 2004-2010 Scott Ullrich
All rights reserved.
originally part of m0n0wall (http://m0n0.ch/wall)
/*
Copyright (C) 2004-2010 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
......@@ -36,10 +25,6 @@
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_BUILDER_BINARIES: /sbin/mount /sbin/umount /sbin/halt /sbin/fsck
pfSense_MODULE: config
*/
if($g['booting']) echo ".";
......@@ -112,7 +97,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
unset($cfgdevice);
if($g['booting']) echo ".";
/* check if there's already an fstab (NFS booting?) */
if (!file_exists("{$g['etc_path']}/fstab")) {
if (!file_exists('/etc/fstab')) {
if($g['booting']) echo ".";
if (strstr($g['platform'], "cdrom")) {
/* config is on floppy disk for CD-ROM version */
......@@ -188,7 +173,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
fclose($fd);
/* write out an fstab */
$fd = fopen("{$g['etc_path']}/fstab", "w");
$fd = fopen('/etc/fstab', 'w');
$fstab = "/dev/{$cfgpartition} {$g['cf_path']} {$cfgfstype} ro,noatime 1 1\n";
$fstab .= "proc /proc procfs rw 0 0\n";
......
......@@ -43,13 +43,10 @@ $g = array(
"varetc_path" => "/var/etc",
"vardb_path" => "/var/db",
"varlog_path" => "/var/log",
"etc_path" => "/etc",
"tmp_path" => "/tmp",
"conf_path" => "/conf",
"ftmp_path" => "/ftmp",
"cf_path" => "/cf",
"cf_conf_path" => "/cf/conf",
"www_path" => "/usr/local/www",
"xml_rootobj" => "pfsense",
"admin_group" => "admins",
"product_name" => "OPNsense",
......
<?php
/*
part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
......@@ -28,16 +26,6 @@
POSSIBILITY OF SUCH DAMAGE.
*/
/*
pfSense_BUILDER_BINARIES: /usr/sbin/powerd /usr/bin/killall /sbin/route
pfSense_BUILDER_BINARIES: /bin/hostname /bin/ls /usr/local/sbin/syslogd
pfSense_BUILDER_BINARIES: /usr/sbin/pccardd /usr/local/sbin/lighttpd /bin/chmod /bin/mkdir
pfSense_BUILDER_BINARIES: /usr/bin/tar /usr/local/sbin/ntpd /usr/local/sbin/ntpdate
pfSense_BUILDER_BINARIES: /usr/bin/nohup /sbin/dmesg /usr/local/sbin/atareinit /sbin/kldload
pfSense_BUILDER_BINARIES: /usr/local/sbin/filterdns
pfSense_MODULE: utils
*/
function activate_powerd()
{
global $config, $g;
......@@ -821,7 +809,7 @@ function system_webgui_start() {
if ($g['booting'])
echo gettext("Starting webConfigurator...");
chdir($g['www_path']);
chdir('/usr/local/www');
/* defaults */
$portarg = "80";
......
......@@ -127,11 +127,14 @@ function cData_attr($parser, $data) {
}
}
function parse_xml_regdomain(&$rdattributes, $rdfile = '', $rootobj = 'regulatory-data') {
function parse_xml_regdomain(&$rdattributes, $rdfile = '', $rootobj = 'regulatory-data')
{
global $g, $listtags;
if (empty($rdfile))
$rdfile = $g['etc_path'] . '/regdomain.xml';
if (empty($rdfile)) {
$rdfile = '/etc/regdomain.xml';
}
$listtags = listtags_rd();
$parsed_xml = array();
......@@ -142,7 +145,7 @@ function parse_xml_regdomain(&$rdattributes, $rdfile = '', $rootobj = 'regulator
$rdattributes = $parsed_xml['attributes'];
}
}
if (empty($parsed_xml) && file_exists($g['etc_path'] . '/regdomain.xml')) {
if (empty($parsed_xml) && file_exists('/etc/regdomain.xml')) {
$rdmain = parse_xml_config_raw_attr($rdfile, $rootobj, $rdattributes);
// unset parts that aren't used before making cache
......
<?php
/*
pfSense_MODULE: header
*/
$g['theme'] = get_current_theme();
$pagetitle = gentitle( $pgtitle );
?>
<!doctype html>
?><!doctype html>
<!--[if IE 8 ]><html lang="<?=system_get_language_code();?>" class="ie ie8 lte9 lte8 no-js"><![endif]-->
<!--[if IE 9 ]><html lang="<?=system_get_language_code();?>" class="ie ie9 lte9 no-js"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="<?=system_get_language_code();?>" class="no-js"><!--<![endif]-->
......@@ -48,7 +44,7 @@ $pagetitle = gentitle( $pgtitle );
<?php if(file_exists("{$g['www_path']}/javascript/global.js")):?>
<?php if (file_exists('/usr/local/www/javascript/global.js')):?>
<script type="text/javascript" src="/javascript/global.js"></script>
<?php endif; ?>
......@@ -59,8 +55,8 @@ $pagetitle = gentitle( $pgtitle );
* Coded by: Erik Kristensen
*/
$dir = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php'));
$path = "{$g['www_path']}/javascript/" . $dir . "/";
$dir = trim(basename($_SERVER['SCRIPT_FILENAME'], '.php'));
$path = '/usr/local/www/javascript/' . $dir . '/';
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
......
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004 Scott Ullrich
......@@ -27,11 +28,11 @@
POSSIBILITY OF SUCH DAMAGE.
*/
require("globals.inc");
require("guiconfig.inc");
require("functions.inc");
require_once("globals.inc");
require_once("guiconfig.inc");
require_once("functions.inc");
require_once("filter.inc");
require("shaper.inc");
require_once("shaper.inc");
require_once("rrd.inc");
function gentitle_pkg($pgname) {
......@@ -56,8 +57,8 @@ if(empty($xml)) {
print_info_box_np(sprintf(gettext("ERROR: Could not open %s."), $xml));
die;
} else {
if (file_exists("{$g['www_path']}/wizards/{$xml}"))
$pkg = parse_xml_config_pkg("{$g['www_path']}/wizards/" . $xml, "pfsensewizard");
if (file_exists("/usr/local/www/wizards/{$xml}"))
$pkg = parse_xml_config_pkg('/usr/local/www/wizards/' . $xml, 'pfsensewizard');
else {
print_info_box_np(sprintf(gettext("ERROR: Could not open %s."), $xml));
die;
......@@ -65,7 +66,7 @@ if(empty($xml)) {
}
if (!is_array($pkg)) {
print_info_box_np(sprintf(gettext("ERROR: Could not parse %s/wizards/%s file."),$g['www_path'],$xml));
print_info_box_np(sprintf(gettext("ERROR: Could not parse /usr/local/www/wizards/%s file."), $xml));
die;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment