diff --git a/readme.html b/readme.html index 2a630165a..0b156fbfb 100644 --- a/readme.html +++ b/readme.html @@ -16,17 +16,17 @@ margin-right: 25%; padding: .2em 2em; } - + h1 { color: #006; font-size: 18px; font-weight: lighter; } - + h2 { font-size: 16px; } - + p, li, dt { line-height: 140%; padding-bottom: 2px; diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index bf8692ab3..67c4de93a 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -14,7 +14,7 @@ function get_others_drafts( $user_id ) { $level_key = $wpdb->prefix . 'user_level'; $editable = get_editable_user_ids( $user_id ); - + if( !$editable ) { $other_drafts = ''; } else { @@ -42,9 +42,9 @@ function get_editable_authors( $user_id ) { function get_editable_user_ids( $user_id, $exclude_zeros = true ) { global $wpdb; - + $user = new WP_User( $user_id ); - + if ( ! $user->has_cap('edit_others_posts') ) { if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) 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'"; if ( $exclude_zeros ) $query .= " AND meta_value != '0'"; - + return $wpdb->get_col( $query ); } @@ -111,7 +111,7 @@ function wp_insert_category($catarr) { } 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'"); } - + if ( $category_nicename == '' ) { $category_nicename = sanitize_title($cat_name, $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) { global $wpdb; - + $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'"); if ( $output == OBJECT ) { @@ -258,7 +258,7 @@ function get_link($link_id, $output = OBJECT) { function wp_insert_link($linkdata) { global $wpdb, $current_user; - + extract($linkdata); $update = false; @@ -266,14 +266,14 @@ function wp_insert_link($linkdata) { $update = true; if ( empty($link_rating) ) - $link_rating = 0; + $link_rating = 0; if ( empty($link_target) ) - $link_target = ''; + $link_target = ''; if ( empty($link_visible) ) $link_visible = 'Y'; - + if ( empty($link_owner) ) $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')"); $link_id = $wpdb->insert_id; } - + if ( $update ) do_action('edit_link', $link_id); else @@ -305,12 +305,12 @@ function wp_update_link($linkdata) { global $wpdb; $link_id = (int) $linkdata['link_id']; - + $link = get_link($link_id, ARRAY_A); - + // Escape data pulled from DB. $link = add_magic_quotes($link); - + // Merge old and new fields with new fields overwriting old ones. $linkdata = array_merge($link, $linkdata); @@ -321,7 +321,7 @@ function wp_delete_link($link_id) { global $wpdb; 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 = '') { diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 231a27be8..dd8707011 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -6,7 +6,7 @@ function write_post() { if ( 'page' == $_POST['post_type'] ) { 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 { if ( !current_user_can('edit_posts') ) 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 ( 'page' == $_POST['post_type'] ) { + if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can('edit_others_pages') ) die(__('You cannot create pages as this user.')); } else { if ( !current_user_can('edit_others_posts') ) die(__('You cannot post as this user.')); - + } } @@ -52,7 +52,7 @@ function write_post() { if ( 'page' == $_POST['post_type'] ) { if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages')) - $_POST['post_status'] = 'draft'; + $_POST['post_status'] = 'draft'; } else { if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; @@ -140,7 +140,7 @@ function edit_post() { if ( 'page' == $_POST['post_type'] ) { 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 { if ( !current_user_can('edit_post', $post_ID) ) die(__('You are not allowed to edit this post.')); @@ -163,13 +163,13 @@ function edit_post() { } if ($_POST['post_author'] != $_POST['user_ID']) { - if ( 'page' == $_POST['post_type'] ) { + if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can('edit_others_pages') ) die(__('You cannot edit pages as this user.')); } else { if ( !current_user_can('edit_others_posts') ) die(__('You cannot edit posts as this user.')); - + } } @@ -185,7 +185,7 @@ function edit_post() { if ( 'page' == $_POST['post_type'] ) { if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages')) - $_POST['post_status'] = 'draft'; + $_POST['post_status'] = 'draft'; } else { if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts')) $_POST['post_status'] = 'draft'; @@ -217,7 +217,7 @@ function edit_post() { foreach ($_POST['meta'] as $key => $value) update_meta($key, $value['key'], $value['value']); } - + if ($_POST['deletemeta']) { foreach ($_POST['deletemeta'] as $key => $value) delete_meta($key); @@ -464,13 +464,13 @@ function edit_user($user_id = 0) { function get_link_to_edit($link_id) { $link = get_link($link_id); - + $link->link_url = wp_specialchars($link->link_url, 1); $link->link_name = wp_specialchars($link->link_name, 1); $link->link_description = wp_specialchars($link->link_description); $link->link_notes = wp_specialchars($link->link_notes); $link->link_rss = wp_specialchars($link->link_rss); - + return $link; } @@ -479,17 +479,17 @@ function get_default_link_to_edit() { $link->link_url = wp_specialchars($_GET['linkurl'], 1); else $link->link_url = ''; - + if ( isset($_GET['name']) ) $link->link_name = wp_specialchars($_GET['name'], 1); else $link->link_name = ''; - + return $link; } function add_link() { - return edit_link(); + return edit_link(); } function edit_link($link_id = '') { @@ -502,7 +502,7 @@ function edit_link($link_id = '') { $_POST['link_image'] = wp_specialchars($_POST['link_image']); $_POST['link_rss'] = wp_specialchars($_POST['link_rss']); $auto_toggle = get_autotoggle($_POST['link_category']); - + // 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. // 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); } } - + usort($result, 'sort_cats'); return $result; @@ -615,7 +615,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) { if ( current_user_can('manage_categories') ) { $edit = "".__('Edit').""; $default_cat_id = get_option('default_category'); - + if ($category->cat_ID != $default_cat_id) $edit .= "cat_ID, '".sprintf(__("You are about to delete the category "%s". All of its posts will go to the default category.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete').""; else @@ -699,7 +699,7 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev function link_category_dropdown($fieldname, $selected = 0) { global $wpdb; - + $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); echo "\n -post_title = stripslashes($post_title); else $post->post_title = $popuptitle; - + $content = wp_specialchars($_REQUEST['content']); $popupurl = wp_specialchars($_REQUEST['popupurl']); diff --git a/wp-admin/cat-js.php b/wp-admin/cat-js.php index 156e8f5c4..ad147b511 100644 --- a/wp-admin/cat-js.php +++ b/wp-admin/cat-js.php @@ -67,7 +67,7 @@ function newCatCompletion() { var id = 0; var ids = new Array(); var names = new Array(); - + ids = myPload( ajaxCat.response ); names = myPload( newcat.value ); for ( i = 0; i < ids.length; i++ ) { @@ -80,9 +80,9 @@ function newCatCompletion() { p.innerHTML = ""; return; } - + var exists = document.getElementById('category-' + id); - + if (exists) { var moveIt = exists.parentNode; var container = moveIt.parentNode; @@ -100,20 +100,20 @@ function newCatCompletion() { newLabel.setAttribute('for', 'category-' + id); newLabel.id = 'new-category-' + id; newLabel.className = 'selectit fade'; - + var newCheck = document.createElement('input'); newCheck.type = 'checkbox'; newCheck.value = id; newCheck.name = 'post_category[]'; newCheck.id = 'category-' + id; newLabel.appendChild(newCheck); - + var newLabelText = document.createTextNode(' ' + names[i]); newLabel.appendChild(newLabelText); - + catDiv.insertBefore(newLabel, catDiv.firstChild); newCheck.checked = 'checked'; - + Fat.fade_all(); newLabel.className = 'selectit'; } diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 79163a985..8f2f81caf 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -27,7 +27,7 @@ case 'addcat': if ( !current_user_can('manage_categories') ) die (__('Cheatin’ uh?')); - + wp_insert_category($_POST); header('Location: categories.php?message=1#addcat'); @@ -96,7 +96,7 @@ break; case 'editedcat': if ( !current_user_can('manage_categories') ) die (__('Cheatin’ uh?')); - + wp_update_category($_POST); header('Location: categories.php?message=3'); diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index e74ebb49d..32ec092ae 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -88,9 +88,9 @@ if ('view' == $mode) { if ($i % 2) $class .= ' alternate'; echo "
  • "; -?> +?>

    comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | |

    - +

    - + ', __('Import Users')); echo ''; } - + function import_users() { // User Import $users = $this->get_dc_users(); $this->users2wp($users); - + echo '
    '; printf('', __('Import Posts')); echo '
    '; } - + function import_posts() { // Post Import $posts = $this->get_dc_posts(); $this->posts2wp($posts); - + echo '
    '; printf('', __('Import Comments')); echo '
    '; } - + function import_comments() { // Comment Import $comments = $this->get_dc_comments(); $this->comments2wp($comments); - + echo '
    '; printf('', __('Import Links')); echo '
    '; } - + function import_links() { //Link Import $links = $this->get_dc_links(); $this->links2wp($links); add_option('dc_links', $links); - + echo '
    '; printf('', __('Finish')); echo '
    '; } - + function cleanup_dcimport() { delete_option('tpre'); @@ -617,7 +617,7 @@ class Dotclear_Import { delete_option('dccharset'); $this->tips(); } - + function tips() { echo '

    '.__('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.').'

    '; @@ -636,7 +636,7 @@ class Dotclear_Import { echo ''; echo '

    '.sprintf(__('That\'s it! What are you waiting for? Go login!'), '/wp-login.php').'

    '; } - + function db_form() { echo ''; } - + function dispatch() { @@ -657,26 +657,26 @@ class Dotclear_Import { else $step = (int) $_GET['step']; $this->header(); - + if ( $step > 0 ) { if($_POST['dbuser']) { if(get_option('dcuser')) - delete_option('dcuser'); + delete_option('dcuser'); add_option('dcuser',$_POST['dbuser']); } if($_POST['dbpass']) { if(get_option('dcpass')) - delete_option('dcpass'); + delete_option('dcpass'); add_option('dcpass',$_POST['dbpass']); } - + if($_POST['dbname']) { if(get_option('dcname')) - delete_option('dcname'); + delete_option('dcname'); add_option('dcname',$_POST['dbname']); } if($_POST['dbhost']) @@ -690,13 +690,13 @@ class Dotclear_Import { if(get_option('dccharset')) delete_option('dccharset'); add_option('dccharset',$_POST['dccharset']); - } + } if($_POST['dbprefix']) { if(get_option('tpre')) delete_option('tpre'); add_option('tpre',$_POST['dbprefix']); - } + } } @@ -726,13 +726,13 @@ class Dotclear_Import { $this->cleanup_dcimport(); break; } - + $this->footer(); } function Dotclear_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/import/livejournal.php b/wp-admin/import/livejournal.php index e8c48c4ad..40c14fce7 100644 --- a/wp-admin/import/livejournal.php +++ b/wp-admin/import/livejournal.php @@ -18,7 +18,7 @@ class LJ_Import { $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } - + function greet() { echo '

    '.__('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.').'

    '; wp_import_upload_form("admin.php?import=livejournal&step=1"); @@ -26,7 +26,7 @@ class LJ_Import { function import_posts() { global $wpdb, $current_user; - + set_magic_quotes_runtime(0); $importdata = file($this->file); // Read the file into an array $importdata = implode('', $importdata); // squish it @@ -35,7 +35,7 @@ class LJ_Import { preg_match_all('|(.*?)|is', $importdata, $posts); $posts = $posts[1]; unset($importdata); - echo '
      '; + echo '
        '; foreach ($posts as $post) { flush(); preg_match('|(.*?)|is', $post, $post_title); @@ -78,7 +78,7 @@ class LJ_Import { preg_match_all('|(.*?)|is', $post, $comments); $comments = $comments[1]; - + if ( $comments ) { $comment_post_ID = $post_id; $num_comments = 0; @@ -134,7 +134,7 @@ class LJ_Import { $this->file = $file['file']; $this->import_posts(); wp_import_cleanup($file['id']); - + echo '

        '; printf(__('All done. Have fun!'), get_option('home')); echo '

        '; @@ -147,7 +147,7 @@ class LJ_Import { $step = (int) $_GET['step']; $this->header(); - + switch ($step) { case 0 : $this->greet(); @@ -156,12 +156,12 @@ class LJ_Import { $this->import(); break; } - + $this->footer(); } function LJ_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php index 3281f0877..0fdb0ce7a 100644 --- a/wp-admin/import/mt.php +++ b/wp-admin/import/mt.php @@ -379,7 +379,7 @@ class MT_Import { } if ( $num_pings ) printf(__('(%s pings)'), $num_pings); - + echo ""; } flush(); @@ -420,7 +420,7 @@ class MT_Import { } function MT_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php index e4a81673d..69972f3e0 100644 --- a/wp-admin/import/rss.php +++ b/wp-admin/import/rss.php @@ -19,7 +19,7 @@ class RSS_Import { $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } - + function greet() { echo '

        '.__('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.').'

        '; wp_import_upload_form("admin.php?import=rss&step=1"); @@ -27,7 +27,7 @@ class RSS_Import { function get_posts() { global $wpdb; - + set_magic_quotes_runtime(0); $datalines = file($this->file); // Read the file into an array $importdata = implode('', $datalines); // squish it @@ -134,7 +134,7 @@ class RSS_Import { $this->get_posts(); $this->import_posts(); wp_import_cleanup($file['id']); - + echo '

        '; printf(__('All done. Have fun!'), get_option('home')); echo '

        '; @@ -147,7 +147,7 @@ class RSS_Import { $step = (int) $_GET['step']; $this->header(); - + switch ($step) { case 0 : $this->greet(); @@ -156,12 +156,12 @@ class RSS_Import { $this->import(); break; } - + $this->footer(); } function RSS_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php index 29010812d..17cae8710 100644 --- a/wp-admin/import/textpattern.php +++ b/wp-admin/import/textpattern.php @@ -7,10 +7,10 @@ if(!function_exists('get_catbynicename')) function get_catbynicename($category_nicename) { global $wpdb; - + $cat_id -= 0; // force numeric $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"'); - + return $name; } } @@ -49,7 +49,7 @@ class Textpattern_Import { { echo ''; } - + function greet() { echo '

        '.__('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.').'

        '; @@ -67,7 +67,7 @@ class Textpattern_Import { $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - + // Get Categories return $txpdb->get_results('SELECT id, @@ -77,7 +77,7 @@ class Textpattern_Import { WHERE type = "article"', ARRAY_A); } - + function get_txp_users() { global $wpdb; @@ -85,9 +85,9 @@ class Textpattern_Import { $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - + // Get Users - + return $txpdb->get_results('SELECT user_id, name, @@ -96,14 +96,14 @@ class Textpattern_Import { privs FROM '.$prefix.'txp_users', ARRAY_A); } - + function get_txp_posts() { // General Housekeeping $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - + // Get Posts return $txpdb->get_results('SELECT ID, @@ -122,7 +122,7 @@ class Textpattern_Import { FROM '.$prefix.'textpattern ', ARRAY_A); } - + function get_txp_comments() { global $wpdb; @@ -130,18 +130,18 @@ class Textpattern_Import { $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - + // Get Comments return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A); } - + function get_txp_links() { //General Housekeeping $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost')); set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - + return $txpdb->get_results('SELECT id, date, @@ -152,7 +152,7 @@ class Textpattern_Import { FROM '.$prefix.'txp_link', ARRAY_A); } - + function cat2wp($categories='') { // General Housekeeping @@ -167,12 +167,12 @@ class Textpattern_Import { { $count++; extract($category); - - + + // Make Nice Variables $name = $wpdb->escape($name); $title = $wpdb->escape($title); - + if($cinfo = category_exists($name)) { $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; } - + // Store category translation for future use add_option('txpcat2wpcat',$txpcat2wpcat); echo '

        '.sprintf(__('Done! %1$s categories imported.'), $count).'

        '; @@ -192,14 +192,14 @@ class Textpattern_Import { echo __('No Categories to Import!'); return false; } - + function users2wp($users='') { // General Housekeeping global $wpdb; $count = 0; $txpid2wpid = array(); - + // Midnight Mojo if(is_array($users)) { @@ -208,14 +208,14 @@ class Textpattern_Import { { $count++; extract($user); - + // Make Nice Variables $name = $wpdb->escape($name); $RealName = $wpdb->escape($RealName); - + if($uinfo = get_userdatabylogin($name)) { - + $ret_id = wp_insert_user(array( 'ID' => $uinfo->ID, 'user_login' => $name, @@ -236,10 +236,10 @@ class Textpattern_Import { ); } $txpid2wpid[$user_id] = $ret_id; - + // Set Textpattern-to-WordPress permissions translation $transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0'); - + // Update Usermeta Data $user = new WP_User($ret_id); if('10' == $transperms[$privs]) { $user->set_role('administrator'); } @@ -249,24 +249,24 @@ class Textpattern_Import { if('3' == $transperms[$privs]) { $user->set_role('contributor'); } if('2' == $transperms[$privs]) { $user->set_role('contributor'); } if('0' == $transperms[$privs]) { $user->set_role('subscriber'); } - + update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] ); update_usermeta( $ret_id, 'rich_editing', 'false'); }// End foreach($users as $user) - + // Store id translation array for future use add_option('txpid2wpid',$txpid2wpid); - - + + echo '

        '.sprintf(__('Done! %1$s users imported.'), $count).'

        '; return true; }// End if(is_array($users) - + echo __('No Users to Import!'); return false; - + }// End function user2wp() - + function posts2wp($posts='') { // General Housekeeping @@ -283,10 +283,10 @@ class Textpattern_Import { { $count++; extract($post); - + // Set Textpattern-to-WordPress status translation $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish'); - + //Can we do this more efficiently? $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1; $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ; @@ -295,9 +295,9 @@ class Textpattern_Import { $Body = $wpdb->escape($Body); $Excerpt = $wpdb->escape($Excerpt); $post_status = $stattrans[$Status]; - + // Import Post data into WordPress - + if($pinfo = post_exists($Title,$Body)) { $ret_id = wp_insert_post(array( @@ -332,7 +332,7 @@ class Textpattern_Import { ); } $txpposts2wpposts[$ID] = $ret_id; - + // Make Post-to-Category associations $cats = array(); if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; } @@ -343,11 +343,11 @@ class Textpattern_Import { } // Store ID translation for later use add_option('txpposts2wpposts',$txpposts2wpposts); - + echo '

        '.sprintf(__('Done! %1$s posts imported.'), $count).'

        '; - return true; + return true; } - + function comments2wp($comments='') { // General Housekeeping @@ -355,7 +355,7 @@ class Textpattern_Import { $count = 0; $txpcm2wpcm = array(); $postarr = get_option('txpposts2wpposts'); - + // Magic Mojo if(is_array($comments)) { @@ -364,7 +364,7 @@ class Textpattern_Import { { $count++; extract($comment); - + // WordPressify Data $comment_ID = ltrim($discussid, '0'); $comment_post_ID = $postarr[$parentid]; @@ -373,7 +373,7 @@ class Textpattern_Import { $email = $wpdb->escape($email); $web = $wpdb->escape($web); $message = $wpdb->escape($message); - + if($cinfo = comment_exists($name, $posted)) { // Update comments @@ -405,25 +405,25 @@ class Textpattern_Import { $txpcm2wpcm[$comment_ID] = $ret_id; } // Store Comment ID translation for future use - add_option('txpcm2wpcm', $txpcm2wpcm); - + add_option('txpcm2wpcm', $txpcm2wpcm); + // Associate newly formed categories with posts get_comment_count($ret_id); - - + + echo '

        '.sprintf(__('Done! %1$s comments imported.'), $count).'

        '; return true; } echo __('No Comments to Import!'); return false; } - + function links2wp($links='') { // General Housekeeping global $wpdb; $count = 0; - + // Deal with the links if(is_array($links)) { @@ -432,12 +432,12 @@ class Textpattern_Import { { $count++; extract($link); - + // Make nice vars $category = $wpdb->escape($category); $linkname = $wpdb->escape($linkname); $description = $wpdb->escape($description); - + if($linfo = link_exists($linkname)) { $ret_id = wp_insert_link(array( @@ -470,67 +470,67 @@ class Textpattern_Import { echo __('No Links to Import!'); return false; } - + function import_categories() - { - // Category Import + { + // Category Import $cats = $this->get_txp_cats(); $this->cat2wp($cats); add_option('txp_cats', $cats); - - - + + + echo '
        '; printf('', __('Import Users')); echo '
        '; } - + function import_users() { // User Import $users = $this->get_txp_users(); $this->users2wp($users); - + echo '
        '; printf('', __('Import Posts')); echo '
        '; } - + function import_posts() { // Post Import $posts = $this->get_txp_posts(); $this->posts2wp($posts); - + echo '
        '; printf('', __('Import Comments')); echo '
        '; } - + function import_comments() { // Comment Import $comments = $this->get_txp_comments(); $this->comments2wp($comments); - + echo '
        '; printf('', __('Import Links')); echo '
        '; } - + function import_links() { //Link Import $links = $this->get_txp_links(); $this->links2wp($links); add_option('txp_links', $links); - + echo '
        '; printf('', __('Finish')); echo '
        '; } - + function cleanup_txpimport() { delete_option('tpre'); @@ -546,7 +546,7 @@ class Textpattern_Import { delete_option('txphost'); $this->tips(); } - + function tips() { echo '

        '.__('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.').'

        '; @@ -565,7 +565,7 @@ class Textpattern_Import { echo ''; echo '

        '.sprintf(__('That\'s it! What are you waiting for? Go login!'), '/wp-login.php').'

        '; } - + function db_form() { echo '
          '; @@ -576,7 +576,7 @@ class Textpattern_Import { printf('
        • ', __('Textpattern Table prefix (if any):')); echo '
        '; } - + function dispatch() { @@ -585,26 +585,26 @@ class Textpattern_Import { else $step = (int) $_GET['step']; $this->header(); - + if ( $step > 0 ) { if($_POST['dbuser']) { if(get_option('txpuser')) - delete_option('txpuser'); + delete_option('txpuser'); add_option('txpuser',$_POST['dbuser']); } if($_POST['dbpass']) { if(get_option('txppass')) - delete_option('txppass'); + delete_option('txppass'); add_option('txppass',$_POST['dbpass']); } - + if($_POST['dbname']) { if(get_option('txpname')) - delete_option('txpname'); + delete_option('txpname'); add_option('txpname',$_POST['dbname']); } if($_POST['dbhost']) @@ -618,7 +618,7 @@ class Textpattern_Import { if(get_option('tpre')) delete_option('tpre'); add_option('tpre',$_POST['dbprefix']); - } + } } @@ -648,13 +648,13 @@ class Textpattern_Import { $this->cleanup_txpimport(); break; } - + $this->footer(); } function Textpattern_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/install.php b/wp-admin/install.php index bedf19502..7d778e9f2 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -33,17 +33,17 @@ header( 'Content-Type: text/html; charset=utf-8' ); margin-right: 20%; padding: .2em 2em; } - + h1 { color: #006; font-size: 18px; font-weight: lighter; } - + h2 { font-size: 16px; } - + p, li, dt { line-height: 140%; padding-bottom: 2px; @@ -127,7 +127,7 @@ if (empty($admin_email)) { } else if (!is_email($admin_email)) { die (__("ERROR: the e-mail address isn't correct")); } - + ?>

        diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 5626570f8..e179c37de 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -128,7 +128,7 @@ switch ($action) { check_admin_referer(); add_link(); - + header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true'); break; } // end Add @@ -137,7 +137,7 @@ switch ($action) { { check_admin_referer(); - + if (isset($links_show_cat_id) && ($links_show_cat_id != '')) $cat_id = $links_show_cat_id; @@ -149,7 +149,7 @@ switch ($action) { $link_id = (int) $_POST['link_id']; edit_link($link_id); - + setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600); wp_redirect($this_file); break; @@ -165,7 +165,7 @@ switch ($action) { $link_id = (int) $_GET['link_id']; wp_delete_link($link_id); - + if (isset($links_show_cat_id) && ($links_show_cat_id != '')) $cat_id = $links_show_cat_id; @@ -184,12 +184,12 @@ switch ($action) { include_once ('admin-header.php'); if ( !current_user_can('manage_links') ) die(__('You do not have sufficient permissions to edit the links for this blog.')); - + $link_id = (int) $_GET['link_id']; - + if ( !$link = get_link_to_edit($link_id) ) die( __('Link not found.') ); - + include('edit-link-form.php'); break; } // end linkedit @@ -370,7 +370,7 @@ function checkAll(form) ?> > link_name; ?>
        -link_description) . ""; echo "link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url"; echo <<comment_post_ID) ) + if ( !current_user_can('edit_post', $comment->comment_post_ID) ) die('-1'); if ( wp_delete_comment($comment->comment_ID) ) { @@ -77,5 +77,5 @@ case 'delete-link-category' : die('0'); } break; -endswitch; +endswitch; ?> diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 352e3458f..d3ba3308b 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -13,7 +13,7 @@ foreach ($menu as $item) { if ( current_user_can($item[1]) ) { if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") ) - echo "\n\t
      1. {$item[0]}
      2. "; + echo "\n\t
      3. {$item[0]}
      4. "; else echo "\n\t
      5. {$item[0]}
      6. "; } diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index 48a8b23a3..9166536dc 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -115,7 +115,7 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored } ?> - +
        set_permalink_structure($permalink_structure); } - + if ( isset($_POST['category_base']) ) { $category_base = $_POST['category_base']; if (! empty($category_base) ) @@ -72,7 +72,7 @@ if ( isset($_POST) ) { $wp_rewrite->set_category_base($category_base); } } - + $permalink_structure = get_settings('permalink_structure'); $category_base = get_settings('category_base'); @@ -141,7 +141,7 @@ $structures = array( checked="checked" /> - +

        diff --git a/wp-admin/options.php b/wp-admin/options.php index de5999c65..8895bcef4 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -28,7 +28,7 @@ switch($action) { case 'update': $any_changed = 0; - + check_admin_referer(); if (!$_POST['page_options']) { @@ -52,11 +52,11 @@ case 'update': $value = trim(stripslashes($_POST[$option])); if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) $value = 'closed'; - + if( $option == 'blogdescription' || $option == 'blogname' ) if (current_user_can('unfiltered_html') == false) $value = wp_filter_post_kses( $value ); - + if (update_option($option, $value) ) { $any_changed++; } diff --git a/wp-admin/page-new.php b/wp-admin/page-new.php index 717989fbb..4d8216b25 100644 --- a/wp-admin/page-new.php +++ b/wp-admin/page-new.php @@ -14,7 +14,7 @@ require_once('admin-header.php'); if ( current_user_can('edit_pages') ) { $action = 'post'; get_currentuserinfo(); - + $post = get_default_post_to_edit(); $post->post_type = 'page'; diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index 37aed6b0c..573497588 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -52,16 +52,16 @@ case 'update': break; default: - + require_once('admin-header.php'); if ( !current_user_can('edit_plugins') ) die('

        '.__('You have do not have sufficient permissions to edit plugins for this blog.').'

        '); update_recently_edited("wp-content/plugins/$file"); - + if (!is_file($real_file)) $error = 1; - + if (!$error) { $f = fopen($real_file, 'r'); $content = fread($f, filesize($real_file)); diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 69d31ec01..583494813 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -3,7 +3,7 @@ require_once('admin.php'); if ( isset($_GET['action']) ) { check_admin_referer(); - + if ('activate' == $_GET['action']) { $current = get_settings('active_plugins'); if (!in_array($_GET['plugin'], $current)) { @@ -36,7 +36,7 @@ $check_plugins = get_settings('active_plugins'); // empty array. if ( !is_array($check_plugins) ) { $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 @@ -91,7 +91,7 @@ if (empty($plugins)) { function sort_plugins($plug1, $plug2) { return strnatcasecmp($plug1['Name'], $plug2['Name']); } - + uksort($plugins, 'sort_plugins'); foreach($plugins as $plugin_file => $plugin_data) { diff --git a/wp-admin/post.php b/wp-admin/post.php index 34f4d05ef..4160ce57c 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -71,7 +71,7 @@ case 'edit': die ( __('You are not allowed to edit this post.') ); $post = get_post_to_edit($post_ID); - + if ($post->post_type == 'page') include('edit-page-form.php'); else @@ -130,8 +130,8 @@ case 'delete': $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_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.') ); if ( $post->post_type == 'attachment' ) { @@ -161,7 +161,7 @@ case 'editcomment': if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), '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.') ); $comment = get_comment_to_edit($comment); @@ -180,7 +180,7 @@ case 'confirmdeletecomment': if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), '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.') ); echo "
        \n"; @@ -223,7 +223,7 @@ case 'deletecomment': if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), '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.') ); wp_set_comment_status($comment->comment_ID, "delete"); @@ -252,7 +252,7 @@ case 'unapprovecomment': if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), '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.') ); wp_set_comment_status($comment->comment_ID, "hold"); @@ -272,7 +272,7 @@ case 'mailapprovecomment': if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), '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.') ); if ('1' != $comment->comment_approved) { @@ -298,7 +298,7 @@ case 'approvecomment': if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), '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.') ); wp_set_comment_status($comment->comment_ID, "approve"); diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 38efd2b7b..d2c28297d 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -103,7 +103,7 @@ switch($step) { '.__('You have do not have sufficient permissions to edit templates for this blog.').'

        '); @@ -71,7 +71,7 @@ default: if (!is_file($real_file)) $error = true; - + if (!$error) { $f = @ fopen($real_file, 'r'); if ( $f ) { @@ -88,7 +88,7 @@ default:

        - +
        '.__('You have do not have sufficient permissions to edit themes for this blog.').'

        '); update_recently_edited($file); - + if (!is_file($real_file)) $error = 1; - + if (!$error && filesize($real_file) > 0) { $f = fopen($real_file, 'r'); $content = fread($f, filesize($real_file)); diff --git a/wp-admin/themes.php b/wp-admin/themes.php index a17ea3cdc..5a3bd980d 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -3,16 +3,16 @@ require_once('admin.php'); if ( isset($_GET['action']) ) { check_admin_referer(); - + if ('activate' == $_GET['action']) { if ( isset($_GET['template']) ) update_option('template', $_GET['template']); - + if ( isset($_GET['stylesheet']) ) update_option('stylesheet', $_GET['stylesheet']); - + do_action('switch_theme', get_current_theme()); - + header('Location: themes.php?activated=true'); exit; } @@ -102,7 +102,7 @@ if ( count($broken_themes) ) { flush_rules(); - + 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"); foreach ($categories as $category) { if ('' == $category->category_nicename) { @@ -77,7 +77,7 @@ function upgrade_100() { else: $catwhere = ''; endif; - + $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere"); if ($allposts) : foreach ($allposts as $post) { @@ -111,7 +111,7 @@ function upgrade_101() { function upgrade_110() { global $wpdb; - + // Set user_nicename. $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); foreach ($users as $user) { @@ -280,7 +280,7 @@ function upgrade_160() { $id = $wpdb->escape( $id ); $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'"); endif; - + // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set. $caps = get_usermeta( $user->ID, $table_prefix . 'capabilities'); if ( empty($caps) || defined('RESET_CAPS') ) { @@ -288,14 +288,14 @@ function upgrade_160() { $role = translate_level_to_role($level); update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) ); } - + 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' ); $wpdb->hide_errors(); foreach ( $old_user_fields as $old ) $wpdb->query("ALTER TABLE $wpdb->users DROP $old"); $wpdb->show_errors(); - + if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); foreach ( $categories as $cat_id ) { @@ -321,7 +321,7 @@ function upgrade_160() { post_mime_type = '$object->post_type', post_type = '' WHERE ID = $object->ID"); - + $meta = get_post_meta($object->ID, 'imagedata', true); if ( ! empty($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 ) { // Update status and type. $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); - + if ( ! empty($posts) ) foreach ($posts as $post) { $status = $post->post_status; $type = 'post'; @@ -345,15 +345,15 @@ function upgrade_210() { $type = 'page'; } else if ( 'attachment' == $status ) { $status = 'inherit'; - $type = 'attachment'; + $type = 'attachment'; } - + $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'"); } } - + if ( $wp_current_db_version < 3513 ) { - populate_roles_210(); + populate_roles_210(); } } @@ -477,17 +477,17 @@ function deslash($content) { function dbDelta($queries, $execute = true) { global $wpdb; - + // Seperate individual queries into an array if( !is_array($queries) ) { $queries = explode( ';', $queries ); if('' == $queries[count($queries) - 1]) array_pop($queries); } - + $cqueries = array(); // Creation Queries $iqueries = array(); // Insertion Queries $for_update = array(); - + // Create a tablename index for an array ($cqueries) of queries foreach($queries as $qry) { if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { @@ -506,7 +506,7 @@ function dbDelta($queries, $execute = true) { else { // Unrecognized query type } - } + } // Check to see which tables and fields exist if($tables = $wpdb->get_col('SHOW TABLES;')) { @@ -525,13 +525,13 @@ function dbDelta($queries, $execute = true) { $flds = explode("\n", $qryline); //echo "
        \n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."

        "; - + // For every field line specified in the query foreach($flds as $fld) { // Extract the field name preg_match("|^([^ ]*)|", trim($fld), $fvals); $fieldname = $fvals[1]; - + // Verify the found field name $validfield = true; switch(strtolower($fieldname)) @@ -547,18 +547,18 @@ function dbDelta($queries, $execute = true) { break; } $fld = trim($fld); - + // If it's a valid field, add it to the field array if($validfield) { $cfields[strtolower($fieldname)] = trim($fld, ", \n"); } } - + // Fetch the table column structure from the database $tablefields = $wpdb->get_results("DESCRIBE {$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(array_key_exists(strtolower($tablefield->Field), $cfields)) { // 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)]; $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; } - + // Get the default value from the array //echo "{$cfields[strtolower($tablefield->Field)]}
        "; 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"; $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname; } - + // Index stuff goes here // Fetch the table index structure from the database $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};"); - + if($tableindices) { // Clear the index array unset($index_ary); @@ -631,7 +631,7 @@ function dbDelta($queries, $execute = true) { } $index_columns = ''; // 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 .= ','; // Add the field to the column list string $index_columns .= $column_data['fieldname']; diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index d27921880..196ed77bf 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -257,7 +257,7 @@ function populate_roles_160() { add_role('author', __('Author')); add_role('contributor', __('Contributor')); add_role('subscriber', __('Subscriber')); - + // Add caps for Administrator role $role = get_role('administrator'); $role->add_cap('switch_themes'); @@ -290,7 +290,7 @@ function populate_roles_160() { $role->add_cap('level_2'); $role->add_cap('level_1'); $role->add_cap('level_0'); - + // Add caps for Editor role $role = get_role('editor'); $role->add_cap('moderate_comments'); @@ -312,7 +312,7 @@ function populate_roles_160() { $role->add_cap('level_2'); $role->add_cap('level_1'); $role->add_cap('level_0'); - + // Add caps for Author role $role = get_role('author'); $role->add_cap('upload_files'); @@ -323,14 +323,14 @@ function populate_roles_160() { $role->add_cap('level_2'); $role->add_cap('level_1'); $role->add_cap('level_0'); - + // Add caps for Contributor role $role = get_role('contributor'); $role->add_cap('edit_posts'); $role->add_cap('read'); $role->add_cap('level_1'); $role->add_cap('level_0'); - + // Add caps for Subscriber role $role = get_role('subscriber'); $role->add_cap('read'); @@ -354,14 +354,14 @@ function populate_roles_210() { $role->add_cap('delete_others_posts'); $role->add_cap('delete_published_posts'); } - - $role = get_role('author'); + + $role = get_role('author'); if ( ! empty($role) ) { $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) ) { $role->add_cap('delete_posts'); } diff --git a/wp-admin/upgrade.php b/wp-admin/upgrade.php index 53eb15492..9c9ba81d3 100644 --- a/wp-admin/upgrade.php +++ b/wp-admin/upgrade.php @@ -27,17 +27,17 @@ header( 'Content-Type: text/html; charset=utf-8' ); margin-right: 20%; padding: .2em 2em; } - + h1 { color: #006; font-size: 18px; font-weight: lighter; } - + h2 { font-size: 16px; } - + p, li, dt { line-height: 140%; padding-bottom: 2px; @@ -73,7 +73,7 @@ switch($step) {

        set_role($_POST['new_role']); } - + header('Location: users.php?update=' . $update); break; @@ -49,7 +49,7 @@ case 'dodelete': die(__('You can’t delete users.')); $userids = $_POST['users']; - + $update = 'del'; foreach ($userids as $id) { if($id == $current_user->id) { @@ -132,27 +132,27 @@ break; case 'adduser': check_admin_referer(); - + $errors = add_user(); - + if(count($errors) == 0) { header('Location: users.php?update=add'); die(); } default: - + include ('admin-header.php'); - + $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;"); - + foreach($userids as $userid) { $tmp_user = new WP_User($userid); $roles = $tmp_user->roles; $role = array_shift($roles); $roleclasses[$role][$tmp_user->user_login] = $tmp_user; - } - + } + ?> - +

        @@ -250,9 +250,9 @@ default: echo ''; echo ''; } - + ?> - + diff --git a/wp-content/plugins/wp-db-backup.php b/wp-content/plugins/wp-db-backup.php index d8d714217..b32860832 100644 --- a/wp-content/plugins/wp-db-backup.php +++ b/wp-content/plugins/wp-db-backup.php @@ -36,12 +36,12 @@ class wpdbBackup { } function wpdbBackup() { - + add_action('wp_cron_daily', array(&$this, 'wp_cron_daily')); $this->backup_dir = trailingslashit($this->backup_dir); $this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); - + if (isset($_POST['do_backup'])) { switch($_POST['do_backup']) { case 'backup': @@ -49,7 +49,7 @@ class wpdbBackup { break; case 'fragments': add_action('admin_menu', array(&$this, 'fragment_menu')); - break; + break; } } elseif (isset($_GET['fragment'] )) { add_action('init', array(&$this, 'init')); @@ -59,7 +59,7 @@ class wpdbBackup { add_action('admin_menu', array(&$this, 'admin_menu')); } } - + function init() { global $user_level; get_currentuserinfo(); @@ -68,9 +68,9 @@ class wpdbBackup { if (isset($_GET['backup'])) { $via = isset($_GET['via']) ? $_GET['via'] : 'http'; - + $this->backup_file = $_GET['backup']; - + switch($via) { case 'smtp': case 'email': @@ -101,14 +101,14 @@ class wpdbBackup { die(); } - + function build_backup_script() { global $table_prefix, $wpdb; - + $datum = date("Ymd_B"); $backup_filename = DB_NAME . "_$table_prefix$datum.sql"; if ($this->gzip()) $backup_filename .= '.gz'; - + echo "
        "; //echo "
        " . print_r($_POST, 1) . "
        "; echo '

        ' . __('Backup') . '

        @@ -143,19 +143,19 @@ class wpdbBackup { } function backup(table, segment) { - var fram = document.getElementById("backuploader"); + var fram = document.getElementById("backuploader"); fram.src = "' . $_SERVER['REQUEST_URI'] . '&fragment=" + table + ":" + segment + ":' . $backup_filename . '"; } - + var curStep = 0; - + function nextStep() { backupStep(curStep); curStep++; } - + function finishBackup() { - var fram = document.getElementById("backuploader"); + var fram = document.getElementById("backuploader"); setMeter(100); '; @@ -179,15 +179,15 @@ class wpdbBackup { setProgress("' . sprintf(__("Backup complete, download here."), $download_uri) . '"); '; } - + echo ' } - + function backupStep(step) { switch(step) { case 0: backup("", 0); break; '; - + $also_backup = array(); if (isset($_POST['other_tables'])) { $also_backup = $_POST['other_tables']; @@ -210,7 +210,7 @@ class wpdbBackup { $step_count++; } echo "case {$step_count}: finishBackup(); break;"; - + echo ' } if(step != 0) setMeter(100 * step / ' . $step_count . '); @@ -224,9 +224,9 @@ class wpdbBackup { function backup_fragment($table, $segment, $filename) { global $table_prefix, $wpdb; - + echo "$table:$segment:$filename"; - + if($table == '') { $msg = __('Creating backup file...'); } else { @@ -236,12 +236,12 @@ class wpdbBackup { $msg = sprintf(__('Backing up table \\"%s\\"...'), $table); } } - + echo ' '; } - + die(); } @@ -304,7 +304,7 @@ class wpdbBackup { if (isset($_POST['other_tables'])) { $also_backup = $_POST['other_tables']; } - + $core_tables = $_POST['core_tables']; $this->backup_file = $this->db_backup($core_tables, $also_backup); if (FALSE !== $backup_file) { @@ -318,7 +318,7 @@ class wpdbBackup { $this->backup_complete = true; } } - + /////////////////////////////// function admin_menu() { add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu')); @@ -387,7 +387,7 @@ class wpdbBackup { fclose($fp); } } - + ////////////// function stow($query_line) { if ($this->gzip()) { @@ -402,7 +402,7 @@ class wpdbBackup { } } } - + function backup_error($err) { if(count($this->backup_errors) < 20) { $this->backup_errors[] = $err; @@ -410,16 +410,16 @@ class wpdbBackup { $this->backup_errors[] = __('Subsequent errors have been omitted from this log.'); } } - + ///////////////////////////// function backup_table($table, $segment = 'none') { global $wpdb; - + /* Taken partially from phpMyAdmin and partially from Alain Wolf, Zurich - Switzerland Website: http://restkultur.ch/personal/wolf/scripts/db_backup/ - + Modified by Scott Merril (http://www.skippy.net/) to use the WordPress $wpdb object */ @@ -429,7 +429,7 @@ class wpdbBackup { backup_errors(__('Error getting table details') . ": $table"); return FALSE; } - + if(($segment == 'none') || ($segment == 0)) { // // Add SQL statement to drop existing table @@ -439,7 +439,7 @@ class wpdbBackup { $this->stow("#\n"); $this->stow("\n"); $this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n"); - + // //Table structure // Comment in SQL-file @@ -448,19 +448,19 @@ class wpdbBackup { $this->stow("# Table structure of table " . $this->backquote($table) . "\n"); $this->stow("#\n"); $this->stow("\n"); - + $create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N); if (FALSE === $create_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($create_table[0][1] . ' ;'); - + if (FALSE === $table_structure) { $this->backup_error(sprintf(__("Error getting table structure of %s"), $table)); $this->stow("#\n# Error getting table structure of $table!\n#\n"); } - + // // Comment in SQL-file $this->stow("\n\n"); @@ -468,7 +468,7 @@ class wpdbBackup { $this->stow('# Data contents of table ' . $this->backquote($table) . "\n"); $this->stow("#\n"); } - + if(($segment == 'none') || ($segment >= 0)) { $ints = array(); foreach ($table_structure as $struct) { @@ -481,10 +481,10 @@ class wpdbBackup { $ints[strtolower($struct->Field)] = "1"; } } - - + + // Batch by $row_inc - + if($segment == 'none') { $row_start = 0; $row_inc = ROWS_PER_SEGMENT; @@ -492,8 +492,8 @@ class wpdbBackup { $row_start = $segment * ROWS_PER_SEGMENT; $row_inc = ROWS_PER_SEGMENT; } - - do { + + do { 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); @@ -503,8 +503,8 @@ class wpdbBackup { 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 $search = array("\x00", "\x0a", "\x0d", "\x1a"); $replace = array('\0', '\n', '\r', '\Z'); @@ -524,8 +524,8 @@ class wpdbBackup { } } while((count($table_data) > 0) and ($segment=='none')); } - - + + if(($segment == 'none') || ($segment < 0)) { // Create footer/closing comment in SQL-file $this->stow("\n"); @@ -534,9 +534,9 @@ class wpdbBackup { $this->stow("# --------------------------------------------------------\n"); $this->stow("\n"); } - + } // end backup_table() - + function return_bytes($val) { $val = trim($val); $last = strtolower($val{strlen($val)-1}); @@ -549,20 +549,20 @@ class wpdbBackup { case 'k': $val *= 1024; } - + return $val; } - + //////////////////////////// function db_backup($core_tables, $other_tables) { global $table_prefix, $wpdb; - + $datum = date("Ymd_B"); $wp_backup_filename = DB_NAME . "_$table_prefix$datum.sql"; if ($this->gzip()) { $wp_backup_filename .= '.gz'; } - + if (is_writable(ABSPATH . $this->backup_dir)) { $this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename); if(!$this->fp) { @@ -573,7 +573,7 @@ class wpdbBackup { $this->backup_error(__('The backup directory is not writeable!')); return false; } - + //Begin new backup of MySql $this->stow("# WordPress MySQL database backup\n"); $this->stow("#\n"); @@ -581,12 +581,12 @@ class wpdbBackup { $this->stow("# Hostname: " . DB_HOST . "\n"); $this->stow("# Database: " . $this->backquote(DB_NAME) . "\n"); $this->stow("# --------------------------------------------------------\n"); - + if ( (is_array($other_tables)) && (count($other_tables) > 0) ) $tables = array_merge($core_tables, $other_tables); else $tables = $core_tables; - + foreach ($tables as $table) { // Increase script execution time-limit to 15 min for every table. if ( !ini_get('safe_mode')) @set_time_limit(15*60); @@ -596,21 +596,21 @@ class wpdbBackup { $this->stow("# --------------------------------------------------------\n"); $this->backup_table($table); } - + $this->close($this->fp); - + if (count($this->backup_errors)) { return false; } else { return $wp_backup_filename; } - + } //wp_db_backup - + /////////////////////////// function deliver_backup ($filename = '', $delivery = 'http', $recipient = '') { if ('' == $filename) { return FALSE; } - + $diskfile = ABSPATH . $this->backup_dir . $filename; if ('http' == $delivery) { if (! file_exists($diskfile)) { @@ -640,7 +640,7 @@ class wpdbBackup { $headers = "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\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)); // Add a multipart boundary above the plain message $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-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; - + // Add file attachment to the message $message .= "--{$boundary}\n" . "Content-Type: application/octet-stream;\n" . @@ -658,24 +658,24 @@ class wpdbBackup { "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$boundary}--\n"; - + if (function_exists('wp_mail')) { wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); } else { mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); } - + unlink($diskfile); } return; } - + //////////////////////////// function backup_menu() { global $table_prefix, $wpdb; $feedback = ''; $WHOOPS = FALSE; - + // did we just do a backup? If so, let's report the status if ( $this->backup_complete ) { $feedback = '

        ' . __('Backup Successful') . '!'; @@ -698,7 +698,7 @@ class wpdbBackup { } $feedback .= '

        '; } - + if (count($this->backup_errors)) { $feedback .= '
        ' . __('The following errors were reported:') . "
        ";
         			foreach($this->backup_errors as $error) {
        @@ -706,7 +706,7 @@ class wpdbBackup {
         			}
         			$feedback .= "
        "; } - + // did we just save options for wp-cron? if ( (function_exists('wp_cron_init')) && isset($_POST['wp_cron_backup_options']) ) { update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE); @@ -716,23 +716,23 @@ class wpdbBackup { } $feedback .= '

        ' . __('Scheduled Backup Options Saved!') . '

        '; } - + // Simple table name storage $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta'); // 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); - + $other_tables = 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 = 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!) $wp_backup_default_tables = array_intersect($all_tables, $wp_table_names); // Get list of non-WP tables $other_tables = array_diff($all_tables, $wp_backup_default_tables); - + if ('' != $feedback) { echo $feedback; } @@ -749,7 +749,7 @@ class wpdbBackup { $WHOOPS = TRUE; } } - + if ( !is_writable( ABSPATH . $this->backup_dir) ) { echo '

        ' . __('WARNING: Your backup directory is NOT writable! We can not create the backup directory.') . '
        ' . ABSPATH . "

        "; } @@ -781,21 +781,21 @@ class wpdbBackup { echo ''; echo '
        '; echo ''; - + // Check DB dize. $table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME)); $core_size = $db_size = 0; foreach($table_status as $table) { $table_size = $table->Data_length - $table->Data_free; if(in_array($table->Name, $wp_backup_default_tables)) { - $core_size += $table_size; + $core_size += $table_size; } $db_size += $table_size; } $mem_limit = ini_get('memory_limit'); $mem_limit = $this->return_bytes($mem_limit); $mem_limit = ($mem_limit == 0) ? 8*1024*1024 : $mem_limit - 2000000; - + if (! $WHOOPS) { echo '
        '; echo '

        '; @@ -804,7 +804,7 @@ class wpdbBackup { } echo ''; echo ''; - + // this stuff only displays if wp_cron is installed if (function_exists('wp_cron_init')) { echo '
        ' . __('Scheduled Backup') . ''; @@ -850,20 +850,20 @@ class wpdbBackup { echo '
        '; } // end of wp_cron section - + echo '
        '; - + }// end wp_backup_menu() - + ///////////////////////////// function wp_cron_daily() { - + $schedule = intval(get_option('wp_cron_backup_schedule')); if (0 == $schedule) { // Scheduled backup is disabled return; } - + global $table_prefix, $wpdb; $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); $core_tables = array_intersect($all_tables, $wp_table_names); $other_tables = get_option('wp_cron_backup_tables'); - + $recipient = get_option('wp_cron_backup_recipient'); - + $backup_file = $this->db_backup($core_tables, $other_tables); if (FALSE !== $backup_file) { $this->deliver_backup ($backup_file, 'smtp', $recipient); } - + return; } // wp_cron_db_backup } diff --git a/wp-content/themes/classic/comments-popup.php b/wp-content/themes/classic/comments-popup.php index f42d38dce..7a209a212 100644 --- a/wp-content/themes/classic/comments-popup.php +++ b/wp-content/themes/classic/comments-popup.php @@ -103,7 +103,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH 'si", // strip out javascript "'<[\/\!]*?[^<>]*?>'si", // strip out html tags "'([\r\n])[\s]+'", // strip out white space @@ -728,9 +728,9 @@ class Snoopy "Ü", "ß", ); - + $text = preg_replace($search,$replace,$document); - + return $text; } @@ -744,7 +744,7 @@ class Snoopy function _expandlinks($links,$URI) { - + preg_match("/^[^\?]+/",$URI,$match); $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]); @@ -752,21 +752,21 @@ class Snoopy $match_part = parse_url($match); $match_root = $match_part["scheme"]."://".$match_part["host"]; - + $search = array( "|^http://".preg_quote($this->host)."|i", "|^(\/)|i", "|^(?!http://)(?!mailto:)|i", "|/\./|", "|/[^\/]+/\.\./|" ); - + $replace = array( "", $match_root."/", $match."/", "/", "/" - ); - + ); + $expandedLinks = preg_replace($search,$replace,$links); return $expandedLinks; @@ -779,19 +779,19 @@ class Snoopy $fp the current open file pointer $URI the full URI $body body contents to send if any (POST) - Output: + Output: \*======================================================================*/ - + function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="") { $cookie_headers = ''; if($this->passcookies && $this->_redirectaddr) $this->setcookies(); - + $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; - $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; + $headers = $http_method." ".$url." ".$this->_httpversion."\r\n"; if(!empty($this->agent)) $headers .= "User-Agent: ".$this->agent."\r\n"; if(!empty($this->host) && !isset($this->rawheaders['Host'])) { @@ -805,10 +805,10 @@ class Snoopy if(!empty($this->referer)) $headers .= "Referer: ".$this->referer."\r\n"; if(!empty($this->cookies)) - { + { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; - + reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_headers .= 'Cookie: '; @@ -831,28 +831,28 @@ class Snoopy $headers .= "; boundary=".$this->_mime_boundary; $headers .= "\r\n"; } - if(!empty($body)) + if(!empty($body)) $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"; - + //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 .= "\r\n"; - + // set the read timeout if needed if ($this->read_timeout > 0) socket_set_timeout($fp, $this->read_timeout); $this->timed_out = false; - + fwrite($fp,$headers.$body,strlen($headers.$body)); - + $this->_redirectaddr = false; unset($this->headers); - + while($currentHeader = fgets($fp,$this->_maxlinelen)) { if ($this->read_timeout > 0 && $this->_check_timeout($fp)) @@ -860,10 +860,10 @@ class Snoopy $this->status=-100; return false; } - + if($currentHeader == "\r\n") break; - + // if a header begins with Location: or URI:, set the redirect if(preg_match("/^(Location:|URI:)/i",$currentHeader)) { @@ -883,16 +883,16 @@ class Snoopy else $this->_redirectaddr = $matches[2]; } - + if(preg_match("|^HTTP/|",$currentHeader)) { if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status)) { $this->status= $status[1]; - } + } $this->response_code = $currentHeader; } - + $this->headers[] = $currentHeader; } @@ -910,13 +910,13 @@ class Snoopy $this->status=-100; return false; } - + // check if there is a a redirect meta tag - + if(preg_match("']*?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? @@ -932,7 +932,7 @@ class Snoopy // no framed content else $this->results = $results; - + return true; } @@ -942,21 +942,21 @@ class Snoopy Input: $url the url to fetch $URI the full URI $body body contents to send if any (POST) - Output: + Output: \*======================================================================*/ - + function _httpsrequest($url,$URI,$http_method,$content_type="",$body="") { if($this->passcookies && $this->_redirectaddr) $this->setcookies(); - $headers = array(); - + $headers = array(); + $URI_PARTS = parse_url($URI); if(empty($url)) $url = "/"; // GET ... header not needed for curl - //$headers[] = $http_method." ".$url." ".$this->_httpversion; + //$headers[] = $http_method." ".$url." ".$this->_httpversion; if(!empty($this->agent)) $headers[] = "User-Agent: ".$this->agent; if(!empty($this->host)) @@ -969,10 +969,10 @@ class Snoopy if(!empty($this->referer)) $headers[] = "Referer: ".$this->referer; if(!empty($this->cookies)) - { + { if(!is_array($this->cookies)) $this->cookies = (array)$this->cookies; - + reset($this->cookies); if ( count($this->cookies) > 0 ) { $cookie_str = 'Cookie: '; @@ -995,44 +995,44 @@ class Snoopy else $headers[] = "Content-type: $content_type"; } - if(!empty($body)) + if(!empty($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); - + for($curr_header = 0; $curr_header < count($headers); $curr_header++) { $safer_header = strtr( $headers[$curr_header], "\"", " " ); $cmdline_params .= " -H \"".$safer_header."\""; } - + if(!empty($body)) $cmdline_params .= " -d \"$body\""; - + if($this->read_timeout > 0) $cmdline_params .= " -m ".$this->read_timeout; - + $headerfile = tempnam($temp_dir, "sno"); $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); - + if($return) { $this->error = "Error: cURL could not retrieve the document, error $return."; return false; } - - + + $results = implode("\r\n",$results); - + $result_headers = file("$headerfile"); - + $this->_redirectaddr = false; unset($this->headers); - + for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) { - + // if a header begins with Location: or URI:, set the redirect if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) { @@ -1052,7 +1052,7 @@ class Snoopy else $this->_redirectaddr = $matches[2]; } - + if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) $this->response_code = $result_headers[$currentHeader]; @@ -1060,10 +1060,10 @@ class Snoopy } // check if there is a a redirect meta tag - + if(preg_match("']*?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? @@ -1081,7 +1081,7 @@ class Snoopy $this->results = $results; unlink("$headerfile"); - + return true; } @@ -1089,7 +1089,7 @@ class Snoopy Function: setcookies() Purpose: set cookies for a redirection \*======================================================================*/ - + function setcookies() { for($x=0; $xheaders); $x++) @@ -1099,7 +1099,7 @@ class Snoopy } } - + /*======================================================================*\ Function: _check_timeout Purpose: checks whether timeout has occurred @@ -1123,13 +1123,13 @@ class Snoopy Purpose: make a socket connection Input: $fp file pointer \*======================================================================*/ - + function _connect(&$fp) { if(!empty($this->proxy_host) && !empty($this->proxy_port)) { $this->_isproxy = true; - + $host = $this->proxy_host; $port = $this->proxy_port; } @@ -1138,9 +1138,9 @@ class Snoopy $host = $this->host; $port = $this->port; } - + $this->status = 0; - + if($fp = fsockopen( $host, $port, @@ -1176,13 +1176,13 @@ class Snoopy Purpose: disconnect a socket connection Input: $fp file pointer \*======================================================================*/ - + function _disconnect($fp) { return(fclose($fp)); } - + /*======================================================================*\ Function: _prepare_post_body Purpose: Prepare post body according to encoding type @@ -1190,7 +1190,7 @@ class Snoopy $formfiles - form upload files Output: post body \*======================================================================*/ - + function _prepare_post_body($formvars, $formfiles) { settype($formvars, "array"); @@ -1199,7 +1199,7 @@ class Snoopy if (count($formvars) == 0 && count($formfiles) == 0) return; - + switch ($this->_submit_type) { case "application/x-www-form-urlencoded": reset($formvars); @@ -1215,7 +1215,7 @@ class Snoopy case "multipart/form-data": $this->_mime_boundary = "Snoopy".md5(uniqid(microtime())); - + reset($formvars); while(list($key,$val) = each($formvars)) { if (is_array($val) || is_object($val)) { @@ -1230,7 +1230,7 @@ class Snoopy $postdata .= "$val\r\n"; } } - + reset($formfiles); while (list($field_name, $file_names) = each($formfiles)) { settype($file_names, "array"); diff --git a/wp-includes/classes.php b/wp-includes/classes.php index ef6f9a611..d576565e0 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -53,7 +53,7 @@ class WP_Query { $this->is_admin = false; $this->is_attachment = false; } - + function init () { unset($this->posts); unset($this->query); @@ -63,7 +63,7 @@ class WP_Query { $this->post_count = 0; $this->current_post = -1; $this->in_the_loop = false; - + $this->init_query_flags(); } @@ -97,7 +97,7 @@ class WP_Query { $qv['attachment'] = $qv['subpost']; if ( '' != $qv['subpost_id'] ) $qv['attachment_id'] = $qv['subpost_id']; - + if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) { $this->is_single = true; $this->is_attachment = true; @@ -226,7 +226,7 @@ class WP_Query { if ('' != $qv['comments_popup']) { $this->is_comments_popup = true; } - + //if we're previewing inside the write screen if ('' != $qv['preview']) { $this->is_preview = true; @@ -247,9 +247,9 @@ class WP_Query { function set_404() { $this->init_query_flags(); - $this->is_404 = true; + $this->is_404 = true; } - + function get($query_var) { if (isset($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)); // Shorthand. - $q = $this->query_vars; + $q = $this->query_vars; // First let's clear some variables $whichcat = ''; @@ -306,7 +306,7 @@ class WP_Query { $q['page'] = trim($q['page'], '/'); $q['page'] = (int) $q['page']; } - + $add_hours = intval(get_settings('gmt_offset')); $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)"; @@ -372,7 +372,7 @@ class WP_Query { $page_paths = '/' . trim($q['pagename'], '/'); $q['pagename'] = sanitize_title(basename($page_paths)); $q['name'] = $q['pagename']; - + $where .= " AND (ID = '$reqpage')"; } elseif ('' != $q['attachment']) { $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment']))); @@ -489,11 +489,11 @@ class WP_Query { $partial_match = $cat_id; } } - + //if we don't match the entire hierarchy fallback on just matching the nicename if (!$q['cat'] && $partial_match) { $q['cat'] = $partial_match; - } + } $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) "; @@ -541,7 +541,7 @@ class WP_Query { $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); $whichauthor .= ' AND (post_author = '.intval($q['author']).')'; } - + $where .= $search.$whichcat.$whichauthor; if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) { @@ -597,7 +597,7 @@ class WP_Query { if ( is_user_logged_in() ) $where .= " OR post_author = $user_ID AND post_status = 'private')"; else - $where .= ')'; + $where .= ')'; } // Apply filters on where and join prior to paging so that any @@ -680,7 +680,7 @@ class WP_Query { if ($this->post_count > 0) { $this->post = $this->posts[0]; } - + // Save any changes made to the query vars. $this->query_vars = $q; return $this->posts; @@ -841,7 +841,7 @@ class retrospam_mgr { $head = '

        ' . __('Check Comments Results:') . '

        '; $foot .= '

        ' . __('« Return to Discussion Options page.') . '

        '; - + return $head . $body . $foot; } // End function display_edit_form @@ -922,7 +922,7 @@ class WP_Rewrite { return false; else return true; - } + } function using_index_permalinks() { if (empty($this->permalink_structure)) { @@ -942,7 +942,7 @@ class WP_Rewrite { return true; else return false; - } + } function preg_index($number) { $match_prefix = '$'; @@ -987,7 +987,7 @@ class WP_Rewrite { $this->date_structure = ''; return false; } - + // The date permalink must have year, month, and day separated by slashes. $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 .= '%category%'; - + return $this->category_structure; } @@ -1153,10 +1153,10 @@ class WP_Rewrite { // 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 // the arrays. - $position = array_search($tag, $this->rewritecode); + $position = array_search($tag, $this->rewritecode); if (FALSE !== $position && NULL !== $position) { $this->rewritereplace[$position] = $pattern; - $this->queryreplace[$position] = $query; + $this->queryreplace[$position] = $query; } else { $this->rewritecode[] = $tag; $this->rewritereplace[] = $pattern; @@ -1174,7 +1174,7 @@ class WP_Rewrite { $trackbackregex = 'trackback/?$'; $pageregex = 'page/?([0-9]{1,})/?$'; - + $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); preg_match_all('/%.+?%/', $permalink_structure, $tokens); @@ -1304,7 +1304,7 @@ class WP_Rewrite { // Date $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct()); $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite); - + // Root $root_rewrite = $this->generate_rewrite_rules($this->root . '/'); $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite); @@ -1372,7 +1372,7 @@ class WP_Rewrite { $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . "RewriteCond %{REQUEST_FILENAME} -d\n" . "RewriteRule ^.*$ - [S=$num_rules]\n"; - + foreach ($rewrite as $match => $query) { // Apache 1.3 does not support the reluctant (non-greedy) modifier. $match = str_replace('.+?', '.+', $match); @@ -1382,7 +1382,7 @@ class WP_Rewrite { if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { //nada. } - + if (strstr($query, $this->index)) { $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; } else { @@ -1413,7 +1413,7 @@ class WP_Rewrite { function init() { $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 = ''; if ($this->using_index_permalinks()) { $this->root = $this->index . '/'; @@ -1493,7 +1493,7 @@ class WP { // Trim path info from the end and the leading home path from the // front. For path info requests, this leaves us with the requesting // filename, if any. For 404 requests, this leaves us with the - // requested permalink. + // requested permalink. $req_uri = str_replace($pathinfo, '', $req_uri); $req_uri = trim($req_uri, '/'); $req_uri = preg_replace("|^$home_path|", '', $req_uri); @@ -1562,10 +1562,10 @@ class WP { if (isset($error)) unset($error); - + if ( isset($query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') ) unset($query_vars); - + $this->did_permalink = false; } } @@ -1619,7 +1619,7 @@ class WP { // 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; - // Make a timestamp for our most recent modification... + // Make a timestamp for our most recent modification... $wp_modified_timestamp = strtotime($wp_last_modified); if ( ($client_last_modified && $client_etag) ? diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 8b9c30e5a..bada2dc45 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -41,7 +41,7 @@ function wp_new_comment( $commentdata ) { $commentdata['comment_date'] = current_time('mysql'); $commentdata['comment_date_gmt'] = current_time('mysql', 1); - + $commentdata = wp_filter_comment($commentdata); @@ -230,7 +230,7 @@ function get_comments_number( $post_id = 0 ) { if ( !isset($comment_count_cache[$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]); } @@ -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') { global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb; global $comment_count_cache; - + if (! is_single() && ! is_page()) { 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';"); - + $number = $comment_count_cache[$id]; - + if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) { echo $none; return; @@ -344,7 +344,7 @@ function comment_author() { function get_comment_author_email() { 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() { @@ -616,7 +616,7 @@ function pingback($content, $post_ID) { // Debug debug_fwrite($log, 'Post contents:'); debug_fwrite($log, $content."\n"); - + // Step 2. // Walking thru the links array // 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 $client->debug = false; - + if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) ) add_ping( $post_ID, $pagelinkedto ); else @@ -769,7 +769,7 @@ function is_local_attachment($url) { $post = & get_post($id); if ( 'attachment' == $post->post_status ) return true; - } + } return false; } @@ -795,7 +795,7 @@ function wp_set_comment_status($comment_id, $comment_status) { if ($wpdb->query($query)) { do_action('wp_set_comment_status', $comment_id, $comment_status); - + $comment = get_comment($comment_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'" ); @@ -809,7 +809,7 @@ function wp_set_comment_status($comment_id, $comment_status) { function wp_get_comment_status($comment_id) { global $wpdb; - + $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); if ($result == NULL) { 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 // spam words don't break things: $word = preg_quote($word, '#'); - + $pattern = "#$word#i"; if ( preg_match($pattern, $author) ) return false; if ( preg_match($pattern, $email) ) return false; diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 6f955e8bc..c593bc862 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -32,7 +32,7 @@ function wptexturize($text) { $curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl); $curl = preg_replace("/ \(tm\)/i", ' ™', $curl); $curl = str_replace("''", '”', $curl); - + $curl = preg_replace('/(\d+)x(\d+)/', "$1×$2", $curl); } elseif (strstr($curl, ']*>)\s*
        !', "$1", $pee); $pee = preg_replace('!
        (\s*)!', '$1', $pee); $pee = preg_replace('!()(.*?)!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '' ", $pee); - + return $pee; } @@ -239,7 +239,7 @@ function remove_accents($string) { chr(197).chr(190) => 'z', chr(197).chr(191) => 's', // Euro Sign chr(226).chr(130).chr(172) => 'E'); - + $string = strtr($string, $chars); } else { // Assume ISO-8859-1 if not UTF-8 @@ -374,10 +374,10 @@ function convert_chars($content, $flag = 'obsolete') { function funky_javascript_fix($text) { // Fixes for browsers' javascript bugs global $is_macIE, $is_winIE; - + if ( $is_winIE || $is_macIE ) $text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text); - + return $text; } @@ -401,7 +401,7 @@ function funky_javascript_fix($text) { 1.0 First Version */ function balanceTags($text, $is_comment = 0) { - + if ( get_option('use_balanceTags') == 0) return $text; diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 606997cbb..af5a8db0a 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -31,7 +31,7 @@ function wp_insert_post($postarr = array()) { $post_name = apply_filters('name_save_pre', $post_name); $comment_status = apply_filters('comment_status_pre', $comment_status); $ping_status = apply_filters('ping_status_pre', $ping_status); - + // Make sure we set a valid category if (0 == count($post_category) || !is_array($post_category)) { $post_category = array(get_option('default_category')); @@ -59,7 +59,7 @@ function wp_insert_post($postarr = array()) { } else { $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 (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) 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_ID = $wpdb->insert_id; + $post_ID = $wpdb->insert_id; } 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'"); do_action('private_to_published', $post_ID); } - + do_action('edit_post', $post_ID); } @@ -251,7 +251,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { $update = false; if ( !empty($ID) ) { $update = true; - $post_ID = $ID; + $post_ID = $ID; } // 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); else $post_name = sanitize_title($post_name); - + if (empty($post_date)) $post_date = current_time('mysql'); 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) 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_ID = $wpdb->insert_id; + $post_ID = $wpdb->insert_id; } - + if ( empty($post_name) ) { $post_name = sanitize_title($post_title, $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 { do_action('add_attachment', $post_ID); } - + return $post_ID; } @@ -395,7 +395,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) { global $wpdb; $post = get_post($postid, $mode); - + // Set categories if($mode == OBJECT) { $post->post_category = wp_get_post_cats('',$postid); @@ -428,7 +428,7 @@ function wp_update_post($postarr = array()) { $postarr = get_object_vars($postarr); // 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. $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. $postarr = array_merge($post, $postarr); - $postarr['post_category'] = $post_cats; + $postarr['post_category'] = $post_cats; if ( $clear_date ) { $postarr['post_date'] = ''; $postarr['post_date_gmt'] = ''; @@ -475,7 +475,7 @@ function wp_publish_post($post_id) { function wp_get_post_cats($blogid = '1', $post_ID = 0) { global $wpdb; - + $sql = "SELECT category_id FROM $wpdb->post2cat 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 (!is_array($post_categories) || 0 == count($post_categories)) $post_categories = array(get_option('default_category')); - + $post_categories = array_unique($post_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 FROM $wpdb->post2cat WHERE post_id = $post_ID"); - + if (!$old_categories) { $old_categories = array(); } else { @@ -532,13 +532,13 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array( VALUES ($post_ID, $new_cat)"); } } - + // Update category counts. $all_affected_cats = array_unique(array_merge($post_categories, $old_categories)); 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'"); $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() @@ -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("DELETE FROM $wpdb->posts WHERE ID = $postid"); - + $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_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 function get_cat_name($cat_id) { global $wpdb; - + $cat_id -= 0; // force numeric $name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id"); - + return $name; } // Get the ID of a category from its name function get_cat_ID($cat_name='General') { global $wpdb; - + $cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'"); return $cid?$cid:1; // default to cat 1 @@ -639,14 +639,14 @@ function trackback_url_list($tb_list, $post_id) { // import postdata as variables extract($postdata); - + // form an excerpt $excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content); - + if (strlen($excerpt) > 255) { $excerpt = substr($excerpt,0,252) . '...'; } - + $trackback_urls = explode(',', $tb_list); foreach($trackback_urls as $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 // spam words don't break things: $word = preg_quote($word, '#'); - + $pattern = "#$word#i"; if ( preg_match($pattern, $author ) ) 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_agent) ) return true; } - + if ( isset($_SERVER['REMOTE_ADDR']) ) { 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'"); return; } - + if (empty($post->post_excerpt)) $excerpt = apply_filters('the_content', $post->post_content); else @@ -812,7 +812,7 @@ function get_page_hierarchy($posts, $parent = 0) { function generate_page_uri_index() { global $wpdb; - + //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'")); //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(); if ($posts) { - + foreach ($posts as $id => $post) { // URI => page name @@ -839,7 +839,7 @@ function generate_page_uri_index() { } update_option('page_uris', $page_uris); - + if ( $page_attachment_uris ) update_option('page_attachment_uris', $page_attachment_uris); } @@ -903,7 +903,7 @@ function wp_mkdir_p($target) { return true; } else { if ( is_dir(dirname($target)) ) - return false; + return false; } // 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"); $upload = wp_upload_dir(); - + if ( $upload['error'] !== false ) return $upload; @@ -972,7 +972,7 @@ function wp_upload_bits($name, $type, $bits) { else $filename = str_replace("$number$ext", ++$number . $ext, $filename); } - + $new_file = $upload['path'] . "/$filename"; 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)); @@ -982,7 +982,7 @@ function wp_upload_bits($name, $type, $bits) { $ifp = @ fopen($new_file, 'wb'); if ( ! $ifp ) return array('error' => "Could not write file $new_file."); - + $success = @ fwrite($ifp, $bits); fclose($ifp); // Set correct file permissions diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 665b39769..dd23ed502 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -22,7 +22,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) { 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)); - + if ( -1 == $i || false == $i ) $i = 0; @@ -304,7 +304,7 @@ function get_option($option) { function get_user_option( $option, $user = 0 ) { global $wpdb, $current_user; - + if ( empty($user) ) $user = $current_user; else @@ -657,7 +657,7 @@ function set_page_path($page) { $curpage = get_page($curpage->post_parent); $path = '/' . $curpage->post_name . $path; } - + $page->fullpath = $path; return $page; @@ -726,7 +726,7 @@ function &get_page(&$page, $output = OBJECT) { wp_cache_add($_page->ID, $_page, 'pages'); } } - + if (!isset($_page->fullpath)) { $_page = set_page_path($_page); wp_cache_replace($_page->ID, $_page, 'pages'); @@ -751,7 +751,7 @@ function set_category_path($cat) { $curcat = get_category($curcat->category_parent); $path = '/' . $curcat->category_nicename . $path; } - + $cat->fullpath = $path; return $cat; @@ -777,7 +777,7 @@ function &get_category(&$category, $output = OBJECT) { if ( !isset($_category->fullpath) ) { $_category = set_category_path($_category); - wp_cache_replace($_category->cat_ID, $_category, 'category'); + wp_cache_replace($_category->cat_ID, $_category, 'category'); } if ( $output == OBJECT ) { @@ -830,23 +830,23 @@ function get_catname($cat_ID) { function get_all_category_ids() { global $wpdb; - + if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); wp_cache_add('all_category_ids', $cat_ids, 'category'); } - + return $cat_ids; } function get_all_page_ids() { global $wpdb; - + if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); wp_cache_add('all_page_ids', $page_ids, 'pages'); } - + return $page_ids; } @@ -1416,7 +1416,7 @@ function update_post_category_cache($post_ids) { if ( empty($dogs) ) return; - + foreach ($dogs as $catt) $category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id); } @@ -1523,7 +1523,7 @@ function is_attachment () { function is_preview() { global $wp_query; - + return $wp_query->is_preview; } @@ -2175,7 +2175,7 @@ function wp_remote_fopen( $uri ) { function wp($query_vars = '') { global $wp; - + $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) ) $meta_value = serialize($meta_value); $meta_value = trim( $meta_value ); - + if (empty($meta_value)) { 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 ) { $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); } else { - return false; + return false; } - + $user = get_userdata($user_id); wp_cache_delete($user_id, 'users'); wp_cache_delete($user->user_login, 'userlogins'); - + 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'"); else $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); - + $user = get_userdata($user_id); wp_cache_delete($user_id, 'users'); wp_cache_delete($user->user_login, 'userlogins'); - + return true; } diff --git a/wp-includes/js/colorpicker.js b/wp-includes/js/colorpicker.js index 2f0438ed5..7d729db5b 100644 --- a/wp-includes/js/colorpicker.js +++ b/wp-includes/js/colorpicker.js @@ -139,7 +139,7 @@ function AnchorPosition_getPageOffsetLeft (el) { } function AnchorPosition_getWindowOffsetLeft (el) { return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft; - } + } function AnchorPosition_getPageOffsetTop (el) { var ot=el.offsetTop; while((el=el.offsetParent) != null) { ot += el.offsetTop; } @@ -434,7 +434,7 @@ function PopupWindow() { this.populated = false; this.visible = false; this.autoHideEnabled = false; - + this.contents = ""; this.url=""; 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; this.show(linkname); } - + // This function runs when you move your mouse over a color block, if you have a newer browser function ColorPicker_highlightColor(c) { var thedoc = (arguments.length>1)?arguments[1]:window.document; @@ -579,7 +579,7 @@ function ColorPicker() { else { var divname = arguments[0]; } - + if (divname != "") { var cp = new PopupWindow(divname); } @@ -590,7 +590,7 @@ function ColorPicker() { // Object variables cp.currentValue = "#FFFFFF"; - + // Method Mappings cp.writeDiv = ColorPicker_writeDiv; cp.highlightColor = ColorPicker_highlightColor; diff --git a/wp-includes/js/fat.js b/wp-includes/js/fat.js index e73bc501a..a16004e47 100644 --- a/wp-includes/js/fat.js +++ b/wp-includes/js/fat.js @@ -31,22 +31,22 @@ var Fat = { if (!duration) duration = 3000; if (!from || from=="#") from = "#FFFF33"; if (!to) to = this.get_bgcolor(id); - + var frames = Math.round(fps * (duration / 1000)); var interval = duration / frames; var delay = interval; var frame = 0; - + if (from.length < 7) from += from.substr(1,3); if (to.length < 7) to += to.substr(1,3); - + var rf = parseInt(from.substr(1,2),16); var gf = parseInt(from.substr(3,2),16); var bf = parseInt(from.substr(5,2),16); var rt = parseInt(to.substr(1,2),16); var gt = parseInt(to.substr(3,2),16); var bt = parseInt(to.substr(5,2),16); - + var r,g,b,h; while (frame < frames) { @@ -54,7 +54,7 @@ var Fat = { g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames)); b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames)); h = this.make_hex(r,g,b); - + setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay); frame++; diff --git a/wp-includes/js/quicktags.js b/wp-includes/js/quicktags.js index be628e074..12a95c7d9 100644 --- a/wp-includes/js/quicktags.js +++ b/wp-includes/js/quicktags.js @@ -205,7 +205,7 @@ function edCheckOpenTags(button) { else { return false; // tag not found } -} +} function edCloseAllTags() { var count = edOpenTags.length; diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index 9f0957fb6..697ba7216 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -87,13 +87,13 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa // Is selection a image if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { flag = getAttrib(focusElm, 'class'); - + if (flag != 'mce_plugin_wordpress_more') // Not a wordpress return true; - + action = "update"; } - + html = '' + '\\s*', 'mg'), '
        \n'); content = content.replace(new RegExp('^\\s*', ''), ''); content = content.replace(new RegExp('\\s*$', ''), ''); - + break; } diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/image.js b/wp-includes/js/tinymce/themes/advanced/jscripts/image.js index 752e421d7..d97e79b8d 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/image.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/image.js @@ -61,7 +61,7 @@ var preloadImg = new Image(); function resetImageData() { var formObj = document.forms[0]; - formObj.width.value = formObj.height.value = ""; + formObj.width.value = formObj.height.value = ""; } function updateImageData() { diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js index 3f6c6bf3c..4e92fdce5 100644 --- a/wp-includes/js/tinymce/tiny_mce.js +++ b/wp-includes/js/tinymce/tiny_mce.js @@ -353,7 +353,7 @@ TinyMCE.prototype.updateContent = function(form_element_name) { if (inst.formElement == formElement) { var doc = inst.getDoc(); - + tinyMCE._setHTML(doc, inst.formElement.value); if (!tinyMCE.isMSIE) diff --git a/wp-includes/js/tinymce/wp-mce-help.php b/wp-includes/js/tinymce/wp-mce-help.php index f347c9278..a193ab931 100644 --- a/wp-includes/js/tinymce/wp-mce-help.php +++ b/wp-includes/js/tinymce/wp-mce-help.php @@ -93,7 +93,7 @@ require_once('../../../wp-config.php'); c = d('content'+i.toString()); t = d('tab'+i.toString()); if ( n == i ) { - c.className = ''; + c.className = ''; t.className = 'current'; } else { c.className = 'hidden'; diff --git a/wp-includes/js/tw-sack.js b/wp-includes/js/tw-sack.js index 956b3f07c..b097dafac 100644 --- a/wp-includes/js/tw-sack.js +++ b/wp-includes/js/tw-sack.js @@ -32,7 +32,7 @@ function sack(file){ this.failed = true; } }; - + this.setVar = function(name, value){ if (this.URLString.length < 3){ this.URLString = name + "=" + value; @@ -40,12 +40,12 @@ function sack(file){ this.URLString += "&" + name + "=" + value; } } - + this.encVar = function(name, value){ var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value); return varString; } - + this.encodeURLString = function(string){ varArray = string.split('&'); for (i = 0; i < varArray.length; i++){ @@ -57,11 +57,11 @@ function sack(file){ } return varArray.join('&'); } - + this.runResponse = function(){ eval(this.response); } - + this.runAJAX = function(urlstring){ this.responseStatus = new Array(2); if(this.failed && this.AjaxFailedAlert){ diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index bcaa9a887..fcacd2f05 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -62,7 +62,7 @@ function get_userdata( $user_id ) { return false; $user = wp_cache_get($user_id, 'users'); - + if ( $user ) return $user; @@ -93,10 +93,10 @@ function get_userdata( $user_id ) { $user->user_lastname = $user->last_name; if ( isset($user->description) ) $user->user_description = $user->description; - + wp_cache_add($user_id, $user, 'users'); wp_cache_add($user->user_login, $user, 'userlogins'); - + return $user; } endif; @@ -114,7 +114,7 @@ function get_userdatabylogin($user_login) { if ( empty( $user_login ) ) return false; - + $userdata = wp_cache_get($user_login, 'userlogins'); if ( $userdata ) return $userdata; @@ -202,7 +202,7 @@ endif; if ( !function_exists('is_user_logged_in') ) : function is_user_logged_in() { global $current_user; - + if ( $current_user->id == 0 ) return false; return true; @@ -216,7 +216,7 @@ function auth_redirect() { !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || (empty($_COOKIE[USER_COOKIE])) ) { nocache_headers(); - + header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); exit(); } @@ -303,9 +303,9 @@ function wp_notify_postauthor($comment_id, $comment_type='') { $comment_author_domain = gethostbyaddr($comment->comment_author_IP); $blogname = get_settings('blogname'); - + if ( empty( $comment_type ) ) $comment_type = 'comment'; - + 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( __('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') ) : function wp_new_user_notification($user_id, $plaintext_pass = '') { $user = new WP_User($user_id); - + $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); - + $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(__('E-mail: %s'), $user_email) . "\r\n"; - + @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); 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(__('Password: %s'), $plaintext_pass) . "\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); - + } endif; diff --git a/wp-includes/registration-functions.php b/wp-includes/registration-functions.php index dcdd297e8..26f0a8040 100644 --- a/wp-includes/registration-functions.php +++ b/wp-includes/registration-functions.php @@ -23,9 +23,9 @@ function validate_username( $username ) { $valid = true; 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) { @@ -41,7 +41,7 @@ function wp_insert_user($userdata) { // Password is not hashed when creating new user. $user_pass = md5($user_pass); } - + $user_login = sanitize_user($user_login, true); if ( empty($user_nicename) ) @@ -49,10 +49,10 @@ function wp_insert_user($userdata) { if ( empty($display_name) ) $display_name = $user_login; - + if ( empty($nickname) ) $nickname = $user_login; - + if ( empty($user_registered) ) $user_registered = gmdate('Y-m-d H:i:s'); @@ -70,7 +70,7 @@ function wp_insert_user($userdata) { $wpdb->query( $query ); $user_id = $wpdb->insert_id; } - + update_usermeta( $user_id, 'first_name', $first_name); update_usermeta( $user_id, 'last_name', $last_name); 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_login, 'userlogins'); - + if ( $update ) do_action('profile_update', $user_id); else do_action('user_register', $user_id); - - return $user_id; + + return $user_id; } function wp_update_user($userdata) { global $wpdb, $current_user; $ID = (int) $userdata['ID']; - + // First, get all of the original fields - $user = get_userdata($ID); + $user = get_userdata($ID); // Escape data pulled from DB. $user = add_magic_quotes(get_object_vars($user)); @@ -121,20 +121,20 @@ function wp_update_user($userdata) { $userdata = array_merge($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 ( isset($plaintext_pass) ) { wp_clearcookie(); wp_setcookie($userdata['user_login'], $plaintext_pass); } } - + return $user_id; } function wp_create_user( $username, $password, $email = '') { global $wpdb; - + $user_login = $wpdb->escape( $username ); $user_email = $wpdb->escape( $email ); $user_pass = $password; @@ -145,7 +145,7 @@ function wp_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 ); } diff --git a/wp-includes/rss-functions.php b/wp-includes/rss-functions.php index df2526ec7..067f21719 100644 --- a/wp-includes/rss-functions.php +++ b/wp-includes/rss-functions.php @@ -30,37 +30,37 @@ class MagpieRSS { var $inimage = false; var $current_field = ''; var $current_namespace = false; - + //var $ERROR = ""; - + var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); function MagpieRSS ($source) { - + # if PHP xml isn't compiled in, die # if ( !function_exists('xml_parser_create') ) trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" ); - + $parser = @xml_parser_create(); - + 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"); - + $this->parser = $parser; - + # pass in parser, and a reference to this object # setup handlers # xml_set_object( $this->parser, $this ); xml_set_element_handler($this->parser, 'feed_start_element', 'feed_end_element' ); - + xml_set_character_data_handler( $this->parser, 'feed_cdata' ); - + $status = xml_parse( $this->parser, $source ); - + if (! $status ) { $errorcode = xml_get_error_code( $this->parser ); if ( $errorcode != XML_ERROR_NONE ) { @@ -72,16 +72,16 @@ class MagpieRSS { $this->error( $errormsg ); } } - + xml_parser_free( $this->parser ); $this->normalize(); } - + function feed_start_element($p, $element, &$attrs) { $el = $element = strtolower($element); $attrs = array_change_key_case($attrs, CASE_LOWER); - + // check for a namespace, and split if found $ns = false; if ( strpos( $element, ':' ) ) { @@ -90,7 +90,7 @@ class MagpieRSS { if ( $ns and $ns != 'rdf' ) { $this->current_namespace = $ns; } - + # if feed type isn't set, then this is first element of feed # identify feed from root element # @@ -110,7 +110,7 @@ class MagpieRSS { } return; } - + if ( $el == 'channel' ) { $this->inchannel = true; @@ -119,10 +119,10 @@ class MagpieRSS { { $this->initem = true; 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, // record textinput or image fields elseif ( @@ -132,7 +132,7 @@ class MagpieRSS { { $this->intextinput = true; } - + elseif ( $this->feed_type == RSS and $this->current_namespace == '' and @@ -140,7 +140,7 @@ class MagpieRSS { { $this->inimage = true; } - + # handle atom content constructs elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) { @@ -148,12 +148,12 @@ class MagpieRSS { if ($el == 'content' ) { $el = 'atom_content'; } - + $this->incontent = $el; - - + + } - + // if inside an Atom content construct (e.g. content or summary) field treat tags as text elseif ($this->feed_type == ATOM and $this->incontent ) { @@ -162,12 +162,12 @@ class MagpieRSS { array_map('map_attrs', array_keys($attrs), array_values($attrs) ) ); - + $this->append_content( "<$element $attrs_str>" ); - + array_unshift( $this->stack, $el ); } - + // Atom support many links per containging element. // Magpie treats link elements of type rel='alternate' // as being equivalent to RSS's simple link element. @@ -181,7 +181,7 @@ class MagpieRSS { else { $link_el = 'link_' . $attrs['rel']; } - + $this->append($link_el, $attrs['href']); } // set stack[0] to current element @@ -189,11 +189,11 @@ class MagpieRSS { array_unshift($this->stack, $el); } } - - + + function feed_cdata ($p, $text) { - + if ($this->feed_type == ATOM and $this->incontent) { $this->append_content( $text ); @@ -203,10 +203,10 @@ class MagpieRSS { $this->append($current_el, $text); } } - + function feed_end_element ($p, $el) { $el = strtolower($el); - + if ( $el == 'item' or $el == 'entry' ) { $this->items[] = $this->current_item; @@ -222,7 +222,7 @@ class MagpieRSS { $this->inimage = false; } elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) - { + { $this->incontent = false; } elseif ($el == 'channel' or $el == 'feed' ) @@ -245,17 +245,17 @@ class MagpieRSS { else { array_shift( $this->stack ); } - + $this->current_namespace = false; } - + function concat (&$str1, $str2="") { if (!isset($str1) ) { $str1=""; } $str1 .= $str2; } - + function append_content($text) { if ( $this->initem ) { $this->concat( $this->current_item[ $this->incontent ], $text ); @@ -264,7 +264,7 @@ class MagpieRSS { $this->concat( $this->channel[ $this->incontent ], $text ); } } - + // smart append - field and namespace aware function append($el, $text) { if (!$el) { @@ -306,10 +306,10 @@ class MagpieRSS { $this->concat( $this->channel[ $el ], $text ); } - + } } - + function normalize () { // if atom populate rss fields if ( $this->is_atom() ) { @@ -320,9 +320,9 @@ class MagpieRSS { $item['description'] = $item['summary']; if ( isset($item['atom_content'])) $item['content']['encoded'] = $item['atom_content']; - + $this->items[$i] = $item; - } + } } elseif ( $this->is_rss() ) { $this->channel['tagline'] = $this->channel['description']; @@ -332,21 +332,21 @@ class MagpieRSS { $item['summary'] = $item['description']; if ( isset($item['content']['encoded'] ) ) $item['atom_content'] = $item['content']['encoded']; - + $this->items[$i] = $item; } } } - + function is_rss () { if ( $this->feed_type == RSS ) { - return $this->feed_version; + return $this->feed_version; } else { return false; } } - + function is_atom() { if ( $this->feed_type == ATOM ) { return $this->feed_version; @@ -378,12 +378,12 @@ require_once( dirname(__FILE__) . '/class-snoopy.php'); function fetch_rss ($url) { // initialize constants init(); - + if ( !isset($url) ) { // error("fetch_rss called without a url"); return false; } - + // if cache is disabled if ( !MAGPIE_CACHE_ON ) { // fetch file, and parse it @@ -403,19 +403,19 @@ function fetch_rss ($url) { // 2. if there is a hit, make sure its fresh // 3. if cached obj fails freshness check, fetch remote // 4. if remote fails, return stale object, or error - + $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); - + if (MAGPIE_DEBUG and $cache->ERROR) { debug($cache->ERROR, E_USER_WARNING); } - - + + $cache_status = 0; // response of check_cache $request_headers = array(); // HTTP headers to send with fetch $rss = 0; // parsed RSS object $errormsg = 0; // errors, if any - + if (!$cache->ERROR) { // return cache HIT, MISS, or STALE $cache_status = $cache->check_cache( $url ); @@ -432,9 +432,9 @@ function fetch_rss ($url) { return $rss; } } - + // else attempt a conditional get - + // setup headers if ( $cache_status == 'STALE' ) { $rss = $cache->get( $url ); @@ -443,9 +443,9 @@ function fetch_rss ($url) { $request_headers['If-Last-Modified'] = $rss->last_modified; } } - + $resp = _fetch_remote_file( $url, $request_headers ); - + if (isset($resp) and $resp) { if ($resp->status == '304' ) { // we have the most current copy @@ -483,9 +483,9 @@ function fetch_rss ($url) { else { $errormsg = "Unable to retrieve RSS file for unknown reasons."; } - + // else fetch failed - + // attempt to return cached object if ($rss) { if ( MAGPIE_DEBUG ) { @@ -493,12 +493,12 @@ function fetch_rss ($url) { } return $rss; } - + // else we totally failed - // error( $errormsg ); - + // error( $errormsg ); + return false; - + } // end if ( !MAGPIE_CACHE_ON ) { } // end fetch_rss() @@ -511,7 +511,7 @@ function _fetch_remote_file ($url, $headers = "" ) { if (is_array($headers) ) { $client->rawheaders = $headers; } - + @$client->fetch($url); return $client; @@ -519,10 +519,10 @@ function _fetch_remote_file ($url, $headers = "" ) { function _response_to_rss ($resp) { $rss = new MagpieRSS( $resp->results ); - - // if RSS parsed successfully + + // if RSS parsed successfully if ( $rss and !$rss->ERROR) { - + // find Etag, and Last-Modified foreach($resp->headers as $h) { // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" @@ -533,26 +533,26 @@ function _response_to_rss ($resp) { $field = $h; $val = ""; } - + if ( $field == 'ETag' ) { $rss->etag = $val; } - + if ( $field == 'Last-Modified' ) { $rss->last_modified = $val; } } - - return $rss; + + return $rss; } // else construct error message else { $errormsg = "Failed to parse RSS file."; - + if ($rss) { $errormsg .= " (" . $rss->ERROR . ")"; } // error($errormsg); - + return false; } // end if ($rss and !$rss->error) } @@ -569,7 +569,7 @@ function init () { else { define('MAGPIE_INITALIZED', 1); } - + if ( !defined('MAGPIE_CACHE_ON') ) { define('MAGPIE_CACHE_ON', 1); } @@ -585,31 +585,31 @@ function init () { if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { define('MAGPIE_CACHE_FRESH_ONLY', 0); } - + if ( !defined('MAGPIE_DEBUG') ) { define('MAGPIE_DEBUG', 0); } if ( !defined('MAGPIE_USER_AGENT') ) { $ua = 'WordPress/' . $wp_version; - + if ( MAGPIE_CACHE_ON ) { $ua = $ua . ')'; } else { $ua = $ua . '; No cache)'; } - + define('MAGPIE_USER_AGENT', $ua); } - + if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout } - + // use gzip encoding to fetch rss files if supported? 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 $MAX_AGE = 43200; // when are files stale, default twelve hours var $ERROR = ''; // accumulate error messages - + function RSSCache ($base='', $age='') { if ( $base ) { $this->BASE_CACHE = $base; @@ -649,50 +649,50 @@ class RSSCache { if ( $age ) { $this->MAX_AGE = $age; } - + } - + /*=======================================================================*\ Function: set Purpose: add an item to the cache, keyed on url Input: url from wich the rss file was fetched - Output: true on sucess + Output: true on sucess \*=======================================================================*/ function set ($url, $rss) { global $wpdb; $cache_option = 'rss_' . $this->file_name( $url ); $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts'; - + if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_option'") ) add_option($cache_option, '', '', 'no'); if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_timestamp'") ) add_option($cache_timestamp, '', '', 'no'); - + update_option($cache_option, $rss); update_option($cache_timestamp, time() ); - + return $cache_option; } - + /*=======================================================================*\ Function: get Purpose: fetch an item from the cache 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) { $this->ERROR = ""; $cache_option = 'rss_' . $this->file_name( $url ); - + if ( ! get_option( $cache_option ) ) { $this->debug( "Cache doesn't contain: $url (cache option: $cache_option)" ); return 0; } - + $rss = get_option( $cache_option ); - + return $rss; } @@ -701,8 +701,8 @@ class RSSCache { Purpose: check a url for membership in the cache and whether the object is older then MAX_AGE (ie. STALE) 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 ) { $this->ERROR = ""; $cache_option = $this->file_name( $url ); @@ -729,32 +729,32 @@ class RSSCache { /*=======================================================================*\ Function: serialize -\*=======================================================================*/ +\*=======================================================================*/ function serialize ( $rss ) { return serialize( $rss ); } /*=======================================================================*\ Function: unserialize -\*=======================================================================*/ +\*=======================================================================*/ function unserialize ( $data ) { return unserialize( $data ); } - + /*=======================================================================*\ Function: file_name Purpose: map url to location in cache Input: url from wich the rss file was fetched Output: a file name -\*=======================================================================*/ +\*=======================================================================*/ function file_name ($url) { return md5( $url ); } - + /*=======================================================================*\ Function: error Purpose: register error -\*=======================================================================*/ +\*=======================================================================*/ function error ($errormsg, $lvl=E_USER_WARNING) { // append PHP's error message if track_errors enabled if ( isset($php_errormsg) ) { @@ -776,17 +776,17 @@ class RSSCache { } function parse_w3cdtf ( $date_str ) { - + # regex to match wc3dtf $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 ) ) { list( $year, $month, $day, $hours, $minutes, $seconds) = array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); - + # calc epoch for current date assuming GMT $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); - + $offset = 0; if ( $match[10] == 'Z' ) { # zulu time, aka GMT @@ -794,20 +794,20 @@ function parse_w3cdtf ( $date_str ) { else { list( $tz_mod, $tz_hour, $tz_min ) = array( $match[8], $match[9], $match[10]); - + # zero out the variables if ( ! $tz_hour ) { $tz_hour = 0; } if ( ! $tz_min ) { $tz_min = 0; } - + $offset_secs = (($tz_hour*60)+$tz_min)*60; - + # is timezone ahead of GMT? then subtract offset # if ( $tz_mod == '+' ) { $offset_secs = $offset_secs * -1; } - - $offset = $offset_secs; + + $offset = $offset_secs; } $epoch = $epoch + $offset; return $epoch; @@ -829,7 +829,7 @@ function wp_rss ($url, $num) { echo htmlentities($item['title']); echo "
        \n"; echo "\n"; - } + } echo ""; } else { diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 8383ad740..3c6c15592 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -271,7 +271,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') { return null; $current_post_date = $post->post_date; - + $join = ''; if ( $in_same_cat ) { $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 ) $qstr = trailingslashit($qstr); $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr ); - + // showing /page/1/ or ?paged=1 is redundant if ( 1 === $pagenum ) { $qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php index 44c3a879c..07cfd1416 100644 --- a/wp-includes/template-functions-post.php +++ b/wp-includes/template-functions-post.php @@ -211,7 +211,7 @@ function get_post_custom( $post_id = 0 ) { // Force subkeys to be array type: if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) ) $post_meta_cache[$mpid] = array(); - + if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) ) $post_meta_cache[$mpid]["$mkey"] = array(); diff --git a/wp-includes/template-loader.php b/wp-includes/template-loader.php index ac69dab08..51ec56868 100644 --- a/wp-includes/template-loader.php +++ b/wp-includes/template-loader.php @@ -31,7 +31,7 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { exit; } else if ( is_category() && $template = get_category_template()) { include($template); - exit; + exit; } else if ( is_author() && $template = get_author_template() ) { include($template); exit; diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 97238c397..fd921e801 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -16,7 +16,7 @@ if (!defined('SAVEQUERIES')) class wpdb { var $show_errors = true; - var $num_queries = 0; + var $num_queries = 0; var $last_query; var $col_info; var $queries; @@ -75,7 +75,7 @@ class wpdb { // ==================================================================== // Format a string correctly for safe insert under all PHP conditions - + function escape($string) { return addslashes( $string ); // Disable rest for now, causing problems if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' ) @@ -101,7 +101,7 @@ class wpdb { $this->last_query

        "; } else { - return false; + return false; } } @@ -111,7 +111,7 @@ class wpdb { function show_errors() { $this->show_errors = true; } - + function hide_errors() { $this->show_errors = false; } @@ -142,7 +142,7 @@ class wpdb { // Perform the query via std mysql_query function.. if (SAVEQUERIES) $this->timer_start(); - + $this->result = @mysql_query($query, $this->dbh); ++$this->num_queries; @@ -159,7 +159,7 @@ class wpdb { $this->rows_affected = mysql_affected_rows(); // Take note of the insert_id 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_val = $this->rows_affected; @@ -179,7 +179,7 @@ class wpdb { // Log number of rows the query returned $this->num_rows = $num_rows; - + // Return number of rows selected $return_val = $this->num_rows; } @@ -293,7 +293,7 @@ class wpdb { $this->time_start = $mtime[1] + $mtime[0]; return true; } - + function timer_stop($precision = 3) { $mtime = microtime(); $mtime = explode(' ', $mtime); @@ -305,7 +305,7 @@ class wpdb { function bail($message) { // Just wraps errors in a nice header and footer if ( !$this->show_errors ) return false; - header( 'Content-Type: text/html; charset=utf-8'); + header( 'Content-Type: text/html; charset=utf-8'); echo << @@ -325,22 +325,22 @@ class wpdb { margin-right: 25%; padding: .2em 2em; } - + h1 { color: #006; font-size: 18px; font-weight: lighter; } - + h2 { font-size: 16px; } - + p, li, dt { line-height: 140%; padding-bottom: 2px; } - + ul, ol { padding: 5px 5px 5px 20px; } diff --git a/wp-includes/wp-l10n.php b/wp-includes/wp-l10n.php index 213294335..ba77c2359 100644 --- a/wp-includes/wp-l10n.php +++ b/wp-includes/wp-l10n.php @@ -14,7 +14,7 @@ function get_locale() { // WPLANG is defined in wp-config. if (defined('WPLANG')) $locale = WPLANG; - + if (empty($locale)) $locale = 'en_US'; @@ -76,20 +76,20 @@ function load_default_textdomain() { $locale = get_locale(); $mofile = ABSPATH . "wp-includes/languages/$locale.mo"; - + load_textdomain('default', $mofile); } function load_plugin_textdomain($domain, $path = 'wp-content/plugins') { $locale = get_locale(); - + $mofile = ABSPATH . "$path/$domain-$locale.mo"; load_textdomain($domain, $mofile); } function load_theme_textdomain($domain) { $locale = get_locale(); - + $mofile = get_template_directory() . "/$locale.mo"; load_textdomain($domain, $mofile); } diff --git a/wp-login.php b/wp-login.php index 0864edbd0..9335f0f37 100644 --- a/wp-login.php +++ b/wp-login.php @@ -28,7 +28,7 @@ case 'logout': $redirect_to = 'wp-login.php'; if ( isset($_REQUEST['redirect_to']) ) $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']); - + wp_redirect($redirect_to); exit(); @@ -139,7 +139,7 @@ case 'resetpass' : $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'"); 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(__('Password: %s'), $new_pass) . "\r\n"; $message .= get_settings('siteurl') . "/wp-login.php\r\n"; @@ -190,11 +190,11 @@ default: if ( $user_login && $user_pass ) { $user = new WP_User(0, $user_login); - + // 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/' ) ) $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; - + if ( wp_login($user_login, $user_pass, $using_cookie) ) { if ( !$using_cookie ) wp_setcookie($user_login, $user_pass, false, '', '', $rememberme); @@ -202,7 +202,7 @@ default: wp_redirect($redirect_to); exit; } else { - if ( $using_cookie ) + if ( $using_cookie ) $error = __('Your session has expired.'); } } diff --git a/wp-mail.php b/wp-mail.php index 6c62fbad6..114ea1110 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -81,11 +81,11 @@ for ($i=1; $i <= $count; $i++) : } $date_arr = explode(' ', $ddate); $date_time = explode(':', $date_arr[3]); - + $ddate_H = $date_time[0]; $ddate_i = $date_time[1]; $ddate_s = $date_time[2]; - + $ddate_m = $date_arr[1]; $ddate_d = $date_arr[0]; $ddate_Y = $date_arr[2]; diff --git a/wp-register.php b/wp-register.php index a51b0513d..28aa5f260 100644 --- a/wp-register.php +++ b/wp-register.php @@ -14,9 +14,9 @@ case 'register': $user_login = sanitize_user( $_POST['user_login'] ); $user_email = $_POST['user_email']; - + $errors = array(); - + if ( $user_login == '' ) $errors['user_login'] = __('ERROR: Please enter a username.'); @@ -45,7 +45,7 @@ case 'register': else wp_new_user_notification($user_id, $password); } - + if ( 0 == count($errors) ) { ?> @@ -53,7 +53,7 @@ case 'register': WordPress » <?php _e('Registration Complete') ?> - +