Kaynağa Gözat

Server Errors app to display web server error log.

Nate 6 yıl önce
işleme
d83d019b3b
5 değiştirilmiş dosya ile 602 ekleme ve 0 silme
  1. 48 0
      app_config.php
  2. 284 0
      app_languages.php
  3. 28 0
      app_menu.php
  4. 152 0
      errors.php
  5. 90 0
      root.php

+ 48 - 0
app_config.php

@@ -0,0 +1,48 @@
+<?php
+
+	//application details
+		$apps[$x]['name'] = "Server Errors";
+		$apps[$x]['uuid'] = "0e08d30e-e4ec-4efd-9f4b-fbd541642c9c";
+		$apps[$x]['category'] = "Core";;
+		$apps[$x]['subcategory'] = "";
+		$apps[$x]['version'] = "1.0";
+		$apps[$x]['license'] = "Mozilla Public License 1.1";
+		$apps[$x]['url'] = "http://www.fusionpbx.com";
+		$apps[$x]['description']['en-us'] = "Display web server errors.";
+		$apps[$x]['description']['ar-eg'] = "";
+		$apps[$x]['description']['de-at'] = "";
+		$apps[$x]['description']['de-ch'] = "";
+		$apps[$x]['description']['de-de'] = "";
+		$apps[$x]['description']['es-cl'] = "";
+		$apps[$x]['description']['es-mx'] = "";
+		$apps[$x]['description']['fr-ca'] = "";
+		$apps[$x]['description']['fr-fr'] = "";
+		$apps[$x]['description']['he-il'] = "";
+		$apps[$x]['description']['it-it'] = "";
+		$apps[$x]['description']['nl-nl'] = "";
+		$apps[$x]['description']['pl-pl'] = "";
+		$apps[$x]['description']['pt-br'] = "";
+		$apps[$x]['description']['pt-pt'] = "";
+		$apps[$x]['description']['ro-ro'] = "";
+		$apps[$x]['description']['ru-ru'] = "";
+		$apps[$x]['description']['sv-se'] = "";
+		$apps[$x]['description']['uk-ua'] = "";
+
+	//permission details
+		$y=0;
+		$apps[$x]['permissions'][$y]['name'] = "errors_view";
+		$apps[$x]['permissions'][$y]['menu']['uuid'] = "0b4702e7-a254-4fda-84ae-1f28350fc8f5";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;
+
+	//default settings
+		$y=0;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "687893ef-f082-4a5d-8511-2b924658ddb2";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "server";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "error";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "/var/log/nginx/error.log";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "Path to web server error log file.";
+		$y++;
+?>

+ 284 - 0
app_languages.php

@@ -0,0 +1,284 @@
+<?php
+#This file was last reorganized on 19th of September 2017 08:54:24 AM UTC
+
+$text['title-server_errors']['en-us'] = "Server Errors";
+$text['title-server_errors']['ar-eg'] = "";
+$text['title-server_errors']['de-at'] = "";
+$text['title-server_errors']['de-ch'] = "";
+$text['title-server_errors']['de-de'] = "";
+$text['title-server_errors']['es-cl'] = "";
+$text['title-server_errors']['es-mx'] = "";
+$text['title-server_errors']['fr-ca'] = "";
+$text['title-server_errors']['fr-fr'] = "";
+$text['title-server_errors']['he-il'] = "";
+$text['title-server_errors']['it-it'] = "";
+$text['title-server_errors']['nl-nl'] = "";
+$text['title-server_errors']['pl-pl'] = "";
+$text['title-server_errors']['pt-br'] = "";
+$text['title-server_errors']['pt-pt'] = "";
+$text['title-server_errors']['ro-ro'] = "";
+$text['title-server_errors']['ru-ru'] = "";
+$text['title-server_errors']['sv-se'] = "";
+$text['title-server_errors']['uk-ua'] = "";
+
+$text['label-syntax']['en-us'] = "Syntax Highlighted";
+$text['label-syntax']['ar-eg'] = "";
+$text['label-syntax']['de-at'] = "Syntax Highlighted"; //copied from de-de
+$text['label-syntax']['de-ch'] = "Syntax Highlighted"; //copied from de-de
+$text['label-syntax']['de-de'] = "Syntax Highlighted";
+$text['label-syntax']['es-cl'] = "Destacar Sintaxis";
+$text['label-syntax']['es-mx'] = "Destacar Sintaxis"; //copied from es-cl
+$text['label-syntax']['fr-ca'] = "Coloration Syntaxique"; //copied from fr-fr
+$text['label-syntax']['fr-fr'] = "Coloration Syntaxique";
+$text['label-syntax']['he-il'] = "";
+$text['label-syntax']['it-it'] = "Sintassi Evidenziata";
+$text['label-syntax']['nl-nl'] = "";
+$text['label-syntax']['pl-pl'] = "Składnia wyróżniona";
+$text['label-syntax']['pt-br'] = "Realçar a sintaxe";
+$text['label-syntax']['pt-pt'] = "Realçar a Sintaxe";
+$text['label-syntax']['ro-ro'] = "";
+$text['label-syntax']['ru-ru'] = "Выделение Синтаксиса";
+$text['label-syntax']['sv-se'] = "Syntax Markerad";
+$text['label-syntax']['uk-ua'] = "Підсвічування синтаксису";
+
+$text['label-sort']['en-us'] = "Sort Descending";
+$text['label-sort']['ar-eg'] = "";
+$text['label-sort']['de-at'] = "Absteigend sortiert"; //copied from de-de
+$text['label-sort']['de-ch'] = "Absteigend sortiert"; //copied from de-de
+$text['label-sort']['de-de'] = "Absteigend sortiert";
+$text['label-sort']['es-cl'] = "Mostrar en orden descendente";
+$text['label-sort']['es-mx'] = "Mostrar en orden descendente"; //copied from es-cl
+$text['label-sort']['fr-ca'] = "Affichage ordre descendant"; //copied from fr-fr
+$text['label-sort']['fr-fr'] = "Affichage ordre descendant";
+$text['label-sort']['he-il'] = "";
+$text['label-sort']['it-it'] = "Ordina a Scendere";
+$text['label-sort']['nl-nl'] = "";
+$text['label-sort']['pl-pl'] = "Sortuj malejąco";
+$text['label-sort']['pt-br'] = "Ordenar por tipo";
+$text['label-sort']['pt-pt'] = "Ordenar Descendetemente";
+$text['label-sort']['ro-ro'] = "";
+$text['label-sort']['ru-ru'] = "Сортировка по убыванию";
+$text['label-sort']['sv-se'] = "Sortera Fallande";
+$text['label-sort']['uk-ua'] = "Сортувати за спаданням";
+
+$text['label-open_file']['en-us'] = "Opening entire file...";
+$text['label-open_file']['ar-eg'] = "";
+$text['label-open_file']['de-at'] = "gesamte Datei öffnen"; //copied from de-de
+$text['label-open_file']['de-ch'] = "gesamte Datei öffnen"; //copied from de-de
+$text['label-open_file']['de-de'] = "gesamte Datei öffnen";
+$text['label-open_file']['es-cl'] = "Abrir el archivo completo";
+$text['label-open_file']['es-mx'] = "Abrir el archivo completo"; //copied from es-cl
+$text['label-open_file']['fr-ca'] = "Ouvrir le fichier entier"; //copied from fr-fr
+$text['label-open_file']['fr-fr'] = "Ouvrir le fichier entier";
+$text['label-open_file']['he-il'] = "";
+$text['label-open_file']['it-it'] = "Apertura completa file";
+$text['label-open_file']['nl-nl'] = "";
+$text['label-open_file']['pl-pl'] = "otwarcie całego pliku";
+$text['label-open_file']['pt-br'] = "Abrir um arquivo todo";
+$text['label-open_file']['pt-pt'] = "abrir o ficheiro todo";
+$text['label-open_file']['ro-ro'] = "";
+$text['label-open_file']['ru-ru'] = "Открытие всего файла";
+$text['label-open_file']['sv-se'] = "Öppnar hela filen";
+$text['label-open_file']['uk-ua'] = "відкрито весь файл";
+
+$text['label-open_at']['en-us'] = "opening at";
+$text['label-open_at']['ar-eg'] = "";
+$text['label-open_at']['de-at'] = "öffnen"; //copied from de-de
+$text['label-open_at']['de-ch'] = "öffnen"; //copied from de-de
+$text['label-open_at']['de-de'] = "öffnen";
+$text['label-open_at']['es-cl'] = "Abrir en";
+$text['label-open_at']['es-mx'] = "Abrir en"; //copied from es-cl
+$text['label-open_at']['fr-ca'] = "Ouvrir à"; //copied from fr-fr
+$text['label-open_at']['fr-fr'] = "Ouvrir à";
+$text['label-open_at']['he-il'] = "";
+$text['label-open_at']['it-it'] = "Aperto a";
+$text['label-open_at']['nl-nl'] = "";
+$text['label-open_at']['pl-pl'] = "otwarcie na";
+$text['label-open_at']['pt-br'] = "Abrir";
+$text['label-open_at']['pt-pt'] = "abrir";
+$text['label-open_at']['ro-ro'] = "";
+$text['label-open_at']['ru-ru'] = "Открытие на";
+$text['label-open_at']['sv-se'] = "Öppnar vid";
+$text['label-open_at']['uk-ua'] = "відкрито о";
+
+$text['header-server_errors']['en-us'] = "Server Errors";
+$text['header-server_errors']['ar-eg'] = "";
+$text['header-server_errors']['de-at'] = "";
+$text['header-server_errors']['de-ch'] = "";
+$text['header-server_errors']['de-de'] = "";
+$text['header-server_errors']['es-cl'] = "";
+$text['header-server_errors']['es-mx'] = "";
+$text['header-server_errors']['fr-ca'] = "";
+$text['header-server_errors']['fr-fr'] = "";
+$text['header-server_errors']['he-il'] = "";
+$text['header-server_errors']['it-it'] = "";
+$text['header-server_errors']['nl-nl'] = "";
+$text['header-server_errors']['pl-pl'] = "";
+$text['header-server_errors']['pt-br'] = "";
+$text['header-server_errors']['pt-pt'] = "";
+$text['header-server_errors']['ro-ro'] = "";
+$text['header-server_errors']['ru-ru'] = "";
+$text['header-server_errors']['sv-se'] = "";
+$text['header-server_errors']['uk-ua'] = "";
+
+$text['label-line_numbers']['en-us'] = "Line Numbers";
+$text['label-line_numbers']['ar-eg'] = "";
+$text['label-line_numbers']['de-at'] = "Zeilennummern anzeigen"; //copied from de-de
+$text['label-line_numbers']['de-ch'] = "Zeilennummern anzeigen"; //copied from de-de
+$text['label-line_numbers']['de-de'] = "Zeilennummern anzeigen";
+$text['label-line_numbers']['es-cl'] = "Mostrar números de línea";
+$text['label-line_numbers']['es-mx'] = "Mostrar números de línea"; //copied from es-cl
+$text['label-line_numbers']['fr-ca'] = "Afficher les numéros de ligne"; //copied from fr-fr
+$text['label-line_numbers']['fr-fr'] = "Afficher les numéros de ligne";
+$text['label-line_numbers']['he-il'] = "";
+$text['label-line_numbers']['it-it'] = "Mostra Numeri di Riga";
+$text['label-line_numbers']['nl-nl'] = "";
+$text['label-line_numbers']['pl-pl'] = "Pokaż numery wierszy";
+$text['label-line_numbers']['pt-br'] = "Mostrar números das linhas";
+$text['label-line_numbers']['pt-pt'] = "Mostrar Números das Linhas";
+$text['label-line_numbers']['ro-ro'] = "";
+$text['label-line_numbers']['ru-ru'] = "Показывать номера строк";
+$text['label-line_numbers']['sv-se'] = "Visa Linje Nummer";
+$text['label-line_numbers']['uk-ua'] = "Нумерація рядків";
+
+$text['label-lines']['en-us'] = "Lines";
+$text['label-lines']['ar-eg'] = "";
+$text['label-lines']['de-at'] = "";
+$text['label-lines']['de-ch'] = "";
+$text['label-lines']['de-de'] = "";
+$text['label-lines']['es-cl'] = "";
+$text['label-lines']['es-mx'] = "";
+$text['label-lines']['fr-ca'] = "";
+$text['label-lines']['fr-fr'] = "";
+$text['label-lines']['he-il'] = "";
+$text['label-lines']['it-it'] = "";
+$text['label-lines']['nl-nl'] = "";
+$text['label-lines']['pl-pl'] = "";
+$text['label-lines']['pt-br'] = "";
+$text['label-lines']['pt-pt'] = "";
+$text['label-lines']['ro-ro'] = "";
+$text['label-lines']['ru-ru'] = "";
+$text['label-lines']['sv-se'] = "";
+$text['label-lines']['uk-ua'] = "";
+
+$text['label-log']['en-us'] = "Log";
+$text['label-log']['ar-eg'] = "";
+$text['label-log']['de-at'] = "";
+$text['label-log']['de-ch'] = "";
+$text['label-log']['de-de'] = "";
+$text['label-log']['es-cl'] = "";
+$text['label-log']['es-mx'] = "";
+$text['label-log']['fr-ca'] = "";
+$text['label-log']['fr-fr'] = "";
+$text['label-log']['he-il'] = "";
+$text['label-log']['it-it'] = "";
+$text['label-log']['nl-nl'] = "";
+$text['label-log']['pl-pl'] = "";
+$text['label-log']['pt-br'] = "";
+$text['label-log']['pt-pt'] = "";
+$text['label-log']['ro-ro'] = "";
+$text['label-log']['ru-ru'] = "";
+$text['label-log']['sv-se'] = "";
+$text['label-log']['uk-ua'] = "";
+
+$text['label-current']['en-us'] = "Current";
+$text['label-current']['ar-eg'] = "";
+$text['label-current']['de-at'] = "";
+$text['label-current']['de-ch'] = "";
+$text['label-current']['de-de'] = "";
+$text['label-current']['es-cl'] = "";
+$text['label-current']['es-mx'] = "";
+$text['label-current']['fr-ca'] = "";
+$text['label-current']['fr-fr'] = "";
+$text['label-current']['he-il'] = "";
+$text['label-current']['it-it'] = "";
+$text['label-current']['nl-nl'] = "";
+$text['label-current']['pl-pl'] = "";
+$text['label-current']['pt-br'] = "";
+$text['label-current']['pt-pt'] = "";
+$text['label-current']['ro-ro'] = "";
+$text['label-current']['ru-ru'] = "";
+$text['label-current']['sv-se'] = "";
+$text['label-current']['uk-ua'] = "";
+
+$text['label-previous']['en-us'] = "Previous";
+$text['label-previous']['ar-eg'] = "";
+$text['label-previous']['de-at'] = "";
+$text['label-previous']['de-ch'] = "";
+$text['label-previous']['de-de'] = "";
+$text['label-previous']['es-cl'] = "";
+$text['label-previous']['es-mx'] = "";
+$text['label-previous']['fr-ca'] = "";
+$text['label-previous']['fr-fr'] = "";
+$text['label-previous']['he-il'] = "";
+$text['label-previous']['it-it'] = "";
+$text['label-previous']['nl-nl'] = "";
+$text['label-previous']['pl-pl'] = "";
+$text['label-previous']['pt-br'] = "";
+$text['label-previous']['pt-pt'] = "";
+$text['label-previous']['ro-ro'] = "";
+$text['label-previous']['ru-ru'] = "";
+$text['label-previous']['sv-se'] = "";
+$text['label-previous']['uk-ua'] = "";
+
+$text['label-filter']['en-us'] = "Filter";
+$text['label-filter']['ar-eg'] = "";
+$text['label-filter']['de-at'] = "Filter"; //copied from de-de
+$text['label-filter']['de-ch'] = "Filter"; //copied from de-de
+$text['label-filter']['de-de'] = "Filter";
+$text['label-filter']['es-cl'] = "Filtrar";
+$text['label-filter']['es-mx'] = "Filtrar"; //copied from es-cl
+$text['label-filter']['fr-ca'] = "Filtre"; //copied from fr-fr
+$text['label-filter']['fr-fr'] = "Filtre";
+$text['label-filter']['he-il'] = "";
+$text['label-filter']['it-it'] = "Filtro";
+$text['label-filter']['nl-nl'] = "";
+$text['label-filter']['pl-pl'] = "Filtr";
+$text['label-filter']['pt-br'] = "Filtro"; //copied from pt-pt
+$text['label-filter']['pt-pt'] = "Filtro";
+$text['label-filter']['ro-ro'] = "";
+$text['label-filter']['ru-ru'] = "Фильтр";
+$text['label-filter']['sv-se'] = "Filter";
+$text['label-filter']['uk-ua'] = "Фільтр";
+
+$text['label-display']['en-us'] = "Display";
+$text['label-display']['ar-eg'] = "";
+$text['label-display']['de-at'] = "letztes anzeigen"; //copied from de-de
+$text['label-display']['de-ch'] = "letztes anzeigen"; //copied from de-de
+$text['label-display']['de-de'] = "letztes anzeigen";
+$text['label-display']['es-cl'] = "Mostrando últimos eventos";
+$text['label-display']['es-mx'] = "Mostrando últimos eventos"; //copied from es-cl
+$text['label-display']['fr-ca'] = "Afficher les derniers"; //copied from fr-fr
+$text['label-display']['fr-fr'] = "Afficher les derniers";
+$text['label-display']['he-il'] = "";
+$text['label-display']['it-it'] = "Mostra l'ultimo";
+$text['label-display']['nl-nl'] = "";
+$text['label-display']['pl-pl'] = "Wyświetlanie od ostatniego";
+$text['label-display']['pt-br'] = "Mostrar o último"; //copied from pt-pt
+$text['label-display']['pt-pt'] = "Mostrar o último";
+$text['label-display']['ro-ro'] = "";
+$text['label-display']['ru-ru'] = "Отображение последнего";
+$text['label-display']['sv-se'] = "Visar den sista";
+$text['label-display']['uk-ua'] = "Показувати останні";
+
+$text['error-open_file']['en-us'] = "Unable to open file!";
+$text['error-open_file']['ar-eg'] = "";
+$text['error-open_file']['de-at'] = "Datei kann nicht geöffnet werden!"; //copied from de-de
+$text['error-open_file']['de-ch'] = "Datei kann nicht geöffnet werden!"; //copied from de-de
+$text['error-open_file']['de-de'] = "Datei kann nicht geöffnet werden!";
+$text['error-open_file']['es-cl'] = "¡Imposible abrir el archivo!";
+$text['error-open_file']['es-mx'] = "¡Imposible abrir el archivo!"; //copied from es-cl
+$text['error-open_file']['fr-ca'] = "Impossible d'ouvrir le fichier!"; //copied from fr-fr
+$text['error-open_file']['fr-fr'] = "Impossible d'ouvrir le fichier!";
+$text['error-open_file']['he-il'] = "";
+$text['error-open_file']['it-it'] = "Impossibile aprire il file!";
+$text['error-open_file']['nl-nl'] = "";
+$text['error-open_file']['pl-pl'] = "Nie można otworzyć pliku!";
+$text['error-open_file']['pt-br'] = "Impossivel abrir o arquivo";
+$text['error-open_file']['pt-pt'] = "Impossível abrir o ficheiro!";
+$text['error-open_file']['ro-ro'] = "";
+$text['error-open_file']['ru-ru'] = "Невозможно открыть файл!";
+$text['error-open_file']['sv-se'] = "Kan inte öppna fil!";
+$text['error-open_file']['uk-ua'] = "Неможливо відкрити файл!";
+
+?>

+ 28 - 0
app_menu.php

@@ -0,0 +1,28 @@
+<?php
+
+	$y=0;
+	$apps[$x]['menu'][$y]['title']['en-us'] = "Server Errors";
+	$apps[$x]['menu'][$y]['title']['ar-eg'] = "";
+	$apps[$x]['menu'][$y]['title']['de-at'] = "";
+	$apps[$x]['menu'][$y]['title']['de-de'] = "";
+	$apps[$x]['menu'][$y]['title']['es-cl'] = "";
+	$apps[$x]['menu'][$y]['title']['es-mx'] = "";
+	$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
+	$apps[$x]['menu'][$y]['title']['fr-fr'] = "";
+	$apps[$x]['menu'][$y]['title']['he-il'] = "";
+	$apps[$x]['menu'][$y]['title']['it-it'] = "";
+	$apps[$x]['menu'][$y]['title']['nl-nl'] = "";
+	$apps[$x]['menu'][$y]['title']['pl-pl'] = "";
+	$apps[$x]['menu'][$y]['title']['pt-br'] = "";
+	$apps[$x]['menu'][$y]['title']['pt-pt'] = "";
+	$apps[$x]['menu'][$y]['title']['ro-ro'] = "";
+	$apps[$x]['menu'][$y]['title']['ru-ru'] = "";
+	$apps[$x]['menu'][$y]['title']['sv-se'] = "";
+	$apps[$x]['menu'][$y]['title']['uk-ua'] = "";
+	$apps[$x]['menu'][$y]['uuid'] = "ccdddbd1-40d2-46ca-a86f-4ed93eba4942";
+	$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
+	$apps[$x]['menu'][$y]['category'] = "internal";
+	$apps[$x]['menu'][$y]['path'] = "/app/errors/errors.php";
+	$apps[$x]['menu'][$y]['groups'][] = "superadmin";
+
+?>

+ 152 - 0
errors.php

@@ -0,0 +1,152 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+//includes
+	include "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (!permission_exists('errors_view')) {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//set defaults
+	if (!is_numeric($_POST['line_number'])) { $_POST['line_number'] = 0; }
+	if ($_POST['sort'] != 'asc' && $_POST['sort'] != 'desc') { $_POST['sort'] = 'asc'; }
+	if (!is_numeric($_POST['lines'])) { $_POST['lines'] = '10'; }
+
+//include the header
+	$document['title'] = $text['title-server_errors'];
+	require_once "resources/header.php";
+
+//show the content
+	$error_file = $_SESSION['server']['error']['text'].($_POST['log'] == 'previous' ? '.1' : null);
+	if (file_exists($error_file)) {
+
+		//colored lines
+		$x = 0;
+		$filters[$x]['pattern'] = '[error]';
+		$filters[$x]['color'] = '#cc0000';
+		$x++;
+		$filters[$x]['pattern'] = '[crit]';
+		$filters[$x]['color'] = 'gold';
+
+		$file_lines = file($error_file, FILE_SKIP_EMPTY_LINES);
+
+		echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
+		echo "	<tr>\n";
+		echo "		<td align='left' valign='top' width='100%' style='padding-right: 15px;' nowrap>\n";
+		echo "			<b>".$text['header-server_errors']."</b><br />\n";
+		echo "		</td>\n";
+		echo "		<td align='right' valign='middle' nowrap>\n";
+		echo "			<form method='post'>\n";
+		echo "			".$text['label-log'];
+		echo "			<select class='formfld' name='log' style='margin-right: 20px; margin-top: 4px;'>\n";
+		echo "				<option value='current'>".$text['label-current']."</option>\n";
+		if (file_exists($_SESSION['server']['error']['text'].'.1')) {
+			echo "			<option value='previous' ".($_POST['log'] == 'previous' ? 'selected' : null).">".$text['label-previous']."</option>\n";
+		}
+		echo "			</select>\n";
+		echo "			".$text['label-filter']." <input type='text' name='filter' class='formfld' style='width: 150px; text-align: center; margin-right: 20px;' value=\"".escape($_POST['filter'])."\" onclick='this.select();'>";
+		echo "			<label style='margin-right: 20px; margin-top: 4px;'><input type='checkbox' name='line_number' id='line_number' value='1' ".(($_POST['line_number'] == 1) ? 'checked' : null)."> ".$text['label-line_numbers']."</label>";
+		echo "			<label style='margin-right: 20px; margin-top: 4px;'><input type='checkbox' name='sort' id='sort' value='desc' ".(($_POST['sort'] == 'desc') ? 'checked' : null)."> ".$text['label-sort']."</label>";
+		echo "			".$text['label-display']." <input type='text' class='formfld' style='min-width: 50px; max-width: 50px; width: 50px; text-align: center;' name='lines' maxlength='5' value=\"".escape($_POST['lines'])."\" onclick='this.select();'> of ".count($file_lines)." ".$text['label-lines'];
+		echo "			<input type='submit' class='btn' style='margin-left: 20px;' name='submit' value=\"".$text['button-reload']."\">";
+		echo "			</form>\n";
+		echo "		</td>\n";
+		echo "	</tr>\n";
+		echo "</table>\n";
+		echo "<br>\n";
+
+		echo "<div id='file_content' style='max-height: 600px; overflow: auto; color: #aaa; background-color: #1c1c1c; border-radius: 4px; padding: 8px; text-align: left;'>\n";
+
+		if (is_array($file_lines) && sizeof($file_lines) > 0) {
+			echo "<span style='font-family: monospace;'>\n";
+			if ($_POST['filter'] != '') {
+				foreach ($file_lines as $index => $line) {
+					if (strpos($line, $_POST['filter']) == false) {
+						unset($file_lines[$index]);
+					}
+				}
+			}
+			if (is_numeric($_POST['lines']) && $_POST['lines'] > 0) {
+				$file_lines = array_slice($file_lines, -$_POST['lines'], $_POST['lines'], true);
+			}
+			if ($_POST['sort'] == 'desc') {
+				$file_lines = array_reverse($file_lines, true);
+			}
+			foreach ($file_lines as $index => $line) {
+				foreach ($filters as $filter) {
+					$pos = strpos($line, $filter['pattern']);
+					if ($pos !== false){
+						$filter_beg = "<span style='color: ".$filter['color'].";'>";
+						$line = str_replace($_POST['filter'],"<span style='background-color: #ffd800; color: #ff6600; font-weight: bold;'>".$_POST['filter']."</span>", $line);
+						$filter_end = "</span>";
+					}
+				}
+				if ($_POST['line_number']) {
+					$line_num = "<span style='font-family: courier; color: #aaa; font-size: 11px;'>".($index + 1)."&nbsp;&nbsp;&nbsp;</span>";
+				}
+				echo $line_num." ".$filter_beg.$line.$filter_end."<br><br>";
+			}
+			echo "</span>\n";
+		}
+		else {
+			echo "<center style='font-family: monospace;'><br>[ EMPTY FILE ]<br><br></center>";
+		}
+
+		echo "	<span id='bottom'></span>\n";
+		echo "</div>\n";
+
+	}
+	else {
+		if ($_SESSION['server']['error']['text'] != '') {
+			echo "Server error log file not found at: ".$_SESSION['server']['error']['text'];
+		}
+		else {
+			echo "Server error log file path not defined in Settings.";
+		}
+	}
+
+// scroll to bottom of displayed lines, when appropriate
+	if ($_POST['sort'] != 'desc') {
+		echo "<script>\n";
+		//note: the order of the two lines below matters!
+		echo "	$('#file_content').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
+		echo "	$('span#bottom')[0].scrollIntoView(true);\n"; //others
+		echo "</script>\n";
+	}
+
+//include the footer
+	require_once "resources/footer.php";
+
+?>

+ 90 - 0
root.php

@@ -0,0 +1,90 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+// make sure the PATH_SEPARATOR is defined
+	umask(2);
+	if (!defined("PATH_SEPARATOR")) {
+		if (strpos($_ENV["OS"], "Win") !== false) {
+			define("PATH_SEPARATOR", ";");
+		} else {
+			define("PATH_SEPARATOR", ":");
+		}
+	}
+
+	if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
+
+	// make sure the document_root is set
+	$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
+	if(PHP_SAPI == 'cli'){
+		chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
+		$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
+		$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
+		if (file_exists('/project_root.php')) {
+			$path = '/';
+		} else {
+			$i    = 1;
+			$path = '';
+			while ($i < count($dirs)) {
+				$path .= '/' . $dirs[$i];
+				if (file_exists($path. '/project_root.php')) {
+					break;
+				}
+				$i++;
+			}
+		}
+		$_SERVER["DOCUMENT_ROOT"] = $path;
+	}else{
+		$_SERVER["DOCUMENT_ROOT"]   = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
+	}
+	$_SERVER["DOCUMENT_ROOT"]   = realpath($_SERVER["DOCUMENT_ROOT"]);
+// try to detect if a project path is being used
+	if (!defined('PROJECT_PATH')) {
+		if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
+			define('PROJECT_PATH', '/fusionpbx');
+		} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
+			define('PROJECT_PATH', '');
+		} else {
+			$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
+			$i    = 1;
+			$path = $_SERVER["DOCUMENT_ROOT"];
+			while ($i < count($dirs)) {
+				$path .= '/' . $dirs[$i];
+				if (file_exists($path. '/project_root.php')) {
+					break;
+				}
+				$i++;
+			}
+			if(!file_exists($path. '/project_root.php')){
+				die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
+			}
+			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
+			define('PROJECT_PATH', $project_path);
+		}
+		$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
+		set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
+	}
+
+?>