diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 5237c8e89d1..b3d70467b75 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,14 +22,14 @@ \brief List of security events \version $Id$ */ - + require_once("./pre.inc.php"); if (! $user->admin) accessforbidden(); // Sécurité accés client -if ($user->societe_id > 0) +if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; @@ -103,7 +103,7 @@ if ($result) $form->form_confirm($_SERVER["PHP_SELF"], $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge'); print '
'; } - + print ''; print ''; print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder); @@ -140,7 +140,7 @@ if ($result) print ''; - + print "\n"; print ''; @@ -149,11 +149,11 @@ if ($result) while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object(); - + $var=!$var; print ""; - + // Date print ''; @@ -175,14 +175,22 @@ if ($result) print ''; // Description - print ''; - + print ''; + print ''; print "\n"; $i++; } - + if ($num == 0) { if ($usefilter) print ''; @@ -190,7 +198,7 @@ if ($result) } print "
'; print ''; print '
'.dolibarr_print_date($obj->dateevent,'%Y-%m-%d %H:%M:%S').''.$obj->description.''; + $text=$langs->trans($obj->description); + if (eregi('\((.*)\)',$obj->description,$reg)) + { + $val=split(',',$reg[1]); + $text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:''); + } + print $text; + print ' 
'.$langs->trans("NoEventFoundWithCriteria").'
"; $db->free(); - + if ($num && $_GET["action"] != 'purge') { print '
'; diff --git a/htdocs/includes/triggers/interface_all_Logevents.class.php b/htdocs/includes/triggers/interface_all_Logevents.class.php index 3a30c02230c..62787065727 100644 --- a/htdocs/includes/triggers/interface_all_Logevents.class.php +++ b/htdocs/includes/triggers/interface_all_Logevents.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,28 +17,27 @@ */ /** - \file htdocs/includes/triggers/interface_all_Logevents.class.php - \ingroup core - \brief Trigger file for - \version $Id$ + * \file htdocs/includes/triggers/interface_all_Logevents.class.php + * \ingroup core + * \brief Trigger file for + * \version $Id$ */ /** - \class InterfaceLogevents - \brief Classe des fonctions triggers des actions agenda -*/ - + * \class InterfaceLogevents + * \brief Classe des fonctions triggers des actions agenda + */ class InterfaceLogevents { var $db; var $error; - + var $date; var $duree; var $texte; var $desc; - + /** * \brief Constructeur. * \param DB Handler d'acces base @@ -46,7 +45,7 @@ class InterfaceLogevents function InterfaceLogevents($DB) { $this->db = $DB ; - + $this->name = eregi_replace('^Interface','',get_class($this)); $this->family = "core"; $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; @@ -61,7 +60,7 @@ class InterfaceLogevents { return $this->name; } - + /** * \brief Renvoi descriptif du lot de triggers * \return string Descriptif du lot de triggers @@ -103,35 +102,33 @@ class InterfaceLogevents $key='MAIN_LOGEVENTS_'.$action; //dolibarr_syslog("xxxxxxxxxxx".$key); if (empty($conf->global->$key)) return 0; // Log events not enabled for this action - + // Actions if ($action == 'USER_LOGIN') { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - + // Initialisation donnees (date,duree,texte,desc) $this->date=time(); $this->duree=0; - $this->texte=$langs->transnoentities("UserLogged",$object->login); - $this->desc=$langs->transnoentities("UserLogged",$object->login); - } + $this->texte="(UserLogged,".$object->login.")"; + $this->desc="(UserLogged,".$object->login.")"; + } if ($action == 'USER_LOGIN_FAILED') { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); - + // Initialisation donnees (date,duree,texte,desc) $this->date=time(); $this->duree=0; $this->texte=$object->trigger_mesg; // Message direct $this->desc=$object->trigger_mesg; // Message direct - } + } if ($action == 'USER_CREATE') { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); - + // Initialisation donnees (date,duree,texte,desc) $this->date=time(); $this->duree=0; @@ -255,7 +252,7 @@ class InterfaceLogevents { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("other"); - + // Initialisation donnees (date,duree,texte,desc) $this->date=time(); $this->duree=0; @@ -337,7 +334,7 @@ class InterfaceLogevents $this->desc=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); $this->desc.="\n".$langs->transnoentities("Author").': '.$user->login; } - + // Invoices elseif ($action == 'BILL_VALIDATE') { @@ -500,7 +497,7 @@ class InterfaceLogevents if ($this->date) { include_once(DOL_DOCUMENT_ROOT.'/core/events.class.php'); - + $event=new Events($this->db); $event->type=$action; $event->dateevent=$this->date; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b0d0f78ae25..6672a5acb5f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -309,7 +309,6 @@ if (! isset($_SESSION["dol_login"])) session_name($sessionname); session_start(); - $langs->load('main'); if ($resultFetchUser == 0) { $langs->load('main'); @@ -350,7 +349,6 @@ else session_name($sessionname); session_start(); - $langs->load('main'); if ($resultFetchUser == 0) { $langs->load('main'); @@ -901,13 +899,13 @@ function left_menu($menu_array, $helppagename='', $form_search='') { print $form_search; } - + // Zone d'affichage permanente des marque pages if ($conf->bookmark->enabled && $user->rights->bookmark->lire) { include_once (DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'); $langs->load("bookmarks"); - + $ret=printBookmarksList($db, $langs); print "\n"; print "\n"; diff --git a/htdocs/pre.inc.php b/htdocs/pre.inc.php index 3800d3e723a..2679a378642 100644 --- a/htdocs/pre.inc.php +++ b/htdocs/pre.inc.php @@ -69,8 +69,8 @@ function llxHeader($head = "") if ($user->rights->propale->lire) { - $langs->load("propal"); - $menu->add_submenu(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop")); + $langs->load("propal"); + $menu->add_submenu(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop")); } } diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index a3a5dc3df90..aef468f6887 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -167,7 +167,7 @@ class Translate { /** * \brief Load in a memory array, translation key-value for a particular file. * If data for file already loaded, do nothing. - * All data in translation array are stored in ISO-8859-1 format. + * All data in translation array are stored in UTF-8 format. * \param domain File name to load (.lang file). Use @ before value if domain is in a module directory. * \param alt Use alternate file even if file in target language is found * \return int <0 if KO, >0 if OK @@ -176,7 +176,7 @@ class Translate { */ function Load($domain,$alt=0) { - // dolibarr_syslog("Translate::Load domain=".$domain." alt=".$alt); + dolibarr_syslog("Translate::Load domain=".$domain." alt=".$alt); // Check parameters if (empty($domain)) @@ -303,6 +303,16 @@ class Translate { } + /** + * \brief Mark domain as not loaded to be able to load it again. + * \param domain File name to load (.lang file). Use @ before value if domain is in a module directory. + */ + function UnLoad($domain) + { + dolibarr_syslog("Translate::UnLoad domain=".$domain." marked as not loaded", LOG_DEBUG); + $this->tab_loaded[$domain]=0; + } + /** * \brief Retourne la liste des domaines charg�es en memoire * \return array Tableau des domaines charg�es diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 1c336631f76..b286308d481 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -1086,15 +1086,15 @@ class User extends CommonObject */ function update_last_login_date() { - dolibarr_syslog ("Mise a jour date derniere connexion pour user->id=".$this->id); - - $now=time(); + $now=gmmktime(); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; $sql.= " datepreviouslogin = datelastlogin,"; $sql.= " datelastlogin = ".$this->db->idate($now).","; $sql.= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion $sql.= " WHERE rowid = ".$this->id; + + dolibarr_syslog ("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) {