"Fixed in Subversion repository.", "Old STR" => "This STR has not been updated by the submitter for two or more weeks " ."and has been closed as required by the Mini-XML Configuration Management " ."Plan. If the issue still requires resolution, please re-submit a new " ."STR.", "Unresolvable" => "We are unable to resolve this problem with the information provided. " ."If you discover new information, please file a new STR referencing " ."this one." ); $subsystems = array( "Build Files", "Config Files", "Core API", "Documentation", "Multiple", "mxmldoc", "Sample Programs", "Web Site" ); $versions = array( "Trunk", "+2.6", "+2.5.1", "2.5", "2.4", "2.3", "2.2.2", "2.2.1", "2.2", "2.1", "2.0", "2.0rc1", "1.3", "1.2", "1.1.2", "1.1.1", "1.1", "1.0", "Web Site" ); // // Get the list of valid developers from the users table... // $managers = array(); $result = db_query("SELECT * FROM users WHERE is_published = 1 AND " ."level >= " . AUTH_DEVEL); while ($row = db_next($result)) $managers[$row["name"]] = $row["email"]; db_free($result); // // 'notify_users()' - Notify users of STR changes... // function notify_users($id, // I - STR # $what = "updated", // I - Reason for notification $contents = "") // I - Notification message { global $priority_long; global $scope_long; global $status_long; global $PHP_URL, $PROJECT_EMAIL, $PROJECT_NAME; $result = db_query("SELECT * FROM str WHERE id = $id"); if ($result) { $contents = wordwrap($contents); $row = db_next($result); $prtext = $priority_long[$row['priority']]; $sttext = $status_long[$row['status']]; $sctext = $scope_long[$row['scope']]; if ($row['subsystem'] != "") $subsystem = $row['subsystem']; else $subsystem = "Unassigned"; if ($row['fix_version'] != "") $fix_version = $row['fix_version']; else $fix_version = "Unassigned"; if (eregi("[a-z0-9_.]+", $row['create_user'])) $email = auth_user_email($row['create_user']); else $email = $row['create_user']; if ($row['create_user'] != $row['modify_user'] && $row['create_user'] != $manager && $email != "") mail($email, "$PROJECT_NAME STR #$id $what", "Your software trouble report #$id has been $what. You can check\n" ."the status of the report and add additional comments and/or files\n" ."at the following URL:\n" ."\n" ." $PHP_URL?L$id\n" ."\n" ." Summary: $row[summary]\n" ." Version: $row[str_version]\n" ." Status: $sttext\n" ." Priority: $prtext\n" ." Scope: $sctext\n" ." Subsystem: $subsystem\n" ."Fix Version: $fix_version\n" ."\n$contents" ."________________________________________________________________\n" ."Thank you for using the $PROJECT_NAME Software Trouble Report page!", "From: $PROJECT_EMAIL\r\n"); $ccresult = db_query("SELECT email FROM carboncopy WHERE url = 'str.php_L$id'"); if ($ccresult) { while ($ccrow = db_next($ccresult)) { mail($ccrow['email'], "$PROJECT_NAME STR #$id $what", "Software trouble report #$id has been $what. You can check\n" ."the status of the report and add additional comments and/or files\n" ."at the following URL:\n" ."\n" ." $PHP_URL?L$id\n" ."\n" ." Summary: $row[summary]\n" ." Version: $row[str_version]\n" ." Status: $sttext\n" ." Priority: $prtext\n" ." Scope: $sctext\n" ." Subsystem: $subsystem\n" ."Fix Version: $fix_version\n" ."\n$contents" ."________________________________________________________________\n" ."Thank you for using the $PROJECT_NAME Software Trouble Report page!", "From: $PROJECT_EMAIL\r\n"); } db_free($ccresult); } if ($row['manager_email'] != "") $manager = $row['manager_email']; else $manager = $PROJECT_EMAIL; if ($row['modify_user'] != $manager) mail($manager, "$PROJECT_NAME STR #$id $what", "The software trouble report #$id assigned to you has been $what.\n" ."You can manage the report and add additional comments and/or files\n" ."at the following URL:\n" ."\n" ." $PHP_URL?L$id\n" ."\n" ." Summary: $row[summary]\n" ." Version: $row[str_version]\n" ." Status: $sttext\n" ." Priority: $prtext\n" ." Scope: $sctext\n" ." Subsystem: $subsystem\n" ."Fix Version: $fix_version\n" ."\n$contents", "From: $PROJECT_EMAIL\r\n"); db_free($result); } } // Get command-line options... // // Usage: str.php [operation] [options] // // Operations: // // B = Batch update selected STRs // L = List all STRs // L# = List STR # // M# = Modify STR # // T# = Post text for STR # // F# = Post file for STR # // N = Post new STR // U# = Update notification for STR # // // Options: // // I# = Set first STR // P# = Set priority filter // S# = Set status filter // C# = Set scope filter // E# = Set email filter // Qtext = Set search text $priority = 0; $status = -2; $scope = 0; $search = ""; $index = 0; $femail = 0; if ($argc) { $op = $argv[0][0]; $id = (int)substr($argv[0], 1); if ($op != 'L' && $op != 'M' && $op != 'T' && $op != 'F' && $op != 'N' && $op != 'U' && $op != 'B') { html_header("Bugs & Features Error"); print("
Bad command '$op'!
\n"); html_footer(); exit(); } if (($op == 'M' || $op == 'B') && $LOGIN_LEVEL < AUTH_DEVEL) { html_header("Bugs & Features Error"); print("The '$op' command is not available to you!
\n"); html_footer(); exit(); } if (($op == 'M' || $op == 'T' || $op == 'F') && !$id) { html_header("Bugs & Features Error"); print("Command '$op' requires an STR number!
\n"); html_footer(); exit(); } if ($op == 'N' && $id) { html_header("Bugs & Features Error"); print("Command '$op' cannot have an STR number!
\n"); html_footer(); exit(); } for ($i = 1; $i < $argc; $i ++) { $option = substr($argv[$i], 1); switch ($argv[$i][0]) { case 'P' : // Set priority filter $priority = (int)$option; break; case 'S' : // Set status filter $status = (int)$option; break; case 'C' : // Set scope filter $scope = (int)$option; break; case 'Q' : // Set search text $search = urldecode($option); $i ++; while ($i < $argc) { $search .= urldecode(" $argv[$i]"); $i ++; } break; case 'I' : // Set first STR $index = (int)$option; if ($index < 0) $index = 0; break; case 'E' : // Show only problem reports matching the current email $femail = (int)$option; break; default : html_header("Bugs & Features Error"); print("Bad option '$argv[$i]'!
\n"); html_footer(); exit(); break; } } } else { $op = 'L'; $id = 0; } if ($REQUEST_METHOD == "POST") { if (array_key_exists("FPRIORITY", $_POST)) $priority = (int)$_POST["FPRIORITY"]; if (array_key_exists("FSTATUS", $_POST)) $status = (int)$_POST["FSTATUS"]; if (array_key_exists("FSCOPE", $_POST)) $scope = (int)$_POST["FSCOPE"]; if (array_key_exists("FEMAIL", $_POST)) $femail = (int)$_POST["FEMAIL"]; if (array_key_exists("SEARCH", $_POST)) $search = $_POST["SEARCH"]; } $options = "+P$priority+S$status+C$scope+I$index+E$femail+Q" . urlencode($search); // B = Batch update selected STRs // L = List all STRs // L# = List STR # // M# = Modify STR # // T# = Post text for STR # // F# = Post file for STR # // N = Post new STR // U# = Update notification for STR # switch ($op) { case 'B' : // Batch update selected STRs if ($REQUEST_METHOD != "POST") { header("Location: $PHP_SELF?L$options"); break; } if (array_key_exists("STATUS", $_POST) && ($_POST["STATUS"] != "" || $_POST["PRIORITY"] != "" || $_POST["MANAGER_EMAIL"] != "" || $_POST["MESSAGE"] != "")) { $time = time(); $manager_email = db_escape($_POST["MANAGER_EMAIL"]); $modify_user = db_escape($_COOKIE["FROM"]); $message = $_POST["MESSAGE"]; if ($message != "") { $contents = db_escape($messages[$message]); $mailmsg = $messages[$message] . "\n\n"; } else { $contents = ""; $mailmsg = ""; } $query = "modify_date = $time, modify_user = '$modify_user'"; if ($_POST["STATUS"] != "") $query .= ", status = $_POST[STATUS]"; if ($_POST["PRIORITY"] != "") $query .= ", priority = $_POST[PRIORITY]"; if ($manager_email != "") $query .= ", manager_email = '$manager_email'"; db_query("BEGIN TRANSACTION"); reset($_POST); while (list($key, $val) = each($_POST)) if (substr($key, 0, 3) == "ID_") { $id = (int)substr($key, 3); db_query("UPDATE str SET $query WHERE id = $id"); if ($contents != "") { db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$contents'," ."$time,'$modify_user')"); notify_users($id, "updated", $mailmsg); } } db_query("COMMIT TRANSACTION"); } header("Location: $PHP_SELF?L$options"); break; case 'L' : // List (all) STR(s) if ($id) { html_header("STR #$id"); $result = db_query("SELECT * FROM str WHERE id = $id"); if (db_count($result) != 1) { print("Error: STR #$id was not found!
\n"); html_footer(); exit(); } $row = db_next($result); html_start_links(1); html_link("Return to Bugs & Features", "$PHP_SELF?L$options"); if ($row['status'] >= $STR_STATUS_ACTIVE) { html_link("Post Text", "$PHP_SELF?T$id$options"); html_link("Post File", "$PHP_SELF?F$id$options"); } if ($LOGIN_LEVEL >= AUTH_DEVEL) html_link("Modify STR", "$PHP_SELF?M$id$options"); html_end_links(); $create_user = sanitize_email($row['create_user']); $manager_email = sanitize_email($row['manager_email']); $subsystem = $row['subsystem']; $summary = htmlspecialchars($row['summary'], ENT_QUOTES); $prtext = $priority_long[$row['priority']]; $sttext = $status_long[$row['status']]; $sctext = $scope_long[$row['scope']]; $str_version = $row['str_version']; $fix_version = $row['fix_version']; if ($manager_email == "") $manager_email = "Unassigned"; if ($subsystem == "") $subsystem = "Unassigned"; if ($fix_version == "") $fix_version = "Unassigned"; print("ID: | $id |
---|---|
Duplicate Of: | " ."STR " ."#$row[master_id] |
This STR is " ."currently hidden from public view. | |
Status: | $sttext |
Priority: | $prtext |
Scope: | $sctext |
Subsystem: | $subsystem |
Summary: | $summary |
Version: | $str_version |
Created By: | $create_user |
Assigned To: | $manager_email |
Fix Version: | $fix_version |
Update Notification: | " ."" ." |
Trouble Report Files:
\n"); if ($row['status'] >= $STR_STATUS_ACTIVE) { html_start_links(); html_link("Post File", "$PHP_SELF?F$id$options"); html_end_links(); } $result = db_query("SELECT * FROM strfile WHERE " ."str_id = $id AND is_published = 1"); if (db_count($result) == 0) print("No files
\n"); else { html_start_table(array("Name/Time/Date", "Filename")); while ($row = db_next($result)) { $date = date("M d, Y", $row['create_date']); $time = date("H:i", $row['create_date']); $email = sanitize_email($row['create_user']); $filename = htmlspecialchars($row['filename']); html_start_row(); print("Trouble Report Dialog:
\n"); if ($row['status'] >= $STR_STATUS_ACTIVE) { html_start_links(); html_link("Post Text", "$PHP_SELF?T$id$options"); html_end_links(); } $result = db_query("SELECT * FROM strtext WHERE " ."str_id = $id AND is_published = 1"); if (db_count($result) == 0) print("No text
\n"); else { html_start_table(array("Name/Time/Date", "Text")); while ($row = db_next($result)) { $date = date("M d, Y", $row['create_date']); $time = date("H:i", $row['create_date']); $email = sanitize_email($row['create_user']); $contents = quote_text($row['contents']); html_start_row(); print("No STRs found.
\n"); if (($priority || $status || $scope) && $search != "") print("Search for \"$htmlsearch\" in all STRs
\n"); html_footer(); exit(); } if ($index >= $count) $index = $count - ($count % $PAGE_MAX); if ($index < 0) $index = 0; $start = $index + 1; $end = $index + $PAGE_MAX; if ($end > $count) $end = $count; $prev = $index - $PAGE_MAX; if ($prev < 0) $prev = 0; $next = $index + $PAGE_MAX; print("$count STR(s) found, showing $start to $end:\n"); if ($LOGIN_LEVEL >= AUTH_DEVEL) print("
"); print(""
."MACH = Machine, "
."OS = Operating System, "
."STR = Software Trouble Report, "
." = hidden from public view
Error: STR #$id was not found!
\n"); html_footer(); exit(); } $row = db_next($result); $create_user = htmlspecialchars($row['create_user']); $manager_email = htmlspecialchars($row['manager_email']); $summary = htmlspecialchars($row['summary'], ENT_QUOTES); print("\n"); print("Trouble Report Files: " ."Post File" ."
\n"); $result = db_query("SELECT * FROM strfile WHERE str_id = $id"); if (db_count($result) == 0) print("No files
\n"); else { print("Name/Time/Date | " ."Filename |
---|---|
$email $time $date " ." | "
."" ."$filename | " ."
Trouble Report Dialog: " ."Post Text" ."
\n"); $result = db_query("SELECT * FROM strtext WHERE " ."str_id = $id"); if (db_count($result) == 0) print("No text
\n"); else { print("Name/Time/Date | " ."Text |
---|---|
$email $time $date " ." | "
."$contents | " ."
Error: Please fill in the fields marked in " ."bold red below and resubmit " ."your trouble report.
\n"); $hstart = ""; $hend = ""; } else { $hstart = ""; $hend = ""; } print("\n"); html_footer(); } break; case 'F' : // Post file for STR # if ($REQUEST_METHOD == "POST") { if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL) $email = $LOGIN_USER; else if (array_key_exists("EMAIL", $_POST) && validate_email($_POST["EMAIL"])) { $email = $_POST["EMAIL"]; setcookie("FROM", "$email", time() + 90 * 86400, "/"); } else if (array_key_exists("FROM", $_COOKIE)) $email = $_COOKIE["FROM"]; else $email = ""; if (ereg("Anonymous.*", $email)) $email = ""; if (array_key_exists("STRFILE", $_FILES)) { $filename = $_FILES['STRFILE']['name']; if ($filename[0] == '.' || $filename[0] == '/') $filename = ""; } else $filename = ""; if ($email != "" && $filename != "") $havedata = 1; } else { if ($LOGIN_USER != "") $email = $LOGIN_USER; else if (array_key_exists("FROM", $_COOKIE)) $email = $_COOKIE["FROM"]; else $email = ""; $filename = ""; if (ereg("Anonymous.*", $email)) $email = ""; } if ($REQUEST_METHOD == "POST" && $havedata) { $time = time(); $temail = db_escape($email); $tmp_name = $_FILES['STRFILE']['tmp_name']; $name = $_FILES['STRFILE']['name']; $tname = db_escape($name); $infile = fopen($tmp_name, "rb"); if (!$infile) { html_header("Error"); print("Error! Unable to open file attachment!
\n"); html_footer(); exit(); } mkdir("strfiles/$id"); $outfile = fopen("strfiles/$id/$name", "wb"); if (!$outfile) { html_header("Error"); print("Error! Unable to save file attachment!
\n"); html_footer(); exit(); } while ($data = fread($infile, 8192)) fwrite($outfile, $data); fclose($infile); fclose($outfile); db_query("INSERT INTO strfile VALUES(NULL,$id,1,'$tname'," ."$time,'$temail')"); db_query("UPDATE str SET modify_date=$time, modify_user='$temail' " ."WHERE id = $id"); db_query("UPDATE str SET status=$STR_STATUS_PENDING WHERE " ."id = $id AND status >= $STR_STATUS_ACTIVE AND " ."status < $STR_STATUS_NEW"); header("Location: $PHP_SELF?L$id$options"); notify_users($id, "updated", "Added file $name\n\n"); } else { html_header("Post File For STR #$id"); html_start_links(1); html_link("Return to STR #$id", "$PHP_SELF?L$id$options"); html_end_links(); if ($REQUEST_METHOD == "POST") { print("Error: Please fill in the fields marked in " ."bold red below and resubmit " ."your trouble report.
\n"); $hstart = ""; $hend = ""; } else { $hstart = ""; $hend = ""; } print("\n"); html_footer(); } break; case 'N' : // Post new STR $havedata = 0; if ($REQUEST_METHOD == "POST") { $npriority = $_POST["PRIORITY"]; $nscope = $_POST["SCOPE"]; $summary = $_POST["SUMMARY"]; $version = $_POST["VERSION"]; $contents = $_POST["CONTENTS"]; if ($LOGIN_USER != "" && $LOGIN_LEVEL < AUTH_DEVEL) $email = $LOGIN_USER; else if (array_key_exists("EMAIL", $_POST) && validate_email($_POST["EMAIL"])) { $email = $_POST["EMAIL"]; setcookie("FROM", "$email", time() + 90 * 86400, "/"); } else if (array_key_exists("FROM", $_COOKIE)) $email = $_COOKIE["FROM"]; else $email = ""; if (array_key_exists("STRFILE", $_FILES)) { $filename = $_FILES['STRFILE']['name']; if ($filename[0] == '.' || $filename[0] == '/') $filename = ""; } else $filename = ""; if ($npriority && $nscope && $summary != "" && $email != "" && $version != "" && $contents != "") $havedata = 1; } else { if ($LOGIN_USER != "") $email = $LOGIN_USER; else if (array_key_exists("FROM", $_COOKIE)) $email = $_COOKIE["FROM"]; else $email = ""; $npriority = 0; $nscope = 0; $summary = ""; $version = ""; $contents = ""; $filename = ""; } if (ereg("Anonymous.*", $email)) $email = ""; if ($REQUEST_METHOD == "POST" && $havedata) { $time = time(); $temail = db_escape($email); $tsummary = db_escape($summary); $tcontents = db_escape($contents); db_query("INSERT INTO str VALUES(NULL,0," ."$_POST[IS_PUBLISHED],$STR_STATUS_NEW," ."$npriority,$nscope,'$tsummary','','$version','',''," ."$time,'$temail',$time,'$temail')"); $id = db_insert_id(); db_query("INSERT INTO strtext VALUES(NULL,$id,1,'$tcontents'," ."$time,'$temail')"); if ($filename != "") { $tmp_name = $_FILES['STRFILE']['tmp_name']; $name = $_FILES['STRFILE']['name']; $tname = db_escape($name); $infile = fopen($tmp_name, "rb"); if (!$infile) { html_header("Error"); print("Error! Unable to open file attachment!
\n"); html_footer(); exit(); } mkdir("strfiles/$id"); $outfile = fopen("strfiles/$id/$name", "wb"); if (!$outfile) { html_header("Error"); print("Error! Unable to save file attachment!
\n"); html_footer(); exit(); } while ($data = fread($infile, 8192)) fwrite($outfile, $data); fclose($infile); fclose($outfile); db_query("INSERT INTO strfile VALUES(NULL,$id,1,'$tname'," ."$time,'$temail')"); } header("Location: $PHP_SELF?L$id$options"); notify_users($id, "created", "$contents\n\n"); } else { html_header("Submit Bug or Feature Request"); html_start_links(1); html_link("Return to Bugs & Features", "$PHP_SELF?L$options"); html_end_links(); if ($REQUEST_METHOD == "POST") { print("Error: Please fill in the fields marked in " ."bold red below and resubmit " ."your trouble report.
\n"); $hstart = ""; $hend = ""; } else { print("Please use this form to report all bugs and request " ."features in the $PROJECT_NAME software. Be sure to include " ."the operating system, compiler, sample programs and/or " ."files, and any other information you can about your " ."problem. Thank you for helping us to improve " ."$PROJECT_NAME!
\n"); $hstart = ""; $hend = ""; } print("\n"); html_footer(); } break; case 'U' : // Update notification status // EMAIL and NOTIFICATION variables hold status; add/delete from strcc... $havedata = 0; if ($REQUEST_METHOD != "POST") { html_header("Bugs & Features Error"); print("The '$op' command requires a POST request!\n"); html_footer(); exit(); } $notification = $_POST["NOTIFICATION"]; $email = $_POST["EMAIL"]; if (($notification != "ON" && $notification != "OFF") || $email == "" || !validate_email($email)) { html_header("Bugs & Features Error"); print("
Please press your browsers back button and enter a valid " ."EMail address and choose whether to receive notification " ."messages.
\n"); html_footer(); exit(); } setcookie("FROM", "$email", time() + 90 * 86400, "/"); $result = db_query("SELECT * FROM carboncopy WHERE " ."url = 'str.php_L$id' AND email = '$email'"); html_header("STR #$id Notifications"); html_start_links(); html_link("Return to STR #$id", "$PHP_SELF?L$id$options"); html_end_links(); if ($notification == "ON") { if ($result && db_count($result) > 0) print("Your email address has already been added to the " ."notification list for STR #$id!
\n"); else { db_query("INSERT INTO carboncopy VALUES(NULL,'str.php?L$id','$email')"); print("Your email address has been added to the notification list " ."for STR #$id.
\n"); } } else if ($result && db_count($result) > 0) { db_query("DELETE FROM carboncopy WHERE " ."url = 'str.php?L$id' AND email = '$email'"); print("Your email address has been removed from the notification list " ."for STR #$id.
\n"); } else { print("Your email address is not on the notification list for " ."STR #$id!
\n"); } if ($result) db_free($result); html_footer(); break; } // // End of "$Id$". // ?>