New: Add an admin page of PHP sessions with a way to lock new connections for other users than yourself. Can also purge existing sessions.

This commit is contained in:
Laurent Destailleur 2009-09-01 22:20:55 +00:00
parent 20e34d93d7
commit 10002455b0
13 changed files with 344 additions and 23 deletions

View File

@ -41,7 +41,9 @@ For users:
- New: Increase page loading speed (all changes reported by Google PageSpeed
tool has been added).
- New: Add support of constant MAIN_ONLY_LOGIN_ALLOWED to allow to lock all
access to any users axcept the one defined in constant.
access to any users except the one defined in constant.
- New: Add an admin page of PHP sessions with a way to lock new connections
for other users than yourself. Can also purge existing sessions.
- Fix: "Now" link works when date popup is not used.
- Fix: Debug seriously the email notification module.
- Fix: Error Call to a member function trans when refusing a supplier order.

View File

@ -41,7 +41,7 @@ $typeconst=array('yesno','texte','chaine');
*/
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
{
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],1,isset($_POST["constnote"])?$_POST["constnote"]:'',$_POST["entity"]));
if (dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],1,isset($_POST["constnote"])?$_POST["constnote"]:'',$_POST["entity"]) < 0)
{
print $db->error();
}
@ -49,7 +49,7 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
if ($_GET["action"] == 'delete')
{
if (! dolibarr_del_const($db, $_GET["rowid"],$_GET["entity"]));
if (dolibarr_del_const($db, $_GET["rowid"],$_GET["entity"]) < 0)
{
print $db->error();
}

View File

@ -100,7 +100,7 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, "listevents.php","",$sortfield,$sortorder,'',$num,0,'setup');
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup');
if ($_GET["action"] == 'purge')
{

View File

@ -0,0 +1,241 @@
<?php
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/admin/tools/listessions.php
* \ingroup core
* \brief List of PHP sessions
* \version $Id$
*/
require_once("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/admin.lib.php');
if (! $user->admin)
accessforbidden();
// Security check
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$langs->load("companies");
$langs->load("users");
$langs->load("other");
$page=$_GET["page"];
$sortorder=$_GET["sortorder"];
$sortfield=$_GET["sortfield"];
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="dateevent";
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Actions
*/
// Purge sessions
if ($_REQUEST['action'] == 'confirm_purge' && $_REQUEST['confirm'] == 'yes' && $user->admin)
{
$res=purgeSessions(session_id());
}
// Lock new sessions
if ($_REQUEST['action'] == 'confirm_lock' && $_REQUEST['confirm'] == 'yes' && $user->admin)
{
if (dolibarr_set_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', $user->login, 'text',1,'Logon is restricted to a particular user', 0) < 0)
{
dol_print_error($db);
}
}
// Unlock new sessions
if ($_REQUEST['action'] == 'confirm_unlock' && $user->admin)
{
if (dolibarr_del_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', -1) < 0)
{
dol_print_error($db);
}
}
/*
* View
*/
llxHeader();
$form=new Form($db);
$userstatic=new User($db);
$usefilter=0;
$listofsessions=listOfSessions();
print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup');
$savehandler=get_cfg_var("session.save_handler");
$savepath=get_cfg_var("session.save_path");
print '<b>'.$langs->trans("SessionSaveHandler").'</b>: '.$savehandler.'<br>';
print '<b>'.$langs->trans("SessionSavePath").'</b>: '.$savepath.'<br>';
print '<br>';
if ($_GET["action"] == 'purge')
{
$formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeSessions'), $langs->trans('ConfirmPurgeSessions'),'confirm_purge',$formquestion,'no',2);
if ($ret == 'html') print '<br>';
}
if ($_GET["action"] == 'lock')
{
$formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('LockNewSessions'), $langs->trans('ConfirmLockNewSessions',$user->login),'confirm_lock',$formquestion,'no',1);
if ($ret == 'html') print '<br>';
}
if ($savehandler == 'files')
{
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("SessionId"),$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateModification"),$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Age"),$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Raw"),$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre('','','');
print "</tr>\n";
// Lignes des champs de filtre
/*
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_code" value="'.$_GET["search_code"].'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_ip" value="'.$_GET["search_ip"].'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_user" value="'.$_GET["search_user"].'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_desc" value="'.$_GET["search_desc"].'">';
print '</td>';
print '<td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'">';
print '</td>';
print "</tr>\n";
print '</form>';
*/
$var=True;
foreach ($listofsessions as $key => $sessionentry)
{
$var=!$var;
print "<tr $bc[$var]>";
// ID
print '<td align="left" nowrap="nowrap">';
if ("$key" == session_id()) print $form->textwithpicto($key,$langs->trans("YourSession"));
else print $key;
print '</td>';
// Date creation
print '<td align="left" nowrap="nowrap">'.dol_print_date($sessionentry['creation'],'%Y-%m-%d %H:%M:%S').'</td>';
// Date modification
print '<td align="left" nowrap="nowrap">'.dol_print_date($sessionentry['modification'],'%Y-%m-%d %H:%M:%S').'</td>';
// Age
print '<td>'.$sessionentry['age'].'</td>';
// Raw
print '<td>'.dol_trunc($sessionentry['raw'],40,'middle').'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
if (sizeof($listofsessions) == 0)
{
if ($usefilter) print '<tr><td colspan="6">'.$langs->trans("NoSessionsFound").'</td></tr>';
else print '<tr><td colspan="6">'.$langs->trans("NoSessionFound").'</td></tr>';
}
print "</table>";
}
else
{
print $langs->trans("NoSessionListWithThisHandler");
}
/*
* Buttons
*/
print '<div class="tabsAction">';
if (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=lock">'.$langs->trans("LockNewSessions").'</a>';
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=confirm_unlock">'.$langs->trans("UnlockNewSessions").'</a>';
}
if ($savehandler == 'files')
{
if (sizeof($listofsessions))
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("PurgeSessions").'</a>';
}
}
print '</div>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -41,7 +41,9 @@ function llxHeader($head = '', $title='', $help_url='')
$menu->add(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade"),1);
if (function_exists('eaccelerator_info')) $menu->add(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"),1);
$menu->add(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit"),1);
$menu->add(DOL_URL_ROOT."/admin/tools/listsessions.php", $langs->trans("Sessions"),1);
$menu->add(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1);
$menu->add(DOL_URL_ROOT."/support/index.php", $langs->trans("HelpCenter"),1,1,'targethelp');
left_menu($menu->liste, $help_url);
}

View File

@ -32,10 +32,9 @@
/**
\class MenuLeft
\brief Classe permettant la gestion du menu du gauche Auguria
* \class MenuLeft
* \brief Classe permettant la gestion du menu du gauche Auguria
*/
class MenuLeft {
var $require_top=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu du haut particulier

View File

@ -32,10 +32,9 @@
/**
\class MenuLeft
\brief Classe permettant la gestion du menu du gauche Auguria
*/
* \class MenuLeft
* \brief Classe permettant la gestion du menu du gauche Auguria
*/
class MenuLeft {
var $require_top=array("auguria_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu du haut particulier

View File

@ -161,6 +161,7 @@ class MenuLeft {
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade"),1);
if ($leftmenu=="admintools" && function_exists('eaccelerator_info')) $newmenu->add(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/listsessions.php", $langs->trans("Sessions"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/support/index.php", $langs->trans("HelpCenter"),1,1,'targethelp');
}

View File

@ -164,6 +164,7 @@ class MenuLeft {
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade"),1);
if ($leftmenu=="admintools" && function_exists('eaccelerator_info')) $newmenu->add(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/listsessions.php", $langs->trans("Sessions"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1);
if ($leftmenu=="admintools") $newmenu->add(DOL_URL_ROOT."/support/index.php", $langs->trans("HelpCenter"),1,1,'targethelp');
}

View File

@ -7,7 +7,7 @@
-- This file is loaded when a menu handler auguria is activated
--
delete from llx_menu_const where fk_menu in (select rowid from llx_menu where menu_handler='auguria', __ENTITY__);
delete from llx_menu_const where fk_menu in (select rowid from llx_menu where menu_handler='auguria' and entity=__ENTITY__);
delete from llx_menu where menu_handler='auguria';
--
@ -57,8 +57,9 @@ insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`,
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'Upgrade', 1, 'admin', '', '', 2, 2, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools" && function_exists(\'eaccelerator_info\')', 'auguria', 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 3, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 4, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 5, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '', 2, 6, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 5, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 6, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="admintools"', 'auguria', 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '', 2, 7, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values (1, 'auguria', 'left', 400__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="users"', 'auguria', 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$leftmenu=="users"', 'auguria', 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/fiche.php?leftmenu=users&action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__);
@ -98,8 +99,8 @@ insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`,
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->stock->enabled', 'auguria', 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->categorie->enabled', 'auguria', 'left', 3200__+MAX_llx_menu__, 'products', '', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie>lire', '', 2, 4, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->categorie->enabled', 'auguria', 'left', 3201__+MAX_llx_menu__, 'products', '', 3200__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=0', 'NewCat', 1, 'categories', '$user->rights->categorie>creer', '', 2, 0, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->droitpret->enabled', 'auguria', 'left', 4800__+MAX_llx_menu__, 'products', '', 3__+MAX_llx_menu__, '/product/droitpret/index.php?leftmenu=droitpret', 'Droit de pr<EFBFBD>t', 0, 'products', '$user->rights->droitpret->lire', '', 2, 5, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->droitpret->enabled', 'auguria', 'left', 4801__+MAX_llx_menu__, 'products', '', 4800__+MAX_llx_menu__, '/product/droitpret/index.php?leftmenu=droitpret', 'G<EFBFBD>n<EFBFBD>rer rapport', 1, 'products', '$user->rights->droitpret->creer', '', 2, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->droitpret->enabled', 'auguria', 'left', 4800__+MAX_llx_menu__, 'products', '', 3__+MAX_llx_menu__, '/product/droitpret/index.php?leftmenu=droitpret', 'Droit de pret', 0, 'products', '$user->rights->droitpret->lire', '', 2, 5, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->droitpret->enabled', 'auguria', 'left', 4801__+MAX_llx_menu__, 'products', '', 4800__+MAX_llx_menu__, '/product/droitpret/index.php?leftmenu=droitpret', 'Generer rapport', 1, 'products', '$user->rights->droitpret->creer', '', 2, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3300__+MAX_llx_menu__, 'suppliers', '', 4__+MAX_llx_menu__, '/fourn/index.php?leftmenu=suppliers', 'Suppliers', 0, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 0, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3301__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/soc.php?leftmenu=suppliers&action=create&type=f', 'NewSupplier', 1, 'suppliers', '$user->rights->societe->creer && $user->rights->fournisseur->lire', '', 2, 0, __ENTITY__);

View File

@ -18,6 +18,7 @@ LockNewSessions=Lock new connections
ConfirmLockNewSessions=Are you sure you want to restrict any new Dolibarr connection to yourself. Only user <b>%s</b> will be able to connect after that.
UnlockNewSessions=Remove connection lock
YourSession=Your session
Sessions=Users session
HTMLCharset=Charset for generated HTML pages
DBStoringCharset=Database charset to store data
DBSortingCharset=Database charset to sort data

View File

@ -18,6 +18,7 @@ LockNewSessions=Bloquer nouvelles connections
ConfirmLockNewSessions=Etes-vous sur de vouloir restreindre l'accès Dolibarr à votre utilisateur. Seul le login <b>%s</b> pourra se connecter après cela.
UnlockNewSessions=Lever blocage des connections
YourSession=Votre session
Sessions=Sessions utilisateurs
HTMLCharset = Charset des pages HTML générées
DBStoringCharset = Charset base pour stockage données
DBSortingCharset = Charset base pour tri données

View File

@ -297,12 +297,12 @@ function run_sql($sqlfile,$silent=1)
/**
\brief Effacement d'une constante dans la base de donnees
\sa dolibarr_get_const, dolibarr_sel_const
\param db Handler d'acces base
\param name Nom ou rowid de la constante
\param entity Multi company id
\return int <0 si ko, >0 si ok
* \brief Effacement d'une constante dans la base de donnees
* \sa dolibarr_get_const, dolibarr_sel_const
* \param db Handler d'acces base
* \param name Nom ou rowid de la constante
* \param entity Multi company id, -1 for all entities
* \return int <0 if KO, >0 if OK
*/
function dolibarr_del_const($db, $name, $entity=1)
{
@ -310,7 +310,7 @@ function dolibarr_del_const($db, $name, $entity=1)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql.=" WHERE (".$db->decrypt('name',$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey)." = '".addslashes($name)."' OR rowid = '".addslashes($name)."')";
$sql.= " AND entity = ".$entity;
if ($entity >= 0) $sql.= " AND entity = ".$entity;
dol_syslog("admin.lib::dolibarr_del_const sql=".$sql);
$resql=$db->query($sql);
@ -321,6 +321,7 @@ function dolibarr_del_const($db, $name, $entity=1)
}
else
{
$this->error=$db->lasterror();
return -1;
}
}
@ -447,4 +448,76 @@ function security_prepare_head()
return $head;
}
/**
* Return list of session
* @return array Array list of sessions
*/
function listOfSessions()
{
$arrayofSessions = array();
$sessPath = get_cfg_var("session.save_path")."\\";
dol_syslog('admin.lib:listOfSessions sessPath='.$sessPath);
$dh = @opendir($sessPath);
while(($file = @readdir($dh)) !== false)
{
if ($file != "." && $file != "..")
{
$fullpath = $sessPath.$file;
if(! @is_dir($fullpath))
{
$tmp=split('_', $file);
$idsess=$tmp[1];
//print 'file='.$file.' id='.$idsess;
$sessValues = file_get_contents($fullpath); // get raw session data
$arrayofSessions[$idsess]["age"] = time()-filectime( $fullpath );
$arrayofSessions[$idsess]["creation"] = filectime( $fullpath );
$arrayofSessions[$idsess]["modification"] = filemtime( $fullpath );
$arrayofSessions[$idsess]["raw"] = $sessValues;
}
}
}
@closedir($dh);
return $arrayofSessions;
}
/**
* Purge existing sessions
* @param mysessionid To avoid to try to delete my own session
* @return int >0 if OK, <0 if KO
*/
function purgeSessions($mysessionid)
{
$arrayofSessions = array();
$sessPath = get_cfg_var("session.save_path")."\\";
dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath);
$error=0;
$dh = @opendir($sessPath);
while(($file = @readdir($dh)) !== false)
{
if ($file != "." && $file != "..")
{
$fullpath = $sessPath.$file;
if(! @is_dir($fullpath))
{
$tmp=split('_', $file);
$idsess=$tmp[1];
// We remove session if it's not ourself
if ($idsess != $mysessionid)
{
$res=@unlink($fullpath);
if (! $res) $error++;
}
}
}
}
@closedir($dh);
if (! $error) return 1;
else return -$error;
}
?>