Changeset 779 for trunk/common
- Timestamp:
- 04/30/08 12:50:07 (7 months ago)
- Location:
- trunk/common
- Files:
-
- 1 removed
- 2 modified
-
captcha.php (deleted)
-
mvblog.php (modified) (3 diffs)
-
mvblog_common.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/mvblog.php
r776 r779 584 584 <textarea name="comment_content" rows="20" cols="50"><?php if (array_key_exists("comment_content", $_POST)) echo $_POST["comment_content"]; ?></textarea><br /> 585 585 <?php 586 if ($anoncomments && !array_key_exists("blog_user", $_SESSION) && !array_key_exists("author_email", $_SESSION)) 587 $this->show_captcha(); 586 if ($anoncomments && !array_key_exists("blog_user", $_SESSION) && !array_key_exists("author_email", $_SESSION)) { 587 $captcha = $this->plugman->run_hooks("captcha_output", ""); 588 echo $captcha; 589 echo "<input type=\"hidden\" name=\"checkcap\" value=\"1\" />\n"; 590 } 588 591 ?> 589 592 <script type="text/javascript" language="Javascript1.2" src="common/js/xmlhttp.js"></script> … … 916 919 $sanitize_options_email = array("email" => 1); 917 920 if (array_key_exists("checkcap", $postdata) && $postdata["checkcap"]) { 918 if ($postdata["caphid"] != md5($postdata["captcha"])) 921 $captcha_check = $this->plugman->run_hooks("captcha_check", $postdata); 922 if ($captcha_check) { 923 $captcha_error = 0; 924 } else { 919 925 $captcha_error = 1; 920 else 921 $captcha_error = 0; 926 } 922 927 923 928 /* check if name and email address are already in the database */ … … 954 959 if ($row["count"] == 0) { die(gettext("no valid article given")); } 955 960 /* check for anon comments on non-anon comments enabled post/blog */ 956 if ( $_SESSION["blog_user"]["user_id"] || $_SESSION["author_id"]) {961 if ((array_key_exists("blog_user", $_SESSION) && $_SESSION["blog_user"]["user_id"]) || (array_key_exists("author_id", $_SESSION) && $_SESSION["author_id"])) { 957 962 $anon_user = false; 958 963 } else { -
trunk/common/mvblog_common.php
r776 r779 1108 1108 } 1109 1109 /* }}} */ 1110 /* show_captcha {{{ */1111 /**1112 * Show a captcha and hidden input and user input field1113 */1114 public function show_captcha() {1115 // generate random text string1116 $txt = "";1117 for ($i=0; $i<6; $i++) {1118 $set = array(rand(65,90), rand(97,122));1119 $txt .= chr($set[rand(0,1)]);1120 }1121 $_SESSION["txt"] = $txt;1122 echo "<img src=\"common/captcha.php\">";1123 //create tmp image file1124 echo "<input type=\"hidden\" name=\"checkcap\" value=\"1\" />\n";1125 echo "<input type=\"hidden\" name=\"caphid\" value=\"".md5($txt)."\" />\n";1126 echo "<input type=\"text\" name=\"captcha\" style=\"width: 60px;\" /> ".gettext("Type the text as shown on the left.")."<br /><br />\n";1127 }1128 /* }}} */1129 1110 }
