##################
# BEGIN SETTINGS #
##################
$site_domain = "reopen911.org";
$posts_folder = "./news_posts/";
$posts_file_extension = ".txt";
$days_before_archiving = 60;
//Set to 0 if you don't want to have file uploads
$upload_file_max_size_bytes = 200000;
$upload_file_acceptable_extensions = array ('jpg');
$upload_file_path = "./uploads/";
$image_display_width = 250;
//Set to 0 if not using password protection
//By setting to 0, "Create a new posting"
//will be added as a menu item
$password = 'walden3';
//This program can be used as the following:
// "Events" or "What's New" or "Guestbook" or "Personals" or "News"
$program_usage = "News";
$bad_file_name_chars = array ('!','@','#','$','%','^','&','*','(',')','-','+','=','[',']','{','}','~','`',
'<','>',',','.','?','/','\\','|',';',':',chr(34),chr(39));
################
# END SETTINGS #
################
?>
..:: Reopen 9/11 - Catch the Real Terrorists ::..
//AVOIDS PAGE EXPIRATION PROBLEM
session_cache_limiter('private_no_expire');
//ACTION IS TO SHOW POSTINGS DOING AUTO ARCHIVE
if (@$HTTP_GET_VARS["action"] == "") {
if (@$HTTP_GET_VARS["history"] == "")
echo "
== ".strtoupper($program_usage)." POSTINGS WITHIN THE LAST $days_before_archiving DAYS ==
\n";
else if ($HTTP_GET_VARS["history"] == "list")
echo "
\n";
//OPENS AND READS CONTENTS OF TASKS DIRECTORY
$d = dir($posts_folder);
while($entry = $d -> read()) {
if (stristr($entry,$posts_file_extension) != false)
$postfiles[] = str_replace($posts_file_extension,"",$entry);
}
$d->close();
//SORTS THE POSTING FILES BY DATE AND ALPHABETICALLY
rsort($postfiles);
//PARSES THE DATE AND POSTING TITLE FROM FILE NAME
echo "
";
foreach ($postfiles as $postfile) {
list($post_date,$post_title) = split("__",$postfile);
$post_year = substr($post_date,0,4);
$post_month = substr($post_date,5,2);
$post_day = substr($post_date,8,2);
$post_title = str_replace("_"," ",$post_title);
//DETERMINES WHETHER TO DISPLAY BASED ON DATE
if (@$HTTP_GET_VARS["history"] == $postfile OR (@$HTTP_GET_VARS["history"] == "" AND intval((mktime(0,0,0,$post_month,$post_day,$post_year) - time())/86400) + $days_before_archiving >= 0)) {
//DISPLAYS THE ACTIVE POSTINGS
echo "
";
//ACTION IS TO CREATE A NEW POSTING
} else if (@$HTTP_GET_VARS["action"] == "Create") {
echo "
== CREATE NEW ".strtoupper($program_usage)." POSTING ==\n";
echo "
\n";
//ACTION IS TO SUBMIT AN ENTERED NEW POSTING
} else if ($HTTP_GET_VARS["action"] == "CreateSubmit") {
if ($HTTP_POST_VARS["date"] == "" OR $HTTP_POST_VARS["title"] == "" OR $HTTP_POST_VARS["content"] == "")
echo "
ERROR: One or more of the required fields was not completed. Please click BACK and try again.\n";
else if ($password != '0' AND $HTTP_POST_VARS["password"] != $password)
echo "
ERROR: Invalid Password.\n";
else {
foreach($bad_file_name_chars as $bad_file_name_char) {
if(strchr(stripslashes($HTTP_POST_VARS["title"]),$bad_file_name_char)!=false)
$found_bad_char++;
}
if ($found_bad_char>0) {
echo "
ERROR: The title contained one or more invalid characters (".implode(" ",$bad_file_name_chars)."). \n";
echo "Please click the BACK button, fix this, and try again.
The new posting has been added successfully!\n";
else
echo "
ERROR: There was a problem saving your new posting.\n";
}
}
} else {
$fw = fopen($newpost_filename,"wb");
$file = fwrite($fw,stripslashes($HTTP_POST_VARS["content"]));
$fp = fclose($fw);
if ($fw)
echo "
The new posting has been added successfully!\n";
else
echo "
ERROR: There was a problem saving your new posting. \n";
}
}
}
//ACTION IS TO SELECT A POSTING FOR DELETION
} else if ($HTTP_GET_VARS["action"] == "Delete") {
//OPENS AND READS CONTENTS OF TASKS DIRECTORY
$d = dir($posts_folder);
while($entry = $d -> read()) {
if (stristr($entry,$posts_file_extension) != false)
$postfiles[] = str_replace($posts_file_extension,"",$entry);
}
$d->close();
//SORTS THE POSTING FILES BY DATE AND ALPHABETICALLY
sort($postfiles);
//BEGIN THE SELECTION FORM
echo "
== DELETE A POSTING ==\n";
echo "
\n";
//ACTION IS TO DELETE A SELECTED POSTING
} else if ($HTTP_GET_VARS["action"] == "DeleteSubmit") {
if ($password == '0' OR $HTTP_POST_VARS["password"] == $password) {
if (unlink($posts_folder.$HTTP_POST_VARS["filename"].$posts_file_extension))
echo "
The posting has been deleted successfully.\n";
else
echo "
ERROR: There was a problem deleting that posting.\n";
} else
echo "
ERROR: Invalid Password.\n";
//ACTION IS UNDEFINED
} else
echo "