예제 #1
0
파일: admin_maj.php 프로젝트: rhertzog/lcs
// Numéro de version
echo "<h3>".get_vocab("num_version_title")."</h3>\n";
echo "<p>".get_vocab("num_version").$display_version_grr;
echo "</p>\n";

echo get_vocab('database') . grr_sql_version() . "\n";
echo "<br />" . get_vocab('system') . php_uname() . "\n";
echo "<br />Version PHP : " . phpversion() . "\n";


echo "<p>".get_vocab("maj_go_www")."<a href=\"".$grr_devel_url."\">".get_vocab("mrbs")."</a></p>\n";
echo "<hr />\n";
// Mise à jour de la base de donnée
echo "<h3>".get_vocab("maj_bdd")."</h3>";
// Vérification du numéro de version
if (verif_version()) {
    echo "<form action=\"admin_maj.php\" method=\"post\">";
    echo "<p><span style=\"color:red;\"><b>".get_vocab("maj_bdd_not_update");
    echo " ".get_vocab("maj_version_bdd").$display_version_old;
    echo "</b></span><br />";
    echo get_vocab("maj_do_update")."<b>".$display_version_grr."</b></p>";
    echo "<input type=\"submit\" value=\"".get_vocab("maj_submit_update")."\" />";
    echo "<input type=\"hidden\" name=\"maj\" value=\"yes\" />";
    echo "<input type=\"hidden\" name=\"version_old\" value=\"$version_old\" />";
    echo "<input type=\"hidden\" name=\"valid\" value=\"$valid\" />";
    echo "</form>";
} else {
    echo "<p>".get_vocab("maj_no_update_to_do")."</p>";
    echo "<p style=\"text-align:center;\"><a href=\"./\">".get_vocab("welcome")."</a></p>";
}
예제 #2
0
/**
 * FUNCTION: how_many_connected()
 * DESCRIPTION: Si c'est un admin qui est connecté, affiche le nombre de personnes actuellement connectées.
 */
function how_many_connected()
{
    if (authGetUserLevel(getUserName(), -1) >= 6) {
        $sql = "SELECT login FROM " . TABLE_PREFIX . "_log WHERE end > now()";
        $res = grr_sql_query($sql);
        $nb_connect = grr_sql_count($res);
        grr_sql_free($res);
        if (@file_exists('./admin_access_area.php')) {
            $racineAd = "./";
        } else {
            $racineAd = "./admin/";
        }
        if ($nb_connect == 1) {
            echo "<a href='{$racineAd}admin_view_connexions.php'>" . $nb_connect . get_vocab("one_connected") . "</a>" . PHP_EOL;
        } else {
            echo "<a href='{$racineAd}admin_view_connexions.php'>" . $nb_connect . get_vocab("several_connected") . "</a>" . PHP_EOL;
        }
        if (verif_version()) {
            affiche_pop_up(get_vocab("maj_bdd_not_update") . get_vocab("please_go_to_admin_maj.php"), "force");
        }
    }
}
예제 #3
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;
            }
        }
    }
}
예제 #4
0
/**
 * FUNCTION: how_many_connected()
 * DESCRIPTION: Si c'est un admin qui est connecté, affiche le nombre de personnes actuellement connectées.
 */
function how_many_connected() {
    if(authGetUserLevel(getUserName(),-1) >= 6)
    {
      $sql = "SELECT LOGIN FROM ".TABLE_PREFIX."_log WHERE END > now()";
      $res = grr_sql_query($sql);
      $nb_connect = grr_sql_count($res);
      grr_sql_free($res);
      if ($nb_connect == 1)
        echo "<a href='admin_view_connexions.php'>".$nb_connect.get_vocab("one_connected")."</a>";
      else
        echo "<a href='admin_view_connexions.php'>".$nb_connect.get_vocab("several_connected")."</a>";
        // Vérification du numéro de version
      if (verif_version())
         affiche_pop_up(get_vocab("maj_bdd_not_update").get_vocab("please_go_to_admin_maj.php"),"force");
    }
}
예제 #5
0
/**
 * FUNCTION: how_many_connected()
 * DESCRIPTION: Si c'est un admin qui est connecté, affiche le nombre de personnes actuellement connectées.
 */
function how_many_connected()
{
    if (authGetUserLevel(getUserName(), -1) >= 6) {
        $sql = "SELECT login FROM " . TABLE_PREFIX . "_log WHERE end > now()";
        $res = grr_sql_query($sql);
        $nb_connect = grr_sql_count($res);
        grr_sql_free($res);
        if ($nb_connect == 1) {
            echo '<a href="admin_view_connexions.php">' . $nb_connect . get_vocab("one_connected") . '</a>' . PHP_EOL;
        } else {
            echo '<a href="admin_view_connexions.php">' . $nb_connect . get_vocab("several_connected") . '</a>' . PHP_EOL;
        }
        if (verif_version()) {
            affiche_pop_up(get_vocab("maj_bdd_not_update") . get_vocab("please_go_to_admin_maj.php"), "force");
        }
    }
}
예제 #6
0
파일: distribution.php 프로젝트: philum/cms
    if ($_GET["update"] == 'program' && $_SESSION['fnb'] < 7) {
        $_SESSION['fnb'] += 1;
        $_SESSION['dest'] = $_SESSION['folders'][$_SESSION['fnb']];
        $ret = maj_system($_SESSION['dest']);
    } else {
        return make_table($ret, 'txtbox', '') . '<br>';
    }
}
////////////
//define_s("dest","distrib/prog");
$_SESSION['dest'] = $_GET["dest"] ? $_GET["dest"] : $_SESSION['dest'];
$_SESSION['dest'] = $_SESSION['dest'] ? $_SESSION['dest'] : "prog";
$_SESSION['updfirst'] = '';
#server
if ($_GET["version"]) {
    $ret = verif_version();
}
if ($_GET["filedate"]) {
    $_SESSION['dest'] = $_GET["filedate"];
    $ret = give_maj_servermtime();
}
if ($_GET["datapage"]) {
    $ret = distribution($_GET["datapage"]);
}
if ($_GET["page"]) {
    $ret = give_page();
}
//sourcedir
if ($_GET["gz"]) {
    $ret = give_gz();
}