addRecipient(...) * * TODO: * * Twitter message: "Status Update: $rationale" * * Finish writing the code to send appropriate emails * - May want to log more information about the user in the request email * e.g. IP Address, User Agent. * - Confirmation requests probably to Hixie * - Confirmed status updates to commit-watches * Write the confirmation system to check in updates to the DB * - Add a better UI to allow user to confirm individual changes */ ?> $value) { if ($name == 'email') { $email = $value; // XXX do stripslashes() here and below? } elseif ($name == 'rationale') { $rationale = $value; } elseif ($value == 'TBW' || $value == 'WIP' || $value == 'SCS' || $value == 'none') { // Ignore any other values, including empty values. $status[addslashes($name)] = $value; } } // Ensure that email and rationale were provided if ($email == '' || !Email::isValidEmail($email) || $rationale == '' || !isUTF8($rationale) || mb_strlen($rationale) > 125) { getMissingInfo($email, $rationale, $status); } else if ($_SERVER['PATH_INFO'] == '/confirm') { updateDB($email, $rationale, $status); outputConfirmed(); } else { $body = getMailConfirmRequest($email, $rationale, $status); $sig = "HTML5 Status Updates\nhttp://www.whatwg.org/html5"; $mail = new Email(); $mail->setSubject("HTML5 Status Update"); $mail->addRecipient('To', 'whatwg@lachy.id.au', 'Lachlan Hunt'); $mail->setFrom("whatwg@whatwg.org", "WHATWG"); $mail->setSignature($sig); $mail->setText($body); $mail->send(); outputConfirmation($body, $sig); } function getMissingInfo($email, $rationale, $status) { ?>
You must provide a valid email address and rationale that is ≤ 125 characters.
$value) { $body .= "$name: $value\n"; $url .= '&'.urlencode($name).'='.urlencode($value); } $body .= "\nConfirm these changes:\n$url\n"; return $body; } function outputConfirmation($body, $sig) { ?>Your changes need to be confirmed before they will be committed. The following request has been sent:
The changes have been confirmed, $value) { if ($value == 'none') { $query = "DELETE FROM `section` WHERE name = '$name';"; } else { $query = "UPDATE section SET status = $statusId[$value] WHERE name = '$name'"; mysql_query($query); if (mysql_affected_rows() == 0) { $query = "INSERT INTO section (`id`,`name`,`status`) VALUES (NULL , '$name', '$statusId[$value]');"; mysql_query($query); } } //echo "$query | " . mysql_affected_rows() . "\n"; } } ?>