Merge branch 'RELENG_2_1' into UNIVNAUTES_2_1

This commit is contained in:
Thomas NOËL 2015-01-15 16:34:41 +01:00
commit 202e2f2c04
6 changed files with 56 additions and 35 deletions

View File

@ -1765,8 +1765,11 @@ function portal_mac_radius($clientmac,$clientip) {
function captiveportal_reapply_attributes($cpentry, $attributes) {
global $config, $cpzone, $g;
$dwfaultbw_up = isset($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0;
$dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0;
if (isset($config['captiveportal'][$cpzone]['peruserbw'])) {
$dwfaultbw_up = isset($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0;
$dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0;
} else
$dwfaultbw_up = $dwfaultbw_down = 0;
$bw_up = isset($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up;
$bw_down = isset($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down;
$bw_up_pipeno = $cpentry[1];
@ -1938,8 +1941,11 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
return;
}
$dwfaultbw_up = isset($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0;
$dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0;
if (isset($config['captiveportal'][$cpzone]['peruserbw'])) {
$dwfaultbw_up = isset($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0;
$dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0;
} else
$dwfaultbw_up = $dwfaultbw_down = 0;
$bw_up = isset($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up;
$bw_down = isset($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down;

View File

@ -58,27 +58,30 @@ function restore_rrd() {
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
@unlink($xml_file);
}
$_gb = exec("cd /;LANG=C /usr/bin/tar -xzf {$g['cf_conf_path']}/rrd.tgz 2>&1", $rrdrestore, $rrdreturn);
$rrdrestore = implode(" ", $rrdrestore);
unset($rrdrestore);
$_gb = exec("cd /;LANG=C /usr/bin/tar -tf {$g['cf_conf_path']}/rrd.tgz", $rrdrestore, $rrdreturn);
if($rrdreturn != 0) {
log_error("RRD restore failed exited with $rrdreturn, the error is: $rrdrestore\n");
}
unset($rrdrestore);
foreach (glob("{$rrddbpath}/*.xml") as $xml_file) {
$rrd_file = preg_replace('/\.xml$/', ".rrd", $xml_file);
if (file_exists("{$rrd_file}")) {
foreach ($rrdrestore as $xml_file) {
$rrd_file = '/' . substr($xml_file, 0, -4) . '.rrd';
if (file_exists("{$rrd_file}"))
@unlink($rrd_file);
file_put_contents("{$g['tmp_path']}/rrd_restore", $xml_file);
$_gb = exec("cd /;LANG=C /usr/bin/tar -xf {$g['cf_conf_path']}/rrd.tgz -T {$g['tmp_path']}/rrd_restore");
if (!file_exists("/{$xml_file}")) {
log_error("Could not extract {$xml_file} RRD xml file from archive!");
continue;
}
$output = array();
$status = null;
$_gb = exec("$rrdtool restore -f '{$xml_file}' '{$rrd_file}'", $output, $status);
$_gb = exec("$rrdtool restore -f '/{$xml_file}' '{$rrd_file}'", $output, $status);
if ($status) {
log_error("rrdtool restore -f '{$xml_file}' '{$rrd_file}' failed returning {$status}.");
continue;
}
unset($output);
@unlink($xml_file);
@unlink("/{$xml_file}");
}
unset($rrdrestore);
/* If this backup is still there on a full install, but we aren't going to use ram disks, remove the archive since this is a transition. */
if (($g['platform'] == "pfSense") && !isset($config['system']['use_mfs_tmpvar'])) {
unlink_if_exists("{$g['cf_conf_path']}/rrd.tgz");

View File

@ -6,12 +6,22 @@
# Save the rrd databases to the config path.
if [ -d "${RRDDBPATH}" ]; then
[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_rw
[ -f "${CF_CONF_PATH}/rrd.tgz" ] && /bin/rm -f "${CF_CONF_PATH}"/rrd.tgz
tgzlist=""
for rrdfile in "${RRDDBPATH}"/*.rrd ; do
xmlfile="${rrdfile%.rrd}.xml"
tgzfile="${rrdfile%.rrd}.tgz"
/usr/bin/nice -n20 /usr/local/bin/rrdtool dump "$rrdfile" "$xmlfile"
cd / && /usr/bin/tar -czf "${tgzfile}" -C / "${RRDDBPATH#/}"/*.xml
/bin/rm -f "${RRDDBPATH}"/*.xml
tgzlist="${tgzlist} @${tgzfile}"
done
cd / && tar -czf "${CF_CONF_PATH}"/rrd.tgz -C / "${RRDDBPATH#/}"/*.xml
rm "${RRDDBPATH}"/*.xml
if [ -n "${tgzlist}" ]; then
cd / && /usr/bin/tar -czf "${CF_CONF_PATH}/rrd.tgz" ${tgzlist}
/bin/rm -f "${RRDDBPATH}"/*.tgz
fi
[ -z "$NO_REMOUNT" ] && /etc/rc.conf_mount_ro
fi

View File

@ -229,7 +229,7 @@ outputJavaScriptFileInline("javascript/base64.js");
<?php if($_GET['action'] == "load"): ?>
jQuery(window).load(
function() {
jQuery("#fbTarget").val("<?=$_GET['path'];?>");
jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path']);?>");
loadFile();
}
);

View File

@ -495,7 +495,7 @@ function verify_before_install() {
}
if(!$bootmanager)
$bootmanager = $_REQUEST['bootmanager'];
echo "\n<!--" . print_r($_REQUEST, true) . " -->\n";
// echo "\n<!--" . print_r($_REQUEST, true) . " -->\n";
$disk = pcsysinstall_get_disk_info(htmlspecialchars($_REQUEST['disk']));
$disksize = format_bytes($disk['size'] * 1048576);
// Loop through posted items and create an array
@ -533,7 +533,7 @@ function verify_before_install() {
$tmparray['encpass'] = $_REQUEST['encpass' . $x];
$disks[] = $tmparray;
}
echo "\n<!-- " . print_r($disks, true) . " --> \n";
// echo "\n<!-- " . print_r($disks, true) . " --> \n";
$bootmanagerupper = strtoupper($bootmanager);
echo <<<EOFAMBAC
<form method="post" action="installer.php">
@ -593,11 +593,11 @@ EOFAMBACBAF;
foreach($disks as $disk) {
$desc = pcsysinstall_get_disk_info($disk['disk']);
echo "<tr>";
echo "<td>&nbsp;&nbsp;&nbsp;{$disk['mountpoint']}</td>";
echo "<td>{$disk['fstype']}</td>";
echo "<td>{$disk['disk']} {$desc['desc']}</td>";
echo "<td>{$disk['size']}</td>";
echo "<td>{$disk['encpass']}</td>";
echo "<td>&nbsp;&nbsp;&nbsp;" . htmlspecialchars($disk['mountpoint']) . "</td>";
echo "<td>" . htmlspecialchars($disk['fstype']) . "</td>";
echo "<td>" . htmlspecialchars($disk['disk']) . " " . htmlspecialchars($desc['desc']) . "</td>";
echo "<td>" . htmlspecialchars($disk['size']) . "</td>";
echo "<td>" . htmlspecialchars($disk['encpass']) . "</td>";
echo "</tr>";
}
@ -968,7 +968,7 @@ EOF;
$first_disk_size = $size - $swap_size;
// Debugging
echo "\n\n<!-- $first_disk - " . print_r($disk_info, true) . " - $size - $first_disk_size -->\n\n";
// echo "\n\n<!-- $first_disk - " . print_r($disk_info, true) . " - $size - $first_disk_size -->\n\n";
// Check to see if a on disk layout exists
if(file_exists("/tmp/webInstaller_disk_layout.txt")) {

View File

@ -62,11 +62,13 @@ $a_cp =& $config['captiveportal'];
$cpdb_all = array();
$showact = isset($_GET['showact']) ? 1 : 0;
foreach ($a_cp as $cpzone => $cp) {
$cpdb = captiveportal_read_db();
foreach ($cpdb as $cpent) {
$cpent[10] = $cpzone;
if ($_GET['showact'])
if ($showact == 1)
$cpent[11] = captiveportal_get_last_activity($cpent[2]);
$cpdb_all[] = $cpent;
}
@ -90,12 +92,12 @@ if ($_GET['order']) {
?>
<table class="sortable" name="sortabletable" id="sortabletable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="captive portal status">
<tr>
<td class="listhdrr"><a href="?order=ip&amp;showact=<?=$_GET['showact'];?>">IP address</a></td>
<td class="listhdrr"><a href="?order=mac&amp;showact=<?=$_GET['showact'];?>">MAC address</a></td>
<td class="listhdrr"><a href="?order=user&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Username");?></a></td>
<?php if ($_GET['showact']): ?>
<td class="listhdrr"><a href="?order=start&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Session start");?></a></td>
<td class="listhdrr"><a href="?order=start&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Last activity");?></a></td>
<td class="listhdrr"><a href="?order=ip&amp;showact=<?=$showact;?>">IP address</a></td>
<td class="listhdrr"><a href="?order=mac&amp;showact=<?=$showact;?>">MAC address</a></td>
<td class="listhdrr"><a href="?order=user&amp;showact=<?=$showact;?>"><?=gettext("Username");?></a></td>
<?php if ($showact == 1): ?>
<td class="listhdrr"><a href="?order=start&amp;showact=<?=$showact;?>"><?=gettext("Session start");?></a></td>
<td class="listhdrr"><a href="?order=start&amp;showact=<?=$showact;?>"><?=gettext("Last activity");?></a></td>
<?php endif; ?>
</tr>
<?php foreach ($cpdb_all as $cpent): ?>
@ -103,12 +105,12 @@ if ($_GET['order']) {
<td class="listlr"><?=$cpent[2];?></td>
<td class="listr"><?=$cpent[3];?>&nbsp;</td>
<td class="listr"><?=$cpent[4];?>&nbsp;</td>
<?php if ($_GET['showact']): ?>
<?php if ($showact == 1): ?>
<td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
<td class="listr"><?php if ($cpent[11] && ($cpent[11] > 0)) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[11]));?></td>
<?php endif; ?>
<td valign="middle" class="list nowrap">
<a href="?order=<?=$_GET['order'];?>&amp;showact=<?=$_GET['showact'];?>&amp;act=del&amp;zone=<?=$cpent[10];?>&amp;id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="x" /></a></td>
<a href="?order=<?=htmlspecialchars($_GET['order']);?>&amp;showact=<?=$showact;?>&amp;act=del&amp;zone=<?=$cpent[10];?>&amp;id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="x" /></a></td>
</tr>
<?php endforeach; ?>
</table>
</table>