diff --git a/src/admin/reports.php b/src/admin/reports.php index 732b5c9..02306e8 100644 --- a/src/admin/reports.php +++ b/src/admin/reports.php @@ -1299,10 +1299,19 @@ function InitOutputtargetDefinitions($myReport, $outputTargetDetails) function CreateCronCommand( $myReportID, $mySavedReportID = null ) { - global $content, $gl_root_path; + global $content, $gl_root_path, $myReport; if ( isset($mySavedReportID) ) { + // Get Reference to report! + $myReport = $content['REPORTS'][ $myReportID ]; + + // Get reference to savedreport + $mySavedReport = $myReport['SAVEDREPORTS'][ $mySavedReportID ]; + + // Get configured Source for savedreport + $myReportSource = $content['Sources'][ $mySavedReport['sourceid'] ]; + $pos = strpos( strtoupper(PHP_OS), "WIN"); if ($pos !== false) { @@ -1320,6 +1329,17 @@ function CreateCronCommand( $myReportID, $mySavedReportID = null ) // Enable display of report command $content['enableCronCommand'] = true; $szCommand = $phpCmd . " " . $phpScript . " runreport " . $myReportID . " " . $mySavedReportID; + + // --- Check for user or group sources + if ( $myReportSource['userid'] != null ) + { + $szCommand .= " " . "userid=" . $myReportSource['userid']; + } + else if ( $myReportSource['groupid'] != null ) + { + $szCommand .= " " . "groupid=" . $myReportSource['userid']; + } + // --- } else { diff --git a/src/cron/cmdreportgen.php b/src/cron/cmdreportgen.php index 944faa5..35831b4 100644 --- a/src/cron/cmdreportgen.php +++ b/src/cron/cmdreportgen.php @@ -72,8 +72,8 @@ include_once($gl_root_path . 'classes/logstream.class.php'); define('IN_PHPLOGCON_COMMANDLINE', true); $content['IN_PHPLOGCON_COMMANDLINE'] = true; InitPhpLogCon(); -InitSourceConfigs(); InitFilterHelpers(); // Helpers for frontend filtering! +InitSourceConfigs(); // Firts of all init List of Reports! InitReportModules(); @@ -107,7 +107,7 @@ function RunReport() if ( $res != SUCCESS ) { // Print error and die! - $szError = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_ERRORCHECKINGSOURCE'], GetAndReplaceLangStr( GetErrorMessage($res), $mySavedReport['sourceid']) ); + $szError = GetAndReplaceLangStr( $content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetAndReplaceLangStr( GetErrorMessage($res), $mySavedReport['sourceid']) ); if ( isset($extraErrorDescription) ) $szError .= "

" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription); DieWithErrorMsg( $szError ); @@ -206,6 +206,34 @@ function RunReport() } else DieWithErrorMsg( $content["LN_CMD_NOSAVEDREPORTID"] ); + + // Run Optional Params first: userid/groupid + if ( isset($_SERVER["argv"][4]) ) + { + // Set to SourceID property! + $tmpvar = $_SERVER["argv"][4]; + + if ( strpos($tmpvar, "=") !== false ) + { + $tmparr = explode("=", $tmpvar); + if ( $tmparr[0] == "userid" ) + { + $userid = $tmparr[1]; + $_SESSION['SESSION_LOGGEDIN'] = true; + $_SESSION['SESSION_USERID'] = $userid; + $content['SESSION_LOGGEDIN'] = true; + $content['SESSION_USERID'] = $userid; + } + else if ( $tmparr[0] == "groupid" ) + { + $groupid = $tmparr[1]; + } + } + + // Reload Configured Sources + LoadSourcesFromDatabase(); + InitSourceConfigs(); + } // --- // --- Operation Handling now diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 55821ef..a845d06 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -985,7 +985,7 @@ function LoadSourcesFromDatabase() $myrows = DB_GetAllRows($result, true); if ( isset($myrows) && count($myrows) > 0 ) { - // Overwrite existing Views array + // Overwrite existing Sources array unset($CFG['Sources']); // Append to Source Array