Beispiel #1
0
/**
 * phpLDAPadmin's custom error handling function. When a PHP error occurs,
 * PHP will call this function rather than printing the typical PHP error string.
 * This provides phpLDAPadmin the ability to format an error message more "pretty"
 * and provide a link for users to submit a bug report. This function is not to
 * be called by users. It is exclusively for the use of PHP internally. If this
 * function is called by PHP from within a context where error handling has been
 * disabled (ie, from within a function called with "@" prepended), then this
 * function does nothing.
 *
 * @param int $errno The PHP error number that occurred (ie, E_ERROR, E_WARNING, E_PARSE, etc).
 * @param string $errstr The PHP error string provided (ie, "Warning index "foo" is undefined)
 * @param string $file The file in which the PHP error ocurred.
 * @param int $lineno The line number on which the PHP error ocurred
 *
 * @see set_error_handler
 */
function pla_error_handler($errno, $errstr, $file, $lineno)
{
    if (DEBUG_ENABLED) {
        debug_log('pla_error_handler(): Entered with (%s,%s,%s,%s)', 1, $errno, $errstr, $file, $lineno);
    }
    // error_reporting will be 0 if the error context occurred
    // within a function call with '@' preprended (ie, @ldap_bind() );
    // So, don't report errors if the caller has specifically
    // disabled them with '@'
    if (0 == ini_get('error_reporting') || 0 == error_reporting()) {
        return;
    }
    $file = basename($file);
    $caller = basename($_SERVER['PHP_SELF']);
    $errtype = "";
    switch ($errno) {
        case E_STRICT:
            $errtype = "E_STRICT";
            break;
        case E_ERROR:
            $errtype = "E_ERROR";
            break;
        case E_WARNING:
            $errtype = "E_WARNING";
            break;
        case E_PARSE:
            $errtype = "E_PARSE";
            break;
        case E_NOTICE:
            $errtype = "E_NOTICE";
            break;
        case E_CORE_ERROR:
            $errtype = "E_CORE_ERROR";
            break;
        case E_CORE_WARNING:
            $errtype = "E_CORE_WARNING";
            break;
        case E_COMPILE_ERROR:
            $errtype = "E_COMPILE_ERROR";
            break;
        case E_COMPILE_WARNING:
            $errtype = "E_COMPILE_WARNING";
            break;
        case E_USER_ERROR:
            $errtype = "E_USER_ERROR";
            break;
        case E_USER_WARNING:
            $errtype = "E_USER_WARNING";
            break;
        case E_USER_NOTICE:
            $errtype = "E_USER_NOTICE";
            break;
        case E_ALL:
            $errtype = "E_ALL";
            break;
        default:
            $errtype = _('Unrecognized error number: ') . $errno;
    }
    $errstr = preg_replace("/\\s+/", " ", $errstr);
    if ($errno == E_NOTICE) {
        echo sprintf(_('<center><table class=\'notice\'><tr><td colspan=\'2\'><center><img src=\'images/warning.png\' height=\'12\' width=\'13\' />
             <b>You found a non-fatal phpLDAPadmin bug!</b></td></tr><tr><td>Error:</td><td><b>%s</b> (<b>%s</b>)</td></tr><tr><td>File:</td>
             <td><b>%s</b> line <b>%s</b>, caller <b>%s</b></td></tr><tr><td>Versions:</td><td>PLA: <b>%s</b>, PHP: <b>%s</b>, SAPI: <b>%s</b>
             </td></tr><tr><td>Web server:</td><td><b>%s</b></td></tr>
	<tr><td colspan=\'2\'><center><a target=\'new\' href=\'%s\'>Please check and see if this bug has been reported here</a>.</center></td></tr>
	<tr><td colspan=\'2\'><center><a target=\'new\' href=\'%s\'>If it hasnt been reported, you may report this bug by clicking here</a>.</center></td></tr>
	</table></center><br />'), $errstr, $errtype, $file, $lineno, $caller, pla_version(), phpversion(), php_sapi_name(), $_SERVER['SERVER_SOFTWARE'], get_href('search_bug', "&summary_keyword=" . htmlspecialchars($errstr)), get_href('add_bug'));
        return;
    }
    $server = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'undefined';
    $phpself = isset($_SERVER['PHP_SELF']) ? basename($_SERVER['PHP_SELF']) : 'undefined';
    pla_error(sprintf(_('Congratulations! You found a bug in phpLDAPadmin.<br /><br />
	     <table class=\'bug\'>
	     <tr><td>Error:</td><td><b>%s</b></td></tr>
	     <tr><td>Level:</td><td><b>%s</b></td></tr>
	     <tr><td>File:</td><td><b>%s</b></td></tr>
	     <tr><td>Line:</td><td><b>%s</b></td></tr>
		 <tr><td>Caller:</td><td><b>%s</b></td></tr>
	     <tr><td>PLA Version:</td><td><b>%s</b></td></tr>
	     <tr><td>PHP Version:</td><td><b>%s</b></td></tr>
	     <tr><td>PHP SAPI:</td><td><b>%s</b></td></tr>
	     <tr><td>Web server:</td><td><b>%s</b></td></tr>
	     </table>
	     <br />
	     Please report this bug by clicking below!'), $errstr, $errtype, $file, $lineno, $phpself, pla_version(), phpversion(), php_sapi_name(), $server));
}
Beispiel #2
0
    die;
} elseif (!is_readable($config_file)) {
    pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions are too strict.', $config_file));
}
if (!check_config()) {
    exit;
}
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"' . "\n";
echo '  "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">' . "\n";
echo "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="no-NO">';
if ($pagetitle = $config->GetValue('appearance', 'page_title')) {
    printf('<head><title>phpLDAPadmin (%s) - %s</title></head>', pla_version(), $pagetitle);
} else {
    printf('<head><title>phpLDAPadmin - %s</title></head>', pla_version());
}
printf('<frameset cols="%s,*">', $config->GetValue('appearance', 'tree_width'));
echo '<frame src="tree.php" name="left_frame" id="left_frame" />';
echo '<frame src="welcome.php" name="right_frame" id="right_frame" />';
echo '</frameset>';
echo '</html>';
/*
 * Makes sure that the config file is properly setup and
 * that your install of PHP can handle LDAP stuff.
 */
function check_config()
{
    global $config_file, $config;
    /* Check for syntax errors in config.php
       As of php 4.3.5, this NO longer catches fatal errors :( */
<?php 
include 'header.php';
?>

<body>

<?php 
$bug_href = get_href('add_bug');
$open_bugs_href = get_href('open_bugs');
$feature_href = get_href('add_rfe');
$open_features_href = get_href('open_rfes');
?>

<h3 class="subtitle" style="margin:0px">phpLDAPadmin - <?php 
echo pla_version();
?>
</h3>
<table class="edit_dn_menu">
<tr>
	<td><img src="images/light.png" /></td>
	<td><nobr><a href="<?php 
echo $feature_href;
?>
" target="new"><?php 
echo $lang['request_new_feature'];
?>
</a>
		(<a href="<?php 
echo $open_features_href;
?>
Beispiel #4
0
		parent.right_frame.location.href = 'timeout.php?server_id=<?php 
    echo $rightframe_server_id;
    ?>
';
		//-->
		</script>
<?php 
}
?>

<!-- # PHP layers menu. -->
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layersmenu-browser_detection.js"></script>
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layerstreemenu-cookies.js"></script>

<?php 
printf('<h3 class="subtitle" style="margin:0px">phpLDAPadmin - %s</h3>', pla_version());
echo "\n\n";
echo '<!-- Links at the top of the tree viewer -->';
echo '<table class="edit_dn_menu" width=100%><tr>';
printf('<td><img src="images/home.png" alt="%s" /></td>', _('Home'));
printf('<td width=50%%><nobr><a href="welcome.php" target="right_frame">%s</a></nobr></td>', _('Home'));
printf('<td><img src="images/trash.png" alt="%s" /></td>', _('Purge caches'));
printf('<td width=50%%><nobr><a href="purge_cache.php" target="right_frame" title="%s">%s</a></nobr></td>', _('Purge all cached data in phpLDAPadmin, including server schemas.'), _('Purge caches'));
echo '</tr><tr>';
if (!$config->GetValue('appearance', 'hide_configuration_management')) {
    printf('<td><img src="images/light.png" alt="%s" /></td>', _('light'));
    printf('<td width=50%%><nobr><a href="%s" target="new">%s</a></nobr></td>', get_href('add_rfe'), _('Request feature'));
    printf('<td><img src="images/bug.png" alt="%s" /></td>', _('bug'));
    printf('<td width=50%%><nobr><a href="%s" target="new">%s</a></nobr></td>', get_href('add_bug'), _('Report a bug'));
    echo '</tr><tr>';
    printf('<td><img src="images/smile.png" alt="%s" /></td>', _('Donate'));