Changeset 163

Show
Ignore:
Timestamp:
17/01/06 15:52:17 (3 years ago)
Author:
rollercow
Message:

Fixes #32
makeCleanString was striping out vaid _ in short subjects

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • admin.lib.php

    r162 r163  
    233233                if (!$this->error) { 
    234234                        //first we make our short subject 
    235                         $shortsubject = $this->blog->makeCleanString($subject); 
     235                        $shortsubject = $this->blog->makeCleanString($subject,true); 
    236236                        //need to check if there are any short titles like this one already 
    237237                        $sql = db_query("SELECT shortsubject FROM entries WHERE user_id = {$this->id} AND shortsubject ~ '{$shortsubject}(_[0-9]{1,3}$|$)' ORDER BY char_length(shortsubject) DESC, shortsubject DESC LIMIT 1;"); 
     
    354354                } 
    355355        } 
    356  
     356/*      currently not used.. if we dont want to bring back the delete link in printEntry from blog.lib we can get rid of this entirely 
     357         
    357358        //delete an entry 
    358359        function deleteEntry($shortSubject) 
     
    376377                } 
    377378        } 
    378  
     379*/ 
    379380        //update settings 
    380381        function updateSettings() 
  • blog.lib.php

    r162 r163  
    314314 
    315315        //takes a string and strips it, making it safe to put in a URL 
    316         function makeCleanString($string) 
    317         { 
     316        function makeCleanString($string,$externalSource=false) 
     317        { 
     318                //externalSource meaning directly inputed by a user, in most cases this should be false.. appart from starting a new post 
    318319                $string = strtolower($string); 
    319320                $string = preg_replace("/[^a-z0-9\- _]/i", "", $string); 
    320321                $string = str_replace(" ", "-",trim($string)); 
    321                 $string = str_replace("_", "-",$string); 
     322                if ($externalSource) { 
     323                        $string = str_replace("_", "-",$string); 
     324                } 
    322325                $string = urlencode($string); 
    323326                return $string;