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

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

View File

@ -385,15 +385,15 @@ function wp_update_link($linkdata) {
$link = add_magic_quotes($link);
// 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']) )
$link_cats = $linkdata['link_category'];
else
$link_cats = $link['link_category'];
$link_cats = $linkdata['link_category'];
else
$link_cats = $link['link_category'];
// Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata);
$linkdata['link_category'] = $link_cats;
$linkdata['link_category'] = $link_cats;
return wp_insert_link($linkdata);
}

View File

@ -38,13 +38,13 @@ else
$content = wp_specialchars($_REQUEST['content']);
$popupurl = wp_specialchars($_REQUEST['popupurl']);
if ( !empty($content) ) {
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
} else {
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
}
if ( !empty($content) ) {
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
} else {
$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">
<html xmlns="http://www.w3.org/1999/xhtml">
@ -77,15 +77,15 @@ $popupurl = wp_specialchars($_REQUEST['popupurl']);
}
#wpbookmarklet .wrap {
border: 0px;
border: 0px;
}
#wpbookmarklet #postdiv {
margin-bottom: 0.5em;
margin-bottom: 0.5em;
}
#wpbookmarklet #titlediv {
margin-bottom: 1em;
margin-bottom: 1em;
}
-->

View File

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

View File

@ -14,10 +14,10 @@ function customFieldsAddIn() {
for ( var i=0; i < inputs.length; i++ ) {
if ('text' == inputs[i].type) {
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) {
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

@ -22,8 +22,8 @@ if ( ! empty($cat_ID) ) {
<?php wp_nonce_field($nonce_action); ?>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<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>
<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>
</tr>
<tr>
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>

View File

@ -181,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
<p>
<strong><?php _e('No comments found.') ?></strong></p>
<strong><?php _e('No comments found.') ?></strong></p>
<?php
} // end if ($comments)

View File

@ -8,8 +8,7 @@ $messages[3] = __('Custom field deleted.');
<?php endif; ?>
<form name="post" action="post.php" method="post" id="post">
<?php if ( (isset($mode) && 'bookmarklet' == $mode) ||
isset($_GET['popupurl']) ): ?>
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
<input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?>
@ -140,8 +139,8 @@ endforeach;
</div>
<fieldset id="titlediv">
<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>
<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>
</fieldset>
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">

View File

@ -54,8 +54,8 @@ addLoadEvent(focusit);
<tr>
<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 />
<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_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>
</tr>
<?php if ( current_user_can('edit_posts') ) : ?>

View File

@ -55,16 +55,16 @@ edCanvas = document.getElementById('content');
<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') ?>" />
<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') ) : ?>
<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 if ('bookmarklet' != $mode) {
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()); ?>" />
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()); ?>" />
</p>
<?php do_action('simple_edit_form', ''); ?>

View File

@ -16,7 +16,7 @@ if (0 == $post_ID) {
$sendto = wp_get_referer();
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
$sendto = 'redo';
$sendto = 'redo';
$sendto = wp_specialchars( $sendto );
?>
@ -27,7 +27,7 @@ $sendto = wp_specialchars( $sendto );
wp_nonce_field($nonce_action);
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 ?>" />

View File

@ -11,11 +11,11 @@ require_once('admin-header.php');
<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">
<fieldset>
<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="submit" name="submit" value="<?php _e('Search') ?>" />
</fieldset>
<fieldset>
<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="submit" name="submit" value="<?php _e('Search') ?>" />
</fieldset>
</form>
<?php

View File

@ -15,8 +15,8 @@ if ($drafts || $other_drafts) {
?>
<div class="wrap">
<?php if ($drafts) { ?>
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
<p><strong><?php _e('Your Drafts:') ?></strong>
<?php
$i = 0;
foreach ($drafts as $draft) {
if (0 != $i)
@ -28,12 +28,12 @@ if ($drafts || $other_drafts) {
++$i;
}
?>
.</p>
.</p>
<?php } ?>
<?php if ($other_drafts) { ?>
<p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
<?php
<p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
<?php
$i = 0;
foreach ($other_drafts as $draft) {
if (0 != $i)
@ -45,7 +45,7 @@ if ($drafts || $other_drafts) {
++$i;
}
?>
.</p>
.</p>
<?php } ?>
@ -88,7 +88,7 @@ if ( count($arc_result) ) { ?>
<form name="viewarc" id="viewarc" action="" method="get">
<fieldset>
<legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'>
<select name='m'>
<?php
foreach ($arc_result as $arc_row) {
if ( $arc_row->yyear == 0 )
@ -127,12 +127,12 @@ if ( count($arc_result) ) { ?>
<?php
// define the columns to display, the syntax is 'internal name' => 'display name'
$posts_columns = array(
'id' => __('ID'),
'date' => __('When'),
'title' => __('Title'),
'categories' => __('Categories'),
'comments' => __('Comments'),
'author' => __('Author')
'id' => __('ID'),
'date' => __('When'),
'title' => __('Title'),
'categories' => __('Categories'),
'comments' => __('Comments'),
'author' => __('Author')
);
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
@ -196,8 +196,8 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'comments':
?>
<td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&amp;c=1">
<?php comments_number(__('0'), __('1'), __('%')) ?>
</a></td>
<?php comments_number(__('0'), __('1'), __('%')) ?>
</a></td>
<?php
break;

View File

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

View File

@ -60,57 +60,58 @@ if(!function_exists('link_exists'))
//
// 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_1byte($char) {
if(!is_int($char)) return false;
return ($char & 0x80) == 0x00;
}
function valid_3byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF0) == 0xE0;
}
function valid_2byte($char) {
if(!is_int($char)) return false;
return ($char & 0xE0) == 0xC0;
}
function valid_4byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF8) == 0xF0;
}
function valid_3byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF0) == 0xE0;
}
function valid_nextbyte($char) {
if(!is_int($char)) return false;
return ($char & 0xC0) == 0x80;
}
function valid_4byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF8) == 0xF0;
}
function valid_utf8($string) {
$len = strlen($string);
$i = 0;
while( $i < $len ) {
$char = ord(substr($string, $i++, 1));
if(valid_1byte($char)) { // continue
continue;
} else if(valid_2byte($char)) { // check 1 byte
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} else if(valid_3byte($char)) { // check 2 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
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 valid_nextbyte($char) {
if(!is_int($char)) return false;
return ($char & 0xC0) == 0x80;
}
function valid_utf8($string) {
$len = strlen($string);
$i = 0;
while( $i < $len ) {
$char = ord(substr($string, $i++, 1));
if(valid_1byte($char)) { // continue
continue;
} else if(valid_2byte($char)) { // check 1 byte
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
} else if(valid_3byte($char)) { // check 2 bytes
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
return false;
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
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) {
if (valid_utf8 ($s)) {
@ -186,7 +187,7 @@ class Dotclear_Import {
// Get Posts
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
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()

View File

@ -71,12 +71,12 @@ class Textpattern_Import {
// Get Categories
return $txpdb->get_results('SELECT
id,
name,
title
FROM '.$prefix.'txp_category
WHERE type = "article"',
ARRAY_A);
id,
name,
title
FROM '.$prefix.'txp_category
WHERE type = "article"',
ARRAY_A);
}
function get_txp_users()
@ -90,12 +90,12 @@ class Textpattern_Import {
// Get Users
return $txpdb->get_results('SELECT
user_id,
name,
RealName,
email,
privs
FROM '.$prefix.'txp_users', ARRAY_A);
user_id,
name,
RealName,
email,
privs
FROM '.$prefix.'txp_users', ARRAY_A);
}
function get_txp_posts()
@ -107,21 +107,21 @@ class Textpattern_Import {
// Get Posts
return $txpdb->get_results('SELECT
ID,
Posted,
AuthorID,
LastMod,
Title,
Body,
Excerpt,
Category1,
Category2,
Status,
Keywords,
url_title,
comments_count
FROM '.$prefix.'textpattern
', ARRAY_A);
ID,
Posted,
AuthorID,
LastMod,
Title,
Body,
Excerpt,
Category1,
Category2,
Status,
Keywords,
url_title,
comments_count
FROM '.$prefix.'textpattern
', ARRAY_A);
}
function get_txp_comments()
@ -144,14 +144,14 @@ class Textpattern_Import {
$prefix = get_option('tpre');
return $txpdb->get_results('SELECT
id,
date,
category,
url,
linkname,
description
FROM '.$prefix.'txp_link',
ARRAY_A);
id,
date,
category,
url,
linkname,
description
FROM '.$prefix.'txp_link',
ARRAY_A);
}
function cat2wp($categories='')
@ -302,35 +302,35 @@ class Textpattern_Import {
if($pinfo = post_exists($Title,$Body))
{
$ret_id = wp_insert_post(array(
'ID' => $pinfo,
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
'ID' => $pinfo,
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
}
else
{
$ret_id = wp_insert_post(array(
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
'post_date' => $Posted,
'post_date_gmt' => $post_date_gmt,
'post_author' => $authorid,
'post_modified' => $LastMod,
'post_modified_gmt' => $post_modified_gmt,
'post_title' => $Title,
'post_content' => $Body,
'post_excerpt' => $Excerpt,
'post_status' => $post_status,
'post_name' => $url_title,
'comment_count' => $comments_count)
);
}
$txpposts2wpposts[$ID] = $ret_id;
@ -379,29 +379,29 @@ class Textpattern_Import {
{
// Update comments
$ret_id = wp_update_comment(array(
'comment_ID' => $cinfo,
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
'comment_ID' => $cinfo,
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
}
else
{
// Insert comments
$ret_id = wp_insert_comment(array(
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_author_IP' => $ip,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
'comment_post_ID' => $comment_post_ID,
'comment_author' => $name,
'comment_author_email' => $email,
'comment_author_url' => $web,
'comment_author_IP' => $ip,
'comment_date' => $posted,
'comment_content' => $message,
'comment_approved' => $comment_approved)
);
}
$txpcm2wpcm[$comment_ID] = $ret_id;
}

View File

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

View File

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

View File

@ -143,8 +143,8 @@ if ($links)
echo $link->link_description . "</td>";
echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
?>
<td>
<?php
<td>
<?php
$cat_names = array();
foreach ($link->link_category as $category) {
@ -157,8 +157,8 @@ if ($links)
echo implode(', ', $cat_names);
?>
</td>
<td><?php echo $link->link_rel; ?></td>
<td align='center'><?php echo $visible; ?></td>
<td><?php echo $link->link_rel; ?></td>
<td align='center'><?php echo $visible; ?></td>
<?php
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
// we need to map XML attribute names to our columns
$opml_map = array('URL' => 'link_url',
'HTMLURL' => 'link_url',
'TEXT' => 'link_name',
'TITLE' => 'link_name',
'TARGET' => 'link_target',
'DESCRIPTION' => 'link_description',
'XMLURL' => 'link_rss'
'HTMLURL' => 'link_url',
'TEXT' => 'link_name',
'TITLE' => 'link_name',
'TARGET' => 'link_target',
'DESCRIPTION' => 'link_description',
'XMLURL' => 'link_rss'
);
$map = $opml_map;
@ -20,24 +20,24 @@ $map = $opml_map;
**/
function startElement($parser, $tagName, $attrs) {
global $updated_timestamp, $all_links, $map;
global $names, $urls, $targets, $descriptions, $feeds;
global $names, $urls, $targets, $descriptions, $feeds;
if ($tagName == 'OUTLINE') {
foreach (array_keys($map) as $key) {
if (isset($attrs[$key])) {
$$map[$key] = $attrs[$key];
}
}
foreach (array_keys($map) as $key) {
if (isset($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.
$names[] = $link_name;
$urls[] = $link_url;
$targets[] = $link_target;
// save the data away.
$names[] = $link_name;
$urls[] = $link_url;
$targets[] = $link_target;
$feeds[] = $link_rss;
$descriptions[] = $link_description;
} // end if outline
$descriptions[] = $link_description;
} // end if outline
}
/**
@ -55,9 +55,9 @@ $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!xml_parse($xml_parser, $opml, true)) {
echo(sprintf(__('XML error: %1$s at line %2$s'),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
echo(sprintf(__('XML error: %1$s at line %2$s'),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
// Free up memory used by the XML parser

View File

@ -31,7 +31,7 @@ case 'update':
foreach($comment as $key => $value) {
if ($feelinglucky && 'later' == $value)
$value = 'delete';
switch($value) {
switch($value) {
case 'later':
// do nothing with that comment
// wp_set_comment_status($key, "hold");
@ -41,10 +41,10 @@ case 'update':
wp_set_comment_status($key, 'delete');
++$item_deleted;
break;
case 'spam':
wp_set_comment_status($key, 'spam');
++$item_spam;
break;
case 'spam':
wp_set_comment_status($key, 'spam');
++$item_spam;
break;
case 'approve':
wp_set_comment_status($key, 'approve');
if ( get_option('comments_notify') == true ) {
@ -52,7 +52,7 @@ case 'update':
}
++$item_approved;
break;
}
}
}
$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";
}
}
if ($spam) {
if ('1' == $spam) {
if ($spam) {
if ('1' == $spam) {
echo __("1 comment marked as spam") . " <br/>\n";
} else {
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
}
}
} else {
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
}
}
if ($ignored) {
if ('1' == $ignored) {
echo __("1 comment unchanged") . " <br/>\n";
@ -151,13 +151,13 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
</li>
<?php
}
}
?>
</ol>
</ol>
<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">
// <![CDATA[
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>
</p>
</noscript>
</form>
</form>
<?php
} else {
// nothing to approve
// nothing to approve
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
}
?>

View File

@ -62,7 +62,7 @@ default:
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?>
<div class="wrap">
<?php
<?php
if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
} else {
@ -75,35 +75,35 @@ default:
<?php
if ($plugin_files) :
?>
<ul>
<?php foreach($plugin_files as $plugin_file) : ?>
<ul>
<?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>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php if (!$error) { ?>
<form name="template" id="template" action="plugin-editor.php" method="post">
<?php wp_nonce_field('edit-plugin_' . $file) ?>
<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="file" value="<?php echo $file ?>" />
<?php if (!$error) { ?>
<form name="template" id="template" action="plugin-editor.php" method="post">
<?php wp_nonce_field('edit-plugin_' . $file) ?>
<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="file" value="<?php echo $file ?>" />
</div>
<?php if ( is_writeable($real_file) ) : ?>
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?>
</p>
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?>
</p>
<?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; ?>
</form>
<?php
</form>
<?php
} else {
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>
<?php

View File

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

View File

@ -2,7 +2,7 @@
define('WP_INSTALLING', true);
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');
@ -86,11 +86,11 @@ switch($step) {
<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>
<li>Database name</li>
<li>Database username</li>
<li>Database password</li>
<li>Database host</li>
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
<li>Database name</li>
<li>Database username</li>
<li>Database password</li>
<li>Database host</li>
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
</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>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>
@ -101,81 +101,81 @@ switch($step) {
?>
</p>
<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>
<table>
<tr>
<th scope="row">Database Name</th>
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
<td>The name of the database you want to run WP in. </td>
</tr>
<tr>
<th scope="row">User Name</th>
<td><input name="uname" type="text" size="25" value="username" /></td>
<td>Your MySQL username</td>
</tr>
<tr>
<th scope="row">Password</th>
<td><input name="pwd" type="text" size="25" value="password" /></td>
<td>...and MySQL password.</td>
</tr>
<tr>
<th scope="row">Database Host</th>
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
<td>99% chance you won't need to change this value.</td>
</tr>
<tr>
<th scope="row">Table Prefix</th>
<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>
</tr>
</table>
<h2 class="step">
<input name="submit" type="submit" value="Submit" />
</h2>
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
<table>
<tr>
<th scope="row">Database Name</th>
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
<td>The name of the database you want to run WP in. </td>
</tr>
<tr>
<th scope="row">User Name</th>
<td><input name="uname" type="text" size="25" value="username" /></td>
<td>Your MySQL username</td>
</tr>
<tr>
<th scope="row">Password</th>
<td><input name="pwd" type="text" size="25" value="password" /></td>
<td>...and MySQL password.</td>
</tr>
<tr>
<th scope="row">Database Host</th>
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
<td>99% chance you won't need to change this value.</td>
</tr>
<tr>
<th scope="row">Table Prefix</th>
<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>
</tr>
</table>
<h2 class="step">
<input name="submit" type="submit" value="Submit" />
</h2>
</form>
<?php
break;
case 2:
$dbname = trim($_POST['dbname']);
$uname = trim($_POST['uname']);
$passwrd = trim($_POST['pwd']);
$dbhost = trim($_POST['dbhost']);
$uname = trim($_POST['uname']);
$passwrd = trim($_POST['pwd']);
$dbhost = trim($_POST['dbhost']);
$prefix = trim($_POST['prefix']);
if (empty($prefix)) $prefix = 'wp_';
// Test the db connection.
define('DB_NAME', $dbname);
define('DB_USER', $uname);
define('DB_PASSWORD', $passwrd);
define('DB_HOST', $dbhost);
// Test the db connection.
define('DB_NAME', $dbname);
define('DB_USER', $uname);
define('DB_PASSWORD', $passwrd);
define('DB_HOST', $dbhost);
// We'll fail here if the values are no good.
require_once('../wp-includes/wp-db.php');
// We'll fail here if the values are no good.
require_once('../wp-includes/wp-db.php');
$handle = fopen('../wp-config.php', 'w');
foreach ($configFile as $line_num => $line) {
switch (substr($line,0,16)) {
case "define('DB_NAME'":
fwrite($handle, str_replace("wordpress", $dbname, $line));
break;
case "define('DB_USER'":
fwrite($handle, str_replace("'username'", "'$uname'", $line));
break;
case "define('DB_PASSW":
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
break;
case "define('DB_HOST'":
fwrite($handle, str_replace("localhost", $dbhost, $line));
break;
foreach ($configFile as $line_num => $line) {
switch (substr($line,0,16)) {
case "define('DB_NAME'":
fwrite($handle, str_replace("wordpress", $dbname, $line));
break;
case "define('DB_USER'":
fwrite($handle, str_replace("'username'", "'$uname'", $line));
break;
case "define('DB_PASSW":
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
break;
case "define('DB_HOST'":
fwrite($handle, str_replace("localhost", $dbhost, $line));
break;
case '$table_prefix =':
fwrite($handle, str_replace('wp_', $prefix, $line));
break;
default:
fwrite($handle, $line);
}
}
fclose($handle);
default:
fwrite($handle, $line);
}
}
fclose($handle);
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>

View File

@ -34,15 +34,15 @@ form {
padding: 3px;
}
.sidebar-categories {
display: block;
height: 6.6em;
overflow: auto;
background-color: #f4f4f4;
display: block;
height: 6.6em;
overflow: auto;
background-color: #f4f4f4;
}
.sidebar-categories label {
font-size: 10px;
display: block;
width: 90%;
display: block;
width: 90%;
}
</style>
</head>
@ -65,9 +65,9 @@ Post:
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
</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') ) : ?>
<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; ?>
</p>
</div>

View File

@ -110,21 +110,21 @@ endif;
if (file_exists(ABSPATH . $old_file))
$common_files[] = $old_file;
} ?>
<ul>
<?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>
<?php endforeach; ?>
</ul>
<ul>
<?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>
<?php endforeach; ?>
</ul>
</div>
<?php if (!$error) { ?>
<form name="template" id="template" action="templates.php" method="post">
<?php wp_nonce_field('edit-file_' . $file) ?>
<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="file" value="<?php echo $file ?>" />
</div>
<form name="template" id="template" action="templates.php" method="post">
<?php wp_nonce_field('edit-file_' . $file) ?>
<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="file" value="<?php echo $file ?>" />
</div>
<?php if ( is_writeable($real_file) ) : ?>
<p class="submit">
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?>
@ -132,8 +132,8 @@ endif;
<?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
</form>
<?php
} else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
}
@ -143,13 +143,13 @@ endif;
<div class="wrap">
<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>
<form name="file" action="templates.php" method="get">
<input type="text" name="file" />
<input type="submit" name="submit" value="<?php _e('Edit file &raquo;') ?>" />
</form>
<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">
<input type="text" name="file" />
<input type="submit" name="submit" value="<?php _e('Edit file &raquo;') ?>" />
</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>
<?php

View File

@ -80,7 +80,7 @@ default:
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?>
<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:') ?>
<select name="theme" id="theme">
<?php
@ -106,30 +106,30 @@ default:
}
?>
<div id="templateside">
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
<?php
if ($allowed_files) :
?>
<ul>
<ul>
<?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>
<?php endforeach; ?>
</ul>
</ul>
<?php endif; ?>
</div>
<?php
if (!$error) {
?>
<form name="template" id="template" action="theme-editor.php" method="post">
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
<form name="template" id="template" action="theme-editor.php" method="post">
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
<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="file" value="<?php echo $file ?>" />
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
</div>
<?php if ( is_writeable($real_file) ) : ?>
<p class="submit">
<p class="submit">
<?php
echo "<input type='submit' name='submit' value=' " . __('Update File &raquo;') . "' tabindex='2' />";
?>
@ -137,8 +137,8 @@ if ($allowed_files) :
<?php else : ?>
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
<?php endif; ?>
</form>
<?php
</form>
<?php
} else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
}

View File

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

View File

@ -251,19 +251,19 @@ function upgrade_101() {
function upgrade_110() {
global $wpdb;
// Set user_nicename.
// Set user_nicename.
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
foreach ($users as $user) {
if ('' == $user->user_nicename) {
$newname = sanitize_title($user->user_nickname);
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
}
}
foreach ($users as $user) {
if ('' == $user->user_nicename) {
$newname = sanitize_title($user->user_nickname);
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
}
}
$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
foreach ($users as $row) {
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() {
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");
if ($posts) {
foreach($posts as $post) {
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
if ( empty($post->guid) )
$guid = get_permalink($post->ID);
else
$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");
if ($comments) {
foreach($comments as $comment) {
$comment_content = addslashes(deslash($comment->comment_content));
$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'");
$comment_content = addslashes(deslash($comment->comment_content));
$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'");
}
}
// Remove extraneous backslashes.
// Remove extraneous backslashes.
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
if ($links) {
foreach($links as $link) {
$link_name = addslashes(deslash($link->link_name));
$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'");
$link_name = addslashes(deslash($link->link_name));
$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'");
}
}
// 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') {
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
}
// 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') {
$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
// newline separated format. Convert to new format.
if ( !is_array( $active_plugins ) ) {
$active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins);
}
// If plugins are not stored in an array, they're stored in the old
// newline separated format. Convert to new format.
if ( !is_array( $active_plugins ) ) {
$active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins);
}
// Obsolete tables
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
@ -548,21 +548,21 @@ function upgrade_210() {
// General
function maybe_create_table($table_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
return false;
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
return true;
}
}
return false;
}
function drop_index($table, $index) {
@ -591,22 +591,22 @@ function add_clean_index($table, $index) {
** false on error
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
}
@ -646,20 +646,20 @@ function __get_option($setting) {
}
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
// a single quote.
$content = preg_replace("/\\\+'/", "'", $content);
// Replace one or more backslashes followed by a single quote with
// a single quote.
$content = preg_replace("/\\\+'/", "'", $content);
// Replace one or more backslashes followed by a double quote with
// a double quote.
$content = preg_replace('/\\\+"/', '"', $content);
// Replace one or more backslashes followed by a double quote with
// a double quote.
$content = preg_replace('/\\\+"/', '"', $content);
// Replace one or more backslashes with one backslash.
$content = preg_replace("/\\\+/", "\\", $content);
// Replace one or more backslashes with one backslash.
$content = preg_replace("/\\\+/", "\\", $content);
return $content;
return $content;
}
function dbDelta($queries, $execute = true) {

View File

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

View File

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

View File

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

View File

@ -11,11 +11,11 @@ $more = 1;
?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<feed version="0.3"
xmlns="http://purl.org/atom/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="<?php echo get_option('rss_language'); ?>"
<?php do_action('atom_ns'); ?>
>
xmlns="http://purl.org/atom/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="<?php echo get_option('rss_language'); ?>"
<?php do_action('atom_ns'); ?>
>
<title><?php bloginfo_rss('name') ?></title>
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
<tagline><?php bloginfo_rss("description") ?></tagline>
@ -25,7 +25,7 @@ $more = 1;
<?php do_action('atom_head'); ?>
<?php while (have_posts()) : the_post(); ?>
<entry>
<author>
<author>
<name><?php the_author() ?></name>
</author>
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>

View File

@ -17,7 +17,7 @@
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_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 wp_head(); ?>
</head>

View File

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

View File

@ -16,12 +16,12 @@
</form>
</li>
<li id="archives"><?php _e('Archives:'); ?>
<ul>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
</ul>
</li>
<li id="meta"><?php _e('Meta:'); ?>
<ul>
<ul>
<?php wp_register(); ?>
<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>

View File

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

View File

@ -2,19 +2,19 @@
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
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 (!empty($post->post_password)) { // if there's a password
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
return;
}
}
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'alt';
/* This variable is for alternating comment background */
$oddcomment = 'alt';
?>
<!-- You can start editing here. -->
@ -50,7 +50,7 @@
<?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. -->
<?php else : // comments are closed ?>

View File

@ -2,7 +2,7 @@
<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(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
@ -12,7 +12,7 @@
</div>
</div>
<?php endwhile; endif; ?>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</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
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
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
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">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="navigation">
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>

View File

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

View File

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

View File

@ -221,18 +221,18 @@ class WP_User {
}
function level_reduction($max, $item) {
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
$level = intval($matches[1]);
return max($max, $level);
} else {
return $max;
}
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
$level = intval($matches[1]);
return max($max, $level);
} else {
return $max;
}
}
function update_user_level_from_caps() {
global $wpdb;
$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);
global $wpdb;
$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);
}
function add_cap($cap, $grant = true) {

View File

@ -530,17 +530,17 @@ class Walker_PageDropdown extends Walker {
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
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\"";
if ( $page->ID == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
$title = wp_specialchars($page->post_title);
$output .= "$pad$title";
$output .= "</option>\n";
$output .= "\t<option value=\"$page->ID\"";
if ( $page->ID == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
$title = wp_specialchars($page->post_title);
$output .= "$pad$title";
$output .= "</option>\n";
return $output;
return $output;
}
}

View File

@ -142,7 +142,7 @@ function get_comments_link() {
}
function comments_link( $file = '', $echo = true ) {
echo get_comments_link();
echo get_comments_link();
}
function get_comments_number( $post_id = 0 ) {
@ -241,8 +241,8 @@ function trackback_rdf($timezone = 0) {
global $id;
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
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:trackback="http://madskills.com/public/xml/rss/module/trackback/">
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description rdf:about="';
the_permalink();
echo '"'."\n";
@ -299,7 +299,7 @@ function comments_template( $file = '/comments.php' ) {
}
function comments_popup_script($width=400, $height=400, $file='') {
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
if (empty ($file)) {
$wpcommentspopupfile = ''; // Use the index.
@ -307,9 +307,9 @@ function comments_popup_script($width=400, $height=400, $file='') {
$wpcommentspopupfile = $file;
}
$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";
echo $javascript;
$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";
echo $javascript;
}
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {

View File

@ -103,9 +103,9 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
if ($no_cache) {
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
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 {
$myrow['comment_ID'] = $postc->comment_ID;
$myrow['comment_post_ID'] = $postc->comment_post_ID;
@ -397,26 +397,26 @@ function wp_new_comment( $commentdata ) {
}
function wp_set_comment_status($comment_id, $comment_status) {
global $wpdb;
global $wpdb;
switch($comment_status) {
switch($comment_status) {
case 'hold':
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'approve':
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'spam':
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'spam':
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'delete':
return wp_delete_comment($comment_id);
break;
default:
return false;
}
}
if ($wpdb->query($query)) {
if ($wpdb->query($query)) {
do_action('wp_set_comment_status', $comment_id, $comment_status);
$comment = get_comment($comment_id);
@ -425,9 +425,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
if( is_object( $c ) )
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
return true;
} else {
} else {
return false;
}
}
}
function wp_update_comment($commentarr) {

View File

@ -42,7 +42,7 @@ function printr($var, $do_not_echo = false) {
$code = htmlentities(ob_get_contents());
ob_clean();
if (!$do_not_echo) {
echo "<pre>$code</pre>";
echo "<pre>$code</pre>";
}
ob_end_clean();
return $code;
@ -57,11 +57,11 @@ if ( !function_exists('file_get_contents') ) {
}
if (!defined('CASE_LOWER')) {
define('CASE_LOWER', 0);
define('CASE_LOWER', 0);
}
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)
*/
if (!function_exists('array_change_key_case')) {
function array_change_key_case($input, $case = CASE_LOWER)
{
if (!is_array($input)) {
user_error('array_change_key_case(): The argument should be an array',
E_USER_WARNING);
return false;
}
function array_change_key_case($input, $case = CASE_LOWER)
{
if (!is_array($input)) {
user_error('array_change_key_case(): The argument should be an array',
E_USER_WARNING);
return false;
}
$output = array ();
$keys = array_keys($input);
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
$output = array ();
$keys = array_keys($input);
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
foreach ($keys as $key) {
$output[$casefunc($key)] = $input[$key];
}
foreach ($keys as $key) {
$output[$casefunc($key)] = $input[$key];
}
return $output;
}
return $output;
}
}
// From php.net
if(!function_exists('http_build_query')) {
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
$res = array();
foreach ((array)$formdata as $k=>$v) {
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
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) );
}
$separator = ini_get('arg_separator.output');
return implode($separator, $res);
}
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
$res = array();
foreach ((array)$formdata as $k=>$v) {
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
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) );
}
$separator = ini_get('arg_separator.output');
return implode($separator, $res);
}
}
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);
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 >= 10) ) {
|| ($author_data->user_level > $post_author_data->user_level)
|| ($author_data->user_level >= 10) ) {
return true;
} else {
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
*/
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
$between = " ", $show_images = true, $orderby = 'id',
$show_description = true, $show_rating = false,
$limit = -1, $show_updated = 0) {
global $wpdb;
$cat_id = -1;
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
if ($results) {
foreach ($results as $result) {
$cat_id = $result->cat_ID;
}
}
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
$show_description, $show_rating, $limit, $show_updated);
$between = " ", $show_images = true, $orderby = 'id',
$show_description = true, $show_rating = false,
$limit = -1, $show_updated = 0) {
global $wpdb;
$cat_id = -1;
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
if ($results) {
foreach ($results as $result) {
$cat_id = $result->cat_ID;
}
}
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
$show_description, $show_rating, $limit, $show_updated);
}
/** function wp_get_linksbyname()
@ -252,16 +252,16 @@ function wp_get_linksbyname($category, $args = '') {
**/
// Deprecate in favor of get_linkz().
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
global $wpdb;
$cat_id = -1;
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
// TODO: Fix me.
if ($results) {
foreach ($results as $result) {
$cat_id = $result->cat_id;
}
}
return get_linkobjects($cat_id, $orderby, $limit);
global $wpdb;
$cat_id = -1;
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
// TODO: Fix me.
if ($results) {
foreach ($results as $result) {
$cat_id = $result->cat_id;
}
}
return get_linkobjects($cat_id, $orderby, $limit);
}
/** function get_linkobjects()
@ -301,40 +301,40 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
**/
// Deprecate in favor of get_linkz().
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
global $wpdb;
global $wpdb;
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
if ($category != -1) {
$sql .= " AND link_category = $category ";
}
if ($orderby == '')
$orderby = 'id';
if (substr($orderby,0,1) == '_') {
$direction = ' DESC';
$orderby = substr($orderby,1);
}
if (strcasecmp('rand',$orderby) == 0) {
$orderby = 'rand()';
} else {
$orderby = " link_" . $orderby;
}
$sql .= ' ORDER BY ' . $orderby;
$sql .= $direction;
/* The next 2 lines implement LIMIT TO processing */
if ($limit != -1)
$sql .= " LIMIT $limit";
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
if ($category != -1) {
$sql .= " AND link_category = $category ";
}
if ($orderby == '')
$orderby = 'id';
if (substr($orderby,0,1) == '_') {
$direction = ' DESC';
$orderby = substr($orderby,1);
}
if (strcasecmp('rand',$orderby) == 0) {
$orderby = 'rand()';
} else {
$orderby = " link_" . $orderby;
}
$sql .= ' ORDER BY ' . $orderby;
$sql .= $direction;
/* The next 2 lines implement LIMIT TO processing */
if ($limit != -1)
$sql .= " LIMIT $limit";
$results = $wpdb->get_results($sql);
if ($results) {
foreach ($results as $result) {
$result->link_url = $result->link_url;
$result->link_name = $result->link_name;
$result->link_description = $result->link_description;
$result->link_notes = $result->link_notes;
$newresults[] = $result;
}
}
return $newresults;
$results = $wpdb->get_results($sql);
if ($results) {
foreach ($results as $result) {
$result->link_url = $result->link_url;
$result->link_name = $result->link_name;
$result->link_description = $result->link_description;
$result->link_notes = $result->link_notes;
$newresults[] = $result;
}
}
return $newresults;
}
/** 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
*/
function get_linksbyname_withrating($cat_name = "noname", $before = '',
$after = '<br />', $between = " ",
$show_images = true, $orderby = 'id',
$show_description = true, $limit = -1, $show_updated = 0) {
$after = '<br />', $between = " ",
$show_images = true, $orderby = 'id',
$show_description = true, $limit = -1, $show_updated = 0) {
get_linksbyname($cat_name, $before, $after, $between, $show_images,
$orderby, $show_description, true, $limit, $show_updated);
get_linksbyname($cat_name, $before, $after, $between, $show_images,
$orderby, $show_description, true, $limit, $show_updated);
}
/** 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
*/
function get_links_withrating($category = -1, $before = '', $after = '<br />',
$between = " ", $show_images = true,
$orderby = 'id', $show_description = true,
$limit = -1, $show_updated = 0) {
$between = " ", $show_images = true,
$orderby = 'id', $show_description = true,
$limit = -1, $show_updated = 0) {
get_links($category, $before, $after, $between, $show_images, $orderby,
$show_description, true, $limit, $show_updated);
get_links($category, $before, $after, $between, $show_images, $orderby,
$show_description, true, $limit, $show_updated);
}
/** function get_get_autotoggle()

View File

@ -126,35 +126,35 @@ function wp_specialchars( $text, $quotes = 0 ) {
}
function utf8_uri_encode( $utf8_string ) {
$unicode = '';
$values = array();
$num_octets = 1;
$unicode = '';
$values = array();
$num_octets = 1;
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
$value = ord( $utf8_string[ $i ] );
$value = ord( $utf8_string[ $i ] );
if ( $value < 128 ) {
$unicode .= chr($value);
} else {
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
if ( $value < 128 ) {
$unicode .= chr($value);
} else {
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
$values[] = $value;
$values[] = $value;
if ( count( $values ) == $num_octets ) {
if ( count( $values ) == $num_octets ) {
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 {
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
}
$values = array();
$num_octets = 1;
}
}
}
}
}
}
return $unicode;
return $unicode;
}
function remove_accents($string) {
@ -417,10 +417,10 @@ function funky_javascript_fix($text) {
@notes
@changelog
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004
1.2 ***TODO*** Make better - change loop condition to $text
1.1 Fixed handling of append/stack pop order of end text
Added Cleaning Hooks
1.0 First Version
1.2 ***TODO*** Make better - change loop condition to $text
1.1 Fixed handling of append/stack pop order of end text
Added Cleaning Hooks
1.0 First Version
*/
function balanceTags($text, $is_comment = 0, $force = false) {
@ -552,10 +552,10 @@ function backslashit($string) {
}
function trailingslashit($string) {
if ( '/' != substr($string, -1)) {
$string .= '/';
}
return $string;
if ( '/' != substr($string, -1)) {
$string .= '/';
}
return $string;
}
function addslashes_gpc($gpc) {
@ -571,11 +571,11 @@ function addslashes_gpc($gpc) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
return $value;
}
function antispambot($emailaddy, $mailto=0) {

View File

@ -462,7 +462,7 @@ function wp_get_http_headers( $url, $red = 1 ) {
@set_time_limit( 60 );
if ( $red > 5 )
return false;
return false;
$parts = parse_url( $url );
$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);
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
$code = $headers['response'];
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
return wp_get_http_headers( $headers['location'], ++$red );
$code = $headers['response'];
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
return wp_get_http_headers( $headers['location'], ++$red );
return $headers;
}
@ -801,8 +801,8 @@ function get_num_queries() {
}
function bool_from_yn($yn) {
if ($yn == 'Y') return 1;
return 0;
if ($yn == 'Y') return 1;
return 0;
}
function do_feed() {
@ -957,7 +957,7 @@ function wp_upload_dir() {
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);
}

View File

@ -378,11 +378,11 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$from = "From: \"$blogname\" <$wp_email>";
if ( '' != $comment->comment_author_email )
$reply_to = "Reply-To: $comment->comment_author_email";
} else {
} else {
$from = "From: \"$comment->comment_author\" <$wp_email>";
if ( '' != $comment->comment_author_email )
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
}
}
$message_headers = "MIME-Version: 1.0\n"
. "$from\n"

View File

@ -684,22 +684,22 @@ function wp_update_post($postarr = array()) {
$post = add_magic_quotes($post);
// 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']) )
$post_cats = $postarr['post_category'];
else
$post_cats = $post['post_category'];
$post_cats = $postarr['post_category'];
else
$post_cats = $post['post_category'];
// 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']) &&
('0000-00-00 00:00:00' == $post['post_date']) )
('0000-00-00 00:00:00' == $post['post_date']) )
$clear_date = true;
else
$clear_date = false;
// Merge old and new fields with new fields overwriting old ones.
$postarr = array_merge($post, $postarr);
$postarr['post_category'] = $post_cats;
// Merge old and new fields with new fields overwriting old ones.
$postarr = array_merge($post, $postarr);
$postarr['post_category'] = $post_cats;
if ( $clear_date ) {
$postarr['post_date'] = '';
$postarr['post_date_gmt'] = '';
@ -848,10 +848,10 @@ function trackback_url_list($tb_list, $post_id) {
$trackback_urls = explode(',', $tb_list);
foreach($trackback_urls as $tb_url) {
$tb_url = trim($tb_url);
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
$tb_url = trim($tb_url);
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
}
}
}
}
//

View File

@ -16,11 +16,11 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
?><?php echo '<?xml version="1.0"?'.">\n"; ?>
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
<opml version="1.0">
<head>
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
</head>
<body>
<head>
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
</head>
<body>
<?php
if (empty ($link_cat))
@ -36,7 +36,7 @@ foreach ((array) $cats as $cat) {
$bookmarks = get_bookmarks("category={$cat->cat_ID}");
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
}

View File

@ -48,7 +48,7 @@ if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
}
if ( is_single() || is_page() )
$tb_id = $posts[0]->ID;
$tb_id = $posts[0]->ID;
if ( !intval( $tb_id ) )
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() {
$this->methods = array(
// Blogger API
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
'blogger.getPost' => 'this:blogger_getPost',
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
'blogger.getTemplate' => 'this:blogger_getTemplate',
'blogger.setTemplate' => 'this:blogger_setTemplate',
'blogger.newPost' => 'this:blogger_newPost',
'blogger.editPost' => 'this:blogger_editPost',
'blogger.deletePost' => 'this:blogger_deletePost',
// Blogger API
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
'blogger.getPost' => 'this:blogger_getPost',
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
'blogger.getTemplate' => 'this:blogger_getTemplate',
'blogger.setTemplate' => 'this:blogger_setTemplate',
'blogger.newPost' => 'this:blogger_newPost',
'blogger.editPost' => 'this:blogger_editPost',
'blogger.deletePost' => 'this:blogger_deletePost',
// MetaWeblog API (with MT extensions to structs)
'metaWeblog.newPost' => 'this:mw_newPost',
'metaWeblog.editPost' => 'this:mw_editPost',
'metaWeblog.getPost' => 'this:mw_getPost',
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
'metaWeblog.getCategories' => 'this:mw_getCategories',
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
// MetaWeblog API (with MT extensions to structs)
'metaWeblog.newPost' => 'this:mw_newPost',
'metaWeblog.editPost' => 'this:mw_editPost',
'metaWeblog.getPost' => 'this:mw_getPost',
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
'metaWeblog.getCategories' => 'this:mw_getCategories',
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
// MetaWeblog API aliases for Blogger API
// see http://www.xmlrpc.com/stories/storyReader$2460
'metaWeblog.deletePost' => 'this:blogger_deletePost',
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
// MetaWeblog API aliases for Blogger API
// see http://www.xmlrpc.com/stories/storyReader$2460
'metaWeblog.deletePost' => 'this:blogger_deletePost',
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
// MovableType API
'mt.getCategoryList' => 'this:mt_getCategoryList',
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
'mt.getPostCategories' => 'this:mt_getPostCategories',
'mt.setPostCategories' => 'this:mt_setPostCategories',
'mt.supportedMethods' => 'this:mt_supportedMethods',
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
'mt.publishPost' => 'this:mt_publishPost',
// MovableType API
'mt.getCategoryList' => 'this:mt_getCategoryList',
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
'mt.getPostCategories' => 'this:mt_getPostCategories',
'mt.setPostCategories' => 'this:mt_setPostCategories',
'mt.supportedMethods' => 'this:mt_supportedMethods',
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
'mt.publishPost' => 'this:mt_publishPost',
// PingBack
'pingback.ping' => 'this:pingback_ping',
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
// PingBack
'pingback.ping' => 'this:pingback_ping',
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
'demo.sayHello' => 'this:sayHello',
'demo.addTwoNumbers' => 'this:addTwoNumbers'
'demo.sayHello' => 'this:sayHello',
'demo.addTwoNumbers' => 'this:addTwoNumbers'
);
$this->methods = apply_filters('xmlrpc_methods', $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) {
if (!user_pass_ok($user_login, $user_pass)) {
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
return false;
}
return true;
if (!user_pass_ok($user_login, $user_pass)) {
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
return false;
}
return true;
}
function escape(&$array) {
@ -181,25 +181,25 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
$user_login = $args[1];
$user_pass = $args[2];
$user_login = $args[1];
$user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$user_data = get_userdatabylogin($user_login);
$user_data = get_userdatabylogin($user_login);
$struct = array(
'nickname' => $user_data->nickname,
'userid' => $user_data->ID,
'url' => $user_data->user_url,
'email' => $user_data->user_email,
'lastname' => $user_data->last_name,
'firstname' => $user_data->first_name
);
$struct = array(
'nickname' => $user_data->nickname,
'userid' => $user_data->ID,
'url' => $user_data->user_url,
'email' => $user_data->user_email,
'lastname' => $user_data->last_name,
'firstname' => $user_data->first_name
);
return $struct;
return $struct;
}
@ -208,81 +208,81 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
$post_ID = $args[1];
$user_login = $args[2];
$user_pass = $args[3];
$post_ID = $args[1];
$user_login = $args[2];
$user_pass = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$user_data = get_userdatabylogin($user_login);
$post_data = wp_get_single_post($post_ID, ARRAY_A);
$user_data = get_userdatabylogin($user_login);
$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 .= '<category>'.$categories.'</category>';
$content .= stripslashes($post_data['post_content']);
$content = '<title>'.stripslashes($post_data['post_title']).'</title>';
$content .= '<category>'.$categories.'</category>';
$content .= stripslashes($post_data['post_content']);
$struct = array(
'userid' => $post_data['post_author'],
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
'content' => $content,
'postid' => $post_data['ID']
);
$struct = array(
'userid' => $post_data['post_author'],
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
'content' => $content,
'postid' => $post_data['ID']
);
return $struct;
return $struct;
}
/* blogger.getRecentPosts ...gets recent posts */
function blogger_getRecentPosts($args) {
global $wpdb;
global $wpdb;
$this->escape($args);
$blog_ID = $args[1]; /* though we don't use it yet */
$user_login = $args[2];
$user_pass = $args[3];
$num_posts = $args[4];
$blog_ID = $args[1]; /* though we don't use it yet */
$user_login = $args[2];
$user_pass = $args[3];
$num_posts = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$posts_list = wp_get_recent_posts($num_posts);
$posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error;
}
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
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']));
$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>';
$content .= '<category>'.$categories.'</category>';
$content .= stripslashes($entry['post_content']);
$content = '<title>'.stripslashes($entry['post_title']).'</title>';
$content .= '<category>'.$categories.'</category>';
$content .= stripslashes($entry['post_content']);
$struct[] = array(
'userid' => $entry['post_author'],
'dateCreated' => new IXR_Date($post_date),
'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]);
}
$recent_posts = array();
for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts;
return $recent_posts;
}
@ -712,96 +712,96 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$num_posts = $args[3];
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$num_posts = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$posts_list = wp_get_recent_posts($num_posts);
$posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error;
}
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
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_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']);
$link = post_permalink($entry['ID']);
$post = get_extended($entry['post_content']);
$link = post_permalink($entry['ID']);
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
$struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'description' => $post['main'],
'title' => $entry['post_title'],
'link' => $link,
'permaLink' => $link,
$struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'description' => $post['main'],
'title' => $entry['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this
// 'content' => $entry['post_content'],
'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
'mt_allow_pings' => $allow_pings
);
'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
'mt_allow_pings' => $allow_pings
);
}
}
$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;
}
/* metaweblog.getCategories ...returns the list of categories on a given weblog */
function mw_getCategories($args) {
global $wpdb;
global $wpdb;
$this->escape($args);
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$categories_struct = array();
$categories_struct = array();
// FIXME: can we avoid using direct SQL there?
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
foreach ($cats as $cat) {
$struct['categoryId'] = $cat['cat_ID'];
$struct['description'] = $cat['cat_name'];
$struct['categoryName'] = $cat['cat_name'];
$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']));
// FIXME: can we avoid using direct SQL there?
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
foreach ($cats as $cat) {
$struct['categoryId'] = $cat['cat_ID'];
$struct['description'] = $cat['cat_name'];
$struct['categoryName'] = $cat['cat_name'];
$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']));
$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);
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$num_posts = $args[3];
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$num_posts = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$posts_list = wp_get_recent_posts($num_posts);
$posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error;
}
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error;
}
foreach ($posts_list as $entry) {
foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$struct[] = array(
'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 */
function mt_getCategoryList($args) {
global $wpdb;
global $wpdb;
$this->escape($args);
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$categories_struct = array();
$categories_struct = array();
// FIXME: can we avoid using direct SQL there?
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
foreach ($cats as $cat) {
$struct['categoryId'] = $cat['cat_ID'];
$struct['categoryName'] = $cat['cat_name'];
// FIXME: can we avoid using direct SQL there?
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
foreach ($cats as $cat) {
$struct['categoryId'] = $cat['cat_ID'];
$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);
$post_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$post_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$categories = array();
$catids = wp_get_post_categories(intval($post_ID));
// first listed category will be the primary category
$isPrimary = true;
foreach($catids as $catid) {
$categories[] = array(
'categoryName' => get_cat_name($catid),
'categoryId' => $catid,
'isPrimary' => $isPrimary
);
$isPrimary = false;
}
$categories = array();
$catids = wp_get_post_categories(intval($post_ID));
// first listed category will be the primary category
$isPrimary = true;
foreach($catids as $catid) {
$categories[] = array(
'categoryName' => get_cat_name($catid),
'categoryId' => $catid,
'isPrimary' => $isPrimary
);
$isPrimary = false;
}
return $categories;
return $categories;
}
@ -956,81 +956,81 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
$post_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$categories = $args[3];
$post_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$categories = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, 'Sorry, you can not edit this post.');
set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, 'Sorry, you can not edit this post.');
foreach($categories as $cat) {
$catids[] = $cat['categoryId'];
}
foreach($categories as $cat) {
$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 */
function mt_supportedMethods($args) {
$supported_methods = array();
foreach($this->methods as $key=>$value) {
$supported_methods[] = $key;
}
$supported_methods = array();
foreach($this->methods as $key=>$value) {
$supported_methods[] = $key;
}
return $supported_methods;
return $supported_methods;
}
/* 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) {
return array();
return array();
}
/* mt.getTrackbackPings ...returns trackbacks sent to a given post */
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) {
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
);
if (!$actual_post) {
return new IXR_Error(404, 'Sorry, no such post.');
}
}
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);
$post_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$post_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) )
return new IXR_Error(401, 'Sorry, you can not edit this post.');
set_current_user(0, $user_login);
if ( !current_user_can('edit_post', $post_ID) )
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
$cats = wp_get_post_categories($post_ID);
$postdata['post_category'] = $cats;
// retain old cats
$cats = wp_get_post_categories($post_ID);
$postdata['post_category'] = $cats;
$this->escape($postdata);
$result = wp_update_post($postdata);
$result = wp_update_post($postdata);
return $result;
return $result;
}
@ -1090,7 +1090,7 @@ class wp_xmlrpc_server extends IXR_Server {
// 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')));
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
// 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
that pingbacked the given URL
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
that pingbacked the given URL
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
function pingback_extensions_getPingbacks($args) {
global $wpdb;