cvs: phpweb /manual add-note.php admin-notes.php browse-errata.php set-magic-cookie.php
| From: | Jim Winstead | Date: | Sun, 23 Sep 2001 02:02:36 +0000 |
| Subject: | cvs: phpweb /manual add-note.php admin-notes.php browse-errata.php set-magic-cookie.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-6618@lists.php.net to get a copy of this message | ||
jimw Sat Sep 22 22:02:36 2001 EDT
Removed files:
/phpweb/manual admin-notes.php browse-errata.php
Modified files:
/phpweb/manual add-note.php set-magic-cookie.php
Log:
demysqlify the notes system. admin-notes and/or browse-errata can resurface in a new form if
people actually find those useful.
Index: phpweb/manual/add-note.php
diff -u phpweb/manual/add-note.php:1.25 phpweb/manual/add-note.php:1.26
--- phpweb/manual/add-note.php:1.25 Sat Sep 22 01:35:09 2001
+++ phpweb/manual/add-note.php Sat Sep 22 22:02:36 2001
@@ -1,23 +1,6 @@
<?
require_once 'prepend.inc';
-
-#
-# Notes only available at main mirror site for now
-#
-if (!is_primary_site()) {
- if (is_backup_primary()) {
- commonHeader("Service Unavailable");?>
-<p>Sorry, you can't add a note to the manual right now.</p>
-<?php
- commonFooter();
- exit;
- }
-
- header('Location: http://www.php.net' .
$HTTP_SERVER_VARS['REQUEST_URI'] );
- exit;
-}
-
-$mailto = 'rasmus@php.net';
+require_once 'posttohost.inc';
require("shared-manual.inc");
commonHeader("Manual Notes");
@@ -35,44 +18,27 @@
unset ($note);
}
-# turn the POST data into GET data so we can do the redirect
-if(!strstr($MYSITE,"www.php.net")) {
- Header("Location: http://www.php.net/manual/add-note.php?sect=".urlencode($sect)."&lang=".urlencode($lang)."&redirect=".urlencode($redirect));
- exit;
-}
-
if (isset($note) && isset($action) && strtolower($action) != "preview"):
- mysql_pconnect("localhost","nobody", "");
- mysql_select_db("php3");
-
- $now = date("Y-m-d H:i:s");
- $sect = ereg_replace("\.php$","",$sect);
- $query = "INSERT INTO note (user, note, sect, ts, lang) VALUES ";
- # no need to call htmlspecialchars() -- we handle it on output
- $query .=
"('$user','$note','$sect','$now','$lang')";
- //echo "<!--$query-->\n";
- if (mysql_query($query)):?>
-<P>Your submission was successful -- thanks for contributing! Note that it may
-not show up for a few hours on some of the <a
href="/mirrors.php">mirrors</a>,
-but it will find its way to all of our mirrors in due time.
-<? $new_id = mysql_insert_id();
- $msg = stripslashes($note);
- $msg .= "\n\n $redirect \n";
- # make sure we have a return address.
- if (!$user) $user = "php-general@lists.php.net";
- mail("php-notes@lists.php.net","note $new_id added to $sect",$msg,"From:
$user");
- else:
- // mail it.
- mail($mailto, "failed manual note query", $query);
+ $result = posttohost("http://master.php.net/entry/user-note.php",
array(
+ "user" => stripslashes($user),
+ "note" => stripslashes($note),
+ "lang" => stripslashes($lang),
+ "sect" => stripslashes($sect)
+ ));
+
+ if ($result) {
+ echo "<!-- $result -->";
+ echo "<p>There was an error processing your submission. It has been automatically
e-mailed to the developers, who will process the note manually.</p>";
+ }
+ else {?>
+<p>Your submission was successful -- thanks for contributing! Note that it will
+not show up for up to a few hours on some of the <a
+href="/mirrors.php">mirrors</a>, but it will find its way to all of our mirrors
+in due time.</p>
+<?php
+ }
?>
-<P>There was an error processing your submission. It has been automatically
-e-mailed to the developers.
-<? endif;?>
-
-<P>You can <A href="<?echo $redirect?>">go back</A> from whence
you came,
-or you can <A href="http://www.php.net/manual/">browse the manual
with the
-on-line notes</A>.
-
+<p>You can <a href="<?php echo $redirect?>">go back</a> from
whence you came.</p>
<?else:
if (isset($note) && strtolower($action) == "preview"):?>
<p>This is what your entry will look like, roughly:</p>
@@ -122,12 +88,12 @@
<p><b>To add a note, you must click on the 'Add Note' button
on the bottom of a manual page so we know where to add the note!</b></p>
<? else:?>
-<form method="POST" action="/manual/add-note.php">
-<input type="hidden" name="sect" value="<?echo $sect;?>">
-<input type="hidden" name="redirect" value="<?echo
$redirect;?>">
-<input type="hidden" name="lang" value="<?echo $lang;?>">
+<form method="post" action="<?php echo $PHP_SELF;?>">
+<input type="hidden" name="sect" value="<?echo $sect;?>"
/>
+<input type="hidden" name="redirect" value="<?echo
$redirect;?>" />
+<input type="hidden" name="lang" value="<?echo $lang;?>"
/>
<table border="0" cellpadding="5" cellspacing="0"
bgcolor="#d0d0d0">
-<TR VALIGN=top>
+<tr valign="top">
<TD><B>Your email address:</B></TD>
<td><input type="text" name="user" size="40"
maxlength="40" value="<?echo
htmlspecialchars(stripslashes($user))?>"></td>
</TR>
Index: phpweb/manual/set-magic-cookie.php
diff -u phpweb/manual/set-magic-cookie.php:1.2 phpweb/manual/set-magic-cookie.php:1.3
--- phpweb/manual/set-magic-cookie.php:1.2 Wed Mar 7 19:18:14 2001
+++ phpweb/manual/set-magic-cookie.php Sat Sep 22 22:02:36 2001
@@ -4,7 +4,7 @@
if (isset($user) && isset($pass)) {
$MAGIC_COOKIE = base64_encode("$user:$pass");
# we set a cookie good for five years
- SetCookie("MAGIC_COOKIE", base64_encode("$user:$pass"), time()+157248000);
+ SetCookie("MAGIC_COOKIE", base64_encode("$user:$pass"), time()+157248000,
'/', '.php.net');
echo "<b>Cookie set</b>.<br>";
}
if (isset($MAGIC_COOKIE)) {