/**
 * Handles error messages
 *
 * @param int $type The error code
 * @param string $message A string describing the error
 * @param string $file The filename in which the error occurred
 * @param int $line The line number on which the error occurred
 * @author Jason Warner <*****@*****.**>
 * @since Beta 2.0
 * @return void
 **/
function error($type, $message, $file = null, $line = 0)
{
    global $set;
    // Get the settings!
    if (isset($_GET['debug']) || function_exists('error_fatal') || !(error_reporting() & $type)) {
        return;
    }
    include $set['include_path'] . '/lib/error.php';
    switch ($type) {
        // Triggered Quicksilver Forums errors
        case QUICKSILVER_ERROR:
            exit(error_warning($message, $file, $line));
            break;
            // Triggered Quicksilver Forums notices and alerts
        // Triggered Quicksilver Forums notices and alerts
        case QUICKSILVER_NOTICE:
            exit(error_notice($message));
            break;
            // Database errors
        // Database errors
        case QUICKSILVER_QUERY_ERROR:
            exit(error_fatal($type, $message, $file, $line));
            break;
            // PHP errors
        // PHP errors
        default:
            exit(error_fatal($type, $message, $file, $line));
            break;
    }
}
Esempio n. 2
0
/**
 * Handles error messages
 *
 * @param int $type The error code
 * @param string $message A string describing the error
 * @param string $file The filename in which the error occurred
 * @param int $line The line number on which the error occurred
 * @author Jason Warner <*****@*****.**>
 * @since Beta 2.0
 * @return void
 **/
function error($type, $message, $file = null, $line = 0)
{
    if (isset($_GET['debug']) || function_exists('error_fatal') || !(error_reporting() & $type)) {
        return;
    }
    $include = './lib/error.php';
    if (!file_exists($include)) {
        $include = '.' . $include;
        // Admin Center errors
    }
    include $include;
    switch ($type) {
        // Triggered Quicksilver Forums errors
        case QUICKSILVER_ERROR:
            exit(error_warning($message, $file, $line));
            break;
            // Triggered Quicksilver Forums notices and alerts
        // Triggered Quicksilver Forums notices and alerts
        case QUICKSILVER_NOTICE:
            exit(error_notice($message));
            break;
            // Database errors
        // Database errors
        case QUICKSILVER_QUERY_ERROR:
            exit(error_fatal($type, $message, $file, $line));
            break;
            // PHP errors
        // PHP errors
        default:
            exit(error_fatal($type, $message, $file, $line));
            break;
    }
}