cvs: php-bugs-web / bug.php /include functions.inc
| From: | jim winstead | Date: | Sun, 12 May 2002 18:01:40 +0000 |
| Subject: | cvs: php-bugs-web / bug.php /include functions.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-10130@lists.php.net to get a copy of this message | ||
jimw Sun May 12 14:01:40 2002 EDT
Modified files:
/php-bugs-web bug.php
/php-bugs-web/include functions.inc
Log:
why do i get the feeling i'm the only one actually capable of writing some php code around
here? sheesh.
Index: php-bugs-web/bug.php
diff -u php-bugs-web/bug.php:1.35 php-bugs-web/bug.php:1.36
--- php-bugs-web/bug.php:1.35 Sun May 5 13:33:36 2002
+++ php-bugs-web/bug.php Sun May 12 14:01:40 2002
@@ -55,6 +55,14 @@
$errors[] = "You must provide a valid email address.";
}
+ # check that they aren't using a php.net mail address without
+ # being authenticated (oh, the horror!)
+ if (preg_match('/^(.+)@php\.net/i', $in['commentemail'], $m)) {
+ if ($user != stripslashes($m[1]) || !verify_password($user,$pass)) {
+ $errors[] = "You have to be logged in as a developer to use your php.net email
address.";
+ }
+ }
+
$ncomment = trim($ncomment);
if (!$ncomment) {
$errors[] = "You must provide a comment.";
@@ -75,6 +83,20 @@
$ncomment = trim($ncomment);
if (!$ncomment) {
$errors[] = "You must provide a comment.";
+ }
+
+ # check that they aren't being bad and setting a status they
+ # aren't allowed to (oh, the horrors.)
+ if ($in['status'] != $bug['status'] || $state_type[$in['status']] !=
2) {
+ $errors[] = "You aren't allowed to change a bug to that state.";
+ }
+
+ # check that they aren't changing the mail to a php.net address
+ # (gosh, somebody might be fooled!)
+ if (preg_match('/^(.+)@php\.net/i', $in['email'], $m)) {
+ if ($user != $m[1] || !verify_password($user,$pass)) {
+ $errors[] = "You have to be logged in as a developer to use your php.net email
address.";
+ }
}
if (!$errors && !($errors = incoming_details_are_valid($in))) {
Index: php-bugs-web/include/functions.inc
diff -u php-bugs-web/include/functions.inc:1.30 php-bugs-web/include/functions.inc:1.31
--- php-bugs-web/include/functions.inc:1.30 Sat May 4 11:04:40 2002
+++ php-bugs-web/include/functions.inc Sun May 12 14:01:40 2002
@@ -53,8 +53,27 @@
echo '<option value="All"', ($limit=='All' ? "
selected": ""),">All</option>\n";
}
+$state_types = array (
+ "Open" => 2,
+ "Closed" => 2,
+ "Duplicate" => 2,
+ "Critical" => 1,
+ "Assigned" => 1,
+ "Analyzed" => 1,
+ "Suspended" => 1,
+ "No Feedback" => 1,
+ "Feedback" => 1,
+ "Old Feedback" => 0,
+ "Stale" => 0,
+ "Fresh" => 0,
+ "Bogus" => 2,
+ "All" => 0
+);
+
function show_state_options($state, $user_mode=0, $default="")
{
+ global $state_types;
+
if (!$state && !$default) {
$state = "Open";
}
@@ -62,23 +81,6 @@
$state = $default;
}
- $state_types = array (
- "Open" => 2,
- "Closed" => 2,
- "Duplicate" => 2,
- "Critical" => 1,
- "Assigned" => 1,
- "Analyzed" => 1,
- "Suspended" => 1,
- "No Feedback" => 1,
- "Feedback" => 1,
- "Old Feedback" => 0,
- "Stale" => 0,
- "Fresh" => 0,
- "Bogus" => 2,
- "All" => 0
- );
-
/* regular users can only pick states with type 2 for unclosed bugs */
if($state != "All" && $state_types[$state] == 1 && $user_mode == 2) {
/* If state was 'Feedback', set state to 'Open' automatically. */