Cleaning up comment moderation and the comment code in general. More to do tomorrow with regards to wp-moderation.php.

git-svn-id: https://develop.svn.wordpress.org/trunk@549 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2003-11-15 08:58:18 +00:00
parent 52f9b145a9
commit b6d0c342a3
9 changed files with 202 additions and 448 deletions

View File

@@ -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('|<br />\s*<br />|', "\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;
}
}