Skip to content

Commit

Permalink
Merge pull request ZoneMinder#1217 from ZoneMinder/multi-server
Browse files Browse the repository at this point in the history
Multi server
  • Loading branch information
Andrew Bauer committed Jan 2, 2016
2 parents a93f78b + 4d1f837 commit e6340ac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions web/ajax/log.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
$logs = array();
foreach ( dbFetchAll( $sql, NULL, $values ) as $log ) {
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
$log['Server'] = $log['ServerId'] ? $servers_by_Id[$log['ServerId']]->Name() : '';
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
$logs[] = $log;
}
$options = array();
Expand Down Expand Up @@ -107,7 +107,7 @@
elseif ( $field == 'ServerId' )
{
foreach( dbFetchAll( $sql, $field, array_values($fieldValues) ) as $value )
$options['ServerId'][$value] = $value ? $servers_by_Id[$value]->Name() : '';
$options['ServerId'][$value] = ( $value and isset($servers_by_Id[$value]) ) ? $servers_by_Id[$value]->Name() : '';

}
else
Expand Down Expand Up @@ -216,6 +216,7 @@
foreach ( dbFetchAll( $sql, NULL, $values ) as $log )
{
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
$logs[] = $log;
}
switch( $format )
Expand Down Expand Up @@ -246,7 +247,7 @@
)."\n" );
foreach ( $logs as $log )
{
fprintf( $exportFP, "%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $servers_by_Id[$log['ServerId']]->Name(),$log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
fprintf( $exportFP, "%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
}
break;
}
Expand Down Expand Up @@ -306,7 +307,7 @@
elseif ( $classLevel > Logger::DEBUG )
$classLevel = Logger::DEBUG;
$logClass = 'log-'.strtolower(Logger::$codes[$classLevel]);
fprintf( $exportFP, " <tr class=\"%s\"><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $logClass, $log['DateTime'], $log['Component'], $servers_by_Id[$log['ServerId']]->Name(), $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
fprintf( $exportFP, " <tr class=\"%s\"><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $logClass, $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
}
fwrite( $exportFP,
' </tbody>
Expand Down

0 comments on commit e6340ac

Please sign in to comment.