Changeset 114


Ignore:
Timestamp:
03/28/2009 09:29:36 PM (3 years ago)
Author:
ofer
Message:

the return of utf8 decode for #24 ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh_db.php

    r102 r114  
    1919 
    2020/** 
    21  * Contains db realated function which are likely to be specific for each environment.  
     21 * Contains db realated function which are likely to be specific for each environment. 
    2222 * This implementation for use with mysql within wordpress 
    23  *  
     23 * 
    2424 */ 
    2525 
     
    9898} 
    9999 
     100/* 
     101* Helper function for annoying strings from php escape (%u2019) 
     102*/ 
     103function utf8_urldecode($str) { 
     104    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str)); 
     105    return html_entity_decode($str,null,'UTF-8');; 
     106} 
    100107 
    101108/* 
     
    108115        $ref=getenv('HTTP_REFERER'); 
    109116        $original =  base64_url_decode($_POST['token']); 
    110         $translation = $_POST['translation']; 
     117        $translation = utf8_urldecode($_POST['translation']); 
    111118        $lang = $_POST['lang']; 
    112119        $source = $_POST['source']; 
     
    123130                logger("Unauthorized translation attempt " . $_SERVER['REMOTE_ADDR'] , 1); 
    124131        } 
    125          
     132 
    126133        $table_name = $wpdb->prefix . TRANSLATIONS_TABLE; 
    127          
     134 
    128135        //Decode & remove already escaped character to avoid double escaping 
    129136        $translation = $wpdb->escape(htmlspecialchars(stripslashes(urldecode($translation)))); 
Note: See TracChangeset for help on using the changeset viewer.