Source for file PHP_Debug_ShowSource.php
Documentation is available at PHP_Debug_ShowSource.php
* This an exemple of showsource file.
* It uses the Pear package TEXT_Highlighter
* /!\ Don't forget to securise this script /!\
* - By allowed path (as the isAllowedPath() function below)
* @since V2.0.0 - 26 apr 2006
* @version CVS: $Id: PHP_Debug_ShowSource.php,v 1.2 2008/09/24 12:34:44 c0il Exp $
// View source configuration (to modify with your settings)
$view_source_options = array (
'PEAR_ROOT' => 'W:/var/www/php/PEAR',
'E:\Works\Projets-DEV\phpdebug\\',
'/var/www-protected/php-debug.com/www/',
// Files that are allowed to be viewed
$pathPattern = '/^{$path}(.*)(.php)$/';
// Additional include path for Pear (to adapt to your configuration )
//set_include_path($options['PEAR_ROOT'] . PATH_SEPARATOR. get_include_path());
//Include Debug_Renderer_HTML_Table_Config to get the configuration
require_once 'PHP/Debug.php';
require_once 'PHP/Debug/Renderer/HTML/TableConfig.php';
//Include the class definition of highlighter
require_once 'Text/Highlighter.php';
require_once 'Text/Highlighter/Renderer/Html.php';
global $view_source_options, $pathPattern;
foreach ($view_source_options['ALLOWED_PATH'] as $path) {
// Add your ip restriction here
// Transform path for regex
// Build the array options for the HTML renderer to get the nice file numbering
'numbers' => $options['HTML_TABLE_view_source_numbers'],
'tabsize' => $options['HTML_TABLE_view_source_tabsize'],
// Finish parser object creation
$renderer = new Text_Highlighter_Renderer_Html ($rendOptions);
$phpHighlighter = Text_Highlighter ::factory ('PHP');
$phpHighlighter->setRenderer ($renderer);
// Now start output, header
'<title>PEAR::PHP_Debug</title>',
'<title>PEAR::PHP_Debug::View_Source::'. $_GET['file']. '</title>',
$options['HTML_TABLE_simple_header']);
<link rel="stylesheet" type="text/css" media="screen" href="'. $view_source_options['CSS_ROOT'] . '/view_source.css" />
<span class="hl-title">'.
echo '<h2>File does not exists</h2>';
echo '<h1>Sorry, your are not allowed to access this path</h1>';
echo $options['HTML_TABLE_simple_footer'];
Documentation generated on Mon, 11 Mar 2019 15:28:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|