mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 08:01:38 +02:00
syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@2973 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -23,6 +23,7 @@ include("../config.php");
|
||||
include("../includes/functions.php");
|
||||
include("includes/functions.inc.php");
|
||||
include("includes/authenticate.inc.php");
|
||||
|
||||
if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } }
|
||||
require("includes/jpgraph/src/jpgraph.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->SetLabelFormatCallback("format_si");
|
||||
|
||||
|
||||
|
||||
function TimeCallback($aVal) {
|
||||
global $dur;
|
||||
|
||||
|
||||
@@ -277,6 +277,7 @@ if ($_SESSION['authenticated'])
|
||||
} else {
|
||||
## Not Authenticated. Print login.
|
||||
include("pages/logon.inc.php");
|
||||
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
+2
-2
@@ -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']));
|
||||
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']];
|
||||
|
||||
$map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}/device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n";
|
||||
@@ -113,7 +113,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
$dif['interface_id'] = $link['remote_hostname'] . $link['remote_port'];
|
||||
}
|
||||
|
||||
if($where == "")
|
||||
if ($where == "")
|
||||
{
|
||||
$map .= "\"$src\" -> \"" . $dst . "\" [weight=500000, arrowsize=0, len=0];\n";
|
||||
$ifdone[$src][$sif['interface_id']] = 1;
|
||||
|
||||
+74
-67
@@ -1,37 +1,41 @@
|
||||
<?php
|
||||
|
||||
if (strpos($_SERVER['REQUEST_URI'], "debug")) {
|
||||
if (strpos($_SERVER['REQUEST_URI'], "debug"))
|
||||
{
|
||||
$debug = "1";
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
} else {
|
||||
} else {
|
||||
$debug = FALSE;
|
||||
ini_set('display_errors', 0);
|
||||
ini_set('display_startup_errors', 0);
|
||||
ini_set('log_errors', 0);
|
||||
ini_set('error_reporting', 0);
|
||||
}
|
||||
}
|
||||
|
||||
$filename = "observium-report.pdf";
|
||||
$html = "";
|
||||
$filename = "observium-report.pdf";
|
||||
$html = "";
|
||||
$type = (isset($_GET['type']) ? $_GET['type'] : "");
|
||||
$report = (isset($_GET['report']) ? $_GET['report'] : "");
|
||||
|
||||
$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");
|
||||
|
||||
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");
|
||||
if (!$_SESSION['authenticated']) { $html .= "unauthenticated"; }
|
||||
|
||||
// Extend TCPDF to use custom footer
|
||||
class ObsPDF extends TCPDF {
|
||||
public function Footer() {
|
||||
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
|
||||
@@ -40,74 +44,77 @@
|
||||
$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);
|
||||
// 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']);
|
||||
// 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);
|
||||
// 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 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 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 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 auto page breaks
|
||||
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
||||
|
||||
//set image scale factor
|
||||
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||
//set image scale factor
|
||||
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||
|
||||
//set some language-dependent strings
|
||||
$pdf->setLanguageArray($l);
|
||||
//set some language-dependent strings
|
||||
$pdf->setLanguageArray($l);
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// set default font subsetting mode
|
||||
$pdf->setFontSubsetting(true);
|
||||
// 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);
|
||||
// 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();
|
||||
// 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") {
|
||||
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='');
|
||||
// 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');
|
||||
// Close and output PDF document
|
||||
// This method has several options, check the source code documentation for more information.
|
||||
$pdf->Output($filename, 'I');
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user