News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

unicodeslugs & vmFile::makeSafe function - Solved in 2.0.12f

Started by Digi-web, October 25, 2012, 14:29:01 PM

Previous topic - Next topic

Digi-web

Edit: latest version 2.0.12f addresses the issue so the topic is fixed.

Hello i am trying to solve this for a day or so since i am new to the vm eshop.
Let me describe the problem and the solution here.

When we have $unicodeslugs = '1'; on configuration settings the makeSafe function ( i am talking about the file on: "administrator\components\com_virtuemart\helpers\mediahandler.php" ) works like that

if (JFactory::getConfig()->get('unicodeslugs') == 0){

         $lang = JFactory::getLanguage();
         $str = $lang->transliterate($str);

         if(function_exists('mb_ereg_replace')){
            $regex = array('#(\.){2,}#', '#[^\w\.\- ]#', '#^\.#');
            return mb_ereg_replace($regex, '', $str);
         } else {
            $regex = array('#(\.){2,}#', '#[^A-Za-z0-9\.\_\- ]#', '#^\.#');
            return preg_replace($regex, '', $str);
         }
      } else {
WE ARE IN THIS CASE
         // Remove any duplicate whitespace and replace whitespaces by hyphens
         //$str = preg_replace('#\x20+#', '-', $str);
         return $str = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', " ", $str);
      }

this preg returns the image(string) with the dot striped "." so the hole image uploading isue is messed up badly!

For test just run this one on an empty file...
$str = "newlogo_vermeiren.gif";
$str = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', " ", $str);
echo $str;

I do not know why there is this differentiation for unicode but many of us must use this option for multilingual seo / sites.
I hope next version will have a fix for this!

Edit: forgot to mention: latest joomla 2.7+, latest virtuemart + latest plugins.
behavior tasted in both latest xamp and wamp.
Php v 5.3.5

Could you please delete the post with url:
http://forum.virtuemart.net/index.php?topic=109106.0
It is the same post in the wrong category and no mod has transferred it here after my requests.

Br Alex
Custom Joomla - Virtuemart Development and Templates
Website: http://www.digi-web.gr