当前位置: 首页>>代码示例>>PHP>>正文


PHP pingWeblogs函数代码示例

本文整理汇总了PHP中pingWeblogs函数的典型用法代码示例。如果您正苦于以下问题:PHP pingWeblogs函数的具体用法?PHP pingWeblogs怎么用?PHP pingWeblogs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pingWeblogs函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_mail_receive


//.........这里部分代码省略.........
            $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('mb_convert_encoding')) {
                    echo "Subject : " . 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('mb_convert_encoding')) {
                        $content = addslashes(mb_convert_encoding(trim($content), $blog_charset, $charset));
                        $post_title = addslashes(trim(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[$wp_id]} (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[$wp_id]} (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[$wp_id]} WHERE post_id = {$post_ID} AND category_id = {$post_category}");
                    if (!$exists && $result) {
                        $wpdb->query("\n\t\t\t\t\t\tINSERT INTO {$wpdb->post2cat[$wp_id]}\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");
                    }
                    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;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例2: VALUES

         $sql = "INSERT INTO {$tableposts} (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 "The result is: " . $result;
     if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
         sleep($sleep_after_edit);
     }
     $blog_ID = 1;
     if ($flat < 500) {
         pingGeoUrl($post_ID);
     }
     // HACK HACK HACK this next line is commented out because I don't know what the word-press replacement
     // is.  right now it's undefined and does not work
     //rss_update($blog_ID);
     pingWeblogs($blog_ID);
     //				pingCafelog($cafelogID, $post_title, $post_ID);
     pingBlogs($blog_ID);
     pingback($content, $post_ID);
     #delete successful email, mark for deletion actually
     if ($result > 0) {
         imap_delete($mbox, $iCount);
         echo "deleted successfully";
     } else {
         die("error deleting message");
     }
 }
 echo "\n<p><b>Posted title:</b> {$post_title}<br />";
 echo "\n<b>Posted content:</b><br /><pre>" . $content . '</pre></p>';
 # Added to make category work
 #
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-moblog.php

示例3: mweditpost

function mweditpost($params)
{
    // ($postid, $user, $pass, $content, $publish)
    global $xmlrpcerruser;
    $xpostid = $params->getParam(0);
    $xuser = $params->getParam(1);
    $xpass = $params->getParam(2);
    $xcontent = $params->getParam(3);
    $xpublish = $params->getParam(4);
    $ID = $xpostid->scalarval();
    $username = $xuser->scalarval();
    $password = $xpass->scalarval();
    $contentstruct = xmlrpc_decode1($xcontent);
    $postdata = wp_get_single_post($ID);
    if (!$postdata) {
        return new xmlrpcresp(0, $xmlrpcerruser + 2, "No such post {$ID}.");
    }
    $userdata = get_userdatabylogin($username);
    $user_ID = $userdata->ID;
    $user_level = $userdata->user_level;
    $post_author_ID = $postdata->post_author;
    $post_authordata = get_userdata($post_author_ID);
    if ($user_ID != $post_author_ID && $user_level <= $post_authordata->user_level) {
        return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, you do not have the right to edit this post.");
    }
    // Check login
    if (user_pass_ok($username, $password)) {
        if ($user_level < 1) {
            return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, level 0 users cannot edit posts");
        }
        extract($postdata);
        $post_title = $contentstruct['title'];
        $post_content = format_to_post($contentstruct['description']);
        $catnames = $contentstruct['categories'];
        logIO("O", "Cat Count" . count($catnames));
        foreach ($catnames as $cat) {
            $post_category[] = get_cat_ID($cat);
        }
        $post_excerpt = $contentstruct['mt_excerpt'];
        $post_more = $contentstruct['mt_text_more'];
        $post_status = $xpublish->scalarval() ? 'publish' : 'draft';
        if ($post_more) {
            $post_content = $post_content . "\n<!--more-->\n" . $post_more;
        }
        $comment_status = 1 == $contentstruct['mt_allow_comments'] ? 'open' : 'closed';
        $ping_status = $contentstruct['mt_allow_pings'] ? 'open' : 'closed';
        $time_difference = get_settings("time_difference");
        $dateCreated = $contentstruct['dateCreated'];
        $dateCreated = $dateCreated ? iso8601_decode($contentstruct['dateCreated']) : time() + $time_difference * 3600;
        $post_date = date("Y-m-d H:i:s", $dateCreated);
        // We've got all the data -- post it:
        $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date');
        $newpost_ID = wp_update_post($newpost);
        if (!$newpost_ID) {
            return new xmlrpcresp(0, $xmlrpcerruser + 2, "For some strange yet very annoying reason, your entry could not be posted.");
        }
        if (!isset($blog_ID)) {
            $blog_ID = 1;
        }
        if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
            sleep($sleep_after_edit);
        }
        pingWeblogs($blog_ID);
        pingCafelog($cafelogID, $post_title, $post_ID);
        pingBlogs($blog_ID);
        pingback($content, $post_ID);
        trackback_url_list($content_struct['mt_tb_ping_urls'], $post_ID);
        logIO("O", "(MW) Edited ! ID: {$post_ID}");
        $myResp = new xmlrpcval($ID, "string");
        return new xmlrpcresp($myResp);
    } else {
        logIO("O", "(MW) Wrong username/password combination <b>{$username} / {$password}</b>");
        return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:75,代码来源:xmlrpc.php

示例4: wp_mail_receive


//.........这里部分代码省略.........
            $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, $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);
                }
                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')) {
                    // 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]) . ")/", get_settings('fileupload_url') . '/' . $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 = mb_conv(trim($content), $blog_charset, $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(get_settings('fileupload_realpath') . "/thumb-" . $attachment)) {
                            $content = "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($attachment) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src = \"" . get_settings('fileupload_url') . '/thumb-' . rawurlencode($attachment) . "\" alt=\"" . $attachment . "\" title=\"" . $attachment . "\" /></a>" . $content . "<br clear=\"left\" />";
                        } else {
                            $content = "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($attachment) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src = \"" . get_settings('fileupload_url') . '/' . rawurlencode($attachment) . "\" alt=\"" . $attachment . "\" title=\"" . $attachment . "\" /></a>" . $content . "<br clear=\"left\" />";
                        }
                    }
                    $postHandler =& wp_handler('Post');
                    $postObject =& $postHandler->create();
                    $postObject->setVar('post_content', $content);
                    $postObject->setVar('post_title', trim(mb_conv($post_title, $blog_charset, $sub_charset)));
                    $postObject->setVar('post_date', $post_date);
                    $postObject->setVar('post_author', $post_author);
                    $postObject->setVar('post_category', $post_category[0]);
                    $postObject->setVar('post_name', sanitize_title($post_title));
                    if ($flat < 500) {
                        $postObject->setVar('post_lat', $flat);
                        $postObject->setVar('post_lon', $flon);
                    }
                    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);
                    do_action('publish_post', $post_ID);
                    do_action('publish_phone', $post_ID);
                    if ($flat < 500) {
                        pingGeoUrl($post_ID);
                    }
                    $blog_ID = 1;
                    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($mail_num)) {
                    echo "<p>Oops " . $wp_pop3->ERROR . "</p></div>\n";
                    $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";
        }
    }
    $wp_pop3->quit();
    timer_stop($output_debugging_info);
    return;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例5: mweditpost

function mweditpost($params)
{
    // ($postid, $user, $pass, $content, $publish)
    $xpostid = $params->getParam(0);
    $xuser = $params->getParam(1);
    $xpass = $params->getParam(2);
    $xcontent = $params->getParam(3);
    $xpublish = $params->getParam(4);
    $ID = intval($xpostid->scalarval());
    $username = $xuser->scalarval();
    $password = $xpass->scalarval();
    $contentstruct = php_xmlrpc_decode($xcontent);
    $postarr['post_status'] = $xpublish->scalarval() ? 'publish' : 'draft';
    // Check login
    if (user_pass_ok($username, $password)) {
        $postdata = wp_get_single_post($ID, ARRAY_A);
        if (!$postdata) {
            return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 2, "No such post '{$ID}'.");
        }
        $userdata = get_userdatabylogin($username);
        if ($userdata->user_level < 1) {
            return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 1, 'Sorry, level 0 users can not edit posts');
        }
        if ($userdata->ID != $postdata['post_author'] && $userdata->user_level != 10) {
            $authordata = get_userdata($postdata['post_author']);
            if ($userdata->user_level <= $authordata->user_level) {
                return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 1, 'Sorry, you do not have the right to edit this post');
            }
        }
        $postarr['ID'] = $ID;
        if (array_key_exists('title', $contentstruct)) {
            $postarr['post_title'] = $contentstruct['title'];
            logIO('O', $contentstruct['title']);
        }
        if (array_key_exists('description', $contentstruct)) {
            $postarr['post_content'] = format_to_post($contentstruct['description']);
            logIO('O', $contentstruct['description']);
        }
        if (array_key_exists('mt_excerpt', $contentstruct)) {
            $postarr['post_excerpt'] = $contentstruct['mt_excerpt'];
        }
        if (array_key_exists('mt_text_more', $contentstruct)) {
            if (trim(format_to_post($contentstruct['mt_text_more']))) {
                $postarr['post_content'] .= "\n<!--more-->\n" . format_to_post($contentstruct['mt_text_more']);
            }
        }
        if (array_key_exists('mt_allow_comments', $contentstruct)) {
            $postarr['comment_status'] = $contentstruct['mt_allow_comments'] ? 'open' : 'closed';
        }
        if (array_key_exists('mt_allow_pings', $contentstruct)) {
            $postarr['ping_status'] = $contentstruct['mt_allow_pings'] ? 'open' : 'closed';
        }
        if (!empty($contentstruct['dateCreated'])) {
            $dateCreated = preg_split('/([+\\-Z])/', $contentstruct['dateCreated'], -1, PREG_SPLIT_DELIM_CAPTURE);
            if (count($dateCreated) == 3) {
                $dateCreated[2] = str_replace(':', '', $dateCreated[2]);
            }
            if ($dateCreated[1] == '+') {
                $dateoffset = intval($dateCreated[2]) * 36;
            } else {
                if ($dateCreated[1] == '-') {
                    $dateoffset = -intval($dateCreated[2]) * 36;
                } else {
                    $dateoffset = 0;
                }
            }
            $dateCreated = iso8601_decode($dateCreated[0], 1) - $dateoffset + get_settings('time_difference') * 3600;
        } else {
            $dateCreated = current_time('timestamp', 0);
        }
        $postarr['post_date'] = date('Y-m-d H:i:s', $dateCreated);
        $postarr['post_category'] = array();
        if (array_key_exists('categories', $contentstruct) && is_array($contentstruct['categories'])) {
            foreach ($contentstruct['categories'] as $cat) {
                $postarr['post_category'][] = get_cat_ID(mb_conv($cat), 'EUC-JP', 'auto');
            }
        } else {
            $postarr['post_category'][] = $GLOBALS['post_default_category'];
        }
        $post_ID = wp_update_post($postarr);
        if (!$post_ID) {
            return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 2, 'For some strange yet very annoying reason, your entry could not be posted.');
        }
        if (empty($GLOBALS['blog_ID'])) {
            $GLOBALS['blog_ID'] = 1;
        }
        pingWeblogs($GLOBALS['blog_ID']);
        pingback($postarr['post_content'], $post_ID);
        if (array_key_exists('mt_tb_ping_urls', $contentstruct)) {
            trackback_url_list($content_struct['mt_tb_ping_urls'], $post_ID);
        }
        logIO('O', "(MW) Edited ! ID: {$post_ID}");
        $myResp = new xmlrpcval(true, 'boolean');
        return new xmlrpcresp($myResp);
    } else {
        logIO('O', "(MW) Wrong username/password combination <b>{$username} / {$password}</b>");
        return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
    }
}
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:99,代码来源:xmlrpc.php

示例6: elseif

     $location = $_SERVER['HTTP_REFERER'] . '&message=2#postcustom';
 } elseif (!empty($deletemeta)) {
     $location = $_SERVER['HTTP_REFERER'] . '&message=3#postcustom';
 } elseif (!empty($referredby)) {
     $location = $referredby;
 } else {
     $location = 'post.php';
 }
 header('Location: ' . $location);
 $postObject->assignCategories($post_category);
 // are we going from draft/private to published?
 if (($prev_status == 'draft' || $prev_status == 'private') && $post_status == 'publish') {
     if (get_settings('use_geo_positions') && $post_latf != null && $post_lonf != null) {
         pingGeoUrl();
     }
     pingWeblogs();
     pingBlogs();
 }
 // end if moving from draft/private to published
 if ($post_status == 'publish') {
     if ($post_pingback) {
         pingback($postObject->getVar('post_content', 'e'), $post_ID);
     }
     do_action('publish_post', $post_ID);
     do_trackback($postObject, $useutf8);
 }
 // Meta Stuff
 if ($meta) {
     foreach ($meta as $key => $value) {
         update_meta($key, $value['key'], $value['value']);
     }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:post.php

示例7: wp_mail_receive


//.........这里部分代码省略.........
                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) . "&amp;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;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例8: foreach

echo "<p>Now sending update-pings. This might take a while, so please be patient.<br />";
foreach ($ping_weblogs as $ping_weblog) {
    echo "<hr size='1' noshade='noshade' />";
    $ping_weblog = weblog_from_para($ping_weblog);
    $title = $Weblogs[$ping_weblog]['name'];
    $Current_weblog = $ping_weblog;
    $file = $Weblogs[$ping_weblog]['front_filename'];
    $logpath = $Weblogs[$ping_weblog]['front_path'];
    if (siteurl_isset()) {
        $url = $Weblogs[$ping_weblog]['siteurl'];
    } else {
        $url = $Paths['pivot_url'] . $logpath . $file;
        $url = gethost() . fixpath($url);
    }
    $url = str_replace("/index.php", "/", $url);
    $url = str_replace("/index.html", "/", $url);
    $servers = explode("\n", $Cfg['ping_urls']);
    echo "<p>url: {$url}<br /></p>";
    flush();
    foreach ($servers as $server) {
        $server = trim($server);
        if (strlen($server) > 3) {
            pingWeblogs($title, $url, $server);
            flush();
        }
    }
}
echo "<p><br /><b><a href='#' onclick='self.close();'>done</a></b></p>";
?>
</body></html>
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:30,代码来源:ping.php

示例9: bloggerdeletepost

function bloggerdeletepost($m)
{
    global $xmlrpcerruser;
    // import user errcode value
    global $blog_ID, $cache_userdata, $tableposts, $use_rss, $use_weblogsping, $post_autobr;
    global $post_default_title, $post_default_category, $sleep_after_edit;
    $err = "";
    dbconnect();
    $post_ID = $m->getParam(1);
    $username = $m->getParam(2);
    $password = $m->getParam(3);
    $newcontent = $m->getParam(4);
    $post_ID = $post_ID->scalarval();
    $username = $username->scalarval();
    $password = $password->scalarval();
    $newcontent = $newcontent->scalarval();
    $sql = "SELECT * FROM {$tableposts} WHERE ID = '{$post_ID}'";
    $result = @mysql_query($sql);
    if (!$result) {
        return new xmlrpcresp(0, $xmlrpcerruser + 2, "No such post.");
    }
    $userdata = get_userdatabylogin($username);
    $user_ID = $userdata["ID"];
    $user_level = $userdata["user_level"];
    $postdata = get_postdata($post_ID);
    $post_authordata = get_userdata($postdata["Author_ID"]);
    $post_author_ID = $postdata["Author_ID"];
    if ($user_ID != $post_author_ID && $user_level <= $post_authordata["user_level"]) {
        return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, you do not have the right to delete this post");
    }
    if (user_pass_ok($username, $password)) {
        if ($user_level < 1) {
            return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, level 0 users can not delete posts");
        }
        $sql = "DELETE FROM {$tableposts} WHERE ID = '{$post_ID}'";
        $result = mysql_query($sql);
        if (!$result) {
            return new xmlrpcresp(0, $xmlrpcerruser + 2, "For some strange yet very annoying reason, the entry couldn't be deleted.");
        }
        if (!isset($blog_ID)) {
            $blog_ID = 1;
        }
        if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
            sleep($sleep_after_edit);
        }
        rss_update($blog_ID);
        pingWeblogs($blog_ID);
        return new xmlrpcresp(new xmlrpcval(1));
    } else {
        return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
    }
}
开发者ID:ericandrewlewis,项目名称:b2,代码行数:52,代码来源:xmlrpc.php


注:本文中的pingWeblogs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。