Exemplo n.º 1
0
function errorHandler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL)
{
    global $user;
    if (!ONLINEDEBUG || !checkUserHasPerm('View Debug Information')) {
        cleanSemaphore();
        dbDisconnect();
        printHTMLFooter();
        exit;
    }
    print "Error encountered<br>\n";
    switch ($errno) {
        case E_USER_ERROR:
            echo "<b>FATAL</b> [{$errno}] {$errstr}<br />\n";
            echo "  Fatal error in line {$errline} of file {$errfile}";
            echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
            echo "Aborting...<br />\n";
            cleanSemaphore();
            dbDisconnect();
            exit(1);
            break;
        case E_USER_WARNING:
            echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n";
            break;
        case E_USER_NOTICE:
            echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n";
            break;
        default:
            echo "Unkown error type: [{$errno}] {$errstr}<br />\n";
            break;
    }
    if (!empty($errfile) && !empty($errline)) {
        print "Error at {$errline} in {$errfile}<br>\n";
    }
    if (!empty($errcontext)) {
        print "<pre>\n";
        print_r($errcontext);
        print "</pre>\n";
    }
    print "<br><br><br>\n";
    print "<pre>\n";
    print getBacktraceString();
    print "</pre>\n";
    cleanSemaphore();
    dbDisconnect();
    printHTMLFooter();
    exit;
}
Exemplo n.º 2
0
function errorHandler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL)
{
    global $user;
    if ($user["adminlevel"] != "developer") {
        dbDisconnect();
        printHTMLFooter();
        semUnlock();
        exit;
    }
    print "Error encountered<br>\n";
    switch ($errno) {
        case E_USER_ERROR:
            echo "<b>FATAL</b> [{$errno}] {$errstr}<br />\n";
            echo "  Fatal error in line {$errline} of file {$errfile}";
            echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
            echo "Aborting...<br />\n";
            semUnlock();
            exit(1);
            break;
        case E_USER_WARNING:
            echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n";
            break;
        case E_USER_NOTICE:
            echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n";
            break;
        default:
            echo "Unkown error type: [{$errno}] {$errstr}<br />\n";
            break;
    }
    if (!empty($errfile) && !empty($errline)) {
        print "Error at {$errline} in {$errfile}<br>\n";
    }
    if (!empty($errcontext)) {
        print "<pre>\n";
        print_r($errcontext);
        print "</pre>\n";
    }
    print "<br><br><br>\n";
    print "<pre>\n";
    print getBacktraceString();
    print "</pre>\n";
    dbDisconnect();
    printHTMLFooter();
    semUnlock();
    exit;
}
Exemplo n.º 3
0
function findAllFiles($the_dir, $the_array, $include_dirs = false, $ext = '', $exclude_dir = '')
{
    // jchi  #24296
    if (!empty($exclude_dir)) {
        $exclude_dir = is_array($exclude_dir) ? $exclude_dir : array($exclude_dir);
        foreach ($exclude_dir as $ex_dir) {
            if ($the_dir == $ex_dir) {
                return $the_array;
            }
        }
    }
    $the_dir = rtrim($the_dir, "/\\");
    //end
    if (!is_dir($the_dir)) {
        return $the_array;
    }
    $d = dir($the_dir);
    if (is_null($d)) {
        $backtrace = getBacktraceString();
        $emsg = 'wrong parameter for dir() function: ' . $the_dir . "\n" . $backtrace;
        $GLOBALS['log']->fatal($emsg);
        return $the_array;
    }
    if ($d === false) {
        $backtrace = getBacktraceString();
        $emsg = 'dir() function return with another error: ' . $the_dir . "\n" . $backtrace;
        $GLOBALS['log']->fatal($emsg);
        return $the_array;
    }
    while (false !== ($f = $d->read())) {
        if ($f == "." || $f == "..") {
            continue;
        }
        if (is_dir("{$the_dir}/{$f}")) {
            // jchi  #24296
            if (!empty($exclude_dir)) {
                //loop through array to compare directories..
                foreach ($exclude_dir as $ex_dir) {
                    if ("{$the_dir}/{$f}" == $ex_dir) {
                        continue 2;
                    }
                }
            }
            //end
            if ($include_dirs) {
                $the_array[] = clean_path("{$the_dir}/{$f}");
            }
            $the_array = findAllFiles("{$the_dir}/{$f}", $the_array, $include_dirs, $ext);
        } else {
            if (empty($ext) || preg_match('/' . $ext . '$/i', $f)) {
                $the_array[] = "{$the_dir}/{$f}";
            }
        }
    }
    rsort($the_array);
    return $the_array;
}
Exemplo n.º 4
0
function xmlRPCabort($errcode, $query = '')
{
    global $mysql_link_vcl, $mysql_link_acct, $ERRORS, $user, $mode;
    global $XMLRPCERRORS;
    if (ONLINEDEBUG && $user["adminlevel"] == "developer") {
        $msg = '';
        if ($errcode >= 100 && $errcode < 400) {
            $msg .= mysql_error($mysql_link_vcl) . " {$query} ";
        }
        $msg .= $ERRORS["{$errcode}"];
        $XMLRPCERRORS[100] = $msg;
        $faultcode = 100;
    } else {
        $message = "";
        if ($errcode >= 100 && $errcode < 400) {
            $message .= mysql_error($mysql_link_vcl) . "\n";
            $message .= mysql_error($mysql_link_acct) . "\n";
            $message .= $query . "\n";
        }
        $message .= "ERROR({$errcode}): " . $ERRORS["{$errcode}"] . "\n";
        $message .= "Logged in user was " . $user["unityid"] . "\n";
        $message .= "Mode was {$mode}\n\n";
        if ($errcode == 20) {
            $urlArray = explode('?', $_SERVER["HTTP_REFERER"]);
            $message .= "HTTP_REFERER URL - " . $urlArray[0] . "\n";
            $message .= "correct URL - " . BASEURL . SCRIPT . "\n";
        }
        $message .= getBacktraceString(FALSE);
        $mailParams = "-f" . ENVELOPESENDER;
        mail(ERROREMAIL, "Error with VCL XMLRPC call", $message, '', $mailParams);
        $faultcode = 1;
    }
    printXMLRPCerror($faultcode);
    dbDisconnect();
    semUnlock();
    exit;
}