summaryrefslogtreecommitdiffstats
path: root/wp-includes/classes.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-26 15:45:20 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-26 15:45:20 +0000
commit28781ebb081ab8d99b30a33f5cd911b3b050bcc9 (patch)
treef21e6b7d3dd06002c58dd52ae2eae10d64d62d85 /wp-includes/classes.php
parentcbd939114d362bfece3839d7d5d5e07367fd6be8 (diff)
downloadwordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.gz
wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.xz
wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.zip
WP Merge to rev 4254
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@770 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/classes.php')
-rw-r--r--wp-includes/classes.php82
1 files changed, 8 insertions, 74 deletions
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index b5f0a68..6d5fec7 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -1,77 +1,5 @@
<?php
-class retrospam_mgr {
- var $spam_words;
- var $comments_list;
- var $found_comments;
-
- function retrospam_mgr() {
- global $wpdb;
-
- $list = explode("\n", get_option('moderation_keys') );
- $list = array_unique( $list );
- $this->spam_words = $list;
-
- $this->comment_list = $wpdb->get_results("SELECT comment_ID AS ID, comment_content AS text, comment_approved AS approved, comment_author_url AS url, comment_author_ip AS ip, comment_author_email AS email FROM $wpdb->comments ORDER BY comment_ID ASC");
- } // End of class constructor
-
- function move_spam( $id_list ) {
- global $wpdb;
- $cnt = 0;
- $id_list = explode( ',', $id_list );
-
- foreach ( $id_list as $comment ) {
- if ( $wpdb->query("update $wpdb->comments set comment_approved = '0' where comment_ID = '$comment'") ) {
- $cnt++;
- }
- }
- echo "<div class='updated'><p> ";
- printf(__('%d comment(s) moved to the moderation queue.'), $cnt);
- echo "</p></div>\n";
- } // End function move_spam
-
- function find_spam() {
- $in_queue = 0;
-
- foreach( $this->comment_list as $comment ) {
- if( $comment->approved == 1 ) {
- foreach( $this->spam_words as $word ) {
- $word = trim($word);
- if ( empty( $word ) )
- continue;
- $fulltext = strtolower($comment->email.' '.$comment->url.' '.$comment->ip.' '.$comment->text);
- if( false !== strpos( $fulltext, strtolower($word) ) ) {
- $this->found_comments[] = $comment->ID;
- break;
- }
- }
- } else {
- $in_queue++;
- }
- }
- return array( 'found' => $this->found_comments, 'in_queue' => $in_queue );
- } // End function find_spam
-
- function display_edit_form( $counters ) {
- $numfound = count($counters[found]);
- $numqueue = $counters[in_queue];
-
- $body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>';
-
- if ( count($counters[found]) > 0 ) {
- $id_list = implode( ',', $counters[found] );
- $body .= '<p><a href="options-discussion.php?action=retrospam&amp;move=true&amp;ids='.$id_list.'">'. __('Move suspect comments to moderation queue &raquo;') . '</a></p>';
-
- }
- $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
-
- $foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
-
- return $head . $body . $foot;
- } // End function display_edit_form
-
-}
-
class WP {
var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots');
@@ -109,7 +37,10 @@ class WP {
$error = '404';
$this->did_permalink = true;
- $pathinfo = $_SERVER['PATH_INFO'];
+ if ( isset($_SERVER['PATH_INFO']) )
+ $pathinfo = $_SERVER['PATH_INFO'];
+ else
+ $pathinfo = '';
$pathinfo_array = explode('?', $pathinfo);
$pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
$req_uri = $_SERVER['REQUEST_URI'];
@@ -117,7 +48,10 @@ class WP {
$req_uri = $req_uri_array[0];
$self = $_SERVER['PHP_SELF'];
$home_path = parse_url(get_option('home'));
- $home_path = $home_path['path'];
+ if ( isset($home_path['path']) )
+ $home_path = $home_path['path'];
+ else
+ $home_path = '';
$home_path = trim($home_path, '/');
// Trim path info from the end and the leading home path from the