summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wp-inst/wp-admin/admin-functions.php36
-rw-r--r--wp-inst/wp-admin/edit-comments.php2
-rw-r--r--wp-inst/wp-admin/edit.php6
-rw-r--r--wp-inst/wp-admin/inline-uploading.php14
-rw-r--r--wp-inst/wp-admin/install.php3
-rw-r--r--wp-inst/wp-admin/options-general.php8
-rw-r--r--wp-inst/wp-admin/options-permalink.php25
-rw-r--r--wp-inst/wp-admin/upgrade-schema.php3
-rw-r--r--wp-inst/wp-admin/upgrade.php1
-rw-r--r--wp-inst/wp-includes/classes.php5
-rw-r--r--wp-inst/wp-includes/comment-functions.php26
-rw-r--r--wp-inst/wp-includes/functions-formatting.php4
-rw-r--r--wp-inst/wp-includes/functions.php17
-rw-r--r--wp-inst/wp-includes/pluggable-functions.php41
-rw-r--r--wp-inst/wp-includes/template-functions-category.php36
-rw-r--r--wp-inst/wp-includes/template-functions-general.php39
-rw-r--r--wp-inst/wp-login.php14
-rw-r--r--wp-inst/wp-settings.php17
-rw-r--r--wp-inst/wp.php48
-rw-r--r--wp-inst/xmlrpc.php6
20 files changed, 209 insertions, 142 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index cc7af04..e26c47f 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -396,7 +396,7 @@ function edit_link($link_id = '') {
die(__("Cheatin' uh ?"));
$_POST['link_url'] = wp_specialchars($_POST['link_url']);
- //$link_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $link_url) ? $link_url : 'http://'.$link_url;
+ $_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
$_POST['link_name'] = wp_specialchars($_POST['link_name']);
$_POST['link_image'] = wp_specialchars($_POST['link_image']);
$_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
@@ -975,6 +975,29 @@ function extract_from_markers($filename, $marker) {
return $result;
}
+function got_mod_rewrite() {
+ global $is_apache;
+
+ // take 3 educated guesses as to whether or not mod_rewrite is available
+ if ( !$is_apache )
+ return false;
+
+ if ( function_exists('apache_get_modules') ) {
+ if ( !in_array('mod_rewrite', apache_get_modules()) )
+ return false;
+ }
+
+ if ( function_exists('ob_get_clean') ) {
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $php_modules = ob_get_clean();
+ if ( strpos($php_modules, 'mod_rewrite') === false)
+ return false;
+ }
+
+ return true;
+}
+
function save_mod_rewrite_rules() {
global $is_apache, $wp_rewrite;
$home_path = get_home_path();
@@ -985,7 +1008,7 @@ function save_mod_rewrite_rules() {
if (!((!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess')))
return;
- if (!$is_apache)
+ if (! got_mod_rewrite())
return;
$rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
@@ -1701,6 +1724,15 @@ function wp_handle_upload(&$file, $overrides = false) {
return array('file' => $new_file, 'url' => $url);
}
+function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) {
+ if ( $height <= $hmax && $width <= $wmax )
+ return array($width, $height);
+ elseif ( $width / $height > $wmax / $hmax )
+ return array($wmax, (int) ($height / $width * $wmax));
+ else
+ return array((int) ($width / $height * $hmax), $hmax);
+}
+
function AJAX_search_box( $get_url, $search_field = 'newvalue', $search_results_field = 'searchresults' ) {
?>
<script language="JavaScript">
diff --git a/wp-inst/wp-admin/edit-comments.php b/wp-inst/wp-admin/edit-comments.php
index 3faf7e1..b13c7f1 100644
--- a/wp-inst/wp-admin/edit-comments.php
+++ b/wp-inst/wp-admin/edit-comments.php
@@ -95,8 +95,6 @@ if ('view' == $mode) {
<p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A');
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " | <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>";
- }
- if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo " | <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 )) . "' );\">" . __('Delete Comment') . "</a> &#8212; ";
} // end if any comments to show
// Get post title
diff --git a/wp-inst/wp-admin/edit.php b/wp-inst/wp-admin/edit.php
index 6c51f38..135e385 100644
--- a/wp-inst/wp-admin/edit.php
+++ b/wp-inst/wp-admin/edit.php
@@ -81,12 +81,14 @@ if ( is_month() ) {
</fieldset>
</form>
+<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
+if ( count($arc_result) ) { ?>
+
<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">
<fieldset>
<legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'>
<?php
- $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
foreach ($arc_result as $arc_row) {
$arc_year = $arc_row->yyear;
$arc_month = $arc_row->mmonth;
@@ -106,6 +108,8 @@ if ( is_month() ) {
</fieldset>
</form>
+<?php } ?>
+
<br style="clear:both;" />
<?php
diff --git a/wp-inst/wp-admin/inline-uploading.php b/wp-inst/wp-admin/inline-uploading.php
index 752e3fe..0b5044a 100644
--- a/wp-inst/wp-admin/inline-uploading.php
+++ b/wp-inst/wp-admin/inline-uploading.php
@@ -182,19 +182,19 @@ if ( count($images) > 0 ) {
$images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
$href = get_subpost_link($object);
$images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n";
- $images_html .= <<<HERE
+ $images_html .= "
<div id='target$i' class='imagewrap left'>
<div id='popup$i' class='popup'>
- <a id="L$i" onclick="toggleLink($i);return false;" href="javascript:void();">$__subpost_on</a>
- <a id="I$i" onclick="if($thumb)toggleImage($i);else alert('$__nothumb');return false;" href="javascript:void();">$thumbtext</a>
- <a onclick="return confirm('$__confirmdelete')" href="<?php echo basename(__FILE__); ?>?action=delete&amp;object=$object&amp;all=$all&amp;start=$start&amp;post=$post">$__delete</a>
- <a onclick="popup.style.display='none';return false;" href="javascript:void()">$__close</a>
+ <a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__subpost_on</a>
+ <a id=\"I$i\" onclick=\"if($thumb)toggleImage($i);else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a>
+ <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;object=$object&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a>
+ <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
</div>
- <a id="link$i" class="imagelink" href="$href" onclick="imagePopup($i);return false;" title="{$image['post_title']}">
+ <a id=\"link$i\" class=\"imagelink\" href=\"$href\" onclick=\"imagePopup($i);return false;\" title=\"{$image['post_title']}\">
<img id='image$i' src='$src' alt='{$image['post_title']}' $height_width />
</a>
</div>
-HERE;
+";
$i++;
}
}
diff --git a/wp-inst/wp-admin/install.php b/wp-inst/wp-admin/install.php
index dd7380e..510b8aa 100644
--- a/wp-inst/wp-admin/install.php
+++ b/wp-inst/wp-admin/install.php
@@ -6,7 +6,8 @@ if (!file_exists('../wp-config.php'))
require_once('../wp-config.php');
require_once('./upgrade-functions.php');
-$guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
+$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+$guessurl = str_replace('/wp-admin/install.php?step=2', '', $schema . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
if (isset($_GET['step']))
$step = $_GET['step'];
diff --git a/wp-inst/wp-admin/options-general.php b/wp-inst/wp-admin/options-general.php
index 60a087f..b6e8c93 100644
--- a/wp-inst/wp-admin/options-general.php
+++ b/wp-inst/wp-admin/options-general.php
@@ -78,10 +78,6 @@ if( is_array( $lang_files ) ) {
<?php _e('hours') ?> </td>
</tr>
<tr>
-<th scope="row">&nbsp;</th>
-<td><?php _e('The following use the same syntax as the <a href="http://php.net/date">PHP <code>date()</code> function</a>. Save option to update sample output.') ?> </td>
-</tr>
-<tr>
<th scope="row"><?php _e('Default date format:') ?></th>
<td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
<?php _e('Output:') ?> <strong><?php echo mysql2date(get_settings('date_format'), current_time('mysql')); ?></strong></td>
@@ -92,6 +88,10 @@ if( is_array( $lang_files ) ) {
<?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('time_format'), current_time('timestamp')); ?></strong></td>
</tr>
<tr>
+<th scope="row">&nbsp;</th>
+<td><?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Save option to update sample output.') ?> </td>
+</tr>
+<tr>
<th scope="row"><?php _e('Weeks in the calendar should start on:') ?></th>
<td><select name="start_of_week" id="start_of_week">
<?php
diff --git a/wp-inst/wp-admin/options-permalink.php b/wp-inst/wp-admin/options-permalink.php
index f6998bc..5ddc682 100644
--- a/wp-inst/wp-admin/options-permalink.php
+++ b/wp-inst/wp-admin/options-permalink.php
@@ -104,27 +104,40 @@ else
<?php
$prefix = '';
-if ( !$is_apache )
+
+if ( ! got_mod_rewrite() )
$prefix = '/index.php';
+
+$structures = array(
+ '',
+ $prefix . '/%year%/%monthnum%/%day%/%postname%/',
+ $prefix . '/archives/%post_id%'
+ );
?>
<form name="form" action="options-permalink.php" method="post">
<h3><?php _e('Common options:'); ?></h3>
<p>
<label>
-<input name="selection" type="radio" value="<?php echo $prefix; ?>/%year%/%monthnum%/%day%/%postname%/" class="tog" <?php checked( $prefix . '/%year%/%monthnum%/%day%/%postname%/', $permalink_structure); ?> />
-<?php _e('Date and name based, example:'); ?> <code><?php echo get_settings('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code>
+<input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> />
+<?php _e('Default'); ?><br /> <span> &raquo; <code><?php echo get_settings('home'); ?>/?p=123</code></span>
+ </label>
+</p>
+<p>
+ <label>
+<input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> />
+<?php _e('Date and name based'); ?><br /> <span> &raquo; <code><?php echo get_settings('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span>
</label>
</p>
<p>
<label>
-<input name="selection" type="radio" value="<?php echo $prefix; ?>/archives/%post_id%" class="tog" <?php checked( $prefix . '/archives/%post_id%', $permalink_structure); ?> />
-<?php _e('Numeric, example:'); ?> <code><?php echo get_settings('home') . $prefix ; ?>/archives/123</code>
+<input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> />
+<?php _e('Numeric'); ?><br /> <span> &raquo; <code><?php echo get_settings('home') . $prefix ; ?>/archives/123</code></span>
</label>
</p>
<p>
<label>
<input name="selection" type="radio" value="custom" class="tog"
-<?php if ( $permalink_structure != $prefix . '/archives/%post_id%' && $permalink_structure != $prefix . '/%year%/%monthnum%/%day%/%postname%/' ) { ?>
+<?php if ( !in_array($permalink_structure, $structures) ) { ?>
checked="checked"
<?php } ?>
/>
diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php
index 6502f1c..ab2a105 100644
--- a/wp-inst/wp-admin/upgrade-schema.php
+++ b/wp-inst/wp-admin/upgrade-schema.php
@@ -190,7 +190,8 @@ CREATE TABLE $wpdb->sitecategories (
function populate_options() {
global $wpdb, $wpblog, $current_site;
- $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+ $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+ $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
add_option('siteurl', $guessurl, __('WordPress web address'));
add_option('blogname', __('My Weblog'), __('Blog title'));
add_option('blogdescription', __('Just another ' . $current_site->site_name . ' weblog'), __('Short tagline'));
diff --git a/wp-inst/wp-admin/upgrade.php b/wp-inst/wp-admin/upgrade.php
index c4a176c..7360f62 100644
--- a/wp-inst/wp-admin/upgrade.php
+++ b/wp-inst/wp-admin/upgrade.php
@@ -7,6 +7,7 @@ require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
$step = $_GET['step'];
if (!$step) $step = 0;
+header( 'Content-Type: text/html; charset=utf-8' );
?>
<!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">
diff --git a/wp-inst/wp-includes/classes.php b/wp-inst/wp-includes/classes.php
index b734d91..cf12941 100644
--- a/wp-inst/wp-includes/classes.php
+++ b/wp-inst/wp-includes/classes.php
@@ -1500,7 +1500,10 @@ class WP {
}
function send_headers() {
+ global $current_user;
@header('X-Pingback: '. get_bloginfo('pingback_url'));
+ if ( $current_user )
+ nocache_headers();
if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
status_header( 404 );
} else if ( empty($this->query_vars['feed']) ) {
@@ -1600,8 +1603,8 @@ class WP {
function main($query_args = '') {
$this->parse_request($query_args);
- $this->send_headers();
$this->prime_caches();
+ $this->send_headers();
$this->query_posts();
$this->handle_404();
$this->register_globals();
diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php
index 1480e44..82098c0 100644
--- a/wp-inst/wp-includes/comment-functions.php
+++ b/wp-inst/wp-includes/comment-functions.php
@@ -34,10 +34,14 @@ function wp_new_comment( $commentdata ) {
$commentdata = apply_filters('preprocess_comment', $commentdata);
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
+ $commentdata['user_ID'] = (int) $commentdata['user_ID'];
+
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
- $commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
- $commentdata['comment_date'] = current_time('mysql');
+ $commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
+
+ $commentdata['comment_date'] = current_time('mysql');
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
+
$commentdata = wp_filter_comment($commentdata);
@@ -50,8 +54,10 @@ function wp_new_comment( $commentdata ) {
if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
if ( '0' == $commentdata['comment_approved'] )
wp_notify_moderator($comment_ID);
-
- if ( get_settings('comments_notify') && $commentdata['comment_approved'] )
+
+ $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
+
+ if ( get_settings('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
}
@@ -79,12 +85,12 @@ function wp_insert_comment($commentdata) {
}
function wp_filter_comment($commentdata) {
- $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
- $commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
- $commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
- $commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']);
- $commentdata['comment_author_IP'] = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
- $commentdata['comment_author_url'] = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
+ $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
+ $commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
+ $commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
+ $commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']);
+ $commentdata['comment_author_IP'] = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
+ $commentdata['comment_author_url'] = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
$commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);
$commentdata['filtered'] = true;
return $commentdata;
diff --git a/wp-inst/wp-includes/functions-formatting.php b/wp-inst/wp-includes/functions-formatting.php
index 3ad94f5..b9143c7 100644
--- a/wp-inst/wp-includes/functions-formatting.php
+++ b/wp-inst/wp-includes/functions-formatting.php
@@ -73,7 +73,7 @@ function wpautop($pee, $br = 1) {
if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
$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') . clean_pre('$2') . '</pre>' ", $pee);
+ $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
return $pee;
}
@@ -993,4 +993,4 @@ function ent2ncr($text) {
return $text;
}
-?> \ No newline at end of file
+?>
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php
index 4b65212..d4f7924 100644
--- a/wp-inst/wp-includes/functions.php
+++ b/wp-inst/wp-includes/functions.php
@@ -271,6 +271,8 @@ function get_settings($setting) {
if( is_object( $value ) ) {
$value = $value->option_value;
wp_cache_set($setting, $value, 'options');
+ } else {
+ return false;
}
}
@@ -338,16 +340,18 @@ function update_option($option_name, $newvalue) {
$newvalue = trim($newvalue);
// If the new and old values are the same, no need to update.
- if ( $newvalue == get_option($option_name) )
+ $oldvalue = get_option($option_name);
+ if ( $newvalue == $oldvalue )
return true;
+ if ( false === $oldvalue ) {
+ add_option($option_name, $newvalue);
+ return true;
+ }
+
if ( is_array($newvalue) || is_object($newvalue) )
$newvalue = serialize($newvalue);
- // If it's not there add it
- if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$option_name'") )
- add_option($option_name, $newvalue);
-
wp_cache_set($option_name, $newvalue, 'options');
$newvalue = $wpdb->escape($newvalue);
@@ -371,7 +375,6 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') {
if ( false !== get_option($name) )
return;
- $original = $value;
if ( is_array($value) || is_object($value) )
$value = serialize($value);
@@ -821,7 +824,7 @@ function make_url_footnote($content) {
$link_url = $matches[2][$i];
$link_text = $matches[4][$i];
$content = str_replace($link_match, $link_text.' '.$link_number, $content);
- $link_url = (strtolower(substr($link_url,0,7)) != 'http://') ? get_settings('home') . $link_url : $link_url;
+ $link_url = ((strtolower(substr($link_url,0,7)) != 'http://')||(strtolower(substr($link_url,0,7)) != 'https://')) ? get_settings('home') . $link_url : $link_url;
$links_summary .= "\n".$link_number.' '.$link_url;
}
$content = strip_tags($content);
diff --git a/wp-inst/wp-includes/pluggable-functions.php b/wp-inst/wp-includes/pluggable-functions.php
index 5f84837..7f211c1 100644
--- a/wp-inst/wp-includes/pluggable-functions.php
+++ b/wp-inst/wp-includes/pluggable-functions.php
@@ -42,16 +42,18 @@ function get_userdata( $user_id ) {
$metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user_id'");
- foreach ( $metavalues as $meta ) {
- @ $value = unserialize($meta->meta_value);
- if ($value === FALSE)
- $value = $meta->meta_value;
- $user->{$meta->meta_key} = $value;
-
- // We need to set user_level from meta, not row
- if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
- $user->user_level = $meta->meta_value;
- }
+ if ($metavalues) {
+ foreach ( $metavalues as $meta ) {
+ @ $value = unserialize($meta->meta_value);
+ if ($value === FALSE)
+ $value = $meta->meta_value;
+ $user->{$meta->meta_key} = $value;
+
+ // We need to set user_level from meta, not row
+ if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
+ $user->user_level = $meta->meta_value;
+ } // end foreach
+ } //end if
wp_cache_add($user_id, $user, 'users');
wp_cache_add($user->user_login, $user, 'users');
@@ -287,16 +289,25 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
$notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
- if ('' == $comment->comment_author_email || '' == $comment->comment_author) {
- $from = "From: \"$blogname\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
- } else {
- $from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>";
- }
+ $admin_email = get_settings('admin_email');
+
+ if ( '' == $comment->comment_author ) {
+ $from = "From: \"$blogname\" <$admin_email>";
+ if ( '' != $comment->comment_author_email )
+ $reply_to = "Reply-To: $comment->comment_author_email";
+ } else {
+ $from = "From: \"$comment->comment_author\" <$admin_email>";
+ if ( '' != $comment->comment_author_email )
+ $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
+ }
$message_headers = "MIME-Version: 1.0\n"
. "$from\n"
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
+ if ( isset($reply_to) )
+ $message_headers .= $reply_to . "\n";
+
$notify_message = apply_filters('comment_notification_text', $notify_message);
$subject = apply_filters('comment_notification_subject', $subject);
$message_headers = apply_filters('comment_notification_headers', $message_headers);
diff --git a/wp-inst/wp-includes/template-functions-category.php b/wp-inst/wp-includes/template-functions-category.php
index 6af7e0c..c39be27 100644
--- a/wp-inst/wp-includes/template-functions-category.php
+++ b/wp-inst/wp-includes/template-functions-category.php
@@ -272,7 +272,7 @@ function wp_list_cats($args = '') {
}
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
- global $wpdb, $category_posts;
+ global $wpdb, $wp_query;
// Optiondates now works
if ( '' == $file )
$file = get_settings('home') . '/';
@@ -293,30 +293,13 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
$sort_column = 'cat_'.$sort_column;
$query = "
- SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
+ SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, category_count
FROM $wpdb->categories
WHERE cat_ID > 0 $exclusions
ORDER BY $sort_column $sort_order";
$categories = $wpdb->get_results($query);
}
- if ( !count($category_posts) ) {
- $now = current_time('mysql', 1);
- $cat_counts = $wpdb->get_results(" SELECT cat_ID,
- COUNT($wpdb->post2cat.post_id) AS cat_count
- FROM $wpdb->categories
- INNER JOIN $wpdb->post2cat ON (cat_ID = category_id)
- INNER JOIN $wpdb->posts ON (ID = post_id)
- WHERE post_status = 'publish'
- AND post_date_gmt < '$now' $exclusions
- GROUP BY category_id");
- if ( !empty($cat_counts) ) {
- foreach ( $cat_counts as $cat_count ) {
- if ( 1 != intval($hide_empty) || $cat_count > 0 )
- $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
- }
- }
- }
if ( $optiondates ) {
$cat_dates = $wpdb->get_results(" SELECT category_id,
@@ -333,7 +316,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
$thelist = "";
foreach ( $categories as $category ) {
- if ( (intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) {
+ if ( ( intval($hide_empty) == 0 || $category->category_count) && (!$hierarchical || $category->category_parent == $child_of) ) {
$num_found++;
$link = '<a href="'.get_category_link($category->cat_ID).'" ';
if ( $use_desc_for_title == 0 || empty($category->category_description) )
@@ -373,7 +356,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
}
if ( intval($optioncount) == 1 )
- $link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
+ $link .= ' ('.intval($category->category_count).')';
if ( $optiondates ) {
if ( $optiondates == 1 )
@@ -381,10 +364,15 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
$link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]);
}
- if ( $list )
- $thelist .= "\t<li>$link\n";
- else
+ if ( $list ) {
+ $thelist .= "\t<li";
+ if (($category->cat_ID == $wp_query->get_queried_object_id()) && is_category()) {
+ $thelist .= ' class="current-cat"';
+ }
+ $thelist .= ">$link\n";
+ } else {
$thelist .= "\t$link<br />\n";
+ }
if ($hierarchical && $children)
$thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical);
diff --git a/wp-inst/wp-includes/template-functions-general.php b/wp-inst/wp-includes/template-functions-general.php
index 17d8aa1..ab388f8 100644
--- a/wp-inst/wp-includes/template-functions-general.php
+++ b/wp-inst/wp-includes/template-functions-general.php
@@ -144,6 +144,8 @@ function wp_title($sep = '&raquo;', $display = true) {
$p = get_query_var('p');
$name = get_query_var('name');
$category_name = get_query_var('category_name');
+ $author = get_query_var('author');
+ $author_name = get_query_var('author_name');
// If there's a category
if ( !empty($cat) ) {
@@ -162,6 +164,16 @@ function wp_title($sep = '&raquo;', $display = true) {
$title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'");
}
+ // If there's an author
+ if ( !empty($author) ) {
+ $title = get_userdata($author);
+ $title = $title->display_name;
+ }
+ if ( !empty($author_name) ) {
+ // We do a direct query here because we don't cache by nicename.
+ $title = $wpdb->get_var("SELECT display_name FROM $wpdb->users WHERE user_nicename = '$author_name'");
+ }
+
// If there's a month
if ( !empty($m) ) {
$my_year = substr($m, 0, 4);
@@ -632,6 +644,33 @@ function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
}
+function the_modified_time($d = '') {
+ echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
+}
+
+
+function get_the_modified_time($d = '') {
+ if ( '' == $d )
+ $the_time = get_post_modified_time(get_settings('time_format'));
+ else
+ $the_time = get_post_modified_time($d);
+ return apply_filters('get_the_modified_time', $the_time, $d);
+}
+
+
+function get_post_modified_time( $d = 'U', $gmt = false ) { // returns timestamp
+ global $post;
+
+ if ( $gmt )
+ $time = $post->post_modified_gmt;
+ else
+ $time = $post->post_modified;
+ $time = mysql2date($d, $time);
+
+ return apply_filters('get_the_modified_time', $time, $d, $gmt);
+}
+
+
function the_weekday() {
global $weekday, $id, $post;
$the_weekday = $weekday[mysql2date('w', $post->post_date)];
diff --git a/wp-inst/wp-login.php b/wp-inst/wp-login.php
index fa224f8..e83e6f7 100644
--- a/wp-inst/wp-login.php
+++ b/wp-inst/wp-login.php
@@ -11,9 +11,10 @@ header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('cha
if ( defined('RELOCATE') ) { // Move flag is set
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
-
- if ( dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl') )
- update_option('siteurl', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
+
+ $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+ if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl') )
+ update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
}
switch($action) {
@@ -23,7 +24,12 @@ case 'logout':
wp_clearcookie();
do_action('wp_logout');
nocache_headers();
- wp_redirect('wp-login.php');
+
+ $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();
break;
diff --git a/wp-inst/wp-settings.php b/wp-inst/wp-settings.php
index fe52c46..7fffb14 100644
--- a/wp-inst/wp-settings.php
+++ b/wp-inst/wp-settings.php
@@ -34,6 +34,14 @@ if ( empty( $_SERVER['REQUEST_URI'] ) ) {
}
}
+// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
+if ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 )
+ $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
+
+// Fix for PHP as CGI hosts that set PATH_INFO to PHP_SELF value
+if ( isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == $_SERVER['PHP_SELF'] )
+ unset($_SERVER['PATH_INFO']);
+
if ( !(phpversion() >= '4.1') )
die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
@@ -204,7 +212,7 @@ else
// For now, disable persistent caching by default. To enable, comment out
// the following line.
-define('DISABLE_CACHE', true);
+//define('DISABLE_CACHE', true);
wp_cache_init();
@@ -331,10 +339,10 @@ $_POST = add_magic_quotes($_POST );
$_COOKIE = add_magic_quotes($_COOKIE);
$_SERVER = add_magic_quotes($_SERVER);
-$wp_query = new WP_Query();
+$wp_query = new WP_Query();
$wp_rewrite = new WP_Rewrite();
-$wp = new WP();
-$wp_roles = new WP_Roles();
+$wp = new WP();
+$wp_roles = new WP_Roles();
define('TEMPLATEPATH', get_template_directory());
@@ -356,4 +364,5 @@ register_shutdown_function('shutdown_action_hook');
// Everything is loaded and initialized.
do_action('init');
+
?>
diff --git a/wp-inst/wp.php b/wp-inst/wp.php
deleted file mode 100644
index 7312a12..0000000
--- a/wp-inst/wp.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-// This is an example of a very simple template
-require_once('./wp-blog-header.php');
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml/DTD/xhtml-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
- <meta name="generator" content="WordPress <?php $wp_version ?>" /> <!-- leave this for stats -->
- <link rel="alternate" type="text/xml" title="RSS" href="<?php bloginfo('rss2_url'); ?>" />
- <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
-</head>
-<body>
-<h1 id="header"><a href="<?php echo get_settings('home'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
-
-<!-- // loop start -->
-<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-<?php the_date('d.m.y', '<h2>','</h2>'); ?>
-<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
-
-<?php the_content(); ?>
-
-<?php link_pages('<br />Pages: ', '<br />', 'number') ?>
-
-<p><em>Posted by <strong><?php the_author() ?></strong> @ <a href="<?php the_permalink() ?>"><?php the_time() ?></a></em></p>
-<p>Filed under: <?php the_category(',') ?></p>
-
-<?php comments_popup_link('comments ?', '1 comment', '% comments') ?>
-
-<?php comments_template(); ?>
-
-
-<!-- // this is just the end of the motor - don't touch that line either :) -->
-<?php endwhile; else: ?>
-<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
-<?php endif; ?>
-
-<div align="right"><cite>Powered by <a href="http://wordpress.org/"><strong>Wordpress</strong></a></cite><br />
-<br />
-<a href="wp-login.php">login</a><br />
-<a href="wp-register.php">register</a>
-</div>
-
-
-</body>
-</html>
diff --git a/wp-inst/xmlrpc.php b/wp-inst/xmlrpc.php
index 235c57b..753a8c8 100644
--- a/wp-inst/xmlrpc.php
+++ b/wp-inst/xmlrpc.php
@@ -324,7 +324,7 @@ class wp_xmlrpc_server extends IXR_Server {
/* warning: here we make the assumption that the weblog's URI is on the same server */
$filename = get_settings('home') . '/';
- $filename = preg_replace('#http://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+ $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
$f = fopen($filename, 'r');
$content = fread($f, filesize($filename));
@@ -359,7 +359,7 @@ class wp_xmlrpc_server extends IXR_Server {
/* warning: here we make the assumption that the weblog's URI is on the same server */
$filename = get_settings('home') . '/';
- $filename = preg_replace('#http://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+ $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
if ($f = fopen($filename, 'w+')) {
fwrite($f, $content);
@@ -1147,7 +1147,7 @@ class wp_xmlrpc_server extends IXR_Server {
$error_code = -1;
// Check if the page linked to is in our site
- $pos1 = strpos($pagelinkedto, str_replace('http://', '', str_replace('www.', '', get_settings('home'))));
+ $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_settings('home')));
if( !$pos1 )
return new IXR_Error(0, 'Is there no link to us?');