This file is an include in another, I need to replace the exit commands so that the footer on the other gets parsed. When I replace the exit commands with return; some of the important functions stop happening, although the footer gets parsed! heres the snippet of code, from phpHOO.
// Check cookie to see if we are in admin mode
if($HooPass == $ADMIN_PASS) {
$ADMIN_MODE = true;
}
$query = getenv("QUERY_STRING");
if( ($viewCat) or ( (!$HTTP_POST_VARS) and (!$query) ) )
{
start_page($viewCat);
start_browse($viewCat);
exit;
} elseif($pass) {
if ($pass == $ADMIN_PASS) {
setcookie("HooPass", $ADMIN_PASS);
$ADMIN_MODE = true;
start_page();
start_browse();
exit;
}
} elseif($add)
{
if (("$add" == "top") || empty($add)) {
$add = 0;
$CatName = "$TOP_CAT_NAME";
} else {
$CatName = stripslashes($db->get_CatNames($add));
if (empty($CatName)) { $CatName = "$TOP_CAT_NAME"; }
}
$junk = "";
print_header($add,$title,$junk);
show_add_link($add, $CatName);
exit;
} elseif($add_cat)
{
$junk = "";
$err_msg = "";
if ($ADMIN_MODE && $FULL_ADMIN_ACCESS) {
if(!$db->add_cat($HTTP_POST_VARS,$err_msg))
{
$title = "Error Creating Category";
$msg = "Category not created. ".$err_msg;
} else {
$title = "Category Created";
$msg = "New subcategory created";
}
} else {
$title = "Error Creating Category";
$msg = "Not authorized for creating categories";
}
start_page($CatID,$title,$msg);
start_browse($CatID);
exit;
} elseif ($suggest)
{
$junk = "";
$err_msg = "";
if(!$db->suggest($HTTP_POST_VARS,$err_msg))
{
$title = "Suggestion Error";
$msg = " ".$err_msg;
} else {
$title = "Suggestion Submitted";
$msg = "Suggestion submitted for approval";
// Also tell the admin about it
mail_new_link($HTTP_POST_VARS);
}
start_page($CatID,$title,$msg);
start_browse($CatID);
exit;
} elseif ($update)
{
$junk = "";
$err_msg = "";
if ($ADMIN_MODE) {
if(!$db->update($HTTP_POST_VARS,$err_msg))
{
$title = "Update Error";
$msg = "Update failed: ".$err_msg;
} else {
$title = "Updated";
$msg = "Updated entry submitted for approval";
}
} else {
$title = "Update Error";
$msg = "Not authorized";
}
start_page($CatID,$title,$msg);
start_browse($CatID);
exit;
} elseif ($approve)
{
if ($ADMIN_MODE) {
if(!$db->approve($approve,$err_msg))
{
$title = "Approval Error";
$msg = $err_msg;
} else {
$title = "Approved";
$msg = "Suggestion approved";
}
} else {
$title = "Approval Error";
$msg = "Not authorized";
}
start_page($CatID,$title,$msg);
start_browse($CatID);
exit;
} elseif ($disapprove)
{
if ($ADMIN_MODE) {
if(!$db->disapprove($disapprove,$err_msg))
{
$title = "Disapproval Error";
$msg = $err_msg;
} else {
$title = "Disapproved";
$msg = "Link disapproved";
}
} else {
$title = "Disapproval Error";
$msg = "Not authorized";
}
start_page($CatID,$title,$msg);
start_browse($CatID);
exit;
} elseif ($delete_link)
{
if ($ADMIN_MODE) {
if(!$db->delete_link($delete_link,$err_msg))
{
$title = "Error deleting submission";
$msg = $err_msg;
} else {
$title = "Deleted";
$msg = "Suggestion deleted";
}
} else {
$title = "Error deleting submission";
$msg = "Not authorized";
}
start_page($CatID,$title,$msg);
start_browse($CatID);
exit;
} elseif ($edit_link)
{
show_edit_link($edit_link,$title,$msg);
exit;
} elseif ($KeyWords)
{
//start_page();
$hits = $db->search($KeyWords);
if( (!$hits) or (empty($hits)) )
{
$junk = "";
$title = "Search Results";
$msg = "No Matches";
start_page($junk,$title,$msg);
} else {
$total = count($hits);
$title = "Search Results";
$msg = "Search returned $total matches";
$junk = "";
start_page($junk,$title,$msg);
while ( list ($key,$hit) = each ($hits))
{
if(!empty($hit))
{
$LinkID = $hit["LinkID"];
$LinkName = stripslashes($hit["LinkName"]);
$LinkDesc = stripslashes($hit["Description"]);
$LinkURL = stripslashes($hit["Url"]);
$CatID = $hit["CatID"];
$CatName = stripslashes($db->get_CatNames($CatID));
print "<DL>\n";
print "<DT><A HREF=\"$LinkURL\" TARGET=\"_NEW\">$LinkName</A>\n";
print "<DD>$LinkDesc\n";
print "<DD><B>Found In:</B> <A HREF=\"$PHP_SELF?viewCat=$CatID\">$CatName</A>\n";
print "</DL>\n";
}
}
}
print "<P><HR>\n";
start_browse($CatID);
exit;
} else {
// Something terribly bad happened - start fresh
start_page("","Error","Unknown error");
start_browse("");
exit;
}
?>