Exemple #1
0
    echo "\n<td><form method=\"get\" action=\"year.php\">";
    echo "<table border=\"0\">\n";
    echo "<tr><td>" . get_vocab("report_start") . get_vocab("deux_points") . "</td>";
    echo "<td>";
    echo genDateSelector("from_", "", $from_month, $from_year, "");
    echo "</td></tr>";
    echo "<tr><td>" . get_vocab("report_end") . get_vocab("deux_points");
    echo "</td><td>\n";
    echo genDateSelector("to_", "", $to_month, $to_year, "");
    echo "</td></tr>\n";
    echo "<tr><td>\n";
    echo "<input type=\"hidden\" name=\"area\" value=\"{$area}\" />\n";
    echo "<input type=\"submit\" name=\"valider\" value=\"" . $vocab["goto"] . "\" /></td><td> </td></tr>\n";
    echo "</table>\n";
    echo "</form></td>\n";
    echo '<td><a title="' . htmlspecialchars(get_vocab('back')) . '" href="' . page_accueil('no') . '">' . $vocab['back'] . '</a></td>';
    echo "</tr></table>\n";
}
$this_area_name = grr_sql_query1("SELECT area_name FROM " . TABLE_PREFIX . "_area WHERE id={$area}");
echo "<div class=\"titre_planning\">" . ucfirst($this_area_name) . " - " . get_vocab("all_areas") . " </div>\n";
//Used below: localized "all day" text but with non-breaking spaces:
$all_day = preg_replace("/ /", " ", get_vocab("all_day"));
//Get all meetings for this month in the room that we care about
//row[0] = Start time
//row[1] = End time
//row[2] = Entry ID
//row[3] = Entry name (brief description)
//row[4] = beneficiaire of the booking
//row[5] = Nom de la ressource
//row[6] = statut
//row[7] = Description complète
Exemple #2
0
            die;
        }
    } else {
        if (Settings::get("authentification_obli") == 1) {
            if ($cook["path"] != '') {
                if (grr_resumeSession()) {
                    header("Location: " . htmlspecialchars_decode(page_accueil()) . "");
                    die;
                } else {
                    if (Settings::get("Url_cacher_page_login") != "" && (!isset($sso_super_admin) || $sso_super_admin == false)) {
                        header("Location: " . Settings::get("Url_cacher_page_login"));
                        die;
                    } else {
                        header("Location: ./login.php");
                        die;
                    }
                }
            } else {
                if (Settings::get("Url_cacher_page_login") != "" && (!isset($sso_super_admin) || $sso_super_admin == false)) {
                    header("Location: " . Settings::get("Url_cacher_page_login"));
                    die;
                } else {
                    header("Location: ./login.php");
                    die;
                }
            }
        } else {
            header("Location: " . htmlspecialchars_decode(page_accueil()) . "");
        }
    }
}
Exemple #3
0
function print_header($day = '', $month = '', $year = '', $type_session = 'with_session')
{
    global $vocab, $search_str, $grrSettings, $clock_file, $desactive_VerifNomPrenomUser, $grr_script_name;
    global $use_prototype, $use_admin, $use_tooltip_js, $desactive_bandeau_sup, $id_site, $use_select2;
    if (!$desactive_VerifNomPrenomUser) {
        $desactive_VerifNomPrenomUser = '******';
    }
    // On vérifie que les noms et prénoms ne sont pas vides
    VerifNomPrenomUser($type_session);
    if ($type_session == "with_session") {
        echo begin_page(Settings::get("company"), "with_session");
    } else {
        echo begin_page(Settings::get("company"), "no_session");
    }
    // Si nous ne sommes pas dans un format imprimable
    if (!isset($_GET['pview']) || $_GET['pview'] != 1) {
        // If we dont know the right date then make it up
        if (!isset($day) || !isset($month) || !isset($year) || $day == '' || $month == '' || $year == '') {
            $date_now = time();
            if ($date_now < Settings::get("begin_bookings")) {
                $date_ = Settings::get("begin_bookings");
            } else {
                if ($date_now > Settings::get("end_bookings")) {
                    $date_ = Settings::get("end_bookings");
                } else {
                    $date_ = $date_now;
                }
            }
            $day = date("d", $date_);
            $month = date("m", $date_);
            $year = date("Y", $date_);
        }
        if (!isset($search_str)) {
            $search_str = get_vocab("search_for");
        }
        if (empty($search_str)) {
            $search_str = "";
        }
        if (!(isset($desactive_bandeau_sup) && $desactive_bandeau_sup == 1 && $type_session != 'with_session')) {
            if (@file_exists('./admin_access_area.php')) {
                $adm = 1;
                $racine = "../";
                $racineAd = "./";
            } else {
                $adm = 0;
                $racine = "./";
                $racineAd = "./admin/";
            }
            // Génération XML
            $generationXML = 1;
            if (Settings::get("export_xml_actif") == "Oui" && $adm == 0) {
                include "{$racine}/include/generationxml.php";
            }
            if (Settings::get("export_xml_plus_actif") == "Oui" && $adm == 0) {
                include "{$racine}/include/generationxmlplus.php";
            }
            // On fabrique une date valide pour la réservation si ce n'est pas le cas
            $date_ = mktime(0, 0, 0, $month, $day, $year);
            if ($date_ < Settings::get("begin_bookings")) {
                $date_ = Settings::get("begin_bookings");
            } else {
                if ($date_ > Settings::get("end_bookings")) {
                    $date_ = Settings::get("end_bookings");
                }
            }
            $day = date("d", $date_);
            $month = date("m", $date_);
            $year = date("Y", $date_);
            echo '<div id="toppanel">' . PHP_EOL;
            echo '<div id="panel">' . PHP_EOL;
            echo '<div class="content">' . PHP_EOL;
            echo '<table id="header">' . PHP_EOL;
            echo '<tr>' . PHP_EOL;
            //Logo
            $nom_picture = $racine . "images/" . Settings::get("logo");
            if (Settings::get("logo") != '' && @file_exists($nom_picture)) {
                echo '<td class="logo" height="100">' . PHP_EOL . '<a href="' . $racine . page_accueil('yes') . 'day=' . $day . '&amp;year=' . $year . '&amp;month=' . $month . '"><img src="' . $nom_picture . '" alt="logo"/></a>' . PHP_EOL . '</td>' . PHP_EOL;
            }
            //Accueil
            echo '<td class="accueil ">', PHP_EOL, '<h2>', PHP_EOL, '<a href="' . $racine . page_accueil('yes'), 'day=', $day, '&amp;year=', $year, '&amp;month=', $month, '">', get_vocab("welcome"), ' - <b>', Settings::get("company"), '</b></a>', PHP_EOL, '</h2>', PHP_EOL;
            //Mail réservartion
            echo Settings::get('message_accueil');
            $sql = "SELECT value FROM " . TABLE_PREFIX . "_setting WHERE name='mail_etat_destinataire'";
            $res = grr_sql_query1($sql);
            //Libère le résultat de la mémoire
            grr_sql_free($res);
            if ($res == 1) {
                if ($type_session == "no_session") {
                    echo '<td class="contactformulaire">', PHP_EOL, '<input class="btn btn-default" type="submit" rel="popup_name" value="Réserver" onClick="javascript:location.href=\'contactFormulaire.php?day=', $day, '&amp;month=', $month, '&amp;year=', $year, '\'" >', PHP_EOL, '</td>', PHP_EOL;
                }
            }
            // Administration div Sauvegarde
            if ($type_session == "with_session") {
                if (authGetUserLevel(getUserName(), -1, 'area') >= 4 || authGetUserLevel(getUserName(), -1, 'user') == 1) {
                    echo '<td class="administration">' . PHP_EOL;
                    echo "<br><a href='{$racineAd}admin_accueil.php?day={$day}&amp;month={$month}&amp;year={$year}'>" . get_vocab('admin') . "</a>" . PHP_EOL;
                    if (authGetUserLevel(getUserName(), -1, 'area') >= 6) {
                        echo '<br />' . PHP_EOL;
                        echo "<form action='{$racineAd}admin_save_mysql.php' method='get'><div>" . PHP_EOL;
                        echo '<input type="hidden" name="flag_connect" value="yes" />' . PHP_EOL;
                        echo '<input type="submit" class="btn btn-default" value="' . get_vocab("submit_backup") . '" /></div>' . PHP_EOL;
                        echo '</form>' . PHP_EOL;
                        how_many_connected();
                    }
                    echo '</td>' . PHP_EOL;
                }
            }
            if ($type_session != "with_session") {
                echo '<script>selection()</script>' . PHP_EOL;
            }
            echo '<td class="configuration" >' . PHP_EOL;
            if (@file_exists('js/' . $clock_file)) {
                echo '<div class="clock">' . PHP_EOL;
                echo '<div id="Date">' . PHP_EOL;
                echo '&nbsp;<span id="hours"></span>' . PHP_EOL;
                echo 'h' . PHP_EOL;
                echo '<span id="min"></span>' . PHP_EOL;
                echo '</div></div>' . PHP_EOL;
            }
            $_SESSION['chemin_retour'] = '';
            if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') {
                $parametres_url = htmlspecialchars($_SERVER['QUERY_STRING']) . "&amp;";
                $_SESSION['chemin_retour'] = traite_grr_url($grr_script_name) . "?" . $_SERVER['QUERY_STRING'];
                echo '<a onclick="charger();" href="' . traite_grr_url($grr_script_name) . '?' . $parametres_url . 'default_language=fr"><img src="' . $racine . 'img_grr/fr_dp.png" alt="France" title="france" width="20" height="13" class="image" /></a>' . PHP_EOL;
                echo '<a onclick="charger();" href="' . traite_grr_url($grr_script_name) . '?' . $parametres_url . 'default_language=de"><img src="' . $racine . 'img_grr/de_dp.png" alt="Deutch" title="deutch" width="20" height="13" class="image" /></a>' . PHP_EOL;
                echo '<a onclick="charger();" href="' . traite_grr_url($grr_script_name) . '?' . $parametres_url . 'default_language=en"><img src="' . $racine . 'img_grr/en_dp.png" alt="English" title="English" width="20" height="13" class="image" /></a>' . PHP_EOL;
                echo '<a onclick="charger();" href="' . traite_grr_url($grr_script_name) . '?' . $parametres_url . 'default_language=it"><img src="' . $racine . 'img_grr/it_dp.png" alt="Italiano" title="Italiano" width="20" height="13" class="image" /></a>' . PHP_EOL;
                echo '<a onclick="charger();" href="' . traite_grr_url($grr_script_name) . '?' . $parametres_url . 'default_language=es"><img src="' . $racine . 'img_grr/es_dp.png" alt="Spanish" title="Spanish" width="20" height="13" class="image" /></a>' . PHP_EOL;
            }
            if ($type_session == 'no_session') {
                if (Settings::get('sso_statut') == 'cas_visiteur' || Settings::get('sso_statut') == 'cas_utilisateur') {
                    echo '<br /> <a href="index.php?force_authentification=y">' . get_vocab("authentification") . '</a>' . PHP_EOL;
                    echo '<br /> <small><i><a href="login.php">' . get_vocab("connect_local") . '</a></i></small>' . PHP_EOL;
                } else {
                    echo '<br /> <a href="login.php">' . get_vocab("connect") . '</a>' . PHP_EOL;
                }
            } else {
                echo '<br /> <b>' . get_vocab("welcome_to") . htmlspecialchars($_SESSION['prenom']) . ' ' . htmlspecialchars($_SESSION['nom']) . '</b>' . PHP_EOL;
                echo '<br /> <a href="' . $racine . 'my_account.php?day=' . $day . '&amp;year=' . $year . '&amp;month=' . $month . '">' . get_vocab("manage_my_account") . '</a>' . PHP_EOL;
                if (verif_access_search(getUserName())) {
                    echo '<br/><a href="' . $racine . 'report.php">' . get_vocab("report") . '</a>' . PHP_EOL;
                }
                $disconnect_link = false;
                if (!(Settings::get("cacher_lien_deconnecter") == 'y' && isset($_SESSION['est_authentifie_sso']))) {
                    $disconnect_link = true;
                    if (Settings::get("authentification_obli") == 1) {
                        echo '<br /> <a href="' . $racine . 'logout.php?auto=0" >' . get_vocab('disconnect') . '</a>' . PHP_EOL;
                    } else {
                        echo '<br /> <a href="' . $racine . 'logout.php?auto=0&amp;redirect_page_accueil=yes" >' . get_vocab('disconnect') . '</a>' . PHP_EOL;
                    }
                }
                if (Settings::get("Url_portail_sso") != '' && isset($_SESSION['est_authentifie_sso'])) {
                    if ($disconnect_link) {
                        echo ' - ' . PHP_EOL;
                    } else {
                        echo '<br />' . PHP_EOL;
                    }
                    echo '<a href="' . Settings::get("Url_portail_sso") . '">' . get_vocab("Portail_accueil") . '</a>' . PHP_EOL;
                }
                if (Settings::get('sso_statut') == 'lasso_visiteur' || Settings::get('sso_statut') == 'lasso_utilisateur') {
                    echo '<br />';
                    if ($_SESSION['lasso_nameid'] == NULL) {
                        echo '<a href="lasso/federate.php">' . get_vocab('lasso_federate_this_account') . '</a>' . PHP_EOL;
                    } else {
                        echo '<a href="lasso/defederate.php">' . get_vocab('lasso_defederate_this_account') . '</a>' . PHP_EOL;
                    }
                }
            }
            echo '</td>' . PHP_EOL;
            echo '</tr>' . PHP_EOL;
            echo '</table>' . PHP_EOL;
            echo '</div>' . PHP_EOL;
            echo '</div>' . PHP_EOL;
            echo '<div class="tab">' . PHP_EOL;
            //	echo '<ul class="login">'.PHP_EOL;
            //echo '<li>'.PHP_EOL;
            echo '<a id="open" class="open" href="#">Menu <i>(ouvrir/fermer)</i></a>' . PHP_EOL;
            //	echo '</li>'.PHP_EOL;
            //	echo '</ul>'.PHP_EOL;
            echo '</div>' . PHP_EOL;
            echo '</div>' . PHP_EOL;
        }
    }
}
Exemple #4
0
/**
* Fonction qui affiche le header,
* @param string $day
* @param string $month
* @param string $year
* @param string $type_session
* @param bool $close si il est true, dans le template twig les div ouverts dans printHeader seront fermés à la fin du fichier, sinon ils restent ouvert et c'est soit menu_gauche, soit le
* script en cours qui doit les fermer.
*/
function print_header($day = '', $month = '', $year = '', $type_session = 'with_session', $close = true, $display = true, $admin = true)
{
    global $vocab, $search_str, $grrSettings, $clock_file, $desactive_VerifNomPrenomUser, $grr_script_name;
    global $use_prototype, $use_admin, $use_tooltip_js, $desactive_bandeau_sup, $id_site, $use_select2;
    /**
     * Intégration de twig :
     *  Todo ne pas faire un echo ici et récupérer l'array pour twig, pour pouvoir fusionner les deux templates header et printHeader
     *  Je laisse les infos dans l'ondre original du script, ça serait plus propre de les grouper, pour remplir
     *  l'array pour twig, mais ça serait plus compliqier de suivre les modifs du code, à prévoir en refacto plus tard
     *
     * var global twig
     */
    global $twig;
    $tplArray = [];
    $tplArray['close'] = $close;
    global $template;
    $tplArray['template'] = $template;
    if (!$desactive_VerifNomPrenomUser) {
        $desactive_VerifNomPrenomUser = '******';
    }
    // On vérifie que les noms et prénoms ne sont pas vides
    VerifNomPrenomUser($type_session);
    /* le header <head> de la page est toujours affiché */
    if ($type_session == 'with_session') {
        echo begin_page(Settings::get('company'), 'with_session');
    } else {
        echo begin_page(Settings::get('company'), 'no_session');
    }
    // Si nous ne sommes pas dans un format imprimable
    if (!isset($_GET['pview']) || $_GET['pview'] != 1) {
        // If we dont know the right date then make it up
        if (!isset($day) || !isset($month) || !isset($year) || $day == '' || $month == '' || $year == '') {
            $date_now = time();
            if ($date_now < Settings::get('begin_bookings')) {
                $date_ = Settings::get('begin_bookings');
            } elseif ($date_now > Settings::get('end_bookings')) {
                $date_ = Settings::get('end_bookings');
            } else {
                $date_ = $date_now;
            }
            $day = date('d', $date_);
            $month = date('m', $date_);
            $year = date('Y', $date_);
        }
        if (!isset($search_str)) {
            $search_str = get_vocab('search_for');
        }
        if (empty($search_str)) {
            $search_str = '';
        }
        if (!(isset($desactive_bandeau_sup) && $desactive_bandeau_sup == 1 && $type_session != 'with_session')) {
            if (@file_exists('./admin_access_area.php')) {
                $adm = 1;
                $racine = '../';
                $racineAd = './';
            } else {
                $adm = 0;
                $racine = './';
                $racineAd = './admin/';
            }
            $tplArray['dansRepAdmin'] = $adm;
            // Génération XML
            $generationXML = 1;
            if (Settings::get('export_xml_actif') == 'Oui' && $adm == 0) {
                include "{$racine}/include/generationxml.php";
            }
            // On fabrique une date valide pour la réservation si ce n'est pas le cas
            $date_ = mktime(0, 0, 0, $month, $day, $year);
            if ($date_ < Settings::get('begin_bookings')) {
                $date_ = Settings::get('begin_bookings');
            } elseif ($date_ > Settings::get('end_bookings')) {
                $date_ = Settings::get('end_bookings');
            }
            $day = date('d', $date_);
            $month = date('m', $date_);
            $year = date('Y', $date_);
            /*echo '<div id="toppanel">'.PHP_EOL;
              echo '<div id="panel">'.PHP_EOL;
              echo '<div class="content">'.PHP_EOL;
              echo '<table id="header">'.PHP_EOL;
              echo '<tr>'.PHP_EOL;*/
            //Logo
            $nom_picture = $racine . 'images/' . Settings::get('logo');
            if (Settings::get('logo') != '' && @file_exists($nom_picture)) {
                $tplArray['nomPicture'] = $nom_picture;
                $tplArray['homeLink'] = $racine . page_accueil('yes') . 'day=' . $day . '&year=' . $year . '&month=' . $month;
                /*echo '<td class="logo" height="100">'.PHP_EOL.'<a href="'.$racine.page_accueil('yes').'day='.$day.'&year='.$year.'&month='.$month.'"><img src="'.$nom_picture.'" alt="logo"/></a>'.PHP_EOL.'</td>'.PHP_EOL;*/
            } else {
                $tplArray['nomPicture'] = false;
            }
            //Accueil
            $tplArray['vocab']['welcome'] = get_vocab('welcome');
            $tplArray['company'] = Settings::get('company');
            /*echo '<td class="accueil ">',PHP_EOL,'<h2>',PHP_EOL,'<a href="'.$racine.page_accueil('yes'),'day=',$day,'&year=',$year,'&month=',$month,'">',get_vocab('welcome'),' - <b>',Settings::get('company'),'</b></a>',PHP_EOL,'</h2>',PHP_EOL;*/
            //Mail réservartion
            $tplArray['messageAcceuil'] = Settings::get('message_accueil');
            //echo Settings::get('message_accueil');
            $sql = 'SELECT value FROM ' . TABLE_PREFIX . "_setting WHERE name='mail_etat_destinataire'";
            $res = grr_sql_query1($sql);
            //Libère le résultat de la mémoire
            grr_sql_free($res);
            if ($res == 1) {
                if ($type_session == 'no_session') {
                    /*echo '<td class="contactformulaire">',PHP_EOL,'<input class="btn btn-default" type="submit" rel="popup_name" value="Réserver" onClick="javascript:location.href=\'contactFormulaire.php?day=',$day,'&month=',$month,'&year=',$year,'\'" >',PHP_EOL,'</td>',PHP_EOL;*/
                    $tplArray['mailEtatDestEtNoSession'] = true;
                    $tplArray['pathToReserver'] = 'contactFormulaire.php?day=' . $day . '&month=' . $month . '&year=' . $year;
                } else {
                    $tplArray['mailEtatDestEtNoSession'] = false;
                }
            }
            // Administration div Sauvegarde
            $tplArray['adminUserWithSession'] = false;
            if ($type_session == 'with_session') {
                if (authGetUserLevel(getUserName(), -1, 'area') >= 4 || authGetUserLevel(getUserName(), -1, 'user') == 1) {
                    $tplArray['adminUserWithSession'] = true;
                    //echo '<td class="administration">'.PHP_EOL;
                    $tplArray['pathToAdmin'] = $racineAd . "admin_accueil.php?day=" . $day . "&month=" . $month . "&year=" . $year;
                    $tplArray['vocab']['admin'] = get_vocab('admin');
                    //echo "<br><a href='{$racineAd}admin_accueil.php?day={$day}&month={$month}&year={$year}'>".get_vocab('admin').'</a>'.PHP_EOL;
                    if (authGetUserLevel(getUserName(), -1, 'area') >= 6) {
                        $tplArray['pathToMyslqlSave'] = $racineAd . 'admin_save_mysql.php';
                        $tplArray['vocab']['submit_backup'] = get_vocab('submit_backup');
                        /*echo '<br />'.PHP_EOL;
                          echo "<form action='{$racineAd}admin_save_mysql.php' method='get'><div>".PHP_EOL;
                          echo '<input type="hidden" name="flag_connect" value="yes" />'.PHP_EOL;
                          echo '<input type="submit" class="btn btn-default" value="'.get_vocab('submit_backup').'" /></div>'.PHP_EOL;
                          echo '</form>'.PHP_EOL;*/
                        $tplArray['vocab']['one_connected'] = get_vocab('one_connected');
                        $tplArray['vocab']['several_connected'] = get_vocab('several_connected');
                        $tplArray['nb_connect'] = how_many_connected();
                        $tplArray['pathToViewConnexions'] = $racineAd . 'admin_view_connexions.php';
                        /**
                         * remove: affiche_pop_up appel, fichier twig alert.html.twig pour gérer les alert,
                         * ATTENTION paramètre "force" non implémenté dans
                         * la fonction affiche_pop_up
                         *
                         * code original : affiche_pop_up(get_vocab('maj_bdd_not_update').get_vocab('please_go_to_admin_maj.php'), 'force');
                         * Ici le but était dans tous les cas d'affichier le message si besion, je ne vérifie pas les settings
                         */
                        /* if true, afficher une alert */
                        if (verif_version()) {
                            $tplArray['erreurVersion'] = get_vocab('maj_bdd_not_update') . get_vocab('please_go_to_admin_maj.php');
                        } else {
                            $tplArray['erreurVersion'] = false;
                        }
                    } else {
                        $tplArray['pathToMyslqlSave'] = false;
                    }
                    /*echo '</td>'.PHP_EOL;*/
                }
            }
            if ($type_session != 'with_session') {
                /*echo '<script>selection()</script>'.PHP_EOL;*/
                $tplArray['session'] = false;
            } else {
                $tplArray['session'] = true;
            }
            /*echo '<td class="configuration" >'.PHP_EOL;*/
            if (@file_exists('js/' . $clock_file)) {
                $tplArray['clockFile'] = $clock_file;
                /*echo '<div class="clock">'.PHP_EOL;
                  echo '<div id="Date">'.PHP_EOL;
                  echo '&nbsp;<span id="hours"></span>'.PHP_EOL;
                  echo 'h'.PHP_EOL;
                  echo '<span id="min"></span>'.PHP_EOL;
                  echo '</div></div>'.PHP_EOL;*/
            } else {
                $tplArray['clockFile'] = false;
            }
            /* reset attribut session */
            $_SESSION['chemin_retour'] = '';
            if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') {
                /**
                 * filtre rapide + urlencode, todo : voir pour mieux faire
                 */
                //$parametres_url = htmlspecialchars(strip_tags($_SERVER['QUERY_STRING'])).'&';
                $parametres_url = urlencode(filter_var(strip_tags($_SERVER['QUERY_STRING']), FILTER_SANITIZE_URL));
                //$_SESSION['chemin_retour'] = traite_grr_url($grr_script_name).'?'.$_SERVER['QUERY_STRING'];
                $_SESSION['chemin_retour'] = traite_grr_url($grr_script_name) . '?' . $parametres_url;
                $tplArray['pathToReturn'] = traite_grr_url($grr_script_name) . '?' . $parametres_url;
                /*echo '<a onclick="charger();" href="'.traite_grr_url($grr_script_name).'?'.$parametres_url.'default_language=fr"><img src="'.$racine.'img_grr/fr_dp.png" alt="France" title="france" width="20" height="13" class="image" /></a>'.PHP_EOL;
                                echo '<a onclick="charger();" href="'.traite_grr_url($grr_script_name).'?'.$parametres_url.'default_language=de"><img src="'.$racine.'img_grr/de_dp.png" alt="Deutch" title="deutch" width="20" height="13" class="image" /></a>'.PHP_EOL;
                                echo '<a onclick="charger();" href="'.traite_grr_url($grr_script_name).'?'.$parametres_url.'default_language=en"><img src="'.$racine.'img_grr/en_dp.png" alt="English" title="English" width="20" height="13" class="image" /></a>'.PHP_EOL;
                                echo '<a onclick="charger();" href="'.traite_grr_url($grr_script_name).'?'.$parametres_url.'default_language=it"><img src="'.$racine.'img_grr/it_dp.png" alt="Italiano" title="Italiano" width="20" height="13" class="image" /></a>'.PHP_EOL;
                                echo '<a onclick="charger();" href="'.traite_grr_url($grr_script_name).'?'.$parametres_url.'default_language=es"><img src="'.$racine.'img_grr/es_dp.png" alt="Spanish" title="Spanish" width="20" height="13" class="image" /></a>'.PHP_EOL;
                 */
            }
            if ($type_session == 'no_session') {
                $tplArray['ssoStatus'] = Settings::get('sso_statut');
                if (Settings::get('sso_statut') == 'cas_visiteur' || Settings::get('sso_statut') == 'cas_utilisateur') {
                    $tplArray['vocab']['authentification'] = get_vocab('authentification');
                    $tplArray['vocab']['connect_local'] = get_vocab('connect_local');
                    /*echo '<br /> <a href="index.php?force_authentification=y">'.get_vocab('authentification').'</a>'.PHP_EOL;
                      echo '<br /> <small><i><a href="login.php">'.get_vocab('connect_local').'</a></i></small>'.PHP_EOL;*/
                } else {
                    /*echo '<br /> <a href="login.php">'.get_vocab('connect').'</a>'.PHP_EOL;*/
                    $tplArray['vocab']['connect'] = get_vocab('connect');
                }
            } else {
                $tplArray['vocab']['welcome_to'] = get_vocab('welcome_to');
                $tplArray['vocab']['manage_my_account'] = get_vocab('manage_my_account');
                $tplArray['pathToMyAccount'] = $racine . 'my_account.php?day=' . $day . '&year=' . $year . '&amp=' . $month;
                $tplArray['prenom'] = htmlspecialchars($_SESSION['prenom']);
                $tplArray['nom'] = htmlspecialchars($_SESSION['nom']);
                /*echo '<br /> <b>'.get_vocab('welcome_to').htmlspecialchars($_SESSION['prenom']).' '.htmlspecialchars($_SESSION['nom']).'</b>'.PHP_EOL;
                  echo '<br /> <a href="'.$racine.'my_account.php?day='.$day.'&year='.$year.'&month='.$month.'">'.get_vocab('manage_my_account').'</a>'.PHP_EOL;*/
                if (verif_access_search(getUserName())) {
                    $tplArray['searchAccess'] = true;
                    $tplArray['pathToReport'] = $racine . 'report.php';
                    $tplArray['vocab']['report'] = get_vocab('report');
                    //echo '<br/><a href="'.$racine.'report.php">'.get_vocab('report').'</a>'.PHP_EOL;
                } else {
                    $tplArray['searchAccess'] = false;
                }
                $disconnect_link = false;
                if (!(Settings::get('cacher_lien_deconnecter') == 'y' && isset($_SESSION['est_authentifie_sso']))) {
                    $disconnect_link = true;
                    $tplArray['disconnectLink'] = true;
                    $tplArray['vocab']['disconnect'] = get_vocab('disconnect');
                    if (Settings::get('authentification_obli') == 1) {
                        $tplArray['authentificationObli'] = true;
                        $tplArray['pathToLogout'] = $racine . 'logout.php?auto=0';
                        //echo '<br /> <a href="'.$racine.'logout.php?auto=0" >'.get_vocab('disconnect').'</a>'.PHP_EOL;
                    } else {
                        $tplArray['authentificationObli'] = false;
                        $tplArray['pathToLogout'] = $racine . 'logout.php?auto=0&redirect_page_accueil=yes';
                        /*echo '<br /> <a href="'.$racine.'logout.php?auto=0&redirect_page_accueil=yes" >'.get_vocab('disconnect').'</a>'.PHP_EOL;*/
                    }
                } else {
                    $tplArray['disconnectLink'] = false;
                }
                if (Settings::get('Url_portail_sso') != '' && isset($_SESSION['est_authentifie_sso'])) {
                    $tplArray['portailSso'] = Settings::get('Url_portail_sso');
                    $tplArray['vocab']['Portail_accueil'] = get_vocab('Portail_accueil');
                    if ($disconnect_link) {
                        echo ' - ' . PHP_EOL;
                    } else {
                        echo '<br />' . PHP_EOL;
                    }
                    //echo '<a href="'.Settings::get('Url_portail_sso').'">'.get_vocab('Portail_accueil').'</a>'.PHP_EOL;
                } else {
                    $tplArray['portailSso'] = false;
                }
                if (Settings::get('sso_statut') == 'lasso_visiteur' || Settings::get('sso_statut') == 'lasso_utilisateur') {
                    $tplArray['ssoStatus'] = Settings::get('sso_statut');
                    //echo '<br />';
                    if ($_SESSION['lasso_nameid'] == null) {
                        $tplArray['lasso_nameid'] = false;
                        $tplArray['vocab']['lasso_federate_this_account'] = get_vocab('lasso_federate_this_account');
                        /*echo '<a href="lasso/federate.php">'.get_vocab('lasso_federate_this_account').'</a>'.PHP_EOL;*/
                    } else {
                        $tplArray['lasso_nameid'] = true;
                        $tplArray['vocab']['lasso_defederate_this_account'] = get_vocab('lasso_defederate_this_account');
                        /*echo '<a href="lasso/defederate.php">'.get_vocab('lasso_defederate_this_account').'</a>'.PHP_EOL;*/
                    }
                }
            }
            /*
                        echo '</td>'.PHP_EOL;
                        echo '</tr>'.PHP_EOL;
                        echo '</table>'.PHP_EOL;
                        echo '</div>'.PHP_EOL;
                        echo '</div>'.PHP_EOL;
                        echo '<div class="tab">'.PHP_EOL;
                    //	echo '<ul class="login">'.PHP_EOL;
                        //echo '<li>'.PHP_EOL;
                        echo '<a id="open" class="open" href="#">Menu <i>(ouvrir/fermer)</i></a>'.PHP_EOL;
                    //	echo '</li>'.PHP_EOL;
                    //	echo '</ul>'.PHP_EOL;
                        echo '</div>'.PHP_EOL;
                        echo '</div>'.PHP_EOL;*/
            if ($display) {
                if ($admin) {
                    echo $twig->render('printHeaderAdmin.html.twig', $tplArray);
                } else {
                    echo $twig->render('printHeader.html.twig', $tplArray);
                }
            } else {
                return $tplArray;
            }
        }
    }
}
Exemple #5
0
    } elseif ($result == '9') {
        $message = get_vocab('echec_connexion_GRR');
        $message .= '<br />' . get_vocab('connexion_a_grr_non_autorisee');
        $message .= '<br />' . get_vocab('echec_authentification_ldap');
        $message .= '<br />' . get_vocab('ldap_doublon_identifiant');
    } elseif ($result == '10') {
        $message = get_vocab('echec_connexion_GRR');
        $message .= '<br />' . get_vocab('connexion_a_grr_non_autorisee');
        $message .= '<br />' . get_vocab('echec_authentification_imap');
    } else {
        if (isset($_POST['url'])) {
            $url = rawurldecode($_POST['url']);
            header('Location: ' . $url);
            die;
        } else {
            header('Location: ./' . htmlspecialchars_decode(page_accueil()) . '');
            die;
        }
    }
}
$tplArray = [];
// Dans le cas d'une démo, on met à jour la base une fois par jour.
MajMysqlModeDemo();
//si on a interdit l'acces a la page login
if (Settings::get('Url_cacher_page_login') != '' && (!isset($sso_super_admin) || $sso_super_admin == false) && !isset($_GET['local'])) {
    header('Location: ./index.php');
}
echo begin_page(get_vocab('mrbs') . get_vocab('deux_points') . Settings::get('company'), 'no_session');
/*<!--<script type="text/javascript" src="js/functions.js" ></script>
<div class="center">-->*/
$nom_picture = './images/' . Settings::get('logo');
Exemple #6
0
function print_header($day='',$month='',$year='',$area='',$type_session='with_session',$page='no_admin',$room='')
{
   global $vocab, $search_str, $grrSettings, $clock_file, $desactive_VerifNomPrenomUser, $grr_script_name;
   global $use_prototype, $use_tooltip_js, $desactive_bandeau_sup, $id_site;

   if (!($desactive_VerifNomPrenomUser)) $desactive_VerifNomPrenomUser = '******';
   // On vérifie que les noms et prénoms ne sont pas vides
   VerifNomPrenomUser($type_session);
   if ($type_session == "with_session")
       echo begin_page(get_vocab("mrbs").get_vocab("deux_points").getSettingValue("company"),"with_session");
   else
       echo begin_page(get_vocab("mrbs").get_vocab("deux_points").getSettingValue("company"),"no_session");

   // Si nous ne sommes pas dans un format imprimable
   if ((!isset($_GET['pview'])) or ($_GET['pview'] != 1)) {

   # If we dont know the right date then make it up
     if (!isset($day) or !isset($month) or !isset($year) or ($day == '') or ($month == '') or ($year == '')) {
         $date_now = mktime();
         if ($date_now < getSettingValue("begin_bookings"))
             $date_ = getSettingValue("begin_bookings");
         else if ($date_now > getSettingValue("end_bookings"))
             $date_ = getSettingValue("end_bookings");
         else
             $date_ = $date_now;
        $day   = date("d",$date_);
        $month = date("m",$date_);
        $year  = date("Y",$date_);
     }
   if (!(isset($search_str))) $search_str = get_vocab("search_for");
   if (empty($search_str)) $search_str = "";
   ?>
   <script type="text/javascript">
    chaine_recherche = "<?php echo $search_str; ?>";
   	function onsubmitForm()
	{
	if(document.pressed == 'a')
	{
  	document.getElementById('day').selectedIndex=<?php $date_now = mktime();echo (date("d",$date_now)-1); ?>;
		document.getElementById('month').selectedIndex=<?php echo (date("m",$date_now)-1);?>;
		document.getElementById('year').selectedIndex=<?php echo (date("Y",$date_now)-strftime("%Y", getSettingValue("begin_bookings")));?>;
  	var p=location.pathname;
	   	if(!p.match("day.php") && !p.match("week.php") && !p.match("week_all.php") && !p.match("month.php") && !p.match("month_all.php") && !p.match("month_all2.php") && !p.match("year.php"))
    document.getElementById('myform').action ="day.php";
	}
    if(document.pressed == 'd')
      document.getElementById('myform').action ="day.php";
    if(document.pressed == 'w')
    <?php
    echo "		document.getElementById('myform').action = \"";
    if ($room=="")
      echo "week_all.php";
		else
      echo "week.php";
    echo "\";\n";
    ?>
    if(document.pressed == 'm')
    <?php
    echo "		document.getElementById('myform').action = \"";
    if ($room=="") {
      if (isset($_SESSION['type_month_all'])) {echo $_SESSION['type_month_all'].".php";}
      else {echo "month_all.php";}
    } else
      echo "month.php";
    echo "\";\n";
    ?>
    return true;
		}
		</script>
    <?php

if (!(isset($desactive_bandeau_sup) and ($desactive_bandeau_sup==1) and ($type_session != 'with_session'))) {
    // On fabrique une date valide pour la réservation si ce n'est pas le cas
    $date_ = mktime(0, 0, 0, $month, $day, $year);
    if ($date_ < getSettingValue("begin_bookings"))
        $date_ = getSettingValue("begin_bookings");
    else if ($date_ > getSettingValue("end_bookings"))
        $date_ = getSettingValue("end_bookings");
    $day   = date("d",$date_);
    $month = date("m",$date_);
    $year  = date("Y",$date_);
?>

   <table width="100%" border="0">
    <tr>
      <td class="border_banner">
       <table width="100%" border="0">
        <tr>
        <?php
        $nom_picture = "./images/".getSettingValue("logo");
        if ((getSettingValue("logo")!='') and (@file_exists($nom_picture)))
         echo "<td class=\"banner\"><img src=\"".$nom_picture."\" class=\"image\" alt=\"logo\" /></td>\n";
         echo "<td class=\"banner\">\n";
          echo "&nbsp;<a href=\"".page_accueil('yes')."day=$day&amp;year=$year&amp;month=$month\">".get_vocab("welcome")."</a>";
          echo " - <b>".getSettingValue("company")."</b>";
          if ($type_session == 'no_session') {
            if ((getSettingValue('sso_statut') == 'cas_visiteur') or (getSettingValue('sso_statut') == 'cas_utilisateur'))
					  {
					    echo "<br />&nbsp;<a href='index.php?force_authentification=y'>".get_vocab("authentification")."</a>";
//					    echo "<br />&nbsp;<small><i><a href='login.php?url=".rawurlencode(str_replace('&amp;','&',get_request_uri()))."'>".get_vocab("connect_local")."</a></i></small>";
// corrige un bug dans le calcul de la page d'accueil après connexion.
					    echo "<br />&nbsp;<small><i><a href='login.php'>".get_vocab("connect_local")."</a></i></small>";
					  }
				    else
					  {
// echo "<br />&nbsp;<a href='login.php?url=".rawurlencode(str_replace('&amp;','&',get_request_uri()))."'>".get_vocab("connect")."</a>";
// corrige un bug dans le calcul de la page d'accueil après connexion.
					    echo "<br />&nbsp;<a href='login.php'>".get_vocab("connect")."</a>";
            }
          } else {
            echo "<br />&nbsp;<b>".get_vocab("welcome_to").grr_htmlSpecialChars($_SESSION['prenom'])." ".grr_htmlSpecialChars($_SESSION['nom'])."</b>";
            echo "<br />&nbsp;<a href=\"my_account.php?day=".$day."&amp;year=".$year."&amp;month=".$month."\">".get_vocab("manage_my_account")."</a>";
            //if ($type_session == "with_session") {
            $parametres_url = '';
                 $_SESSION['chemin_retour'] = '';
                 if (isset($_SERVER['QUERY_STRING']) and ($_SERVER['QUERY_STRING'] != '')) {
                     // Il y a des paramètres à passer
                     $parametres_url = grr_htmlSpecialChars($_SERVER['QUERY_STRING'])."&amp;";
                     $_SESSION['chemin_retour'] = traite_grr_url($grr_script_name)."?". $_SERVER['QUERY_STRING'];
                 }
                 echo " - <a href=\"".traite_grr_url($grr_script_name)."?".$parametres_url."default_language=fr\"><img src=\"img_grr/fr_dp.png\" alt=\"France\" title=\"france\" width=\"20\" height=\"13\" class=\"image\" /></a>\n";
                 echo "<a href=\"".traite_grr_url($grr_script_name)."?".$parametres_url."default_language=de\"><img src=\"img_grr/de_dp.png\" alt=\"Deutch\" title=\"deutch\" width=\"20\" height=\"13\" class=\"image\" /></a>\n";
                 echo "<a href=\"".traite_grr_url($grr_script_name)."?".$parametres_url."default_language=en\"><img src=\"img_grr/en_dp.png\" alt=\"English\" title=\"English\" width=\"20\" height=\"13\" class=\"image\" /></a>\n";
                 echo "<a href=\"".traite_grr_url($grr_script_name)."?".$parametres_url."default_language=it\"><img src=\"img_grr/it_dp.png\" alt=\"Italiano\" title=\"Italiano\" width=\"20\" height=\"13\" class=\"image\" /></a>\n";
                 echo "<a href=\"".traite_grr_url($grr_script_name)."?".$parametres_url."default_language=es\"><img src=\"img_grr/es_dp.png\" alt=\"Spanish\" title=\"Spanish\" width=\"20\" height=\"13\" class=\"image\" /></a>\n";

            //}
            $disconnect_link = false;
            if (!((getSettingValue("cacher_lien_deconnecter")=='y') and (isset($_SESSION['est_authentifie_sso'])))) {
               // on n'affiche pas le lien logout dans le cas d'un utilisateur LCS connecté.
               $disconnect_link = true;
               if (getSettingValue("authentification_obli") == 1) {
                   echo "<br />&nbsp;<a href=\"./logout.php?auto=0\" >".get_vocab('disconnect')."</a>";
               } else {
                   echo "<br />&nbsp;<a href=\"./logout.php?auto=0&amp;redirect_page_accueil=yes\" >".get_vocab('disconnect')."</a>";
               }
            }
            if ((getSettingValue("Url_portail_sso")!='') and (isset($_SESSION['est_authentifie_sso']))) {
                if ($disconnect_link)
                   echo "&nbsp;-&nbsp;";
                else
                   echo "<br />&nbsp;";
                echo('<a href="'.getSettingValue("Url_portail_sso").'">'.get_vocab("Portail_accueil").'</a>');
             }
             // Cas d'une authentification LASSO
             if ((getSettingValue('sso_statut') == 'lasso_visiteur') or (getSettingValue('sso_statut') == 'lasso_utilisateur')) {
               echo "<br />&nbsp;";
               if ($_SESSION['lasso_nameid'] == NULL)
                 echo "<a href=\"lasso/federate.php\">".get_vocab('lasso_federate_this_account')."</a>";
               else
                 echo "<a href=\"lasso/defederate.php\">".get_vocab('lasso_defederate_this_account')."</a>";
               }
          }
      ?>
     </td>
     <?php
	   if (((isset($area)) and ($area > 0)) or ((isset($room)) and ($room > 0)))
	      // si aucune ressource ni domaine ne sont définis, on affiche pas la colonne de sélection du jour
        $affiche_col_date = TRUE;
	   else
	      $affiche_col_date = FALSE;

     if (($page=="no_admin") and ($affiche_col_date)) {
     ?>
         <td class="banner"  align="center">
           <form id="myform" action="" method="get" onsubmit="return onsubmitForm();"><div>
           <?php
           genDateSelector("", $day, $month, $year,"");
    		   if ((isset($area)) and ($area > 0))
             echo "<input type=\"hidden\" id=\"area_\" name=\"area\" value=\"$area\" />";
    		   if ((isset($room)) and ($room > 0))
             echo "<input type=\"hidden\" id=\"room_\" name=\"room\" value=\"$room\" />";
           ?>
		   <input type="submit" value="<?php echo get_vocab("gototoday") ?>" onclick="document.pressed='a'" />
           <br />
           <br />
           <input type="submit" value="<?php echo get_vocab("allday") ?>" onclick="document.pressed='d'" />
           <input type="submit" value="<?php echo get_vocab("week") ?>" onclick="document.pressed='w'" />
           <input type="submit" value="<?php echo get_vocab("month") ?>" onclick="document.pressed='m'" />
           </div></form>
         </td>
         <?php
     }
     if ($type_session == "with_session") {
          if ((authGetUserLevel(getUserName(),-1,'area') >= 4) or (authGetUserLevel(getUserName(),-1,'user') == 1))  {
           echo "<td class=\"banner\" align=\"center\">";
           echo "<a href='admin_accueil.php?day=$day&amp;month=$month&amp;year=$year'>".get_vocab("admin")."</a>\n";
           if(authGetUserLevel(getUserName(),-1,'area') >= 6)  {
              echo "<br />\n<form action=\"admin_save_mysql.php\" method=\"get\"><div>\n
              <input type=\"hidden\" name=\"flag_connect\" value=\"yes\" />\n
              <input type=\"submit\" value=\"".get_vocab("submit_backup")."\" /></div>\n
              </form>";
              how_many_connected();
           }
           echo "\n</td>";
      }
     }
      ?>
          <td class="banner" align="center">
      <?php
      if (@file_exists($clock_file)) {
        echo "<script type=\"text/javascript\">";
        echo "<!--\n";
        echo "new LiveClock();\n";
        echo "//-->";
        echo "</script><br />";
      }

      echo grr_help("","")."<br />";
      if (verif_access_search(getUserName())) {
          echo "<a href=\"report.php\">".get_vocab("report")."</a><br />";
      }
      echo "<span class=\"small\">".affiche_version()."</span> - ";
      if ($type_session == "with_session") {
          if ($_SESSION['statut'] == 'administrateur') {
              echo affiche_lien_contact("contact_support","identifiant:non","seulement_si_email");
          } else {
              echo affiche_lien_contact("contact_administrateur","identifiant:non","seulement_si_email");
          }
      } else {
          echo affiche_lien_contact("contact_administrateur","identifiant:non","seulement_si_email");
      }

          ?>
         </td>
        </tr>
       </table>
      </td>
     </tr>
    </table>
<?php
}
if (isset($use_prototype))
    echo "<script type=\"text/javascript\" src=\"./include/prototype-1.6.0.3.js\"></script>";
if (isset($use_tooltip_js))
    echo "<script type=\"text/javascript\" src=\"./include/tooltip.js\"></script>";
echo getSettingValue('message_accueil');
  }
}
Exemple #7
0
phpCAS::setNoCasServerValidation();

/*
Gestion du single sign-out (version 1.0.0 de phpcas)
Commentez la ligne suivante si vous avez une erreur du type
PHP Fatal error:  Call to undefined method phpCAS::handlelogoutrequests() in /var/www/html/grr/include/cas.inc.php
*/
phpCAS::handleLogoutRequests(false);

if(phpCAS::checkAuthentication()) {
  // L'utilisateur est déjà authentifié, on continue
} else {
  // L'utilisateur n'est pas authentifié. Que fait-on ?
  if (getSettingValue("sso_redirection_accueil_grr")=='y') {
    if (isset($_GET['force_authentification']))
        phpCAS::forceAuthentication(); // On force l'utilisateur à s'authentifier en redirigeant l'utilisateur vers le serveur CAS
    else
        header("Location: ".htmlspecialchars_decode(page_accueil()).""); // On redirige l'utilisateur vers la page d'accueil de GRR
  } else {
        phpCAS::forceAuthentication(); // On force l'utilisateur à s'authentifier en redirigeant l'utilisateur vers le serveur CAS
  }
}

// A ce stade, l'utilisateur est authentifié
$login=phpCAS::getUser();
$user_ext_authentifie = 'cas';

if (file_exists("./include/config_CAS.inc.php"))
   include("./include/config_CAS.inc.php");

?>