From 26474d349f6f03b3f74beb91ef680f0c634e05d5 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 9 Sep 2008 01:16:32 +0000 Subject: - fix issue when picture_url_style = file (sql query like) - sql call SET NAMES "xxx" (if required) in upgrade.php, upgrade_feed.php and after 65-database.php git-svn-id: http://piwigo.org/svn/trunk@2512 68402e56-0260-453c-a942-63ccdbb3a9ee --- install/db/65-database.php | 5 +++++ picture.php | 4 +++- template/yoga/picture.tpl | 2 +- upgrade.php | 12 ++++++++---- upgrade_feed.php | 12 ++++++++---- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/install/db/65-database.php b/install/db/65-database.php index daa59de30..0381f0ac3 100644 --- a/install/db/65-database.php +++ b/install/db/65-database.php @@ -298,6 +298,11 @@ define(\'DB_COLLATE\', \'\'); define('DB_CHARSET', $db_charset); define('DB_COLLATE', ''); + if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') and DB_CHARSET!='' ) + { + pwg_query('SET NAMES "'.DB_CHARSET.'"'); + } + echo $upgrade_log; $fp = @fopen( PHPWG_ROOT_PATH.'upgrade65.log', 'w' ); if ($fp) diff --git a/picture.php b/picture.php index 6126a307e..31a53cbde 100644 --- a/picture.php +++ b/picture.php @@ -52,7 +52,9 @@ SELECT id, file, level else {// url given by file name assert( !empty($page['image_file']) ); - $query .= 'file LIKE "' . $page['image_file'] . '.%" ESCAPE "|" LIMIT 1'; + $query .= 'file LIKE "' . + str_replace(array('_','%'), array('/_','/%'), $page['image_file'] ). + '.%" ESCAPE "/" LIMIT 1'; } if ( ! ( $row = mysql_fetch_array(pwg_query($query)) ) ) {// element does not exist diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index 9ba9d6ffa..e86e24ee9 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -209,7 +209,7 @@ y.callService( {/if} {/foreach} - +