diff -uNr a/mp-wp/manifest b/mp-wp/manifest --- a/mp-wp/manifest 4ad5c0b7eda9c670f311a23da92114ab10bf30b9990b46882047aea3ab569395f643cb4aa6144ee0ba74b9821df1e69b26d299c1f0e9c11631a78c46f95913bd +++ b/mp-wp/manifest 69b0efa256e0f4de208ab3c73a6dec8882bd60f194a330bdb67f300b73f4cd12f2a57ccded30b236f9d6831263184eac2c4a3fa23c9fd30391d67c2f092baa5e @@ -5,3 +5,4 @@ 569483 mp-wp_remove-tinymce-and-other-crud billymg Remove tinymce, most of the importers, the self-update feature, and the google gears and press-this plugins 602064 mp-wp_apply-htmlspecialchars-to-post-edit-content billymg Run post content through htmlspecialchars() before loading into the post edit UI 605926 mp-wp_comments_filtering diana_coman Recent comments widget should show only people's comments (no track/pingbacks); theme default changed to show trackbacks/pingbacks as last/at the bottom in an article's comments list. +629903 mp-wp_remove-textselectionjs-pop3-etc-r2 jfw Remove the unreliable JS-based selection (reground: including wrapper spans), posting by POP3 login, and a stray .php.orig file. Neutralize and comment the example pingback updater. diff -uNr a/mp-wp/pingback-updater.php b/mp-wp/pingback-updater.php --- a/mp-wp/pingback-updater.php 219a4fc0cdfe92c1972a536e37c4d3d9dca6758d744eb7391787d87434543f1bb2961305a0f4dab21ee42bde64bc0870b70981eecad38a29f308123bb42b76b5 +++ b/mp-wp/pingback-updater.php 6b99c0b24445f116108a7e92dfc7018a7420dc01813dcfd12168a09dc1c19c7ea8801120f692809e67493eedcb4d2f3e2a9a88dd73abbe0ce8b94e9a56af1ca1 @@ -1,4 +1,6 @@ diff -uNr a/mp-wp/wp-admin/includes/schema.php b/mp-wp/wp-admin/includes/schema.php --- a/mp-wp/wp-admin/includes/schema.php 261cb6fc5fc05c18a47689861feae94267b0ba35fa4e2f7138a2671ab615f553d10d345d6869187f3080e99daffa1bd0924a2c65f6d7955728c0d815ab176c95 +++ b/mp-wp/wp-admin/includes/schema.php c890a951b231c4c93f6b5c87cd66f0a3312c83fd26fa04718ee43a55d67b18c7e4cc2e3b44e54276e093bb952b191430260f6de08ad6fca55dc96e7987997c4a @@ -194,10 +194,6 @@ add_option('posts_per_rss', 10); add_option('rss_excerpt_length', 50); add_option('rss_use_excerpt', 0); - add_option('mailserver_url', 'mail.example.com'); - add_option('mailserver_login', 'login@example.com'); - add_option('mailserver_pass', 'password'); - add_option('mailserver_port', 110); add_option('default_category', 1); add_option('default_comment_status', 'open'); add_option('default_ping_status', 'open'); diff -uNr a/mp-wp/wp-admin/options-writing.php b/mp-wp/wp-admin/options-writing.php --- a/mp-wp/wp-admin/options-writing.php ce5dd19582efd856b7b9f0cec13cde48a400ed1535e83383619a236f7490e8779bdb9ae7a1fcb28baf6288442ce31205c946efc24001e074cdbaf5e41367aaf0 +++ b/mp-wp/wp-admin/options-writing.php 8cbbcb864590dd9ace0c79288a9b31e43b65223e3fe0b295b4d8b79102a08d0cfb47e5fc3516ab50c6e3b92e8995586ef57624453f4532082c47ac0c39646e1c @@ -78,38 +78,6 @@ -

-

%s, %s, %s.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?>

- - - - - - - - - - - - - - - - - - - -
- - -
- -
- 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true)); -?> -
-

diff -uNr a/mp-wp/wp-comments-post.php.orig b/mp-wp/wp-comments-post.php.orig --- a/mp-wp/wp-comments-post.php.orig 9425d2c2b68595447c693283e81f2f10c33327073ee84a76cd8e387981745e088b160442ee6654c82e0bcfcd45d8680a90c665f8cca466ee7a7751226eba3e7b +++ b/mp-wp/wp-comments-post.php.orig false @@ -1,115 +0,0 @@ -get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); - -if ( empty($status->comment_status) ) { - do_action('comment_id_not_found', $comment_post_ID); - exit; -} elseif ( !comments_open($comment_post_ID) ) { - do_action('comment_closed', $comment_post_ID); - wp_die( __('Sorry, comments are closed for this item.') ); -} elseif ( in_array($status->post_status, array('draft', 'pending') ) ) { - do_action('comment_on_draft', $comment_post_ID); - exit; -} -// These get changed for avoiding spammers. - -$suffix = substr(md5(date('Y-m-d').$_SERVER['REMOTE_ADDR']).$_SERVER['HTTP_USER_AGENT'],6,7); - -$comment_author = ( isset($_POST['author'.$suffix]) ) ? trim(strip_tags($_POST['author'.$suffix])) : null; -$comment_author_email = ( isset($_POST['email'.$suffix]) ) ? trim($_POST['email'.$suffix]) : null; -$comment_author_url = ( isset($_POST['url'.$suffix]) ) ? trim($_POST['url'.$suffix]) : null; -$comment_content = ( isset($_POST['comment']) ) ? trim(strip_tags($_POST['comment'],"
    1. ")) : null; -$comment_checks = ( isset($_POST['comment_post_time']) ) ? trim($_POST['comment_post_time']) : null; -$comment_check = explode ("-",$comment_checks); -$comment_time = $comment_check[0]; -$comment_IP = $comment_check[1]; - -// Special handle for idiots. -/* -if (($comment_author_email == "icriss78@yahoo.com")||($comment_author_url == "http://blog.matinal.org")) { - $comment_author_url = ""; - $comment_content.= "\n\nEu sunt o simpla fictiune. Luati ce-am scris mai sus ca atare."; -} -*/ - -// GPG catchall. - -if (strpos($comment_content,"BEGIN PGP")>0) $comment_content = "".$comment_content.""; - -// Don't make it much more than 3 or it'll pester users. - -if (((time() - $comment_time) < 3)||(time() - $comment_time > 5000)||($comment_IP <> $_SERVER['REMOTE_ADDR'])) wp_die( __('Looks like you tried to comment off a stale page. Reload the article, count to three and try again.') ); - -$myrows = $wpdb->get_var('SELECT comment_ID FROM tril_comments WHERE comment_author_IP = "'.$_SERVER["REMOTE_ADDR"].'" and comment_approved = "spam";'); -if ($myrows > 0) wp_die( __('Spammers need not apply.') ); - -// If the user is logged in -$user = wp_get_current_user(); -if ( $user->ID ) { - if ( empty( $user->display_name ) ) - $user->display_name=$user->user_login; - $comment_author = $wpdb->escape($user->display_name); - $comment_author_email = $wpdb->escape($user->user_email); - $comment_author_url = $wpdb->escape($user->user_url); - if ( current_user_can('unfiltered_html') ) { - if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { - kses_remove_filters(); // start with a clean slate - kses_init_filters(); // set up the filters - } - } -} else { - if ( get_option('comment_registration') ) - wp_die( __('Sorry, you must be logged in to post a comment.') ); -} - -$comment_type = ''; - -if ( get_option('require_name_email') && !$user->ID ) { - if ( 6 > strlen($comment_author_email) || '' == $comment_author ) - wp_die( __('Error: please fill the required fields (name, email).') ); - elseif ( !is_email($comment_author_email)) - wp_die( __('Error: please enter a valid email address.') ); -} - -if ( '' == $comment_content ) - wp_die( __('Error: please type a comment.') ); - -$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; - -$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); - -$comment_id = wp_new_comment( $commentdata ); - -$comment = get_comment($comment_id); -if ( !$user->ID ) { - setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); - setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); - setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); -} - -$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id; -$location = apply_filters('comment_post_redirect', $location, $comment); - -wp_redirect($location); - -?> diff -uNr a/mp-wp/wp-content/themes/default/footer.php b/mp-wp/wp-content/themes/default/footer.php --- a/mp-wp/wp-content/themes/default/footer.php acdc1e30a585923e1b0879e650e51185df6faaf999e79ba34c37cf360181ed4a5d67e2d53e4a510c3f4958f776284b865b302130451c548a067dc5efca8fd575 +++ b/mp-wp/wp-content/themes/default/footer.php 44f4703acd8b81f7ddb3181a7e4fe2797a4aa0c2b90fcb615297fbd2e60f6cb79bea1155e56616e2503144862066ce022a16d781d18fa12850441978bb8d2bde @@ -22,6 +22,5 @@ - diff -uNr a/mp-wp/wp-content/themes/default/page.php b/mp-wp/wp-content/themes/default/page.php --- a/mp-wp/wp-content/themes/default/page.php 662fa8de62b303463ec65e384051b4eeb2d8ba2328859979b800c2d1f0b885f6b1bedbee756355fd13e68ce0f5e491f229bb2184f0fed9cb92f328f5a5661631 +++ b/mp-wp/wp-content/themes/default/page.php c3cc58384f388f422e147292eb19777d7703a2ce273ada639c46863566cc75e63975c4b261f19069b4c0f6f95336f90e26e2ce1cdb448444c85d04817dd9ed79 @@ -9,7 +9,6 @@
      -

      @@ -18,11 +17,10 @@
      -
      ', '

      '); ?>
      - \ No newline at end of file + diff -uNr a/mp-wp/wp-content/themes/default/selection-magic.php b/mp-wp/wp-content/themes/default/selection-magic.php --- a/mp-wp/wp-content/themes/default/selection-magic.php 01e83a62726bef4232415b4841942427f31063ac2ddfbab0048d5f5b63da00ec2eccacf3fc30cc71997e304969960f5774037e1245e1f0c4e9853d7d3b6450e7 +++ b/mp-wp/wp-content/themes/default/selection-magic.php false @@ -1,135 +0,0 @@ - diff -uNr a/mp-wp/wp-content/themes/default/single.php b/mp-wp/wp-content/themes/default/single.php --- a/mp-wp/wp-content/themes/default/single.php 20f607b36bc9e82f8481aedccc77fd7029c86340e5f617020f5d6f5eca1c57580fcd749907338f40395eb2eb2160fe3534a0fa6466acaeeacb0123bb96cc5e62 +++ b/mp-wp/wp-content/themes/default/single.php 1ab328dab276d34db579e48ace1c583439ae63d9ff6255ba057eb7f3cf4b303584998b8ed214a1edb5bca542d59e376d12b346b8e7b4a435b7a3e3f2b178f93d @@ -16,8 +16,7 @@
      - -
      id="post-"> +
      id="post-">

      @@ -59,8 +58,7 @@

      -
      - +
      diff -uNr a/mp-wp/wp-includes/class-pop3.php b/mp-wp/wp-includes/class-pop3.php --- a/mp-wp/wp-includes/class-pop3.php 745206f90604f46cc369eb2fd4da8c31803b3c7a0fa13f75c24111f7f3adda434dcb05fe7c9176e539498789d4358967b650c7f44d1c03bc781422d765dc59bb +++ b/mp-wp/wp-includes/class-pop3.php false @@ -1,651 +0,0 @@ -BUFFER,"integer"); - if( !empty($server) ) { - // Do not allow programs to alter MAILSERVER - // if it is already specified. They can get around - // this if they -really- want to, so don't count on it. - if(empty($this->MAILSERVER)) - $this->MAILSERVER = $server; - } - if(!empty($timeout)) { - settype($timeout,"integer"); - $this->TIMEOUT = $timeout; - if (!ini_get('safe_mode')) - set_time_limit($timeout); - } - return true; - } - - function update_timer () { - if (!ini_get('safe_mode')) - set_time_limit($this->TIMEOUT); - return true; - } - - function connect ($server, $port = 110) { - // Opens a socket to the specified server. Unless overridden, - // port defaults to 110. Returns true on success, false on fail - - // If MAILSERVER is set, override $server with it's value - - if (!isset($port) || !$port) {$port = 110;} - if(!empty($this->MAILSERVER)) - $server = $this->MAILSERVER; - - if(empty($server)){ - $this->ERROR = "POP3 connect: " . _("No server specified"); - unset($this->FP); - return false; - } - - $fp = @fsockopen("$server", $port, $errno, $errstr); - - if(!$fp) { - $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]"; - unset($this->FP); - return false; - } - - socket_set_blocking($fp,-1); - $this->update_timer(); - $reply = fgets($fp,$this->BUFFER); - $reply = $this->strip_clf($reply); - if($this->DEBUG) - error_log("POP3 SEND [connect: $server] GOT [$reply]",0); - if(!$this->is_ok($reply)) { - $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; - unset($this->FP); - return false; - } - $this->FP = $fp; - $this->BANNER = $this->parse_banner($reply); - return true; - } - - function user ($user = "") { - // Sends the USER command, returns true or false - - if( empty($user) ) { - $this->ERROR = "POP3 user: " . _("no login ID submitted"); - return false; - } elseif(!isset($this->FP)) { - $this->ERROR = "POP3 user: " . _("connection not established"); - return false; - } else { - $reply = $this->send_cmd("USER $user"); - if(!$this->is_ok($reply)) { - $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; - return false; - } else - return true; - } - } - - function pass ($pass = "") { - // Sends the PASS command, returns # of msgs in mailbox, - // returns false (undef) on Auth failure - - if(empty($pass)) { - $this->ERROR = "POP3 pass: " . _("No password submitted"); - return false; - } elseif(!isset($this->FP)) { - $this->ERROR = "POP3 pass: " . _("connection not established"); - return false; - } else { - $reply = $this->send_cmd("PASS $pass"); - if(!$this->is_ok($reply)) { - $this->ERROR = "POP3 pass: " . _("Authentication failed") . " [$reply]"; - $this->quit(); - return false; - } else { - // Auth successful. - $count = $this->last("count"); - $this->COUNT = $count; - return $count; - } - } - } - - function apop ($login,$pass) { - // Attempts an APOP login. If this fails, it'll - // try a standard login. YOUR SERVER MUST SUPPORT - // THE USE OF THE APOP COMMAND! - // (apop is optional per rfc1939) - - if(!isset($this->FP)) { - $this->ERROR = "POP3 apop: " . _("No connection to server"); - return false; - } elseif(!$this->ALLOWAPOP) { - $retVal = $this->login($login,$pass); - return $retVal; - } elseif(empty($login)) { - $this->ERROR = "POP3 apop: " . _("No login ID submitted"); - return false; - } elseif(empty($pass)) { - $this->ERROR = "POP3 apop: " . _("No password submitted"); - return false; - } else { - $banner = $this->BANNER; - if( (!$banner) or (empty($banner)) ) { - $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort"); - $retVal = $this->login($login,$pass); - return $retVal; - } else { - $AuthString = $banner; - $AuthString .= $pass; - $APOPString = md5($AuthString); - $cmd = "APOP $login $APOPString"; - $reply = $this->send_cmd($cmd); - if(!$this->is_ok($reply)) { - $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort"); - $retVal = $this->login($login,$pass); - return $retVal; - } else { - // Auth successful. - $count = $this->last("count"); - $this->COUNT = $count; - return $count; - } - } - } - } - - function login ($login = "", $pass = "") { - // Sends both user and pass. Returns # of msgs in mailbox or - // false on failure (or -1, if the error occurs while getting - // the number of messages.) - - if( !isset($this->FP) ) { - $this->ERROR = "POP3 login: " . _("No connection to server"); - return false; - } else { - $fp = $this->FP; - if( !$this->user( $login ) ) { - // Preserve the error generated by user() - return false; - } else { - $count = $this->pass($pass); - if( (!$count) || ($count == -1) ) { - // Preserve the error generated by last() and pass() - return false; - } else - return $count; - } - } - } - - function top ($msgNum, $numLines = "0") { - // Gets the header and first $numLines of the msg body - // returns data in an array with each returned line being - // an array element. If $numLines is empty, returns - // only the header information, and none of the body. - - if(!isset($this->FP)) { - $this->ERROR = "POP3 top: " . _("No connection to server"); - return false; - } - $this->update_timer(); - - $fp = $this->FP; - $buffer = $this->BUFFER; - $cmd = "TOP $msgNum $numLines"; - fwrite($fp, "TOP $msgNum $numLines\r\n"); - $reply = fgets($fp, $buffer); - $reply = $this->strip_clf($reply); - if($this->DEBUG) { - @error_log("POP3 SEND [$cmd] GOT [$reply]",0); - } - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 top: " . _("Error ") . "[$reply]"; - return false; - } - - $count = 0; - $MsgArray = array(); - - $line = fgets($fp,$buffer); - while ( !ereg("^\.\r\n",$line)) - { - $MsgArray[$count] = $line; - $count++; - $line = fgets($fp,$buffer); - if(empty($line)) { break; } - } - - return $MsgArray; - } - - function pop_list ($msgNum = "") { - // If called with an argument, returns that msgs' size in octets - // No argument returns an associative array of undeleted - // msg numbers and their sizes in octets - - if(!isset($this->FP)) - { - $this->ERROR = "POP3 pop_list: " . _("No connection to server"); - return false; - } - $fp = $this->FP; - $Total = $this->COUNT; - if( (!$Total) or ($Total == -1) ) - { - return false; - } - if($Total == 0) - { - return array("0","0"); - // return -1; // mailbox empty - } - - $this->update_timer(); - - if(!empty($msgNum)) - { - $cmd = "LIST $msgNum"; - fwrite($fp,"$cmd\r\n"); - $reply = fgets($fp,$this->BUFFER); - $reply = $this->strip_clf($reply); - if($this->DEBUG) { - @error_log("POP3 SEND [$cmd] GOT [$reply]",0); - } - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; - return false; - } - list($junk,$num,$size) = preg_split('/\s+/',$reply); - return $size; - } - $cmd = "LIST"; - $reply = $this->send_cmd($cmd); - if(!$this->is_ok($reply)) - { - $reply = $this->strip_clf($reply); - $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; - return false; - } - $MsgArray = array(); - $MsgArray[0] = $Total; - for($msgC=1;$msgC <= $Total; $msgC++) - { - if($msgC > $Total) { break; } - $line = fgets($fp,$this->BUFFER); - $line = $this->strip_clf($line); - if(ereg("^\.",$line)) - { - $this->ERROR = "POP3 pop_list: " . _("Premature end of list"); - return false; - } - list($thisMsg,$msgSize) = preg_split('/\s+/',$line); - settype($thisMsg,"integer"); - if($thisMsg != $msgC) - { - $MsgArray[$msgC] = "deleted"; - } - else - { - $MsgArray[$msgC] = $msgSize; - } - } - return $MsgArray; - } - - function get ($msgNum) { - // Retrieve the specified msg number. Returns an array - // where each line of the msg is an array element. - - if(!isset($this->FP)) - { - $this->ERROR = "POP3 get: " . _("No connection to server"); - return false; - } - - $this->update_timer(); - - $fp = $this->FP; - $buffer = $this->BUFFER; - $cmd = "RETR $msgNum"; - $reply = $this->send_cmd($cmd); - - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]"; - return false; - } - - $count = 0; - $MsgArray = array(); - - $line = fgets($fp,$buffer); - while ( !ereg("^\.\r\n",$line)) - { - if ( $line{0} == '.' ) { $line = substr($line,1); } - $MsgArray[$count] = $line; - $count++; - $line = fgets($fp,$buffer); - if(empty($line)) { break; } - } - return $MsgArray; - } - - function last ( $type = "count" ) { - // Returns the highest msg number in the mailbox. - // returns -1 on error, 0+ on success, if type != count - // results in a popstat() call (2 element array returned) - - $last = -1; - if(!isset($this->FP)) - { - $this->ERROR = "POP3 last: " . _("No connection to server"); - return $last; - } - - $reply = $this->send_cmd("STAT"); - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 last: " . _("Error ") . "[$reply]"; - return $last; - } - - $Vars = preg_split('/\s+/',$reply); - $count = $Vars[1]; - $size = $Vars[2]; - settype($count,"integer"); - settype($size,"integer"); - if($type != "count") - { - return array($count,$size); - } - return $count; - } - - function reset () { - // Resets the status of the remote server. This includes - // resetting the status of ALL msgs to not be deleted. - // This method automatically closes the connection to the server. - - if(!isset($this->FP)) - { - $this->ERROR = "POP3 reset: " . _("No connection to server"); - return false; - } - $reply = $this->send_cmd("RSET"); - if(!$this->is_ok($reply)) - { - // The POP3 RSET command -never- gives a -ERR - // response - if it ever does, something truely - // wild is going on. - - $this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]"; - @error_log("POP3 reset: ERROR [$reply]",0); - } - $this->quit(); - return true; - } - - function send_cmd ( $cmd = "" ) - { - // Sends a user defined command string to the - // POP server and returns the results. Useful for - // non-compliant or custom POP servers. - // Do NOT includ the \r\n as part of your command - // string - it will be appended automatically. - - // The return value is a standard fgets() call, which - // will read up to $this->BUFFER bytes of data, until it - // encounters a new line, or EOF, whichever happens first. - - // This method works best if $cmd responds with only - // one line of data. - - if(!isset($this->FP)) - { - $this->ERROR = "POP3 send_cmd: " . _("No connection to server"); - return false; - } - - if(empty($cmd)) - { - $this->ERROR = "POP3 send_cmd: " . _("Empty command string"); - return ""; - } - - $fp = $this->FP; - $buffer = $this->BUFFER; - $this->update_timer(); - fwrite($fp,"$cmd\r\n"); - $reply = fgets($fp,$buffer); - $reply = $this->strip_clf($reply); - if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } - return $reply; - } - - function quit() { - // Closes the connection to the POP3 server, deleting - // any msgs marked as deleted. - - if(!isset($this->FP)) - { - $this->ERROR = "POP3 quit: " . _("connection does not exist"); - return false; - } - $fp = $this->FP; - $cmd = "QUIT"; - fwrite($fp,"$cmd\r\n"); - $reply = fgets($fp,$this->BUFFER); - $reply = $this->strip_clf($reply); - if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } - fclose($fp); - unset($this->FP); - return true; - } - - function popstat () { - // Returns an array of 2 elements. The number of undeleted - // msgs in the mailbox, and the size of the mbox in octets. - - $PopArray = $this->last("array"); - - if($PopArray == -1) { return false; } - - if( (!$PopArray) or (empty($PopArray)) ) - { - return false; - } - return $PopArray; - } - - function uidl ($msgNum = "") - { - // Returns the UIDL of the msg specified. If called with - // no arguments, returns an associative array where each - // undeleted msg num is a key, and the msg's uidl is the element - // Array element 0 will contain the total number of msgs - - if(!isset($this->FP)) { - $this->ERROR = "POP3 uidl: " . _("No connection to server"); - return false; - } - - $fp = $this->FP; - $buffer = $this->BUFFER; - - if(!empty($msgNum)) { - $cmd = "UIDL $msgNum"; - $reply = $this->send_cmd($cmd); - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; - return false; - } - list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); - return $myUidl; - } else { - $this->update_timer(); - - $UIDLArray = array(); - $Total = $this->COUNT; - $UIDLArray[0] = $Total; - - if ($Total < 1) - { - return $UIDLArray; - } - $cmd = "UIDL"; - fwrite($fp, "UIDL\r\n"); - $reply = fgets($fp, $buffer); - $reply = $this->strip_clf($reply); - if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; - return false; - } - - $line = ""; - $count = 1; - $line = fgets($fp,$buffer); - while ( !ereg("^\.\r\n",$line)) { - if(ereg("^\.\r\n",$line)) { - break; - } - list ($msg,$msgUidl) = preg_split('/\s+/',$line); - $msgUidl = $this->strip_clf($msgUidl); - if($count == $msg) { - $UIDLArray[$msg] = $msgUidl; - } - else - { - $UIDLArray[$count] = 'deleted'; - } - $count++; - $line = fgets($fp,$buffer); - } - } - return $UIDLArray; - } - - function delete ($msgNum = "") { - // Flags a specified msg as deleted. The msg will not - // be deleted until a quit() method is called. - - if(!isset($this->FP)) - { - $this->ERROR = "POP3 delete: " . _("No connection to server"); - return false; - } - if(empty($msgNum)) - { - $this->ERROR = "POP3 delete: " . _("No msg number submitted"); - return false; - } - $reply = $this->send_cmd("DELE $msgNum"); - if(!$this->is_ok($reply)) - { - $this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]"; - return false; - } - return true; - } - - // ********************************************************* - - // The following methods are internal to the class. - - function is_ok ($cmd = "") { - // Return true or false on +OK or -ERR - - if( empty($cmd) ) - return false; - else - return( ereg ("^\+OK", $cmd ) ); - } - - function strip_clf ($text = "") { - // Strips \r\n from server responses - - if(empty($text)) - return $text; - else { - $stripped = str_replace("\r",'',$text); - $stripped = str_replace("\n",'',$stripped); - return $stripped; - } - } - - function parse_banner ( $server_text ) { - $outside = true; - $banner = ""; - $length = strlen($server_text); - for($count =0; $count < $length; $count++) - { - $digit = substr($server_text,$count,1); - if(!empty($digit)) { - if( (!$outside) && ($digit != '<') && ($digit != '>') ) - { - $banner .= $digit; - } - if ($digit == '<') - { - $outside = false; - } - if($digit == '>') - { - $outside = true; - } - } - } - $banner = $this->strip_clf($banner); // Just in case - return "<$banner>"; - } - -} // End class -?> diff -uNr a/mp-wp/wp-mail.php b/mp-wp/wp-mail.php --- a/mp-wp/wp-mail.php 2915bb3a275f2961bc736fb095f7a5f6e289de2ea82f2e3f89483d7d34802aedcd971d4bac56bfb3f324d6e68a3adf48a50ac19a927117cd542577c54a75f557 +++ b/mp-wp/wp-mail.php false @@ -1,209 +0,0 @@ - Writing - * - * @package WordPress - */ - -/** Make sure that the WordPress bootstrap has run before continuing. */ -require(dirname(__FILE__) . '/wp-load.php'); - -/** Get the POP3 class with which to access the mailbox. */ -require_once( ABSPATH . WPINC . '/class-pop3.php' ); - -$time_difference = absint(get_option('gmt_offset')) * 3600; - -$phone_delim = '::'; - -$pop3 = new POP3(); - -if ( ! $pop3->connect(get_option('mailserver_url'), get_option('mailserver_port') ) || - ! $pop3->user(get_option('mailserver_login')) || - ( ! $count = $pop3->pass(get_option('mailserver_pass')) ) ) { - $pop3->quit(); - wp_die( ( 0 === $count ) ? __("There doesn't seem to be any new mail.") : wp_specialchars($pop3->ERROR) ); -} - -for ( $i = 1; $i <= $count; $i++ ) { - - $message = $pop3->get($i); - - $bodysignal = false; - $boundary = ''; - $charset = ''; - $content = ''; - $content_type = ''; - $content_transfer_encoding = ''; - $post_author = 1; - $author_found = false; - $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); - foreach ($message as $line) { - // body signal - if ( strlen($line) < 3 ) - $bodysignal = true; - if ( $bodysignal ) { - $content .= $line; - } else { - if ( preg_match('/Content-Type: /i', $line) ) { - $content_type = trim($line); - $content_type = substr($content_type, 14, strlen($content_type) - 14); - $content_type = explode(';', $content_type); - if ( ! empty( $content_type[1] ) ) { - $charset = explode('=', $content_type[1]); - $charset = ( ! empty( $charset[1] ) ) ? trim($charset[1]) : ''; - } - $content_type = $content_type[0]; - } - if ( preg_match('/Content-Transfer-Encoding: /i', $line) ) { - $content_transfer_encoding = trim($line); - $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding) - 27); - $content_transfer_encoding = explode(';', $content_transfer_encoding); - $content_transfer_encoding = $content_transfer_encoding[0]; - } - if ( ( $content_type == 'multipart/alternative' ) && ( false !== strpos($line, 'boundary="') ) && ( '' == $boundary ) ) { - $boundary = trim($line); - $boundary = explode('"', $boundary); - $boundary = $boundary[1]; - } - if (preg_match('/Subject: /i', $line)) { - $subject = trim($line); - $subject = substr($subject, 9, strlen($subject) - 9); - // Captures any text in the subject before $phone_delim as the subject - if ( function_exists('iconv_mime_decode') ) { - $subject = iconv_mime_decode($subject, 2, get_option('blog_charset')); - } else { - $subject = wp_iso_descrambler($subject); - } - $subject = explode($phone_delim, $subject); - $subject = $subject[0]; - } - - // Set the author using the email address (From or Reply-To, the last used) - // otherwise use the site admin - if ( preg_match('/(From|Reply-To): /', $line) ) { - if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) ) - $author = $matches[0]; - else - $author = trim($line); - $author = sanitize_email($author); - if ( is_email($author) ) { - echo '

      ' . sprintf(__('Author is %s'), $author) . '

      '; - $userdata = get_user_by_email($author); - if ( empty($userdata) ) { - $author_found = false; - } else { - $post_author = $userdata->ID; - $author_found = true; - } - } else { - $author_found = false; - } - } - - if (preg_match('/Date: /i', $line)) { // of the form '20 Mar 2002 20:32:37' - $ddate = trim($line); - $ddate = str_replace('Date: ', '', $ddate); - if (strpos($ddate, ',')) { - $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate))); - } - $date_arr = explode(' ', $ddate); - $date_time = explode(':', $date_arr[3]); - - $ddate_H = $date_time[0]; - $ddate_i = $date_time[1]; - $ddate_s = $date_time[2]; - - $ddate_m = $date_arr[1]; - $ddate_d = $date_arr[0]; - $ddate_Y = $date_arr[2]; - for ( $j = 0; $j < 12; $j++ ) { - if ( $ddate_m == $dmonths[$j] ) { - $ddate_m = $j+1; - } - } - - $time_zn = intval($date_arr[4]) * 36; - $ddate_U = gmmktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y); - $ddate_U = $ddate_U - $time_zn; - $post_date = gmdate('Y-m-d H:i:s', $ddate_U + $time_difference); - $post_date_gmt = gmdate('Y-m-d H:i:s', $ddate_U); - } - } - } - - // Set $post_status based on $author_found and on author's publish_posts capability - if ( $author_found ) { - $user = new WP_User($post_author); - $post_status = ( $user->has_cap('publish_posts') ) ? 'publish' : 'pending'; - } else { - // Author not found in DB, set status to pending. Author already set to admin. - $post_status = 'pending'; - } - - $subject = trim($subject); - - if ( $content_type == 'multipart/alternative' ) { - $content = explode('--'.$boundary, $content); - $content = $content[2]; - // match case-insensitive content-transfer-encoding - if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim) ) { - $content = explode($delim[0], $content); - $content = $content[1]; - } - $content = strip_tags($content, '


      '); - } - $content = trim($content); - - if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) { - $content = quoted_printable_decode($content); - } - - if ( function_exists('iconv') && ! empty( $charset ) ) { - $content = iconv($charset, get_option('blog_charset'), $content); - } - - // Captures any text in the body after $phone_delim as the body - $content = explode($phone_delim, $content); - $content = empty( $content[1] ) ? $content[0] : $content[1]; - - $content = trim($content); - - $post_content = apply_filters('phone_content', $content); - - $post_title = xmlrpc_getposttitle($content); - - if ($post_title == '') $post_title = $subject; - - $post_category = array(get_option('default_email_category')); - - $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status'); - $post_data = add_magic_quotes($post_data); - - $post_ID = wp_insert_post($post_data); - if ( is_wp_error( $post_ID ) ) - echo "\n" . $post_ID->get_error_message(); - - // We couldn't post, for whatever reason. Better move forward to the next email. - if ( empty( $post_ID ) ) - continue; - - do_action('publish_phone', $post_ID); - - echo "\n

      " . sprintf(__('Author: %s'), wp_specialchars($post_author)) . '

      '; - echo "\n

      " . sprintf(__('Posted title: %s'), wp_specialchars($post_title)) . '

      '; - - if(!$pop3->delete($i)) { - echo '

      ' . sprintf(__('Oops: %s'), wp_specialchars($pop3->ERROR)) . '

      '; - $pop3->reset(); - exit; - } else { - echo '

      ' . sprintf(__('Mission complete. Message %s deleted.'), $i) . '

      '; - } - -} - -$pop3->quit(); - -?>