aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install/db/65-database.php5
-rw-r--r--picture.php4
-rw-r--r--template/yoga/picture.tpl2
-rw-r--r--upgrade.php12
-rw-r--r--upgrade_feed.php12
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(
<input type="submit" name="rate" value="{$mark}" class="rateButton" />
{/if}
{/foreach}
- <script type="text/javascript" src="{$ROOT_URL}{$themeconf.template_dir}/rating.js"></script>
+ <script type="text/javascript" src="{$ROOT_URL}template/{$themeconf.template}/rating.js"></script>
<script type="text/javascript">
makeNiceRatingForm( {ldelim}rootUrl: '{$ROOT_URL|@escape:"javascript"}', image_id: {$current.id},
updateRateText: "{'update_rate'|@translate|@escape:'javascript'}", updateRateElement: document.getElementById("updateRate"),
diff --git a/upgrade.php b/upgrade.php
index 73cf376ee..67cfce745 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -40,10 +40,14 @@ include_once(PHPWG_ROOT_PATH.'include/constants.php');
define('PREFIX_TABLE', $prefixeTable);
// Database connection
-mysql_connect( $cfgHote, $cfgUser, $cfgPassword )
-or die ( "Could not connect to database server" );
-mysql_select_db( $cfgBase )
-or die ( "Could not connect to database" );
+mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or die ( "Could not connect to database server" );
+mysql_select_db( $cfgBase ) or die ( "Could not connect to database" );
+if ( version_compare(mysql_get_server_info(), '4.1.0', '>=')
+ and defined('DB_CHARSET') and DB_CHARSET!='' )
+{
+ pwg_query('SET NAMES "'.DB_CHARSET.'"');
+}
+
// +-----------------------------------------------------------------------+
// | tricky output |
// +-----------------------------------------------------------------------+
diff --git a/upgrade_feed.php b/upgrade_feed.php
index 44ccbe5db..f50b69433 100644
--- a/upgrade_feed.php
+++ b/upgrade_feed.php
@@ -42,10 +42,14 @@ define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db');
// | Database connection |
// +-----------------------------------------------------------------------+
-mysql_connect($cfgHote, $cfgUser, $cfgPassword)
-or die("Could not connect to database server");
-mysql_select_db($cfgBase)
-or die("Could not connect to database");
+mysql_connect($cfgHote, $cfgUser, $cfgPassword) or die("Could not connect to database server");
+mysql_select_db($cfgBase) or die("Could not connect to database");
+if ( version_compare(mysql_get_server_info(), '4.1.0', '>=')
+ and defined('DB_CHARSET') and DB_CHARSET!='' )
+{
+ pwg_query('SET NAMES "'.DB_CHARSET.'"');
+}
+
// +-----------------------------------------------------------------------+
// | Upgrades |