Changeset 549
- Timestamp:
- 11/15/2003 08:58:18 AM (22 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2functions.php
r548 r549 65 65 } 66 66 67 function wpautop($pee, $br =1) {67 function wpautop($pee, $br = 1) { 68 68 $pee = $pee . "\n"; // just to make things a little easier, pad the end 69 69 $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); … … 170 170 } 171 171 return $j; 172 } 173 174 function current_time($type) { 175 $time_difference = get_settings('time_difference'); 176 switch ($type) { 177 case 'mysql': 178 return date('Y-m-d H:i:s', (time() + ($time_difference * 3600) ) ); 179 break; 180 case 'timestamp': 181 return (time() + ($time_difference * 3600) ); 182 break; 183 } 172 184 } 173 185 … … 1395 1407 1396 1408 switch($comment_status) { 1397 1398 $query = "UPDATE $tablecomments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";1399 break;1400 1401 $query = "UPDATE $tablecomments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";1402 break;1403 1404 $query = "DELETE FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1";1405 break;1406 1407 return false;1409 case 'hold': 1410 $query = "UPDATE $tablecomments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; 1411 break; 1412 case 'approve': 1413 $query = "UPDATE $tablecomments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; 1414 break; 1415 case 'delete': 1416 $query = "DELETE FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1"; 1417 break; 1418 default: 1419 return false; 1408 1420 } 1409 1421 1410 1422 if ($wpdb->query($query)) { 1411 return true;1423 return true; 1412 1424 } else { 1413 return false;1425 return false; 1414 1426 } 1415 1427 } -
trunk/b2comments.php
r546 r549 20 20 <!-- You can start editing here. --> 21 21 22 <h2 >Comments</h2>22 <h2 id="comments">Comments</h2> 23 23 24 <p><a href="<?php echo $siteurl; ?>/wp-commentsrss2.php?p=<?php echo $id; ?>"> RSSfeed for comments on this post.</a></p>24 <p><a href="<?php echo $siteurl; ?>/wp-commentsrss2.php?p=<?php echo $id; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p> 25 25 26 26 <?php if ('open' == $post->ping_status) { ?> … … 28 28 <?php } ?> 29 29 30 <ol id="comments">31 <?php32 // this line is WordPress' motor, do not delete it.33 if ($comments) {34 foreach ($comments as $comment) {35 ?>36 37 <li id="comment-<?php comment_ID() ?>">38 <?php comment_text() ?>39 <p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>40 </li>41 30 42 <?php } // end for each comment 43 } else { // this is displayed if there are no comments so far 44 ?> 45 <li>No comments yet.</li> 31 <?php if ($comments) { ?> 32 <ol id="commentlist"> 33 <?php foreach ($comments as $comment) { ?> 34 <li id="comment-<?php comment_ID() ?>"> 35 <?php comment_text() ?> 36 <p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p> 37 </li> 38 39 <?php } // end for each comment ?> 40 </ol> 41 <?php } else { // this is displayed if there are no comments so far ?> 42 <p>No comments yet.</p> 46 43 <?php } ?> 47 </ol> 44 48 45 <h2>Leave a Comment</h2> 49 46 <?php if ('open' == $post->comment_status) { ?> … … 78 75 ?> 79 76 <p> 80 <strong>Please note:</strong><br /> 81 This blog uses comment moderation. In other words: your comment will need approval 82 by the administrator before it will appear in the blog. Approval usually happens 83 within the next 24 hours. Please send your comment only once. Thank you. 77 <strong>Please note:</strong> Comment moderation is currently enabled so there may be a delay between when you post your comment and when it shows up. Patience is a virtue; there’s no need to resubmit your comment. 84 78 </p> 85 79 <?php -
trunk/b2comments.post.php
r546 r549 44 44 die('Sorry, comments are closed for this item.'); 45 45 46 if ($require_name_email && ($email == '' || $email == '@' || $author == '' || $author == 'name')) { //original fix by Dodo, and then Drinyth 47 echo 'Error: please fill the required fields (name, email).'; 48 exit; 46 if ($require_name_email && ($email == '' || $author == '')) { //original fix by Dodo, and then Drinyth 47 die('Error: please fill the required fields (name, email).'); 49 48 } 50 49 if ($comment == 'comment' || $comment == '') { 51 echo "Error: please type a comment"; 52 exit; 50 die('Error: please type a comment.'); 53 51 } 54 52 55 $time_difference = get_settings('time_difference'); 56 $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));53 54 $now = current_time('mysql'); 57 55 58 56 $comment = strip_tags($comment, $comment_allowed_tags); … … 69 67 $url = addslashes($url); 70 68 71 /* flood-protection */69 /* Flood-protection */ 72 70 $lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); 73 71 $ok = true; … … 78 76 $ok = false; 79 77 } 80 /* end flood-protection */78 /* End flood-protection */ 81 79 82 80 83 81 84 82 if ($ok) { // if there was no comment from this IP in the last 10 seconds 85 $comment_moderation = get_settings( "comment_moderation");86 $moderation_notify = get_settings( "moderation_notify");83 $comment_moderation = get_settings('comment_moderation'); 84 $moderation_notify = get_settings('moderation_notify'); 87 85 88 86 // o42: this place could be the hook for further comment spam checking … … 98 96 $wpdb->query("INSERT INTO $tablecomments (comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content,comment_karma,comment_approved) VALUES ('0', '$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$comment', '0', '$approved')"); 99 97 100 // o42: this should be changed as soon as other sql dbs are supported 101 // as it's proprietary to mysql 102 $comment_ID = $wpdb->get_var("SELECT last_insert_id()"); 98 /* 99 $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); 103 100 104 101 $fp = fopen("/tmp/wpdebug.txt", "w+"); … … 118 115 fclose($fp); 119 116 117 */ 120 118 if ($email == '') 121 119 $email = ' '; // this to make sure a cookie is set for 'no email' … … 128 126 setcookie('comment_author_url_'.$cookiehash, $url, time()+30000000); 129 127 130 131 128 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 129 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); 132 130 header('Cache-Control: no-cache, must-revalidate'); 133 131 header('Pragma: no-cache'); 134 $location = ( !empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"];132 $location = (empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_SERVER_VARS["HTTP_REFERER"] : $HTTP_POST_VARS['redirect_to']; 135 133 if ($is_IIS) { 136 134 header("Refresh: 0;url=$location"); -
trunk/b2commentspopup.php
r546 r549 20 20 <h1 id="header"><a href="" title="<?php echo $blogname ?>"><?php echo $blogname ?></a></h1> 21 21 22 <h2 >Comments</h2>22 <h2 id="comments">Comments</h2> 23 23 24 24 <p><a href="<?php echo $siteurl; ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>">RSS feed for comments on this post.</a></p> … … 28 28 <?php } ?> 29 29 30 <ol id="comments">31 30 <?php 32 31 // this line is WordPress' motor, do not delete it. … … 34 33 $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); 35 34 if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie 36 echo("<li>".get_the_password_form()."</li></ol>"); 37 } 38 else { 39 if ($comments) { 40 // this line is WordPress' motor, do not delete it. 41 foreach ($comments as $comment) { 42 ?> 43 <!-- comment --> 44 <li id="comment-<?php comment_ID() ?>"> 45 <?php comment_text() ?> 46 <p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p> 47 </li> 35 echo(get_the_password_form()); 36 } else { ?> 48 37 49 <?php } // end for each comment 50 } else { // this is displayed if there are no comments so far 51 ?> 52 <li>No comments yet.</li> 38 <?php if ($comments) { ?> 39 <ol id="commentlist"> 40 <?php foreach ($comments as $comment) { ?> 41 <li id="comment-<?php comment_ID() ?>"> 42 <?php comment_text() ?> 43 <p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p> 44 </li> 45 46 <?php } // end for each comment ?> 47 </ol> 48 <?php } else { // this is displayed if there are no comments so far ?> 49 <p>No comments yet.</p> 53 50 <?php } ?> 54 </ol> 55 <?php 56 if ('open' == $commentstatus->comment_status) { ?> 51 52 <?php if ('open' == $commentstatus->comment_status) { ?> 57 53 <h2>Leave a Comment</h2> 58 54 <p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo htmlentities(str_replace('<', ' <', $comment_allowed_tags)); ?></code></p> -
trunk/wp-admin/b2menutop.txt
r546 r549 1 1 1 wp-post.php Post 2 2 1 edit.php Edit 3 3 wp-moderation.php Moderation4 3 3 b2team.php Team 5 4 4 wp-options.php Options -
trunk/wp-admin/edit-comments.php
r546 r549 38 38 ?> 39 39 <ul id="adminmenu2"> 40 <li><a href="edit.php">Posts</a></li> 41 <li class="last"><a href="edit-comments.php" class="current">Comments</a></li> 40 <li><a href="edit.php">Latest Posts</a></li> 41 <li class="last"><a href="edit-comments.php" class="current">Latest Comments</a></li> 42 <li><a href="wp-moderation.php">Comments Awaiting Moderation</a></li> 42 43 </ul> 43 44 -
trunk/wp-admin/upgrade-072-to-073.php
r516 r549 77 77 } 78 78 79 $wpdb->query("INSERT INTO `$tableoptions` (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) VALUES ('', '0', 'permalink_structure', 'Y', '3', '', '20', '8', 'How the permalinks for your site are constructed.', '8');"); 80 ?> 81 <strong>Done.</strong></p> 79 if (!$wpdb->get_var("SELECT option_name FROM $tableoptions WHERE option_name = 'permalink_structure'")) { // If it's not already there 80 $wpdb->query("INSERT INTO `$tableoptions` 81 (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) 82 VALUES 83 ('', '0', 'permalink_structure', 'Y', '3', '', '20', '8', 'How the permalinks for your site are constructed. See <a href=\"wp-options-permalink.php\">permalink options page</a> for necessary mod_rewrite rules and more information.', '8');"); 84 } 85 ?> 86 Done with the name game. Now a little option action. </p> 82 87 <p>Now on to <a href="upgrade-072-to-073.php?step=2">step 2</a>.</p> 83 88 <?php … … 101 106 echo ' .'; 102 107 flush(); 103 // add link to date format help page 104 $wpdb->query("UPDATE $tableoptions SET option_description = 'see <a href=\"help/en/dateformats.help.html\">help</a> for format characters' WHERE option_id = 52"); 105 $wpdb->query("UPDATE $tableoptions SET option_description = 'see <a href=\"help/en/dateformats.help.html\">help</a> for format characters' WHERE option_id = 53"); 106 echo ' .'; 107 flush(); 108 ?> 109 <strong>Done.</strong></p> 110 <p>See, that didn’t hurt a bit. All done!</p> 108 // add link to php date format. this could be to a wordpress.org page in the future 109 $wpdb->query("UPDATE $tableoptions SET option_description = 'see <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 52"); 110 $wpdb->query("UPDATE $tableoptions SET option_description = 'see <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 53"); 111 echo ' .'; 112 flush(); 113 ?> 114 <strong>Done with the options updates. Now for a bit of comment action</strong></p> 115 <?php 116 $result = ''; 117 $error_count = 0; 118 $continue = true; 119 120 // Insert new column "comment_approved" to $tablecomments 121 if ($continue) { 122 $ddl = "ALTER TABLE $tablecomments ADD COLUMN comment_approved ENUM('0', '1') DEFAULT '1' NOT NULL"; 123 if (maybe_add_column($tablecomments, $tablecol, $ddl)) { 124 $wpdb->query("ALTER TABLE $tablecomments ADD INDEX (comment_approved)"); 125 } 126 } 127 128 // Insert new option "comment_moderation" to settings 129 if (!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'comment_moderation'")) { 130 $wpdb->query("INSERT INTO $tableoptions 131 (option_id, blog_id, option_name, option_can_override, option_type, option_value, option_width, option_height, option_description, option_admin_level) 132 VALUES 133 ('0', '0', 'comment_moderation', 'Y', '5',' none', 20, 8, 'If enabled, comments will only be shown after they have been approved.', 8)"); 134 } 135 136 // attach option to group "General blog settings" 137 if ($continue) { 138 $oid = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'comment_moderation'"); 139 $gid = $wpdb->get_var("SELECT group_id FROM $tableoptiongroups WHERE group_name = 'General blog settings'"); 140 141 $seq = $wpdb->get_var("SELECT MAX(seq) FROM $tableoptiongroup_options WHERE group_id = '$gid'"); 142 143 ++$seq; 144 145 $wpdb->query("INSERT INTO $tableoptiongroup_options 146 (group_id, option_id, seq) 147 VALUES 148 ('$gid', '$oid', '$seq')"); 149 } 150 151 // Insert option values for new option "comment_moderation" 152 if ($continue) { 153 $ddl = array(); 154 $ddl[] = "INSERT INTO $tableoptionvalues 155 (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) 156 VALUES 157 ('$oid', 'none', 'None', NULL, NULL, 1)"; 158 $ddl[] = "INSERT INTO $tableoptionvalues 159 (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) 160 VALUES 161 ('$oid', 'manual', 'Manual', NULL, NULL, 2)"; 162 $ddl[] = "INSERT INTO $tableoptionvalues 163 (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) 164 VALUES 165 ('$oid','auto', 'Automatic', NULL, NULL, 3)"; 166 167 foreach ($ddl as $query) { 168 $wpdb->query($query); 169 } 170 171 } 172 173 // Insert new option "moderation_notify" to settings 174 if (!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'moderation_notify'")) { 175 $wpdb->query("INSERT INTO $tableoptions 176 (option_id, blog_id, option_name, option_can_override, option_type, option_value, option_width, option_height, option_description, option_admin_level) 177 VALUES 178 ('0', '0', 'moderation_notify' , 'Y', '2', '1', 20, 8, 'Set this to true if you want to be notified about new comments that wait for approval', 8)"); 179 } 180 181 // attach option to group "General blog settings" 182 if ($continue) { 183 $oid = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'moderation_notify'"); 184 $gid = $wpdb->get_var("SELECT group_id FROM $tableoptiongroups WHERE group_name = 'General blog settings'"); 185 186 $seq = $wpdb->get_var("SELECT MAX(seq) FROM $tableoptiongroup_options WHERE group_id = '$gid'"); 187 188 ++$seq; 189 $wpdb->query("INSERT INTO $tableoptiongroup_options 190 (group_id, option_id, seq) 191 VALUES 192 ('$gid', '$oid', '$seq')"); 193 } 194 ?> 195 <p>Comment spammers should now watch out for you.</p> 196 <p>See, that didn’t hurt a bit (again). All done!</p> 111 197 <?php 112 198 break; -
trunk/wp-admin/wp-moderation.php
r546 r549 43 43 44 44 $standalone = 1; 45 require_once( "b2header.php");45 require_once('b2header.php'); 46 46 47 47 if ($user_level < 3) { 48 die('<p>You have no right to moderate comments.<br />Ask for a promotion toyour <a href="mailto:$admin_email">blog admin</a>. :)</p>');48 die('<p>Your level is not high enough to moderate comments. Ask for a promotion from your <a href="mailto:$admin_email">blog admin</a>. :)</p>'); 49 49 } 50 50 51 51 // check if comment moderation is turned on in the settings 52 52 // if not, just give a short note and stop 53 if ( get_settings("comment_moderation") == "none") {54 echo "<div class=\"wrap\">\n";55 echo "Comment moderation has been turned off.<br /><br />\n";56 echo "</div>\n";57 include("b2footer.php");53 if ('none' == get_settings("comment_moderation")) { 54 echo '<div class="wrap"> 55 <p>Comment moderation has been turned off.</p> 56 </div>'; 57 require('b2footer.php'); 58 58 exit; 59 59 } … … 65 65 foreach($comment as $key => $value) { 66 66 switch($value) { 67 case "later":68 // do nothing with that comment69 // wp_set_comment_status($key, "hold");70 ++$item_ignored;71 break;72 73 case "delete":74 wp_set_comment_status($key, "delete");75 ++$item_deleted;76 break;77 78 case "approve":79 wp_set_comment_status($key, "approve");80 if (get_settings("comments_notify") == true) {81 82 }83 ++$item_approved;84 break;67 case 'later': 68 // do nothing with that comment 69 // wp_set_comment_status($key, "hold"); 70 ++$item_ignored; 71 break; 72 73 case 'delete': 74 wp_set_comment_status($key, 'delete'); 75 ++$item_deleted; 76 break; 77 78 case 'approve': 79 wp_set_comment_status($key, 'approve'); 80 if (get_settings('comments_notify') == true) { 81 wp_notify_postauthor($key); 82 } 83 ++$item_approved; 84 break; 85 85 } 86 86 } … … 97 97 98 98 if ($user_level <= 3) { 99 die('<p>You have no right to moderate comments.<br>Ask for a promotion toyour <a href="mailto:$admin_email">blog admin</a>. :)</p>');99 die('<p>Your level is not high enough to moderate comments. Ask for a promotion from your <a href="mailto:$admin_email">blog admin</a>. :)</p>'); 100 100 } 101 101 102 102 // check if comment moderation is turned on in the settings 103 103 // if not, just give a short note and stop 104 if ( get_settings("comment_moderation") == "none") {105 echo "<div class=\"wrap\">\n";106 echo "Comment moderation has been turned off.<br /><br />\n";107 echo "</div>\n";104 if ('none' == get_settings('comment_moderation')) { 105 echo '<div class="wrap"> 106 <p>Comment moderation has been turned off.</p> 107 </div>'; 108 108 include("b2footer.php"); 109 109 exit; … … 145 145 <?php 146 146 147 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved ='0'");147 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved = 0"); 148 148 if ($comments) { 149 149 // list all comments that are waiting for approval
Note: See TracChangeset
for help on using the changeset viewer.