Beispiel #1
0
/**
 * prints some debug info
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function html_debug()
{
    global $conf;
    global $lang;
    /** @var DokuWiki_Auth_Plugin $auth */
    global $auth;
    global $INFO;
    //remove sensitive data
    $cnf = $conf;
    debug_guard($cnf);
    $nfo = $INFO;
    debug_guard($nfo);
    $ses = $_SESSION;
    debug_guard($ses);
    print '<html><body>';
    print '<p>When reporting bugs please send all the following ';
    print 'output as a mail to andi@splitbrain.org ';
    print 'The best way to do this is to save this page in your browser</p>';
    print '<b>$INFO:</b><pre>';
    print_r($nfo);
    print '</pre>';
    print '<b>$_SERVER:</b><pre>';
    print_r($_SERVER);
    print '</pre>';
    print '<b>$conf:</b><pre>';
    print_r($cnf);
    print '</pre>';
    print '<b>DOKU_BASE:</b><pre>';
    print DOKU_BASE;
    print '</pre>';
    print '<b>abs DOKU_BASE:</b><pre>';
    print DOKU_URL;
    print '</pre>';
    print '<b>rel DOKU_BASE:</b><pre>';
    print dirname($_SERVER['PHP_SELF']) . '/';
    print '</pre>';
    print '<b>PHP Version:</b><pre>';
    print phpversion();
    print '</pre>';
    print '<b>locale:</b><pre>';
    print setlocale(LC_ALL, 0);
    print '</pre>';
    print '<b>encoding:</b><pre>';
    print $lang['encoding'];
    print '</pre>';
    if ($auth) {
        print '<b>Auth backend capabilities:</b><pre>';
        foreach ($auth->getCapabilities() as $cando) {
            print '   ' . str_pad($cando, 16) . ' => ' . (int) $auth->canDo($cando) . NL;
        }
        print '</pre>';
    }
    print '<b>$_SESSION:</b><pre>';
    print_r($ses);
    print '</pre>';
    print '<b>Environment:</b><pre>';
    print_r($_ENV);
    print '</pre>';
    print '<b>PHP settings:</b><pre>';
    $inis = ini_get_all();
    print_r($inis);
    print '</pre>';
    if (function_exists('apache_get_version')) {
        $apache = array();
        $apache['version'] = apache_get_version();
        if (function_exists('apache_get_modules')) {
            $apache['modules'] = apache_get_modules();
        }
        print '<b>Apache</b><pre>';
        print_r($apache);
        print '</pre>';
    }
    print '</body></html>';
}
Beispiel #2
0
/**
 * prints some debug info
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function html_debug()
{
    global $conf;
    global $lang;
    global $auth;
    global $INFO;
    //remove sensitive data
    $cnf = $conf;
    debug_guard($cnf);
    $nfo = $INFO;
    debug_guard($nfo);
    $ses = $_SESSION;
    debug_guard($ses);
    print '<html><body>';
    print '<p>When reporting bugs please send all the following ';
    print 'output as a mail to andi@splitbrain.org ';
    print 'The best way to do this is to save this page in your browser</p>';
    print '<b>$INFO:</b><pre>';
    print_r($nfo);
    print '</pre>';
    print '<b>$_SERVER:</b><pre>';
    print_r($_SERVER);
    print '</pre>';
    print '<b>$conf:</b><pre>';
    print_r($cnf);
    print '</pre>';
    print '<b>DOKU_BASE:</b><pre>';
    print DOKU_BASE;
    print '</pre>';
    print '<b>abs DOKU_BASE:</b><pre>';
    print DOKU_URL;
    print '</pre>';
    print '<b>rel DOKU_BASE:</b><pre>';
    print dirname($_SERVER['PHP_SELF']) . '/';
    print '</pre>';
    print '<b>PHP Version:</b><pre>';
    print phpversion();
    print '</pre>';
    print '<b>locale:</b><pre>';
    print setlocale(LC_ALL, 0);
    print '</pre>';
    print '<b>encoding:</b><pre>';
    print $lang['encoding'];
    print '</pre>';
    if ($auth) {
        print '<b>Auth backend capabilities:</b><pre>';
        print_r($auth->cando);
        print '</pre>';
    }
    print '<b>$_SESSION:</b><pre>';
    print_r($ses);
    print '</pre>';
    print '<b>Environment:</b><pre>';
    print_r($_ENV);
    print '</pre>';
    print '<b>PHP settings:</b><pre>';
    $inis = ini_get_all();
    print_r($inis);
    print '</pre>';
    print '</body></html>';
}
Beispiel #3
0
/**
 * Remove all data from an array where the key seems to point to sensitive data
 *
 * This is used to remove passwords, mail addresses and similar data from the
 * debug output
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function debug_guard(&$data)
{
    foreach ($data as $key => $value) {
        if (preg_match('/(notify|pass|auth|secret|ftp|userinfo|token|buid|mail|proxy)/i', $key)) {
            $data[$key] = '***';
            continue;
        }
        if (is_array($value)) {
            debug_guard($data[$key]);
        }
    }
}