diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index 538fdd1a25..08658c10c8 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -64,7 +64,7 @@ function wptexturize($text) { return $output; } -function wpautop($pee, $br=1) { +function wpautop($pee, $br = 1) { $pee = $pee . "\n"; // just to make things a little easier, pad the end $pee = preg_replace('|
\s*
|', "\n\n", $pee); $pee = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $pee); // Space things out a little @@ -171,6 +171,18 @@ function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1 return $j; } +function current_time($type) { + $time_difference = get_settings('time_difference'); + switch ($type) { + case 'mysql': + return date('Y-m-d H:i:s', (time() + ($time_difference * 3600) ) ); + break; + case 'timestamp': + return (time() + ($time_difference * 3600) ); + break; + } +} + function addslashes_gpc($gpc) { if (!get_magic_quotes_gpc()) { $gpc = addslashes($gpc); @@ -1394,23 +1406,23 @@ function wp_set_comment_status($comment_id, $comment_status) { global $wpdb, $tablecomments; switch($comment_status) { - case 'hold': - $query = "UPDATE $tablecomments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; - break; - case 'approve': - $query = "UPDATE $tablecomments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; - break; - case 'delete': - $query = "DELETE FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1"; - break; - default: - return false; + case 'hold': + $query = "UPDATE $tablecomments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; + break; + case 'approve': + $query = "UPDATE $tablecomments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; + break; + case 'delete': + $query = "DELETE FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1"; + break; + default: + return false; } if ($wpdb->query($query)) { - return true; + return true; } else { - return false; + return false; } } diff --git a/b2comments.php b/b2comments.php index bc26f98949..a473802dd4 100644 --- a/b2comments.php +++ b/b2comments.php @@ -19,32 +19,29 @@ -

Comments

+

Comments

-

RSS feed for comments on this post.

+

RSS feed for comments on this post.

ping_status) { ?>

The URI to TrackBack this entry is:

-
    - - -
  1. - -

    by @

    -
  2. - -
  3. No comments yet.
  4. - + +
      + +
    1. + +

      by @

      +
    2. + +
    + +

    No comments yet.

    + +

    Leave a Comment

    comment_status) { ?>

    Line and paragraph breaks automatic, website trumps email, HTML allowed:

    @@ -77,10 +74,7 @@ if ($comments) { if ('none' != get_settings("comment_moderation")) { ?>

    - Please note:
    - This blog uses comment moderation. In other words: your comment will need approval - by the administrator before it will appear in the blog. Approval usually happens - within the next 24 hours. Please send your comment only once. Thank you. + Please note: 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.

    get_var("SELECT comment_status FROM $tableposts WHERE ID if ('closed' == $commentstatus) die('Sorry, comments are closed for this item.'); -if ($require_name_email && ($email == '' || $email == '@' || $author == '' || $author == 'name')) { //original fix by Dodo, and then Drinyth - echo 'Error: please fill the required fields (name, email).'; - exit; +if ($require_name_email && ($email == '' || $author == '')) { //original fix by Dodo, and then Drinyth + die('Error: please fill the required fields (name, email).'); } if ($comment == 'comment' || $comment == '') { - echo "Error: please type a comment"; - exit; + die('Error: please type a comment.'); } -$time_difference = get_settings('time_difference'); -$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600))); + +$now = current_time('mysql'); $comment = strip_tags($comment, $comment_allowed_tags); $comment = balanceTags($comment, 1); @@ -68,7 +66,7 @@ $author = addslashes($author); $email = addslashes($email); $url = addslashes($url); -/* flood-protection */ +/* Flood-protection */ $lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); $ok = true; if (!empty($lasttime)) { @@ -77,13 +75,13 @@ if (!empty($lasttime)) { if (($time_newcomment - $time_lastcomment) < 10) $ok = false; } -/* end flood-protection */ +/* End flood-protection */ if ($ok) { // if there was no comment from this IP in the last 10 seconds - $comment_moderation = get_settings("comment_moderation"); - $moderation_notify = get_settings("moderation_notify"); + $comment_moderation = get_settings('comment_moderation'); + $moderation_notify = get_settings('moderation_notify'); // o42: this place could be the hook for further comment spam checking // $approved should be set according the final approval status @@ -97,9 +95,8 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds } $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')"); - // o42: this should be changed as soon as other sql dbs are supported - // as it's proprietary to mysql - $comment_ID = $wpdb->get_var("SELECT last_insert_id()"); +/* + $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); $fp = fopen("/tmp/wpdebug.txt", "w+"); fwrite($fp, "comment_moderation: $comment_moderation\n"); @@ -117,6 +114,7 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds fclose($fp); +*/ if ($email == '') $email = ' '; // this to make sure a cookie is set for 'no email' @@ -127,11 +125,11 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds setcookie('comment_author_email_'.$cookiehash, $email, time()+30000000); setcookie('comment_author_url_'.$cookiehash, $url, time()+30000000); - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); - $location = (!empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"]; + $location = (empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_SERVER_VARS["HTTP_REFERER"] : $HTTP_POST_VARS['redirect_to']; if ($is_IIS) { header("Refresh: 0;url=$location"); } else { @@ -141,4 +139,4 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds die('Sorry, you can only post a new comment once every 10 seconds. Slow down cowboy.'); } -?> +?> \ No newline at end of file diff --git a/b2commentspopup.php b/b2commentspopup.php index bde4d55031..a4bcddb184 100644 --- a/b2commentspopup.php +++ b/b2commentspopup.php @@ -19,7 +19,7 @@ foreach ($posts as $post) { start_b2();

    -

    Comments

    +

    Comments

    RSS feed for comments on this post.

    @@ -27,33 +27,29 @@ foreach ($posts as $post) { start_b2();

    The URI to TrackBack this entry is:

    -
      get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie - echo("
    1. ".get_the_password_form()."
    "); -} -else { - if ($comments) { -// this line is WordPress' motor, do not delete it. - foreach ($comments as $comment) { -?> - -
  5. - -

    by @

    -
  6. + echo(get_the_password_form()); +} else { ?> - -
  7. No comments yet.
  8. - + +
      + +
    1. + +

      by @

      +
    2. + +
    -comment_status) { ?> + +

    No comments yet.

    + + +comment_status) { ?>

    Leave a Comment

    Line and paragraph breaks automatic, website trumps email, HTML allowed:

    diff --git a/wp-admin/b2menutop.txt b/wp-admin/b2menutop.txt index e1672a9a75..e8b9519be7 100644 --- a/wp-admin/b2menutop.txt +++ b/wp-admin/b2menutop.txt @@ -1,6 +1,5 @@ 1 wp-post.php Post 1 edit.php Edit -3 wp-moderation.php Moderation 3 b2team.php Team 4 wp-options.php Options 3 b2categories.php Categories diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index c1385c1c1d..9954bc3252 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -37,8 +37,9 @@ if ($previousXstart < 0) { ob_start(); ?>
    diff --git a/wp-admin/upgrade-072-to-073.php b/wp-admin/upgrade-072-to-073.php index f441e8c775..4d92b1fa32 100644 --- a/wp-admin/upgrade-072-to-073.php +++ b/wp-admin/upgrade-072-to-073.php @@ -76,9 +76,14 @@ foreach($posts as $post) { flush(); } -$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');"); +if (!$wpdb->get_var("SELECT option_name FROM $tableoptions WHERE option_name = 'permalink_structure'")) { // If it's not already there + $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. See permalink options page for necessary mod_rewrite rules and more information.', '8');"); + } ?> - Done.

    + Done with the name game. Now a little option action.

    Now on to step 2.

    query("INSERT INTO `$tableoptions` (`option_id`, `blog_id`, `option_name` $wpdb->query("UPDATE $tableoptions SET option_description = 'accepted file types, separated by spaces. example: \'jpg gif png\'' WHERE option_id = 34"); echo ' .'; flush(); - // add link to date format help page - $wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 52"); - $wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 53"); + // add link to php date format. this could be to a wordpress.org page in the future + $wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 52"); + $wpdb->query("UPDATE $tableoptions SET option_description = 'see help for format characters' WHERE option_id = 53"); echo ' .'; flush(); ?> - Done.

    -

    See, that didn’t hurt a bit. All done!

    + Done with the options updates. Now for a bit of comment action

    +query("ALTER TABLE $tablecomments ADD INDEX (comment_approved)"); + } +} + +// Insert new option "comment_moderation" to settings +if (!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'comment_moderation'")) { + $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', '0', 'comment_moderation', 'Y', '5',' none', 20, 8, 'If enabled, comments will only be shown after they have been approved.', 8)"); +} + +// attach option to group "General blog settings" +if ($continue) { + $oid = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'comment_moderation'"); + $gid = $wpdb->get_var("SELECT group_id FROM $tableoptiongroups WHERE group_name = 'General blog settings'"); + + $seq = $wpdb->get_var("SELECT MAX(seq) FROM $tableoptiongroup_options WHERE group_id = '$gid'"); + + ++$seq; + + $wpdb->query("INSERT INTO $tableoptiongroup_options + (group_id, option_id, seq) + VALUES + ('$gid', '$oid', '$seq')"); +} + +// Insert option values for new option "comment_moderation" +if ($continue) { + $ddl = array(); + $ddl[] = "INSERT INTO $tableoptionvalues + (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) + VALUES + ('$oid', 'none', 'None', NULL, NULL, 1)"; + $ddl[] = "INSERT INTO $tableoptionvalues + (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) + VALUES + ('$oid', 'manual', 'Manual', NULL, NULL, 2)"; + $ddl[] = "INSERT INTO $tableoptionvalues + (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) + VALUES + ('$oid','auto', 'Automatic', NULL, NULL, 3)"; + + foreach ($ddl as $query) { + $wpdb->query($query); + } + +} + +// Insert new option "moderation_notify" to settings +if (!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'moderation_notify'")) { + $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', '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)"); +} + +// attach option to group "General blog settings" +if ($continue) { + $oid = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'moderation_notify'"); + $gid = $wpdb->get_var("SELECT group_id FROM $tableoptiongroups WHERE group_name = 'General blog settings'"); + + $seq = $wpdb->get_var("SELECT MAX(seq) FROM $tableoptiongroup_options WHERE group_id = '$gid'"); + + ++$seq; + $wpdb->query("INSERT INTO $tableoptiongroup_options + (group_id, option_id, seq) + VALUES + ('$gid', '$oid', '$seq')"); +} +?> +

    Comment spammers should now watch out for you.

    +

    See, that didn’t hurt a bit (again). All done!

    - - - WordPress >Database upgrade for comment moderation hack - - - - -

    WordPress

    - - - -

    This will upgrade your database in order to be able to use otaku42's comment -moderation hack.

    -

    First of all: backup your database! This script will make -changes to it and it could happen that things aren't going the way they should. -You have been warned.

    -

    What this hack does is simple: it introduces a new option for comment moderation. -Comment moderation means that new comments won't show up in your blog until they -have been approved. Approval happens either manually or automatically (not implemented -yet). This all is a first step towards comment spam prevention. -
    You will have a simple panel in the admin section that shows you waiting -comments. You can either approve or delete them, or hold them further for approval.

    -

    The procedure is easy: click on the next button and see if there -are any warnings popping up. If so, please report the problem(s) to me -(mrenzmann@otaku42.de) so that I can -fix it/them.

    -

    The following passage (grey text) is of interest for you only if you are familiar -with WordPress development:

    - -

    In order to have the patch working we need to extend the comment table with a -field that indicates whether the comment has been approved or not (comment_approved). -Its default value will be 1 so that comments are auto-approved when comment -moderation has been turned off by the admin.

    -

    The next thing is that we need an option to turn comment moderation on/off. It will -be named comment_moderation and can be found in General blog -settings.

    -

    Another option that gets inserted is moderation_notify. If turned on, a mail -will be sent to the admin to inform about the new (and possibly other) comment that is/are -waiting for his approval.

    -

    This upgrade procedure tries to be as save as possible by not relying on any hardcoded -values. For example it retrieves the id for option group general blog settings -rather than assuming it has the same id as in my own blog.

    -
    -

    Ready? - -Let's go!

    \n"; - break; // end case 0 - - case 1: - $result = ""; - $error_count = 0; - $continue = true; - - // insert new column "comment_approved" to $tablecomments - if ($continue) { - $tablename = $tablecomments; - $tablecol = "comment_approved"; - $ddl = "ALTER TABLE $tablecomments ADD COLUMN $tablecol ENUM('0','1') DEFAULT '1' NOT NULL"; - $result .= "Adding column $tablecol to table $tablename: "; - if (maybe_add_column($tablename, $tablecol, $ddl)) { - $result .= "ok
    \n"; - $result .= "Indexing new column $tablecol: "; - - $wpdb->query("ALTER TABLE $tablename ADD INDEX ($tablecol)"); - $results = $wpdb->get_results("SHOW INDEX FROM $tablecomments"); - foreach ($results as $row) { - if ($row->Key_name == $tablecol) { - $index=1; - } - } - - if (1 == $index) { - $result .= "ok"; - $continue = true; - } else { - $result .= "error"; - ++$error_count; - $continue = false; - } - } else { - $result .= "error (couldn't add column $tablecol)"; - ++$error_count; - $continue = false; - } - $result .= "
    \n"; - } - - // insert new option "comment_moderation" to settings - if ($continue) { - $option = "comment_moderation"; - $tablename = $tableoptions; - $ddl = "INSERT INTO $tablename " - . "(option_id, blog_id, option_name, option_can_override, option_type, " - . "option_value, option_width, option_height, option_description, " - . "option_admin_level) " - . "VALUES " - . "('0','0','$option','Y','5','none',20,8,'if enabled, comments will only be shown after they have been approved by you',8)"; - $result .= "Adding new option $option to settings: "; - if ($wpdb->query($ddl)) { - $result .= "ok"; - $continue = true; - } else { - $result .= "error"; - ++$error_count; - $continue = false; - } - $result .= "
    \n"; - } - - // attach option to group "General blog settings" - if ($continue) { - // we take over here $option and $tablename from above - $group = "General blog settings"; - $result .= "Inserting new option $option to settings group '$group': "; - - $oid = $wpdb->get_var("SELECT option_id FROM $tablename WHERE option_name='$option'"); - $gid = $wpdb->get_var("SELECT group_id FROM $tableoptiongroups WHERE group_name='$group'"); - - if (0 != $gid && 0 != $oid) { - $continue = true; - } else { - $result .= "error (couldn't determine option_id and/or group_id)"; - ++$error_count; - $continue = false; - } - } - - if ($continue) { - $seq = $wpdb->get_var("SELECT MAX(seq) FROM $tableoptiongroup_options WHERE group_id='$gid'"); - - if (0 != $seq) { - $continue = true; - } else { - $result .= "error (couldn't determine sequence)"; - ++$error_count; - $continue = false; - } - } - - if ($continue) { - ++$seq; - $ddl = "INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) " - . "VALUES ('$gid','$oid','$seq')"; - if ($wpdb->query($ddl)) { - $result .= "ok"; - } else { - $result .= "error"; - ++$error_count; - $continue = false; - } - $result .= "
    \n"; - } - - // insert option values for new option "comment_moderation" - if ($continue) { - $tablename = $tableoptionvalues; - $result .= "Inserting option values for new option $option: "; - - $ddl = array(); - $ddl[] = "INSERT INTO $tablename (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) " - . "VALUES ('$oid','none','None',NULL,NULL,1)"; - $ddl[] = "INSERT INTO $tablename (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) " - . "VALUES ('$oid','manual','Manual',NULL,NULL,2)"; - $ddl[] = "INSERT INTO $tablename (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) " - . "VALUES ('$oid','auto','Automatic',NULL,NULL,3)"; - - for ($i = 0; $i < count($ddl); $i++) { - if ($wpdb->query($ddl[$i])) { - $success = true; - continue; - } else { - $success = false; - break; - } - } - - if ($success) { - $result .= "ok"; - } else { - $result .= "error"; - ++$error_count; - $continue = false; - } - $result .= "
    \n"; - } - - // insert new option "moderation_notify" to settings - if ($continue) { - $option = "moderation_notify"; - $tablename = $tableoptions; - $ddl = "INSERT INTO $tablename " - . "(option_id, blog_id, option_name, option_can_override, option_type, " - . "option_value, option_width, option_height, option_description, " - . "option_admin_level) " - . "VALUES " - . "('0','0','$option','Y','2','1',20,8,'set this to true if you want to be notified about new comments that wait for approval',8)"; - $result .= "Adding new option $option to settings: "; - if ($wpdb->query($ddl)) { - $result .= "ok"; - $continue = true; - } else { - $result .= "error"; - ++$error_count; - $continue = false; - } - $result .= "
    \n"; - } - - // attach option to group "General blog settings" - if ($continue) { - // we take over here $option and $tablename from above - $group = "General blog settings"; - $result .= "Inserting new option $option to settings group '$group': "; - - $oid = $wpdb->get_var("SELECT option_id FROM $tablename WHERE option_name='$option'"); - $gid = $wpdb->get_var("SELECT group_id FROM $tableoptiongroups WHERE group_name='$group'"); - - if (0 != $gid && 0 != $oid) { - $continue = true; - } else { - $result .= "error (couldn't determine option_id and/or group_id)"; - ++$error_count; - $continue = false; - } - } - - if ($continue) { - $seq = $wpdb->get_var("SELECT MAX(seq) FROM $tableoptiongroup_options WHERE group_id='$gid'"); - - if (0 != $seq) { - $continue = true; - } else { - $result .= "error (couldn't determine sequence)"; - ++$error_count; - $continue = false; - } - } - - if ($continue) { - ++$seq; - $ddl = "INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) " - . "VALUES ('$gid','$oid','$seq')"; - if ($wpdb->query($ddl)) { - $result .= "ok"; - } else { - $result .= "error"; - ++$error_count; - $continue = false; - } - $result .= "
    \n"; - } - - echo $result; - - if ($error_count > 0) { -?> - -

    Hmmm... there was some kind of error. If you cannot figure out -from the output above how to correct the problems please -contact me at mrenzmann@otaku42.de -and report your problem.

    - - - -

    Seems that everything went fine. Great!

    -

    Now you have two new options in your settings section General blog settings: -

    1. comment_moderation controls whether you want to use the new comment -moderation functionality at all. If set to manual, you need to approve each -new comment by hand either in the comment moderation panel or when editing the comments -for a post. Choose automatic currently equals manual, but in the near -future this will allow the application of filtering functions (such as URL blacklisting, -keyword filtering, bayesian filtering and similar stuff). To approve awaiting comments -go to Moderate in the admin menu, where all waiting comments will be listed.
    2. -
    3. moderation_notify will decide if you get notified by e-mail as soon as a -new comment has been posted and is waiting for approval (in other words: this setting -only takes effect, if comment_moderation is either set to manual or -automatic. The notification message will contain direct links that allow to -approve or delete a comment, or to jump to the moderation panel.
    -

    Have fun!

    - - - - - diff --git a/wp-admin/wp-moderation.php b/wp-admin/wp-moderation.php index 994bb8509c..3dc16b4e39 100644 --- a/wp-admin/wp-moderation.php +++ b/wp-admin/wp-moderation.php @@ -42,19 +42,19 @@ switch($action) { case 'update': $standalone = 1; - require_once("b2header.php"); + require_once('b2header.php'); if ($user_level < 3) { - die('

    You have no right to moderate comments.
    Ask for a promotion to your blog admin. :)

    '); + die('

    Your level is not high enough to moderate comments. Ask for a promotion from your blog admin. :)

    '); } // check if comment moderation is turned on in the settings // if not, just give a short note and stop - if (get_settings("comment_moderation") == "none") { - echo "
    \n"; - echo "Comment moderation has been turned off.

    \n"; - echo "
    \n"; - include("b2footer.php"); + if ('none' == get_settings("comment_moderation")) { + echo '
    +

    Comment moderation has been turned off.

    +
    '; + require('b2footer.php'); exit; } @@ -64,24 +64,24 @@ case 'update': foreach($comment as $key => $value) { switch($value) { - case "later": - // do nothing with that comment - // wp_set_comment_status($key, "hold"); - ++$item_ignored; - break; - - case "delete": - wp_set_comment_status($key, "delete"); - ++$item_deleted; - break; - - case "approve": - wp_set_comment_status($key, "approve"); - if (get_settings("comments_notify") == true) { - wp_notify_postauthor($key); - } - ++$item_approved; - break; + case 'later': + // do nothing with that comment + // wp_set_comment_status($key, "hold"); + ++$item_ignored; + break; + + case 'delete': + wp_set_comment_status($key, 'delete'); + ++$item_deleted; + break; + + case 'approve': + wp_set_comment_status($key, 'approve'); + if (get_settings('comments_notify') == true) { + wp_notify_postauthor($key); + } + ++$item_approved; + break; } } @@ -96,15 +96,15 @@ default: require_once('b2header.php'); if ($user_level <= 3) { - die('

    You have no right to moderate comments.
    Ask for a promotion to your blog admin. :)

    '); + die('

    Your level is not high enough to moderate comments. Ask for a promotion from your blog admin. :)

    '); } // check if comment moderation is turned on in the settings // if not, just give a short note and stop - if (get_settings("comment_moderation") == "none") { - echo "
    \n"; - echo "Comment moderation has been turned off.

    \n"; - echo "
    \n"; + if ('none' == get_settings('comment_moderation')) { + echo '
    +

    Comment moderation has been turned off.

    +
    '; include("b2footer.php"); exit; } @@ -144,7 +144,7 @@ default: get_results("SELECT * FROM $tablecomments WHERE comment_approved='0'"); +$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved = 0"); if ($comments) { // list all comments that are waiting for approval $file = basename(__FILE__);