noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
do.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 define('ALLOWED',1);
00023 
00024 /**\file
00025  * \brief Main file
00026  */
00027 require_once '../include/constant.php';
00028 require_once 'class_database.php';
00029 require_once ('class_dossier.php');
00030 require_once('user_common.php');
00031 require_once('ac_common.php');
00032 require_once 'function_javascript.php';
00033 require_once 'constant.security.php';
00034 require_once 'class_html_input.php';
00035 mb_internal_encoding("UTF-8");
00036 
00037 // if gDossier is not set redirect to form to choose a folder
00038 if ( ! isset($_REQUEST['gDossier']))
00039 {
00040     redirect('user_login.php');
00041     exit();
00042 }
00043 if ( ! isset ($_SESSION['g_theme']))
00044   {
00045     echo "<h2>"._('Vous  êtes déconnecté')."</h2>";
00046     redirect('user_login.php');
00047     exit();
00048 
00049   }
00050 $style_user=HtmlInput::default_value_post("style_user",$_SESSION['g_theme']);
00051 
00052 html_page_start($style_user);
00053 
00054 global $g_user, $cn,$g_parameter;
00055 
00056 
00057 
00058 $cn = new Database(Dossier::id());
00059 $g_user = new User($cn);
00060 
00061 if ($g_user->check_dossier(dossier::id()) == 'P')
00062 {
00063     redirect("extension.php?" . dossier::get(), 0);
00064     exit();
00065 }
00066 $g_parameter=new Own($cn);
00067 
00068 load_all_script();
00069 /*  Check Browser version if < IE6 then unsupported */
00070 $browser = $_SERVER['HTTP_USER_AGENT'];
00071 if (strpos($browser, 'MSIE 6') != false ||
00072         strpos($browser, 'MSIE 5') != false)
00073 {
00074 
00075 
00076     echo <<<EOF
00077     <!--[if lt IE 7]>
00078     <div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
00079     <div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div>
00080     <div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
00081     <div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
00082     <div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
00083    <div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>Vous utilisez un navigateur dépassé depuis près de 8 ans!</div>
00084     <div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>Pour une meilleure expérience web, prenez le temps de mettre votre navigateur à jour.</div>
00085     </div>
00086    <div style='width: 75px; float: left;'><a href='http://fr.www.mozilla.com/fr/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div>
00087    <div style='width: 73px; float: left;'><a href='http://www.apple.com/fr/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div>
00088  <div style='float: left;'><a href='http://www.google.com/chrome?hl=fr' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div>
00089      </div>
00090      </div>
00091      <![endif]-->
00092 EOF;
00093     exit();
00094 }
00095 if ($cn->exist_table('version') == false)
00096 {
00097     echo '<h2 class="error" style="font-size:12px">' . _("Base de donnée invalide") . '</h2>';
00098     $base = dirname($_SERVER['REQUEST_URI']);
00099     echo HtmlInput::button_anchor('Retour', $base . '/user_login.php');
00100     exit();
00101 }
00102 if (DBVERSION < dossier::get_version($cn))
00103 {
00104     echo '<h2 class="error" style="font-size:12px">' . _("Attention: la version de base de donnée est supérieure à la version du programme, vous devriez mettre à jour") . '</h2>';
00105 }
00106 if (DBVERSION > dossier::get_version($cn))
00107 {
00108     echo '<h2 class="error" style="font-size:12px">' . _("Votre base de données n'est pas à jour") . '   ';
00109     $a = _("cliquez ici pour appliquer le patch");
00110     $base = dirname($_SERVER['REQUEST_URI']) . '/admin/setup.php';
00111     echo '<a hreF="' . $base . '">' . $a . '</a></h2>';
00112 }
00113 
00114 /*
00115  * Set a correct periode for the user
00116  */
00117 $periode = $g_user->get_periode();
00118 $oPeriode = new Periode($cn, $periode);
00119 
00120 if ($oPeriode->load() == -1)
00121 {
00122     $periode = $cn->get_value('select p_id from parm_periode order by p_start asc limit 1');
00123     $g_user->set_periode($periode);
00124 }
00125 
00126 // Display available menu in the right order
00127 load_all_script();
00128 
00129 $module_selected = -1;
00130 
00131 /*
00132  * Set the user preference
00133  */
00134 if ( isset ($_POST['set_preference'])) {
00135     //// Save value
00136     extract($_POST);
00137 
00138     if (strlen(trim($pass_1)) != 0 && strlen(trim($pass_2)) != 0)
00139     {
00140         $g_user->save_password($pass_1,$pass_2);
00141         
00142     }
00143     $g_user->set_periode($period);
00144     $g_user->save_global_preference('THEME', $style_user);
00145     $g_user->save_global_preference('LANG', $lang);
00146     $g_user->save_global_preference('PAGESIZE', $p_size);
00147     $g_user->set_mini_report($minirap);
00148     $_SESSION['g_theme']=$style_user;
00149     $_SESSION['g_pagesize']=$p_size;
00150     $_SESSION['g_lang']=$lang;
00151 }
00152 /*
00153  * if an action is requested
00154  */
00155 if (isset($_REQUEST['ac']))
00156 {
00157     $_REQUEST['ac']=  trim(strtoupper($_REQUEST['ac']));
00158     $all = explode('/', $_REQUEST['ac']);
00159     $module_selected = $all[0];
00160     $g_user->audit();
00161 // Show module and highligt selected one
00162     show_module($module_selected);
00163     for ($i = 0; $i != count($all); $i++)
00164     {   // show the menu
00165                 show_menu($all, $i);
00166     }
00167 }
00168 else
00169 {
00170     $default = find_default_module();
00171     $_GET['ac']=$default;
00172     $_POST['ac']=$default;
00173     $_REQUEST['ac']=$default;
00174     show_module($default);
00175     $all[0] = $default;
00176     show_menu($all, 0);
00177 }
00178 
00179 
 All Data Structures Namespaces Files Functions Variables Enumerations