Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986

git-svn-id: http://svn.automattic.com/wordpress/trunk@4495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-11-19 07:56:05 +00:00
parent 38e868257a
commit 9f534ebae6
99 changed files with 1521 additions and 1521 deletions

View File

@ -1,4 +1,4 @@
<?php <?php
/* Short and sweet */ /* Short and sweet */
define('WP_USE_THEMES', true); define('WP_USE_THEMES', true);
require('./wp-blog-header.php'); require('./wp-blog-header.php');

View File

@ -128,7 +128,7 @@ case 'add-category' : // On the Fly
break; break;
case 'add-cat' : // From Manage->Categories case 'add-cat' : // From Manage->Categories
if ( !current_user_can( 'manage_categories' ) ) if ( !current_user_can( 'manage_categories' ) )
die('-1'); die('-1');
if ( !$cat = wp_insert_category( $_POST ) ) if ( !$cat = wp_insert_category( $_POST ) )
die('0'); die('0');
if ( !$cat = get_category( $cat ) ) if ( !$cat = get_category( $cat ) )

View File

@ -48,7 +48,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
if ( ! $user->has_cap('edit_others_posts') ) { if ( ! $user->has_cap('edit_others_posts') ) {
if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
return array($user->id); return array($user->id);
else else
return false; return false;
} }
@ -96,7 +96,7 @@ function wp_insert_category($catarr) {
$update = false; $update = false;
$cat_name = apply_filters('pre_category_name', $cat_name); $cat_name = apply_filters('pre_category_name', $cat_name);
if (empty ($category_nicename)) if (empty ($category_nicename))
$category_nicename = sanitize_title($cat_name); $category_nicename = sanitize_title($cat_name);
else else
@ -198,7 +198,7 @@ function wp_delete_category($cat_ID) {
$cats = array($default_cat); $cats = array($default_cat);
else else
$cats = array_diff($cats, array($cat_ID)); $cats = array_diff($cats, array($cat_ID));
wp_set_post_categories($post_id, $cats); wp_set_post_categories($post_id, $cats);
} }
$default_link_cat = get_option('default_link_category'); $default_link_cat = get_option('default_link_category');
@ -209,9 +209,9 @@ function wp_delete_category($cat_ID) {
$cats = array($default_link_cat); $cats = array($default_link_cat);
else else
$cats = array_diff($cats, array($cat_ID)); $cats = array_diff($cats, array($cat_ID));
wp_set_link_cats($link_id, $cats); wp_set_link_cats($link_id, $cats);
} }
wp_cache_delete($cat_ID, 'category'); wp_cache_delete($cat_ID, 'category');
wp_cache_delete('all_category_ids', 'category'); wp_cache_delete('all_category_ids', 'category');
@ -285,9 +285,9 @@ function wp_delete_user($id, $reassign = 'novalue') {
function wp_revoke_user($id) { function wp_revoke_user($id) {
$id = (int) $id; $id = (int) $id;
$user = new WP_User($id); $user = new WP_User($id);
$user->remove_all_caps(); $user->remove_all_caps();
} }
function wp_insert_link($linkdata) { function wp_insert_link($linkdata) {
@ -385,15 +385,15 @@ function wp_update_link($linkdata) {
$link = add_magic_quotes($link); $link = add_magic_quotes($link);
// Passed link category list overwrites existing category list if not empty. // Passed link category list overwrites existing category list if not empty.
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category']) if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
&& 0 != count($linkdata['link_category']) ) && 0 != count($linkdata['link_category']) )
$link_cats = $linkdata['link_category']; $link_cats = $linkdata['link_category'];
else else
$link_cats = $link['link_category']; $link_cats = $link['link_category'];
// Merge old and new fields with new fields overwriting old ones. // Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata); $linkdata = array_merge($link, $linkdata);
$linkdata['link_category'] = $link_cats; $linkdata['link_category'] = $link_cats;
return wp_insert_link($linkdata); return wp_insert_link($linkdata);
} }
@ -402,7 +402,7 @@ function wp_delete_link($link_id) {
global $wpdb; global $wpdb;
do_action('delete_link', $link_id); do_action('delete_link', $link_id);
$categories = wp_get_link_cats($link_id); $categories = wp_get_link_cats($link_id);
if( is_array( $categories ) ) { if( is_array( $categories ) ) {
foreach ( $categories as $category ) { foreach ( $categories as $category ) {
@ -418,9 +418,9 @@ function wp_delete_link($link_id) {
function wp_get_link_cats($link_ID = 0) { function wp_get_link_cats($link_ID = 0) {
global $wpdb; global $wpdb;
$sql = "SELECT category_id $sql = "SELECT category_id
FROM $wpdb->link2cat FROM $wpdb->link2cat
WHERE link_id = $link_ID WHERE link_id = $link_ID
ORDER BY category_id"; ORDER BY category_id";
$result = $wpdb->get_col($sql); $result = $wpdb->get_col($sql);
@ -441,8 +441,8 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
// First the old categories // First the old categories
$old_categories = $wpdb->get_col(" $old_categories = $wpdb->get_col("
SELECT category_id SELECT category_id
FROM $wpdb->link2cat FROM $wpdb->link2cat
WHERE link_id = $link_ID"); WHERE link_id = $link_ID");
if (!$old_categories) { if (!$old_categories) {
@ -457,9 +457,9 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
if ($delete_cats) { if ($delete_cats) {
foreach ($delete_cats as $del) { foreach ($delete_cats as $del) {
$wpdb->query(" $wpdb->query("
DELETE FROM $wpdb->link2cat DELETE FROM $wpdb->link2cat
WHERE category_id = $del WHERE category_id = $del
AND link_id = $link_ID AND link_id = $link_ID
"); ");
} }
} }
@ -470,11 +470,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
if ($add_cats) { if ($add_cats) {
foreach ($add_cats as $new_cat) { foreach ($add_cats as $new_cat) {
$wpdb->query(" $wpdb->query("
INSERT INTO $wpdb->link2cat (link_id, category_id) INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ($link_ID, $new_cat)"); VALUES ($link_ID, $new_cat)");
} }
} }
// Update category counts. // Update category counts.
$all_affected_cats = array_unique(array_merge($link_categories, $old_categories)); $all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
foreach ( $all_affected_cats as $cat_id ) { foreach ( $all_affected_cats as $cat_id ) {

View File

@ -1139,10 +1139,10 @@ function touch_time( $edit = 1, $for_post = 1 ) {
?> ?>
</select> </select>
<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/> <input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/>
<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @ <input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @
<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> : <input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> :
<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> <input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
<?php <?php
if ( $edit ) { if ( $edit ) {
_e( 'Existing timestamp' ); _e( 'Existing timestamp' );
@ -1387,7 +1387,7 @@ function user_can_access_admin_page() {
return false; return false;
} }
} }
return true; return true;
} }

View File

@ -35,16 +35,16 @@ if (!empty($post_title))
else else
$post->post_title = $popuptitle; $post->post_title = $popuptitle;
$content = wp_specialchars($_REQUEST['content']); $content = wp_specialchars($_REQUEST['content']);
$popupurl = wp_specialchars($_REQUEST['popupurl']); $popupurl = wp_specialchars($_REQUEST['popupurl']);
if ( !empty($content) ) { if ( !empty($content) ) {
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) ); $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
} else { } else {
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text"; $post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
} }
/* /big funky fixes */ /* /big funky fixes */
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
@ -77,15 +77,15 @@ $popupurl = wp_specialchars($_REQUEST['popupurl']);
} }
#wpbookmarklet .wrap { #wpbookmarklet .wrap {
border: 0px; border: 0px;
} }
#wpbookmarklet #postdiv { #wpbookmarklet #postdiv {
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
#wpbookmarklet #titlediv { #wpbookmarklet #titlediv {
margin-bottom: 1em; margin-bottom: 1em;
} }
--> -->

View File

@ -48,10 +48,10 @@ break;
case 'edit': case 'edit':
require_once ('admin-header.php'); require_once ('admin-header.php');
$cat_ID = (int) $_GET['cat_ID']; $cat_ID = (int) $_GET['cat_ID'];
$category = get_category_to_edit($cat_ID); $category = get_category_to_edit($cat_ID);
include('edit-category-form.php'); include('edit-category-form.php');
break; break;

View File

@ -14,10 +14,10 @@ function customFieldsAddIn() {
for ( var i=0; i < inputs.length; i++ ) { for ( var i=0; i < inputs.length; i++ ) {
if ('text' == inputs[i].type) { if ('text' == inputs[i].type) {
inputs[i].setAttribute('autocomplete', 'off'); inputs[i].setAttribute('autocomplete', 'off');
inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); }; inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
} }
if ('updatemeta' == inputs[i].className) { if ('updatemeta' == inputs[i].className) {
inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); }; inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
} }
} }

View File

@ -9,7 +9,7 @@ switch ( $_GET['pagenow'] ) :
break; break;
case 'page.php' : case 'page.php' :
case 'page-new.php' : case 'page-new.php' :
$man = 'pagemeta'; $man = 'pagemeta';
break; break;
case 'link.php' : case 'link.php' :
$man = 'linkmeta'; $man = 'linkmeta';

View File

@ -22,8 +22,8 @@ if ( ! empty($cat_ID) ) {
<?php wp_nonce_field($nonce_action); ?> <?php wp_nonce_field($nonce_action); ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5"> <table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr> <tr>
<th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th> <th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td> <td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th> <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>

View File

@ -143,7 +143,7 @@ $start = " start='$offset'";
++$i; $class = ''; ++$i; $class = '';
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID); $comment_status = wp_get_comment_status($comment->comment_ID);
if ('unapproved' == $comment_status) if ('unapproved' == $comment_status)
$class .= ' unapproved'; $class .= ' unapproved';
if ($i % 2) if ($i % 2)
$class .= ' alternate'; $class .= ' alternate';
@ -153,7 +153,7 @@ $start = " start='$offset'";
<?php comment_text() ?> <?php comment_text() ?>
<p><?php comment_date('M j, g:i A'); ?> &#8212; [ <p><?php comment_date('M j, g:i A'); ?> &#8212; [
<?php <?php
if ( current_user_can('edit_post', $comment->comment_post_ID) ) { if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>'; echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
@ -181,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?> ?>
<p> <p>
<strong><?php _e('No comments found.') ?></strong></p> <strong><?php _e('No comments found.') ?></strong></p>
<?php <?php
} // end if ($comments) } // end if ($comments)

View File

@ -8,8 +8,7 @@ $messages[3] = __('Custom field deleted.');
<?php endif; ?> <?php endif; ?>
<form name="post" action="post.php" method="post" id="post"> <form name="post" action="post.php" method="post" id="post">
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
isset($_GET['popupurl']) ): ?>
<input type="hidden" name="mode" value="bookmarklet" /> <input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?> <?php endif; ?>
@ -121,7 +120,7 @@ if ( $authors && count( $authors ) > 1 ) :
<h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3> <h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3>
<div class="dbx-content"> <div class="dbx-content">
<select name="post_author_override" id="post_author_override"> <select name="post_author_override" id="post_author_override">
<?php <?php
foreach ($authors as $o) : foreach ($authors as $o) :
$o = get_userdata( $o->ID ); $o = get_userdata( $o->ID );
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"'; if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
@ -140,8 +139,8 @@ endforeach;
</div> </div>
<fieldset id="titlediv"> <fieldset id="titlediv">
<legend><?php _e('Title') ?></legend> <legend><?php _e('Title') ?></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
</fieldset> </fieldset>
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> <fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
@ -208,7 +207,7 @@ if (current_user_can('upload_files')) {
</div> </div>
<div class="dbx-content-wrapper"> <div class="dbx-content-wrapper">
<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>) <div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
<?php <?php
if ( ! empty($pings) ) if ( ! empty($pings) )
echo $pings; echo $pings;
?> ?>
@ -227,7 +226,7 @@ if ( ! empty($pings) )
<table cellpadding="3"> <table cellpadding="3">
<?php <?php
$metadata = has_meta($post_ID); $metadata = has_meta($post_ID);
list_meta($metadata); list_meta($metadata);
?> ?>
</table> </table>

View File

@ -54,8 +54,8 @@ addLoadEvent(focusit);
<tr> <tr>
<th scope="row" valign="top"><?php _e('Comment Status') ?>:</th> <th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br /> <td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br /> <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td> <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
</tr> </tr>
<?php if ( current_user_can('edit_posts') ) : ?> <?php if ( current_user_can('edit_posts') ) : ?>

View File

@ -54,17 +54,17 @@ edCanvas = document.getElementById('content');
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?> <p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p> <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" /> <p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" /> <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
<?php if ( current_user_can('edit_posts') ) : ?> <?php if ( current_user_can('edit_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" /> <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
<?php endif; ?> <?php endif; ?>
<?php if ('bookmarklet' != $mode) { <?php if ('bookmarklet' != $mode) {
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing &raquo;') . '" />'; echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing &raquo;') . '" />';
} ?> } ?>
<input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" /> <input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
</p> </p>
<?php do_action('simple_edit_form', ''); ?> <?php do_action('simple_edit_form', ''); ?>

View File

@ -30,7 +30,7 @@ function xfn_check($class, $value = '', $type = 'check') {
} }
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php echo $heading ?></h2> <h2><?php echo $heading ?></h2>
<?php echo $form ?> <?php echo $form ?>
<?php wp_nonce_field($nonce_action); ?> <?php wp_nonce_field($nonce_action); ?>
@ -48,7 +48,7 @@ function xfn_check($class, $value = '', $type = 'check') {
</fieldset> </fieldset>
<fieldset class="dbx-box"> <fieldset class="dbx-box">
<h3 class="dbx-handle"><?php _e('Target') ?></h3> <h3 class="dbx-handle"><?php _e('Target') ?></h3>
<div class="dbx-content"> <div class="dbx-content">
<label for="link_target_blank" class="selectit"> <label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
@ -63,7 +63,7 @@ function xfn_check($class, $value = '', $type = 'check') {
</fieldset> </fieldset>
<fieldset class="dbx-box"> <fieldset class="dbx-box">
<h3 class="dbx-handle"><?php _e('Visible') ?></h3> <h3 class="dbx-handle"><?php _e('Visible') ?></h3>
<div class="dbx-content"> <div class="dbx-content">
<label for="link_visible_yes" class="selectit"> <label for="link_visible_yes" class="selectit">
<input id="link_visible_yes" type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" /> <input id="link_visible_yes" type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />

View File

@ -16,7 +16,7 @@ if (0 == $post_ID) {
$sendto = wp_get_referer(); $sendto = wp_get_referer();
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) ) if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
$sendto = 'redo'; $sendto = 'redo';
$sendto = wp_specialchars( $sendto ); $sendto = wp_specialchars( $sendto );
?> ?>
@ -27,7 +27,7 @@ $sendto = wp_specialchars( $sendto );
wp_nonce_field($nonce_action); wp_nonce_field($nonce_action);
if (isset($mode) && 'bookmarklet' == $mode) { if (isset($mode) && 'bookmarklet' == $mode) {
echo '<input type="hidden" name="mode" value="bookmarklet" />'; echo '<input type="hidden" name="mode" value="bookmarklet" />';
} }
?> ?>
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" /> <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
@ -103,7 +103,7 @@ addLoadEvent(focusit);
<h3 class="dbx-handle"><?php _e('Page Author'); ?>:</h3> <h3 class="dbx-handle"><?php _e('Page Author'); ?>:</h3>
<div class="dbx-content"> <div class="dbx-content">
<select name="post_author_override" id="post_author_override"> <select name="post_author_override" id="post_author_override">
<?php <?php
foreach ($authors as $o) : foreach ($authors as $o) :
$o = get_userdata( $o->ID ); $o = get_userdata( $o->ID );
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"'; if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
@ -117,7 +117,7 @@ endforeach;
<?php endif; ?> <?php endif; ?>
<fieldset id="pageorder" class="dbx-box"> <fieldset id="pageorder" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Page Order') ?></h3> <h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
<div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div> <div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div>
</fieldset> </fieldset>
@ -168,9 +168,9 @@ if (current_user_can('upload_files')) {
<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3> <h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
<div id="postcustomstuff" class="dbx-content"> <div id="postcustomstuff" class="dbx-content">
<table cellpadding="3"> <table cellpadding="3">
<?php <?php
$metadata = has_meta($post_ID); $metadata = has_meta($post_ID);
list_meta($metadata); list_meta($metadata);
?> ?>
</table> </table>
@ -186,7 +186,7 @@ list_meta($metadata);
</div> </div>
<?php if ('edit' == $action) : <?php if ('edit' == $action) :
$delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID ); $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
if ( current_user_can('delete_page', $post->ID) ) ?> if ( current_user_can('delete_page', $post->ID) ) ?>
<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
<?php endif; ?> <?php endif; ?>

View File

@ -10,12 +10,12 @@ require_once('admin-header.php');
<h2><?php _e('Page Management'); ?></h2> <h2><?php _e('Page Management'); ?></h2>
<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p> <p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p>
<form name="searchform" action="" method="get"> <form name="searchform" action="" method="get">
<fieldset> <fieldset>
<legend><?php _e('Search Pages&hellip;') ?></legend> <legend><?php _e('Search Pages&hellip;') ?></legend>
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" /> <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" /> <input type="submit" name="submit" value="<?php _e('Search') ?>" />
</fieldset> </fieldset>
</form> </form>
<?php <?php
@ -53,10 +53,10 @@ page_rows(0, 0, $posts, $all);
<p><?php _e('No pages yet.') ?></p> <p><?php _e('No pages yet.') ?></p>
<?php <?php
} // end if ($posts) } // end if ($posts)
?> ?>
<h3><a href="page-new.php"><?php _e('Create New Page &raquo;'); ?></a></h3> <h3><a href="page-new.php"><?php _e('Create New Page &raquo;'); ?></a></h3>
</div> </div>
<?php include('admin-footer.php'); ?> <?php include('admin-footer.php'); ?>

View File

@ -12,11 +12,11 @@ $drafts = get_users_drafts( $user_ID );
$other_drafts = get_others_drafts( $user_ID); $other_drafts = get_others_drafts( $user_ID);
if ($drafts || $other_drafts) { if ($drafts || $other_drafts) {
?> ?>
<div class="wrap"> <div class="wrap">
<?php if ($drafts) { ?> <?php if ($drafts) { ?>
<p><strong><?php _e('Your Drafts:') ?></strong> <p><strong><?php _e('Your Drafts:') ?></strong>
<?php <?php
$i = 0; $i = 0;
foreach ($drafts as $draft) { foreach ($drafts as $draft) {
if (0 != $i) if (0 != $i)
@ -27,13 +27,13 @@ if ($drafts || $other_drafts) {
echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
++$i; ++$i;
} }
?> ?>
.</p> .</p>
<?php } ?> <?php } ?>
<?php if ($other_drafts) { ?> <?php if ($other_drafts) { ?>
<p><strong><?php _e('Other&#8217;s Drafts:') ?></strong> <p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
<?php <?php
$i = 0; $i = 0;
foreach ($other_drafts as $draft) { foreach ($other_drafts as $draft) {
if (0 != $i) if (0 != $i)
@ -44,8 +44,8 @@ if ($drafts || $other_drafts) {
echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
++$i; ++$i;
} }
?> ?>
.</p> .</p>
<?php } ?> <?php } ?>
@ -88,7 +88,7 @@ if ( count($arc_result) ) { ?>
<form name="viewarc" id="viewarc" action="" method="get"> <form name="viewarc" id="viewarc" action="" method="get">
<fieldset> <fieldset>
<legend><?php _e('Browse Month&hellip;') ?></legend> <legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'> <select name='m'>
<?php <?php
foreach ($arc_result as $arc_row) { foreach ($arc_result as $arc_row) {
if ( $arc_row->yyear == 0 ) if ( $arc_row->yyear == 0 )
@ -127,12 +127,12 @@ if ( count($arc_result) ) { ?>
<?php <?php
// define the columns to display, the syntax is 'internal name' => 'display name' // define the columns to display, the syntax is 'internal name' => 'display name'
$posts_columns = array( $posts_columns = array(
'id' => __('ID'), 'id' => __('ID'),
'date' => __('When'), 'date' => __('When'),
'title' => __('Title'), 'title' => __('Title'),
'categories' => __('Categories'), 'categories' => __('Categories'),
'comments' => __('Comments'), 'comments' => __('Comments'),
'author' => __('Author') 'author' => __('Author')
); );
$posts_columns = apply_filters('manage_posts_columns', $posts_columns); $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
@ -143,7 +143,7 @@ $posts_columns['control_delete'] = '';
?> ?>
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>
@ -160,7 +160,7 @@ $bgcolor = '';
while (have_posts()) : the_post(); while (have_posts()) : the_post();
add_filter('the_title','wp_specialchars'); add_filter('the_title','wp_specialchars');
$class = ('alternate' == $class) ? '' : 'alternate'; $class = ('alternate' == $class) ? '' : 'alternate';
?> ?>
<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'> <tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
<?php <?php
@ -195,9 +195,9 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'comments': case 'comments':
?> ?>
<td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1"> <td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
<?php comments_number(__('0'), __('1'), __('%')) ?> <?php comments_number(__('0'), __('1'), __('%')) ?>
</a></td> </a></td>
<?php <?php
break; break;
@ -259,9 +259,9 @@ if ( 1 == count($posts) ) {
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
if ($comments) { if ($comments) {
?> ?>
<h3 id="comments"><?php _e('Comments') ?></h3> <h3 id="comments"><?php _e('Comments') ?></h3>
<ol id="the-comment-list" class="commentlist"> <ol id="the-comment-list" class="commentlist">
<?php <?php
$i = 0; $i = 0;
foreach ($comments as $comment) { foreach ($comments as $comment) {
@ -269,7 +269,7 @@ foreach ($comments as $comment) {
++$i; $class = ''; ++$i; $class = '';
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID); $comment_status = wp_get_comment_status($comment->comment_ID);
if ('unapproved' == $comment_status) if ('unapproved' == $comment_status)
$class .= ' unapproved'; $class .= ' unapproved';
if ($i % 2) if ($i % 2)
$class .= ' alternate'; $class .= ' alternate';
@ -299,8 +299,8 @@ if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo '</ol>'; echo '</ol>';
}//end if comments }//end if comments
?> ?>
<?php } ?> <?php } ?>
</div> </div>
<?php <?php
include('admin-footer.php'); include('admin-footer.php');
?> ?>

View File

@ -72,7 +72,7 @@ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_dat
<!-- You will be taken through the simple import procedure. --> <!-- You will be taken through the simple import procedure. -->
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"--> <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"-->
<rss version="2.0" <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
@ -108,7 +108,7 @@ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_dat
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent> <wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
<wp:post_type><?php echo $post->post_type; ?></wp:post_type> <wp:post_type><?php echo $post->post_type; ?></wp:post_type>
<?php <?php
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); $postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
if ( $postmeta ) { if ( $postmeta ) {
?> ?>
<?php foreach( $postmeta as $meta ) { ?> <?php foreach( $postmeta as $meta ) { ?>
@ -119,7 +119,7 @@ if ( $postmeta ) {
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php <?php
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
if ( $comments ) { foreach ( $comments as $c ) { ?> if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment> <wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id> <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>

View File

@ -517,7 +517,7 @@ class Blogger_Import {
$did_one = true; $did_one = true;
} }
$output.= "<p>$archivename $status</p>\n"; $output.= "<p>$archivename $status</p>\n";
} }
if ( ! $did_one ) if ( ! $did_one )
$this->set_next_step(7); $this->set_next_step(7);
die( $this->refresher(1000) . $output ); die( $this->refresher(1000) . $output );

View File

@ -20,7 +20,7 @@ class BW_Import {
$trans_tbl = array_flip($trans_tbl); $trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl); return strtr($string, $trans_tbl);
} }
function greet() { function greet() {
echo '<div class="narrow">'; echo '<div class="narrow">';
echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'</p>'; echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'</p>';
@ -30,7 +30,7 @@ class BW_Import {
function import_posts() { function import_posts() {
global $wpdb, $current_user; global $wpdb, $current_user;
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array $importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it $importdata = implode('', $importdata); // squish it
@ -39,7 +39,7 @@ class BW_Import {
preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts); preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts);
$posts = $posts[1]; $posts = $posts[1];
unset($importdata); unset($importdata);
echo '<ol>'; echo '<ol>';
foreach ($posts as $post) { foreach ($posts as $post) {
flush(); flush();
preg_match('|<item type=\"(.*?)\">|is', $post, $post_type); preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
@ -102,7 +102,7 @@ class BW_Import {
preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments); preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
$comments = $comments[1]; $comments = $comments[1];
if ( $comments ) { if ( $comments ) {
$comment_post_ID = $post_id; $comment_post_ID = $post_id;
$num_comments = 0; $num_comments = 0;
@ -157,7 +157,7 @@ class BW_Import {
$this->file = $file['file']; $this->file = $file['file'];
$this->import_posts(); $this->import_posts();
wp_import_cleanup($file['id']); wp_import_cleanup($file['id']);
echo '<h3>'; echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>'; echo '</h3>';
@ -170,7 +170,7 @@ class BW_Import {
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
switch ($step) { switch ($step) {
case 0 : case 0 :
$this->greet(); $this->greet();
@ -179,12 +179,12 @@ class BW_Import {
$this->import(); $this->import();
break; break;
} }
$this->footer(); $this->footer();
} }
function BW_Import() { function BW_Import() {
// Nothing. // Nothing.
} }
} }

View File

@ -9,7 +9,7 @@
**/ **/
if(!function_exists('get_catbynicename')) if(!function_exists('get_catbynicename'))
{ {
function get_catbynicename($category_nicename) function get_catbynicename($category_nicename)
{ {
global $wpdb; global $wpdb;
@ -60,57 +60,58 @@ if(!function_exists('link_exists'))
// //
// This cries out for a C-implementation to be included in PHP core // This cries out for a C-implementation to be included in PHP core
// //
function valid_1byte($char) {
if(!is_int($char)) return false;
return ($char & 0x80) == 0x00;
}
function valid_2byte($char) {
if(!is_int($char)) return false;
return ($char & 0xE0) == 0xC0;
}
function valid_3byte($char) { function valid_1byte($char) {
if(!is_int($char)) return false; if(!is_int($char)) return false;
return ($char & 0xF0) == 0xE0; return ($char & 0x80) == 0x00;
} }
function valid_4byte($char) { function valid_2byte($char) {
if(!is_int($char)) return false; if(!is_int($char)) return false;
return ($char & 0xF8) == 0xF0; return ($char & 0xE0) == 0xC0;
} }
function valid_nextbyte($char) { function valid_3byte($char) {
if(!is_int($char)) return false; if(!is_int($char)) return false;
return ($char & 0xC0) == 0x80; return ($char & 0xF0) == 0xE0;
} }
function valid_utf8($string) { function valid_4byte($char) {
$len = strlen($string); if(!is_int($char)) return false;
$i = 0; return ($char & 0xF8) == 0xF0;
while( $i < $len ) { }
$char = ord(substr($string, $i++, 1));
if(valid_1byte($char)) { // continue function valid_nextbyte($char) {
continue; if(!is_int($char)) return false;
} else if(valid_2byte($char)) { // check 1 byte return ($char & 0xC0) == 0x80;
if(!valid_nextbyte(ord(substr($string, $i++, 1)))) }
return false;
} else if(valid_3byte($char)) { // check 2 bytes function valid_utf8($string) {
if(!valid_nextbyte(ord(substr($string, $i++, 1)))) $len = strlen($string);
return false; $i = 0;
if(!valid_nextbyte(ord(substr($string, $i++, 1)))) while( $i < $len ) {
return false; $char = ord(substr($string, $i++, 1));
} else if(valid_4byte($char)) { // check 3 bytes if(valid_1byte($char)) { // continue
if(!valid_nextbyte(ord(substr($string, $i++, 1)))) continue;
return false; } else if(valid_2byte($char)) { // check 1 byte
if(!valid_nextbyte(ord(substr($string, $i++, 1)))) if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false; return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1)))) } else if(valid_3byte($char)) { // check 2 bytes
return false; if(!valid_nextbyte(ord(substr($string, $i++, 1))))
} // goto next char return false;
} if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return true; // done return false;
} } else if(valid_4byte($char)) { // check 3 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} // goto next char
}
return true; // done
}
function csc ($s) { function csc ($s) {
if (valid_utf8 ($s)) { if (valid_utf8 ($s)) {
@ -151,7 +152,7 @@ class Dotclear_Import {
echo '</form></div>'; echo '</form></div>';
} }
function get_dc_cats() function get_dc_cats()
{ {
global $wpdb; global $wpdb;
// General Housekeeping // General Housekeeping
@ -186,7 +187,7 @@ class Dotclear_Import {
// Get Posts // Get Posts
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
} }
function get_dc_comments() function get_dc_comments()
@ -211,7 +212,7 @@ class Dotclear_Import {
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A); return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A);
} }
function cat2wp($categories='') function cat2wp($categories='')
{ {
// General Housekeeping // General Housekeeping
global $wpdb; global $wpdb;
@ -221,7 +222,7 @@ class Dotclear_Import {
if(is_array($categories)) if(is_array($categories))
{ {
echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
foreach ($categories as $category) foreach ($categories as $category)
{ {
$count++; $count++;
extract($category); extract($category);
@ -283,7 +284,7 @@ class Dotclear_Import {
'display_name' => $Realname) 'display_name' => $Realname)
); );
} }
else else
{ {
$ret_id = wp_insert_user(array( $ret_id = wp_insert_user(array(
'user_login' => $user_id, 'user_login' => $user_id,
@ -384,7 +385,7 @@ class Dotclear_Import {
'comment_count' => $post_nb_comment + $post_nb_trackback) 'comment_count' => $post_nb_comment + $post_nb_trackback)
); );
} }
else else
{ {
$ret_id = wp_insert_post(array( $ret_id = wp_insert_post(array(
'post_author' => $authorid, 'post_author' => $authorid,
@ -460,7 +461,7 @@ class Dotclear_Import {
'comment_approved' => $comment_approved) 'comment_approved' => $comment_approved)
); );
} }
else else
{ {
// Insert comments // Insert comments
$ret_id = wp_insert_comment(array( $ret_id = wp_insert_comment(array(
@ -547,7 +548,7 @@ class Dotclear_Import {
return false; return false;
} }
function import_categories() function import_categories()
{ {
// Category Import // Category Import
$cats = $this->get_dc_cats(); $cats = $this->get_dc_cats();
@ -565,7 +566,7 @@ class Dotclear_Import {
function import_users() function import_users()
{ {
// User Import // User Import
$users = $this->get_dc_users(); $users = $this->get_dc_users();
$this->users2wp($users); $this->users2wp($users);
echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">'; echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
@ -655,7 +656,7 @@ class Dotclear_Import {
echo '</table>'; echo '</table>';
} }
function dispatch() function dispatch()
{ {
if (empty ($_GET['step'])) if (empty ($_GET['step']))
@ -664,7 +665,7 @@ class Dotclear_Import {
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
if ( $step > 0 ) if ( $step > 0 )
{ {
if($_POST['dbuser']) if($_POST['dbuser'])
{ {
@ -689,25 +690,25 @@ class Dotclear_Import {
{ {
if(get_option('dchost')) if(get_option('dchost'))
delete_option('dchost'); delete_option('dchost');
add_option('dchost',$_POST['dbhost']); add_option('dchost',$_POST['dbhost']);
} }
if($_POST['dccharset']) if($_POST['dccharset'])
{ {
if(get_option('dccharset')) if(get_option('dccharset'))
delete_option('dccharset'); delete_option('dccharset');
add_option('dccharset',$_POST['dccharset']); add_option('dccharset',$_POST['dccharset']);
} }
if($_POST['dbprefix']) if($_POST['dbprefix'])
{ {
if(get_option('dcdbprefix')) if(get_option('dcdbprefix'))
delete_option('dcdbprefix'); delete_option('dcdbprefix');
add_option('dcdbprefix',$_POST['dbprefix']); add_option('dcdbprefix',$_POST['dbprefix']);
} }
} }
switch ($step) switch ($step)
{ {
default: default:
case 0 : case 0 :
@ -736,7 +737,7 @@ class Dotclear_Import {
$this->footer(); $this->footer();
} }
function Dotclear_Import() function Dotclear_Import()
{ {
// Nothing. // Nothing.
} }

View File

@ -66,10 +66,10 @@ class GM_Import {
$string = str_replace("|*|","<br />\n",$string); $string = str_replace("|*|","<br />\n",$string);
return($string); return($string);
} }
function import() { function import() {
global $wpdb; global $wpdb;
$wpvarstoreset = array('gmpath', 'archivespath', 'lastentry'); $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
for ($i=0; $i<count($wpvarstoreset); $i += 1) { for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i]; $wpvar = $wpvarstoreset[$i];
@ -136,11 +136,11 @@ class GM_Import {
<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php <li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php
chdir($archivespath); chdir($archivespath);
for($i = 0; $i <= $lastentry; $i = $i + 1) { for($i = 0; $i <= $lastentry; $i = $i + 1) {
$entryfile = ""; $entryfile = "";
if ($i<10000000) { if ($i<10000000) {
$entryfile .= "0"; $entryfile .= "0";
if ($i<1000000) { if ($i<1000000) {
@ -194,7 +194,7 @@ class GM_Import {
$post_status = 'publish'; //in greymatter, there are no drafts $post_status = 'publish'; //in greymatter, there are no drafts
$comment_status = 'open'; $comment_status = 'open';
$ping_status = 'closed'; $ping_status = 'closed';
if ($post_ID = post_exists($post_title, '', $post_date)) { if ($post_ID = post_exists($post_title, '', $post_date)) {
echo ' '; echo ' ';
_e('(already exists)'); _e('(already exists)');
@ -303,7 +303,7 @@ class GM_Import {
} }
function GM_Import() { function GM_Import() {
// Nothing. // Nothing.
} }
} }

View File

@ -55,9 +55,9 @@ class MT_Import {
$pass = 'changeme'; $pass = 'changeme';
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
++ $this->j; ++ $this->j;
$this->mtnames[$this->j] = $author; //add that new mt author name to an array $this->mtnames[$this->j] = $author; //add that new mt author name to an array
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
if (!$user_id) { //banging my head against the desk now. if (!$user_id) { //banging my head against the desk now.
if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
$user_id = wp_create_user($author, $pass); $user_id = wp_create_user($author, $pass);
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
@ -399,7 +399,7 @@ class MT_Import {
function import() { function import() {
$this->id = (int) $_GET['id']; $this->id = (int) $_GET['id'];
$this->file = get_attached_file($this->id); $this->file = get_attached_file($this->id);
$this->get_authors_from_post(); $this->get_authors_from_post();
$this->get_entries(); $this->get_entries();

View File

@ -4,7 +4,7 @@
**/ **/
if(!function_exists('get_catbynicename')) if(!function_exists('get_catbynicename'))
{ {
function get_catbynicename($category_nicename) function get_catbynicename($category_nicename)
{ {
global $wpdb; global $wpdb;
@ -70,13 +70,13 @@ class Textpattern_Import {
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Categories // Get Categories
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
id, id,
name, name,
title title
FROM '.$prefix.'txp_category FROM '.$prefix.'txp_category
WHERE type = "article"', WHERE type = "article"',
ARRAY_A); ARRAY_A);
} }
function get_txp_users() function get_txp_users()
@ -90,12 +90,12 @@ class Textpattern_Import {
// Get Users // Get Users
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
user_id, user_id,
name, name,
RealName, RealName,
email, email,
privs privs
FROM '.$prefix.'txp_users', ARRAY_A); FROM '.$prefix.'txp_users', ARRAY_A);
} }
function get_txp_posts() function get_txp_posts()
@ -106,22 +106,22 @@ class Textpattern_Import {
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Posts // Get Posts
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
ID, ID,
Posted, Posted,
AuthorID, AuthorID,
LastMod, LastMod,
Title, Title,
Body, Body,
Excerpt, Excerpt,
Category1, Category1,
Category2, Category2,
Status, Status,
Keywords, Keywords,
url_title, url_title,
comments_count comments_count
FROM '.$prefix.'textpattern FROM '.$prefix.'textpattern
', ARRAY_A); ', ARRAY_A);
} }
function get_txp_comments() function get_txp_comments()
@ -143,18 +143,18 @@ class Textpattern_Import {
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
id, id,
date, date,
category, category,
url, url,
linkname, linkname,
description description
FROM '.$prefix.'txp_link', FROM '.$prefix.'txp_link',
ARRAY_A); ARRAY_A);
} }
function cat2wp($categories='') function cat2wp($categories='')
{ {
// General Housekeeping // General Housekeeping
global $wpdb; global $wpdb;
@ -164,7 +164,7 @@ class Textpattern_Import {
if(is_array($categories)) if(is_array($categories))
{ {
echo '<p>'.__('Importing Categories...').'<br /><br /></p>'; echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
foreach ($categories as $category) foreach ($categories as $category)
{ {
$count++; $count++;
extract($category); extract($category);
@ -226,7 +226,7 @@ class Textpattern_Import {
'display_name' => $name) 'display_name' => $name)
); );
} }
else else
{ {
$ret_id = wp_insert_user(array( $ret_id = wp_insert_user(array(
'user_login' => $name, 'user_login' => $name,
@ -302,35 +302,35 @@ class Textpattern_Import {
if($pinfo = post_exists($Title,$Body)) if($pinfo = post_exists($Title,$Body))
{ {
$ret_id = wp_insert_post(array( $ret_id = wp_insert_post(array(
'ID' => $pinfo, 'ID' => $pinfo,
'post_date' => $Posted, 'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt, 'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid, 'post_author' => $authorid,
'post_modified' => $LastMod, 'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt, 'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title, 'post_title' => $Title,
'post_content' => $Body, 'post_content' => $Body,
'post_excerpt' => $Excerpt, 'post_excerpt' => $Excerpt,
'post_status' => $post_status, 'post_status' => $post_status,
'post_name' => $url_title, 'post_name' => $url_title,
'comment_count' => $comments_count) 'comment_count' => $comments_count)
); );
} }
else else
{ {
$ret_id = wp_insert_post(array( $ret_id = wp_insert_post(array(
'post_date' => $Posted, 'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt, 'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid, 'post_author' => $authorid,
'post_modified' => $LastMod, 'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt, 'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title, 'post_title' => $Title,
'post_content' => $Body, 'post_content' => $Body,
'post_excerpt' => $Excerpt, 'post_excerpt' => $Excerpt,
'post_status' => $post_status, 'post_status' => $post_status,
'post_name' => $url_title, 'post_name' => $url_title,
'comment_count' => $comments_count) 'comment_count' => $comments_count)
); );
} }
$txpposts2wpposts[$ID] = $ret_id; $txpposts2wpposts[$ID] = $ret_id;
@ -379,29 +379,29 @@ class Textpattern_Import {
{ {
// Update comments // Update comments
$ret_id = wp_update_comment(array( $ret_id = wp_update_comment(array(
'comment_ID' => $cinfo, 'comment_ID' => $cinfo,
'comment_post_ID' => $comment_post_ID, 'comment_post_ID' => $comment_post_ID,
'comment_author' => $name, 'comment_author' => $name,
'comment_author_email' => $email, 'comment_author_email' => $email,
'comment_author_url' => $web, 'comment_author_url' => $web,
'comment_date' => $posted, 'comment_date' => $posted,
'comment_content' => $message, 'comment_content' => $message,
'comment_approved' => $comment_approved) 'comment_approved' => $comment_approved)
); );
} }
else else
{ {
// Insert comments // Insert comments
$ret_id = wp_insert_comment(array( $ret_id = wp_insert_comment(array(
'comment_post_ID' => $comment_post_ID, 'comment_post_ID' => $comment_post_ID,
'comment_author' => $name, 'comment_author' => $name,
'comment_author_email' => $email, 'comment_author_email' => $email,
'comment_author_url' => $web, 'comment_author_url' => $web,
'comment_author_IP' => $ip, 'comment_author_IP' => $ip,
'comment_date' => $posted, 'comment_date' => $posted,
'comment_content' => $message, 'comment_content' => $message,
'comment_approved' => $comment_approved) 'comment_approved' => $comment_approved)
); );
} }
$txpcm2wpcm[$comment_ID] = $ret_id; $txpcm2wpcm[$comment_ID] = $ret_id;
} }
@ -450,7 +450,7 @@ class Textpattern_Import {
'link_updated' => $date) 'link_updated' => $date)
); );
} }
else else
{ {
$ret_id = wp_insert_link(array( $ret_id = wp_insert_link(array(
'link_url' => $url, 'link_url' => $url,
@ -472,7 +472,7 @@ class Textpattern_Import {
return false; return false;
} }
function import_categories() function import_categories()
{ {
// Category Import // Category Import
$cats = $this->get_txp_cats(); $cats = $this->get_txp_cats();
@ -490,7 +490,7 @@ class Textpattern_Import {
function import_users() function import_users()
{ {
// User Import // User Import
$users = $this->get_txp_users(); $users = $this->get_txp_users();
$this->users2wp($users); $this->users2wp($users);
echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">'; echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
@ -578,7 +578,7 @@ class Textpattern_Import {
echo '</table>'; echo '</table>';
} }
function dispatch() function dispatch()
{ {
if (empty ($_GET['step'])) if (empty ($_GET['step']))
@ -587,7 +587,7 @@ class Textpattern_Import {
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
if ( $step > 0 ) if ( $step > 0 )
{ {
if($_POST['dbuser']) if($_POST['dbuser'])
{ {
@ -612,19 +612,19 @@ class Textpattern_Import {
{ {
if(get_option('txphost')) if(get_option('txphost'))
delete_option('txphost'); delete_option('txphost');
add_option('txphost',$_POST['dbhost']); add_option('txphost',$_POST['dbhost']);
} }
if($_POST['dbprefix']) if($_POST['dbprefix'])
{ {
if(get_option('tpre')) if(get_option('tpre'))
delete_option('tpre'); delete_option('tpre');
add_option('tpre',$_POST['dbprefix']); add_option('tpre',$_POST['dbprefix']);
} }
} }
switch ($step) switch ($step)
{ {
default: default:
case 0 : case 0 :
@ -653,7 +653,7 @@ class Textpattern_Import {
$this->footer(); $this->footer();
} }
function Textpattern_Import() function Textpattern_Import()
{ {
// Nothing. // Nothing.
} }

View File

@ -58,9 +58,9 @@ class WP_Import {
$pass = 'changeme'; $pass = 'changeme';
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
++ $this->j; ++ $this->j;
$this->mtnames[$this->j] = $author; //add that new mt author name to an array $this->mtnames[$this->j] = $author; //add that new mt author name to an array
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
if (!$user_id) { //banging my head against the desk now. if (!$user_id) { //banging my head against the desk now.
if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
$user_id = wp_create_user($author, $pass); $user_id = wp_create_user($author, $pass);
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
@ -273,7 +273,7 @@ class WP_Import {
function import() { function import() {
$this->id = (int) $_GET['id']; $this->id = (int) $_GET['id'];
$this->file = get_attached_file($this->id); $this->file = get_attached_file($this->id);
$this->get_authors_from_post(); $this->get_authors_from_post();
$this->get_entries(); $this->get_entries();

View File

@ -46,11 +46,11 @@ if ( $comments || $numcomments ) :
<?php endif; ?> <?php endif; ?>
<ul> <ul>
<?php <?php
if ( $comments ) { if ( $comments ) {
foreach ($comments as $comment) { foreach ($comments as $comment) {
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>'); echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
edit_comment_link(__("Edit"), ' <small>(', ')</small>'); edit_comment_link(__("Edit"), ' <small>(', ')</small>');
echo '</li>'; echo '</li>';
} }
} }
@ -80,7 +80,7 @@ foreach ($recentposts as $post) {
<?php <?php
if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) : if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) :
?> ?>
<div> <div>
<h3><?php _e('Scheduled Entries:') ?></h3> <h3><?php _e('Scheduled Entries:') ?></h3>
<ul> <ul>
@ -90,7 +90,7 @@ foreach ($scheduled as $post) {
$post->post_title = sprintf(__('Post #%s'), $post->ID); $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "</li>"; echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&amp;post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "</li>";
} }
?> ?>
</ul> </ul>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -99,7 +99,7 @@ foreach ($scheduled as $post) {
<h3><?php _e('Blog Stats'); ?></h3> <h3><?php _e('Blog Stats'); ?></h3>
<?php <?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); if (0 < $numposts) $numposts = number_format($numposts);
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms); if (0 < $numcomms) $numcomms = number_format($numcomms);

View File

@ -9,21 +9,21 @@ $debug = 0;
** false on error ** false on error
*/ */
function maybe_create_table($table_name, $create_ddl) { function maybe_create_table($table_name, $create_ddl) {
global $wpdb; global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) { if ($table == $table_name) {
return true; return true;
} }
} }
//didn't find it try to create it. //didn't find it try to create it.
$q = $wpdb->query($create_ddl); $q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded! // we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) { if ($table == $table_name) {
return true; return true;
} }
} }
return false; return false;
} }
/** /**
@ -33,22 +33,22 @@ function maybe_create_table($table_name, $create_ddl) {
** false on error ** false on error
*/ */
function maybe_add_column($table_name, $column_name, $create_ddl) { function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug; global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />"); if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) { if ($column == $column_name) {
return true; return true;
} }
} }
//didn't find it try to create it. //didn't find it try to create it.
$q = $wpdb->query($create_ddl); $q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded! // we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) { if ($column == $column_name) {
return true; return true;
} }
} }
return false; return false;
} }
@ -59,21 +59,21 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
** false on error ** false on error
*/ */
function maybe_drop_column($table_name, $column_name, $drop_ddl) { function maybe_drop_column($table_name, $column_name, $drop_ddl) {
global $wpdb; global $wpdb;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) { if ($column == $column_name) {
//found it try to drop it. //found it try to drop it.
$q = $wpdb->query($drop_ddl); $q = $wpdb->query($drop_ddl);
// we cannot directly tell that whether this succeeded! // we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) { if ($column == $column_name) {
return false; return false;
} }
} }
} }
} }
// else didn't find it // else didn't find it
return true; return true;
} }
@ -92,45 +92,45 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
** Extra ** Extra
*/ */
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) { function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
global $wpdb, $debug; global $wpdb, $debug;
$diffs = 0; $diffs = 0;
$results = $wpdb->get_results("DESC $table_name"); $results = $wpdb->get_results("DESC $table_name");
foreach ($results as $row ) { foreach ($results as $row ) {
if ($debug > 1) print_r($row); if ($debug > 1) print_r($row);
if ($row->Field == $col_name) { if ($row->Field == $col_name) {
// got our column, check the params // got our column, check the params
if ($debug) echo ("checking $row->Type against $col_type\n"); if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) { if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs; ++$diffs;
} }
if (($is_null != null) && ($row->Null != $is_null)) { if (($is_null != null) && ($row->Null != $is_null)) {
++$diffs; ++$diffs;
} }
if (($key != null) && ($row->Key != $key)) { if (($key != null) && ($row->Key != $key)) {
++$diffs; ++$diffs;
} }
if (($default != null) && ($row->Default != $default)) { if (($default != null) && ($row->Default != $default)) {
++$diffs; ++$diffs;
} }
if (($extra != null) && ($row->Extra != $extra)) { if (($extra != null) && ($row->Extra != $extra)) {
++$diffs; ++$diffs;
} }
if ($diffs > 0) { if ($diffs > 0) {
if ($debug) echo ("diffs = $diffs returning false\n"); if ($debug) echo ("diffs = $diffs returning false\n");
return false; return false;
} }
return true; return true;
} // end if found our column } // end if found our column
} }
return false; return false;
} }
/* /*
echo "<p>testing</p>"; echo "<p>testing</p>";
echo "<pre>"; echo "<pre>";
//check_column('wp_links', 'link_description', 'mediumtext'); //check_column('wp_links', 'link_description', 'mediumtext');
//if (check_column($wpdb->comments, 'comment_author', 'tinytext')) //if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
// echo "ok\n"; // echo "ok\n";
$error_count = 0; $error_count = 0;
@ -138,14 +138,14 @@ $tablename = $wpdb->links;
// check the column // check the column
if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
{ {
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
$q = $wpdb->query($ddl); $q = $wpdb->query($ddl);
} }
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) { if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
$res .= $tablename . ' - ok <br />'; $res .= $tablename . ' - ok <br />';
} else { } else {
$res .= 'There was a problem with ' . $tablename . '<br />'; $res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count; ++$error_count;
} }
echo "</pre>"; echo "</pre>";
*/ */

View File

@ -7,9 +7,9 @@ $parent_file = 'link-manager.php';
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id', 'description', 'visible', 'target', 'category', 'link_id',
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
'notes', 'linkcheck[]')); 'notes', 'linkcheck[]'));
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') ); wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
if ( current_user_can( 'manage_categories' ) ) if ( current_user_can( 'manage_categories' ) )

View File

@ -143,8 +143,8 @@ if ($links)
echo $link->link_description . "</td>"; echo $link->link_description . "</td>";
echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>"; echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
?> ?>
<td> <td>
<?php <?php
$cat_names = array(); $cat_names = array();
foreach ($link->link_category as $category) { foreach ($link->link_category as $category) {
@ -157,8 +157,8 @@ if ($links)
echo implode(', ', $cat_names); echo implode(', ', $cat_names);
?> ?>
</td> </td>
<td><?php echo $link->link_rel; ?></td> <td><?php echo $link->link_rel; ?></td>
<td align='center'><?php echo $visible; ?></td> <td align='center'><?php echo $visible; ?></td>
<?php <?php
echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>'; echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>';

View File

@ -4,12 +4,12 @@ require_once('../wp-config.php');
// columns we wish to find are: link_url, link_name, link_target, link_description // columns we wish to find are: link_url, link_name, link_target, link_description
// we need to map XML attribute names to our columns // we need to map XML attribute names to our columns
$opml_map = array('URL' => 'link_url', $opml_map = array('URL' => 'link_url',
'HTMLURL' => 'link_url', 'HTMLURL' => 'link_url',
'TEXT' => 'link_name', 'TEXT' => 'link_name',
'TITLE' => 'link_name', 'TITLE' => 'link_name',
'TARGET' => 'link_target', 'TARGET' => 'link_target',
'DESCRIPTION' => 'link_description', 'DESCRIPTION' => 'link_description',
'XMLURL' => 'link_rss' 'XMLURL' => 'link_rss'
); );
$map = $opml_map; $map = $opml_map;
@ -20,24 +20,24 @@ $map = $opml_map;
**/ **/
function startElement($parser, $tagName, $attrs) { function startElement($parser, $tagName, $attrs) {
global $updated_timestamp, $all_links, $map; global $updated_timestamp, $all_links, $map;
global $names, $urls, $targets, $descriptions, $feeds; global $names, $urls, $targets, $descriptions, $feeds;
if ($tagName == 'OUTLINE') { if ($tagName == 'OUTLINE') {
foreach (array_keys($map) as $key) { foreach (array_keys($map) as $key) {
if (isset($attrs[$key])) { if (isset($attrs[$key])) {
$$map[$key] = $attrs[$key]; $$map[$key] = $attrs[$key];
} }
} }
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n"); //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
// save the data away. // save the data away.
$names[] = $link_name; $names[] = $link_name;
$urls[] = $link_url; $urls[] = $link_url;
$targets[] = $link_target; $targets[] = $link_target;
$feeds[] = $link_rss; $feeds[] = $link_rss;
$descriptions[] = $link_description; $descriptions[] = $link_description;
} // end if outline } // end if outline
} }
/** /**
@ -55,9 +55,9 @@ $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!xml_parse($xml_parser, $opml, true)) { if (!xml_parse($xml_parser, $opml, true)) {
echo(sprintf(__('XML error: %1$s at line %2$s'), echo(sprintf(__('XML error: %1$s at line %2$s'),
xml_error_string(xml_get_error_code($xml_parser)), xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser))); xml_get_current_line_number($xml_parser)));
} }
// Free up memory used by the XML parser // Free up memory used by the XML parser

View File

@ -29,7 +29,7 @@ switch ($action) {
$deleted = 0; $deleted = 0;
foreach ($linkcheck as $link_id) { foreach ($linkcheck as $link_id) {
$link_id = (int) $link_id; $link_id = (int) $link_id;
if ( wp_delete_link($link_id) ) if ( wp_delete_link($link_id) )
$deleted++; $deleted++;
} }

View File

@ -34,8 +34,8 @@ foreach ($menu as $item) {
if ( isset($submenu["$parent_file"]) ) : if ( isset($submenu["$parent_file"]) ) :
?> ?>
<ul id="submenu"> <ul id="submenu">
<?php <?php
foreach ($submenu["$parent_file"] as $item) : foreach ($submenu["$parent_file"] as $item) :
if ( !current_user_can($item[1]) ) if ( !current_user_can($item[1]) )
continue; continue;
@ -65,7 +65,7 @@ else :
<div id="minisub"></div> <div id="minisub"></div>
<?php <?php
endif; endif;
do_action('admin_notices'); do_action('admin_notices');

View File

@ -83,14 +83,14 @@ foreach ($submenu as $parent => $sub) {
$_wp_submenu_nopriv[$parent][$data[2]] = true; $_wp_submenu_nopriv[$parent][$data[2]] = true;
} }
} }
if ( empty($submenu[$parent]) ) if ( empty($submenu[$parent]) )
unset($submenu[$parent]); unset($submenu[$parent]);
} }
// Loop over the top-level menu. // Loop over the top-level menu.
// Menus for which the original parent is not acessible due to lack of privs will have the next // Menus for which the original parent is not acessible due to lack of privs will have the next
// submenu in line be assigned as the new menu parent. // submenu in line be assigned as the new menu parent.
foreach ( $menu as $id => $data ) { foreach ( $menu as $id => $data ) {
if ( empty($submenu[$data[2]]) ) if ( empty($submenu[$data[2]]) )
continue; continue;

View File

@ -31,7 +31,7 @@ case 'update':
foreach($comment as $key => $value) { foreach($comment as $key => $value) {
if ($feelinglucky && 'later' == $value) if ($feelinglucky && 'later' == $value)
$value = 'delete'; $value = 'delete';
switch($value) { switch($value) {
case 'later': case 'later':
// do nothing with that comment // do nothing with that comment
// wp_set_comment_status($key, "hold"); // wp_set_comment_status($key, "hold");
@ -41,10 +41,10 @@ case 'update':
wp_set_comment_status($key, 'delete'); wp_set_comment_status($key, 'delete');
++$item_deleted; ++$item_deleted;
break; break;
case 'spam': case 'spam':
wp_set_comment_status($key, 'spam'); wp_set_comment_status($key, 'spam');
++$item_spam; ++$item_spam;
break; break;
case 'approve': case 'approve':
wp_set_comment_status($key, 'approve'); wp_set_comment_status($key, 'approve');
if ( get_option('comments_notify') == true ) { if ( get_option('comments_notify') == true ) {
@ -52,7 +52,7 @@ case 'update':
} }
++$item_approved; ++$item_approved;
break; break;
} }
} }
$file = basename(__FILE__); $file = basename(__FILE__);
@ -85,13 +85,13 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n"; echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n";
} }
} }
if ($spam) { if ($spam) {
if ('1' == $spam) { if ('1' == $spam) {
echo __("1 comment marked as spam") . " <br/>\n"; echo __("1 comment marked as spam") . " <br/>\n";
} else { } else {
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n"; echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
} }
} }
if ($ignored) { if ($ignored) {
if ('1' == $ignored) { if ('1' == $ignored) {
echo __("1 comment unchanged") . " <br/>\n"; echo __("1 comment unchanged") . " <br/>\n";
@ -151,13 +151,13 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
</li> </li>
<?php <?php
} }
?> ?>
</ol> </ol>
<div id="ajax-response"></div> <div id="ajax-response"></div>
<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments &raquo;') ?>" /></p> <p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments &raquo;') ?>" /></p>
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[
function markAllForDelete() { function markAllForDelete() {
@ -197,10 +197,10 @@ document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark
<input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can&#8217;t be undone.</strong>'); ?></label> <input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can&#8217;t be undone.</strong>'); ?></label>
</p> </p>
</noscript> </noscript>
</form> </form>
<?php <?php
} else { } else {
// nothing to approve // nothing to approve
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n"; echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
} }
?> ?>

View File

@ -7,9 +7,9 @@ $parent_file = 'options-general.php';
include('admin-header.php'); include('admin-header.php');
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Miscellaneous Options') ?></h2> <h2><?php _e('Miscellaneous Options') ?></h2>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field('update-options') ?>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p> <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /></p>
@ -43,10 +43,10 @@ include('admin-header.php');
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" /> <input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /> <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
</p> </p>
</form> </form>
</div> </div>
<?php include('./admin-footer.php'); ?> <?php include('./admin-footer.php'); ?>

View File

@ -144,7 +144,7 @@ $structures = array(
<?php if ( !in_array($permalink_structure, $structures) ) { ?> <?php if ( !in_array($permalink_structure, $structures) ) { ?>
checked="checked" checked="checked"
<?php } ?> <?php } ?>
/> />
<?php _e('Custom, specify below'); ?> <?php _e('Custom, specify below'); ?>
</label> </label>
<br /> <br />

View File

@ -6,30 +6,30 @@ $parent_file = 'options-general.php';
include('./admin-header.php'); include('./admin-header.php');
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Privacy Options') ?></h2> <h2><?php _e('Privacy Options') ?></h2>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?> <?php wp_nonce_field('update-options') ?>
<table class="optiontable"> <table class="optiontable">
<tr valign="top"> <tr valign="top">
<th scope="row"><?php _e('Blog visibility:') ?> </th> <th scope="row"><?php _e('Blog visibility:') ?> </th>
<td> <td>
<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> /> <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
<label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p> <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
<p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> /> <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p> <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
<?php do_action('blog_privacy_selector'); ?> <?php do_action('blog_privacy_selector'); ?>
</td> </td>
</tr> </tr>
</table> </table>
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /> <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="blog_public" /> <input type="hidden" name="page_options" value="blog_public" />
</p> </p>
</form> </form>
</div> </div>
<?php include('./admin-footer.php') ?> <?php include('./admin-footer.php') ?>

View File

@ -65,7 +65,7 @@ endforeach;
<tr valign="top"> <tr valign="top">
<th scope="row"><?php _e('Mail server:') ?></th> <th scope="row"><?php _e('Mail server:') ?></th>
<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" /> <td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
<label for="mailserver_port"><?php _e('Port:') ?></label> <label for="mailserver_port"><?php _e('Port:') ?></label>
<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" /> <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
</td> </td>
</tr> </tr>
@ -113,11 +113,11 @@ endforeach;
</fieldset> </fieldset>
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" /> <input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /> <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
</p> </p>
</form> </form>
</div> </div>
<?php include('./admin-footer.php') ?> <?php include('./admin-footer.php') ?>

View File

@ -61,8 +61,8 @@ default:
<?php if (isset($_GET['a'])) : ?> <?php if (isset($_GET['a'])) : ?>
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?> <?php endif; ?>
<div class="wrap"> <div class="wrap">
<?php <?php
if (is_writeable($real_file)) { if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>'; echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
} else { } else {
@ -75,39 +75,39 @@ default:
<?php <?php
if ($plugin_files) : if ($plugin_files) :
?> ?>
<ul> <ul>
<?php foreach($plugin_files as $plugin_file) : ?> <?php foreach($plugin_files as $plugin_file) : ?>
<li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li> <li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if (!$error) { ?> <?php if (!$error) { ?>
<form name="template" id="template" action="plugin-editor.php" method="post"> <form name="template" id="template" action="plugin-editor.php" method="post">
<?php wp_nonce_field('edit-plugin_' . $file) ?> <?php wp_nonce_field('edit-plugin_' . $file) ?>
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" /> <input type="hidden" name="file" value="<?php echo $file ?>" />
</div> </div>
<?php if ( is_writeable($real_file) ) : ?> <?php if ( is_writeable($real_file) ) : ?>
<p class="submit"> <p class="submit">
<?php <?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />"; echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?> ?>
</p> </p>
<?php else : ?> <?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p> <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?> <?php endif; ?>
</form> </form>
<?php <?php
} else { } else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
} }
?> ?>
<div class="clear"> &nbsp; </div> <div class="clear"> &nbsp; </div>
</div> </div>
<?php <?php
break; break;
} }
include("admin-footer.php") ?> include("admin-footer.php") ?>

View File

@ -15,7 +15,7 @@ case 'post':
$parent_file = 'post-new.php'; $parent_file = 'post-new.php';
$submenu_file = 'post-new.php'; $submenu_file = 'post-new.php';
check_admin_referer('add-post'); check_admin_referer('add-post');
$post_ID = 'post' == $action ? write_post() : edit_post(); $post_ID = 'post' == $action ? write_post() : edit_post();
// Redirect. // Redirect.
@ -89,7 +89,7 @@ case 'editattachment':
case 'editpost': case 'editpost':
$post_ID = (int) $_POST['post_ID']; $post_ID = (int) $_POST['post_ID'];
check_admin_referer('update-post_' . $post_ID); check_admin_referer('update-post_' . $post_ID);
$post_ID = edit_post(); $post_ID = edit_post();
if ( 'post' == $_POST['originalaction'] ) { if ( 'post' == $_POST['originalaction'] ) {

View File

@ -1,4 +1,4 @@
<?php <?php
require_once('admin.php'); require_once('admin.php');
$title = __('Profile'); $title = __('Profile');
@ -121,13 +121,13 @@ if ( $show_password_fields ) :
<br clear="all" /> <br clear="all" />
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform"> <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
<?php <?php
if(count($profileuser->caps) > count($profileuser->roles)): if(count($profileuser->caps) > count($profileuser->roles)):
?> ?>
<tr> <tr>
<th scope="row"><?php _e('Additional Capabilities:') ?></th> <th scope="row"><?php _e('Additional Capabilities:') ?></th>
<td><?php <td><?php
$output = ''; $output = '';
foreach($profileuser->caps as $cap => $value) { foreach($profileuser->caps as $cap => $value) {
if(!$wp_roles->is_role($cap)) { if(!$wp_roles->is_role($cap)) {

View File

@ -2,7 +2,7 @@
define('WP_INSTALLING', true); define('WP_INSTALLING', true);
if (!file_exists('../wp-config-sample.php')) if (!file_exists('../wp-config-sample.php'))
die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
$configFile = file('../wp-config-sample.php'); $configFile = file('../wp-config-sample.php');
@ -82,103 +82,103 @@ if (file_exists('../wp-config.php'))
switch($step) { switch($step) {
case 0: case 0:
?> ?>
<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p> <p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
<ol> <ol>
<li>Database name</li> <li>Database name</li>
<li>Database username</li> <li>Database username</li>
<li>Database password</li> <li>Database password</li>
<li>Database host</li> <li>Database host</li>
<li>Table prefix (if you want to run more than one WordPress in a single database) </li> <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
</ol> </ol>
<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p> <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready, <a href="setup-config.php?step=1">let&#8217;s go</a>! </p> <p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready, <a href="setup-config.php?step=1">let&#8217;s go</a>! </p>
<?php <?php
break; break;
case 1: case 1:
?> ?>
</p> </p>
<form method="post" action="setup-config.php?step=2"> <form method="post" action="setup-config.php?step=2">
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p> <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
<table> <table>
<tr> <tr>
<th scope="row">Database Name</th> <th scope="row">Database Name</th>
<td><input name="dbname" type="text" size="25" value="wordpress" /></td> <td><input name="dbname" type="text" size="25" value="wordpress" /></td>
<td>The name of the database you want to run WP in. </td> <td>The name of the database you want to run WP in. </td>
</tr> </tr>
<tr> <tr>
<th scope="row">User Name</th> <th scope="row">User Name</th>
<td><input name="uname" type="text" size="25" value="username" /></td> <td><input name="uname" type="text" size="25" value="username" /></td>
<td>Your MySQL username</td> <td>Your MySQL username</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Password</th> <th scope="row">Password</th>
<td><input name="pwd" type="text" size="25" value="password" /></td> <td><input name="pwd" type="text" size="25" value="password" /></td>
<td>...and MySQL password.</td> <td>...and MySQL password.</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Database Host</th> <th scope="row">Database Host</th>
<td><input name="dbhost" type="text" size="25" value="localhost" /></td> <td><input name="dbhost" type="text" size="25" value="localhost" /></td>
<td>99% chance you won't need to change this value.</td> <td>99% chance you won't need to change this value.</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Table Prefix</th> <th scope="row">Table Prefix</th>
<td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td> <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
<td>If you want to run multiple WordPress installations in a single database, change this.</td> <td>If you want to run multiple WordPress installations in a single database, change this.</td>
</tr> </tr>
</table> </table>
<h2 class="step"> <h2 class="step">
<input name="submit" type="submit" value="Submit" /> <input name="submit" type="submit" value="Submit" />
</h2> </h2>
</form> </form>
<?php <?php
break; break;
case 2: case 2:
$dbname = trim($_POST['dbname']); $dbname = trim($_POST['dbname']);
$uname = trim($_POST['uname']); $uname = trim($_POST['uname']);
$passwrd = trim($_POST['pwd']); $passwrd = trim($_POST['pwd']);
$dbhost = trim($_POST['dbhost']); $dbhost = trim($_POST['dbhost']);
$prefix = trim($_POST['prefix']); $prefix = trim($_POST['prefix']);
if (empty($prefix)) $prefix = 'wp_'; if (empty($prefix)) $prefix = 'wp_';
// Test the db connection. // Test the db connection.
define('DB_NAME', $dbname); define('DB_NAME', $dbname);
define('DB_USER', $uname); define('DB_USER', $uname);
define('DB_PASSWORD', $passwrd); define('DB_PASSWORD', $passwrd);
define('DB_HOST', $dbhost); define('DB_HOST', $dbhost);
// We'll fail here if the values are no good. // We'll fail here if the values are no good.
require_once('../wp-includes/wp-db.php'); require_once('../wp-includes/wp-db.php');
$handle = fopen('../wp-config.php', 'w'); $handle = fopen('../wp-config.php', 'w');
foreach ($configFile as $line_num => $line) { foreach ($configFile as $line_num => $line) {
switch (substr($line,0,16)) { switch (substr($line,0,16)) {
case "define('DB_NAME'": case "define('DB_NAME'":
fwrite($handle, str_replace("wordpress", $dbname, $line)); fwrite($handle, str_replace("wordpress", $dbname, $line));
break; break;
case "define('DB_USER'": case "define('DB_USER'":
fwrite($handle, str_replace("'username'", "'$uname'", $line)); fwrite($handle, str_replace("'username'", "'$uname'", $line));
break; break;
case "define('DB_PASSW": case "define('DB_PASSW":
fwrite($handle, str_replace("'password'", "'$passwrd'", $line)); fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
break; break;
case "define('DB_HOST'": case "define('DB_HOST'":
fwrite($handle, str_replace("localhost", $dbhost, $line)); fwrite($handle, str_replace("localhost", $dbhost, $line));
break; break;
case '$table_prefix =': case '$table_prefix =':
fwrite($handle, str_replace('wp_', $prefix, $line)); fwrite($handle, str_replace('wp_', $prefix, $line));
break; break;
default: default:
fwrite($handle, $line); fwrite($handle, $line);
} }
} }
fclose($handle); fclose($handle);
chmod('../wp-config.php', 0666); chmod('../wp-config.php', 0666);
?> ?>
<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p> <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
<?php <?php
break; break;
} }

View File

@ -34,15 +34,15 @@ form {
padding: 3px; padding: 3px;
} }
.sidebar-categories { .sidebar-categories {
display: block; display: block;
height: 6.6em; height: 6.6em;
overflow: auto; overflow: auto;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
.sidebar-categories label { .sidebar-categories label {
font-size: 10px; font-size: 10px;
display: block; display: block;
width: 90%; width: 90%;
} }
</style> </style>
</head> </head>
@ -65,9 +65,9 @@ Post:
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea> <textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
</p> </p>
<p> <p>
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" /> <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
<?php if ( current_user_can('publish_posts') ) : ?> <?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" /> <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
<?php endif; ?> <?php endif; ?>
</p> </p>
</div> </div>

View File

@ -82,7 +82,7 @@ default:
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<div class="wrap"> <div class="wrap">
<?php <?php
if (is_writeable($real_file)) { if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), wp_specialchars($file) ) . '</h2>'; echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), wp_specialchars($file) ) . '</h2>';
@ -91,8 +91,8 @@ if (is_writeable($real_file)) {
} }
?> ?>
<div id="templateside"> <div id="templateside">
<?php <?php
if ( $recents ) : if ( $recents ) :
?> ?>
<h3><?php _e('Recent'); ?></h3> <h3><?php _e('Recent'); ?></h3>
<?php <?php
@ -110,21 +110,21 @@ endif;
if (file_exists(ABSPATH . $old_file)) if (file_exists(ABSPATH . $old_file))
$common_files[] = $old_file; $common_files[] = $old_file;
} ?> } ?>
<ul> <ul>
<?php foreach ($common_files as $common_file) : ?> <?php foreach ($common_files as $common_file) : ?>
<li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li> <li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
</div> </div>
<?php if (!$error) { ?> <?php if (!$error) { ?>
<form name="template" id="template" action="templates.php" method="post"> <form name="template" id="template" action="templates.php" method="post">
<?php wp_nonce_field('edit-file_' . $file) ?> <?php wp_nonce_field('edit-file_' . $file) ?>
<div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea> <div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" /> <input type="hidden" name="file" value="<?php echo $file ?>" />
</div> </div>
<?php if ( is_writeable($real_file) ) : ?> <?php if ( is_writeable($real_file) ) : ?>
<p class="submit"> <p class="submit">
<?php <?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />"; echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?> ?>
@ -132,8 +132,8 @@ endif;
<?php else : ?> <?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p> <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?> <?php endif; ?>
</form> </form>
<?php <?php
} else { } else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
} }
@ -143,14 +143,14 @@ endif;
<div class="wrap"> <div class="wrap">
<h2><?php _e('Other Files') ?></h2> <h2><?php _e('Other Files') ?></h2>
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p> <p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
<form name="file" action="templates.php" method="get"> <form name="file" action="templates.php" method="get">
<input type="text" name="file" /> <input type="text" name="file" />
<input type="submit" name="submit" value="<?php _e('Edit file &raquo;') ?>" /> <input type="submit" name="submit" value="<?php _e('Edit file &raquo;') ?>" />
</form> </form>
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p> <p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p>
</div> </div>
<?php <?php
break; break;

View File

@ -80,7 +80,7 @@ default:
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?> <?php endif; ?>
<div class="wrap"> <div class="wrap">
<form name="theme" action="theme-editor.php" method="post"> <form name="theme" action="theme-editor.php" method="post">
<?php _e('Select theme to edit:') ?> <?php _e('Select theme to edit:') ?>
<select name="theme" id="theme"> <select name="theme" id="theme">
<?php <?php
@ -106,30 +106,30 @@ default:
} }
?> ?>
<div id="templateside"> <div id="templateside">
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3> <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
<?php <?php
if ($allowed_files) : if ($allowed_files) :
?> ?>
<ul> <ul>
<?php foreach($allowed_files as $allowed_file) : ?> <?php foreach($allowed_files as $allowed_file) : ?>
<li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li> <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php <?php
if (!$error) { if (!$error) {
?> ?>
<form name="template" id="template" action="theme-editor.php" method="post"> <form name="template" id="template" action="theme-editor.php" method="post">
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?> <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" /> <input type="hidden" name="file" value="<?php echo $file ?>" />
<input type="hidden" name="theme" value="<?php echo $theme ?>" /> <input type="hidden" name="theme" value="<?php echo $theme ?>" />
</div> </div>
<?php if ( is_writeable($real_file) ) : ?> <?php if ( is_writeable($real_file) ) : ?>
<p class="submit"> <p class="submit">
<?php <?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />"; echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?> ?>
@ -137,16 +137,16 @@ if ($allowed_files) :
<?php else : ?> <?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p> <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?> <?php endif; ?>
</form> </form>
<?php <?php
} else { } else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
} }
?> ?>
<div class="clear"> &nbsp; </div> <div class="clear"> &nbsp; </div>
</div> </div>
<?php <?php
break; break;
} }
include("admin-footer.php") ?> include("admin-footer.php") ?>

View File

@ -112,10 +112,10 @@ if ( count($broken_themes) ) {
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"'; $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
echo " echo "
<tr $theme> <tr $theme>
<td>$title</td> <td>$title</td>
<td>$description</td> <td>$description</td>
</tr>"; </tr>";
} }
?> ?>
</table> </table>

View File

@ -28,13 +28,13 @@ if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5)
while ( !feof($fs) ) while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet $response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs); fclose($fs);
$response = explode("\r\n\r\n", $response, 2); $response = explode("\r\n\r\n", $response, 2);
$body = trim( $response[1] ); $body = trim( $response[1] );
$body = str_replace(array("\r\n", "\r"), "\n", $body); $body = str_replace(array("\r\n", "\r"), "\n", $body);
$returns = explode("\n", $body); $returns = explode("\n", $body);
foreach ($returns as $return) : foreach ($returns as $return) :
$time = $wpdb->escape( substr($return, 0, 19) ); $time = $wpdb->escape( substr($return, 0, 19) );
$uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) ); $uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );

View File

@ -120,7 +120,7 @@ We hope you enjoy your new weblog. Thanks!
http://wordpress.org/ http://wordpress.org/
"), $blog_url, $name, $password); "), $blog_url, $name, $password);
@wp_mail($email, __('New WordPress Blog'), $message, $message_headers); @wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
} }
endif; endif;
@ -137,7 +137,7 @@ function wp_upgrade() {
wp_cache_flush(); wp_cache_flush();
make_db_current_silent(); make_db_current_silent();
upgrade_all(); upgrade_all();
wp_cache_flush(); wp_cache_flush();
} }
endif; endif;
@ -187,7 +187,7 @@ function upgrade_100() {
$posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''"); $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
if ($posts) { if ($posts) {
foreach($posts as $post) { foreach($posts as $post) {
if ('' == $post->post_name) { if ('' == $post->post_name) {
$newtitle = sanitize_title($post->post_title); $newtitle = sanitize_title($post->post_title);
$wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'"); $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
} }
@ -196,7 +196,7 @@ function upgrade_100() {
$categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories"); $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
foreach ($categories as $category) { foreach ($categories as $category) {
if ('' == $category->category_nicename) { if ('' == $category->category_nicename) {
$newtitle = sanitize_title($category->cat_name); $newtitle = sanitize_title($category->cat_name);
$wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'"); $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
} }
@ -251,19 +251,19 @@ function upgrade_101() {
function upgrade_110() { function upgrade_110() {
global $wpdb; global $wpdb;
// Set user_nicename. // Set user_nicename.
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
foreach ($users as $user) { foreach ($users as $user) {
if ('' == $user->user_nicename) { if ('' == $user->user_nicename) {
$newname = sanitize_title($user->user_nickname); $newname = sanitize_title($user->user_nickname);
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'"); $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
} }
} }
$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users"); $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
foreach ($users as $row) { foreach ($users as $row) {
if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) { if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
$wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\''); $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
} }
} }
@ -305,57 +305,57 @@ function upgrade_110() {
} }
function upgrade_130() { function upgrade_130() {
global $wpdb; global $wpdb;
// Remove extraneous backslashes. // Remove extraneous backslashes.
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts"); $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
if ($posts) { if ($posts) {
foreach($posts as $post) { foreach($posts as $post) {
$post_content = addslashes(deslash($post->post_content)); $post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title)); $post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt)); $post_excerpt = addslashes(deslash($post->post_excerpt));
if ( empty($post->guid) ) if ( empty($post->guid) )
$guid = get_permalink($post->ID); $guid = get_permalink($post->ID);
else else
$guid = $post->guid; $guid = $post->guid;
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'"); $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
} }
} }
// Remove extraneous backslashes. // Remove extraneous backslashes.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments"); $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
if ($comments) { if ($comments) {
foreach($comments as $comment) { foreach($comments as $comment) {
$comment_content = addslashes(deslash($comment->comment_content)); $comment_content = addslashes(deslash($comment->comment_content));
$comment_author = addslashes(deslash($comment->comment_author)); $comment_author = addslashes(deslash($comment->comment_author));
$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'"); $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
} }
} }
// Remove extraneous backslashes. // Remove extraneous backslashes.
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links"); $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
if ($links) { if ($links) {
foreach($links as $link) { foreach($links as $link) {
$link_name = addslashes(deslash($link->link_name)); $link_name = addslashes(deslash($link->link_name));
$link_description = addslashes(deslash($link->link_description)); $link_description = addslashes(deslash($link->link_description));
$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'"); $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
} }
} }
// The "paged" option for what_to_show is no more. // The "paged" option for what_to_show is no more.
if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') { if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'"); $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
} }
$active_plugins = __get_option('active_plugins'); $active_plugins = __get_option('active_plugins');
// If plugins are not stored in an array, they're stored in the old // If plugins are not stored in an array, they're stored in the old
// newline separated format. Convert to new format. // newline separated format. Convert to new format.
if ( !is_array( $active_plugins ) ) { if ( !is_array( $active_plugins ) ) {
$active_plugins = explode("\n", trim($active_plugins)); $active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins); update_option('active_plugins', $active_plugins);
} }
// Obsolete tables // Obsolete tables
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues'); $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
@ -499,7 +499,7 @@ function upgrade_210() {
// Give future posts a post_status of future. // Give future posts a post_status of future.
$now = gmdate('Y-m-d H:i:59'); $now = gmdate('Y-m-d H:i:59');
$wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'"); $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'"); $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
if ( !empty($posts) ) if ( !empty($posts) )
foreach ( $posts as $post ) foreach ( $posts as $post )
@ -508,7 +508,7 @@ function upgrade_210() {
if ( $wp_current_db_version < 3570 ) { if ( $wp_current_db_version < 3570 ) {
// Create categories for link categories if a category with the same // Create categories for link categories if a category with the same
// name doesn't exist. Create a map of link cat IDs to cat IDs. // name doesn't exist. Create a map of link cat IDs to cat IDs.
$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories"); $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
foreach ( $link_cats as $link_cat) { foreach ( $link_cats as $link_cat) {
if ( $cat_id = category_exists($link_cat->cat_name) ) { if ( $cat_id = category_exists($link_cat->cat_name) ) {
$link_cat_id_map[$link_cat->cat_id] = $cat_id; $link_cat_id_map[$link_cat->cat_id] = $cat_id;
@ -527,9 +527,9 @@ function upgrade_210() {
if (!$cat && 0 != $link->link_category) { if (!$cat && 0 != $link->link_category) {
$wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id) $wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ('$link->link_id', '$link_cat')"); VALUES ('$link->link_id', '$link_cat')");
} }
} }
// Set default to the last category we grabbed during the upgrade loop. // Set default to the last category we grabbed during the upgrade loop.
update_option('default_link_category', $default_link_cat); update_option('default_link_category', $default_link_cat);
@ -548,21 +548,21 @@ function upgrade_210() {
// General // General
function maybe_create_table($table_name, $create_ddl) { function maybe_create_table($table_name, $create_ddl) {
global $wpdb; global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) { if ($table == $table_name) {
return true; return true;
} }
} }
//didn't find it try to create it. //didn't find it try to create it.
$q = $wpdb->query($create_ddl); $q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded! // we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) { if ($table == $table_name) {
return true; return true;
} }
} }
return false; return false;
} }
function drop_index($table, $index) { function drop_index($table, $index) {
@ -591,22 +591,22 @@ function add_clean_index($table, $index) {
** false on error ** false on error
*/ */
function maybe_add_column($table_name, $column_name, $create_ddl) { function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug; global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />"); if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) { if ($column == $column_name) {
return true; return true;
} }
} }
//didn't find it try to create it. //didn't find it try to create it.
$q = $wpdb->query($create_ddl); $q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded! // we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) { if ($column == $column_name) {
return true; return true;
} }
} }
return false; return false;
} }
@ -615,7 +615,7 @@ function get_alloptions_110() {
global $wpdb; global $wpdb;
if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) { if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
foreach ($options as $option) { foreach ($options as $option) {
// "When trying to design a foolproof system, // "When trying to design a foolproof system,
// never underestimate the ingenuity of the fools :)" -- Dougal // never underestimate the ingenuity of the fools :)" -- Dougal
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
@ -646,20 +646,20 @@ function __get_option($setting) {
} }
function deslash($content) { function deslash($content) {
// Note: \\\ inside a regex denotes a single backslash. // Note: \\\ inside a regex denotes a single backslash.
// Replace one or more backslashes followed by a single quote with // Replace one or more backslashes followed by a single quote with
// a single quote. // a single quote.
$content = preg_replace("/\\\+'/", "'", $content); $content = preg_replace("/\\\+'/", "'", $content);
// Replace one or more backslashes followed by a double quote with // Replace one or more backslashes followed by a double quote with
// a double quote. // a double quote.
$content = preg_replace('/\\\+"/', '"', $content); $content = preg_replace('/\\\+"/', '"', $content);
// Replace one or more backslashes with one backslash. // Replace one or more backslashes with one backslash.
$content = preg_replace("/\\\+/", "\\", $content); $content = preg_replace("/\\\+/", "\\", $content);
return $content; return $content;
} }
function dbDelta($queries, $execute = true) { function dbDelta($queries, $execute = true) {
@ -826,7 +826,7 @@ function dbDelta($queries, $execute = true) {
$index_columns .= '('.$column_data['subpart'].')'; $index_columns .= '('.$column_data['subpart'].')';
} }
} }
// Add the column list to the index create string // Add the column list to the index create string
$index_string .= ' ('.$index_columns.')'; $index_string .= ' ('.$index_columns.')';
if(!(($aindex = array_search($index_string, $indices)) === false)) { if(!(($aindex = array_search($index_string, $indices)) === false)) {

View File

@ -223,7 +223,7 @@ function populate_options() {
add_option('uploads_use_yearmonth_folders', 1); add_option('uploads_use_yearmonth_folders', 1);
add_option('upload_path', 'wp-content/uploads'); add_option('upload_path', 'wp-content/uploads');
} }
// 2.0.3 // 2.0.3
add_option('secret', md5(uniqid(microtime()))); add_option('secret', md5(uniqid(microtime())));

View File

@ -56,6 +56,6 @@ switch($step) {
<?php <?php
break; break;
} }
?> ?>
</body> </body>
</html> </html>

View File

@ -186,13 +186,13 @@ if ( $show_password_fields ) :
<?php do_action('edit_user_profile'); ?> <?php do_action('edit_user_profile'); ?>
<br clear="all" /> <br clear="all" />
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform"> <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
<?php <?php
if(count($profileuser->caps) > count($profileuser->roles)): if(count($profileuser->caps) > count($profileuser->roles)):
?> ?>
<tr> <tr>
<th scope="row"><?php _e('Additional Capabilities:') ?></th> <th scope="row"><?php _e('Additional Capabilities:') ?></th>
<td><?php <td><?php
$output = ''; $output = '';
foreach($profileuser->caps as $cap => $value) { foreach($profileuser->caps as $cap => $value) {
if(!$wp_roles->is_role($cap)) { if(!$wp_roles->is_role($cap)) {
@ -202,15 +202,15 @@ if ( $show_password_fields ) :
} }
echo $output; echo $output;
?></td> ?></td>
</tr> </tr>
<?php <?php
endif; endif;
?> ?>
</table> </table>
<p class="submit"> <p class="submit">
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" /> <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
<input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" /> <input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" />
</p> </p>
</form> </form>
</div> </div>

View File

@ -283,7 +283,7 @@ form#upload #post_content {
} }
.commentlist li { .commentlist li {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
padding: 1em 1em .2em; padding: 1em 1em .2em;
margin: 0; margin: 0;
} }
@ -954,8 +954,8 @@ input.delete:hover {
} }
/* A handy div class for hiding controls. /* A handy div class for hiding controls.
Some browsers will disable them when you Some browsers will disable them when you
set display:none; */ set display:none; */
.zerosize { .zerosize {
height: 0px; height: 0px;
width: 0px; width: 0px;
@ -995,9 +995,9 @@ input.delete:hover {
} }
/**************************************************************** /****************************************************************
avoid padding, margins or borders on dbx-box, avoid padding, margins or borders on dbx-box,
to reduce visual discrepancies between it and the clone. to reduce visual discrepancies between it and the clone.
overall, dbx-box is best left as visually unstyled as possible overall, dbx-box is best left as visually unstyled as possible
*****************************************************************/ *****************************************************************/
.dbx-box { .dbx-box {
margin:0; margin:0;

View File

@ -10,10 +10,10 @@ function GetElementsWithClassName(elementName, className) {
} }
function meChecked() { function meChecked() {
var undefined; var undefined;
var eMe = document.getElementById('me'); var eMe = document.getElementById('me');
if (eMe == undefined) return false; if (eMe == undefined) return false;
else return eMe.checked; else return eMe.checked;
} }
function upit() { function upit() {

View File

@ -11,11 +11,11 @@ $more = 1;
?> ?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<feed version="0.3" <feed version="0.3"
xmlns="http://purl.org/atom/ns#" xmlns="http://purl.org/atom/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="<?php echo get_option('rss_language'); ?>" xml:lang="<?php echo get_option('rss_language'); ?>"
<?php do_action('atom_ns'); ?> <?php do_action('atom_ns'); ?>
> >
<title><?php bloginfo_rss('name') ?></title> <title><?php bloginfo_rss('name') ?></title>
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
<tagline><?php bloginfo_rss("description") ?></tagline> <tagline><?php bloginfo_rss("description") ?></tagline>
@ -25,7 +25,7 @@ $more = 1;
<?php do_action('atom_head'); ?> <?php do_action('atom_head'); ?>
<?php while (have_posts()) : the_post(); ?> <?php while (have_posts()) : the_post(); ?>
<entry> <entry>
<author> <author>
<name><?php the_author() ?></name> <name><?php the_author() ?></name>
</author> </author>
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title> <title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
@ -33,7 +33,7 @@ $more = 1;
<id><?php the_guid(); ?></id> <id><?php the_guid(); ?></id>
<modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified> <modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
<issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued> <issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
<?php the_category_rss('rdf') ?> <?php the_category_rss('rdf') ?>
<summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> <summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
<?php if ( !get_option('rss_use_excerpt') ) : ?> <?php if ( !get_option('rss_use_excerpt') ) : ?>
<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content> <content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>

View File

@ -1,4 +1,4 @@
<?php <?php
if (empty($wp)) { if (empty($wp)) {
require_once('wp-config.php'); require_once('wp-config.php');
@ -64,7 +64,7 @@ if (have_posts()) :
<author><?php echo get_comment_author_rss() ?></author> <author><?php echo get_comment_author_rss() ?></author>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
<guid><?php comment_link() ?></guid> <guid><?php comment_link() ?></guid>
<?php <?php
if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
?> ?>
<description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description> <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
@ -74,12 +74,12 @@ if (have_posts()) :
?> ?>
<description><?php comment_text_rss() ?></description> <description><?php comment_text_rss() ?></description>
<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded> <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
<?php <?php
} // close check for password } // close check for password
?> ?>
</item> </item>
<?php <?php
} }
} }
} }
endwhile; endif; endwhile; endif;

View File

@ -1,4 +1,4 @@
<?php <?php
/* Don't remove these lines. */ /* Don't remove these lines. */
add_filter('comment_text', 'popuplinks'); add_filter('comment_text', 'popuplinks');
while( have_posts()) : the_post(); while( have_posts()) : the_post();
@ -97,7 +97,7 @@ endwhile;
?> ?>
<!-- // this is just the end of the motor - don't touch that line either :) --> <!-- // this is just the end of the motor - don't touch that line either :) -->
<?php //} ?> <?php //} ?>
<p class="credit"><?php timer_stop(1); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>Wordpress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p> <p class="credit"><?php timer_stop(1); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>Wordpress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p>
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -2,7 +2,7 @@
<p><?php _e('Enter your password to view comments.'); ?></p> <p><?php _e('Enter your password to view comments.'); ?></p>
<?php return; endif; ?> <?php return; endif; ?>
<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?> <h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>
<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a> <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
<?php endif; ?> <?php endif; ?>
@ -25,7 +25,7 @@
<p><?php _e('No comments yet.'); ?></p> <p><?php _e('No comments yet.'); ?></p>
<?php endif; ?> <?php endif; ?>
<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?> <p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
<?php if ( pings_open() ) : ?> <?php if ( pings_open() ) : ?>
<a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a> <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a>
<?php endif; ?> <?php endif; ?>

View File

@ -17,7 +17,7 @@
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?> <?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?> <?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?> <?php wp_head(); ?>
</head> </head>

View File

@ -1,4 +1,4 @@
<?php <?php
get_header(); get_header();
?> ?>
@ -15,8 +15,8 @@ get_header();
</div> </div>
<div class="feedback"> <div class="feedback">
<?php wp_link_pages(); ?> <?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?> <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
</div> </div>
</div> </div>

View File

@ -16,12 +16,12 @@
</form> </form>
</li> </li>
<li id="archives"><?php _e('Archives:'); ?> <li id="archives"><?php _e('Archives:'); ?>
<ul> <ul>
<?php wp_get_archives('type=monthly'); ?> <?php wp_get_archives('type=monthly'); ?>
</ul> </ul>
</li> </li>
<li id="meta"><?php _e('Meta:'); ?> <li id="meta"><?php _e('Meta:'); ?>
<ul> <ul>
<?php wp_register(); ?> <?php wp_register(); ?>
<li><?php wp_loginout(); ?></li> <li><?php wp_loginout(); ?></li>
<li><a href="feed:<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> <li><a href="feed:<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>

View File

@ -40,7 +40,7 @@
<?php the_content() ?> <?php the_content() ?>
</div> </div>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div> </div>

View File

@ -11,14 +11,14 @@ Template Name: Archives
<?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php include (TEMPLATEPATH . '/searchform.php'); ?>
<h2>Archives by Month:</h2> <h2>Archives by Month:</h2>
<ul> <ul>
<?php wp_get_archives('type=monthly'); ?> <?php wp_get_archives('type=monthly'); ?>
</ul> </ul>
<h2>Archives by Subject:</h2> <h2>Archives by Subject:</h2>
<ul> <ul>
<?php wp_list_categories(); ?> <?php wp_list_categories(); ?>
</ul> </ul>
</div> </div>

View File

@ -1,4 +1,4 @@
<?php <?php
/* Don't remove these lines. */ /* Don't remove these lines. */
add_filter('comment_text', 'popuplinks'); add_filter('comment_text', 'popuplinks');
while ( have_posts()) : the_post(); while ( have_posts()) : the_post();
@ -97,7 +97,7 @@ endwhile;
?> ?>
<!-- // this is just the end of the motor - don't touch that line either :) --> <!-- // this is just the end of the motor - don't touch that line either :) -->
<?php //} ?> <?php //} ?>
<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p> <p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p>
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -2,25 +2,25 @@
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!'); die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?> ?>
<p class="nocomments">This post is password protected. Enter the password to view comments.<p> <p class="nocomments">This post is password protected. Enter the password to view comments.<p>
<?php <?php
return; return;
} }
} }
/* This variable is for alternating comment background */ /* This variable is for alternating comment background */
$oddcomment = 'alt'; $oddcomment = 'alt';
?> ?>
<!-- You can start editing here. --> <!-- You can start editing here. -->
<?php if ($comments) : ?> <?php if ($comments) : ?>
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3> <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
<ol class="commentlist"> <ol class="commentlist">
@ -50,7 +50,7 @@
<?php else : // this is displayed if there are no comments so far ?> <?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?> <?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. --> <!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?> <?php else : // comments are closed ?>

View File

@ -3,7 +3,7 @@
<div id="footer"> <div id="footer">
<!-- If you'd like to support WordPress, having the "powered by" link someone on your blog is the best way, it's our only promotion or advertising. --> <!-- If you'd like to support WordPress, having the "powered by" link someone on your blog is the best way, it's our only promotion or advertising. -->
<p> <p>
<?php bloginfo('name'); ?> is proudly powered by <?php bloginfo('name'); ?> is proudly powered by
<a href="http://wordpress.org/">WordPress</a> <a href="http://wordpress.org/">WordPress</a>
<br /><a href="feed:<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> <br /><a href="feed:<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a>
and <a href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>. and <a href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>.

View File

@ -14,13 +14,13 @@
<style type="text/css" media="screen"> <style type="text/css" media="screen">
<?php <?php
// Checks to see whether it needs a sidebar or not // Checks to see whether it needs a sidebar or not
if ( !$withcomments && !is_single() ) { if ( !$withcomments && !is_single() ) {
?> ?>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
<?php } else { // No sidebar ?> <?php } else { // No sidebar ?>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
<?php } ?> <?php } ?>
</style> </style>

View File

@ -2,7 +2,7 @@
<div id="content" class="narrowcolumn"> <div id="content" class="narrowcolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>"> <div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2> <h2><?php the_title(); ?></h2>
<div class="entry"> <div class="entry">
@ -12,7 +12,7 @@
</div> </div>
</div> </div>
<?php endwhile; endif; ?> <?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div> </div>

View File

@ -24,11 +24,11 @@
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <?php the_time('F, Y'); ?>.</p> for <?php the_time('F, Y'); ?>.</p>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the year <?php the_time('Y'); ?>.</p> for the year <?php the_time('Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?> <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>

View File

@ -2,7 +2,7 @@
<div id="content" class="widecolumn"> <div id="content" class="widecolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="navigation"> <div class="navigation">
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div> <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
@ -23,10 +23,10 @@
<?php /* This is commented, because it requires a little adjusting sometimes. <?php /* This is commented, because it requires a little adjusting sometimes.
You'll need to download this plugin, and follow the instructions: You'll need to download this plugin, and follow the instructions:
http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */ http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?> /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>. and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?> // Both Comments and Pings are open ?>

View File

@ -1,8 +1,8 @@
<?php <?php
if (empty($doing_rss)) { if (empty($doing_rss)) {
$doing_rss = 1; $doing_rss = 1;
require(dirname(__FILE__) . '/wp-blog-header.php'); require(dirname(__FILE__) . '/wp-blog-header.php');
} }
do_feed(); do_feed();

View File

@ -146,7 +146,7 @@ function get_links($category = -1,
} }
function get_linkrating($link) { function get_linkrating($link) {
return apply_filters('link_rating', $link->link_rating); return apply_filters('link_rating', $link->link_rating);
} }
/** function get_linkcatname() /** function get_linkcatname()

View File

@ -19,7 +19,7 @@ function get_bookmark($bookmark_id, $output = OBJECT) {
// Deprecate // Deprecate
function get_link($bookmark_id, $output = OBJECT) { function get_link($bookmark_id, $output = OBJECT) {
return get_bookmark($bookmark_id, $output); return get_bookmark($bookmark_id, $output);
} }
function get_bookmarks($args = '') { function get_bookmarks($args = '') {
@ -50,7 +50,7 @@ function get_bookmarks($args = '') {
} }
} }
} }
if (!empty($inclusions)) if (!empty($inclusions))
$inclusions .= ')'; $inclusions .= ')';
$exclusions = ''; $exclusions = '';
@ -65,9 +65,9 @@ function get_bookmarks($args = '') {
} }
} }
} }
if (!empty($exclusions)) if (!empty($exclusions))
$exclusions .= ')'; $exclusions .= ')';
if ( ! empty($category_name) ) { if ( ! empty($category_name) ) {
if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") ) if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
$category = $cat_id; $category = $cat_id;
@ -87,7 +87,7 @@ function get_bookmarks($args = '') {
} }
} }
if (!empty($category_query)) { if (!empty($category_query)) {
$category_query .= ')'; $category_query .= ')';
$join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) "; $join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) ";
} }

View File

@ -65,7 +65,7 @@ class WP_Object_Cache {
var $secret = ''; var $secret = '';
function acquire_lock() { function acquire_lock() {
// Acquire a write lock. // Acquire a write lock.
$this->mutex = @fopen($this->cache_dir.$this->flock_filename, 'w'); $this->mutex = @fopen($this->cache_dir.$this->flock_filename, 'w');
if ( false == $this->mutex) if ( false == $this->mutex)
return false; return false;
@ -237,11 +237,11 @@ class WP_Object_Cache {
while ($index < count($stack)) { while ($index < count($stack)) {
# Get indexed directory from stack # Get indexed directory from stack
$dir = $stack[$index]; $dir = $stack[$index];
$dh = @ opendir($dir); $dh = @ opendir($dir);
if (!$dh) if (!$dh)
return false; return false;
while (($file = @ readdir($dh)) !== false) { while (($file = @ readdir($dh)) !== false) {
if ($file == '.' or $file == '..') if ($file == '.' or $file == '..')
continue; continue;

View File

@ -221,18 +221,18 @@ class WP_User {
} }
function level_reduction($max, $item) { function level_reduction($max, $item) {
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) { if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
$level = intval($matches[1]); $level = intval($matches[1]);
return max($max, $level); return max($max, $level);
} else { } else {
return $max; return $max;
} }
} }
function update_user_level_from_caps() { function update_user_level_from_caps() {
global $wpdb; global $wpdb;
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); $this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level); update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
} }
function add_cap($cap, $grant = true) { function add_cap($cap, $grant = true) {
@ -298,7 +298,7 @@ function map_meta_cap($cap, $user_id) {
$post = get_post($args[0]); $post = get_post($args[0]);
if ( 'page' == $post->post_type ) { if ( 'page' == $post->post_type ) {
$args = array_merge(array('delete_page', $user_id), $args); $args = array_merge(array('delete_page', $user_id), $args);
return call_user_func_array('map_meta_cap', $args); return call_user_func_array('map_meta_cap', $args);
} }
$post_author_data = get_userdata($post->post_author); $post_author_data = get_userdata($post->post_author);
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>"; //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
@ -352,7 +352,7 @@ function map_meta_cap($cap, $user_id) {
$post = get_post($args[0]); $post = get_post($args[0]);
if ( 'page' == $post->post_type ) { if ( 'page' == $post->post_type ) {
$args = array_merge(array('edit_page', $user_id), $args); $args = array_merge(array('edit_page', $user_id), $args);
return call_user_func_array('map_meta_cap', $args); return call_user_func_array('map_meta_cap', $args);
} }
$post_author_data = get_userdata($post->post_author); $post_author_data = get_userdata($post->post_author);
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>"; //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
@ -402,7 +402,7 @@ function map_meta_cap($cap, $user_id) {
$post = get_post($args[0]); $post = get_post($args[0]);
if ( 'page' == $post->post_type ) { if ( 'page' == $post->post_type ) {
$args = array_merge(array('read_page', $user_id), $args); $args = array_merge(array('read_page', $user_id), $args);
return call_user_func_array('map_meta_cap', $args); return call_user_func_array('map_meta_cap', $args);
} }
if ( 'private' != $post->post_status ) { if ( 'private' != $post->post_status ) {

View File

@ -187,8 +187,8 @@ function wp_dropdown_categories($args = '') {
$output .= "\t<option value='0'>$show_option_all</option>\n"; $output .= "\t<option value='0'>$show_option_all</option>\n";
} }
if ( $show_option_none) { if ( $show_option_none) {
$show_option_none = apply_filters('list_cats', $show_option_none); $show_option_none = apply_filters('list_cats', $show_option_none);
$output .= "\t<option value='-1'>$show_option_none</option>\n"; $output .= "\t<option value='-1'>$show_option_none</option>\n";
} }
@ -226,7 +226,7 @@ function wp_list_categories($args = '') {
extract($r); extract($r);
$categories = get_categories($r); $categories = get_categories($r);
$output = ''; $output = '';
if ( $title_li && 'list' == $style ) if ( $title_li && 'list' == $style )
$output = '<li class="categories">' . $r['title_li'] . '<ul>'; $output = '<li class="categories">' . $r['title_li'] . '<ul>';
@ -249,7 +249,7 @@ function wp_list_categories($args = '') {
if ( $title_li && 'list' == $style ) if ( $title_li && 'list' == $style )
$output .= '</ul></li>'; $output .= '</ul></li>';
echo apply_filters('list_cats', $output); echo apply_filters('list_cats', $output);
} }

View File

@ -12,7 +12,7 @@ class WP {
var $matched_rule; var $matched_rule;
var $matched_query; var $matched_query;
var $did_permalink = false; var $did_permalink = false;
function add_query_var($qv) { function add_query_var($qv) {
$this->public_query_vars[] = $qv; $this->public_query_vars[] = $qv;
} }
@ -96,7 +96,7 @@ class WP {
preg_match("!^$match!", urldecode($request_match), $matches)) { preg_match("!^$match!", urldecode($request_match), $matches)) {
// Got a match. // Got a match.
$this->matched_rule = $match; $this->matched_rule = $match;
// Trim the query of everything up to the '?'. // Trim the query of everything up to the '?'.
$query = preg_replace("!^.+\?!", '', $query); $query = preg_replace("!^.+\?!", '', $query);
@ -190,14 +190,14 @@ class WP {
) )
) )
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT'; $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
else else
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
$wp_etag = '"' . md5($wp_last_modified) . '"'; $wp_etag = '"' . md5($wp_last_modified) . '"';
@header("Last-Modified: $wp_last_modified"); @header("Last-Modified: $wp_last_modified");
@header("ETag: $wp_etag"); @header("ETag: $wp_etag");
// Support for Conditional GET // Support for Conditional GET
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
$client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
else $client_etag = false; else $client_etag = false;
@ -321,7 +321,7 @@ class WP_Error {
if ( empty($codes) ) if ( empty($codes) )
return ''; return '';
return $codes[0]; return $codes[0];
} }
function get_error_messages($code = '') { function get_error_messages($code = '') {
@ -337,7 +337,7 @@ class WP_Error {
if ( isset($this->errors[$code]) ) if ( isset($this->errors[$code]) )
return $this->errors[$code]; return $this->errors[$code];
else else
return array(); return array();
} }
function get_error_message($code = '') { function get_error_message($code = '') {
@ -381,29 +381,29 @@ function is_wp_error($thing) {
// A class for displaying various tree-like structures. Extend the Walker class to use it, see examples at the bottom // A class for displaying various tree-like structures. Extend the Walker class to use it, see examples at the bottom
class Walker { class Walker {
var $tree_type; var $tree_type;
var $db_fields; var $db_fields;
//abstract callbacks //abstract callbacks
function start_lvl($output) { return $output; } function start_lvl($output) { return $output; }
function end_lvl($output) { return $output; } function end_lvl($output) { return $output; }
function start_el($output) { return $output; } function start_el($output) { return $output; }
function end_el($output) { return $output; } function end_el($output) { return $output; }
function walk($elements, $to_depth) { function walk($elements, $to_depth) {
$args = array_slice(func_get_args(), 2); $parents = array(); $depth = 1; $previous_element = ''; $output = ''; $args = array_slice(func_get_args(), 2); $parents = array(); $depth = 1; $previous_element = ''; $output = '';
//padding at the end //padding at the end
$last_element->post_parent = 0; $last_element->post_parent = 0;
$last_element->post_id = 0; $last_element->post_id = 0;
$elements[] = $last_element; $elements[] = $last_element;
$id_field = $this->db_fields['id']; $id_field = $this->db_fields['id'];
$parent_field = $this->db_fields['parent']; $parent_field = $this->db_fields['parent'];
$flat = ($to_depth == -1) ? true : false; $flat = ($to_depth == -1) ? true : false;
foreach ( $elements as $element ) { foreach ( $elements as $element ) {
// If flat, start and end the element and skip the level checks. // If flat, start and end the element and skip the level checks.
if ( $flat) { if ( $flat) {
@ -443,7 +443,7 @@ class Walker {
$cb_args = array_merge( array($output, $previous_element, $depth - 1), $args); $cb_args = array_merge( array($output, $previous_element, $depth - 1), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args); $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
} }
while ( $parent = array_shift($parents) ) { while ( $parent = array_shift($parents) ) {
$depth--; $depth--;
if ( !$to_depth || ($depth < $to_depth) ) { if ( !$to_depth || ($depth < $to_depth) ) {
@ -463,7 +463,7 @@ class Walker {
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args); $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
} }
} }
// Start the element. // Start the element.
if ( !$to_depth || ($depth <= $to_depth) ) { if ( !$to_depth || ($depth <= $to_depth) ) {
if ( $element->$id_field != 0 ) { if ( $element->$id_field != 0 ) {
@ -471,10 +471,10 @@ class Walker {
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args); $output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
} }
} }
$previous_element = $element; $previous_element = $element;
} }
return $output; return $output;
} }
} }
@ -482,19 +482,19 @@ class Walker {
class Walker_Page extends Walker { class Walker_Page extends Walker {
var $tree_type = 'page'; var $tree_type = 'page';
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
function start_lvl($output, $depth) { function start_lvl($output, $depth) {
$indent = str_repeat("\t", $depth); $indent = str_repeat("\t", $depth);
$output .= "$indent<ul>\n"; $output .= "$indent<ul>\n";
return $output; return $output;
} }
function end_lvl($output, $depth) { function end_lvl($output, $depth) {
$indent = str_repeat("\t", $depth); $indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n"; $output .= "$indent</ul>\n";
return $output; return $output;
} }
function start_el($output, $page, $depth, $current_page, $show_date, $date_format) { function start_el($output, $page, $depth, $current_page, $show_date, $date_format) {
if ( $depth ) if ( $depth )
$indent = str_repeat("\t", $depth); $indent = str_repeat("\t", $depth);
@ -530,45 +530,45 @@ class Walker_PageDropdown extends Walker {
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
function start_el($output, $page, $depth, $args) { function start_el($output, $page, $depth, $args) {
$pad = str_repeat('&nbsp;', $depth * 3); $pad = str_repeat('&nbsp;', $depth * 3);
$output .= "\t<option value=\"$page->ID\""; $output .= "\t<option value=\"$page->ID\"";
if ( $page->ID == $args['selected'] ) if ( $page->ID == $args['selected'] )
$output .= ' selected="selected"'; $output .= ' selected="selected"';
$output .= '>'; $output .= '>';
$title = wp_specialchars($page->post_title); $title = wp_specialchars($page->post_title);
$output .= "$pad$title"; $output .= "$pad$title";
$output .= "</option>\n"; $output .= "</option>\n";
return $output; return $output;
} }
} }
class Walker_Category extends Walker { class Walker_Category extends Walker {
var $tree_type = 'category'; var $tree_type = 'category';
var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
function start_lvl($output, $depth, $args) { function start_lvl($output, $depth, $args) {
if ( 'list' != $args['style'] ) if ( 'list' != $args['style'] )
return $output; return $output;
$indent = str_repeat("\t", $depth); $indent = str_repeat("\t", $depth);
$output .= "$indent<ul class='children'>\n"; $output .= "$indent<ul class='children'>\n";
return $output; return $output;
} }
function end_lvl($output, $depth, $args) { function end_lvl($output, $depth, $args) {
if ( 'list' != $args['style'] ) if ( 'list' != $args['style'] )
return $output; return $output;
$indent = str_repeat("\t", $depth); $indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n"; $output .= "$indent</ul>\n";
return $output; return $output;
} }
function start_el($output, $category, $depth, $args) { function start_el($output, $category, $depth, $args) {
extract($args); extract($args);
$link = '<a href="' . get_category_link($category->cat_ID) . '" '; $link = '<a href="' . get_category_link($category->cat_ID) . '" ';
if ( $use_desc_for_title == 0 || empty($category->category_description) ) if ( $use_desc_for_title == 0 || empty($category->category_description) )
$link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name, 1)) . '"'; $link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name, 1)) . '"';
@ -576,24 +576,24 @@ class Walker_Category extends Walker {
$link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category),1) . '"'; $link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category),1) . '"';
$link .= '>'; $link .= '>';
$link .= apply_filters('list_cats', $category->cat_name, $category).'</a>'; $link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) { if ( (! empty($feed_image)) || (! empty($feed)) ) {
$link .= ' '; $link .= ' ';
if ( empty($feed_image) ) if ( empty($feed_image) )
$link .= '('; $link .= '(';
$link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"'; $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
if ( !empty($feed) ) { if ( !empty($feed) ) {
$title = ' title="' . $feed . '"'; $title = ' title="' . $feed . '"';
$alt = ' alt="' . $feed . '"'; $alt = ' alt="' . $feed . '"';
$name = $feed; $name = $feed;
$link .= $title; $link .= $title;
} }
$link .= '>'; $link .= '>';
if ( !empty($feed_image) ) if ( !empty($feed_image) )
$link .= "<img src='$feed_image' $alt$title" . ' />'; $link .= "<img src='$feed_image' $alt$title" . ' />';
else else
@ -618,14 +618,14 @@ class Walker_Category extends Walker {
} else { } else {
$output .= "\t$link<br />\n"; $output .= "\t$link<br />\n";
} }
return $output; return $output;
} }
function end_el($output, $page, $depth, $args) { function end_el($output, $page, $depth, $args) {
if ( 'list' != $args['style'] ) if ( 'list' != $args['style'] )
return $output; return $output;
$output .= "</li>\n"; $output .= "</li>\n";
return $output; return $output;
} }
@ -635,10 +635,10 @@ class Walker_Category extends Walker {
class Walker_CategoryDropdown extends Walker { class Walker_CategoryDropdown extends Walker {
var $tree_type = 'category'; var $tree_type = 'category';
var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
function start_el($output, $category, $depth, $args) { function start_el($output, $category, $depth, $args) {
$pad = str_repeat('&nbsp;', $depth * 3); $pad = str_repeat('&nbsp;', $depth * 3);
$cat_name = apply_filters('list_cats', $category->cat_name, $category); $cat_name = apply_filters('list_cats', $category->cat_name, $category);
$output .= "\t<option value=\"".$category->cat_ID."\""; $output .= "\t<option value=\"".$category->cat_ID."\"";
if ( $category->cat_ID == $args['selected'] ) if ( $category->cat_ID == $args['selected'] )
@ -652,7 +652,7 @@ class Walker_CategoryDropdown extends Walker {
$output .= '&nbsp;&nbsp;' . gmdate($format, $category->last_update_timestamp); $output .= '&nbsp;&nbsp;' . gmdate($format, $category->last_update_timestamp);
} }
$output .= "</option>\n"; $output .= "</option>\n";
return $output; return $output;
} }
} }

View File

@ -142,7 +142,7 @@ function get_comments_link() {
} }
function comments_link( $file = '', $echo = true ) { function comments_link( $file = '', $echo = true ) {
echo get_comments_link(); echo get_comments_link();
} }
function get_comments_number( $post_id = 0 ) { function get_comments_number( $post_id = 0 ) {
@ -240,9 +240,9 @@ function trackback_url( $display = true ) {
function trackback_rdf($timezone = 0) { function trackback_rdf($timezone = 0) {
global $id; global $id;
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) { if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description rdf:about="'; <rdf:Description rdf:about="';
the_permalink(); the_permalink();
echo '"'."\n"; echo '"'."\n";
@ -265,7 +265,7 @@ function comments_open() {
function pings_open() { function pings_open() {
global $post; global $post;
if ( 'open' == $post->ping_status ) if ( 'open' == $post->ping_status )
return true; return true;
else else
return false; return false;
@ -299,7 +299,7 @@ function comments_template( $file = '/comments.php' ) {
} }
function comments_popup_script($width=400, $height=400, $file='') { function comments_popup_script($width=400, $height=400, $file='') {
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript; global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
if (empty ($file)) { if (empty ($file)) {
$wpcommentspopupfile = ''; // Use the index. $wpcommentspopupfile = ''; // Use the index.
@ -307,9 +307,9 @@ function comments_popup_script($width=400, $height=400, $file='') {
$wpcommentspopupfile = $file; $wpcommentspopupfile = $file;
} }
$wpcommentsjavascript = 1; $wpcommentsjavascript = 1;
$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n"; $javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
echo $javascript; echo $javascript;
} }
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {

View File

@ -18,11 +18,11 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
// Skip empty lines // Skip empty lines
if (empty($word)) { continue; } if (empty($word)) { continue; }
// Do some escaping magic so that '#' chars in the // Do some escaping magic so that '#' chars in the
// spam words don't break things: // spam words don't break things:
$word = preg_quote($word, '#'); $word = preg_quote($word, '#');
$pattern = "#$word#i"; $pattern = "#$word#i";
if ( preg_match($pattern, $author) ) return false; if ( preg_match($pattern, $author) ) return false;
if ( preg_match($pattern, $email) ) return false; if ( preg_match($pattern, $email) ) return false;
if ( preg_match($pattern, $url) ) return false; if ( preg_match($pattern, $url) ) return false;
@ -103,9 +103,9 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
if ($no_cache) { if ($no_cache) {
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'"; $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
if (false == $include_unapproved) { if (false == $include_unapproved) {
$query .= " AND comment_approved = '1'"; $query .= " AND comment_approved = '1'";
} }
$myrow = $wpdb->get_row($query, ARRAY_A); $myrow = $wpdb->get_row($query, ARRAY_A);
} else { } else {
$myrow['comment_ID'] = $postc->comment_ID; $myrow['comment_ID'] = $postc->comment_ID;
$myrow['comment_post_ID'] = $postc->comment_post_ID; $myrow['comment_post_ID'] = $postc->comment_post_ID;
@ -157,7 +157,7 @@ function sanitize_comment_cookies() {
if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) { if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
$comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]); $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
$comment_author_email = stripslashes($comment_author_email); $comment_author_email = stripslashes($comment_author_email);
$comment_author_email = wp_specialchars($comment_author_email, true); $comment_author_email = wp_specialchars($comment_author_email, true);
$_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email; $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
} }
@ -243,11 +243,11 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
// Skip empty lines // Skip empty lines
if ( empty($word) ) { continue; } if ( empty($word) ) { continue; }
// Do some escaping magic so that '#' chars in the // Do some escaping magic so that '#' chars in the
// spam words don't break things: // spam words don't break things:
$word = preg_quote($word, '#'); $word = preg_quote($word, '#');
$pattern = "#$word#i"; $pattern = "#$word#i";
if ( preg_match($pattern, $author ) ) return true; if ( preg_match($pattern, $author ) ) return true;
if ( preg_match($pattern, $email ) ) return true; if ( preg_match($pattern, $email ) ) return true;
if ( preg_match($pattern, $url ) ) return true; if ( preg_match($pattern, $url ) ) return true;
@ -328,9 +328,9 @@ function wp_insert_comment($commentdata) {
if ( ! isset($user_id) ) if ( ! isset($user_id) )
$user_id = 0; $user_id = 0;
$result = $wpdb->query("INSERT INTO $wpdb->comments $result = $wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id) (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
VALUES VALUES
('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id') ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
"); ");
@ -397,26 +397,26 @@ function wp_new_comment( $commentdata ) {
} }
function wp_set_comment_status($comment_id, $comment_status) { function wp_set_comment_status($comment_id, $comment_status) {
global $wpdb; global $wpdb;
switch($comment_status) { switch($comment_status) {
case 'hold': case 'hold':
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
break; break;
case 'approve': case 'approve':
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
break; break;
case 'spam': case 'spam':
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
break; break;
case 'delete': case 'delete':
return wp_delete_comment($comment_id); return wp_delete_comment($comment_id);
break; break;
default: default:
return false; return false;
} }
if ($wpdb->query($query)) { if ($wpdb->query($query)) {
do_action('wp_set_comment_status', $comment_id, $comment_status); do_action('wp_set_comment_status', $comment_id, $comment_status);
$comment = get_comment($comment_id); $comment = get_comment($comment_id);
@ -425,9 +425,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
if( is_object( $c ) ) if( is_object( $c ) )
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" ); $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
return true; return true;
} else { } else {
return false; return false;
} }
} }
function wp_update_comment($commentarr) { function wp_update_comment($commentarr) {
@ -582,7 +582,7 @@ function do_all_pings() {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';"); $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
pingback($ping->post_content, $ping->ID); pingback($ping->post_content, $ping->ID);
} }
// Do Enclosures // Do Enclosures
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) { while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';"); $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
@ -705,7 +705,7 @@ function pingback($content, $post_ID) {
$pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
if ($pingback_server_url) { if ($pingback_server_url) {
@ set_time_limit( 60 ); @ set_time_limit( 60 );
// Now, the RPC call // Now, the RPC call
debug_fwrite($log, "Page Linked To: $pagelinkedto \n"); debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
debug_fwrite($log, 'Page Linked From: '); debug_fwrite($log, 'Page Linked From: ');

View File

@ -36,13 +36,13 @@ if (!function_exists('ob_clean')) {
/* Added in PHP 4.3.0 */ /* Added in PHP 4.3.0 */
function printr($var, $do_not_echo = false) { function printr($var, $do_not_echo = false) {
// from php.net/print_r user contributed notes // from php.net/print_r user contributed notes
ob_start(); ob_start();
print_r($var); print_r($var);
$code = htmlentities(ob_get_contents()); $code = htmlentities(ob_get_contents());
ob_clean(); ob_clean();
if (!$do_not_echo) { if (!$do_not_echo) {
echo "<pre>$code</pre>"; echo "<pre>$code</pre>";
} }
ob_end_clean(); ob_end_clean();
return $code; return $code;
@ -57,11 +57,11 @@ if ( !function_exists('file_get_contents') ) {
} }
if (!defined('CASE_LOWER')) { if (!defined('CASE_LOWER')) {
define('CASE_LOWER', 0); define('CASE_LOWER', 0);
} }
if (!defined('CASE_UPPER')) { if (!defined('CASE_UPPER')) {
define('CASE_UPPER', 1); define('CASE_UPPER', 1);
} }
@ -78,38 +78,38 @@ if (!defined('CASE_UPPER')) {
* @require PHP 4.0.0 (user_error) * @require PHP 4.0.0 (user_error)
*/ */
if (!function_exists('array_change_key_case')) { if (!function_exists('array_change_key_case')) {
function array_change_key_case($input, $case = CASE_LOWER) function array_change_key_case($input, $case = CASE_LOWER)
{ {
if (!is_array($input)) { if (!is_array($input)) {
user_error('array_change_key_case(): The argument should be an array', user_error('array_change_key_case(): The argument should be an array',
E_USER_WARNING); E_USER_WARNING);
return false; return false;
} }
$output = array (); $output = array ();
$keys = array_keys($input); $keys = array_keys($input);
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
foreach ($keys as $key) { foreach ($keys as $key) {
$output[$casefunc($key)] = $input[$key]; $output[$casefunc($key)] = $input[$key];
} }
return $output; return $output;
} }
} }
// From php.net // From php.net
if(!function_exists('http_build_query')) { if(!function_exists('http_build_query')) {
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) { function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
$res = array(); $res = array();
foreach ((array)$formdata as $k=>$v) { foreach ((array)$formdata as $k=>$v) {
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k); $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
if ($key) $tmp_key = $key.'['.$tmp_key.']'; if ($key) $tmp_key = $key.'['.$tmp_key.']';
$res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) ); $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
} }
$separator = ini_get('arg_separator.output'); $separator = ini_get('arg_separator.output');
return implode($separator, $res); return implode($separator, $res);
} }
} }
if ( !function_exists('_') ) { if ( !function_exists('_') ) {

View File

@ -129,8 +129,8 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
$post_author_data = get_userdata($post->post_author); $post_author_data = get_userdata($post->post_author);
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|| ($author_data->user_level > $post_author_data->user_level) || ($author_data->user_level > $post_author_data->user_level)
|| ($author_data->user_level >= 10) ) { || ($author_data->user_level >= 10) ) {
return true; return true;
} else { } else {
return false; return false;
@ -199,19 +199,19 @@ function user_can_edit_user($user_id, $other_user) {
** show_updated (default 0) - whether to show last updated timestamp ** show_updated (default 0) - whether to show last updated timestamp
*/ */
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
$between = " ", $show_images = true, $orderby = 'id', $between = " ", $show_images = true, $orderby = 'id',
$show_description = true, $show_rating = false, $show_description = true, $show_rating = false,
$limit = -1, $show_updated = 0) { $limit = -1, $show_updated = 0) {
global $wpdb; global $wpdb;
$cat_id = -1; $cat_id = -1;
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'"); $results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
if ($results) { if ($results) {
foreach ($results as $result) { foreach ($results as $result) {
$cat_id = $result->cat_ID; $cat_id = $result->cat_ID;
} }
} }
get_links($cat_id, $before, $after, $between, $show_images, $orderby, get_links($cat_id, $before, $after, $between, $show_images, $orderby,
$show_description, $show_rating, $limit, $show_updated); $show_description, $show_rating, $limit, $show_updated);
} }
/** function wp_get_linksbyname() /** function wp_get_linksbyname()
@ -252,16 +252,16 @@ function wp_get_linksbyname($category, $args = '') {
**/ **/
// Deprecate in favor of get_linkz(). // Deprecate in favor of get_linkz().
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
global $wpdb; global $wpdb;
$cat_id = -1; $cat_id = -1;
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'"); //$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
// TODO: Fix me. // TODO: Fix me.
if ($results) { if ($results) {
foreach ($results as $result) { foreach ($results as $result) {
$cat_id = $result->cat_id; $cat_id = $result->cat_id;
} }
} }
return get_linkobjects($cat_id, $orderby, $limit); return get_linkobjects($cat_id, $orderby, $limit);
} }
/** function get_linkobjects() /** function get_linkobjects()
@ -301,40 +301,40 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
**/ **/
// Deprecate in favor of get_linkz(). // Deprecate in favor of get_linkz().
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) { function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
global $wpdb; global $wpdb;
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'"; $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
if ($category != -1) { if ($category != -1) {
$sql .= " AND link_category = $category "; $sql .= " AND link_category = $category ";
} }
if ($orderby == '') if ($orderby == '')
$orderby = 'id'; $orderby = 'id';
if (substr($orderby,0,1) == '_') { if (substr($orderby,0,1) == '_') {
$direction = ' DESC'; $direction = ' DESC';
$orderby = substr($orderby,1); $orderby = substr($orderby,1);
} }
if (strcasecmp('rand',$orderby) == 0) { if (strcasecmp('rand',$orderby) == 0) {
$orderby = 'rand()'; $orderby = 'rand()';
} else { } else {
$orderby = " link_" . $orderby; $orderby = " link_" . $orderby;
} }
$sql .= ' ORDER BY ' . $orderby; $sql .= ' ORDER BY ' . $orderby;
$sql .= $direction; $sql .= $direction;
/* The next 2 lines implement LIMIT TO processing */ /* The next 2 lines implement LIMIT TO processing */
if ($limit != -1) if ($limit != -1)
$sql .= " LIMIT $limit"; $sql .= " LIMIT $limit";
$results = $wpdb->get_results($sql); $results = $wpdb->get_results($sql);
if ($results) { if ($results) {
foreach ($results as $result) { foreach ($results as $result) {
$result->link_url = $result->link_url; $result->link_url = $result->link_url;
$result->link_name = $result->link_name; $result->link_name = $result->link_name;
$result->link_description = $result->link_description; $result->link_description = $result->link_description;
$result->link_notes = $result->link_notes; $result->link_notes = $result->link_notes;
$newresults[] = $result; $newresults[] = $result;
} }
} }
return $newresults; return $newresults;
} }
/** function get_linksbyname_withrating() /** function get_linksbyname_withrating()
@ -359,12 +359,12 @@ function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
** show_updated (default 0) - whether to show last updated timestamp ** show_updated (default 0) - whether to show last updated timestamp
*/ */
function get_linksbyname_withrating($cat_name = "noname", $before = '', function get_linksbyname_withrating($cat_name = "noname", $before = '',
$after = '<br />', $between = " ", $after = '<br />', $between = " ",
$show_images = true, $orderby = 'id', $show_images = true, $orderby = 'id',
$show_description = true, $limit = -1, $show_updated = 0) { $show_description = true, $limit = -1, $show_updated = 0) {
get_linksbyname($cat_name, $before, $after, $between, $show_images, get_linksbyname($cat_name, $before, $after, $between, $show_images,
$orderby, $show_description, true, $limit, $show_updated); $orderby, $show_description, true, $limit, $show_updated);
} }
/** function get_links_withrating() /** function get_links_withrating()
@ -389,12 +389,12 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '',
** show_updated (default 0) - whether to show last updated timestamp ** show_updated (default 0) - whether to show last updated timestamp
*/ */
function get_links_withrating($category = -1, $before = '', $after = '<br />', function get_links_withrating($category = -1, $before = '', $after = '<br />',
$between = " ", $show_images = true, $between = " ", $show_images = true,
$orderby = 'id', $show_description = true, $orderby = 'id', $show_description = true,
$limit = -1, $show_updated = 0) { $limit = -1, $show_updated = 0) {
get_links($category, $before, $after, $between, $show_images, $orderby, get_links($category, $before, $after, $between, $show_images, $orderby,
$show_description, true, $limit, $show_updated); $show_description, true, $limit, $show_updated);
} }
/** function get_get_autotoggle() /** function get_get_autotoggle()
@ -403,7 +403,7 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />',
** uses 0 ** uses 0
*/ */
function get_autotoggle($id = 0) { function get_autotoggle($id = 0) {
return 0; return 0;
} }
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) { function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
@ -433,7 +433,7 @@ function wp_list_cats($args = '') {
$r['style'] = 'break'; $r['style'] = 'break';
$r['title_li'] = ''; $r['title_li'] = '';
return wp_list_categories($r); return wp_list_categories($r);
} }
function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',

View File

@ -65,18 +65,18 @@ function wpautop($pee, $br = 1) {
$pee = $pee . "\n"; // just to make things a little easier, pad the end $pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
// Space things out a little // Space things out a little
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee); $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee); $pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee); $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee); $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
if ($br) { if ($br) {
$pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee); $pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee);
$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
@ -86,7 +86,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee); $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
return $pee; return $pee;
} }
@ -126,35 +126,35 @@ function wp_specialchars( $text, $quotes = 0 ) {
} }
function utf8_uri_encode( $utf8_string ) { function utf8_uri_encode( $utf8_string ) {
$unicode = ''; $unicode = '';
$values = array(); $values = array();
$num_octets = 1; $num_octets = 1;
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
$value = ord( $utf8_string[ $i ] ); for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
if ( $value < 128 ) { $value = ord( $utf8_string[ $i ] );
$unicode .= chr($value);
} else { if ( $value < 128 ) {
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; $unicode .= chr($value);
} else {
$values[] = $value; if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
if ( count( $values ) == $num_octets ) { $values[] = $value;
if ( count( $values ) == $num_octets ) {
if ($num_octets == 3) { if ($num_octets == 3) {
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
} else { } else {
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
} }
$values = array(); $values = array();
$num_octets = 1; $num_octets = 1;
} }
} }
} }
return $unicode; return $unicode;
} }
function remove_accents($string) { function remove_accents($string) {
@ -339,7 +339,7 @@ function sanitize_title_with_dashes($title) {
return $title; return $title;
} }
function convert_chars($content, $flag = 'obsolete') { function convert_chars($content, $flag = 'obsolete') {
// Translation of invalid Unicode references range to valid range // Translation of invalid Unicode references range to valid range
$wp_htmltranswinuni = array( $wp_htmltranswinuni = array(
'&#128;' => '&#8364;', // the Euro sign '&#128;' => '&#8364;', // the Euro sign
@ -405,22 +405,22 @@ function funky_javascript_fix($text) {
/* /*
balanceTags balanceTags
Balances Tags of string using a modified stack. Balances Tags of string using a modified stack.
@param text Text to be balanced @param text Text to be balanced
@return Returns balanced text @return Returns balanced text
@author Leonard Lin (leonard@acm.org) @author Leonard Lin (leonard@acm.org)
@version v1.1 @version v1.1
@date November 4, 2001 @date November 4, 2001
@license GPL v2.0 @license GPL v2.0
@notes @notes
@changelog @changelog
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004 --- Modified by Scott Reilly (coffee2code) 02 Aug 2004
1.2 ***TODO*** Make better - change loop condition to $text 1.2 ***TODO*** Make better - change loop condition to $text
1.1 Fixed handling of append/stack pop order of end text 1.1 Fixed handling of append/stack pop order of end text
Added Cleaning Hooks Added Cleaning Hooks
1.0 First Version 1.0 First Version
*/ */
function balanceTags($text, $is_comment = 0, $force = false) { function balanceTags($text, $is_comment = 0, $force = false) {
@ -446,7 +446,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
if ($regex[1][0] == "/") { // End Tag if ($regex[1][0] == "/") { // End Tag
$tag = strtolower(substr($regex[1],1)); $tag = strtolower(substr($regex[1],1));
// if too many closing tags // if too many closing tags
if($stacksize <= 0) { if($stacksize <= 0) {
$tag = ''; $tag = '';
//or close to be safe $tag = '/' . $tag; //or close to be safe $tag = '/' . $tag;
} }
@ -503,7 +503,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
} }
$newtext .= substr($text,0,$i) . $tag; $newtext .= substr($text,0,$i) . $tag;
$text = substr($text,$i+$l); $text = substr($text,$i+$l);
} }
// Clear Tag Queue // Clear Tag Queue
$newtext .= $tagqueue; $newtext .= $tagqueue;
@ -552,10 +552,10 @@ function backslashit($string) {
} }
function trailingslashit($string) { function trailingslashit($string) {
if ( '/' != substr($string, -1)) { if ( '/' != substr($string, -1)) {
$string .= '/'; $string .= '/';
} }
return $string; return $string;
} }
function addslashes_gpc($gpc) { function addslashes_gpc($gpc) {
@ -571,11 +571,11 @@ function addslashes_gpc($gpc) {
function stripslashes_deep($value) function stripslashes_deep($value)
{ {
$value = is_array($value) ? $value = is_array($value) ?
array_map('stripslashes_deep', $value) : array_map('stripslashes_deep', $value) :
stripslashes($value); stripslashes($value);
return $value; return $value;
} }
function antispambot($emailaddy, $mailto=0) { function antispambot($emailaddy, $mailto=0) {
@ -731,7 +731,7 @@ function sanitize_email($email) {
return preg_replace('/[^a-z0-9+_.@-]/i', '', $email); return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
} }
function human_time_diff( $from, $to = '' ) { function human_time_diff( $from, $to = '' ) {
if ( empty($to) ) if ( empty($to) )
$to = time(); $to = time();
$diff = (int) abs($to - $from); $diff = (int) abs($to - $from);
@ -745,7 +745,7 @@ function human_time_diff( $from, $to = '' ) {
$hours = round($diff / 3600); $hours = round($diff / 3600);
if ($hours <= 1) if ($hours <= 1)
$since = __('1 hour'); $since = __('1 hour');
else else
$since = sprintf( __('%s hours'), $hours ); $since = sprintf( __('%s hours'), $hours );
} elseif ($diff >= 86400) { } elseif ($diff >= 86400) {
$days = round($diff / 86400); $days = round($diff / 86400);

View File

@ -12,7 +12,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
if( 'U' == $dateformatstring ) if( 'U' == $dateformatstring )
return $i; return $i;
if ( -1 == $i || false == $i ) if ( -1 == $i || false == $i )
$i = 0; $i = 0;
@ -462,7 +462,7 @@ function wp_get_http_headers( $url, $red = 1 ) {
@set_time_limit( 60 ); @set_time_limit( 60 );
if ( $red > 5 ) if ( $red > 5 )
return false; return false;
$parts = parse_url( $url ); $parts = parse_url( $url );
$file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : ''); $file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : '');
@ -491,9 +491,9 @@ function wp_get_http_headers( $url, $red = 1 ) {
preg_match('/.*([0-9]{3}).*/', $response, $return); preg_match('/.*([0-9]{3}).*/', $response, $return);
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404 $headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
$code = $headers['response']; $code = $headers['response'];
if ( ('302' == $code || '301' == $code) && isset($headers['location']) ) if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
return wp_get_http_headers( $headers['location'], ++$red ); return wp_get_http_headers( $headers['location'], ++$red );
return $headers; return $headers;
} }
@ -801,8 +801,8 @@ function get_num_queries() {
} }
function bool_from_yn($yn) { function bool_from_yn($yn) {
if ($yn == 'Y') return 1; if ($yn == 'Y') return 1;
return 0; return 0;
} }
function do_feed() { function do_feed() {
@ -957,7 +957,7 @@ function wp_upload_dir() {
return array('error' => $message); return array('error' => $message);
} }
$uploads = array('path' => $dir, 'url' => $url, 'error' => false); $uploads = array('path' => $dir, 'url' => $url, 'error' => false);
return apply_filters('upload_dir', $uploads); return apply_filters('upload_dir', $uploads);
} }

View File

@ -471,7 +471,7 @@ function get_calendar($initial = true) {
FROM $wpdb->posts FROM $wpdb->posts
WHERE post_date > '$thisyear-$thismonth-01' WHERE post_date > '$thisyear-$thismonth-01'
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
AND post_type = 'post' AND post_status = 'publish' AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date ASC ORDER BY post_date ASC
LIMIT 1"); LIMIT 1");

View File

@ -17,7 +17,7 @@ function get_locale() {
return $locale; return $locale;
} }
// Return a translated string. // Return a translated string.
function __($text, $domain = 'default') { function __($text, $domain = 'default') {
global $l10n; global $l10n;

View File

@ -63,7 +63,7 @@ function get_permalink($id = 0) {
$authordata = get_userdata($post->post_author); $authordata = get_userdata($post->post_author);
$author = $authordata->user_nicename; $author = $authordata->user_nicename;
$date = explode(" ",date('Y m d H i s', $unixtime)); $date = explode(" ",date('Y m d H i s', $unixtime));
$rewritereplace = $rewritereplace =
array( array(
$date[0], $date[0],
$date[1], $date[1],
@ -282,7 +282,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
for ( $i = 1; $i < (count($cat_array)); $i++ ) { for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
} }
$join .= ')'; $join .= ')';
} }
$sql_exclude_cats = ''; $sql_exclude_cats = '';
@ -315,7 +315,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
for ( $i = 1; $i < (count($cat_array)); $i++ ) { for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
} }
$join .= ')'; $join .= ')';
} }
$sql_exclude_cats = ''; $sql_exclude_cats = '';
@ -350,7 +350,7 @@ function previous_post_link($format='&laquo; %link', $link='%title', $in_same_ca
$format = str_replace('%link', $link, $format); $format = str_replace('%link', $link, $format);
echo $format; echo $format;
} }
function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') { function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
@ -365,7 +365,7 @@ function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat =
$link = $string . $link . '</a>'; $link = $string . $link . '</a>';
$format = str_replace('%link', $link, $format); $format = str_replace('%link', $link, $format);
echo $format; echo $format;
} }
function get_pagenum_link($pagenum = 1) { function get_pagenum_link($pagenum = 1) {
@ -373,7 +373,7 @@ function get_pagenum_link($pagenum = 1) {
$qstr = wp_specialchars($_SERVER['REQUEST_URI']); $qstr = wp_specialchars($_SERVER['REQUEST_URI']);
$page_querystring = "paged"; $page_querystring = "paged";
$page_modstring = "page/"; $page_modstring = "page/";
$page_modregex = "page/?"; $page_modregex = "page/?";
$permalink = 0; $permalink = 0;
@ -492,7 +492,7 @@ function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nx
if ( !is_singular() ) { if ( !is_singular() ) {
$max_num_pages = $wp_query->max_num_pages; $max_num_pages = $wp_query->max_num_pages;
$paged = get_query_var('paged'); $paged = get_query_var('paged');
//only have sep if there's both prev and next results //only have sep if there's both prev and next results
if ($paged < 2 || $paged >= $max_num_pages) { if ($paged < 2 || $paged >= $max_num_pages) {
$sep = ''; $sep = '';

View File

@ -46,7 +46,7 @@ function get_currentuserinfo() {
if ( ! empty($current_user) ) if ( ! empty($current_user) )
return; return;
if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ||
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) {
wp_set_current_user(0); wp_set_current_user(0);
return false; return false;
@ -212,7 +212,7 @@ endif;
if ( !function_exists('auth_redirect') ) : if ( !function_exists('auth_redirect') ) :
function auth_redirect() { function auth_redirect() {
// Checks if a user is logged in, if not redirects them to the login page // Checks if a user is logged in, if not redirects them to the login page
if ( (!empty($_COOKIE[USER_COOKIE]) && if ( (!empty($_COOKIE[USER_COOKIE]) &&
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
(empty($_COOKIE[USER_COOKIE])) ) { (empty($_COOKIE[USER_COOKIE])) ) {
nocache_headers(); nocache_headers();
@ -331,7 +331,7 @@ endif;
if ( ! function_exists('wp_notify_postauthor') ) : if ( ! function_exists('wp_notify_postauthor') ) :
function wp_notify_postauthor($comment_id, $comment_type='') { function wp_notify_postauthor($comment_id, $comment_type='') {
global $wpdb; global $wpdb;
$comment = get_comment($comment_id); $comment = get_comment($comment_id);
$post = get_post($comment->comment_post_ID); $post = get_post($comment->comment_post_ID);
$user = get_userdata( $post->post_author ); $user = get_userdata( $post->post_author );
@ -378,11 +378,11 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$from = "From: \"$blogname\" <$wp_email>"; $from = "From: \"$blogname\" <$wp_email>";
if ( '' != $comment->comment_author_email ) if ( '' != $comment->comment_author_email )
$reply_to = "Reply-To: $comment->comment_author_email"; $reply_to = "Reply-To: $comment->comment_author_email";
} else { } else {
$from = "From: \"$comment->comment_author\" <$wp_email>"; $from = "From: \"$comment->comment_author\" <$wp_email>";
if ( '' != $comment->comment_author_email ) if ( '' != $comment->comment_author_email )
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
} }
$message_headers = "MIME-Version: 1.0\n" $message_headers = "MIME-Version: 1.0\n"
. "$from\n" . "$from\n"
@ -439,7 +439,7 @@ function wp_notify_moderator($comment_id) {
$subject = apply_filters('comment_moderation_subject', $subject, $comment_id); $subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
@wp_mail($admin_email, $subject, $notify_message); @wp_mail($admin_email, $subject, $notify_message);
return true; return true;
} }
endif; endif;
@ -489,7 +489,7 @@ function wp_create_nonce($action = -1) {
$uid = $user->id; $uid = $user->id;
$i = ceil(time() / 43200); $i = ceil(time() / 43200);
return substr(wp_hash($i . $action . $uid), -12, 10); return substr(wp_hash($i . $action . $uid), -12, 10);
} }
endif; endif;

View File

@ -166,8 +166,8 @@ function get_posts($args) {
$inclusions = ''; $inclusions = '';
if ( !empty($include) ) { if ( !empty($include) ) {
$offset = 0; //ignore offset, category, exclude, meta_key, and meta_value params if using include $offset = 0; //ignore offset, category, exclude, meta_key, and meta_value params if using include
$category = ''; $category = '';
$exclude = ''; $exclude = '';
$meta_key = ''; $meta_key = '';
$meta_value = ''; $meta_value = '';
$incposts = preg_split('/[\s,]+/',$include); $incposts = preg_split('/[\s,]+/',$include);
@ -181,8 +181,8 @@ function get_posts($args) {
} }
} }
} }
if (!empty($inclusions)) if (!empty($inclusions))
$inclusions .= ')'; $inclusions .= ')';
$exclusions = ''; $exclusions = '';
if ( !empty($exclude) ) { if ( !empty($exclude) ) {
@ -196,12 +196,12 @@ function get_posts($args) {
} }
} }
} }
if (!empty($exclusions)) if (!empty($exclusions))
$exclusions .= ')'; $exclusions .= ')';
$query ="SELECT DISTINCT * FROM $wpdb->posts " ; $query ="SELECT DISTINCT * FROM $wpdb->posts " ;
$query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ; $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ;
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
$query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ; $query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ;
$query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ; $query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ;
$query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ; $query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ;
@ -400,9 +400,9 @@ function wp_get_post_categories($post_ID = 0) {
$post_ID = (int) $post_ID; $post_ID = (int) $post_ID;
$sql = "SELECT category_id $sql = "SELECT category_id
FROM $wpdb->post2cat FROM $wpdb->post2cat
WHERE post_id = '$post_ID' WHERE post_id = '$post_ID'
ORDER BY category_id"; ORDER BY category_id";
$result = $wpdb->get_col($sql); $result = $wpdb->get_col($sql);
@ -435,7 +435,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
// Set categories // Set categories
if($mode == OBJECT) { if($mode == OBJECT) {
$post->post_category = wp_get_post_categories($postid); $post->post_category = wp_get_post_categories($postid);
} }
else { else {
$post['post_category'] = wp_get_post_categories($postid); $post['post_category'] = wp_get_post_categories($postid);
} }
@ -635,13 +635,13 @@ function wp_insert_post($postarr = array()) {
if ( !defined('WP_IMPORTING') ) { if ( !defined('WP_IMPORTING') ) {
if ( $post_pingback ) if ( $post_pingback )
$result = $wpdb->query(" $result = $wpdb->query("
INSERT INTO $wpdb->postmeta INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value) (post_id,meta_key,meta_value)
VALUES ('$post_ID','_pingme','1') VALUES ('$post_ID','_pingme','1')
"); ");
$result = $wpdb->query(" $result = $wpdb->query("
INSERT INTO $wpdb->postmeta INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value) (post_id,meta_key,meta_value)
VALUES ('$post_ID','_encloseme','1') VALUES ('$post_ID','_encloseme','1')
"); ");
wp_schedule_single_event(time(), 'do_pings'); wp_schedule_single_event(time(), 'do_pings');
@ -653,7 +653,7 @@ function wp_insert_post($postarr = array()) {
if ( !empty($page_template) ) if ( !empty($page_template) )
if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template)) if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template))
add_post_meta($post_ID, '_wp_page_template', $page_template, true); add_post_meta($post_ID, '_wp_page_template', $page_template, true);
if ( $post_status == 'publish' ) if ( $post_status == 'publish' )
do_action('publish_page', $post_ID); do_action('publish_page', $post_ID);
} }
@ -684,22 +684,22 @@ function wp_update_post($postarr = array()) {
$post = add_magic_quotes($post); $post = add_magic_quotes($post);
// Passed post category list overwrites existing category list if not empty. // Passed post category list overwrites existing category list if not empty.
if ( isset($postarr['post_category']) && is_array($postarr['post_category']) if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
&& 0 != count($postarr['post_category']) ) && 0 != count($postarr['post_category']) )
$post_cats = $postarr['post_category']; $post_cats = $postarr['post_category'];
else else
$post_cats = $post['post_category']; $post_cats = $post['post_category'];
// Drafts shouldn't be assigned a date unless explicitly done so by the user // Drafts shouldn't be assigned a date unless explicitly done so by the user
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
('0000-00-00 00:00:00' == $post['post_date']) ) ('0000-00-00 00:00:00' == $post['post_date']) )
$clear_date = true; $clear_date = true;
else else
$clear_date = false; $clear_date = false;
// Merge old and new fields with new fields overwriting old ones. // Merge old and new fields with new fields overwriting old ones.
$postarr = array_merge($post, $postarr); $postarr = array_merge($post, $postarr);
$postarr['post_category'] = $post_cats; $postarr['post_category'] = $post_cats;
if ( $clear_date ) { if ( $clear_date ) {
$postarr['post_date'] = ''; $postarr['post_date'] = '';
$postarr['post_date_gmt'] = ''; $postarr['post_date_gmt'] = '';
@ -733,8 +733,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
// First the old categories // First the old categories
$old_categories = $wpdb->get_col(" $old_categories = $wpdb->get_col("
SELECT category_id SELECT category_id
FROM $wpdb->post2cat FROM $wpdb->post2cat
WHERE post_id = $post_ID"); WHERE post_id = $post_ID");
if (!$old_categories) { if (!$old_categories) {
@ -749,9 +749,9 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
if ($delete_cats) { if ($delete_cats) {
foreach ($delete_cats as $del) { foreach ($delete_cats as $del) {
$wpdb->query(" $wpdb->query("
DELETE FROM $wpdb->post2cat DELETE FROM $wpdb->post2cat
WHERE category_id = $del WHERE category_id = $del
AND post_id = $post_ID AND post_id = $post_ID
"); ");
} }
} }
@ -848,10 +848,10 @@ function trackback_url_list($tb_list, $post_id) {
$trackback_urls = explode(',', $tb_list); $trackback_urls = explode(',', $tb_list);
foreach($trackback_urls as $tb_url) { foreach($trackback_urls as $tb_url) {
$tb_url = trim($tb_url); $tb_url = trim($tb_url);
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id); trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
}
} }
}
} }
// //
@ -928,7 +928,7 @@ function get_page_by_path($page_path, $output = OBJECT) {
$pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'"); $pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'");
if ( empty($pages) ) if ( empty($pages) )
return NULL; return NULL;
foreach ($pages as $page) { foreach ($pages as $page) {
@ -1018,8 +1018,8 @@ function &get_pages($args = '') {
$inclusions = ''; $inclusions = '';
if ( !empty($include) ) { if ( !empty($include) ) {
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
$exclude = ''; $exclude = '';
$meta_key = ''; $meta_key = '';
$meta_value = ''; $meta_value = '';
$incpages = preg_split('/[\s,]+/',$include); $incpages = preg_split('/[\s,]+/',$include);
@ -1032,8 +1032,8 @@ function &get_pages($args = '') {
} }
} }
} }
if (!empty($inclusions)) if (!empty($inclusions))
$inclusions .= ')'; $inclusions .= ')';
$exclusions = ''; $exclusions = '';
if ( !empty($exclude) ) { if ( !empty($exclude) ) {
@ -1196,7 +1196,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
if (empty($post_date)) if (empty($post_date))
$post_date = current_time('mysql'); $post_date = current_time('mysql');
if (empty($post_date_gmt)) if (empty($post_date_gmt))
$post_date_gmt = current_time('mysql', 1); $post_date_gmt = current_time('mysql', 1);
if ( empty($comment_status) ) { if ( empty($comment_status) ) {

View File

@ -3,7 +3,7 @@
/* /*
* The Big Query. * The Big Query.
*/ */
function get_query_var($var) { function get_query_var($var) {
global $wp_query; global $wp_query;
@ -224,7 +224,7 @@ function is_404 () {
/* /*
* The Loop. Post loop control. * The Loop. Post loop control.
*/ */
function have_posts() { function have_posts() {
global $wp_query; global $wp_query;
@ -416,8 +416,8 @@ class WP_Query {
} elseif ( $qv['p'] ) { } elseif ( $qv['p'] ) {
$this->is_single = true; $this->is_single = true;
} elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) { } elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
// If year, month, day, hour, minute, and second are set, a single // If year, month, day, hour, minute, and second are set, a single
// post is being queried. // post is being queried.
$this->is_single = true; $this->is_single = true;
} elseif ('' != $qv['static'] || '' != $qv['pagename'] || (int) $qv['page_id']) { } elseif ('' != $qv['static'] || '' != $qv['pagename'] || (int) $qv['page_id']) {
$this->is_page = true; $this->is_page = true;
@ -493,7 +493,7 @@ class WP_Query {
if ('' != $qv['category_name']) { if ('' != $qv['category_name']) {
$this->is_category = true; $this->is_category = true;
} }
if ((empty($qv['author'])) || ($qv['author'] == '0')) { if ((empty($qv['author'])) || ($qv['author'] == '0')) {
$this->is_author = false; $this->is_author = false;
} else { } else {
@ -771,7 +771,7 @@ class WP_Query {
// Category stuff // Category stuff
if ((empty($q['cat'])) || ($q['cat'] == '0') || if ((empty($q['cat'])) || ($q['cat'] == '0') ||
// Bypass cat checks if fetching specific posts // Bypass cat checks if fetching specific posts
( $this->is_single || $this->is_page )) { ( $this->is_single || $this->is_page )) {
$whichcat=''; $whichcat='';
@ -788,7 +788,7 @@ class WP_Query {
if ( $in ) if ( $in )
$in_cats .= "$cat, " . get_category_children($cat, '', ', '); $in_cats .= "$cat, " . get_category_children($cat, '', ', ');
else else
$out_cats .= "$cat, " . get_category_children($cat, '', ', '); $out_cats .= "$cat, " . get_category_children($cat, '', ', ');
} }
$in_cats = substr($in_cats, 0, -2); $in_cats = substr($in_cats, 0, -2);
$out_cats = substr($out_cats, 0, -2); $out_cats = substr($out_cats, 0, -2);
@ -831,7 +831,7 @@ class WP_Query {
$reqcat = 0; $reqcat = 0;
$q['cat'] = $reqcat; $q['cat'] = $reqcat;
$tables = ", $wpdb->post2cat, $wpdb->categories"; $tables = ", $wpdb->post2cat, $wpdb->categories";
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) "; $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
$whichcat = " AND category_id IN ({$q['cat']}, "; $whichcat = " AND category_id IN ({$q['cat']}, ";
@ -922,7 +922,7 @@ class WP_Query {
if ( is_admin() ) if ( is_admin() )
$where .= " OR post_status = 'future' OR post_status = 'draft'"; $where .= " OR post_status = 'future' OR post_status = 'draft'";
if ( is_user_logged_in() ) { if ( is_user_logged_in() ) {
if ( 'post' == $post_type ) if ( 'post' == $post_type )
$cap = 'edit_private_posts'; $cap = 'edit_private_posts';
@ -1024,7 +1024,7 @@ class WP_Query {
} }
function next_post() { function next_post() {
$this->current_post++; $this->current_post++;
$this->post = $this->posts[$this->current_post]; $this->post = $this->posts[$this->current_post];
@ -1060,7 +1060,7 @@ class WP_Query {
$this->post = $this->posts[0]; $this->post = $this->posts[0];
} }
} }
function &query($query) { function &query($query) {
$this->parse_query($query); $this->parse_query($query);
return $this->get_posts(); return $this->get_posts();

View File

@ -85,9 +85,9 @@ function wp_insert_user($userdata) {
$wpdb->query( $query ); $wpdb->query( $query );
$user_id = $ID; $user_id = $ID;
} else { } else {
$query = "INSERT INTO $wpdb->users $query = "INSERT INTO $wpdb->users
(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name) (user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)
VALUES VALUES
('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')"; ('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
$query = apply_filters('create_user_query', $query); $query = apply_filters('create_user_query', $query);
$wpdb->query( $query ); $wpdb->query( $query );

View File

@ -16,15 +16,15 @@ function add_rewrite_tag($tagname, $regex) {
if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') { if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
return; return;
} }
$qv = trim($tagname, '%'); $qv = trim($tagname, '%');
global $wp_rewrite, $wp; global $wp_rewrite, $wp;
$wp->add_query_var($qv); $wp->add_query_var($qv);
$wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '='); $wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
} }
//Add a new feed type like /atom1/ //Add a new feed type like /atom1/
function add_feed($feedname, $function) { function add_feed($feedname, $function) {
global $wp_rewrite; global $wp_rewrite;
if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is
@ -169,7 +169,7 @@ class WP_Rewrite {
var $non_wp_rules; //rules that don't redirect to WP's index.php var $non_wp_rules; //rules that don't redirect to WP's index.php
var $endpoints; var $endpoints;
var $use_verbose_rules = false; var $use_verbose_rules = false;
var $rewritecode = var $rewritecode =
array( array(
'%year%', '%year%',
'%monthnum%', '%monthnum%',
@ -185,7 +185,7 @@ class WP_Rewrite {
'%search%' '%search%'
); );
var $rewritereplace = var $rewritereplace =
array( array(
'([0-9]{4})', '([0-9]{4})',
'([0-9]{1,2})', '([0-9]{1,2})',
@ -201,7 +201,7 @@ class WP_Rewrite {
'(.+)' '(.+)'
); );
var $queryreplace = var $queryreplace =
array ( array (
'year=', 'year=',
'monthnum=', 'monthnum=',
@ -218,7 +218,7 @@ class WP_Rewrite {
); );
var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
function using_permalinks() { function using_permalinks() {
if (empty($this->permalink_structure)) if (empty($this->permalink_structure))
return false; return false;
@ -235,7 +235,7 @@ class WP_Rewrite {
if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) { if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) {
return true; return true;
} }
return false; return false;
} }
@ -251,11 +251,11 @@ class WP_Rewrite {
$match_suffix = ''; $match_suffix = '';
if (! empty($this->matches)) { if (! empty($this->matches)) {
$match_prefix = '$' . $this->matches . '['; $match_prefix = '$' . $this->matches . '[';
$match_suffix = ']'; $match_suffix = ']';
} }
return "$match_prefix$number$match_suffix"; return "$match_prefix$number$match_suffix";
} }
function page_rewrite_rules() { function page_rewrite_rules() {
@ -301,13 +301,13 @@ class WP_Rewrite {
$date_endian= $endian; $date_endian= $endian;
break; break;
} }
} }
if ( empty($date_endian) ) if ( empty($date_endian) )
$date_endian = '%year%/%monthnum%/%day%'; $date_endian = '%year%/%monthnum%/%day%';
// Do not allow the date tags and %post_id% to overlap in the permalink // Do not allow the date tags and %post_id% to overlap in the permalink
// structure. If they do, move the date tags to $front/date/. // structure. If they do, move the date tags to $front/date/.
$front = $this->front; $front = $this->front;
preg_match_all('/%.+?%/', $this->permalink_structure, $tokens); preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
$tok_index = 1; $tok_index = 1;
@ -482,11 +482,11 @@ class WP_Rewrite {
//build a regex to match the trackback and page/xx parts of URLs //build a regex to match the trackback and page/xx parts of URLs
$trackbackregex = 'trackback/?$'; $trackbackregex = 'trackback/?$';
$pageregex = 'page/?([0-9]{1,})/?$'; $pageregex = 'page/?([0-9]{1,})/?$';
//build up an array of endpoint regexes to append => queries to append //build up an array of endpoint regexes to append => queries to append
if ($endpoints) { if ($endpoints) {
$ep_query_append = array (); $ep_query_append = array ();
foreach ($this->endpoints as $endpoint) { foreach ($this->endpoints as $endpoint) {
//match everything after the endpoint name, but allow for nothing to appear there //match everything after the endpoint name, but allow for nothing to appear there
$epmatch = $endpoint[1] . '(/(.*))?/?$'; $epmatch = $endpoint[1] . '(/(.*))?/?$';
//this will be appended on to the rest of the query for each dir //this will be appended on to the rest of the query for each dir
@ -511,7 +511,7 @@ class WP_Rewrite {
if (0 < $i) { if (0 < $i) {
$queries[$i] = $queries[$i - 1] . '&'; $queries[$i] = $queries[$i - 1] . '&';
} }
$query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1); $query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1);
$queries[$i] .= $query_token; $queries[$i] .= $query_token;
} }
@ -548,7 +548,7 @@ class WP_Rewrite {
$num_toks = preg_match_all('/%.+?%/', $struct, $toks); $num_toks = preg_match_all('/%.+?%/', $struct, $toks);
//get the 'tagname=$matches[i]' //get the 'tagname=$matches[i]'
$query = $queries[$num_toks - 1]; $query = $queries[$num_toks - 1];
//set up $ep_mask_specific which is used to match more specific URL types //set up $ep_mask_specific which is used to match more specific URL types
switch ($dirs[$j]) { switch ($dirs[$j]) {
case '%year%': $ep_mask_specific = EP_YEAR; break; case '%year%': $ep_mask_specific = EP_YEAR; break;
@ -580,15 +580,15 @@ class WP_Rewrite {
$rewrite = array($feedmatch => $feedquery, $feedmatch2 => $feedquery2); $rewrite = array($feedmatch => $feedquery, $feedmatch2 => $feedquery2);
if ($paged) //...and /page/xx ones if ($paged) //...and /page/xx ones
$rewrite = array_merge($rewrite, array($pagematch => $pagequery)); $rewrite = array_merge($rewrite, array($pagematch => $pagequery));
//if we've got some tags in this dir //if we've got some tags in this dir
if ($num_toks) { if ($num_toks) {
$post = false; $post = false;
$page = false; $page = false;
//check to see if this dir is permalink-level: i.e. the structure specifies an //check to see if this dir is permalink-level: i.e. the structure specifies an
//individual post. Do this by checking it contains at least one of 1) post name, //individual post. Do this by checking it contains at least one of 1) post name,
//2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and //2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
//minute all present). Set these flags now as we need them for the endpoints. //minute all present). Set these flags now as we need them for the endpoints.
if (strstr($struct, '%postname%') || strstr($struct, '%post_id%') if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
|| strstr($struct, '%pagename%') || strstr($struct, '%pagename%')
@ -597,7 +597,7 @@ class WP_Rewrite {
if ( strstr($struct, '%pagename%') ) if ( strstr($struct, '%pagename%') )
$page = true; $page = true;
} }
//do endpoints //do endpoints
if ($endpoints) { if ($endpoints) {
foreach ($ep_query_append as $regex => $ep) { foreach ($ep_query_append as $regex => $ep) {
@ -607,7 +607,7 @@ class WP_Rewrite {
} }
} }
} }
//if we're creating rules for a permalink, do all the endpoints like attachments etc //if we're creating rules for a permalink, do all the endpoints like attachments etc
if ($post) { if ($post) {
$post = true; $post = true;
@ -618,7 +618,7 @@ class WP_Rewrite {
$match = rtrim($match, '/'); $match = rtrim($match, '/');
//get rid of brackets //get rid of brackets
$submatchbase = str_replace(array('(',')'),'',$match); $submatchbase = str_replace(array('(',')'),'',$match);
//add a rule for at attachments, which take the form of <permalink>/some-text //add a rule for at attachments, which take the form of <permalink>/some-text
$sub1 = $submatchbase . '/([^/]+)/'; $sub1 = $submatchbase . '/([^/]+)/';
$sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/... $sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/...
@ -626,19 +626,19 @@ class WP_Rewrite {
$sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...) $sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...)
//add an ? as we don't have to match that last slash, and finally a $ so we //add an ? as we don't have to match that last slash, and finally a $ so we
//match to the end of the URL //match to the end of the URL
//add another rule to match attachments in the explicit form: //add another rule to match attachments in the explicit form:
//<permalink>/attachment/some-text //<permalink>/attachment/some-text
$sub2 = $submatchbase . '/attachment/([^/]+)/'; $sub2 = $submatchbase . '/attachment/([^/]+)/';
$sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback $sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback
$sub2feed = $sub2 . $feedregex; //feeds, <permalink>/attachment/feed/(atom|...) $sub2feed = $sub2 . $feedregex; //feeds, <permalink>/attachment/feed/(atom|...)
$sub2feed2 = $sub2 . $feedregex2; //and feeds again on to this <permalink>/attachment/(feed|atom...) $sub2feed2 = $sub2 . $feedregex2; //and feeds again on to this <permalink>/attachment/(feed|atom...)
//create queries for these extra tag-ons we've just dealt with //create queries for these extra tag-ons we've just dealt with
$subquery = $index . '?attachment=' . $this->preg_index(1); $subquery = $index . '?attachment=' . $this->preg_index(1);
$subtbquery = $subquery . '&tb=1'; $subtbquery = $subquery . '&tb=1';
$subfeedquery = $subquery . '&feed=' . $this->preg_index(2); $subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
//do endpoints for attachments //do endpoints for attachments
if ($endpoint) { foreach ($ep_query_append as $regex => $ep) { if ($endpoint) { foreach ($ep_query_append as $regex => $ep) {
if ($ep[0] & EP_ATTACHMENT) { if ($ep[0] & EP_ATTACHMENT) {
@ -646,11 +646,11 @@ class WP_Rewrite {
$rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
} }
} } } }
//now we've finished with endpoints, finish off the $sub1 and $sub2 matches //now we've finished with endpoints, finish off the $sub1 and $sub2 matches
$sub1 .= '?$'; $sub1 .= '?$';
$sub2 .= '?$'; $sub2 .= '?$';
//allow URLs like <permalink>/2 for <permalink>/page/2 //allow URLs like <permalink>/2 for <permalink>/page/2
$match = $match . '(/[0-9]+)?/?$'; $match = $match . '(/[0-9]+)?/?$';
$query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1); $query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1);
@ -659,7 +659,7 @@ class WP_Rewrite {
$match .= '?$'; $match .= '?$';
$query = $index . '?' . $query; $query = $index . '?' . $query;
} }
//create the final array for this dir by joining the $rewrite array (which currently //create the final array for this dir by joining the $rewrite array (which currently
//only contains rules/queries for trackback, pages etc) to the main regex/query for //only contains rules/queries for trackback, pages etc) to the main regex/query for
//this dir //this dir
@ -669,7 +669,7 @@ class WP_Rewrite {
if ($post) { if ($post) {
//add trackback //add trackback
$rewrite = array_merge(array($trackbackmatch => $trackbackquery), $rewrite); $rewrite = array_merge(array($trackbackmatch => $trackbackquery), $rewrite);
//add regexes/queries for attachments, attachment trackbacks and so on //add regexes/queries for attachments, attachment trackbacks and so on
if ( ! $page ) //require <permalink>/attachment/stuff form for pages because of confusion with subpages if ( ! $page ) //require <permalink>/attachment/stuff form for pages because of confusion with subpages
$rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery)); $rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery));
@ -763,11 +763,11 @@ class WP_Rewrite {
$home_root = parse_url(get_option('home')); $home_root = parse_url(get_option('home'));
$home_root = trailingslashit($home_root['path']); $home_root = trailingslashit($home_root['path']);
$rules = "<IfModule mod_rewrite.c>\n"; $rules = "<IfModule mod_rewrite.c>\n";
$rules .= "RewriteEngine On\n"; $rules .= "RewriteEngine On\n";
$rules .= "RewriteBase $home_root\n"; $rules .= "RewriteBase $home_root\n";
//add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all) //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
foreach ($this->non_wp_rules as $match => $query) { foreach ($this->non_wp_rules as $match => $query) {
// Apache 1.3 does not support the reluctant (non-greedy) modifier. // Apache 1.3 does not support the reluctant (non-greedy) modifier.
@ -819,7 +819,7 @@ class WP_Rewrite {
return $rules; return $rules;
} }
//Add a straight rewrite rule //Add a straight rewrite rule
function add_rule($regex, $redirect) { function add_rule($regex, $redirect) {
//get everything up to the first ? //get everything up to the first ?
@ -831,12 +831,12 @@ class WP_Rewrite {
$this->extra_rules[$regex] = $redirect; $this->extra_rules[$regex] = $redirect;
} }
} }
//add a rule that doesn't redirect to index.php //add a rule that doesn't redirect to index.php
function add_external_rule($regex, $redirect) { function add_external_rule($regex, $redirect) {
$this->non_wp_rules[$regex] = $redirect; $this->non_wp_rules[$regex] = $redirect;
} }
//add an endpoint, like /trackback/, to be inserted after certain URL types (specified in $places) //add an endpoint, like /trackback/, to be inserted after certain URL types (specified in $places)
function add_endpoint($name, $places) { function add_endpoint($name, $places) {
global $wp; global $wp;

View File

@ -11,7 +11,7 @@ define('RSS', 'RSS');
define('ATOM', 'Atom'); define('ATOM', 'Atom');
define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version); define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version);
class MagpieRSS { class MagpieRSS {
var $parser; var $parser;
var $current_item = array(); // item currently being parsed var $current_item = array(); // item currently being parsed
var $items = array(); // collection of parsed items var $items = array(); // collection of parsed items
@ -25,7 +25,7 @@ class MagpieRSS {
var $stack = array(); // parser stack var $stack = array(); // parser stack
var $inchannel = false; var $inchannel = false;
var $initem = false; var $initem = false;
var $incontent = false; // if in Atom <content mode="xml"> field var $incontent = false; // if in Atom <content mode="xml"> field
var $intextinput = false; var $intextinput = false;
var $inimage = false; var $inimage = false;
var $current_field = ''; var $current_field = '';
@ -54,10 +54,10 @@ class MagpieRSS {
# setup handlers # setup handlers
# #
xml_set_object( $this->parser, $this ); xml_set_object( $this->parser, $this );
xml_set_element_handler($this->parser, xml_set_element_handler($this->parser,
'feed_start_element', 'feed_end_element' ); 'feed_start_element', 'feed_end_element' );
xml_set_character_data_handler( $this->parser, 'feed_cdata' ); xml_set_character_data_handler( $this->parser, 'feed_cdata' );
$status = xml_parse( $this->parser, $source ); $status = xml_parse( $this->parser, $source );
@ -85,7 +85,7 @@ class MagpieRSS {
// check for a namespace, and split if found // check for a namespace, and split if found
$ns = false; $ns = false;
if ( strpos( $element, ':' ) ) { if ( strpos( $element, ':' ) ) {
list($ns, $el) = split( ':', $element, 2); list($ns, $el) = split( ':', $element, 2);
} }
if ( $ns and $ns != 'rdf' ) { if ( $ns and $ns != 'rdf' ) {
$this->current_namespace = $ns; $this->current_namespace = $ns;
@ -111,11 +111,11 @@ class MagpieRSS {
return; return;
} }
if ( $el == 'channel' ) if ( $el == 'channel' )
{ {
$this->inchannel = true; $this->inchannel = true;
} }
elseif ($el == 'item' or $el == 'entry' ) elseif ($el == 'item' or $el == 'entry' )
{ {
$this->initem = true; $this->initem = true;
if ( isset($attrs['rdf:about']) ) { if ( isset($attrs['rdf:about']) ) {
@ -125,18 +125,18 @@ class MagpieRSS {
// if we're in the default namespace of an RSS feed, // if we're in the default namespace of an RSS feed,
// record textinput or image fields // record textinput or image fields
elseif ( elseif (
$this->feed_type == RSS and $this->feed_type == RSS and
$this->current_namespace == '' and $this->current_namespace == '' and
$el == 'textinput' ) $el == 'textinput' )
{ {
$this->intextinput = true; $this->intextinput = true;
} }
elseif ( elseif (
$this->feed_type == RSS and $this->feed_type == RSS and
$this->current_namespace == '' and $this->current_namespace == '' and
$el == 'image' ) $el == 'image' )
{ {
$this->inimage = true; $this->inimage = true;
} }
@ -155,12 +155,12 @@ class MagpieRSS {
} }
// if inside an Atom content construct (e.g. content or summary) field treat tags as text // if inside an Atom content construct (e.g. content or summary) field treat tags as text
elseif ($this->feed_type == ATOM and $this->incontent ) elseif ($this->feed_type == ATOM and $this->incontent )
{ {
// if tags are inlined, then flatten // if tags are inlined, then flatten
$attrs_str = join(' ', $attrs_str = join(' ',
array_map('map_attrs', array_map('map_attrs',
array_keys($attrs), array_keys($attrs),
array_values($attrs) ) ); array_values($attrs) ) );
$this->append_content( "<$element $attrs_str>" ); $this->append_content( "<$element $attrs_str>" );
@ -172,9 +172,9 @@ class MagpieRSS {
// Magpie treats link elements of type rel='alternate' // Magpie treats link elements of type rel='alternate'
// as being equivalent to RSS's simple link element. // as being equivalent to RSS's simple link element.
// //
elseif ($this->feed_type == ATOM and $el == 'link' ) elseif ($this->feed_type == ATOM and $el == 'link' )
{ {
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
{ {
$link_el = 'link'; $link_el = 'link';
} }
@ -194,7 +194,7 @@ class MagpieRSS {
function feed_cdata ($p, $text) { function feed_cdata ($p, $text) {
if ($this->feed_type == ATOM and $this->incontent) if ($this->feed_type == ATOM and $this->incontent)
{ {
$this->append_content( $text ); $this->append_content( $text );
} }
@ -207,17 +207,17 @@ class MagpieRSS {
function feed_end_element ($p, $el) { function feed_end_element ($p, $el) {
$el = strtolower($el); $el = strtolower($el);
if ( $el == 'item' or $el == 'entry' ) if ( $el == 'item' or $el == 'entry' )
{ {
$this->items[] = $this->current_item; $this->items[] = $this->current_item;
$this->current_item = array(); $this->current_item = array();
$this->initem = false; $this->initem = false;
} }
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
{ {
$this->intextinput = false; $this->intextinput = false;
} }
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
{ {
$this->inimage = false; $this->inimage = false;
} }
@ -225,14 +225,14 @@ class MagpieRSS {
{ {
$this->incontent = false; $this->incontent = false;
} }
elseif ($el == 'channel' or $el == 'feed' ) elseif ($el == 'channel' or $el == 'feed' )
{ {
$this->inchannel = false; $this->inchannel = false;
} }
elseif ($this->feed_type == ATOM and $this->incontent ) { elseif ($this->feed_type == ATOM and $this->incontent ) {
// balance tags properly // balance tags properly
// note: i don't think this is actually neccessary // note: i don't think this is actually neccessary
if ( $this->stack[0] == $el ) if ( $this->stack[0] == $el )
{ {
$this->append_content("</$el>"); $this->append_content("</$el>");
} }
@ -270,7 +270,7 @@ class MagpieRSS {
if (!$el) { if (!$el) {
return; return;
} }
if ( $this->current_namespace ) if ( $this->current_namespace )
{ {
if ( $this->initem ) { if ( $this->initem ) {
$this->concat( $this->concat(
@ -395,7 +395,7 @@ function fetch_rss ($url) {
// error("Failed to fetch $url and cache is off"); // error("Failed to fetch $url and cache is off");
return false; return false;
} }
} }
// else cache is ON // else cache is ON
else { else {
// Flow // Flow
@ -472,7 +472,7 @@ function fetch_rss ($url) {
if ( $resp->error ) { if ( $resp->error ) {
# compensate for Snoopy's annoying habbit to tacking # compensate for Snoopy's annoying habbit to tacking
# on '\n' # on '\n'
$http_error = substr($resp->error, 0, -2); $http_error = substr($resp->error, 0, -2);
$errormsg .= "(HTTP Error: $http_error)"; $errormsg .= "(HTTP Error: $http_error)";
} }
else { else {
@ -613,28 +613,28 @@ function init () {
} }
} }
function is_info ($sc) { function is_info ($sc) {
return $sc >= 100 && $sc < 200; return $sc >= 100 && $sc < 200;
} }
function is_success ($sc) { function is_success ($sc) {
return $sc >= 200 && $sc < 300; return $sc >= 200 && $sc < 300;
} }
function is_redirect ($sc) { function is_redirect ($sc) {
return $sc >= 300 && $sc < 400; return $sc >= 300 && $sc < 400;
} }
function is_error ($sc) { function is_error ($sc) {
return $sc >= 400 && $sc < 600; return $sc >= 400 && $sc < 600;
} }
function is_client_error ($sc) { function is_client_error ($sc) {
return $sc >= 400 && $sc < 500; return $sc >= 400 && $sc < 500;
} }
function is_server_error ($sc) { function is_server_error ($sc) {
return $sc >= 500 && $sc < 600; return $sc >= 500 && $sc < 600;
} }
class RSSCache { class RSSCache {
@ -685,7 +685,7 @@ class RSSCache {
$cache_option = 'rss_' . $this->file_name( $url ); $cache_option = 'rss_' . $this->file_name( $url );
if ( ! get_option( $cache_option ) ) { if ( ! get_option( $cache_option ) ) {
$this->debug( $this->debug(
"Cache doesn't contain: $url (cache option: $cache_option)" "Cache doesn't contain: $url (cache option: $cache_option)"
); );
return 0; return 0;
@ -757,7 +757,7 @@ class RSSCache {
\*=======================================================================*/ \*=======================================================================*/
function error ($errormsg, $lvl=E_USER_WARNING) { function error ($errormsg, $lvl=E_USER_WARNING) {
// append PHP's error message if track_errors enabled // append PHP's error message if track_errors enabled
if ( isset($php_errormsg) ) { if ( isset($php_errormsg) ) {
$errormsg .= " ($php_errormsg)"; $errormsg .= " ($php_errormsg)";
} }
$this->ERROR = $errormsg; $this->ERROR = $errormsg;
@ -781,7 +781,7 @@ function parse_w3cdtf ( $date_str ) {
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
if ( preg_match( $pat, $date_str, $match ) ) { if ( preg_match( $pat, $date_str, $match ) ) {
list( $year, $month, $day, $hours, $minutes, $seconds) = list( $year, $month, $day, $hours, $minutes, $seconds) =
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
# calc epoch for current date assuming GMT # calc epoch for current date assuming GMT

View File

@ -73,7 +73,7 @@ class WP_Scripts {
} }
} }
} }
/** /**
* Determines dependencies of scripts * Determines dependencies of scripts
@ -159,7 +159,7 @@ class WP_Scripts {
endswitch; endswitch;
return false; return false;
} }
} }
class _WP_Script { class _WP_Script {

View File

@ -152,7 +152,7 @@ function setup_userdata($user_id = '') {
if ( '' == $user_id ) if ( '' == $user_id )
$user = wp_get_current_user(); $user = wp_get_current_user();
else else
$user = new WP_User($user_id); $user = new WP_User($user_id);
if ( 0 == $user->ID ) if ( 0 == $user->ID )

View File

@ -90,7 +90,7 @@ class wpdb {
function print_error($str = '') { function print_error($str = '') {
global $EZSQL_ERROR; global $EZSQL_ERROR;
if (!$str) $str = mysql_error(); if (!$str) $str = mysql_error();
$EZSQL_ERROR[] = $EZSQL_ERROR[] =
array ('query' => $this->last_query, 'error_str' => $str); array ('query' => $this->last_query, 'error_str' => $str);
$str = htmlspecialchars($str, ENT_QUOTES); $str = htmlspecialchars($str, ENT_QUOTES);

View File

@ -16,11 +16,11 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
?><?php echo '<?xml version="1.0"?'.">\n"; ?> ?><?php echo '<?xml version="1.0"?'.">\n"; ?>
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" --> <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
<opml version="1.0"> <opml version="1.0">
<head> <head>
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title> <title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated> <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
</head> </head>
<body> <body>
<?php <?php
if (empty ($link_cat)) if (empty ($link_cat))
@ -36,7 +36,7 @@ foreach ((array) $cats as $cat) {
$bookmarks = get_bookmarks("category={$cat->cat_ID}"); $bookmarks = get_bookmarks("category={$cat->cat_ID}");
foreach ((array) $bookmarks as $bookmark) { foreach ((array) $bookmarks as $bookmark) {
?> ?>
<outline text="<?php echo wp_specialchars($bookmark->link_name); ?>" type="link" xmlUrl="<?php echo wp_specialchars($bookmark->link_rss); ?>" htmlUrl="<?php echo wp_specialchars($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" /> <outline text="<?php echo wp_specialchars($bookmark->link_name); ?>" type="link" xmlUrl="<?php echo wp_specialchars($bookmark->link_rss); ?>" htmlUrl="<?php echo wp_specialchars($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
<?php <?php
} }

View File

@ -274,7 +274,7 @@ case 'register' :
<?php <?php
break; break;
case 'login' : case 'login' :
default: default:
$user_login = ''; $user_login = '';
$user_pass = ''; $user_pass = '';

View File

@ -12,7 +12,7 @@ $more = 1;
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" --> <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
<rss version="2.0" <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"

View File

@ -47,8 +47,8 @@ if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
$blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset); $blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset);
} }
if ( is_single() || is_page() ) if ( is_single() || is_page() )
$tb_id = $posts[0]->ID; $tb_id = $posts[0]->ID;
if ( !intval( $tb_id ) ) if ( !intval( $tb_id ) )
trackback_response(1, 'I really need an ID for this to work.'); trackback_response(1, 'I really need an ID for this to work.');

View File

@ -66,48 +66,48 @@ class wp_xmlrpc_server extends IXR_Server {
function wp_xmlrpc_server() { function wp_xmlrpc_server() {
$this->methods = array( $this->methods = array(
// Blogger API // Blogger API
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
'blogger.getUserInfo' => 'this:blogger_getUserInfo', 'blogger.getUserInfo' => 'this:blogger_getUserInfo',
'blogger.getPost' => 'this:blogger_getPost', 'blogger.getPost' => 'this:blogger_getPost',
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
'blogger.getTemplate' => 'this:blogger_getTemplate', 'blogger.getTemplate' => 'this:blogger_getTemplate',
'blogger.setTemplate' => 'this:blogger_setTemplate', 'blogger.setTemplate' => 'this:blogger_setTemplate',
'blogger.newPost' => 'this:blogger_newPost', 'blogger.newPost' => 'this:blogger_newPost',
'blogger.editPost' => 'this:blogger_editPost', 'blogger.editPost' => 'this:blogger_editPost',
'blogger.deletePost' => 'this:blogger_deletePost', 'blogger.deletePost' => 'this:blogger_deletePost',
// MetaWeblog API (with MT extensions to structs) // MetaWeblog API (with MT extensions to structs)
'metaWeblog.newPost' => 'this:mw_newPost', 'metaWeblog.newPost' => 'this:mw_newPost',
'metaWeblog.editPost' => 'this:mw_editPost', 'metaWeblog.editPost' => 'this:mw_editPost',
'metaWeblog.getPost' => 'this:mw_getPost', 'metaWeblog.getPost' => 'this:mw_getPost',
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts', 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
'metaWeblog.getCategories' => 'this:mw_getCategories', 'metaWeblog.getCategories' => 'this:mw_getCategories',
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject', 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
// MetaWeblog API aliases for Blogger API // MetaWeblog API aliases for Blogger API
// see http://www.xmlrpc.com/stories/storyReader$2460 // see http://www.xmlrpc.com/stories/storyReader$2460
'metaWeblog.deletePost' => 'this:blogger_deletePost', 'metaWeblog.deletePost' => 'this:blogger_deletePost',
'metaWeblog.getTemplate' => 'this:blogger_getTemplate', 'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
'metaWeblog.setTemplate' => 'this:blogger_setTemplate', 'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
// MovableType API // MovableType API
'mt.getCategoryList' => 'this:mt_getCategoryList', 'mt.getCategoryList' => 'this:mt_getCategoryList',
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles', 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
'mt.getPostCategories' => 'this:mt_getPostCategories', 'mt.getPostCategories' => 'this:mt_getPostCategories',
'mt.setPostCategories' => 'this:mt_setPostCategories', 'mt.setPostCategories' => 'this:mt_setPostCategories',
'mt.supportedMethods' => 'this:mt_supportedMethods', 'mt.supportedMethods' => 'this:mt_supportedMethods',
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
'mt.publishPost' => 'this:mt_publishPost', 'mt.publishPost' => 'this:mt_publishPost',
// PingBack // PingBack
'pingback.ping' => 'this:pingback_ping', 'pingback.ping' => 'this:pingback_ping',
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
'demo.sayHello' => 'this:sayHello', 'demo.sayHello' => 'this:sayHello',
'demo.addTwoNumbers' => 'this:addTwoNumbers' 'demo.addTwoNumbers' => 'this:addTwoNumbers'
); );
$this->methods = apply_filters('xmlrpc_methods', $this->methods); $this->methods = apply_filters('xmlrpc_methods', $this->methods);
$this->IXR_Server($this->methods); $this->IXR_Server($this->methods);
@ -124,11 +124,11 @@ class wp_xmlrpc_server extends IXR_Server {
} }
function login_pass_ok($user_login, $user_pass) { function login_pass_ok($user_login, $user_pass) {
if (!user_pass_ok($user_login, $user_pass)) { if (!user_pass_ok($user_login, $user_pass)) {
$this->error = new IXR_Error(403, 'Bad login/pass combination.'); $this->error = new IXR_Error(403, 'Bad login/pass combination.');
return false; return false;
} }
return true; return true;
} }
function escape(&$array) { function escape(&$array) {
@ -181,25 +181,25 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$user_data = get_userdatabylogin($user_login); $user_data = get_userdatabylogin($user_login);
$struct = array( $struct = array(
'nickname' => $user_data->nickname, 'nickname' => $user_data->nickname,
'userid' => $user_data->ID, 'userid' => $user_data->ID,
'url' => $user_data->user_url, 'url' => $user_data->user_url,
'email' => $user_data->user_email, 'email' => $user_data->user_email,
'lastname' => $user_data->last_name, 'lastname' => $user_data->last_name,
'firstname' => $user_data->first_name 'firstname' => $user_data->first_name
); );
return $struct; return $struct;
} }
@ -208,81 +208,81 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[1]; $post_ID = $args[1];
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$user_data = get_userdatabylogin($user_login); $user_data = get_userdatabylogin($user_login);
$post_data = wp_get_single_post($post_ID, ARRAY_A); $post_data = wp_get_single_post($post_ID, ARRAY_A);
$categories = implode(',', wp_get_post_categories($post_ID)); $categories = implode(',', wp_get_post_categories($post_ID));
$content = '<title>'.stripslashes($post_data['post_title']).'</title>'; $content = '<title>'.stripslashes($post_data['post_title']).'</title>';
$content .= '<category>'.$categories.'</category>'; $content .= '<category>'.$categories.'</category>';
$content .= stripslashes($post_data['post_content']); $content .= stripslashes($post_data['post_content']);
$struct = array( $struct = array(
'userid' => $post_data['post_author'], 'userid' => $post_data['post_author'],
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])), 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
'content' => $content, 'content' => $content,
'postid' => $post_data['ID'] 'postid' => $post_data['ID']
); );
return $struct; return $struct;
} }
/* blogger.getRecentPosts ...gets recent posts */ /* blogger.getRecentPosts ...gets recent posts */
function blogger_getRecentPosts($args) { function blogger_getRecentPosts($args) {
global $wpdb; global $wpdb;
$this->escape($args); $this->escape($args);
$blog_ID = $args[1]; /* though we don't use it yet */ $blog_ID = $args[1]; /* though we don't use it yet */
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
$num_posts = $args[4]; $num_posts = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$posts_list = wp_get_recent_posts($num_posts); $posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) { if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error; return $this->error;
} }
foreach ($posts_list as $entry) { foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$categories = implode(',', wp_get_post_categories($entry['ID']));
$content = '<title>'.stripslashes($entry['post_title']).'</title>'; $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$content .= '<category>'.$categories.'</category>'; $categories = implode(',', wp_get_post_categories($entry['ID']));
$content .= stripslashes($entry['post_content']);
$struct[] = array( $content = '<title>'.stripslashes($entry['post_title']).'</title>';
'userid' => $entry['post_author'], $content .= '<category>'.$categories.'</category>';
'dateCreated' => new IXR_Date($post_date), $content .= stripslashes($entry['post_content']);
'content' => $content,
'postid' => $entry['ID'],
);
} $struct[] = array(
'userid' => $entry['post_author'],
'dateCreated' => new IXR_Date($post_date),
'content' => $content,
'postid' => $entry['ID'],
);
$recent_posts = array(); }
for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts; $recent_posts = array();
for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts;
} }
@ -712,96 +712,96 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$num_posts = $args[3]; $num_posts = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$posts_list = wp_get_recent_posts($num_posts); $posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) { if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error; return $this->error;
} }
foreach ($posts_list as $entry) { foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$categories = array();
$catids = wp_get_post_categories($entry['ID']);
foreach($catids as $catid) {
$categories[] = get_cat_name($catid);
}
$post = get_extended($entry['post_content']); $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$link = post_permalink($entry['ID']); $categories = array();
$catids = wp_get_post_categories($entry['ID']);
foreach($catids as $catid) {
$categories[] = get_cat_name($catid);
}
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; $post = get_extended($entry['post_content']);
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; $link = post_permalink($entry['ID']);
$struct[] = array( $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
'dateCreated' => new IXR_Date($post_date), $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
'userid' => $entry['post_author'],
'postid' => $entry['ID'], $struct[] = array(
'description' => $post['main'], 'dateCreated' => new IXR_Date($post_date),
'title' => $entry['post_title'], 'userid' => $entry['post_author'],
'link' => $link, 'postid' => $entry['ID'],
'permaLink' => $link, 'description' => $post['main'],
'title' => $entry['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this // commented out because no other tool seems to use this
// 'content' => $entry['post_content'], // 'content' => $entry['post_content'],
'categories' => $categories, 'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'], 'mt_excerpt' => $entry['post_excerpt'],
'mt_text_more' => $post['extended'], 'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments, 'mt_allow_comments' => $allow_comments,
'mt_allow_pings' => $allow_pings 'mt_allow_pings' => $allow_pings
); );
} }
$recent_posts = array(); $recent_posts = array();
for ($j=0; $j<count($struct); $j++) { for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]); array_push($recent_posts, $struct[$j]);
} }
return $recent_posts; return $recent_posts;
} }
/* metaweblog.getCategories ...returns the list of categories on a given weblog */ /* metaweblog.getCategories ...returns the list of categories on a given weblog */
function mw_getCategories($args) { function mw_getCategories($args) {
global $wpdb; global $wpdb;
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$categories_struct = array(); $categories_struct = array();
// FIXME: can we avoid using direct SQL there? // FIXME: can we avoid using direct SQL there?
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) { if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
foreach ($cats as $cat) { foreach ($cats as $cat) {
$struct['categoryId'] = $cat['cat_ID']; $struct['categoryId'] = $cat['cat_ID'];
$struct['description'] = $cat['cat_name']; $struct['description'] = $cat['cat_name'];
$struct['categoryName'] = $cat['cat_name']; $struct['categoryName'] = $cat['cat_name'];
$struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID'])); $struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID']));
$struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name'])); $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name']));
$categories_struct[] = $struct; $categories_struct[] = $struct;
} }
} }
return $categories_struct; return $categories_struct;
} }
@ -852,72 +852,72 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$num_posts = $args[3]; $num_posts = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$posts_list = wp_get_recent_posts($num_posts); $posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) { if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error; return $this->error;
} }
foreach ($posts_list as $entry) { foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$struct[] = array( $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'title' => $entry['post_title'],
);
} $struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'title' => $entry['post_title'],
);
$recent_posts = array(); }
for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]); $recent_posts = array();
} for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
return $recent_posts; }
return $recent_posts;
} }
/* mt.getCategoryList ...returns the list of categories on a given weblog */ /* mt.getCategoryList ...returns the list of categories on a given weblog */
function mt_getCategoryList($args) { function mt_getCategoryList($args) {
global $wpdb; global $wpdb;
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$categories_struct = array(); $categories_struct = array();
// FIXME: can we avoid using direct SQL there? // FIXME: can we avoid using direct SQL there?
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) { if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
foreach ($cats as $cat) { foreach ($cats as $cat) {
$struct['categoryId'] = $cat['cat_ID']; $struct['categoryId'] = $cat['cat_ID'];
$struct['categoryName'] = $cat['cat_name']; $struct['categoryName'] = $cat['cat_name'];
$categories_struct[] = $struct; $categories_struct[] = $struct;
} }
} }
return $categories_struct; return $categories_struct;
} }
@ -926,28 +926,28 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
$categories = array(); $categories = array();
$catids = wp_get_post_categories(intval($post_ID)); $catids = wp_get_post_categories(intval($post_ID));
// first listed category will be the primary category // first listed category will be the primary category
$isPrimary = true; $isPrimary = true;
foreach($catids as $catid) { foreach($catids as $catid) {
$categories[] = array( $categories[] = array(
'categoryName' => get_cat_name($catid), 'categoryName' => get_cat_name($catid),
'categoryId' => $catid, 'categoryId' => $catid,
'isPrimary' => $isPrimary 'isPrimary' => $isPrimary
); );
$isPrimary = false; $isPrimary = false;
} }
return $categories; return $categories;
} }
@ -956,81 +956,81 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$categories = $args[3]; $categories = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
set_current_user(0, $user_login); set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) ) if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, 'Sorry, you can not edit this post.'); return new IXR_Error(401, 'Sorry, you can not edit this post.');
foreach($categories as $cat) { foreach($categories as $cat) {
$catids[] = $cat['categoryId']; $catids[] = $cat['categoryId'];
} }
wp_set_post_categories($post_ID, $catids); wp_set_post_categories($post_ID, $catids);
return true; return true;
} }
/* mt.supportedMethods ...returns an array of methods supported by this server */ /* mt.supportedMethods ...returns an array of methods supported by this server */
function mt_supportedMethods($args) { function mt_supportedMethods($args) {
$supported_methods = array(); $supported_methods = array();
foreach($this->methods as $key=>$value) { foreach($this->methods as $key=>$value) {
$supported_methods[] = $key; $supported_methods[] = $key;
} }
return $supported_methods; return $supported_methods;
} }
/* mt.supportedTextFilters ...returns an empty array because we don't /* mt.supportedTextFilters ...returns an empty array because we don't
support per-post text filters yet */ support per-post text filters yet */
function mt_supportedTextFilters($args) { function mt_supportedTextFilters($args) {
return array(); return array();
} }
/* mt.getTrackbackPings ...returns trackbacks sent to a given post */ /* mt.getTrackbackPings ...returns trackbacks sent to a given post */
function mt_getTrackbackPings($args) { function mt_getTrackbackPings($args) {
global $wpdb; global $wpdb;
$post_ID = intval($args); $post_ID = intval($args);
$actual_post = wp_get_single_post($post_ID, ARRAY_A); $actual_post = wp_get_single_post($post_ID, ARRAY_A);
if (!$actual_post) { if (!$actual_post) {
return new IXR_Error(404, 'Sorry, no such post.'); return new IXR_Error(404, 'Sorry, no such post.');
}
$comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID");
if (!$comments) {
return array();
}
$trackback_pings = array();
foreach($comments as $comment) {
if ( 'trackback' == $comment->comment_type ) {
$content = $comment->comment_content;
$title = substr($content, 8, (strpos($content, '</strong>') - 8));
$trackback_pings[] = array(
'pingTitle' => $title,
'pingURL' => $comment->comment_author_url,
'pingIP' => $comment->comment_author_IP
);
} }
}
return $trackback_pings; $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID");
if (!$comments) {
return array();
}
$trackback_pings = array();
foreach($comments as $comment) {
if ( 'trackback' == $comment->comment_type ) {
$content = $comment->comment_content;
$title = substr($content, 8, (strpos($content, '</strong>') - 8));
$trackback_pings[] = array(
'pingTitle' => $title,
'pingURL' => $comment->comment_author_url,
'pingIP' => $comment->comment_author_IP
);
}
}
return $trackback_pings;
} }
@ -1039,30 +1039,30 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
} }
set_current_user(0, $user_login); set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) ) if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, 'Sorry, you can not edit this post.'); return new IXR_Error(401, 'Sorry, you can not edit this post.');
$postdata = wp_get_single_post($post_ID,ARRAY_A); $postdata = wp_get_single_post($post_ID,ARRAY_A);
$postdata['post_status'] = 'publish'; $postdata['post_status'] = 'publish';
// retain old cats // retain old cats
$cats = wp_get_post_categories($post_ID); $cats = wp_get_post_categories($post_ID);
$postdata['post_category'] = $cats; $postdata['post_category'] = $cats;
$this->escape($postdata); $this->escape($postdata);
$result = wp_update_post($postdata); $result = wp_update_post($postdata);
return $result; return $result;
} }
@ -1073,7 +1073,7 @@ class wp_xmlrpc_server extends IXR_Server {
/* pingback.ping gets a pingback and registers it */ /* pingback.ping gets a pingback and registers it */
function pingback_ping($args) { function pingback_ping($args) {
global $wpdb, $wp_version; global $wpdb, $wp_version;
$this->escape($args); $this->escape($args);
@ -1090,7 +1090,7 @@ class wp_xmlrpc_server extends IXR_Server {
// Check if the page linked to is in our site // Check if the page linked to is in our site
$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
if( !$pos1 ) if( !$pos1 )
return new IXR_Error(0, 'Is there no link to us?'); return new IXR_Error(0, 'Is there no link to us?');
// let's find which post is linked to // let's find which post is linked to
// FIXME: does url_to_postid() cover all these cases already? // FIXME: does url_to_postid() cover all these cases already?
@ -1223,8 +1223,8 @@ class wp_xmlrpc_server extends IXR_Server {
/* pingback.extensions.getPingbacks returns an array of URLs /* pingback.extensions.getPingbacks returns an array of URLs
that pingbacked the given URL that pingbacked the given URL
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */ specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
function pingback_extensions_getPingbacks($args) { function pingback_extensions_getPingbacks($args) {
global $wpdb; global $wpdb;