Death to trailing tabs. Props Mark J. fixes #2405

git-svn-id: http://svn.automattic.com/wordpress/trunk@3517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-02-12 07:53:23 +00:00
parent 17b47c6fe0
commit dd202ce1f9
88 changed files with 1019 additions and 1019 deletions

View File

@ -16,17 +16,17 @@
margin-right: 25%; margin-right: 25%;
padding: .2em 2em; padding: .2em 2em;
} }
h1 { h1 {
color: #006; color: #006;
font-size: 18px; font-size: 18px;
font-weight: lighter; font-weight: lighter;
} }
h2 { h2 {
font-size: 16px; font-size: 16px;
} }
p, li, dt { p, li, dt {
line-height: 140%; line-height: 140%;
padding-bottom: 2px; padding-bottom: 2px;

View File

@ -14,7 +14,7 @@ function get_others_drafts( $user_id ) {
$level_key = $wpdb->prefix . 'user_level'; $level_key = $wpdb->prefix . 'user_level';
$editable = get_editable_user_ids( $user_id ); $editable = get_editable_user_ids( $user_id );
if( !$editable ) { if( !$editable ) {
$other_drafts = ''; $other_drafts = '';
} else { } else {
@ -42,9 +42,9 @@ function get_editable_authors( $user_id ) {
function get_editable_user_ids( $user_id, $exclude_zeros = true ) { function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
global $wpdb; global $wpdb;
$user = new WP_User( $user_id ); $user = new WP_User( $user_id );
if ( ! $user->has_cap('edit_others_posts') ) { if ( ! $user->has_cap('edit_others_posts') ) {
if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
return array($user->id); return array($user->id);
@ -57,7 +57,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'"; $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
if ( $exclude_zeros ) if ( $exclude_zeros )
$query .= " AND meta_value != '0'"; $query .= " AND meta_value != '0'";
return $wpdb->get_col( $query ); return $wpdb->get_col( $query );
} }
@ -111,7 +111,7 @@ function wp_insert_category($catarr) {
} else { } else {
$wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'"); $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'");
} }
if ( $category_nicename == '' ) { if ( $category_nicename == '' ) {
$category_nicename = sanitize_title($cat_name, $cat_ID ); $category_nicename = sanitize_title($cat_name, $cat_ID );
$wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" ); $wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" );
@ -242,7 +242,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
function get_link($link_id, $output = OBJECT) { function get_link($link_id, $output = OBJECT) {
global $wpdb; global $wpdb;
$link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'"); $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
if ( $output == OBJECT ) { if ( $output == OBJECT ) {
@ -258,7 +258,7 @@ function get_link($link_id, $output = OBJECT) {
function wp_insert_link($linkdata) { function wp_insert_link($linkdata) {
global $wpdb, $current_user; global $wpdb, $current_user;
extract($linkdata); extract($linkdata);
$update = false; $update = false;
@ -266,14 +266,14 @@ function wp_insert_link($linkdata) {
$update = true; $update = true;
if ( empty($link_rating) ) if ( empty($link_rating) )
$link_rating = 0; $link_rating = 0;
if ( empty($link_target) ) if ( empty($link_target) )
$link_target = ''; $link_target = '';
if ( empty($link_visible) ) if ( empty($link_visible) )
$link_visible = 'Y'; $link_visible = 'Y';
if ( empty($link_owner) ) if ( empty($link_owner) )
$link_owner = $current_user->id; $link_owner = $current_user->id;
@ -292,7 +292,7 @@ function wp_insert_link($linkdata) {
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')"); $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
$link_id = $wpdb->insert_id; $link_id = $wpdb->insert_id;
} }
if ( $update ) if ( $update )
do_action('edit_link', $link_id); do_action('edit_link', $link_id);
else else
@ -305,12 +305,12 @@ function wp_update_link($linkdata) {
global $wpdb; global $wpdb;
$link_id = (int) $linkdata['link_id']; $link_id = (int) $linkdata['link_id'];
$link = get_link($link_id, ARRAY_A); $link = get_link($link_id, ARRAY_A);
// Escape data pulled from DB. // Escape data pulled from DB.
$link = add_magic_quotes($link); $link = add_magic_quotes($link);
// Merge old and new fields with new fields overwriting old ones. // Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata); $linkdata = array_merge($link, $linkdata);
@ -321,7 +321,7 @@ function wp_delete_link($link_id) {
global $wpdb; global $wpdb;
do_action('delete_link', $link_id); do_action('delete_link', $link_id);
return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'"); return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
} }
function post_exists($title, $content = '', $post_date = '') { function post_exists($title, $content = '', $post_date = '') {

View File

@ -6,7 +6,7 @@ function write_post() {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can('edit_pages') ) if ( !current_user_can('edit_pages') )
die(__('You are not allowed to create pages on this blog.')); die(__('You are not allowed to create pages on this blog.'));
} else { } else {
if ( !current_user_can('edit_posts') ) if ( !current_user_can('edit_posts') )
die(__('You are not allowed to create posts or drafts on this blog.')); die(__('You are not allowed to create posts or drafts on this blog.'));
@ -30,13 +30,13 @@ function write_post() {
} }
if ($_POST['post_author'] != $_POST['user_ID']) { if ($_POST['post_author'] != $_POST['user_ID']) {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can('edit_others_pages') ) if ( !current_user_can('edit_others_pages') )
die(__('You cannot create pages as this user.')); die(__('You cannot create pages as this user.'));
} else { } else {
if ( !current_user_can('edit_others_posts') ) if ( !current_user_can('edit_others_posts') )
die(__('You cannot post as this user.')); die(__('You cannot post as this user.'));
} }
} }
@ -52,7 +52,7 @@ function write_post() {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages')) if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages'))
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'draft';
} else { } else {
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'draft';
@ -140,7 +140,7 @@ function edit_post() {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can('edit_page', $post_ID) ) if ( !current_user_can('edit_page', $post_ID) )
die(__('You are not allowed to edit this page.')); die(__('You are not allowed to edit this page.'));
} else { } else {
if ( !current_user_can('edit_post', $post_ID) ) if ( !current_user_can('edit_post', $post_ID) )
die(__('You are not allowed to edit this post.')); die(__('You are not allowed to edit this post.'));
@ -163,13 +163,13 @@ function edit_post() {
} }
if ($_POST['post_author'] != $_POST['user_ID']) { if ($_POST['post_author'] != $_POST['user_ID']) {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ( !current_user_can('edit_others_pages') ) if ( !current_user_can('edit_others_pages') )
die(__('You cannot edit pages as this user.')); die(__('You cannot edit pages as this user.'));
} else { } else {
if ( !current_user_can('edit_others_posts') ) if ( !current_user_can('edit_others_posts') )
die(__('You cannot edit posts as this user.')); die(__('You cannot edit posts as this user.'));
} }
} }
@ -185,7 +185,7 @@ function edit_post() {
if ( 'page' == $_POST['post_type'] ) { if ( 'page' == $_POST['post_type'] ) {
if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages')) if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages'))
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'draft';
} else { } else {
if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts')) if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts'))
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'draft';
@ -217,7 +217,7 @@ function edit_post() {
foreach ($_POST['meta'] as $key => $value) foreach ($_POST['meta'] as $key => $value)
update_meta($key, $value['key'], $value['value']); update_meta($key, $value['key'], $value['value']);
} }
if ($_POST['deletemeta']) { if ($_POST['deletemeta']) {
foreach ($_POST['deletemeta'] as $key => $value) foreach ($_POST['deletemeta'] as $key => $value)
delete_meta($key); delete_meta($key);
@ -464,13 +464,13 @@ function edit_user($user_id = 0) {
function get_link_to_edit($link_id) { function get_link_to_edit($link_id) {
$link = get_link($link_id); $link = get_link($link_id);
$link->link_url = wp_specialchars($link->link_url, 1); $link->link_url = wp_specialchars($link->link_url, 1);
$link->link_name = wp_specialchars($link->link_name, 1); $link->link_name = wp_specialchars($link->link_name, 1);
$link->link_description = wp_specialchars($link->link_description); $link->link_description = wp_specialchars($link->link_description);
$link->link_notes = wp_specialchars($link->link_notes); $link->link_notes = wp_specialchars($link->link_notes);
$link->link_rss = wp_specialchars($link->link_rss); $link->link_rss = wp_specialchars($link->link_rss);
return $link; return $link;
} }
@ -479,17 +479,17 @@ function get_default_link_to_edit() {
$link->link_url = wp_specialchars($_GET['linkurl'], 1); $link->link_url = wp_specialchars($_GET['linkurl'], 1);
else else
$link->link_url = ''; $link->link_url = '';
if ( isset($_GET['name']) ) if ( isset($_GET['name']) )
$link->link_name = wp_specialchars($_GET['name'], 1); $link->link_name = wp_specialchars($_GET['name'], 1);
else else
$link->link_name = ''; $link->link_name = '';
return $link; return $link;
} }
function add_link() { function add_link() {
return edit_link(); return edit_link();
} }
function edit_link($link_id = '') { function edit_link($link_id = '') {
@ -502,7 +502,7 @@ function edit_link($link_id = '') {
$_POST['link_image'] = wp_specialchars($_POST['link_image']); $_POST['link_image'] = wp_specialchars($_POST['link_image']);
$_POST['link_rss'] = wp_specialchars($_POST['link_rss']); $_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
$auto_toggle = get_autotoggle($_POST['link_category']); $auto_toggle = get_autotoggle($_POST['link_category']);
// if we are in an auto toggle category and this one is visible then we // if we are in an auto toggle category and this one is visible then we
// need to make the others invisible before we add this new one. // need to make the others invisible before we add this new one.
// FIXME Add category toggle func. // FIXME Add category toggle func.
@ -577,7 +577,7 @@ function get_nested_categories($default = 0, $parent = 0) {
$result[$cat]['cat_name'] = get_the_category_by_ID($cat); $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
} }
} }
usort($result, 'sort_cats'); usort($result, 'sort_cats');
return $result; return $result;
@ -615,7 +615,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
if ( current_user_can('manage_categories') ) { if ( current_user_can('manage_categories') ) {
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
$default_cat_id = get_option('default_category'); $default_cat_id = get_option('default_category');
if ($category->cat_ID != $default_cat_id) if ($category->cat_ID != $default_cat_id)
$edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;. All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>"; $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;. All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
else else
@ -699,7 +699,7 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev
function link_category_dropdown($fieldname, $selected = 0) { function link_category_dropdown($fieldname, $selected = 0) {
global $wpdb; global $wpdb;
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
echo "\n<select name='$fieldname' size='1'>\n"; echo "\n<select name='$fieldname' size='1'>\n";
foreach ($results as $row) { foreach ($results as $row) {
@ -1834,7 +1834,7 @@ o.submit();
<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" /> <input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
</div> </div>
</form> </form>
<?php <?php
} }
function wp_import_handle_upload() { function wp_import_handle_upload() {

View File

@ -53,41 +53,41 @@ if (isset($_GET['page'])) {
if ( $page_hook ) { if ( $page_hook ) {
if (! isset($_GET['noheader'])) if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php'); require_once(ABSPATH . '/wp-admin/admin-header.php');
do_action($page_hook); do_action($page_hook);
} else { } else {
if ( validate_file($plugin_page) ) { if ( validate_file($plugin_page) ) {
die(__('Invalid plugin page')); die(__('Invalid plugin page'));
} }
if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
die(sprintf(__('Cannot load %s.'), $plugin_page)); die(sprintf(__('Cannot load %s.'), $plugin_page));
if (! isset($_GET['noheader'])) if (! isset($_GET['noheader']))
require_once(ABSPATH . '/wp-admin/admin-header.php'); require_once(ABSPATH . '/wp-admin/admin-header.php');
include(ABSPATH . "wp-content/plugins/$plugin_page"); include(ABSPATH . "wp-content/plugins/$plugin_page");
} }
include(ABSPATH . 'wp-admin/admin-footer.php'); include(ABSPATH . 'wp-admin/admin-footer.php');
exit(); exit();
} else if (isset($_GET['import'])) { } else if (isset($_GET['import'])) {
$importer = $_GET['import']; $importer = $_GET['import'];
if ( validate_file($importer) ) { if ( validate_file($importer) ) {
die(__('Invalid importer.')); die(__('Invalid importer.'));
} }
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
die(__('Cannot load importer.')); die(__('Cannot load importer.'));
include(ABSPATH . "wp-admin/import/$importer.php"); include(ABSPATH . "wp-admin/import/$importer.php");
$parent_file = 'import.php'; $parent_file = 'import.php';
$title = __('Import'); $title = __('Import');
if (! isset($_GET['noheader'])) if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php'); require_once(ABSPATH . 'wp-admin/admin-header.php');
@ -97,7 +97,7 @@ if (isset($_GET['page'])) {
kses_init_filters(); // Always filter imported data with kses. kses_init_filters(); // Always filter imported data with kses.
call_user_func($wp_importers[$importer][2]); call_user_func($wp_importers[$importer][2]);
include(ABSPATH . 'wp-admin/admin-footer.php'); include(ABSPATH . 'wp-admin/admin-footer.php');
exit(); exit();

View File

@ -25,16 +25,16 @@ $post = get_default_post_to_edit();
$popuptitle = wp_specialchars(stripslashes($popuptitle)); $popuptitle = wp_specialchars(stripslashes($popuptitle));
$text = wp_specialchars(stripslashes(urldecode($text))); $text = wp_specialchars(stripslashes(urldecode($text)));
$popuptitle = funky_javascript_fix($popuptitle); $popuptitle = funky_javascript_fix($popuptitle);
$text = funky_javascript_fix($text); $text = funky_javascript_fix($text);
$post_title = wp_specialchars($_REQUEST['post_title']); $post_title = wp_specialchars($_REQUEST['post_title']);
if (!empty($post_title)) if (!empty($post_title))
$post->post_title = stripslashes($post_title); $post->post_title = stripslashes($post_title);
else else
$post->post_title = $popuptitle; $post->post_title = $popuptitle;
$content = wp_specialchars($_REQUEST['content']); $content = wp_specialchars($_REQUEST['content']);
$popupurl = wp_specialchars($_REQUEST['popupurl']); $popupurl = wp_specialchars($_REQUEST['popupurl']);

View File

@ -67,7 +67,7 @@ function newCatCompletion() {
var id = 0; var id = 0;
var ids = new Array(); var ids = new Array();
var names = new Array(); var names = new Array();
ids = myPload( ajaxCat.response ); ids = myPload( ajaxCat.response );
names = myPload( newcat.value ); names = myPload( newcat.value );
for ( i = 0; i < ids.length; i++ ) { for ( i = 0; i < ids.length; i++ ) {
@ -80,9 +80,9 @@ function newCatCompletion() {
p.innerHTML = "<?php echo addslashes(__('That category name is invalid. Try something else.')); ?>"; p.innerHTML = "<?php echo addslashes(__('That category name is invalid. Try something else.')); ?>";
return; return;
} }
var exists = document.getElementById('category-' + id); var exists = document.getElementById('category-' + id);
if (exists) { if (exists) {
var moveIt = exists.parentNode; var moveIt = exists.parentNode;
var container = moveIt.parentNode; var container = moveIt.parentNode;
@ -100,20 +100,20 @@ function newCatCompletion() {
newLabel.setAttribute('for', 'category-' + id); newLabel.setAttribute('for', 'category-' + id);
newLabel.id = 'new-category-' + id; newLabel.id = 'new-category-' + id;
newLabel.className = 'selectit fade'; newLabel.className = 'selectit fade';
var newCheck = document.createElement('input'); var newCheck = document.createElement('input');
newCheck.type = 'checkbox'; newCheck.type = 'checkbox';
newCheck.value = id; newCheck.value = id;
newCheck.name = 'post_category[]'; newCheck.name = 'post_category[]';
newCheck.id = 'category-' + id; newCheck.id = 'category-' + id;
newLabel.appendChild(newCheck); newLabel.appendChild(newCheck);
var newLabelText = document.createTextNode(' ' + names[i]); var newLabelText = document.createTextNode(' ' + names[i]);
newLabel.appendChild(newLabelText); newLabel.appendChild(newLabelText);
catDiv.insertBefore(newLabel, catDiv.firstChild); catDiv.insertBefore(newLabel, catDiv.firstChild);
newCheck.checked = 'checked'; newCheck.checked = 'checked';
Fat.fade_all(); Fat.fade_all();
newLabel.className = 'selectit'; newLabel.className = 'selectit';
} }

View File

@ -27,7 +27,7 @@ case 'addcat':
if ( !current_user_can('manage_categories') ) if ( !current_user_can('manage_categories') )
die (__('Cheatin&#8217; uh?')); die (__('Cheatin&#8217; uh?'));
wp_insert_category($_POST); wp_insert_category($_POST);
header('Location: categories.php?message=1#addcat'); header('Location: categories.php?message=1#addcat');
@ -96,7 +96,7 @@ break;
case 'editedcat': case 'editedcat':
if ( !current_user_can('manage_categories') ) if ( !current_user_can('manage_categories') )
die (__('Cheatin&#8217; uh?')); die (__('Cheatin&#8217; uh?'));
wp_update_category($_POST); wp_update_category($_POST);
header('Location: categories.php?message=3'); header('Location: categories.php?message=3');

View File

@ -88,9 +88,9 @@ if ('view' == $mode) {
if ($i % 2) if ($i % 2)
$class .= ' alternate'; $class .= ' alternate';
echo "<li id='comment-$comment->comment_ID' class='$class'>"; echo "<li id='comment-$comment->comment_ID' class='$class'>";
?> ?>
<p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
<?php comment_text() ?> <?php comment_text() ?>
<p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A'); <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A');
@ -118,7 +118,7 @@ if ('view' == $mode) {
?> ?>
<p> <p>
<strong><?php _e('No comments found.') ?></strong></p> <strong><?php _e('No comments found.') ?></strong></p>
<?php <?php
} // end if ($comments) } // end if ($comments)
} elseif ('edit' == $mode) { } elseif ('edit' == $mode) {

View File

@ -17,16 +17,16 @@ $ids = array();
foreach ($names as $cat_name) { foreach ($names as $cat_name) {
$cat_name = trim( $cat_name ); $cat_name = trim( $cat_name );
if ( !$category_nicename = sanitize_title($cat_name) ) if ( !$category_nicename = sanitize_title($cat_name) )
continue; continue;
if ( $already = category_exists($cat_name) ) { if ( $already = category_exists($cat_name) ) {
$ids[] = (string) $already; $ids[] = (string) $already;
continue; continue;
} }
$new_cat_id = wp_create_category($cat_name); $new_cat_id = wp_create_category($cat_name);
$ids[] = (string) $new_cat_id; $ids[] = (string) $new_cat_id;
} }

View File

@ -93,15 +93,15 @@ if ( count($arc_result) ) { ?>
<legend><?php _e('Browse Month&hellip;') ?></legend> <legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'> <select name='m'>
<?php <?php
foreach ($arc_result as $arc_row) { foreach ($arc_result as $arc_row) {
$arc_year = $arc_row->yyear; $arc_year = $arc_row->yyear;
$arc_month = $arc_row->mmonth; $arc_month = $arc_row->mmonth;
if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] ) if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
$default = 'selected="selected"'; $default = 'selected="selected"';
else else
$default = null; $default = null;
echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">'; echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
echo $month[zeroise($arc_month, 2)] . " $arc_year"; echo $month[zeroise($arc_month, 2)] . " $arc_year";
echo "</option>\n"; echo "</option>\n";
@ -157,7 +157,7 @@ $class = ('alternate' == $class) ? '' : 'alternate';
foreach($posts_columns as $column_name=>$column_display_name) { foreach($posts_columns as $column_name=>$column_display_name) {
switch($column_name) { switch($column_name) {
case 'id': case 'id':
?> ?>
<th scope="row"><?php echo $id ?></th> <th scope="row"><?php echo $id ?></th>

View File

@ -135,13 +135,13 @@ class Blogger_Import {
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header); if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec ($ch); $response = curl_exec ($ch);
if ($parse) { if ($parse) {
$response = $this->parse_response($response); $response = $this->parse_response($response);
$response['url'] = $url; $response['url'] = $url;
return $response; return $response;
} }
return $response; return $response;
} }
@ -210,7 +210,7 @@ class Blogger_Import {
$this->import['blogs'][$_GET['blog']]['nextstep'] = $step; $this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
update_option('import-blogger', $this->import); update_option('import-blogger', $this->import);
} }
// Redirects to next step // Redirects to next step
function do_next_step() { function do_next_step() {
header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
@ -224,13 +224,13 @@ class Blogger_Import {
if ( ! ( $_POST['user'] && $_POST['pass'] ) ) { if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
$this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>'); $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
} }
// Try logging in. If we get an array of cookies back, we at least connected. // Try logging in. If we get an array of cookies back, we at least connected.
$this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']); $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
if ( !is_array( $this->import['cookies'] ) ) { if ( !is_array( $this->import['cookies'] ) ) {
$this->login_form(__('Login failed. Please enter your credentials again.')); $this->login_form(__('Login failed. Please enter your credentials again.'));
} }
// Save the password so we can log the browser in when it's time to publish. // Save the password so we can log the browser in when it's time to publish.
$this->import['pass'] = $_POST['pass']; $this->import['pass'] = $_POST['pass'];
$this->import['user'] = $_POST['user']; $this->import['user'] = $_POST['user'];
@ -395,7 +395,7 @@ class Blogger_Import {
update_option('import-blogger', $import); update_option('import-blogger', $import);
$archive = $this->get_blogger($url); $archive = $this->get_blogger($url);
if ( $archive['code'] > 200 ) if ( $archive['code'] > 200 )
continue; continue;
$posts = explode('<wordpresspost>', $archive['body']); $posts = explode('<wordpresspost>', $archive['body']);
for ($i = 1; $i < count($posts); $i = $i + 1) { for ($i = 1; $i < count($posts); $i = $i + 1) {
$postparts = explode('<wordpresscomment>', $posts[$i]); $postparts = explode('<wordpresscomment>', $posts[$i]);
@ -409,7 +409,7 @@ class Blogger_Import {
$post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3]; $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
$post_author_name = $wpdb->escape(trim($postinfo[1])); $post_author_name = $wpdb->escape(trim($postinfo[1]));
$post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org'; $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
if ( $this->lump_authors ) { if ( $this->lump_authors ) {
// Ignore Blogger authors. Use the current user_ID for all posts imported. // Ignore Blogger authors. Use the current user_ID for all posts imported.
$post_author = $GLOBALS['user_ID']; $post_author = $GLOBALS['user_ID'];
@ -435,21 +435,21 @@ class Blogger_Import {
$posthour = zeroise($post_date_His[0], 2); $posthour = zeroise($post_date_His[0], 2);
$postminute = zeroise($post_date_His[1], 2); $postminute = zeroise($post_date_His[1], 2);
$postsecond = zeroise($post_date_His[2], 2); $postsecond = zeroise($post_date_His[2], 2);
if (($post_date[2] == 'PM') && ($posthour != '12')) if (($post_date[2] == 'PM') && ($posthour != '12'))
$posthour = $posthour + 12; $posthour = $posthour + 12;
else if (($post_date[2] == 'AM') && ($posthour == '12')) else if (($post_date[2] == 'AM') && ($posthour == '12'))
$posthour = '00'; $posthour = '00';
$post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond"; $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
$post_content = addslashes($post_content); $post_content = addslashes($post_content);
$post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;) $post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
$post_title = addslashes($post_title); $post_title = addslashes($post_title);
$post_status = 'publish'; $post_status = 'publish';
if ( $ID = post_exists($post_title, '', $post_date) ) { if ( $ID = post_exists($post_title, '', $post_date) ) {
$post_array[$i]['ID'] = $ID; $post_array[$i]['ID'] = $ID;
$skippedpostcount++; $skippedpostcount++;
@ -597,7 +597,7 @@ class Blogger_Import {
if ( $_GET['restart'] == 'true' ) { if ( $_GET['restart'] == 'true' ) {
$this->restart(); $this->restart();
} }
if ( isset($_GET['noheader']) ) { if ( isset($_GET['noheader']) ) {
$this->import = get_settings('import-blogger'); $this->import = get_settings('import-blogger');
@ -647,7 +647,7 @@ class Blogger_Import {
break; break;
} }
die; die;
} else { } else {
$this->greet(); $this->greet();
} }

View File

@ -7,10 +7,10 @@ if(!function_exists('get_catbynicename'))
function get_catbynicename($category_nicename) function get_catbynicename($category_nicename)
{ {
global $wpdb; global $wpdb;
$cat_id -= 0; // force numeric $cat_id -= 0; // force numeric
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"'); $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
return $name; return $name;
} }
} }
@ -135,7 +135,7 @@ class Dotclear_Import {
{ {
echo '</div>'; echo '</div>';
} }
function greet() function greet()
{ {
echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog. Mileage may vary.').'</p>'; echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog. Mileage may vary.').'</p>';
@ -153,11 +153,11 @@ class Dotclear_Import {
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Categories // Get Categories
return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A); return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A);
} }
function get_dc_users() function get_dc_users()
{ {
global $wpdb; global $wpdb;
@ -165,25 +165,25 @@ class Dotclear_Import {
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Users // Get Users
return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A); return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A);
} }
function get_dc_posts() function get_dc_posts()
{ {
// General Housekeeping // General Housekeeping
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Posts // Get Posts
return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name
FROM dc_post INNER JOIN dc_categorie FROM dc_post INNER JOIN dc_categorie
ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A); ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A);
} }
function get_dc_comments() function get_dc_comments()
{ {
global $wpdb; global $wpdb;
@ -191,11 +191,11 @@ class Dotclear_Import {
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Comments // Get Comments
return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A); return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A);
} }
function get_dc_links() function get_dc_links()
{ {
//General Housekeeping //General Housekeeping
@ -205,7 +205,7 @@ class Dotclear_Import {
return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A); return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);
} }
function cat2wp($categories='') function cat2wp($categories='')
{ {
// General Housekeeping // General Housekeeping
@ -220,7 +220,7 @@ class Dotclear_Import {
{ {
$count++; $count++;
extract($category); extract($category);
// Make Nice Variables // Make Nice Variables
$name = $wpdb->escape($cat_libelle_url); $name = $wpdb->escape($cat_libelle_url);
$title = $wpdb->escape(csc ($cat_libelle)); $title = $wpdb->escape(csc ($cat_libelle));
@ -236,7 +236,7 @@ class Dotclear_Import {
} }
$dccat2wpcat[$id] = $ret_id; $dccat2wpcat[$id] = $ret_id;
} }
// Store category translation for future use // Store category translation for future use
add_option('dccat2wpcat',$dccat2wpcat); add_option('dccat2wpcat',$dccat2wpcat);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
@ -245,14 +245,14 @@ class Dotclear_Import {
echo __('No Categories to Import!'); echo __('No Categories to Import!');
return false; return false;
} }
function users2wp($users='') function users2wp($users='')
{ {
// General Housekeeping // General Housekeeping
global $wpdb; global $wpdb;
$count = 0; $count = 0;
$dcid2wpid = array(); $dcid2wpid = array();
// Midnight Mojo // Midnight Mojo
if(is_array($users)) if(is_array($users))
{ {
@ -261,14 +261,14 @@ class Dotclear_Import {
{ {
$count++; $count++;
extract($user); extract($user);
// Make Nice Variables // Make Nice Variables
$name = $wpdb->escape(csc ($name)); $name = $wpdb->escape(csc ($name));
$RealName = $wpdb->escape(csc ($user_pseudo)); $RealName = $wpdb->escape(csc ($user_pseudo));
if($uinfo = get_userdatabylogin($name)) if($uinfo = get_userdatabylogin($name))
{ {
$ret_id = wp_insert_user(array( $ret_id = wp_insert_user(array(
'ID' => $uinfo->ID, 'ID' => $uinfo->ID,
'user_login' => $user_id, 'user_login' => $user_id,
@ -289,9 +289,9 @@ class Dotclear_Import {
); );
} }
$dcid2wpid[$user_id] = $ret_id; $dcid2wpid[$user_id] = $ret_id;
// Set Dotclear-to-WordPress permissions translation // Set Dotclear-to-WordPress permissions translation
// Update Usermeta Data // Update Usermeta Data
$user = new WP_User($ret_id); $user = new WP_User($ret_id);
$wp_perms = $user_level + 1; $wp_perms = $user_level + 1;
@ -302,26 +302,26 @@ class Dotclear_Import {
else if(3 <= $wp_perms) { $user->set_role('contributor'); } else if(3 <= $wp_perms) { $user->set_role('contributor'); }
else if(2 <= $wp_perms) { $user->set_role('contributor'); } else if(2 <= $wp_perms) { $user->set_role('contributor'); }
else { $user->set_role('subscriber'); } else { $user->set_role('subscriber'); }
update_usermeta( $ret_id, 'wp_user_level', $wp_perms); update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
update_usermeta( $ret_id, 'rich_editing', 'false'); update_usermeta( $ret_id, 'rich_editing', 'false');
update_usermeta( $ret_id, 'first_name', csc ($user_prenom)); update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
update_usermeta( $ret_id, 'last_name', csc ($user_nom)); update_usermeta( $ret_id, 'last_name', csc ($user_nom));
}// End foreach($users as $user) }// End foreach($users as $user)
// Store id translation array for future use // Store id translation array for future use
add_option('dcid2wpid',$dcid2wpid); add_option('dcid2wpid',$dcid2wpid);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true; return true;
}// End if(is_array($users) }// End if(is_array($users)
echo __('No Users to Import!'); echo __('No Users to Import!');
return false; return false;
}// End function user2wp() }// End function user2wp()
function posts2wp($posts='') function posts2wp($posts='')
{ {
// General Housekeeping // General Housekeeping
@ -338,11 +338,11 @@ class Dotclear_Import {
{ {
$count++; $count++;
extract($post); extract($post);
// Set Dotclear-to-WordPress status translation // Set Dotclear-to-WordPress status translation
$stattrans = array(0 => 'draft', 1 => 'publish'); $stattrans = array(0 => 'draft', 1 => 'publish');
$comment_status_map = array (0 => 'closed', 1 => 'open'); $comment_status_map = array (0 => 'closed', 1 => 'open');
//Can we do this more efficiently? //Can we do this more efficiently?
$uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1; $uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ; $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
@ -356,9 +356,9 @@ class Dotclear_Import {
$post_excerpt = $wpdb->escape ($post_excerpt); $post_excerpt = $wpdb->escape ($post_excerpt);
$post_content = $wpdb->escape ($post_content); $post_content = $wpdb->escape ($post_content);
$post_status = $stattrans[$post_pub]; $post_status = $stattrans[$post_pub];
// Import Post data into WordPress // Import Post data into WordPress
if($pinfo = post_exists($Title,$post_content)) if($pinfo = post_exists($Title,$post_content))
{ {
$ret_id = wp_insert_post(array( $ret_id = wp_insert_post(array(
@ -397,7 +397,7 @@ class Dotclear_Import {
); );
} }
$dcposts2wpposts[$post_id] = $ret_id; $dcposts2wpposts[$post_id] = $ret_id;
// Make Post-to-Category associations // Make Post-to-Category associations
$cats = array(); $cats = array();
if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; } if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
@ -407,11 +407,11 @@ class Dotclear_Import {
} }
// Store ID translation for later use // Store ID translation for later use
add_option('dcposts2wpposts',$dcposts2wpposts); add_option('dcposts2wpposts',$dcposts2wpposts);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
return true; return true;
} }
function comments2wp($comments='') function comments2wp($comments='')
{ {
// General Housekeeping // General Housekeeping
@ -419,7 +419,7 @@ class Dotclear_Import {
$count = 0; $count = 0;
$dccm2wpcm = array(); $dccm2wpcm = array();
$postarr = get_option('dcposts2wpposts'); $postarr = get_option('dcposts2wpposts');
// Magic Mojo // Magic Mojo
if(is_array($comments)) if(is_array($comments))
{ {
@ -428,7 +428,7 @@ class Dotclear_Import {
{ {
$count++; $count++;
extract($comment); extract($comment);
// WordPressify Data // WordPressify Data
$comment_ID = ltrim($comment_id, '0'); $comment_ID = ltrim($comment_id, '0');
$comment_post_ID = $postarr[$post_id]; $comment_post_ID = $postarr[$post_id];
@ -437,7 +437,7 @@ class Dotclear_Import {
$email = $wpdb->escape($comment_email); $email = $wpdb->escape($comment_email);
$web = "http://".$wpdb->escape($comment_site); $web = "http://".$wpdb->escape($comment_site);
$message = $wpdb->escape(textconv ($comment_content)); $message = $wpdb->escape(textconv ($comment_content));
if($cinfo = comment_exists($name, $comment_dt)) if($cinfo = comment_exists($name, $comment_dt))
{ {
// Update comments // Update comments
@ -472,25 +472,25 @@ class Dotclear_Import {
$dccm2wpcm[$comment_ID] = $ret_id; $dccm2wpcm[$comment_ID] = $ret_id;
} }
// Store Comment ID translation for future use // Store Comment ID translation for future use
add_option('dccm2wpcm', $dccm2wpcm); add_option('dccm2wpcm', $dccm2wpcm);
// Associate newly formed categories with posts // Associate newly formed categories with posts
get_comment_count($ret_id); get_comment_count($ret_id);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true; return true;
} }
echo __('No Comments to Import!'); echo __('No Comments to Import!');
return false; return false;
} }
function links2wp($links='') function links2wp($links='')
{ {
// General Housekeeping // General Housekeeping
global $wpdb; global $wpdb;
$count = 0; $count = 0;
// Deal with the links // Deal with the links
if(is_array($links)) if(is_array($links))
{ {
@ -499,7 +499,7 @@ class Dotclear_Import {
{ {
$count++; $count++;
extract($link); extract($link);
if ($title != "") { if ($title != "") {
if ($cinfo = link_cat_exists (csc ($title))) { if ($cinfo = link_cat_exists (csc ($title))) {
$category = $cinfo; $category = $cinfo;
@ -511,7 +511,7 @@ class Dotclear_Import {
} else { } else {
$linkname = $wpdb->escape(csc ($label)); $linkname = $wpdb->escape(csc ($label));
$description = $wpdb->escape(csc ($title)); $description = $wpdb->escape(csc ($title));
if($linfo = link_exists($linkname)) { if($linfo = link_exists($linkname)) {
$ret_id = wp_insert_link(array( $ret_id = wp_insert_link(array(
'link_id' => $linfo, 'link_id' => $linfo,
@ -540,67 +540,67 @@ class Dotclear_Import {
echo __('No Links to Import!'); echo __('No Links to Import!');
return false; return false;
} }
function import_categories() function import_categories()
{ {
// Category Import // Category Import
$cats = $this->get_dc_cats(); $cats = $this->get_dc_cats();
$this->cat2wp($cats); $this->cat2wp($cats);
add_option('dc_cats', $cats); add_option('dc_cats', $cats);
echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">'; echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Users')); printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
echo '</form>'; echo '</form>';
} }
function import_users() function import_users()
{ {
// User Import // User Import
$users = $this->get_dc_users(); $users = $this->get_dc_users();
$this->users2wp($users); $this->users2wp($users);
echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">'; echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts')); printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
echo '</form>'; echo '</form>';
} }
function import_posts() function import_posts()
{ {
// Post Import // Post Import
$posts = $this->get_dc_posts(); $posts = $this->get_dc_posts();
$this->posts2wp($posts); $this->posts2wp($posts);
echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">'; echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments')); printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
echo '</form>'; echo '</form>';
} }
function import_comments() function import_comments()
{ {
// Comment Import // Comment Import
$comments = $this->get_dc_comments(); $comments = $this->get_dc_comments();
$this->comments2wp($comments); $this->comments2wp($comments);
echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">'; echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Links')); printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
echo '</form>'; echo '</form>';
} }
function import_links() function import_links()
{ {
//Link Import //Link Import
$links = $this->get_dc_links(); $links = $this->get_dc_links();
$this->links2wp($links); $this->links2wp($links);
add_option('dc_links', $links); add_option('dc_links', $links);
echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">'; echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Finish')); printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
echo '</form>'; echo '</form>';
} }
function cleanup_dcimport() function cleanup_dcimport()
{ {
delete_option('tpre'); delete_option('tpre');
@ -617,7 +617,7 @@ class Dotclear_Import {
delete_option('dccharset'); delete_option('dccharset');
$this->tips(); $this->tips();
} }
function tips() function tips()
{ {
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Dotclear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>'; echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Dotclear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
@ -636,7 +636,7 @@ class Dotclear_Import {
echo '</ul>'; echo '</ul>';
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>'; echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
} }
function db_form() function db_form()
{ {
echo '<ul>'; echo '<ul>';
@ -648,7 +648,7 @@ class Dotclear_Import {
printf('<li><label for="dccharset">%s</label> <input type="text" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:')); printf('<li><label for="dccharset">%s</label> <input type="text" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:'));
echo '</ul>'; echo '</ul>';
} }
function dispatch() function dispatch()
{ {
@ -657,26 +657,26 @@ class Dotclear_Import {
else else
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
if ( $step > 0 ) if ( $step > 0 )
{ {
if($_POST['dbuser']) if($_POST['dbuser'])
{ {
if(get_option('dcuser')) if(get_option('dcuser'))
delete_option('dcuser'); delete_option('dcuser');
add_option('dcuser',$_POST['dbuser']); add_option('dcuser',$_POST['dbuser']);
} }
if($_POST['dbpass']) if($_POST['dbpass'])
{ {
if(get_option('dcpass')) if(get_option('dcpass'))
delete_option('dcpass'); delete_option('dcpass');
add_option('dcpass',$_POST['dbpass']); add_option('dcpass',$_POST['dbpass']);
} }
if($_POST['dbname']) if($_POST['dbname'])
{ {
if(get_option('dcname')) if(get_option('dcname'))
delete_option('dcname'); delete_option('dcname');
add_option('dcname',$_POST['dbname']); add_option('dcname',$_POST['dbname']);
} }
if($_POST['dbhost']) if($_POST['dbhost'])
@ -690,13 +690,13 @@ class Dotclear_Import {
if(get_option('dccharset')) if(get_option('dccharset'))
delete_option('dccharset'); delete_option('dccharset');
add_option('dccharset',$_POST['dccharset']); add_option('dccharset',$_POST['dccharset']);
} }
if($_POST['dbprefix']) if($_POST['dbprefix'])
{ {
if(get_option('tpre')) if(get_option('tpre'))
delete_option('tpre'); delete_option('tpre');
add_option('tpre',$_POST['dbprefix']); add_option('tpre',$_POST['dbprefix']);
} }
} }
@ -726,13 +726,13 @@ class Dotclear_Import {
$this->cleanup_dcimport(); $this->cleanup_dcimport();
break; break;
} }
$this->footer(); $this->footer();
} }
function Dotclear_Import() function Dotclear_Import()
{ {
// Nothing. // Nothing.
} }
} }

View File

@ -18,7 +18,7 @@ class LJ_Import {
$trans_tbl = array_flip($trans_tbl); $trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl); return strtr($string, $trans_tbl);
} }
function greet() { function greet() {
echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog. Pick a LiveJournal file to upload and click Import.').'</p>'; echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog. Pick a LiveJournal file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=livejournal&amp;step=1"); wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
@ -26,7 +26,7 @@ class LJ_Import {
function import_posts() { function import_posts() {
global $wpdb, $current_user; global $wpdb, $current_user;
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array $importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it $importdata = implode('', $importdata); // squish it
@ -35,7 +35,7 @@ class LJ_Import {
preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts); preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
$posts = $posts[1]; $posts = $posts[1];
unset($importdata); unset($importdata);
echo '<ol>'; echo '<ol>';
foreach ($posts as $post) { foreach ($posts as $post) {
flush(); flush();
preg_match('|<subject>(.*?)</subject>|is', $post, $post_title); preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
@ -78,7 +78,7 @@ class LJ_Import {
preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments); preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
$comments = $comments[1]; $comments = $comments[1];
if ( $comments ) { if ( $comments ) {
$comment_post_ID = $post_id; $comment_post_ID = $post_id;
$num_comments = 0; $num_comments = 0;
@ -134,7 +134,7 @@ class LJ_Import {
$this->file = $file['file']; $this->file = $file['file'];
$this->import_posts(); $this->import_posts();
wp_import_cleanup($file['id']); wp_import_cleanup($file['id']);
echo '<h3>'; echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>'; echo '</h3>';
@ -147,7 +147,7 @@ class LJ_Import {
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
switch ($step) { switch ($step) {
case 0 : case 0 :
$this->greet(); $this->greet();
@ -156,12 +156,12 @@ class LJ_Import {
$this->import(); $this->import();
break; break;
} }
$this->footer(); $this->footer();
} }
function LJ_Import() { function LJ_Import() {
// Nothing. // Nothing.
} }
} }

View File

@ -379,7 +379,7 @@ class MT_Import {
} }
if ( $num_pings ) if ( $num_pings )
printf(__('(%s pings)'), $num_pings); printf(__('(%s pings)'), $num_pings);
echo "</li>"; echo "</li>";
} }
flush(); flush();
@ -420,7 +420,7 @@ class MT_Import {
} }
function MT_Import() { function MT_Import() {
// Nothing. // Nothing.
} }
} }

View File

@ -19,7 +19,7 @@ class RSS_Import {
$trans_tbl = array_flip($trans_tbl); $trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl); return strtr($string, $trans_tbl);
} }
function greet() { function greet() {
echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>'; echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
wp_import_upload_form("admin.php?import=rss&amp;step=1"); wp_import_upload_form("admin.php?import=rss&amp;step=1");
@ -27,7 +27,7 @@ class RSS_Import {
function get_posts() { function get_posts() {
global $wpdb; global $wpdb;
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$datalines = file($this->file); // Read the file into an array $datalines = file($this->file); // Read the file into an array
$importdata = implode('', $datalines); // squish it $importdata = implode('', $datalines); // squish it
@ -134,7 +134,7 @@ class RSS_Import {
$this->get_posts(); $this->get_posts();
$this->import_posts(); $this->import_posts();
wp_import_cleanup($file['id']); wp_import_cleanup($file['id']);
echo '<h3>'; echo '<h3>';
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')); printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
echo '</h3>'; echo '</h3>';
@ -147,7 +147,7 @@ class RSS_Import {
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
switch ($step) { switch ($step) {
case 0 : case 0 :
$this->greet(); $this->greet();
@ -156,12 +156,12 @@ class RSS_Import {
$this->import(); $this->import();
break; break;
} }
$this->footer(); $this->footer();
} }
function RSS_Import() { function RSS_Import() {
// Nothing. // Nothing.
} }
} }

View File

@ -7,10 +7,10 @@ if(!function_exists('get_catbynicename'))
function get_catbynicename($category_nicename) function get_catbynicename($category_nicename)
{ {
global $wpdb; global $wpdb;
$cat_id -= 0; // force numeric $cat_id -= 0; // force numeric
$name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"'); $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
return $name; return $name;
} }
} }
@ -49,7 +49,7 @@ class Textpattern_Import {
{ {
echo '</div>'; echo '</div>';
} }
function greet() function greet()
{ {
echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>'; echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>';
@ -67,7 +67,7 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Categories // Get Categories
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
id, id,
@ -77,7 +77,7 @@ class Textpattern_Import {
WHERE type = "article"', WHERE type = "article"',
ARRAY_A); ARRAY_A);
} }
function get_txp_users() function get_txp_users()
{ {
global $wpdb; global $wpdb;
@ -85,9 +85,9 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Users // Get Users
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
user_id, user_id,
name, name,
@ -96,14 +96,14 @@ class Textpattern_Import {
privs privs
FROM '.$prefix.'txp_users', ARRAY_A); FROM '.$prefix.'txp_users', ARRAY_A);
} }
function get_txp_posts() function get_txp_posts()
{ {
// General Housekeeping // General Housekeeping
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Posts // Get Posts
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
ID, ID,
@ -122,7 +122,7 @@ class Textpattern_Import {
FROM '.$prefix.'textpattern FROM '.$prefix.'textpattern
', ARRAY_A); ', ARRAY_A);
} }
function get_txp_comments() function get_txp_comments()
{ {
global $wpdb; global $wpdb;
@ -130,18 +130,18 @@ class Textpattern_Import {
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
// Get Comments // Get Comments
return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A); return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
} }
function get_txp_links() function get_txp_links()
{ {
//General Housekeeping //General Housekeeping
$txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$prefix = get_option('tpre'); $prefix = get_option('tpre');
return $txpdb->get_results('SELECT return $txpdb->get_results('SELECT
id, id,
date, date,
@ -152,7 +152,7 @@ class Textpattern_Import {
FROM '.$prefix.'txp_link', FROM '.$prefix.'txp_link',
ARRAY_A); ARRAY_A);
} }
function cat2wp($categories='') function cat2wp($categories='')
{ {
// General Housekeeping // General Housekeeping
@ -167,12 +167,12 @@ class Textpattern_Import {
{ {
$count++; $count++;
extract($category); extract($category);
// Make Nice Variables // Make Nice Variables
$name = $wpdb->escape($name); $name = $wpdb->escape($name);
$title = $wpdb->escape($title); $title = $wpdb->escape($title);
if($cinfo = category_exists($name)) if($cinfo = category_exists($name))
{ {
$ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title)); $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
@ -183,7 +183,7 @@ class Textpattern_Import {
} }
$txpcat2wpcat[$id] = $ret_id; $txpcat2wpcat[$id] = $ret_id;
} }
// Store category translation for future use // Store category translation for future use
add_option('txpcat2wpcat',$txpcat2wpcat); add_option('txpcat2wpcat',$txpcat2wpcat);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
@ -192,14 +192,14 @@ class Textpattern_Import {
echo __('No Categories to Import!'); echo __('No Categories to Import!');
return false; return false;
} }
function users2wp($users='') function users2wp($users='')
{ {
// General Housekeeping // General Housekeeping
global $wpdb; global $wpdb;
$count = 0; $count = 0;
$txpid2wpid = array(); $txpid2wpid = array();
// Midnight Mojo // Midnight Mojo
if(is_array($users)) if(is_array($users))
{ {
@ -208,14 +208,14 @@ class Textpattern_Import {
{ {
$count++; $count++;
extract($user); extract($user);
// Make Nice Variables // Make Nice Variables
$name = $wpdb->escape($name); $name = $wpdb->escape($name);
$RealName = $wpdb->escape($RealName); $RealName = $wpdb->escape($RealName);
if($uinfo = get_userdatabylogin($name)) if($uinfo = get_userdatabylogin($name))
{ {
$ret_id = wp_insert_user(array( $ret_id = wp_insert_user(array(
'ID' => $uinfo->ID, 'ID' => $uinfo->ID,
'user_login' => $name, 'user_login' => $name,
@ -236,10 +236,10 @@ class Textpattern_Import {
); );
} }
$txpid2wpid[$user_id] = $ret_id; $txpid2wpid[$user_id] = $ret_id;
// Set Textpattern-to-WordPress permissions translation // Set Textpattern-to-WordPress permissions translation
$transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0'); $transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');
// Update Usermeta Data // Update Usermeta Data
$user = new WP_User($ret_id); $user = new WP_User($ret_id);
if('10' == $transperms[$privs]) { $user->set_role('administrator'); } if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
@ -249,24 +249,24 @@ class Textpattern_Import {
if('3' == $transperms[$privs]) { $user->set_role('contributor'); } if('3' == $transperms[$privs]) { $user->set_role('contributor'); }
if('2' == $transperms[$privs]) { $user->set_role('contributor'); } if('2' == $transperms[$privs]) { $user->set_role('contributor'); }
if('0' == $transperms[$privs]) { $user->set_role('subscriber'); } if('0' == $transperms[$privs]) { $user->set_role('subscriber'); }
update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] ); update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
update_usermeta( $ret_id, 'rich_editing', 'false'); update_usermeta( $ret_id, 'rich_editing', 'false');
}// End foreach($users as $user) }// End foreach($users as $user)
// Store id translation array for future use // Store id translation array for future use
add_option('txpid2wpid',$txpid2wpid); add_option('txpid2wpid',$txpid2wpid);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
return true; return true;
}// End if(is_array($users) }// End if(is_array($users)
echo __('No Users to Import!'); echo __('No Users to Import!');
return false; return false;
}// End function user2wp() }// End function user2wp()
function posts2wp($posts='') function posts2wp($posts='')
{ {
// General Housekeeping // General Housekeeping
@ -283,10 +283,10 @@ class Textpattern_Import {
{ {
$count++; $count++;
extract($post); extract($post);
// Set Textpattern-to-WordPress status translation // Set Textpattern-to-WordPress status translation
$stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish'); $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');
//Can we do this more efficiently? //Can we do this more efficiently?
$uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1; $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ; $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
@ -295,9 +295,9 @@ class Textpattern_Import {
$Body = $wpdb->escape($Body); $Body = $wpdb->escape($Body);
$Excerpt = $wpdb->escape($Excerpt); $Excerpt = $wpdb->escape($Excerpt);
$post_status = $stattrans[$Status]; $post_status = $stattrans[$Status];
// Import Post data into WordPress // Import Post data into WordPress
if($pinfo = post_exists($Title,$Body)) if($pinfo = post_exists($Title,$Body))
{ {
$ret_id = wp_insert_post(array( $ret_id = wp_insert_post(array(
@ -332,7 +332,7 @@ class Textpattern_Import {
); );
} }
$txpposts2wpposts[$ID] = $ret_id; $txpposts2wpposts[$ID] = $ret_id;
// Make Post-to-Category associations // Make Post-to-Category associations
$cats = array(); $cats = array();
if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; } if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
@ -343,11 +343,11 @@ class Textpattern_Import {
} }
// Store ID translation for later use // Store ID translation for later use
add_option('txpposts2wpposts',$txpposts2wpposts); add_option('txpposts2wpposts',$txpposts2wpposts);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
return true; return true;
} }
function comments2wp($comments='') function comments2wp($comments='')
{ {
// General Housekeeping // General Housekeeping
@ -355,7 +355,7 @@ class Textpattern_Import {
$count = 0; $count = 0;
$txpcm2wpcm = array(); $txpcm2wpcm = array();
$postarr = get_option('txpposts2wpposts'); $postarr = get_option('txpposts2wpposts');
// Magic Mojo // Magic Mojo
if(is_array($comments)) if(is_array($comments))
{ {
@ -364,7 +364,7 @@ class Textpattern_Import {
{ {
$count++; $count++;
extract($comment); extract($comment);
// WordPressify Data // WordPressify Data
$comment_ID = ltrim($discussid, '0'); $comment_ID = ltrim($discussid, '0');
$comment_post_ID = $postarr[$parentid]; $comment_post_ID = $postarr[$parentid];
@ -373,7 +373,7 @@ class Textpattern_Import {
$email = $wpdb->escape($email); $email = $wpdb->escape($email);
$web = $wpdb->escape($web); $web = $wpdb->escape($web);
$message = $wpdb->escape($message); $message = $wpdb->escape($message);
if($cinfo = comment_exists($name, $posted)) if($cinfo = comment_exists($name, $posted))
{ {
// Update comments // Update comments
@ -405,25 +405,25 @@ class Textpattern_Import {
$txpcm2wpcm[$comment_ID] = $ret_id; $txpcm2wpcm[$comment_ID] = $ret_id;
} }
// Store Comment ID translation for future use // Store Comment ID translation for future use
add_option('txpcm2wpcm', $txpcm2wpcm); add_option('txpcm2wpcm', $txpcm2wpcm);
// Associate newly formed categories with posts // Associate newly formed categories with posts
get_comment_count($ret_id); get_comment_count($ret_id);
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>'; echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
return true; return true;
} }
echo __('No Comments to Import!'); echo __('No Comments to Import!');
return false; return false;
} }
function links2wp($links='') function links2wp($links='')
{ {
// General Housekeeping // General Housekeeping
global $wpdb; global $wpdb;
$count = 0; $count = 0;
// Deal with the links // Deal with the links
if(is_array($links)) if(is_array($links))
{ {
@ -432,12 +432,12 @@ class Textpattern_Import {
{ {
$count++; $count++;
extract($link); extract($link);
// Make nice vars // Make nice vars
$category = $wpdb->escape($category); $category = $wpdb->escape($category);
$linkname = $wpdb->escape($linkname); $linkname = $wpdb->escape($linkname);
$description = $wpdb->escape($description); $description = $wpdb->escape($description);
if($linfo = link_exists($linkname)) if($linfo = link_exists($linkname))
{ {
$ret_id = wp_insert_link(array( $ret_id = wp_insert_link(array(
@ -470,67 +470,67 @@ class Textpattern_Import {
echo __('No Links to Import!'); echo __('No Links to Import!');
return false; return false;
} }
function import_categories() function import_categories()
{ {
// Category Import // Category Import
$cats = $this->get_txp_cats(); $cats = $this->get_txp_cats();
$this->cat2wp($cats); $this->cat2wp($cats);
add_option('txp_cats', $cats); add_option('txp_cats', $cats);
echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">'; echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Users')); printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
echo '</form>'; echo '</form>';
} }
function import_users() function import_users()
{ {
// User Import // User Import
$users = $this->get_txp_users(); $users = $this->get_txp_users();
$this->users2wp($users); $this->users2wp($users);
echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">'; echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts')); printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
echo '</form>'; echo '</form>';
} }
function import_posts() function import_posts()
{ {
// Post Import // Post Import
$posts = $this->get_txp_posts(); $posts = $this->get_txp_posts();
$this->posts2wp($posts); $this->posts2wp($posts);
echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">'; echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments')); printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
echo '</form>'; echo '</form>';
} }
function import_comments() function import_comments()
{ {
// Comment Import // Comment Import
$comments = $this->get_txp_comments(); $comments = $this->get_txp_comments();
$this->comments2wp($comments); $this->comments2wp($comments);
echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">'; echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Import Links')); printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
echo '</form>'; echo '</form>';
} }
function import_links() function import_links()
{ {
//Link Import //Link Import
$links = $this->get_txp_links(); $links = $this->get_txp_links();
$this->links2wp($links); $this->links2wp($links);
add_option('txp_links', $links); add_option('txp_links', $links);
echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">'; echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
printf('<input type="submit" name="submit" value="%s" />', __('Finish')); printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
echo '</form>'; echo '</form>';
} }
function cleanup_txpimport() function cleanup_txpimport()
{ {
delete_option('tpre'); delete_option('tpre');
@ -546,7 +546,7 @@ class Textpattern_Import {
delete_option('txphost'); delete_option('txphost');
$this->tips(); $this->tips();
} }
function tips() function tips()
{ {
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>'; echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
@ -565,7 +565,7 @@ class Textpattern_Import {
echo '</ul>'; echo '</ul>';
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>'; echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
} }
function db_form() function db_form()
{ {
echo '<ul>'; echo '<ul>';
@ -576,7 +576,7 @@ class Textpattern_Import {
printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):')); printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):'));
echo '</ul>'; echo '</ul>';
} }
function dispatch() function dispatch()
{ {
@ -585,26 +585,26 @@ class Textpattern_Import {
else else
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
$this->header(); $this->header();
if ( $step > 0 ) if ( $step > 0 )
{ {
if($_POST['dbuser']) if($_POST['dbuser'])
{ {
if(get_option('txpuser')) if(get_option('txpuser'))
delete_option('txpuser'); delete_option('txpuser');
add_option('txpuser',$_POST['dbuser']); add_option('txpuser',$_POST['dbuser']);
} }
if($_POST['dbpass']) if($_POST['dbpass'])
{ {
if(get_option('txppass')) if(get_option('txppass'))
delete_option('txppass'); delete_option('txppass');
add_option('txppass',$_POST['dbpass']); add_option('txppass',$_POST['dbpass']);
} }
if($_POST['dbname']) if($_POST['dbname'])
{ {
if(get_option('txpname')) if(get_option('txpname'))
delete_option('txpname'); delete_option('txpname');
add_option('txpname',$_POST['dbname']); add_option('txpname',$_POST['dbname']);
} }
if($_POST['dbhost']) if($_POST['dbhost'])
@ -618,7 +618,7 @@ class Textpattern_Import {
if(get_option('tpre')) if(get_option('tpre'))
delete_option('tpre'); delete_option('tpre');
add_option('tpre',$_POST['dbprefix']); add_option('tpre',$_POST['dbprefix']);
} }
} }
@ -648,13 +648,13 @@ class Textpattern_Import {
$this->cleanup_txpimport(); $this->cleanup_txpimport();
break; break;
} }
$this->footer(); $this->footer();
} }
function Textpattern_Import() function Textpattern_Import()
{ {
// Nothing. // Nothing.
} }
} }

View File

@ -33,17 +33,17 @@ header( 'Content-Type: text/html; charset=utf-8' );
margin-right: 20%; margin-right: 20%;
padding: .2em 2em; padding: .2em 2em;
} }
h1 { h1 {
color: #006; color: #006;
font-size: 18px; font-size: 18px;
font-weight: lighter; font-weight: lighter;
} }
h2 { h2 {
font-size: 16px; font-size: 16px;
} }
p, li, dt { p, li, dt {
line-height: 140%; line-height: 140%;
padding-bottom: 2px; padding-bottom: 2px;
@ -127,7 +127,7 @@ if (empty($admin_email)) {
} else if (!is_email($admin_email)) { } else if (!is_email($admin_email)) {
die (__("<strong>ERROR</strong>: the e-mail address isn't correct")); die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
} }
?> ?>
<h1><?php _e('Second Step'); ?></h1> <h1><?php _e('Second Step'); ?></h1>
<p><?php _e('Now we&#8217;re going to create the database tables and fill them with some default data.'); ?></p> <p><?php _e('Now we&#8217;re going to create the database tables and fill them with some default data.'); ?></p>

View File

@ -128,7 +128,7 @@ switch ($action) {
check_admin_referer(); check_admin_referer();
add_link(); add_link();
header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true'); header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true');
break; break;
} // end Add } // end Add
@ -137,7 +137,7 @@ switch ($action) {
{ {
check_admin_referer(); check_admin_referer();
if (isset($links_show_cat_id) && ($links_show_cat_id != '')) if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id; $cat_id = $links_show_cat_id;
@ -149,7 +149,7 @@ switch ($action) {
$link_id = (int) $_POST['link_id']; $link_id = (int) $_POST['link_id'];
edit_link($link_id); edit_link($link_id);
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600); setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
wp_redirect($this_file); wp_redirect($this_file);
break; break;
@ -165,7 +165,7 @@ switch ($action) {
$link_id = (int) $_GET['link_id']; $link_id = (int) $_GET['link_id'];
wp_delete_link($link_id); wp_delete_link($link_id);
if (isset($links_show_cat_id) && ($links_show_cat_id != '')) if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id; $cat_id = $links_show_cat_id;
@ -184,12 +184,12 @@ switch ($action) {
include_once ('admin-header.php'); include_once ('admin-header.php');
if ( !current_user_can('manage_links') ) if ( !current_user_can('manage_links') )
die(__('You do not have sufficient permissions to edit the links for this blog.')); die(__('You do not have sufficient permissions to edit the links for this blog.'));
$link_id = (int) $_GET['link_id']; $link_id = (int) $_GET['link_id'];
if ( !$link = get_link_to_edit($link_id) ) if ( !$link = get_link_to_edit($link_id) )
die( __('Link not found.') ); die( __('Link not found.') );
include('edit-link-form.php'); include('edit-link-form.php');
break; break;
} // end linkedit } // end linkedit
@ -370,7 +370,7 @@ function checkAll(form)
?> ?>
<tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>> <tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
<td><strong><?php echo $link->link_name; ?></strong><br /> <td><strong><?php echo $link->link_name; ?></strong><br />
<?php <?php
echo sprintf(__('Description: %s'), $link->link_description) . "</td>"; echo sprintf(__('Description: %s'), $link->link_description) . "</td>";
echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>"; echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>";
echo <<<LINKS echo <<<LINKS

View File

@ -51,7 +51,7 @@ function removeThisItem(id) {
listItems.splice(pos,1); listItems.splice(pos,1);
recolorList(pos); recolorList(pos);
ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement); ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement);
} }
} }
@ -63,7 +63,7 @@ function getListPos(id) {
} }
} }
return pos; return pos;
} }
function getListItems() { function getListItems() {
if (list) return; if (list) return;

View File

@ -54,7 +54,7 @@ case 'delete-comment' :
if ( !$comment = get_comment($id) ) if ( !$comment = get_comment($id) )
die('0'); die('0');
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die('-1'); die('-1');
if ( wp_delete_comment($comment->comment_ID) ) { if ( wp_delete_comment($comment->comment_ID) ) {
@ -77,5 +77,5 @@ case 'delete-link-category' :
die('0'); die('0');
} }
break; break;
endswitch; endswitch;
?> ?>

View File

@ -13,7 +13,7 @@ foreach ($menu as $item) {
if ( current_user_can($item[1]) ) { if ( current_user_can($item[1]) ) {
if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") ) if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else else
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
} }

View File

@ -115,7 +115,7 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
} }
?> ?>
<div class="wrap"> <div class="wrap">
<?php <?php

View File

@ -41,7 +41,7 @@ structure.onfocus = function () { document.getElementById('custom_selection').ch
var aInputs = document.getElementsByTagName('input'); var aInputs = document.getElementsByTagName('input');
for (var i = 0; i < aInputs.length; i++) { for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit; aInputs[i].onclick = aInputs[i].onkeyup = upit;
} }
} }
@ -64,7 +64,7 @@ if ( isset($_POST) ) {
$permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
$wp_rewrite->set_permalink_structure($permalink_structure); $wp_rewrite->set_permalink_structure($permalink_structure);
} }
if ( isset($_POST['category_base']) ) { if ( isset($_POST['category_base']) ) {
$category_base = $_POST['category_base']; $category_base = $_POST['category_base'];
if (! empty($category_base) ) if (! empty($category_base) )
@ -72,7 +72,7 @@ if ( isset($_POST) ) {
$wp_rewrite->set_category_base($category_base); $wp_rewrite->set_category_base($category_base);
} }
} }
$permalink_structure = get_settings('permalink_structure'); $permalink_structure = get_settings('permalink_structure');
$category_base = get_settings('category_base'); $category_base = get_settings('category_base');
@ -141,7 +141,7 @@ $structures = array(
checked="checked" checked="checked"
<?php } ?> <?php } ?>
/> />
<?php _e('Custom, specify below'); ?> <?php _e('Custom, specify below'); ?>
</label> </label>
<br /> <br />
</p> </p>

View File

@ -28,7 +28,7 @@ switch($action) {
case 'update': case 'update':
$any_changed = 0; $any_changed = 0;
check_admin_referer(); check_admin_referer();
if (!$_POST['page_options']) { if (!$_POST['page_options']) {
@ -52,11 +52,11 @@ case 'update':
$value = trim(stripslashes($_POST[$option])); $value = trim(stripslashes($_POST[$option]));
if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) if( in_array($option, $nonbools) && ( $value == '0' || $value == '') )
$value = 'closed'; $value = 'closed';
if( $option == 'blogdescription' || $option == 'blogname' ) if( $option == 'blogdescription' || $option == 'blogname' )
if (current_user_can('unfiltered_html') == false) if (current_user_can('unfiltered_html') == false)
$value = wp_filter_post_kses( $value ); $value = wp_filter_post_kses( $value );
if (update_option($option, $value) ) { if (update_option($option, $value) ) {
$any_changed++; $any_changed++;
} }

View File

@ -14,7 +14,7 @@ require_once('admin-header.php');
if ( current_user_can('edit_pages') ) { if ( current_user_can('edit_pages') ) {
$action = 'post'; $action = 'post';
get_currentuserinfo(); get_currentuserinfo();
$post = get_default_post_to_edit(); $post = get_default_post_to_edit();
$post->post_type = 'page'; $post->post_type = 'page';

View File

@ -52,16 +52,16 @@ case 'update':
break; break;
default: default:
require_once('admin-header.php'); require_once('admin-header.php');
if ( !current_user_can('edit_plugins') ) if ( !current_user_can('edit_plugins') )
die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>'); die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>');
update_recently_edited("wp-content/plugins/$file"); update_recently_edited("wp-content/plugins/$file");
if (!is_file($real_file)) if (!is_file($real_file))
$error = 1; $error = 1;
if (!$error) { if (!$error) {
$f = fopen($real_file, 'r'); $f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file)); $content = fread($f, filesize($real_file));

View File

@ -3,7 +3,7 @@ require_once('admin.php');
if ( isset($_GET['action']) ) { if ( isset($_GET['action']) ) {
check_admin_referer(); check_admin_referer();
if ('activate' == $_GET['action']) { if ('activate' == $_GET['action']) {
$current = get_settings('active_plugins'); $current = get_settings('active_plugins');
if (!in_array($_GET['plugin'], $current)) { if (!in_array($_GET['plugin'], $current)) {
@ -36,7 +36,7 @@ $check_plugins = get_settings('active_plugins');
// empty array. // empty array.
if ( !is_array($check_plugins) ) { if ( !is_array($check_plugins) ) {
$check_plugins = array(); $check_plugins = array();
update_option('active_plugins', $check_plugins); update_option('active_plugins', $check_plugins);
} }
// If a plugin file does not exist, remove it from the list of active // If a plugin file does not exist, remove it from the list of active
@ -91,7 +91,7 @@ if (empty($plugins)) {
function sort_plugins($plug1, $plug2) { function sort_plugins($plug1, $plug2) {
return strnatcasecmp($plug1['Name'], $plug2['Name']); return strnatcasecmp($plug1['Name'], $plug2['Name']);
} }
uksort($plugins, 'sort_plugins'); uksort($plugins, 'sort_plugins');
foreach($plugins as $plugin_file => $plugin_data) { foreach($plugins as $plugin_file => $plugin_data) {

View File

@ -71,7 +71,7 @@ case 'edit':
die ( __('You are not allowed to edit this post.') ); die ( __('You are not allowed to edit this post.') );
$post = get_post_to_edit($post_ID); $post = get_post_to_edit($post_ID);
if ($post->post_type == 'page') if ($post->post_type == 'page')
include('edit-page-form.php'); include('edit-page-form.php');
else else
@ -130,8 +130,8 @@ case 'delete':
$post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']); $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
$post = & get_post($post_id); $post = & get_post($post_id);
if ( !current_user_can('edit_post', $post_id) ) if ( !current_user_can('edit_post', $post_id) )
die( __('You are not allowed to delete this post.') ); die( __('You are not allowed to delete this post.') );
if ( $post->post_type == 'attachment' ) { if ( $post->post_type == 'attachment' ) {
@ -161,7 +161,7 @@ case 'editcomment':
if ( ! $comment = get_comment($comment) ) if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post.') ); die( __('You are not allowed to edit comments on this post.') );
$comment = get_comment_to_edit($comment); $comment = get_comment_to_edit($comment);
@ -180,7 +180,7 @@ case 'confirmdeletecomment':
if ( ! $comment = get_comment($comment) ) if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to delete comments on this post.') ); die( __('You are not allowed to delete comments on this post.') );
echo "<div class='wrap'>\n"; echo "<div class='wrap'>\n";
@ -223,7 +223,7 @@ case 'deletecomment':
if ( ! $comment = get_comment($comment) ) if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post.') ); die( __('You are not allowed to edit comments on this post.') );
wp_set_comment_status($comment->comment_ID, "delete"); wp_set_comment_status($comment->comment_ID, "delete");
@ -252,7 +252,7 @@ case 'unapprovecomment':
if ( ! $comment = get_comment($comment) ) if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
wp_set_comment_status($comment->comment_ID, "hold"); wp_set_comment_status($comment->comment_ID, "hold");
@ -272,7 +272,7 @@ case 'mailapprovecomment':
if ( ! $comment = get_comment($comment) ) if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
if ('1' != $comment->comment_approved) { if ('1' != $comment->comment_approved) {
@ -298,7 +298,7 @@ case 'approvecomment':
if ( ! $comment = get_comment($comment) ) if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( !current_user_can('edit_post', $comment->comment_post_ID) ) if ( !current_user_can('edit_post', $comment->comment_post_ID) )
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
wp_set_comment_status($comment->comment_ID, "approve"); wp_set_comment_status($comment->comment_ID, "approve");

View File

@ -103,7 +103,7 @@ switch($step) {
</form> </form>
<?php <?php
break; break;
case 2: case 2:
$dbname = trim($_POST['dbname']); $dbname = trim($_POST['dbname']);
$uname = trim($_POST['uname']); $uname = trim($_POST['uname']);

View File

@ -60,7 +60,7 @@ break;
default: default:
require_once('./admin-header.php'); require_once('./admin-header.php');
if ( ! current_user_can('edit_files') ) if ( ! current_user_can('edit_files') )
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>'); die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
@ -71,7 +71,7 @@ default:
if (!is_file($real_file)) if (!is_file($real_file))
$error = true; $error = true;
if (!$error) { if (!$error) {
$f = @ fopen($real_file, 'r'); $f = @ fopen($real_file, 'r');
if ( $f ) { if ( $f ) {
@ -88,7 +88,7 @@ default:
<div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div> <div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div>
<?php else: ?> <?php else: ?>
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div> <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<div class="wrap"> <div class="wrap">
<?php <?php

View File

@ -66,16 +66,16 @@ case 'update':
break; break;
default: default:
require_once('admin-header.php'); require_once('admin-header.php');
if ( !current_user_can('edit_themes') ) if ( !current_user_can('edit_themes') )
die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>'); die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
update_recently_edited($file); update_recently_edited($file);
if (!is_file($real_file)) if (!is_file($real_file))
$error = 1; $error = 1;
if (!$error && filesize($real_file) > 0) { if (!$error && filesize($real_file) > 0) {
$f = fopen($real_file, 'r'); $f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file)); $content = fread($f, filesize($real_file));

View File

@ -3,16 +3,16 @@ require_once('admin.php');
if ( isset($_GET['action']) ) { if ( isset($_GET['action']) ) {
check_admin_referer(); check_admin_referer();
if ('activate' == $_GET['action']) { if ('activate' == $_GET['action']) {
if ( isset($_GET['template']) ) if ( isset($_GET['template']) )
update_option('template', $_GET['template']); update_option('template', $_GET['template']);
if ( isset($_GET['stylesheet']) ) if ( isset($_GET['stylesheet']) )
update_option('stylesheet', $_GET['stylesheet']); update_option('stylesheet', $_GET['stylesheet']);
do_action('switch_theme', get_current_theme()); do_action('switch_theme', get_current_theme());
header('Location: themes.php?activated=true'); header('Location: themes.php?activated=true');
exit; exit;
} }
@ -102,7 +102,7 @@ if ( count($broken_themes) ) {
</tr> </tr>
<?php <?php
$theme = ''; $theme = '';
$theme_names = array_keys($broken_themes); $theme_names = array_keys($broken_themes);
natcasesort($theme_names); natcasesort($theme_names);

View File

@ -20,7 +20,7 @@ function upgrade_all() {
if ( !empty($template) ) if ( !empty($template) )
$wp_current_db_version = 2541; $wp_current_db_version = 2541;
} }
populate_options(); populate_options();
if ( $wp_current_db_version < 2541 ) { if ( $wp_current_db_version < 2541 ) {
@ -29,7 +29,7 @@ function upgrade_all() {
upgrade_110(); upgrade_110();
upgrade_130(); upgrade_130();
} }
if ( $wp_current_db_version < 3308 ) if ( $wp_current_db_version < 3308 )
upgrade_160(); upgrade_160();
@ -37,7 +37,7 @@ function upgrade_all() {
upgrade_210(); upgrade_210();
$wp_rewrite->flush_rules(); $wp_rewrite->flush_rules();
update_option('db_version', $wp_db_version); update_option('db_version', $wp_db_version);
} }
@ -54,7 +54,7 @@ function upgrade_100() {
} }
} }
} }
$categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories"); $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
foreach ($categories as $category) { foreach ($categories as $category) {
if ('' == $category->category_nicename) { if ('' == $category->category_nicename) {
@ -77,7 +77,7 @@ function upgrade_100() {
else: else:
$catwhere = ''; $catwhere = '';
endif; endif;
$allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere"); $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
if ($allposts) : if ($allposts) :
foreach ($allposts as $post) { foreach ($allposts as $post) {
@ -111,7 +111,7 @@ function upgrade_101() {
function upgrade_110() { function upgrade_110() {
global $wpdb; global $wpdb;
// Set user_nicename. // Set user_nicename.
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
foreach ($users as $user) { foreach ($users as $user) {
@ -280,7 +280,7 @@ function upgrade_160() {
$id = $wpdb->escape( $id ); $id = $wpdb->escape( $id );
$wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'"); $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
endif; endif;
// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set. // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
$caps = get_usermeta( $user->ID, $table_prefix . 'capabilities'); $caps = get_usermeta( $user->ID, $table_prefix . 'capabilities');
if ( empty($caps) || defined('RESET_CAPS') ) { if ( empty($caps) || defined('RESET_CAPS') ) {
@ -288,14 +288,14 @@ function upgrade_160() {
$role = translate_level_to_role($level); $role = translate_level_to_role($level);
update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) ); update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) );
} }
endforeach; endforeach;
$old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' ); $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
$wpdb->hide_errors(); $wpdb->hide_errors();
foreach ( $old_user_fields as $old ) foreach ( $old_user_fields as $old )
$wpdb->query("ALTER TABLE $wpdb->users DROP $old"); $wpdb->query("ALTER TABLE $wpdb->users DROP $old");
$wpdb->show_errors(); $wpdb->show_errors();
if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts
$categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
foreach ( $categories as $cat_id ) { foreach ( $categories as $cat_id ) {
@ -321,7 +321,7 @@ function upgrade_160() {
post_mime_type = '$object->post_type', post_mime_type = '$object->post_type',
post_type = '' post_type = ''
WHERE ID = $object->ID"); WHERE ID = $object->ID");
$meta = get_post_meta($object->ID, 'imagedata', true); $meta = get_post_meta($object->ID, 'imagedata', true);
if ( ! empty($meta['file']) ) if ( ! empty($meta['file']) )
add_post_meta($object->ID, '_wp_attached_file', $meta['file']); add_post_meta($object->ID, '_wp_attached_file', $meta['file']);
@ -335,7 +335,7 @@ function upgrade_210() {
if ( $wp_current_db_version < 3506 ) { if ( $wp_current_db_version < 3506 ) {
// Update status and type. // Update status and type.
$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
if ( ! empty($posts) ) foreach ($posts as $post) { if ( ! empty($posts) ) foreach ($posts as $post) {
$status = $post->post_status; $status = $post->post_status;
$type = 'post'; $type = 'post';
@ -345,15 +345,15 @@ function upgrade_210() {
$type = 'page'; $type = 'page';
} else if ( 'attachment' == $status ) { } else if ( 'attachment' == $status ) {
$status = 'inherit'; $status = 'inherit';
$type = 'attachment'; $type = 'attachment';
} }
$wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'"); $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
} }
} }
if ( $wp_current_db_version < 3513 ) { if ( $wp_current_db_version < 3513 ) {
populate_roles_210(); populate_roles_210();
} }
} }
@ -477,17 +477,17 @@ function deslash($content) {
function dbDelta($queries, $execute = true) { function dbDelta($queries, $execute = true) {
global $wpdb; global $wpdb;
// Seperate individual queries into an array // Seperate individual queries into an array
if( !is_array($queries) ) { if( !is_array($queries) ) {
$queries = explode( ';', $queries ); $queries = explode( ';', $queries );
if('' == $queries[count($queries) - 1]) array_pop($queries); if('' == $queries[count($queries) - 1]) array_pop($queries);
} }
$cqueries = array(); // Creation Queries $cqueries = array(); // Creation Queries
$iqueries = array(); // Insertion Queries $iqueries = array(); // Insertion Queries
$for_update = array(); $for_update = array();
// Create a tablename index for an array ($cqueries) of queries // Create a tablename index for an array ($cqueries) of queries
foreach($queries as $qry) { foreach($queries as $qry) {
if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
@ -506,7 +506,7 @@ function dbDelta($queries, $execute = true) {
else { else {
// Unrecognized query type // Unrecognized query type
} }
} }
// Check to see which tables and fields exist // Check to see which tables and fields exist
if($tables = $wpdb->get_col('SHOW TABLES;')) { if($tables = $wpdb->get_col('SHOW TABLES;')) {
@ -525,13 +525,13 @@ function dbDelta($queries, $execute = true) {
$flds = explode("\n", $qryline); $flds = explode("\n", $qryline);
//echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>"; //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
// For every field line specified in the query // For every field line specified in the query
foreach($flds as $fld) { foreach($flds as $fld) {
// Extract the field name // Extract the field name
preg_match("|^([^ ]*)|", trim($fld), $fvals); preg_match("|^([^ ]*)|", trim($fld), $fvals);
$fieldname = $fvals[1]; $fieldname = $fvals[1];
// Verify the found field name // Verify the found field name
$validfield = true; $validfield = true;
switch(strtolower($fieldname)) switch(strtolower($fieldname))
@ -547,18 +547,18 @@ function dbDelta($queries, $execute = true) {
break; break;
} }
$fld = trim($fld); $fld = trim($fld);
// If it's a valid field, add it to the field array // If it's a valid field, add it to the field array
if($validfield) { if($validfield) {
$cfields[strtolower($fieldname)] = trim($fld, ", \n"); $cfields[strtolower($fieldname)] = trim($fld, ", \n");
} }
} }
// Fetch the table column structure from the database // Fetch the table column structure from the database
$tablefields = $wpdb->get_results("DESCRIBE {$table};"); $tablefields = $wpdb->get_results("DESCRIBE {$table};");
// For every field in the table // For every field in the table
foreach($tablefields as $tablefield) { foreach($tablefields as $tablefield) {
// If the table field exists in the field array... // If the table field exists in the field array...
if(array_key_exists(strtolower($tablefield->Field), $cfields)) { if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
// Get the field type from the query // Get the field type from the query
@ -571,7 +571,7 @@ function dbDelta($queries, $execute = true) {
$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)]; $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
$for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
} }
// Get the default value from the array // Get the default value from the array
//echo "{$cfields[strtolower($tablefield->Field)]}<br>"; //echo "{$cfields[strtolower($tablefield->Field)]}<br>";
if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) { if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
@ -598,11 +598,11 @@ function dbDelta($queries, $execute = true) {
$cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef"; $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
$for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname; $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
} }
// Index stuff goes here // Index stuff goes here
// Fetch the table index structure from the database // Fetch the table index structure from the database
$tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};"); $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
if($tableindices) { if($tableindices) {
// Clear the index array // Clear the index array
unset($index_ary); unset($index_ary);
@ -631,7 +631,7 @@ function dbDelta($queries, $execute = true) {
} }
$index_columns = ''; $index_columns = '';
// For each column in the index // For each column in the index
foreach($index_data['columns'] as $column_data) { foreach($index_data['columns'] as $column_data) {
if($index_columns != '') $index_columns .= ','; if($index_columns != '') $index_columns .= ',';
// Add the field to the column list string // Add the field to the column list string
$index_columns .= $column_data['fieldname']; $index_columns .= $column_data['fieldname'];

View File

@ -257,7 +257,7 @@ function populate_roles_160() {
add_role('author', __('Author')); add_role('author', __('Author'));
add_role('contributor', __('Contributor')); add_role('contributor', __('Contributor'));
add_role('subscriber', __('Subscriber')); add_role('subscriber', __('Subscriber'));
// Add caps for Administrator role // Add caps for Administrator role
$role = get_role('administrator'); $role = get_role('administrator');
$role->add_cap('switch_themes'); $role->add_cap('switch_themes');
@ -290,7 +290,7 @@ function populate_roles_160() {
$role->add_cap('level_2'); $role->add_cap('level_2');
$role->add_cap('level_1'); $role->add_cap('level_1');
$role->add_cap('level_0'); $role->add_cap('level_0');
// Add caps for Editor role // Add caps for Editor role
$role = get_role('editor'); $role = get_role('editor');
$role->add_cap('moderate_comments'); $role->add_cap('moderate_comments');
@ -312,7 +312,7 @@ function populate_roles_160() {
$role->add_cap('level_2'); $role->add_cap('level_2');
$role->add_cap('level_1'); $role->add_cap('level_1');
$role->add_cap('level_0'); $role->add_cap('level_0');
// Add caps for Author role // Add caps for Author role
$role = get_role('author'); $role = get_role('author');
$role->add_cap('upload_files'); $role->add_cap('upload_files');
@ -323,14 +323,14 @@ function populate_roles_160() {
$role->add_cap('level_2'); $role->add_cap('level_2');
$role->add_cap('level_1'); $role->add_cap('level_1');
$role->add_cap('level_0'); $role->add_cap('level_0');
// Add caps for Contributor role // Add caps for Contributor role
$role = get_role('contributor'); $role = get_role('contributor');
$role->add_cap('edit_posts'); $role->add_cap('edit_posts');
$role->add_cap('read'); $role->add_cap('read');
$role->add_cap('level_1'); $role->add_cap('level_1');
$role->add_cap('level_0'); $role->add_cap('level_0');
// Add caps for Subscriber role // Add caps for Subscriber role
$role = get_role('subscriber'); $role = get_role('subscriber');
$role->add_cap('read'); $role->add_cap('read');
@ -354,14 +354,14 @@ function populate_roles_210() {
$role->add_cap('delete_others_posts'); $role->add_cap('delete_others_posts');
$role->add_cap('delete_published_posts'); $role->add_cap('delete_published_posts');
} }
$role = get_role('author'); $role = get_role('author');
if ( ! empty($role) ) { if ( ! empty($role) ) {
$role->add_cap('delete_posts'); $role->add_cap('delete_posts');
$role->add_cap('delete_published_posts'); $role->add_cap('delete_published_posts');
} }
$role = get_role('contributor'); $role = get_role('contributor');
if ( ! empty($role) ) { if ( ! empty($role) ) {
$role->add_cap('delete_posts'); $role->add_cap('delete_posts');
} }

View File

@ -27,17 +27,17 @@ header( 'Content-Type: text/html; charset=utf-8' );
margin-right: 20%; margin-right: 20%;
padding: .2em 2em; padding: .2em 2em;
} }
h1 { h1 {
color: #006; color: #006;
font-size: 18px; font-size: 18px;
font-weight: lighter; font-weight: lighter;
} }
h2 { h2 {
font-size: 16px; font-size: 16px;
} }
p, li, dt { p, li, dt {
line-height: 140%; line-height: 140%;
padding-bottom: 2px; padding-bottom: 2px;
@ -73,7 +73,7 @@ switch($step) {
<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2> <h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
<?php <?php
break; break;
case 1: case 1:
wp_cache_flush(); wp_cache_flush();
make_db_current_silent(); make_db_current_silent();

View File

@ -2,7 +2,7 @@
require_once('admin.php'); require_once('admin.php');
$title = __('Edit User'); $title = __('Edit User');
$parent_file = 'profile.php'; $parent_file = 'profile.php';
$submenu_file = 'users.php'; $submenu_file = 'users.php';
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id'); $wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');

View File

@ -4,7 +4,7 @@ require_once( ABSPATH . WPINC . '/registration-functions.php');
$title = __('Users'); $title = __('Users');
$parent_file = 'profile.php'; $parent_file = 'profile.php';
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
$update = ''; $update = '';
@ -32,7 +32,7 @@ case 'promote':
$user = new WP_User($id); $user = new WP_User($id);
$user->set_role($_POST['new_role']); $user->set_role($_POST['new_role']);
} }
header('Location: users.php?update=' . $update); header('Location: users.php?update=' . $update);
break; break;
@ -49,7 +49,7 @@ case 'dodelete':
die(__('You can&#8217;t delete users.')); die(__('You can&#8217;t delete users.'));
$userids = $_POST['users']; $userids = $_POST['users'];
$update = 'del'; $update = 'del';
foreach ($userids as $id) { foreach ($userids as $id) {
if($id == $current_user->id) { if($id == $current_user->id) {
@ -132,27 +132,27 @@ break;
case 'adduser': case 'adduser':
check_admin_referer(); check_admin_referer();
$errors = add_user(); $errors = add_user();
if(count($errors) == 0) { if(count($errors) == 0) {
header('Location: users.php?update=add'); header('Location: users.php?update=add');
die(); die();
} }
default: default:
include ('admin-header.php'); include ('admin-header.php');
$userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;"); $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;");
foreach($userids as $userid) { foreach($userids as $userid) {
$tmp_user = new WP_User($userid); $tmp_user = new WP_User($userid);
$roles = $tmp_user->roles; $roles = $tmp_user->roles;
$role = array_shift($roles); $role = array_shift($roles);
$roleclasses[$role][$tmp_user->user_login] = $tmp_user; $roleclasses[$role][$tmp_user->user_login] = $tmp_user;
} }
?> ?>
<?php <?php
@ -198,7 +198,7 @@ default:
<?php <?php
endif; endif;
?> ?>
<form action="" method="post" name="updateusers" id="updateusers"> <form action="" method="post" name="updateusers" id="updateusers">
<div class="wrap"> <div class="wrap">
<h2><?php _e('User List by Role'); ?></h2> <h2><?php _e('User List by Role'); ?></h2>
@ -250,9 +250,9 @@ default:
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
} }
?> ?>
<?php <?php
} }

View File

@ -872,7 +872,7 @@ table .vers, table .name {
.dbx-handle-cursor { .dbx-handle-cursor {
cursor: move; cursor: move;
} }
/* toggle images */ /* toggle images */
a.dbx-toggle, a.dbx-toggle:visited { a.dbx-toggle, a.dbx-toggle:visited {
display:block; display:block;

View File

@ -38,7 +38,7 @@ function blurry() {
var aInputs = document.getElementsByTagName('input'); var aInputs = document.getElementsByTagName('input');
for (var i = 0; i < aInputs.length; i++) { for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit; aInputs[i].onclick = aInputs[i].onkeyup = upit;
} }
} }

View File

@ -56,8 +56,8 @@ if (have_posts()) :
$title = apply_filters('the_title', $title); $title = apply_filters('the_title', $title);
$title = apply_filters('the_title_rss', $title); $title = apply_filters('the_title_rss', $title);
printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
} else { } else {
printf(__('by: %s'), get_comment_author_rss()); printf(__('by: %s'), get_comment_author_rss());
} ?></title> } ?></title>
<link><?php comment_link() ?></link> <link><?php comment_link() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>

View File

@ -36,12 +36,12 @@ class wpdbBackup {
} }
function wpdbBackup() { function wpdbBackup() {
add_action('wp_cron_daily', array(&$this, 'wp_cron_daily')); add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
$this->backup_dir = trailingslashit($this->backup_dir); $this->backup_dir = trailingslashit($this->backup_dir);
$this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); $this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
if (isset($_POST['do_backup'])) { if (isset($_POST['do_backup'])) {
switch($_POST['do_backup']) { switch($_POST['do_backup']) {
case 'backup': case 'backup':
@ -49,7 +49,7 @@ class wpdbBackup {
break; break;
case 'fragments': case 'fragments':
add_action('admin_menu', array(&$this, 'fragment_menu')); add_action('admin_menu', array(&$this, 'fragment_menu'));
break; break;
} }
} elseif (isset($_GET['fragment'] )) { } elseif (isset($_GET['fragment'] )) {
add_action('init', array(&$this, 'init')); add_action('init', array(&$this, 'init'));
@ -59,7 +59,7 @@ class wpdbBackup {
add_action('admin_menu', array(&$this, 'admin_menu')); add_action('admin_menu', array(&$this, 'admin_menu'));
} }
} }
function init() { function init() {
global $user_level; global $user_level;
get_currentuserinfo(); get_currentuserinfo();
@ -68,9 +68,9 @@ class wpdbBackup {
if (isset($_GET['backup'])) { if (isset($_GET['backup'])) {
$via = isset($_GET['via']) ? $_GET['via'] : 'http'; $via = isset($_GET['via']) ? $_GET['via'] : 'http';
$this->backup_file = $_GET['backup']; $this->backup_file = $_GET['backup'];
switch($via) { switch($via) {
case 'smtp': case 'smtp':
case 'email': case 'email':
@ -101,14 +101,14 @@ class wpdbBackup {
die(); die();
} }
function build_backup_script() { function build_backup_script() {
global $table_prefix, $wpdb; global $table_prefix, $wpdb;
$datum = date("Ymd_B"); $datum = date("Ymd_B");
$backup_filename = DB_NAME . "_$table_prefix$datum.sql"; $backup_filename = DB_NAME . "_$table_prefix$datum.sql";
if ($this->gzip()) $backup_filename .= '.gz'; if ($this->gzip()) $backup_filename .= '.gz';
echo "<div class='wrap'>"; echo "<div class='wrap'>";
//echo "<pre>" . print_r($_POST, 1) . "</pre>"; //echo "<pre>" . print_r($_POST, 1) . "</pre>";
echo '<h2>' . __('Backup') . '</h2> echo '<h2>' . __('Backup') . '</h2>
@ -143,19 +143,19 @@ class wpdbBackup {
} }
function backup(table, segment) { function backup(table, segment) {
var fram = document.getElementById("backuploader"); var fram = document.getElementById("backuploader");
fram.src = "' . $_SERVER['REQUEST_URI'] . '&fragment=" + table + ":" + segment + ":' . $backup_filename . '"; fram.src = "' . $_SERVER['REQUEST_URI'] . '&fragment=" + table + ":" + segment + ":' . $backup_filename . '";
} }
var curStep = 0; var curStep = 0;
function nextStep() { function nextStep() {
backupStep(curStep); backupStep(curStep);
curStep++; curStep++;
} }
function finishBackup() { function finishBackup() {
var fram = document.getElementById("backuploader"); var fram = document.getElementById("backuploader");
setMeter(100); setMeter(100);
'; ';
@ -179,15 +179,15 @@ class wpdbBackup {
setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>."), $download_uri) . '"); setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>."), $download_uri) . '");
'; ';
} }
echo ' echo '
} }
function backupStep(step) { function backupStep(step) {
switch(step) { switch(step) {
case 0: backup("", 0); break; case 0: backup("", 0); break;
'; ';
$also_backup = array(); $also_backup = array();
if (isset($_POST['other_tables'])) { if (isset($_POST['other_tables'])) {
$also_backup = $_POST['other_tables']; $also_backup = $_POST['other_tables'];
@ -210,7 +210,7 @@ class wpdbBackup {
$step_count++; $step_count++;
} }
echo "case {$step_count}: finishBackup(); break;"; echo "case {$step_count}: finishBackup(); break;";
echo ' echo '
} }
if(step != 0) setMeter(100 * step / ' . $step_count . '); if(step != 0) setMeter(100 * step / ' . $step_count . ');
@ -224,9 +224,9 @@ class wpdbBackup {
function backup_fragment($table, $segment, $filename) { function backup_fragment($table, $segment, $filename) {
global $table_prefix, $wpdb; global $table_prefix, $wpdb;
echo "$table:$segment:$filename"; echo "$table:$segment:$filename";
if($table == '') { if($table == '') {
$msg = __('Creating backup file...'); $msg = __('Creating backup file...');
} else { } else {
@ -236,12 +236,12 @@ class wpdbBackup {
$msg = sprintf(__('Backing up table \\"%s\\"...'), $table); $msg = sprintf(__('Backing up table \\"%s\\"...'), $table);
} }
} }
echo '<script type="text/javascript"><!--// echo '<script type="text/javascript"><!--//
var msg = "' . $msg . '"; var msg = "' . $msg . '";
window.parent.setProgress(msg); window.parent.setProgress(msg);
'; ';
if (is_writable(ABSPATH . $this->backup_dir)) { if (is_writable(ABSPATH . $this->backup_dir)) {
$this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a'); $this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a');
if(!$this->fp) { if(!$this->fp) {
@ -249,7 +249,7 @@ class wpdbBackup {
$this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.'); $this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.');
} }
else { else {
if($table == '') { if($table == '') {
//Begin new backup of MySql //Begin new backup of MySql
$this->stow("# WordPress MySQL database backup\n"); $this->stow("# WordPress MySQL database backup\n");
$this->stow("#\n"); $this->stow("#\n");
@ -266,7 +266,7 @@ class wpdbBackup {
$this->stow("# --------------------------------------------------------\n"); $this->stow("# --------------------------------------------------------\n");
$this->stow("# Table: " . $this->backquote($table) . "\n"); $this->stow("# Table: " . $this->backquote($table) . "\n");
$this->stow("# --------------------------------------------------------\n"); $this->stow("# --------------------------------------------------------\n");
} }
$this->backup_table($table, $segment); $this->backup_table($table, $segment);
} }
} }
@ -276,7 +276,7 @@ class wpdbBackup {
} }
if($this->fp) $this->close($this->fp); if($this->fp) $this->close($this->fp);
if($this->backup_errors) { if($this->backup_errors) {
foreach($this->backup_errors as $error) { foreach($this->backup_errors as $error) {
echo "window.parent.addError('$error');\n"; echo "window.parent.addError('$error');\n";
@ -294,7 +294,7 @@ class wpdbBackup {
//--></script> //--></script>
'; ';
} }
die(); die();
} }
@ -304,7 +304,7 @@ class wpdbBackup {
if (isset($_POST['other_tables'])) { if (isset($_POST['other_tables'])) {
$also_backup = $_POST['other_tables']; $also_backup = $_POST['other_tables'];
} }
$core_tables = $_POST['core_tables']; $core_tables = $_POST['core_tables'];
$this->backup_file = $this->db_backup($core_tables, $also_backup); $this->backup_file = $this->db_backup($core_tables, $also_backup);
if (FALSE !== $backup_file) { if (FALSE !== $backup_file) {
@ -318,7 +318,7 @@ class wpdbBackup {
$this->backup_complete = true; $this->backup_complete = true;
} }
} }
/////////////////////////////// ///////////////////////////////
function admin_menu() { function admin_menu() {
add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu')); add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu'));
@ -387,7 +387,7 @@ class wpdbBackup {
fclose($fp); fclose($fp);
} }
} }
////////////// //////////////
function stow($query_line) { function stow($query_line) {
if ($this->gzip()) { if ($this->gzip()) {
@ -402,7 +402,7 @@ class wpdbBackup {
} }
} }
} }
function backup_error($err) { function backup_error($err) {
if(count($this->backup_errors) < 20) { if(count($this->backup_errors) < 20) {
$this->backup_errors[] = $err; $this->backup_errors[] = $err;
@ -410,16 +410,16 @@ class wpdbBackup {
$this->backup_errors[] = __('Subsequent errors have been omitted from this log.'); $this->backup_errors[] = __('Subsequent errors have been omitted from this log.');
} }
} }
///////////////////////////// /////////////////////////////
function backup_table($table, $segment = 'none') { function backup_table($table, $segment = 'none') {
global $wpdb; global $wpdb;
/* /*
Taken partially from phpMyAdmin and partially from Taken partially from phpMyAdmin and partially from
Alain Wolf, Zurich - Switzerland Alain Wolf, Zurich - Switzerland
Website: http://restkultur.ch/personal/wolf/scripts/db_backup/ Website: http://restkultur.ch/personal/wolf/scripts/db_backup/
Modified by Scott Merril (http://www.skippy.net/) Modified by Scott Merril (http://www.skippy.net/)
to use the WordPress $wpdb object to use the WordPress $wpdb object
*/ */
@ -429,7 +429,7 @@ class wpdbBackup {
backup_errors(__('Error getting table details') . ": $table"); backup_errors(__('Error getting table details') . ": $table");
return FALSE; return FALSE;
} }
if(($segment == 'none') || ($segment == 0)) { if(($segment == 'none') || ($segment == 0)) {
// //
// Add SQL statement to drop existing table // Add SQL statement to drop existing table
@ -439,7 +439,7 @@ class wpdbBackup {
$this->stow("#\n"); $this->stow("#\n");
$this->stow("\n"); $this->stow("\n");
$this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n"); $this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n");
// //
//Table structure //Table structure
// Comment in SQL-file // Comment in SQL-file
@ -448,19 +448,19 @@ class wpdbBackup {
$this->stow("# Table structure of table " . $this->backquote($table) . "\n"); $this->stow("# Table structure of table " . $this->backquote($table) . "\n");
$this->stow("#\n"); $this->stow("#\n");
$this->stow("\n"); $this->stow("\n");
$create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N); $create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N);
if (FALSE === $create_table) { if (FALSE === $create_table) {
$this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table)); $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table));
$this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n"); $this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n");
} }
$this->stow($create_table[0][1] . ' ;'); $this->stow($create_table[0][1] . ' ;');
if (FALSE === $table_structure) { if (FALSE === $table_structure) {
$this->backup_error(sprintf(__("Error getting table structure of %s"), $table)); $this->backup_error(sprintf(__("Error getting table structure of %s"), $table));
$this->stow("#\n# Error getting table structure of $table!\n#\n"); $this->stow("#\n# Error getting table structure of $table!\n#\n");
} }
// //
// Comment in SQL-file // Comment in SQL-file
$this->stow("\n\n"); $this->stow("\n\n");
@ -468,7 +468,7 @@ class wpdbBackup {
$this->stow('# Data contents of table ' . $this->backquote($table) . "\n"); $this->stow('# Data contents of table ' . $this->backquote($table) . "\n");
$this->stow("#\n"); $this->stow("#\n");
} }
if(($segment == 'none') || ($segment >= 0)) { if(($segment == 'none') || ($segment >= 0)) {
$ints = array(); $ints = array();
foreach ($table_structure as $struct) { foreach ($table_structure as $struct) {
@ -481,10 +481,10 @@ class wpdbBackup {
$ints[strtolower($struct->Field)] = "1"; $ints[strtolower($struct->Field)] = "1";
} }
} }
// Batch by $row_inc // Batch by $row_inc
if($segment == 'none') { if($segment == 'none') {
$row_start = 0; $row_start = 0;
$row_inc = ROWS_PER_SEGMENT; $row_inc = ROWS_PER_SEGMENT;
@ -492,8 +492,8 @@ class wpdbBackup {
$row_start = $segment * ROWS_PER_SEGMENT; $row_start = $segment * ROWS_PER_SEGMENT;
$row_inc = ROWS_PER_SEGMENT; $row_inc = ROWS_PER_SEGMENT;
} }
do { do {
if ( !ini_get('safe_mode')) @set_time_limit(15*60); if ( !ini_get('safe_mode')) @set_time_limit(15*60);
$table_data = $wpdb->get_results("SELECT * FROM $table LIMIT {$row_start}, {$row_inc}", ARRAY_A); $table_data = $wpdb->get_results("SELECT * FROM $table LIMIT {$row_start}, {$row_inc}", ARRAY_A);
@ -503,8 +503,8 @@ class wpdbBackup {
fwrite($fp, "#\n# Error getting table contents fom $table!\n#\n"); fwrite($fp, "#\n# Error getting table contents fom $table!\n#\n");
} }
*/ */
$entries = 'INSERT INTO ' . $this->backquote($table) . ' VALUES ('; $entries = 'INSERT INTO ' . $this->backquote($table) . ' VALUES (';
// \x08\\x09, not required // \x08\\x09, not required
$search = array("\x00", "\x0a", "\x0d", "\x1a"); $search = array("\x00", "\x0a", "\x0d", "\x1a");
$replace = array('\0', '\n', '\r', '\Z'); $replace = array('\0', '\n', '\r', '\Z');
@ -524,8 +524,8 @@ class wpdbBackup {
} }
} while((count($table_data) > 0) and ($segment=='none')); } while((count($table_data) > 0) and ($segment=='none'));
} }
if(($segment == 'none') || ($segment < 0)) { if(($segment == 'none') || ($segment < 0)) {
// Create footer/closing comment in SQL-file // Create footer/closing comment in SQL-file
$this->stow("\n"); $this->stow("\n");
@ -534,9 +534,9 @@ class wpdbBackup {
$this->stow("# --------------------------------------------------------\n"); $this->stow("# --------------------------------------------------------\n");
$this->stow("\n"); $this->stow("\n");
} }
} // end backup_table() } // end backup_table()
function return_bytes($val) { function return_bytes($val) {
$val = trim($val); $val = trim($val);
$last = strtolower($val{strlen($val)-1}); $last = strtolower($val{strlen($val)-1});
@ -549,20 +549,20 @@ class wpdbBackup {
case 'k': case 'k':
$val *= 1024; $val *= 1024;
} }
return $val; return $val;
} }
//////////////////////////// ////////////////////////////
function db_backup($core_tables, $other_tables) { function db_backup($core_tables, $other_tables) {
global $table_prefix, $wpdb; global $table_prefix, $wpdb;
$datum = date("Ymd_B"); $datum = date("Ymd_B");
$wp_backup_filename = DB_NAME . "_$table_prefix$datum.sql"; $wp_backup_filename = DB_NAME . "_$table_prefix$datum.sql";
if ($this->gzip()) { if ($this->gzip()) {
$wp_backup_filename .= '.gz'; $wp_backup_filename .= '.gz';
} }
if (is_writable(ABSPATH . $this->backup_dir)) { if (is_writable(ABSPATH . $this->backup_dir)) {
$this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename); $this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename);
if(!$this->fp) { if(!$this->fp) {
@ -573,7 +573,7 @@ class wpdbBackup {
$this->backup_error(__('The backup directory is not writeable!')); $this->backup_error(__('The backup directory is not writeable!'));
return false; return false;
} }
//Begin new backup of MySql //Begin new backup of MySql
$this->stow("# WordPress MySQL database backup\n"); $this->stow("# WordPress MySQL database backup\n");
$this->stow("#\n"); $this->stow("#\n");
@ -581,12 +581,12 @@ class wpdbBackup {
$this->stow("# Hostname: " . DB_HOST . "\n"); $this->stow("# Hostname: " . DB_HOST . "\n");
$this->stow("# Database: " . $this->backquote(DB_NAME) . "\n"); $this->stow("# Database: " . $this->backquote(DB_NAME) . "\n");
$this->stow("# --------------------------------------------------------\n"); $this->stow("# --------------------------------------------------------\n");
if ( (is_array($other_tables)) && (count($other_tables) > 0) ) if ( (is_array($other_tables)) && (count($other_tables) > 0) )
$tables = array_merge($core_tables, $other_tables); $tables = array_merge($core_tables, $other_tables);
else else
$tables = $core_tables; $tables = $core_tables;
foreach ($tables as $table) { foreach ($tables as $table) {
// Increase script execution time-limit to 15 min for every table. // Increase script execution time-limit to 15 min for every table.
if ( !ini_get('safe_mode')) @set_time_limit(15*60); if ( !ini_get('safe_mode')) @set_time_limit(15*60);
@ -596,21 +596,21 @@ class wpdbBackup {
$this->stow("# --------------------------------------------------------\n"); $this->stow("# --------------------------------------------------------\n");
$this->backup_table($table); $this->backup_table($table);
} }
$this->close($this->fp); $this->close($this->fp);
if (count($this->backup_errors)) { if (count($this->backup_errors)) {
return false; return false;
} else { } else {
return $wp_backup_filename; return $wp_backup_filename;
} }
} //wp_db_backup } //wp_db_backup
/////////////////////////// ///////////////////////////
function deliver_backup ($filename = '', $delivery = 'http', $recipient = '') { function deliver_backup ($filename = '', $delivery = 'http', $recipient = '') {
if ('' == $filename) { return FALSE; } if ('' == $filename) { return FALSE; }
$diskfile = ABSPATH . $this->backup_dir . $filename; $diskfile = ABSPATH . $this->backup_dir . $filename;
if ('http' == $delivery) { if ('http' == $delivery) {
if (! file_exists($diskfile)) { if (! file_exists($diskfile)) {
@ -640,7 +640,7 @@ class wpdbBackup {
$headers = "MIME-Version: 1.0\n"; $headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
$headers .= 'From: ' . get_settings('admin_email') . "\n"; $headers .= 'From: ' . get_settings('admin_email') . "\n";
$message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024));
// Add a multipart boundary above the plain message // Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n" . $message = "This is a multi-part message in MIME format.\n\n" .
@ -648,7 +648,7 @@ class wpdbBackup {
"Content-Type: text/plain; charset=\"utf-8\"\n" . "Content-Type: text/plain; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . "Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n"; $message . "\n\n";
// Add file attachment to the message // Add file attachment to the message
$message .= "--{$boundary}\n" . $message .= "--{$boundary}\n" .
"Content-Type: application/octet-stream;\n" . "Content-Type: application/octet-stream;\n" .
@ -658,24 +658,24 @@ class wpdbBackup {
"Content-Transfer-Encoding: base64\n\n" . "Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" . $data . "\n\n" .
"--{$boundary}--\n"; "--{$boundary}--\n";
if (function_exists('wp_mail')) { if (function_exists('wp_mail')) {
wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers);
} else { } else {
mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers);
} }
unlink($diskfile); unlink($diskfile);
} }
return; return;
} }
//////////////////////////// ////////////////////////////
function backup_menu() { function backup_menu() {
global $table_prefix, $wpdb; global $table_prefix, $wpdb;
$feedback = ''; $feedback = '';
$WHOOPS = FALSE; $WHOOPS = FALSE;
// did we just do a backup? If so, let's report the status // did we just do a backup? If so, let's report the status
if ( $this->backup_complete ) { if ( $this->backup_complete ) {
$feedback = '<div class="updated"><p>' . __('Backup Successful') . '!'; $feedback = '<div class="updated"><p>' . __('Backup Successful') . '!';
@ -698,7 +698,7 @@ class wpdbBackup {
} }
$feedback .= '</p></div>'; $feedback .= '</p></div>';
} }
if (count($this->backup_errors)) { if (count($this->backup_errors)) {
$feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>"; $feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>";
foreach($this->backup_errors as $error) { foreach($this->backup_errors as $error) {
@ -706,7 +706,7 @@ class wpdbBackup {
} }
$feedback .= "</pre></div>"; $feedback .= "</pre></div>";
} }
// did we just save options for wp-cron? // did we just save options for wp-cron?
if ( (function_exists('wp_cron_init')) && isset($_POST['wp_cron_backup_options']) ) { if ( (function_exists('wp_cron_init')) && isset($_POST['wp_cron_backup_options']) ) {
update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE); update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE);
@ -716,23 +716,23 @@ class wpdbBackup {
} }
$feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>'; $feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>';
} }
// Simple table name storage // Simple table name storage
$wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta'); $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta');
// Apply WP DB prefix to table names // Apply WP DB prefix to table names
$wp_table_names = array_map(create_function('$a', 'global $table_prefix;return "{$table_prefix}{$a}";'), $wp_table_names); $wp_table_names = array_map(create_function('$a', 'global $table_prefix;return "{$table_prefix}{$a}";'), $wp_table_names);
$other_tables = array(); $other_tables = array();
$also_backup = array(); $also_backup = array();
// Get complete db table list // Get complete db table list
$all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N); $all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
$all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables); $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
// Get list of WP tables that actually exist in this DB (for 1.6 compat!) // Get list of WP tables that actually exist in this DB (for 1.6 compat!)
$wp_backup_default_tables = array_intersect($all_tables, $wp_table_names); $wp_backup_default_tables = array_intersect($all_tables, $wp_table_names);
// Get list of non-WP tables // Get list of non-WP tables
$other_tables = array_diff($all_tables, $wp_backup_default_tables); $other_tables = array_diff($all_tables, $wp_backup_default_tables);
if ('' != $feedback) { if ('' != $feedback) {
echo $feedback; echo $feedback;
} }
@ -749,7 +749,7 @@ class wpdbBackup {
$WHOOPS = TRUE; $WHOOPS = TRUE;
} }
} }
if ( !is_writable( ABSPATH . $this->backup_dir) ) { if ( !is_writable( ABSPATH . $this->backup_dir) ) {
echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>"; echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>";
} }
@ -781,21 +781,21 @@ class wpdbBackup {
echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>'; echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>';
echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> '; echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> ';
echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />'; echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />';
// Check DB dize. // Check DB dize.
$table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME)); $table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME));
$core_size = $db_size = 0; $core_size = $db_size = 0;
foreach($table_status as $table) { foreach($table_status as $table) {
$table_size = $table->Data_length - $table->Data_free; $table_size = $table->Data_length - $table->Data_free;
if(in_array($table->Name, $wp_backup_default_tables)) { if(in_array($table->Name, $wp_backup_default_tables)) {
$core_size += $table_size; $core_size += $table_size;
} }
$db_size += $table_size; $db_size += $table_size;
} }
$mem_limit = ini_get('memory_limit'); $mem_limit = ini_get('memory_limit');
$mem_limit = $this->return_bytes($mem_limit); $mem_limit = $this->return_bytes($mem_limit);
$mem_limit = ($mem_limit == 0) ? 8*1024*1024 : $mem_limit - 2000000; $mem_limit = ($mem_limit == 0) ? 8*1024*1024 : $mem_limit - 2000000;
if (! $WHOOPS) { if (! $WHOOPS) {
echo '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>'; echo '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>';
echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>'; echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>';
@ -804,7 +804,7 @@ class wpdbBackup {
} }
echo '</fieldset>'; echo '</fieldset>';
echo '</form>'; echo '</form>';
// this stuff only displays if wp_cron is installed // this stuff only displays if wp_cron is installed
if (function_exists('wp_cron_init')) { if (function_exists('wp_cron_init')) {
echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>'; echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>';
@ -850,20 +850,20 @@ class wpdbBackup {
echo '</fieldset>'; echo '</fieldset>';
} }
// end of wp_cron section // end of wp_cron section
echo '</div>'; echo '</div>';
}// end wp_backup_menu() }// end wp_backup_menu()
///////////////////////////// /////////////////////////////
function wp_cron_daily() { function wp_cron_daily() {
$schedule = intval(get_option('wp_cron_backup_schedule')); $schedule = intval(get_option('wp_cron_backup_schedule'));
if (0 == $schedule) { if (0 == $schedule) {
// Scheduled backup is disabled // Scheduled backup is disabled
return; return;
} }
global $table_prefix, $wpdb; global $table_prefix, $wpdb;
$wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta'); $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta');
@ -872,14 +872,14 @@ class wpdbBackup {
$all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables); $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
$core_tables = array_intersect($all_tables, $wp_table_names); $core_tables = array_intersect($all_tables, $wp_table_names);
$other_tables = get_option('wp_cron_backup_tables'); $other_tables = get_option('wp_cron_backup_tables');
$recipient = get_option('wp_cron_backup_recipient'); $recipient = get_option('wp_cron_backup_recipient');
$backup_file = $this->db_backup($core_tables, $other_tables); $backup_file = $this->db_backup($core_tables, $other_tables);
if (FALSE !== $backup_file) { if (FALSE !== $backup_file) {
$this->deliver_backup ($backup_file, 'smtp', $recipient); $this->deliver_backup ($backup_file, 'smtp', $recipient);
} }
return; return;
} // wp_cron_db_backup } // wp_cron_db_backup
} }

View File

@ -103,7 +103,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
document.onkeypress = function esc(e) { document.onkeypress = function esc(e) {
if(typeof(e) == "undefined") { e=event; } if(typeof(e) == "undefined") { e=event; }
if (e.keyCode == 27) { self.close(); } if (e.keyCode == 27) { self.close(); }
} }

View File

@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title> <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please --> <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@ -15,7 +15,7 @@
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" /> <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?> <?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?> <?php //comments_popup_script(); // off by default ?>

View File

@ -5,15 +5,15 @@ get_header();
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<h2>','</h2>'); ?> <?php the_date('','<h2>','</h2>'); ?>
<div class="post" id="post-<?php the_ID(); ?>"> <div class="post" id="post-<?php the_ID(); ?>">
<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div> <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
<div class="storycontent"> <div class="storycontent">
<?php the_content(__('(more...)')); ?> <?php the_content(__('(more...)')); ?>
</div> </div>
<div class="feedback"> <div class="feedback">
<?php wp_link_pages(); ?> <?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?> <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>

View File

@ -11,7 +11,7 @@
</ul> </ul>
</li> </li>
<li id="search"> <li id="search">
<label for="s"><?php _e('Search:'); ?></label> <label for="s"><?php _e('Search:'); ?></label>
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div> <div>
<input type="text" name="s" id="s" size="15" /><br /> <input type="text" name="s" id="s" size="15" /><br />

View File

@ -5,21 +5,21 @@
<?php if (have_posts()) : ?> <?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?> <?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2> <h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?> <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2> <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2> <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2> <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is a search */ } elseif (is_search()) { ?> <?php /* If this is a search */ } elseif (is_search()) { ?>
<h2 class="pagetitle">Search Results</h2> <h2 class="pagetitle">Search Results</h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?> <?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2> <h2 class="pagetitle">Author Archive</h2>
@ -38,29 +38,29 @@
<div class="post"> <div class="post">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3> <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<small><?php the_time('l, F jS, Y') ?></small> <small><?php the_time('l, F jS, Y') ?></small>
<div class="entry"> <div class="entry">
<?php the_content() ?> <?php the_content() ?>
</div> </div>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
<div class="navigation"> <div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
</div> </div>
<?php else : ?> <?php else : ?>
<h2 class="center">Not Found</h2> <h2 class="center">Not Found</h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php get_sidebar(); ?> <?php get_sidebar(); ?>

View File

@ -20,6 +20,6 @@ Template Name: Archives
<?php wp_list_cats(); ?> <?php wp_list_cats(); ?>
</ul> </ul>
</div> </div>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@ -1,9 +1,9 @@
<?php get_header(); ?> <?php get_header(); ?>
<div id="content" class="widecolumn"> <div id="content" class="widecolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="navigation"> <div class="navigation">
<div class="alignleft">&nbsp;</div> <div class="alignleft">&nbsp;</div>
<div class="alignright">&nbsp;</div> <div class="alignright">&nbsp;</div>
@ -16,9 +16,9 @@
<p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p> <p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
<p class="postmetadata alt"> <p class="postmetadata alt">
<small> <small>
This entry was posted This entry was posted
@ -29,39 +29,39 @@
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>. and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?> // Both Comments and Pings are open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site. You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Only Pings are Open ?> // Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site. Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Comments are open, Pings are not ?> // Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed. You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Neither Comments, nor Pings are open ?> // Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed. Both comments and pings are currently closed.
<?php } edit_post_link('Edit this entry.','',''); ?> <?php } edit_post_link('Edit this entry.','',''); ?>
</small> </small>
</p> </p>
</div> </div>
</div> </div>
<?php comments_template(); ?> <?php comments_template(); ?>
<?php endwhile; else: ?> <?php endwhile; else: ?>
<p>Sorry, no attachments matched your criteria.</p> <p>Sorry, no attachments matched your criteria.</p>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@ -103,7 +103,7 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?> <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
document.onkeypress = function esc(e) { document.onkeypress = function esc(e) {
if(typeof(e) == "undefined") { e=event; } if(typeof(e) == "undefined") { e=event; }
if (e.keyCode == 27) { self.close(); } if (e.keyCode == 27) { self.close(); }
} }

View File

@ -5,9 +5,9 @@
if (!empty($post->post_password)) { // if there's a password if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?> ?>
<p class="nocomments">This post is password protected. Enter the password to view comments.<p> <p class="nocomments">This post is password protected. Enter the password to view comments.<p>
<?php <?php
return; return;
} }
@ -39,7 +39,7 @@
</li> </li>
<?php /* Changes every other comment to a different class */ <?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = ''; if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt'; else $oddcomment = 'alt';
?> ?>
@ -52,11 +52,11 @@
<?php if ('open' == $post->comment_status) : ?> <?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. --> <!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?> <?php else : // comments are closed ?>
<!-- If comments are closed. --> <!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p> <p class="nocomments">Comments are closed.</p>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -57,7 +57,7 @@ function kubrick_header_color_string() {
$color = kubrick_header_color(); $color = kubrick_header_color();
if ( false === $color ) if ( false === $color )
return 'white'; return 'white';
return $color; return $color;
} }
@ -100,21 +100,21 @@ function kubrick_add_theme_page() {
} }
} }
} else { } else {
if ( isset($_REQUEST['headerimage']) ) { if ( isset($_REQUEST['headerimage']) ) {
if ( '' == $_REQUEST['headerimage'] ) if ( '' == $_REQUEST['headerimage'] )
delete_option('kubrick_header_image'); delete_option('kubrick_header_image');
else else
update_option('kubrick_header_image', $_REQUEST['headerimage']); update_option('kubrick_header_image', $_REQUEST['headerimage']);
} }
if ( isset($_REQUEST['fontcolor']) ) { if ( isset($_REQUEST['fontcolor']) ) {
if ( '' == $_REQUEST['fontcolor'] ) if ( '' == $_REQUEST['fontcolor'] )
delete_option('kubrick_header_color'); delete_option('kubrick_header_color');
else else
update_option('kubrick_header_color', $_REQUEST['fontcolor']); update_option('kubrick_header_color', $_REQUEST['fontcolor']);
} }
if ( isset($_REQUEST['fontdisplay']) ) { if ( isset($_REQUEST['fontdisplay']) ) {
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] ) if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
delete_option('kubrick_header_display'); delete_option('kubrick_header_display');
@ -268,7 +268,7 @@ function kubrick_theme_page_head() {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-size: 1.2em; font-size: 1.2em;
text-align: center; text-align: center;
} }
#kubrick-header #header { #kubrick-header #header {
text-decoration: none; text-decoration: none;
color: <?php echo kubrick_header_color_string(); ?>; color: <?php echo kubrick_header_color_string(); ?>;

View File

@ -16,8 +16,8 @@
/* To accomodate differing install paths of WordPress, images are referred only here, /* To accomodate differing install paths of WordPress, images are referred only here,
and not in the wp-layout.css file. If you prefer to use only CSS for colors and what and not in the wp-layout.css file. If you prefer to use only CSS for colors and what
not, then go right ahead and delete the following lines, and the image files. */ not, then go right ahead and delete the following lines, and the image files. */
body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); } body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }
<?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?> <?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
<?php } else { // No sidebar ?> <?php } else { // No sidebar ?>
@ -28,7 +28,7 @@
/* Because the template is slightly different, size-wise, with images, this needs to be set here /* Because the template is slightly different, size-wise, with images, this needs to be set here
If you don't want to use the template's images, you can also delete the following two lines. */ If you don't want to use the template's images, you can also delete the following two lines. */
#header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; } #header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; }
#headerimg { margin: 7px 9px 0; height: 192px; width: 740px; } #headerimg { margin: 7px 9px 0; height: 192px; width: 740px; }

View File

@ -3,27 +3,27 @@
<div id="content" class="narrowcolumn"> <div id="content" class="narrowcolumn">
<?php if (have_posts()) : ?> <?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?> <?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>"> <div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry"> <div class="entry">
<?php the_content('Read the rest of this entry &raquo;'); ?> <?php the_content('Read the rest of this entry &raquo;'); ?>
</div> </div>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
<div class="navigation"> <div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
</div> </div>
<?php else : ?> <?php else : ?>
<h2 class="center">Not Found</h2> <h2 class="center">Not Found</h2>

View File

@ -13,6 +13,6 @@ Template Name: Links
<?php get_links_list(); ?> <?php get_links_list(); ?>
</ul> </ul>
</div> </div>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@ -7,9 +7,9 @@
<h2><?php the_title(); ?></h2> <h2><?php the_title(); ?></h2>
<div class="entrytext"> <div class="entrytext">
<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?> <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
</div> </div>
</div> </div>
<?php endwhile; endif; ?> <?php endwhile; endif; ?>

View File

@ -5,7 +5,7 @@
<?php if (have_posts()) : ?> <?php if (have_posts()) : ?>
<h2 class="pagetitle">Search Results</h2> <h2 class="pagetitle">Search Results</h2>
<div class="navigation"> <div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
@ -13,28 +13,28 @@
<?php while (have_posts()) : the_post(); ?> <?php while (have_posts()) : the_post(); ?>
<div class="post"> <div class="post">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3> <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<small><?php the_time('l, F jS, Y') ?></small> <small><?php the_time('l, F jS, Y') ?></small>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
<div class="navigation"> <div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
</div> </div>
<?php else : ?> <?php else : ?>
<h2 class="center">No posts found. Try a different search?</h2> <h2 class="center">No posts found. Try a different search?</h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php get_sidebar(); ?> <?php get_sidebar(); ?>

View File

@ -1,6 +1,6 @@
<div id="sidebar"> <div id="sidebar">
<ul> <ul>
<li> <li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li> </li>
@ -15,11 +15,11 @@
<?php /* If this is a 404 page */ if (is_404()) { ?> <?php /* If this is a 404 page */ if (is_404()) { ?>
<?php /* If this is a category archive */ } elseif (is_category()) { ?> <?php /* If this is a category archive */ } elseif (is_category()) { ?>
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p> <p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?> <?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the day <?php the_time('l, F jS, Y'); ?>.</p> for the day <?php the_time('l, F jS, Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <?php the_time('F, Y'); ?>.</p> for <?php the_time('F, Y'); ?>.</p>
@ -27,7 +27,7 @@
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for the year <?php the_time('Y'); ?>.</p> for the year <?php the_time('Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?> <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives <p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
@ -52,9 +52,9 @@
</ul> </ul>
</li> </li>
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
<?php get_links_list(); ?> <?php get_links_list(); ?>
<li><h2>Meta</h2> <li><h2>Meta</h2>
<ul> <ul>
<?php wp_register(); ?> <?php wp_register(); ?>
@ -66,7 +66,7 @@
</ul> </ul>
</li> </li>
<?php } ?> <?php } ?>
</ul> </ul>
</div> </div>

View File

@ -1,22 +1,22 @@
<?php get_header(); ?> <?php get_header(); ?>
<div id="content" class="widecolumn"> <div id="content" class="widecolumn">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="navigation"> <div class="navigation">
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div> <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
<div class="alignright"><?php next_post_link('%link &raquo;') ?></div> <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
</div> </div>
<div class="post" id="post-<?php the_ID(); ?>"> <div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2> <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="entrytext"> <div class="entrytext">
<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
<p class="postmetadata alt"> <p class="postmetadata alt">
<small> <small>
This entry was posted This entry was posted
@ -27,39 +27,39 @@
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>. and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?> // Both Comments and Pings are open ?>
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site. You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Only Pings are Open ?> // Only Pings are Open ?>
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site. Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Comments are open, Pings are not ?> // Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed. You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
// Neither Comments, nor Pings are open ?> // Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed. Both comments and pings are currently closed.
<?php } edit_post_link('Edit this entry.','',''); ?> <?php } edit_post_link('Edit this entry.','',''); ?>
</small> </small>
</p> </p>
</div> </div>
</div> </div>
<?php comments_template(); ?> <?php comments_template(); ?>
<?php endwhile; else: ?> <?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p> <p>Sorry, no posts matched your criteria.</p>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@ -14,7 +14,7 @@ Author URI: http://binarybonsai.com/
The CSS, XHTML and design is released under GPL: The CSS, XHTML and design is released under GPL:
http://www.opensource.org/licenses/gpl-license.php http://www.opensource.org/licenses/gpl-license.php
*** REGARDING IMAGES *** *** REGARDING IMAGES ***
All CSS that involves the use of images, can be found in the 'index.php' file. All CSS that involves the use of images, can be found in the 'index.php' file.
@ -59,7 +59,7 @@ body {
.widecolumn { .widecolumn {
line-height: 1.6em; line-height: 1.6em;
} }
.narrowcolumn .postmetadata { .narrowcolumn .postmetadata {
text-align: center; text-align: center;
} }
@ -132,7 +132,7 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
.commentlist li, #commentform input, #commentform textarea { .commentlist li, #commentform input, #commentform textarea {
font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif; font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
} }
.commentlist li { .commentlist li {
font-weight: bold; font-weight: bold;
} }
@ -164,7 +164,7 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike { small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
color: #777; color: #777;
} }
code { code {
font: 1.1em 'Courier New', Courier, Fixed; font: 1.1em 'Courier New', Courier, Fixed;
} }
@ -184,7 +184,7 @@ a:hover {
color: #147; color: #147;
text-decoration: underline; text-decoration: underline;
} }
#wp-calendar #prev a { #wp-calendar #prev a {
font-size: 9pt; font-size: 9pt;
} }
@ -219,7 +219,7 @@ body {
width: 760px; width: 760px;
border: 1px solid #959596; border: 1px solid #959596;
} }
#header { #header {
padding: 0; padding: 0;
margin: 0 auto; margin: 0 auto;
@ -246,7 +246,7 @@ body {
margin: 5px 0 0 150px; margin: 5px 0 0 150px;
width: 450px; width: 450px;
} }
.post { .post {
margin: 0 0 40px; margin: 0 0 40px;
text-align: justify; text-align: justify;
@ -339,13 +339,13 @@ p img {
thought?!) align the image to the right. And using 'class="centered', thought?!) align the image to the right. And using 'class="centered',
will of course center the image. This is much better than using will of course center the image. This is much better than using
align="center", being much more futureproof (and valid) */ align="center", being much more futureproof (and valid) */
img.centered { img.centered {
display: block; display: block;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
img.alignright { img.alignright {
padding: 4px; padding: 4px;
margin: 0 0 2px 7px; margin: 0 0 2px 7px;
@ -361,7 +361,7 @@ img.alignleft {
.alignright { .alignright {
float: right; float: right;
} }
.alignleft { .alignleft {
float: left float: left
} }
@ -405,7 +405,7 @@ html>body .entry li {
list-style-type: none; list-style-type: none;
list-style-image: none; list-style-image: none;
} }
#sidebar ul, #sidebar ul ol { #sidebar ul, #sidebar ul ol {
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@ -103,12 +103,12 @@ class WP_Object_Cache {
if ( ! $this->acquire_lock() ) if ( ! $this->acquire_lock() )
return false; return false;
$this->rm_cache_dir(); $this->rm_cache_dir();
$this->cache = array (); $this->cache = array ();
$this->dirty_objects = array (); $this->dirty_objects = array ();
$this->non_existant_objects = array (); $this->non_existant_objects = array ();
$this->release_lock(); $this->release_lock();
return true; return true;
@ -248,7 +248,7 @@ class WP_Object_Cache {
while (($file = @ readdir($dh)) !== false) { while (($file = @ readdir($dh)) !== false) {
if ($file == '.' or $file == '..') if ($file == '.' or $file == '..')
continue; continue;
if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file)) if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
$stack[] = $dir . DIRECTORY_SEPARATOR . $file; $stack[] = $dir . DIRECTORY_SEPARATOR . $file;
else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file)) else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
@ -354,7 +354,7 @@ class WP_Object_Cache {
if (@ copy($temp_file, $cache_file)) if (@ copy($temp_file, $cache_file))
@ unlink($temp_file); @ unlink($temp_file);
else else
$errors++; $errors++;
} }
@ chmod($cache_file, $file_perms); @ chmod($cache_file, $file_perms);
} }
@ -363,7 +363,7 @@ class WP_Object_Cache {
$this->dirty_objects = array(); $this->dirty_objects = array();
$this->release_lock(); $this->release_lock();
if ( $errors ) if ( $errors )
return false; return false;

View File

@ -34,15 +34,15 @@ class WP_Roles {
$this->role_names[$role] = $display_name; $this->role_names[$role] = $display_name;
return $this->role_objects[$role]; return $this->role_objects[$role];
} }
function remove_role($role) { function remove_role($role) {
if ( ! isset($this->role_objects[$role]) ) if ( ! isset($this->role_objects[$role]) )
return; return;
unset($this->role_objects[$role]); unset($this->role_objects[$role]);
unset($this->role_names[$role]); unset($this->role_names[$role]);
unset($this->roles[$role]); unset($this->roles[$role]);
update_option($this->role_key, $this->roles); update_option($this->role_key, $this->roles);
} }
@ -70,7 +70,7 @@ class WP_Roles {
function is_role($role) function is_role($role)
{ {
return isset($this->role_names[$role]); return isset($this->role_names[$role]);
} }
} }
class WP_Role { class WP_Role {
@ -150,10 +150,10 @@ class WP_User {
$this->caps = array(); $this->caps = array();
$this->get_role_caps(); $this->get_role_caps();
} }
function get_role_caps() { function get_role_caps() {
global $wp_roles; global $wp_roles;
if ( ! isset($wp_roles) ) if ( ! isset($wp_roles) )
$wp_roles = new WP_Roles(); $wp_roles = new WP_Roles();
@ -169,14 +169,14 @@ class WP_User {
} }
$this->allcaps = array_merge($this->allcaps, $this->caps); $this->allcaps = array_merge($this->allcaps, $this->caps);
} }
function add_role($role) { function add_role($role) {
$this->caps[$role] = true; $this->caps[$role] = true;
update_usermeta($this->id, $this->cap_key, $this->caps); update_usermeta($this->id, $this->cap_key, $this->caps);
$this->get_role_caps(); $this->get_role_caps();
$this->update_user_level_from_caps(); $this->update_user_level_from_caps();
} }
function remove_role($role) { function remove_role($role) {
if ( empty($this->roles[$role]) || (count($this->roles) <= 1) ) if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
return; return;
@ -184,7 +184,7 @@ class WP_User {
update_usermeta($this->id, $this->cap_key, $this->caps); update_usermeta($this->id, $this->cap_key, $this->caps);
$this->get_role_caps(); $this->get_role_caps();
} }
function set_role($role) { function set_role($role) {
foreach($this->roles as $oldrole) foreach($this->roles as $oldrole)
unset($this->caps[$oldrole]); unset($this->caps[$oldrole]);
@ -203,13 +203,13 @@ class WP_User {
return $max; return $max;
} }
} }
function update_user_level_from_caps() { function update_user_level_from_caps() {
global $table_prefix; global $table_prefix;
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); $this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
update_usermeta($this->id, $table_prefix.'user_level', $this->user_level); update_usermeta($this->id, $table_prefix.'user_level', $this->user_level);
} }
function add_cap($cap, $grant = true) { function add_cap($cap, $grant = true) {
$this->caps[$cap] = $grant; $this->caps[$cap] = $grant;
update_usermeta($this->id, $this->cap_key, $this->caps); update_usermeta($this->id, $this->cap_key, $this->caps);
@ -220,13 +220,13 @@ class WP_User {
unset($this->caps[$cap]); unset($this->caps[$cap]);
update_usermeta($this->id, $this->cap_key, $this->caps); update_usermeta($this->id, $this->cap_key, $this->caps);
} }
//has_cap(capability_or_role_name) or //has_cap(capability_or_role_name) or
//has_cap('edit_post', post_id) //has_cap('edit_post', post_id)
function has_cap($cap) { function has_cap($cap) {
if ( is_numeric($cap) ) if ( is_numeric($cap) )
$cap = $this->translate_level_to_cap($cap); $cap = $this->translate_level_to_cap($cap);
$args = array_slice(func_get_args(), 1); $args = array_slice(func_get_args(), 1);
$args = array_merge(array($cap, $this->id), $args); $args = array_merge(array($cap, $this->id), $args);
$caps = call_user_func_array('map_meta_cap', $args); $caps = call_user_func_array('map_meta_cap', $args);
@ -345,12 +345,12 @@ function map_meta_cap($cap, $user_id) {
break; break;
case 'read_post': case 'read_post':
$post = get_post($args[0]); $post = get_post($args[0]);
if ( 'private' != $post->post_status ) { if ( 'private' != $post->post_status ) {
$caps[] = 'read'; $caps[] = 'read';
break; break;
} }
$author_data = get_userdata($user_id); $author_data = get_userdata($user_id);
$post_author_data = get_userdata($post->post_author); $post_author_data = get_userdata($post->post_author);
if ($user_id == $post_author_data->ID) if ($user_id == $post_author_data->ID)

View File

@ -39,7 +39,7 @@ if ( !in_array('Snoopy', get_declared_classes() ) ) :
class Snoopy class Snoopy
{ {
/**** Public variables ****/ /**** Public variables ****/
/* user definable vars */ /* user definable vars */
var $host = "www.php.net"; // host name we are connecting to var $host = "www.php.net"; // host name we are connecting to
@ -48,7 +48,7 @@ class Snoopy
var $proxy_port = ""; // proxy port to use var $proxy_port = ""; // proxy port to use
var $proxy_user = ""; // proxy user to use var $proxy_user = ""; // proxy user to use
var $proxy_pass = ""; // proxy password to use var $proxy_pass = ""; // proxy password to use
var $agent = "Snoopy v1.2.3"; // agent we masquerade as var $agent = "Snoopy v1.2.3"; // agent we masquerade as
var $referer = ""; // referer info to pass var $referer = ""; // referer info to pass
var $cookies = array(); // array of cookies to pass var $cookies = array(); // array of cookies to pass
@ -66,15 +66,15 @@ class Snoopy
var $passcookies = true; // pass set cookies back through redirects var $passcookies = true; // pass set cookies back through redirects
// NOTE: this currently does not respect // NOTE: this currently does not respect
// dates, domains or paths. // dates, domains or paths.
var $user = ""; // user for http authentication var $user = ""; // user for http authentication
var $pass = ""; // password for http authentication var $pass = ""; // password for http authentication
// http accept types // http accept types
var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
var $results = ""; // where the content is put var $results = ""; // where the content is put
var $error = ""; // error messages sent here var $error = ""; // error messages sent here
var $response_code = ""; // response code returned from server var $response_code = ""; // response code returned from server
var $headers = array(); // headers returned from server sent here var $headers = array(); // headers returned from server sent here
@ -100,11 +100,11 @@ class Snoopy
// library functions built into php, // library functions built into php,
// as these functions are not stable // as these functions are not stable
// as of this Snoopy release. // as of this Snoopy release.
/**** Private variables ****/ /**** Private variables ****/
var $_maxlinelen = 4096; // max line length (headers) var $_maxlinelen = 4096; // max line length (headers)
var $_httpmethod = "GET"; // default http request method var $_httpmethod = "GET"; // default http request method
var $_httpversion = "HTTP/1.0"; // default http request version var $_httpversion = "HTTP/1.0"; // default http request version
var $_submit_method = "POST"; // default submit method var $_submit_method = "POST"; // default submit method
@ -114,7 +114,7 @@ class Snoopy
var $_redirectdepth = 0; // increments on an http redirect var $_redirectdepth = 0; // increments on an http redirect
var $_frameurls = array(); // frame src urls var $_frameurls = array(); // frame src urls
var $_framedepth = 0; // increments on frame depth var $_framedepth = 0; // increments on frame depth
var $_isproxy = false; // set if using a proxy server var $_isproxy = false; // set if using a proxy server
var $_fp_timeout = 30; // timeout for socket connection var $_fp_timeout = 30; // timeout for socket connection
@ -129,7 +129,7 @@ class Snoopy
function fetch($URI) function fetch($URI)
{ {
//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS); //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
$URI_PARTS = parse_url($URI); $URI_PARTS = parse_url($URI);
if (!empty($URI_PARTS["user"])) if (!empty($URI_PARTS["user"]))
@ -140,7 +140,7 @@ class Snoopy
$URI_PARTS["query"] = ''; $URI_PARTS["query"] = '';
if (empty($URI_PARTS["path"])) if (empty($URI_PARTS["path"]))
$URI_PARTS["path"] = ''; $URI_PARTS["path"] = '';
switch(strtolower($URI_PARTS["scheme"])) switch(strtolower($URI_PARTS["scheme"]))
{ {
case "http": case "http":
@ -160,7 +160,7 @@ class Snoopy
// no proxy, send only the path // no proxy, send only the path
$this->_httprequest($path, $fp, $URI, $this->_httpmethod); $this->_httprequest($path, $fp, $URI, $this->_httpmethod);
} }
$this->_disconnect($fp); $this->_disconnect($fp);
if($this->_redirectaddr) if($this->_redirectaddr)
@ -183,7 +183,7 @@ class Snoopy
{ {
$frameurls = $this->_frameurls; $frameurls = $this->_frameurls;
$this->_frameurls = array(); $this->_frameurls = array();
while(list(,$frameurl) = each($frameurls)) while(list(,$frameurl) = each($frameurls))
{ {
if($this->_framedepth < $this->maxframes) if($this->_framedepth < $this->maxframes)
@ -194,13 +194,13 @@ class Snoopy
else else
break; break;
} }
} }
} }
else else
{ {
return false; return false;
} }
return true; return true;
break; break;
case "https": case "https":
if(!$this->curl_path) if(!$this->curl_path)
@ -254,15 +254,15 @@ class Snoopy
else else
break; break;
} }
} }
return true; return true;
break; break;
default: default:
// not a valid protocol // not a valid protocol
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
return false; return false;
break; break;
} }
return true; return true;
} }
@ -280,9 +280,9 @@ class Snoopy
function submit($URI, $formvars="", $formfiles="") function submit($URI, $formvars="", $formfiles="")
{ {
unset($postdata); unset($postdata);
$postdata = $this->_prepare_post_body($formvars, $formfiles); $postdata = $this->_prepare_post_body($formvars, $formfiles);
$URI_PARTS = parse_url($URI); $URI_PARTS = parse_url($URI);
if (!empty($URI_PARTS["user"])) if (!empty($URI_PARTS["user"]))
$this->user = $URI_PARTS["user"]; $this->user = $URI_PARTS["user"];
@ -312,17 +312,17 @@ class Snoopy
// no proxy, send only the path // no proxy, send only the path
$this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata); $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
} }
$this->_disconnect($fp); $this->_disconnect($fp);
if($this->_redirectaddr) if($this->_redirectaddr)
{ {
/* url was redirected, check if we've hit the max depth */ /* url was redirected, check if we've hit the max depth */
if($this->maxredirs > $this->_redirectdepth) if($this->maxredirs > $this->_redirectdepth)
{ {
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
// only follow redirect if it's on this site, or offsiteok is true // only follow redirect if it's on this site, or offsiteok is true
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
{ {
@ -341,9 +341,9 @@ class Snoopy
{ {
$frameurls = $this->_frameurls; $frameurls = $this->_frameurls;
$this->_frameurls = array(); $this->_frameurls = array();
while(list(,$frameurl) = each($frameurls)) while(list(,$frameurl) = each($frameurls))
{ {
if($this->_framedepth < $this->maxframes) if($this->_framedepth < $this->maxframes)
{ {
$this->fetch($frameurl); $this->fetch($frameurl);
@ -352,14 +352,14 @@ class Snoopy
else else
break; break;
} }
} }
} }
else else
{ {
return false; return false;
} }
return true; return true;
break; break;
case "https": case "https":
if(!$this->curl_path) if(!$this->curl_path)
@ -386,9 +386,9 @@ class Snoopy
{ {
/* url was redirected, check if we've hit the max depth */ /* url was redirected, check if we've hit the max depth */
if($this->maxredirs > $this->_redirectdepth) if($this->maxredirs > $this->_redirectdepth)
{ {
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]); $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
// only follow redirect if it's on this site, or offsiteok is true // only follow redirect if it's on this site, or offsiteok is true
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok) if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
@ -410,7 +410,7 @@ class Snoopy
$this->_frameurls = array(); $this->_frameurls = array();
while(list(,$frameurl) = each($frameurls)) while(list(,$frameurl) = each($frameurls))
{ {
if($this->_framedepth < $this->maxframes) if($this->_framedepth < $this->maxframes)
{ {
$this->fetch($frameurl); $this->fetch($frameurl);
@ -419,16 +419,16 @@ class Snoopy
else else
break; break;
} }
} }
return true; return true;
break; break;
default: default:
// not a valid protocol // not a valid protocol
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n'; $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
return false; return false;
break; break;
} }
return true; return true;
} }
@ -442,7 +442,7 @@ class Snoopy
function fetchlinks($URI) function fetchlinks($URI)
{ {
if ($this->fetch($URI)) if ($this->fetch($URI))
{ {
if($this->lastredirectaddr) if($this->lastredirectaddr)
$URI = $this->lastredirectaddr; $URI = $this->lastredirectaddr;
if(is_array($this->results)) if(is_array($this->results))
@ -470,9 +470,9 @@ class Snoopy
function fetchform($URI) function fetchform($URI)
{ {
if ($this->fetch($URI)) if ($this->fetch($URI))
{ {
if(is_array($this->results)) if(is_array($this->results))
{ {
@ -481,14 +481,14 @@ class Snoopy
} }
else else
$this->results = $this->_stripform($this->results); $this->results = $this->_stripform($this->results);
return true; return true;
} }
else else
return false; return false;
} }
/*======================================================================*\ /*======================================================================*\
Function: fetchtext Function: fetchtext
Purpose: fetch the text from a web page, stripping the links Purpose: fetch the text from a web page, stripping the links
@ -499,7 +499,7 @@ class Snoopy
function fetchtext($URI) function fetchtext($URI)
{ {
if($this->fetch($URI)) if($this->fetch($URI))
{ {
if(is_array($this->results)) if(is_array($this->results))
{ {
for($x=0;$x<count($this->results);$x++) for($x=0;$x<count($this->results);$x++)
@ -523,7 +523,7 @@ class Snoopy
function submitlinks($URI, $formvars="", $formfiles="") function submitlinks($URI, $formvars="", $formfiles="")
{ {
if($this->submit($URI,$formvars, $formfiles)) if($this->submit($URI,$formvars, $formfiles))
{ {
if($this->lastredirectaddr) if($this->lastredirectaddr)
$URI = $this->lastredirectaddr; $URI = $this->lastredirectaddr;
if(is_array($this->results)) if(is_array($this->results))
@ -557,7 +557,7 @@ class Snoopy
function submittext($URI, $formvars = "", $formfiles = "") function submittext($URI, $formvars = "", $formfiles = "")
{ {
if($this->submit($URI,$formvars, $formfiles)) if($this->submit($URI,$formvars, $formfiles))
{ {
if($this->lastredirectaddr) if($this->lastredirectaddr)
$URI = $this->lastredirectaddr; $URI = $this->lastredirectaddr;
if(is_array($this->results)) if(is_array($this->results))
@ -581,7 +581,7 @@ class Snoopy
return false; return false;
} }
/*======================================================================*\ /*======================================================================*\
Function: set_submit_multipart Function: set_submit_multipart
@ -593,7 +593,7 @@ class Snoopy
$this->_submit_type = "multipart/form-data"; $this->_submit_type = "multipart/form-data";
} }
/*======================================================================*\ /*======================================================================*\
Function: set_submit_normal Function: set_submit_normal
Purpose: Set the form submission content type to Purpose: Set the form submission content type to
@ -604,14 +604,14 @@ class Snoopy
$this->_submit_type = "application/x-www-form-urlencoded"; $this->_submit_type = "application/x-www-form-urlencoded";
} }
/*======================================================================*\ /*======================================================================*\
Private functions Private functions
\*======================================================================*/ \*======================================================================*/
/*======================================================================*\ /*======================================================================*\
Function: _striplinks Function: _striplinks
Purpose: strip the hyperlinks from an html document Purpose: strip the hyperlinks from an html document
@ -620,13 +620,13 @@ class Snoopy
\*======================================================================*/ \*======================================================================*/
function _striplinks($document) function _striplinks($document)
{ {
preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href= preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href=
([\"\'])? # find single or double quote ([\"\'])? # find single or double quote
(?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching (?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching
# quote, otherwise match up to next space # quote, otherwise match up to next space
'isx",$document,$links); 'isx",$document,$links);
// catenate the non-empty matches from the conditional subpattern // catenate the non-empty matches from the conditional subpattern
@ -634,14 +634,14 @@ class Snoopy
{ {
if(!empty($val)) if(!empty($val))
$match[] = $val; $match[] = $val;
} }
while(list($key,$val) = each($links[3])) while(list($key,$val) = each($links[3]))
{ {
if(!empty($val)) if(!empty($val))
$match[] = $val; $match[] = $val;
} }
// return the links // return the links
return $match; return $match;
} }
@ -654,18 +654,18 @@ class Snoopy
\*======================================================================*/ \*======================================================================*/
function _stripform($document) function _stripform($document)
{ {
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements); preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);
// catenate the matches // catenate the matches
$match = implode("\r\n",$elements[0]); $match = implode("\r\n",$elements[0]);
// return the links // return the links
return $match; return $match;
} }
/*======================================================================*\ /*======================================================================*\
Function: _striptext Function: _striptext
Purpose: strip the text from an html document Purpose: strip the text from an html document
@ -675,11 +675,11 @@ class Snoopy
function _striptext($document) function _striptext($document)
{ {
// I didn't use preg eval (//e) since that is only available in PHP 4.0. // I didn't use preg eval (//e) since that is only available in PHP 4.0.
// so, list your entities one by one here. I included some of the // so, list your entities one by one here. I included some of the
// more common ones. // more common ones.
$search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript $search = array("'<script[^>]*?>.*?</script>'si", // strip out javascript
"'<[\/\!]*?[^<>]*?>'si", // strip out html tags "'<[\/\!]*?[^<>]*?>'si", // strip out html tags
"'([\r\n])[\s]+'", // strip out white space "'([\r\n])[\s]+'", // strip out white space
@ -728,9 +728,9 @@ class Snoopy
"Ü", "Ü",
"ß", "ß",
); );
$text = preg_replace($search,$replace,$document); $text = preg_replace($search,$replace,$document);
return $text; return $text;
} }
@ -744,7 +744,7 @@ class Snoopy
function _expandlinks($links,$URI) function _expandlinks($links,$URI)
{ {
preg_match("/^[^\?]+/",$URI,$match); preg_match("/^[^\?]+/",$URI,$match);
$match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);
@ -752,21 +752,21 @@ class Snoopy
$match_part = parse_url($match); $match_part = parse_url($match);
$match_root = $match_root =
$match_part["scheme"]."://".$match_part["host"]; $match_part["scheme"]."://".$match_part["host"];
$search = array( "|^http://".preg_quote($this->host)."|i", $search = array( "|^http://".preg_quote($this->host)."|i",
"|^(\/)|i", "|^(\/)|i",
"|^(?!http://)(?!mailto:)|i", "|^(?!http://)(?!mailto:)|i",
"|/\./|", "|/\./|",
"|/[^\/]+/\.\./|" "|/[^\/]+/\.\./|"
); );
$replace = array( "", $replace = array( "",
$match_root."/", $match_root."/",
$match."/", $match."/",
"/", "/",
"/" "/"
); );
$expandedLinks = preg_replace($search,$replace,$links); $expandedLinks = preg_replace($search,$replace,$links);
return $expandedLinks; return $expandedLinks;
@ -779,19 +779,19 @@ class Snoopy
$fp the current open file pointer $fp the current open file pointer
$URI the full URI $URI the full URI
$body body contents to send if any (POST) $body body contents to send if any (POST)
Output: Output:
\*======================================================================*/ \*======================================================================*/
function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
{ {
$cookie_headers = ''; $cookie_headers = '';
if($this->passcookies && $this->_redirectaddr) if($this->passcookies && $this->_redirectaddr)
$this->setcookies(); $this->setcookies();
$URI_PARTS = parse_url($URI); $URI_PARTS = parse_url($URI);
if(empty($url)) if(empty($url))
$url = "/"; $url = "/";
$headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
if(!empty($this->agent)) if(!empty($this->agent))
$headers .= "User-Agent: ".$this->agent."\r\n"; $headers .= "User-Agent: ".$this->agent."\r\n";
if(!empty($this->host) && !isset($this->rawheaders['Host'])) { if(!empty($this->host) && !isset($this->rawheaders['Host'])) {
@ -805,10 +805,10 @@ class Snoopy
if(!empty($this->referer)) if(!empty($this->referer))
$headers .= "Referer: ".$this->referer."\r\n"; $headers .= "Referer: ".$this->referer."\r\n";
if(!empty($this->cookies)) if(!empty($this->cookies))
{ {
if(!is_array($this->cookies)) if(!is_array($this->cookies))
$this->cookies = (array)$this->cookies; $this->cookies = (array)$this->cookies;
reset($this->cookies); reset($this->cookies);
if ( count($this->cookies) > 0 ) { if ( count($this->cookies) > 0 ) {
$cookie_headers .= 'Cookie: '; $cookie_headers .= 'Cookie: ';
@ -831,28 +831,28 @@ class Snoopy
$headers .= "; boundary=".$this->_mime_boundary; $headers .= "; boundary=".$this->_mime_boundary;
$headers .= "\r\n"; $headers .= "\r\n";
} }
if(!empty($body)) if(!empty($body))
$headers .= "Content-length: ".strlen($body)."\r\n"; $headers .= "Content-length: ".strlen($body)."\r\n";
if(!empty($this->user) || !empty($this->pass)) if(!empty($this->user) || !empty($this->pass))
$headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n"; $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
//add proxy auth headers //add proxy auth headers
if(!empty($this->proxy_user)) if(!empty($this->proxy_user))
$headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n"; $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n";
$headers .= "\r\n"; $headers .= "\r\n";
// set the read timeout if needed // set the read timeout if needed
if ($this->read_timeout > 0) if ($this->read_timeout > 0)
socket_set_timeout($fp, $this->read_timeout); socket_set_timeout($fp, $this->read_timeout);
$this->timed_out = false; $this->timed_out = false;
fwrite($fp,$headers.$body,strlen($headers.$body)); fwrite($fp,$headers.$body,strlen($headers.$body));
$this->_redirectaddr = false; $this->_redirectaddr = false;
unset($this->headers); unset($this->headers);
while($currentHeader = fgets($fp,$this->_maxlinelen)) while($currentHeader = fgets($fp,$this->_maxlinelen))
{ {
if ($this->read_timeout > 0 && $this->_check_timeout($fp)) if ($this->read_timeout > 0 && $this->_check_timeout($fp))
@ -860,10 +860,10 @@ class Snoopy
$this->status=-100; $this->status=-100;
return false; return false;
} }
if($currentHeader == "\r\n") if($currentHeader == "\r\n")
break; break;
// if a header begins with Location: or URI:, set the redirect // if a header begins with Location: or URI:, set the redirect
if(preg_match("/^(Location:|URI:)/i",$currentHeader)) if(preg_match("/^(Location:|URI:)/i",$currentHeader))
{ {
@ -883,16 +883,16 @@ class Snoopy
else else
$this->_redirectaddr = $matches[2]; $this->_redirectaddr = $matches[2];
} }
if(preg_match("|^HTTP/|",$currentHeader)) if(preg_match("|^HTTP/|",$currentHeader))
{ {
if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status))
{ {
$this->status= $status[1]; $this->status= $status[1];
} }
$this->response_code = $currentHeader; $this->response_code = $currentHeader;
} }
$this->headers[] = $currentHeader; $this->headers[] = $currentHeader;
} }
@ -910,13 +910,13 @@ class Snoopy
$this->status=-100; $this->status=-100;
return false; return false;
} }
// check if there is a a redirect meta tag // check if there is a a redirect meta tag
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
{ {
$this->_redirectaddr = $this->_expandlinks($match[1],$URI); $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
} }
// have we hit our frame depth and is there frame src to fetch? // have we hit our frame depth and is there frame src to fetch?
@ -932,7 +932,7 @@ class Snoopy
// no framed content // no framed content
else else
$this->results = $results; $this->results = $results;
return true; return true;
} }
@ -942,21 +942,21 @@ class Snoopy
Input: $url the url to fetch Input: $url the url to fetch
$URI the full URI $URI the full URI
$body body contents to send if any (POST) $body body contents to send if any (POST)
Output: Output:
\*======================================================================*/ \*======================================================================*/
function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")
{ {
if($this->passcookies && $this->_redirectaddr) if($this->passcookies && $this->_redirectaddr)
$this->setcookies(); $this->setcookies();
$headers = array(); $headers = array();
$URI_PARTS = parse_url($URI); $URI_PARTS = parse_url($URI);
if(empty($url)) if(empty($url))
$url = "/"; $url = "/";
// GET ... header not needed for curl // GET ... header not needed for curl
//$headers[] = $http_method." ".$url." ".$this->_httpversion; //$headers[] = $http_method." ".$url." ".$this->_httpversion;
if(!empty($this->agent)) if(!empty($this->agent))
$headers[] = "User-Agent: ".$this->agent; $headers[] = "User-Agent: ".$this->agent;
if(!empty($this->host)) if(!empty($this->host))
@ -969,10 +969,10 @@ class Snoopy
if(!empty($this->referer)) if(!empty($this->referer))
$headers[] = "Referer: ".$this->referer; $headers[] = "Referer: ".$this->referer;
if(!empty($this->cookies)) if(!empty($this->cookies))
{ {
if(!is_array($this->cookies)) if(!is_array($this->cookies))
$this->cookies = (array)$this->cookies; $this->cookies = (array)$this->cookies;
reset($this->cookies); reset($this->cookies);
if ( count($this->cookies) > 0 ) { if ( count($this->cookies) > 0 ) {
$cookie_str = 'Cookie: '; $cookie_str = 'Cookie: ';
@ -995,44 +995,44 @@ class Snoopy
else else
$headers[] = "Content-type: $content_type"; $headers[] = "Content-type: $content_type";
} }
if(!empty($body)) if(!empty($body))
$headers[] = "Content-length: ".strlen($body); $headers[] = "Content-length: ".strlen($body);
if(!empty($this->user) || !empty($this->pass)) if(!empty($this->user) || !empty($this->pass))
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
for($curr_header = 0; $curr_header < count($headers); $curr_header++) { for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
$safer_header = strtr( $headers[$curr_header], "\"", " " ); $safer_header = strtr( $headers[$curr_header], "\"", " " );
$cmdline_params .= " -H \"".$safer_header."\""; $cmdline_params .= " -H \"".$safer_header."\"";
} }
if(!empty($body)) if(!empty($body))
$cmdline_params .= " -d \"$body\""; $cmdline_params .= " -d \"$body\"";
if($this->read_timeout > 0) if($this->read_timeout > 0)
$cmdline_params .= " -m ".$this->read_timeout; $cmdline_params .= " -m ".$this->read_timeout;
$headerfile = tempnam($temp_dir, "sno"); $headerfile = tempnam($temp_dir, "sno");
$safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access
exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return); exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return);
if($return) if($return)
{ {
$this->error = "Error: cURL could not retrieve the document, error $return."; $this->error = "Error: cURL could not retrieve the document, error $return.";
return false; return false;
} }
$results = implode("\r\n",$results); $results = implode("\r\n",$results);
$result_headers = file("$headerfile"); $result_headers = file("$headerfile");
$this->_redirectaddr = false; $this->_redirectaddr = false;
unset($this->headers); unset($this->headers);
for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++)
{ {
// if a header begins with Location: or URI:, set the redirect // if a header begins with Location: or URI:, set the redirect
if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader]))
{ {
@ -1052,7 +1052,7 @@ class Snoopy
else else
$this->_redirectaddr = $matches[2]; $this->_redirectaddr = $matches[2];
} }
if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
$this->response_code = $result_headers[$currentHeader]; $this->response_code = $result_headers[$currentHeader];
@ -1060,10 +1060,10 @@ class Snoopy
} }
// check if there is a a redirect meta tag // check if there is a a redirect meta tag
if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
{ {
$this->_redirectaddr = $this->_expandlinks($match[1],$URI); $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
} }
// have we hit our frame depth and is there frame src to fetch? // have we hit our frame depth and is there frame src to fetch?
@ -1081,7 +1081,7 @@ class Snoopy
$this->results = $results; $this->results = $results;
unlink("$headerfile"); unlink("$headerfile");
return true; return true;
} }
@ -1089,7 +1089,7 @@ class Snoopy
Function: setcookies() Function: setcookies()
Purpose: set cookies for a redirection Purpose: set cookies for a redirection
\*======================================================================*/ \*======================================================================*/
function setcookies() function setcookies()
{ {
for($x=0; $x<count($this->headers); $x++) for($x=0; $x<count($this->headers); $x++)
@ -1099,7 +1099,7 @@ class Snoopy
} }
} }
/*======================================================================*\ /*======================================================================*\
Function: _check_timeout Function: _check_timeout
Purpose: checks whether timeout has occurred Purpose: checks whether timeout has occurred
@ -1123,13 +1123,13 @@ class Snoopy
Purpose: make a socket connection Purpose: make a socket connection
Input: $fp file pointer Input: $fp file pointer
\*======================================================================*/ \*======================================================================*/
function _connect(&$fp) function _connect(&$fp)
{ {
if(!empty($this->proxy_host) && !empty($this->proxy_port)) if(!empty($this->proxy_host) && !empty($this->proxy_port))
{ {
$this->_isproxy = true; $this->_isproxy = true;
$host = $this->proxy_host; $host = $this->proxy_host;
$port = $this->proxy_port; $port = $this->proxy_port;
} }
@ -1138,9 +1138,9 @@ class Snoopy
$host = $this->host; $host = $this->host;
$port = $this->port; $port = $this->port;
} }
$this->status = 0; $this->status = 0;
if($fp = fsockopen( if($fp = fsockopen(
$host, $host,
$port, $port,
@ -1176,13 +1176,13 @@ class Snoopy
Purpose: disconnect a socket connection Purpose: disconnect a socket connection
Input: $fp file pointer Input: $fp file pointer
\*======================================================================*/ \*======================================================================*/
function _disconnect($fp) function _disconnect($fp)
{ {
return(fclose($fp)); return(fclose($fp));
} }
/*======================================================================*\ /*======================================================================*\
Function: _prepare_post_body Function: _prepare_post_body
Purpose: Prepare post body according to encoding type Purpose: Prepare post body according to encoding type
@ -1190,7 +1190,7 @@ class Snoopy
$formfiles - form upload files $formfiles - form upload files
Output: post body Output: post body
\*======================================================================*/ \*======================================================================*/
function _prepare_post_body($formvars, $formfiles) function _prepare_post_body($formvars, $formfiles)
{ {
settype($formvars, "array"); settype($formvars, "array");
@ -1199,7 +1199,7 @@ class Snoopy
if (count($formvars) == 0 && count($formfiles) == 0) if (count($formvars) == 0 && count($formfiles) == 0)
return; return;
switch ($this->_submit_type) { switch ($this->_submit_type) {
case "application/x-www-form-urlencoded": case "application/x-www-form-urlencoded":
reset($formvars); reset($formvars);
@ -1215,7 +1215,7 @@ class Snoopy
case "multipart/form-data": case "multipart/form-data":
$this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); $this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
reset($formvars); reset($formvars);
while(list($key,$val) = each($formvars)) { while(list($key,$val) = each($formvars)) {
if (is_array($val) || is_object($val)) { if (is_array($val) || is_object($val)) {
@ -1230,7 +1230,7 @@ class Snoopy
$postdata .= "$val\r\n"; $postdata .= "$val\r\n";
} }
} }
reset($formfiles); reset($formfiles);
while (list($field_name, $file_names) = each($formfiles)) { while (list($field_name, $file_names) = each($formfiles)) {
settype($file_names, "array"); settype($file_names, "array");

View File

@ -53,7 +53,7 @@ class WP_Query {
$this->is_admin = false; $this->is_admin = false;
$this->is_attachment = false; $this->is_attachment = false;
} }
function init () { function init () {
unset($this->posts); unset($this->posts);
unset($this->query); unset($this->query);
@ -63,7 +63,7 @@ class WP_Query {
$this->post_count = 0; $this->post_count = 0;
$this->current_post = -1; $this->current_post = -1;
$this->in_the_loop = false; $this->in_the_loop = false;
$this->init_query_flags(); $this->init_query_flags();
} }
@ -97,7 +97,7 @@ class WP_Query {
$qv['attachment'] = $qv['subpost']; $qv['attachment'] = $qv['subpost'];
if ( '' != $qv['subpost_id'] ) if ( '' != $qv['subpost_id'] )
$qv['attachment_id'] = $qv['subpost_id']; $qv['attachment_id'] = $qv['subpost_id'];
if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) { if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) {
$this->is_single = true; $this->is_single = true;
$this->is_attachment = true; $this->is_attachment = true;
@ -226,7 +226,7 @@ class WP_Query {
if ('' != $qv['comments_popup']) { if ('' != $qv['comments_popup']) {
$this->is_comments_popup = true; $this->is_comments_popup = true;
} }
//if we're previewing inside the write screen //if we're previewing inside the write screen
if ('' != $qv['preview']) { if ('' != $qv['preview']) {
$this->is_preview = true; $this->is_preview = true;
@ -247,9 +247,9 @@ class WP_Query {
function set_404() { function set_404() {
$this->init_query_flags(); $this->init_query_flags();
$this->is_404 = true; $this->is_404 = true;
} }
function get($query_var) { function get($query_var) {
if (isset($this->query_vars[$query_var])) { if (isset($this->query_vars[$query_var])) {
return $this->query_vars[$query_var]; return $this->query_vars[$query_var];
@ -268,7 +268,7 @@ class WP_Query {
do_action('pre_get_posts', array(&$this)); do_action('pre_get_posts', array(&$this));
// Shorthand. // Shorthand.
$q = $this->query_vars; $q = $this->query_vars;
// First let's clear some variables // First let's clear some variables
$whichcat = ''; $whichcat = '';
@ -306,7 +306,7 @@ class WP_Query {
$q['page'] = trim($q['page'], '/'); $q['page'] = trim($q['page'], '/');
$q['page'] = (int) $q['page']; $q['page'] = (int) $q['page'];
} }
$add_hours = intval(get_settings('gmt_offset')); $add_hours = intval(get_settings('gmt_offset'));
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
@ -372,7 +372,7 @@ class WP_Query {
$page_paths = '/' . trim($q['pagename'], '/'); $page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths)); $q['pagename'] = sanitize_title(basename($page_paths));
$q['name'] = $q['pagename']; $q['name'] = $q['pagename'];
$where .= " AND (ID = '$reqpage')"; $where .= " AND (ID = '$reqpage')";
} elseif ('' != $q['attachment']) { } elseif ('' != $q['attachment']) {
$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment']))); $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
@ -489,11 +489,11 @@ class WP_Query {
$partial_match = $cat_id; $partial_match = $cat_id;
} }
} }
//if we don't match the entire hierarchy fallback on just matching the nicename //if we don't match the entire hierarchy fallback on just matching the nicename
if (!$q['cat'] && $partial_match) { if (!$q['cat'] && $partial_match) {
$q['cat'] = $partial_match; $q['cat'] = $partial_match;
} }
$tables = ", $wpdb->post2cat, $wpdb->categories"; $tables = ", $wpdb->post2cat, $wpdb->categories";
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) "; $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
@ -541,7 +541,7 @@ class WP_Query {
$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
$whichauthor .= ' AND (post_author = '.intval($q['author']).')'; $whichauthor .= ' AND (post_author = '.intval($q['author']).')';
} }
$where .= $search.$whichcat.$whichauthor; $where .= $search.$whichcat.$whichauthor;
if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) { if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
@ -597,7 +597,7 @@ class WP_Query {
if ( is_user_logged_in() ) if ( is_user_logged_in() )
$where .= " OR post_author = $user_ID AND post_status = 'private')"; $where .= " OR post_author = $user_ID AND post_status = 'private')";
else else
$where .= ')'; $where .= ')';
} }
// Apply filters on where and join prior to paging so that any // Apply filters on where and join prior to paging so that any
@ -680,7 +680,7 @@ class WP_Query {
if ($this->post_count > 0) { if ($this->post_count > 0) {
$this->post = $this->posts[0]; $this->post = $this->posts[0];
} }
// Save any changes made to the query vars. // Save any changes made to the query vars.
$this->query_vars = $q; $this->query_vars = $q;
return $this->posts; return $this->posts;
@ -841,7 +841,7 @@ class retrospam_mgr {
$head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>'; $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
$foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>'; $foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
return $head . $body . $foot; return $head . $body . $foot;
} // End function display_edit_form } // End function display_edit_form
@ -922,7 +922,7 @@ class WP_Rewrite {
return false; return false;
else else
return true; return true;
} }
function using_index_permalinks() { function using_index_permalinks() {
if (empty($this->permalink_structure)) { if (empty($this->permalink_structure)) {
@ -942,7 +942,7 @@ class WP_Rewrite {
return true; return true;
else else
return false; return false;
} }
function preg_index($number) { function preg_index($number) {
$match_prefix = '$'; $match_prefix = '$';
@ -987,7 +987,7 @@ class WP_Rewrite {
$this->date_structure = ''; $this->date_structure = '';
return false; return false;
} }
// The date permalink must have year, month, and day separated by slashes. // The date permalink must have year, month, and day separated by slashes.
$endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%'); $endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%');
@ -1070,7 +1070,7 @@ class WP_Rewrite {
$this->category_structure = $this->category_base . '/'; $this->category_structure = $this->category_base . '/';
$this->category_structure .= '%category%'; $this->category_structure .= '%category%';
return $this->category_structure; return $this->category_structure;
} }
@ -1153,10 +1153,10 @@ class WP_Rewrite {
// If the tag already exists, replace the existing pattern and query for // If the tag already exists, replace the existing pattern and query for
// that tag, otherwise add the new tag, pattern, and query to the end of // that tag, otherwise add the new tag, pattern, and query to the end of
// the arrays. // the arrays.
$position = array_search($tag, $this->rewritecode); $position = array_search($tag, $this->rewritecode);
if (FALSE !== $position && NULL !== $position) { if (FALSE !== $position && NULL !== $position) {
$this->rewritereplace[$position] = $pattern; $this->rewritereplace[$position] = $pattern;
$this->queryreplace[$position] = $query; $this->queryreplace[$position] = $query;
} else { } else {
$this->rewritecode[] = $tag; $this->rewritecode[] = $tag;
$this->rewritereplace[] = $pattern; $this->rewritereplace[] = $pattern;
@ -1174,7 +1174,7 @@ class WP_Rewrite {
$trackbackregex = 'trackback/?$'; $trackbackregex = 'trackback/?$';
$pageregex = 'page/?([0-9]{1,})/?$'; $pageregex = 'page/?([0-9]{1,})/?$';
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
preg_match_all('/%.+?%/', $permalink_structure, $tokens); preg_match_all('/%.+?%/', $permalink_structure, $tokens);
@ -1304,7 +1304,7 @@ class WP_Rewrite {
// Date // Date
$date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct()); $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct());
$date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite); $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);
// Root // Root
$root_rewrite = $this->generate_rewrite_rules($this->root . '/'); $root_rewrite = $this->generate_rewrite_rules($this->root . '/');
$root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite); $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite);
@ -1372,7 +1372,7 @@ class WP_Rewrite {
$rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" .
"RewriteCond %{REQUEST_FILENAME} -d\n" . "RewriteCond %{REQUEST_FILENAME} -d\n" .
"RewriteRule ^.*$ - [S=$num_rules]\n"; "RewriteRule ^.*$ - [S=$num_rules]\n";
foreach ($rewrite as $match => $query) { foreach ($rewrite as $match => $query) {
// Apache 1.3 does not support the reluctant (non-greedy) modifier. // Apache 1.3 does not support the reluctant (non-greedy) modifier.
$match = str_replace('.+?', '.+', $match); $match = str_replace('.+?', '.+', $match);
@ -1382,7 +1382,7 @@ class WP_Rewrite {
if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
//nada. //nada.
} }
if (strstr($query, $this->index)) { if (strstr($query, $this->index)) {
$rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
} else { } else {
@ -1413,7 +1413,7 @@ class WP_Rewrite {
function init() { function init() {
$this->permalink_structure = get_settings('permalink_structure'); $this->permalink_structure = get_settings('permalink_structure');
$this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%')); $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
$this->root = ''; $this->root = '';
if ($this->using_index_permalinks()) { if ($this->using_index_permalinks()) {
$this->root = $this->index . '/'; $this->root = $this->index . '/';
@ -1493,7 +1493,7 @@ class WP {
// Trim path info from the end and the leading home path from the // Trim path info from the end and the leading home path from the
// front. For path info requests, this leaves us with the requesting // front. For path info requests, this leaves us with the requesting
// filename, if any. For 404 requests, this leaves us with the // filename, if any. For 404 requests, this leaves us with the
// requested permalink. // requested permalink.
$req_uri = str_replace($pathinfo, '', $req_uri); $req_uri = str_replace($pathinfo, '', $req_uri);
$req_uri = trim($req_uri, '/'); $req_uri = trim($req_uri, '/');
$req_uri = preg_replace("|^$home_path|", '', $req_uri); $req_uri = preg_replace("|^$home_path|", '', $req_uri);
@ -1562,10 +1562,10 @@ class WP {
if (isset($error)) if (isset($error))
unset($error); unset($error);
if ( isset($query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') ) if ( isset($query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') )
unset($query_vars); unset($query_vars);
$this->did_permalink = false; $this->did_permalink = false;
} }
} }
@ -1619,7 +1619,7 @@ class WP {
// If string is empty, return 0. If not, attempt to parse into a timestamp // If string is empty, return 0. If not, attempt to parse into a timestamp
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
// Make a timestamp for our most recent modification... // Make a timestamp for our most recent modification...
$wp_modified_timestamp = strtotime($wp_last_modified); $wp_modified_timestamp = strtotime($wp_last_modified);
if ( ($client_last_modified && $client_etag) ? if ( ($client_last_modified && $client_etag) ?

View File

@ -41,7 +41,7 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_date'] = current_time('mysql'); $commentdata['comment_date'] = current_time('mysql');
$commentdata['comment_date_gmt'] = current_time('mysql', 1); $commentdata['comment_date_gmt'] = current_time('mysql', 1);
$commentdata = wp_filter_comment($commentdata); $commentdata = wp_filter_comment($commentdata);
@ -230,7 +230,7 @@ function get_comments_number( $post_id = 0 ) {
if ( !isset($comment_count_cache[$post_id]) ) if ( !isset($comment_count_cache[$post_id]) )
$comment_count_cache[$id] = $wpdb->get_var("SELECT comment_count FROM $wpdb->posts WHERE ID = '$post_id'"); $comment_count_cache[$id] = $wpdb->get_var("SELECT comment_count FROM $wpdb->posts WHERE ID = '$post_id'");
return apply_filters('get_comments_number', $comment_count_cache[$post_id]); return apply_filters('get_comments_number', $comment_count_cache[$post_id]);
} }
@ -277,13 +277,13 @@ function comments_popup_script($width=400, $height=400, $file='') {
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb; global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb;
global $comment_count_cache; global $comment_count_cache;
if (! is_single() && ! is_page()) { if (! is_single() && ! is_page()) {
if ( !isset($comment_count_cache[$id]) ) if ( !isset($comment_count_cache[$id]) )
$comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';"); $comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
$number = $comment_count_cache[$id]; $number = $comment_count_cache[$id];
if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) { if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
echo $none; echo $none;
return; return;
@ -344,7 +344,7 @@ function comment_author() {
function get_comment_author_email() { function get_comment_author_email() {
global $comment; global $comment;
return apply_filters('get_comment_author_email', $comment->comment_author_email); return apply_filters('get_comment_author_email', $comment->comment_author_email);
} }
function comment_author_email() { function comment_author_email() {
@ -616,7 +616,7 @@ function pingback($content, $post_ID) {
// Debug // Debug
debug_fwrite($log, 'Post contents:'); debug_fwrite($log, 'Post contents:');
debug_fwrite($log, $content."\n"); debug_fwrite($log, $content."\n");
// Step 2. // Step 2.
// Walking thru the links array // Walking thru the links array
// first we get rid of links pointing to sites, not to specific files // first we get rid of links pointing to sites, not to specific files
@ -658,7 +658,7 @@ function pingback($content, $post_ID) {
// when set to true, this outputs debug messages by itself // when set to true, this outputs debug messages by itself
$client->debug = false; $client->debug = false;
if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) ) if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) )
add_ping( $post_ID, $pagelinkedto ); add_ping( $post_ID, $pagelinkedto );
else else
@ -769,7 +769,7 @@ function is_local_attachment($url) {
$post = & get_post($id); $post = & get_post($id);
if ( 'attachment' == $post->post_status ) if ( 'attachment' == $post->post_status )
return true; return true;
} }
return false; return false;
} }
@ -795,7 +795,7 @@ function wp_set_comment_status($comment_id, $comment_status) {
if ($wpdb->query($query)) { if ($wpdb->query($query)) {
do_action('wp_set_comment_status', $comment_id, $comment_status); do_action('wp_set_comment_status', $comment_id, $comment_status);
$comment = get_comment($comment_id); $comment = get_comment($comment_id);
$comment_post_ID = $comment->comment_post_ID; $comment_post_ID = $comment->comment_post_ID;
$c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" ); $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" );
@ -809,7 +809,7 @@ function wp_set_comment_status($comment_id, $comment_status) {
function wp_get_comment_status($comment_id) { function wp_get_comment_status($comment_id) {
global $wpdb; global $wpdb;
$result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
if ($result == NULL) { if ($result == NULL) {
return 'deleted'; return 'deleted';
@ -845,7 +845,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
// Do some escaping magic so that '#' chars in the // Do some escaping magic so that '#' chars in the
// spam words don't break things: // spam words don't break things:
$word = preg_quote($word, '#'); $word = preg_quote($word, '#');
$pattern = "#$word#i"; $pattern = "#$word#i";
if ( preg_match($pattern, $author) ) return false; if ( preg_match($pattern, $author) ) return false;
if ( preg_match($pattern, $email) ) return false; if ( preg_match($pattern, $email) ) return false;

View File

@ -32,7 +32,7 @@ function wptexturize($text) {
$curl = preg_replace("/'([\s.]|\Z)/", '&#8217;$1', $curl); $curl = preg_replace("/'([\s.]|\Z)/", '&#8217;$1', $curl);
$curl = preg_replace("/ \(tm\)/i", ' &#8482;', $curl); $curl = preg_replace("/ \(tm\)/i", ' &#8482;', $curl);
$curl = str_replace("''", '&#8221;', $curl); $curl = str_replace("''", '&#8221;', $curl);
$curl = preg_replace('/(\d+)x(\d+)/', "$1&#215;$2", $curl); $curl = preg_replace('/(\d+)x(\d+)/', "$1&#215;$2", $curl);
} elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) { } elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {
@ -74,7 +74,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee); $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee); $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
return $pee; return $pee;
} }
@ -239,7 +239,7 @@ function remove_accents($string) {
chr(197).chr(190) => 'z', chr(197).chr(191) => 's', chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
// Euro Sign // Euro Sign
chr(226).chr(130).chr(172) => 'E'); chr(226).chr(130).chr(172) => 'E');
$string = strtr($string, $chars); $string = strtr($string, $chars);
} else { } else {
// Assume ISO-8859-1 if not UTF-8 // Assume ISO-8859-1 if not UTF-8
@ -374,10 +374,10 @@ function convert_chars($content, $flag = 'obsolete') {
function funky_javascript_fix($text) { function funky_javascript_fix($text) {
// Fixes for browsers' javascript bugs // Fixes for browsers' javascript bugs
global $is_macIE, $is_winIE; global $is_macIE, $is_winIE;
if ( $is_winIE || $is_macIE ) if ( $is_winIE || $is_macIE )
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text); $text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
return $text; return $text;
} }
@ -401,7 +401,7 @@ function funky_javascript_fix($text) {
1.0 First Version 1.0 First Version
*/ */
function balanceTags($text, $is_comment = 0) { function balanceTags($text, $is_comment = 0) {
if ( get_option('use_balanceTags') == 0) if ( get_option('use_balanceTags') == 0)
return $text; return $text;

View File

@ -31,7 +31,7 @@ function wp_insert_post($postarr = array()) {
$post_name = apply_filters('name_save_pre', $post_name); $post_name = apply_filters('name_save_pre', $post_name);
$comment_status = apply_filters('comment_status_pre', $comment_status); $comment_status = apply_filters('comment_status_pre', $comment_status);
$ping_status = apply_filters('ping_status_pre', $ping_status); $ping_status = apply_filters('ping_status_pre', $ping_status);
// Make sure we set a valid category // Make sure we set a valid category
if (0 == count($post_category) || !is_array($post_category)) { if (0 == count($post_category) || !is_array($post_category)) {
$post_category = array(get_option('default_category')); $post_category = array(get_option('default_category'));
@ -59,7 +59,7 @@ function wp_insert_post($postarr = array()) {
} else { } else {
$post_name = sanitize_title($post_name); $post_name = sanitize_title($post_name);
} }
// If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
if (empty($post_date)) { if (empty($post_date)) {
@ -150,7 +150,7 @@ function wp_insert_post($postarr = array()) {
(post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
VALUES VALUES
('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");
$post_ID = $wpdb->insert_id; $post_ID = $wpdb->insert_id;
} }
if ( empty($post_name) && 'draft' != $post_status ) { if ( empty($post_name) && 'draft' != $post_status ) {
@ -177,7 +177,7 @@ function wp_insert_post($postarr = array()) {
$wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'"); $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
do_action('private_to_published', $post_ID); do_action('private_to_published', $post_ID);
} }
do_action('edit_post', $post_ID); do_action('edit_post', $post_ID);
} }
@ -251,7 +251,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
$update = false; $update = false;
if ( !empty($ID) ) { if ( !empty($ID) ) {
$update = true; $update = true;
$post_ID = $ID; $post_ID = $ID;
} }
// Create a valid post name. // Create a valid post name.
@ -259,7 +259,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
$post_name = sanitize_title($post_title); $post_name = sanitize_title($post_title);
else else
$post_name = sanitize_title($post_name); $post_name = sanitize_title($post_name);
if (empty($post_date)) if (empty($post_date))
$post_date = current_time('mysql'); $post_date = current_time('mysql');
if (empty($post_date_gmt)) if (empty($post_date_gmt))
@ -332,9 +332,9 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
(post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid)
VALUES VALUES
('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')");
$post_ID = $wpdb->insert_id; $post_ID = $wpdb->insert_id;
} }
if ( empty($post_name) ) { if ( empty($post_name) ) {
$post_name = sanitize_title($post_title, $post_ID); $post_name = sanitize_title($post_title, $post_ID);
$wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" ); $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" );
@ -352,7 +352,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
} else { } else {
do_action('add_attachment', $post_ID); do_action('add_attachment', $post_ID);
} }
return $post_ID; return $post_ID;
} }
@ -395,7 +395,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
global $wpdb; global $wpdb;
$post = get_post($postid, $mode); $post = get_post($postid, $mode);
// Set categories // Set categories
if($mode == OBJECT) { if($mode == OBJECT) {
$post->post_category = wp_get_post_cats('',$postid); $post->post_category = wp_get_post_cats('',$postid);
@ -428,7 +428,7 @@ function wp_update_post($postarr = array()) {
$postarr = get_object_vars($postarr); $postarr = get_object_vars($postarr);
// First, get all of the original fields // First, get all of the original fields
$post = wp_get_single_post($postarr['ID'], ARRAY_A); $post = wp_get_single_post($postarr['ID'], ARRAY_A);
// Escape data pulled from DB. // Escape data pulled from DB.
$post = add_magic_quotes($post); $post = add_magic_quotes($post);
@ -449,7 +449,7 @@ function wp_update_post($postarr = array()) {
// Merge old and new fields with new fields overwriting old ones. // Merge old and new fields with new fields overwriting old ones.
$postarr = array_merge($post, $postarr); $postarr = array_merge($post, $postarr);
$postarr['post_category'] = $post_cats; $postarr['post_category'] = $post_cats;
if ( $clear_date ) { if ( $clear_date ) {
$postarr['post_date'] = ''; $postarr['post_date'] = '';
$postarr['post_date_gmt'] = ''; $postarr['post_date_gmt'] = '';
@ -475,7 +475,7 @@ function wp_publish_post($post_id) {
function wp_get_post_cats($blogid = '1', $post_ID = 0) { function wp_get_post_cats($blogid = '1', $post_ID = 0) {
global $wpdb; global $wpdb;
$sql = "SELECT category_id $sql = "SELECT category_id
FROM $wpdb->post2cat FROM $wpdb->post2cat
WHERE post_id = $post_ID WHERE post_id = $post_ID
@ -494,7 +494,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
// If $post_categories isn't already an array, make it one: // If $post_categories isn't already an array, make it one:
if (!is_array($post_categories) || 0 == count($post_categories)) if (!is_array($post_categories) || 0 == count($post_categories))
$post_categories = array(get_option('default_category')); $post_categories = array(get_option('default_category'));
$post_categories = array_unique($post_categories); $post_categories = array_unique($post_categories);
// First the old categories // First the old categories
@ -502,7 +502,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
SELECT category_id SELECT category_id
FROM $wpdb->post2cat FROM $wpdb->post2cat
WHERE post_id = $post_ID"); WHERE post_id = $post_ID");
if (!$old_categories) { if (!$old_categories) {
$old_categories = array(); $old_categories = array();
} else { } else {
@ -532,13 +532,13 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
VALUES ($post_ID, $new_cat)"); VALUES ($post_ID, $new_cat)");
} }
} }
// Update category counts. // Update category counts.
$all_affected_cats = array_unique(array_merge($post_categories, $old_categories)); $all_affected_cats = array_unique(array_merge($post_categories, $old_categories));
foreach ( $all_affected_cats as $cat_id ) { foreach ( $all_affected_cats as $cat_id ) {
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'");
$wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'");
wp_cache_delete($cat_id, 'category'); wp_cache_delete($cat_id, 'category');
} }
} // wp_set_post_cats() } // wp_set_post_cats()
@ -568,7 +568,7 @@ function wp_delete_post($postid = 0) {
$wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'"); $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'");
$wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid"); $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");
$wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid"); $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");
@ -595,17 +595,17 @@ function post_permalink($post_id = 0, $mode = '') { // $mode legacy
// Get the name of a category from its ID // Get the name of a category from its ID
function get_cat_name($cat_id) { function get_cat_name($cat_id) {
global $wpdb; global $wpdb;
$cat_id -= 0; // force numeric $cat_id -= 0; // force numeric
$name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id"); $name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id");
return $name; return $name;
} }
// Get the ID of a category from its name // Get the ID of a category from its name
function get_cat_ID($cat_name='General') { function get_cat_ID($cat_name='General') {
global $wpdb; global $wpdb;
$cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'"); $cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
return $cid?$cid:1; // default to cat 1 return $cid?$cid:1; // default to cat 1
@ -639,14 +639,14 @@ function trackback_url_list($tb_list, $post_id) {
// import postdata as variables // import postdata as variables
extract($postdata); extract($postdata);
// form an excerpt // form an excerpt
$excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content); $excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content);
if (strlen($excerpt) > 255) { if (strlen($excerpt) > 255) {
$excerpt = substr($excerpt,0,252) . '...'; $excerpt = substr($excerpt,0,252) . '...';
} }
$trackback_urls = explode(',', $tb_list); $trackback_urls = explode(',', $tb_list);
foreach($trackback_urls as $tb_url) { foreach($trackback_urls as $tb_url) {
$tb_url = trim($tb_url); $tb_url = trim($tb_url);
@ -684,7 +684,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
// Do some escaping magic so that '#' chars in the // Do some escaping magic so that '#' chars in the
// spam words don't break things: // spam words don't break things:
$word = preg_quote($word, '#'); $word = preg_quote($word, '#');
$pattern = "#$word#i"; $pattern = "#$word#i";
if ( preg_match($pattern, $author ) ) return true; if ( preg_match($pattern, $author ) ) return true;
if ( preg_match($pattern, $email ) ) return true; if ( preg_match($pattern, $email ) ) return true;
@ -693,7 +693,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
if ( preg_match($pattern, $user_ip ) ) return true; if ( preg_match($pattern, $user_ip ) ) return true;
if ( preg_match($pattern, $user_agent) ) return true; if ( preg_match($pattern, $user_agent) ) return true;
} }
if ( isset($_SERVER['REMOTE_ADDR']) ) { if ( isset($_SERVER['REMOTE_ADDR']) ) {
if ( wp_proxy_check($_SERVER['REMOTE_ADDR']) ) return true; if ( wp_proxy_check($_SERVER['REMOTE_ADDR']) ) return true;
} }
@ -722,7 +722,7 @@ function do_trackbacks($post_id) {
$wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'"); $wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'");
return; return;
} }
if (empty($post->post_excerpt)) if (empty($post->post_excerpt))
$excerpt = apply_filters('the_content', $post->post_content); $excerpt = apply_filters('the_content', $post->post_content);
else else
@ -812,7 +812,7 @@ function get_page_hierarchy($posts, $parent = 0) {
function generate_page_uri_index() { function generate_page_uri_index() {
global $wpdb; global $wpdb;
//get pages in order of hierarchy, i.e. children after parents //get pages in order of hierarchy, i.e. children after parents
$posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'")); $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));
//now reverse it, because we need parents after children for rewrite rules to work properly //now reverse it, because we need parents after children for rewrite rules to work properly
@ -822,7 +822,7 @@ function generate_page_uri_index() {
$page_attachment_uris = array(); $page_attachment_uris = array();
if ($posts) { if ($posts) {
foreach ($posts as $id => $post) { foreach ($posts as $id => $post) {
// URI => page name // URI => page name
@ -839,7 +839,7 @@ function generate_page_uri_index() {
} }
update_option('page_uris', $page_uris); update_option('page_uris', $page_uris);
if ( $page_attachment_uris ) if ( $page_attachment_uris )
update_option('page_attachment_uris', $page_attachment_uris); update_option('page_attachment_uris', $page_attachment_uris);
} }
@ -903,7 +903,7 @@ function wp_mkdir_p($target) {
return true; return true;
} else { } else {
if ( is_dir(dirname($target)) ) if ( is_dir(dirname($target)) )
return false; return false;
} }
// If the above failed, attempt to create the parent node, then try again. // If the above failed, attempt to create the parent node, then try again.
@ -954,7 +954,7 @@ function wp_upload_bits($name, $type, $bits) {
return array('error' => "Empty filename"); return array('error' => "Empty filename");
$upload = wp_upload_dir(); $upload = wp_upload_dir();
if ( $upload['error'] !== false ) if ( $upload['error'] !== false )
return $upload; return $upload;
@ -972,7 +972,7 @@ function wp_upload_bits($name, $type, $bits) {
else else
$filename = str_replace("$number$ext", ++$number . $ext, $filename); $filename = str_replace("$number$ext", ++$number . $ext, $filename);
} }
$new_file = $upload['path'] . "/$filename"; $new_file = $upload['path'] . "/$filename";
if ( ! wp_mkdir_p( dirname($new_file) ) ) { if ( ! wp_mkdir_p( dirname($new_file) ) ) {
$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
@ -982,7 +982,7 @@ function wp_upload_bits($name, $type, $bits) {
$ifp = @ fopen($new_file, 'wb'); $ifp = @ fopen($new_file, 'wb');
if ( ! $ifp ) if ( ! $ifp )
return array('error' => "Could not write file $new_file."); return array('error' => "Could not write file $new_file.");
$success = @ fwrite($ifp, $bits); $success = @ fwrite($ifp, $bits);
fclose($ifp); fclose($ifp);
// Set correct file permissions // Set correct file permissions

View File

@ -22,7 +22,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
return false; return false;
} }
$i = mktime(substr($m,11,2),substr($m,14,2),substr($m,17,2),substr($m,5,2),substr($m,8,2),substr($m,0,4)); $i = mktime(substr($m,11,2),substr($m,14,2),substr($m,17,2),substr($m,5,2),substr($m,8,2),substr($m,0,4));
if ( -1 == $i || false == $i ) if ( -1 == $i || false == $i )
$i = 0; $i = 0;
@ -304,7 +304,7 @@ function get_option($option) {
function get_user_option( $option, $user = 0 ) { function get_user_option( $option, $user = 0 ) {
global $wpdb, $current_user; global $wpdb, $current_user;
if ( empty($user) ) if ( empty($user) )
$user = $current_user; $user = $current_user;
else else
@ -657,7 +657,7 @@ function set_page_path($page) {
$curpage = get_page($curpage->post_parent); $curpage = get_page($curpage->post_parent);
$path = '/' . $curpage->post_name . $path; $path = '/' . $curpage->post_name . $path;
} }
$page->fullpath = $path; $page->fullpath = $path;
return $page; return $page;
@ -726,7 +726,7 @@ function &get_page(&$page, $output = OBJECT) {
wp_cache_add($_page->ID, $_page, 'pages'); wp_cache_add($_page->ID, $_page, 'pages');
} }
} }
if (!isset($_page->fullpath)) { if (!isset($_page->fullpath)) {
$_page = set_page_path($_page); $_page = set_page_path($_page);
wp_cache_replace($_page->ID, $_page, 'pages'); wp_cache_replace($_page->ID, $_page, 'pages');
@ -751,7 +751,7 @@ function set_category_path($cat) {
$curcat = get_category($curcat->category_parent); $curcat = get_category($curcat->category_parent);
$path = '/' . $curcat->category_nicename . $path; $path = '/' . $curcat->category_nicename . $path;
} }
$cat->fullpath = $path; $cat->fullpath = $path;
return $cat; return $cat;
@ -777,7 +777,7 @@ function &get_category(&$category, $output = OBJECT) {
if ( !isset($_category->fullpath) ) { if ( !isset($_category->fullpath) ) {
$_category = set_category_path($_category); $_category = set_category_path($_category);
wp_cache_replace($_category->cat_ID, $_category, 'category'); wp_cache_replace($_category->cat_ID, $_category, 'category');
} }
if ( $output == OBJECT ) { if ( $output == OBJECT ) {
@ -830,23 +830,23 @@ function get_catname($cat_ID) {
function get_all_category_ids() { function get_all_category_ids() {
global $wpdb; global $wpdb;
if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
$cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
wp_cache_add('all_category_ids', $cat_ids, 'category'); wp_cache_add('all_category_ids', $cat_ids, 'category');
} }
return $cat_ids; return $cat_ids;
} }
function get_all_page_ids() { function get_all_page_ids() {
global $wpdb; global $wpdb;
if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) {
$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
wp_cache_add('all_page_ids', $page_ids, 'pages'); wp_cache_add('all_page_ids', $page_ids, 'pages');
} }
return $page_ids; return $page_ids;
} }
@ -1416,7 +1416,7 @@ function update_post_category_cache($post_ids) {
if ( empty($dogs) ) if ( empty($dogs) )
return; return;
foreach ($dogs as $catt) foreach ($dogs as $catt)
$category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id); $category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id);
} }
@ -1523,7 +1523,7 @@ function is_attachment () {
function is_preview() { function is_preview() {
global $wp_query; global $wp_query;
return $wp_query->is_preview; return $wp_query->is_preview;
} }
@ -2175,7 +2175,7 @@ function wp_remote_fopen( $uri ) {
function wp($query_vars = '') { function wp($query_vars = '') {
global $wp; global $wp;
$wp->main($query_vars); $wp->main($query_vars);
} }
@ -2245,7 +2245,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
if ( is_array($meta_value) || is_object($meta_value) ) if ( is_array($meta_value) || is_object($meta_value) )
$meta_value = serialize($meta_value); $meta_value = serialize($meta_value);
$meta_value = trim( $meta_value ); $meta_value = trim( $meta_value );
if (empty($meta_value)) { if (empty($meta_value)) {
delete_usermeta($user_id, $meta_key); delete_usermeta($user_id, $meta_key);
} }
@ -2258,13 +2258,13 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
} else if ( $cur->meta_value != $meta_value ) { } else if ( $cur->meta_value != $meta_value ) {
$wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
} else { } else {
return false; return false;
} }
$user = get_userdata($user_id); $user = get_userdata($user_id);
wp_cache_delete($user_id, 'users'); wp_cache_delete($user_id, 'users');
wp_cache_delete($user->user_login, 'userlogins'); wp_cache_delete($user->user_login, 'userlogins');
return true; return true;
} }
@ -2282,11 +2282,11 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'"); $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'");
else else
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
$user = get_userdata($user_id); $user = get_userdata($user_id);
wp_cache_delete($user_id, 'users'); wp_cache_delete($user_id, 'users');
wp_cache_delete($user->user_login, 'userlogins'); wp_cache_delete($user->user_login, 'userlogins');
return true; return true;
} }

View File

@ -139,7 +139,7 @@ function AnchorPosition_getPageOffsetLeft (el) {
} }
function AnchorPosition_getWindowOffsetLeft (el) { function AnchorPosition_getWindowOffsetLeft (el) {
return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft; return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
} }
function AnchorPosition_getPageOffsetTop (el) { function AnchorPosition_getPageOffsetTop (el) {
var ot=el.offsetTop; var ot=el.offsetTop;
while((el=el.offsetParent) != null) { ot += el.offsetTop; } while((el=el.offsetParent) != null) { ot += el.offsetTop; }
@ -434,7 +434,7 @@ function PopupWindow() {
this.populated = false; this.populated = false;
this.visible = false; this.visible = false;
this.autoHideEnabled = false; this.autoHideEnabled = false;
this.contents = ""; this.contents = "";
this.url=""; this.url="";
this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no"; this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
@ -556,7 +556,7 @@ function ColorPicker_select(inputobj,linkname) {
window.ColorPicker_targetInput = inputobj; window.ColorPicker_targetInput = inputobj;
this.show(linkname); this.show(linkname);
} }
// This function runs when you move your mouse over a color block, if you have a newer browser // This function runs when you move your mouse over a color block, if you have a newer browser
function ColorPicker_highlightColor(c) { function ColorPicker_highlightColor(c) {
var thedoc = (arguments.length>1)?arguments[1]:window.document; var thedoc = (arguments.length>1)?arguments[1]:window.document;
@ -579,7 +579,7 @@ function ColorPicker() {
else { else {
var divname = arguments[0]; var divname = arguments[0];
} }
if (divname != "") { if (divname != "") {
var cp = new PopupWindow(divname); var cp = new PopupWindow(divname);
} }
@ -590,7 +590,7 @@ function ColorPicker() {
// Object variables // Object variables
cp.currentValue = "#FFFFFF"; cp.currentValue = "#FFFFFF";
// Method Mappings // Method Mappings
cp.writeDiv = ColorPicker_writeDiv; cp.writeDiv = ColorPicker_writeDiv;
cp.highlightColor = ColorPicker_highlightColor; cp.highlightColor = ColorPicker_highlightColor;

View File

@ -31,22 +31,22 @@ var Fat = {
if (!duration) duration = 3000; if (!duration) duration = 3000;
if (!from || from=="#") from = "#FFFF33"; if (!from || from=="#") from = "#FFFF33";
if (!to) to = this.get_bgcolor(id); if (!to) to = this.get_bgcolor(id);
var frames = Math.round(fps * (duration / 1000)); var frames = Math.round(fps * (duration / 1000));
var interval = duration / frames; var interval = duration / frames;
var delay = interval; var delay = interval;
var frame = 0; var frame = 0;
if (from.length < 7) from += from.substr(1,3); if (from.length < 7) from += from.substr(1,3);
if (to.length < 7) to += to.substr(1,3); if (to.length < 7) to += to.substr(1,3);
var rf = parseInt(from.substr(1,2),16); var rf = parseInt(from.substr(1,2),16);
var gf = parseInt(from.substr(3,2),16); var gf = parseInt(from.substr(3,2),16);
var bf = parseInt(from.substr(5,2),16); var bf = parseInt(from.substr(5,2),16);
var rt = parseInt(to.substr(1,2),16); var rt = parseInt(to.substr(1,2),16);
var gt = parseInt(to.substr(3,2),16); var gt = parseInt(to.substr(3,2),16);
var bt = parseInt(to.substr(5,2),16); var bt = parseInt(to.substr(5,2),16);
var r,g,b,h; var r,g,b,h;
while (frame < frames) while (frame < frames)
{ {
@ -54,7 +54,7 @@ var Fat = {
g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames)); g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames)); b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
h = this.make_hex(r,g,b); h = this.make_hex(r,g,b);
setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay); setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);
frame++; frame++;

View File

@ -205,7 +205,7 @@ function edCheckOpenTags(button) {
else { else {
return false; // tag not found return false; // tag not found
} }
} }
function edCloseAllTags() { function edCloseAllTags() {
var count = edOpenTags.length; var count = edOpenTags.length;

View File

@ -87,13 +87,13 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
// Is selection a image // Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'class'); flag = getAttrib(focusElm, 'class');
if (flag != 'mce_plugin_wordpress_more') // Not a wordpress if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
return true; return true;
action = "update"; action = "update";
} }
html = '' html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" ' + ' width="100%" height="10px" '
@ -105,17 +105,17 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
var flag = ""; var flag = "";
var template = new Array(); var template = new Array();
var altPage = tinyMCE.getLang('lang_wordpress_more_alt'); var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
// Is selection a image // Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'name'); flag = getAttrib(focusElm, 'name');
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
return true; return true;
action = "update"; action = "update";
} }
html = '' html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" ' + ' width="100%" height="10px" '
@ -131,7 +131,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
function TinyMCE_wordpress_cleanup(type, content) { function TinyMCE_wordpress_cleanup(type, content) {
switch (type) { switch (type) {
case "insert_to_editor": case "insert_to_editor":
var startPos = 0; var startPos = 0;
var altMore = tinyMCE.getLang('lang_wordpress_more_alt'); var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
@ -178,9 +178,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
if (attribs['class'] == "mce_plugin_wordpress_more") { if (attribs['class'] == "mce_plugin_wordpress_more") {
endPos += 2; endPos += 2;
var embedHTML = '<!--more-->'; var embedHTML = '<!--more-->';
// Insert embed/object chunk // Insert embed/object chunk
chunkBefore = content.substring(0, startPos); chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos); chunkAfter = content.substring(endPos);
@ -188,9 +188,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
} }
if (attribs['class'] == "mce_plugin_wordpress_page") { if (attribs['class'] == "mce_plugin_wordpress_page") {
endPos += 2; endPos += 2;
var embedHTML = '<!--nextpage-->'; var embedHTML = '<!--nextpage-->';
// Insert embed/object chunk // Insert embed/object chunk
chunkBefore = content.substring(0, startPos); chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos); chunkAfter = content.substring(endPos);
@ -221,7 +221,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n'); content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
content = content.replace(new RegExp('^\\s*', ''), ''); content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), ''); content = content.replace(new RegExp('\\s*$', ''), '');
break; break;
} }

View File

@ -61,7 +61,7 @@ var preloadImg = new Image();
function resetImageData() { function resetImageData() {
var formObj = document.forms[0]; var formObj = document.forms[0];
formObj.width.value = formObj.height.value = ""; formObj.width.value = formObj.height.value = "";
} }
function updateImageData() { function updateImageData() {

View File

@ -353,7 +353,7 @@ TinyMCE.prototype.updateContent = function(form_element_name) {
if (inst.formElement == formElement) { if (inst.formElement == formElement) {
var doc = inst.getDoc(); var doc = inst.getDoc();
tinyMCE._setHTML(doc, inst.formElement.value); tinyMCE._setHTML(doc, inst.formElement.value);
if (!tinyMCE.isMSIE) if (!tinyMCE.isMSIE)

View File

@ -93,7 +93,7 @@ require_once('../../../wp-config.php');
c = d('content'+i.toString()); c = d('content'+i.toString());
t = d('tab'+i.toString()); t = d('tab'+i.toString());
if ( n == i ) { if ( n == i ) {
c.className = ''; c.className = '';
t.className = 'current'; t.className = 'current';
} else { } else {
c.className = 'hidden'; c.className = 'hidden';

View File

@ -32,7 +32,7 @@ function sack(file){
this.failed = true; this.failed = true;
} }
}; };
this.setVar = function(name, value){ this.setVar = function(name, value){
if (this.URLString.length < 3){ if (this.URLString.length < 3){
this.URLString = name + "=" + value; this.URLString = name + "=" + value;
@ -40,12 +40,12 @@ function sack(file){
this.URLString += "&" + name + "=" + value; this.URLString += "&" + name + "=" + value;
} }
} }
this.encVar = function(name, value){ this.encVar = function(name, value){
var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value); var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
return varString; return varString;
} }
this.encodeURLString = function(string){ this.encodeURLString = function(string){
varArray = string.split('&'); varArray = string.split('&');
for (i = 0; i < varArray.length; i++){ for (i = 0; i < varArray.length; i++){
@ -57,11 +57,11 @@ function sack(file){
} }
return varArray.join('&'); return varArray.join('&');
} }
this.runResponse = function(){ this.runResponse = function(){
eval(this.response); eval(this.response);
} }
this.runAJAX = function(urlstring){ this.runAJAX = function(urlstring){
this.responseStatus = new Array(2); this.responseStatus = new Array(2);
if(this.failed && this.AjaxFailedAlert){ if(this.failed && this.AjaxFailedAlert){

View File

@ -62,7 +62,7 @@ function get_userdata( $user_id ) {
return false; return false;
$user = wp_cache_get($user_id, 'users'); $user = wp_cache_get($user_id, 'users');
if ( $user ) if ( $user )
return $user; return $user;
@ -93,10 +93,10 @@ function get_userdata( $user_id ) {
$user->user_lastname = $user->last_name; $user->user_lastname = $user->last_name;
if ( isset($user->description) ) if ( isset($user->description) )
$user->user_description = $user->description; $user->user_description = $user->description;
wp_cache_add($user_id, $user, 'users'); wp_cache_add($user_id, $user, 'users');
wp_cache_add($user->user_login, $user, 'userlogins'); wp_cache_add($user->user_login, $user, 'userlogins');
return $user; return $user;
} }
endif; endif;
@ -114,7 +114,7 @@ function get_userdatabylogin($user_login) {
if ( empty( $user_login ) ) if ( empty( $user_login ) )
return false; return false;
$userdata = wp_cache_get($user_login, 'userlogins'); $userdata = wp_cache_get($user_login, 'userlogins');
if ( $userdata ) if ( $userdata )
return $userdata; return $userdata;
@ -202,7 +202,7 @@ endif;
if ( !function_exists('is_user_logged_in') ) : if ( !function_exists('is_user_logged_in') ) :
function is_user_logged_in() { function is_user_logged_in() {
global $current_user; global $current_user;
if ( $current_user->id == 0 ) if ( $current_user->id == 0 )
return false; return false;
return true; return true;
@ -216,7 +216,7 @@ function auth_redirect() {
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
(empty($_COOKIE[USER_COOKIE])) ) { (empty($_COOKIE[USER_COOKIE])) ) {
nocache_headers(); nocache_headers();
header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
exit(); exit();
} }
@ -303,9 +303,9 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$comment_author_domain = gethostbyaddr($comment->comment_author_IP); $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
$blogname = get_settings('blogname'); $blogname = get_settings('blogname');
if ( empty( $comment_type ) ) $comment_type = 'comment'; if ( empty( $comment_type ) ) $comment_type = 'comment';
if ('comment' == $comment_type) { if ('comment' == $comment_type) {
$notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
@ -407,14 +407,14 @@ endif;
if ( !function_exists('wp_new_user_notification') ) : if ( !function_exists('wp_new_user_notification') ) :
function wp_new_user_notification($user_id, $plaintext_pass = '') { function wp_new_user_notification($user_id, $plaintext_pass = '') {
$user = new WP_User($user_id); $user = new WP_User($user_id);
$user_login = stripslashes($user->user_login); $user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email); $user_email = stripslashes($user->user_email);
$message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
@wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
if ( empty($plaintext_pass) ) if ( empty($plaintext_pass) )
@ -423,9 +423,9 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
$message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
$message .= get_settings('siteurl') . "/wp-login.php\r\n"; $message .= get_settings('siteurl') . "/wp-login.php\r\n";
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message);
} }
endif; endif;

View File

@ -23,9 +23,9 @@ function validate_username( $username ) {
$valid = true; $valid = true;
if ( $name != $username ) if ( $name != $username )
$valid = false; $valid = false;
return apply_filters('validate_username', $valid, $username); return apply_filters('validate_username', $valid, $username);
} }
function wp_insert_user($userdata) { function wp_insert_user($userdata) {
@ -41,7 +41,7 @@ function wp_insert_user($userdata) {
// Password is not hashed when creating new user. // Password is not hashed when creating new user.
$user_pass = md5($user_pass); $user_pass = md5($user_pass);
} }
$user_login = sanitize_user($user_login, true); $user_login = sanitize_user($user_login, true);
if ( empty($user_nicename) ) if ( empty($user_nicename) )
@ -49,10 +49,10 @@ function wp_insert_user($userdata) {
if ( empty($display_name) ) if ( empty($display_name) )
$display_name = $user_login; $display_name = $user_login;
if ( empty($nickname) ) if ( empty($nickname) )
$nickname = $user_login; $nickname = $user_login;
if ( empty($user_registered) ) if ( empty($user_registered) )
$user_registered = gmdate('Y-m-d H:i:s'); $user_registered = gmdate('Y-m-d H:i:s');
@ -70,7 +70,7 @@ function wp_insert_user($userdata) {
$wpdb->query( $query ); $wpdb->query( $query );
$user_id = $wpdb->insert_id; $user_id = $wpdb->insert_id;
} }
update_usermeta( $user_id, 'first_name', $first_name); update_usermeta( $user_id, 'first_name', $first_name);
update_usermeta( $user_id, 'last_name', $last_name); update_usermeta( $user_id, 'last_name', $last_name);
update_usermeta( $user_id, 'nickname', $nickname ); update_usermeta( $user_id, 'nickname', $nickname );
@ -91,22 +91,22 @@ function wp_insert_user($userdata) {
wp_cache_delete($user_id, 'users'); wp_cache_delete($user_id, 'users');
wp_cache_delete($user_login, 'userlogins'); wp_cache_delete($user_login, 'userlogins');
if ( $update ) if ( $update )
do_action('profile_update', $user_id); do_action('profile_update', $user_id);
else else
do_action('user_register', $user_id); do_action('user_register', $user_id);
return $user_id; return $user_id;
} }
function wp_update_user($userdata) { function wp_update_user($userdata) {
global $wpdb, $current_user; global $wpdb, $current_user;
$ID = (int) $userdata['ID']; $ID = (int) $userdata['ID'];
// First, get all of the original fields // First, get all of the original fields
$user = get_userdata($ID); $user = get_userdata($ID);
// Escape data pulled from DB. // Escape data pulled from DB.
$user = add_magic_quotes(get_object_vars($user)); $user = add_magic_quotes(get_object_vars($user));
@ -121,20 +121,20 @@ function wp_update_user($userdata) {
$userdata = array_merge($user, $userdata); $userdata = array_merge($user, $userdata);
$user_id = wp_insert_user($userdata); $user_id = wp_insert_user($userdata);
// Update the cookies if the password changed. // Update the cookies if the password changed.
if( $current_user->id == $ID ) { if( $current_user->id == $ID ) {
if ( isset($plaintext_pass) ) { if ( isset($plaintext_pass) ) {
wp_clearcookie(); wp_clearcookie();
wp_setcookie($userdata['user_login'], $plaintext_pass); wp_setcookie($userdata['user_login'], $plaintext_pass);
} }
} }
return $user_id; return $user_id;
} }
function wp_create_user( $username, $password, $email = '') { function wp_create_user( $username, $password, $email = '') {
global $wpdb; global $wpdb;
$user_login = $wpdb->escape( $username ); $user_login = $wpdb->escape( $username );
$user_email = $wpdb->escape( $email ); $user_email = $wpdb->escape( $email );
$user_pass = $password; $user_pass = $password;
@ -145,7 +145,7 @@ function wp_create_user( $username, $password, $email = '') {
function create_user( $username, $password, $email ) { function create_user( $username, $password, $email ) {
return wp_create_user( $username, $password, $email ); return wp_create_user( $username, $password, $email );
} }

View File

@ -30,37 +30,37 @@ class MagpieRSS {
var $inimage = false; var $inimage = false;
var $current_field = ''; var $current_field = '';
var $current_namespace = false; var $current_namespace = false;
//var $ERROR = ""; //var $ERROR = "";
var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
function MagpieRSS ($source) { function MagpieRSS ($source) {
# if PHP xml isn't compiled in, die # if PHP xml isn't compiled in, die
# #
if ( !function_exists('xml_parser_create') ) if ( !function_exists('xml_parser_create') )
trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" ); trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" );
$parser = @xml_parser_create(); $parser = @xml_parser_create();
if ( !is_resource($parser) ) if ( !is_resource($parser) )
trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php"); trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
$this->parser = $parser; $this->parser = $parser;
# pass in parser, and a reference to this object # pass in parser, and a reference to this object
# setup handlers # setup handlers
# #
xml_set_object( $this->parser, $this ); xml_set_object( $this->parser, $this );
xml_set_element_handler($this->parser, xml_set_element_handler($this->parser,
'feed_start_element', 'feed_end_element' ); 'feed_start_element', 'feed_end_element' );
xml_set_character_data_handler( $this->parser, 'feed_cdata' ); xml_set_character_data_handler( $this->parser, 'feed_cdata' );
$status = xml_parse( $this->parser, $source ); $status = xml_parse( $this->parser, $source );
if (! $status ) { if (! $status ) {
$errorcode = xml_get_error_code( $this->parser ); $errorcode = xml_get_error_code( $this->parser );
if ( $errorcode != XML_ERROR_NONE ) { if ( $errorcode != XML_ERROR_NONE ) {
@ -72,16 +72,16 @@ class MagpieRSS {
$this->error( $errormsg ); $this->error( $errormsg );
} }
} }
xml_parser_free( $this->parser ); xml_parser_free( $this->parser );
$this->normalize(); $this->normalize();
} }
function feed_start_element($p, $element, &$attrs) { function feed_start_element($p, $element, &$attrs) {
$el = $element = strtolower($element); $el = $element = strtolower($element);
$attrs = array_change_key_case($attrs, CASE_LOWER); $attrs = array_change_key_case($attrs, CASE_LOWER);
// check for a namespace, and split if found // check for a namespace, and split if found
$ns = false; $ns = false;
if ( strpos( $element, ':' ) ) { if ( strpos( $element, ':' ) ) {
@ -90,7 +90,7 @@ class MagpieRSS {
if ( $ns and $ns != 'rdf' ) { if ( $ns and $ns != 'rdf' ) {
$this->current_namespace = $ns; $this->current_namespace = $ns;
} }
# if feed type isn't set, then this is first element of feed # if feed type isn't set, then this is first element of feed
# identify feed from root element # identify feed from root element
# #
@ -110,7 +110,7 @@ class MagpieRSS {
} }
return; return;
} }
if ( $el == 'channel' ) if ( $el == 'channel' )
{ {
$this->inchannel = true; $this->inchannel = true;
@ -119,10 +119,10 @@ class MagpieRSS {
{ {
$this->initem = true; $this->initem = true;
if ( isset($attrs['rdf:about']) ) { if ( isset($attrs['rdf:about']) ) {
$this->current_item['about'] = $attrs['rdf:about']; $this->current_item['about'] = $attrs['rdf:about'];
} }
} }
// if we're in the default namespace of an RSS feed, // if we're in the default namespace of an RSS feed,
// record textinput or image fields // record textinput or image fields
elseif ( elseif (
@ -132,7 +132,7 @@ class MagpieRSS {
{ {
$this->intextinput = true; $this->intextinput = true;
} }
elseif ( elseif (
$this->feed_type == RSS and $this->feed_type == RSS and
$this->current_namespace == '' and $this->current_namespace == '' and
@ -140,7 +140,7 @@ class MagpieRSS {
{ {
$this->inimage = true; $this->inimage = true;
} }
# handle atom content constructs # handle atom content constructs
elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
{ {
@ -148,12 +148,12 @@ class MagpieRSS {
if ($el == 'content' ) { if ($el == 'content' ) {
$el = 'atom_content'; $el = 'atom_content';
} }
$this->incontent = $el; $this->incontent = $el;
} }
// if inside an Atom content construct (e.g. content or summary) field treat tags as text // if inside an Atom content construct (e.g. content or summary) field treat tags as text
elseif ($this->feed_type == ATOM and $this->incontent ) elseif ($this->feed_type == ATOM and $this->incontent )
{ {
@ -162,12 +162,12 @@ class MagpieRSS {
array_map('map_attrs', array_map('map_attrs',
array_keys($attrs), array_keys($attrs),
array_values($attrs) ) ); array_values($attrs) ) );
$this->append_content( "<$element $attrs_str>" ); $this->append_content( "<$element $attrs_str>" );
array_unshift( $this->stack, $el ); array_unshift( $this->stack, $el );
} }
// Atom support many links per containging element. // Atom support many links per containging element.
// Magpie treats link elements of type rel='alternate' // Magpie treats link elements of type rel='alternate'
// as being equivalent to RSS's simple link element. // as being equivalent to RSS's simple link element.
@ -181,7 +181,7 @@ class MagpieRSS {
else { else {
$link_el = 'link_' . $attrs['rel']; $link_el = 'link_' . $attrs['rel'];
} }
$this->append($link_el, $attrs['href']); $this->append($link_el, $attrs['href']);
} }
// set stack[0] to current element // set stack[0] to current element
@ -189,11 +189,11 @@ class MagpieRSS {
array_unshift($this->stack, $el); array_unshift($this->stack, $el);
} }
} }
function feed_cdata ($p, $text) { function feed_cdata ($p, $text) {
if ($this->feed_type == ATOM and $this->incontent) if ($this->feed_type == ATOM and $this->incontent)
{ {
$this->append_content( $text ); $this->append_content( $text );
@ -203,10 +203,10 @@ class MagpieRSS {
$this->append($current_el, $text); $this->append($current_el, $text);
} }
} }
function feed_end_element ($p, $el) { function feed_end_element ($p, $el) {
$el = strtolower($el); $el = strtolower($el);
if ( $el == 'item' or $el == 'entry' ) if ( $el == 'item' or $el == 'entry' )
{ {
$this->items[] = $this->current_item; $this->items[] = $this->current_item;
@ -222,7 +222,7 @@ class MagpieRSS {
$this->inimage = false; $this->inimage = false;
} }
elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
{ {
$this->incontent = false; $this->incontent = false;
} }
elseif ($el == 'channel' or $el == 'feed' ) elseif ($el == 'channel' or $el == 'feed' )
@ -245,17 +245,17 @@ class MagpieRSS {
else { else {
array_shift( $this->stack ); array_shift( $this->stack );
} }
$this->current_namespace = false; $this->current_namespace = false;
} }
function concat (&$str1, $str2="") { function concat (&$str1, $str2="") {
if (!isset($str1) ) { if (!isset($str1) ) {
$str1=""; $str1="";
} }
$str1 .= $str2; $str1 .= $str2;
} }
function append_content($text) { function append_content($text) {
if ( $this->initem ) { if ( $this->initem ) {
$this->concat( $this->current_item[ $this->incontent ], $text ); $this->concat( $this->current_item[ $this->incontent ], $text );
@ -264,7 +264,7 @@ class MagpieRSS {
$this->concat( $this->channel[ $this->incontent ], $text ); $this->concat( $this->channel[ $this->incontent ], $text );
} }
} }
// smart append - field and namespace aware // smart append - field and namespace aware
function append($el, $text) { function append($el, $text) {
if (!$el) { if (!$el) {
@ -306,10 +306,10 @@ class MagpieRSS {
$this->concat( $this->concat(
$this->channel[ $el ], $text ); $this->channel[ $el ], $text );
} }
} }
} }
function normalize () { function normalize () {
// if atom populate rss fields // if atom populate rss fields
if ( $this->is_atom() ) { if ( $this->is_atom() ) {
@ -320,9 +320,9 @@ class MagpieRSS {
$item['description'] = $item['summary']; $item['description'] = $item['summary'];
if ( isset($item['atom_content'])) if ( isset($item['atom_content']))
$item['content']['encoded'] = $item['atom_content']; $item['content']['encoded'] = $item['atom_content'];
$this->items[$i] = $item; $this->items[$i] = $item;
} }
} }
elseif ( $this->is_rss() ) { elseif ( $this->is_rss() ) {
$this->channel['tagline'] = $this->channel['description']; $this->channel['tagline'] = $this->channel['description'];
@ -332,21 +332,21 @@ class MagpieRSS {
$item['summary'] = $item['description']; $item['summary'] = $item['description'];
if ( isset($item['content']['encoded'] ) ) if ( isset($item['content']['encoded'] ) )
$item['atom_content'] = $item['content']['encoded']; $item['atom_content'] = $item['content']['encoded'];
$this->items[$i] = $item; $this->items[$i] = $item;
} }
} }
} }
function is_rss () { function is_rss () {
if ( $this->feed_type == RSS ) { if ( $this->feed_type == RSS ) {
return $this->feed_version; return $this->feed_version;
} }
else { else {
return false; return false;
} }
} }
function is_atom() { function is_atom() {
if ( $this->feed_type == ATOM ) { if ( $this->feed_type == ATOM ) {
return $this->feed_version; return $this->feed_version;
@ -378,12 +378,12 @@ require_once( dirname(__FILE__) . '/class-snoopy.php');
function fetch_rss ($url) { function fetch_rss ($url) {
// initialize constants // initialize constants
init(); init();
if ( !isset($url) ) { if ( !isset($url) ) {
// error("fetch_rss called without a url"); // error("fetch_rss called without a url");
return false; return false;
} }
// if cache is disabled // if cache is disabled
if ( !MAGPIE_CACHE_ON ) { if ( !MAGPIE_CACHE_ON ) {
// fetch file, and parse it // fetch file, and parse it
@ -403,19 +403,19 @@ function fetch_rss ($url) {
// 2. if there is a hit, make sure its fresh // 2. if there is a hit, make sure its fresh
// 3. if cached obj fails freshness check, fetch remote // 3. if cached obj fails freshness check, fetch remote
// 4. if remote fails, return stale object, or error // 4. if remote fails, return stale object, or error
$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
if (MAGPIE_DEBUG and $cache->ERROR) { if (MAGPIE_DEBUG and $cache->ERROR) {
debug($cache->ERROR, E_USER_WARNING); debug($cache->ERROR, E_USER_WARNING);
} }
$cache_status = 0; // response of check_cache $cache_status = 0; // response of check_cache
$request_headers = array(); // HTTP headers to send with fetch $request_headers = array(); // HTTP headers to send with fetch
$rss = 0; // parsed RSS object $rss = 0; // parsed RSS object
$errormsg = 0; // errors, if any $errormsg = 0; // errors, if any
if (!$cache->ERROR) { if (!$cache->ERROR) {
// return cache HIT, MISS, or STALE // return cache HIT, MISS, or STALE
$cache_status = $cache->check_cache( $url ); $cache_status = $cache->check_cache( $url );
@ -432,9 +432,9 @@ function fetch_rss ($url) {
return $rss; return $rss;
} }
} }
// else attempt a conditional get // else attempt a conditional get
// setup headers // setup headers
if ( $cache_status == 'STALE' ) { if ( $cache_status == 'STALE' ) {
$rss = $cache->get( $url ); $rss = $cache->get( $url );
@ -443,9 +443,9 @@ function fetch_rss ($url) {
$request_headers['If-Last-Modified'] = $rss->last_modified; $request_headers['If-Last-Modified'] = $rss->last_modified;
} }
} }
$resp = _fetch_remote_file( $url, $request_headers ); $resp = _fetch_remote_file( $url, $request_headers );
if (isset($resp) and $resp) { if (isset($resp) and $resp) {
if ($resp->status == '304' ) { if ($resp->status == '304' ) {
// we have the most current copy // we have the most current copy
@ -483,9 +483,9 @@ function fetch_rss ($url) {
else { else {
$errormsg = "Unable to retrieve RSS file for unknown reasons."; $errormsg = "Unable to retrieve RSS file for unknown reasons.";
} }
// else fetch failed // else fetch failed
// attempt to return cached object // attempt to return cached object
if ($rss) { if ($rss) {
if ( MAGPIE_DEBUG ) { if ( MAGPIE_DEBUG ) {
@ -493,12 +493,12 @@ function fetch_rss ($url) {
} }
return $rss; return $rss;
} }
// else we totally failed // else we totally failed
// error( $errormsg ); // error( $errormsg );
return false; return false;
} // end if ( !MAGPIE_CACHE_ON ) { } // end if ( !MAGPIE_CACHE_ON ) {
} // end fetch_rss() } // end fetch_rss()
@ -511,7 +511,7 @@ function _fetch_remote_file ($url, $headers = "" ) {
if (is_array($headers) ) { if (is_array($headers) ) {
$client->rawheaders = $headers; $client->rawheaders = $headers;
} }
@$client->fetch($url); @$client->fetch($url);
return $client; return $client;
@ -519,10 +519,10 @@ function _fetch_remote_file ($url, $headers = "" ) {
function _response_to_rss ($resp) { function _response_to_rss ($resp) {
$rss = new MagpieRSS( $resp->results ); $rss = new MagpieRSS( $resp->results );
// if RSS parsed successfully // if RSS parsed successfully
if ( $rss and !$rss->ERROR) { if ( $rss and !$rss->ERROR) {
// find Etag, and Last-Modified // find Etag, and Last-Modified
foreach($resp->headers as $h) { foreach($resp->headers as $h) {
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
@ -533,26 +533,26 @@ function _response_to_rss ($resp) {
$field = $h; $field = $h;
$val = ""; $val = "";
} }
if ( $field == 'ETag' ) { if ( $field == 'ETag' ) {
$rss->etag = $val; $rss->etag = $val;
} }
if ( $field == 'Last-Modified' ) { if ( $field == 'Last-Modified' ) {
$rss->last_modified = $val; $rss->last_modified = $val;
} }
} }
return $rss; return $rss;
} // else construct error message } // else construct error message
else { else {
$errormsg = "Failed to parse RSS file."; $errormsg = "Failed to parse RSS file.";
if ($rss) { if ($rss) {
$errormsg .= " (" . $rss->ERROR . ")"; $errormsg .= " (" . $rss->ERROR . ")";
} }
// error($errormsg); // error($errormsg);
return false; return false;
} // end if ($rss and !$rss->error) } // end if ($rss and !$rss->error)
} }
@ -569,7 +569,7 @@ function init () {
else { else {
define('MAGPIE_INITALIZED', 1); define('MAGPIE_INITALIZED', 1);
} }
if ( !defined('MAGPIE_CACHE_ON') ) { if ( !defined('MAGPIE_CACHE_ON') ) {
define('MAGPIE_CACHE_ON', 1); define('MAGPIE_CACHE_ON', 1);
} }
@ -585,31 +585,31 @@ function init () {
if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
define('MAGPIE_CACHE_FRESH_ONLY', 0); define('MAGPIE_CACHE_FRESH_ONLY', 0);
} }
if ( !defined('MAGPIE_DEBUG') ) { if ( !defined('MAGPIE_DEBUG') ) {
define('MAGPIE_DEBUG', 0); define('MAGPIE_DEBUG', 0);
} }
if ( !defined('MAGPIE_USER_AGENT') ) { if ( !defined('MAGPIE_USER_AGENT') ) {
$ua = 'WordPress/' . $wp_version; $ua = 'WordPress/' . $wp_version;
if ( MAGPIE_CACHE_ON ) { if ( MAGPIE_CACHE_ON ) {
$ua = $ua . ')'; $ua = $ua . ')';
} }
else { else {
$ua = $ua . '; No cache)'; $ua = $ua . '; No cache)';
} }
define('MAGPIE_USER_AGENT', $ua); define('MAGPIE_USER_AGENT', $ua);
} }
if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout
} }
// use gzip encoding to fetch rss files if supported? // use gzip encoding to fetch rss files if supported?
if ( !defined('MAGPIE_USE_GZIP') ) { if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true); define('MAGPIE_USE_GZIP', true);
} }
} }
@ -641,7 +641,7 @@ class RSSCache {
var $BASE_CACHE = 'wp-content/cache'; // where the cache files are stored var $BASE_CACHE = 'wp-content/cache'; // where the cache files are stored
var $MAX_AGE = 43200; // when are files stale, default twelve hours var $MAX_AGE = 43200; // when are files stale, default twelve hours
var $ERROR = ''; // accumulate error messages var $ERROR = ''; // accumulate error messages
function RSSCache ($base='', $age='') { function RSSCache ($base='', $age='') {
if ( $base ) { if ( $base ) {
$this->BASE_CACHE = $base; $this->BASE_CACHE = $base;
@ -649,50 +649,50 @@ class RSSCache {
if ( $age ) { if ( $age ) {
$this->MAX_AGE = $age; $this->MAX_AGE = $age;
} }
} }
/*=======================================================================*\ /*=======================================================================*\
Function: set Function: set
Purpose: add an item to the cache, keyed on url Purpose: add an item to the cache, keyed on url
Input: url from wich the rss file was fetched Input: url from wich the rss file was fetched
Output: true on sucess Output: true on sucess
\*=======================================================================*/ \*=======================================================================*/
function set ($url, $rss) { function set ($url, $rss) {
global $wpdb; global $wpdb;
$cache_option = 'rss_' . $this->file_name( $url ); $cache_option = 'rss_' . $this->file_name( $url );
$cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts'; $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts';
if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_option'") ) if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_option'") )
add_option($cache_option, '', '', 'no'); add_option($cache_option, '', '', 'no');
if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_timestamp'") ) if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_timestamp'") )
add_option($cache_timestamp, '', '', 'no'); add_option($cache_timestamp, '', '', 'no');
update_option($cache_option, $rss); update_option($cache_option, $rss);
update_option($cache_timestamp, time() ); update_option($cache_timestamp, time() );
return $cache_option; return $cache_option;
} }
/*=======================================================================*\ /*=======================================================================*\
Function: get Function: get
Purpose: fetch an item from the cache Purpose: fetch an item from the cache
Input: url from wich the rss file was fetched Input: url from wich the rss file was fetched
Output: cached object on HIT, false on MISS Output: cached object on HIT, false on MISS
\*=======================================================================*/ \*=======================================================================*/
function get ($url) { function get ($url) {
$this->ERROR = ""; $this->ERROR = "";
$cache_option = 'rss_' . $this->file_name( $url ); $cache_option = 'rss_' . $this->file_name( $url );
if ( ! get_option( $cache_option ) ) { if ( ! get_option( $cache_option ) ) {
$this->debug( $this->debug(
"Cache doesn't contain: $url (cache option: $cache_option)" "Cache doesn't contain: $url (cache option: $cache_option)"
); );
return 0; return 0;
} }
$rss = get_option( $cache_option ); $rss = get_option( $cache_option );
return $rss; return $rss;
} }
@ -701,8 +701,8 @@ class RSSCache {
Purpose: check a url for membership in the cache Purpose: check a url for membership in the cache
and whether the object is older then MAX_AGE (ie. STALE) and whether the object is older then MAX_AGE (ie. STALE)
Input: url from wich the rss file was fetched Input: url from wich the rss file was fetched
Output: cached object on HIT, false on MISS Output: cached object on HIT, false on MISS
\*=======================================================================*/ \*=======================================================================*/
function check_cache ( $url ) { function check_cache ( $url ) {
$this->ERROR = ""; $this->ERROR = "";
$cache_option = $this->file_name( $url ); $cache_option = $this->file_name( $url );
@ -729,32 +729,32 @@ class RSSCache {
/*=======================================================================*\ /*=======================================================================*\
Function: serialize Function: serialize
\*=======================================================================*/ \*=======================================================================*/
function serialize ( $rss ) { function serialize ( $rss ) {
return serialize( $rss ); return serialize( $rss );
} }
/*=======================================================================*\ /*=======================================================================*\
Function: unserialize Function: unserialize
\*=======================================================================*/ \*=======================================================================*/
function unserialize ( $data ) { function unserialize ( $data ) {
return unserialize( $data ); return unserialize( $data );
} }
/*=======================================================================*\ /*=======================================================================*\
Function: file_name Function: file_name
Purpose: map url to location in cache Purpose: map url to location in cache
Input: url from wich the rss file was fetched Input: url from wich the rss file was fetched
Output: a file name Output: a file name
\*=======================================================================*/ \*=======================================================================*/
function file_name ($url) { function file_name ($url) {
return md5( $url ); return md5( $url );
} }
/*=======================================================================*\ /*=======================================================================*\
Function: error Function: error
Purpose: register error Purpose: register error
\*=======================================================================*/ \*=======================================================================*/
function error ($errormsg, $lvl=E_USER_WARNING) { function error ($errormsg, $lvl=E_USER_WARNING) {
// append PHP's error message if track_errors enabled // append PHP's error message if track_errors enabled
if ( isset($php_errormsg) ) { if ( isset($php_errormsg) ) {
@ -776,17 +776,17 @@ class RSSCache {
} }
function parse_w3cdtf ( $date_str ) { function parse_w3cdtf ( $date_str ) {
# regex to match wc3dtf # regex to match wc3dtf
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
if ( preg_match( $pat, $date_str, $match ) ) { if ( preg_match( $pat, $date_str, $match ) ) {
list( $year, $month, $day, $hours, $minutes, $seconds) = list( $year, $month, $day, $hours, $minutes, $seconds) =
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
# calc epoch for current date assuming GMT # calc epoch for current date assuming GMT
$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
$offset = 0; $offset = 0;
if ( $match[10] == 'Z' ) { if ( $match[10] == 'Z' ) {
# zulu time, aka GMT # zulu time, aka GMT
@ -794,20 +794,20 @@ function parse_w3cdtf ( $date_str ) {
else { else {
list( $tz_mod, $tz_hour, $tz_min ) = list( $tz_mod, $tz_hour, $tz_min ) =
array( $match[8], $match[9], $match[10]); array( $match[8], $match[9], $match[10]);
# zero out the variables # zero out the variables
if ( ! $tz_hour ) { $tz_hour = 0; } if ( ! $tz_hour ) { $tz_hour = 0; }
if ( ! $tz_min ) { $tz_min = 0; } if ( ! $tz_min ) { $tz_min = 0; }
$offset_secs = (($tz_hour*60)+$tz_min)*60; $offset_secs = (($tz_hour*60)+$tz_min)*60;
# is timezone ahead of GMT? then subtract offset # is timezone ahead of GMT? then subtract offset
# #
if ( $tz_mod == '+' ) { if ( $tz_mod == '+' ) {
$offset_secs = $offset_secs * -1; $offset_secs = $offset_secs * -1;
} }
$offset = $offset_secs; $offset = $offset_secs;
} }
$epoch = $epoch + $offset; $epoch = $epoch + $offset;
return $epoch; return $epoch;
@ -829,7 +829,7 @@ function wp_rss ($url, $num) {
echo htmlentities($item['title']); echo htmlentities($item['title']);
echo "</a><br />\n"; echo "</a><br />\n";
echo "</li>\n"; echo "</li>\n";
} }
echo "</ul>"; echo "</ul>";
} }
else { else {

View File

@ -271,7 +271,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
return null; return null;
$current_post_date = $post->post_date; $current_post_date = $post->post_date;
$join = ''; $join = '';
if ( $in_same_cat ) { if ( $in_same_cat ) {
$join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id "; $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
@ -437,7 +437,7 @@ function get_pagenum_link($pagenum = 1) {
if ( $permalink ) if ( $permalink )
$qstr = trailingslashit($qstr); $qstr = trailingslashit($qstr);
$qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr ); $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr );
// showing /page/1/ or ?paged=1 is redundant // showing /page/1/ or ?paged=1 is redundant
if ( 1 === $pagenum ) { if ( 1 === $pagenum ) {
$qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style $qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style

View File

@ -211,7 +211,7 @@ function get_post_custom( $post_id = 0 ) {
// Force subkeys to be array type: // Force subkeys to be array type:
if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) ) if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) )
$post_meta_cache[$mpid] = array(); $post_meta_cache[$mpid] = array();
if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) ) if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) )
$post_meta_cache[$mpid]["$mkey"] = array(); $post_meta_cache[$mpid]["$mkey"] = array();

View File

@ -31,7 +31,7 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
exit; exit;
} else if ( is_category() && $template = get_category_template()) { } else if ( is_category() && $template = get_category_template()) {
include($template); include($template);
exit; exit;
} else if ( is_author() && $template = get_author_template() ) { } else if ( is_author() && $template = get_author_template() ) {
include($template); include($template);
exit; exit;

View File

@ -16,7 +16,7 @@ if (!defined('SAVEQUERIES'))
class wpdb { class wpdb {
var $show_errors = true; var $show_errors = true;
var $num_queries = 0; var $num_queries = 0;
var $last_query; var $last_query;
var $col_info; var $col_info;
var $queries; var $queries;
@ -75,7 +75,7 @@ class wpdb {
// ==================================================================== // ====================================================================
// Format a string correctly for safe insert under all PHP conditions // Format a string correctly for safe insert under all PHP conditions
function escape($string) { function escape($string) {
return addslashes( $string ); // Disable rest for now, causing problems return addslashes( $string ); // Disable rest for now, causing problems
if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
@ -101,7 +101,7 @@ class wpdb {
<code>$this->last_query</code></p> <code>$this->last_query</code></p>
</div>"; </div>";
} else { } else {
return false; return false;
} }
} }
@ -111,7 +111,7 @@ class wpdb {
function show_errors() { function show_errors() {
$this->show_errors = true; $this->show_errors = true;
} }
function hide_errors() { function hide_errors() {
$this->show_errors = false; $this->show_errors = false;
} }
@ -142,7 +142,7 @@ class wpdb {
// Perform the query via std mysql_query function.. // Perform the query via std mysql_query function..
if (SAVEQUERIES) if (SAVEQUERIES)
$this->timer_start(); $this->timer_start();
$this->result = @mysql_query($query, $this->dbh); $this->result = @mysql_query($query, $this->dbh);
++$this->num_queries; ++$this->num_queries;
@ -159,7 +159,7 @@ class wpdb {
$this->rows_affected = mysql_affected_rows(); $this->rows_affected = mysql_affected_rows();
// Take note of the insert_id // Take note of the insert_id
if ( preg_match("/^\\s*(insert|replace) /i",$query) ) { if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
$this->insert_id = mysql_insert_id($this->dbh); $this->insert_id = mysql_insert_id($this->dbh);
} }
// Return number of rows affected // Return number of rows affected
$return_val = $this->rows_affected; $return_val = $this->rows_affected;
@ -179,7 +179,7 @@ class wpdb {
// Log number of rows the query returned // Log number of rows the query returned
$this->num_rows = $num_rows; $this->num_rows = $num_rows;
// Return number of rows selected // Return number of rows selected
$return_val = $this->num_rows; $return_val = $this->num_rows;
} }
@ -293,7 +293,7 @@ class wpdb {
$this->time_start = $mtime[1] + $mtime[0]; $this->time_start = $mtime[1] + $mtime[0];
return true; return true;
} }
function timer_stop($precision = 3) { function timer_stop($precision = 3) {
$mtime = microtime(); $mtime = microtime();
$mtime = explode(' ', $mtime); $mtime = explode(' ', $mtime);
@ -305,7 +305,7 @@ class wpdb {
function bail($message) { // Just wraps errors in a nice header and footer function bail($message) { // Just wraps errors in a nice header and footer
if ( !$this->show_errors ) if ( !$this->show_errors )
return false; return false;
header( 'Content-Type: text/html; charset=utf-8'); header( 'Content-Type: text/html; charset=utf-8');
echo <<<HEAD echo <<<HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
@ -325,22 +325,22 @@ class wpdb {
margin-right: 25%; margin-right: 25%;
padding: .2em 2em; padding: .2em 2em;
} }
h1 { h1 {
color: #006; color: #006;
font-size: 18px; font-size: 18px;
font-weight: lighter; font-weight: lighter;
} }
h2 { h2 {
font-size: 16px; font-size: 16px;
} }
p, li, dt { p, li, dt {
line-height: 140%; line-height: 140%;
padding-bottom: 2px; padding-bottom: 2px;
} }
ul, ol { ul, ol {
padding: 5px 5px 5px 20px; padding: 5px 5px 5px 20px;
} }

View File

@ -14,7 +14,7 @@ function get_locale() {
// WPLANG is defined in wp-config. // WPLANG is defined in wp-config.
if (defined('WPLANG')) if (defined('WPLANG'))
$locale = WPLANG; $locale = WPLANG;
if (empty($locale)) if (empty($locale))
$locale = 'en_US'; $locale = 'en_US';
@ -76,20 +76,20 @@ function load_default_textdomain() {
$locale = get_locale(); $locale = get_locale();
$mofile = ABSPATH . "wp-includes/languages/$locale.mo"; $mofile = ABSPATH . "wp-includes/languages/$locale.mo";
load_textdomain('default', $mofile); load_textdomain('default', $mofile);
} }
function load_plugin_textdomain($domain, $path = 'wp-content/plugins') { function load_plugin_textdomain($domain, $path = 'wp-content/plugins') {
$locale = get_locale(); $locale = get_locale();
$mofile = ABSPATH . "$path/$domain-$locale.mo"; $mofile = ABSPATH . "$path/$domain-$locale.mo";
load_textdomain($domain, $mofile); load_textdomain($domain, $mofile);
} }
function load_theme_textdomain($domain) { function load_theme_textdomain($domain) {
$locale = get_locale(); $locale = get_locale();
$mofile = get_template_directory() . "/$locale.mo"; $mofile = get_template_directory() . "/$locale.mo";
load_textdomain($domain, $mofile); load_textdomain($domain, $mofile);
} }

View File

@ -28,7 +28,7 @@ case 'logout':
$redirect_to = 'wp-login.php'; $redirect_to = 'wp-login.php';
if ( isset($_REQUEST['redirect_to']) ) if ( isset($_REQUEST['redirect_to']) )
$redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']); $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']);
wp_redirect($redirect_to); wp_redirect($redirect_to);
exit(); exit();
@ -139,7 +139,7 @@ case 'resetpass' :
$new_pass = substr( md5( uniqid( microtime() ) ), 0, 7); $new_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
$wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'"); $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
wp_cache_delete($user->ID, 'users'); wp_cache_delete($user->ID, 'users');
wp_cache_delete($user->user_login, 'userlogins'); wp_cache_delete($user->user_login, 'userlogins');
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
$message .= get_settings('siteurl') . "/wp-login.php\r\n"; $message .= get_settings('siteurl') . "/wp-login.php\r\n";
@ -190,11 +190,11 @@ default:
if ( $user_login && $user_pass ) { if ( $user_login && $user_pass ) {
$user = new WP_User(0, $user_login); $user = new WP_User(0, $user_login);
// If the user can't edit posts, send them to their profile. // If the user can't edit posts, send them to their profile.
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) ) if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
$redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php';
if ( wp_login($user_login, $user_pass, $using_cookie) ) { if ( wp_login($user_login, $user_pass, $using_cookie) ) {
if ( !$using_cookie ) if ( !$using_cookie )
wp_setcookie($user_login, $user_pass, false, '', '', $rememberme); wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
@ -202,7 +202,7 @@ default:
wp_redirect($redirect_to); wp_redirect($redirect_to);
exit; exit;
} else { } else {
if ( $using_cookie ) if ( $using_cookie )
$error = __('Your session has expired.'); $error = __('Your session has expired.');
} }
} }

View File

@ -81,11 +81,11 @@ for ($i=1; $i <= $count; $i++) :
} }
$date_arr = explode(' ', $ddate); $date_arr = explode(' ', $ddate);
$date_time = explode(':', $date_arr[3]); $date_time = explode(':', $date_arr[3]);
$ddate_H = $date_time[0]; $ddate_H = $date_time[0];
$ddate_i = $date_time[1]; $ddate_i = $date_time[1];
$ddate_s = $date_time[2]; $ddate_s = $date_time[2];
$ddate_m = $date_arr[1]; $ddate_m = $date_arr[1];
$ddate_d = $date_arr[0]; $ddate_d = $date_arr[0];
$ddate_Y = $date_arr[2]; $ddate_Y = $date_arr[2];

View File

@ -14,9 +14,9 @@ case 'register':
$user_login = sanitize_user( $_POST['user_login'] ); $user_login = sanitize_user( $_POST['user_login'] );
$user_email = $_POST['user_email']; $user_email = $_POST['user_email'];
$errors = array(); $errors = array();
if ( $user_login == '' ) if ( $user_login == '' )
$errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.'); $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
@ -45,7 +45,7 @@ case 'register':
else else
wp_new_user_notification($user_id, $password); wp_new_user_notification($user_id, $password);
} }
if ( 0 == count($errors) ) { if ( 0 == count($errors) ) {
?> ?>
@ -53,7 +53,7 @@ case 'register':
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>WordPress &raquo; <?php _e('Registration Complete') ?></title> <title>WordPress &raquo; <?php _e('Registration Complete') ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" /> <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
<style type="text/css"> <style type="text/css">
.submit { .submit {

View File

@ -9,7 +9,7 @@ function unregister_GLOBALS() {
// Variables that shouldn't be unset // Variables that shouldn't be unset
$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
foreach ( $input as $k => $v ) foreach ( $input as $k => $v )
if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) )
@ -27,7 +27,7 @@ if ( ! isset($blog_id) )
// Fix for IIS, which doesn't set REQUEST_URI // Fix for IIS, which doesn't set REQUEST_URI
if ( empty( $_SERVER['REQUEST_URI'] ) ) { if ( empty( $_SERVER['REQUEST_URI'] ) ) {
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI? $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI?
// Append the query string if it exists and isn't null // Append the query string if it exists and isn't null
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];

View File

@ -577,7 +577,7 @@ class wp_xmlrpc_server extends IXR_Server {
$post_category[] = get_cat_ID($cat); $post_category[] = get_cat_ID($cat);
} }
} }
// We've got all the data -- post it: // We've got all the data -- post it:
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping'); $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');
@ -623,7 +623,7 @@ class wp_xmlrpc_server extends IXR_Server {
$catnames = $content_struct['categories']; $catnames = $content_struct['categories'];
$post_category = array(); $post_category = array();
if (is_array($catnames)) { if (is_array($catnames)) {
foreach ($catnames as $cat) { foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat); $post_category[] = get_cat_ID($cat);
@ -861,7 +861,7 @@ class wp_xmlrpc_server extends IXR_Server {
logIO('O', '(MW) Could not write file '.$name); logIO('O', '(MW) Could not write file '.$name);
return new IXR_Error(500, 'Could not write file '.$name); return new IXR_Error(500, 'Could not write file '.$name);
} }
return array('url' => $upload['url']); return array('url' => $upload['url']);
} }
@ -995,7 +995,7 @@ class wp_xmlrpc_server extends IXR_Server {
foreach($categories as $cat) { foreach($categories as $cat) {
$catids[] = $cat['categoryId']; $catids[] = $cat['categoryId'];
} }
wp_set_post_cats('', $post_ID, $catids); wp_set_post_cats('', $post_ID, $catids);
return true; return true;
@ -1199,11 +1199,11 @@ class wp_xmlrpc_server extends IXR_Server {
$linea = strip_tags( $linea, '<a>' ); // just keep the tag we need $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
$p = explode( "\n\n", $linea ); $p = explode( "\n\n", $linea );
$sem_regexp_pb = "/(\\/|\\\|\*|\?|\+|\.|\^|\\$|\(|\)|\[|\]|\||\{|\})/"; $sem_regexp_pb = "/(\\/|\\\|\*|\?|\+|\.|\^|\\$|\(|\)|\[|\]|\||\{|\})/";
$sem_regexp_fix = "\\\\$1"; $sem_regexp_fix = "\\\\$1";
$link = preg_replace( $sem_regexp_pb, $sem_regexp_fix, $pagelinkedfrom ); $link = preg_replace( $sem_regexp_pb, $sem_regexp_fix, $pagelinkedfrom );
$finished = false; $finished = false;
foreach ( $p as $para ) { foreach ( $p as $para ) {
if ( $finished ) if ( $finished )
@ -1238,7 +1238,7 @@ class wp_xmlrpc_server extends IXR_Server {
wp_new_comment($commentdata); wp_new_comment($commentdata);
do_action('pingback_post', $wpdb->insert_id); do_action('pingback_post', $wpdb->insert_id);
return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"; return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
} }