Html::displayErrorAndDie PHP Method

displayErrorAndDie() static public method

Simple Error message page
static public displayErrorAndDie ( $message, $minimal = false ) : nothing
$message string displayed before dying
$minimal set to true do not display app menu (false by default)
return nothing as function kill script
    static function displayErrorAndDie($message, $minimal = false)
    {
        global $CFG_GLPI, $HEADER_LOADED;
        if (!$HEADER_LOADED) {
            if ($minimal || !isset($_SESSION["glpiactiveprofile"]["interface"])) {
                self::nullHeader(__('Access denied'), '');
            } else {
                if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
                    self::header(__('Access denied'), '');
                } else {
                    if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
                        self::helpHeader(__('Access denied'), '');
                    }
                }
            }
        }
        echo "<div class='center'><br><br>";
        echo Html::image($CFG_GLPI["root_doc"] . "/pics/warning.png", array('alt' => __('Warning')));
        echo "<br><br><span class='b'>{$message}</span></div>";
        self::nullFooter();
        exit;
    }

Usage Example

示例#1
0
/**
 * Obsolete function provided to detect compatibility issue
 *
 * @since version 0.84
**/
function handleObsoleteCall($func)
{
    $name = NOT_AVAILABLE;
    foreach (debug_backtrace() as $row) {
        if (isset($row['function']) && $row['function'] == $func && isset($row['file']) && preg_match(':(/|\\\\)plugins(/|\\\\)(.*)(/|\\\\):', $row['file'], $reg)) {
            $name = $reg[3];
            break;
        }
    }
    echo "</table>";
    Html::displayErrorAndDie(sprintf(__('The plugin %s is incompatible with this version of GLPI'), $name) . "<br><br>" . __('Delete or update it otherwise GLPI will not work correctly.'));
}
All Usage Examples Of Html::displayErrorAndDie
Html