Show
Ignore:
Timestamp:
10/03/08 01:07:01 (14 months ago)
Author:
bchoate
Message:

Merging fireball branch changes to-date to trunk: svn merge -r2974:3081 http://code.sixapart.com/svn/movabletype/branches/fireball .

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tmpl/cms/cfg_archives.tmpl

    r2213 r3082  
    116116        return false; 
    117117    } 
     118    if (f.enable_archive_paths.checked) { 
     119        if (!f.archive_path.value) { 
     120            alert('<__trans phrase="You must set Local Archive Path." escape="singlequotes">'); 
     121            return false; 
     122        } else if (!is_valid_url(f.archive_url.value)){ 
     123            alert('<__trans phrase="You must set a valid Archive URL." escape="singlequotes">'); 
     124            return false; 
     125        } else if (!is_valid_path(f.archive_path.value)){ 
     126            alert('<__trans phrase="You must set a valid Local Archive Path." escape="singlequotes">'); 
     127            return false; 
     128        } 
     129    } 
    118130    f.site_url.disabled = false; 
    119131    f.site_path.disabled = false; 
     
    126138} 
    127139function is_valid_path(path_){ 
    128     for(i = 0; i < path_.length; i++){ 
    129         var buf = escape(path_.substr(i, 1)); 
    130         if (buf.match(/^%u.*/)){ 
    131             return false; 
    132         } 
    133         if (buf.match(/(%.{2}){2}?/)){ 
    134                 return false; 
    135         } 
     140    var str = path_.replace(/[ "%<>\[\\\]\^`{\|}~]/g, ""); 
     141    str = encodeURI(str); 
     142    if (str.indexOf('%') != -1) { 
     143        return false; 
     144    } 
     145    if (str.match(/\.\./)) { 
     146        return false; 
    136147    } 
    137148    return true;