protected static function create_link($line) { # urlencode our environment and language query parameters as # necessary. if (is_null(self::$encoded_environment)) { self::$encoded_environment = urlencode($_GET['environment']); } if (is_null(self::$encoded_language)) { self::$encoded_language = urlencode($_GET['language']); } # Create an array of query parameters and create the line identifier # for this particular log line. $query_params = array ( 'display_extended_filters=0', 'environment=' . self::$encoded_environment, 'language=' . self::$encoded_language, 'start_timestamp=' . ($line->syslog_timestamp - 1), 'end_timestamp=' . ($line->syslog_timestamp + 5) ); $line_id = $line->syslog_timestamp . '.' . $line->line_offset; return '<a href="?' . implode('&', $query_params) . '#' . $line_id . '" id="' . $line_id . '" name="' . $line_id . '">link</a>'; }
while ((LineOutput::$displayed_lines < MAX_LINES) && ($current_line = $log_set->gets())) { // If we have any filters, skip the lines that do not match them. if ( (! $current_line->matches_source_hosts()) || (! $current_line->matches_log_levels()) || (! $current_line->matches_log_facilities()) || (! $current_line->matches_filters()) ) { SkipWarning::add(); continue; } echo SkipWarning::warning(true); LineOutput::display($current_line); } echo SkipWarning::warning(true); if ((LineOutput::$displayed_lines == 0) && (SkipWarning::$total_skipped == 0)) { echo "<div class='warning'>No log lines were found for the requested timeframe (" . strftime('%Y-%m-%d %H:%M:%S', $start_timestamp) . " thru " . strftime('%Y-%m-%d %H:%M:%S', $end_timestamp) . ').</div>'; } elseif (LineOutput::$displayed_lines >= MAX_LINES) { echo "<div class='warning'>Encountered maximum line display limit of " . number_format(MAX_LINES) . " lines.</div>"; } else { echo "<div class='warning'>Reached end of requested timeframe (" . strftime('%Y-%m-%d %H:%M:%S', $end_timestamp) . ").</div>"; } }
return $r; } $result = Console_Getopt::getopt($argv, 'i:'); if (!$result || count($result[1]) < 1) { die("usage: php sci_generator.php -i scintilla source directory"); } list($opts, $argv) = $result; $path = ''; foreach ($opts as $opt) { list($opt_spec, $opt_arg) = $opt; if ($opt_spec == 'i') { $path = $opt_arg; } } $savefile = dirname(__FILE__) . "/gen_scintilla.c"; if ($sfp = new LineOutput(fopen($savefile, 'w'), $savefile)) { if ($handle = fopen("ext/scintilla/scintilla.in", "r")) { while (1 && ($data = fgets($handle, 1000)) !== FALSE) { $sfp->write($data); } } $sfp->write("\n/*Start of generated code*/\n\n"); $const = array(); if ($handle = fopen("{$path}/include/Scintilla.h", "r")) { while (1 && ($data = fgets($handle, 1000)) !== FALSE) { preg_match('!\\#define\\s(SCI_\\w+)\\s([-]*\\d+)!is', $data, $match); $const[$match[2]] = $match[1]; } fclose($handle); } if ($handle = fopen("{$path}/include/Scintilla.iface", "r")) {