post("action","string","display_form");
if (isset($_REQUEST['gDossier']) && $http->request("gDossier","number",0) != 0 )
{
$g_user->load_global_pref();
$msg = "";
$cn =Dossier::connect();
$g_user->db = $cn;
$inside_dossier = true;
$local_pref=$g_user->get_preference();
}
//////////////////////////////////////////////////////////////////////////
// Theme
//////////////////////////////////////////////////////////////////////////
$repo = new Database();
// charge tous les styles
$res = $repo->exec_sql("select the_name from theme
order by the_name");
$style = new ISelect('style_user');
$style->value = $repo->make_array("select the_name,the_name
from theme
order by the_name");
$style->selected =$_SESSION[SESSION_KEY.'g_theme'];
//----------------------------------------------------------------------------------------------
// Display the form
//----------------------------------------------------------------------------------------------
if ( $action == 'display_form' )
{
echo HtmlInput::title_box(_('Préférence'), 'preference_div');
echo '
';
echo '
';
echo _("Après validation, recharger pour appliquer les changements");
echo '
';
//----------------------------------------------------------------------
//
?>
";
?>
post("style_user","string","Classique");
$lang=$http->post("lang","string","fr_FR.utf8");
$p_size=$http->post("p_size","number",50);
$pass_1=$http->post("pass_1","string","");
$pass_2=$http->post("pass_2","string","");
$p_email=$http->post("p_email","string","");
$csv_fieldsep=$http->post("csv_fieldsep","number");
$csv_decimal=$http->post("csv_decimal","number");
$csv_encoding=$http->post("csv_encoding");
$firstday=$http->post("selFirstDay","number");
$vatCode=$http->post("selVATCode","number");
$password="OK";
$msg ="";
if (noalyss_strlentrim($pass_1) != 0 && noalyss_strlentrim($pass_2) != 0)
{
if ( $g_user->save_password($_POST['pass_1'],$pass_2) )
{
$g_user->password_to_session() ;
} else {
/**
* password not changed
*/
$password="NOK";
$msg="";
if ( $_POST['pass_1'] !== $pass_2) {
$msg = _("Mot de passe ne correspondent pas");
$msg .="
";
}
$a_pass_error=check_password_strength($_POST['pass_1']);
if ( count($a_pass_error['msg']) != 0 ) {
foreach($a_pass_error['msg'] as $pass_error) {
$msg.=$pass_error."
";
}
}
}
}
if ( $inside_dossier)
{
$period=$http->post("period","number");
$g_user->set_periode($period);
}
$g_user->save_global_preference('THEME', $style_user);
$g_user->save_global_preference('LANG', $lang);
$g_user->save_global_preference('PAGESIZE', $p_size);
$g_user->save_global_preference('csv_fieldsep', $csv_fieldsep);
$g_user->save_global_preference('csv_decimal', $csv_decimal);
$g_user->save_global_preference('csv_encoding', $csv_encoding);
$g_user->save_global_preference('first_week_day', $firstday);
$g_user->save_global_preference('vat_code', $vatCode);
$g_user->save_email($p_email);
$_SESSION[SESSION_KEY.'g_theme']=$style_user;
$_SESSION[SESSION_KEY.'g_pagesize']=$p_size;
$_SESSION[SESSION_KEY.'g_lang']=$lang;
$_SESSION[SESSION_KEY.'csv_fieldsep']=$csv_fieldsep;
$_SESSION[SESSION_KEY.'csv_decimal']=$csv_decimal;
$_SESSION[SESSION_KEY.'csv_encoding']=$csv_encoding;
// find the right CSS theme
$style= $repo->get_value("select the_filestyle from theme
where the_name=$1" ,[$style_user]);
if ($style == "")
{
$style = "style-classic7.css";
}
json_response(["style"=>$style,'psw'=>$password,'msg'=>$msg]);
}