Compare commits
71 Commits
5.6-branch
...
2.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4bd28c86f | ||
|
|
25903703f4 | ||
|
|
09a10da767 | ||
|
|
b1deb1d6df | ||
|
|
207af1aeb1 | ||
|
|
d066cef6fe | ||
|
|
8b3415d780 | ||
|
|
06b5e2cb37 | ||
|
|
20fe71511c | ||
|
|
f060b92e90 | ||
|
|
3702fd2a35 | ||
|
|
d574573c34 | ||
|
|
bcb9b83494 | ||
|
|
b53405b8e3 | ||
|
|
13c289f0a0 | ||
|
|
041c7d133d | ||
|
|
01cf6061be | ||
|
|
1e57f40061 | ||
|
|
8fe6255f89 | ||
|
|
600b96dc9a | ||
|
|
8cf0feaa86 | ||
|
|
6787161bb7 | ||
|
|
12b50a0dd6 | ||
|
|
2d74b4a60c | ||
|
|
72e8406345 | ||
|
|
f54b5cfac9 | ||
|
|
21d3d46bbc | ||
|
|
faabd2d6a9 | ||
|
|
8de1fa5c0f | ||
|
|
a9741b9cdb | ||
|
|
194f7b4a75 | ||
|
|
b0f12dec28 | ||
|
|
7184153c3d | ||
|
|
b40bb99d85 | ||
|
|
af27a75670 | ||
|
|
58235c4df5 | ||
|
|
11f901ee4f | ||
|
|
9779403c81 | ||
|
|
39c6dfa998 | ||
|
|
67988bdff0 | ||
|
|
f66e4060a9 | ||
|
|
790a4d36d9 | ||
|
|
184928af47 | ||
|
|
c4e47d3e9b | ||
|
|
0161b0c2e8 | ||
|
|
04b303eaea | ||
|
|
79a8bf5d08 | ||
|
|
b95912c4a5 | ||
|
|
e9f8f9abf7 | ||
|
|
22de2d2cb9 | ||
|
|
250e1ea3f8 | ||
|
|
2cef330387 | ||
|
|
a5c59de945 | ||
|
|
987fb7822d | ||
|
|
edf6e21ebd | ||
|
|
9a8d98cb3d | ||
|
|
6323ce0a14 | ||
|
|
ab6e0e1e4f | ||
|
|
decde5cfd8 | ||
|
|
b86f82e435 | ||
|
|
1f46a9c3ae | ||
|
|
6c3dba8271 | ||
|
|
1527d0d4c4 | ||
|
|
0a737c65f2 | ||
|
|
238ca3e925 | ||
|
|
78ca745e30 | ||
|
|
8789eb2c7f | ||
|
|
a391b9676c | ||
|
|
58fb7284f3 | ||
|
|
8db733bca6 | ||
|
|
0024f9cd6d |
@@ -155,7 +155,7 @@ case 'add-meta' :
|
||||
if ( !current_user_can( 'edit_post', $id ) )
|
||||
die('-1');
|
||||
if ( $id < 0 ) {
|
||||
$now = current_time('timestamp');
|
||||
$now = current_time('timestamp', 1);
|
||||
if ( $pid = wp_insert_post( array(
|
||||
'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
|
||||
) ) )
|
||||
@@ -231,7 +231,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
|
||||
if($_POST['post_ID'] < 0) {
|
||||
$_POST['temp_ID'] = $_POST['post_ID'];
|
||||
$id = wp_write_post();
|
||||
if(is_wp_error($id))
|
||||
if( is_wp_error($id) )
|
||||
die($id->get_error_message());
|
||||
else
|
||||
die("$id");
|
||||
|
||||
@@ -123,7 +123,7 @@ function wp_insert_category($catarr) {
|
||||
|
||||
if (!$update) {
|
||||
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')");
|
||||
$cat_ID = $wpdb->insert_id;
|
||||
$cat_ID = (int) $wpdb->insert_id;
|
||||
} else {
|
||||
$wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'");
|
||||
}
|
||||
@@ -245,7 +245,7 @@ function category_exists($cat_name) {
|
||||
if (!$category_nicename = sanitize_title($cat_name))
|
||||
return 0;
|
||||
|
||||
return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
|
||||
return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
|
||||
}
|
||||
|
||||
function wp_delete_user($id, $reassign = 'novalue') {
|
||||
@@ -299,6 +299,8 @@ function wp_insert_link($linkdata) {
|
||||
if ( !empty($link_id) )
|
||||
$update = true;
|
||||
|
||||
$link_id = (int) $link_id;
|
||||
|
||||
if( trim( $link_name ) == '' )
|
||||
return 0;
|
||||
$link_name = apply_filters('pre_link_name', $link_name);
|
||||
@@ -360,7 +362,7 @@ function wp_insert_link($linkdata) {
|
||||
WHERE link_id='$link_id'");
|
||||
} else {
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
|
||||
$link_id = $wpdb->insert_id;
|
||||
$link_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
wp_set_link_cats($link_id, $link_category);
|
||||
@@ -443,7 +445,7 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
$old_categories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
WHERE link_id = $link_ID");
|
||||
WHERE link_id = '$link_ID'");
|
||||
|
||||
if (!$old_categories) {
|
||||
$old_categories = array();
|
||||
@@ -456,10 +458,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
|
||||
if ($delete_cats) {
|
||||
foreach ($delete_cats as $del) {
|
||||
$del = (int) $del;
|
||||
$wpdb->query("
|
||||
DELETE FROM $wpdb->link2cat
|
||||
WHERE category_id = $del
|
||||
AND link_id = $link_ID
|
||||
WHERE category_id = '$del'
|
||||
AND link_id = '$link_ID'
|
||||
");
|
||||
}
|
||||
}
|
||||
@@ -469,9 +472,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
|
||||
if ($add_cats) {
|
||||
foreach ($add_cats as $new_cat) {
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ($link_ID, $new_cat)");
|
||||
$new_cat = (int) $new_cat;
|
||||
if ( !empty($new_cat) )
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ('$link_ID', '$new_cat')");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,19 +139,19 @@ function fix_attachment_links( $post_ID ) {
|
||||
|
||||
$post = & get_post( $post_ID, ARRAY_A );
|
||||
|
||||
$search = "#<a[^>]+rel=('|\" )[^'\"]*attachment[^>]*>#ie";
|
||||
$search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
|
||||
|
||||
// See if we have any rel="attachment" links
|
||||
if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) )
|
||||
return;
|
||||
|
||||
$i = 0;
|
||||
$search = "#[\s]+rel=(\"|' )(.*? )wp-att-(\d+ )\\1#i";
|
||||
$search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
|
||||
foreach ( $anchor_matches[0] as $anchor ) {
|
||||
if ( 0 == preg_match( $search, $anchor, $id_matches ) )
|
||||
continue;
|
||||
|
||||
$id = $id_matches[3];
|
||||
$id = (int) $id_matches[3];
|
||||
|
||||
// While we have the attachment ID, let's adopt any orphans.
|
||||
$attachment = & get_post( $id, ARRAY_A );
|
||||
@@ -358,7 +358,7 @@ function get_default_post_to_edit() {
|
||||
else if ( !empty( $post_title ) ) {
|
||||
$text = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
|
||||
$text = funky_javascript_fix( $text);
|
||||
$popupurl = attribute_escape($_REQUEST['popupurl']);
|
||||
$popupurl = clean_url($_REQUEST['popupurl']);
|
||||
$post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ function get_user_to_edit( $user_id ) {
|
||||
$user = new WP_User( $user_id );
|
||||
$user->user_login = attribute_escape($user->user_login);
|
||||
$user->user_email = attribute_escape($user->user_email);
|
||||
$user->user_url = attribute_escape($user->user_url);
|
||||
$user->user_url = clean_url($user->user_url);
|
||||
$user->first_name = attribute_escape($user->first_name);
|
||||
$user->last_name = attribute_escape($user->last_name);
|
||||
$user->display_name = attribute_escape($user->display_name);
|
||||
@@ -435,7 +435,7 @@ function get_user_to_edit( $user_id ) {
|
||||
function add_user() {
|
||||
if ( func_num_args() ) { // The hackiest hack that ever did hack
|
||||
global $current_user, $wp_roles;
|
||||
$user_id = func_get_arg( 0 );
|
||||
$user_id = (int) func_get_arg( 0 );
|
||||
|
||||
if ( isset( $_POST['role'] ) ) {
|
||||
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
|
||||
@@ -453,7 +453,7 @@ function edit_user( $user_id = 0 ) {
|
||||
global $current_user, $wp_roles, $wpdb;
|
||||
if ( $user_id != 0 ) {
|
||||
$update = true;
|
||||
$user->ID = $user_id;
|
||||
$user->ID = (int) $user_id;
|
||||
$userdata = get_userdata( $user_id );
|
||||
$user->user_login = $wpdb->escape( $userdata->user_login );
|
||||
} else {
|
||||
@@ -478,7 +478,7 @@ function edit_user( $user_id = 0 ) {
|
||||
if ( isset( $_POST['email'] ))
|
||||
$user->user_email = wp_specialchars( trim( $_POST['email'] ));
|
||||
if ( isset( $_POST['url'] ) ) {
|
||||
$user->user_url = wp_specialchars( trim( $_POST['url'] ));
|
||||
$user->user_url = clean_url( trim( $_POST['url'] ));
|
||||
$user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
|
||||
}
|
||||
if ( isset( $_POST['first_name'] ))
|
||||
@@ -562,11 +562,11 @@ function edit_user( $user_id = 0 ) {
|
||||
function get_link_to_edit( $link_id ) {
|
||||
$link = get_link( $link_id );
|
||||
|
||||
$link->link_url = attribute_escape($link->link_url);
|
||||
$link->link_url = clean_url($link->link_url);
|
||||
$link->link_name = attribute_escape($link->link_name);
|
||||
$link->link_image = attribute_escape($link->link_image);
|
||||
$link->link_description = attribute_escape($link->link_description);
|
||||
$link->link_rss = attribute_escape($link->link_rss);
|
||||
$link->link_rss = clean_url($link->link_rss);
|
||||
$link->link_rel = attribute_escape($link->link_rel);
|
||||
$link->link_notes = wp_specialchars($link->link_notes);
|
||||
$link->post_category = $link->link_category;
|
||||
@@ -576,7 +576,7 @@ function get_link_to_edit( $link_id ) {
|
||||
|
||||
function get_default_link_to_edit() {
|
||||
if ( isset( $_GET['linkurl'] ) )
|
||||
$link->link_url = attribute_escape( $_GET['linkurl']);
|
||||
$link->link_url = clean_url( $_GET['linkurl']);
|
||||
else
|
||||
$link->link_url = '';
|
||||
|
||||
@@ -599,10 +599,10 @@ function edit_link( $link_id = '' ) {
|
||||
wp_die( __( 'Cheatin’ uh?' ));
|
||||
|
||||
$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
|
||||
$_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
|
||||
$_POST['link_url'] = clean_url($_POST['link_url']);
|
||||
$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
|
||||
$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
|
||||
$_POST['link_rss'] = wp_specialchars( $_POST['link_rss'] );
|
||||
$_POST['link_rss'] = clean_url($_POST['link_rss']);
|
||||
$_POST['link_category'] = $_POST['post_category'];
|
||||
|
||||
if ( !empty( $link_id ) ) {
|
||||
@@ -781,8 +781,8 @@ function _cat_row( $category, $level, $name_override = false ) {
|
||||
$pad = str_repeat( '— ', $level );
|
||||
if ( current_user_can( 'manage_categories' ) ) {
|
||||
$edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__( 'Edit' )."</a></td>";
|
||||
$default_cat_id = get_option( 'default_category' );
|
||||
$default_link_cat_id = get_option( 'default_link_category' );
|
||||
$default_cat_id = (int) get_option( 'default_category' );
|
||||
$default_link_cat_id = (int) get_option( 'default_link_category' );
|
||||
|
||||
if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
|
||||
$edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll of its posts will go into the default category of '%s'\nAll of its bookmarks will go into the default category of '%s'.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
|
||||
@@ -821,7 +821,7 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
|
||||
|
||||
$post->post_title = wp_specialchars( $post->post_title );
|
||||
$pad = str_repeat( '— ', $level );
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
$class = ('alternate' == $class ) ? '' : 'alternate';
|
||||
?>
|
||||
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
|
||||
@@ -830,7 +830,7 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
|
||||
<?php echo $pad; ?><?php the_title() ?>
|
||||
</td>
|
||||
<td><?php the_author() ?></td>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( 'Y-m-d g:i a', $post->post_modified ); ?></td>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?></td>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e( 'View' ); ?></a></td>
|
||||
<td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
|
||||
<td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&post=$id", 'delete-page_' . $id ) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf( __("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop." ), get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>
|
||||
@@ -867,7 +867,7 @@ function user_row( $user_object, $style = '' ) {
|
||||
}
|
||||
$r .= "</td>\n\t\t<td>";
|
||||
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
|
||||
$edit_link = attribute_escape( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ));
|
||||
$edit_link = add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" );
|
||||
$r .= "<a href='$edit_link' class='edit'>".__( 'Edit' )."</a>";
|
||||
}
|
||||
$r .= "</td>\n\t</tr>";
|
||||
@@ -1269,7 +1269,7 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
|
||||
|
||||
if ( $items ) {
|
||||
foreach ( $items as $item ) {
|
||||
// A page cannot be it's own parent.
|
||||
// A page cannot be its own parent.
|
||||
if (!empty ( $post_ID ) ) {
|
||||
if ( $item->ID == $post_ID ) {
|
||||
continue;
|
||||
@@ -1533,6 +1533,14 @@ function add_theme_page( $page_title, $menu_title, $access_level, $file, $functi
|
||||
return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function );
|
||||
}
|
||||
|
||||
function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
|
||||
if ( current_user_can('edit_users') )
|
||||
$parent = 'users.php';
|
||||
else
|
||||
$parent = 'profile.php';
|
||||
return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
|
||||
}
|
||||
|
||||
function validate_file( $file, $allowed_files = '' ) {
|
||||
if ( false !== strpos( $file, './' ))
|
||||
return 1;
|
||||
@@ -1602,7 +1610,7 @@ function get_file_description( $file ) {
|
||||
}
|
||||
elseif ( file_exists( ABSPATH . $file ) && is_file( ABSPATH . $file ) ) {
|
||||
$template_data = implode( '', file( ABSPATH . $file ) );
|
||||
if ( preg_match( "|Template Name:(.* )|i", $template_data, $name ))
|
||||
if ( preg_match( "|Template Name:(.*)|i", $template_data, $name ))
|
||||
return $name[1];
|
||||
}
|
||||
|
||||
@@ -1914,7 +1922,7 @@ function wp_import_upload_form( $action ) {
|
||||
if ( strstr( $size, 'g' ) )
|
||||
$bytes = $size * 1024 * 1024 * 1024;
|
||||
?>
|
||||
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
|
||||
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
|
||||
<p>
|
||||
<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?> )
|
||||
<input type="file" id="upload" name="import" size="25" />
|
||||
@@ -2190,7 +2198,7 @@ function wp_create_thumbnail( $file, $max_side, $effect = '' ) {
|
||||
|
||||
$thumbpath = str_replace( basename( $file ), $thumb, $file );
|
||||
|
||||
// move the thumbnail to it's final destination
|
||||
// move the thumbnail to its final destination
|
||||
if ( $type[2] == 1 ) {
|
||||
if (!imagegif( $thumbnail, $thumbpath ) ) {
|
||||
$error = __( "Thumbnail path invalid" );
|
||||
@@ -2215,8 +2223,7 @@ function wp_create_thumbnail( $file, $max_side, $effect = '' ) {
|
||||
if (!empty ( $error ) ) {
|
||||
return $error;
|
||||
} else {
|
||||
apply_filters( 'wp_create_thumbnail', $thumbpath );
|
||||
return $thumbpath;
|
||||
return apply_filters( 'wp_create_thumbnail', $thumbpath );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
if (!isset($_GET["page"])) require_once('admin.php');
|
||||
if ( $editing ) {
|
||||
wp_enqueue_script( array("dbx-admin-key?pagenow=$pagenow",'admin-custom-fields') );
|
||||
wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields') );
|
||||
if ( current_user_can('manage_categories') )
|
||||
wp_enqueue_script( 'ajaxcat' );
|
||||
if ( user_can_richedit() )
|
||||
|
||||
@@ -37,7 +37,7 @@ else
|
||||
|
||||
|
||||
$content = wp_specialchars($_REQUEST['content']);
|
||||
$popupurl = attribute_escape($_REQUEST['popupurl']);
|
||||
$popupurl = clean_url($_REQUEST['popupurl']);
|
||||
if ( !empty($content) ) {
|
||||
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
|
||||
} else {
|
||||
|
||||
@@ -174,7 +174,7 @@ Event.observe( window, 'load', hide_text );
|
||||
<h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p>
|
||||
<p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
|
||||
|
||||
<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo add_query_arg('step', 2) ?>" style="margin: auto; width: 50%;">
|
||||
<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
|
||||
<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
|
||||
<input type="hidden" name="action" value="save" />
|
||||
<p class="submit">
|
||||
@@ -188,7 +188,7 @@ Event.observe( window, 'load', hide_text );
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Reset Header Image and Color'); ?></h2>
|
||||
<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
|
||||
<form method="post" action="<?php echo add_query_arg('step', 1) ?>">
|
||||
<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
|
||||
<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
@@ -223,12 +223,12 @@ Event.observe( window, 'load', hide_text );
|
||||
|
||||
if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {
|
||||
set_theme_mod('header_image', $url);
|
||||
$header = apply_filters('wp_create_file_in_uploads', $header); // For replication
|
||||
$header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication
|
||||
return $this->finished();
|
||||
} elseif ( $width > HEADER_IMAGE_WIDTH ) {
|
||||
$oitar = $width / HEADER_IMAGE_WIDTH;
|
||||
$image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
|
||||
$image = apply_filters('wp_create_file_in_uploads', $image); // For replication
|
||||
$image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication
|
||||
|
||||
$url = str_replace(basename($url), basename($image), $url);
|
||||
$width = $width / $oitar;
|
||||
@@ -240,7 +240,7 @@ Event.observe( window, 'load', hide_text );
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<form method="POST" action="<?php echo add_query_arg('step', 3) ?>">
|
||||
<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">
|
||||
|
||||
<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
|
||||
<div id="testWrap">
|
||||
@@ -286,8 +286,7 @@ Event.observe( window, 'load', hide_text );
|
||||
// cleanup
|
||||
$file = get_attached_file( $_POST['attachment_id'] );
|
||||
$medium = str_replace(basename($file), 'midsize-'.basename($file), $file);
|
||||
@unlink( $medium );
|
||||
apply_filters( 'wp_delete_file', $medium );
|
||||
@unlink( apply_filters( 'wp_delete_file', $medium ) );
|
||||
wp_delete_attachment( $_POST['attachment_id'] );
|
||||
|
||||
return $this->finished();
|
||||
|
||||
@@ -56,7 +56,7 @@ if ( !empty( $_POST['delete_comments'] ) ) :
|
||||
$i = 0;
|
||||
foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
|
||||
$comment = (int) $comment;
|
||||
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
|
||||
$post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
|
||||
// $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
|
||||
if ( current_user_can('edit_post', $post_id) ) {
|
||||
if ( !empty( $_POST['spam_button'] ) )
|
||||
@@ -101,7 +101,7 @@ $total_pages = ceil( $total / 20 );
|
||||
$r = '';
|
||||
if ( 1 < $page ) {
|
||||
$args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
|
||||
$r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page') .'</a>' . "\n";
|
||||
$r .= '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">« '. __('Previous Page') .'</a>' . "\n";
|
||||
}
|
||||
if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
|
||||
for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
|
||||
@@ -111,7 +111,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
|
||||
$p = false;
|
||||
if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
|
||||
$args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
|
||||
$r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . "</a>\n";
|
||||
$r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n";
|
||||
$in = true;
|
||||
elseif ( $in == true ) :
|
||||
$r .= "...\n";
|
||||
@@ -122,7 +122,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
|
||||
}
|
||||
if ( ( $page ) * 20 < $total || -1 == $total ) {
|
||||
$args['apage'] = $page + 1;
|
||||
$r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' »</a>' . "\n";
|
||||
$r .= '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page') .' »</a>' . "\n";
|
||||
}
|
||||
echo "<p class='pagenav'>$r</p>";
|
||||
?>
|
||||
@@ -248,7 +248,7 @@ $total_pages = ceil( $total / 20 );
|
||||
$r = '';
|
||||
if ( 1 < $page ) {
|
||||
$args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
|
||||
$r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page') .'</a>' . "\n";
|
||||
$r .= '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">« '. __('Previous Page') .'</a>' . "\n";
|
||||
}
|
||||
if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
|
||||
for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
|
||||
@@ -258,7 +258,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
|
||||
$p = false;
|
||||
if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
|
||||
$args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
|
||||
$r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . "</a>\n";
|
||||
$r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n";
|
||||
$in = true;
|
||||
elseif ( $in == true ) :
|
||||
$r .= "...\n";
|
||||
@@ -269,7 +269,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
|
||||
}
|
||||
if ( ( $page ) * 20 < $total || -1 == $total ) {
|
||||
$args['apage'] = $page + 1;
|
||||
$r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' »</a>' . "\n";
|
||||
$r .= '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page') .' »</a>' . "\n";
|
||||
}
|
||||
echo "<p class='pagenav'>$r</p>";
|
||||
?>
|
||||
|
||||
@@ -168,11 +168,11 @@ if ('publish' != $post->post_status || 0 == $post_ID) {
|
||||
?>
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php
|
||||
if ( !empty($_REQUEST['popupurl']) )
|
||||
echo attribute_escape(stripslashes($_REQUEST['popupurl']));
|
||||
echo clean_url(stripslashes($_REQUEST['popupurl']));
|
||||
else if ( url_to_postid(wp_get_referer()) == $post_ID )
|
||||
echo 'redo';
|
||||
else
|
||||
echo attribute_escape(stripslashes(wp_get_referer()));
|
||||
echo clean_url(stripslashes(wp_get_referer()));
|
||||
?>" /></p>
|
||||
|
||||
<?php do_action('edit_form_advanced'); ?>
|
||||
|
||||
@@ -13,7 +13,7 @@ if (0 == $post_ID) {
|
||||
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
|
||||
}
|
||||
|
||||
$sendto = attribute_escape(stripslashes(wp_get_referer()));
|
||||
$sendto = clean_url(stripslashes(wp_get_referer()));
|
||||
|
||||
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
|
||||
$sendto = 'redo';
|
||||
|
||||
@@ -19,7 +19,7 @@ require_once('admin-header.php');
|
||||
</form>
|
||||
|
||||
<?php
|
||||
wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1');
|
||||
wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');
|
||||
|
||||
if ( $_GET['s'] )
|
||||
$all = false;
|
||||
|
||||
@@ -177,7 +177,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
|
||||
case 'date':
|
||||
?>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td>
|
||||
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(_('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
|
||||
<?php
|
||||
break;
|
||||
case 'title':
|
||||
@@ -279,17 +279,17 @@ foreach ($comments as $comment) {
|
||||
|
||||
<?php comment_text() ?>
|
||||
|
||||
<p><?php comment_date('M j, g:i A'); ?> — [
|
||||
<p><?php comment_date(__('M j, g:i A')); ?> — [
|
||||
<?php
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
|
||||
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $post->ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
|
||||
echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
|
||||
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
|
||||
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $post->ID . '&c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
|
||||
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $post->ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
|
||||
echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
|
||||
echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
|
||||
}
|
||||
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=".$comment->comment_post_ID."&c=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), js_escape( $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ]";
|
||||
} // end if any comments to show
|
||||
echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
@@ -104,7 +104,7 @@ class BW_Import {
|
||||
$comments = $comments[1];
|
||||
|
||||
if ( $comments ) {
|
||||
$comment_post_ID = $post_id;
|
||||
$comment_post_ID = (int) $post_id;
|
||||
$num_comments = 0;
|
||||
foreach ($comments as $comment) {
|
||||
preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);
|
||||
|
||||
@@ -437,8 +437,8 @@ class Dotclear_Import {
|
||||
extract($comment);
|
||||
|
||||
// WordPressify Data
|
||||
$comment_ID = ltrim($comment_id, '0');
|
||||
$comment_post_ID = $postarr[$post_id];
|
||||
$comment_ID = (int) ltrim($comment_id, '0');
|
||||
$comment_post_ID = (int) $postarr[$post_id];
|
||||
$comment_approved = "$comment_pub";
|
||||
$name = $wpdb->escape(csc ($comment_auteur));
|
||||
$email = $wpdb->escape($comment_email);
|
||||
|
||||
@@ -82,7 +82,7 @@ class LJ_Import {
|
||||
$comments = $comments[1];
|
||||
|
||||
if ( $comments ) {
|
||||
$comment_post_ID = $post_id;
|
||||
$comment_post_ID = (int) $post_id;
|
||||
$num_comments = 0;
|
||||
foreach ($comments as $comment) {
|
||||
preg_match('|<event>(.*?)</event>|is', $comment, $comment_content);
|
||||
|
||||
@@ -171,7 +171,7 @@ class MT_Import {
|
||||
return;
|
||||
}
|
||||
$this->file = $file['file'];
|
||||
$this->id = $file['id'];
|
||||
$this->id = (int) $file['id'];
|
||||
|
||||
$this->get_entries();
|
||||
$this->mt_authors_form();
|
||||
@@ -295,7 +295,7 @@ class MT_Import {
|
||||
}
|
||||
}
|
||||
|
||||
$comment_post_ID = $post_id;
|
||||
$comment_post_ID = (int) $post_id;
|
||||
$comment_approved = 1;
|
||||
|
||||
// Now for comments
|
||||
|
||||
@@ -174,7 +174,7 @@ class WP_Import {
|
||||
return;
|
||||
}
|
||||
$this->file = $file['file'];
|
||||
$this->id = $file['id'];
|
||||
$this->id = (int) $file['id'];
|
||||
|
||||
$this->get_entries();
|
||||
$this->wp_authors_form();
|
||||
@@ -201,7 +201,7 @@ class WP_Import {
|
||||
if ( empty($parent) )
|
||||
$category_parent = '0';
|
||||
else
|
||||
$category_parent = (int) category_exists($parent);
|
||||
$category_parent = category_exists($parent);
|
||||
|
||||
$catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name');
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
require_once('admin.php');
|
||||
require_once (ABSPATH . WPINC . '/rss.php');
|
||||
|
||||
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
|
||||
switch ( $_GET['jax'] ) {
|
||||
|
||||
case 'incominglinks' :
|
||||
|
||||
@@ -133,7 +133,7 @@ if ( $links ) {
|
||||
foreach ($links as $link) {
|
||||
$link->link_name = attribute_escape($link->link_name);
|
||||
$link->link_description = wp_specialchars($link->link_description);
|
||||
$link->link_url = attribute_escape($link->link_url);
|
||||
$link->link_url = clean_url($link->link_url);
|
||||
$link->link_category = wp_get_link_cats($link->link_id);
|
||||
$short_url = str_replace('http://', '', $link->link_url);
|
||||
$short_url = str_replace('www.', '', $short_url);
|
||||
|
||||
@@ -60,7 +60,7 @@ include('./admin-header.php');
|
||||
<table class="optiontable">
|
||||
<tr>
|
||||
<th scope="row"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>
|
||||
<td><code><?php echo gmdate('Y-m-d g:i:s a'); ?></code></td>
|
||||
<td><code><?php echo gmdate(__('Y-m-d g:i:s a')); ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Times in the weblog should differ by:') ?> </th>
|
||||
|
||||
@@ -40,7 +40,6 @@ include('admin-header.php');
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -54,7 +53,6 @@ include('admin-header.php');
|
||||
<th width="33%" scope="row"><?php _e('Show at most:') ?></th>
|
||||
<td>
|
||||
<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <?php _e('posts') ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -72,7 +70,7 @@ include('admin-header.php');
|
||||
<td>
|
||||
<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br />
|
||||
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
|
||||
<p><?php _e('Note: If you use the <code><--more--></code> feature, it will cut off posts in RSS feeds.'); ?></p>
|
||||
<p><?php _e('Note: If you use the <code><!--more--></code> feature, it will cut off posts in RSS feeds.'); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -63,7 +63,7 @@ case 'edit':
|
||||
?>
|
||||
<div id='preview' class='wrap'>
|
||||
<h2 id="preview-post"><?php _e('Page Preview (updated when page is saved)'); ?></h2>
|
||||
<iframe src="<?php echo attribute_escape(apply_filters('preview_page_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
|
||||
<iframe src="<?php echo clean_url(apply_filters('preview_page_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -69,7 +69,7 @@ case 'edit':
|
||||
?>
|
||||
<div id='preview' class='wrap'>
|
||||
<h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?></h2>
|
||||
<iframe src="<?php echo attribute_escape(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
|
||||
<iframe src="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -28,7 +28,7 @@ else
|
||||
<?php
|
||||
switch($step) {
|
||||
case 0:
|
||||
$goback = attribute_escape(stripslashes(wp_get_referer()));
|
||||
$goback = clean_url(stripslashes(wp_get_referer()));
|
||||
?>
|
||||
<p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.'); ?></p>
|
||||
<h2 class="step"><a href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress »'); ?></a></h2>
|
||||
@@ -40,7 +40,7 @@ switch($step) {
|
||||
if ( empty( $_GET['backto'] ) )
|
||||
$backto = __get_option('home');
|
||||
else
|
||||
$backto = attribute_escape(stripslashes($_GET['backto']));
|
||||
$backto = clean_url(stripslashes($_GET['backto']));
|
||||
?>
|
||||
<h2><?php _e('Step 1'); ?></h2>
|
||||
<p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"), $backto); ?></p>
|
||||
|
||||
@@ -35,7 +35,7 @@ function wp_upload_display( $dims = false, $href = '' ) {
|
||||
$r = '';
|
||||
|
||||
if ( $href )
|
||||
$r .= "<a id='file-link-$id' href='$href' title='$post_title' class='file-link $class'>\n";
|
||||
$r .= "<a id='file-link-$id' href='" . clean_url($href) ."' title='$post_title' class='file-link $class'>\n";
|
||||
if ( $href || $image_src )
|
||||
$r .= "\t\t\t$innerHTML";
|
||||
if ( $href )
|
||||
@@ -83,9 +83,9 @@ function wp_upload_view() {
|
||||
echo '[ ';
|
||||
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . attribute_escape(add_query_arg('action', 'edit')) . '" title="' . __('Edit this file') . '">' . __('edit') . '</a>';
|
||||
echo '<a href="' . clean_url(add_query_arg('action', 'edit')) . '" title="' . __('Edit this file') . '">' . __('edit') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . attribute_escape(remove_query_arg(array('action', 'ID'))) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
|
||||
echo '<a href="' . clean_url(remove_query_arg(array('action', 'ID'))) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
|
||||
echo ' ]'; ?></span>
|
||||
</div>
|
||||
|
||||
@@ -123,9 +123,9 @@ function wp_upload_form() {
|
||||
echo '[ ';
|
||||
echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . attribute_escape(add_query_arg('action', 'view')) . '">' . __('links') . '</a>';
|
||||
echo '<a href="' . clean_url(add_query_arg('action', 'view')) . '">' . __('links') . '</a>';
|
||||
echo ' | ';
|
||||
echo '<a href="' . attribute_escape(remove_query_arg(array('action','ID'))) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
|
||||
echo '<a href="' . clean_url(remove_query_arg(array('action','ID'))) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
|
||||
echo ' ]'; ?></span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the curr
|
||||
$href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
|
||||
if ( isset($tab_array[4]) && is_array($tab_array[4]) )
|
||||
add_query_arg( $tab_array[4], $href );
|
||||
$_href = attribute_escape( $href);
|
||||
$_href = clean_url( $href);
|
||||
$page_links = '';
|
||||
$class = 'upload-tab alignleft';
|
||||
if ( $tab == $t ) {
|
||||
|
||||
@@ -55,7 +55,7 @@ include ('admin-header.php');
|
||||
<div id="message" class="updated fade">
|
||||
<p><strong><?php _e('User updated.') ?></strong></p>
|
||||
<?php if ( $wp_http_referer ) : ?>
|
||||
<p><a href="<?php echo attribute_escape($wp_http_referer); ?>"><?php _e('« Back to Authors and Users'); ?></a></p>
|
||||
<p><a href="<?php echo clean_url($wp_http_referer); ?>"><?php _e('« Back to Authors and Users'); ?></a></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -25,14 +25,20 @@ $comment_content = trim($_POST['comment']);
|
||||
|
||||
// If the user is logged in
|
||||
$user = wp_get_current_user();
|
||||
if ( $user->ID ) :
|
||||
if ( $user->ID ) {
|
||||
$comment_author = $wpdb->escape($user->display_name);
|
||||
$comment_author_email = $wpdb->escape($user->user_email);
|
||||
$comment_author_url = $wpdb->escape($user->user_url);
|
||||
else :
|
||||
if ( current_user_can('unfiltered_html') ) {
|
||||
if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
|
||||
kses_remove_filters(); // start with a clean slate
|
||||
kses_init_filters(); // set up the filters
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( get_option('comment_registration') )
|
||||
wp_die( __('Sorry, you must be logged in to post a comment.') );
|
||||
endif;
|
||||
}
|
||||
|
||||
$comment_type = '';
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ function the_author_posts_link($deprecated = '') {
|
||||
|
||||
function get_author_posts_url($author_id, $author_nicename = '') {
|
||||
global $wpdb, $wp_rewrite, $post, $cache_userdata;
|
||||
$auth_ID = $author_id;
|
||||
$auth_ID = (int) $author_id;
|
||||
$link = $wp_rewrite->get_author_permastruct();
|
||||
|
||||
if ( empty($link) ) {
|
||||
|
||||
@@ -96,7 +96,7 @@ function get_links($category = -1,
|
||||
$output .= get_option('links_recently_updated_prepend');
|
||||
$the_link = '#';
|
||||
if ( !empty($row->link_url) )
|
||||
$the_link = wp_specialchars($row->link_url);
|
||||
$the_link = clean_url($row->link_url);
|
||||
$rel = $row->link_rel;
|
||||
if ( '' != $rel )
|
||||
$rel = ' rel="' . $rel . '"';
|
||||
@@ -165,7 +165,7 @@ function get_linkcatname($id = 0) {
|
||||
if ( empty($cats) || ! is_array($cats) )
|
||||
return '';
|
||||
|
||||
$cat_id = $cats[0]; // Take the first cat.
|
||||
$cat_id = (int) $cats[0]; // Take the first cat.
|
||||
|
||||
$cat = get_category($cat_id);
|
||||
return $cat->cat_name;
|
||||
@@ -260,7 +260,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
|
||||
|
||||
$the_link = '#';
|
||||
if ( !empty($bookmark->link_url) )
|
||||
$the_link = wp_specialchars($bookmark->link_url);
|
||||
$the_link = clean_url($bookmark->link_url);
|
||||
|
||||
$rel = $bookmark->link_rel;
|
||||
if ( '' != $rel )
|
||||
@@ -344,10 +344,14 @@ function wp_list_bookmarks($args = '') {
|
||||
$bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_invisible&show_updated=$show_updated");
|
||||
|
||||
if ( !empty($bookmarks) ) {
|
||||
$output .= str_replace(array('%id', '%class'), array("linkuncat", $class), $category_before);
|
||||
$output .= "$title_before$title_li$title_after\n\t<ul>\n";
|
||||
$output .= _walk_bookmarks($bookmarks, $r);
|
||||
$output .= "\n\t</ul>\n$category_after\n";
|
||||
if ( !empty( $title_li ) ){
|
||||
$output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);
|
||||
$output .= "$title_before$title_li$title_after\n\t<ul>\n";
|
||||
$output .= _walk_bookmarks($bookmarks, $r);
|
||||
$output .= "\n\t</ul>\n$category_after\n";
|
||||
} else {
|
||||
$output .= _walk_bookmarks($bookmarks, $r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
function get_bookmark($bookmark_id, $output = OBJECT) {
|
||||
global $wpdb;
|
||||
|
||||
$bookmark_id = (int) $bookmark_id;
|
||||
$link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$bookmark_id'");
|
||||
$link->link_category = wp_get_link_cats($bookmark_id);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
function wp_cache_add($key, $data, $flag = '', $expire = 0) {
|
||||
global $wp_object_cache;
|
||||
$data = unserialize(serialize($data));
|
||||
|
||||
return $wp_object_cache->add($key, $data, $flag, $expire);
|
||||
}
|
||||
@@ -37,12 +38,14 @@ function wp_cache_init() {
|
||||
|
||||
function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
|
||||
global $wp_object_cache;
|
||||
$data = unserialize(serialize($data));
|
||||
|
||||
return $wp_object_cache->replace($key, $data, $flag, $expire);
|
||||
}
|
||||
|
||||
function wp_cache_set($key, $data, $flag = '', $expire = 0) {
|
||||
global $wp_object_cache;
|
||||
$data = unserialize(serialize($data));
|
||||
|
||||
return $wp_object_cache->set($key, $data, $flag, $expire);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class WP_Roles {
|
||||
unset($this->role_objects[$role]);
|
||||
unset($this->role_names[$role]);
|
||||
unset($this->roles[$role]);
|
||||
|
||||
|
||||
if ( $this->use_db )
|
||||
update_option($this->role_key, $this->roles);
|
||||
}
|
||||
@@ -427,7 +427,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
}
|
||||
|
||||
$author_data = get_userdata($user_id);
|
||||
$page_author_data = get_userdata($post->post_author);
|
||||
$page_author_data = get_userdata($page->post_author);
|
||||
if ($user_id == $page_author_data->ID)
|
||||
$caps[] = 'read';
|
||||
else
|
||||
|
||||
@@ -62,8 +62,9 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
|
||||
function get_the_category($id = false) {
|
||||
global $post, $category_cache, $blog_id;
|
||||
|
||||
$id = (int) $id;
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
|
||||
if ( !isset($category_cache[$blog_id][$id]) )
|
||||
update_post_category_cache($id);
|
||||
|
||||
@@ -33,7 +33,7 @@ function &get_categories($args = '') {
|
||||
$key = md5( serialize( $r ) );
|
||||
if ( $cache = wp_cache_get( 'get_categories', 'category' ) )
|
||||
if ( isset( $cache[ $key ] ) )
|
||||
return $cache[ $key ];
|
||||
return apply_filters('get_categories', $cache[$key], $r);
|
||||
|
||||
$where = 'cat_ID > 0';
|
||||
$inclusions = '';
|
||||
@@ -146,6 +146,7 @@ function &get_category(&$category, $output = OBJECT) {
|
||||
wp_cache_add($category->cat_ID, $category, 'category');
|
||||
$_category = $category;
|
||||
} else {
|
||||
$category = (int) $category;
|
||||
if ( ! $_category = wp_cache_get($category, 'category') ) {
|
||||
$_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");
|
||||
wp_cache_set($category, $_category, 'category');
|
||||
|
||||
@@ -148,6 +148,9 @@ class WP {
|
||||
$this->query_vars[$wpvar] = $_GET[$wpvar];
|
||||
elseif (!empty($perma_query_vars[$wpvar]))
|
||||
$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
|
||||
|
||||
if ( !empty( $this->query_vars[$wpvar] ) )
|
||||
$this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
|
||||
}
|
||||
|
||||
foreach ($this->private_query_vars as $var) {
|
||||
|
||||
@@ -150,7 +150,7 @@ function get_comments_number( $post_id = 0 ) {
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
if ( !$post_id )
|
||||
$post_id = $id;
|
||||
$post_id = (int) $id;
|
||||
|
||||
$post = get_post($post_id);
|
||||
if ( ! isset($post->comment_count) )
|
||||
@@ -271,6 +271,12 @@ function pings_open() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function wp_comment_form_unfiltered_html_nonce() {
|
||||
global $post;
|
||||
if ( current_user_can('unfiltered_html') )
|
||||
wp_nonce_field('unfiltered-html-comment_' . $post->ID, '_wp_unfiltered_html_comment', false);
|
||||
}
|
||||
|
||||
function comments_template( $file = '/comments.php' ) {
|
||||
global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ function &get_comment(&$comment, $output = OBJECT) {
|
||||
$comment_cache[$comment->comment_ID] = &$comment;
|
||||
$_comment = & $comment_cache[$comment->comment_ID];
|
||||
} else {
|
||||
$comment = (int) $comment;
|
||||
if ( !isset($comment_cache[$comment]) ) {
|
||||
$_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment' LIMIT 1");
|
||||
$comment_cache[$comment->comment_ID] = & $_comment;
|
||||
@@ -169,7 +170,7 @@ function sanitize_comment_cookies() {
|
||||
if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) {
|
||||
$comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]);
|
||||
$comment_author_url = stripslashes($comment_author_url);
|
||||
$comment_author_url = attribute_escape($comment_author_url);
|
||||
$comment_author_url = clean_url($comment_author_url);
|
||||
$_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url;
|
||||
}
|
||||
}
|
||||
@@ -345,7 +346,7 @@ function wp_insert_comment($commentdata) {
|
||||
('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
|
||||
");
|
||||
|
||||
$id = $wpdb->insert_id;
|
||||
$id = (int) $wpdb->insert_id;
|
||||
|
||||
if ( $comment_approved == 1)
|
||||
wp_update_comment_count($comment_post_ID);
|
||||
|
||||
@@ -93,6 +93,10 @@ function spawn_cron() {
|
||||
}
|
||||
|
||||
function wp_cron() {
|
||||
// Prevent infinite loops caused by lack of wp-cron.php
|
||||
if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false )
|
||||
return;
|
||||
|
||||
$crons = _get_cron_array();
|
||||
|
||||
if ( !is_array($crons) )
|
||||
|
||||
@@ -31,6 +31,8 @@ add_filter('pre_comment_author_name', 'wp_filter_kses');
|
||||
add_filter('pre_comment_author_email', 'wp_filter_kses');
|
||||
add_filter('pre_comment_author_url', 'wp_filter_kses');
|
||||
|
||||
add_action('comment_form', 'wp_comment_form_unfiltered_html_nonce');
|
||||
|
||||
// Default filters for these functions
|
||||
add_filter('comment_author', 'wptexturize');
|
||||
add_filter('comment_author', 'convert_chars');
|
||||
|
||||
@@ -108,7 +108,7 @@ function comments_rss($commentsrssfilename = '') {
|
||||
|
||||
|
||||
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
||||
$auth_ID = $author_id;
|
||||
$auth_ID = (int) $author_id;
|
||||
$permalink_structure = get_option('permalink_structure');
|
||||
|
||||
if ( '' == $permalink_structure ) {
|
||||
|
||||
@@ -63,7 +63,6 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace( '|<p>(<div[^>]*>\s*)|', "$1<p>", $pee );
|
||||
$pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
|
||||
$pee = preg_replace( '|<p>|', "$1<p>", $pee );
|
||||
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
|
||||
@@ -82,7 +81,7 @@ function wpautop($pee, $br = 1) {
|
||||
if ( strstr( $pee, '<pre' ) )
|
||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
|
||||
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
|
||||
/**/
|
||||
|
||||
return $pee;
|
||||
}
|
||||
|
||||
@@ -1073,7 +1072,11 @@ function clean_url( $url, $protocols = null ) {
|
||||
$strip = array('%0d', '%0a');
|
||||
$url = str_replace($strip, '', $url);
|
||||
$url = str_replace(';//', '://', $url);
|
||||
$url = (!strstr($url, '://')) ? 'http://'.$url : $url;
|
||||
// Append http unless a relative link starting with / or a php file.
|
||||
if ( strpos($url, '://') === false &&
|
||||
substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9]+?\.php/i', $url) )
|
||||
$url = 'http://' . $url;
|
||||
|
||||
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
|
||||
if ( !is_array($protocols) )
|
||||
$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
|
||||
|
||||
@@ -566,7 +566,7 @@ function update_post_category_cache($post_ids) {
|
||||
$post_id_array = (array) explode(',', $post_ids);
|
||||
$count = count( $post_id_array);
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
$post_id = $post_id_array[ $i ];
|
||||
$post_id = (int) $post_id_array[ $i ];
|
||||
if ( isset( $category_cache[$blog_id][$post_id] ) ) {
|
||||
unset( $post_id_array[ $i ] );
|
||||
continue;
|
||||
@@ -620,7 +620,7 @@ function update_postmeta_cache($post_id_list = '') {
|
||||
$post_id_array = (array) explode(',', $post_id_list);
|
||||
$count = count( $post_id_array);
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
$post_id = $post_id_array[ $i ];
|
||||
$post_id = (int) $post_id_array[ $i ];
|
||||
if ( isset( $post_meta_cache[$blog_id][$post_id] ) ) { // If the meta is already cached
|
||||
unset( $post_id_array[ $i ] );
|
||||
continue;
|
||||
@@ -920,9 +920,11 @@ function wp_nonce_url($actionurl, $action = -1) {
|
||||
return wp_specialchars(add_query_arg('_wpnonce', wp_create_nonce($action), $actionurl));
|
||||
}
|
||||
|
||||
function wp_nonce_field($action = -1) {
|
||||
echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />';
|
||||
wp_referer_field();
|
||||
function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true) {
|
||||
$name = attribute_escape($name);
|
||||
echo '<input type="hidden" name="' . $name . '" value="' . wp_create_nonce($action) . '" />';
|
||||
if ( $referer )
|
||||
wp_referer_field();
|
||||
}
|
||||
|
||||
function wp_referer_field() {
|
||||
@@ -1190,7 +1192,7 @@ function wp_nonce_ays($action) {
|
||||
|
||||
$adminurl = get_option('siteurl') . '/wp-admin';
|
||||
if ( wp_get_referer() )
|
||||
$adminurl = wp_get_referer();
|
||||
$adminurl = clean_url(wp_get_referer());
|
||||
|
||||
$title = __('WordPress Confirmation');
|
||||
// Remove extra layer of slashes.
|
||||
@@ -1198,16 +1200,16 @@ function wp_nonce_ays($action) {
|
||||
if ( $_POST ) {
|
||||
$q = http_build_query($_POST);
|
||||
$q = explode( ini_get('arg_separator.output'), $q);
|
||||
$html .= "\t<form method='post' action='$pagenow'>\n";
|
||||
$html .= "\t<form method='post' action='" . attribute_escape($pagenow) . "'>\n";
|
||||
foreach ( (array) $q as $a ) {
|
||||
$v = substr(strstr($a, '='), 1);
|
||||
$k = substr($a, 0, -(strlen($v)+1));
|
||||
$html .= "\t\t<input type='hidden' name='" . attribute_escape(urldecode($k)) . "' value='" . attribute_escape(urldecode($v)) . "' />\n";
|
||||
}
|
||||
$html .= "\t\t<input type='hidden' name='_wpnonce' value='" . wp_create_nonce($action) . "' />\n";
|
||||
$html .= "\t\t<div id='message' class='confirm fade'>\n\t\t<p>" . wp_explain_nonce($action) . "</p>\n\t\t<p><a href='$adminurl'>" . __('No') . "</a> <input type='submit' value='" . __('Yes') . "' /></p>\n\t\t</div>\n\t</form>\n";
|
||||
$html .= "\t\t<div id='message' class='confirm fade'>\n\t\t<p>" . wp_specialchars(wp_explain_nonce($action)) . "</p>\n\t\t<p><a href='$adminurl'>" . __('No') . "</a> <input type='submit' value='" . __('Yes') . "' /></p>\n\t\t</div>\n\t</form>\n";
|
||||
} else {
|
||||
$html .= "\t<div id='message' class='confirm fade'>\n\t<p>" . wp_explain_nonce($action) . "</p>\n\t<p><a href='$adminurl'>" . __('No') . "</a> <a href='" . add_query_arg( '_wpnonce', wp_create_nonce($action), $_SERVER['REQUEST_URI'] ) . "'>" . __('Yes') . "</a></p>\n\t</div>\n";
|
||||
$html .= "\t<div id='message' class='confirm fade'>\n\t<p>" . wp_specialchars(wp_explain_nonce($action)) . "</p>\n\t<p><a href='$adminurl'>" . __('No') . "</a> <a href='" . clean_url(add_query_arg( '_wpnonce', wp_create_nonce($action), $_SERVER['REQUEST_URI'] )) . "'>" . __('Yes') . "</a></p>\n\t</div>\n";
|
||||
}
|
||||
$html .= "</body>\n</html>";
|
||||
wp_die($html, $title);
|
||||
|
||||
@@ -147,8 +147,7 @@ function get_bloginfo($show='') {
|
||||
|
||||
|
||||
function wp_title($sep = '»', $display = true) {
|
||||
global $wpdb;
|
||||
global $m, $year, $monthnum, $day, $category_name, $wp_locale, $posts;
|
||||
global $wpdb, $wp_locale, $wp_query;
|
||||
|
||||
$cat = get_query_var('cat');
|
||||
$p = get_query_var('p');
|
||||
@@ -156,6 +155,10 @@ function wp_title($sep = '»', $display = true) {
|
||||
$category_name = get_query_var('category_name');
|
||||
$author = get_query_var('author');
|
||||
$author_name = get_query_var('author_name');
|
||||
$m = (int) get_query_var('m');
|
||||
$year = (int) get_query_var('year');
|
||||
$monthnum = (int)get_query_var('monthnum');
|
||||
$day = (int) get_query_var('day');
|
||||
$title = '';
|
||||
|
||||
// If there's a category
|
||||
@@ -196,14 +199,15 @@ function wp_title($sep = '»', $display = true) {
|
||||
if ( !empty($year) ) {
|
||||
$title = $year;
|
||||
if ( !empty($monthnum) )
|
||||
$title .= " $sep ".$wp_locale->get_month($monthnum);
|
||||
$title .= " $sep " . $wp_locale->get_month($monthnum);
|
||||
if ( !empty($day) )
|
||||
$title .= " $sep ".zeroise($day, 2);
|
||||
$title .= " $sep " . zeroise($day, 2);
|
||||
}
|
||||
|
||||
// If there is a post
|
||||
if ( is_single() || is_page() ) {
|
||||
$title = strip_tags($posts[0]->post_title);
|
||||
$queried = $wp_query->get_queried_object();
|
||||
$title = strip_tags($queried->post_title);
|
||||
$title = apply_filters('single_post_title', $title);
|
||||
}
|
||||
|
||||
@@ -256,7 +260,12 @@ function single_cat_title($prefix = '', $display = true ) {
|
||||
|
||||
|
||||
function single_month_title($prefix = '', $display = true ) {
|
||||
global $m, $monthnum, $wp_locale, $year;
|
||||
global $wp_locale;
|
||||
|
||||
$m = (int) get_query_var('m');
|
||||
$year = (int) get_query_var('year');
|
||||
$monthnum = (int) get_query_var('monthnum');
|
||||
|
||||
if ( !empty($monthnum) && !empty($year) ) {
|
||||
$my_year = $year;
|
||||
$my_month = $wp_locale->get_month($monthnum);
|
||||
@@ -280,6 +289,7 @@ function single_month_title($prefix = '', $display = true ) {
|
||||
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
|
||||
$text = wptexturize($text);
|
||||
$title_text = attribute_escape($text);
|
||||
$url = clean_url($url);
|
||||
|
||||
if ('link' == $format)
|
||||
return "\t<link rel='archives' title='$title_text' href='$url' />\n";
|
||||
@@ -962,7 +972,7 @@ function paginate_links( $arg = '' ) {
|
||||
$link = str_replace('%#%', $current - 1, $link);
|
||||
if ( $add_args )
|
||||
$link = add_query_arg( $add_args, $link );
|
||||
$page_links[] = "<a class='prev page-numbers' href='" . attribute_escape($link) . "'>$prev_text</a>";
|
||||
$page_links[] = "<a class='prev page-numbers' href='" . clean_url($link) . "'>$prev_text</a>";
|
||||
endif;
|
||||
for ( $n = 1; $n <= $total; $n++ ) :
|
||||
if ( $n == $current ) :
|
||||
@@ -974,7 +984,7 @@ function paginate_links( $arg = '' ) {
|
||||
$link = str_replace('%#%', $n, $link);
|
||||
if ( $add_args )
|
||||
$link = add_query_arg( $add_args, $link );
|
||||
$page_links[] = "<a class='page-numbers' href='" . attribute_escape($link) . "'>$n</a>";
|
||||
$page_links[] = "<a class='page-numbers' href='" . clean_url($link) . "'>$n</a>";
|
||||
$dots = true;
|
||||
elseif ( $dots && !$show_all ) :
|
||||
$page_links[] = "<span class='page-numbers dots'>...</span>";
|
||||
@@ -987,7 +997,7 @@ function paginate_links( $arg = '' ) {
|
||||
$link = str_replace('%#%', $current + 1, $link);
|
||||
if ( $add_args )
|
||||
$link = add_query_arg( $add_args, $link );
|
||||
$page_links[] = "<a class='next page-numbers' href='" . attribute_escape($link) . "'>$next_text</a>";
|
||||
$page_links[] = "<a class='next page-numbers' href='" . clean_url($link) . "'>$next_text</a>";
|
||||
endif;
|
||||
switch ( $type ) :
|
||||
case 'array' :
|
||||
|
||||
40
wp-includes/js/scriptaculous/wp-scriptaculous.js
Normal file
40
wp-includes/js/scriptaculous/wp-scriptaculous.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
|
||||
var Scriptaculous = {
|
||||
Version: '1.6.1',
|
||||
require: function(libraryName) {
|
||||
// inserting via DOM fails in Safari 2.0, so brute force approach
|
||||
document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
|
||||
},
|
||||
load: function() {
|
||||
if((typeof Prototype=='undefined') ||
|
||||
(typeof Element == 'undefined') ||
|
||||
(typeof Element.Methods=='undefined') ||
|
||||
parseFloat(Prototype.Version.split(".")[0] + "." +
|
||||
Prototype.Version.split(".")[1]) < 1.5)
|
||||
throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
|
||||
|
||||
$A(document.getElementsByTagName("script")).findAll( function(s) {
|
||||
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
|
||||
}).each( function(s) {
|
||||
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
|
||||
var includes = s.src.match(/\?.*load=([a-z,]*)/);
|
||||
if ( includes )
|
||||
includes[1].split(',').each(
|
||||
function(include) { Scriptaculous.require(path+include+'.js') });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Scriptaculous.load();
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
@ require('../../../wp-config.php');
|
||||
cache_javascript_headers();
|
||||
|
||||
function wp_translate_tinymce_lang($text) {
|
||||
if ( ! function_exists('__') ) {
|
||||
@@ -43,7 +44,7 @@
|
||||
$mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css';
|
||||
$mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css';
|
||||
$mce_css = apply_filters('mce_css', $mce_css);
|
||||
if ( $_SERVER['HTTPS'] ) {
|
||||
if ( $_SERVER['HTTPS'] == 'on' ) {
|
||||
$mce_css = str_replace('http://', 'https://', $mce_css);
|
||||
$mce_popups_css = str_replace('http://', 'https://', $mce_popups_css);
|
||||
}
|
||||
@@ -73,6 +74,7 @@ initArray = {
|
||||
convert_newlines_to_brs : false,
|
||||
remove_linebreaks : false,
|
||||
fix_list_elements : true,
|
||||
gecko_spellcheck : true,
|
||||
entities : "38,amp,60,lt,62,gt",
|
||||
content_css : "<?php echo $mce_css; ?>",
|
||||
valid_elements : "<?php echo $valid_elements; ?>",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* @version 1.08
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <EFBFBD> 2005-2006, Moxiecode Systems AB, All rights reserved.
|
||||
* @copyright Copyright 2005-2006, Moxiecode Systems AB, All rights reserved.
|
||||
*
|
||||
* This file compresses the TinyMCE JavaScript using GZip and
|
||||
* enables the browser to do two requests instead of one for each .js file.
|
||||
@@ -82,7 +82,7 @@ $cacheDir = realpath("."); // Absolute directory path to where cached gz file
|
||||
$debug = false; // Enable this option if you need debuging info
|
||||
|
||||
// Headers
|
||||
header("Content-type: text/javascript; charset: UTF-8");
|
||||
header("Content-Type: text/javascript; charset=" . get_bloginfo('charset'));
|
||||
// header("Cache-Control: must-revalidate");
|
||||
header("Vary: Accept-Encoding"); // Handle proxies
|
||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php require_once('../../../wp-config.php'); ?>
|
||||
<?php require_once('../../../wp-config.php');
|
||||
header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
|
||||
<head>
|
||||
|
||||
@@ -93,8 +93,9 @@ function post_permalink($post_id = 0, $mode = '') { // $mode legacy
|
||||
function get_page_link($id = false) {
|
||||
global $post;
|
||||
|
||||
$id = (int) $id;
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
|
||||
if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
|
||||
$link = get_option('home');
|
||||
@@ -109,7 +110,7 @@ function _get_page_link( $id = false ) {
|
||||
global $post, $wp_rewrite;
|
||||
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
|
||||
$pagestruct = $wp_rewrite->get_page_permastruct();
|
||||
|
||||
@@ -130,7 +131,7 @@ function get_attachment_link($id = false) {
|
||||
$link = false;
|
||||
|
||||
if (! $id) {
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
}
|
||||
|
||||
$object = get_post($id);
|
||||
@@ -379,7 +380,7 @@ function next_post_link($format='%link »', $link='%title', $in_same_cat =
|
||||
function get_pagenum_link($pagenum = 1) {
|
||||
global $wp_rewrite;
|
||||
|
||||
$qstr = wp_specialchars($_SERVER['REQUEST_URI']);
|
||||
$qstr = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$page_querystring = "paged";
|
||||
$page_modstring = "page/";
|
||||
@@ -446,7 +447,7 @@ function get_pagenum_link($pagenum = 1) {
|
||||
return $qstr;
|
||||
}
|
||||
|
||||
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
||||
function get_next_posts_page_link($max_page = 0) {
|
||||
global $paged, $pagenow;
|
||||
|
||||
if ( !is_single() ) {
|
||||
@@ -454,10 +455,14 @@ function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
||||
$paged = 1;
|
||||
$nextpage = intval($paged) + 1;
|
||||
if ( !$max_page || $max_page >= $nextpage )
|
||||
echo get_pagenum_link($nextpage);
|
||||
return get_pagenum_link($nextpage);
|
||||
}
|
||||
}
|
||||
|
||||
function next_posts($max_page = 0) {
|
||||
echo clean_url(get_next_posts_page_link($max_page));
|
||||
}
|
||||
|
||||
function next_posts_link($label='Next Page »', $max_page=0) {
|
||||
global $paged, $wpdb, $wp_query;
|
||||
if ( !$max_page ) {
|
||||
@@ -473,18 +478,20 @@ function next_posts_link($label='Next Page »', $max_page=0) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function previous_posts() { // original by cfactor at cooltux.org
|
||||
function get_previous_posts_page_link() {
|
||||
global $paged, $pagenow;
|
||||
|
||||
if ( !is_single() ) {
|
||||
$nextpage = intval($paged) - 1;
|
||||
if ( $nextpage < 1 )
|
||||
$nextpage = 1;
|
||||
echo get_pagenum_link($nextpage);
|
||||
return get_pagenum_link($nextpage);
|
||||
}
|
||||
}
|
||||
|
||||
function previous_posts() {
|
||||
echo clean_url(get_previous_posts_page_link());
|
||||
}
|
||||
|
||||
function previous_posts_link($label='« Previous Page') {
|
||||
global $paged;
|
||||
|
||||
@@ -473,7 +473,7 @@ endif;
|
||||
if ( !function_exists('wp_verify_nonce') ) :
|
||||
function wp_verify_nonce($nonce, $action = -1) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = $user->id;
|
||||
$uid = (int) $user->id;
|
||||
|
||||
$i = ceil(time() / 43200);
|
||||
|
||||
@@ -487,7 +487,7 @@ endif;
|
||||
if ( !function_exists('wp_create_nonce') ) :
|
||||
function wp_create_nonce($action = -1) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = $user->id;
|
||||
$uid = (int) $user->id;
|
||||
|
||||
$i = ceil(time() / 43200);
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@ function wp_list_pages($args = '') {
|
||||
$r = array_merge($defaults, $r);
|
||||
|
||||
$output = '';
|
||||
$current_page = 0;
|
||||
|
||||
// sanitize, mostly to keep spaces out
|
||||
$r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']);
|
||||
@@ -288,7 +289,8 @@ function wp_list_pages($args = '') {
|
||||
$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
|
||||
|
||||
global $wp_query;
|
||||
$current_page = $wp_query->get_queried_object_id();
|
||||
if ( is_page() )
|
||||
$current_page = $wp_query->get_queried_object_id();
|
||||
$output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
|
||||
|
||||
if ( $r['title_li'] )
|
||||
|
||||
@@ -74,16 +74,16 @@ function &get_children($args = '', $output = OBJECT) {
|
||||
// get extended entry info (<!--more-->)
|
||||
function get_extended($post) {
|
||||
//Match the new style more links
|
||||
if (preg_match('/<!--more(.+?)?-->/', $post, $matches)) {
|
||||
list($main,$extended) = explode($matches[0],$post,2);
|
||||
if ( preg_match('/<!--more(.*?)-->/', $post, $matches) ) {
|
||||
list($main, $extended) = explode($matches[0], $post, 2);
|
||||
} else {
|
||||
$main = $post;
|
||||
$extended = '';
|
||||
}
|
||||
|
||||
// Strip leading and trailing whitespace
|
||||
$main = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$main);
|
||||
$extended = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$extended);
|
||||
$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
|
||||
$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
|
||||
|
||||
return array('main' => $main, 'extended' => $extended);
|
||||
}
|
||||
@@ -105,6 +105,7 @@ function &get_post(&$post, $output = OBJECT) {
|
||||
$post_cache[$blog_id][$post->ID] = &$post;
|
||||
$_post = & $post_cache[$blog_id][$post->ID];
|
||||
} else {
|
||||
$post = (int) $post;
|
||||
if ( $_post = wp_cache_get($post, 'pages') )
|
||||
return get_page($_post, $output);
|
||||
elseif ( isset($post_cache[$blog_id][$post]) )
|
||||
@@ -374,7 +375,7 @@ function get_post_custom($post_id = 0) {
|
||||
global $id, $post_meta_cache, $wpdb, $blog_id;
|
||||
|
||||
if ( !$post_id )
|
||||
$post_id = $id;
|
||||
$post_id = (int) $id;
|
||||
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
@@ -446,6 +447,8 @@ function wp_delete_post($postid = 0) {
|
||||
}
|
||||
|
||||
function wp_get_post_categories($post_id = 0) {
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
$cats = &get_the_category($post_id);
|
||||
$cat_ids = array();
|
||||
foreach ( $cats as $cat )
|
||||
@@ -457,6 +460,7 @@ function wp_get_recent_posts($num = 10) {
|
||||
global $wpdb;
|
||||
|
||||
// Set the limit clause, if we got a limit
|
||||
$num = (int) $num;
|
||||
if ($num) {
|
||||
$limit = "LIMIT $num";
|
||||
}
|
||||
@@ -470,6 +474,8 @@ function wp_get_recent_posts($num = 10) {
|
||||
function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
||||
global $wpdb;
|
||||
|
||||
$postid = (int) $postid;
|
||||
|
||||
$post = get_post($postid, $mode);
|
||||
|
||||
// Set categories
|
||||
@@ -533,7 +539,7 @@ function wp_insert_post($postarr = array()) {
|
||||
|
||||
// Get the post ID.
|
||||
if ( $update )
|
||||
$post_ID = $ID;
|
||||
$post_ID = (int) $ID;
|
||||
|
||||
// Create a valid post name. Drafts are allowed to have an empty
|
||||
// post name.
|
||||
@@ -637,7 +643,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 = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
if ( empty($post_name) && 'draft' != $post_status ) {
|
||||
@@ -763,6 +769,8 @@ function wp_publish_post($post_id) {
|
||||
|
||||
function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
global $wpdb;
|
||||
|
||||
$post_ID = (int) $post_ID;
|
||||
// If $post_categories isn't already an array, make it one:
|
||||
if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories))
|
||||
$post_categories = array(get_option('default_category'));
|
||||
@@ -773,7 +781,7 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
$old_categories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = $post_ID");
|
||||
WHERE post_id = '$post_ID'");
|
||||
|
||||
if (!$old_categories) {
|
||||
$old_categories = array();
|
||||
@@ -788,8 +796,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
foreach ($delete_cats as $del) {
|
||||
$wpdb->query("
|
||||
DELETE FROM $wpdb->post2cat
|
||||
WHERE category_id = $del
|
||||
AND post_id = $post_ID
|
||||
WHERE category_id = '$del'
|
||||
AND post_id = '$post_ID'
|
||||
");
|
||||
}
|
||||
}
|
||||
@@ -799,10 +807,11 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
|
||||
if ($add_cats) {
|
||||
foreach ($add_cats as $new_cat) {
|
||||
$new_cat = (int) $new_cat;
|
||||
if ( !empty($new_cat) )
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->post2cat (post_id, category_id)
|
||||
VALUES ($post_ID, $new_cat)");
|
||||
VALUES ('$post_ID', '$new_cat')");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -928,6 +937,7 @@ function &get_page(&$page, $output = OBJECT) {
|
||||
wp_cache_add($page->ID, $page, 'pages');
|
||||
$_page = $page;
|
||||
} else {
|
||||
$page = (int) $page;
|
||||
// first, check the cache
|
||||
if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) {
|
||||
// not in the page cache?
|
||||
@@ -1244,7 +1254,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
|
||||
$update = false;
|
||||
if ( !empty($ID) ) {
|
||||
$update = true;
|
||||
$post_ID = $ID;
|
||||
$post_ID = (int) $ID;
|
||||
}
|
||||
|
||||
// Create a valid post name.
|
||||
@@ -1339,7 +1349,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
|
||||
(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, guid)
|
||||
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', '$guid')");
|
||||
$post_ID = $wpdb->insert_id;
|
||||
$post_ID = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
if ( empty($post_name) ) {
|
||||
@@ -1494,7 +1504,7 @@ function wp_mime_type_icon( $mime = 0 ) {
|
||||
$mime = (int) $mime;
|
||||
if ( !$post =& get_post( $mime ) )
|
||||
return false;
|
||||
$post_id = $post->ID;
|
||||
$post_id = (int) $post->ID;
|
||||
$mime = $post->post_mime_type;
|
||||
}
|
||||
|
||||
|
||||
@@ -765,9 +765,11 @@ class WP_Query {
|
||||
$searchand = ' AND ';
|
||||
}
|
||||
$term = addslashes_gpc($q['s']);
|
||||
if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')";
|
||||
|
||||
$search = " AND ({$search}) ";
|
||||
if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
|
||||
$search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')";
|
||||
|
||||
if ( !empty($search) )
|
||||
$search = " AND ({$search}) ";
|
||||
}
|
||||
|
||||
// Category stuff
|
||||
@@ -794,16 +796,16 @@ class WP_Query {
|
||||
$in_cats = substr($in_cats, 0, -2);
|
||||
$out_cats = substr($out_cats, 0, -2);
|
||||
if ( strlen($in_cats) > 0 )
|
||||
$in_cats = " AND category_id IN ($in_cats)";
|
||||
$in_cats = " AND $wpdb->post2cat.category_id IN ($in_cats)";
|
||||
if ( strlen($out_cats) > 0 ) {
|
||||
$ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id IN ($out_cats)");
|
||||
$ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE $wpdb->post2cat.category_id IN ($out_cats)");
|
||||
if ( is_array($ids) && count($ids > 0) ) {
|
||||
foreach ( $ids as $id )
|
||||
$out_posts .= "$id, ";
|
||||
$out_posts = substr($out_posts, 0, -2);
|
||||
}
|
||||
if ( strlen($out_posts) > 0 )
|
||||
$out_cats = " AND ID NOT IN ($out_posts)";
|
||||
$out_cats = " AND $wpdb->posts.ID NOT IN ($out_posts)";
|
||||
else
|
||||
$out_cats = '';
|
||||
}
|
||||
@@ -929,9 +931,9 @@ class WP_Query {
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
if ( 'post' == $post_type )
|
||||
$cap = 'edit_private_posts';
|
||||
$cap = 'read_private_posts';
|
||||
else
|
||||
$cap = 'edit_private_pages';
|
||||
$cap = 'read_private_pages';
|
||||
|
||||
if ( current_user_can($cap) )
|
||||
$where .= " OR post_status = 'private'";
|
||||
|
||||
@@ -89,7 +89,7 @@ function wp_insert_user($userdata) {
|
||||
$query = "UPDATE $wpdb->users SET user_pass='$user_pass', user_email='$user_email', user_url='$user_url', user_nicename = '$user_nicename', display_name = '$display_name' WHERE ID = '$ID'";
|
||||
$query = apply_filters('update_user_query', $query);
|
||||
$wpdb->query( $query );
|
||||
$user_id = $ID;
|
||||
$user_id = (int) $ID;
|
||||
} else {
|
||||
$query = "INSERT INTO $wpdb->users
|
||||
(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)
|
||||
@@ -97,7 +97,7 @@ function wp_insert_user($userdata) {
|
||||
('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
|
||||
$query = apply_filters('create_user_query', $query);
|
||||
$wpdb->query( $query );
|
||||
$user_id = $wpdb->insert_id;
|
||||
$user_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
update_usermeta( $user_id, 'first_name', $first_name);
|
||||
|
||||
@@ -782,13 +782,13 @@ function parse_w3cdtf ( $date_str ) {
|
||||
|
||||
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]);
|
||||
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]);
|
||||
|
||||
# calc epoch for current date assuming GMT
|
||||
$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
|
||||
|
||||
$offset = 0;
|
||||
if ( $match[10] == 'Z' ) {
|
||||
if ( $match[11] == 'Z' ) {
|
||||
# zulu time, aka GMT
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -17,7 +17,7 @@ class WP_Scripts {
|
||||
$this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
|
||||
$this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20061113' );
|
||||
$mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
|
||||
$this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061113' );
|
||||
$this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' );
|
||||
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
|
||||
$this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116');
|
||||
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '20070118');
|
||||
@@ -78,7 +78,7 @@ class WP_Scripts {
|
||||
if ( isset($this->args[$handle]) )
|
||||
$ver .= '&' . $this->args[$handle];
|
||||
$src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src;
|
||||
$src = add_query_arg('ver', $ver, $src);
|
||||
$src = clean_url(add_query_arg('ver', $ver, $src));
|
||||
echo "<script type='text/javascript' src='$src'></script>\n";
|
||||
}
|
||||
$this->printed[] = $handle;
|
||||
|
||||
@@ -345,7 +345,7 @@ function get_home_template() {
|
||||
function get_page_template() {
|
||||
global $wp_query;
|
||||
|
||||
$id = $wp_query->post->ID;
|
||||
$id = (int) $wp_query->post->ID;
|
||||
$template = get_post_meta($id, '_wp_page_template', true);
|
||||
|
||||
if ( 'default' == $template )
|
||||
|
||||
@@ -9,6 +9,7 @@ function get_profile($field, $user = false) {
|
||||
|
||||
function get_usernumposts($userid) {
|
||||
global $wpdb;
|
||||
$userid = (int) $userid;
|
||||
return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_type = 'post' AND post_status = 'publish'");
|
||||
}
|
||||
|
||||
@@ -160,8 +161,8 @@ function setup_userdata($user_id = '') {
|
||||
|
||||
$userdata = $user->data;
|
||||
$user_login = $user->user_login;
|
||||
$user_level = $user->user_level;
|
||||
$user_ID = $user->ID;
|
||||
$user_level = (int) $user->user_level;
|
||||
$user_ID = (int) $user->ID;
|
||||
$user_email = $user->user_email;
|
||||
$user_url = $user->user_url;
|
||||
$user_pass_md5 = md5($user->user_pass);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// This holds the version number in a separate file so we can bump it without cluttering the SVN
|
||||
|
||||
$wp_version = '2.1';
|
||||
$wp_db_version = 4772;
|
||||
$wp_version = '2.1.3';
|
||||
$wp_db_version = 4773;
|
||||
|
||||
?>
|
||||
|
||||
@@ -286,7 +286,7 @@ default:
|
||||
$user_pass = '';
|
||||
$using_cookie = FALSE;
|
||||
|
||||
if ( !isset( $_REQUEST['redirect_to'] ) )
|
||||
if ( !isset( $_REQUEST['redirect_to'] ) || is_user_logged_in() )
|
||||
$redirect_to = 'wp-admin/';
|
||||
else
|
||||
$redirect_to = $_REQUEST['redirect_to'];
|
||||
|
||||
@@ -84,7 +84,7 @@ if ( !empty($tb_url) && !empty($title) && !empty($tb_url) ) {
|
||||
$title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title;
|
||||
}
|
||||
|
||||
$comment_post_ID = $tb_id;
|
||||
$comment_post_ID = (int) $tb_id;
|
||||
$comment_author = $blog_name;
|
||||
$comment_author_email = '';
|
||||
$comment_author_url = $tb_url;
|
||||
|
||||
70
xmlrpc.php
70
xmlrpc.php
@@ -209,7 +209,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[1];
|
||||
$post_ID = (int) $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
|
||||
@@ -244,7 +244,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[1]; /* though we don't use it yet */
|
||||
$blog_ID = (int) $args[1]; /* though we don't use it yet */
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$num_posts = $args[4];
|
||||
@@ -292,7 +292,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[1];
|
||||
$blog_ID = (int) $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
|
||||
@@ -326,7 +326,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[1];
|
||||
$blog_ID = (int) $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$content = $args[4];
|
||||
@@ -363,7 +363,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[1]; /* though we don't use it yet */
|
||||
$blog_ID = (int) $args[1]; /* though we don't use it yet */
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$content = $args[4];
|
||||
@@ -411,7 +411,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[1];
|
||||
$post_ID = (int) $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$content = $args[4];
|
||||
@@ -435,6 +435,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
extract($actual_post);
|
||||
|
||||
if ( ('publish' == $post_status) && !current_user_can('publish_posts') )
|
||||
return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.');
|
||||
|
||||
$post_title = xmlrpc_getposttitle($content);
|
||||
$post_category = xmlrpc_getpostcategory($content);
|
||||
$post_content = xmlrpc_removepostdata($content);
|
||||
@@ -459,7 +462,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[1];
|
||||
$post_ID = (int) $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$publish = $args[4];
|
||||
@@ -500,7 +503,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0]; // we will support this in the near future
|
||||
$blog_ID = (int) $args[0]; // we will support this in the near future
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$content_struct = $args[3];
|
||||
@@ -535,7 +538,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
|
||||
}
|
||||
|
||||
$to_ping = $content_struct['mt_tb_ping_urls'];
|
||||
$to_ping = $content_struct['mt_tb_ping_urls'];
|
||||
if ( is_array($to_ping) )
|
||||
$to_ping = implode(' ', $to_ping);
|
||||
|
||||
// Do some timestamp voodoo
|
||||
$dateCreatedd = $content_struct['dateCreated'];
|
||||
@@ -595,7 +600,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$post_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$content_struct = $args[3];
|
||||
@@ -629,12 +634,18 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_more = $content_struct['mt_text_more'];
|
||||
$post_status = $publish ? 'publish' : 'draft';
|
||||
|
||||
|
||||
if ( ('publish' == $post_status) && !current_user_can('publish_posts') )
|
||||
return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.');
|
||||
|
||||
if ($post_more) {
|
||||
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
|
||||
}
|
||||
|
||||
$to_ping = $content_struct['mt_tb_ping_urls'];
|
||||
|
||||
$to_ping = $content_struct['mt_tb_ping_urls'];
|
||||
if ( is_array($to_ping) )
|
||||
$to_ping = implode(' ', $to_ping);
|
||||
|
||||
$comment_status = (empty($content_struct['mt_allow_comments'])) ?
|
||||
get_option('default_comment_status')
|
||||
: $content_struct['mt_allow_comments'];
|
||||
@@ -676,7 +687,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$post_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
@@ -731,10 +742,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$blog_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$num_posts = $args[3];
|
||||
$num_posts = (int) $args[3];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
@@ -797,7 +808,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$blog_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
@@ -831,7 +842,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$blog_ID = $wpdb->escape($args[0]);
|
||||
$blog_ID = (int) $args[0];
|
||||
$user_login = $wpdb->escape($args[1]);
|
||||
$user_pass = $wpdb->escape($args[2]);
|
||||
$data = $args[3];
|
||||
@@ -857,8 +868,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$upload = wp_upload_bits($name, $type, $bits);
|
||||
if ( ! empty($upload['error']) ) {
|
||||
logIO('O', '(MW) Could not write file '.$name);
|
||||
return new IXR_Error(500, 'Could not write file '.$name);
|
||||
$errorString = 'Could not write file ' . $name . ' (' . $upload['error'] . ')';
|
||||
logIO('O', '(MW) ' . $errorString);
|
||||
return new IXR_Error(500, $errorString);
|
||||
}
|
||||
// Construct the attachment array
|
||||
// attach to post_id -1
|
||||
@@ -888,10 +900,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$blog_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$num_posts = $args[3];
|
||||
$num_posts = (int) $args[3];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
@@ -933,7 +945,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$blog_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
@@ -962,7 +974,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$post_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
@@ -977,7 +989,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
foreach($catids as $catid) {
|
||||
$categories[] = array(
|
||||
'categoryName' => get_cat_name($catid),
|
||||
'categoryId' => $catid,
|
||||
'categoryId' => (string) $catid,
|
||||
'isPrimary' => $isPrimary
|
||||
);
|
||||
$isPrimary = false;
|
||||
@@ -992,7 +1004,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$post_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$categories = $args[3];
|
||||
@@ -1075,7 +1087,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$post_ID = (int) $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
@@ -1137,18 +1149,18 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
} elseif (preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
|
||||
// the path defines the post_ID (archives/p/XXXX)
|
||||
$blah = explode('/', $match[0]);
|
||||
$post_ID = $blah[1];
|
||||
$post_ID = (int) $blah[1];
|
||||
$way = 'from the path';
|
||||
} elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
|
||||
// the querystring defines the post_ID (?p=XXXX)
|
||||
$blah = explode('=', $match[0]);
|
||||
$post_ID = $blah[1];
|
||||
$post_ID = (int) $blah[1];
|
||||
$way = 'from the querystring';
|
||||
} elseif (isset($urltest['fragment'])) {
|
||||
// an #anchor is there, it's either...
|
||||
if (intval($urltest['fragment'])) {
|
||||
// ...an integer #XXXX (simpliest case)
|
||||
$post_ID = $urltest['fragment'];
|
||||
$post_ID = (int) $urltest['fragment'];
|
||||
$way = 'from the fragment (numeric)';
|
||||
} elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) {
|
||||
// ...a post id in the form 'post-###'
|
||||
|
||||
Reference in New Issue
Block a user