Project

General

Profile

« Previous | Next » 

Revision 3c2c32b3

Added by sbeaver over 10 years ago

diag_pkglog.php conversion complete

Ready for review

View differences:

usr/local/www/diag_pkglogs.php
41 41
*/
42 42

  
43 43
/*
44
	pfSense_BUILDER_BINARIES:	/usr/bin/netstat	
45
	pfSense_MODULE:	pkgs
44
	pfSense_BUILDER_BINARIES:	/usr/bin/netstat
45
	pfSense_MODULE: pkgs
46 46
*/
47 47

  
48 48
##|+PRIV
......
57 57

  
58 58
if(!($nentries = $config['syslog']['nentries'])) $nentries = 50;
59 59

  
60
//if ($_POST['clear']) 
61
//	clear_log_file($logfile);
62

  
63 60
$i = 0;
64 61
$pkgwithlogging = false;
65 62
$apkg = $_GET['pkg'];
......
86 83
$pgtitle = array(gettext("Status"),gettext("Package logs"));
87 84
include("head.inc");
88 85

  
89
?>
90
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
91
<?php include("fbegin.inc"); ?>
92
<table width="100%" border="0" cellpadding="0" cellspacing="0">
93
  <tr>
94
	<td>
95
    <?php
96
	if($pkgwithlogging == false) {
97
		print_info_box(gettext("No packages with logging facilities are currently installed."));
98
		echo '</ul></td></tr></table>';
99
		include("fend.inc");
100
		exit;
101
	}
86
if($pkgwithlogging == false) {
87
	print_info_box(gettext("No packages with logging facilities are currently installed."));
88
} else {
102 89
	$tab_array = array();
103 90
	foreach($config['installedpackages']['package'] as $package) {
104 91
		if(is_array($package['logging'])) {
105
			if(!($logtab = $package['logging']['logtab'])) $logtab = $package['name'];
106
			if($apkg == $package['name']) { 
92
			if(!($logtab = $package['logging']['logtab']))
93
				$logtab = $package['name'];
94

  
95
			if($apkg == $package['name']) {
107 96
				$curtab = $logtab;
108 97
				$tab_array[] = array(sprintf(gettext("%s"),$logtab), true, "diag_pkglogs.php?pkg=".$package['name']);
109 98
			} else {
110 99
				$tab_array[] = array(sprintf(gettext("%s"),$logtab), false, "diag_pkglogs.php?pkg=".$package['name']);
111 100
			}
112 101
		}
113
       	 }
102
	}
114 103
	display_top_tabs($tab_array);
115
    ?> 
116
  </td></tr>
117
  <tr>
118
    <td>
119
	<div id="mainarea">
120
		<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
121
		  <tr>
122
			<td colspan="2" class="listtopic">
123
			  <?php printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab); ?></td>
124
		  </tr>
125
		  <?php
126
			$package =& $config['installedpackages']['package'][$apkgid];
127
			dump_clog($g['varlog_path'] . '/' . $package['logging']['logfilename'], $nentries);
128
		?>
129
		</table>
130
<!--
131
<form action="diag_pkglogs.php" method="post">
132
<input name="clear" type="submit" class="formbtn" value="Clear log">
133
</form>
134
-->
135
		</div>
136
	</td>
137
  </tr>
138
</table>
139
<?php include("fend.inc"); ?>
140
</body>
141
</html>
104
?>
105

  
106
	<div class="panel panel-default">
107
		<div class="panel-heading"><?=printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab)?></div>
108
		<pre>
109
<?php
110
		$package =& $config['installedpackages']['package'][$apkgid];
111
		dump_clog_no_table($g['varlog_path'] . '/' . $package['logging']['logfilename'], $nentries, true, array());
112
?>
113
		</pre>
114
	</div>
115

  
116
<?php }
117

  
118
include("foot.inc"); ?>

Also available in: Unified diff