#!/usr/bin/perl ############################################################################### # Greymatter 1.7.2 # Copyright (c)2000-2007, The Greymatter team # http://greymatterforum.proboards82.com/ # By possessing this software, you agree not to hold the author responsible for # any problems that may arise from your installation or usage of Greymatter # itself, or from any content generated by yourself or others through the use of # this program. You may freely modify and redistribute this program, so # long as every copyright notice (including in this manual and in the Greymatter # code) remains fully intact. Finally, you may not sell or in any way # make a financial profit from this program, either in original or modified form. # Your possession of this software signifies that you agree to these terms; # please delete your copy of this software if you don't agree to these terms. # Original Creators Noah Grey ############################################################################### eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); }; use lib 'libs'; use CGI::Carp qw(fatalsToBrowser); use Gm_Constants; use Gm_Trace; require "gm-library.cgi"; # ---------------------------------------- # gathering the input & checking for login # ---------------------------------------- &Gm_Trace::Trace(level => 3, msg => "before request header in gm.cgi"); print Gm_Web::createRequestHeader(); &Gm_Trace::Trace(level => 3, msg => "after request header in gm.cgi"); $authorIP = $ENV{'REMOTE_ADDR'}; $logindeletednotice = ""; # if ($ENV{'REQUEST_METHOD'} eq "GET") { $getin = $ENV{'QUERY_STRING'}; } else { read(STDIN, $getin, $ENV{'CONTENT_LENGTH'}); } # # @pairs = split(/&/, $getin); # foreach $pair (@pairs) { # ($name, $value) = split(/=/, $pair); # $name =~ tr/+/ /; # $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # unless (($name eq "logtext") || ($name eq "loglink")) { $value =~ tr/+/ /; } # $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # # # What if we have multiple values for the form element, hmm? # if( exists( $IN{$name} ) && defined( $IN{$name} )){ # if( $name eq "thomas" ){ # # For some reason, this variable appears multiple times on a page, # # perhaps so a reload won't mess with it? Who knows..., but anyway # # DO NOT APPEND, must replace # $IN{$name} = $value; # warn 'Avoiding appending because of "thomas" variable, bad!'; # } else { # # really append # $IN{$name} .= "\t$value"; # } # } else { # $IN{$name} = $value; # } # } &Gm_Trace::Trace(level => 4, msg => "before web params in gm.cgi"); %IN = %{Gm_Web::getWebParams( errHandler=>\&Gm_Web::displayAdminErrorExit )}; &Gm_Trace::Trace(level => 4, msg => "after web params in gm.cgi"); &gm_readconfig; # TODO COORDINATE SO ONLY DONE ONCE PER CALL &gm_bancheck; $IN{'authorname'} =~ s//\>\;/g; $IN{'authorpassword'} =~ s//\>\;/g; if ($IN{'thomas'} eq "") { &gm_login; } if ($IN{'thomas'} eq "Re-Login") { &gm_login; } &gm_validate; if ($IN{'thomas'} eq "login") { &gm_writetocplog("$IN{'authorname'} logged in"); &gm_versioncheck; &gm_readcounter; $statusnote = qq(Welcome, $IN{'authorname'}.

); if ($newentrynumber eq "0") { $cploglines = Gm_Storage::getCplog( errHandler=>\&Gm_Web::displayAdminErrorExit ); $cplogtext = join (" ", @$cploglines); unless ($cplogtext =~ /successfully performed diagnostics/) { $statusnote = qq(Welcome to Greymatter! Please enter Configuration first, check your paths,
and run Diagnostics & Repair to validate your installation.

); } } &gm_frontpage; } if ($IN{'thomas'} eq "rebuildupdate") { &gm_rebuildupdate; } if ($IN{'thomas'} eq "Update Now") { &gm_versionupgrading; } if ($IN{'thomas'} eq "gmbmpost") { &gm_addentrypopup; } if ($IN{'thomas'} eq "Return To Main Menu") { &gm_frontpage; } if ($IN{'thomas'} eq "Add A New Entry") { &gm_addentry; } if ($IN{'thomas'} eq "Edit An Entry") { &gm_editentryselection; } if ($IN{'thomas'} eq "Configuration") { &gm_configuration; } if ($IN{'thomas'} eq "Edit Templates") { &gm_edittemplates; } if ($IN{'thomas'} eq "Edit Authors") { &gm_editauthors; } if ($IN{'thomas'} eq "Edit Banned IP List") { &gm_editbanlist; } if ($IN{'thomas'} eq "Add Bookmarklets") { &gm_addbookmarklets; } if ($IN{'thomas'} eq "Upload Files") { &gm_uploadfiles; } if ($IN{'thomas'} eq "Rebuild Files") { &gm_rebuildfilesmenu; } if ($IN{'thomas'} eq "View Control Panel Log") { &gm_viewcplog; } if ($IN{'thomas'} eq "Add This Entry") { &gm_savenewentry; } if ($IN{'thomas'} eq "Preview Before Posting") { &gm_previewentry; } if ($IN{'thomas'} eq "Re-Edit This Entry") { if ($IN{'gmbmspecial'} eq "popupblog") { &gm_addentrypopup; } else { &gm_addentry; } } if ($IN{'thomas'} eq "Change View") { &gm_editentryselection; } if ($IN{'thomas'} eq "Search") { &gm_editentryselection; } if ($IN{'thomas'} eq "Edit Selected Entry") { &gm_editthisentry; } if ($IN{'thomas'} eq "Open/Close Selected Entry") { &gm_changeentryopenstatus; } if ($IN{'thomas'} eq "Search And Replace Across All Entries") { &gm_editentrysearchandreplace; } if ($IN{'thomas'} eq "Edit Selected Comment") { &gm_editselectedcomment; } if ($IN{'thomas'} eq "Delete Selected Comment") { &gm_deleteselectedcomment; } if ($IN{'thomas'} eq "Delete All Selected Comments") { &gm_DeleteAllSelectedComments; } if ($IN{'thomas'} eq "Save Changes To This Entry") { &gm_saveentrychanges; } if ($IN{'thomas'} eq "Select Another Entry") { &gm_editentryselection; } if ($IN{'thomas'} eq "Return To Entry Selection") { &gm_editentryselection; } if ($IN{'thomas'} eq "Perform Search And Replace") { &gm_performsearchandreplace; } if ($IN{'thomas'} eq "Save Changes To This Comment") { &gm_savecommentchanges; } if ($IN{'thomas'} eq "Return To Entry Editing") { &gm_editthisentry; } if ($IN{'thomas'} eq "Add New IP") { &gm_addbannedip; } if ($IN{'thomas'} eq "Delete Selected IP") { &gm_deletebannedip; } if ($IN{'thomas'} eq "Diagnostics & Repair") { &gm_diagnosticscheck; } if ($IN{'thomas'} eq "Save Configuration") { &gm_saveconfiguration; } if ($IN{'thomas'} eq "Perform Diagnostics & Repair") { &gm_diagnosticsperform; } if ($IN{'thomas'} eq "Return To Configuration") { &gm_configuration; } if ($IN{'thomas'} eq "Edit Main Index-Related Templates") { &gm_editmainindextemplates; } if ($IN{'thomas'} eq "Edit Archive-Related Templates") { &gm_editarchivetemplates; } if ($IN{'thomas'} eq "Edit Entry Page-Related Templates") { &gm_editentrypagetemplates; } if ($IN{'thomas'} eq "Edit Karma & Comments-Related Templates") { &gm_editkarmacommentstemplates; } if ($IN{'thomas'} eq "Edit Header, Footer & Sidebar Templates") { &gm_editheaderfootertemplates; } if ($IN{'thomas'} eq "Edit Miscellaneous Templates") { &gm_editmisctemplates; } if ($IN{'thomas'} eq "Return To Templates Menu") { &gm_edittemplates; } if ($IN{'thomas'} eq "Save Template Changes") { &gm_savetemplatechanges; } if ($IN{'thomas'} eq "Edit Selected Author") { &gm_editselectedauthor; } if ($IN{'thomas'} eq "Delete Selected Author") { &gm_deleteselectedauthor; } if ($IN{'thomas'} eq "Create New Author") { &gm_createnewauthor; } if ($IN{'thomas'} eq "Save Changes To This Author") { &gm_saveauthorchanges; } if ($IN{'thomas'} eq "Return To Author Panel") { &gm_editauthors; } if ($IN{'thomas'} eq "Upload This File") { &gm_processupload; } if ($IN{'thomas'} eq "Rebuild Last Entry Page Only") { &gm_rebuildlastentrypageonly; } if ($IN{'thomas'} eq "Rebuild Main Index File") { &gm_rebuildmainindexfile; } if ($IN{'thomas'} eq "Rebuild Main Entry Pages") { &gm_rebuildmainentrypages; } if ($IN{'thomas'} eq "Rebuild Archive Master Index") { &gm_rebuildarchivemasterindex; } if ($IN{'thomas'} eq "Rebuild Archive Log Indexes") { &gm_rebuildarchivelogindexes; } if ($IN{'thomas'} eq "Rebuild Archive Entry Pages") { &gm_rebuildarchiveentrypages; } if ($IN{'thomas'} eq "Rebuild All Entry Pages") { &gm_rebuildallentrypages; } if ($IN{'thomas'} eq "Rebuild Connected Files") { &gm_rebuildconnectedfilescheck; } if ($IN{'thomas'} eq "Rebuild Everything") { &gm_rebuildeverything; } if ($IN{'thomas'} eq "Clear And Exit") { unlink ("$EntriesPath/gmrightclick-$IN{'usethisauthorname'}.reg"); &gm_frontpage; } if ($IN{'thomas'} eq "Reset The Control Panel Log") { &gm_resetcplog; } if ($IN{'thomas'} eq "Include This Image In A New Entry") { &gm_addentry; } if ($IN{'thomas'} eq "Include In Entry As A Popup Window") { $IN{'newentrymaintext'} = $IN{'newentrypopuptext'}; &gm_addentry; } if ($IN{'thomas'} eq "Include This Link In A New Entry") { &gm_addentry; } exit;