From f30455c6ff6543519c88242154e915de59928eb6 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 1 Feb 2005 07:29:37 +0000 Subject: [PATCH] - bug fixed : when a user is the guest user, login saved in history table is "guest" and not the localized version of guest username git-svn-id: http://piwigo.org/svn/trunk@725 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/include/functions.inc.php b/include/functions.inc.php index 457fa0a82..77be51606 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -333,14 +333,20 @@ function pwg_log( $file, $category, $picture = '' ) { global $conf, $user; - if ( $conf['log'] ) + if ($conf['log']) { - $query = 'insert into '.HISTORY_TABLE; - $query.= ' (date,login,IP,file,category,picture) values'; - $query.= " (NOW(), '".$user['username']."'"; - $query.= ",'".$_SERVER['REMOTE_ADDR']."'"; - $query.= ",'".$file."','".$category."','".$picture."');"; - pwg_query( $query ); + $query = ' +INSERT INTO '.HISTORY_TABLE.' + (date,login,IP,file,category,picture) + VALUES + (NOW(), + \''.(($user['id'] == 2) ? 'guest' : $user['username']).'\', + \''.$_SERVER['REMOTE_ADDR'].'\', + \''.$file.'\', + \''.$category.'\', + \''.$picture.'\') +;'; + pwg_query($query); } }