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 /**\file
00024  * \brief Main file
00025  */
00026 require_once '../include/constant.php';
00027 require_once 'class_database.php';
00028 require_once ('class_dossier.php');
00029 require_once('user_common.php');
00030 require_once('ac_common.php');
00031 require_once 'function_javascript.php';
00032 require_once 'constant.security.php';
00033 require_once 'class_html_input.php';
00034 mb_internal_encoding("UTF-8");
00035 
00036 // if gDossier is not set redirect to form to choose a folder
00037 if ( ! isset($_REQUEST['gDossier']))
00038 {
00039     redirect('user_login.php');
00040     exit();
00041 }
00042 if ( ! isset ($_SESSION['g_theme']))
00043   {
00044     echo "<h2>"._('Vous  êtes déconnecté')."</h2>";
00045     redirect('user_login.php');
00046     exit();
00047 
00048   }
00049 $style_user=HtmlInput::default_value_post("style_user",$_SESSION['g_theme']);
00050 
00051 html_page_start($style_user);
00052 
00053 global $g_user, $cn,$g_parameter;
00054 
00055 
00056 
00057 $cn = new Database(Dossier::id());
00058 $g_user = new User($cn);
00059 
00060 if ($g_user->check_dossier(dossier::id()) == 'P')
00061 {
00062     redirect("extension.php?" . dossier::get(), 0);
00063     exit();
00064 }
00065 $g_parameter=new Own($cn);
00066 
00067 load_all_script();
00068 /*  Check Browser version if < IE6 then unsupported */
00069 $browser = $_SERVER['HTTP_USER_AGENT'];
00070 if (strpos($browser, 'MSIE 6') != false ||
00071         strpos($browser, 'MSIE 5') != false)
00072 {
00073 
00074 
00075     echo <<<EOF
00076     <!--[if lt IE 7]>
00077     <div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
00078     <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>
00079     <div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
00080     <div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
00081     <div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
00082    <div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>Vous utilisez un navigateur dépassé depuis près de 8 ans!</div>
00083     <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>
00084     </div>
00085    <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>
00086    <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>
00087  <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>
00088      </div>
00089      </div>
00090      <![endif]-->
00091 EOF;
00092     exit();
00093 }
00094 if ($cn->exist_table('version') == false)
00095 {
00096     echo '<h2 class="error" style="font-size:12px">' . _("Base de donnée invalide") . '</h2>';
00097     $base = dirname($_SERVER['REQUEST_URI']);
00098        echo HtmlInput::button_anchor('Retour', $base . '/user_login.php');
00099     exit();
00100 }
00101 if (DBVERSION < dossier::get_version($cn))
00102 {
00103     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>';
00104 }
00105 if (DBVERSION > dossier::get_version($cn))
00106 {
00107     echo '<h2 class="error" style="font-size:12px">' . _("Votre base de données n'est pas à jour") . '   ';
00108     $a = _("cliquez ici pour appliquer le patch");
00109     $base = dirname($_SERVER['REQUEST_URI']);
00110     if ($base == '/') { $base = ''; }
00111     $base .= '/admin/setup.php';
00112     echo '<a hreF="' . $base . '">' . $a . '</a></h2>';
00113 }
00114 
00115 /*
00116  * Set a correct periode for the user
00117  */
00118 $periode = $g_user->get_periode();
00119 $oPeriode = new Periode($cn, $periode);
00120 
00121 if ($oPeriode->load() == -1)
00122 {
00123     $periode = $cn->get_value('select p_id from parm_periode order by p_start asc limit 1');
00124     $g_user->set_periode($periode);
00125 }
00126 
00127 // Display available menu in the right order
00128 load_all_script();
00129 
00130 $module_selected = -1;
00131 
00132 /*
00133  * Set the user preference
00134  */
00135 if ( isset ($_POST['set_preference'])) {
00136     //// Save value
00137     extract($_POST);
00138 
00139     if (strlen(trim($pass_1)) != 0 && strlen(trim($pass_2)) != 0)
00140     {
00141         $g_user->save_password($pass_1,$pass_2);
00142         
00143     }
00144     $g_user->set_periode($period);
00145     $g_user->save_global_preference('THEME', $style_user);
00146     $g_user->save_global_preference('LANG', $lang);
00147     $g_user->save_global_preference('PAGESIZE', $p_size);
00148     $g_user->set_mini_report($minirap);
00149     $_SESSION['g_theme']=$style_user;
00150     $_SESSION['g_pagesize']=$p_size;
00151     $_SESSION['g_lang']=$lang;
00152 }
00153 
00154 /*
00155  * if an action is requested
00156  */
00157 if (isset($_REQUEST['ac']))
00158 {
00159     // When debugging save all the input in a file
00160     if ( LOGINPUT)
00161     {
00162         $file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
00163         $tmp_ac=explode('/',trim(strtoupper($_REQUEST['ac'])));
00164         $last=count($tmp_ac);
00165         if ($last > 0) $last--;
00166         fwrite ($file_loginput,"<?php \n");
00167         fwrite ($file_loginput,'//@description:'.$tmp_ac[$last]."\n");
00168         fwrite($file_loginput, '$_GET='.var_export($_GET,true));
00169         fwrite($file_loginput,";\n");
00170         fwrite($file_loginput, '$_POST='.var_export($_POST,true));
00171         fwrite($file_loginput,";\n");
00172         fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
00173         fwrite($file_loginput,"\n");
00174         fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
00175         fwrite($file_loginput,"\n");
00176         fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
00177         fwrite($file_loginput,"\n");
00178         fclose($file_loginput);
00179     }
00180 
00181     $_REQUEST['ac']=  trim(strtoupper($_REQUEST['ac']));
00182     $all = explode('/', $_REQUEST['ac']);
00183     $module_selected = $all[0];
00184     $g_user->audit();
00185 // Show module and highligt selected one
00186     show_module($module_selected);
00187     for ($i = 0; $i != count($all); $i++)
00188     {   // show the menu
00189                 show_menu($all, $i);
00190     }
00191 }
00192 else
00193 {
00194     $default = find_default_module();
00195     $_GET['ac']=$default;
00196     $_POST['ac']=$default;
00197     $_REQUEST['ac']=$default;
00198     show_module($default);
00199     $all[0] = $default;
00200     show_menu($all, 0);
00201 }
00202 
00203 
 All Data Structures Namespaces Files Functions Variables Enumerations