Changeset 44
- Timestamp:
- 12/21/05 16:24:53 (3 years ago)
- Files:
-
- devel/units/users/userdetails_actions.php (modified) (1 diff)
- devel/units/users/userdetails_edit.php (modified) (1 diff)
- devel/units/weblogs/weblogs_actions.php (modified) (1 diff)
- devel/units/weblogs/weblogs_posts_view.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/units/users/userdetails_actions.php
r36 r44 36 36 } 37 37 $messages[] = gettext("Email address updated."); 38 } 39 } 40 41 if ($usertype == 'person' && isset($_REQUEST['publiccomments'])) { 42 if ($_REQUEST['publiccomments'] == "yes") { 43 run("users:flags:set",array("publiccomments",$id,"1")); 44 $messages[] = gettext("Public comments and discussion set to 'on'."); 45 } else { 46 run("users:flags:unset",array("publiccomments",$id)); 47 $messages[] = gettext("Public comments and discussion set to 'off'."); 38 48 } 39 49 } devel/units/users/userdetails_edit.php
r42 r44 57 57 ); 58 58 59 $emailReplies = gettext("Make comments public"); 60 $emailRules = gettext("Set this to 'yes' if you would like anyone to be able to comment on your resources (by default only logged-in users can). Note that this may make you vulnerable to spam."); 61 62 $body .= <<< END 63 64 <h5>$emailReplies</h5> 65 <p> 66 $emailRules 67 </p> 68 69 END; 70 71 $emailreplies = run("users:flags:get",array("publiccomments",$page_owner)); 72 if ($emailreplies) { 73 $body .= run("templates:draw", array( 74 'context' => 'databox', 75 'name' => gettext("Public comments: "), 76 'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" /> " . gettext("No") . "</label>" 77 ) 78 ); 79 } else { 80 $body .= run("templates:draw", array( 81 'context' => 'databox', 82 'name' => gettext("Public comments: "), 83 'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>" 84 ) 85 ); 86 } 87 59 88 $emailReplies = gettext("Receive email messages"); 60 89 $emailRules = gettext("Set this to 'yes' if you would like to receive comments, replies and interesting discussion through your email. You can also access them by clicking on <a href=\"". url ."_activity/\">view your activity</a>."); devel/units/weblogs/weblogs_actions.php
r38 r44 138 138 $owner = (int) $_SESSION['userid']; 139 139 $posted = time(); 140 db_query("insert into weblog_comments 141 set body = '$body', 142 posted = $posted, 143 postedname = '$postedname', 144 owner = $owner, 145 post_id = $post_id"); 146 if (run("users:flags:get",array("emailreplies",$post->owner))) { 147 $email = db_query("select email,username from users where ident = " . ((int) $post->owner)); 148 if (sizeof($email) > 0) { 149 $username = $email[0]->username; 150 $email = $email[0]->email; 151 $message = gettext(sprintf("You have received a comment from %s on your blog post '%s'. It reads as follows:",$_REQUEST['postedname'],stripslashes($post->title))); 152 $message .= "\n\n\n" . $_REQUEST['new_weblog_comment'] . "\n\n\n"; 153 $message .= gettext(sprintf("To reply and see other comments on this blog post, click here: %s", url . $username . "/weblog/" . $post->ident . ".html")); 154 $message = wordwrap($message); 155 mail(stripslashes($email),stripslashes($post->title),$message,"From: " . sitename . "<" . email . ">"); 140 if (logged_on || run("users:flags:get",array("publiccomments",$post->owner))) { 141 db_query("insert into weblog_comments 142 set body = '$body', 143 posted = $posted, 144 postedname = '$postedname', 145 owner = $owner, 146 post_id = $post_id"); 147 if (run("users:flags:get",array("emailreplies",$post->owner))) { 148 $email = db_query("select email,username from users where ident = " . ((int) $post->owner)); 149 if (sizeof($email) > 0) { 150 $username = $email[0]->username; 151 $email = $email[0]->email; 152 $message = gettext(sprintf("You have received a comment from %s on your blog post '%s'. It reads as follows:",$_REQUEST['postedname'],stripslashes($post->title))); 153 $message .= "\n\n\n" . $_REQUEST['new_weblog_comment'] . "\n\n\n"; 154 $message .= gettext(sprintf("To reply and see other comments on this blog post, click here: %s", url . $username . "/weblog/" . $post->ident . ".html")); 155 $message = wordwrap($message); 156 mail(stripslashes($email),stripslashes($post->title),$message,"From: " . sitename . "<" . email . ">"); 157 } 156 158 } 157 } else { 158 $messages[] = run("users:flags:get",array("emailreplies",$post->owner)) . "#" . $post->owner; 159 } 160 $messages[] = gettext("Your comment has been added."); // gettext variable 159 $messages[] = gettext("Your comment has been added."); // gettext variable 160 } 161 161 } else { 162 162 $messages[] = gettext("Your comment could not be posted. The system thought it was spam."); devel/units/weblogs/weblogs_posts_view.php
r40 r44 155 155 ); 156 156 157 $run_result .= run("weblogs:comments:add",$post); 157 if (logged_on || run("users:flags:get",array("publiccomments",$post->owner))) { 158 $run_result .= run("weblogs:comments:add",$post); 159 } else { 160 $run_result .= "<p>" . gettext("You must be logged in to post a comment.") . "</p>"; 161 } 158 162 159 163 } else {
