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} - +