Exemplo n.º 1
0
    }
}
function GetErrorMessage()
{
    global $error_message;
    echo $error_message;
}
?>

<html>
<head>
	<script language="javascript" type="text/javascript">
		function OnInit()
		{
			var error = "<?php 
echo GetErrorMessage();
?>
";
			if (error != "")
				window.alert (error);

			var href = "<?php 
echo $_POST["_wp_http_referer"];
?>
";
			window.location.href = href;
		}
	</script>
</head>
<body onload="OnInit()">
</body>
Exemplo n.º 2
0
function CheckConfiguredLogStreamSource($myReport, $mySourceID)
{
    global $content, $extraErrorDescription;
    // Get Objectreference to report
    $myReportObj = $myReport["ObjRef"];
    // Handle GET and POST input!
    $content['MSG_WARNING_FORMURL'] = $_SERVER['SCRIPT_NAME'] . "?";
    $content['MSG_CHECK_URL'] = $_SERVER['SCRIPT_NAME'] . "?";
    foreach ($_GET as $varname => $varvalue) {
        // All variables!
        $content['MSG_WARNING_FORMURL'] .= $varname . "=" . $varvalue . "&";
        // Skip the Optimize variable!
        if (strpos($varname, "optimize") === false) {
            $content['MSG_CHECK_URL'] .= $varname . "=" . $varvalue . "&";
        }
    }
    foreach ($_POST as $varname => $varvalue) {
        $content['POST_VARIABLES'][] = array("varname" => $varname, "varvalue" => $varvalue);
    }
    // Append Force Optimice Paramater
    $content['MSG_CHECK_URL'] .= "forcecheckoptimize=true";
    // Check if optimize variable is set!
    if (isset($_GET['optimize'])) {
        // Check what we have to do
        if ($_GET['optimize'] == "addfields") {
            // This will create all INDEXES we need for this logstream!
            $res = $myReportObj->CreateMissingLogStreamFields($mySourceID);
            if ($res != SUCCESS) {
                $content['ISERROR'] = true;
                $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_FAILED_ADDING_FIELDS'], $content['SOURCES'][$mySourceID]['Name'], $res);
                if (isset($extraErrorDescription)) {
                    $content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
                }
            }
            // Show information in performance warning area
            $content['ISSOURCENOTOPTIMIZED'] = true;
            $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_FIELDS_CREATED'];
            $content['MSG_WARNING_CLASS'] = 'PriorityNotice';
            $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_FIELDS_CREATED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name']);
            $content['MSG_WARNING_SUBMITFORM'] = "false";
            // return result
            return $res;
        } else {
            if ($_GET['optimize'] == "indexes") {
                // This will create all INDEXES we need for this logstream!
                $res = $myReportObj->CreateLogStreamIndexes($mySourceID);
                if ($res != SUCCESS) {
                    $content['ISERROR'] = true;
                    $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_FAILED_CREATE_INDEXES'], $content['SOURCES'][$mySourceID]['Name'], $res);
                    if (isset($extraErrorDescription)) {
                        $content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
                    }
                }
                // Show information in performance warning area
                $content['ISSOURCENOTOPTIMIZED'] = true;
                $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_INDEX_CREATED'];
                $content['MSG_WARNING_CLASS'] = 'PriorityNotice';
                $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_INDEX_CREATED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name']);
                $content['MSG_WARNING_SUBMITFORM'] = "false";
                // return result
                return $res;
            } else {
                if ($_GET['optimize'] == "trigger") {
                    // This will create all INDEXES we need for this logstream!
                    $res = $myReportObj->CreateLogStreamTrigger($mySourceID);
                    if ($res != SUCCESS) {
                        $content['ISERROR'] = true;
                        $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_FAILED_CREATE_TRIGGER'], $content['SOURCES'][$mySourceID]['Name'], $res);
                        if (isset($extraErrorDescription)) {
                            $content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
                        }
                    } else {
                        // Show information in performance warning area
                        $content['ISSOURCENOTOPTIMIZED'] = true;
                        $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_TRIGGER_CREATED'];
                        $content['MSG_WARNING_CLASS'] = 'PriorityNotice';
                        $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_TRIGGER_CREATED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name']);
                        $content['MSG_WARNING_SUBMITFORM'] = "false";
                    }
                    // return result
                    return $res;
                } else {
                    if ($_GET['optimize'] == "checksum") {
                        // This will create all INDEXES we need for this logstream!
                        $res = $myReportObj->ChangeChecksumFieldUnsigned($mySourceID);
                        if ($res != SUCCESS) {
                            $content['ISERROR'] = true;
                            $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_FAILED_CHANGE_CHECKSUM'], $content['SOURCES'][$mySourceID]['Name'], $res);
                            if (isset($extraErrorDescription)) {
                                $content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
                            }
                        } else {
                            // Show information in performance warning area
                            $content['ISSOURCENOTOPTIMIZED'] = true;
                            $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_CHECKSUM_CHANGED'];
                            $content['MSG_WARNING_CLASS'] = 'PriorityNotice';
                            $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_CHECKSUM_CHANGED_SUCCESS'], $content['SOURCES'][$mySourceID]['Name']);
                            $content['MSG_WARNING_SUBMITFORM'] = "false";
                        }
                        // return result
                        return $res;
                    }
                }
            }
        }
    }
    // Use SESSION to check if Source needs to be checked for optimization
    $bForceCheck = false;
    if (!isset($_SESSION['Sources'][$mySourceID]['optimized']) || $_SESSION['Sources'][$mySourceID]['optimized'] == false || isset($_GET['forcecheckoptimize']) && $_GET['forcecheckoptimize'] == "true") {
        // Set Checking to true!
        $bForceCheck = true;
    }
    // Lets see if we need to check
    if ($bForceCheck) {
        // Run checks
        $res = $myReportObj->CheckLogStreamSource($mySourceID);
        if ($res != SUCCESS) {
            // Current Logstream Source is not optimized! Show to user!
            $content['ISSOURCENOTOPTIMIZED'] = true;
            if ($res == ERROR_DB_DBFIELDNOTFOUND) {
                $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
                $content['MSG_WARNING_CLASS'] = 'PriorityWarning';
                $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_ADD_MISSINGFIELDS'], $content['SOURCES'][$mySourceID]['Name']);
                $content['MSG_WARNING_SUBMITFORM'] = "true";
                $content['MSG_WARNING_FORMURL'] .= "optimize=addfields";
                // Addmissing fields
            } else {
                if ($res == ERROR_DB_INDEXESMISSING) {
                    $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
                    $content['MSG_WARNING_CLASS'] = 'PriorityWarning';
                    $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_OPTIMIZE_INDEXES'], $content['SOURCES'][$mySourceID]['Name']);
                    $content['MSG_WARNING_SUBMITFORM'] = "true";
                    $content['MSG_WARNING_FORMURL'] .= "optimize=indexes";
                    // Add missing INDEXES
                } else {
                    if ($res == ERROR_DB_TRIGGERMISSING) {
                        $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
                        $content['MSG_WARNING_CLASS'] = 'PriorityWarning';
                        $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_OPTIMIZE_TRIGGER'], $content['SOURCES'][$mySourceID]['Name']);
                        $content['MSG_WARNING_SUBMITFORM'] = "true";
                        $content['MSG_WARNING_FORMURL'] .= "optimize=trigger";
                        // Add missing TRIGGERS
                    } else {
                        if ($res == ERROR_DB_CHECKSUMERROR) {
                            $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_PERFORMANCE_WARNING'];
                            $content['MSG_WARNING_CLASS'] = 'PriorityWarning';
                            $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_CHANGE_CHECKSUM'], $content['SOURCES'][$mySourceID]['Name']);
                            $content['MSG_WARNING_SUBMITFORM'] = "true";
                            $content['MSG_WARNING_FORMURL'] .= "optimize=checksum";
                            // Change Checksum field!
                        } else {
                            $content['MSG_WARNING_TITLE'] = $content['LN_REPORTS_SOURCE_WARNING'];
                            $content['MSG_WARNING_CLASS'] = 'PriorityWarning';
                            $content['MSG_WARNING_DETAILS'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_FAILED_SOURCE_CHECK'], $content['SOURCES'][$mySourceID]['Name'], GetErrorMessage($res));
                            $content['MSG_WARNING_SUBMITFORM'] = "true";
                            $content['MSG_WARNING_FORMURL'] .= "forcecheckoptimize=true";
                            // Change Checksum field!
                        }
                    }
                }
            }
        } else {
            // Check was successfull! Set Checked Property in LogStream Source
            $_SESSION['Sources'][$mySourceID]['optimized'] = true;
        }
    }
}
Exemplo n.º 3
0
                $myChart['rowend'] = '</td>';
            } else {
                $myChart['cssclass'] = "line2";
                $myChart['rowbegin'] = '<td width="50%" valign="top">';
                $myChart['rowend'] = '</td></tr>';
            }
            $i++;
            // ---
        }
    }
} else {
    // This will disable to Stats View and show an error message
    $content['statsenabled'] = false;
    // Set error code
    $content['ISERROR'] = true;
    $content['ERROR_MSG'] = GetErrorMessage(ERROR_CHARTS_NOTCONFIGURED);
    $content['detailederror_code'] = ERROR_CHARTS_NOTCONFIGURED;
}
// ---
// --- BEGIN CREATE TITLE
$content['TITLE'] = InitPageTitle();
// Append custom title part!
$content['TITLE'] .= " :: " . $content['LN_MENU_STATISTICS'];
// --- END CREATE TITLE
// --- Parsen and Output
InitTemplateParser();
$page->parser($content, "statistics.html");
$page->output();
// ---
//include($gl_root_path . 'include/functions_installhelpers.php');
//ConvertCustomCharts();
Exemplo n.º 4
0
function DB_PrintError($MyErrorMsg, $DieOrNot)
{
    global $content, $n, $HTTP_COOKIE_VARS, $errdesc, $errno, $linesep;
    $errdesc = mysql_error();
    $errno = mysql_errno();
    // Define global variable so we know an error has occured!
    if (!defined('PHPLOGCON_INERROR')) {
        define('PHPLOGCON_INERROR', true);
    }
    $errormsg = "Database error: {$MyErrorMsg} {$linesep}";
    $errormsg .= "mysql error: {$errdesc} {$linesep}";
    $errormsg .= "mysql error number: {$errno} {$linesep}";
    $errormsg .= "Date: " . date("d.m.Y @ H:i") . $linesep;
    $errormsg .= "Script: " . getenv("REQUEST_URI") . $linesep;
    $errormsg .= "Referer: " . getenv("HTTP_REFERER") . $linesep;
    if ($DieOrNot == true) {
        DieWithErrorMsg("{$linesep}" . $errormsg);
    } else {
        OutputDebugMessage("DB_PrintError: {$errormsg}", DEBUG_ERROR);
        if (!isset($content['detailederror'])) {
            $content['detailederror_code'] = ERROR_DB_QUERYFAILED;
            $content['detailederror'] = GetErrorMessage(ERROR_DB_QUERYFAILED);
        } else {
            $content['detailederror'] .= "<br><br>" . GetErrorMessage(ERROR_DB_QUERYFAILED);
        }
        // Append SQL Detail Error
        $content['detailederror'] .= "<br><br>" . $errormsg;
    }
}
Exemplo n.º 5
0
function GetInfrastructureInfo($host, $port, $id)
{
    $headers = array('Accept: text/*');
    $res = BasicRESTCall("GET", $host, $port, '/infrastructures/' . $id, $headers);
    if ($res->getStatus() != 200) {
        return 'Error: Code: ' . strval($res->getStatus()) . '. ' . GetErrorMessage($output);
    } else {
        $vm_urls = split("\n", $res->getOutput());
        $vm_ids = array();
        foreach ($vm_urls as $vm_url) {
            $vm_id = trim(basename(parse_url($vm_url, PHP_URL_PATH)));
            if (strlen($vm_id) > 0) {
                $vm_ids[] = $vm_id;
            }
        }
        return $vm_ids;
    }
}
                            $content['error_details'] = $content['LN_GEN_ERROR_INVALIDTYPE'];
                        }
                    }
                }
            } else {
                $content['error_occured'] = true;
                $content['error_details'] = GetErrorMessage($chartData);
                if (isset($extraErrorDescription)) {
                    $content['error_details'] .= "\n\n" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
                }
            }
            //$fields[SYSLOG_UID]['FieldID']
        } else {
            // This will disable to Main SyslogView and show an error message
            $content['error_occured'] = true;
            $content['error_details'] = GetErrorMessage($res);
            if (isset($extraErrorDescription)) {
                $content['error_details'] .= "\n\n" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
            }
        }
        // Close file!
        $stream->Close();
    } else {
        $content['error_occured'] = true;
        $content['error_details'] = GetAndReplaceLangStr($content['LN_GEN_ERROR_SOURCENOTFOUND'], $currentSourceID);
    }
}
if ($content['error_occured']) {
    // Use JpGraph to display errors!
    $myError = new JpGraphErrObjectImg();
    $myError->SetTitle($content['LN_GEN_ERRORDETAILS']);
Exemplo n.º 7
0
                // Disable pager in this case!
                $content['main_pagerenabled'] = false;
            }
            if ($content['read_direction'] == EnumReadDirection::Forward) {
                // Back Button was clicked, so we need to flip the array
                //				print_r( $content['syslogmessages'] );
                $content['syslogmessages'] = array_reverse($content['syslogmessages']);
                //				print_r( $content['syslogmessages'] );
            }
            // This will enable to Main SyslogView
            $content['syslogmessagesenabled'] = "true";
        }
    } else {
        // This will disable to Main SyslogView and show an error message
        $content['syslogmessagesenabled'] = "false";
        $content['detailederror'] = GetErrorMessage($res);
        $content['detailederror_code'] = $res;
        if (isset($extraErrorDescription)) {
            $content['detailederror'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
        }
    }
    // Close file!
    $stream->Close();
} else {
    $content['syslogmessagesenabled'] = "false";
    $content['detailederror'] = GetAndReplaceLangStr($content['LN_GEN_ERROR_SOURCENOTFOUND'], $currentSourceID);
    $content['detailederror_code'] = ERROR_SOURCENOTFOUND;
}
// ---
// --- Parsen and Output
InitTemplateParser();
Exemplo n.º 8
0
 if ($res != SUCCESS) {
     $content['error_occured'] = true;
     $content['error_details'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_ERRORCHECKINGSOURCE'], GetAndReplaceLangStr(GetErrorMessage($res), $mySavedReport['sourceid']));
     if (isset($extraErrorDescription)) {
         $content['error_details'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
     }
 } else {
     // Init IncludePath
     $reportIncludePath = $myReportObj->GetReportIncludePath();
     // Include Custom language file if available
     $myReportObj->InitReportLanguageFile($reportIncludePath);
     // Now start the processing part!
     $res = $myReportObj->startDataProcessing();
     if ($res != SUCCESS) {
         $content['error_occured'] = true;
         $content['error_details'] = GetAndReplaceLangStr($content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetErrorMessage($res));
         if (isset($extraErrorDescription)) {
             $content['error_details'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
         }
     } else {
         // --- Perform report output
         // Init template Parser
         $page = new Template();
         $page->set_path($reportIncludePath);
         // Parse template
         $page->parser($content, $myReportObj->GetBaseFileName());
         // Output the result
         $res = $myReportObj->OutputReport($page->result(), $szErrorStr);
         if ($res == SUCCESS && $myReportObj->GetOutputTarget() != REPORT_TARGET_STDOUT) {
             // Output wasn't STDOUT, so we need to display what happened to the user
             $content['report_success'] = true;
Exemplo n.º 9
0
function CleanData($optParam1, $optParam2, $optParam3, $optParam4)
{
    global $content, $gl_root_path;
    // Get Source reference!
    $mySource = $content['Sources'][$content['SOURCEID']];
    // Check Source Type
    if ($mySource['SourceType'] == SOURCE_DB || $mySource['SourceType'] == SOURCE_PDO) {
        // Include LogStream facility
        include $gl_root_path . 'classes/logstream.class.php';
        //Debug Output
        PrintHTMLDebugInfo(DEBUG_INFO, "CleanData", GetAndReplaceLangStr($content["LN_CMD_CLEANINGDATAFOR"], $mySource['Name']));
        // Create LogStream Object
        $stream = $mySource['ObjRef']->LogStreamFactory($mySource['ObjRef']);
        $res = $stream->Verify();
        if ($res == SUCCESS) {
            // Gather Database Stats
            $content['ROWCOUNT'] = $stream->GetLogStreamTotalRowCount();
            if (isset($content['ROWCOUNT'])) {
                //Debug Output
                PrintHTMLDebugInfo(DEBUG_INFO, "CleanData", GetAndReplaceLangStr($content["LN_CMD_ROWSFOUND"], $content['ROWCOUNT'], $mySource['Name']));
                if ($optParam1 != NULL) {
                    if ($optParam1 == "all") {
                        $timestamp = 0;
                    } else {
                        if ($optParam1 == "olderthan" && $optParam2 != NULL) {
                            // Take current time and subtract Seconds
                            $nSecondsSubtract = intval($optParam2);
                            $timestamp = time() - $nSecondsSubtract;
                        } else {
                            if ($optParam1 == "date" && $optParam2 != NULL && $optParam3 != NULL && $optParam4 != NULL) {
                                // Generate Timestamp
                                $timestamp = mktime(0, 0, 0, intval($optParam2), intval($optParam3), intval($optParam4));
                            } else {
                                // Print error and die!
                                DieWithErrorMsg($content["LN_CMD_WRONGSUBOPORMISSING"]);
                            }
                        }
                    }
                    // Continue with delete only if $timestamp is set!
                    if (isset($timestamp)) {
                        //Debug Output
                        PrintHTMLDebugInfo(DEBUG_INFO, "CleanData", GetAndReplaceLangStr($content["LN_CMD_DELETINGOLDERTHEN"], date("Y-m-d", $timestamp)));
                        // Now perform the data cleanup!
                        $content['affectedrows'] = $stream->CleanupLogdataByDate($timestamp);
                        if (isset($content['affectedrows'])) {
                            //Debug Output
                            PrintHTMLDebugInfo(DEBUG_INFO, "CleanData", GetAndReplaceLangStr($content["LN_CMD_DELETEDROWS"], $content['affectedrows']));
                        } else {
                            // Print error and die!
                            DieWithErrorMsg(GetAndReplaceLangStr($content["LN_CMD_FAILEDTOCLEANDATA"], $mySource['Name']));
                        }
                    }
                } else {
                    // Print error and die!
                    DieWithErrorMsg($content["LN_CMD_SUBPARAM1MISSING"]);
                }
            } else {
                // Print error and die!
                DieWithErrorMsg(GetAndReplaceLangStr($content["LN_CMD_COULDNOTGETROWCOUNT"], $mySource['Name']));
            }
        } else {
            // Print error and die!
            $szErroMsg = GetAndReplaceLangStr($content["LN_SOURCES_ERROR_WITHINSOURCE"], $mySource['Name'], GetErrorMessage($res));
            if (isset($extraErrorDescription)) {
                $szErroMsg .= "\r\n\r\n" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
            }
            DieWithErrorMsg($szErroMsg);
        }
    } else {
        // Print error and die!
        DieWithErrorMsg(GetAndReplaceLangStr($content["LN_SOURCES_ERROR_NOCLEARSUPPORT"], $content['SOURCEID']));
    }
}
Exemplo n.º 10
0
                     $tmpSource['DBUser'] = DB_StripSlahes($content['SourceDBUser']);
                     $tmpSource['DBPassword'] = DB_StripSlahes($content['SourceDBPassword']);
                     $tmpSource['DBEnableRowCounting'] = $content['SourceDBEnableRowCounting'];
                     $tmpSource['DBRecordsPerQuery'] = $content['SourceDBRecordsPerQuery'];
                     $tmpSource['userid'] = $content['userid'];
                     $tmpSource['groupid'] = $content['groupid'];
                 }
             }
             // Init the source
             InitSource($tmpSource);
             // Create LogStream Object
             $stream = $tmpSource['ObjRef']->LogStreamFactory($tmpSource['ObjRef']);
             $res = $stream->Verify();
             if ($res != SUCCESS) {
                 $content['ISERROR'] = true;
                 $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_SOURCES_ERROR_WITHINSOURCE'], $tmpSource['Name'], GetErrorMessage($res));
                 if (isset($extraErrorDescription)) {
                     $content['ERROR_MSG'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
                 }
             }
             // ---
         }
     }
 }
 // --- Now ADD/EDIT do the processing!
 if (!isset($content['ISERROR'])) {
     // Everything was alright, so we go to the next step!
     if ($_POST['op'] == "addnewsource") {
         // Add custom search now!
         if ($content['SourceType'] == SOURCE_DISK) {
             $sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, MsgSkipUnparseable, defaultfilter, ViewID, LogLineType, DiskFile, userid, groupid) \n\t\t\t\tVALUES ('" . $content['Name'] . "', \n\t\t\t\t\t\t'" . $content['Description'] . "',\n\t\t\t\t\t\t" . $content['SourceType'] . ", \n\t\t\t\t\t\t'" . $content['MsgParserList'] . "',\n\t\t\t\t\t\t" . $content['MsgNormalize'] . ", \n\t\t\t\t\t\t" . $content['MsgSkipUnparseable'] . ", \n\t\t\t\t\t\t'" . $content['defaultfilter'] . "',\n\t\t\t\t\t\t'" . $content['SourceViewID'] . "',\n\t\t\t\t\t\t'" . $content['SourceLogLineType'] . "',\n\t\t\t\t\t\t'" . $content['SourceDiskFile'] . "',\n\t\t\t\t\t\t" . $content['userid'] . ", \n\t\t\t\t\t\t" . $content['groupid'] . " \n\t\t\t\t\t\t)";
Exemplo n.º 11
0
function RunReport()
{
    global $content, $gl_root_path;
    // Get Reference to report!
    $myReport = $content['REPORTS'][$content['reportid']];
    // Get reference to savedreport
    $mySavedReport = $myReport['SAVEDREPORTS'][$content['savedreportid']];
    // Get Objectreference to report
    $myReportObj = $myReport["ObjRef"];
    // Set SavedReport Settings!
    $myReportObj->InitFromSavedReport($mySavedReport);
    //Debug Output
    PrintHTMLDebugInfo(DEBUG_INFO, "RunReport", GetAndReplaceLangStr($content["LN_CMD_RUNREPORT"], $mySavedReport['customTitle']));
    // Perform check
    $res = $myReportObj->verifyDataSource();
    if ($res != SUCCESS) {
        // Print error and die!
        $szError = GetAndReplaceLangStr($content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetAndReplaceLangStr(GetErrorMessage($res), $mySavedReport['sourceid']));
        if (isset($extraErrorDescription)) {
            $szError .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
        }
        DieWithErrorMsg($szError);
    } else {
        // Call processing part now!
        $res = $myReportObj->startDataProcessing();
        if ($res != SUCCESS) {
            DieWithErrorMsg(GetAndReplaceLangStr($content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetErrorMessage($res)));
        } else {
            // --- Perform report output
            // Init IncludePath
            $reportIncludePath = $myReportObj->GetReportIncludePath();
            // Include Custom language file if available
            $myReportObj->InitReportLanguageFile($reportIncludePath);
            // Init template Parser
            $page = new Template();
            $page->set_path($reportIncludePath);
            // Parse template
            $page->parser($content, $myReportObj->GetBaseFileName());
            // Output the result
            $res = $myReportObj->OutputReport($page->result(), $szErrorStr);
            if ($res == SUCCESS && $myReportObj->GetOutputTarget() != REPORT_TARGET_STDOUT) {
                //Debug Output
                PrintHTMLDebugInfo(DEBUG_INFO, "RunReport", GetAndReplaceLangStr($content["LN_GEN_SUCCESS_REPORTWASGENERATED_DETAILS"], $szErrorStr));
            } else {
                if ($res == ERROR) {
                    // Debug Error
                    PrintHTMLDebugInfo(DEBUG_ERROR, "RunReport", GetAndReplaceLangStr($content["LN_GEN_ERROR_REPORTFAILEDTOGENERATE"], $szErrorStr));
                }
            }
            // ---
        }
    }
}