function _b_wp_archives_monthly_show($options, $wp_num = '')
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     $tpl_file = empty($options[2]) ? 'wp_archives_monthly.html' : $options[2];
     $sel_value = '';
     if (current_wp()) {
         if (!empty($_SERVER['PATH_INFO'])) {
             permlink_to_param();
         }
         init_param('GET', 'm', 'string', '');
         init_param('GET', 'year', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         init_param('GET', 'day', 'integer', '');
         if (strlen(get_param('m')) == 6) {
             $sel_value = get_param('m');
         } else {
             if (test_param('year') && test_param('monthnum') && !test_param('day')) {
                 $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2);
             }
         }
     }
     $block['wp_num'] = $wp_num;
     $block['divid'] = 'wpArchive' . $wp_num;
     $block['siteurl'] = wp_siteurl();
     $block['style'] = block_style_get(false);
     $block['block_style'] = $block_style;
     $block['with_count'] = $with_count;
     $now = current_time('mysql');
     $postHandler =& wp_handler('Post');
     $criteria =& new CriteriaCompo(new Criteria('post_date', $now, '<'));
     $criteria->add(new Criteria('post_status', 'publish'));
     $criteria->setSort('post_date');
     $criteria->setOrder('DESC');
     $criteria->setGroupby('YEAR(post_date), MONTH(post_date)');
     $postObjects =& $postHandler->getObjects($criteria, false, 'DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts');
     $block['records'] = array();
     if ($postObjects) {
         foreach ($postObjects as $postObject) {
             $this_year = $postObject->getExtraVar('year');
             $this_month = $postObject->getExtraVar('month');
             $_record['url'] = get_month_link($this_year, $this_month);
             $_record['text'] = format_month($this_year, $GLOBALS['month'][zeroise($this_month, 2)]);
             if ($with_count) {
                 $_record['count'] = '&nbsp;(' . $postObject->getExtraVar('posts') . ')';
             } else {
                 $_record['count'] = '';
             }
             $_record['select'] = $sel_value == $this_year . zeroise($this_month, 2) ? 'selected="selected"' : '';
             $block['records'][] = $_record;
         }
     }
     $_wpTpl =& new WordPresTpl('theme');
     $_wpTpl->assign('block', $block);
     if (!$_wpTpl->tpl_exists($tpl_file)) {
         $tpl_file = 'wp_archives_monthly.html';
     }
     $block['content'] = $_wpTpl->fetch($tpl_file);
     return $block;
 }
 function _b_wp_calendar_show($option, $wp_num = "")
 {
     if (current_wp()) {
         if (!empty($_SERVER['PATH_INFO'])) {
             permlink_to_param();
         }
         init_param('GET', 'p', 'integer', '');
         init_param('GET', 'm', 'integer', '');
         init_param('GET', 'w', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         init_param('GET', 'year', 'integer', '');
         if (test_param('p') && !(test_param('m') || test_param('monthnum') || test_param('w'))) {
             $postHandler =& wp_handler('Post');
             $postObject =& $postHandler->get(get_param('p'));
             if ($postObject) {
                 $GLOBALS['m'] = mysql2date('Ym', $postObject->getVar('post_date'));
             }
         }
     }
     $block['wp_num'] = $wp_num;
     $block['divid'] = 'wpCalendar' . $wp_num;
     $block['style'] = block_style_get(false);
     $block['calendar'] = get_calendar(1, false);
     $_wpTpl =& new WordPresTpl('theme');
     $_wpTpl->assign('block', $block);
     $block['content'] = $_wpTpl->fetch('wp_calendar.html');
     return $block;
 }
 function b_wp_archives_monthly_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     $id = 1;
     $GLOBALS['use_cache'] = 1;
     if ($wp_num == "") {
         $GLOBALS['wp_id'] = $wp_num;
         $GLOBALS['wp_inblock'] = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $GLOBALS['wp_inblock'] = 0;
     }
     $sel_value = '';
     if (current_wp()) {
         init_param('GET', 'm', 'string', '');
         init_param('GET', 'year', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         if (strlen(get_param('m')) == 6) {
             $sel_value = get_param('m');
         } else {
             if (test_param('year') && test_param('monthnum')) {
                 $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2);
             }
         }
     }
     ob_start();
     block_style_get($wp_num);
     if ($block_style == 0) {
         // Simple Listing
         echo "<ul class='wpBlockList'>\n";
         get_archives('monthly', '', 'html', '', '', $with_count);
         echo "</ul>\n";
     } else {
         // Dropdown Listing
         echo '<form name="archiveform' . $wp_num . '" id="archiveform' . $wp_num . '" action="#">';
         echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> ';
         echo '<option value="">' . _WP_BY_MONTHLY . '</option>';
         get_archives('monthly', '', 'option', '', '', $with_count, $sel_value);
         echo '</select>';
         echo '</form>';
     }
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
 function _b_wp_archives_monthly_show($options, $wp_num = '')
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     $sel_value = '';
     if (current_wp()) {
         if (!empty($_SERVER['PATH_INFO'])) {
             permlink_to_param();
         }
         init_param('GET', 'm', 'string', '');
         init_param('GET', 'year', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         if (strlen(get_param('m')) == 6) {
             $sel_value = get_param('m');
         } else {
             if (test_param('year') && test_param('monthnum')) {
                 $sel_value = get_param('year') . zeroise(get_param('monthnum'), 2);
             }
         }
     }
     ob_start();
     block_style_get($wp_num);
     if ($block_style == 0) {
         // Simple Listing
         echo '<ul class="wpBlockList">' . "\n";
         get_archives('monthly', '', 'html', '', '', $with_count);
         echo '</ul>' . "\n";
     } else {
         // Dropdown Listing
         echo '<form name="archiveform' . $wp_num . '" id="archiveform' . $wp_num . '" action="#">';
         echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> ';
         echo '<option value="' . wp_siteurl() . '">' . _WP_BY_MONTHLY . '</option>';
         get_archives('monthly', '', 'option', '', '', $with_count, $sel_value);
         echo '</select>';
         echo '</form>';
     }
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
 function _b_wp_calendar_show($option, $wp_num = "")
 {
     if (current_wp()) {
         if (!empty($_SERVER['PATH_INFO'])) {
             permlink_to_param();
         }
         init_param('GET', 'p', 'integer', '');
         init_param('GET', 'm', 'integer', '');
         init_param('GET', 'w', 'integer', '');
         init_param('GET', 'monthnum', 'integer', '');
         init_param('GET', 'year', 'integer', '');
         if (test_param('p') && !(test_param('m') || test_param('monthnum') || test_param('w'))) {
             $postHandler =& wp_handler('Post');
             $postObject =& $postHandler->get(get_param('p'));
             $GLOBALS['m'] = mysql2date('Ym', $postObject->getVar('post_date'));
         }
     }
     ob_start();
     block_style_get();
     get_calendar(1);
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
Пример #6
0
    } else {
        return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
    }
}
/**** /Blogger API ****/
/**** metaWeblog API ****/
/**********************
 *
 * metaWeblog API extensions
 * added by 
 *	Dougal Campbell <*****@*****.**> 
 *	http://dougal.gunters.org/
 *
 **********************/
#Temporally fix for kousagi
if (test_param(kousagi)) {
    $mwnewpost_sig = array(array($xmlrpcString, $xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcStruct, $xmlrpcBoolean));
} else {
    $mwnewpost_sig = array(array($xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcStruct, $xmlrpcBoolean));
}
$mwnewpost_doc = 'Add a post, MetaWeblog API-style';
function mwnewpost($params)
{
    global $blog_ID;
    $xblogid = $params->getParam(0);
    $xuser = $params->getParam(1);
    $xpass = $params->getParam(2);
    $xcontent = $params->getParam(3);
    $xpublish = $params->getParam(4);
    $blogid = $xblogid->scalarval();
    $username = $xuser->scalarval();
Пример #7
0
        the_author_ID();
        ?>
)"><?php 
        the_author_nickname();
        ?>
</a>)</cite>, in <strong><?php 
        the_category();
        ?>
</strong><br />
	<?php 
        the_content();
        ?>
</p>
<?php 
        // comments
        if (test_param('withcomments') or test_param('c')) {
            $comments = $wpdb->get_results("SELECT * FROM " . wp_table('comments') . " WHERE comment_post_ID = {$wp_post_id} ORDER BY comment_date");
            if ($comments) {
                ?>
 
<h3><?php 
                echo _LANG_E_TITLE_COMMENTS;
                ?>
</h3>
	<ol id="comments">
<?php 
                foreach ($comments as $comment) {
                    ?>
 
	<!-- comment -->
		<li>
        // Change from flat structure to hierarchical:
        $GLOBALS['post_meta_cache'][wp_id()] = array();
        foreach ($meta_list as $metarow) {
            $mpid = $metarow['post_id'];
            $mkey = $metarow['meta_key'];
            $mval = $metarow['meta_value'];
            // Force subkeys to be array type:
            if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid])) {
                $GLOBALS['post_meta_cache'][wp_id()][$mpid] = array();
            }
            if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"])) {
                $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"] = array();
            }
            // Add a value to the current pid/key:
            $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"][] = $mval;
        }
    }
}
if (preg_match('#/modules/' . wp_mod() . '(/|/index.php.*)?$#', $_SERVER['PHP_SELF'])) {
    //redirect feed and trackback
    if (test_param('feed')) {
        require_once 'wp-feed.php';
        exit;
    } else {
        if (test_param('tb')) {
            $trackback_filename = get_settings('trackback_filename') ? get_settings('trackback_filename') : 'wp-trackback.php';
            require_once $trackback_filename;
            exit;
        }
    }
}
<?php

require_once 'admin.php';
$parent_file = 'edit.php';
$this_file = 'edit-comments.php';
user_level_check();
$standalone = 0;
$title = 'Edit Comments';
require_once 'admin-header.php';
init_param('GET', 'showcomments', 'integer', 10);
init_param('GET', 'commentstart', 'integer', 1);
init_param('GET', 'commentend', 'integer', 0);
init_param('GET', 'commentorder', 'string', 'DESC');
$commentstart = get_param('commentstart');
$commentorder = get_param('commentorder');
if (test_param('commentend')) {
    $commentend = get_param('commentend');
    $showcomments = $commentend - $commentstart + 1;
} else {
    $showcomments = get_param('showcomments');
    $commentend = $commentstart + $showcomments - 1;
}
$nextXstart = $commentend + 1;
$nextXend = $nextXstart + $showcomments - 1;
$previousXstart = $commentstart - $showcomments;
$previousXend = $commentend - $showcomments;
if ($previousXstart < 1) {
    $previousXstart = 0;
    $previousXend = 0;
}
$selorder_desc = selected($commentorder, "DESC", false);
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));
}
if (test_param('p') && get_param('p') != 'all' || test_param('name')) {
    $_tb_id = $GLOBALS['posts'][0]->ID;
}
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");
        echo $GLOBALS['wp_version'];
        ?>
"/>
	<admin:errorReportsTo rdf:resource="mailto:<?php 
        echo antispambot(get_settings('admin_email'));
        ?>
"/>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>

<?php 
        $_criteria =& new CriteriaCompo(new Criteria('comment_approved', '1 '));
        $_criteria->add(new Criteria('post_status', 'publish'));
        $_criteria->add(new Criteria('post_date', date("Y-m-d H:i:s"), '<'));
        if (test_param('p')) {
            $_criteria->add(new Criteria('comment_post_ID', $GLOBALS['wp_post_id']));
        } else {
            $_criteria->setOrder('DESC');
        }
        $_criteria->setSort('comment_date');
        $_criteria->setLimit(get_settings('posts_per_rss'));
        $_criteria->setStart(1);
        $_joinCriteria =& new XoopsJoinCriteria(wp_table('posts'), 'comment_post_id', 'ID');
        $commentHandler =& wp_handler('Comment');
        $commentObjects = $commentHandler->getObjects($_criteria, false, 'comment_ID, comment_author, comment_author_email, comment_author_url,
											  comment_date, comment_content, comment_post_ID,' . wp_table('posts') . '.ID,
											 ' . wp_table('posts') . '.post_password', false, $_joinCriteria);
        // this line is WordPress' motor, do not delete it.
        if ($commentObjects) {
            foreach ($commentObjects as $commentObject) {
function archive_header(&$post, $before = '', $after = '')
{
    static $previous = '';
    if (test_param('orderby')) {
        $orderby = explode(' ', get_param('orderby'));
        $orderby = $orderby[0];
    } else {
        $orderby = '';
    }
    switch ($orderby) {
        case 'title':
            if (_LANGCODE == 'ja') {
                $thisletter = ucfirst(mb_substring($post->yomi, 0, 1, $GLOBALS['blog_charset']));
                if ($thisletter > "¤ó") {
                    $thisletter = "´Á»ú";
                }
            } else {
                $thisletter = ucfirst(substr($post->yomi, 0, 1));
            }
            if ($thisletter == "") {
                $thisletter = _WP_POST_NOTITLE;
            }
            if ($previous === '' || $thisletter !== $previous) {
                $output = "<br/>" . $thisletter;
            }
            $previous = $thisletter;
            break;
        case 'category':
            $thiscategory = $post->cat_ID;
            if ($thiscategory != $previous) {
                $output = '<br/><strong><a href="' . get_category_link(false, $thiscategory) . '">' . get_catname($thiscategory) . '</a></strong>';
            }
            $previous = $thiscategory;
            break;
        case 'author':
            $thisauthor = $post->post_author;
            if ($thisauthor != $previous) {
                $output = '<br/><strong><a href="' . get_author_link(false, $thisauthor) . '">' . the_author('', false) . '</a></strong>';
            }
            $previous = $thisauthor;
            break;
        case 'date':
        case '':
            $thismonth = mysql2date('m', $post->post_date);
            $thisyear = mysql2date('Y', $post->post_date);
            $thisdate = $thisyear . $thismonth;
            if ($thisdate != $previous) {
                $monthstr = format_month(sprintf("%d", $thisyear), $GLOBALS['month'][zeroise($thismonth, 2)]);
                $output = '<strong><br/><a href="' . get_month_link($thisyear, $thismonth) . '">' . $monthstr . '</a></strong>';
            }
            $previous = $thisdate;
            break;
    }
    if (!empty($output)) {
        $output = $before . $output . $after . "\n";
        echo $output;
    }
}
$this_file = 'edit-comments.php';
user_level_check();
$standalone = 0;
$title = 'Edit Comments';
require_once 'admin-header.php';
init_param('GET', 'showcomments', 'integer', 10);
init_param('GET', 'commentstart', 'integer', 0);
init_param('GET', 'commentend', 'integer', 0);
init_param('GET', 'commentorder', 'string', 'DESC');
if (test_param('commentstart') && test_param('commentend')) {
    $showcomments = $commentend - $commentstart + 1;
} else {
    if (!test_param('$commentstart')) {
        $commentstart = 1;
    }
    if (!test_param('$commentend')) {
        $commentend = $commentstart + $showcomments - 1;
    }
}
$nextXstart = $commentend + 1;
$nextXend = $nextXstart + $showcomments - 1;
$previousXstart = $commentstart - $showcomments;
$previousXend = $commentend - $showcomments;
if ($previousXstart < 1) {
    $previousXstart = 0;
    $previousXend = 0;
}
$selorder_desc = selected($commentorder, "DESC", false);
$selorder_asc = selected($commentorder, "ASC", false);
$criteria = new Criteria(1, 1);
$criteria->setSort('comment_date');
            if (test_param('m') || test_param('p') || test_param('w') || test_param('s') || test_param('cat') || test_param('category_name')) {
            } else {
                if (test_param('paged')) {
                    $_criteria_start = (intval(get_param('paged')) - 1) * $GLOBALS['posts_per_page'];
                }
                $_criteria_limit = $GLOBALS['posts_per_page'];
            }
        }
    }
}
if (isset($GLOBALS['p']) && $GLOBALS['p'] == 'all') {
    unset($_criteria);
    $_criteria =& new CriteriaCompo();
}
if ($GLOBALS['pagenow'] != 'post.php' && $GLOBALS['pagenow'] != 'edit.php') {
    if (!test_param('poststart') || !test_param('postend') || !(get_param('postend') > get_param('poststart'))) {
        $_criteria->add(new Criteria('post_date', current_time('mysql'), '<='));
    }
    $_distinct = 'DISTINCT';
}
$_wCriteria = new CriteriaCompo(new Criteria('post_status', 'publish'));
// Get private posts
if (!empty($GLOBALS['user_ID'])) {
    $_wCriteria->add(new Criteria('post_author', intval($GLOBALS['user_ID'])), 'OR');
    $_wCriteria->add(new Criteria('post_status', 'draft', '!='), 'AND');
}
$_criteria->add($_wCriteria);
unset($_wCriteria);
$_criteria->setGroupBy(wp_table('posts') . '.ID');
if ($_criteria_sort) {
    $_criteria->setSort($_criteria_sort);
Пример #15
0
<?php

/* RDF 1.0 generator, original version by garym@teledyn.com */
$GLOBALS['blog'] = 1;
$GLOBALS['doing_rss'] = 1;
require_once dirname(__FILE__) . '/wp-config.php';
error_reporting(E_ERROR);
init_param('GET', 'num', 'integer');
if (test_param('num')) {
    $GLOBALS['showposts'] = get_param('num');
}
require_once 'wp-blog-header.php';
add_filter('the_content', 'trim');
$_rss_charset = wp_get_rss_charset();
header('Content-type: application/xml');
echo '<?xml version="1.0" encoding="' . $_rss_charset . '"?' . '>';
?>
<!-- generator="wordpress/<?php 
echo $GLOBALS['wp_version'];
?>
" -->
<rdf:RDF
	xmlns="http://purl.org/rss/1.0/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:admin="http://webns.net/mvcb/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
<channel rdf:about="<?php 
bloginfo_rss('url');
Пример #16
0
<?php

error_reporting(E_ERROR);
$GLOBALS['blog'] = 1;
$GLOBALS['doing_rss'] = 1;
$GLOBALS['wp_inblock'] = 0;
require "wp-config.php";
init_param('GET', 'feed', 'string', 'rss2');
init_param('GET', 'p', 'string', '');
init_param('GET', 'name', 'string', '');
init_param('GET', 'withcomments', 'integer', 0);
if (test_param('p') && $p != 'all' || test_param('name') || get_param('withcomments') == 1) {
    require 'wp-commentsrss2.php';
} else {
    switch (get_param('feed')) {
        case 'atom':
            require 'wp-atom.php';
            break;
        case 'rdf':
            require 'wp-rdf.php';
            break;
        case 'rss':
            require 'wp-rss.php';
            break;
        case 'rss2':
        case 'feed':
            require 'wp-rss2.php';
            break;
    }
}
Пример #17
0
         $mn = $mn > 59 ? $mn - 60 : $mn;
         $ss = $ss > 59 ? $ss - 60 : $ss;
         $datemodif = "{$aa}-{$mm}-{$jj} {$hh}:{$mn}:{$ss}";
     } else {
         $datemodif = '';
     }
     $commentObject =& $commentHandler->get($comment_ID);
     $commentObject->setVar('comment_ID', $comment_ID);
     $commentObject->setVar('comment_content', apply_filters('comment_save_pre', $wp_content));
     $commentObject->setVar('comment_author', $newcomment_author);
     $commentObject->setVar('comment_author_email', $newcomment_author_email);
     $commentObject->setVar('comment_author_url', $newcomment_author_url);
     if ($datemodif) {
         $commentObject->setVar('comment_date', $datemodif);
     }
     if (!test_param('referredby') && $_SERVER['HTTP_REFERER'] != "") {
         $location = $_SERVER['HTTP_REFERER'];
     } else {
         $location = urldecode($referredby);
     }
     if (!$commentHandler->insert($commentObject, false, false)) {
         redirect_header($location, 3, $commentHandler->getErrors());
     }
     header('Location: ' . $location);
     do_action('edit_comment', $comment_ID);
     exit;
     break;
 default:
     $title = 'Create New Post';
     $standalone = 0;
     require_once './admin-header.php';