Skip to content
Snippets Groups Projects
Commit fc91e553 authored by Raphaël Doursenaud's avatar Raphaël Doursenaud
Browse files

Setup FirePHP like ChromePHP

parent 1396ed8f
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ AdoDb-Date 0.33 Modified BSD License Yes ...@@ -16,6 +16,7 @@ AdoDb-Date 0.33 Modified BSD License Yes
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation EvalMath 1.0 BSD Yes Safe math expressions evaluation
FirePHPCore 0.4.0 MIT License Yes Send logs to Firefox Firebug console
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
Mobiledetect 2.8.3 MIT License Yes Detect mobile devices browsers Mobiledetect 2.8.3 MIT License Yes Detect mobile devices browsers
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
"phpoffice/phpexcel": "1.8.0", "phpoffice/phpexcel": "1.8.0",
"restler/framework": "^3.0", "restler/framework": "^3.0",
"tecnick.com/tcpdf": "6.2.6", "tecnick.com/tcpdf": "6.2.6",
"raven/raven": "^0.12.0" "raven/raven": "^0.12.0",
"firephp/firephp-core": "^0.4.0"
}, },
"suggest": { "suggest": {
"ext-mysqlnd": "To use with MySQL or MariaDB", "ext-mysqlnd": "To use with MySQL or MariaDB",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "2ab34d0ff69b48500c20621330c1bfd7", "hash": "f441e6348ae7862942693cab10810418",
"packages": [ "packages": [
{ {
"name": "ccampbell/chromephp", "name": "ccampbell/chromephp",
...@@ -90,6 +90,42 @@ ...@@ -90,6 +90,42 @@
], ],
"time": "2014-02-26 15:34:37" "time": "2014-02-26 15:34:37"
}, },
{
"name": "firephp/firephp-core",
"version": "v0.4.0",
"source": {
"type": "git",
"url": "https://github.com/firephp/firephp-core.git",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firephp/firephp-core/zipball/fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"lib/FirePHPCore/FirePHP.class.php",
"lib/FirePHPCore/fb.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"homepage": "http://christophdorn.com"
}
],
"description": "Traditional FirePHPCore library for sending PHP variables to the browser.",
"homepage": "https://github.com/firephp/firephp-core",
"time": "2013-04-23 15:28:20"
},
{ {
"name": "mobiledetect/mobiledetectlib", "name": "mobiledetect/mobiledetectlib",
"version": "2.8.3", "version": "2.8.3",
......
<?php <?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
...@@ -7,7 +23,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; ...@@ -7,7 +23,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
*/ */
class mod_syslog_firephp extends LogHandler implements LogHandlerInterface class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
{ {
var $code = 'firephp'; public $code = 'firephp';
private static $firephp_include_path = '/includes/firephp/firephp-core/lib/';
private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php';
/** /**
* Return name of logger * Return name of logger
...@@ -38,7 +56,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface ...@@ -38,7 +56,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
{ {
global $langs; global $langs;
return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning','FirePHPCore/FirePHP.class.php'); return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path);
} }
/** /**
...@@ -48,14 +66,19 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface ...@@ -48,14 +66,19 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
*/ */
public function isActive() public function isActive()
{ {
global $conf;
try try
{ {
set_include_path('/usr/share/php/'); if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) {
$res = @include_once 'FirePHPCore/FirePHP.class.php'; $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path;
}
set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH);
$res = @include_once self::$firephp_class_path;
restore_include_path(); restore_include_path();
if ($res) if ($res) {
{
return 1; return 1;
} else {
return 0;
} }
} }
catch(Exception $e) catch(Exception $e)
...@@ -66,24 +89,25 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface ...@@ -66,24 +89,25 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
return -1; return -1;
} }
///** /**
// * Return array of configuration data * Return array of configuration data
// * *
// * @return array Return array of configuration data * @return array Return array of configuration data
// */ */
// public function configure() public function configure()
// { {
// global $langs; global $langs;
// return array( return array(
// array( array(
// 'name' => $langs->trans('IncludePath'), 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'),
// 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH',
// 'default' => '/usr/share/php', 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path,
// 'attr' => 'size="40"' 'attr' => 'size="60"',
// ) 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path
// ); )
// } );
}
/** /**
* Return if configuration is valid * Return if configuration is valid
...@@ -92,20 +116,15 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface ...@@ -92,20 +116,15 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {
global $langs; global $conf, $langs;
$errors = array(); $errors = array();
$oldinclude = get_include_path(); if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path))
set_include_path('/usr/share/php/');
if (!file_exists('FirePHPCore/FirePHP.class.php'))
{ {
$errors[] = $langs->trans("ErrorFailedToOpenFile", 'FirePhp.php'); $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path);
} }
set_include_path($oldinclude);
return $errors; return $errors;
} }
...@@ -129,8 +148,8 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface ...@@ -129,8 +148,8 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
// Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once() a constant from // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once() a constant from
// database or config file because we must be able to log data before database or config file read. // database or config file because we must be able to log data before database or config file read.
$oldinclude=get_include_path(); $oldinclude=get_include_path();
set_include_path('/usr/share/php/'); set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH);
include_once 'FirePHPCore/FirePHP.class.php'; include_once self::$firephp_class_path;
set_include_path($oldinclude); set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed ob_start(); // To be sure headers are not flushed until all page is completely processed
$firephp = FirePHP::getInstance(true); $firephp = FirePHP::getInstance(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment