require "smilies.inc.php"; $bug_data_file = $bug_data_dir . "/bugs.dat"; $bug_lock_file = $bug_data_dir . "/bugs.lock"; function build_bug_tracker_nav() global $action, $session; $buffer = "<b>List Bugs</b>"; $buffer = "<a href=\"" . $session->localUrl($PHP_SELF) . "\">" . $buffer .= "<b>·</b> "; $buffer .= "<b>Add Bug</b>"; $buffer .= "<a href=\"" . $session->localUrl($PHP_SELF) . "?action=addbug\">Add Bug</a>"; $buffer .= "<b>·</b> "; $buffer .= "<a href=\"" . $session->localUrl("logout.php") . while (file_exists($bug_lock_file)) $fp = fopen($bug_lock_file, "w"); function unlock_bug_file($fp) function add_bug($bugnum, $desc) if (!$fp = fopen($bug_data_file, "a")) print "There was an error opening $bug_data_file!"; fwrite($fp, $bugnum . "\t" . $desc . "\n"); header("Location: bugtracker.php"); function display_add_bug() start_section("Add Bug", build_bug_tracker_nav(), false); <form method="get" action="bugtracker.php"> <input type="hidden" name="action" value="addbug" /> start_table(array("width" => "100%", "cellspacing" => 2, "cellpadding" => 0, "border" => 0)); form_item("Bug Number", "bugnum", $bugnum, true, 10); form_item("Description", "desc", $desc, true, 50); start_td(array("colspan" => 2, "align" => "center")); <input type="submit" value="Submit" /> function remove_bugs($bugs) print "No bugs were entered.\n"; /* I know this algorithm sucks. It's slow. Deal with it :) */ /* Build a little hashtable for the bugs */ for ($i = 0; $i < count($bugs); $i++) $bug_table[$bugs[$i]] = 1; $lines = file($bug_data_file); if (!$fp = fopen($bug_data_file, "w")) print "There was an error opening $bug_data_file!"; for ($i = 0; $i < count($lines); $i++) list($bugnum, $desc) = split("\t", $lines[$i], 2); if (!array_key_exists($bugnum, $bug_table)) fwrite($fp, $bugnum . "\t" . $desc); function display_remove_bugs() setup_site("Remove Bugs"); start_section("Remove Bugs", build_bug_tracker_nav(), false); print " Are you sure you want to remove the following bugs: "; $bug_count = count($bugs); for ($i = 0; $i < $bug_count; $i++) print "<b>" . $bugs[$i] . "</b>"; <form method="post" action="bugtracker.php"> <input type="hidden" name="action" value="removebug" /> for ($i = 0; $i < $bug_count; $i++) print " <input type=\"hidden\" name=\"bugs[]\" value=\""; print $bugs[$i] . "\" />\n"; <input type="submit" name="confirm" value="Yes" /> <input type="submit" name="confirm" value="No" /> start_section("Bugs", build_bug_tracker_nav(), false); if (!file_exists($bug_data_file)) print "<i>None. We're a bug-free Gaim!</i>"; $lines = file($bug_data_file); $line_count = count($lines); print "<i>None. We're a bug-free Gaim!</i>"; <form method="get" action="bugtracker.php"> <input type="hidden" name="action" value="removebug" /> $table = new Table(array("", "Bug Number", "Description"), $table->set_valignment(0, "top"); $table->set_valignment(1, "top"); $table->set_widths(array("20", "100", "100%")); for ($i = 0; $i < $line_count; $i++) list($bugnum, $desc) = split("\t", $lines[$i], 2); "<input type=\"checkbox\" name=\"bugs[]\" value=\"" . "<a href=\"http://sourceforge.net/tracker/index.php?" . "func=detail&aid=" . $bugnum . "&group_id=235&" . "\">" . $bugnum . "</a>", array("valign" => "top"), <input type="reset" value="Clear Checks" /> <input type="submit" value="Remove Bugs" /> /* Beginning of the main code */ if (!$users->logged_in() || !$users->is_active_user_admin()) header("Location: login.php"); if (isset($bugnum) && isset($desc)) else if ($action == "removebug") header("Location: bugtracker.php");