Dotclear

Changeset 2858:6f06ad9c208a for inc


Ignore:
Timestamp:
12/17/14 12:54:19 (11 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.7
Message:

Less dirty hack for URLs used as format with (s)printf() functions.

Location:
inc/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.dc.adminurl.php

    r2852 r2858  
    7373      * @param  boolean $urlencode set to true if url may not be encoded 
    7474      * @param  string $separator separator to use between QS parameters 
     75      * @param  boolean $parametric set to true if url will be used as (s)printf() format. 
    7576      * @return string            the forged url 
    7677      */ 
    77      public function get($name,$params=array(),$separator='&amp;') 
     78     public function get($name,$params=array(),$separator='&amp;',$parametric=false) 
    7879     { 
    7980          if (!isset($this->urls[$name])) { 
     
    8687               $u .= '?'.http_build_query($p,'',$separator); 
    8788          } 
    88           return $u; 
     89          // Dirty hack to get back %s instead of %25s in URLs used with (s)printf(), as http_build_query urlencode() its result. 
     90          return $parametric ? str_replace('%25s','%s',$u) : $u; 
    8991     } 
    90  
    9192 
    9293     /** 
     
    106107          http::redirect($this->get($name,$params,'&').$suffix); 
    107108     } 
    108  
    109109 
    110110     /** 
     
    145145     } 
    146146 
    147  
    148  
    149147     /** 
    150148      * retrieves a URL (decoded — useful for echoing) given its name, and optional parameters 
    151149      * 
    152       * should be used carefully, parameters are no more escaped 
     150      * @deprecated      should be used carefully, parameters are no more escaped 
    153151      * 
    154152      * @param  string $name      URL Name 
  • inc/admin/lib.pager.php

    r2852 r2858  
    214214     { 
    215215          if ($this->core->auth->check('categories',$this->core->blog->id)) { 
    216                $cat_link = '<a href="'.$this->core->adminurl->get('admin.category',array('id' => '%s')).'">%s</a>'; 
    217                $cat_link = str_replace('%25s','%s',$cat_link); 
     216               $cat_link = '<a href="'.$this->core->adminurl->get('admin.category',array('id' => '%s'),'&amp;',true).'">%s</a>'; 
    218217          } else { 
    219218               $cat_link = '%2$s'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map