public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
Fixed unique_filename() not considering sub-paths. [#201 state:resolved]
vito (author)
Mon Sep 01 14:03:14 -0700 2008
commit  0de5ec72717d55085c730364f6b1c499e98e43b2
tree    747b8440e3c658021bc25a20e80b6a85db2f4047
parent  0a83e618df461db5a1dc6aedf397251ee67fcbf7
...
733
734
735
736
 
737
738
739
...
752
753
754
755
 
756
757
758
 
759
760
761
...
805
806
807
808
 
809
810
811
...
733
734
735
 
736
737
738
739
...
752
753
754
 
755
756
757
 
758
759
760
761
...
805
806
807
 
808
809
810
811
0
@@ -733,7 +733,7 @@
0
    * Returns:
0
    *     $name - A unique version of the given $name.
0
    */
0
-  function unique_filename($name, $num = 2) {
0
+  function unique_filename($name, $path = "", $num = 2) {
0
     if (!file_exists(MAIN_DIR.Config::current()->uploads_path.$name))
0
       return $name;
0
 
0
@@ -752,10 +752,10 @@
0
     $ext = ".".array_pop($name);
0
 
0
     $try = implode(".", $name)."-".$num.$ext;
0
-    if (!file_exists(MAIN_DIR.Config::current()->uploads_path.$try))
0
+    if (!file_exists(MAIN_DIR.Config::current()->uploads_path.$path.$try))
0
       return $try;
0
 
0
-    return unique_filename(implode(".", $name).$ext, $num + 1);
0
+    return unique_filename(implode(".", $name).$ext, $path, $num + 1);
0
   }
0
 
0
   /**
0
@@ -805,7 +805,7 @@
0
     array_pop($file_split);
0
     $file_clean = implode(".", $file_split);
0
     $file_clean = sanitize($file_clean, false).".".$file_ext;
0
-    $filename = unique_filename($file_clean);
0
+    $filename = unique_filename($file_clean, $path);
0
 
0
     $message = __("Couldn't upload file. CHMOD <code>".MAIN_DIR.Config::current()->uploads_path."</code> to 777 and try again. If this problem persists, it's probably timing out; in which case, you must contact your system administrator to increase the maximum POST and upload sizes.");
0
     if ($put) {
...
2
3
4
5
 
 
 
 
6
7
8
...
2
3
4
 
5
6
7
8
9
10
11
0
@@ -2,7 +2,10 @@
0
 
0
 {% block content %}
0
     {% for tag in tag_cloud %}
0
-    {% if loop.first %}<h1>${ "Tag Maelstrom" | translate }</h1>{% endif %}
0
+    {% if loop.first %}
0
+    <h1>${ "Tag Maelstrom" | translate }</h1>
0
+    <br />
0
+    {% endif %}
0
     <a class="tag" href="$tag.url" style="font-size: $tag.size%" title="$tag.title">$tag.name</a>
0
     {% else %}
0
     <h1>${ "No Tags" | translate }</h1>

Comments