syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@2973 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-04-06 15:01:58 +00:00
parent a4d35fed50
commit c95f4db6b8
4 changed files with 117 additions and 110 deletions

View File

@@ -23,6 +23,7 @@ include("../config.php");
include("../includes/functions.php"); include("../includes/functions.php");
include("includes/functions.inc.php"); include("includes/functions.inc.php");
include("includes/authenticate.inc.php"); include("includes/authenticate.inc.php");
if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } } if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } }
require("includes/jpgraph/src/jpgraph.php"); require("includes/jpgraph/src/jpgraph.php");
include("includes/jpgraph/src/jpgraph_line.php"); include("includes/jpgraph/src/jpgraph_line.php");
@@ -160,8 +161,6 @@ $graph->xaxis->title->Set($type);
$graph->yaxis->title->Set("Bits per second"); $graph->yaxis->title->Set("Bits per second");
$graph->yaxis->SetLabelFormatCallback("format_si"); $graph->yaxis->SetLabelFormatCallback("format_si");
function TimeCallback($aVal) { function TimeCallback($aVal) {
global $dur; global $dur;

View File

@@ -277,6 +277,7 @@ if ($_SESSION['authenticated'])
} else { } else {
## Not Authenticated. Print login. ## Not Authenticated. Print login.
include("pages/logon.inc.php"); include("pages/logon.inc.php");
exit; exit;
} }
?> ?>

View File

@@ -61,7 +61,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$links = dbFetch("SELECT * from ports AS I, links AS L WHERE I.device_id = ? AND L.local_interface_id = I.interface_id ORDER BY L.remote_hostname", array($device['device_id'])); $links = dbFetch("SELECT * from ports AS I, links AS L WHERE I.device_id = ? AND L.local_interface_id = I.interface_id ORDER BY L.remote_hostname", array($device['device_id']));
if (count($links)) if (count($links))
{ {
if(!isset($locations[$device['location']])) { $locations[$device['location']] = $loc_count; $loc_count++; } if (!isset($locations[$device['location']])) { $locations[$device['location']] = $loc_count; $loc_count++; }
$loc_id = $locations[$device['location']]; $loc_id = $locations[$device['location']];
$map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}/device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n"; $map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}/device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n";
@@ -112,8 +112,8 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$dif['label'] = $link['remote_port']; $dif['label'] = $link['remote_port'];
$dif['interface_id'] = $link['remote_hostname'] . $link['remote_port']; $dif['interface_id'] = $link['remote_hostname'] . $link['remote_port'];
} }
if($where == "") if ($where == "")
{ {
$map .= "\"$src\" -> \"" . $dst . "\" [weight=500000, arrowsize=0, len=0];\n"; $map .= "\"$src\" -> \"" . $dst . "\" [weight=500000, arrowsize=0, len=0];\n";
$ifdone[$src][$sif['interface_id']] = 1; $ifdone[$src][$sif['interface_id']] = 1;

View File

@@ -1,113 +1,120 @@
<?php <?php
if (strpos($_SERVER['REQUEST_URI'], "debug")) { if (strpos($_SERVER['REQUEST_URI'], "debug"))
$debug = "1"; {
ini_set('display_errors', 1); $debug = "1";
ini_set('display_startup_errors', 1); ini_set('display_errors', 1);
ini_set('log_errors', 1); ini_set('display_startup_errors', 1);
ini_set('error_reporting', E_ALL); ini_set('log_errors', 1);
} else { ini_set('error_reporting', E_ALL);
$debug = FALSE; } else {
ini_set('display_errors', 0); $debug = FALSE;
ini_set('display_startup_errors', 0); ini_set('display_errors', 0);
ini_set('log_errors', 0); ini_set('display_startup_errors', 0);
ini_set('error_reporting', 0); ini_set('log_errors', 0);
ini_set('error_reporting', 0);
}
$filename = "observium-report.pdf";
$html = "";
$type = (isset($_GET['type']) ? $_GET['type'] : "");
$report = (isset($_GET['report']) ? $_GET['report'] : "");
include("../includes/defaults.inc.php");
include("../config.php");
include("../includes/functions.php");
include("includes/functions.inc.php");
include("includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { $html .= "unauthenticated"; }
require_once("includes/tcpdf/config/lang/eng.php");
require_once("includes/tcpdf/tcpdf.php");
// Extend TCPDF to use custom footer
class ObsPDF extends TCPDF
{
public function Footer()
{
// Posistion at 15mm from bottom
$this->SetY(-15);
// Set Font
$this->SetFont('helvetica', 'N', 8);
// Set Footer text
$this->Cell(0, 0, 'Created by Observium (www.observium.org)', 0, false, 'L', 0, 'http://www.observium.org/', 0, false, 'M', 'M');
$this->Cell(10, 0, 'Page '.$this->getAliasNumPAge().' of '.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'M', 'M');
}
}
// create new PDF document
$pdf = new ObsPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document security
$protection['permissions'] = array('modify', 'copy', 'annot-forms', 'fill-forms');
$protection['userpass'] = null;
//$protection['ownerpass'] = "6q49qp783sqo8p3o45q30nno51q01q35";
$protection['ownerpass'] = str_rot13(md5(str_rot13(pow(rand(), rand(0, 1000)))));
$protection['mode'] = 3;
$protection['pubkey'] = null;
$pdf->SetProtection($protection['permissions'], $protection['userpass'], $protection['ownerpass'], $protection['mode'], $protection['pubkey']);
// disable header
$pdf->setPrintHeader(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 10, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
if ($_SESSION['authenticated'])
{
if ($type == "billing")
{
if ($report == "history")
{
include("pages/bill/pdf_history.inc.php");
} }
}
}
$filename = "observium-report.pdf"; // Print text using writeHTMLCell()
$html = ""; $pdf->writeHTML($html, $ln=true, $fill=false, $reseth=true, $cell=false, $align='');
$type = (isset($_GET['type']) ? $_GET['type'] : ""); // ---------------------------------------------------------
$report = (isset($_GET['report']) ? $_GET['report'] : "");
include("../includes/defaults.inc.php"); // Close and output PDF document
include("../config.php"); // This method has several options, check the source code documentation for more information.
include("../includes/functions.php"); $pdf->Output($filename, 'I');
include("includes/functions.inc.php");
include("includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { $html .= "unauthenticated"; }
require_once("includes/tcpdf/config/lang/eng.php");
require_once("includes/tcpdf/tcpdf.php");
// Extend TCPDF to use custom footer
class ObsPDF extends TCPDF {
public function Footer() {
// Posistion at 15mm from bottom
$this->SetY(-15);
// Set Font
$this->SetFont('helvetica', 'N', 8);
// Set Footer text
$this->Cell(0, 0, 'Created by Observium (www.observium.org)', 0, false, 'L', 0, 'http://www.observium.org/', 0, false, 'M', 'M');
$this->Cell(10, 0, 'Page '.$this->getAliasNumPAge().' of '.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'M', 'M');
}
}
// create new PDF document
$pdf = new ObsPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document security
$protection['permissions'] = array('modify', 'copy', 'annot-forms', 'fill-forms');
$protection['userpass'] = null;
//$protection['ownerpass'] = "6q49qp783sqo8p3o45q30nno51q01q35";
$protection['ownerpass'] = str_rot13(md5(str_rot13(pow(rand(), rand(0, 1000)))));
$protection['mode'] = 3;
$protection['pubkey'] = null;
$pdf->SetProtection($protection['permissions'], $protection['userpass'], $protection['ownerpass'], $protection['mode'], $protection['pubkey']);
// disable header
$pdf->setPrintHeader(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 10, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
if ($_SESSION['authenticated']) {
if ($type == "billing") {
if ($report == "history") {
include("pages/bill/pdf_history.inc.php");
}
}
}
// Print text using writeHTMLCell()
$pdf->writeHTML($html, $ln=true, $fill=false, $reseth=true, $cell=false, $align='');
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output($filename, 'I');
?> ?>