cvs: php-master-web /include cvs-auth.inc email-validation.inc functions.inc login.inc /manage user-notes.php
| From: | Gabor Hojtsy | Date: | Thu, 10 Jun 2004 08:28:48 +0000 |
| Subject: | cvs: php-master-web /include cvs-auth.inc email-validation.inc functions.inc login.inc /manage user-notes.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-24911@lists.php.net to get a copy of this message | ||
goba Thu Jun 10 04:28:48 2004 EDT
Modified files:
/php-master-web/include cvs-auth.inc email-validation.inc
functions.inc login.inc
/php-master-web/manage user-notes.php
Log:
lots of cleanups:
- remove dependency on register_globals at some places (include files)
- fix HTML tags (body was missing from master pages)
- indentation, coding standards, adding cvs ids
- converting some configuration related globals to constants
http://cvs.php.net/diff.php/php-master-web/include/cvs-auth.inc?r1=1.2&r2=1.3&ty=u Index: php-master-web/include/cvs-auth.inc diff -u php-master-web/include/cvs-auth.inc:1.2 php-master-web/include/cvs-auth.inc:1.3 --- php-master-web/include/cvs-auth.inc:1.2 Fri Sep 5 06:06:36 2003 +++ php-master-web/include/cvs-auth.inc Thu Jun 10 04:28:47 2004 @@ -1,35 +1,35 @@ <?php -/* $Id: cvs-auth.inc,v 1.2 2003/09/05 10:06:36 goba Exp $ */ +/* $Id: cvs-auth.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ */ -$ignore_password = false; -$passwd_file = "/repository/CVSROOT/passwd"; +define("LOGIN_IGNORE_PWD", FALSE); +define("LOGIN_PWD_FILE", "/repository/CVSROOT/passwd"); -function find_password($user) { - global $passwd_file, $ignore_password; - if ($ignore_password) return " "; // can't be "" - $fp = fopen($passwd_file, "r"); - if (!$fp) { die("unable to open CVS users file"); } - while(!feof($fp)) { - $line=fgets($fp,120); - list($luser,$passwd,$junk) = explode(":",$line); - if($user==$luser) { - fclose($fp); - return($passwd); - } - } - fclose($fp); - return(""); +function find_password($user) +{ + if (LOGIN_IGNORE_PWD) return " "; // should be at least one char + $fp = fopen(LOGIN_PWD_FILE, "r"); + if (!$fp) { + die("ERROR: Unable to open CVS users file!"); + } + while(!feof($fp)) { + $line = fgets($fp, 120); + list($luser, $passwd, $junk) = explode(":", $line); + if ($user == $luser) { + fclose($fp); + return $passwd; + } + } + fclose($fp); + return ""; } -function verify_password($user, $pass) { - global $ignore_password; - $psw = find_password($user); - if (strlen($psw) > 0) { - if ($ignore_password || crypt($pass,substr($psw,0,2)) == $psw) { - return true; - } - } - return false; +function verify_password($user, $pass) +{ + $psw = find_password($user); + if (strlen($psw) > 0) { + if (LOGIN_IGNORE_PWD || crypt($pass, substr($psw, 0, 2)) == $psw) { + return TRUE; + } + } + return FALSE; } - -?> http://cvs.php.net/diff.php/php-master-web/include/email-validation.inc?r1=1.2&r2=1.3&ty=u Index: php-master-web/include/email-validation.inc diff -u php-master-web/include/email-validation.inc:1.2 php-master-web/include/email-validation.inc:1.3 --- php-master-web/include/email-validation.inc:1.2 Sun Aug 10 07:01:29 2003 +++ php-master-web/include/email-validation.inc Thu Jun 10 04:28:47 2004 @@ -1,9 +1,8 @@ <?php +// $Id: email-validation.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ -// $Id: email-validation.inc,v 1.2 2003/08/10 11:01:29 goba Exp $ - -// Try to remove anti-SPAM bits -function clean_AntiSPAM($email) +// Try to remove antispam bits from the address +function clean_antispam($email) { $remove_spam = "![-_]?(NO|I[-_]?HATE|DELETE|REMOVE)[-_]?(THIS)?(ME|SPAM)?[-_]?!i"; return preg_replace($remove_spam, "", trim($email)); @@ -15,16 +14,16 @@ // Exclude our mailing list hosting servers $hosts_regex = "!(lists\.php\.net|chek[^\.*]\.com)!i"; $excluded_hosts = preg_match($hosts_regex, $email); - + // Email addresses need to match this pattern $email_regex = ":^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~ ])+" . "@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+" . "[a-zA-Z]{2,6}\$:i"; - + // If address is not under excluded hosts, and fits the regex, // then we belive that it is a good email address if (!$excluded_hosts && !empty($email)) { - return preg_match($email_regex, $email); + return preg_match($email_regex, $email); } else { return FALSE; } http://cvs.php.net/diff.php/php-master-web/include/functions.inc?r1=1.8&r2=1.9&ty=u Index: php-master-web/include/functions.inc diff -u php-master-web/include/functions.inc:1.8 php-master-web/include/functions.inc:1.9 --- php-master-web/include/functions.inc:1.8 Sun Oct 5 14:28:40 2003 +++ php-master-web/include/functions.inc Thu Jun 10 04:28:47 2004 @@ -1,4 +1,5 @@ <?php +// $Id: functions.inc,v 1.9 2004/06/10 08:28:47 goba Exp $ // Shorthand function for htmlspecialchars function hsc($str) { @@ -35,16 +36,21 @@ <title><?php echo $title;?></title> <link rel="stylesheet" type="text/css" href="/style.css" /> </head> -<div id="header"> -<div id="logo"><a href="http://www.php.net/"><img src="/include/logo.gif" width="53" height="28" border="0" alt="php" align="absmiddle" /></a></div> -<div id="links"> - <a href="/manage/event.php">events</a> -• <a href="/inventory.php">inventory</a> -• <a href="/manage/mirrors.php">mirrors</a> -• <a href="/manage/users.php">users</a> -• <a href="/manage/user-notes.php">notes</a> -</div> -</div> +<body> + <div id="header"> + <div id="logo"> + <a href="http://www.php.net/"> + <img src="/include/logo.gif" width="53" height="28" border="0" alt="php" align="absmiddle" /> + </a> + </div> + <div id="links"> + <a href="/manage/event.php">events</a> • + <a href="/inventory.php">inventory</a> • + <a href="/manage/mirrors.php">mirrors</a> • + <a href="/manage/users.php">users</a> • + <a href="/manage/user-notes.php">notes</a> + </div> + </div> <?php } http://cvs.php.net/diff.php/php-master-web/include/login.inc?r1=1.2&r2=1.3&ty=u Index: php-master-web/include/login.inc diff -u php-master-web/include/login.inc:1.2 php-master-web/include/login.inc:1.3 --- php-master-web/include/login.inc:1.2 Sat Oct 27 15:59:55 2001 +++ php-master-web/include/login.inc Thu Jun 10 04:28:47 2004 @@ -1,33 +1,48 @@ <?php +/* $Id: login.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ */ -require 'cvs-auth.inc'; +include_once 'cvs-auth.inc'; -if (isset($save) && isset($user) && isset($pw)) { - setcookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/','.php.net'); +// User not logged in +$user = $pw = FALSE; + +// Set magic cookie if login information is available +if (isset($_POST['save']) && isset($_POST['user']) && isset($_POST['pw'])) { + setcookie( + "MAGIC_COOKIE", + base64_encode("{$_POST['user']}:{$_POST['pw']}"), + time()+3600*24*12, + '/', + '.php.net' + ); + list($user, $pw) = array($_POST['user'], $_POST['pw']); } -if (isset($MAGIC_COOKIE) && !isset($user) && !isset($pw)) { - list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE)); + +// Preserve information previously set in magic cookie if available +if (isset($_COOKIE['MAGIC_COOKIE']) && !isset($_POST['user']) && !isset($_POST['pw'])) { + list($user, $pw) = explode(":", base64_decode($_COOKIE['MAGIC_COOKIE'])); } function query_string() { - if ($GLOBALS['QUERY_STRING']) { - return htmlspecialchars("?$GLOBALS[QUERY_STRING]"); - } + if ($_SERVER['QUERY_STRING']) { + return htmlspecialchars("?{$_SERVER['QUERY_STRING']}"); + } } function preserve_form_fields() { - if ($GLOBALS['REQUEST_METHOD'] == "POST" && @is_array($GLOBALS['in'])) { - while (list($k,$v) = each($GLOBALS['in'])) { - echo "<input type=\"hidden\" name=\"in[", htmlspecialchars($k), - "]\" value=\"", htmlspecialchars($v), "\" />\n"; + if ($_SERVER['REQUEST_METHOD'] == "POST" && @is_array($_POST['in'])) { + while (list($k, $v) = each($_POST['in'])) { + echo "<input type=\"hidden\" name=\"in[", htmlspecialchars($k), + "]\" value=\"", htmlspecialchars($v), "\" />\n"; + } } - } } -if (!$user || !$pw || !verify_password($user,$pw)) {?> +// Login form, if the user is not yet logged in +if (!$user || !$pw || !verify_password($user,$pw)) { ?> <html> <head> - <title>you must log in</title> + <title>You must log in!</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF, query_string();?>"> http://cvs.php.net/diff.php/php-master-web/manage/user-notes.php?r1=1.39&r2=1.40&ty=u Index: php-master-web/manage/user-notes.php diff -u php-master-web/manage/user-notes.php:1.39 php-master-web/manage/user-notes.php:1.40 --- php-master-web/manage/user-notes.php:1.39 Wed May 26 06:15:09 2004 +++ php-master-web/manage/user-notes.php Thu Jun 10 04:28:48 2004 @@ -1,16 +1,17 @@ <?php +// $Id: user-notes.php,v 1.40 2004/06/10 08:28:48 goba Exp $ -require_once 'functions.inc'; -require_once 'cvs-auth.inc'; -require_once 'email-validation.inc'; +include_once 'functions.inc'; +include_once 'cvs-auth.inc'; +include_once 'email-validation.inc'; // ** alerts ** remove comment when alerts are on-line //require_once 'alert_lib.inc'; -$mailto = "php-notes@lists.php.net"; +$mailto = $mailfrom = "php-notes@lists.php.net"; $reject_text = 'You are receiving this email because your note posted -to the on-line PHP manual has been removed by one of the editors. +to the online PHP manual has been removed by one of the editors. Read the following paragraphs carefully, because they contain pointers to resources better suited for requesting support or @@ -20,25 +21,18 @@ The user contributed notes are not an appropriate place to ask questions, report bugs or suggest new features; please -use the resources listed in <http://www.php.net/support.php> +use the resources listed on <http://php.net/support> for those purposes. This was clearly stated in the page you used to submit your note, please carefully re-read those instructions before submitting future contributions. -Bug Submissions and Feature Requests should be entered at +Bug submissions and feature requests should be entered at <http://bugs.php.net/>. For documentation errors use the bug system, and classify the bug as "Documentation problem". Support and ways to find answers to your questions can be found -at <http://www.php.net/support.php>. +at <http://php.net/support>. -Your note has been removed from the on-line manual.'; - -// Use class names instead of colors -ini_set('highlight.comment', 'comment'); -ini_set('highlight.default', 'default'); -ini_set('highlight.keyword', 'keyword'); -ini_set('highlight.string', 'string'); -ini_set('highlight.html', 'html'); +Your note has been removed from the online manual.'; if($user && $pass) { setcookie("MAGIC_COOKIE",base64_encode("$user:$pass"),time()+3600*24*12,'/','.php.net'); @@ -211,7 +205,7 @@ //$mailto .= get_emails_for_sect($row["sect"]); mail($mailto,"note $row[id] ".($action == "reject" ? "rejected" : "deleted")." from $row[sect] by $user","Note Submitter: $row[user]\n\n----\n\n".$row['note'],"From: $user@php.net\r\nIn-Reply-To: <note-$id@php.net>"); if ($action == 'reject') { - mail_user($row['user'], "note $row[id] rejected and deleted from $row[sect] by notes editor $user",$reject_text."\n\n----- Copy of your note below -----\n\n".$row['note']); + mail_user($row['user'], $mailfrom, "note $row[id] rejected and deleted from $row[sect] by notes editor $user",$reject_text."\n\n----- Copy of your note below -----\n\n".$row['note']); } } @@ -255,7 +249,7 @@ //$mailto .= get_emails_for_sect($row["sect"]); mail($mailto,"note $row[id] modified in $row[sect] by $user",stripslashes($note)."\n\n--was--\n$row[note]\n\nhttp://www.php.net/manual/en/$row[sect].php","From: $user@php.net\r\nIn-Reply-To: <note-$id@php.net>"); if (addslashes($row["sect"]) != $sect) { - mail_user($email, "note $id moved from $row[sect] to $sect by notes editor $user", "----- Copy of your note below -----\n\n".stripslashes($note)); + mail_user($email, $mailfrom, "note $id moved from $row[sect] to $sect by notes editor $user", "----- Copy of your note below -----\n\n".stripslashes($note)); } header('Location: user-notes.php?id=' . $id . '&was=' . $action); exit; @@ -308,6 +302,15 @@ foot(); } +// ---------------------------------------------------------------------------------- + +// Use class names instead of colors +ini_set('highlight.comment', 'comment'); +ini_set('highlight.default', 'default'); +ini_set('highlight.keyword', 'keyword'); +ini_set('highlight.string', 'string'); +ini_set('highlight.html', 'html'); + // Copied over from phpweb (should be syncronised if changed) function clean_note($text) { @@ -359,11 +362,17 @@ else { echo $highlighted; } } -function mail_user($email, $subject, $message) +// Send out a mail to the note submitter, with an envelope sender ignoring bounces +function mail_user($mailto, $mailfrom, $subject, $message) { - $email = clean_antispam($email); - if (is_emailable_address($email)) { - # use an envelope sender that lets us ignore bounces - mail($email,$subject,$message,"From: webmaster@php.net", '-fbounces-ignored@php.net'); - } + $email = clean_antispam($email); + if (is_emailable_address($email)) { + mail( + $mailto, + $subject, + $message, + "From: $mailfrom", + "-fbounces-ignored@php.net" + ); + } }
http://cvs.php.net/diff.php/php-master-web/include/cvs-auth.inc?r1=1.2&r2=1.3&ty=u Index: php-master-web/include/cvs-auth.inc diff -u php-master-web/include/cvs-auth.inc:1.2 php-master-web/include/cvs-auth.inc:1.3 --- php-master-web/include/cvs-auth.inc:1.2 Fri Sep 5 06:06:36 2003 +++ php-master-web/include/cvs-auth.inc Thu Jun 10 04:28:47 2004 @@ -1,35 +1,35 @@ <?php -/* $Id: cvs-auth.inc,v 1.2 2003/09/05 10:06:36 goba Exp $ */ +/* $Id: cvs-auth.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ */ -$ignore_password = false; -$passwd_file = "/repository/CVSROOT/passwd"; +define("LOGIN_IGNORE_PWD", FALSE); +define("LOGIN_PWD_FILE", "/repository/CVSROOT/passwd"); -function find_password($user) { - global $passwd_file, $ignore_password; - if ($ignore_password) return " "; // can't be "" - $fp = fopen($passwd_file, "r"); - if (!$fp) { die("unable to open CVS users file"); } - while(!feof($fp)) { - $line=fgets($fp,120); - list($luser,$passwd,$junk) = explode(":",$line); - if($user==$luser) { - fclose($fp); - return($passwd); - } - } - fclose($fp); - return(""); +function find_password($user) +{ + if (LOGIN_IGNORE_PWD) return " "; // should be at least one char + $fp = fopen(LOGIN_PWD_FILE, "r"); + if (!$fp) { + die("ERROR: Unable to open CVS users file!"); + } + while(!feof($fp)) { + $line = fgets($fp, 120); + list($luser, $passwd, $junk) = explode(":", $line); + if ($user == $luser) { + fclose($fp); + return $passwd; + } + } + fclose($fp); + return ""; } -function verify_password($user, $pass) { - global $ignore_password; - $psw = find_password($user); - if (strlen($psw) > 0) { - if ($ignore_password || crypt($pass,substr($psw,0,2)) == $psw) { - return true; - } - } - return false; +function verify_password($user, $pass) +{ + $psw = find_password($user); + if (strlen($psw) > 0) { + if (LOGIN_IGNORE_PWD || crypt($pass, substr($psw, 0, 2)) == $psw) { + return TRUE; + } + } + return FALSE; } - -?> http://cvs.php.net/diff.php/php-master-web/include/email-validation.inc?r1=1.2&r2=1.3&ty=u Index: php-master-web/include/email-validation.inc diff -u php-master-web/include/email-validation.inc:1.2 php-master-web/include/email-validation.inc:1.3 --- php-master-web/include/email-validation.inc:1.2 Sun Aug 10 07:01:29 2003 +++ php-master-web/include/email-validation.inc Thu Jun 10 04:28:47 2004 @@ -1,9 +1,8 @@ <?php +// $Id: email-validation.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ -// $Id: email-validation.inc,v 1.2 2003/08/10 11:01:29 goba Exp $ - -// Try to remove anti-SPAM bits -function clean_AntiSPAM($email) +// Try to remove antispam bits from the address +function clean_antispam($email) { $remove_spam = "![-_]?(NO|I[-_]?HATE|DELETE|REMOVE)[-_]?(THIS)?(ME|SPAM)?[-_]?!i"; return preg_replace($remove_spam, "", trim($email)); @@ -15,16 +14,16 @@ // Exclude our mailing list hosting servers $hosts_regex = "!(lists\.php\.net|chek[^\.*]\.com)!i"; $excluded_hosts = preg_match($hosts_regex, $email); - + // Email addresses need to match this pattern $email_regex = ":^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~ ])+" . "@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+" . "[a-zA-Z]{2,6}\$:i"; - + // If address is not under excluded hosts, and fits the regex, // then we belive that it is a good email address if (!$excluded_hosts && !empty($email)) { - return preg_match($email_regex, $email); + return preg_match($email_regex, $email); } else { return FALSE; } http://cvs.php.net/diff.php/php-master-web/include/functions.inc?r1=1.8&r2=1.9&ty=u Index: php-master-web/include/functions.inc diff -u php-master-web/include/functions.inc:1.8 php-master-web/include/functions.inc:1.9 --- php-master-web/include/functions.inc:1.8 Sun Oct 5 14:28:40 2003 +++ php-master-web/include/functions.inc Thu Jun 10 04:28:47 2004 @@ -1,4 +1,5 @@ <?php +// $Id: functions.inc,v 1.9 2004/06/10 08:28:47 goba Exp $ // Shorthand function for htmlspecialchars function hsc($str) { @@ -35,16 +36,21 @@ <title><?php echo $title;?></title> <link rel="stylesheet" type="text/css" href="/style.css" /> </head> -<div id="header"> -<div id="logo"><a href="http://www.php.net/"><img src="/include/logo.gif" width="53" height="28" border="0" alt="php" align="absmiddle" /></a></div> -<div id="links"> - <a href="/manage/event.php">events</a> -• <a href="/inventory.php">inventory</a> -• <a href="/manage/mirrors.php">mirrors</a> -• <a href="/manage/users.php">users</a> -• <a href="/manage/user-notes.php">notes</a> -</div> -</div> +<body> + <div id="header"> + <div id="logo"> + <a href="http://www.php.net/"> + <img src="/include/logo.gif" width="53" height="28" border="0" alt="php" align="absmiddle" /> + </a> + </div> + <div id="links"> + <a href="/manage/event.php">events</a> • + <a href="/inventory.php">inventory</a> • + <a href="/manage/mirrors.php">mirrors</a> • + <a href="/manage/users.php">users</a> • + <a href="/manage/user-notes.php">notes</a> + </div> + </div> <?php } http://cvs.php.net/diff.php/php-master-web/include/login.inc?r1=1.2&r2=1.3&ty=u Index: php-master-web/include/login.inc diff -u php-master-web/include/login.inc:1.2 php-master-web/include/login.inc:1.3 --- php-master-web/include/login.inc:1.2 Sat Oct 27 15:59:55 2001 +++ php-master-web/include/login.inc Thu Jun 10 04:28:47 2004 @@ -1,33 +1,48 @@ <?php +/* $Id: login.inc,v 1.3 2004/06/10 08:28:47 goba Exp $ */ -require 'cvs-auth.inc'; +include_once 'cvs-auth.inc'; -if (isset($save) && isset($user) && isset($pw)) { - setcookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/','.php.net'); +// User not logged in +$user = $pw = FALSE; + +// Set magic cookie if login information is available +if (isset($_POST['save']) && isset($_POST['user']) && isset($_POST['pw'])) { + setcookie( + "MAGIC_COOKIE", + base64_encode("{$_POST['user']}:{$_POST['pw']}"), + time()+3600*24*12, + '/', + '.php.net' + ); + list($user, $pw) = array($_POST['user'], $_POST['pw']); } -if (isset($MAGIC_COOKIE) && !isset($user) && !isset($pw)) { - list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE)); + +// Preserve information previously set in magic cookie if available +if (isset($_COOKIE['MAGIC_COOKIE']) && !isset($_POST['user']) && !isset($_POST['pw'])) { + list($user, $pw) = explode(":", base64_decode($_COOKIE['MAGIC_COOKIE'])); } function query_string() { - if ($GLOBALS['QUERY_STRING']) { - return htmlspecialchars("?$GLOBALS[QUERY_STRING]"); - } + if ($_SERVER['QUERY_STRING']) { + return htmlspecialchars("?{$_SERVER['QUERY_STRING']}"); + } } function preserve_form_fields() { - if ($GLOBALS['REQUEST_METHOD'] == "POST" && @is_array($GLOBALS['in'])) { - while (list($k,$v) = each($GLOBALS['in'])) { - echo "<input type=\"hidden\" name=\"in[", htmlspecialchars($k), - "]\" value=\"", htmlspecialchars($v), "\" />\n"; + if ($_SERVER['REQUEST_METHOD'] == "POST" && @is_array($_POST['in'])) { + while (list($k, $v) = each($_POST['in'])) { + echo "<input type=\"hidden\" name=\"in[", htmlspecialchars($k), + "]\" value=\"", htmlspecialchars($v), "\" />\n"; + } } - } } -if (!$user || !$pw || !verify_password($user,$pw)) {?> +// Login form, if the user is not yet logged in +if (!$user || !$pw || !verify_password($user,$pw)) { ?> <html> <head> - <title>you must log in</title> + <title>You must log in!</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF, query_string();?>"> http://cvs.php.net/diff.php/php-master-web/manage/user-notes.php?r1=1.39&r2=1.40&ty=u Index: php-master-web/manage/user-notes.php diff -u php-master-web/manage/user-notes.php:1.39 php-master-web/manage/user-notes.php:1.40 --- php-master-web/manage/user-notes.php:1.39 Wed May 26 06:15:09 2004 +++ php-master-web/manage/user-notes.php Thu Jun 10 04:28:48 2004 @@ -1,16 +1,17 @@ <?php +// $Id: user-notes.php,v 1.40 2004/06/10 08:28:48 goba Exp $ -require_once 'functions.inc'; -require_once 'cvs-auth.inc'; -require_once 'email-validation.inc'; +include_once 'functions.inc'; +include_once 'cvs-auth.inc'; +include_once 'email-validation.inc'; // ** alerts ** remove comment when alerts are on-line //require_once 'alert_lib.inc'; -$mailto = "php-notes@lists.php.net"; +$mailto = $mailfrom = "php-notes@lists.php.net"; $reject_text = 'You are receiving this email because your note posted -to the on-line PHP manual has been removed by one of the editors. +to the online PHP manual has been removed by one of the editors. Read the following paragraphs carefully, because they contain pointers to resources better suited for requesting support or @@ -20,25 +21,18 @@ The user contributed notes are not an appropriate place to ask questions, report bugs or suggest new features; please -use the resources listed in <http://www.php.net/support.php> +use the resources listed on <http://php.net/support> for those purposes. This was clearly stated in the page you used to submit your note, please carefully re-read those instructions before submitting future contributions. -Bug Submissions and Feature Requests should be entered at +Bug submissions and feature requests should be entered at <http://bugs.php.net/>. For documentation errors use the bug system, and classify the bug as "Documentation problem". Support and ways to find answers to your questions can be found -at <http://www.php.net/support.php>. +at <http://php.net/support>. -Your note has been removed from the on-line manual.'; - -// Use class names instead of colors -ini_set('highlight.comment', 'comment'); -ini_set('highlight.default', 'default'); -ini_set('highlight.keyword', 'keyword'); -ini_set('highlight.string', 'string'); -ini_set('highlight.html', 'html'); +Your note has been removed from the online manual.'; if($user && $pass) { setcookie("MAGIC_COOKIE",base64_encode("$user:$pass"),time()+3600*24*12,'/','.php.net'); @@ -211,7 +205,7 @@ //$mailto .= get_emails_for_sect($row["sect"]); mail($mailto,"note $row[id] ".($action == "reject" ? "rejected" : "deleted")." from $row[sect] by $user","Note Submitter: $row[user]\n\n----\n\n".$row['note'],"From: $user@php.net\r\nIn-Reply-To: <note-$id@php.net>"); if ($action == 'reject') { - mail_user($row['user'], "note $row[id] rejected and deleted from $row[sect] by notes editor $user",$reject_text."\n\n----- Copy of your note below -----\n\n".$row['note']); + mail_user($row['user'], $mailfrom, "note $row[id] rejected and deleted from $row[sect] by notes editor $user",$reject_text."\n\n----- Copy of your note below -----\n\n".$row['note']); } } @@ -255,7 +249,7 @@ //$mailto .= get_emails_for_sect($row["sect"]); mail($mailto,"note $row[id] modified in $row[sect] by $user",stripslashes($note)."\n\n--was--\n$row[note]\n\nhttp://www.php.net/manual/en/$row[sect].php","From: $user@php.net\r\nIn-Reply-To: <note-$id@php.net>"); if (addslashes($row["sect"]) != $sect) { - mail_user($email, "note $id moved from $row[sect] to $sect by notes editor $user", "----- Copy of your note below -----\n\n".stripslashes($note)); + mail_user($email, $mailfrom, "note $id moved from $row[sect] to $sect by notes editor $user", "----- Copy of your note below -----\n\n".stripslashes($note)); } header('Location: user-notes.php?id=' . $id . '&was=' . $action); exit; @@ -308,6 +302,15 @@ foot(); } +// ---------------------------------------------------------------------------------- + +// Use class names instead of colors +ini_set('highlight.comment', 'comment'); +ini_set('highlight.default', 'default'); +ini_set('highlight.keyword', 'keyword'); +ini_set('highlight.string', 'string'); +ini_set('highlight.html', 'html'); + // Copied over from phpweb (should be syncronised if changed) function clean_note($text) { @@ -359,11 +362,17 @@ else { echo $highlighted; } } -function mail_user($email, $subject, $message) +// Send out a mail to the note submitter, with an envelope sender ignoring bounces +function mail_user($mailto, $mailfrom, $subject, $message) { - $email = clean_antispam($email); - if (is_emailable_address($email)) { - # use an envelope sender that lets us ignore bounces - mail($email,$subject,$message,"From: webmaster@php.net", '-fbounces-ignored@php.net'); - } + $email = clean_antispam($email); + if (is_emailable_address($email)) { + mail( + $mailto, + $subject, + $message, + "From: $mailfrom", + "-fbounces-ignored@php.net" + ); + } }