Changeset 1648

Show
Ignore:
Timestamp:
01/02/07 14:24:57 (20 months ago)
Author:
mbonetti
Message:

More uniform handling of UTF-8 uri generation. Will probably need better
filtering in rss_uri(). Fix for #150, too.

Location:
trunk/gregarius
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/cls/channels.php

    r1644 r1648  
    9090            //$this->rlink = getPath().preg_replace("/[^a-zA-Z0-9_]/", "_", $title)."/"; 
    9191            /* EXPERIMENTAL! */ 
    92             $this->rlink = getPath() . utf8_uri_encode(preg_replace('/[\s&\/\+]/','_',$title)) . "/"; 
     92            $this->rlink = getPath(rss_uri($title)) . "/"; 
    9393        } else { 
    9494            $this->rlink = getPath()."feed.php?channel=$id"; 
  • trunk/gregarius/cls/items.php

    r1561 r1648  
    7373            $this->title = "[nt]"; 
    7474        } 
    75         $this->escapedTitle = preg_replace("/[^A-Za-z0-9%\.]/", "_", utf8_uri_encode($title)); 
     75        $this->escapedTitle = rss_uri($title); //preg_replace("/[^A-Za-z0-9%\.]/", "_", utf8_uri_encode($title)); 
     76         
    7677        $this->url = trim($url); 
    7778        $this->enclosure = $enclosure; 
     
    136137            $this->iconUrl = $icon; 
    137138        } 
    138         $this->escapedTitle = preg_replace("/[^A-Za-z0-9\.]/", "_", $title); 
     139        //$this->escapedTitle = preg_replace("/[^A-Za-z0-9\.]/", "_", $title); 
     140        $this->escapedTitle = rss_uri($title); 
    139141    }  
    140142     
  • trunk/gregarius/feed.php

    r1561 r1648  
    914914    $prev = $succ = $up = null; 
    915915    if (isset($_REQUEST['channel'])) { 
    916         $escaped_title = preg_replace("/[^A-Za-z0-9\.]/","_",$_REQUEST['channel']); 
     916        $escaped_title = rss_uri($_REQUEST['channel']); //preg_replace("/[^A-Za-z0-9\.]/","_",$_REQUEST['channel']); 
    917917    } else { 
    918918        $escaped_title = null; 
     
    11251125                                    'url' =>  makeArchiveUrl($pts_,$escaped_title,$cid,true) 
    11261126                                           . (getConfig('rss.output.usemodrewrite') ? 
    1127                                               preg_replace("/[^A-Za-z0-9\.%]/","_",utf8_uri_encode($ptitle_)): 
     1127                                              rss_uri($ptitle_): 
    11281128                                              "&iid=$piid_"), 
    11291129                                    'lbl' => htmlentities( $ptitle_,ENT_COMPAT,"UTF-8" ) 
     
    11431143                                    'url' =>  makeArchiveUrl($ts_,$escaped_title,$cid,true) 
    11441144                                           . (getConfig('rss.output.usemodrewrite') ? 
    1145                                               preg_replace("/[^A-Za-z0-9\.%]/","_",utf8_uri_encode($title_)) : 
     1145                                              rss_uri($title_) : 
    11461146                                              "&iid=$iid_"), 
    11471147                                    'lbl' => htmlentities($title_,ENT_COMPAT,"UTF-8") 
     
    12061206                                'url' => getPath(). 
    12071207                                       ( getConfig('rss.output.usemodrewrite') ? 
    1208                                          preg_replace("/[^A-Za-z0-9\.]/","_",$title_) ."/" 
     1208                                         rss_uri($title_) ."/" 
    12091209                                         :"feed.php?channel=$cid_") , 
    12101210                                'lbl' => htmlentities( $title_,ENT_COMPAT,"UTF-8" ) 
     
    12161216                                'url' => getPath(). 
    12171217                                       ( getConfig('rss.output.usemodrewrite') ? 
    1218                                          preg_replace("/[^A-Za-z0-9\.]/","_",$title_) ."/" 
     1218                                         rss_uri($title_) ."/" 
    12191219                                         :"feed.php?channel=$cid_") , 
    12201220                                'lbl' => htmlentities( $title_,ENT_COMPAT,"UTF-8" ) 
     
    12551255                            'url' => getPath(). 
    12561256                                   ( getConfig('rss.output.usemodrewrite') ? 
    1257                                      preg_replace("/[^A-Za-z0-9\.]/","_",$vftitle_) ."/" 
     1257                                     rss_uri($vftitle_) ."/" 
    12581258                                     :"feed.php?vfolder=$vfid_") , 
    12591259                            'lbl' => htmlentities( $vftitle_,ENT_COMPAT,"UTF-8" ) 
     
    12671267                            'url' => getPath(). 
    12681268                                   ( getConfig('rss.output.usemodrewrite') ? 
    1269                                      preg_replace("/[^A-Za-z0-9\.]/","_",$vftitle_) ."/" 
     1269                                     rss_uri($vftitle_) ."/" 
    12701270                                     :"feed.php?vfolder=$vfid_") , 
    12711271                            'lbl' => htmlentities( $vftitle_,ENT_COMPAT,"UTF-8" ) 
     
    13181318                            'url' => getPath(). 
    13191319                                   ( getConfig('rss.output.usemodrewrite') ? 
    1320                                      preg_replace("/[^A-Za-z0-9\.]/","_",$ftitle__) ."/" 
     1320                                     rss_uri($ftitle__) ."/" 
    13211321                                     :"feed.php?folder=$fid__") , 
    13221322                            'lbl' => htmlentities( $ftitle__,ENT_COMPAT,"UTF-8" ) 
     
    13301330                            'url' => getPath(). 
    13311331                                   ( getConfig('rss.output.usemodrewrite') ? 
    1332                                      preg_replace("/[^A-Za-z0-9\.]/","_",$ftitle__) ."/" 
     1332                                    rss_uri($ftitle__) ."/" 
    13331333                                     :"feed.php?folder=$fid__") , 
    13341334                            'lbl' => htmlentities( $ftitle__,ENT_COMPAT,"UTF-8" ) 
  • trunk/gregarius/util.php

    r1644 r1648  
    11561156} 
    11571157 
     1158function rss_uri($title, $sep='_') { 
     1159    return utf8_uri_encode(preg_replace('#[\s&/\+\'"\?]#',$sep,$title)); 
     1160} 
    11581161?>