[ 新規 | 編集 | 差分 ] [ 検索 | 一覧 | FrontPage ] [ 履歴 (RSS) | 差分履歴 (RSS) ] [ ログイン ]
【PR】Amazon | SL-C3000 | SL-C1000(3/18発売!) | SL-C860 | SL-6000W | SL-6000L | SL-6000N

WalWiki/カスタマイズ/非公開ページ

編集

[secret page]

編集

resource.txtへの追加

編集
secretbutton非公開にする

グローバル変数定義

編集
my $frozen_frozen = 1;
my $frozen_certified = 2;
my $frozen_secret = 3;

do_read()内の変更

編集
sub do_read {
    # yakty add [secret page] start
    if(&is_secret($form{mypage}) and not &valid_password($form{mypassword})){
        &do_login;
        return;
    }
    # yakty add [secret page] end
    &print_header($form{mypage});
    &print_content($database{$form{mypage}});
    &print_footer($form{mypage});
}

do_write()内の変更

編集
    my $willbesecret = ($form{myfrozen} == $frozen_secret);                # yakty add [secret page]

    if ($form{mymsg}) {
        # Walrus mod [write softly] start
#       $database{$form{mypage}} = $form{mymsg};
        if ($lock_enable) {
        #if ($form{mytouch}) {                                           # yakty del [noupdate if nochange]
        if ($form{mytouch} and $isChanged) {                             # yakty add [noupdate if nochange]
#           &set_info($form{mypage}, $info_LastModified, '' . localtime);                                # Walrus del [gmtime offset]
            &set_info($form{mypage}, $info_LastModified, '' . gmtime(time + $modifier_time_offset));     # Walrus add [gmtime offset]
            &update_recent_changes;
        # }  # yakty del [secret page]
        # yakty add [secret page] start
        } elsif($willbesecret) {
            &update_recent_changes;
        }
        # yakty add [secret page] end
        #if ($form{mytouch}) {                       # yakty del [noupdate if nochange]
        #if ($form{mytouch} and $isChanged) {                            # yakty add [noupdate if nochange] # yakty del [secret page]
        if (($form{mytouch} and $isChanged) or $willbesecret) {          # yakty add [noupdate if nochange] [secret page]
            &update_recent_changes;
        }
        &print_header($form{mypage});

update_recent_changes()内の変更

編集
    foreach (@oldupdates) {
        /^\- \d\d\d\d\-\d\d\-\d\d \(...\) \d\d:\d\d:\d\d (\S+)/;    # date format.
        my $name = &unarmor_name($1);
        #if (&is_exist_page($name) and ($name ne $form{mypage})) {                             # yakty del [secret page]
        if (not &is_secret($name) and &is_exist_page($name) and ($name ne $form{mypage})) {    # yakty add [secret page]
            push(@updates, $_);
        }
    }
    #if (&is_exist_page($form{mypage})) {                                             # yakty del [secret page]
    if (&is_exist_page($form{mypage}) and $form{myfrozen} != $frozen_secret) {        # yakty add [secret page]
        unshift(@updates, $update);
    }

update_recent_diffs()内の変更

編集
   if($form{myfrozen} != $frozen_secret){ # yakty add [secret page]
       my $update = "- @{[&get_now]} @{[&armor_name($form{mypage})]}";
       my @difftxt = split(/\n/, $diffmsg);
       if((@difftxt = grep /^[-+]/, @difftxt)){
           $diffmsg = join("\n", @difftxt);
           $diffmsg =~ s/^/ /gm;
           $contents = $update . "\n" . $diffmsg . "\n";
       }
   }                                      # yakty add [secret page]
   my @txt = split(/\n/, $database{$RecentDiffs});
   my $n = 0;
   my $skip = 0;
   my @diffs;
   foreach (@txt){
       if(/^\- \d\d\d\d\-\d\d\-\d\d \(...\) \d\d:\d\d:\d\d (\S+)/){
           last if(++$n > $maxrecent);
           my $name = &unarmor_name($1);
           # $skip = 0;             # yakty del [secret page]
           $skip = (&is_secret($name) or ($name eq $form{mypage} and $form{myfrozen} == $frozen_secret));   # yakty add [secret page]
           if($name eq $skippage){
               $skip = 1;
               $skippage = '';
           }
       }
       next if($skip);
       push @diffs, $_;
   }
   $contents .= join("\n", @diffs);

print_header()内の変更

編集
    my $frozen = &is_frozen($page);                                        # yakty add [certified] [secret page]
    #if (&is_frozen($page) and $form{mycmd} =~ /^(read|write)$/) {         # yakty del [certified] [secret page]
    # yakty add [secret page] start
    if ($frozen == $frozen_secret and $form{mycmd} =~ /^(read|write)$/) {
        $editable = 0;
        $admineditable = 1;
        $bodyclass = "secret";
    } elsif ($frozen == $frozen_frozen and $form{mycmd} =~ /^(read|write)$/) {
    # yakty add [secret page] end
    #if( $frozen == 1 and $form{mycmd} =~ /^(read|write)$/) {               # yakty add [certified]
        $editable = 0;
        $admineditable = 1;
        $bodyclass = "frozen";
    # Walrus add [edit admin only] start

print_editform()内の変更

編集
@{[
    $mode{admin} ?
    # yakty del [certified] [secret page] start
    #qq(
    #<input type="radio" name="myfrozen" value="1" @{[$frozen ? qq(checked="checked") : ""]}>$resource{frozenbutton}
    #<input type="radio" name="myfrozen" value="0" @{[$frozen ? "" : qq(checked="checked")]}>$resource{notfrozenbutton}<br>)
    # yakty del [certified] [secret page] end
    # yakty add [certtified] [secret page] start
    qq(
    <input type="radio" name="myfrozen" value="3" @{[($frozen == 3) ? qq(checked="checked") : ""]}>$resource{secretbutton}
    <input type="radio" name="myfrozen" value="2" @{[($frozen == 2) ? qq(checked="checked") : ""]}>$resource{certifybutton}
    <input type="radio" name="myfrozen" value="1" @{[($frozen == 1) ? qq(checked="checked") : ""]}>$resource{frozenbutton}
    <input type="radio" name="myfrozen" value="0" @{[$frozen ? "" : qq(checked="checked")]}>$resource{notfrozenbutton}<br>)
    # yakty add [certified] [secret page] end
    : ""
]}

frozen_reject()内の変更

編集
sub frozen_reject {
    my ($isfrozen) = &get_info($form{mypage}, $info_IsFrozen);
    my ($willbefrozen) = $form{myfrozen};
    if ($allow_comment_in_frozen and $form{'mycmd'} eq 'comment' and not $willbefrozen) {     # yakty add [certified]
    #if (not $isfrozen and not $willbefrozen) {       # yakty del [certified]
        # You need no check.
        $form{myfrozen} = $isfrozen;                  # yakty add [certified]
        return 0;
    # Walrus add [allow comment in frozen] start
    } elsif (not $isfrozen == $frozen_frozen and not $isfrozen == $frozen_secret and not $willbefrozen){                                           # yakty add [certified] [secret page]
    #} elsif ($allow_comment_in_frozen and $form{'mycmd'} eq 'comment' and not $willbefrozen) {   # yakty del [certified]
        #$form{myfrozen} = $isfrozen;                                                             # yakty del [certified]
        return 0;
    # Walrus add [allow comment in frozen] end
    } elsif (valid_password($form{mypassword})) {
        # You are admin.
        return 0;
    } else {
        &print_error($resource{passworderror});
        return 1;
    }
}

do_search()内の変更

編集
sub do_search {
    my $word = &escape($form{mymsg});
    &print_header($SearchPage);
    &print_searchform($word);
    my $counter = 0;
    my $admin = &valid_password($form{mypassword});       # yakty add [secret page]
        foreach my $page (@pages) {
            next if (&is_secret($page) and not $admin);   # yakty add [secret page]

is_frozen()内の変更

編集
sub is_frozen {
    my ($page) = @_;
    # yakty del [certified]
    #if (&get_info($page, $info_IsFrozen)) {
    #    return 1;
    #} else {
    #    return 0;
    #}
    # yakty del [certifled]
    return &get_info($page, $info_IsFrozen);        # yakty add [certified] [secret page]
}

is_secret()追加

編集
# yakty add [secret page] start
sub is_secret {
    my ($page) = @_;
    return &is_frozen($page) == $frozen_secret;
}
# yakty add [secret page] end

do_index() 内の変更

編集
   &print_header($IndexPage);
   my $admin = &valid_password($form{mypassword});       # yakty add [secret page]
   print qq(<ul>);
   foreach my $page (sort keys %database) {
   my $frozen = &is_frozen($page);                       # yakty add [secret page]
   next if(not $admin and $frozen == $frozen_secret);    # yakty add [secret page]

02257