]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
move to bug page
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index fc5dfc2efde84d552940dda35efc511ce92e87dd..4c15be0aeecb09221d27863ceb580d55f759d66e 100644 (file)
@@ -31,7 +31,7 @@ sub page_locked ($$;$) { #{{{
 
        foreach my $admin (@{$config{adminuser}}) {
                my $locked_pages=userinfo_get($admin, "locked_pages");
 
        foreach my $admin (@{$config{adminuser}}) {
                my $locked_pages=userinfo_get($admin, "locked_pages");
-               if (globlist_match($page, userinfo_get($admin, "locked_pages"))) {
+               if (pagespec_match($page, userinfo_get($admin, "locked_pages"))) {
                        return 1 if $nonfatal;
                        error(htmllink("", "", $page, 1)." is locked by ".
                              htmllink("", "", $admin, 1)." and cannot be edited.");
                        return 1 if $nonfatal;
                        error(htmllink("", "", $page, 1)." is locked by ".
                              htmllink("", "", $admin, 1)." and cannot be edited.");
@@ -278,9 +278,9 @@ sub cgi_prefs ($$) { #{{{
        $form->field(name => "password", type => "password");
        $form->field(name => "confirm_password", type => "password");
        $form->field(name => "subscriptions", size => 50,
        $form->field(name => "password", type => "password");
        $form->field(name => "confirm_password", type => "password");
        $form->field(name => "subscriptions", size => 50,
-               comment => "(".htmllink("", "", "GlobList", 1).")");
+               comment => "(".htmllink("", "", "PageSpec", 1).")");
        $form->field(name => "locked_pages", size => 50,
        $form->field(name => "locked_pages", size => 50,
-               comment => "(".htmllink("", "", "GlobList", 1).")");
+               comment => "(".htmllink("", "", "PageSpec", 1).")");
        
        if (! is_admin($user_name)) {
                $form->field(name => "locked_pages", type => "hidden");
        
        if (! is_admin($user_name)) {
                $form->field(name => "locked_pages", type => "hidden");
@@ -346,12 +346,11 @@ sub cgi_editpage ($$) { #{{{
        # This untaint is safe because titlepage removes any problematic
        # characters.
        my ($page)=$form->field('page');
        # This untaint is safe because titlepage removes any problematic
        # characters.
        my ($page)=$form->field('page');
-       $page=titlepage(possibly_foolish_untaint(lc($page)));
+       $page=titlepage(possibly_foolish_untaint($page));
        if (! defined $page || ! length $page ||
            $page=~/$config{wiki_file_prune_regexp}/ || $page=~/^\//) {
                error("bad page name");
        }
        if (! defined $page || ! length $page ||
            $page=~/$config{wiki_file_prune_regexp}/ || $page=~/^\//) {
                error("bad page name");
        }
-       $page=lc($page);
        
        my $from;
        if (defined $form->field('from')) {
        
        my $from;
        if (defined $form->field('from')) {
@@ -359,7 +358,7 @@ sub cgi_editpage ($$) { #{{{
        }
        
        my $file;
        }
        
        my $file;
-       my $type;       
+       my $type;
        if (exists $pagesources{$page}) {
                $file=$pagesources{$page};
                $type=pagetype($file);
        if (exists $pagesources{$page}) {
                $file=$pagesources{$page};
                $type=pagetype($file);
@@ -373,9 +372,7 @@ sub cgi_editpage ($$) { #{{{
                        # favor the type of linking page
                        $type=pagetype($pagesources{$from});
                }
                        # favor the type of linking page
                        $type=pagetype($pagesources{$from});
                }
-               else {
-                       $type=$config{default_pageext};
-               }
+               $type=$config{default_pageext} unless defined $type;
                $file=$page.".".$type;
        }
 
                $file=$page.".".$type;
        }
 
@@ -457,7 +454,7 @@ sub cgi_editpage ($$) { #{{{
                        }
 
                        @page_locs = grep {
                        }
 
                        @page_locs = grep {
-                               ! exists $pagesources{lc($_)} &&
+                               ! exists $pagecase{lc $_} &&
                                ! page_locked($_, $session, 1)
                        } @page_locs;
                        
                                ! page_locked($_, $session, 1)
                        } @page_locs;
                        
@@ -485,8 +482,8 @@ sub cgi_editpage ($$) { #{{{
                        if (! defined $form->field('editcontent') || 
                            ! length $form->field('editcontent')) {
                                my $content="";
                        if (! defined $form->field('editcontent') || 
                            ! length $form->field('editcontent')) {
                                my $content="";
-                               if (exists $pagesources{lc($page)}) {
-                                       $content=readfile(srcfile($pagesources{lc($page)}));
+                               if (exists $pagesources{$page}) {
+                                       $content=readfile(srcfile($pagesources{$page}));
                                        $content=~s/\n/\r\n/g;
                                }
                                $form->field(name => "editcontent", value => $content,
                                        $content=~s/\n/\r\n/g;
                                }
                                $form->field(name => "editcontent", value => $content,
@@ -617,11 +614,11 @@ sub cgi () { #{{{
                cgi_prefs($q, $session);
        }
        elsif ($do eq 'blog') {
                cgi_prefs($q, $session);
        }
        elsif ($do eq 'blog') {
-               my $page=titlepage(lc($q->param('title')));
+               my $page=titlepage(decode_utf8($q->param('title')));
                # if the page already exists, munge it to be unique
                my $from=$q->param('from');
                my $add="";
                # if the page already exists, munge it to be unique
                my $from=$q->param('from');
                my $add="";
-               while (exists $oldpagemtime{"$from/$page$add"}) {
+               while (exists $pagecase{lc "$from/$page$add"}) {
                        $add=1 unless length $add;
                        $add++;
                }
                        $add=1 unless length $add;
                        $add++;
                }