function fetch($tplfile, $cache_id = null, $compile_id = null, $display = false) { if ($this->tplbase == 'base') { $tpldir = wp_base() . '/templates'; } else { if ($this->tplbase == 'theme') { $tplpath = get_custom_path('templates/' . $tplfile); $tpldir = dirname($tplpath); $tplfile = basename($tplpath); } else { $tpldir = wp_base() . '/' . $this->tplbase . '/templates'; } } $this->template_dir = $tpldir; if (!$compile_id) { if ($this->tplbase == 'theme') { $compile_id = wp_prefix() . $GLOBALS['xoopsConfig']['theme_set'] . '_'; } else { $compile_id = wp_prefix() . $this->tplbase . '_'; } } return parent::fetch($tplfile, $cache_id, $compile_id, $display); }
/** ** get_weblogs_updatedfile() ** Retrieves and caches a copy of the weblogs.com changed blogs xml file. ** If the file exists check it's age, get new copy if old. ** If a new or updated file has been written return true (needs processing) ** otherwise return false (nothing to do) **/ function get_weblogs_updatedfile() { $update = false; $file = wp_base() . "/" . get_settings('weblogs_cache_file'); if ($GLOBALS['ignore_weblogs_cache']) { $update = true; } else { if (file_exists($file)) { // is it old? $modtime = filemtime($file); if (time() - $modtime > get_settings('weblogs_cacheminutes') * 60) { $update = true; } } else { // doesn't exist $update = true; } } if ($update) { // get a new copy $a = @file(get_settings('weblogs_xml_url')); if ($a != false && count($a) && $a[0]) { $contents = implode('', $a); // Clean up the input, because weblogs.com doesn't output clean XML $contents = preg_replace("/'/", ''', $contents); $contents = preg_replace('|[^[:space:][:punct:][:alpha:][:digit:]]|', '', $contents); $cachefp = fopen(wp_base() . "/" . get_settings('weblogs_cache_file'), "w"); fwrite($cachefp, $contents); fclose($cachefp); } else { return false; //don't try to process } } return $update; }
require wp_base() . '/wp-includes/wp-filter-setup.php'; if (empty($GLOBALS['wp_inblock']) || $GLOBALS['wp_inblock'] != 1) { if (!defined('XOOPS_PULUGIN' . wp_id())) { define('XOOPS_PULUGIN' . wp_id(), 1); if (get_settings('active_plugins')) { $check_plugins = explode("\n", get_settings('active_plugins')); foreach ($check_plugins as $check_plugin) { if (file_exists(wp_base() . '/wp-content/plugins/' . $check_plugin)) { if (!defined(md5('WP_PLUGIN_' . strtoupper($check_plugin) . '_INCLUDED'))) { define(md5('WP_PLUGIN_' . strtoupper($check_plugin) . '_INCLUDED'), 1); require_once wp_base() . '/wp-content/plugins/' . $check_plugin; } else { // It is very tricky!! if (!defined(md5('WP_PLUGIN_' . strtoupper($check_plugin) . wp_base() . '_DEFINED'))) { define(md5('WP_PLUGIN_' . strtoupper($check_plugin) . wp_base() . '_DEFINED'), 1); if (preg_match_all('/(add|remove)_(action|filter)\\s*\\([^\\)]+\\)\\s*\\;/', implode('', file(wp_base() . '/wp-content/plugins/' . $check_plugin)), $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { eval($match[0]); } } } } } } } if (!defined('SHUTDOWN_ACTION_HOOK')) { define('SHUTDOWN_ACTION_HOOK', '1'); function wp_shutdown_action_hook() { do_action('shutdown', ''); }
require_once dirname(dirname(__FILE__)) . '/wp-config.php'; } } $xmlrpc_filename = get_settings('xmlrpc_filename') ? get_settings('xmlrpc_filename') : 'xmlrpc.php'; $__file__ = str_replace('\\', '/', __FILE__); if (wp_base() . '/' . $xmlrpc_filename != $__file__) { @header('HTTP/1.x 404 Not Found'); echo "404 Not Found"; exit; } include 'wp-config.php'; require_once wp_base() . '/wp-includes/class-xmlrpc.php'; require_once wp_base() . '/wp-includes/class-xmlrpcs.php'; require_once wp_base() . '/wp-includes/template-functions.php'; require_once wp_base() . '/wp-includes/functions.php'; require_once wp_base() . '/wp-includes/vars.php'; error_reporting(E_ERROR); #Temporally fix for kousagi init_param('GET', 'kousagi', 'integer', ''); $use_cache = 1; $post_autobr = 0; $post_default_title = ''; // posts submitted via the xmlrpc interface get that title $GLOBALS['post_default_category'] = 1; // posts submitted via the xmlrpc interface go into that category function logIO($io, $msg) { if ($GLOBALS['wp_debug']) { $fp = fopen('./log/xmlrpc.log', 'a+'); $date = date('Y-m-d H:i:s '); $iot = $io == 'I' ? ' Input: ' : ' Output: ';
<?php if (!defined('WP_TEMPLATE_FUNCTIONS_INCLUDED')) { define('WP_TEMPLATE_FUNCTIONS_INCLUDED', 1); /***** About-the-blog tags *****/ require_once wp_base() . '/wp-includes/template-functions-general.php'; /***** Links *****/ require_once wp_base() . '/wp-includes/template-functions-links.php'; /**** // Geo Tags ****/ require_once wp_base() . '/wp-includes/template-functions-geo.php'; /***** Author tags *****/ require_once wp_base() . '/wp-includes/template-functions-author.php'; /***** Post tags *****/ require_once wp_base() . '/wp-includes/template-functions-post.php'; /***** Category tags *****/ require_once wp_base() . '/wp-includes/template-functions-category.php'; /***** Comment tags *****/ require_once wp_base() . '/wp-includes/template-functions-comment.php'; }
define('MOD_PUKI_LANG', 'en'); } else { if (file_exists(MOD_PUKI_LANG_BASE . '/' . _LANGCODE)) { define('MOD_PUKI_LANG', _LANGCODE); } else { define('MOD_PUKI_LANG', 'en'); } } } } else { if (defined('ABSPATH') and 'WPINC') { //For WordPress Environment //キャッシュのファイルの保管先 // XOOPS環境下では、wp-contentディレクトリ下にmodPukiWikiというディレクトリを作成して自動設定 if (!defined('MOD_PUKI_CACHE_DIR')) { define('MOD_PUKI_CACHE_DIR', wp_base() . '/wp-content/modPukiWiki/'); if (!file_exists(MOD_PUKI_CACHE_DIR)) { mkdir(MOD_PUKI_CACHE_DIR, 0777); } } //画像キャッシュなどのファイルの保管先 // WordPress環境下では、Fileアップロード関連の設定を参照して自動設定 if (file_exists(get_settings('fileupload_realpath'))) { if (!defined('MOD_PUKI_UPLOAD_URL')) { define('MOD_PUKI_UPLOAD_URL', get_settings('fileupload_url') . '/modPukiWiki/'); } if (!defined('MOD_PUKI_UPLOAD_DIR')) { define('MOD_PUKI_UPLOAD_DIR', get_settings('fileupload_realpath') . '/modPukiWiki/'); if (!file_exists(MOD_PUKI_UPLOAD_DIR)) { mkdir(MOD_PUKI_UPLOAD_DIR, 0777); }
#wp-calendar #today { \tbackground: #D85F7D; \tcolor: #ffffff; } #wp-calendar th { \tfont-style: normal; \tfont-size: 11px; \ttext-transform: capitalize; } EOD; /* Don't remove this line */ } /* Don't remove this line */ if (@in_array('pukiwiki', $GLOBALS['wp_filter'][wp_id()]['the_content']["6"]) && !preg_match("/^" . preg_quote(wp_base() . "/", "/") . "/i", $cur_PATH)) { /* Don't remove this line */ if (!defined("WP_BLOCK_WIKI_READ")) { /* Don't remove this line */ define("WP_BLOCK_WIKI_READ", "1"); $wp_block_style .= <<<EOD /* * modPukiWiki錮ㅞⅩ�엠ㄵ瑜래샵혼데澄婁� */ div.modPukiWP_ie5 { \ttext-align:left; } .modPukiWP_style_table { \tpadding:0px;
function WordPresTpl($tplbase = "") { $this->XoopsTpl(); $this->template_dir = wp_base() . '/' . $tplbase . '/templates/'; $this->error_reporting = error_reporting(); }
?> <ul id="adminmenu2"> <?php foreach ($submenu["{$parent_file}"] as $item) { if ($user_level < $item[1]) { continue; } if ($parent_file != 'options.php' || !preg_match('/^options.php/', $item[2])) { if (substr($self, -10) == substr($item[2], -10) || isset($plugin_page) && $plugin_page == $item[2]) { $class = ' class="current"'; } else { $class = ''; } } else { if (isset($_GET['option_group_id']) && $item[2] == 'options.php?option_group_id=' . $_GET['option_group_id']) { $class = ' class="current"'; } else { $class = ''; } } if (file_exists(wp_base() . "/wp-content/plugins/{$item[2]}")) { echo "\n\t<li><a href='" . wp_siteurl() . "/wp-admin/admin.php?page={$item[2]}'{$class}>{$item[0]}</a></li>"; } else { echo "\n\t<li><a href='" . wp_siteurl() . "/wp-admin/{$item[2]}'{$class}>{$item[0]}</a></li>"; } } ?> </ul> <?php }
<?php require_once wp_base() . "/class/xoopstableobject.php"; require_once wp_base() . "/class/wp_posts.php"; require_once wp_base() . "/class/wp_users.php"; require_once wp_base() . "/class/wp_categories.php"; require_once wp_base() . "/class/wp_comments.php"; require_once wp_base() . "/class/wp_postmeta.php"; require_once wp_base() . "/class/wp_post2cat.php"; require_once wp_base() . "/class/wp_links.php"; require_once wp_base() . "/class/wp_linkcategories.php"; require_once wp_base() . "/class/wp_options.php"; require_once wp_base() . "/class/wp_optiongroup_options.php"; require_once wp_base() . "/class/wp_template.php"; require_once wp_base() . "/class/wp_misc.php";
<th nowrap><?php echo _LANG_PG_SUB_DESCR; ?> </th> <th nowrap><?php echo _LANG_PG_SUB_ACTION; ?> </th> </tr> <?php sort($plugin_files); // Alphabetize by filename. Better way? $style = ''; $ticket = $xoopsWPTicket->getTicketParamString('plugins'); foreach ($plugin_files as $plugin_file) { $plugin_data = implode('', file(wp_base() . '/wp-content/plugins/' . $plugin_file)); preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name); preg_match("|Plugin URI:(.*)|i", $plugin_data, $plugin_uri); preg_match("|Description:(.*)|i", $plugin_data, $description); preg_match("|Author:(.*)|i", $plugin_data, $author_name); preg_match("|Author URI:(.*)|i", $plugin_data, $author_uri); if (preg_match("|Version:(.*)|i", $plugin_data, $version)) { $version = $version[1]; } else { $version = ''; } $description = wptexturize($description[1]); if ('' == $plugin_uri) { $plugin = $plugin_name[1]; } else { $plugin = "<a href='{$plugin_uri[1]}' title='Visit plugin homepage'>{$plugin_name[1]}</a>";
<?php if (file_exists(dirname(__FILE__) . '/xoops_version.php')) { require_once dirname(__FILE__) . '/wp-config.php'; } else { if (file_exists(dirname(dirname(__FILE__)) . '/xoops_version.php')) { require_once dirname(dirname(__FILE__)) . '/wp-config.php'; } } $trackback_filename = get_settings('trackback_filename') ? get_settings('trackback_filename') : 'wp-trackback.php'; if (wp_base() . '/' . $trackback_filename != __FILE__) { trackback_response(1, 'Sorry, Invalid Request.'); } // trackback is done by a POST $_tb_id = explode('/', $_SERVER['REQUEST_URI']); $_tb_id = intval($_tb_id[count($_tb_id) - 1]); init_param('', 'url', 'string', ''); init_param('', 'title', 'string', ''); init_param('', 'excerpt', 'html', ''); init_param('', 'blog_name', 'string', ''); init_param('', 'charset', 'string', ''); init_param('', 'p', 'integer', ''); init_param('', 'name', 'string', ''); init_param('', '__mode', 'string', ''); require_once 'wp-blog-header.php'; //Anti Trackback SPAM $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : (isset($_ENV['HTTP_REFERER']) ? $_ENV['HTTP_REFERER'] : ''); if ($ref) { // Most of Trackbacks don't have HTTP_REFERER header('Location: ' . get_permalink($tb_id)); }
function wp_mail_receive() { global $wpdb, $wp_pop3, $img_target; require_once wp_base() . '/wp-includes/class-pop3.php'; timer_start(); $use_cache = 1; $time_difference = get_settings('time_difference'); // Get Server Time Zone // If Server Time Zone is not collect, Please comment out following line; $server_timezone = date("O"); // echo "Server TimeZone is ".date('O')."<br />"; // If Server Time Zone is not collect, Please uncomment following line and set collect timezone value; // $server_timezone = "+0900"; //This is a sample value for JST+0900 $server_timezone = $server_timezone / 100; $weblog_timezone = $server_timezone + $time_difference; error_reporting(2037); $wp_pop3 = new POP3(); if (!$wp_pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) { echo "Ooops {$wp_pop3->ERROR} <br />\n"; return; } $Count = $wp_pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass')); if ($Count == false) { if (!$wp_pop3->FP) { echo "Oooops Login Failed: {$wp_pop3->ERROR}<br />\n"; } else { echo "No Message<br />\n"; $wp_pop3->quit(); } return; } // ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT! register_shutdown_function('wp_mail_quit'); for ($iCount = 1; $iCount <= $Count; $iCount++) { $MsgOne = $wp_pop3->get($iCount); if (!$MsgOne || gettype($MsgOne) != 'array') { echo "oops, {$wp_pop3->ERROR}<br />\n"; $wp_pop3->quit(); return; } $content = ''; $content_type = ''; $boundary = ''; $att_boundary = ''; $hatt_boundary = ''; $bodysignal = 0; $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); while (list($lineNum, $line) = each($MsgOne)) { if (strlen($line) < 3) { $bodysignal = 1; } if ($bodysignal) { $content .= $line; } else { if (preg_match('/^Content-Type:\\s+(.*?)\\;/i', $line, $match)) { $content_type = $match[1]; $content_type = strtolower($match[1]); } if ($content_type == 'multipart/mixed' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $att_boundary == '') { $att_boundary = trim($match[1]); } if ($content_type == 'multipart/alternative' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $boundary == '') { $boundary = trim($match[1]); } if ($content_type == 'multipart/related' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $hatt_boundary == '') { $hatt_boundary = trim($match[1]); } if (preg_match('/Subject: /', $line)) { $subject = trim($line); $subject = substr($subject, 9, strlen($subject) - 9); if (function_exists('mb_decode_mimeheader')) { $subject1 = mb_decode_mimeheader($subject); if ($subject != $subject) { $sub_charset = mb_internal_encoding(); } else { $sub_charset = "auto"; } $subject = $subject1; } if (get_settings('use_phoneemail')) { $subject = explode(get_settings('phoneemail_separator'), $subject); $subject = trim($subject[0]); } } if (preg_match('/Date: /', $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]; $mail_timezone = trim(ereg_replace("\\([^)]*\\)", "", $date_arr[4])) / 100; // echo "Email TimeZone is {$date_arr[4]}<br />"; $mail_time_difference = $weblog_timezone - $mail_timezone; for ($i = 0; $i < 12; $i++) { if ($ddate_m == $dmonths[$i]) { $ddate_m = $i + 1; } } $ddate_U = mktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y); $ddate_U = $ddate_U + $mai_time_difference * 3600; $post_date = date('Y-m-d H:i:s', $ddate_U); } } } if (!ereg(get_settings('subjectprefix'), $subject)) { continue; } $charset = ""; $ncharset = preg_match("/\\s?charset=\"?([A-Za-z0-9\\-]*)\"?/i", $content, $matches); if ($ncharset) { $charset = $matches[1]; } $ddate_today = time() + $time_difference * 3600; $ddate_difference_days = ($ddate_today - $ddate_U) / 86400; if ($ddate_difference_days > 14) { echo "Too old<br />\n"; continue; } if (preg_match('/' . get_settings('subjectprefix') . '/', $subject)) { $userpassstring = ''; echo "<div style=\"border: 1px dashed #999; padding: 10px; margin: 10px;\">\n"; echo "<p><b>{$iCount}</b></p><p><b>Subject: </b>{$subject}</p>\n"; $subject = trim(str_replace(get_settings('subjectprefix'), '', $subject)); $attachment = false; if ($att_boundary) { $contents = explode('--' . $att_boundary, $content); $content = $contents[1]; $ncharset = preg_match("/\\s?charset=\"?([A-Za-z0-9\\-]*)\"?/i", $content, $matches); if ($ncharset) { $charset = $matches[1]; } $content = explode("\r\n\r\n", $content, 2); $content = $content[1]; } if ($hatt_boundary) { $contents = explode('--' . $hatt_boundary, $content); $content = $contents[1]; if (preg_match('/Content-Type: multipart\\/alternative\\;\\s*boundary\\=(?:")?([^";\\s\\n]*?)(?:")?\\s*(?:;|\\n|$)"/i', $content, $matches)) { $boundary = trim($matches[1]); $content = explode('--' . $boundary, $content); $content = $content[2]; } $ncharset = preg_match("/charset=\"?([^\"]*)\"?/i", $content, $matches); if ($ncharset) { $charset = $matches[1]; } $content = explode('Content-Transfer-Encoding: quoted-printable', $content); $content = strip_tags($content[1], '<img><p><br><i><b><u><em><strong><strike><font><span><div><dl><dt><dd><ol><ul><li>,<table><tr><td>'); } else { if ($boundary) { $content = explode('--' . $boundary, $content); $content = $content[2]; if (preg_match('/Content-Type: multipart\\/related\\;\\s*boundary=(?:")?([^";\\s\\n]*?)(?:")?\\s*(?:;|\\n|$)/i', $content, $matches)) { $hatt_boundary = trim($matches[1]); $contents = explode('--' . $hatt_boundary, $content); $content = $contents[1]; } $ncharset = preg_match("/charset=\"?([^\"]*)\"?/i", $content, $matches); if ($ncharset) { $charset = $matches[1]; } $content = explode('Content-Transfer-Encoding: quoted-printable', $content); $content = strip_tags($content[1], '<img><p><br><i><b><u><em><strong><strike><font><span><div><dl><dt><dd><ol><ul><li>,<table><tr><td>'); } } $content = trim($content); echo "<p><b>Content-type:</b> {$content_type}, <b>boundary:</b> {$boundary}</p>\n"; echo "<p><b>att_boundary:</b> {$att_boundary}, <b>hatt_boundary:</b> {$hatt_boundary}</p>\n"; echo "<p><b>charset:</b>{$charset}, <b>BLOG charset:</b>" . $GLOBALS['blog_charset'] . "</p>\n"; // echo "<p><b>Raw content:</b><br /><pre>".$content.'</pre></p>'; if ($charset == "" || trim(strtoupper($charset)) == "ISO-2022-JP") { $charset = "JIS"; } if (trim(strtoupper($charset)) == "SHIFT_JIS") { $charset = "SJIS"; } $btpos = strpos($content, get_settings('bodyterminator')); if ($btpos) { $content = substr($content, 0, $btpos); } $content = trim($content); $blah = explode("\n", preg_replace("/^[\n\r\\s]*/", "", strip_tags($content))); $firstline = preg_replace("/[\n\r]/", "", $blah[0]); $secondline = $blah[1]; if (get_settings('use_phoneemail')) { echo "<p><b>Use Phone Mail:</b> Yes</p>\n"; $btpos = strpos($firstline, get_settings('phoneemail_separator')); if ($btpos) { $userpassstring = trim(substr($firstline, 0, $btpos)); $content = trim(substr($content, $btpos + strlen(get_settings('phoneemail_separator')), strlen($content))); $btpos = strpos($content, get_settings('phoneemail_separator')); if ($btpos) { $userpassstring = trim(substr($content, 0, $btpos)); $content = trim(substr($content, $btpos + strlen(get_settings('phoneemail_separator')), strlen($content))); } } $contentfirstline = $blah[1]; } else { echo "<p><b>Use Phone Mail:</b> No</p>\n"; $userpassstring = strip_tags($firstline); $contentfirstline = ''; } $flat = 999.0; $flon = 999.0; $secondlineParts = explode(':', strip_tags($secondline)); if (strncmp($secondlineParts[0], "POS", 3) == 0) { echo "Found POS:<br>\n"; // echo "Second parts is:".$secondlineParts[1]; // the second line is the postion listing line $secLineParts = explode(',', $secondlineParts[1]); $flatStr = $secLineParts[0]; $flonStr = $secLineParts[1]; // echo "String are ".$flatStr.$flonStr; $flat = floatval($secLineParts[0]); $flon = floatval($secLineParts[1]); // echo "values are ".$flat." and ".$flon; // ok remove that position... we should not have it in the final output $content = str_replace($secondline, '', $content); } $blah = explode(':', $userpassstring); $user_login = $blah[0]; $user_pass = $blah[1]; $user_login = mb_conv(trim($user_login), $GLOBALS['blog_charset'], $charset); $content = $contentfirstline . str_replace($firstline, '', $content); $content = trim($content); // Please uncomment following line, only if you want to check user and password. // echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>"; echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>"; if (!user_pass_ok($user_login, $user_pass)) { echo "<p><b>Wrong Login.</b></p></div>\n"; continue; } $userdata = get_userdatabylogin($user_login); $user_level = $userdata->user_level; $post_author = $userdata->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'); } echo "Subject : " . mb_conv($subject, $GLOBALS['blog_charset'], $sub_charset) . " <br />\n"; echo "Category : {$post_category} <br />\n"; if (!get_settings('emailtestonly')) { // Attaching Image Files Save if ($att_boundary != "") { $attachment = wp_getattach($contents[2], "user-" . trim($post_author), 1); } if ($boundary != "" && $hatt_boundary != "") { for ($i = 2; $i < count($contents); $i++) { $hattachment = wp_getattach($contents[$i], "user-" . trim($post_author), 0); if ($hattachment) { if (preg_match("/Content-Id: \\<([^\\>]*)>/i", $contents[$i], $matches)) { $content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", wp_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); $content = addslashes(mb_conv(trim($content), $GLOBALS['blog_charset'], $charset)); $post_title = addslashes(trim(mb_conv($post_title, $GLOBALS['blog_charset'], $sub_charset))); // If we find an attachment, add it to the post if ($attachment) { if (isset($img_target) && $img_target) { $img_target = ' target="' . $img_target . '"'; } else { $img_target = ''; } if (file_exists("../attach/thumb-" . $attachment)) { $content = "<a href=\"" . wp_siteurl() . "/attach/" . $attachment . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src = \"" . wp_siteurl() . "/attach/thumb-" . $attachment . "\" alt=\"moblog\" ></a>" . $content . "<br clear=\"left\" />"; } else { $content = "<a href=\"" . wp_siteurl() . "/attach/" . $attachment . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src = \"" . wp_siteurl() . "/attach/" . $attachment . "\" alt=\"moblog\" ></a>" . $content . "<br clear=\"left\" />"; } } $post_name = sanitize_title($post_title); if ($flat > 500) { $sql = "INSERT INTO " . wp_table('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 " . wp_table('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; // update blank postname if ($post_name == "") { $post_name = "post-" . $post_ID; $wpdb->query("UPDATE " . wp_table('posts') . " SET post_name='{$post_name}' WHERE ID = {$post_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 " . wp_table('post2cat') . " WHERE post_id = {$post_ID} AND category_id = {$post_category}"); if (!$exists && $result) { $wpdb->query("\n\t\t\t\t\t\tINSERT INTO " . wp_table('post2cat') . "\n\t\t\t\t\t\t(post_id, category_id)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$post_ID}, {$post_category})\n\t\t\t\t\t\t"); } do_action('publish_post', $post_ID); do_action('publish_phone', $post_ID); pingWeblogs($blog_ID); pingBlogs($blog_ID); pingback($content, $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; }
} if (!test_param('title') && !test_param('url') && !test_param('blog_name')) { // If it doesn't look like a trackback at all... header('Location: ' . get_permalink($_tb_id)); } if (!empty($_tb_id) && !test_param('__mode') && test_param('url')) { @header('Content-Type: text/xml'); if (!get_settings('use_trackback')) { trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.'); } $_title = get_param('title'); $_excerpt = get_param('excerpt'); $_blog_name = get_param('blog_name'); $_charset = get_param('charset'); if ($GLOBALS['wp_debug']) { $_debug_file = wp_base() . '/log/trackback_r.log'; $_fp = fopen($_debug_file, 'a'); fwrite($_fp, "Title(Orig) ={$_title}\n"); fwrite($_fp, "Excerpt(Orig) ={$_excerpt}\n"); fwrite($_fp, "BlogName(Orig) ={$_blog_name}\n"); fwrite($_fp, "CharSet(Orig) ={$_charset}\n\n"); } $postHandler =& wp_handler('Post'); $postObject =& $postHandler->get($_tb_id); if (!$postObject) { trackback_response(1, 'Sorry, no post is exist for this post id.'); } if ($postObject->getVar('ping_status') == 'closed') { trackback_response(1, 'Sorry, trackbacks are closed for this item.'); } if (get_settings('check_trackback_content')) {
function current_wp() { $cur_PATH = $_SERVER['SCRIPT_FILENAME']; if (preg_match('/^' . preg_quote(wp_base() . '/', '/') . '/i', $cur_PATH)) { return true; } else { return false; } }
function current_wp() { $cur_PATH = $_SERVER['SCRIPT_FILENAME']; if (preg_match("/^" . preg_quote(wp_base() . "/", "/") . "/i", $cur_PATH)) { return true; } else { return false; } }
<?php /* Plugin Name: Blacklist Plugin URI: http://www.farook.org Description: Checks each entered comment against a standard blacklist and either approves or holds the comment for later approval or automatically deletes it. Also allows you to work with comments in the moderation queue so that you can harvest information to add to the blacklist while mass-deleting held comments. If it's your first time you can use the <a href="../blacklist-install.php">Blacklist Installer</a> or you can simply go to the <a href="wpblacklist.php">Blacklist Configuration</a> screen. Version: 2.9 Author: Fahim Farook Author URI: http://www.farook.org */ require_once wp_base() . '/wp-includes/wpblfunctions.php'; $tableblacklist = $GLOBALS['xoopsDB']->prefix("wp_blacklist"); /* notifies the moderator of the blog (usually the admin) about deleted comments always returns true */ function wpbl_notify($comment_id, $reason, $harvest) { global $wbbl_comment; $tableposts = wp_table('posts'); $sql = "SELECT * FROM {$tableposts} WHERE ID='{$wbbl_comment['comment_post_ID']}' LIMIT 1"; $post = $GLOBALS['wpdb']->get_row($sql); if (!empty($wpbl_comment['comment_author_IP'])) { $comment_author_domain = gethostbyaddr($wpbl_comment['comment_author_IP']); } else { $comment_author_domain = ''; } // create the e-mail body $notify_message = "A new "; if ($wpbl_comment['comment_type'] == '') { $notify_message .= "Comment";
<?php require_once 'admin.php'; $mode = 'sidebar'; $standalone = 1; $title = ""; require_once 'admin-header.php'; if ($user_level <= 0) { redirect_header(wp_siteurl() . '/wp-admin/', 5, _LANG_P_CHEATING_ERROR); } init_param('GET', 'action', 'string', ''); require_once XOOPS_ROOT_PATH . '/class/template.php'; $wpTpl =& new XoopsTpl(); $wpTpl->error_reporting = error_reporting(); $wpTpl->assign('action', $action); $wpTpl->assign('admin_area_charset', $admin_area_charset); if ($action != 'done') { $category_select = categories_nested_select(array(get_settings('default_post_category'))); $ticket = $xoopsWPTicket->getTicketHtml(__LINE__, 10800); $wpTpl->assign('user_ID', $user_ID); $wpTpl->assign('category_select', $category_select); $wpTpl->assign('ticket', $ticket); } $wpTpl->template_dir = wp_base() . '/wp-admin/templates/'; $wpTpl->display('sidebar.html'); require_once 'admin-footer.php';
function wp_mail_receive() { global $img_target; require_once wp_base() . '/wp-includes/class-pop3.php'; timer_start(); $use_cache = 1; $time_difference = get_settings('time_difference'); error_reporting(2037); $GLOBALS['wp_pop3'] = new POP3(); if (!$GLOBALS['wp_pop3']->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) { echo "Ooops {$GLOBALS['wp_pop3']}->ERROR <br />\n"; return; } $mail_count = $GLOBALS['wp_pop3']->login(get_settings('mailserver_login'), get_settings('mailserver_pass')); if ($mail_count == false) { if (!$GLOBALS['wp_pop3']->FP) { echo "Oooops Login Failed: {$wp_pop3->ERROR}<br />\n"; } else { echo "No Message<br />\n"; $GLOBALS['wp_pop3']->quit(); } return; } // ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT! register_shutdown_function('wp_mail_quit'); for ($mail_num = 1; $mail_num <= $mail_count; $mail_num++) { $MsgOne = $GLOBALS['wp_pop3']->get($mail_num); if (!$MsgOne || gettype($MsgOne) != 'array') { echo "oops, {$GLOBALS['wp_pop3']}->ERROR<br />\n"; $GLOBALS['wp_pop3']->quit(); return; } $content = ''; $content_type = ''; $boundary = ''; $alt_boundary = ''; $emb_boundary = ''; $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); $mailMsg = ''; while (list($lineNum, $line) = each($MsgOne)) { $mailMsg .= $line; } $mailParts = parse_msg($mailMsg); if (!empty($mailParts['header']['date'])) { $ddate = trim($mailParts['header']['date'][0]); if (strpos($ddate, ',')) { $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate))); } $ddate_U = strtotime($ddate) + $time_difference * 3600; $post_date = date('Y-m-d H:i:s', $ddate_U); } if (!empty($mailParts['header']['subject'])) { $subject = trim($mailParts['header']['subject'][0]); if (function_exists('mb_decode_mimeheader')) { $subject1 = mb_decode_mimeheader($subject); if ($subject1 != $subject) { $sub_charset = mb_internal_encoding(); } else { $sub_charset = "auto"; } $subject = $subject1; } if (get_settings('use_phoneemail')) { $subject = explode(get_settings('phoneemail_separator'), $subject); $subject = trim($subject[0]); } } if (!ereg(get_settings('subjectprefix'), $subject)) { continue; } $charset = ""; $ncharset = preg_match("/\\s?charset=\"?([A-Za-z0-9\\-]*)\"?/i", $content, $matches); if ($ncharset) { $charset = $matches[1]; } $ddate_today = time() + $time_difference * 3600; $ddate_difference_days = ($ddate_today - $ddate_U) / 86400; if ($ddate_difference_days > 14) { echo "Too old<br />\n"; continue; } if (preg_match('/' . get_settings('subjectprefix') . '/', $subject)) { $userpassstring = ''; echo "<div style=\"border: 1px dashed #999; padding: 10px; margin: 10px;\">\n"; echo "<p><b>{$mail_num}</b></p><p><b>Subject: </b>{$subject}</p>\n"; $subject = trim(str_replace(get_settings('subjectprefix'), '', $subject)); $attaches = array(); if ($mailParts['type'] == 'multipart') { if ($mailParts['subtype'] == 'mixed') { for ($i = 1; $i < count($mailParts['body']); $i++) { $attaches[] = array('type' => 'mix', 'body' => $mailParts['body'][$i]); } if (!is_array($mailParts['body'][0]['body'])) { $content = $mailParts['body'][0]['body']; $charset = $mailParts['body'][0]['charset']; $encoding = $mailParts['body'][0]['encodings']; $content = convert_content($content, $charest, $encoding); } else { $mailParts = $mailParts['body'][0]; } } if ($mailParts['type'] == 'multipart' && $mailParts['subtype'] == 'related') { if ($mailParts['body'][0]['type'] == 'multipart' && $mailParts['body'][0]['subtype'] == 'alternative') { $content = $mailParts['body'][0]['body'][1]['body']; $charset = $mailParts['body'][0]['body'][1]['charset']; $encoding = $mailParts['body'][0]['body'][1]['encodings']; $content = convert_content($content, $charest, $encoding); } else { $content = $mailParts['body'][0]['body']; $charset = $mailParts['body'][0]['charset']; $encoding = $mailParts['body'][0]['encodings']; $content = convert_content($content, $charest, $encoding); } $content = preg_replace('/(\\<.*?\\>)/es', 'str_replace(array("\\n","\\r"), array(" ", " "), "\\1")', $content); $content = preg_replace('/\\<head\\>.*\\<\\/head\\>/is', '', $content); $content = preg_replace('/(\\<body\\s*[^\\>]*\\>)\\s*\\<br\\s*\\/*\\>\\s*/is', '\\1', $content); $content = strip_tags($content, '<img><p><br><i><b><u><em><strong><strike><font><span><div><dl><dt><dd><ol><ul><li>,<table><tr><td><category><title>'); $content = preg_replace('!(</div>|</p>)([^\\r\\n])!i', "\\1\n\\2", $content); for ($i = 1; $i < count($mailParts['body']); $i++) { $attaches[] = array('type' => 'relate', 'body' => $mailParts['body'][$i], 'id' => preg_replace('/<(.*)>/', '$1', $mailParts['body'][$i]['header']['content-id'][0])); } } if ($mailParts['type'] == 'multipart' && $mailParts['subtype'] == 'alternative') { if ($mailParts['body'][1]['type'] == 'multipart' && $mailParts['body'][1]['subtype'] == 'related') { $content = $mailParts['body'][1]['body'][0]['body']; $charset = $mailParts['body'][1]['body'][0]['charset']; $encoding = $mailParts['body'][1]['body'][0]['encodings']; $content = convert_content($content, $charest, $encoding); for ($i = 1; $i < count($mailParts['body'][1]['body']); $i++) { $attaches[] = array('type' => 'relate', 'body' => $mailParts['body'][1]['body'][$i], 'id' => preg_replace('/<(.*)>/', '$1', $mailParts['body'][1]['body'][$i]['header']['content-id'][0])); } } else { $content = $mailParts['body'][1]['body']; $charset = $mailParts['body'][1]['charset']; $encoding = $mailParts['body'][1]['encodings']; $content = convert_content($content, $charest, $encoding); } $content = preg_replace('/(\\<[^\\>]*\\>)/es', 'str_replace(array("\\n","\\r"), array(" ", " "), "\\1")', $content); $content = preg_replace('/\\<head\\>.*\\<\\/head\\>/is', '', $content); $content = preg_replace('/(\\<body\\s*[^\\>]*\\>)\\s*\\<br\\s*\\/*\\>\\s*/is', '\\1', $content); $content = strip_tags($content, '<img><p><br><i><b><u><em><strong><strike><font><span><div><dl><dt><dd><ol><ul><li>,<table><tr><td><category><title>'); $content = preg_replace('!(</div>|</p>)([^\\r\\n])!i', "\\1\n\\2", $content); } } else { $content = $mailParts['body']; $charset = $mailParts['charset']; $encoding = $mailParts['encodings']; $content = convert_content($content, $charest, $encoding); } $content = trim($content); echo "<p><b>Content-type:</b> {$content_type}, <b>boundary:</b> {$boundary}</p>\n"; echo "<p><b>alt_boundary:</b> {$alt_boundary}, <b>emb_boundary:</b> {$emb_boundary}</p>\n"; echo "<p><b>charset:</b>{$charset}, <b>BLOG charset:</b>" . $GLOBALS['blog_charset'] . "</p>\n"; // echo "<p><b>Raw content:</b><br /><pre>".$content.'</pre></p>'; if ($charset == "" || trim(strtoupper($charset)) == "ISO-2022-JP") { $charset = "JIS"; } if (trim(strtoupper($charset)) == "SHIFT_JIS") { $charset = "SJIS"; } $btpos = strpos($content, get_settings('bodyterminator')); if ($btpos) { $content = substr($content, 0, $btpos); } $content = trim($content); $blah = explode("\n", preg_replace("/^[\n\r\\s]*/", "", strip_tags($content))); $firstline = preg_replace("/[\n\r]/", "", $blah[0]); $secondline = $blah[1]; if (get_settings('use_phoneemail')) { echo "<p><b>Use Phone Mail:</b> Yes</p>\n"; $btpos = strpos($firstline, get_settings('phoneemail_separator')); if ($btpos) { $userpassstring = trim(substr($firstline, 0, $btpos)); $content = trim(substr($content, $btpos + strlen(get_settings('phoneemail_separator')), strlen($content))); $btpos = strpos($content, get_settings('phoneemail_separator')); if ($btpos) { $userpassstring = trim(substr($content, 0, $btpos)); $content = trim(substr($content, $btpos + strlen(get_settings('phoneemail_separator')), strlen($content))); } } $contentfirstline = $blah[1]; } else { echo "<p><b>Use Phone Mail:</b> No</p>\n"; $userpassstring = strip_tags($firstline); $contentfirstline = ''; } $flat = 999.0; $flon = 999.0; $secondlineParts = explode(':', strip_tags($secondline)); if (strncmp($secondlineParts[0], "POS", 3) == 0) { echo "Found POS:<br />\n"; // echo "Second parts is:".$secondlineParts[1]; // the second line is the postion listing line $secLineParts = explode(',', $secondlineParts[1]); $flatStr = $secLineParts[0]; $flonStr = $secLineParts[1]; // echo "String are ".$flatStr.$flonStr; $flat = floatval($secLineParts[0]); $flon = floatval($secLineParts[1]); // echo "values are ".$flat." and ".$flon; // ok remove that position... we should not have it in the final output $content = str_replace($secondline, '', $content); } $blah = explode(':', $userpassstring); $user_login = trim($blah[0]); $user_pass = $blah[1]; $content = $contentfirstline . str_replace($firstline, '', $content); $content = trim($content); // Please uncomment following line, only if you want to check user and password. // echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>"; echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>"; if (!user_pass_ok($user_login, $user_pass)) { echo "<p><b>Error: Wrong Login.</b></p></div>\n"; continue; } $userdata = get_userdatabylogin($user_login); $user_level = $userdata->user_level; $post_author = $userdata->ID; if ($user_level > 0) { $post_title = xmlrpc_getposttitle($content); if ($post_title == '') { $post_title = $subject; } echo "Subject : " . mb_conv($post_title, $GLOBALS['blog_charset'], $sub_charset) . " <br />\n"; $post_category = get_settings('default_category'); if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) { $post_category = xmlrpc_getpostcategory($content); $content = xmlrpc_removepostdata($content); } if (empty($post_category)) { $post_category = get_settings('default_post_category'); } echo "Category : {$post_category} <br />\n"; $post_category = explode(',', $post_category); if (!get_settings('emailtestonly')) { $content = preg_replace('|\\n([^\\n])|', " \$1", trim($content)); $content_before = ""; $content_after = ""; for ($i = 0; $i < count($attaches); $i++) { $create_thumbs = $attaches[$i]['type'] == 'mix' ? 1 : 0; list($file_name, $is_img, $orig_name) = wp_getattach($attaches[$i]['body'], "user-" . trim($post_author), $create_thumbs); if ($file_name) { if ($attaches[$i]['type'] == 'relate') { $content = preg_replace("/cid:" . preg_quote($attaches[$i]['id']) . "/", get_settings('fileupload_url') . '/' . $file_name, $content); } else { if (isset($img_target) && $img_target) { $img_target = ' target="' . $img_target . '"'; } else { $img_target = ''; } if ($is_img) { if (file_exists(get_settings('fileupload_realpath') . "/thumb-" . $file_name)) { $content_before .= "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($file_name) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src=\"" . get_settings('fileupload_url') . '/thumb-' . rawurlencode($file_name) . "\" alt=\"" . $orig_name . "\" title=\"" . $orig_name . "\" /></a>"; } else { $content_before .= "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($file_name) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src=\"" . get_settings('fileupload_url') . '/' . rawurlencode($file_name) . "\" alt=\"" . $orig_name . "\" title=\"" . $orig_name . "\" /></a>"; } } else { $content_after .= "<a href=\"" . wp_siteurl() . "/wp-download.php?from=" . rawurlencode($file_name) . "&fname=" . urlencode($orig_name) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src=\"" . wp_siteurl() . "/wp-images/file.gif\" alt=\"" . $orig_name . "\" title=\"" . $orig_name . "\" />" . $orig_name . "</a>"; } } } } $content = $content_before . $content . "<br clear=\"left\" />" . $content_after; $postHandler =& wp_handler('Post'); $postObject =& $postHandler->create(); $postObject->setVar('post_content', $content, true); $postObject->setVar('post_title', trim(mb_conv($post_title, $GLOBALS['blog_charset'], $sub_charset)), true); $postObject->setVar('post_date', $post_date, true); $postObject->setVar('post_author', $post_author, true); $postObject->setVar('post_category', $post_category[0], true); $postObject->setVar('post_name', sanitize_title($post_title), true); if ($flat < 500) { $postObject->setVar('post_lat', $flat, true); $postObject->setVar('post_lon', $flon, true); } $postObject->setVar('post_status', get_settings('default_post_status'), true); $postObject->setVar('ping_status', get_settings('default_ping_status'), true); $postObject->setVar('comment_status', get_settings('default_comment_status'), true); if (!$postHandler->insert($postObject, true)) { echo "<b>Error: Insert New Post</b><br />"; } $post_ID = $postObject->getVar('ID'); echo "Post ID = {$post_ID}<br />\n"; $postObject->assignCategories($post_category, true); do_action('publish_post', $post_ID); do_action('publish_phone', $post_ID); if ($flat < 500) { pingGeoUrl($post_ID); } $blog_ID = 1; pingWeblogs($blog_ID); pingback($content, $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 (!$GLOBALS['wp_pop3']->delete($mail_num)) { echo "<p>Oops " . $GLOBALS['wp_pop3']->ERROR . "</p></div>\n"; $GLOBALS['wp_pop3']->reset(); return; } else { echo "<p>Mission complete, message <strong>{$mail_num}</strong> deleted.</p>\n"; } } else { echo "<p><strong>Level 0 users can\\'t post.</strong></p>\n"; } echo "</div>\n"; } } $GLOBALS['wp_pop3']->quit(); timer_stop($GLOBALS['wp_mail_debug']); return; }