当前位置: 首页>>代码示例>>PHP>>正文


PHP lms_portal::is_instance方法代码示例

本文整理汇总了PHP中lms_portal::is_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_portal::is_instance方法的具体用法?PHP lms_portal::is_instance怎么用?PHP lms_portal::is_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lms_portal的用法示例。


在下文中一共展示了lms_portal::is_instance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_http_error

function send_http_error($pException, $pBacktrace = "", $silent = false)
{
    if ($pException->getCode() == E_USER_ACCESS_DENIED) {
        logging::write_log(LOG_403, date("d.m.Y H:i", time()) . " USER: " . $_ENV["USER"] . " " . "HTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI']);
        header('Location: ' . PATH_URL . "403/");
        exit;
    }
    if ($pException->getCode() == E_USER_AUTHORIZATION) {
        try {
            while (ob_get_level() > 0) {
                ob_end_clean();
            }
        } catch (Exception $e) {
        }
        $protocoll = isset($_SERVER["HTTPS"]) ? "https://" : "http://";
        $url = $protocoll . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
        $request_url = str_ireplace(PATH_URL, "/", $url);
        $silent or header('Location: ' . URL_SIGNIN_REQUEST . substr($request_url, 1));
        exit;
    }
    if ($pException->getCode() == E_USER_DISCLAIMER) {
        try {
            while (ob_get_level() > 0) {
                ob_end_clean();
            }
        } catch (Exception $e) {
        }
        $protocoll = isset($_SERVER["HTTPS"]) ? "https://" : "http://";
        $url = $protocoll . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
        $request_url = str_ireplace(PATH_URL, "/", $url);
        $silent or header('Location: ' . PATH_URL . 'disclaimer_local.php?req=' . $request_url);
        exit;
    }
    if ($pException->getCode() == E_USER_CHANGE_PASSWORD) {
        try {
            while (ob_get_level() > 0) {
                ob_end_clean();
            }
        } catch (Exception $e) {
        }
        $silent or header('Location: ' . PATH_URL . 'usermanagement/user-password');
        //?req=' . $_SERVER[ 'REQUEST_URI' ] );
        exit;
    }
    if ($pException->getCode() != E_USER_RIGHTS) {
        $error_id = 'E' . strtoupper(uniqid('', FALSE));
        try {
            $user = 0;
            try {
                $user = lms_steam::get_current_user();
            } catch (Exception $x) {
            }
            $ustring = 'user is not a valid object (' . $_ENV["USER"] . ')';
            try {
                if (is_object($user) && $user instanceof steam_user) {
                    $ustring = $user->get_name();
                }
            } catch (Exception $e) {
                $ustring = '(id=' . $user->get_id() . ')';
            }
            if (lms_portal::is_instance() && is_object(lms_portal::get_instance()->get_user())) {
                $password = lms_portal::get_instance()->get_user()->get_password();
            } else {
                $password = "1234567890NICHTGESETZT1234567890";
            }
            $_SESSION["ERROR_ID"] = $error_id;
            if ($pBacktrace != "") {
                $backtrace = $pBacktrace;
            } else {
                $backtrace = $pException->getTraceAsString();
            }
            $backtrace = str_replace($password, "*****", $backtrace . "\n==============================");
            $_SESSION["ERROR_TEXT"] = 'ID: ' . $error_id . "\tCode: " . $pException->getCode() . "\nDate: " . date("d.m.Y H:i", time()) . "\nUser: " . $ustring . "\nHTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI'] . "\nBrowser: " . $_SERVER['HTTP_USER_AGENT'] . "\nMessage: " . $pException->getMessage() . "\nServer: " . PATH_SERVER . "\nPlatform: " . PLATFORM_ID . "\nBacktrace:\n" . $backtrace;
            $_SESSION["ERROR_REFERER"] = $_SERVER["REQUEST_URI"];
            if (defined("SEND_ERROR_MAIL") && SEND_ERROR_MAIL) {
                $subject = PLATFORM_NAME . " Error " . $_SESSION["ERROR_ID"];
                $header = "MIME-Version: 1.0\r\n" . "Content-type: text/plain; charset=utf-8\r\n" . "From: " . ERROR_MAIL_SENDER . "\r\n" . "X-Mailer: PHP/" . phpversion();
                mail(ERROR_MAIL_RECEIVER, '=?UTF-8?B?' . base64_encode($subject) . '?=', $_SESSION["ERROR_TEXT"], $header);
                logging::write_log(LOG_ERROR, "Error mail sent.");
            }
            logging::write_log(LOG_ERROR, $_SESSION["ERROR_TEXT"]);
        } catch (Exception $e) {
            echo "<pre>" . $e->getTraceAsString() . "</pre>";
            error_log($e->getTraceAsString());
            print 'Cannot write Log-File! ';
            print 'Please check if ' . LOG_ERROR . ' is writable. <br>';
            print 'ErrorMessage:<br><pre>';
            try {
                $password = lms_portal::get_instance()->get_user()->get_password();
            } catch (Exception $e) {
                $password = "1234567890NICHTGESETZT1234567890";
            }
            print 'ID: ' . $error_id . "\tCode: " . $pException->getCode() . "\nDate: " . date("d.m.Y H:i", time()) . "\nUser: " . $ustring . "\nHTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI'] . "\nBrowser: " . $_SERVER['HTTP_USER_AGENT'] . "\nMessage: " . $pException->getMessage() . "\nServer: " . PATH_SERVER . "\nPlatform: " . PLATFORM_ID . "\nBacktrace:\n" . str_replace($password, "*****", $pException->getTraceAsString() . "\n==============================");
            exit;
        }
    }
    try {
        while (ob_get_level() > 0) {
            ob_end_clean();
        }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:exception_handler.inc.php


注:本文中的lms_portal::is_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。