Jan 09, 2009 | 04:14 PM  
Welcome

Don't have an account yet? You can create one, it is free, just click here

as a registered user you have some advantages like free downloads, comments and posting on our forums, depending upon this site's configuration and options.

 • •  Control Panel - Register - Login  • • 
Current Stable MDPro Lite 1.0821 Download
  Forum FAQForum FAQ   SearchSearch  UsergroupsUsergroups  PreferencesPreferences  Options forumOptions forum  Watched TopicsWatched Topics  Watched ForumsWatched Forums
Latest forum posts Latest forum posts  Log in to check your private messages Log in to check your private messages    Log inLog in 
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Wiseman
MD user level 5
MD user level 5


Joined: Mar 15, 2005
Posts: 103
Location: Spain
Member
Post  Posted: Aug 23, 2007 - 11:27 PM Reply with quote Back to top
Post subject: Fix for AutoTheme/render and UTF-8 (MDLite & MDP 1.07x)

This is a fix a condition where AutoTheme wouldn't detect the blocks (e.g. md_blocks) table has been properly updated when the MySQL table used the UTF-8 character set/encoding. This happened because MySQL reports 3*255 as $field->max_length, not 255.

For MDPro 1.07x: Replace this function in modules/AutoTheme/includes/md-pro/atAdmin.php
For MDLite: Replace this function in modules/Autorender/includes/atExtended.php

Code:
function AutoThemeCheckTable()
{
   list($dbconn) = pnDBGetConn();
   $pntable =& pnDBGetTables();
   $column = &$pntable['blocks_column'];

   $sql = "SELECT $column[position] FROM $pntable[blocks]";
   $result = $dbconn->SelectLimit($sql,1);

   $field = $result->FetchField(0);
//BEGIN AUTOTHEME-BLOCKS TABLE DETECTION-FIX
   if ($field->max_length >= 255) {
//END AUTOTHEME-BLOCKS TABLE DETECTION-FIX
      return true;
   }
   else {
      return false;
   }
}


Rationale: The function was checking for $field->max_length == 255, a sign that the table has been updated to hold the allowable values for block positions (now strings). MySQL (possibly wrongly) returns this size in octets, not characters. Since MySQL supports just UCS-2, its longest UTF-8 character spans over 3 octets, and the maximum octet count for a 255 character UTF-8 string is 255 * 3 = 765 octets. This patch changes this line to check whether the field maximum length is equal or greater than 255, which fits AutoTheme's purpose and works with MySQL in both UTF-8 and legacy character sets/encodings, as well as other databases.
View user's profile Visit poster's website
TiMax
Project Manager
Project Manager


Joined: July 31, 2003
Posts: 1560
Location: Quebec - Canada

Post  Posted: Aug 25, 2007 - 12:20 AM Reply with quote Back to top

Thanks man, we will check it to include your contribution with MDPro 1.082

_________________
TiMaxMAX s.o.s.Fantasia e dinamicità Italiane, qualità e servizi Canadesi Web Services, hosting ed housing professionali
View user's profile Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:     
Jump to:  
All times are GMT + 13 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by MDForum 2.0.8© 2003-2007 MAXdev Team
Credits