Beispiel #1
0
if ($DB_ERROR == '') {
    $dir = dirname(__FILE__);
    require $dir . '/lang/lang.php';
    require $dir . '/include/themes.php';
    require $dir . '/include/lib/mail/email_message.php';
    require $dir . '/include/lib/mail/smtp_message.php';
    require $dir . '/include/lib/mail/smtp.php';
    require $dir . '/include/mail_manager.php';
    require $dir . '/include/accounting_functions.php';
    require $dir . '/include/currency_functions.php';
    require $dir . '/include/dynamic_forms.php';
    require_once $dir . '/include/plugin_manager.php';
    require $dir . '/include/invoice_functions.php';
    require $dir . '/include/functions.php';
    if (!get_magic_quotes_gpc()) {
        JB_unfck_gpc();
    }
} elseif (basename($_SERVER['PHP_SELF']) !== 'install.php') {
    $http_url = $_SERVER['PHP_SELF'];
    // eg /ojo/admin/edit_config.php
    $http_url = str_replace('admin/', '', $http_url);
    if (file_exists(dirname(__FILE__) . '/admin/install.php')) {
        $http_url = preg_replace('#/(/admin/)?[^/]+$#', '/admin/install.php', $http_url);
        JB_echo_install_info($http_url);
        die;
    } elseif (basename($_SERVER['PHP_SELF']) !== 'edit_config.php') {
        $http_url = preg_replace('#/(/admin/)?[^/]+$#', '/admin/edit_config.php', $http_url);
        echo_edit_config_info($http_url);
        die;
    }
}
Beispiel #2
0
function JB_echo_db_error($error)
{
    if (defined('JB_HIDE_MYSQL_ERRORS') && JB_HIDE_MYSQL_ERRORS) {
        return;
    }
    if (strpos($error, 'show columns from') !== false) {
        // this is a diagnostic query, should still continue on error.
        return;
    }
    $http_url = $_SERVER['PHP_SELF'];
    // eg /ojo/admin/edit_config.php
    $http_url = str_replace('admin/', '', $http_url);
    if (strpos($error, "doesn't exist") !== false) {
        // looks like the database was not installed
        if (file_exists(dirname(__FILE__) . '/admin/install.php')) {
            $http_url = preg_replace('#/(/admin/)?[^/]+$#', '/admin/install.php', $http_url);
            JB_echo_install_info($http_url, $error);
            die;
        } elseif (basename($_SERVER['PHP_SELF']) !== 'edit_config.php') {
            $http_url = preg_replace('#/(/admin/)?[^/]+$#', '/admin/edit_config.php', $http_url);
            echo_edit_config_info($http_url, $error);
            die;
        }
    } else {
        if (JB_SET_CUSTOM_ERROR == 'YES') {
            ob_start();
            $trace = debug_backtrace();
            var_dump($trace['1']);
            $trace = ob_get_contents();
            ob_end_clean();
            $req = var_export($_REQUEST, true);
            if (function_exists('jb_escape_html')) {
                jb_custom_error_handler('sql', jb_escape_html($error . "\n" . $trace . "\n" . $req), __FILE__, 0, $vars);
            } else {
                jb_custom_error_handler('sql', htmlentities($error . "\n" . $trace . "\n" . $req), __FILE__, 0, $vars);
            }
        } else {
            if (function_exists('jb_escape_html')) {
                echo jb_escape_html($error);
            } else {
                echo htmlentities($error);
            }
        }
    }
}