⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wp-mail.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
				if (!$result) {
					echo "<p><b>Wrong login or password.</b></p></div>\n";
					continue;
				}
			}

			$user_level = $result->user_level;
			$post_author = $result->ID;

			if ($user_level > 0) {
				$post_title = xmlrpc_getposttitle($content);
				if ($post_title == '') {
					$post_title = $subject;
				}

				$post_category = get_settings('default_category');
				if (preg_match('/<category>(.+?)<\/category>/is', $content, $matchcat)) {
					$post_category = xmlrpc_getpostcategory($content);
				}
				if ($post_category == '') {
					$post_category = get_settings('default_post_category');
				}
				if (function_exists('xoopschina_mb_convert_encoding')) {
					echo "Subject : " . xoopschina_mb_convert_encoding($subject, $blog_charset, $sub_charset) . " <br />\n";
				} else {
					echo "Subject : " . $subject . " <br />\n";
				}
				echo "Category : $post_category <br />\n";
				if (!get_settings('emailtestonly')) {
					// Attaching Image Files Save
					if ($att_boundary != "") {
						$attachment = wp_getattach($contents[2], trim($user_login), 1);
					}
					if (($boundary != "") && ($hatt_boundary != "")) {
						for ($i = 2; $i < count($contents); $i++) {
							$hattachment = wp_getattach($contents[$i], trim($user_login), 0);
							if ($hattachment) {
								if (preg_match("/Content-Id: \<([^\>]*)>/i", $contents[$i], $matches)) {
									$content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", "$siteurl/attach/" . $hattachment, $content);
								}
							}
						}
					}
					if ($boundary != "") {
						$content = preg_replace("/\=[\r\n]/", "", $content);
						$content = preg_replace("/[\r\n]/", " ", $content);
					}

					$content = preg_replace("|\n([^\n])|", " $1", $content);
					$content = preg_replace("/\=([0-9a-fA-F]{2,2})/e", "pack('c',base_convert('\\1',16,10))", $content);
					if (function_exists('xoopschina_mb_convert_encoding')) {
						$content = addslashes(xoopschina_mb_convert_encoding(trim($content), $blog_charset, $charset));
						$post_title = addslashes(trim(xoopschina_mb_convert_encoding($post_title, $blog_charset, $sub_charset)));
					} else {
						$content = addslashes(trim($content));
						$post_title = addslashes(trim($post_title));
					}
					// If we find an attachment, add it to the post
					if ($attachment) {
						if (file_exists("../attach/thumb-" . $attachment)) {
							$content = "<a href=\"" . $siteurl . "/attach/" . $attachment . "\"><img style=\"float: left;\" hspace=\"6\" src = \"" . $siteurl . "/attach/thumb-" . $attachment . "\"  alt=\"moblog\" ></a>" . $content . "<br clear=left>";
						} else {
							$content = "<a href=\"" . $siteurl . "/attach/" . $attachment . "\"><img style=\"float: left;\" hspace=\"6\" src = \"" . $siteurl . "/attach/" . $attachment . "\"  alt=\"moblog\" ></a>" . $content . "<br clear=left>";
						}
					}
					if ($flat > 500) {
						$sql = "INSERT INTO {$wpdb->posts} (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)";
					} else {
						$sql = "INSERT INTO {$wpdb->posts} (post_author, post_date, post_content, post_title, post_category, post_lat, post_lon) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category, $flat, $flon)";
					}
					$result = $wpdb->query($sql);
					$post_ID = $wpdb->insert_id;
					echo "Post ID = $post_ID<br />\n";
					if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
						sleep($sleep_after_edit);
					}

					$blog_ID = 1;
					if ($flat < 500) {
						pingGeoUrl($post_ID);
					}
					// Double check it's not there already
					$exists = $wpdb->get_row("SELECT * FROM {$wpdb->post2cat} WHERE post_id = $post_ID AND category_id = $post_category");
					if (!$exists && $result) {
						$wpdb->query("
						INSERT INTO {$wpdb->post2cat}
						(post_id, category_id)
						VALUES
						($post_ID, $post_category)
						");
					}

					pingWeblogs($blog_ID);
					pingBlogs($blog_ID);
//					pingback($content, $post_ID);
					do_action('publish_post', $post_ID);
					do_action('publish_phone', $post_ID);
				}
				echo "\n<p><b>Posted title:</b> $post_title<br />\n";
				echo "<b>Posted content:</b><br /><pre>" . $content . "</pre></p>\n";

				if (!$wp_pop3->delete($iCount)) {
					echo "<p>Oops " . $wp_pop3->ERROR . "</p></div>\n";
					$wp_pop3->reset();
					return;
				} else {
					echo "<p>Mission complete, message <strong>$iCount</strong> deleted.</p>\n";
				}
			} else {
				echo "<p><strong>Level 0 users can\'t post.</strong></p>\n";
			}
			echo "</div>\n";
		}
	}

	$wp_pop3->quit();

	timer_stop($output_debugging_info);
	return;
}
function wp_getattach($content, $prefix = "", $create_thumbs = 0)
{
	$contents = explode("\r\n\r\n", $content);
	$subtype = preg_match("/Content-Type: [^\/]*\/([^\;]*);/", $contents[0], $matches);
	if ($subtype) $subtype = strtolower($matches[1]);
	$temp_file = "";
	if (in_array($subtype, array("gif", "jpg", "jpeg", "png"))) {
		if (($prefix == 0) && eregi("name=\"?([^\"\n]+)\"?", $contents[0], $filereg)) {
			$filename = ereg_replace("[\t\r\n]", "", $filereg[1]);
			if (function_exists('xoopschina_mb_convert_encoding')) {
				$temp_file = xoopschina_mb_convert_encoding($filename, $blog_charset, "utf-8");
			} else {
				$temp_file = $filename;
			}
		}
		// 藕烧デ〖タをデコ〖ドして瘦赂
		if (eregi("Content-Transfer-Encoding:.*base64", $contents[0])) {
			$tmp = base64_decode($contents[1]);
			if (!$temp_file) {
				$temp_file_base = $prefix . "_" . time();
			} else {
				$temp_file_info = pathinfo($temp_file);
				$temp_file_base = basename($temp_file, "." . $temp_file_info["extension"]);
			}
			$i = 0;
			$temp_file = $temp_file_base . ".$subtype";
			while (file_exists("../attach/" . $temp_file)) {
				$temp_file = $temp_file_base . "-" . $i . ".$subtype";;
				$i++;
			}
			if (!($temp_fp = fopen("../attach/" . $temp_file, "wb"))) {
				echo("Error1<br/>\n");
				continue;
			}
			fputs($temp_fp, $tmp);
			fclose($temp_fp);
			if ($create_thumbs) {
				wp_create_thumbnail("../attach/" . $temp_file, 180, "");
			}
		}
		echo "$temp_file <br/>\n";
		return $temp_file;
	}
	return false;
}

function wp_create_thumbnail($file, $max_side, $effect = '')
{
	// 1 = GIF, 2 = JPEG, 3 = PNG
	if (file_exists($file)) {
		$type = getimagesize($file);
		// if the associated function doesn't exist - then it's not
		// handle. duh. i hope.
		if (!function_exists('imagegif') && $type[2] == 1) {
			$error = 'Filetype not supported. Thumbnail not created.';
		} elseif (!function_exists('imagejpeg') && $type[2] == 2) {
			$error = 'Filetype not supported. Thumbnail not created.';
		} elseif (!function_exists('imagepng') && $type[2] == 3) {
			$error = 'Filetype not supported. Thumbnail not created.';
		} else {
			// create the initial copy from the original file
			if ($type[2] == 1) {
				$image = imagecreatefromgif($file);
			} elseif ($type[2] == 2) {
				$image = imagecreatefromjpeg($file);
			} elseif ($type[2] == 3) {
				$image = imagecreatefrompng($file);
			}

			if (function_exists('imageantialias'))
				imageantialias($image, true);

			$image_attr = getimagesize($file);
			// figure out the longest side
			if ($image_attr[0] > $image_attr[1]) {
				$image_width = $image_attr[0];
				$image_height = $image_attr[1];
				$image_new_width = $max_side;

				$image_ratio = $image_width / $image_new_width;
				$image_new_height = $image_height / $image_ratio;
				// width is > height
			} else {
				$image_width = $image_attr[0];
				$image_height = $image_attr[1];
				$image_new_height = $max_side;

				$image_ratio = $image_height / $image_new_height;
				$image_new_width = $image_width / $image_ratio;
				// height > width
			}
            if (function_exists('gd_info')) {
	            $gdver=gd_info();
	            if(strstr($gdver["GD Version"],"1.")!=false){
	            	//For GD
	                $thumbnail = imagecreate($image_new_width, $image_new_height);
	            }else{
	            	//For GD2
					$thumbnail = imagecreatetruecolor($image_new_width, $image_new_height);
	            }
			} else {
                $thumbnail = imagecreatetruecolor($image_new_width, $image_new_height);
			}
			@imagecopyresized($thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1]);
			// move the thumbnail to it's final destination
			$path = explode('/', $file);
			$thumbpath = substr($file, 0, strrpos($file, '/')) . '/thumb-' . $path[count($path)-1];

			if ($type[2] == 1) {
				if (!imagegif($thumbnail, $thumbpath)) {
					$error = "Thumbnail path invalid";
				}
			} elseif ($type[2] == 2) {
				if (!imagejpeg($thumbnail, $thumbpath)) {
					$error = "Thumbnail path invalid";
				}
			} elseif ($type[2] == 3) {
				if (!imagepng($thumbnail, $thumbpath)) {
					$error = "Thumbnail path invalid";
				}
			}
		}
	}

	if (!empty($error)) {
		return $error;
	} else {
		return 1;
	}
}

require_once(dirname(__FILE__) . '/../wp-config.php');

//$output_debugging_info = 0; // =0 if you don't want to output any debugging info.
$output_debugging_info = 1; // =1 if you want to output debugging info to screen.
//$output_debugging_info = 2; // =2 if you want to output debugging info to log file. TODO.

if ( function_exists('debug_backtrace') ) {
	$scriptpath = debug_backtrace();
	if ( count($scriptpath) ) { // Is this file included from another file ?
		$output_debugging_info = 0;  // in this case, shouldn't output any messages.
	}
} else {
	$output_debugging_info = 0;  // in this case, shouldn't output any messages.
}

ob_start();
if ($output_debugging_info) {
	header("Content-Type: text/html; charset=GB2312");
	echo <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312" />
</head><body>
EOD;
}
wp_mail_receive();
if ($output_debugging_info) {
	echo "</body></html>";
	ob_end_flush();
} else {
	ob_end_clean();
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -