From b1c5e25b5e4eed872230ebffe72cc7ece4533ee2 Mon Sep 17 00:00:00 2001 From: plegall Date: Sun, 18 Sep 2005 21:56:56 +0000 Subject: - bug 107 fixed: crash when logging visit on a category containing "'" character. Correction reported from branch 1.4 - bug fixed: in admin/stats, incorrect SQL queries gave no result. git-svn-id: http://piwigo.org/svn/trunk@868 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/stats.php | 11 ++++++----- doc/ChangeLog | 10 +++++++++- include/functions.inc.php | 8 ++++---- language/en_UK.iso-8859-1/admin.lang.php | 2 +- language/fr_FR.iso-8859-1/admin.lang.php | 2 +- template/yoga/admin/stats.tpl | 23 +++++++++++------------ 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/admin/stats.php b/admin/stats.php index 61e3fbe39..5e823a38d 100644 --- a/admin/stats.php +++ b/admin/stats.php @@ -80,8 +80,11 @@ while ( $row = mysql_fetch_array( $result ) ) $value = ''; if (isset($_GET['month']) && isset($_GET['year']) ) { - $where_clause = "DATE_FORMAT(date,'%Y-%m-%d') = '".$row['d']."'"; - $value = substr($row['d'],8,2); + $where_clause = 'DAYOFMONTH(date) = '.$row['d'].' + AND MONTH(date) = '.$row['m'].' + AND YEAR(date) = '.$row['y']; + $week_day = $lang['day'][date('w', mktime(12,0,0,$row['m'],$row['d'],$row['y']))]; + $value = $row['d'].' ('.$week_day.')'; } else { @@ -97,12 +100,10 @@ while ( $row = mysql_fetch_array( $result ) ) // Number of pictures seen $query = ' -SELECT COUNT(*) as p, - FILE as f +SELECT COUNT(*) as p FROM '.HISTORY_TABLE.' WHERE '.$where_clause.' AND FILE = \'picture\' - GROUP BY FILE ;'; $pictures = mysql_fetch_array(pwg_query( $query )); diff --git a/doc/ChangeLog b/doc/ChangeLog index de2210587..71a0b075d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,14 @@ 2005-09-18 Pierrick LE GALL - * bug 101 fixed: correction reported from branch 1.4 + * bug 107 fixed: crash when logging visit on a category containing + "'" character. Correction reported from branch 1.4 + + * bug fixed: in admin/stats, incorrect SQL queries gave no result. + +2005-09-18 Pierrick LE GALL + + * bug 101 fixed: "problem with IE search on keywords". correction + reported from branch 1.4 2005-09-17 Pierrick LE GALL diff --git a/include/functions.inc.php b/include/functions.inc.php index 5fb2fc263..ae5f46415 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -359,11 +359,11 @@ INSERT INTO '.HISTORY_TABLE.' (date,login,IP,file,category,picture) VALUES (NOW(), - \''.(($user['id'] == 2) ? 'guest' : $user['username']).'\', + \''.(($user['id'] == 2) ? 'guest' : addslashes($user['username'])).'\', \''.$_SERVER['REMOTE_ADDR'].'\', - \''.$file.'\', - \''.$category.'\', - \''.$picture.'\') + \''.addslashes($file).'\', + \''.addslashes($category).'\', + \''.addslashes($picture).'\') ;'; pwg_query($query); } diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index 65b4a56cb..df7c0e5f1 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -333,6 +333,6 @@ $lang['user_status_guest'] = 'User'; $lang['username'] = 'username'; $lang['users'] = 'Users'; $lang['visitors'] = 'Visitors'; -$lang['w_day'] = 'w_day'; +$lang['w_day'] = 'Day'; $lang['waiting'] = 'Waiting'; ?> \ No newline at end of file diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index 012c12f0f..0644414df 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -331,6 +331,6 @@ $lang['user_status_guest'] = 'Visiteur'; $lang['username'] = 'nom utilisateur'; $lang['users'] = 'Utilisateurs'; $lang['visitors'] = 'Visiteurs'; -$lang['w_day'] = 'jour de la semaine'; +$lang['w_day'] = 'Jour'; $lang['waiting'] = 'En attente'; ?> \ No newline at end of file diff --git a/template/yoga/admin/stats.tpl b/template/yoga/admin/stats.tpl index dbfa667a6..da0fff82d 100644 --- a/template/yoga/admin/stats.tpl +++ b/template/yoga/admin/stats.tpl @@ -2,23 +2,22 @@

{lang:title_history}

{L_STAT_TITLE}

-{L_STAT_MONTHLY_ALT} +{L_STAT_MONTHLY_ALT} +

{L_STAT_MONTH_TITLE}

- - - + + - - - - - - + + + + + + - +
{L_MONTH}{L_PAGES_SEEN}{L_VALUE}{L_PAGES_SEEN} {L_VISITORS} {L_PICTURES}
{month.MONTH}{month.PAGES}{month.VISITORS}{month.IMAGES}
{statrow.VALUE}{statrow.PAGES}{statrow.VISITORS}{statrow.IMAGES}
-
-- cgit v1.2.3