add-note.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. header('Location: http://php-gtk.audean.com');
  3. require_once('../include/prepend.php');
  4. require_once '../include/shared-manual1.inc';
  5. /*
  6. # Notes only available at main mirror site for now
  7. if ($_SERVER["HTTP_HOST"]!='gtk.php.net') {
  8. header('Location: http://gtk.php.net' . $_SERVER['REQUEST_URI'] );
  9. exit;
  10. }
  11. */
  12. $mailto = 'gtk-webmaster@lists.php.net';
  13. commonHeader('PHP-GTK 1 Manual Notes');
  14. /* clean off leading and trailing whitespace */
  15. $user = trim($user_email);
  16. $note = trim($note);
  17. /* don't pass through example username */
  18. if ($user_email == 'user@example.com') {
  19. $user_email = '';
  20. }
  21. if ($note == '') {
  22. unset ($note);
  23. }
  24. # turn the POST data into GET data so we can do the redirect
  25. /*
  26. if (!strstr($MYSITE,"gtk.php.net")) {
  27. header("Location: http://gtk.php.net/manual1/add-note.php?sect=".urlencode($sect)."&lang=".urlencode($lang)."&redirect=".urlencode($redirect));
  28. exit;
  29. }
  30. */
  31. if (isset($note) && isset($action) && strtolower($action) != "preview" && file_exists($notesdb)) {
  32. $now = time();
  33. $note = htmlentities($note, ENT_COMPAT, 'UTF-8');
  34. $db_string = '(null, "'.$sect.'", "'.$now.'", "'.$user_email.'", "'.$note.'")';
  35. $db = sqlite_open($notesdb);
  36. $query = @sqlite_query($db, "INSERT INTO php_gtk_manual VALUES $db_string");
  37. sqlite_close($db);
  38. if (mysql_query($query)) {
  39. echo "<p>Your submission was successful -- thanks for contributing!</p>";
  40. $new_id = sqlite_last_insert_rowid($db);
  41. $msg = stripslashes($note);
  42. $msg .= "\n\n $redirect \n";
  43. # make sure we have a return address.
  44. if (!$user_email) {
  45. $user_email = "php-gtk@lists.php.net";
  46. }
  47. mail($mailto, "note $new_id added to $sect", $msg, "From: $user_email");
  48. } else {
  49. # mail it.
  50. mail($mailto, "failed manual v1 note query", $query);
  51. echo "<p>There was an error processing your submission. " .
  52. "It has been automatically e-mailed to the developers.</p>";
  53. }
  54. echo '<p>You can <a href="' . $redirect. '">go back</a> from whence you came,' .
  55. 'or you can <a href="http://gtk.php.net/manual1/">go to the manual home page</a>.</p>';
  56. } else {
  57. if (isset($note) && strtolower($action) == "preview") {
  58. echo '<p>This is what your entry will look like, roughly:</p>';
  59. echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
  60. $temp = array(
  61. 'user' => stripslashes($user_email),
  62. 'note' => stripslashes($note),
  63. 'xwhen' => time()
  64. );
  65. makeEntry($temp, false, false);
  66. echo "</table>";
  67. } else {
  68. ?>
  69. <p>
  70. You can contribute to the PHP-GTK 1 manual from the comfort of your browser!
  71. Just add your comment in the big field below, and, optionally, your email
  72. address in the little one (usual anti-spam practices are OK, e.g.
  73. johnNOSPAM@doe.NO_SPAM.com).
  74. </p>
  75. <p>
  76. Note that most HTML tags are not allowed in the posts. We tried
  77. allowing them in the past, but people invariably made a mess of
  78. things making the manual hard to read for everybody. You can include
  79. &lt;p&gt;, &lt;/p&gt;, and &lt;br&gt; tags.
  80. </p>
  81. <p>
  82. Carefully read the following note. If your post falls into one of the
  83. categories mentioned there, it will be rejected by one of the editors.
  84. </p>
  85. <p>
  86. <b>Note:</b> If you are trying to <a href="http://bugs.php.net/">report a
  87. bug</a>, or <a href="http://bugs.php.net/">request a new feature or language
  88. change</a>, you're in the wrong place. If you are just commenting on the fact
  89. that something is not documented, save your breath. This is where <b>you</b>
  90. add to the documentation, not where you ask <b>us</b> to add the
  91. documentation. This is also not the correct place to <a
  92. href="http://gtk.php.net/resources.php">ask questions</a> (even if you see others have done that
  93. before, we are editing the notes slowly but surely). If you post a note in
  94. any of the categories above, it will edited and/or removed.
  95. </p>
  96. <p>
  97. Just to make the point once more. The notes are being edited and support
  98. questions/bug reports/feature request/comments on lack of documentation, are
  99. being <b>deleted</b> from them (and you may get a <b>rejection</b> email), so
  100. if you post a question/bug/feature/complaint, it will be removed (but once you
  101. get an answer/bug solution/function documentation, feel free to come back
  102. and add it here!).
  103. </p>
  104. <p>
  105. That said, you can change your mind and <a href="http://gtk.php.net/resources.php">click here to
  106. go to the support pages</a> or <a href="http://bugs.php.net/">click here
  107. to submit a bug report or request a feature</a>.
  108. </p>
  109. <?php
  110. }
  111. if (!$user_email) {
  112. $user_email = "user@example.com";
  113. }
  114. if (!isset($sect)) {
  115. echo "<p><b>To add a note, you must click on the 'Add Note' button " .
  116. "on the bottom of a manual page so we know where to add the note!</b></p>";
  117. } else {
  118. ?>
  119. <form method="POST" action="/manual1/add-note.php">
  120. <input type="hidden" name="sect" value="<?echo $sect;?>">
  121. <input type="hidden" name="redirect" value="<?echo $redirect;?>">
  122. <input type="hidden" name="lang" value="<?echo $lang;?>">
  123. <table border="0" cellpadding="5" cellspacing="0" bgcolor="#e0e0e0">
  124. <tr valign="top">
  125. <td align="right">Your email address:<br /></td>
  126. <td><input type="text" name="user_email" size="40" maxlength="40" value="<?echo htmlspecialchars(stripslashes($user_email))?>"></td>
  127. </tr>
  128. <tr valign="top">
  129. <td align="right">Your note:<br /></td>
  130. <td><textarea name="note" rows="6" cols="40" wrap="virtual"><?echo htmlspecialchars(stripslashes($note))?></textarea><br>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td colspan="2" align="right">
  135. <input type="submit" name="action" value="Preview">
  136. <input type="submit" name="action" value="Add Note">
  137. </td>
  138. </tr>
  139. </table>
  140. </form>
  141. <?php
  142. }
  143. }
  144. commonFooter();
  145. ?>