Death to trailing tabs. Props Mark J. fixes #2405
git-svn-id: http://svn.automattic.com/wordpress/trunk@3517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
17b47c6fe0
commit
dd202ce1f9
|
@ -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;
|
||||
|
|
|
@ -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 = '') {
|
||||
|
|
|
@ -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 = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
|
||||
$default_cat_id = get_option('default_category');
|
||||
|
||||
|
||||
if ($category->cat_ID != $default_cat_id)
|
||||
$edit .= "<td><a href='categories.php?action=delete&cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->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')."</a>";
|
||||
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<select name='$fieldname' size='1'>\n";
|
||||
foreach ($results as $row) {
|
||||
|
@ -1834,7 +1834,7 @@ o.submit();
|
|||
<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
function wp_import_handle_upload() {
|
||||
|
|
|
@ -53,41 +53,41 @@ if (isset($_GET['page'])) {
|
|||
if ( $page_hook ) {
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . '/wp-admin/admin-header.php');
|
||||
|
||||
|
||||
do_action($page_hook);
|
||||
} else {
|
||||
if ( validate_file($plugin_page) ) {
|
||||
die(__('Invalid plugin page'));
|
||||
}
|
||||
|
||||
|
||||
if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
|
||||
die(sprintf(__('Cannot load %s.'), $plugin_page));
|
||||
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . '/wp-admin/admin-header.php');
|
||||
|
||||
|
||||
include(ABSPATH . "wp-content/plugins/$plugin_page");
|
||||
}
|
||||
|
||||
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
exit();
|
||||
} else if (isset($_GET['import'])) {
|
||||
|
||||
|
||||
$importer = $_GET['import'];
|
||||
|
||||
if ( validate_file($importer) ) {
|
||||
die(__('Invalid importer.'));
|
||||
}
|
||||
|
||||
|
||||
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
|
||||
die(__('Cannot load importer.'));
|
||||
|
||||
|
||||
include(ABSPATH . "wp-admin/import/$importer.php");
|
||||
|
||||
$parent_file = 'import.php';
|
||||
$title = __('Import');
|
||||
|
||||
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
|
@ -97,7 +97,7 @@ if (isset($_GET['page'])) {
|
|||
kses_init_filters(); // Always filter imported data with kses.
|
||||
|
||||
call_user_func($wp_importers[$importer][2]);
|
||||
|
||||
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
exit();
|
||||
|
|
|
@ -25,16 +25,16 @@ $post = get_default_post_to_edit();
|
|||
|
||||
$popuptitle = wp_specialchars(stripslashes($popuptitle));
|
||||
$text = wp_specialchars(stripslashes(urldecode($text)));
|
||||
|
||||
|
||||
$popuptitle = funky_javascript_fix($popuptitle);
|
||||
$text = funky_javascript_fix($text);
|
||||
|
||||
|
||||
$post_title = wp_specialchars($_REQUEST['post_title']);
|
||||
if (!empty($post_title))
|
||||
$post->post_title = stripslashes($post_title);
|
||||
else
|
||||
$post->post_title = $popuptitle;
|
||||
|
||||
|
||||
|
||||
$content = wp_specialchars($_REQUEST['content']);
|
||||
$popupurl = wp_specialchars($_REQUEST['popupurl']);
|
||||
|
|
|
@ -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 = "<?php echo addslashes(__('That category name is invalid. Try something else.')); ?>";
|
||||
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';
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -88,9 +88,9 @@ if ('view' == $mode) {
|
|||
if ($i % 2)
|
||||
$class .= ' alternate';
|
||||
echo "<li id='comment-$comment->comment_ID' class='$class'>";
|
||||
?>
|
||||
?>
|
||||
<p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
|
||||
|
||||
|
||||
<?php comment_text() ?>
|
||||
|
||||
<p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A');
|
||||
|
@ -118,7 +118,7 @@ if ('view' == $mode) {
|
|||
?>
|
||||
<p>
|
||||
<strong><?php _e('No comments found.') ?></strong></p>
|
||||
|
||||
|
||||
<?php
|
||||
} // end if ($comments)
|
||||
} elseif ('edit' == $mode) {
|
||||
|
|
|
@ -17,16 +17,16 @@ $ids = array();
|
|||
|
||||
foreach ($names as $cat_name) {
|
||||
$cat_name = trim( $cat_name );
|
||||
|
||||
|
||||
if ( !$category_nicename = sanitize_title($cat_name) )
|
||||
continue;
|
||||
if ( $already = category_exists($cat_name) ) {
|
||||
$ids[] = (string) $already;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$new_cat_id = wp_create_category($cat_name);
|
||||
|
||||
|
||||
$ids[] = (string) $new_cat_id;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,15 +93,15 @@ if ( count($arc_result) ) { ?>
|
|||
<legend><?php _e('Browse Month…') ?></legend>
|
||||
<select name='m'>
|
||||
<?php
|
||||
foreach ($arc_result as $arc_row) {
|
||||
foreach ($arc_result as $arc_row) {
|
||||
$arc_year = $arc_row->yyear;
|
||||
$arc_month = $arc_row->mmonth;
|
||||
|
||||
|
||||
if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
|
||||
$default = 'selected="selected"';
|
||||
else
|
||||
$default = null;
|
||||
|
||||
|
||||
echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
|
||||
echo $month[zeroise($arc_month, 2)] . " $arc_year";
|
||||
echo "</option>\n";
|
||||
|
@ -157,7 +157,7 @@ $class = ('alternate' == $class) ? '' : 'alternate';
|
|||
foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
|
||||
switch($column_name) {
|
||||
|
||||
|
||||
case 'id':
|
||||
?>
|
||||
<th scope="row"><?php echo $id ?></th>
|
||||
|
|
|
@ -135,13 +135,13 @@ class Blogger_Import {
|
|||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
||||
$response = curl_exec ($ch);
|
||||
|
||||
|
||||
if ($parse) {
|
||||
$response = $this->parse_response($response);
|
||||
$response['url'] = $url;
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ class Blogger_Import {
|
|||
$this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
|
||||
update_option('import-blogger', $this->import);
|
||||
}
|
||||
|
||||
|
||||
// Redirects to next step
|
||||
function do_next_step() {
|
||||
header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
|
||||
|
@ -224,13 +224,13 @@ class Blogger_Import {
|
|||
if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
|
||||
$this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
|
||||
}
|
||||
|
||||
// Try logging in. If we get an array of cookies back, we at least connected.
|
||||
|
||||
// Try logging in. If we get an array of cookies back, we at least connected.
|
||||
$this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
|
||||
if ( !is_array( $this->import['cookies'] ) ) {
|
||||
$this->login_form(__('Login failed. Please enter your credentials again.'));
|
||||
}
|
||||
|
||||
|
||||
// Save the password so we can log the browser in when it's time to publish.
|
||||
$this->import['pass'] = $_POST['pass'];
|
||||
$this->import['user'] = $_POST['user'];
|
||||
|
@ -395,7 +395,7 @@ class Blogger_Import {
|
|||
update_option('import-blogger', $import);
|
||||
$archive = $this->get_blogger($url);
|
||||
if ( $archive['code'] > 200 )
|
||||
continue;
|
||||
continue;
|
||||
$posts = explode('<wordpresspost>', $archive['body']);
|
||||
for ($i = 1; $i < count($posts); $i = $i + 1) {
|
||||
$postparts = explode('<wordpresscomment>', $posts[$i]);
|
||||
|
@ -409,7 +409,7 @@ class Blogger_Import {
|
|||
$post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
|
||||
$post_author_name = $wpdb->escape(trim($postinfo[1]));
|
||||
$post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
|
||||
|
||||
|
||||
if ( $this->lump_authors ) {
|
||||
// Ignore Blogger authors. Use the current user_ID for all posts imported.
|
||||
$post_author = $GLOBALS['user_ID'];
|
||||
|
@ -435,21 +435,21 @@ class Blogger_Import {
|
|||
$posthour = zeroise($post_date_His[0], 2);
|
||||
$postminute = zeroise($post_date_His[1], 2);
|
||||
$postsecond = zeroise($post_date_His[2], 2);
|
||||
|
||||
|
||||
if (($post_date[2] == 'PM') && ($posthour != '12'))
|
||||
$posthour = $posthour + 12;
|
||||
else if (($post_date[2] == 'AM') && ($posthour == '12'))
|
||||
$posthour = '00';
|
||||
|
||||
|
||||
$post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
|
||||
|
||||
|
||||
$post_content = addslashes($post_content);
|
||||
$post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
|
||||
|
||||
|
||||
$post_title = addslashes($post_title);
|
||||
|
||||
|
||||
$post_status = 'publish';
|
||||
|
||||
|
||||
if ( $ID = post_exists($post_title, '', $post_date) ) {
|
||||
$post_array[$i]['ID'] = $ID;
|
||||
$skippedpostcount++;
|
||||
|
@ -597,7 +597,7 @@ class Blogger_Import {
|
|||
if ( $_GET['restart'] == 'true' ) {
|
||||
$this->restart();
|
||||
}
|
||||
|
||||
|
||||
if ( isset($_GET['noheader']) ) {
|
||||
$this->import = get_settings('import-blogger');
|
||||
|
||||
|
@ -647,7 +647,7 @@ class Blogger_Import {
|
|||
break;
|
||||
}
|
||||
die;
|
||||
|
||||
|
||||
} else {
|
||||
$this->greet();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class Dotclear_Import {
|
|||
{
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
function greet()
|
||||
{
|
||||
echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog. Mileage may vary.').'</p>';
|
||||
|
@ -153,11 +153,11 @@ class Dotclear_Import {
|
|||
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
|
||||
set_magic_quotes_runtime(0);
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
|
||||
// Get Categories
|
||||
return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A);
|
||||
}
|
||||
|
||||
|
||||
function get_dc_users()
|
||||
{
|
||||
global $wpdb;
|
||||
|
@ -165,25 +165,25 @@ class Dotclear_Import {
|
|||
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
|
||||
set_magic_quotes_runtime(0);
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
|
||||
// Get Users
|
||||
|
||||
|
||||
return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A);
|
||||
}
|
||||
|
||||
|
||||
function get_dc_posts()
|
||||
{
|
||||
// General Housekeeping
|
||||
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
|
||||
set_magic_quotes_runtime(0);
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
|
||||
// Get Posts
|
||||
return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name
|
||||
FROM dc_post INNER JOIN dc_categorie
|
||||
ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A);
|
||||
}
|
||||
|
||||
|
||||
function get_dc_comments()
|
||||
{
|
||||
global $wpdb;
|
||||
|
@ -191,11 +191,11 @@ class Dotclear_Import {
|
|||
$dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
|
||||
set_magic_quotes_runtime(0);
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
|
||||
// Get Comments
|
||||
return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A);
|
||||
}
|
||||
|
||||
|
||||
function get_dc_links()
|
||||
{
|
||||
//General Housekeeping
|
||||
|
@ -205,7 +205,7 @@ class Dotclear_Import {
|
|||
|
||||
return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);
|
||||
}
|
||||
|
||||
|
||||
function cat2wp($categories='')
|
||||
{
|
||||
// General Housekeeping
|
||||
|
@ -220,7 +220,7 @@ class Dotclear_Import {
|
|||
{
|
||||
$count++;
|
||||
extract($category);
|
||||
|
||||
|
||||
// Make Nice Variables
|
||||
$name = $wpdb->escape($cat_libelle_url);
|
||||
$title = $wpdb->escape(csc ($cat_libelle));
|
||||
|
@ -236,7 +236,7 @@ class Dotclear_Import {
|
|||
}
|
||||
$dccat2wpcat[$id] = $ret_id;
|
||||
}
|
||||
|
||||
|
||||
// Store category translation for future use
|
||||
add_option('dccat2wpcat',$dccat2wpcat);
|
||||
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
|
||||
|
@ -245,14 +245,14 @@ class Dotclear_Import {
|
|||
echo __('No Categories to Import!');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function users2wp($users='')
|
||||
{
|
||||
// General Housekeeping
|
||||
global $wpdb;
|
||||
$count = 0;
|
||||
$dcid2wpid = array();
|
||||
|
||||
|
||||
// Midnight Mojo
|
||||
if(is_array($users))
|
||||
{
|
||||
|
@ -261,14 +261,14 @@ class Dotclear_Import {
|
|||
{
|
||||
$count++;
|
||||
extract($user);
|
||||
|
||||
|
||||
// Make Nice Variables
|
||||
$name = $wpdb->escape(csc ($name));
|
||||
$RealName = $wpdb->escape(csc ($user_pseudo));
|
||||
|
||||
|
||||
if($uinfo = get_userdatabylogin($name))
|
||||
{
|
||||
|
||||
|
||||
$ret_id = wp_insert_user(array(
|
||||
'ID' => $uinfo->ID,
|
||||
'user_login' => $user_id,
|
||||
|
@ -289,9 +289,9 @@ class Dotclear_Import {
|
|||
);
|
||||
}
|
||||
$dcid2wpid[$user_id] = $ret_id;
|
||||
|
||||
|
||||
// Set Dotclear-to-WordPress permissions translation
|
||||
|
||||
|
||||
// Update Usermeta Data
|
||||
$user = new WP_User($ret_id);
|
||||
$wp_perms = $user_level + 1;
|
||||
|
@ -302,26 +302,26 @@ class Dotclear_Import {
|
|||
else if(3 <= $wp_perms) { $user->set_role('contributor'); }
|
||||
else if(2 <= $wp_perms) { $user->set_role('contributor'); }
|
||||
else { $user->set_role('subscriber'); }
|
||||
|
||||
|
||||
update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
|
||||
update_usermeta( $ret_id, 'rich_editing', 'false');
|
||||
update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
|
||||
update_usermeta( $ret_id, 'last_name', csc ($user_nom));
|
||||
}// End foreach($users as $user)
|
||||
|
||||
|
||||
// Store id translation array for future use
|
||||
add_option('dcid2wpid',$dcid2wpid);
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
|
||||
return true;
|
||||
}// End if(is_array($users)
|
||||
|
||||
|
||||
echo __('No Users to Import!');
|
||||
return false;
|
||||
|
||||
|
||||
}// End function user2wp()
|
||||
|
||||
|
||||
function posts2wp($posts='')
|
||||
{
|
||||
// General Housekeeping
|
||||
|
@ -338,11 +338,11 @@ class Dotclear_Import {
|
|||
{
|
||||
$count++;
|
||||
extract($post);
|
||||
|
||||
|
||||
// Set Dotclear-to-WordPress status translation
|
||||
$stattrans = array(0 => 'draft', 1 => 'publish');
|
||||
$comment_status_map = array (0 => 'closed', 1 => 'open');
|
||||
|
||||
|
||||
//Can we do this more efficiently?
|
||||
$uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
|
||||
$authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
|
||||
|
@ -356,9 +356,9 @@ class Dotclear_Import {
|
|||
$post_excerpt = $wpdb->escape ($post_excerpt);
|
||||
$post_content = $wpdb->escape ($post_content);
|
||||
$post_status = $stattrans[$post_pub];
|
||||
|
||||
|
||||
// Import Post data into WordPress
|
||||
|
||||
|
||||
if($pinfo = post_exists($Title,$post_content))
|
||||
{
|
||||
$ret_id = wp_insert_post(array(
|
||||
|
@ -397,7 +397,7 @@ class Dotclear_Import {
|
|||
);
|
||||
}
|
||||
$dcposts2wpposts[$post_id] = $ret_id;
|
||||
|
||||
|
||||
// Make Post-to-Category associations
|
||||
$cats = array();
|
||||
if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
|
||||
|
@ -407,11 +407,11 @@ class Dotclear_Import {
|
|||
}
|
||||
// Store ID translation for later use
|
||||
add_option('dcposts2wpposts',$dcposts2wpposts);
|
||||
|
||||
|
||||
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function comments2wp($comments='')
|
||||
{
|
||||
// General Housekeeping
|
||||
|
@ -419,7 +419,7 @@ class Dotclear_Import {
|
|||
$count = 0;
|
||||
$dccm2wpcm = array();
|
||||
$postarr = get_option('dcposts2wpposts');
|
||||
|
||||
|
||||
// Magic Mojo
|
||||
if(is_array($comments))
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ class Dotclear_Import {
|
|||
{
|
||||
$count++;
|
||||
extract($comment);
|
||||
|
||||
|
||||
// WordPressify Data
|
||||
$comment_ID = ltrim($comment_id, '0');
|
||||
$comment_post_ID = $postarr[$post_id];
|
||||
|
@ -437,7 +437,7 @@ class Dotclear_Import {
|
|||
$email = $wpdb->escape($comment_email);
|
||||
$web = "http://".$wpdb->escape($comment_site);
|
||||
$message = $wpdb->escape(textconv ($comment_content));
|
||||
|
||||
|
||||
if($cinfo = comment_exists($name, $comment_dt))
|
||||
{
|
||||
// Update comments
|
||||
|
@ -472,25 +472,25 @@ class Dotclear_Import {
|
|||
$dccm2wpcm[$comment_ID] = $ret_id;
|
||||
}
|
||||
// Store Comment ID translation for future use
|
||||
add_option('dccm2wpcm', $dccm2wpcm);
|
||||
|
||||
add_option('dccm2wpcm', $dccm2wpcm);
|
||||
|
||||
// Associate newly formed categories with posts
|
||||
get_comment_count($ret_id);
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
|
||||
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))
|
||||
{
|
||||
|
@ -499,7 +499,7 @@ class Dotclear_Import {
|
|||
{
|
||||
$count++;
|
||||
extract($link);
|
||||
|
||||
|
||||
if ($title != "") {
|
||||
if ($cinfo = link_cat_exists (csc ($title))) {
|
||||
$category = $cinfo;
|
||||
|
@ -511,7 +511,7 @@ class Dotclear_Import {
|
|||
} else {
|
||||
$linkname = $wpdb->escape(csc ($label));
|
||||
$description = $wpdb->escape(csc ($title));
|
||||
|
||||
|
||||
if($linfo = link_exists($linkname)) {
|
||||
$ret_id = wp_insert_link(array(
|
||||
'link_id' => $linfo,
|
||||
|
@ -540,67 +540,67 @@ class Dotclear_Import {
|
|||
echo __('No Links to Import!');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function import_categories()
|
||||
{
|
||||
// Category Import
|
||||
{
|
||||
// Category Import
|
||||
$cats = $this->get_dc_cats();
|
||||
$this->cat2wp($cats);
|
||||
add_option('dc_cats', $cats);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=2" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
|
||||
echo '</form>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
function import_users()
|
||||
{
|
||||
// User Import
|
||||
$users = $this->get_dc_users();
|
||||
$this->users2wp($users);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=3" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function import_posts()
|
||||
{
|
||||
// Post Import
|
||||
$posts = $this->get_dc_posts();
|
||||
$this->posts2wp($posts);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=4" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function import_comments()
|
||||
{
|
||||
// Comment Import
|
||||
$comments = $this->get_dc_comments();
|
||||
$this->comments2wp($comments);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=5" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function import_links()
|
||||
{
|
||||
//Link Import
|
||||
$links = $this->get_dc_links();
|
||||
$this->links2wp($links);
|
||||
add_option('dc_links', $links);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=6" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function cleanup_dcimport()
|
||||
{
|
||||
delete_option('tpre');
|
||||
|
@ -617,7 +617,7 @@ class Dotclear_Import {
|
|||
delete_option('dccharset');
|
||||
$this->tips();
|
||||
}
|
||||
|
||||
|
||||
function tips()
|
||||
{
|
||||
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Dotclear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
|
||||
|
@ -636,7 +636,7 @@ class Dotclear_Import {
|
|||
echo '</ul>';
|
||||
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
|
||||
}
|
||||
|
||||
|
||||
function db_form()
|
||||
{
|
||||
echo '<ul>';
|
||||
|
@ -648,7 +648,7 @@ class Dotclear_Import {
|
|||
printf('<li><label for="dccharset">%s</label> <input type="text" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:'));
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class LJ_Import {
|
|||
$trans_tbl = array_flip($trans_tbl);
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
|
||||
|
||||
function greet() {
|
||||
echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog. Pick a LiveJournal file to upload and click Import.').'</p>';
|
||||
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('|<entry>(.*?)</entry>|is', $importdata, $posts);
|
||||
$posts = $posts[1];
|
||||
unset($importdata);
|
||||
echo '<ol>';
|
||||
echo '<ol>';
|
||||
foreach ($posts as $post) {
|
||||
flush();
|
||||
preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
|
||||
|
@ -78,7 +78,7 @@ class LJ_Import {
|
|||
|
||||
preg_match_all('|<comment>(.*?)</comment>|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 '<h3>';
|
||||
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
|
||||
echo '</h3>';
|
||||
|
@ -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.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ class MT_Import {
|
|||
}
|
||||
if ( $num_pings )
|
||||
printf(__('(%s pings)'), $num_pings);
|
||||
|
||||
|
||||
echo "</li>";
|
||||
}
|
||||
flush();
|
||||
|
@ -420,7 +420,7 @@ class MT_Import {
|
|||
}
|
||||
|
||||
function MT_Import() {
|
||||
// Nothing.
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class RSS_Import {
|
|||
$trans_tbl = array_flip($trans_tbl);
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
|
||||
|
||||
function greet() {
|
||||
echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
|
||||
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 '<h3>';
|
||||
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
|
||||
echo '</h3>';
|
||||
|
@ -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.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 '</div>';
|
||||
}
|
||||
|
||||
|
||||
function greet()
|
||||
{
|
||||
echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern. Mileage may vary.').'</p>';
|
||||
|
@ -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 '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
|
||||
|
@ -192,14 +192,14 @@ class Textpattern_Import {
|
|||
echo __('No Categories to Import!');
|
||||
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 '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
|
||||
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 '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
|
||||
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 '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
|
||||
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 '<form action="admin.php?import=textpattern&step=2" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
|
||||
echo '</form>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
function import_users()
|
||||
{
|
||||
// User Import
|
||||
$users = $this->get_txp_users();
|
||||
$this->users2wp($users);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=textpattern&step=3" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function import_posts()
|
||||
{
|
||||
// Post Import
|
||||
$posts = $this->get_txp_posts();
|
||||
$this->posts2wp($posts);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=textpattern&step=4" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function import_comments()
|
||||
{
|
||||
// Comment Import
|
||||
$comments = $this->get_txp_comments();
|
||||
$this->comments2wp($comments);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=textpattern&step=5" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function import_links()
|
||||
{
|
||||
//Link Import
|
||||
$links = $this->get_txp_links();
|
||||
$this->links2wp($links);
|
||||
add_option('txp_links', $links);
|
||||
|
||||
|
||||
echo '<form action="admin.php?import=textpattern&step=6" method="post">';
|
||||
printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
function cleanup_txpimport()
|
||||
{
|
||||
delete_option('tpre');
|
||||
|
@ -546,7 +546,7 @@ class Textpattern_Import {
|
|||
delete_option('txphost');
|
||||
$this->tips();
|
||||
}
|
||||
|
||||
|
||||
function tips()
|
||||
{
|
||||
echo '<p>'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from Textpattern, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'</p>';
|
||||
|
@ -565,7 +565,7 @@ class Textpattern_Import {
|
|||
echo '</ul>';
|
||||
echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
|
||||
}
|
||||
|
||||
|
||||
function db_form()
|
||||
{
|
||||
echo '<ul>';
|
||||
|
@ -576,7 +576,7 @@ class Textpattern_Import {
|
|||
printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):'));
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<h1><?php _e('Second Step'); ?></h1>
|
||||
<p><?php _e('Now we’re going to create the database tables and fill them with some default data.'); ?></p>
|
||||
|
|
|
@ -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)
|
|||
?>
|
||||
<tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
|
||||
<td><strong><?php echo $link->link_name; ?></strong><br />
|
||||
<?php
|
||||
<?php
|
||||
echo sprintf(__('Description: %s'), $link->link_description) . "</td>";
|
||||
echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>";
|
||||
echo <<<LINKS
|
||||
|
|
|
@ -51,7 +51,7 @@ function removeThisItem(id) {
|
|||
listItems.splice(pos,1);
|
||||
recolorList(pos);
|
||||
ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ function getListPos(id) {
|
|||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
function getListItems() {
|
||||
if (list) return;
|
||||
|
|
|
@ -54,7 +54,7 @@ case 'delete-comment' :
|
|||
|
||||
if ( !$comment = get_comment($id) )
|
||||
die('0');
|
||||
if ( !current_user_can('edit_post', $comment->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;
|
||||
?>
|
||||
|
|
|
@ -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<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
|
|||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<?php
|
||||
|
|
|
@ -41,7 +41,7 @@ structure.onfocus = function () { document.getElementById('custom_selection').ch
|
|||
|
||||
var aInputs = document.getElementsByTagName('input');
|
||||
|
||||
for (var i = 0; i < aInputs.length; i++) {
|
||||
for (var i = 0; i < aInputs.length; i++) {
|
||||
aInputs[i].onclick = aInputs[i].onkeyup = upit;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ if ( isset($_POST) ) {
|
|||
$permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
|
||||
$wp_rewrite->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"
|
||||
<?php } ?>
|
||||
/>
|
||||
<?php _e('Custom, specify below'); ?>
|
||||
<?php _e('Custom, specify below'); ?>
|
||||
</label>
|
||||
<br />
|
||||
</p>
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -52,16 +52,16 @@ case 'update':
|
|||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
||||
require_once('admin-header.php');
|
||||
if ( !current_user_can('edit_plugins') )
|
||||
die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>');
|
||||
|
||||
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));
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
|
||||
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
die( __('You are not allowed to edit comments on this post.') );
|
||||
|
||||
$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. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
die( __('You are not allowed to delete comments on this post.') );
|
||||
|
||||
echo "<div class='wrap'>\n";
|
||||
|
@ -223,7 +223,7 @@ case 'deletecomment':
|
|||
if ( ! $comment = get_comment($comment) )
|
||||
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
|
||||
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
die( __('You are not allowed to edit comments on this post.') );
|
||||
|
||||
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. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
|
||||
|
||||
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. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
|
||||
|
||||
if ('1' != $comment->comment_approved) {
|
||||
|
@ -298,7 +298,7 @@ case 'approvecomment':
|
|||
if ( ! $comment = get_comment($comment) )
|
||||
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
|
||||
|
||||
wp_set_comment_status($comment->comment_ID, "approve");
|
||||
|
|
|
@ -103,7 +103,7 @@ switch($step) {
|
|||
</form>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
$dbname = trim($_POST['dbname']);
|
||||
$uname = trim($_POST['uname']);
|
||||
|
|
|
@ -60,7 +60,7 @@ break;
|
|||
default:
|
||||
|
||||
require_once('./admin-header.php');
|
||||
|
||||
|
||||
if ( ! current_user_can('edit_files') )
|
||||
die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
|
||||
|
||||
|
@ -71,7 +71,7 @@ default:
|
|||
|
||||
if (!is_file($real_file))
|
||||
$error = true;
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$f = @ fopen($real_file, 'r');
|
||||
if ( $f ) {
|
||||
|
@ -88,7 +88,7 @@ default:
|
|||
<div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div>
|
||||
<?php else: ?>
|
||||
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
|
|
|
@ -66,16 +66,16 @@ case 'update':
|
|||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
||||
require_once('admin-header.php');
|
||||
if ( !current_user_can('edit_themes') )
|
||||
die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
|
||||
|
||||
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));
|
||||
|
|
|
@ -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) ) {
|
|||
</tr>
|
||||
<?php
|
||||
$theme = '';
|
||||
|
||||
|
||||
$theme_names = array_keys($broken_themes);
|
||||
natcasesort($theme_names);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function upgrade_all() {
|
|||
if ( !empty($template) )
|
||||
$wp_current_db_version = 2541;
|
||||
}
|
||||
|
||||
|
||||
populate_options();
|
||||
|
||||
if ( $wp_current_db_version < 2541 ) {
|
||||
|
@ -29,7 +29,7 @@ function upgrade_all() {
|
|||
upgrade_110();
|
||||
upgrade_130();
|
||||
}
|
||||
|
||||
|
||||
if ( $wp_current_db_version < 3308 )
|
||||
upgrade_160();
|
||||
|
||||
|
@ -37,7 +37,7 @@ function upgrade_all() {
|
|||
upgrade_210();
|
||||
|
||||
$wp_rewrite->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 "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
|
||||
|
||||
|
||||
// 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)]}<br>";
|
||||
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'];
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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) {
|
|||
<h2 class="step"><a href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress »'); ?></a></h2>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
wp_cache_flush();
|
||||
make_db_current_silent();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require_once('admin.php');
|
||||
|
||||
$title = __('Edit User');
|
||||
$parent_file = 'profile.php';
|
||||
$parent_file = 'profile.php';
|
||||
$submenu_file = 'users.php';
|
||||
|
||||
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
|
||||
|
|
|
@ -4,7 +4,7 @@ require_once( ABSPATH . WPINC . '/registration-functions.php');
|
|||
|
||||
$title = __('Users');
|
||||
$parent_file = 'profile.php';
|
||||
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
$update = '';
|
||||
|
||||
|
@ -32,7 +32,7 @@ case 'promote':
|
|||
$user = new WP_User($id);
|
||||
$user->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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
@ -198,7 +198,7 @@ default:
|
|||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
||||
<form action="" method="post" name="updateusers" id="updateusers">
|
||||
<div class="wrap">
|
||||
<h2><?php _e('User List by Role'); ?></h2>
|
||||
|
@ -250,9 +250,9 @@ default:
|
|||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -872,7 +872,7 @@ table .vers, table .name {
|
|||
.dbx-handle-cursor {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
|
||||
/* toggle images */
|
||||
a.dbx-toggle, a.dbx-toggle:visited {
|
||||
display:block;
|
||||
|
|
|
@ -38,7 +38,7 @@ function blurry() {
|
|||
|
||||
var aInputs = document.getElementsByTagName('input');
|
||||
|
||||
for (var i = 0; i < aInputs.length; i++) {
|
||||
for (var i = 0; i < aInputs.length; i++) {
|
||||
aInputs[i].onclick = aInputs[i].onkeyup = upit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ if (have_posts()) :
|
|||
$title = apply_filters('the_title', $title);
|
||||
$title = apply_filters('the_title_rss', $title);
|
||||
printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
|
||||
} else {
|
||||
printf(__('by: %s'), get_comment_author_rss());
|
||||
} else {
|
||||
printf(__('by: %s'), get_comment_author_rss());
|
||||
} ?></title>
|
||||
<link><?php comment_link() ?></link>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
|
|
|
@ -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 "<div class='wrap'>";
|
||||
//echo "<pre>" . print_r($_POST, 1) . "</pre>";
|
||||
echo '<h2>' . __('Backup') . '</h2>
|
||||
|
@ -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 <a href=\\\"%s\\\">here</a>."), $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 '<script type="text/javascript"><!--//
|
||||
var msg = "' . $msg . '";
|
||||
window.parent.setProgress(msg);
|
||||
';
|
||||
|
||||
|
||||
if (is_writable(ABSPATH . $this->backup_dir)) {
|
||||
$this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a');
|
||||
if(!$this->fp) {
|
||||
|
@ -249,7 +249,7 @@ class wpdbBackup {
|
|||
$this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.');
|
||||
}
|
||||
else {
|
||||
if($table == '') {
|
||||
if($table == '') {
|
||||
//Begin new backup of MySql
|
||||
$this->stow("# WordPress MySQL database backup\n");
|
||||
$this->stow("#\n");
|
||||
|
@ -266,7 +266,7 @@ class wpdbBackup {
|
|||
$this->stow("# --------------------------------------------------------\n");
|
||||
$this->stow("# Table: " . $this->backquote($table) . "\n");
|
||||
$this->stow("# --------------------------------------------------------\n");
|
||||
}
|
||||
}
|
||||
$this->backup_table($table, $segment);
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ class wpdbBackup {
|
|||
}
|
||||
|
||||
if($this->fp) $this->close($this->fp);
|
||||
|
||||
|
||||
if($this->backup_errors) {
|
||||
foreach($this->backup_errors as $error) {
|
||||
echo "window.parent.addError('$error');\n";
|
||||
|
@ -294,7 +294,7 @@ class wpdbBackup {
|
|||
//--></script>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
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 = '<div class="updated"><p>' . __('Backup Successful') . '!';
|
||||
|
@ -698,7 +698,7 @@ class wpdbBackup {
|
|||
}
|
||||
$feedback .= '</p></div>';
|
||||
}
|
||||
|
||||
|
||||
if (count($this->backup_errors)) {
|
||||
$feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>";
|
||||
foreach($this->backup_errors as $error) {
|
||||
|
@ -706,7 +706,7 @@ class wpdbBackup {
|
|||
}
|
||||
$feedback .= "</pre></div>";
|
||||
}
|
||||
|
||||
|
||||
// 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 .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>';
|
||||
}
|
||||
|
||||
|
||||
// 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 '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>";
|
||||
}
|
||||
|
@ -781,21 +781,21 @@ class wpdbBackup {
|
|||
echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>';
|
||||
echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> ';
|
||||
echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />';
|
||||
|
||||
|
||||
// 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 '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>';
|
||||
echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>';
|
||||
|
@ -804,7 +804,7 @@ class wpdbBackup {
|
|||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
|
||||
// this stuff only displays if wp_cron is installed
|
||||
if (function_exists('wp_cron_init')) {
|
||||
echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>';
|
||||
|
@ -850,20 +850,20 @@ class wpdbBackup {
|
|||
echo '</fieldset>';
|
||||
}
|
||||
// end of wp_cron section
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
}// 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
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
|
|||
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.onkeypress = function esc(e) {
|
||||
document.onkeypress = function esc(e) {
|
||||
if(typeof(e) == "undefined") { e=event; }
|
||||
if (e.keyCode == 27) { self.close(); }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
||||
|
||||
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
|
||||
|
||||
|
||||
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
@ -15,7 +15,7 @@
|
|||
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
|
||||
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
|
||||
|
||||
|
||||
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
|
||||
<?php wp_get_archives('type=monthly&format=link'); ?>
|
||||
<?php //comments_popup_script(); // off by default ?>
|
||||
|
|
|
@ -5,15 +5,15 @@ get_header();
|
|||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
|
||||
<?php the_date('','<h2>','</h2>'); ?>
|
||||
|
||||
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
|
||||
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
|
||||
|
||||
|
||||
<div class="storycontent">
|
||||
<?php the_content(__('(more...)')); ?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="feedback">
|
||||
<?php wp_link_pages(); ?>
|
||||
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li id="search">
|
||||
<label for="s"><?php _e('Search:'); ?></label>
|
||||
<label for="s"><?php _e('Search:'); ?></label>
|
||||
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<div>
|
||||
<input type="text" name="s" id="s" size="15" /><br />
|
||||
|
|
|
@ -5,21 +5,21 @@
|
|||
<?php if (have_posts()) : ?>
|
||||
|
||||
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
|
||||
<?php /* If this is a category archive */ if (is_category()) { ?>
|
||||
<?php /* If this is a category archive */ if (is_category()) { ?>
|
||||
<h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>
|
||||
|
||||
|
||||
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
|
||||
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
|
||||
|
||||
|
||||
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
|
||||
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
|
||||
|
||||
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
|
||||
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
|
||||
|
||||
|
||||
<?php /* If this is a search */ } elseif (is_search()) { ?>
|
||||
<h2 class="pagetitle">Search Results</h2>
|
||||
|
||||
|
||||
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
|
||||
<h2 class="pagetitle">Author Archive</h2>
|
||||
|
||||
|
@ -38,29 +38,29 @@
|
|||
<div class="post">
|
||||
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
|
||||
<small><?php the_time('l, F jS, Y') ?></small>
|
||||
|
||||
|
||||
<div class="entry">
|
||||
<?php the_content() ?>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<h2 class="center">Not Found</h2>
|
||||
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
|
|
@ -20,6 +20,6 @@ Template Name: Archives
|
|||
<?php wp_list_cats(); ?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div id="content" class="widecolumn">
|
||||
|
||||
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"> </div>
|
||||
<div class="alignright"> </div>
|
||||
|
@ -16,9 +16,9 @@
|
|||
<p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
|
||||
|
||||
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
|
||||
|
||||
|
||||
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
|
||||
|
||||
|
||||
<p class="postmetadata alt">
|
||||
<small>
|
||||
This entry was posted
|
||||
|
@ -29,39 +29,39 @@
|
|||
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
|
||||
and is filed under <?php the_category(', ') ?>.
|
||||
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
|
||||
|
||||
|
||||
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
|
||||
// Both Comments and Pings are open ?>
|
||||
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
|
||||
|
||||
|
||||
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
|
||||
// Only Pings are Open ?>
|
||||
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
|
||||
|
||||
|
||||
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
|
||||
// Comments are open, Pings are not ?>
|
||||
You can skip to the end and leave a response. Pinging is currently not allowed.
|
||||
|
||||
|
||||
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
|
||||
// Neither Comments, nor Pings are open ?>
|
||||
Both comments and pings are currently closed.
|
||||
|
||||
Both comments and pings are currently closed.
|
||||
|
||||
<?php } edit_post_link('Edit this entry.','',''); ?>
|
||||
|
||||
|
||||
</small>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php comments_template(); ?>
|
||||
|
||||
|
||||
<?php endwhile; else: ?>
|
||||
|
||||
|
||||
<p>Sorry, no attachments matched your criteria.</p>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
|
|
@ -103,7 +103,7 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos
|
|||
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.onkeypress = function esc(e) {
|
||||
document.onkeypress = function esc(e) {
|
||||
if(typeof(e) == "undefined") { e=event; }
|
||||
if (e.keyCode == 27) { self.close(); }
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
if (!empty($post->post_password)) { // if there's a password
|
||||
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
|
||||
?>
|
||||
|
||||
|
||||
<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
|
||||
|
||||
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
</li>
|
||||
|
||||
<?php /* Changes every other comment to a different class */
|
||||
<?php /* Changes every other comment to a different class */
|
||||
if ('alt' == $oddcomment) $oddcomment = '';
|
||||
else $oddcomment = 'alt';
|
||||
?>
|
||||
|
@ -52,11 +52,11 @@
|
|||
|
||||
<?php if ('open' == $post->comment_status) : ?>
|
||||
<!-- If comments are open, but there are no comments. -->
|
||||
|
||||
|
||||
<?php else : // comments are closed ?>
|
||||
<!-- If comments are closed. -->
|
||||
<p class="nocomments">Comments are closed.</p>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ function kubrick_header_color_string() {
|
|||
$color = kubrick_header_color();
|
||||
if ( false === $color )
|
||||
return 'white';
|
||||
|
||||
|
||||
return $color;
|
||||
}
|
||||
|
||||
|
@ -100,21 +100,21 @@ function kubrick_add_theme_page() {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
if ( isset($_REQUEST['headerimage']) ) {
|
||||
if ( '' == $_REQUEST['headerimage'] )
|
||||
delete_option('kubrick_header_image');
|
||||
else
|
||||
update_option('kubrick_header_image', $_REQUEST['headerimage']);
|
||||
}
|
||||
|
||||
|
||||
if ( isset($_REQUEST['fontcolor']) ) {
|
||||
if ( '' == $_REQUEST['fontcolor'] )
|
||||
delete_option('kubrick_header_color');
|
||||
else
|
||||
update_option('kubrick_header_color', $_REQUEST['fontcolor']);
|
||||
}
|
||||
|
||||
|
||||
if ( isset($_REQUEST['fontdisplay']) ) {
|
||||
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
|
||||
delete_option('kubrick_header_display');
|
||||
|
@ -268,7 +268,7 @@ function kubrick_theme_page_head() {
|
|||
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||
font-size: 1.2em;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
#kubrick-header #header {
|
||||
text-decoration: none;
|
||||
color: <?php echo kubrick_header_color_string(); ?>;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
/* To accomodate differing install paths of WordPress, images are referred only here,
|
||||
and not in the wp-layout.css file. If you prefer to use only CSS for colors and what
|
||||
not, then go right ahead and delete the following lines, and the image files. */
|
||||
|
||||
body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }
|
||||
|
||||
body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }
|
||||
<?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?>
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
|
||||
<?php } else { // No sidebar ?>
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
/* Because the template is slightly different, size-wise, with images, this needs to be set here
|
||||
If you don't want to use the template's images, you can also delete the following two lines. */
|
||||
|
||||
|
||||
#header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; }
|
||||
#headerimg { margin: 7px 9px 0; height: 192px; width: 740px; }
|
||||
|
||||
|
|
|
@ -3,27 +3,27 @@
|
|||
<div id="content" class="narrowcolumn">
|
||||
|
||||
<?php if (have_posts()) : ?>
|
||||
|
||||
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
|
||||
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
|
||||
|
||||
|
||||
<div class="entry">
|
||||
<?php the_content('Read the rest of this entry »'); ?>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
</div>
|
||||
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<h2 class="center">Not Found</h2>
|
||||
|
|
|
@ -13,6 +13,6 @@ Template Name: Links
|
|||
<?php get_links_list(); ?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<h2><?php the_title(); ?></h2>
|
||||
<div class="entrytext">
|
||||
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
|
||||
|
||||
|
||||
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; endif; ?>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<?php if (have_posts()) : ?>
|
||||
|
||||
<h2 class="pagetitle">Search Results</h2>
|
||||
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
|
@ -13,28 +13,28 @@
|
|||
|
||||
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
|
||||
|
||||
<div class="post">
|
||||
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
|
||||
<small><?php the_time('l, F jS, Y') ?></small>
|
||||
|
||||
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
</div>
|
||||
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<h2 class="center">No posts found. Try a different search?</h2>
|
||||
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="sidebar">
|
||||
<ul>
|
||||
|
||||
|
||||
<li>
|
||||
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
|
||||
</li>
|
||||
|
@ -15,11 +15,11 @@
|
|||
<?php /* If this is a 404 page */ if (is_404()) { ?>
|
||||
<?php /* If this is a category archive */ } elseif (is_category()) { ?>
|
||||
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
|
||||
|
||||
|
||||
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
|
||||
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||
for the day <?php the_time('l, F jS, Y'); ?>.</p>
|
||||
|
||||
|
||||
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
|
||||
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||
for <?php the_time('F, Y'); ?>.</p>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
|
||||
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||
for the year <?php the_time('Y'); ?>.</p>
|
||||
|
||||
|
||||
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
|
||||
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||
for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
|
||||
|
@ -52,9 +52,9 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
|
||||
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
|
||||
<?php get_links_list(); ?>
|
||||
|
||||
|
||||
<li><h2>Meta</h2>
|
||||
<ul>
|
||||
<?php wp_register(); ?>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div id="content" class="widecolumn">
|
||||
|
||||
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
|
||||
<div class="alignright"><?php next_post_link('%link »') ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
|
||||
|
||||
<div class="entrytext">
|
||||
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
|
||||
|
||||
|
||||
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
|
||||
|
||||
|
||||
<p class="postmetadata alt">
|
||||
<small>
|
||||
This entry was posted
|
||||
|
@ -27,39 +27,39 @@
|
|||
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
|
||||
and is filed under <?php the_category(', ') ?>.
|
||||
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
|
||||
|
||||
|
||||
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
|
||||
// Both Comments and Pings are open ?>
|
||||
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
|
||||
|
||||
|
||||
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
|
||||
// Only Pings are Open ?>
|
||||
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
|
||||
|
||||
|
||||
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
|
||||
// Comments are open, Pings are not ?>
|
||||
You can skip to the end and leave a response. Pinging is currently not allowed.
|
||||
|
||||
|
||||
<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
|
||||
// Neither Comments, nor Pings are open ?>
|
||||
Both comments and pings are currently closed.
|
||||
|
||||
Both comments and pings are currently closed.
|
||||
|
||||
<?php } edit_post_link('Edit this entry.','',''); ?>
|
||||
|
||||
|
||||
</small>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php comments_template(); ?>
|
||||
|
||||
|
||||
<?php endwhile; else: ?>
|
||||
|
||||
|
||||
<p>Sorry, no posts matched your criteria.</p>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
|
|
@ -14,7 +14,7 @@ Author URI: http://binarybonsai.com/
|
|||
|
||||
The CSS, XHTML and design is released under GPL:
|
||||
http://www.opensource.org/licenses/gpl-license.php
|
||||
|
||||
|
||||
|
||||
*** REGARDING IMAGES ***
|
||||
All CSS that involves the use of images, can be found in the 'index.php' file.
|
||||
|
@ -59,7 +59,7 @@ body {
|
|||
.widecolumn {
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
|
||||
.narrowcolumn .postmetadata {
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
|
|||
.commentlist li, #commentform input, #commentform textarea {
|
||||
font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||
}
|
||||
|
||||
|
||||
.commentlist li {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
|
|||
small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
code {
|
||||
font: 1.1em 'Courier New', Courier, Fixed;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ a:hover {
|
|||
color: #147;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
#wp-calendar #prev a {
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ body {
|
|||
width: 760px;
|
||||
border: 1px solid #959596;
|
||||
}
|
||||
|
||||
|
||||
#header {
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
|
@ -246,7 +246,7 @@ body {
|
|||
margin: 5px 0 0 150px;
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
|
||||
.post {
|
||||
margin: 0 0 40px;
|
||||
text-align: justify;
|
||||
|
@ -339,13 +339,13 @@ p img {
|
|||
thought?!) align the image to the right. And using 'class="centered',
|
||||
will of course center the image. This is much better than using
|
||||
align="center", being much more futureproof (and valid) */
|
||||
|
||||
|
||||
img.centered {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
|
||||
img.alignright {
|
||||
padding: 4px;
|
||||
margin: 0 0 2px 7px;
|
||||
|
@ -361,7 +361,7 @@ img.alignleft {
|
|||
.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
.alignleft {
|
||||
float: left
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ html>body .entry li {
|
|||
list-style-type: none;
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
|
||||
#sidebar ul, #sidebar ul ol {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
|
@ -103,12 +103,12 @@ class WP_Object_Cache {
|
|||
|
||||
if ( ! $this->acquire_lock() )
|
||||
return false;
|
||||
|
||||
|
||||
$this->rm_cache_dir();
|
||||
$this->cache = array ();
|
||||
$this->dirty_objects = array ();
|
||||
$this->non_existant_objects = array ();
|
||||
|
||||
|
||||
$this->release_lock();
|
||||
|
||||
return true;
|
||||
|
@ -248,7 +248,7 @@ class WP_Object_Cache {
|
|||
while (($file = @ readdir($dh)) !== false) {
|
||||
if ($file == '.' or $file == '..')
|
||||
continue;
|
||||
|
||||
|
||||
if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
|
||||
$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
|
||||
else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
|
||||
|
@ -354,7 +354,7 @@ class WP_Object_Cache {
|
|||
if (@ copy($temp_file, $cache_file))
|
||||
@ unlink($temp_file);
|
||||
else
|
||||
$errors++;
|
||||
$errors++;
|
||||
}
|
||||
@ chmod($cache_file, $file_perms);
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ class WP_Object_Cache {
|
|||
$this->dirty_objects = array();
|
||||
|
||||
$this->release_lock();
|
||||
|
||||
|
||||
if ( $errors )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -34,15 +34,15 @@ class WP_Roles {
|
|||
$this->role_names[$role] = $display_name;
|
||||
return $this->role_objects[$role];
|
||||
}
|
||||
|
||||
|
||||
function remove_role($role) {
|
||||
if ( ! isset($this->role_objects[$role]) )
|
||||
return;
|
||||
|
||||
|
||||
unset($this->role_objects[$role]);
|
||||
unset($this->role_names[$role]);
|
||||
unset($this->roles[$role]);
|
||||
|
||||
|
||||
update_option($this->role_key, $this->roles);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class WP_Roles {
|
|||
function is_role($role)
|
||||
{
|
||||
return isset($this->role_names[$role]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WP_Role {
|
||||
|
@ -150,10 +150,10 @@ class WP_User {
|
|||
$this->caps = array();
|
||||
$this->get_role_caps();
|
||||
}
|
||||
|
||||
|
||||
function get_role_caps() {
|
||||
global $wp_roles;
|
||||
|
||||
|
||||
if ( ! isset($wp_roles) )
|
||||
$wp_roles = new WP_Roles();
|
||||
|
||||
|
@ -169,14 +169,14 @@ class WP_User {
|
|||
}
|
||||
$this->allcaps = array_merge($this->allcaps, $this->caps);
|
||||
}
|
||||
|
||||
|
||||
function add_role($role) {
|
||||
$this->caps[$role] = true;
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
$this->get_role_caps();
|
||||
$this->update_user_level_from_caps();
|
||||
}
|
||||
|
||||
|
||||
function remove_role($role) {
|
||||
if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
|
||||
return;
|
||||
|
@ -184,7 +184,7 @@ class WP_User {
|
|||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
$this->get_role_caps();
|
||||
}
|
||||
|
||||
|
||||
function set_role($role) {
|
||||
foreach($this->roles as $oldrole)
|
||||
unset($this->caps[$oldrole]);
|
||||
|
@ -203,13 +203,13 @@ class WP_User {
|
|||
return $max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function update_user_level_from_caps() {
|
||||
global $table_prefix;
|
||||
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
|
||||
update_usermeta($this->id, $table_prefix.'user_level', $this->user_level);
|
||||
}
|
||||
|
||||
|
||||
function add_cap($cap, $grant = true) {
|
||||
$this->caps[$cap] = $grant;
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
|
@ -220,13 +220,13 @@ class WP_User {
|
|||
unset($this->caps[$cap]);
|
||||
update_usermeta($this->id, $this->cap_key, $this->caps);
|
||||
}
|
||||
|
||||
|
||||
//has_cap(capability_or_role_name) or
|
||||
//has_cap('edit_post', post_id)
|
||||
function has_cap($cap) {
|
||||
if ( is_numeric($cap) )
|
||||
$cap = $this->translate_level_to_cap($cap);
|
||||
|
||||
|
||||
$args = array_slice(func_get_args(), 1);
|
||||
$args = array_merge(array($cap, $this->id), $args);
|
||||
$caps = call_user_func_array('map_meta_cap', $args);
|
||||
|
@ -345,12 +345,12 @@ function map_meta_cap($cap, $user_id) {
|
|||
break;
|
||||
case 'read_post':
|
||||
$post = get_post($args[0]);
|
||||
|
||||
|
||||
if ( 'private' != $post->post_status ) {
|
||||
$caps[] = 'read';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$author_data = get_userdata($user_id);
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
if ($user_id == $post_author_data->ID)
|
||||
|
|
|
@ -39,7 +39,7 @@ if ( !in_array('Snoopy', get_declared_classes() ) ) :
|
|||
class Snoopy
|
||||
{
|
||||
/**** Public variables ****/
|
||||
|
||||
|
||||
/* user definable vars */
|
||||
|
||||
var $host = "www.php.net"; // host name we are connecting to
|
||||
|
@ -48,7 +48,7 @@ class Snoopy
|
|||
var $proxy_port = ""; // proxy port to use
|
||||
var $proxy_user = ""; // proxy user to use
|
||||
var $proxy_pass = ""; // proxy password to use
|
||||
|
||||
|
||||
var $agent = "Snoopy v1.2.3"; // agent we masquerade as
|
||||
var $referer = ""; // referer info to pass
|
||||
var $cookies = array(); // array of cookies to pass
|
||||
|
@ -66,15 +66,15 @@ class Snoopy
|
|||
var $passcookies = true; // pass set cookies back through redirects
|
||||
// NOTE: this currently does not respect
|
||||
// dates, domains or paths.
|
||||
|
||||
|
||||
var $user = ""; // user for http authentication
|
||||
var $pass = ""; // password for http authentication
|
||||
|
||||
|
||||
// http accept types
|
||||
var $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
|
||||
|
||||
|
||||
var $results = ""; // where the content is put
|
||||
|
||||
|
||||
var $error = ""; // error messages sent here
|
||||
var $response_code = ""; // response code returned from server
|
||||
var $headers = array(); // headers returned from server sent here
|
||||
|
@ -100,11 +100,11 @@ class Snoopy
|
|||
// library functions built into php,
|
||||
// as these functions are not stable
|
||||
// as of this Snoopy release.
|
||||
|
||||
/**** Private variables ****/
|
||||
|
||||
|
||||
/**** Private variables ****/
|
||||
|
||||
var $_maxlinelen = 4096; // max line length (headers)
|
||||
|
||||
|
||||
var $_httpmethod = "GET"; // default http request method
|
||||
var $_httpversion = "HTTP/1.0"; // default http request version
|
||||
var $_submit_method = "POST"; // default submit method
|
||||
|
@ -114,7 +114,7 @@ class Snoopy
|
|||
var $_redirectdepth = 0; // increments on an http redirect
|
||||
var $_frameurls = array(); // frame src urls
|
||||
var $_framedepth = 0; // increments on frame depth
|
||||
|
||||
|
||||
var $_isproxy = false; // set if using a proxy server
|
||||
var $_fp_timeout = 30; // timeout for socket connection
|
||||
|
||||
|
@ -129,7 +129,7 @@ class Snoopy
|
|||
|
||||
function fetch($URI)
|
||||
{
|
||||
|
||||
|
||||
//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
|
||||
$URI_PARTS = parse_url($URI);
|
||||
if (!empty($URI_PARTS["user"]))
|
||||
|
@ -140,7 +140,7 @@ class Snoopy
|
|||
$URI_PARTS["query"] = '';
|
||||
if (empty($URI_PARTS["path"]))
|
||||
$URI_PARTS["path"] = '';
|
||||
|
||||
|
||||
switch(strtolower($URI_PARTS["scheme"]))
|
||||
{
|
||||
case "http":
|
||||
|
@ -160,7 +160,7 @@ class Snoopy
|
|||
// no proxy, send only the path
|
||||
$this->_httprequest($path, $fp, $URI, $this->_httpmethod);
|
||||
}
|
||||
|
||||
|
||||
$this->_disconnect($fp);
|
||||
|
||||
if($this->_redirectaddr)
|
||||
|
@ -183,7 +183,7 @@ class Snoopy
|
|||
{
|
||||
$frameurls = $this->_frameurls;
|
||||
$this->_frameurls = array();
|
||||
|
||||
|
||||
while(list(,$frameurl) = each($frameurls))
|
||||
{
|
||||
if($this->_framedepth < $this->maxframes)
|
||||
|
@ -194,13 +194,13 @@ class Snoopy
|
|||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
break;
|
||||
case "https":
|
||||
if(!$this->curl_path)
|
||||
|
@ -254,15 +254,15 @@ class Snoopy
|
|||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
// not a valid protocol
|
||||
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -280,9 +280,9 @@ class Snoopy
|
|||
function submit($URI, $formvars="", $formfiles="")
|
||||
{
|
||||
unset($postdata);
|
||||
|
||||
|
||||
$postdata = $this->_prepare_post_body($formvars, $formfiles);
|
||||
|
||||
|
||||
$URI_PARTS = parse_url($URI);
|
||||
if (!empty($URI_PARTS["user"]))
|
||||
$this->user = $URI_PARTS["user"];
|
||||
|
@ -312,17 +312,17 @@ class Snoopy
|
|||
// no proxy, send only the path
|
||||
$this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
|
||||
}
|
||||
|
||||
|
||||
$this->_disconnect($fp);
|
||||
|
||||
if($this->_redirectaddr)
|
||||
{
|
||||
/* url was redirected, check if we've hit the max depth */
|
||||
if($this->maxredirs > $this->_redirectdepth)
|
||||
{
|
||||
{
|
||||
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
|
||||
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
|
||||
|
||||
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
|
||||
|
||||
// only follow redirect if it's on this site, or offsiteok is true
|
||||
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
|
||||
{
|
||||
|
@ -341,9 +341,9 @@ class Snoopy
|
|||
{
|
||||
$frameurls = $this->_frameurls;
|
||||
$this->_frameurls = array();
|
||||
|
||||
|
||||
while(list(,$frameurl) = each($frameurls))
|
||||
{
|
||||
{
|
||||
if($this->_framedepth < $this->maxframes)
|
||||
{
|
||||
$this->fetch($frameurl);
|
||||
|
@ -352,14 +352,14 @@ class Snoopy
|
|||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
break;
|
||||
case "https":
|
||||
if(!$this->curl_path)
|
||||
|
@ -386,9 +386,9 @@ class Snoopy
|
|||
{
|
||||
/* url was redirected, check if we've hit the max depth */
|
||||
if($this->maxredirs > $this->_redirectdepth)
|
||||
{
|
||||
{
|
||||
if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
|
||||
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
|
||||
$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
|
||||
|
||||
// only follow redirect if it's on this site, or offsiteok is true
|
||||
if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
|
||||
|
@ -410,7 +410,7 @@ class Snoopy
|
|||
$this->_frameurls = array();
|
||||
|
||||
while(list(,$frameurl) = each($frameurls))
|
||||
{
|
||||
{
|
||||
if($this->_framedepth < $this->maxframes)
|
||||
{
|
||||
$this->fetch($frameurl);
|
||||
|
@ -419,16 +419,16 @@ class Snoopy
|
|||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
// not a valid protocol
|
||||
$this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ class Snoopy
|
|||
function fetchlinks($URI)
|
||||
{
|
||||
if ($this->fetch($URI))
|
||||
{
|
||||
{
|
||||
if($this->lastredirectaddr)
|
||||
$URI = $this->lastredirectaddr;
|
||||
if(is_array($this->results))
|
||||
|
@ -470,9 +470,9 @@ class Snoopy
|
|||
|
||||
function fetchform($URI)
|
||||
{
|
||||
|
||||
|
||||
if ($this->fetch($URI))
|
||||
{
|
||||
{
|
||||
|
||||
if(is_array($this->results))
|
||||
{
|
||||
|
@ -481,14 +481,14 @@ class Snoopy
|
|||
}
|
||||
else
|
||||
$this->results = $this->_stripform($this->results);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: fetchtext
|
||||
Purpose: fetch the text from a web page, stripping the links
|
||||
|
@ -499,7 +499,7 @@ class Snoopy
|
|||
function fetchtext($URI)
|
||||
{
|
||||
if($this->fetch($URI))
|
||||
{
|
||||
{
|
||||
if(is_array($this->results))
|
||||
{
|
||||
for($x=0;$x<count($this->results);$x++)
|
||||
|
@ -523,7 +523,7 @@ class Snoopy
|
|||
function submitlinks($URI, $formvars="", $formfiles="")
|
||||
{
|
||||
if($this->submit($URI,$formvars, $formfiles))
|
||||
{
|
||||
{
|
||||
if($this->lastredirectaddr)
|
||||
$URI = $this->lastredirectaddr;
|
||||
if(is_array($this->results))
|
||||
|
@ -557,7 +557,7 @@ class Snoopy
|
|||
function submittext($URI, $formvars = "", $formfiles = "")
|
||||
{
|
||||
if($this->submit($URI,$formvars, $formfiles))
|
||||
{
|
||||
{
|
||||
if($this->lastredirectaddr)
|
||||
$URI = $this->lastredirectaddr;
|
||||
if(is_array($this->results))
|
||||
|
@ -581,7 +581,7 @@ class Snoopy
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: set_submit_multipart
|
||||
|
@ -593,7 +593,7 @@ class Snoopy
|
|||
$this->_submit_type = "multipart/form-data";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: set_submit_normal
|
||||
Purpose: Set the form submission content type to
|
||||
|
@ -604,14 +604,14 @@ class Snoopy
|
|||
$this->_submit_type = "application/x-www-form-urlencoded";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Private functions
|
||||
\*======================================================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _striplinks
|
||||
Purpose: strip the hyperlinks from an html document
|
||||
|
@ -620,13 +620,13 @@ class Snoopy
|
|||
\*======================================================================*/
|
||||
|
||||
function _striplinks($document)
|
||||
{
|
||||
{
|
||||
preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href=
|
||||
([\"\'])? # find single or double quote
|
||||
(?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching
|
||||
# quote, otherwise match up to next space
|
||||
'isx",$document,$links);
|
||||
|
||||
|
||||
|
||||
// catenate the non-empty matches from the conditional subpattern
|
||||
|
||||
|
@ -634,14 +634,14 @@ class Snoopy
|
|||
{
|
||||
if(!empty($val))
|
||||
$match[] = $val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
while(list($key,$val) = each($links[3]))
|
||||
{
|
||||
if(!empty($val))
|
||||
$match[] = $val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// return the links
|
||||
return $match;
|
||||
}
|
||||
|
@ -654,18 +654,18 @@ class Snoopy
|
|||
\*======================================================================*/
|
||||
|
||||
function _stripform($document)
|
||||
{
|
||||
{
|
||||
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);
|
||||
|
||||
|
||||
// catenate the matches
|
||||
$match = implode("\r\n",$elements[0]);
|
||||
|
||||
|
||||
// return the links
|
||||
return $match;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*======================================================================*\
|
||||
Function: _striptext
|
||||
Purpose: strip the text from an html document
|
||||
|
@ -675,11 +675,11 @@ class Snoopy
|
|||
|
||||
function _striptext($document)
|
||||
{
|
||||
|
||||
|
||||
// I didn't use preg eval (//e) since that is only available in PHP 4.0.
|
||||
// so, list your entities one by one here. I included some of the
|
||||
// more common ones.
|
||||
|
||||
|
||||
$search = array("'<script[^>]*?>.*?</script>'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("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
|
||||
|
||||
{
|
||||
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);
|
||||
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);
|
||||
}
|
||||
|
||||
// have we hit our frame depth and is there frame src to fetch?
|
||||
|
@ -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("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
|
||||
{
|
||||
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);
|
||||
$this->_redirectaddr = $this->_expandlinks($match[1],$URI);
|
||||
}
|
||||
|
||||
// have we hit our frame depth and is there frame src to fetch?
|
||||
|
@ -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; $x<count($this->headers); $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");
|
||||
|
|
|
@ -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 = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
|
||||
|
||||
$foot .= '<p><a href="options-discussion.php">' . __('« Return to Discussion Options page.') . '</a></p></div>';
|
||||
|
||||
|
||||
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) ?
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {
|
||||
|
@ -74,7 +74,7 @@ function wpautop($pee, $br = 1) {
|
|||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
|
||||
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
|
||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -205,7 +205,7 @@ function edCheckOpenTags(button) {
|
|||
else {
|
||||
return false; // tag not found
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function edCloseAllTags() {
|
||||
var count = edOpenTags.length;
|
||||
|
|
|
@ -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 = ''
|
||||
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||
+ ' width="100%" height="10px" '
|
||||
|
@ -105,17 +105,17 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
|||
var flag = "";
|
||||
var template = new Array();
|
||||
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
|
||||
|
||||
|
||||
// Is selection a image
|
||||
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
||||
flag = getAttrib(focusElm, 'name');
|
||||
|
||||
|
||||
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
|
||||
return true;
|
||||
|
||||
|
||||
action = "update";
|
||||
}
|
||||
|
||||
|
||||
html = ''
|
||||
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||
+ ' width="100%" height="10px" '
|
||||
|
@ -131,7 +131,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
|||
|
||||
function TinyMCE_wordpress_cleanup(type, content) {
|
||||
switch (type) {
|
||||
|
||||
|
||||
case "insert_to_editor":
|
||||
var startPos = 0;
|
||||
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
|
||||
|
@ -178,9 +178,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
|||
|
||||
if (attribs['class'] == "mce_plugin_wordpress_more") {
|
||||
endPos += 2;
|
||||
|
||||
|
||||
var embedHTML = '<!--more-->';
|
||||
|
||||
|
||||
// Insert embed/object chunk
|
||||
chunkBefore = content.substring(0, startPos);
|
||||
chunkAfter = content.substring(endPos);
|
||||
|
@ -188,9 +188,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
|||
}
|
||||
if (attribs['class'] == "mce_plugin_wordpress_page") {
|
||||
endPos += 2;
|
||||
|
||||
|
||||
var embedHTML = '<!--nextpage-->';
|
||||
|
||||
|
||||
// Insert embed/object chunk
|
||||
chunkBefore = content.substring(0, startPos);
|
||||
chunkAfter = content.substring(endPos);
|
||||
|
@ -221,7 +221,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
|||
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
|
||||
content = content.replace(new RegExp('^\\s*', ''), '');
|
||||
content = content.replace(new RegExp('\\s*$', ''), '');
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 "</a><br />\n";
|
||||
echo "</li>\n";
|
||||
}
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
|||
<code>$this->last_query</code></p>
|
||||
</div>";
|
||||
} 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 <<<HEAD
|
||||
<!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">
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
10
wp-login.php
10
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.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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'] = __('<strong>ERROR</strong>: 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':
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>WordPress » <?php _e('Registration Complete') ?></title>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
|
||||
<link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
|
||||
<style type="text/css">
|
||||
.submit {
|
||||
|
|
|
@ -9,7 +9,7 @@ function unregister_GLOBALS() {
|
|||
|
||||
// Variables that shouldn't be unset
|
||||
$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
|
||||
|
||||
|
||||
$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
|
||||
foreach ( $input as $k => $v )
|
||||
if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) )
|
||||
|
@ -27,7 +27,7 @@ if ( ! isset($blog_id) )
|
|||
// Fix for IIS, which doesn't set REQUEST_URI
|
||||
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI?
|
||||
|
||||
|
||||
// Append the query string if it exists and isn't null
|
||||
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
|
||||
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
|
||||
|
|
14
xmlrpc.php
14
xmlrpc.php
|
@ -577,7 +577,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$post_category[] = get_cat_ID($cat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We've got all the data -- post it:
|
||||
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');
|
||||
|
||||
|
@ -623,7 +623,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$catnames = $content_struct['categories'];
|
||||
|
||||
$post_category = array();
|
||||
|
||||
|
||||
if (is_array($catnames)) {
|
||||
foreach ($catnames as $cat) {
|
||||
$post_category[] = get_cat_ID($cat);
|
||||
|
@ -861,7 +861,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
logIO('O', '(MW) Could not write file '.$name);
|
||||
return new IXR_Error(500, 'Could not write file '.$name);
|
||||
}
|
||||
|
||||
|
||||
return array('url' => $upload['url']);
|
||||
}
|
||||
|
||||
|
@ -995,7 +995,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
foreach($categories as $cat) {
|
||||
$catids[] = $cat['categoryId'];
|
||||
}
|
||||
|
||||
|
||||
wp_set_post_cats('', $post_ID, $catids);
|
||||
|
||||
return true;
|
||||
|
@ -1199,11 +1199,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
|
||||
|
||||
$p = explode( "\n\n", $linea );
|
||||
|
||||
|
||||
$sem_regexp_pb = "/(\\/|\\\|\*|\?|\+|\.|\^|\\$|\(|\)|\[|\]|\||\{|\})/";
|
||||
$sem_regexp_fix = "\\\\$1";
|
||||
$link = preg_replace( $sem_regexp_pb, $sem_regexp_fix, $pagelinkedfrom );
|
||||
|
||||
|
||||
$finished = false;
|
||||
foreach ( $p as $para ) {
|
||||
if ( $finished )
|
||||
|
@ -1238,7 +1238,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
|
||||
wp_new_comment($commentdata);
|
||||
do_action('pingback_post', $wpdb->insert_id);
|
||||
|
||||
|
||||
return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue