diff --git a/b2mail.php b/b2mail.php index ff652a5d29..f1a90a9339 100644 --- a/b2mail.php +++ b/b2mail.php @@ -11,12 +11,10 @@ require_once($abspath.$b2inc.'/b2functions.php'); require_once($abspath.$b2inc."/xmlrpc.inc"); require_once($abspath.$b2inc."/xmlrpcs.inc"); -dbconnect(); timer_start(); $use_cache = 1; $output_debugging_info = 0; # =1 if you want to output debugging info -$autobr = get_settings('AutoBR'); $time_difference = get_settings('time_difference'); if ($use_phoneemail) { @@ -126,7 +124,7 @@ for ($iCount=1; $iCount<=$Count; $iCount++) { ob_start(); if ($ddate_difference_days > 14) { - echo 'too old
'; + echo 'Too old
'; continue; } @@ -148,7 +146,7 @@ for ($iCount=1; $iCount<=$Count; $iCount++) { $content = trim($content); echo "

Content-type: $content_type, boundary: $boundary

\n"; - echo "

Raw content:

".$content.'

'; + echo "

Raw content:

".$content.'

'; $btpos = strpos($content, $bodyterminator); if ($btpos) { @@ -186,16 +184,15 @@ for ($iCount=1; $iCount<=$Count; $iCount++) { echo "

Login: $user_login, Pass: $user_pass

"; $sql = "SELECT ID, user_level FROM $tableusers WHERE user_login='$user_login' AND user_pass='$user_pass' ORDER BY ID DESC LIMIT 1"; - $result = mysql_query($sql); + $result = $wpdb->get_row($sql); - if (!mysql_num_rows($result)) { + if (!$result) { echo '

Wrong login or password.

'; continue; } - $row = mysql_fetch_object($result); - $user_level = $row->user_level; - $post_author = $row->ID; + $user_level = $result->user_level; + $post_author = $result->ID; if ($user_level > 0) { @@ -209,15 +206,11 @@ for ($iCount=1; $iCount<=$Count; $iCount++) { $post_category = $default_category; } - if ($autobr) { - $content = autobrize($content); - } - if (!$thisisforfunonly) { $post_title = addslashes(trim($post_title)); $content = addslashes(trim($content)); $sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)"; - $result = mysql_query($sql) or die('Couldn\'t add post: '.mysql_error()); + $result = $wpdb->query($sql); $post_ID = mysql_insert_id(); if (isset($sleep_after_edit) && $sleep_after_edit > 0) { @@ -232,18 +225,18 @@ for ($iCount=1; $iCount<=$Count; $iCount++) { pingback($content, $post_ID); } echo "\n

Posted title: $post_title
"; - echo "\nPosted content:

".$content.'

'; + echo "\nPosted content:
".$content.'

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

oops '.$pop3->ERROR.'

'; + echo '

Oops '.$pop3->ERROR.'

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

Mission complete, message $iCount deleted

"; + echo "

Mission complete, message $iCount deleted.

"; } } else { - echo '

Level 0 users can\'t post.

'; + echo '

Level 0 users can\'t post.

'; } echo ''; if ($output_debugging_info) { @@ -259,4 +252,4 @@ $pop3->quit(); timer_stop($output_debugging_info); exit; -?> +?> \ No newline at end of file