/**
 * Display common message for item not found
 *
 * @return Nothing
**/
function displayNotFoundError()
{
    global $LANG, $CFG_GLPI, $HEADER_LOADED;
    if (!$HEADER_LOADED) {
        if (!isset($_SESSION["glpiactiveprofile"]["interface"])) {
            nullHeader($LANG['login'][5]);
        } else {
            if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
                commonHeader($LANG['login'][5]);
            } else {
                if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
                    helpHeader($LANG['login'][5]);
                }
            }
        }
    }
    echo "<div class='center'><br><br>";
    echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png' alt='warning'><br><br>";
    echo "<strong>" . $LANG['common'][54] . "</strong></div>";
    nullFooter();
    exit;
}
Exemple #2
0
    $_POST['login_password'] = unclean_cross_side_scripting_deep($_POST['login_password']);
} else {
    $_POST['login_password'] = '';
}
// Redirect management
$REDIRECT = "";
if (isset($_POST['redirect']) && strlen($_POST['redirect']) > 0) {
    $REDIRECT = "?redirect=" . $_POST['redirect'];
} else {
    if (isset($_GET['redirect']) && strlen($_GET['redirect']) > 0) {
        $REDIRECT = "?redirect=" . $_GET['redirect'];
    }
}
$auth = new Auth();
// now we can continue with the process...
if ($auth->Login($_POST['login_name'], $_POST['login_password'], isset($_REQUEST["noAUTO"]) ? $_REQUEST["noAUTO"] : false)) {
    // Redirect to Command Central if not post-only
    if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
        glpi_header($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php{$REDIRECT}");
    } else {
        glpi_header($CFG_GLPI['root_doc'] . "/front/central.php{$REDIRECT}");
    }
} else {
    // we have done at least a good login? No, we exit.
    nullHeader("Login", $CFG_GLPI["root_doc"] . '/index.php');
    echo '<div class="center b">' . $auth->getErr() . '<br><br>';
    // Logout whit noAUto to manage auto_login with errors
    echo '<a href="' . $CFG_GLPI["root_doc"] . '/logout.php?noAUTO=1' . str_replace("?", "&", $REDIRECT) . '">' . $LANG['login'][1] . '</a></div>';
    nullFooter();
    exit;
}
/**
 * Simple Error message page
 *
 * @param $message string displayed before dying
 * @param $minimal set to true do not display app menu
 *
 * @return nothing as function kill script
 **/
function displayErrorAndDie($message, $minimal = false)
{
    global $LANG, $CFG_GLPI, $HEADER_LOADED;
    if (!$HEADER_LOADED) {
        if ($minimal || !isset($_SESSION["glpiactiveprofile"]["interface"])) {
            nullHeader($LANG['login'][5], '');
        } else {
            if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
                commonHeader($LANG['login'][5], '');
            } else {
                if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
                    helpHeader($LANG['login'][5], '');
                }
            }
        }
    }
    echo "<div class='center'><br><br>";
    echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png' alt='warning'><br><br>";
    echo "<strong>{$message}</strong></div>";
    nullFooter();
    exit;
}
 /**
  *  Display a common mysql connection error
  **/
 static function displayMySQLError()
 {
     nullHeader("Mysql Error", '');
     if (!isCommandLine()) {
         echo "<div class='center'><p><strong>\n                A link to the Mysql server could not be established. Please check your configuration.\n                </strong></p><p><strong>\n                Le serveur Mysql est inaccessible. V&eacute;rifiez votre configuration</strong></p>\n               </div>";
     } else {
         echo "A link to the Mysql server could not be established. Please check your configuration.\n";
         echo "Le serveur Mysql est inaccessible. V&eacute;rifiez votre configuration\n";
     }
     nullFooter();
     die;
 }