!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/home/mnnews/public_html/cgi-bin/news/   drwxr-xr-x
Free 3.92 GB of 27.03 GB (14.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     npa_category.pl (10.62 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# News Categories Addon
push(@Addons_Loaded, 'News Categories 1.0');
push(@Addons_DisplaySubForm, 'NewsCatSubForm');
push(@Addons_PageHandler, 'NewsCatPageHandler');
push(@Addons_BuildNews_Post, 'NewsCatBuild');
push(@Addons_MainPage, 'NewsCat_MainPage');
push(@Addons_NPHTMLFoot, 'NewsCat_HTMLFoot');
push(@Addons_RemoveNews2, 'NewsCatRemoveNews2');
push(@Addons_RemoveNewsSave, 'NewsCatRemoveNewsSave');
$Addons_List{'News Categories 1.0'} = ['npa_category.pl', 'Manages different categories and news files (profiles) from one copy of NewsPro.', 'http://amphibian.gagames.com/addon.cgi?category&1.0'];

sub NewsCatPageHandler {
    if (query_string() eq "newscat") {
        &NewsCatMain;
        exit;
    }
}

sub NewsCatRemoveNewsSave {
    push(@formfields, 'newscat');
}

sub NewsCatRemoveNews2 {
    my @NCats = split(/\|x\|/, $NPConfig{'NewsCategories'});
    my $nci;
    print qq~ Category:
    <select name="newscat--$newsnum"><option value=""~;
    unless ($newscat) {
        print " selected";
    }
    print ">(default)</option>";
    foreach $nci (@NCats) {
        print qq~
        <option value="$nci"~;
        if ($nci eq $newscat) {
            print " selected";
        }
        print qq~>$nci</option>~;
    }
    print "</select>";
}

sub NewsCat_HTMLFoot {
    if ($up == 3) {
            print qq~ <a href="$scripturl?newscat" class="navlink">News Categories</a> |~;
    }
}
sub NewsCat_MainPage {
    if ($up == 3) {
        print qq~
        <b><a href="$scripturl?newscat">News Categories</a>:</b> Configure news categories and profiles, features that allow you to create multiple news files.<br><br>
        ~;
    }
}

sub NewsCatBuild {
    &NewsCatLoadConfig;
    foreach $i (sort keys %newsprofiles) {
        my $prof = $newsprofiles{$i};
        if ($prof->[0]) {
            # Filter by category and date.
            my $filtsub;
            if ($prof->[8]) {$filtsub = $prof->[8];}
            else {$filtsub = 'NewsCatFilter';}
            my @FilteredND = &$filtsub(split(/\!/, $prof->[2]), $prof->[3]);
            # Filter by maximum number.
            if (@FilteredND > $prof->[4]) {
                my $maxnum = @FilteredND - 1;
                my $minnum = $maxnum - $prof->[4];
                $minnum++;
                @FilteredND = @FilteredND[$minnum..$maxnum];
            }
            # Filtered! Build news.
            $newsnum = @FilteredND - 1;
            $content = '';
            while ($newsnum >= 0) {
                my $ff;
                foreach $ff (keys %{$FilteredND[$newsnum]}) {
                    ${$ff} = $FilteredND[$newsnum]->{$ff};
                }
                $newsdate = &GetTheDate($newstime);
                &{$prof->[5]};
                if ($prof->[10]) {$content .= qq~<a name="newsitem$newsid"></a>~;}
                $content .= $newshtml;
                $newsnum--;
            }
            # News built. Now open the text file.
            NPopen(NCFILE, ">$prof->[9]/$prof->[1]");
            print NCFILE $content;
            close(NCFILE);
            # Done. Now generate HTML.
            if ($prof->[6]) {
                NPopen(TMPL, "$NPConfig{'admin_path'}/$prof->[6]");
                @tmpl = <TMPL>;
                close(TMPL);
                my $tmpl = join('', @tmpl);
                $tmpl =~ s/<InsertContent>/$content/i;
                $tmpl =~ s/<InsertField(\S?)>/${$1}/gi;
                $tmpl =~ s/<InsertTitle>/$prof->[7]/gi;
                my $htmlfilename;
                if ($prof->[1] =~ /(.+)\./) {
                    $htmlfilename = $1;
                } else {
                    $htmlfilename = $prof->[1];
                }
                $htmlfilename .= ".$NPConfig{'ArcHtmlExt'}";
                NPopen(TMPL, ">$prof->[9]/$htmlfilename");
                print TMPL $tmpl;
                close(TMPL);
            }
        }
    }
}


sub NewsCatSubForm {
    push(@formfields, 'newscat');
    $FormFieldsName{'newscat'} = "News Category";
    my @NCats = split(/\|x\|/, $NPConfig{'NewsCategories'});
    $FormFieldsCustom{'newscat'} = q~<select name="newscat">
    <option value="" selected>(default)</option>~;
    my $ncat;
    foreach $ncat (sort @NCats) {
        $FormFieldsCustom{'newscat'} .= qq~
        <option value="$ncat">$ncat</option>~;
    }
    $FormFieldsCustom{'newscat'} .= q~
    </select>~;
}


sub NewsCatSaveProf {
    my $prof = $in{'editprofsave'};
    @{$newsprofiles{$prof}} = ($newsprofiles{$prof}->[0], $in{'textfile'}, join('!', split(/\|x\|/, $in{'newscategories'})),
    $in{'maxage'}, $in{'maxnum'}, $in{'newssub'}, $in{'tmplfile'}, $in{'tmpltitle'}, $in{'filtsub'}, $in{'filepath'}, $in{'anchors'});
    &NewsCatSaveConfig;
}
sub NewsCatEditProf {
    my $prof = $in{'profname'};
    my @selectedcats = split(/\!/, $newsprofiles{$prof}->[2]);
    my %selectedcats;
    foreach $i (@selectedcats) {
        $selectedcats{$i} = 'selected';
    }
    &NPHTMLHead("Edit profile $prof");
    print qq~
    <form action="$scripturl?newscat" method="POST">
    <input type="hidden" name="editprofsave" value="$prof">
    Name of generated text file (i.e. $prof.txt): <input type="text" name="textfile" value="$newsprofiles{$prof}->[1]"><br><br>
    Absolute path of directory in which files will be created, with no trailing slash (i.e. $NPConfig{'htmlfile_path'}): <input type="text" name="filepath" value="$newsprofiles{$prof}->[9]"><br><br>
    
    Include only news from categories: (multiple selections allowed)
    <select name="newscategories" size="3" multiple>
    <option value="AllCategories" $selectedcats{'AllCategories'}>(All Categories)</option>
    ~;
    foreach $i (@newscategories) {
        print qq~
        <option value="$i" $selectedcats{$i}>$i</option>~;
    }
    if ($newsprofiles{$prof}->[10] eq "0") {
        $Anchor1 = '';
        $Anchor2 = 'selected';
    } else {
        $Anchor1 = 'selected';
        $Anchor2 = '';
    }
    print qq~
    </select><br><br>
    Do not include news older than <input type="text" name="maxage" value="$newsprofiles{$prof}->[3]">
    days (to disable filtering by date, enter 10000).<br><br>
    Include a maximum of <input type="text" name="maxnum" value="$newsprofiles{$prof}->[4]">
    news items (to disable filtering by item number, enter 10000).<br><br>
    EXPERT USERS ONLY! \@NewsData filtering sub. Most users should leave this blank. <input type="text" name="filtsub" value="$newsprofiles{$prof}->[8]"><br><br>
    Generate news using ndisplay.pl subroutine <input type="text" name="newssub" value="$newsprofiles{$prof}->[5]">
    (i.e. DoNewsHTML for the general news style, DoHeadlineHTML for headlines).<br><br>
    Generate HTML file using .tmpl file  <input type="text" name="tmplfile" value="$newsprofiles{$prof}->[6]">
    located in your NewsPro directory (to disable HTML file creation, leave blank).<br>
    If generating HTML file, enter page title: <input type="text" name="tmpltitle" value="$newsprofiles{$prof}->[7]"><br>
    Create &lt;a name&gt; tags with news? Unless you're going to be including more than one news file on a single HTML page, you should leave this on.
    <select name="anchors"><option value="1" $Anchor1>Yes</option><option value="0" $Anchor2>No</option></select>
    <br><br><input type="submit" name="submit" value="Save Changes"></form>
    ~;
    &NPHTMLFoot;
}
    

sub NewsCatFilter {
    my $mintime = pop;
    $mintime = $mintime * 86400;
    my @filtcats = @_;
    my %filtcats;
    my $nd;
    undef @NewNewsData;
    my @NewNewsData;
    foreach $i (@filtcats) {
        $filtcats{$i} = 1;
    }
    foreach $nd (@NewsData) {
        # First, check if it matches the category.
        if ($filtcats{$nd->{'newscat'}} || $filtcats{'AllCategories'}) {
            # It matches. Now check the time.
            if ($nd->{'newstime'} >= (time - $mintime)) {
                # It's good. Add to the new array.
                push(@NewNewsData, $nd);
            }
        }
    }
    return @NewNewsData;
}

sub NewsCatFilterReverse {
    my @NND = reverse(&NewsCatFilter(@_));
    return @NND;
}

sub NewsCatLoadConfig {
    @newscategories = sort(split(/\|x\|/, $NPConfig{'NewsCategories'}));
    @nprof = split(/\|x\|/, $NPConfig{'NewsProfiles'});
    foreach $i (@nprof) {
        @nprof2 = split(/\~/, $i);
        my $j = shift(@nprof2);
        if ($j) {
        $newsprofiles{$j} = [];
        @{$newsprofiles{$j}} = @nprof2;
        }
    }
}
sub NewsCatSaveConfig {
    $NPConfig{'NewsCategories'} = join('|x|', @newscategories);
    my @nprof = ('');
    foreach $i (sort keys %newsprofiles) {
        push(@nprof, join('~', $i, @{$newsprofiles{$i}}));
    }
    $NPConfig{'NewsProfiles'} = join('|x|', @nprof);
    &WriteConfigInfo;
}
sub NewsCatMain {
    unless ($UserPermissions{$Cookies{'uname'}} == 3) {
        &NPdie('You are not authorized to access this');
    }
    &NewsCatLoadConfig;
    if ($in{'editprof'}) {
        &NewsCatEditProf;
        exit;
    }
    if ($in{'editprofsave'}) {
        &NewsCatSaveProf;
    }
    if ($in{'removecat'}) {
        my $new_newscategories;
        foreach $i (@newscategories) {
            unless ($i eq $in{'removecat'}) {
                push(@new_newscategories, $i);
            }
        }
        @newscategories = @new_newscategories;
        &NewsCatSaveConfig;
    }
    if ($in{'removeprof'}) {
        if ($newsprofiles{$in{'profname'}}) {
            delete $newsprofiles{$in{'profname'}};
        }
        &NewsCatSaveConfig;
    }
    if ($in{'addcat'}) {
        $in{'addcat'} =~ s/[^\w\d_]//g;
        if ($in{'addcat'} ne "") {
            push(@newscategories, $in{'addcat'});
        }
        &NewsCatSaveConfig;
    }
    if ($in{'addprof'}) {
        $in{'addprof'} =~ s/[^\w\d_]//g;
        unless ($newsprofiles{$in{'addprof'}} || $in{'addprof'} eq "") {
            $newsprofiles{$in{'addprof'}} = ['0', "$in{'addprof'}.txt", 'AllCategories', '10000', '10000', 'DoNewsHTML', '', '', '', $NPConfig{'htmlfile_path'}];
        }
        &NewsCatSaveConfig;
    }
    if ($in{'disableprof'}) {
        $newsprofiles{$in{'profname'}}->[0] = 0;
        &NewsCatSaveConfig;
    }
    if ($in{'enableprof'}) {
        $newsprofiles{$in{'profname'}}->[0] = 1;
        &NewsCatSaveConfig;
    }
    &NPHTMLHead("News Categories");
    print q~
    <div align="center"><h3>News Categories</h3><table width="80%" border="0">
    ~;
    foreach $i (@newscategories) {
        print qq~
        <tr>
        <td>$i</td>
        <td> <div align="center"> <form action="$scripturl?newscat" method="POST">
        <input type="hidden" name="removecat" value="$i">
        <input type="submit" name="Submit" value="Remove"></form>
        </div> </td> </tr>
        ~;
    }
    print qq~
</table>
<b>Add new category:</b><form action="$scripturl?newscat" method="POST">
<input type="text" name="addcat" value="Name"><input type="submit" name="submit" value="Submit">
</form><hr width="75%">
    ~;
    print q~
    <h3>News Profiles</h3><table width="80%" border="0">
    ~;
    foreach $i (sort keys %newsprofiles) {
        print qq~
        <tr>
        <td>$i
        ~;
        unless ($newsprofiles{$i}->[0]) {
            print q~ (File creation currently <b>disabled</b>)~;
        }
        print qq~
        </td>
        <td><div align="center">
        <form action="$scripturl?newscat" method="POST">
        <input type="hidden" name="profname" value="$i">
        <input type="submit" name="removeprof" value="Remove">
        <input type="submit" name="editprof" value="Edit">
        ~;
        if ($newsprofiles{$i}->[0]) {
            print qq~
            <input type="submit" name="disableprof" value="Disable File Creation">
            ~;
        } else {
            print qq~
            <input type="submit" name="enableprof" value="Enable File Creation">
            ~;
        }
        print q~
        </div></form></td></tr>
        ~;
    }
    print qq~
    </table>
    <b>Add new profile:</b><form action="$scripturl?newscat" method="POST">
    <input type="text" name="addprof" value="Name"><input type="submit" name="submit" value="Submit">
    </form>
    ~;
    &NPHTMLFoot;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0037 ]--