mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 11:19:26 +02:00
Started adding PDF Support
This commit is contained in:
parent
74fc838c45
commit
4505ba1bf3
@ -76,7 +76,16 @@ if (
|
||||
(isset($_GET['op']) && $_GET['op'] == "export") &&
|
||||
(isset($_GET['exporttype']) && array_key_exists($_GET['exporttype'], $content['EXPORTTYPES']))
|
||||
)
|
||||
{
|
||||
$content['exportformat'] = $_GET['exporttype'];
|
||||
|
||||
// Check for extensions
|
||||
if ( $content['exportformat'] == EXPORT_PDF && !$content['PDF_IS_ENABLED'] )
|
||||
{
|
||||
$content['error_occured'] = true;
|
||||
$content['error_details'] = $content['LN_GEN_ERROR_PDFMISSINGEXTENSION'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content['error_occured'] = true;
|
||||
@ -405,10 +414,50 @@ else
|
||||
// Set MIME TYPE and File Extension
|
||||
$szOutputMimeType = "application/pdf";
|
||||
$szOutputFileExtension = ".pdf";
|
||||
|
||||
try
|
||||
{
|
||||
// Init PDF Document
|
||||
$myPdf = new PDFlib();
|
||||
if ($myPdf->begin_document("", "") == 0) {
|
||||
die("Error: " . $myPdf->get_errmsg());
|
||||
}
|
||||
|
||||
$myPdf->set_info("Creator", "hello.php");
|
||||
$myPdf->set_info("Author", "Rainer Schaaf");
|
||||
$myPdf->set_info("Title", "Hello world (PHP)!");
|
||||
|
||||
$myPdf->begin_page_ext(595, 842, "");
|
||||
|
||||
$font = $myPdf->load_font("Helvetica-Bold", "winansi", "");
|
||||
|
||||
$myPdf->setfont($font, 24.0);
|
||||
$myPdf->set_text_pos(50, 700);
|
||||
|
||||
$myPdf->show("Hello world!");
|
||||
$myPdf->continue_text("(says PHP)");
|
||||
$myPdf->end_page_ext("");
|
||||
$myPdf->end_document("");
|
||||
|
||||
// Copy PDF Output
|
||||
$szOutputContent = $myPdf->get_buffer();
|
||||
}
|
||||
catch (PDFlibException $e) {
|
||||
die("PDFlib exception occurred in hello sample:\n" .
|
||||
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
|
||||
$e->get_errmsg() . "\n");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
die($e);
|
||||
}
|
||||
|
||||
// Delete PDF Object!
|
||||
$myPdf = 0;
|
||||
}
|
||||
|
||||
// Set needed Header properties
|
||||
header('Content-type: ' . $szOutputMimeType . "; " . $szOutputCharset);
|
||||
header("Content-Length: " . strlen($szOutputContent) );
|
||||
header('Content-Disposition: attachment; filename="' . $szOutputFileName . $szOutputFileExtension . '"');
|
||||
|
||||
// Output Content!
|
||||
|
@ -72,9 +72,7 @@ define('SOURCE_PDO', '3');
|
||||
// --- Exportformat defines
|
||||
define('EXPORT_CVS', 'CVS');
|
||||
define('EXPORT_XML', 'XML');
|
||||
define('EXPORT_EXCEL', 'EXCEL');
|
||||
define('EXPORT_PDF', 'PDF');
|
||||
define('EXPORT_HTML', 'HTML');
|
||||
// ---
|
||||
|
||||
// ---
|
||||
|
@ -334,12 +334,9 @@ function CreateExportFormatList()
|
||||
|
||||
// Add basic formats!
|
||||
$content['EXPORTTYPES'][EXPORT_CVS] = array( "ID" => EXPORT_CVS, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_CVS'] );
|
||||
//TODO $content['EXPORTTYPES'][EXPORT_HTML] = array( "ID" => EXPORT_HTML, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_HTML'] );
|
||||
//TODO $content['EXPORTTYPES'][EXPORT_EXCEL] = array( "ID" => EXPORT_EXCEL, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_EXCEL'] );
|
||||
$content['EXPORTTYPES'][EXPORT_XML] = array( "ID" => EXPORT_XML, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_XML'] );
|
||||
|
||||
// Add formats by loaded extensions
|
||||
if ( $content['XML_IS_ENABLED'] )
|
||||
$content['EXPORTTYPES'][EXPORT_XML] = array( "ID" => EXPORT_XML, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_XML'] );
|
||||
if ( $content['PDF_IS_ENABLED'] )
|
||||
$content['EXPORTTYPES'][EXPORT_PDF] = array( "ID" => EXPORT_PDF, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_PDF'] );
|
||||
|
||||
@ -405,31 +402,12 @@ function CheckAndSetRunMode()
|
||||
$content['GD_IS_ENABLED'] = false;
|
||||
|
||||
// Check MYSQL Extension
|
||||
if ( in_array("mysql", $loadedExtensions) )
|
||||
$content['MYSQL_IS_ENABLED'] = true;
|
||||
else
|
||||
$content['MYSQL_IS_ENABLED'] = false;
|
||||
|
||||
if ( in_array("mysql", $loadedExtensions) ) { $content['MYSQL_IS_ENABLED'] = true; } else { $content['MYSQL_IS_ENABLED'] = false; }
|
||||
// Check PDO Extension
|
||||
if ( in_array("PDO", $loadedExtensions) )
|
||||
$content['PDO_IS_ENABLED'] = true;
|
||||
else
|
||||
$content['PDO_IS_ENABLED'] = false;
|
||||
// ---
|
||||
|
||||
// Check XML Extension
|
||||
if ( in_array("xml", $loadedExtensions) )
|
||||
$content['XML_IS_ENABLED'] = true;
|
||||
else
|
||||
$content['XML_IS_ENABLED'] = false;
|
||||
// ---
|
||||
|
||||
if ( in_array("PDO", $loadedExtensions) ) { $content['PDO_IS_ENABLED'] = true; } else { $content['PDO_IS_ENABLED'] = false; }
|
||||
// Check PDF Extension
|
||||
if ( in_array("pdf", $loadedExtensions) )
|
||||
$content['PDF_IS_ENABLED'] = true;
|
||||
else
|
||||
$content['PDF_IS_ENABLED'] = false;
|
||||
// ---
|
||||
if ( in_array("pdf", $loadedExtensions) ) { $content['PDF_IS_ENABLED'] = true; } else { $content['PDF_IS_ENABLED'] = false; }
|
||||
|
||||
}
|
||||
|
||||
function InitRuntimeInformations()
|
||||
|
@ -79,6 +79,14 @@ $content['LN_ERROR_NORECORDS'] = "Es wurden keine syslog-Einträge gefunden.
|
||||
$content['LN_ERROR_DB_INVALIDDBMAPPING'] = "Invalid datafield mappings";
|
||||
$content['LN_ERROR_DB_INVALIDDBDRIVER'] = "Invalid database driver selected";
|
||||
$content['LN_ERROR_DB_TABLENOTFOUND'] = "Could not find the configured table, maybe misspelled or the tablenames are case sensitive";
|
||||
$content['LN_GEN_SELECTEXPORT'] = "> Select Exportformat <";
|
||||
$content['LN_GEN_EXPORT_CVS'] = "CVS (Comma separated)";
|
||||
$content['LN_GEN_EXPORT_XML'] = "XML";
|
||||
$content['LN_GEN_EXPORT_PDF'] = "PDF";
|
||||
$content['LN_GEN_ERROR_EXPORING'] = "Error exporting data";
|
||||
$content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong.";
|
||||
$content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found.";
|
||||
$content['LN_GEN_ERROR_PDFMISSINGEXTENSION'] = "The PDF Extension is missing in your php environment.";
|
||||
|
||||
// Topmenu Entries
|
||||
$content['LN_MENU_SEARCH'] = "Suchen";
|
||||
|
@ -81,13 +81,12 @@ $content['LN_ERROR_DB_INVALIDDBDRIVER'] = "Invalid database driver selected";
|
||||
$content['LN_ERROR_DB_TABLENOTFOUND'] = "Could not find the configured table, maybe misspelled or the tablenames are case sensitive";
|
||||
$content['LN_GEN_SELECTEXPORT'] = "> Select Exportformat <";
|
||||
$content['LN_GEN_EXPORT_CVS'] = "CVS (Comma separated)";
|
||||
$content['LN_GEN_EXPORT_HTML'] = "HTML";
|
||||
$content['LN_GEN_EXPORT_XML'] = "XML";
|
||||
$content['LN_GEN_EXPORT_PDF'] = "PDF";
|
||||
$content['LN_GEN_EXPORT_EXCEL'] = "Excel";
|
||||
$content['LN_GEN_ERROR_EXPORING'] = "Error exporting data";
|
||||
$content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong.";
|
||||
$content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found.";
|
||||
$content['LN_GEN_ERROR_PDFMISSINGEXTENSION'] = "The PDF Extension is missing in your php environment.";
|
||||
|
||||
// Topmenu Entries
|
||||
$content['LN_MENU_SEARCH'] = "Search";
|
||||
|
@ -83,6 +83,14 @@ $content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas.";
|
||||
$content['LN_ERROR_DB_INVALIDDBMAPPING'] = "Invalid datafield mappings";
|
||||
$content['LN_ERROR_DB_INVALIDDBDRIVER'] = "Invalid database driver selected";
|
||||
$content['LN_ERROR_DB_TABLENOTFOUND'] = "Could not find the configured table, maybe misspelled or the tablenames are case sensitive";
|
||||
$content['LN_GEN_SELECTEXPORT'] = "> Select Exportformat <";
|
||||
$content['LN_GEN_EXPORT_CVS'] = "CVS (Comma separated)";
|
||||
$content['LN_GEN_EXPORT_XML'] = "XML";
|
||||
$content['LN_GEN_EXPORT_PDF'] = "PDF";
|
||||
$content['LN_GEN_ERROR_EXPORING'] = "Error exporting data";
|
||||
$content['LN_GEN_ERROR_INVALIDEXPORTTYPE'] = "Invalid Export format selected, or other parameters were wrong.";
|
||||
$content['LN_GEN_ERROR_SOURCENOTFOUND'] = "The Source with ID '%1' could not be found.";
|
||||
$content['LN_GEN_ERROR_PDFMISSINGEXTENSION'] = "The PDF Extension is missing in your php environment.";
|
||||
|
||||
|
||||
// Topmenu Entries
|
||||
|
@ -99,9 +99,9 @@
|
||||
<input type="hidden" name="op" value="export">
|
||||
<input type="hidden" name="uid" value="{uid_current}">
|
||||
<select name="exporttype" size="1" OnChange="document.exportform.submit();" STYLE="width: 150px">
|
||||
<option {selected} value="">{LN_GEN_SELECTEXPORT}</option>
|
||||
<option selected value="">{LN_GEN_SELECTEXPORT}</option>
|
||||
<!-- BEGIN EXPORTTYPES -->
|
||||
<option {selected} value="{ID}">{DisplayName}</option>
|
||||
<option value="{ID}">{DisplayName}</option>
|
||||
<!-- END EXPORTTYPES -->
|
||||
</select>
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user