Compare commits
254 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dea69baaef | ||
|
|
084361c8ac | ||
|
|
4beed03c65 | ||
|
|
b3a5117b6d | ||
|
|
a185b7376e | ||
|
|
46291cd1f5 | ||
|
|
9e63b5c8d8 | ||
|
|
ec0f80aa43 | ||
|
|
a95277a8c5 | ||
|
|
e11647a638 | ||
|
|
8788a9bd9e | ||
|
|
434ee3acd5 | ||
|
|
b6cbe98881 | ||
|
|
e2f1542016 | ||
|
|
32cb17c3dd | ||
|
|
4160fafdcd | ||
|
|
7059985cf1 | ||
|
|
d6b2e48c89 | ||
|
|
3222cf4dfb | ||
|
|
7b58642bbc | ||
|
|
ff3d436b2f | ||
|
|
422bd96e7e | ||
|
|
4b538e243c | ||
|
|
552c4ad4b8 | ||
|
|
5242c3eec3 | ||
|
|
70ae8e667b | ||
|
|
63d317c680 | ||
|
|
8f48c9ca99 | ||
|
|
8f96b4f054 | ||
|
|
04f3e6d29d | ||
|
|
d63d15600a | ||
|
|
eb60eaab15 | ||
|
|
9f33ee88e1 | ||
|
|
3cc914328a | ||
|
|
f0a54726e0 | ||
|
|
17681831ee | ||
|
|
95883b9211 | ||
|
|
2fd04bb902 | ||
|
|
f49bca8131 | ||
|
|
48d0ec3c43 | ||
|
|
406027014e | ||
|
|
3e8d9d0cf0 | ||
|
|
ebdf64dce2 | ||
|
|
75af9cc6b6 | ||
|
|
5be251dbe9 | ||
|
|
96b0ea4c10 | ||
|
|
6784ed04bd | ||
|
|
db7f896a2f | ||
|
|
9d12ebaed3 | ||
|
|
edb0d26bef | ||
|
|
797c0e896f | ||
|
|
87ae97a740 | ||
|
|
3518ab235e | ||
|
|
4dad093159 | ||
|
|
d877c39976 | ||
|
|
5eb42126dd | ||
|
|
b8899402d0 | ||
|
|
baffa2ef15 | ||
|
|
584fb345bd | ||
|
|
0cffb54324 | ||
|
|
c377504cd3 | ||
|
|
68b4b3c61c | ||
|
|
07730d904d | ||
|
|
5786083f60 | ||
|
|
add01ff78a | ||
|
|
8e076bda03 | ||
|
|
a2b53e2909 | ||
|
|
74b400f3d3 | ||
|
|
0d878895e4 | ||
|
|
f3031d20db | ||
|
|
4d55cc850b | ||
|
|
ac4cbfa853 | ||
|
|
03b04efa1c | ||
|
|
0c3b3e5347 | ||
|
|
4780b6f925 | ||
|
|
527e544e2f | ||
|
|
1eac787dce | ||
|
|
9fd4eb9adf | ||
|
|
c996e21818 | ||
|
|
c7bd7fe40b | ||
|
|
6fa7ece460 | ||
|
|
a0e1196acf | ||
|
|
c882b0ab31 | ||
|
|
dac1dfc256 | ||
|
|
84c853d8d0 | ||
|
|
1a6877d062 | ||
|
|
5b9e782523 | ||
|
|
af7a390c59 | ||
|
|
7b1a2648b3 | ||
|
|
381e0879d0 | ||
|
|
a19088c2cb | ||
|
|
92805e971f | ||
|
|
e54d8a34c2 | ||
|
|
f81f76f751 | ||
|
|
6bd9d5a824 | ||
|
|
13ae8dd0bc | ||
|
|
14c439eaad | ||
|
|
50829f1dda | ||
|
|
2cdb8f3852 | ||
|
|
08b02d95bc | ||
|
|
e3d0f0334d | ||
|
|
267d1c519b | ||
|
|
ee95c85ec9 | ||
|
|
24865d57a0 | ||
|
|
7ee667d4a9 | ||
|
|
d27f6e58e6 | ||
|
|
8f5144ccfc | ||
|
|
e5d1bed10c | ||
|
|
6a85ffa048 | ||
|
|
1360dd85c5 | ||
|
|
28da91c8e1 | ||
|
|
74328576c6 | ||
|
|
d8ba4fd2ef | ||
|
|
2c30bcbb7d | ||
|
|
11f5bb3f58 | ||
|
|
928cb8e0a5 | ||
|
|
14aeac1de1 | ||
|
|
2ca5ffceea | ||
|
|
99218b60d7 | ||
|
|
8007e707c8 | ||
|
|
83a8a56f73 | ||
|
|
f1ccc3d222 | ||
|
|
65e7810299 | ||
|
|
38d509975a | ||
|
|
7133584620 | ||
|
|
ea350cb922 | ||
|
|
19c83838cf | ||
|
|
5534514f39 | ||
|
|
c48ebdadd7 | ||
|
|
171fa8fabd | ||
|
|
97504fef96 | ||
|
|
bd7f914d8c | ||
|
|
eb6980c900 | ||
|
|
e6ace4940a | ||
|
|
dbeb92f23b | ||
|
|
8da6700ea7 | ||
|
|
7a8be58c67 | ||
|
|
8f9c24ef7a | ||
|
|
8682ab7007 | ||
|
|
17e8a05912 | ||
|
|
4e1fa082fd | ||
|
|
9697579316 | ||
|
|
e27d276710 | ||
|
|
1828746711 | ||
|
|
6851c1e0ab | ||
|
|
3505b7172a | ||
|
|
4ca7ad63ac | ||
|
|
2a5bae7136 | ||
|
|
04edf0703e | ||
|
|
1dd96f8a39 | ||
|
|
cfc06de303 | ||
|
|
6ecc63bbc7 | ||
|
|
0d88aac206 | ||
|
|
4bed76bfb2 | ||
|
|
e20d004cab | ||
|
|
ecbeff5616 | ||
|
|
11f6361840 | ||
|
|
7d2cd84b73 | ||
|
|
f94536e388 | ||
|
|
56933a4e6d | ||
|
|
5b6f2a148c | ||
|
|
cb76d37c05 | ||
|
|
3e2b1f0d75 | ||
|
|
ab0395cd3c | ||
|
|
f88ebc2808 | ||
|
|
8b3937b621 | ||
|
|
57f741c827 | ||
|
|
61aca1c30a | ||
|
|
7875b024a8 | ||
|
|
8ee2a563b8 | ||
|
|
3c12b33710 | ||
|
|
59ae577d6b | ||
|
|
c4b6f0fa51 | ||
|
|
267655af24 | ||
|
|
c81c012981 | ||
|
|
16b593ec35 | ||
|
|
c1c2c0df34 | ||
|
|
fc33ac0368 | ||
|
|
5123086148 | ||
|
|
8b36e6be3a | ||
|
|
3825b18aff | ||
|
|
15073f4f4a | ||
|
|
15209b94c2 | ||
|
|
c21410812f | ||
|
|
b4f88fc01c | ||
|
|
5a295374c6 | ||
|
|
379367cfbe | ||
|
|
2bc77d4189 | ||
|
|
4cd9ea1d27 | ||
|
|
1996a5986f | ||
|
|
53eef6d943 | ||
|
|
0ee45ebf10 | ||
|
|
00e11b95f4 | ||
|
|
ef3ef052e6 | ||
|
|
b6cd1461ec | ||
|
|
4964935ced | ||
|
|
afabe5523d | ||
|
|
266b766a0d | ||
|
|
0459dc002a | ||
|
|
568d440bf4 | ||
|
|
5d148a8d1b | ||
|
|
563e4e9ff9 | ||
|
|
2fbbab314f | ||
|
|
8d5745bfb4 | ||
|
|
a91c28459e | ||
|
|
3a0fc8bf43 | ||
|
|
c84f9a4325 | ||
|
|
3afee26783 | ||
|
|
4b3cb04c1b | ||
|
|
2f10c8b2f3 | ||
|
|
88dce7c55b | ||
|
|
30711d8c0c | ||
|
|
ca90d6e32c | ||
|
|
735666f3c0 | ||
|
|
b9433193df | ||
|
|
ec8924fb5b | ||
|
|
6ff955829c | ||
|
|
e276f13b35 | ||
|
|
26808caf61 | ||
|
|
2233bfb700 | ||
|
|
442e09db17 | ||
|
|
acf8c1c2cc | ||
|
|
d40a808df3 | ||
|
|
299e5c6f36 | ||
|
|
139adf7c5c | ||
|
|
778c30821d | ||
|
|
826ecd2bcd | ||
|
|
5701e838c6 | ||
|
|
4ae13d2448 | ||
|
|
6bb1b724ab | ||
|
|
8e42511ad6 | ||
|
|
8d579218f6 | ||
|
|
98874495fb | ||
|
|
ee0bee021f | ||
|
|
0e74c2524b | ||
|
|
b07728b5ee | ||
|
|
eb8369937f | ||
|
|
9da4d0f021 | ||
|
|
894c4cc880 | ||
|
|
8d7f5b8cae | ||
|
|
639a2a93d2 | ||
|
|
4fd6b840a5 | ||
|
|
f05d1a28ec | ||
|
|
839698993a | ||
|
|
774a21505d | ||
|
|
f6da723d1f | ||
|
|
8a8d558563 | ||
|
|
015651ab8c | ||
|
|
16d7d02013 | ||
|
|
810bf22215 | ||
|
|
c567fccfc4 | ||
|
|
a7110c0663 | ||
|
|
7431bdd75a | ||
|
|
ecf61fc382 |
@@ -1,10 +1,10 @@
|
||||
|
||||
<div id="footer"><p><a href="http://wordpress.org/"><img src="../wp-images/wp-small.png" alt="WordPress" /></a><br />
|
||||
<?php bloginfo('version'); ?> — <a href="http://wordpress.org/support/"><?php _e('Support Forums'); ?></a><br />
|
||||
<?php bloginfo('version'); ?> <br />
|
||||
<a href="http://codex.wordpress.org/"><?php _e('Documentation'); ?></a> — <a href="http://wordpress.org/support/"><?php _e('Support Forums'); ?></a> <br />
|
||||
<?php printf(__('%s seconds'), number_format(timer_stop(), 2)); ?>
|
||||
</p>
|
||||
|
||||
<p><a href="http://spreadfirefox.com/community/?q=affiliates&id=2490&t=1" title="<?php _e('WordPress recommends the open-source Firefox browser') ?>"><img src="http://static.wordpress.org/get-firefox.png" alt="Get Firefox" /></a></p>
|
||||
</div>
|
||||
|
||||
<?php do_action('admin_footer', ''); ?>
|
||||
|
||||
@@ -409,10 +409,9 @@ function update_meta($mid, $mkey, $mvalue) {
|
||||
return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
|
||||
}
|
||||
|
||||
function touch_time($edit = 1) {
|
||||
global $month, $postdata;
|
||||
// echo $postdata['Date'];
|
||||
if ('draft' == $postdata->post_status) {
|
||||
function touch_time($edit = 1, $for_post = 1) {
|
||||
global $month, $postdata, $commentdata;
|
||||
if ( $for_post && ('draft' == $postdata->post_status) ) {
|
||||
$checked = 'checked="checked" ';
|
||||
$edit = false;
|
||||
} else {
|
||||
@@ -422,7 +421,7 @@ function touch_time($edit = 1) {
|
||||
echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">' . __('Edit timestamp') . '</label></legend>';
|
||||
|
||||
$time_adj = time() + (get_settings('gmt_offset') * 3600);
|
||||
$post_date = $postdata->post_date;
|
||||
$post_date = ($for_post) ? $postdata->post_date : $commentdata['comment_date'];
|
||||
$jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
|
||||
$mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
|
||||
$aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj);
|
||||
@@ -449,16 +448,29 @@ function touch_time($edit = 1) {
|
||||
<input type="text" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
|
||||
<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
|
||||
<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" />
|
||||
<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> <?php _e('Existing timestamp'); ?>: <?php echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?></fieldset>
|
||||
<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
|
||||
<?php _e('Existing timestamp'); ?>:
|
||||
<?php
|
||||
// We might need to readjust to display proper existing timestamp
|
||||
if ( $for_post && ('draft' == $postdata->post_status) ) {
|
||||
$jj = mysql2date('d', $post_date);
|
||||
$mm = mysql2date('m', $post_date);
|
||||
$aa = mysql2date('Y', $post_date);
|
||||
$hh = mysql2date('H', $post_date);
|
||||
$mn = mysql2date('i', $post_date);
|
||||
$ss = mysql2date('s', $post_date);
|
||||
}
|
||||
echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
||||
function check_admin_referer() {
|
||||
$adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
|
||||
$referer = strtolower($_SERVER['HTTP_REFERER']);
|
||||
if ( !strstr($referer, $adminurl) ) {
|
||||
die('Sorry, you need to enable sending referrers, for this feature to work.');
|
||||
}
|
||||
$adminurl = strtolower( get_settings('siteurl') ) . '/wp-admin';
|
||||
$referer = strtolower( $_SERVER['HTTP_REFERER'] );
|
||||
if ( !strstr($referer, $adminurl) )
|
||||
die(__('Sorry, you need to <a href="http://codex.wordpress.org/Enable_Sending_Referrers">enable sending referrers</a> for this feature to work.'));
|
||||
do_action('check_admin_referer');
|
||||
}
|
||||
|
||||
// insert_with_markers: Owen Winkler
|
||||
@@ -614,16 +626,18 @@ function get_page_templates() {
|
||||
$templates = $themes[$theme]['Template Files'];
|
||||
$page_templates = array();
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$template_data = implode('', file(ABSPATH . $template));
|
||||
preg_match("|Template Name:(.*)|i", $template_data, $name);
|
||||
preg_match("|Description:(.*)|i", $template_data, $description);
|
||||
if( is_array( $templates ) ) {
|
||||
foreach ($templates as $template) {
|
||||
$template_data = implode('', file(ABSPATH . $template));
|
||||
preg_match("|Template Name:(.*)|i", $template_data, $name);
|
||||
preg_match("|Description:(.*)|i", $template_data, $description);
|
||||
|
||||
$name = $name[1];
|
||||
$description = $description[1];
|
||||
$name = $name[1];
|
||||
$description = $description[1];
|
||||
|
||||
if (! empty($name)) {
|
||||
$page_templates[trim($name)] = basename($template);
|
||||
if (! empty($name)) {
|
||||
$page_templates[trim($name)] = basename($template);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -744,6 +758,7 @@ function get_admin_page_title() {
|
||||
|
||||
function get_admin_page_parent() {
|
||||
global $parent_file;
|
||||
global $menu;
|
||||
global $submenu;
|
||||
global $pagenow;
|
||||
global $plugin_page;
|
||||
@@ -752,6 +767,15 @@ function get_admin_page_parent() {
|
||||
return $parent_file;
|
||||
}
|
||||
|
||||
if ($pagenow == 'admin.php' && isset($plugin_page)) {
|
||||
foreach ($menu as $parent_menu) {
|
||||
if ($parent_menu[2] == $plugin_page) {
|
||||
$parent_file = $plugin_page;
|
||||
return $plugin_page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array_keys($submenu) as $parent) {
|
||||
foreach ($submenu[$parent] as $submenu_array) {
|
||||
if ($submenu_array[2] == $pagenow) {
|
||||
@@ -769,10 +793,10 @@ function get_admin_page_parent() {
|
||||
}
|
||||
|
||||
function plugin_basename($file) {
|
||||
return preg_replace('#^.*wp-content/plugins/#', '', $file);
|
||||
return preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
|
||||
}
|
||||
|
||||
function add_menu_page($page_title, $menu_title, $access_level, $file) {
|
||||
function add_menu_page($page_title, $menu_title, $access_level, $file, $function = '') {
|
||||
global $menu, $admin_page_hooks;
|
||||
|
||||
$file = plugin_basename($file);
|
||||
@@ -780,6 +804,12 @@ function add_menu_page($page_title, $menu_title, $access_level, $file) {
|
||||
$menu[] = array($menu_title, $access_level, $file, $page_title);
|
||||
|
||||
$admin_page_hooks[$file] = sanitize_title($menu_title);
|
||||
|
||||
$hookname = get_plugin_page_hookname($file, '');
|
||||
if ( !empty($function) && !empty($hookname) )
|
||||
add_action($hookname, $function);
|
||||
|
||||
return $hookname;
|
||||
}
|
||||
|
||||
function add_submenu_page($parent, $page_title, $menu_title, $access_level, $file, $function = '') {
|
||||
@@ -946,13 +976,13 @@ function get_plugin_data($plugin_file) {
|
||||
$name = trim($name);
|
||||
$plugin = $name;
|
||||
if ('' != $plugin_uri[1] && '' != $name) {
|
||||
$plugin = __("<a href='{$plugin_uri[1]}' title='Visit plugin homepage'>{$plugin}</a>");
|
||||
$plugin = '<a href="' . $plugin_uri[1] . '" title="' . __('Visit plugin homepage') . '">' . $plugin . '</a>';
|
||||
}
|
||||
|
||||
if ('' == $author_uri[1]) {
|
||||
$author = $author_name[1];
|
||||
} else {
|
||||
$author = __("<a href='{$author_uri[1]}' title='Visit author homepage'>{$author_name[1]}</a>");
|
||||
$author = '<a href="' . $author_uri[1] . '" title="' . __('Visit author homepage') . '">' . $author_name[1] . '</a>';
|
||||
}
|
||||
|
||||
return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]);
|
||||
@@ -1014,10 +1044,18 @@ function get_plugins() {
|
||||
function get_plugin_page_hookname($plugin_page, $parent_page) {
|
||||
global $admin_page_hooks;
|
||||
|
||||
if ( isset($admin_page_hooks[$parent_page]) )
|
||||
$parent = get_admin_page_parent();
|
||||
|
||||
if ( empty($parent_page) || 'admin.php' == $parent_page ) {
|
||||
if ( isset($admin_page_hooks[$plugin_page]) )
|
||||
$page_type = 'toplevel';
|
||||
else if ( isset($admin_page_hooks[$parent]) )
|
||||
$page_type = $admin_page_hooks[$parent];
|
||||
} else if ( isset($admin_page_hooks[$parent_page]) ) {
|
||||
$page_type = $admin_page_hooks[$parent_page];
|
||||
else
|
||||
} else {
|
||||
$page_type = 'admin';
|
||||
}
|
||||
|
||||
$plugin_name = preg_replace('!\.php!', '', $plugin_page);
|
||||
|
||||
@@ -1026,13 +1064,22 @@ function get_plugin_page_hookname($plugin_page, $parent_page) {
|
||||
|
||||
function get_plugin_page_hook($plugin_page, $parent_page) {
|
||||
global $wp_filter;
|
||||
|
||||
|
||||
$hook = get_plugin_page_hookname($plugin_page, $parent_page);
|
||||
|
||||
if ( isset($wp_filter[$hook]) )
|
||||
return $hook;
|
||||
else
|
||||
return '';
|
||||
}
|
||||
|
||||
?>
|
||||
function pimp_firefox() {
|
||||
if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'Firefox' ) )
|
||||
return;
|
||||
$getit = __('WordPress recommends the open-source Firefox browser');
|
||||
echo '
|
||||
<p id="firefoxlink" style="text-align: center;"><a href="http://spreadfirefox.com/community/?q=affiliates&id=2490&t=1" title="' . $getit . '"><img src="../wp-images/get-firefox.png" alt="Get Firefox" /></a></p>
|
||||
';
|
||||
}
|
||||
add_action('admin_footer', 'pimp_firefox');
|
||||
|
||||
?>
|
||||
@@ -6,7 +6,7 @@ if (!isset($_GET["page"])) require_once('admin.php'); ?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title>
|
||||
<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<?php
|
||||
require_once('../wp-config.php');
|
||||
if ( defined('ABSPATH') )
|
||||
require_once( ABSPATH . 'wp-config.php');
|
||||
else
|
||||
require_once('../wp-config.php');
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/admin-functions.php');
|
||||
auth_redirect();
|
||||
|
||||
header('Expires: Mon, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate, max-age=0');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories");
|
||||
foreach ($dogs as $catt) {
|
||||
$cache_categories[$catt->cat_ID] = $catt;
|
||||
}
|
||||
update_category_cache();
|
||||
|
||||
get_currentuserinfo();
|
||||
|
||||
|
||||
@@ -154,9 +154,7 @@ cat_rows();
|
||||
|
||||
<?php if ( $user_level > 3 ) : ?>
|
||||
<div class="wrap">
|
||||
<p><?php printf(__('<strong>Note:</strong><br />
|
||||
Deleting a category does not delete posts from that category, it will just
|
||||
set them back to the default category <strong>%s</strong>.'), get_catname(1)) ?>
|
||||
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(1)) ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -183,4 +181,4 @@ break;
|
||||
}
|
||||
|
||||
include('admin-footer.php');
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@ if (0 == $post_ID) {
|
||||
$form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
|
||||
}
|
||||
|
||||
$form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_pingback" />';
|
||||
$form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />';
|
||||
|
||||
$form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
|
||||
|
||||
@@ -115,7 +115,7 @@ edCanvas = document.getElementById('content');
|
||||
<?php
|
||||
if ('publish' != $post_status || 0 == $post_ID) {
|
||||
?>
|
||||
<?php if ( 1 < $user_level || (1 == $user_level && 2 == get_option('new_users_can_blog')) ) : ?>
|
||||
<?php if ( user_can_create_post($user_ID) ) : ?>
|
||||
<input name="publish" type="submit" id="publish" tabindex="10" value="<?php _e('Publish') ?>" />
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
@@ -135,7 +135,7 @@ if ('publish' != $post_status || 0 == $post_ID) {
|
||||
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php _e('Post Status') ?>:</th>
|
||||
<td><?php if ( 1 < $user_level || (1 == $user_level && 2 == get_option('new_users_can_blog')) ) : ?>
|
||||
<td><?php if ( user_can_create_post($user_ID) ) : ?>
|
||||
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post_status, 'publish'); ?> /> <?php _e('Published') ?></label><br />
|
||||
<?php endif; ?>
|
||||
<label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post_status, 'draft'); ?> /> <?php _e('Draft') ?></label><br />
|
||||
@@ -157,7 +157,7 @@ if ('publish' != $post_status || 0 == $post_ID) {
|
||||
<select name="post_author_override" id="post_author_override">
|
||||
<?php
|
||||
foreach ($users as $o) :
|
||||
if ( $post_author == $o->ID ) $selected = 'selected="selected"';
|
||||
if ( $post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
|
||||
else $selected = '';
|
||||
echo "<option value='$o->ID' $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>";
|
||||
endforeach;
|
||||
@@ -172,11 +172,13 @@ if ('publish' != $post_status || 0 == $post_ID) {
|
||||
<td><?php touch_time(($action == 'edit')); ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if ('edit' == $action) : ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Delete'); ?>:</th>
|
||||
<td><?php if ('edit' == $action) : ?>
|
||||
<td>
|
||||
<input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), addslashes($edited_post_title) ) . "')\""; ?> />
|
||||
<?php endif; ?></td>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ edCanvas = document.getElementById('content');
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<p class="submit"><input type="submit" name="submit" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
|
||||
<p class="submit"><input type="submit" name="editcomment" id="editcomment" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php echo $_SERVER['HTTP_REFERER']; ?>" />
|
||||
</p>
|
||||
|
||||
@@ -74,7 +74,7 @@ edCanvas = document.getElementById('content');
|
||||
<?php if ($user_level > 4) : ?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Edit time'); ?>:</th>
|
||||
<td><?php touch_time(($action == 'edit')); ?></td>
|
||||
<td><?php touch_time(('editcomment' == $action), 0); ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ edCanvas = document.getElementById('content');
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<input type="hidden" name="post_pingback" value="1" id="post_pingback" />
|
||||
<input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" />
|
||||
|
||||
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
|
||||
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
|
||||
@@ -58,7 +58,7 @@ edCanvas = document.getElementById('content');
|
||||
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
|
||||
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
|
||||
|
||||
<?php if ( 1 < $user_level || (1 == $user_level && 2 == get_option('new_users_can_blog')) ) : ?>
|
||||
<?php if ( user_can_create_post($user_ID) ) : ?>
|
||||
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ if (0 == $post_ID) {
|
||||
|
||||
$sendto = $_SERVER['HTTP_REFERER'];
|
||||
|
||||
if ( $sendto == get_permalink($post) )
|
||||
$sendto = 'redo';
|
||||
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
|
||||
$sendto = 'redo';
|
||||
$sendto = wp_specialchars( $sendto );
|
||||
|
||||
?>
|
||||
|
||||
@@ -66,12 +66,21 @@ if ($drafts || $other_drafts) {
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php
|
||||
if ( $_GET['m'] ) {
|
||||
echo $month[substr( $_GET['m'], 4, 2 )] . ' ' . substr( $_GET['m'], 0, 4 );
|
||||
} elseif ( isset( $_GET['s'] ) ) {
|
||||
$what_to_show = 'posts';
|
||||
$posts_per_page = 15;
|
||||
$posts_per_archive_page = -1;
|
||||
|
||||
include(ABSPATH.'wp-blog-header.php');
|
||||
|
||||
if ( is_month() ) {
|
||||
single_month_title(' ');
|
||||
} elseif ( is_search() ) {
|
||||
printf(__('Search for “%s”'), wp_specialchars($_GET['s']) );
|
||||
} else {
|
||||
_e('Last 15 Posts');
|
||||
if ( ! is_paged() || get_query_var('paged') == 1 )
|
||||
_e('Last 15 Posts');
|
||||
else
|
||||
_e('Previous Posts');
|
||||
}
|
||||
?>
|
||||
</h2>
|
||||
@@ -79,7 +88,7 @@ if ( $_GET['m'] ) {
|
||||
<form name="searchform" action="" method="get" style="float: left; width: 16em; margin-right: 3em;">
|
||||
<fieldset>
|
||||
<legend><?php _e('Search Posts…') ?></legend>
|
||||
<input type="text" name="s" value="<?php if (isset($s)) echo $s; ?>" size="17" />
|
||||
<input type="text" name="s" value="<?php if (isset($s)) echo wp_specialchars($s, 1); ?>" size="17" />
|
||||
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||
</fieldset>
|
||||
</form>
|
||||
@@ -140,15 +149,6 @@ $posts_columns['control_delete'] = '';
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
$what_to_show = 'posts';
|
||||
if ( empty($_GET['m']) || 0 == $_GET['m'] && empty($_GET['s']) ) {
|
||||
$showposts = 15;
|
||||
} else {
|
||||
$nopaging = true;
|
||||
}
|
||||
|
||||
include(ABSPATH.'wp-blog-header.php');
|
||||
|
||||
if ($posts) {
|
||||
$bgcolor = '';
|
||||
foreach ($posts as $post) { start_wp();
|
||||
@@ -208,13 +208,13 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
|
||||
case 'control_edit':
|
||||
?>
|
||||
<td><?php if ( user_can_edit_user($user_ID,$authordata->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<td><?php if ( user_can_edit_post($user_ID,$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'control_delete':
|
||||
?>
|
||||
<td><?php if ( user_can_edit_user($user_ID,$authordata->ID) ) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "')\">" . __('Delete') . "</a>"; } ?></td>
|
||||
<td><?php if ( user_can_edit_post($user_ID,$post->ID) ) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "')\">" . __('Delete') . "</a>"; } ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -238,6 +238,12 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
} // end if ($posts)
|
||||
?>
|
||||
</table>
|
||||
|
||||
<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
|
||||
if ( 1 == count($posts) ) {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ require_once('../wp-config.php');
|
||||
require('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">
|
||||
|
||||
@@ -15,8 +15,9 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
require_once('../wp-config.php');
|
||||
require('upgrade-functions.php');
|
||||
require_once('../wp-config.php');
|
||||
require('upgrade-functions.php');
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
switch ($action) {
|
||||
|
||||
case "step1":
|
||||
@@ -85,7 +86,7 @@ case "step1":
|
||||
user_ip,
|
||||
user_domain,
|
||||
user_browser,
|
||||
dateYMDhour,
|
||||
user_registered,
|
||||
user_level,
|
||||
user_idmode
|
||||
) VALUES (
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. You must install WordPress before you import any entries.");
|
||||
|
||||
require_once('../wp-config.php');
|
||||
require('upgrade-functions.php');
|
||||
@@ -19,47 +20,63 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
}
|
||||
}
|
||||
|
||||
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">
|
||||
<title>WordPress › Import from GreyMatter</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style media="screen" type="text/css">
|
||||
body {
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
margin-left: 20%;
|
||||
margin-right: 20%;
|
||||
}
|
||||
#logo {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-image: url(http://wordpress.org/images/logo.png);
|
||||
background-repeat: no-repeat;
|
||||
height: 60px;
|
||||
border-bottom: 4px solid #333;
|
||||
}
|
||||
#logo a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
text-indent: -100em;
|
||||
height: 60px;
|
||||
}
|
||||
p {
|
||||
line-height: 140%;
|
||||
}
|
||||
#authors li {
|
||||
padding:3px;
|
||||
border: 1px solid #ccc;
|
||||
width: 40%;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
<h1 id="logo"><a href="http://wordpress.org">WordPress</a></h1>
|
||||
|
||||
<?php
|
||||
switch ($action) {
|
||||
|
||||
case "step1":
|
||||
|
||||
function gm2autobr($string) { // transforms GM's |*| into b2's <br />\n
|
||||
function gm2autobr($string) { // transforms GM's |*| into wp's <br />\n
|
||||
$string = str_replace("|*|","<br />\n",$string);
|
||||
return($string);
|
||||
}
|
||||
|
||||
if (!chdir($archivespath))
|
||||
if (!@chdir($archivespath))
|
||||
die("Wrong path, $archivespath\ndoesn't exist\non the server");
|
||||
|
||||
if (!chdir($gmpath))
|
||||
if (!@chdir($gmpath))
|
||||
die("Wrong path, $gmpath\ndoesn't exist\non the server");
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>GM 2 b2 - converting...</title>
|
||||
<link rel="stylesheet" href="wp-admin/b2.css" type="text/css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
<?php
|
||||
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
|
||||
?>
|
||||
textarea,input,select {
|
||||
background-color: #f0f0f0;
|
||||
border-width: 1px;
|
||||
border-color: #cccccc;
|
||||
border-style: solid;
|
||||
padding: 2px;
|
||||
margin: 1px;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin: 20px;">
|
||||
<p><font face="times new roman" style="font-size: 39px;">gm 2 <img src="../wp-images/wpminilogo.png" width="50" height="50" border="0" alt="WP" align="top" /></font></p>
|
||||
|
||||
<p>The importer is running...</p>
|
||||
<ul>
|
||||
<li>importing users... <ul><?php
|
||||
@@ -67,9 +84,6 @@ textarea,input,select {
|
||||
chdir($gmpath);
|
||||
$userbase = file("gm-authors.cgi");
|
||||
|
||||
$connexion = mysql_connect($server,$loginsql,$passsql) or die ("Oops, MySQL connection error ! Couldn't connect to $server with the username $loginsql");
|
||||
$bdd = mysql_select_db(DB_NAME,$connexion) or die ("Oops, can't find any database named DB_NAME here !");
|
||||
|
||||
foreach($userbase as $user) {
|
||||
$userdata=explode("|", $user);
|
||||
|
||||
@@ -93,8 +107,8 @@ textarea,input,select {
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
|
||||
$result = mysql_query($query);
|
||||
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
|
||||
$result = $wpdb->query($query);
|
||||
if ($result==false) {
|
||||
die ("<strong>ERROR</strong>: couldn't register an user!");
|
||||
}
|
||||
@@ -140,8 +154,8 @@ textarea,input,select {
|
||||
$post_author=trim(addslashes($postinfo[1]));
|
||||
// we'll check the author is registered, or if it's a deleted author
|
||||
$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
|
||||
$result = mysql_query($sql);
|
||||
if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
|
||||
$result = $wpdb->query($sql);
|
||||
if (! $result) { // if deleted from GM, we register the author as a level 0 user in wp
|
||||
$user_ip="127.0.0.1";
|
||||
$user_domain="localhost";
|
||||
$user_browser="server";
|
||||
@@ -152,18 +166,16 @@ textarea,input,select {
|
||||
$user_email=addslashes("user@deleted.com");
|
||||
$user_url=addslashes("");
|
||||
$user_joindate=addslashes($user_joindate);
|
||||
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
|
||||
$result = mysql_query($query);
|
||||
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
|
||||
$result = $wpdb->query($query);
|
||||
if ($result==false) {
|
||||
die ("<strong>ERROR</strong>: couldn't register an user!");
|
||||
}
|
||||
echo ": registered deleted user <i>$user_login</i> at level 0 ";
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
|
||||
$result = mysql_query($sql);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$post_author_ID=$myrow[0];
|
||||
$sql = "SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'";
|
||||
$post_author_ID = $wpdb->get_var($sql);
|
||||
|
||||
$post_title=gm2autobr($postinfo[2]);
|
||||
$post_title=addslashes($post_title);
|
||||
@@ -188,15 +200,13 @@ textarea,input,select {
|
||||
$post_karma=$postinfo[12];
|
||||
|
||||
$query = "INSERT INTO $wpdb->posts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
|
||||
$result = mysql_query($query) or die(mysql_error());
|
||||
$result = $wpdb->query($query);
|
||||
|
||||
if (!$result)
|
||||
die ("Error in posting...");
|
||||
|
||||
$sql2 = "SELECT * FROM $wpdb->posts ORDER BY ID DESC LIMIT 1";
|
||||
$result2 = mysql_query($sql2);
|
||||
$myrow2 = mysql_fetch_array($result2);
|
||||
$post_ID=$myrow2[0];
|
||||
$query = "SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1";
|
||||
$post_ID = $wpdb->get_var($query);
|
||||
|
||||
// Grab a default category.
|
||||
$post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
|
||||
@@ -237,7 +247,7 @@ textarea,input,select {
|
||||
$comment_content=addslashes($commentinfo[12]);
|
||||
|
||||
$sql3 = "INSERT INTO $wpdb->comments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";
|
||||
$result3 = mysql_query($sql3);
|
||||
$result3 = $wpdb->query($sql3);
|
||||
if (!$result3)
|
||||
die ("There is an error with the database, it can't store your comment..");
|
||||
}
|
||||
@@ -253,48 +263,19 @@ textarea,input,select {
|
||||
?>
|
||||
</ul><b>Done</b></li></ul>
|
||||
<p> </p>
|
||||
<p>Completed GM 2 b2 import !</p>
|
||||
<p>Completed GM 2 WordPress import !</p>
|
||||
<p>Now you can go and <a href="wp-login.php">log in</a>, have fun !</p>
|
||||
<?php
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
?>
|
||||
|
||||
?><html>
|
||||
<head>
|
||||
<title>GM 2 b2 importer utility</title>
|
||||
<link rel="stylesheet" href="wp-admin/b2.css" type="text/css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
<?php
|
||||
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
|
||||
?>
|
||||
textarea,input,select {
|
||||
background-color: #f0f0f0;
|
||||
border-width: 1px;
|
||||
border-color: #cccccc;
|
||||
border-style: solid;
|
||||
padding: 2px;
|
||||
margin: 1px;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin: 20px;">
|
||||
<p><font face="times new roman" style="font-size: 39px;">gm 2 <img src="../wp-images/wpminilogo.png" width="50" height="50" border="0" alt="WP" align="top" /></font></p>
|
||||
<p>This is a basic GreyMatter to WordPress import script.</p>
|
||||
<p>What it does:</p>
|
||||
<ul>
|
||||
<li>parses gm-authors.cgi to import authors: everyone is imported at level 1</li>
|
||||
<li>parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress yet)<br />if authors are found not to be in gm-authors.cgi, imports them at level 0</li>
|
||||
<li>parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on WordPress); if authors are found not to be in gm-authors.cgi, imports them at level 0</li>
|
||||
</ul>
|
||||
<p>What it does not:</p>
|
||||
<ul>
|
||||
@@ -302,15 +283,14 @@ textarea,input,select {
|
||||
<li>import gm-templates. you'll start with the basic template wp.php</li>
|
||||
<li>doesn't keep entries on top</li>
|
||||
</ul>
|
||||
<p> </p>
|
||||
|
||||
<h3>First step: install WordPress</h3>
|
||||
<h3>First step: Install WordPress</h3>
|
||||
<p>Install the WordPress blog as explained in the <a href="../readme.html" target="_blank">ReadMe</a>, then immediately come back here.</p>
|
||||
|
||||
<form name="stepOne" method="get">
|
||||
<input type="hidden" name="action" value="step1" />
|
||||
<h3>Second step: GreyMatter details:</h3>
|
||||
<p><table cellpadding="0">
|
||||
<h3>Second step: Provide GreyMatter details</h3>
|
||||
<table cellpadding="0">
|
||||
<tr>
|
||||
<td>Path to GM files:</td>
|
||||
<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
|
||||
@@ -319,15 +299,17 @@ textarea,input,select {
|
||||
<td>Path to GM entries:</td>
|
||||
<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><br />This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>This importer will search for files 00000001.cgi to 000-whatever.cgi, so you need to enter the number of the last GM post here. (If you don't know that number, just log into your FTP and look it up in the entries' folder)</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Last entry's number:</td>
|
||||
<td><input type="text" name="lastentry" value="00000001" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p>When you're ready, click OK to start importing: <input type="submit" name="submit" value="OK" class="search" /></p>
|
||||
</form>
|
||||
|
||||
@@ -335,7 +317,6 @@ textarea,input,select {
|
||||
</html>
|
||||
<?php
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -17,6 +17,7 @@ require('../wp-config.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">
|
||||
|
||||
@@ -8,6 +8,7 @@ require('../wp-config.php');
|
||||
require ('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">
|
||||
@@ -68,7 +69,7 @@ set_magic_quotes_runtime(0);
|
||||
$importdata = file(MTEXPORT); // Read the file into an array
|
||||
$importdata = implode('', $importdata); // squish it
|
||||
$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
|
||||
$importdata = preg_replace("/--------\nAUTHOR/", "--MT-ENTRY--\nAUTHOR", $importdata);
|
||||
$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata);
|
||||
$authors = array();
|
||||
$temp = array();
|
||||
$posts = explode("--MT-ENTRY--", $importdata);
|
||||
@@ -179,7 +180,7 @@ set_magic_quotes_runtime(0);
|
||||
$importdata = file(MTEXPORT); // Read the file into an array
|
||||
$importdata = implode('', $importdata); // squish it
|
||||
$importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);
|
||||
$importdata = preg_replace("/--------\nAUTHOR/", "--MT-ENTRY--\nAUTHOR", $importdata);
|
||||
$importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--", $importdata);
|
||||
$authors = array();
|
||||
$temp = array();
|
||||
$posts = explode("--MT-ENTRY--", $importdata);
|
||||
|
||||
@@ -22,6 +22,7 @@ require('../wp-config.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">
|
||||
|
||||
@@ -13,6 +13,7 @@ require('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">
|
||||
|
||||
@@ -39,7 +39,7 @@ if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM
|
||||
foreach ($scheduled as $post) {
|
||||
if ($post->post_title == '')
|
||||
$post->post_title = sprintf(__('Post #%s'), $post->ID);
|
||||
echo "<li><a href='post.php?action=edit&post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a> in " . human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt) ) . "</li>";
|
||||
echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "</li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
@@ -54,7 +54,7 @@ if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url,
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($comments as $comment) {
|
||||
echo '<li>' . sprintf('%s on %s', get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
|
||||
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
|
||||
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
|
||||
echo '</li>';
|
||||
}
|
||||
@@ -81,7 +81,7 @@ if (0 < $numcomms) $numcomms = number_format($numcomms);
|
||||
$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
|
||||
if (0 < $numcats) $numcats = number_format($numcats);
|
||||
?>
|
||||
<p>There are currently <?php echo $numposts ?> <a href="edit.php" title="posts">posts</a> and <?php echo $numcomms ?> <a href="edit-comments.php" title="Comments">comments</a>, contained within <?php echo $numcats ?> <a href="categories.php" title="categories">categories</a>.</p>
|
||||
<p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php', $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$_wp_installing = 1;
|
||||
define('WP_INSTALLING', true);
|
||||
if (!file_exists('../wp-config.php'))
|
||||
die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
|
||||
|
||||
@@ -12,11 +12,12 @@ if (isset($_GET['step']))
|
||||
$step = $_GET['step'];
|
||||
else
|
||||
$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">
|
||||
<head>
|
||||
<title>WordPress › Installation</title>
|
||||
<title><?php _e('WordPress › Installation'); ?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style media="screen" type="text/css">
|
||||
<!--
|
||||
@@ -77,46 +78,58 @@ else
|
||||
// Let's check to make sure WP isn't already installed.
|
||||
$wpdb->hide_errors();
|
||||
$installed = $wpdb->get_results("SELECT * FROM $wpdb->users");
|
||||
if ($installed) die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p></body></html>'));
|
||||
if ($installed) die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
|
||||
$wpdb->show_errors();
|
||||
|
||||
switch($step) {
|
||||
|
||||
case 0:
|
||||
?>
|
||||
<p>Welcome to WordPress installation. We’re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="../readme.html">ReadMe documentation</a> at your leisure.</p>
|
||||
<h2 class="step"><a href="install.php?step=1">First Step »</a></h2>
|
||||
<p><?php printf(__('Welcome to WordPress installation. We’re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="%s">ReadMe documentation</a> at your leisure.'), '../readme.html'); ?></p>
|
||||
<h2 class="step"><a href="install.php?step=1"><?php _e('First Step »'); ?></a></h2>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
?>
|
||||
<h1>First Step</h1>
|
||||
<p>Before we begin we need a little bit of information. Don't worry, you can always change these later. </p>
|
||||
<h1><?php _e('First Step'); ?></h1>
|
||||
<p><?php _e("Before we begin we need a little bit of information. Don't worry, you can always change these later."); ?></p>
|
||||
|
||||
<form id="setup" method="post" action="install.php?step=2">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th width="33%">Weblog title:</th>
|
||||
<th width="33%"><?php _e('Weblog title:'); ?></th>
|
||||
<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Your e-mail:</th>
|
||||
<th><?php _e('Your e-mail:'); ?></th>
|
||||
<td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><em>Double-check that email address before continuing.</em></p>
|
||||
<p><em><?php _e('Double-check that email address before continuing.'); ?></em></p>
|
||||
<h2 class="step">
|
||||
<input type="submit" name="Submit" value="Continue to Second Step »" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Continue to Second Step »'); ?>" />
|
||||
</h2>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
break;
|
||||
case 2:
|
||||
|
||||
// Fill in the data we gathered
|
||||
$weblog_title = $_POST['weblog_title'];
|
||||
$admin_email = $_POST['admin_email'];
|
||||
// check e-mail address
|
||||
if (empty($admin_email)) {
|
||||
die (__("<strong>ERROR</strong>: please type your e-mail address"));
|
||||
} else if (!is_email($admin_email)) {
|
||||
die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
|
||||
}
|
||||
|
||||
?>
|
||||
<h1>Second Step</h1>
|
||||
<p>Now we’re going to create the database tables and fill them with some default data.</p>
|
||||
<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>
|
||||
|
||||
|
||||
<?php
|
||||
@@ -126,15 +139,11 @@ flush();
|
||||
make_db_current_silent();
|
||||
populate_options();
|
||||
|
||||
// Fill in the data we gathered
|
||||
$weblog_title = addslashes(stripslashes(stripslashes($_POST['weblog_title'])));
|
||||
$admin_email = addslashes(stripslashes(stripslashes($_POST['admin_email'])));
|
||||
|
||||
$wpdb->query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'");
|
||||
$wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'");
|
||||
|
||||
// Now drop in some default links
|
||||
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Blogroll')");
|
||||
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".addslashes(__('Blogroll'))."')");
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blog.carthik.net/index.php', 'Carthik', 1, 'http://blog.carthik.net/feed/');");
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/');");
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/');");
|
||||
@@ -145,65 +154,61 @@ $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/');");
|
||||
|
||||
// Default category
|
||||
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'Uncategorized')");
|
||||
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename) VALUES ('0', '".addslashes(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."')");
|
||||
|
||||
// First post
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$now_gmt = gmdate('Y-m-d H:i:s');
|
||||
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', 'Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!', 'Hello world!', '0', '$now', '$now_gmt')");
|
||||
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_name, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', '".addslashes(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '".addslashes(__('Hello world!'))."', '0', '".addslashes(__('hello-world'))."', '$now', '$now_gmt')");
|
||||
|
||||
$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
|
||||
|
||||
// Default comment
|
||||
$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', 'Mr WordPress', '', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', 'Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')");
|
||||
$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".addslashes(__('Mr WordPress'))."', '', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', '".addslashes(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
|
||||
|
||||
// Set up admin user
|
||||
$random_password = substr(md5(uniqid(microtime())), 0, 6);
|
||||
$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode, user_registered) VALUES ( '1', 'admin', MD5('$random_password'), 'Administrator', '$admin_email', '10', 'nickname', NOW() )");
|
||||
$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode, user_registered) VALUES ( '1', 'admin', MD5('$random_password'), '".addslashes(__('Administrator'))."', '$admin_email', '10', 'nickname', NOW() )");
|
||||
|
||||
$from = 'From: '.$_POST['weblog_title'].' <wordpress@'.$_SERVER['SERVER_NAME'].'>';
|
||||
$message_headers = "$from";
|
||||
$message = "Your new WordPress blog has been successfully set up at:
|
||||
$message_headers = 'From: ' . stripslashes($_POST['weblog_title']) . ' <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
|
||||
$message = sprintf(__("Your new WordPress blog has been successfully set up at:
|
||||
|
||||
$guessurl
|
||||
%1\$s
|
||||
|
||||
You can log in to the administrator account with the following information:
|
||||
|
||||
Username: admin
|
||||
Password: $random_password
|
||||
Password: %2\$s
|
||||
|
||||
We hope you enjoy your new weblog. Thanks!
|
||||
|
||||
--The WordPress Team
|
||||
http://wordpress.org/
|
||||
";
|
||||
"), $guessurl, $random_password);
|
||||
|
||||
@mail($admin_email, 'New WordPress Blog', $message, $message_headers);
|
||||
@mail($admin_email, __('New WordPress Blog'), $message, $message_headers);
|
||||
|
||||
upgrade_all();
|
||||
?>
|
||||
|
||||
<p><em>Finished!</em></p>
|
||||
<p><em><?php _e('Finished!'); ?></em></p>
|
||||
|
||||
<p>Now you can <a href="../wp-login.php">log in</a> with the <strong>login</strong>
|
||||
"<code>admin</code>" and <strong>password</strong> "<code><?php echo $random_password; ?></code>".</p>
|
||||
<p><strong><em>Note that password</em></strong> carefully! It is a <em>random</em>
|
||||
password that was generated just for you. If you lose it, you
|
||||
will have to delete the tables from the database yourself, and re-install WordPress. So to review:
|
||||
<p><?php printf(__('Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $random_password); ?></p>
|
||||
<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install WordPress. So to review:'); ?>
|
||||
</p>
|
||||
<dl>
|
||||
<dt>Login</dt>
|
||||
<dt><?php _e('Username'); ?></dt>
|
||||
<dd><code>admin</code></dd>
|
||||
<dt>Password</dt>
|
||||
<dt><?php _e('Password'); ?></dt>
|
||||
<dd><code><?php echo $random_password; ?></code></dd>
|
||||
<dt>Login address</dt>
|
||||
<dt><?php _e('Login address'); ?></dt>
|
||||
<dd><a href="../wp-login.php">wp-login.php</a></dd>
|
||||
</dl>
|
||||
<p>Were you expecting more steps? Sorry to disappoint. All done! :)</p>
|
||||
<p><?php _e('Were you expecting more steps? Sorry to disappoint. All done! :)'); ?></p>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<p id="footer"><a href="http://wordpress.org/">WordPress</a>, personal publishing platform.</p>
|
||||
<p id="footer"><?php _e('<a href="http://wordpress.org/">WordPress</a>, personal publishing platform.'); ?></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -116,10 +116,10 @@ require('admin-header.php');
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('friendship') ?> </th>
|
||||
<td>
|
||||
<label for="contact">
|
||||
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
|
||||
<label for="acquaintance">
|
||||
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
|
||||
<label for="contact">
|
||||
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
|
||||
<label id="friend">
|
||||
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
|
||||
<label for="friendship">
|
||||
@@ -160,7 +160,7 @@ require('admin-header.php');
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> family </th>
|
||||
<th scope="row"> <?php _e('family'); ?> </th>
|
||||
<td>
|
||||
<label for="child">
|
||||
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
|
||||
|
||||
@@ -108,7 +108,7 @@ switch ($action) {
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>Edit “<?php echo wp_specialchars($row->cat_name)?>” Category </h2>
|
||||
<h2><?php printf(__('Edit “%s” Category'), wp_specialchars($row->cat_name)); ?></h2>
|
||||
|
||||
<form name="editcat" method="post">
|
||||
<input type="hidden" name="action" value="editedcat" />
|
||||
@@ -305,24 +305,50 @@ $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images
|
||||
$i = 1;
|
||||
foreach ($results as $row) {
|
||||
if ($row->list_limit == -1) {
|
||||
$row->list_limit = 'none';
|
||||
$row->list_limit = __('none');
|
||||
}
|
||||
$style = ($i % 2) ? ' class="alternate"' : '';
|
||||
/*
|
||||
Manually internationalize every sort order option.
|
||||
*/
|
||||
switch ($row->sort_order) {
|
||||
case 'name':
|
||||
$row->sort_order = __('name');
|
||||
break;
|
||||
case 'id':
|
||||
$row->sort_order = __('id');
|
||||
break;
|
||||
case 'url':
|
||||
$row->sort_order = __('url');
|
||||
break;
|
||||
case 'rating':
|
||||
$row->sort_order = __('rating');
|
||||
break;
|
||||
case 'updated':
|
||||
$row->sort_order = __('updated');
|
||||
break;
|
||||
case 'rand':
|
||||
$row->sort_order = __('rand');
|
||||
break;
|
||||
case 'length':
|
||||
$row->sort_order = __('length');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<tr valign="middle" align="center" <?php echo $style ?> style="border-bottom: 1px dotted #9C9A9C;">
|
||||
<td><?php echo wp_specialchars($row->cat_name)?></td>
|
||||
<td ><?php echo $row->cat_id?></td>
|
||||
<td><?php echo $row->auto_toggle?></td>
|
||||
<td><?php echo $row->show_images?></td>
|
||||
<td><?php echo $row->show_description?></td>
|
||||
<td><?php echo $row->show_rating?></td>
|
||||
<td><?php echo $row->show_updated?></td>
|
||||
<td><?php echo $row->sort_order?></td>
|
||||
<td><?php echo $row->sort_desc?></td>
|
||||
<td><?php echo $row->auto_toggle == 'Y' ? __('Yes') : __('No') ?></td>
|
||||
<td><?php echo $row->show_images == 'Y' ? __('Yes') : __('No') ?></td>
|
||||
<td><?php echo $row->show_description == 'Y' ? __('Yes') : __('No') ?></td>
|
||||
<td><?php echo $row->show_rating == 'Y' ? __('Yes') : __('No') ?></td>
|
||||
<td><?php echo $row->show_updated == 'Y' ? __('Yes') : __('No') ?></td>
|
||||
<td><?php echo $row->sort_order ?></td>
|
||||
<td><?php echo $row->sort_desc == 'Y' ? __('Yes') : __('No') ?></td>
|
||||
<td nowrap="nowrap"><?php echo htmlentities($row->text_before_link)?> </td>
|
||||
<td nowrap="nowrap"><?php echo htmlentities($row->text_after_link)?> </td>
|
||||
<td nowrap="nowrap"><?php echo htmlentities($row->text_after_all)?></td>
|
||||
<td><?php echo $row->list_limit?></td>
|
||||
<td><?php echo $row->list_limit ?></td>
|
||||
<td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&action=Edit" class="edit"><?php _e('Edit') ?></a></td>
|
||||
<td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&action=Delete" onclick="return confirm('<?php _e("You are about to delete this category.\\n \'Cancel\' to stop, \'OK\' to delete.") ?>');" class="delete"><?php _e('Delete') ?></a></td>
|
||||
</tr>
|
||||
@@ -417,13 +443,11 @@ foreach ($results as $row) {
|
||||
</div>
|
||||
<div class="wrap">
|
||||
<h3><?php _e('Note:') ?></h3>
|
||||
<?php printf(__('<p>Deleting a link category does not delete links from that category.<br />
|
||||
It will just set them back to the default category <b>%s</b>.'), get_linkcatname(1)) ?>
|
||||
</p>
|
||||
<?php printf(__('<p>Deleting a link category does not delete links from that category.<br />It will just set them back to the default category <b>%s</b>.'), get_linkcatname(1)) ?></p>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
} // end default
|
||||
} // end case
|
||||
?>
|
||||
<?php include('admin-footer.php'); ?>
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
||||
@@ -28,14 +28,8 @@ switch ($step) {
|
||||
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
|
||||
|
||||
<ol>
|
||||
<li><?php _e('Go to <a href="http://www.blogrolling.com">Blogrolling.com</a>
|
||||
and sign in. Once you’ve done that, click on <strong>Get Code</strong>, and then
|
||||
look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr>
|
||||
code</strong>') ?>.</li>
|
||||
<li><?php _e('Or go to <a href="http://blo.gs">Blo.gs</a> and sign in. Once you’ve done
|
||||
that in the \'Welcome Back\' box on the right, click on <strong>share</strong>, and then
|
||||
look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr>
|
||||
link</strong> (favorites.opml).') ?></li>
|
||||
<li><?php _e('Go to <a href="http://www.blogrolling.com">Blogrolling.com</a> and sign in. Once you’ve done that, click on <strong>Get Code</strong>, and then look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr> code</strong>') ?>.</li>
|
||||
<li><?php _e('Or go to <a href="http://blo.gs">Blo.gs</a> and sign in. Once you’ve done that in the \'Welcome Back\' box on the right, click on <strong>share</strong>, and then look for the <strong><abbr title="Outline Processor Markup Language">OPML</abbr> link</strong> (favorites.opml).') ?></li>
|
||||
<li><?php _e('Select that text and copy it or copy the link/shortcut into the box below.') ?><br />
|
||||
<input type="hidden" name="step" value="1" />
|
||||
<?php _e('Your OPML URL:') ?> <input type="text" name="opml_url" size="65" />
|
||||
|
||||
@@ -66,6 +66,7 @@ $links_show_order = $_COOKIE['links_show_order_' . COOKIEHASH];
|
||||
if ('' != $_POST['assign']) $action = 'assign';
|
||||
if ('' != $_POST['visibility']) $action = 'visibility';
|
||||
if ('' != $_POST['move']) $action = 'move';
|
||||
if ('' != $_POST['linkcheck']) $linkcheck = $_POST[linkcheck];
|
||||
|
||||
switch ($action) {
|
||||
case 'assign':
|
||||
@@ -242,7 +243,7 @@ switch ($action) {
|
||||
WHERE link_id=$link_id");
|
||||
} // end if save
|
||||
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
|
||||
header('Location: ' . $this_file);
|
||||
wp_redirect($this_file);
|
||||
break;
|
||||
} // end Save
|
||||
|
||||
@@ -266,7 +267,7 @@ switch ($action) {
|
||||
}
|
||||
$links_show_cat_id = $cat_id;
|
||||
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
|
||||
header('Location: '.$this_file);
|
||||
wp_redirect($this_file);
|
||||
break;
|
||||
} // end Delete
|
||||
|
||||
@@ -346,10 +347,10 @@ switch ($action) {
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('friendship') ?> </th>
|
||||
<td>
|
||||
<label for="contact">
|
||||
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
|
||||
<label for="acquaintance">
|
||||
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
|
||||
<label for="contact">
|
||||
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
|
||||
<label id="friend">
|
||||
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
|
||||
<label for="friendship">
|
||||
@@ -390,7 +391,7 @@ switch ($action) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> family </th>
|
||||
<th scope="row"> <?php _e('family') ?> </th>
|
||||
<td>
|
||||
<label for="child">
|
||||
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
|
||||
@@ -674,11 +675,10 @@ function checkAll(form)
|
||||
$visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
|
||||
++$i;
|
||||
$style = ($i % 2) ? ' class="alternate"' : '';
|
||||
echo <<<LINKS
|
||||
|
||||
<tr valign="middle" $style>
|
||||
<td><strong>$link->link_name</strong><br />
|
||||
LINKS;
|
||||
?>
|
||||
<tr valign="middle" <?php echo $style; ?>>
|
||||
<td><strong><?php echo $link->link_name; ?></strong><br />
|
||||
<?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
|
||||
@@ -752,4 +752,4 @@ LINKS;
|
||||
} // end case
|
||||
?>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
||||
@@ -35,16 +35,19 @@ foreach ($submenu["$parent_file"] as $item) :
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( (isset($plugin_page) && $plugin_page == $item[2]) || (!isset($plugin_page) && substr($self, -10) == substr($item[2], -10)) ) $class = ' class="current"';
|
||||
else if (isset($submenu_file) && $submenu_file == substr($item[2], -10)) $class = ' class="current"';
|
||||
if ( isset($submenu_file) ) {
|
||||
if ( $submenu_file == $item[2] ) $class = ' class="current"';
|
||||
else $class = '';
|
||||
} else if ( (isset($plugin_page) && $plugin_page == $item[2]) || (!isset($plugin_page) && $self == $item[2]) ) $class = ' class="current"';
|
||||
else $class = '';
|
||||
|
||||
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}")) {
|
||||
$page_hook = get_plugin_page_hook($item[2], $parent_file);
|
||||
if ( $page_hook )
|
||||
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
$menu_hook = get_plugin_page_hook($item[2], $parent_file);
|
||||
|
||||
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
|
||||
if ( 'admin.php' == $pagenow )
|
||||
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/{$parent_file}?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>";
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ endforeach;
|
||||
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Update Services') ?></legend>
|
||||
<p><?php printf(__('When you publish a new post WordPress can notify site update services. For more about this see <a href="%s">Update Services</a> on the Codex. Separate multiple service URIs with line breaks.'), 'http://codex.wordpress.org/Update_Services') ?></p>
|
||||
<p><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service URIs with line breaks.') ?></p>
|
||||
|
||||
<textarea name="ping_sites" id="ping_sites" style="width: 98%;" rows="3" cols="50"><?php form_option('ping_sites'); ?></textarea>
|
||||
</fieldset>
|
||||
|
||||
@@ -53,8 +53,6 @@ case 'update':
|
||||
if ($user_level >= $option->option_admin_level) {
|
||||
$old_val = $option->option_value;
|
||||
$new_val = trim($_POST[$option->option_name]);
|
||||
if ( !$new_val && $old_val != 0 )
|
||||
$new_val = '';
|
||||
if( in_array($option->option_name, $nonbools) && ( $new_val == '0' || $new_val == '') )
|
||||
$new_val = 'closed';
|
||||
if ($new_val !== $old_val) {
|
||||
@@ -70,6 +68,8 @@ case 'update':
|
||||
if ($any_changed) {
|
||||
// If siteurl or home changed, reset cookies.
|
||||
if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) {
|
||||
// If home changed, write rewrite rules to new location.
|
||||
save_mod_rewrite_rules();
|
||||
// Get currently logged in user and password.
|
||||
get_currentuserinfo();
|
||||
// Clear cookies for old paths.
|
||||
@@ -84,14 +84,14 @@ case 'update':
|
||||
$referred = remove_query_arg('updated' , $_SERVER['HTTP_REFERER']);
|
||||
$goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']);
|
||||
$goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
|
||||
header('Location: ' . $goback);
|
||||
wp_redirect($goback);
|
||||
break;
|
||||
|
||||
default:
|
||||
include('admin-header.php'); ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2>All options</h2>
|
||||
<h2><?php _e('All options'); ?></h2>
|
||||
<form name="form" action="options.php" method="post">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<table width="98%">
|
||||
@@ -103,7 +103,7 @@ foreach ($options as $option) :
|
||||
echo "
|
||||
<tr>
|
||||
<th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
|
||||
<td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . htmlspecialchars($value, ENT_QUOTES) . "' /></td>
|
||||
<td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td>
|
||||
<td>$option->option_description</td>
|
||||
</tr>";
|
||||
endforeach;
|
||||
|
||||
@@ -67,7 +67,7 @@ default:
|
||||
if (!$error) {
|
||||
$f = fopen($real_file, 'r');
|
||||
$content = fread($f, filesize($real_file));
|
||||
$content = wp_specialchars($content);
|
||||
$content = htmlspecialchars($content);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -29,6 +29,16 @@ require_once('admin-header.php');
|
||||
// If any plugins don't exist, axe 'em
|
||||
|
||||
$check_plugins = get_settings('active_plugins');
|
||||
|
||||
// Sanity check. If the active plugin list is not an array, make it an
|
||||
// empty array.
|
||||
if ( !is_array($check_plugins) ) {
|
||||
$check_plugins = array();
|
||||
update_option('active_plugins', $check_plugins);
|
||||
}
|
||||
|
||||
// If a plugin file does not exist, remove it from the list of active
|
||||
// plugins.
|
||||
foreach ($check_plugins as $check_plugin) {
|
||||
if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
|
||||
$current = get_settings('active_plugins');
|
||||
@@ -72,22 +82,24 @@ if (empty($plugins)) {
|
||||
<?php
|
||||
$style = '';
|
||||
foreach($plugins as $plugin_file => $plugin_data) {
|
||||
$style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
|
||||
$style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
|
||||
|
||||
if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) {
|
||||
$action = "<a href='plugins.php?action=deactivate&plugin=$plugin_file' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
|
||||
$plugin_data['Title'] = "<strong>{$plugin_data['Title']}</strong>";
|
||||
$style .= $style == 'alternate' ? ' active' : 'active';
|
||||
} else {
|
||||
$action = "<a href='plugins.php?action=activate&plugin=$plugin_file' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
|
||||
}
|
||||
$plugin_data['Description'] = wp_kses($plugin_data['Description'], array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()) ); ;
|
||||
if ($style != '') $style = 'class="' . $style . '"';
|
||||
echo "
|
||||
<tr $style>
|
||||
<td>{$plugin_data['Title']}</td>
|
||||
<td>{$plugin_data['Version']}</td>
|
||||
<td>{$plugin_data['Author']}</td>
|
||||
<td>{$plugin_data['Description']}</td>
|
||||
<td>$action</td>
|
||||
<td class=\"name\">{$plugin_data['Title']}</td>
|
||||
<td class=\"vers\">{$plugin_data['Version']}</td>
|
||||
<td class=\"auth\">{$plugin_data['Author']}</td>
|
||||
<td class=\"desc\">{$plugin_data['Description']}</td>
|
||||
<td class=\"togl\">$action</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
@@ -96,6 +108,10 @@ if (empty($plugins)) {
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<h2><?php _e('Get More Plugins'); ?></h2>
|
||||
<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is uploaded, you may activate it here.'); ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -22,11 +22,16 @@ if (isset($_POST['deletepost'])) {
|
||||
$action = "delete";
|
||||
}
|
||||
|
||||
// Fix submenu highlighting for pages.
|
||||
if (false !== strpos($_SERVER['HTTP_REFERER'], 'edit-pages.php')) $submenu_file = 'page-new.php';
|
||||
|
||||
$editing = true;
|
||||
|
||||
switch($action) {
|
||||
case 'post':
|
||||
|
||||
if ( !user_can_create_draft($user_ID) )
|
||||
die('You are not allowed to create posts or drafts on this blog.');
|
||||
die( __('You are not allowed to create posts or drafts on this blog.') );
|
||||
|
||||
$post_pingback = (int) $_POST['post_pingback'];
|
||||
$content = apply_filters('content_save_pre', $_POST['content']);
|
||||
@@ -58,14 +63,25 @@ case 'post':
|
||||
if ( empty($post_status) )
|
||||
$post_status = 'draft';
|
||||
// Double-check
|
||||
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) && 2 != get_option('new_users_can_blog') )
|
||||
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) )
|
||||
$post_status = 'draft';
|
||||
|
||||
$comment_status = $_POST['comment_status'];
|
||||
if ( empty($comment_status) && !isset($_POST['advanced_view']) )
|
||||
$comment_status = get_option('default_comment_status');
|
||||
if ( empty($comment_status) ) {
|
||||
if ( !isset($_POST['advanced_view']) )
|
||||
$comment_status = get_option('default_comment_status');
|
||||
else
|
||||
$comment_status = 'closed';
|
||||
}
|
||||
|
||||
$ping_status = $_POST['ping_status'];
|
||||
if ( empty($ping_status) && !isset($_POST['advanced_view']) )
|
||||
$ping_status = get_option('default_ping_status');
|
||||
if ( empty($ping_status) ) {
|
||||
if ( !isset($_POST['advanced_view']) )
|
||||
$ping_status = get_option('default_ping_status');
|
||||
else
|
||||
$ping_status = 'closed';
|
||||
}
|
||||
|
||||
$post_password = $_POST['post_password'];
|
||||
|
||||
$trackback = $_POST['trackback_url'];
|
||||
@@ -102,7 +118,8 @@ case 'post':
|
||||
$post_ID = $id_result->Auto_increment;
|
||||
|
||||
if ( empty($post_name) ) {
|
||||
$post_name = sanitize_title($post_title, $post_ID);
|
||||
if ( 'draft' != $post_status )
|
||||
$post_name = sanitize_title($post_title, $post_ID);
|
||||
} else {
|
||||
$post_name = sanitize_title($post_name, $post_ID);
|
||||
}
|
||||
@@ -176,11 +193,12 @@ case 'post':
|
||||
do_action('save_post', $post_ID);
|
||||
|
||||
if ('publish' == $post_status) {
|
||||
do_action('publish_post', $post_ID);
|
||||
if ($post_pingback)
|
||||
pingback($content, $post_ID);
|
||||
do_enclose( $content, $post_ID );
|
||||
do_trackbacks($post_ID);
|
||||
do_action('publish_post', $post_ID);
|
||||
|
||||
}
|
||||
|
||||
if ($post_status == 'static') {
|
||||
@@ -201,9 +219,9 @@ case 'edit':
|
||||
$post = $post_ID = $p = (int) $_GET['post'];
|
||||
|
||||
if ( !user_can_edit_post($user_ID, $post_ID) )
|
||||
die ('You are not allowed to edit this post.');
|
||||
die ( __('You are not allowed to edit this post.') );
|
||||
|
||||
$postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
|
||||
$postdata = &get_post($post_ID);
|
||||
$content = $postdata->post_content;
|
||||
$content = format_to_edit($content);
|
||||
$content = apply_filters('content_edit_pre', $content);
|
||||
@@ -224,7 +242,7 @@ case 'edit':
|
||||
$menu_order = $postdata->menu_order;
|
||||
|
||||
if( 'private' == $postdata->post_status && $postdata->post_author != $user_ID )
|
||||
die ('You are not allowed to view other users\' private posts.');
|
||||
die ( __('You are not allowed to view other users\' private posts.') );
|
||||
|
||||
if ($post_status == 'static') {
|
||||
$page_template = get_post_meta($post_ID, '_wp_page_template', true);
|
||||
@@ -233,11 +251,11 @@ case 'edit':
|
||||
include('edit-form-advanced.php');
|
||||
}
|
||||
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
|
||||
$post = &$postdata;
|
||||
?>
|
||||
<div id='preview' class='wrap'>
|
||||
<h2><?php _e('Post Preview (updated when post is saved)'); ?></h2>
|
||||
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), the_title()); ?>"><?php the_title(); ?></a></h3>
|
||||
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), get_the_title()); ?>"><?php the_title(); ?></a></h3>
|
||||
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(','); ?> — <?php the_author() ?> @ <?php the_time() ?></div>
|
||||
|
||||
<div class="storycontent">
|
||||
@@ -258,7 +276,7 @@ case 'editpost':
|
||||
$post_ID = $_POST['post_ID'];
|
||||
|
||||
if (!user_can_edit_post($user_ID, $post_ID, $blog_ID))
|
||||
die('You are not allowed to edit this post.');
|
||||
die( __('You are not allowed to edit this post.') );
|
||||
|
||||
$post_categories = $_POST['post_category'];
|
||||
if (!$post_categories) $post_categories[] = 1;
|
||||
@@ -287,9 +305,6 @@ case 'editpost':
|
||||
//if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status');
|
||||
$post_password = $_POST['post_password'];
|
||||
$post_name = $_POST['post_name'];
|
||||
if (empty($post_name)) {
|
||||
$post_name = $post_title;
|
||||
}
|
||||
|
||||
$post_parent = 0;
|
||||
if (isset($_POST['parent_id'])) {
|
||||
@@ -302,11 +317,12 @@ case 'editpost':
|
||||
|
||||
if (isset($_POST['publish'])) $post_status = 'publish';
|
||||
// Double-check
|
||||
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) && 2 != get_option('new_users_can_blog') )
|
||||
if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) )
|
||||
$post_status = 'draft';
|
||||
|
||||
if (empty($post_name)) {
|
||||
$post_name = sanitize_title($post_title, $post_ID);
|
||||
if ( empty($post_name) ) {
|
||||
if ( 'draft' != $post_status )
|
||||
$post_name = sanitize_title($post_title, $post_ID);
|
||||
} else {
|
||||
$post_name = sanitize_title($post_name, $post_ID);
|
||||
}
|
||||
@@ -414,6 +430,8 @@ case 'editpost':
|
||||
if ($prev_status != 'publish' && $post_status == 'publish')
|
||||
do_action('private_to_published', $post_ID);
|
||||
|
||||
do_action('edit_post', $post_ID);
|
||||
|
||||
if ($post_status == 'publish') {
|
||||
do_action('publish_post', $post_ID);
|
||||
do_trackbacks($post_ID);
|
||||
@@ -430,7 +448,6 @@ case 'editpost':
|
||||
}
|
||||
}
|
||||
|
||||
do_action('edit_post', $post_ID);
|
||||
exit();
|
||||
break;
|
||||
|
||||
@@ -440,11 +457,11 @@ case 'delete':
|
||||
$post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
|
||||
|
||||
if (!user_can_delete_post($user_ID, $post_id)) {
|
||||
die('You are not allowed to delete this post.');
|
||||
die( __('You are not allowed to delete this post.') );
|
||||
}
|
||||
|
||||
if (! wp_delete_post($post_id))
|
||||
die(__('Error in deleting...'));
|
||||
die( __('Error in deleting...') );
|
||||
|
||||
$sendback = $_SERVER['HTTP_REFERER'];
|
||||
if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post.php';
|
||||
@@ -465,7 +482,7 @@ case 'editcomment':
|
||||
$commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
|
||||
|
||||
if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) {
|
||||
die('You are not allowed to edit comments on this post.');
|
||||
die( __('You are not allowed to edit comments on this post.') );
|
||||
}
|
||||
|
||||
$content = $commentdata['comment_content'];
|
||||
@@ -483,11 +500,11 @@ case 'confirmdeletecomment':
|
||||
require_once('./admin-header.php');
|
||||
|
||||
$comment = $_GET['comment'];
|
||||
$p = $_GET['p'];
|
||||
$p = (int) $_GET['p'];
|
||||
$commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID'])) {
|
||||
die('You are not allowed to delete comments on this post.');
|
||||
die( __('You are not allowed to delete comments on this post.') );
|
||||
}
|
||||
|
||||
echo "<div class=\"wrap\">\n";
|
||||
@@ -525,11 +542,11 @@ case 'deletecomment':
|
||||
$noredir = false;
|
||||
}
|
||||
|
||||
$postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
$postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
$commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
|
||||
|
||||
if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID'])) {
|
||||
die('You are not allowed to edit comments on this post.');
|
||||
die( __('You are not allowed to edit comments on this post.') );
|
||||
}
|
||||
|
||||
wp_set_comment_status($comment, "delete");
|
||||
@@ -560,7 +577,7 @@ case 'unapprovecomment':
|
||||
$commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) {
|
||||
die('You are not allowed to edit comments on this post, so you cannot disapprove this comment.');
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
|
||||
}
|
||||
|
||||
wp_set_comment_status($comment, "hold");
|
||||
@@ -580,7 +597,7 @@ case 'mailapprovecomment':
|
||||
$commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) {
|
||||
die('You are not allowed to edit comments on this post, so you cannot approve this comment.');
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
|
||||
}
|
||||
|
||||
if ('1' != $commentdata['comment_approved']) {
|
||||
@@ -605,7 +622,7 @@ case 'approvecomment':
|
||||
$commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
|
||||
|
||||
if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) {
|
||||
die('You are not allowed to edit comments on this post, so you cannot approve this comment.');
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
|
||||
}
|
||||
|
||||
wp_set_comment_status($comment, "approve");
|
||||
@@ -632,7 +649,7 @@ case 'editedcomment':
|
||||
$comment_status = $_POST['comment_status'];
|
||||
|
||||
if (!user_can_edit_post_comments($user_ID, $comment_post_ID)) {
|
||||
die('You are not allowed to edit comments on this post, so you cannot edit this comment.');
|
||||
die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.') );
|
||||
}
|
||||
|
||||
if (user_can_edit_post_date($user_ID, $post_ID) && (!empty($_POST['edit_date']))) {
|
||||
@@ -676,7 +693,7 @@ default:
|
||||
require_once ('./admin-header.php');
|
||||
?>
|
||||
<?php if ( isset($_GET['posted']) ) : ?>
|
||||
<div class="updated"><p>Post saved. <a href="<?php bloginfo('home'); ?>">View site »</a></p></div>
|
||||
<div class="updated"><p><?php printf(__('Post saved. <a href="%s">View site »</a>'), get_bloginfo('home')); ?></p></div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if (user_can_create_draft($user_ID)) {
|
||||
|
||||
@@ -30,7 +30,7 @@ case 'update':
|
||||
|
||||
/* checking the nickname has been typed */
|
||||
if (empty($_POST["newuser_nickname"])) {
|
||||
die (__("<strong>ERROR</strong>: please enter your nickname (can be the same as your login)"));
|
||||
die (__("<strong>ERROR</strong>: please enter your nickname (can be the same as your username)"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,16 +51,20 @@ case 'update':
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($_POST["pass1"] == "") {
|
||||
if ($_POST["pass2"] != "")
|
||||
$pass1 = $_POST["pass1"];
|
||||
$pass2 = $_POST["pass2"];
|
||||
do_action('check_passwords', array($user_login, &$pass1, &$pass2));
|
||||
|
||||
if ( '' == $pass1 ) {
|
||||
if ( '' != $pass2 )
|
||||
die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
|
||||
$updatepassword = "";
|
||||
} else {
|
||||
if ($_POST["pass2"] == "")
|
||||
if ('' == $pass2)
|
||||
die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
|
||||
if ($_POST["pass1"] != $_POST["pass2"])
|
||||
if ( $pass1 != $pass2 )
|
||||
die (__("<strong>ERROR</strong>: you typed two different passwords. Go back to correct that."));
|
||||
$newuser_pass = $_POST["pass1"];
|
||||
$newuser_pass = $pass1;
|
||||
$updatepassword = "user_pass=MD5('$newuser_pass'), ";
|
||||
wp_clearcookie();
|
||||
wp_setcookie($user_login, $newuser_pass);
|
||||
@@ -69,7 +73,7 @@ case 'update':
|
||||
$newuser_firstname = wp_specialchars($_POST['newuser_firstname']);
|
||||
$newuser_lastname = wp_specialchars($_POST['newuser_lastname']);
|
||||
$newuser_nickname = $_POST['newuser_nickname'];
|
||||
$newuser_nicename = sanitize_title($newuser_nickname);
|
||||
$newuser_nicename = sanitize_title($newuser_nickname);
|
||||
$newuser_icq = wp_specialchars($_POST['newuser_icq']);
|
||||
$newuser_aim = wp_specialchars($_POST['newuser_aim']);
|
||||
$newuser_msn = wp_specialchars($_POST['newuser_msn']);
|
||||
@@ -82,7 +86,7 @@ case 'update':
|
||||
|
||||
$result = $wpdb->query("UPDATE $wpdb->users SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description', user_nicename = '$newuser_nicename' WHERE ID = $user_ID");
|
||||
|
||||
header('Location: profile.php?updated=true');
|
||||
wp_redirect('profile.php?updated=true');
|
||||
break;
|
||||
|
||||
case 'IErightclick':
|
||||
@@ -140,7 +144,7 @@ if (isset($updated)) { ?>
|
||||
|
||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('Login:') ?></th>
|
||||
<th width="33%" scope="row"><?php _e('Username:') ?></th>
|
||||
<td width="67%"><?php echo $profiledata->user_login; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -225,12 +229,17 @@ if (isset($updated)) { ?>
|
||||
<th scope="row"><?php _e('Profile:') ?></th>
|
||||
<td><textarea name="user_description" rows="5" id="textarea2" style="width: 99%; "><?php echo $profiledata->user_description ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
$show_password_fields = apply_filters('show_password_fields', true);
|
||||
if ( $show_password_fields ) :
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('New <strong>Password</strong> (Leave blank to stay the same.)') ?></th>
|
||||
<td><input type="password" name="pass1" size="16" value="" />
|
||||
<br />
|
||||
<input type="password" name="pass2" size="16" value="" /></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" value="<?php _e('Update Profile »') ?>" name="submit" />
|
||||
|
||||
@@ -25,18 +25,17 @@ function zeroise(number, threshold) {
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
var datetime = now.getFullYear() + '-' +
|
||||
zeroise(now.getMonth() + 1, 2) + '-' +
|
||||
zeroise(now.getDate(), 2) + 'T' +
|
||||
zeroise(now.getHours(), 2) + ':' +
|
||||
zeroise(now.getMinutes(), 2) + ':' +
|
||||
zeroise(now.getSeconds() ,2) +
|
||||
// FIXME: we could try handling timezones like +05:30 and the like
|
||||
zeroise((now.getTimezoneOffset()/60), 2) + ':' + '00';
|
||||
var datetime = now.getUTCFullYear() + '-' +
|
||||
zeroise(now.getUTCMonth() + 1, 2) + '-' +
|
||||
zeroise(now.getUTCDate(), 2) + 'T' +
|
||||
zeroise(now.getUTCHours(), 2) + ':' +
|
||||
zeroise(now.getUTCMinutes(), 2) + ':' +
|
||||
zeroise(now.getUTCSeconds() ,2) +
|
||||
'+00:00';
|
||||
|
||||
edButtons[edButtons.length] =
|
||||
new edButton('ed_strong'
|
||||
,'str'
|
||||
,'b'
|
||||
,'<strong>'
|
||||
,'</strong>'
|
||||
,'b'
|
||||
@@ -44,7 +43,7 @@ new edButton('ed_strong'
|
||||
|
||||
edButtons[edButtons.length] =
|
||||
new edButton('ed_em'
|
||||
,'em'
|
||||
,'i'
|
||||
,'<em>'
|
||||
,'</em>'
|
||||
,'i'
|
||||
@@ -61,8 +60,8 @@ new edButton('ed_link'
|
||||
edButtons[edButtons.length] =
|
||||
new edButton('ed_block'
|
||||
,'b-quote'
|
||||
,'<blockquote>'
|
||||
,'</blockquote>'
|
||||
,'\n\n<blockquote>'
|
||||
,'</blockquote>\n\n'
|
||||
,'q'
|
||||
);
|
||||
|
||||
@@ -132,7 +131,7 @@ new edButton('ed_more'
|
||||
,'t'
|
||||
,-1
|
||||
);
|
||||
|
||||
/*
|
||||
edButtons[edButtons.length] =
|
||||
new edButton('ed_next'
|
||||
,'page'
|
||||
@@ -141,7 +140,7 @@ new edButton('ed_next'
|
||||
,'p'
|
||||
,-1
|
||||
);
|
||||
|
||||
*/
|
||||
function edLink() {
|
||||
this.display = '';
|
||||
this.URL = '';
|
||||
@@ -251,8 +250,8 @@ function edSpell(myField) {
|
||||
if (word == '') {
|
||||
word = prompt('Enter a word to look up:', '');
|
||||
}
|
||||
if (word != '') {
|
||||
window.open('http://dictionary.reference.com/search?q=' + escape(word));
|
||||
if (word !== null && /^\w[\w ]*$/.test(word)) {
|
||||
window.open('http://www.answers.com/' + escape(word));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +260,7 @@ function edToolbar() {
|
||||
for (i = 0; i < edButtons.length; i++) {
|
||||
edShowButton(edButtons[i], i);
|
||||
}
|
||||
document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="Dictionary lookup" value="Dict." />');
|
||||
document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="Dictionary lookup" value="lookup" />');
|
||||
document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="Close all open tags" value="Close Tags" />');
|
||||
// edShowLinks(); // disabled by default
|
||||
document.write('</div>');
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$_wp_installing = 1;
|
||||
define('WP_INSTALLING', true);
|
||||
|
||||
if (file_exists('../wp-config.php'))
|
||||
die("The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first.");
|
||||
die("The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.");
|
||||
|
||||
if (!file_exists('../wp-config-sample.php'))
|
||||
die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
||||
@@ -12,6 +12,7 @@ if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have
|
||||
|
||||
$step = 0;
|
||||
if(isset($_GET['step'])) $step = $_GET['step'];
|
||||
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">
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
$mode = 'sidebar';
|
||||
|
||||
$standalone = 1;
|
||||
require_once('admin-header.php');
|
||||
require_once('admin.php');
|
||||
|
||||
get_currentuserinfo();
|
||||
|
||||
@@ -18,7 +17,7 @@ if ('b' == $_GET['a']) {
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
|
||||
</head>
|
||||
<body
|
||||
<body>
|
||||
<p>Posted !</p>
|
||||
<p><a href="sidebar.php">Click here</a> to post again.</p>
|
||||
</body>
|
||||
|
||||
@@ -135,9 +135,9 @@ endif;
|
||||
?>
|
||||
</div>
|
||||
<div class="wrap">
|
||||
<h2>Other Files</h2>
|
||||
<h2><?php _e('Other Files') ?></h2>
|
||||
|
||||
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://wiki.wordpress.org/index.php/MakeWritable" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
|
||||
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
|
||||
<form name="file" action="templates.php" method="get">
|
||||
<input type="text" name="file" />
|
||||
<input type="submit" name="submit" value="<?php _e('Edit file »') ?>" />
|
||||
|
||||
@@ -24,7 +24,13 @@ $themes = get_themes();
|
||||
|
||||
if (empty($theme)) {
|
||||
$theme = get_current_theme();
|
||||
}
|
||||
} else {
|
||||
$theme = stripslashes($theme);
|
||||
}
|
||||
|
||||
|
||||
if ( ! isset($themes[$theme]) )
|
||||
die(__('The requested theme does not exist.'));
|
||||
|
||||
$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
|
||||
|
||||
@@ -70,7 +76,7 @@ default:
|
||||
if (!is_file($real_file))
|
||||
$error = 1;
|
||||
|
||||
if (!$error) {
|
||||
if (!$error && filesize($real_file) > 0) {
|
||||
$f = fopen($real_file, 'r');
|
||||
$content = fread($f, filesize($real_file));
|
||||
$content = htmlspecialchars($content);
|
||||
@@ -89,7 +95,8 @@ default:
|
||||
$theme_name = $a_theme['Name'];
|
||||
if ($theme_name == $theme) $selected = " selected='selected'";
|
||||
else $selected = '';
|
||||
echo "\n\t<option value='$theme_name' $selected>$theme_name</option>";
|
||||
$theme_name = wp_specialchars($theme_name, true);
|
||||
echo "\n\t<option value=\"$theme_name\" $selected>$theme_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
@@ -53,9 +53,7 @@ $current_stylesheet = $themes[$current_theme]['Stylesheet'];
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<h2><?php _e('Other Themes'); ?></h2>
|
||||
<p><?php _e('Themes are usually downloaded separately from WordPress. To install a theme you generally just need to put the theme file or files into your <code>wp-content/themes</code> directory. Once a theme is installed, you may select it here.'); ?></p>
|
||||
|
||||
<h2><?php _e('Themes Available'); ?></h2>
|
||||
<?php if ( 1 < count($themes) ) { ?>
|
||||
<table width="100%" cellpadding="3" cellspacing="3">
|
||||
<tr>
|
||||
@@ -65,7 +63,7 @@ $current_stylesheet = $themes[$current_theme]['Stylesheet'];
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php
|
||||
$theme = '';
|
||||
$style = '';
|
||||
|
||||
$theme_names = array_keys($themes);
|
||||
natcasesort($theme_names);
|
||||
@@ -86,17 +84,20 @@ $current_stylesheet = $themes[$current_theme]['Stylesheet'];
|
||||
$current = false;
|
||||
}
|
||||
|
||||
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
|
||||
$style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
|
||||
if ($current) $style .= $style == 'alternate' ? ' active' : 'active';
|
||||
if ($style != '') $style = 'class="' . $style . '"';
|
||||
|
||||
echo "
|
||||
<tr $theme>";
|
||||
<tr $style>";
|
||||
if ( $current )
|
||||
echo "<td><strong>$title $version</strong></td>";
|
||||
else
|
||||
echo "<td>$title $version</td>";
|
||||
echo "
|
||||
<td align='center'>$author</td>
|
||||
<td>$description</td>
|
||||
<td align='center'>$action</td>
|
||||
<td class=\"auth\">$author</td>
|
||||
<td class=\"desc\">$description</td>
|
||||
<td class=\"togl\">$action</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
@@ -143,6 +144,9 @@ if (count($broken_themes)) {
|
||||
}
|
||||
?>
|
||||
|
||||
<h2><?php _e('Get More Themes'); ?></h2>
|
||||
<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you may activate it here.'); ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -23,22 +23,22 @@ $http_request .= "\r\n";
|
||||
$http_request .= $query_string;
|
||||
|
||||
$response = '';
|
||||
$fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5);
|
||||
fwrite($fs, $http_request);
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
$body = trim( $response[1] );
|
||||
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
||||
|
||||
$returns = explode("\n", $body);
|
||||
|
||||
foreach ($returns as $return) :
|
||||
$time = addslashes( substr($return, 0, 19) );
|
||||
$uri = addslashes( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
|
||||
endforeach;
|
||||
|
||||
if( false !== ( $fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5) ) ) {
|
||||
fwrite($fs, $http_request);
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
$body = trim( $response[1] );
|
||||
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
||||
|
||||
$returns = explode("\n", $body);
|
||||
|
||||
foreach ($returns as $return) :
|
||||
$time = addslashes( substr($return, 0, 19) );
|
||||
$uri = addslashes( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
|
||||
endforeach;
|
||||
}
|
||||
?>
|
||||
@@ -131,7 +131,7 @@ function upgrade_110() {
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date");
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
|
||||
$wpdb->query("UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_registered = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -180,10 +180,14 @@ function upgrade_130() {
|
||||
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
|
||||
}
|
||||
|
||||
if ( !is_array( get_settings('active_plugins') ) ) {
|
||||
$plugins = explode("\n", trim(get_settings('active_plugins')) );
|
||||
update_option('active_plugins', $plugins);
|
||||
}
|
||||
$active_plugins = __get_option('active_plugins');
|
||||
|
||||
// If plugins are not stored in an array, they're stored in the old
|
||||
// newline separated format. Convert to new format.
|
||||
if ( !is_array( $active_plugins ) ) {
|
||||
$active_plugins = explode("\n", trim($active_plugins));
|
||||
update_option('active_plugins', $active_plugins);
|
||||
}
|
||||
|
||||
// Obsolete tables
|
||||
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
|
||||
@@ -291,6 +295,19 @@ function get_alloptions_110() {
|
||||
return $all_options;
|
||||
}
|
||||
|
||||
// Version of get_option that is private to install/upgrade.
|
||||
function __get_option($setting) {
|
||||
global $wpdb;
|
||||
|
||||
$option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
|
||||
|
||||
@ $kellogs = unserialize($option);
|
||||
if ($kellogs !== FALSE)
|
||||
return $kellogs;
|
||||
else
|
||||
return $option;
|
||||
}
|
||||
|
||||
function deslash($content) {
|
||||
// Note: \\\ inside a regex denotes a single backslash.
|
||||
|
||||
@@ -561,13 +578,13 @@ function make_site_theme_from_oldschool($theme_name, $template) {
|
||||
$lines = explode("\n", implode('', file("$site_dir/$newfile")));
|
||||
if ($lines) {
|
||||
$f = fopen("$site_dir/$newfile", 'w');
|
||||
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match('/require.*wp-blog-header/', $line))
|
||||
$line = '//' . $line;
|
||||
|
||||
// Update stylesheet references.
|
||||
$line = str_replace("<?php echo get_settings('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);
|
||||
$line = str_replace("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);
|
||||
|
||||
// Update comments template inclusion.
|
||||
$line = str_replace("<?php include(ABSPATH . 'wp-comments.php'); ?>", "<?php comments_template(); ?>", $line);
|
||||
@@ -579,7 +596,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
|
||||
}
|
||||
|
||||
// Add a theme header.
|
||||
$header = "/*\nTheme Name: $theme_name\nTheme URI: " . get_option('siteurl') . "\nDescription: A theme automatically created by the upgrade.\nVersion: 1.0\nAuthor: Moi\n*/\n";
|
||||
$header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the upgrade.\nVersion: 1.0\nAuthor: Moi\n*/\n";
|
||||
|
||||
$stylelines = file_get_contents("$site_dir/style.css");
|
||||
if ($stylelines) {
|
||||
@@ -618,7 +635,7 @@ function make_site_theme_from_default($theme_name, $template) {
|
||||
|
||||
foreach ($stylelines as $line) {
|
||||
if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
|
||||
elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . get_option('siteurl');
|
||||
elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
|
||||
elseif (strstr($line, "Description:")) $line = "Description: Your theme";
|
||||
elseif (strstr($line, "Version:")) $line = "Version: 1";
|
||||
elseif (strstr($line, "Author:")) $line = "Author: You";
|
||||
@@ -648,7 +665,7 @@ function make_site_theme_from_default($theme_name, $template) {
|
||||
// Create a site theme from the default theme.
|
||||
function make_site_theme() {
|
||||
// Name the theme after the blog.
|
||||
$theme_name = get_option('blogname');
|
||||
$theme_name = __get_option('blogname');
|
||||
$template = sanitize_title($theme_name);
|
||||
$site_dir = ABSPATH . "wp-content/themes/$template";
|
||||
|
||||
@@ -679,7 +696,7 @@ function make_site_theme() {
|
||||
}
|
||||
|
||||
// Make the new site theme active.
|
||||
$current_template = get_option('template');
|
||||
$current_template = __get_option('template');
|
||||
if ($current_template == 'default') {
|
||||
update_option('template', $template);
|
||||
update_option('stylesheet', $template);
|
||||
|
||||
@@ -152,9 +152,9 @@ function populate_options() {
|
||||
global $wpdb;
|
||||
|
||||
$guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_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 WordPress weblog', 'Short tagline');
|
||||
add_option('siteurl', $guessurl, __('WordPress web address'));
|
||||
add_option('blogname', __('My Weblog'), __('Blog title'));
|
||||
add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
|
||||
add_option('new_users_can_blog', 0);
|
||||
add_option('users_can_register', 0);
|
||||
add_option('admin_email', 'you@example.com');
|
||||
@@ -183,9 +183,9 @@ function populate_options() {
|
||||
add_option('default_post_edit_rows', 9);
|
||||
add_option('posts_per_page', 10);
|
||||
add_option('what_to_show', 'posts');
|
||||
add_option('date_format', 'F j, Y');
|
||||
add_option('time_format', 'g:i a');
|
||||
add_option('links_updated_date_format', 'F j, Y g:i a');
|
||||
add_option('date_format', __('F j, Y'));
|
||||
add_option('time_format', __('g:i a'));
|
||||
add_option('links_updated_date_format', __('F j, Y g:i a'));
|
||||
add_option('links_recently_updated_prepend', '<em>');
|
||||
add_option('links_recently_updated_append', '</em>');
|
||||
add_option('links_recently_updated_time', 120);
|
||||
@@ -203,7 +203,7 @@ function populate_options() {
|
||||
add_option('advanced_edit', 0);
|
||||
add_option('comment_max_links', 2);
|
||||
// 1.5
|
||||
add_option('default_email_category', 1, 'Posts by email go to this category');
|
||||
add_option('default_email_category', 1, __('Posts by email go to this category'));
|
||||
add_option('recently_edited');
|
||||
add_option('use_linksupdate', 0);
|
||||
add_option('template', 'default');
|
||||
@@ -215,6 +215,8 @@ function populate_options() {
|
||||
add_option('open_proxy_check', 1);
|
||||
add_option('rss_language', 'en');
|
||||
add_option('html_type', 'text/html');
|
||||
// 1.5.1
|
||||
add_option('use_trackback', 0);
|
||||
|
||||
// Delete unused options
|
||||
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url');
|
||||
@@ -229,4 +231,4 @@ function populate_options() {
|
||||
endforeach;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$_wp_installing = 1;
|
||||
define('WP_INSTALLING', true);
|
||||
if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
|
||||
require('../wp-config.php');
|
||||
timer_start();
|
||||
@@ -67,8 +67,8 @@ switch($step) {
|
||||
|
||||
case 0:
|
||||
?>
|
||||
<p>This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.</p>
|
||||
<h2 class="step"><a href="upgrade.php?step=1">Upgrade WordPress »</a></h2>
|
||||
<p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.'); ?></p>
|
||||
<h2 class="step"><a href="upgrade.php?step=1"><?php _e('Upgrade WordPress »'); ?></a></h2>
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -76,14 +76,14 @@ switch($step) {
|
||||
make_db_current_silent();
|
||||
upgrade_all();
|
||||
?>
|
||||
<h2>Step 1</h2>
|
||||
<p>There's actually only one step. So if you see this, you're done. <a href="../">Have fun</a>! </p>
|
||||
<h2><?php _e('Step 1'); ?></h2>
|
||||
<p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"), '../'); ?></p>
|
||||
|
||||
<!--
|
||||
<pre>
|
||||
<?php echo $wpdb->num_queries; ?> queries
|
||||
<?php printf(__('%s queries'), $wpdb->num_queries); ?>
|
||||
|
||||
<?php timer_stop(1); ?> seconds
|
||||
<?php printf(__('%s seconds'), timer_stop(0)); ?>
|
||||
</pre>
|
||||
-->
|
||||
|
||||
|
||||
@@ -30,24 +30,28 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to
|
||||
|
||||
/* checking the nickname has been typed */
|
||||
if (empty($_POST["new_nickname"])) {
|
||||
die (__("<strong>ERROR</strong>: please enter your nickname (can be the same as your login)"));
|
||||
die (__("<strong>ERROR</strong>: please enter your nickname (can be the same as your username)"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($_POST['pass1'] == '') {
|
||||
if ($_POST['pass2'] != '')
|
||||
$new_user_login = wp_specialchars($_POST['new_user_login']);
|
||||
$pass1 = $_POST['pass1'];
|
||||
$pass2 = $_POST['pass2'];
|
||||
do_action('check_passwords', array($new_user_login, &$pass1, &$pass2));
|
||||
|
||||
if ( '' == $pass1 ) {
|
||||
if ( '' != $pass2 )
|
||||
die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
|
||||
$updatepassword = '';
|
||||
} else {
|
||||
if ($_POST['pass2'] == "")
|
||||
if ( '' == $pass2)
|
||||
die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
|
||||
if ($_POST['pass1'] != $_POST['pass2'])
|
||||
if ( $pass1 != $pass2 )
|
||||
die (__("<strong>ERROR</strong>: you typed two different passwords. Go back to correct that."));
|
||||
$new_pass = $_POST["pass1"];
|
||||
$new_pass = $pass1;
|
||||
$updatepassword = "user_pass=MD5('$new_pass'), ";
|
||||
}
|
||||
|
||||
$new_user_login = wp_specialchars($_POST['new_user_login']);
|
||||
$new_firstname = wp_specialchars($_POST['new_firstname']);
|
||||
$new_lastname = wp_specialchars($_POST['new_lastname']);
|
||||
$new_nickname = $_POST['new_nickname'];
|
||||
@@ -95,7 +99,7 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to
|
||||
<form name="edituser" id="edituser" action="user-edit.php" method="post">
|
||||
<table width="99%" border="0" cellspacing="2" cellpadding="3">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('Login:') ?></th>
|
||||
<th width="33%" scope="row"><?php _e('Username:') ?></th>
|
||||
<td width="73%"><input type="text" name="new_user_login" id="new_user_login" value="<?php echo $edituser->user_login; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -180,12 +184,17 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$show_password_fields = apply_filters('show_password_fields', true);
|
||||
if ( $show_password_fields ) :
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('New <strong>Password</strong> (Leave blank to stay the same.)') ?></th>
|
||||
<td><input type="password" name="pass1" size="16" value="" />
|
||||
<br />
|
||||
<input type="password" name="pass2" size="16" value="" /></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
@@ -200,4 +209,4 @@ break;
|
||||
}
|
||||
|
||||
include('admin-footer.php');
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -24,35 +24,33 @@ switch ($action) {
|
||||
case 'adduser':
|
||||
check_admin_referer();
|
||||
|
||||
$user_login = wp_specialchars($_POST['user_login']);
|
||||
$user_login = wp_specialchars(trim($_POST['user_login']));
|
||||
$pass1 = $_POST['pass1'];
|
||||
$pass2 = $_POST['pass2'];
|
||||
$user_email = wp_specialchars($_POST['email']);
|
||||
$user_firstname = wp_specialchars($_POST['firstname']);
|
||||
$user_lastname = wp_specialchars($_POST['lastname']);
|
||||
$user_uri = wp_specialchars($_POST['uri']);
|
||||
$user_email = wp_specialchars(trim($_POST['email']));
|
||||
$user_firstname = wp_specialchars(trim($_POST['firstname']));
|
||||
$user_lastname = wp_specialchars(trim($_POST['lastname']));
|
||||
$user_uri = wp_specialchars(trim($_POST['uri']));
|
||||
|
||||
/* checking login has been typed */
|
||||
if ($user_login == '') {
|
||||
die (__('<strong>ERROR</strong>: Please enter a login.'));
|
||||
}
|
||||
/* checking that username has been typed */
|
||||
if ($user_login == '')
|
||||
die (__('<strong>ERROR</strong>: Please enter a username.'));
|
||||
|
||||
/* checking the password has been typed twice */
|
||||
if ($pass1 == '' || $pass2 == '') {
|
||||
do_action('check_passwords', array($user_login, &$pass1, &$pass2));
|
||||
if ($pass1 == '' || $pass2 == '')
|
||||
die (__('<strong>ERROR</strong>: Please enter your password twice.'));
|
||||
}
|
||||
|
||||
/* checking the password has been typed twice the same */
|
||||
if ($pass1 != $pass2) {
|
||||
if ($pass1 != $pass2)
|
||||
die (__('<strong>ERROR</strong>: Please type the same password in the two password fields.'));
|
||||
}
|
||||
|
||||
$user_nickname = $user_login;
|
||||
|
||||
/* checking the login isn't already used by another user */
|
||||
/* checking that the username isn't already used by another user */
|
||||
$loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
|
||||
if ($loginthere) {
|
||||
die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
|
||||
}
|
||||
if ($loginthere)
|
||||
die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
|
||||
|
||||
/* checking e-mail address */
|
||||
if (empty($_POST["email"])) {
|
||||
@@ -75,20 +73,19 @@ case 'adduser':
|
||||
VALUES
|
||||
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', '$now', '$new_users_can_blog', 'nickname', '$user_firstname', '$user_lastname', '$user_nicename', '$user_uri')");
|
||||
|
||||
if ($result == false) {
|
||||
if ($result == false)
|
||||
die (__('<strong>ERROR</strong>: Couldn’t register you!'));
|
||||
}
|
||||
|
||||
$stars = '';
|
||||
for ($i = 0; $i < strlen($pass1); $i = $i + 1) {
|
||||
for ($i = 0; $i < strlen($pass1); $i = $i + 1)
|
||||
$stars .= '*';
|
||||
}
|
||||
|
||||
$user_login = stripslashes($user_login);
|
||||
$message = 'New user registration on your blog ' . get_settings('blogname') . ":\r\n\r\n";
|
||||
$message .= "Login: $user_login\r\n\r\nE-mail: $user_email";
|
||||
$user_login = stripslashes($user_login);
|
||||
$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'), '[' . get_settings('blogname') . '] New User Registration', $message);
|
||||
@wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
|
||||
header('Location: users.php');
|
||||
break;
|
||||
|
||||
@@ -308,12 +305,17 @@ echo "\n<tr $style>
|
||||
<th scope="row"><?php _e('Website') ?></th>
|
||||
<td><input name="uri" type="text" id="uri" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
$show_password_fields = apply_filters('show_password_fields', true);
|
||||
if ( $show_password_fields ) :
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Password (twice)') ?> </th>
|
||||
<td><input name="pass1" type="password" id="pass1" />
|
||||
<br />
|
||||
<input name="pass2" type="password" id="pass2" /></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input name="adduser" type="submit" id="adduser" value="<?php _e('Add User') ?> »" />
|
||||
|
||||
@@ -141,6 +141,14 @@ textarea, input, select {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
float: left
|
||||
}
|
||||
|
||||
.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.alternate {
|
||||
background: #eee;
|
||||
}
|
||||
@@ -173,6 +181,13 @@ textarea, input, select {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.post-categories {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
@@ -281,13 +296,13 @@ textarea, input, select {
|
||||
#adminmenu2 {
|
||||
background: #a3a3a3;
|
||||
border-bottom: none;
|
||||
height: 21px;
|
||||
margin: 0;
|
||||
padding: 0 2em;
|
||||
padding: 3px 2em 0;
|
||||
}
|
||||
|
||||
#adminmenu2 .current {
|
||||
background: #f2f2f2;
|
||||
border-top: 1px solid #9a9a9a;
|
||||
border-right: 2px solid #4f4f4f;
|
||||
color: #000;
|
||||
}
|
||||
@@ -296,7 +311,7 @@ textarea, input, select {
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
padding: 3px 5px 4px;
|
||||
padding: .3em .4em .33em;
|
||||
}
|
||||
|
||||
#adminmenu2 a:hover {
|
||||
@@ -541,3 +556,11 @@ textarea, input, select {
|
||||
margin: 0 0 .3em .6em;
|
||||
padding: 0 0 0 .6em;
|
||||
}
|
||||
|
||||
|
||||
/* emeyer additions */
|
||||
|
||||
.active td {background: #BEB;}
|
||||
.active .name {background: #9C9;}
|
||||
.alternate.active td {background: #ADA;}
|
||||
.alternate.active .name {background: #8B8;}
|
||||
|
||||
20
wp-atom.php
20
wp-atom.php
@@ -20,8 +20,8 @@ $more = 1;
|
||||
<title><?php bloginfo_rss('name') ?></title>
|
||||
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
||||
<tagline><?php bloginfo_rss("description") ?></tagline>
|
||||
<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></modified>
|
||||
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></copyright>
|
||||
<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></modified>
|
||||
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></copyright>
|
||||
<generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
|
||||
|
||||
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
||||
@@ -32,18 +32,12 @@ $more = 1;
|
||||
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
|
||||
<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
|
||||
<id><?php the_guid(); ?></id>
|
||||
<modified><?php the_time('Y-m-d\TH:i:s\Z'); ?></modified>
|
||||
<issued> <?php the_time('Y-m-d\TH:i:s\Z'); ?></issued>
|
||||
<?php the_category_rss('rdf') ?>
|
||||
<summary type="<?php bloginfo('html_type'); ?>" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
|
||||
<?php if (!get_settings('rss_use_excerpt')) : ?>
|
||||
<?php if ( strlen( $post->post_content ) ) : ?>
|
||||
<modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
|
||||
<issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
|
||||
<?php the_category_rss('rdf') ?>
|
||||
<summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
|
||||
<?php if ( !get_settings('rss_use_excerpt') ) : ?>
|
||||
<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
||||
<?php else : ?>
|
||||
<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></content>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_excerpt_rss() ?>]]></content>
|
||||
<?php endif; ?>
|
||||
<?php rss_enclosure(); ?>
|
||||
</entry>
|
||||
|
||||
@@ -17,7 +17,7 @@ $query_vars = array();
|
||||
if ((isset($_GET['error']) && $_GET['error'] == '404') ||
|
||||
((! empty($_SERVER['PATH_INFO'])) &&
|
||||
('/' != $_SERVER['PATH_INFO']) &&
|
||||
(false === strpos($_SERVER['PATH_INFO'], 'index.php'))
|
||||
(false === strpos($_SERVER['PATH_INFO'], '.php'))
|
||||
)) {
|
||||
|
||||
// If we match a rewrite rule, this will be cleared.
|
||||
@@ -85,7 +85,7 @@ if ((isset($_GET['error']) && $_GET['error'] == '404') ||
|
||||
}
|
||||
}
|
||||
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');
|
||||
|
||||
$wpvarstoreset = apply_filters('query_vars', $wpvarstoreset);
|
||||
|
||||
@@ -128,24 +128,28 @@ if ( !empty($error) && '404' == $error ) {
|
||||
@header('X-Pingback: ' . get_bloginfo('pingback_url'));
|
||||
|
||||
// Support for Conditional GET
|
||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) $client_last_modified = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
||||
else $client_last_modified = false;
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
|
||||
else $client_etag = false;
|
||||
|
||||
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||
// 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...
|
||||
$wp_modified_timestamp = strtotime($wp_last_modified);
|
||||
|
||||
if ( ($client_last_modified && $client_etag) ?
|
||||
(($client_last_modified == $wp_last_modified) && ($client_etag == $wp_etag)) :
|
||||
(($client_last_modified == $wp_last_modified) || ($client_etag == $wp_etag)) ) {
|
||||
(($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
|
||||
(($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
|
||||
if ( preg_match('/cgi/',php_sapi_name()) ) {
|
||||
header('Status: 304 Not Modified');
|
||||
echo "\r\n\r\n";
|
||||
exit;
|
||||
header('Status: 304 Not Modified');
|
||||
echo "\r\n\r\n";
|
||||
exit;
|
||||
} else {
|
||||
if ( version_compare(phpversion(), '4.3.0', '>=') ) {
|
||||
header('Not Modified', TRUE, 304);
|
||||
} else {
|
||||
header('HTTP/1.x 304 Not Modified');
|
||||
}
|
||||
if ( version_compare(phpversion(), '4.3.0', '>=') )
|
||||
header('Not Modified', TRUE, 304);
|
||||
else
|
||||
header('HTTP/1.x 304 Not Modified');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -167,14 +171,15 @@ foreach (array_merge($wpvarstoreset, $more_wpvars) as $wpvar) {
|
||||
$query_string = apply_filters('query_string', $query_string);
|
||||
|
||||
update_category_cache();
|
||||
get_currentuserinfo();
|
||||
|
||||
// Call query posts to do the work.
|
||||
$posts = query_posts($query_string);
|
||||
$posts = & query_posts($query_string);
|
||||
|
||||
// Extract updated query vars back into global namespace.
|
||||
extract($wp_query->query_vars);
|
||||
|
||||
if (1 == count($posts)) {
|
||||
if ( is_single() || is_page() ) {
|
||||
$more = 1;
|
||||
$single = 1;
|
||||
}
|
||||
@@ -183,8 +188,8 @@ if (1 == count($posts)) {
|
||||
// 404 if one was already issued, if the request was a search, or if the
|
||||
// request was a regular query string request rather than a permalink request.
|
||||
if ( (0 == count($posts)) && !is_404() && !is_search()
|
||||
&& !empty($_SERVER['QUERY_STRING']) &&
|
||||
(false === strpos($_SERVER['REQUEST_URI'], '?')) ) {
|
||||
&& ( isset($rewrite) || (!empty($_SERVER['QUERY_STRING']) &&
|
||||
(false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
|
||||
$wp_query->is_404 = true;
|
||||
if ( preg_match('/cgi/', php_sapi_name()) )
|
||||
@header('Status: 404 Not Found');
|
||||
@@ -255,4 +260,4 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
|
||||
}
|
||||
|
||||
endif;
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -3,20 +3,23 @@ require( dirname(__FILE__) . '/wp-config.php' );
|
||||
|
||||
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||
|
||||
$post_status = $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
|
||||
$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
|
||||
|
||||
if ( empty($post_status) ) {
|
||||
if ( empty($status->comment_status) ) {
|
||||
do_action('comment_id_not_found', $comment_post_ID);
|
||||
exit;
|
||||
} elseif ( 'closed' == $post_status ) {
|
||||
} elseif ( 'closed' == $status->comment_status ) {
|
||||
do_action('comment_closed', $comment_post_ID);
|
||||
die( __('Sorry, comments are closed for this item.') );
|
||||
} elseif ( 'draft' == $status->post_status ) {
|
||||
do_action('comment_on_draft', $comment_post_ID);
|
||||
exit;
|
||||
}
|
||||
|
||||
$comment_author = $_POST['author'];
|
||||
$comment_author_email = $_POST['email'];
|
||||
$comment_author_url = $_POST['url'];
|
||||
$comment_content = $_POST['comment'];
|
||||
$comment_author = trim($_POST['author']);
|
||||
$comment_author_email = trim($_POST['email']);
|
||||
$comment_author_url = trim($_POST['url']);
|
||||
$comment_content = trim($_POST['comment']);
|
||||
|
||||
// If the user is logged in
|
||||
get_currentuserinfo();
|
||||
@@ -31,8 +34,12 @@ endif;
|
||||
|
||||
$comment_type = '';
|
||||
|
||||
if ( get_settings('require_name_email') && ('' == $comment_author_email || '' == $comment_author) )
|
||||
die( __('Error: please fill the required fields (name, email).') );
|
||||
if ( get_settings('require_name_email') && !$user_ID ) {
|
||||
if ( 6 > strlen($comment_author_email) || '' == $comment_author )
|
||||
die( __('Error: please fill the required fields (name, email).') );
|
||||
elseif ( !is_email($comment_author_email))
|
||||
die( __('Error: please enter a valid email address.') );
|
||||
}
|
||||
|
||||
if ( '' == $comment_content )
|
||||
die( __('Error: please type a comment.') );
|
||||
@@ -45,13 +52,12 @@ setcookie('comment_author_' . COOKIEHASH, stripslashes($comment_author), time()
|
||||
setcookie('comment_author_email_' . COOKIEHASH, stripslashes($comment_author_email), time() + 30000000, COOKIEPATH);
|
||||
setcookie('comment_author_url_' . COOKIEHASH, stripslashes($comment_author_url), time() + 30000000, COOKIEPATH);
|
||||
|
||||
header('Expires: Mon, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate, max-age=0');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
$location = get_permalink($comment_post_ID);
|
||||
|
||||
header("Location: $location");
|
||||
$location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to'];
|
||||
|
||||
wp_redirect($location);
|
||||
?>
|
||||
@@ -30,17 +30,17 @@ if (have_posts()) :
|
||||
<?php
|
||||
if (is_single() || is_page()) {
|
||||
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
|
||||
comment_author_url, comment_date, comment_content, comment_post_ID,
|
||||
comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
|
||||
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
|
||||
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id'
|
||||
AND $wpdb->comments.comment_approved = '1' AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'page')
|
||||
AND $wpdb->comments.comment_approved = '1' AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'static')
|
||||
AND post_date < '".date("Y-m-d H:i:59")."'
|
||||
ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') );
|
||||
ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') );
|
||||
} else { // if no post id passed in, we'll just ue the last 10 comments.
|
||||
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
|
||||
comment_author_url, comment_date, comment_content, comment_post_ID,
|
||||
comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
|
||||
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
|
||||
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish'
|
||||
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'static')
|
||||
AND $wpdb->comments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."'
|
||||
ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') );
|
||||
}
|
||||
@@ -51,7 +51,7 @@ if (have_posts()) :
|
||||
<item>
|
||||
<title>by: <?php comment_author_rss() ?></title>
|
||||
<link><?php comment_link() ?></link>
|
||||
<pubDate><?php comment_time('r'); ?></pubDate>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<guid><?php comment_link() ?></guid>
|
||||
<?php
|
||||
if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
// ** MySQL settings ** //
|
||||
define('DB_NAME', 'wordpress'); // The name of the database
|
||||
define('DB_USER', 'username'); // Your MySQL username
|
||||
define('DB_PASSWORD', 'password'); // ...and password
|
||||
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
|
||||
|
||||
// Change the prefix if you want to have multiple blogs in a single database.
|
||||
$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'
|
||||
|
||||
// Change this to localize WordPress. A corresponding MO file for the
|
||||
// chosen language must be installed to wp-includes/languages.
|
||||
// For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
|
||||
// to enable German language support.
|
||||
define ('WPLANG', '');
|
||||
|
||||
/* Stop editing */
|
||||
|
||||
define('ABSPATH', dirname(__FILE__).'/');
|
||||
require_once(ABSPATH.'wp-settings.php');
|
||||
<?php
|
||||
// ** MySQL settings ** //
|
||||
define('DB_NAME', 'wordpress'); // The name of the database
|
||||
define('DB_USER', 'username'); // Your MySQL username
|
||||
define('DB_PASSWORD', 'password'); // ...and password
|
||||
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
|
||||
|
||||
// Change the prefix if you want to have multiple blogs in a single database.
|
||||
$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'
|
||||
|
||||
// Change this to localize WordPress. A corresponding MO file for the
|
||||
// chosen language must be installed to wp-includes/languages.
|
||||
// For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
|
||||
// to enable German language support.
|
||||
define ('WPLANG', '');
|
||||
|
||||
/* Stop editing */
|
||||
|
||||
define('ABSPATH', dirname(__FILE__).'/');
|
||||
require_once(ABSPATH.'wp-settings.php');
|
||||
?>
|
||||
@@ -45,6 +45,7 @@ if (isset($wp_version)) {
|
||||
# Add Markdown filter with priority 6 (same as Textile).
|
||||
add_filter('the_content', 'Markdown', 6);
|
||||
add_filter('the_excerpt', 'Markdown', 6);
|
||||
add_filter('the_excerpt_rss', 'Markdown', 6);
|
||||
add_filter('comment_text', 'Markdown', 6);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$text = preg_split("/\n/",$text);
|
||||
foreach($text as $line){
|
||||
$line = trim($line);
|
||||
$line = rtrim($line);
|
||||
$lineout[] = $line;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action('wp_footer'); ?>
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,8 +6,8 @@ get_header();
|
||||
|
||||
<?php the_date('','<h2>','</h2>'); ?>
|
||||
|
||||
<div class="post">
|
||||
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
|
||||
<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">
|
||||
@@ -18,10 +18,6 @@ get_header();
|
||||
<?php wp_link_pages(); ?>
|
||||
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<?php trackback_rdf(); ?>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
@@ -44,17 +44,14 @@
|
||||
</div>
|
||||
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
|
||||
<!--
|
||||
<?php trackback_rdf(); ?>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
@@ -6,7 +6,7 @@ foreach ($posts as $post) { start_wp();
|
||||
<!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">
|
||||
<head>
|
||||
<title><?php echo get_settings('blogname'); ?> - <?php echo sprintf(__("Comments on %s"), the_title('','',false)); ?></title>
|
||||
<title><?php echo get_settings('blogname'); ?> - Comments on <?php the_title(); ?></title>
|
||||
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
|
||||
<style type="text/css" media="screen">
|
||||
@@ -19,12 +19,12 @@ foreach ($posts as $post) { start_wp();
|
||||
|
||||
<h1 id="header"><a href="" title="<?php echo get_settings('blogname'); ?>"><?php echo get_settings('blogname'); ?></a></h1>
|
||||
|
||||
<h2 id="comments"><?php _e("Comments"); ?></h2>
|
||||
<h2 id="comments">Comments</h2>
|
||||
|
||||
<p><a href="<?php echo get_settings('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p>
|
||||
<p><a href="<?php echo get_settings('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>
|
||||
|
||||
<?php if ('open' == $post->ping_status) { ?>
|
||||
<p><?php _e("The <acronym title=\"Uniform Resource Identifier\">URI</acronym> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
|
||||
<p>The <acronym title="Uniform Resource Identifier">URI</acronym> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
@@ -43,55 +43,55 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
|
||||
<?php foreach ($comments as $comment) { ?>
|
||||
<li id="comment-<?php comment_ID() ?>">
|
||||
<?php comment_text() ?>
|
||||
<p><cite><?php comment_type(__('Comment'), __('Trackback'), __('Pingback')); ?> <?php _e("by"); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
|
||||
<p><cite><?php comment_type('Comment', 'Trackback', 'Pingback'); ?> by <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
|
||||
</li>
|
||||
|
||||
<?php } // end for each comment ?>
|
||||
</ol>
|
||||
<?php } else { // this is displayed if there are no comments so far ?>
|
||||
<p><?php _e("No comments yet."); ?></p>
|
||||
<p>No comments yet.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ('open' == $commentstatus->comment_status) { ?>
|
||||
<h2><?php _e("Leave a comment"); ?></h2>
|
||||
<p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p>
|
||||
<h2>Leave a comment</h2>
|
||||
<p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>
|
||||
|
||||
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
|
||||
<p>
|
||||
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
|
||||
<label for="author"><?php _e("Name"); ?></label>
|
||||
<label for="author">Name</label>
|
||||
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
|
||||
<input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($_SERVER["REQUEST_URI"]); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
|
||||
<label for="email"><?php _e("E-mail"); ?></label>
|
||||
<label for="email">E-mail</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
|
||||
<label for="url"><?php _e("<acronym title=\"Uniform Resource Identifier\">URI</acronym>"); ?></label>
|
||||
<label for="url"><acronym title="Uniform Resource Identifier">URI</acronym></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="comment"><?php _e("Your Comment"); ?></label>
|
||||
<label for="comment">Your Comment</label>
|
||||
<br />
|
||||
<textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input name="submit" type="submit" tabindex="5" value="<?php _e("Say It!"); ?>" />
|
||||
<input name="submit" type="submit" tabindex="5" value="Say It!" />
|
||||
</p>
|
||||
<?php do_action('comment_form', $post->ID); ?>
|
||||
</form>
|
||||
<?php } else { // comments are closed ?>
|
||||
<p><?php _e("Sorry, the comment form is closed at this time."); ?></p>
|
||||
<p>Sorry, the comment form is closed at this time.</p>
|
||||
<?php }
|
||||
} // end password check
|
||||
?>
|
||||
|
||||
<div><strong><a href="javascript:window.close()"><?php _e("Close this window."); ?></a></strong></div>
|
||||
<div><strong><a href="javascript:window.close()">Close this window.</a></strong></div>
|
||||
|
||||
<?php // if you delete this the sky will fall on your head
|
||||
}
|
||||
@@ -99,7 +99,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
|
||||
|
||||
<!-- // this is just the end of the motor - don't touch that line either :) -->
|
||||
<?php //} ?>
|
||||
<p class="credit"><?php timer_stop(1); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>Wordpress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p>
|
||||
<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p>
|
||||
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
|
||||
?>
|
||||
|
||||
<p class="nocomments"><?php _e("This post is password protected. Enter the password to view comments."); ?><p>
|
||||
<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
|
||||
|
||||
<?php
|
||||
return;
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<?php else : // this is displayed if there are no comments so far ?>
|
||||
|
||||
<?php if ('open' == $post-> comment_status) : ?>
|
||||
<?php if ('open' == $post->comment_status) : ?>
|
||||
<!-- If comments are open, but there are no comments. -->
|
||||
|
||||
<?php else : // comments are closed ?>
|
||||
@@ -61,7 +61,7 @@
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if ('open' == $post-> comment_status) : ?>
|
||||
<?php if ('open' == $post->comment_status) : ?>
|
||||
|
||||
<h3 id="respond">Leave a Reply</h3>
|
||||
|
||||
@@ -73,15 +73,15 @@
|
||||
|
||||
<?php if ( $user_ID ) : ?>
|
||||
|
||||
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Logout »</a></p>
|
||||
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »</a></p>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
|
||||
<label for="author"><small>Name <?php if ($req) _e('(required)'); ?></small></label></p>
|
||||
<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
|
||||
|
||||
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
|
||||
<label for="email"><small>Mail (will not be published) <?php if ($req) _e('(required)'); ?></small></label></p>
|
||||
<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
|
||||
|
||||
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
|
||||
<label for="url"><small>Website</small></label></p>
|
||||
@@ -101,4 +101,4 @@
|
||||
|
||||
<?php endif; // If registration required and not logged in ?>
|
||||
|
||||
<?php endif; // if you delete this the sky will fall on your head ?>
|
||||
<?php endif; // if you delete this the sky will fall on your head ?>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ -->
|
||||
<?php /* "Just what do you think you're doing Dave?" */ ?>
|
||||
|
||||
<?php do_action('wp_footer'); ?>
|
||||
<?php wp_footer(); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,54 +2,50 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head profile="http://gmpg.org/xfn/11">
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
||||
|
||||
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
|
||||
|
||||
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
|
||||
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
|
||||
|
||||
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
|
||||
<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'); ?>" />
|
||||
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
/* BEGIN IMAGE CSS */
|
||||
/* 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"); } <?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single()) && (! is_page())) { ?>
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } <?php } else { // No sidebar ?>
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } <?php } ?>
|
||||
#header { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickheader.jpg") no-repeat bottom center; }
|
||||
#footer { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickfooter.jpg") no-repeat bottom; border: none;}
|
||||
|
||||
|
||||
/* 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; }
|
||||
/* END IMAGE CSS */
|
||||
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
|
||||
<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'); ?>" />
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
/* 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. */
|
||||
|
||||
|
||||
/* To ease the insertion of a personal header image, I have done it in such a way,
|
||||
that you simply drop in an image called 'personalheader.jpg' into your /images/
|
||||
directory. Dimensions should be at least 760px x 200px. Anything above that will
|
||||
get cropped off of the image. */
|
||||
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 ?>
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
|
||||
<?php } ?>
|
||||
#header { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickheader.jpg") no-repeat bottom center; }
|
||||
#footer { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickfooter.jpg") no-repeat bottom; border: none;}
|
||||
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
#headerimg { background: url('<?php bloginfo('stylesheet_directory'); ?>/images/personalheader.jpg') no-repeat top;}
|
||||
*/
|
||||
#header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; }
|
||||
#headerimg { margin: 7px 9px 0; height: 192px; width: 740px; }
|
||||
|
||||
</style>
|
||||
/* To ease the insertion of a personal header image, I have done it in such a way,
|
||||
that you simply drop in an image called 'personalheader.jpg' into your /images/
|
||||
directory. Dimensions should be at least 760px x 200px. Anything above that will
|
||||
get cropped off of the image. */
|
||||
/*
|
||||
#headerimg { background: url('<?php bloginfo('stylesheet_directory'); ?>/images/personalheader.jpg') no-repeat top;}
|
||||
*/
|
||||
</style>
|
||||
|
||||
<?php wp_get_archives('type=monthly&format=link'); ?>
|
||||
<?php wp_get_archives('type=monthly&format=link'); ?>
|
||||
|
||||
<?php wp_head(); ?>
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@@ -6,32 +6,28 @@
|
||||
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
|
||||
<div class="post">
|
||||
<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
<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(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
|
||||
<!--
|
||||
<?php trackback_rdf(); ?>
|
||||
-->
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
</div>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
|
||||
<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>
|
||||
<p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p>
|
||||
<p class="center">Sorry, but you are looking for something that isn't here.</p>
|
||||
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
@@ -40,4 +36,4 @@
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<div id="content" class="narrowcolumn">
|
||||
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
<div class="post">
|
||||
<h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h2><?php the_title(); ?></h2>
|
||||
<div class="entrytext">
|
||||
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<h2 class="pagetitle">Search Results</h2>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -22,18 +22,14 @@
|
||||
<?php the_excerpt() ?>
|
||||
</div>
|
||||
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
|
||||
<!--
|
||||
<?php trackback_rdf(); ?>
|
||||
-->
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
</div>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
|
||||
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
|
||||
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
</li>
|
||||
|
||||
<!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
|
||||
<li><h2><?php _e('Author'); ?></h2>
|
||||
<li><h2>Author</h2>
|
||||
<p>A little something about you, the author. Nothing lengthy, just an overview.</p>
|
||||
</li>
|
||||
-->
|
||||
|
||||
<li>
|
||||
<?php /* If this is a category archive */ if (is_category()) { ?>
|
||||
<?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()) { ?>
|
||||
@@ -37,30 +38,30 @@
|
||||
<?php } ?>
|
||||
</li>
|
||||
|
||||
<?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
|
||||
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
|
||||
|
||||
<li><h2><?php _e('Archives'); ?></h2>
|
||||
<li><h2>Archives</h2>
|
||||
<ul>
|
||||
<?php wp_get_archives('type=monthly'); ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><h2><?php _e('Categories'); ?></h2>
|
||||
<li><h2>Categories</h2>
|
||||
<ul>
|
||||
<?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?>
|
||||
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
|
||||
<?php get_links_list(); ?>
|
||||
|
||||
<li><h2><?php _e('Meta'); ?></h2>
|
||||
<li><h2>Meta</h2>
|
||||
<ul>
|
||||
<?php wp_register(); ?>
|
||||
<li><?php wp_loginout(); ?></li>
|
||||
<li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
|
||||
<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
|
||||
<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
|
||||
<li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>">WordPress</a></li>
|
||||
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
|
||||
<?php wp_meta(); ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php previous_post('« %','','yes') ?></div>
|
||||
<div class="alignright"><?php next_post(' % »','','yes') ?></div>
|
||||
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
|
||||
<div class="alignright"><?php next_post_link('%link »') ?></div>
|
||||
</div>
|
||||
|
||||
<div class="post">
|
||||
<h2 id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
<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>'); ?>
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
<?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(display); ?>">trackback</a> from your own site.
|
||||
You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
|
||||
|
||||
<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
|
||||
// Only Pings are Open ?>
|
||||
Responses are currently closed, but you can <a href="<?php trackback_url(display); ?> ">trackback</a> from your own site.
|
||||
Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
|
||||
|
||||
<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
|
||||
// Comments are open, Pings are not ?>
|
||||
@@ -56,10 +56,10 @@
|
||||
|
||||
<?php endwhile; else: ?>
|
||||
|
||||
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
|
||||
<p>Sorry, no posts matched your criteria.</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
15
wp-feed.php
15
wp-feed.php
@@ -2,7 +2,7 @@
|
||||
|
||||
if (empty($doing_rss)) {
|
||||
$doing_rss = 1;
|
||||
require('wp-blog-header.php');
|
||||
require(dirname(__FILE__) . '/wp-blog-header.php');
|
||||
}
|
||||
|
||||
// Remove the pad, if present.
|
||||
@@ -13,20 +13,23 @@ if ($feed == '' || $feed == 'feed') {
|
||||
}
|
||||
|
||||
if ( is_single() || ($withcomments == 1) ) {
|
||||
require('wp-commentsrss2.php');
|
||||
require(ABSPATH . 'wp-commentsrss2.php');
|
||||
} else {
|
||||
switch ($feed) {
|
||||
case 'atom':
|
||||
require('wp-atom.php');
|
||||
require(ABSPATH . 'wp-atom.php');
|
||||
break;
|
||||
case 'rdf':
|
||||
require('wp-rdf.php');
|
||||
require(ABSPATH . 'wp-rdf.php');
|
||||
break;
|
||||
case 'rss':
|
||||
require('wp-rss.php');
|
||||
require(ABSPATH . 'wp-rss.php');
|
||||
break;
|
||||
case 'rss2':
|
||||
require('wp-rss2.php');
|
||||
require(ABSPATH . 'wp-rss2.php');
|
||||
break;
|
||||
case 'comments-rss2':
|
||||
require(ABSPATH . 'wp-commentsrss2.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
wp-images/get-firefox.png
Normal file
BIN
wp-images/get-firefox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -217,7 +217,7 @@ class WP_Query {
|
||||
$this->query_vars[$query_var] = $value;
|
||||
}
|
||||
|
||||
function get_posts() {
|
||||
function &get_posts() {
|
||||
global $wpdb, $pagenow, $request, $user_ID;
|
||||
|
||||
// Shorthand.
|
||||
@@ -249,8 +249,15 @@ class WP_Query {
|
||||
$q['nopaging'] = false;
|
||||
}
|
||||
}
|
||||
if ( $this->is_feed )
|
||||
if ( $this->is_feed ) {
|
||||
$q['posts_per_page'] = get_settings('posts_per_rss');
|
||||
$q['what_to_show'] = 'posts';
|
||||
}
|
||||
|
||||
if (isset($q['page'])) {
|
||||
$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));
|
||||
@@ -491,16 +498,17 @@ class WP_Query {
|
||||
}
|
||||
|
||||
if ($this->is_page) {
|
||||
$where .= ' AND (post_status = "static"';
|
||||
$where .= ' AND (post_status = "static")';
|
||||
} elseif ($this->is_single) {
|
||||
$where .= ' AND (post_status != "static")';
|
||||
} else {
|
||||
$where .= ' AND (post_status = "publish"';
|
||||
}
|
||||
|
||||
// Get private posts
|
||||
if (isset($user_ID) && ('' != intval($user_ID)))
|
||||
$where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
|
||||
else
|
||||
$where .= ')';
|
||||
if (isset($user_ID) && ('' != intval($user_ID)))
|
||||
$where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
|
||||
else
|
||||
$where .= ')';
|
||||
}
|
||||
|
||||
// Apply filters on where and join prior to paging so that any
|
||||
// manipulations to them are reflected in the paging by day queries.
|
||||
@@ -537,18 +545,31 @@ class WP_Query {
|
||||
$where = apply_filters('posts_where_paged', $where);
|
||||
$where .= " GROUP BY $wpdb->posts.ID";
|
||||
$join = apply_filters('posts_join_paged', $join);
|
||||
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY post_" . $q['orderby'] . " $limits";
|
||||
$orderby = "post_" . $q['orderby'];
|
||||
$orderby = apply_filters('posts_orderby', $orderby);
|
||||
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY " . $orderby . " $limits";
|
||||
|
||||
if ($q['preview']) {
|
||||
$request = 'SELECT 1-1'; // dummy mysql query for the preview
|
||||
// little funky fix for IEwin, rawk on that code
|
||||
$is_winIE = ((preg_match('/MSIE/',$HTTP_USER_AGENT)) && (preg_match('/Win/',$HTTP_USER_AGENT)));
|
||||
if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {
|
||||
$preview_content = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $preview_content);
|
||||
$this->posts = $wpdb->get_results($request);
|
||||
|
||||
// Check post status to determine if post should be displayed.
|
||||
if ($this->is_single) {
|
||||
if ('publish' != $this->posts[0]->post_status) {
|
||||
if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) {
|
||||
// User must be logged in to view unpublished posts.
|
||||
$this->posts = array();
|
||||
} else {
|
||||
if ('draft' == $this->posts[0]->post_status) {
|
||||
// User must have edit permissions on the draft to preview.
|
||||
if (! user_can_edit_post($user_ID, $this->posts[0]->ID))
|
||||
$this->posts = array();
|
||||
} elseif ('private' == $this->posts[0]->post_status) {
|
||||
if ($this->posts[0]->post_author != $user_ID)
|
||||
$this->posts = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->posts = $wpdb->get_results($request);
|
||||
$this->posts = apply_filters('the_posts', $this->posts);
|
||||
$this->post_count = count($this->posts);
|
||||
if ($this->post_count > 0) {
|
||||
@@ -591,7 +612,7 @@ class WP_Query {
|
||||
}
|
||||
}
|
||||
|
||||
function query($query) {
|
||||
function &query($query) {
|
||||
$this->parse_query($query);
|
||||
return $this->get_posts();
|
||||
}
|
||||
@@ -605,11 +626,9 @@ class WP_Query {
|
||||
$this->queried_object_id = 0;
|
||||
|
||||
if ($this->is_category) {
|
||||
global $cache_categories;
|
||||
if (isset($cache_categories[$this->get('cat')])) {
|
||||
$this->queried_object = $cache_categories[$this->get('cat')];
|
||||
$this->queried_object_id = $this->get('cat');
|
||||
}
|
||||
$category = &get_category($this->get('cat'));
|
||||
$this->queried_object = &$category;
|
||||
$this->queried_object_id = $this->get('cat');
|
||||
} else if ($this->is_single) {
|
||||
$this->queried_object = $this->post;
|
||||
$this->queried_object_id = $this->post->ID;
|
||||
@@ -858,24 +877,32 @@ class WP_Rewrite {
|
||||
$endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%');
|
||||
|
||||
$this->date_structure = '';
|
||||
$date_endian = '';
|
||||
|
||||
foreach ($endians as $endian) {
|
||||
if (false !== strpos($this->permalink_structure, $endian)) {
|
||||
$this->date_structure = $this->front . $endian;
|
||||
$date_endian= $endian;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($date_endian) )
|
||||
$date_endian = '%year%/%monthnum%/%day%';
|
||||
|
||||
// Do not allow the date tags and %post_id% to overlap in the permalink
|
||||
// structure. If they do, move the date tags to $front/date/.
|
||||
$front = $this->front;
|
||||
if ( false !== strpos($this->permalink_structure, $this->front . '%post_id%') )
|
||||
$front = $front . 'date/';
|
||||
|
||||
if (empty($this->date_structure)) {
|
||||
$this->date_structure = $front . '%year%/%monthnum%/%day%';
|
||||
preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
|
||||
$tok_index = 1;
|
||||
foreach ($tokens[0] as $token) {
|
||||
if ( ($token == '%post_id%') && ($tok_index <= 3) ) {
|
||||
$front = $front . 'date/';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->date_structure = $front . $date_endian;
|
||||
|
||||
return $this->date_structure;
|
||||
}
|
||||
|
||||
@@ -1024,8 +1051,8 @@ class WP_Rewrite {
|
||||
|
||||
function generate_rewrite_rules($permalink_structure, $page = true, $feed = true, $forcomments = false, $walk_dirs = true) {
|
||||
$feedregex2 = '';
|
||||
foreach ($this->feeds as $feed) {
|
||||
$feedregex2 .= $feed . '|';
|
||||
foreach ($this->feeds as $feed_name) {
|
||||
$feedregex2 .= $feed_name . '|';
|
||||
}
|
||||
$feedregex2 = '(' . trim($feedregex2, '|') . ')/?$';
|
||||
$feedregex = $this->feed_base . '/' . $feedregex2;
|
||||
@@ -1101,7 +1128,8 @@ class WP_Rewrite {
|
||||
$post = 1;
|
||||
$trackbackmatch = $match . $trackbackregex;
|
||||
$trackbackquery = $trackbackindex . '?' . $query . '&tb=1';
|
||||
$match = $match . '?([0-9]+)?/?$';
|
||||
$match = rtrim($match, '/');
|
||||
$match = $match . '(/[0-9]+)?/?$';
|
||||
$query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1);
|
||||
} else {
|
||||
$match .= '?$';
|
||||
|
||||
@@ -20,8 +20,10 @@ function comments_template( $file = '/comments.php' ) {
|
||||
|
||||
get_currentuserinfo();
|
||||
|
||||
if ( file_exists( TEMPLATEPATH . $file ) )
|
||||
require( TEMPLATEPATH . $file );
|
||||
define('COMMENTS_TEMPLATE', true);
|
||||
$include = apply_filters('comments_template', TEMPLATEPATH . $file );
|
||||
if ( file_exists( $include ) )
|
||||
require( $include );
|
||||
else
|
||||
require( ABSPATH . 'wp-content/themes/default/comments.php');
|
||||
|
||||
@@ -40,11 +42,10 @@ function clean_url( $url ) {
|
||||
function get_comments_number( $comment_id ) {
|
||||
global $wpdb, $comment_count_cache;
|
||||
$comment_id = (int) $comment_id;
|
||||
if (!isset($comment_count_cache[$comment_id]))
|
||||
$number = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'");
|
||||
else
|
||||
$number = $comment_count_cache[$comment_id];
|
||||
return apply_filters('get_comments_number', $number);
|
||||
if (!isset($comment_count_cache[$comment_id]))
|
||||
$comment_count_cache[$comment_id] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'");
|
||||
|
||||
return apply_filters('get_comments_number', $comment_count_cache[$comment_id]);
|
||||
}
|
||||
|
||||
function comments_number( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $number = '' ) {
|
||||
@@ -92,11 +93,11 @@ function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Com
|
||||
global $comment_count_cache;
|
||||
|
||||
if (! is_single() && ! is_page()) {
|
||||
if ('' == $comment_count_cache["$id"]) {
|
||||
$number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
|
||||
} else {
|
||||
$number = $comment_count_cache["$id"];
|
||||
}
|
||||
if ( !isset($comment_count_cache[$id]))
|
||||
$comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
|
||||
|
||||
$number = $comment_count_cache[$id];
|
||||
|
||||
if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
|
||||
echo $none;
|
||||
return;
|
||||
@@ -287,12 +288,13 @@ function comment_date( $d = '' ) {
|
||||
echo get_comment_date( $d );
|
||||
}
|
||||
|
||||
function get_comment_time( $d = '' ) {
|
||||
function get_comment_time( $d = '', $gmt = false ) {
|
||||
global $comment;
|
||||
$comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
|
||||
if ( '' == $d )
|
||||
$date = mysql2date(get_settings('time_format'), $comment->comment_date);
|
||||
$date = mysql2date(get_settings('time_format'), $comment_date);
|
||||
else
|
||||
$date = mysql2date($d, $comment->comment_date);
|
||||
$date = mysql2date($d, $comment_date);
|
||||
return apply_filters('get_comment_time', $date);
|
||||
}
|
||||
|
||||
@@ -465,12 +467,11 @@ function pingback($content, $post_ID) {
|
||||
|
||||
// when set to true, this outputs debug messages by itself
|
||||
$client->debug = false;
|
||||
$client->query('pingback.ping', array($pagelinkedfrom, $pagelinkedto));
|
||||
|
||||
if ( !$client->query('pingback.ping', array($pagelinkedfrom, $pagelinkedto) ) )
|
||||
debug_fwrite($log, "Error.\n Fault code: ".$client->getErrorCode()." : ".$client->getErrorMessage()."\n");
|
||||
else
|
||||
if ( $client->query('pingback.ping', array($pagelinkedfrom, $pagelinkedto) ) )
|
||||
add_ping( $post_ID, $pagelinkedto );
|
||||
else
|
||||
debug_fwrite($log, "Error.\n Fault code: ".$client->getErrorCode()." : ".$client->getErrorMessage()."\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,6 +480,7 @@ function pingback($content, $post_ID) {
|
||||
}
|
||||
|
||||
function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
|
||||
global $wp_version;
|
||||
|
||||
$byte_count = 0;
|
||||
$contents = '';
|
||||
@@ -614,110 +616,6 @@ function wp_get_comment_status($comment_id) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('wp_notify_postauthor') ) {
|
||||
function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
global $wpdb;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
|
||||
|
||||
if ('' == $user->user_email) return false; // If there's no email to send the comment to
|
||||
|
||||
$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 = "New comment on your post #$comment->comment_post_ID \"".$post->post_title."\"\r\n\r\n";
|
||||
$notify_message .= "Author : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
|
||||
$notify_message .= "E-mail : $comment->comment_author_email\r\n";
|
||||
$notify_message .= "URI : $comment->comment_author_url\r\n";
|
||||
$notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$comment->comment_author_IP\r\n";
|
||||
$notify_message .= "Comment:\r\n $comment->comment_content \r\n\r\n";
|
||||
$notify_message .= "You can see all comments on this post here: \r\n";
|
||||
$subject = '[' . $blogname . '] Comment: "' .$post->post_title.'"';
|
||||
} elseif ('trackback' == $comment_type) {
|
||||
$notify_message = "New trackback on your post #$comment_post_ID \"".$post->post_title."\"\r\n\r\n";
|
||||
$notify_message .= "Website: $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
|
||||
$notify_message .= "URI : $comment->comment_author_url\r\n";
|
||||
$notify_message .= "Excerpt: \n $comment->comment_content \r\n\r\n";
|
||||
$notify_message .= "You can see all trackbacks on this post here: \r\n";
|
||||
$subject = '[' . $blogname . '] Trackback: "' .$post->post_title.'"';
|
||||
} elseif ('pingback' == $comment_type) {
|
||||
$notify_message = "New pingback on your post #$comment_post_ID \"".$post->post_title."\"\r\n\r\n";
|
||||
$notify_message .= "Website: $comment->comment_author\r\n";
|
||||
$notify_message .= "URI : $comment->comment_author_url\r\n";
|
||||
$notify_message .= "Excerpt: \n[...] $comment->comment_content [...]\r\n\r\n";
|
||||
$notify_message .= "You can see all pingbacks on this post here: \r\n";
|
||||
$subject = '[' . $blogname . '] Pingback: "' .$post->post_title.'"';
|
||||
}
|
||||
$notify_message .= get_permalink($comment->comment_post_ID) . '#comments';
|
||||
$notify_message .= "\r\n\r\nTo delete this comment:\r\n" . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id";
|
||||
|
||||
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>";
|
||||
}
|
||||
|
||||
$message_headers = "MIME-Version: 1.0\n"
|
||||
. "$from\n"
|
||||
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
|
||||
|
||||
@wp_mail($user->user_email, $subject, $notify_message, $message_headers);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* wp_notify_moderator
|
||||
notifies the moderator of the blog (usually the admin)
|
||||
about a new comment that waits for approval
|
||||
always returns true
|
||||
*/
|
||||
if ( !function_exists('wp_notify_moderator') ) {
|
||||
function wp_notify_moderator($comment_id) {
|
||||
global $wpdb;
|
||||
|
||||
if( get_settings( "moderation_notify" ) == 0 )
|
||||
return true;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
|
||||
|
||||
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
|
||||
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
|
||||
|
||||
$notify_message = "A new comment on the post #$post->ID \"$post->post_title\" is waiting for your approval\r\n";
|
||||
$notify_message .= get_permalink($comment->comment_post_ID);
|
||||
$notify_message .= "\n\nAuthor : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
|
||||
$notify_message .= "E-mail : $comment->comment_author_email\r\n";
|
||||
$notify_message .= "URL : $comment->comment_author_url\r\n";
|
||||
$notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$comment->comment_author_IP\r\n";
|
||||
$notify_message .= "Comment:\r\n".$comment->comment_content."\r\n\r\n";
|
||||
$notify_message .= "To approve this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=mailapprovecomment&p=".$comment->comment_post_ID."&comment=$comment_id\r\n";
|
||||
$notify_message .= "To delete this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id\r\n";
|
||||
$notify_message .= "Currently $comments_waiting comments are waiting for approval. Please visit the moderation panel:\r\n";
|
||||
$notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
|
||||
|
||||
$subject = '[' . get_settings('blogname') . '] Please moderate: "' .$post->post_title.'"';
|
||||
$admin_email = get_settings("admin_email");
|
||||
$from = "From: $admin_email";
|
||||
|
||||
$message_headers = "MIME-Version: 1.0\n"
|
||||
. "$from\n"
|
||||
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
|
||||
|
||||
@wp_mail($admin_email, $subject, $notify_message, $message_headers);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
|
||||
global $wpdb;
|
||||
|
||||
@@ -727,27 +625,27 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||
return false; // Check # of external links
|
||||
|
||||
$mod_keys = trim( get_settings('moderation_keys') );
|
||||
if ('' == $mod_keys )
|
||||
return true; // If moderation keys are empty
|
||||
$words = explode("\n", $mod_keys );
|
||||
if ( !empty($mod_keys) ) {
|
||||
$words = explode("\n", $mod_keys );
|
||||
|
||||
foreach ($words as $word) {
|
||||
$word = trim($word);
|
||||
foreach ($words as $word) {
|
||||
$word = trim($word);
|
||||
|
||||
// Skip empty lines
|
||||
if (empty($word)) { continue; }
|
||||
// Skip empty lines
|
||||
if (empty($word)) { continue; }
|
||||
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// spam words don't break things:
|
||||
$word = preg_quote($word, '#');
|
||||
// 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;
|
||||
if ( preg_match($pattern, $url) ) return false;
|
||||
if ( preg_match($pattern, $comment) ) return false;
|
||||
if ( preg_match($pattern, $user_ip) ) return false;
|
||||
if ( preg_match($pattern, $user_agent) ) return false;
|
||||
$pattern = "#$word#i";
|
||||
if ( preg_match($pattern, $author) ) return false;
|
||||
if ( preg_match($pattern, $email) ) return false;
|
||||
if ( preg_match($pattern, $url) ) return false;
|
||||
if ( preg_match($pattern, $comment) ) return false;
|
||||
if ( preg_match($pattern, $user_ip) ) return false;
|
||||
if ( preg_match($pattern, $user_agent) ) return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Comment whitelisting:
|
||||
@@ -755,10 +653,14 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||
if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll
|
||||
$uri = parse_url($url);
|
||||
$domain = $uri['host'];
|
||||
if ( $wpdb->get_var("SELECT link_id FROM $wpdb->links WHERE link_url LIKE ('%$domain%') LIMIT 1") )
|
||||
$uri = parse_url( get_option('home') );
|
||||
$home_domain = $uri['host'];
|
||||
if ( $wpdb->get_var("SELECT link_id FROM $wpdb->links WHERE link_url LIKE ('%$domain%') LIMIT 1") || $domain == $home_domain )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
} elseif( $author != '' && $email != '' ) {
|
||||
$ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' ");
|
||||
$ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1");
|
||||
if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) )
|
||||
return true;
|
||||
else
|
||||
@@ -771,4 +673,4 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -48,21 +48,17 @@ add_filter('comment_text', 'make_clickable');
|
||||
add_filter('comment_text', 'wpautop', 30);
|
||||
add_filter('comment_text', 'convert_smilies', 20);
|
||||
|
||||
add_filter('comment_text_rss', 'htmlspecialchars');
|
||||
|
||||
add_filter('comment_excerpt', 'convert_chars');
|
||||
add_filter('the_excerpt_rss', 'convert_chars');
|
||||
|
||||
// Places to balance tags on input
|
||||
add_filter('content_save_pre', 'balanceTags', 50);
|
||||
add_filter('excerpt_save_pre', 'balanceTags', 50);
|
||||
add_filter('comment_save_pre', 'balanceTags', 50);
|
||||
|
||||
// Misc. title, content, and excerpt filters
|
||||
add_filter('the_title', 'convert_chars');
|
||||
add_filter('the_title', 'trim');
|
||||
|
||||
add_filter('the_title_rss', 'strip_tags');
|
||||
|
||||
add_filter('the_content', 'convert_smilies');
|
||||
add_filter('the_content', 'convert_chars');
|
||||
add_filter('the_content', 'wpautop');
|
||||
@@ -70,11 +66,23 @@ add_filter('the_content', 'wpautop');
|
||||
add_filter('the_excerpt', 'convert_smilies');
|
||||
add_filter('the_excerpt', 'convert_chars');
|
||||
add_filter('the_excerpt', 'wpautop');
|
||||
|
||||
add_filter('get_the_excerpt', 'wp_trim_excerpt');
|
||||
|
||||
add_filter('sanitize_title', 'sanitize_title_with_dashes');
|
||||
|
||||
// RSS filters
|
||||
add_filter('the_title_rss', 'strip_tags');
|
||||
add_filter('the_title_rss', 'ent2ncr', 8);
|
||||
add_filter('the_content_rss', 'ent2ncr', 8);
|
||||
add_filter('the_excerpt_rss', 'convert_chars');
|
||||
add_filter('the_excerpt_rss', 'ent2ncr', 8);
|
||||
add_filter('comment_author_rss', 'ent2ncr', 8);
|
||||
add_filter('comment_text_rss', 'htmlspecialchars');
|
||||
add_filter('comment_text_rss', 'ent2ncr', 8);
|
||||
add_filter('bloginfo_rss', 'ent2ncr', 8);
|
||||
add_filter('the_author', 'ent2ncr', 8);
|
||||
|
||||
// Actions
|
||||
add_action('publish_post', 'generic_ping');
|
||||
|
||||
?>
|
||||
@@ -1,8 +1,12 @@
|
||||
<?php
|
||||
|
||||
function bloginfo_rss($show='') {
|
||||
$info = strip_tags(get_bloginfo($show));
|
||||
echo convert_chars($info);
|
||||
function get_bloginfo_rss($show = '') {
|
||||
$info = strip_tags(get_bloginfo($show));
|
||||
return convert_chars($info);
|
||||
}
|
||||
|
||||
function bloginfo_rss($show = '') {
|
||||
echo get_bloginfo_rss($show);
|
||||
}
|
||||
|
||||
function the_title_rss() {
|
||||
@@ -69,20 +73,20 @@ function comment_text_rss() {
|
||||
echo $comment_text;
|
||||
}
|
||||
|
||||
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'wp-commentsrss2.php') {
|
||||
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = '') {
|
||||
$url = comments_rss($commentsrssfilename);
|
||||
echo "<a href='$url'>$link_text</a>";
|
||||
}
|
||||
|
||||
function comments_rss($commentsrssfilename = 'wp-commentsrss2.php') {
|
||||
function comments_rss($commentsrssfilename = '') {
|
||||
global $id;
|
||||
|
||||
if ('' != get_settings('permalink_structure'))
|
||||
$url = trailingslashit( get_permalink() ) . 'feed/';
|
||||
else
|
||||
$url = get_settings('siteurl') . "/$commentsrssfilename?p=$id";
|
||||
$url = get_settings('home') . "/$commentsrssfilename?feed=rss2&p=$id";
|
||||
|
||||
return $url;
|
||||
return apply_filters('post_comments_feed_link', $url);
|
||||
}
|
||||
|
||||
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
||||
@@ -90,29 +94,30 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
||||
$permalink_structure = get_settings('permalink_structure');
|
||||
|
||||
if ('' == $permalink_structure) {
|
||||
$file = get_settings('siteurl') . '/wp-rss2.php';
|
||||
$link = $file . '?author=' . $author_id;
|
||||
$link = get_settings('home') . '?feed=rss2&author=' . $author_id;
|
||||
} else {
|
||||
$link = get_author_link(0, $author_id, $author_nicename);
|
||||
$link = $link . "feed/";
|
||||
$link = get_author_link(0, $author_id, $author_nicename);
|
||||
$link = $link . "feed/";
|
||||
}
|
||||
|
||||
$link = apply_filters('author_feed_link', $link);
|
||||
|
||||
if ($echo) echo $link;
|
||||
return $link;
|
||||
}
|
||||
|
||||
function get_category_rss_link($echo = false, $category_id, $category_nicename) {
|
||||
$cat_ID = $category_id;
|
||||
function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
|
||||
$permalink_structure = get_settings('permalink_structure');
|
||||
|
||||
if ('' == $permalink_structure) {
|
||||
$file = get_settings('siteurl') . '/wp-rss2.php';
|
||||
$link = $file . '?cat=' . $category_id;
|
||||
$link = get_settings('home') . '?feed=rss2&cat=' . $cat_ID;
|
||||
} else {
|
||||
$link = get_category_link($category_id);
|
||||
$link = $link . "feed/";
|
||||
$link = get_category_link($cat_ID);
|
||||
$link = $link . "feed/";
|
||||
}
|
||||
|
||||
$link = apply_filters('category_feed_link', $link);
|
||||
|
||||
if ($echo) echo $link;
|
||||
return $link;
|
||||
}
|
||||
@@ -132,7 +137,9 @@ function the_category_rss($type = 'rss') {
|
||||
}
|
||||
|
||||
function rss_enclosure() {
|
||||
global $id;
|
||||
global $id, $post;
|
||||
if (!empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password)) return;
|
||||
|
||||
$custom_fields = get_post_custom();
|
||||
if( is_array( $custom_fields ) ) {
|
||||
while( list( $key, $val ) = each( $custom_fields ) ) {
|
||||
@@ -140,7 +147,7 @@ function rss_enclosure() {
|
||||
if (is_array($val)) {
|
||||
foreach($val as $enc) {
|
||||
$enclosure = split( "\n", $enc );
|
||||
print "<enclosure url='".trim( $enclosure[ 0 ] )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
||||
print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,15 @@ function wptexturize($text) {
|
||||
|
||||
if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag
|
||||
$curl = str_replace('---', '—', $curl);
|
||||
$curl = preg_replace('/(\s)--(\s)/', '$1—$2', $curl);
|
||||
$curl = str_replace(' -- ', ' — ', $curl);
|
||||
$curl = str_replace('--', '–', $curl);
|
||||
$curl = str_replace('xn–', 'xn--', $curl);
|
||||
$curl = str_replace('...', '…', $curl);
|
||||
$curl = str_replace('``', '“', $curl);
|
||||
|
||||
// This is a hack, look at this more later. It works pretty well though.
|
||||
$cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round");
|
||||
$cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round");
|
||||
$cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
|
||||
$cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");
|
||||
$curl = str_replace($cockney, $cockneyreplace, $curl);
|
||||
|
||||
$curl = preg_replace("/'s/", '’s', $curl);
|
||||
@@ -32,7 +33,7 @@ function wptexturize($text) {
|
||||
$curl = preg_replace("/ \(tm\)/i", ' ™', $curl);
|
||||
$curl = str_replace("''", '”', $curl);
|
||||
|
||||
$curl = preg_replace('/(d+)x(\d+)/', "$1×$2", $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'))) {
|
||||
// strstr is fast
|
||||
@@ -57,20 +58,20 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = $pee . "\n"; // just to make things a little easier, pad the end
|
||||
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
|
||||
// Space things out a little
|
||||
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|math|p|h[1-6])>)!', "$1\n", $pee);
|
||||
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n", $pee);
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
|
||||
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
|
||||
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
|
||||
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|math|p|h[1-6])[^>]*>)!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
|
||||
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|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
|
||||
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
|
||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . clean_pre('$2') . '</pre>' ", $pee);
|
||||
|
||||
@@ -141,42 +142,104 @@ function utf8_uri_encode( $utf8_string ) {
|
||||
|
||||
function remove_accents($string) {
|
||||
if (seems_utf8($string)) {
|
||||
$chars = array(// Decompositions for Latin-1 Supplement
|
||||
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
|
||||
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
|
||||
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
|
||||
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
|
||||
chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
|
||||
chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
|
||||
chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
|
||||
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
|
||||
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
|
||||
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
|
||||
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
|
||||
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
|
||||
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
|
||||
chr(195).chr(160) => 'a', chr(195).chr(161) => 'a',
|
||||
chr(195).chr(162) => 'a', chr(195).chr(163) => 'a',
|
||||
chr(195).chr(164) => 'a', chr(195).chr(165) => 'a',
|
||||
chr(195).chr(167) => 'c', chr(195).chr(168) => 'e',
|
||||
chr(195).chr(169) => 'e', chr(195).chr(170) => 'e',
|
||||
chr(195).chr(171) => 'e', chr(195).chr(172) => 'i',
|
||||
chr(195).chr(173) => 'i', chr(195).chr(174) => 'i',
|
||||
chr(195).chr(175) => 'i', chr(195).chr(177) => 'n',
|
||||
chr(195).chr(178) => 'o', chr(195).chr(179) => 'o',
|
||||
chr(195).chr(180) => 'o', chr(195).chr(181) => 'o',
|
||||
chr(195).chr(182) => 'o', chr(195).chr(182) => 'o',
|
||||
chr(195).chr(185) => 'u', chr(195).chr(186) => 'u',
|
||||
chr(195).chr(187) => 'u', chr(195).chr(188) => 'u',
|
||||
chr(195).chr(189) => 'y', chr(195).chr(191) => 'y',
|
||||
// Decompositions for Latin Extended-A
|
||||
// TODO: Finish me.
|
||||
chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
|
||||
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
|
||||
chr(197).chr(189) => 'Z', chr(197).chr(190) => 'z',
|
||||
// Euro Sign
|
||||
chr(226).chr(130).chr(172) => 'E');
|
||||
|
||||
$chars = array(
|
||||
// Decompositions for Latin-1 Supplement
|
||||
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
|
||||
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
|
||||
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
|
||||
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
|
||||
chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
|
||||
chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
|
||||
chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
|
||||
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
|
||||
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
|
||||
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
|
||||
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
|
||||
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
|
||||
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
|
||||
chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
|
||||
chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
|
||||
chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
|
||||
chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
|
||||
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
|
||||
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
|
||||
chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
|
||||
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
|
||||
chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
|
||||
chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
|
||||
chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
|
||||
chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
|
||||
chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
|
||||
chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
|
||||
chr(195).chr(191) => 'y',
|
||||
// Decompositions for Latin Extended-A
|
||||
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
|
||||
chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
|
||||
chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
|
||||
chr(196).chr(134) => 'C', chr(196).chr(134) => 'c',
|
||||
chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
|
||||
chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
|
||||
chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
|
||||
chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
|
||||
chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
|
||||
chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
|
||||
chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
|
||||
chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
|
||||
chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
|
||||
chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
|
||||
chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
|
||||
chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
|
||||
chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
|
||||
chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
|
||||
chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
|
||||
chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
|
||||
chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
|
||||
chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
|
||||
chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
|
||||
chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
|
||||
chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
|
||||
chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
|
||||
chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
|
||||
chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
|
||||
chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
|
||||
chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
|
||||
chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
|
||||
chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
|
||||
chr(197).chr(128) => 'l', chr(196).chr(129) => 'L',
|
||||
chr(197).chr(130) => 'l', chr(196).chr(131) => 'N',
|
||||
chr(197).chr(132) => 'n', chr(196).chr(133) => 'N',
|
||||
chr(197).chr(134) => 'n', chr(196).chr(135) => 'N',
|
||||
chr(197).chr(136) => 'n', chr(196).chr(137) => 'N',
|
||||
chr(197).chr(138) => 'n', chr(196).chr(139) => 'N',
|
||||
chr(197).chr(140) => 'O', chr(196).chr(141) => 'o',
|
||||
chr(197).chr(142) => 'O', chr(196).chr(143) => 'o',
|
||||
chr(197).chr(144) => 'O', chr(196).chr(145) => 'o',
|
||||
chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
|
||||
chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
|
||||
chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
|
||||
chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
|
||||
chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
|
||||
chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
|
||||
chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
|
||||
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
|
||||
chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
|
||||
chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
|
||||
chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
|
||||
chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
|
||||
chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
|
||||
chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
|
||||
chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
|
||||
chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
|
||||
chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
|
||||
chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
|
||||
chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
|
||||
chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
|
||||
chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
|
||||
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
|
||||
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
|
||||
@@ -619,7 +682,7 @@ function sanitize_email($email) {
|
||||
function human_time_diff( $from, $to = '' ) {
|
||||
if ( empty($to) )
|
||||
$to = time();
|
||||
$diff = (int) ($to - $from);
|
||||
$diff = (int) abs($to - $from);
|
||||
if ($diff <= 3600) {
|
||||
$mins = round($diff / 60);
|
||||
if ($mins <= 1)
|
||||
@@ -642,28 +705,289 @@ function human_time_diff( $from, $to = '' ) {
|
||||
return $since;
|
||||
}
|
||||
|
||||
function wp_trim_excerpt( $text ) { // Fakes an excerpt if needed
|
||||
function wp_trim_excerpt($text) { // Fakes an excerpt if needed
|
||||
global $post;
|
||||
if ( '' == $text ) {
|
||||
$text = $post->post_content;
|
||||
$text = strip_tags( $text );
|
||||
$blah = explode(' ', $text);
|
||||
$text = apply_filters('the_content', $text);
|
||||
$text = str_replace(']]>', ']]>', $text);
|
||||
$text = strip_tags($text);
|
||||
$excerpt_length = 55;
|
||||
if (count($blah) > $excerpt_length) {
|
||||
$k = $excerpt_length;
|
||||
$use_dotdotdot = 1;
|
||||
} else {
|
||||
$k = count($blah);
|
||||
$use_dotdotdot = 0;
|
||||
$words = explode(' ', $text, $excerpt_length + 1);
|
||||
if (count($words) > $excerpt_length) {
|
||||
array_pop($words);
|
||||
array_push($words, '[...]');
|
||||
$text = implode(' ', $words);
|
||||
}
|
||||
$excerpt = '';
|
||||
for ($i=0; $i<$k; $i++) {
|
||||
$excerpt .= $blah[$i].' ';
|
||||
}
|
||||
$excerpt .= ($use_dotdotdot) ? '[...]' : '';
|
||||
$text = $excerpt;
|
||||
} // end if no excerpt
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
function ent2ncr($text) {
|
||||
$to_ncr = array(
|
||||
'"' => '"',
|
||||
'&' => '&',
|
||||
'⁄' => '/',
|
||||
'<' => '<',
|
||||
'>' => '>',
|
||||
' ' => ' ',
|
||||
'¡' => '¡',
|
||||
'¢' => '¢',
|
||||
'£' => '£',
|
||||
'¤' => '¤',
|
||||
'¥' => '¥',
|
||||
'|' => '¦',
|
||||
'¦' => '¦',
|
||||
'&brkbar;' => '¦',
|
||||
'§' => '§',
|
||||
'¨' => '¨',
|
||||
'¨' => '¨',
|
||||
'©' => '©',
|
||||
'ª' => 'ª',
|
||||
'«' => '«',
|
||||
'¬' => '¬',
|
||||
'­' => '­',
|
||||
'®' => '®',
|
||||
'¯' => '¯',
|
||||
'&hibar;' => '¯',
|
||||
'°' => '°',
|
||||
'±' => '±',
|
||||
'²' => '²',
|
||||
'³' => '³',
|
||||
'´' => '´',
|
||||
'µ' => 'µ',
|
||||
'¶' => '¶',
|
||||
'·' => '·',
|
||||
'¸' => '¸',
|
||||
'¹' => '¹',
|
||||
'º' => 'º',
|
||||
'»' => '»',
|
||||
'¼' => '¼',
|
||||
'½' => '½',
|
||||
'¾' => '¾',
|
||||
'¿' => '¿',
|
||||
'À' => 'À',
|
||||
'Á' => 'Á',
|
||||
'Â' => 'Â',
|
||||
'Ã' => 'Ã',
|
||||
'Ä' => 'Ä',
|
||||
'Å' => 'Å',
|
||||
'Æ' => 'Æ',
|
||||
'Ç' => 'Ç',
|
||||
'È' => 'È',
|
||||
'É' => 'É',
|
||||
'Ê' => 'Ê',
|
||||
'Ë' => 'Ë',
|
||||
'Ì' => 'Ì',
|
||||
'Í' => 'Í',
|
||||
'Î' => 'Î',
|
||||
'Ï' => 'Ï',
|
||||
'Ð' => 'Ð',
|
||||
'Ñ' => 'Ñ',
|
||||
'Ò' => 'Ò',
|
||||
'Ó' => 'Ó',
|
||||
'Ô' => 'Ô',
|
||||
'Õ' => 'Õ',
|
||||
'Ö' => 'Ö',
|
||||
'×' => '×',
|
||||
'Ø' => 'Ø',
|
||||
'Ù' => 'Ù',
|
||||
'Ú' => 'Ú',
|
||||
'Û' => 'Û',
|
||||
'Ü' => 'Ü',
|
||||
'Ý' => 'Ý',
|
||||
'Þ' => 'Þ',
|
||||
'ß' => 'ß',
|
||||
'à' => 'à',
|
||||
'á' => 'á',
|
||||
'â' => 'â',
|
||||
'ã' => 'ã',
|
||||
'ä' => 'ä',
|
||||
'å' => 'å',
|
||||
'æ' => 'æ',
|
||||
'ç' => 'ç',
|
||||
'è' => 'è',
|
||||
'é' => 'é',
|
||||
'ê' => 'ê',
|
||||
'ë' => 'ë',
|
||||
'ì' => 'ì',
|
||||
'í' => 'í',
|
||||
'î' => 'î',
|
||||
'ï' => 'ï',
|
||||
'ð' => 'ð',
|
||||
'ñ' => 'ñ',
|
||||
'ò' => 'ò',
|
||||
'ó' => 'ó',
|
||||
'ô' => 'ô',
|
||||
'õ' => 'õ',
|
||||
'ö' => 'ö',
|
||||
'÷' => '÷',
|
||||
'ø' => 'ø',
|
||||
'ù' => 'ù',
|
||||
'ú' => 'ú',
|
||||
'û' => 'û',
|
||||
'ü' => 'ü',
|
||||
'ý' => 'ý',
|
||||
'þ' => 'þ',
|
||||
'ÿ' => 'ÿ',
|
||||
'Œ' => 'Œ',
|
||||
'œ' => 'œ',
|
||||
'Š' => 'Š',
|
||||
'š' => 'š',
|
||||
'Ÿ' => 'Ÿ',
|
||||
'ƒ' => 'ƒ',
|
||||
'ˆ' => 'ˆ',
|
||||
'˜' => '˜',
|
||||
'Α' => 'Α',
|
||||
'Β' => 'Β',
|
||||
'Γ' => 'Γ',
|
||||
'Δ' => 'Δ',
|
||||
'Ε' => 'Ε',
|
||||
'Ζ' => 'Ζ',
|
||||
'Η' => 'Η',
|
||||
'Θ' => 'Θ',
|
||||
'Ι' => 'Ι',
|
||||
'Κ' => 'Κ',
|
||||
'Λ' => 'Λ',
|
||||
'Μ' => 'Μ',
|
||||
'Ν' => 'Ν',
|
||||
'Ξ' => 'Ξ',
|
||||
'Ο' => 'Ο',
|
||||
'Π' => 'Π',
|
||||
'Ρ' => 'Ρ',
|
||||
'Σ' => 'Σ',
|
||||
'Τ' => 'Τ',
|
||||
'Υ' => 'Υ',
|
||||
'Φ' => 'Φ',
|
||||
'Χ' => 'Χ',
|
||||
'Ψ' => 'Ψ',
|
||||
'Ω' => 'Ω',
|
||||
'α' => 'α',
|
||||
'β' => 'β',
|
||||
'γ' => 'γ',
|
||||
'δ' => 'δ',
|
||||
'ε' => 'ε',
|
||||
'ζ' => 'ζ',
|
||||
'η' => 'η',
|
||||
'θ' => 'θ',
|
||||
'ι' => 'ι',
|
||||
'κ' => 'κ',
|
||||
'λ' => 'λ',
|
||||
'μ' => 'μ',
|
||||
'ν' => 'ν',
|
||||
'ξ' => 'ξ',
|
||||
'ο' => 'ο',
|
||||
'π' => 'π',
|
||||
'ρ' => 'ρ',
|
||||
'ς' => 'ς',
|
||||
'σ' => 'σ',
|
||||
'τ' => 'τ',
|
||||
'υ' => 'υ',
|
||||
'φ' => 'φ',
|
||||
'χ' => 'χ',
|
||||
'ψ' => 'ψ',
|
||||
'ω' => 'ω',
|
||||
'ϑ' => 'ϑ',
|
||||
'ϒ' => 'ϒ',
|
||||
'ϖ' => 'ϖ',
|
||||
' ' => ' ',
|
||||
' ' => ' ',
|
||||
' ' => ' ',
|
||||
'‌' => '‌',
|
||||
'‍' => '‍',
|
||||
'‎' => '‎',
|
||||
'‏' => '‏',
|
||||
'–' => '–',
|
||||
'—' => '—',
|
||||
'‘' => '‘',
|
||||
'’' => '’',
|
||||
'‚' => '‚',
|
||||
'“' => '“',
|
||||
'”' => '”',
|
||||
'„' => '„',
|
||||
'†' => '†',
|
||||
'‡' => '‡',
|
||||
'•' => '•',
|
||||
'…' => '…',
|
||||
'‰' => '‰',
|
||||
'′' => '′',
|
||||
'″' => '″',
|
||||
'‹' => '‹',
|
||||
'›' => '›',
|
||||
'‾' => '‾',
|
||||
'⁄' => '⁄',
|
||||
'€' => '€',
|
||||
'ℑ' => 'ℑ',
|
||||
'℘' => '℘',
|
||||
'ℜ' => 'ℜ',
|
||||
'™' => '™',
|
||||
'ℵ' => 'ℵ',
|
||||
'↵' => '↵',
|
||||
'⇐' => '⇐',
|
||||
'⇑' => '⇑',
|
||||
'⇒' => '⇒',
|
||||
'⇓' => '⇓',
|
||||
'⇔' => '⇔',
|
||||
'∀' => '∀',
|
||||
'∂' => '∂',
|
||||
'∃' => '∃',
|
||||
'∅' => '∅',
|
||||
'∇' => '∇',
|
||||
'∈' => '∈',
|
||||
'∉' => '∉',
|
||||
'∋' => '∋',
|
||||
'∏' => '∏',
|
||||
'∑' => '∑',
|
||||
'−' => '−',
|
||||
'∗' => '∗',
|
||||
'√' => '√',
|
||||
'∝' => '∝',
|
||||
'∞' => '∞',
|
||||
'∠' => '∠',
|
||||
'∧' => '∧',
|
||||
'∨' => '∨',
|
||||
'∩' => '∩',
|
||||
'∪' => '∪',
|
||||
'∫' => '∫',
|
||||
'∴' => '∴',
|
||||
'∼' => '∼',
|
||||
'≅' => '≅',
|
||||
'≈' => '≈',
|
||||
'≠' => '≠',
|
||||
'≡' => '≡',
|
||||
'≤' => '≤',
|
||||
'≥' => '≥',
|
||||
'⊂' => '⊂',
|
||||
'⊃' => '⊃',
|
||||
'⊄' => '⊄',
|
||||
'⊆' => '⊆',
|
||||
'⊇' => '⊇',
|
||||
'⊕' => '⊕',
|
||||
'⊗' => '⊗',
|
||||
'⊥' => '⊥',
|
||||
'⋅' => '⋅',
|
||||
'⌈' => '⌈',
|
||||
'⌉' => '⌉',
|
||||
'⌊' => '⌊',
|
||||
'⌋' => '⌋',
|
||||
'⟨' => '〈',
|
||||
'⟩' => '〉',
|
||||
'←' => '←',
|
||||
'↑' => '↑',
|
||||
'→' => '→',
|
||||
'↓' => '↓',
|
||||
'↔' => '↔',
|
||||
'◊' => '◊',
|
||||
'♠' => '♠',
|
||||
'♣' => '♣',
|
||||
'♥' => '♥',
|
||||
'♦' => '♦'
|
||||
);
|
||||
|
||||
foreach ($to_ncr as $entity => $ncr) {
|
||||
$text = str_replace($entity, $ncr, $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -139,12 +139,13 @@ function wp_update_post($postarr = array()) {
|
||||
WHERE ID = $ID";
|
||||
|
||||
$result = $wpdb->query($sql);
|
||||
$rows_affected = $wpdb->rows_affected;
|
||||
|
||||
wp_set_post_cats('', $ID, $post_category);
|
||||
|
||||
do_action('edit_post', $ID);
|
||||
|
||||
return $wpdb->rows_affected;
|
||||
return $rows_affected;
|
||||
}
|
||||
|
||||
function wp_get_post_cats($blogid = '1', $post_ID = 0) {
|
||||
@@ -350,10 +351,10 @@ function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
|
||||
/* returns true if $user_id can edit $post_id */
|
||||
function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
|
||||
$author_data = get_userdata($user_id);
|
||||
$post_data = get_postdata($post_id);
|
||||
$post_author_data = get_userdata($post_data['Author_ID']);
|
||||
$post = get_post($post_id);
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
|
||||
if ( ($user_id == $post_author_data->ID)
|
||||
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|
||||
|| ($author_data->user_level > $post_author_data->user_level)
|
||||
|| ($author_data->user_level >= 10) ) {
|
||||
return true;
|
||||
@@ -479,6 +480,18 @@ function wp_new_comment( $commentdata, $spam = false ) {
|
||||
$now = current_time('mysql');
|
||||
$now_gmt = current_time('mysql', 1);
|
||||
|
||||
if ( $user_id ) {
|
||||
$userdata = get_userdata($user_id);
|
||||
$post_author = $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = '$comment_post_ID' LIMIT 1");
|
||||
}
|
||||
|
||||
// Simple duplicate check
|
||||
$dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$author' ";
|
||||
if ( $email ) $dupe .= "OR comment_author_email = '$email' ";
|
||||
$dupe .= ") AND comment_content = '$comment' LIMIT 1";
|
||||
if ( $wpdb->get_var($dupe) )
|
||||
die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
|
||||
|
||||
// Simple flood-protection
|
||||
if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) {
|
||||
$time_lastcomment = mysql2date('U', $lasttime);
|
||||
@@ -489,13 +502,17 @@ function wp_new_comment( $commentdata, $spam = false ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )
|
||||
if ( $userdata && ( $user_id == $post_author || $userdata->user_level >= 9 ) ) {
|
||||
$approved = 1;
|
||||
else
|
||||
$approved = 0;
|
||||
if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) )
|
||||
$approved = 'spam';
|
||||
|
||||
} else {
|
||||
if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )
|
||||
$approved = 1;
|
||||
else
|
||||
$approved = 0;
|
||||
if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) )
|
||||
$approved = 'spam';
|
||||
}
|
||||
|
||||
$approved = apply_filters('pre_comment_approved', $approved);
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->comments
|
||||
@@ -524,14 +541,18 @@ function do_trackbacks($post_id) {
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $post_id");
|
||||
$to_ping = get_to_ping($post_id);
|
||||
$pinged = get_pung($post_id);
|
||||
$content = strip_tags($post->post_content);
|
||||
$excerpt = strip_tags($post->post_excerpt);
|
||||
$post_title = strip_tags($post->post_title);
|
||||
|
||||
if ( $excerpt )
|
||||
$excerpt = substr($excerpt, 0, 252) . '...';
|
||||
if ( empty($to_ping) )
|
||||
return;
|
||||
if (empty($post->post_excerpt))
|
||||
$excerpt = apply_filters('the_content', $post->post_content);
|
||||
else
|
||||
$excerpt = substr($content, 0, 252) . '...';
|
||||
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
|
||||
$excerpt = str_replace(']]>', ']]>', $excerpt);
|
||||
$excerpt = strip_tags($excerpt);
|
||||
$excerpt = substr($excerpt, 0, 252) . '...';
|
||||
|
||||
$post_title = apply_filters('the_title', $post->post_title);
|
||||
$post_title = strip_tags($post_title);
|
||||
|
||||
if ($to_ping) : foreach ($to_ping as $tb_ping) :
|
||||
$tb_ping = trim($tb_ping);
|
||||
@@ -571,7 +592,7 @@ function get_to_ping($post_id) { // Get any URIs in the todo list
|
||||
global $wpdb;
|
||||
$to_ping = $wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_id");
|
||||
$to_ping = trim($to_ping);
|
||||
$to_ping = preg_split('/\s/', $to_ping);
|
||||
$to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
|
||||
return $to_ping;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
415
wp-includes/gettext.php
Executable file → Normal file
415
wp-includes/gettext.php
Executable file → Normal file
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2003 Danilo Segan <danilo@kvota.net>.
|
||||
|
||||
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
|
||||
|
||||
This file is part of PHP-gettext.
|
||||
|
||||
PHP-gettext is free software; you can redistribute it and/or modify
|
||||
@@ -20,44 +21,91 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// For start, we only want to read the MO files
|
||||
|
||||
/**
|
||||
* Provides a simple gettext replacement that works independently from
|
||||
* the system's gettext abilities.
|
||||
* It can read MO files and use them for translating strings.
|
||||
* The files are passed to gettext_reader as a Stream (see streams.php)
|
||||
*
|
||||
* This version has the ability to cache all strings and translations to
|
||||
* speed up the string lookup.
|
||||
* While the cache is enabled by default, it can be switched off with the
|
||||
* second parameter in the constructor (e.g. whenusing very large MO files
|
||||
* that you don't want to keep in memory)
|
||||
*/
|
||||
class gettext_reader {
|
||||
//public:
|
||||
var $error = 0; // public variable that holds error code (0 if no error)
|
||||
//private:
|
||||
var $BYTEORDER = 0;
|
||||
//public:
|
||||
var $error = 0; // public variable that holds error code (0 if no error)
|
||||
|
||||
//private:
|
||||
var $BYTEORDER = 0; // 0: low endian, 1: big endian
|
||||
var $STREAM = NULL;
|
||||
var $short_circuit = false;
|
||||
var $enable_cache = false;
|
||||
var $originals = NULL; // offset of original table
|
||||
var $translations = NULL; // offset of translation table
|
||||
var $pluralheader = NULL; // cache header field for plural forms
|
||||
var $total = 0; // total string count
|
||||
var $table_originals = NULL; // table for original strings (offsets)
|
||||
var $table_translations = NULL; // table for translated strings (offsets)
|
||||
var $cache_translations = NULL; // original -> translation mapping
|
||||
|
||||
|
||||
/* Methods */
|
||||
|
||||
|
||||
/**
|
||||
* Reads a 32bit Integer from the Stream
|
||||
*
|
||||
* @access private
|
||||
* @return Integer from the Stream
|
||||
*/
|
||||
function readint() {
|
||||
// Reads 4 byte value from $FD and puts it in int
|
||||
// $BYTEORDER specifies the byte order: 0 low endian, 1 big endian
|
||||
for ($i=0; $i<4; $i++) {
|
||||
$byte[$i]=ord($this->STREAM->read(1));
|
||||
if ($this->BYTEORDER == 0) {
|
||||
// low endian
|
||||
return array_shift(unpack('V', $this->STREAM->read(4)));
|
||||
} else {
|
||||
// big endian
|
||||
return array_shift(unpack('N', $this->STREAM->read(4)));
|
||||
}
|
||||
}
|
||||
//print sprintf("pos: %d\n",$this->STREAM->currentpos());
|
||||
if ($this->BYTEORDER == 0)
|
||||
return (int)(($byte[0]) | ($byte[1]<<8) | ($byte[2]<<16) | ($byte[3]<<24));
|
||||
else
|
||||
return (int)(($byte[3]) | ($byte[2]<<8) | ($byte[1]<<16) | ($byte[0]<<24));
|
||||
}
|
||||
|
||||
// constructor that requires StreamReader object
|
||||
function gettext_reader($Reader) {
|
||||
/**
|
||||
* Reads an array of Integers from the Stream
|
||||
*
|
||||
* @param int count How many elements should be read
|
||||
* @return Array of Integers
|
||||
*/
|
||||
function readintarray($count) {
|
||||
if ($this->BYTEORDER == 0) {
|
||||
// low endian
|
||||
return unpack('V'.$count, $this->STREAM->read(4 * $count));
|
||||
} else {
|
||||
// big endian
|
||||
return unpack('N'.$count, $this->STREAM->read(4 * $count));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Reader the StreamReader object
|
||||
* @param boolean enable_cache Enable or disable caching of strings (default on)
|
||||
*/
|
||||
function gettext_reader($Reader, $enable_cache = true) {
|
||||
// If there isn't a StreamReader, turn on short circuit mode.
|
||||
if (! $Reader) {
|
||||
$this->short_circuit = true;
|
||||
return;
|
||||
$this->short_circuit = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Caching can be turned off
|
||||
$this->enable_cache = $enable_cache;
|
||||
|
||||
// $MAGIC1 = (int)0x950412de; //bug in PHP 5
|
||||
$MAGIC1 = (int) - 1794895138;
|
||||
// $MAGIC2 = (int)0xde120495; //bug
|
||||
$MAGIC2 = (int) - 569244523;
|
||||
|
||||
// $MAGIC1 = (int)0x950412de; //bug in PHP 5
|
||||
$MAGIC1 = (int) - 1794895138;
|
||||
// $MAGIC2 = (int)0xde120495; //bug
|
||||
$MAGIC2 = (int) - 569244523;
|
||||
|
||||
$this->STREAM = $Reader;
|
||||
$magic = $this->readint();
|
||||
@@ -69,169 +117,242 @@ class gettext_reader {
|
||||
$this->error = 1; // not MO file
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// FIXME: Do we care about revision? We should.
|
||||
$revision = $this->readint();
|
||||
|
||||
$total = $this->readint();
|
||||
$originals = $this->readint();
|
||||
$translations = $this->readint();
|
||||
|
||||
$this->total = $total;
|
||||
$this->originals = $originals;
|
||||
$this->translations = $translations;
|
||||
|
||||
|
||||
$this->total = $this->readint();
|
||||
$this->originals = $this->readint();
|
||||
$this->translations = $this->readint();
|
||||
}
|
||||
|
||||
function load_tables($translations=false) {
|
||||
// if tables are loaded do not load them again
|
||||
if (!is_array($this->ORIGINALS)) {
|
||||
$this->ORIGINALS = array();
|
||||
$this->STREAM->seekto($this->originals);
|
||||
for ($i=0; $i<$this->total; $i++) {
|
||||
$len = $this->readint();
|
||||
$ofs = $this->readint();
|
||||
$this->ORIGINALS[] = array($len,$ofs);
|
||||
|
||||
/**
|
||||
* Loads the translation tables from the MO file into the cache
|
||||
* If caching is enabled, also loads all strings into a cache
|
||||
* to speed up translation lookups
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function load_tables() {
|
||||
if (is_array($this->cache_translations) &&
|
||||
is_array($this->table_originals) &&
|
||||
is_array($this->table_translations))
|
||||
return;
|
||||
|
||||
/* get original and translations tables */
|
||||
$this->STREAM->seekto($this->originals);
|
||||
$this->table_originals = $this->readintarray($this->total * 2);
|
||||
$this->STREAM->seekto($this->translations);
|
||||
$this->table_translations = $this->readintarray($this->total * 2);
|
||||
|
||||
if ($this->enable_cache) {
|
||||
$this->cache_translations = array ();
|
||||
/* read all strings in the cache */
|
||||
for ($i = 0; $i < $this->total; $i++) {
|
||||
$this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
|
||||
$original = $this->STREAM->read($this->table_originals[$i * 2 + 1]);
|
||||
$this->STREAM->seekto($this->table_translations[$i * 2 + 2]);
|
||||
$translation = $this->STREAM->read($this->table_translations[$i * 2 + 1]);
|
||||
$this->cache_translations[$original] = $translation;
|
||||
}
|
||||
}
|
||||
|
||||
// similar for translations
|
||||
if ($translations and !is_array($this->TRANSLATIONS)) {
|
||||
$this->TRANSLATIONS = array();
|
||||
$this->STREAM->seekto($this->translations);
|
||||
for ($i=0; $i<$this->total; $i++) {
|
||||
$len = $this->readint();
|
||||
$ofs = $this->readint();
|
||||
$this->TRANSLATIONS[] = array($len,$ofs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_string_number($num) {
|
||||
// get a string with particular number
|
||||
// TODO: Add simple hashing [check array, add if not already there]
|
||||
$this->load_tables();
|
||||
$meta = $this->ORIGINALS[$num];
|
||||
$length = $meta[0];
|
||||
$offset = $meta[1];
|
||||
if (! $length) {
|
||||
return '';
|
||||
}
|
||||
$this->STREAM->seekto($offset);
|
||||
$data = $this->STREAM->read($length);
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
function get_translation_number($num) {
|
||||
// get a string with particular number
|
||||
// TODO: Add simple hashing [check array, add if not already there]
|
||||
$this->load_tables(true);
|
||||
$meta = $this->TRANSLATIONS[$num];
|
||||
$length = $meta[0];
|
||||
$offset = $meta[1];
|
||||
|
||||
/**
|
||||
* Returns a string from the "originals" table
|
||||
*
|
||||
* @access private
|
||||
* @param int num Offset number of original string
|
||||
* @return string Requested string if found, otherwise ''
|
||||
*/
|
||||
function get_original_string($num) {
|
||||
$length = $this->table_originals[$num * 2 + 1];
|
||||
$offset = $this->table_originals[$num * 2 + 2];
|
||||
if (! $length)
|
||||
return '';
|
||||
$this->STREAM->seekto($offset);
|
||||
$data = $this->STREAM->read($length);
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
// binary search for string
|
||||
function find_string($string, $start,$end) {
|
||||
//print "start: $start, end: $end\n";
|
||||
if (abs($start-$end)<=1) {
|
||||
// we're done, if it's not it, bye bye
|
||||
$txt = $this->get_string_number($start);
|
||||
/**
|
||||
* Returns a string from the "translations" table
|
||||
*
|
||||
* @access private
|
||||
* @param int num Offset number of original string
|
||||
* @return string Requested string if found, otherwise ''
|
||||
*/
|
||||
function get_translation_string($num) {
|
||||
$length = $this->table_translations[$num * 2 + 1];
|
||||
$offset = $this->table_translations[$num * 2 + 2];
|
||||
if (! $length)
|
||||
return '';
|
||||
$this->STREAM->seekto($offset);
|
||||
$data = $this->STREAM->read($length);
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Binary search for string
|
||||
*
|
||||
* @access private
|
||||
* @param string string
|
||||
* @param int start (internally used in recursive function)
|
||||
* @param int end (internally used in recursive function)
|
||||
* @return int string number (offset in originals table)
|
||||
*/
|
||||
function find_string($string, $start = -1, $end = -1) {
|
||||
if (($start == -1) or ($end == -1)) {
|
||||
// find_string is called with only one parameter, set start end end
|
||||
$start = 0;
|
||||
$end = $this->total;
|
||||
}
|
||||
if (abs($start - $end) <= 1) {
|
||||
// We're done, now we either found the string, or it doesn't exist
|
||||
$txt = $this->get_original_string($start);
|
||||
if ($string == $txt)
|
||||
return $start;
|
||||
return $start;
|
||||
else
|
||||
return -1;
|
||||
} elseif ($start>$end) {
|
||||
return $this->find_string($string,$end,$start);
|
||||
} else {
|
||||
$half = (int)(($start+$end)/2);
|
||||
$tst = $this->get_string_number($half);
|
||||
$cmp = strcmp($string,$tst);
|
||||
if ($cmp == 0)
|
||||
return $half;
|
||||
elseif ($cmp<0)
|
||||
return $this->find_string($string,$start,$half);
|
||||
return -1;
|
||||
} else if ($start > $end) {
|
||||
// start > end -> turn around and start over
|
||||
return $this->find_string($string, $end, $start);
|
||||
} else {
|
||||
// Divide table in two parts
|
||||
$half = (int)(($start + $end) / 2);
|
||||
$cmp = strcmp($string, $this->get_original_string($half));
|
||||
if ($cmp == 0)
|
||||
// string is exactly in the middle => return it
|
||||
return $half;
|
||||
else if ($cmp < 0)
|
||||
// The string is in the upper half
|
||||
return $this->find_string($string, $start, $half);
|
||||
else
|
||||
return $this->find_string($string,$half,$end);
|
||||
// The string is in the lower half
|
||||
return $this->find_string($string, $half, $end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates a string
|
||||
*
|
||||
* @access public
|
||||
* @param string string to be translated
|
||||
* @return string translated string (or original, if not found)
|
||||
*/
|
||||
function translate($string) {
|
||||
if ($this->short_circuit) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
$num = $this->find_string($string, 0, $this->total);
|
||||
if ($num == -1)
|
||||
if ($this->short_circuit)
|
||||
return $string;
|
||||
else
|
||||
return $this->get_translation_number($num);
|
||||
}
|
||||
|
||||
function get_plural_forms() {
|
||||
// lets assume message number 0 is header
|
||||
// this is true, right?
|
||||
|
||||
// cache header field for plural forms
|
||||
if (is_string($this->pluralheader))
|
||||
return $this->pluralheader;
|
||||
else {
|
||||
$header = $this->get_translation_number(0);
|
||||
|
||||
if (eregi("plural-forms: (.*)\n",$header,$regs)) {
|
||||
$expr = $regs[1];
|
||||
} else {
|
||||
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
|
||||
}
|
||||
$this->pluralheader = $expr;
|
||||
return $expr;
|
||||
$this->load_tables();
|
||||
|
||||
if ($this->enable_cache) {
|
||||
// Caching enabled, get translated string from cache
|
||||
if (array_key_exists($string, $this->cache_translations))
|
||||
return $this->cache_translations[$string];
|
||||
else
|
||||
return $string;
|
||||
} else {
|
||||
// Caching not enabled, try to find string
|
||||
$num = $this->find_string($string);
|
||||
if ($num == -1)
|
||||
return $string;
|
||||
else
|
||||
return $this->get_translation_string($num);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get possible plural forms from MO header
|
||||
*
|
||||
* @access private
|
||||
* @return string plural form header
|
||||
*/
|
||||
function get_plural_forms() {
|
||||
// lets assume message number 0 is header
|
||||
// this is true, right?
|
||||
$this->load_tables();
|
||||
|
||||
// cache header field for plural forms
|
||||
if (! is_string($this->pluralheader)) {
|
||||
if ($this->enable_cache) {
|
||||
$header = $this->cache_translations[""];
|
||||
} else {
|
||||
$header = $this->get_translation_string(0);
|
||||
}
|
||||
if (eregi("plural-forms: (.*)\n", $header, $regs))
|
||||
$expr = $regs[1];
|
||||
else
|
||||
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
|
||||
$this->pluralheader = $expr;
|
||||
}
|
||||
return $this->pluralheader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects which plural form to take
|
||||
*
|
||||
* @access private
|
||||
* @param n count
|
||||
* @return int array index of the right plural form
|
||||
*/
|
||||
function select_string($n) {
|
||||
$string = $this->get_plural_forms();
|
||||
$string = str_replace('nplurals',"\$total",$string);
|
||||
$string = str_replace("n",$n,$string);
|
||||
$string = str_replace('plural',"\$plural",$string);
|
||||
|
||||
|
||||
$total = 0;
|
||||
$plural = 0;
|
||||
|
||||
eval("$string");
|
||||
if ($plural>=$total) $plural = 0;
|
||||
if ($plural >= $total) $plural = 0;
|
||||
return $plural;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of gettext
|
||||
*
|
||||
* @access public
|
||||
* @param string single
|
||||
* @param string plural
|
||||
* @param string number
|
||||
* @return translated plural form
|
||||
*/
|
||||
function ngettext($single, $plural, $number) {
|
||||
if ($this->short_circuit) {
|
||||
if ($number != 1) return $plural;
|
||||
else return $single;
|
||||
if ($number != 1)
|
||||
return $plural;
|
||||
else
|
||||
return $single;
|
||||
}
|
||||
|
||||
// find out the appropriate form
|
||||
$select = $this->select_string($number);
|
||||
|
||||
|
||||
// this should contains all strings separated by NULLs
|
||||
$result = $this->find_string($single.chr(0).$plural,0,$this->total);
|
||||
if ($result == -1) {
|
||||
if ($number != 1) return $plural;
|
||||
else return $single;
|
||||
} else {
|
||||
$result = $this->get_translation_number($result);
|
||||
$key = $single.chr(0).$plural;
|
||||
|
||||
// lets try to parse all the NUL staff
|
||||
//$result = "proba0".chr(0)."proba1".chr(0)."proba2";
|
||||
$list = explode (chr(0), $result);
|
||||
return $list[$select];
|
||||
|
||||
if ($this->enable_cache) {
|
||||
if (! array_key_exists($key, $this->cache_translations)) {
|
||||
return ($number != 1) ? $plural : $single;
|
||||
} else {
|
||||
$result = $this->cache_translations[$key];
|
||||
$list = explode(chr(0), $result);
|
||||
return $list[$select];
|
||||
}
|
||||
} else {
|
||||
$num = $this->find_string($key);
|
||||
if ($num == -1) {
|
||||
return ($number != 1) ? $plural : $single;
|
||||
} else {
|
||||
$result = $this->get_translation_string($num);
|
||||
$list = explode(chr(0), $result);
|
||||
return $list[$select];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -48,43 +48,73 @@ function bool_from_yn($yn) {
|
||||
** Parameters:
|
||||
** category (no default) - The category to use.
|
||||
**/
|
||||
function wp_get_linksbyname($category) {
|
||||
global $wpdb;
|
||||
function wp_get_linksbyname($category, $args = '') {
|
||||
global $wpdb;
|
||||
|
||||
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_name='$category'");
|
||||
if ($cat) {
|
||||
if ($cat->sort_desc == 'Y') {
|
||||
$cat->sort_order = '_'.$cat->sort_order;
|
||||
}
|
||||
get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all,
|
||||
$cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order,
|
||||
bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating),
|
||||
$cat->list_limit, bool_from_yn($cat->show_updated));
|
||||
}
|
||||
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_name='$category'");
|
||||
|
||||
if (! $cat) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($args)) {
|
||||
if ($cat->sort_desc == 'Y') {
|
||||
$cat->sort_order = '_'.$cat->sort_order;
|
||||
}
|
||||
get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all,
|
||||
$cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order,
|
||||
bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating),
|
||||
$cat->list_limit, bool_from_yn($cat->show_updated));
|
||||
} else {
|
||||
$args = add_query_arg('category', $cat->cat_id, $args);
|
||||
wp_get_links($args);
|
||||
}
|
||||
} // end wp_get_linksbyname
|
||||
|
||||
/** function wp_get_links()
|
||||
** Gets the links associated with category n.
|
||||
** Parameters:
|
||||
** category (no default) - The category to use.
|
||||
** or:
|
||||
** a query string
|
||||
**/
|
||||
function wp_get_links($category) {
|
||||
global $wpdb;
|
||||
function wp_get_links($args = '') {
|
||||
global $wpdb;
|
||||
|
||||
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$category");
|
||||
if ($cat) {
|
||||
if ($cat->sort_desc == 'Y') {
|
||||
$cat->sort_order = '_'.$cat->sort_order;
|
||||
}
|
||||
get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all,
|
||||
$cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order,
|
||||
bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating),
|
||||
$cat->list_limit, bool_from_yn($cat->show_updated));
|
||||
}
|
||||
if (!empty($args) && false === strpos($args, '=')) {
|
||||
// If args is not a query string, it's a category id.
|
||||
$category = $args;
|
||||
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$category");
|
||||
if ($cat) {
|
||||
if ($cat->sort_desc == 'Y') {
|
||||
$cat->sort_order = '_'.$cat->sort_order;
|
||||
}
|
||||
get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all,
|
||||
$cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order,
|
||||
bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating),
|
||||
$cat->list_limit, bool_from_yn($cat->show_updated));
|
||||
}
|
||||
} else {
|
||||
parse_str($args);
|
||||
|
||||
if (! isset($category)) $category = -1;
|
||||
if (! isset($before)) $before = '';
|
||||
if (! isset($after)) $after = '<br />';
|
||||
if (! isset($between)) $between = ' ';
|
||||
if (! isset($show_images)) $show_images = true;
|
||||
if (! isset($orderby)) $orderby = 'name';
|
||||
if (! isset($show_description)) $show_description = true;
|
||||
if (! isset($show_rating)) $show_rating = false;
|
||||
if (! isset($limit)) $limit = -1;
|
||||
if (! isset($show_updated)) $show_updated = 1;
|
||||
if (! isset($echo)) $echo = true;
|
||||
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo);
|
||||
}
|
||||
} // end wp_get_links
|
||||
|
||||
/** function get_links()
|
||||
@@ -168,20 +198,27 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||
if (!$results) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = "";
|
||||
|
||||
foreach ($results as $row) {
|
||||
if (!isset($row->recently_updated)) $row->recently_updated = false;
|
||||
echo($before);
|
||||
$output .= ($before);
|
||||
|
||||
if ($show_updated && $row->recently_updated) {
|
||||
echo get_settings('links_recently_updated_prepend');
|
||||
$output .= get_settings('links_recently_updated_prepend');
|
||||
}
|
||||
|
||||
$the_link = '#';
|
||||
if (($row->link_url != null) && ($row->link_url != '')) {
|
||||
$the_link = $row->link_url;
|
||||
}
|
||||
|
||||
if ( !empty($row->link_url) )
|
||||
$the_link = wp_specialchars($row->link_url);
|
||||
$rel = $row->link_rel;
|
||||
|
||||
if ($rel != '') {
|
||||
$rel = " rel='$rel'";
|
||||
}
|
||||
|
||||
$desc = wp_specialchars($row->link_description, ENT_QUOTES);
|
||||
$name = wp_specialchars($row->link_name, ENT_QUOTES);
|
||||
|
||||
@@ -203,27 +240,37 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||
if ('' != $target) {
|
||||
$target = " target='$target'";
|
||||
}
|
||||
echo("<a href='$the_link'");
|
||||
echo($rel . $title . $target);
|
||||
echo('>');
|
||||
|
||||
$output.= "<a href='$the_link'";
|
||||
$output.= $rel . $title . $target;
|
||||
$output.= '>';
|
||||
|
||||
if (($row->link_image != null) && $show_images) {
|
||||
if (strstr($row->link_image, 'http'))
|
||||
echo "<img src='$row->link_image' $alt $title />";
|
||||
$output.= "<img src='$row->link_image' $alt $title />";
|
||||
else // If it's a relative path
|
||||
echo "<img src='" . get_settings('siteurl') . "$row->link_image' $alt $title />";
|
||||
$output.= "<img src='" . get_settings('siteurl') . "$row->link_image' $alt $title />";
|
||||
} else {
|
||||
echo($name);
|
||||
$output.= $name;
|
||||
}
|
||||
echo('</a>');
|
||||
|
||||
$output.= '</a>';
|
||||
|
||||
if ($show_updated && $row->recently_updated) {
|
||||
echo get_settings('links_recently_updated_append');
|
||||
$output.= get_settings('links_recently_updated_append');
|
||||
}
|
||||
|
||||
if ($show_description && ($desc != '')) {
|
||||
echo($between.$desc);
|
||||
$output.= $between.$desc;
|
||||
}
|
||||
echo("$after\n");
|
||||
$output.= "$after\n";
|
||||
} // end while
|
||||
|
||||
if($echo) {
|
||||
echo $output;
|
||||
} else {
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
269
wp-includes/pluggable-functions.php
Normal file
269
wp-includes/pluggable-functions.php
Normal file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
/* These functions can be replaced via plugins. They are loaded after
|
||||
plugins are loaded. */
|
||||
|
||||
|
||||
if ( !function_exists('get_currentuserinfo') ) :
|
||||
function get_currentuserinfo() {
|
||||
global $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5, $user_identity;
|
||||
// *** retrieving user's data from cookies and db - no spoofing
|
||||
|
||||
if (isset($_COOKIE['wordpressuser_' . COOKIEHASH]))
|
||||
$user_login = $_COOKIE['wordpressuser_' . COOKIEHASH];
|
||||
$userdata = get_userdatabylogin($user_login);
|
||||
$user_level = $userdata->user_level;
|
||||
$user_ID = $userdata->ID;
|
||||
$user_nickname = $userdata->user_nickname;
|
||||
$user_email = $userdata->user_email;
|
||||
$user_url = $userdata->user_url;
|
||||
$user_pass_md5 = md5($userdata->user_pass);
|
||||
|
||||
$idmode = $userdata->user_idmode;
|
||||
if ($idmode == 'nickname') $user_identity = $userdata->user_nickname;
|
||||
if ($idmode == 'login') $user_identity = $userdata->user_login;
|
||||
if ($idmode == 'firstname') $user_identity = $userdata->user_firstname;
|
||||
if ($idmode == 'lastname') $user_identity = $userdata->user_lastname;
|
||||
if ($idmode == 'namefl') $user_identity = $userdata->user_firstname.' '.$userdata->user_lastname;
|
||||
if ($idmode == 'namelf') $user_identity = $userdata->user_lastname.' '.$userdata->user_firstname;
|
||||
if (!$idmode) $user_identity = $userdata->user_nickname;
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('get_userdata') ) :
|
||||
function get_userdata($userid) {
|
||||
global $wpdb, $cache_userdata;
|
||||
$userid = (int) $userid;
|
||||
if ( empty($cache_userdata[$userid]) && $userid != 0) {
|
||||
$cache_userdata[$userid] = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = $userid");
|
||||
$cache_userdata[$cache_userdata[$userid]->user_login] =& $cache_userdata[$userid];
|
||||
}
|
||||
|
||||
return $cache_userdata[$userid];
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('get_userdatabylogin') ) :
|
||||
function get_userdatabylogin($user_login) {
|
||||
global $cache_userdata, $wpdb;
|
||||
if ( !empty($user_login) && empty($cache_userdata[$user_login]) ) {
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'"); /* todo: get rid of this intermediate var */
|
||||
$cache_userdata[$user->ID] = $user;
|
||||
$cache_userdata[$user_login] =& $cache_userdata[$user->ID];
|
||||
} else {
|
||||
$user = $cache_userdata[$user_login];
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('wp_mail') ) :
|
||||
function wp_mail($to, $subject, $message, $headers = '') {
|
||||
if( $headers == '' ) {
|
||||
$headers = "MIME-Version: 1.0\n" .
|
||||
"From: " . get_settings('admin_email') . "\n" .
|
||||
"Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
|
||||
}
|
||||
|
||||
return @mail($to, $subject, $message, $headers);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('wp_login') ) :
|
||||
function wp_login($username, $password, $already_md5 = false) {
|
||||
global $wpdb, $error;
|
||||
|
||||
if ( !$username )
|
||||
return false;
|
||||
|
||||
if ( !$password ) {
|
||||
$error = __('<strong>Error</strong>: The password field is empty.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
|
||||
|
||||
if (!$login) {
|
||||
$error = __('<strong>Error</strong>: Wrong username.');
|
||||
return false;
|
||||
} else {
|
||||
// If the password is already_md5, it has been double hashed.
|
||||
// Otherwise, it is plain text.
|
||||
if ( ($already_md5 && $login->user_login == $username && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) {
|
||||
return true;
|
||||
} else {
|
||||
$error = __('<strong>Error</strong>: Incorrect password.');
|
||||
$pwd = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('auth_redirect') ) :
|
||||
function auth_redirect() {
|
||||
// Checks if a user is logged in, if not redirects them to the login page
|
||||
if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) &&
|
||||
!wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true)) ||
|
||||
(empty($_COOKIE['wordpressuser_' . COOKIEHASH])) ) {
|
||||
header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate, max-age=0');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
// Cookie safe redirect. Works around IIS Set-Cookie bug.
|
||||
// http://support.microsoft.com/kb/q176113/
|
||||
if ( !function_exists('wp_redirect') ) :
|
||||
function wp_redirect($location) {
|
||||
global $is_IIS;
|
||||
|
||||
if ($is_IIS)
|
||||
header("Refresh: 0;url=$location");
|
||||
else
|
||||
header("Location: $location");
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('wp_setcookie') ) :
|
||||
function wp_setcookie($username, $password, $already_md5 = false, $home = '', $siteurl = '') {
|
||||
if ( !$already_md5 )
|
||||
$password = md5( md5($password) ); // Double hash the password in the cookie.
|
||||
|
||||
if ( empty($home) )
|
||||
$cookiepath = COOKIEPATH;
|
||||
else
|
||||
$cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' );
|
||||
|
||||
if ( empty($siteurl) ) {
|
||||
$sitecookiepath = SITECOOKIEPATH;
|
||||
$cookiehash = COOKIEHASH;
|
||||
} else {
|
||||
$sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' );
|
||||
$cookiehash = md5($siteurl);
|
||||
}
|
||||
|
||||
setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $cookiepath);
|
||||
setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $cookiepath);
|
||||
|
||||
if ( $cookiepath != $sitecookiepath ) {
|
||||
setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $sitecookiepath);
|
||||
setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $sitecookiepath);
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( !function_exists('wp_clearcookie') ) :
|
||||
function wp_clearcookie() {
|
||||
setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH);
|
||||
setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH);
|
||||
setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH);
|
||||
setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists('wp_notify_postauthor') ) :
|
||||
function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
global $wpdb;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
|
||||
|
||||
if ('' == $user->user_email) return false; // If there's no email to send the comment to
|
||||
|
||||
$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";
|
||||
$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
|
||||
$notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
|
||||
$notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
|
||||
$notify_message .= __('You can see all comments on this post here: ') . "\r\n";
|
||||
$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
|
||||
} elseif ('trackback' == $comment_type) {
|
||||
$notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
|
||||
$notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
|
||||
$notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
|
||||
$notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
|
||||
$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
|
||||
} elseif ('pingback' == $comment_type) {
|
||||
$notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
|
||||
$notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
|
||||
$notify_message .= __('Excerpt: ') . "\r\n" . sprintf( __('[...] %s [...]'), $comment->comment_content ) . "\r\n\r\n";
|
||||
$notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
|
||||
$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
|
||||
}
|
||||
$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>";
|
||||
}
|
||||
|
||||
$message_headers = "MIME-Version: 1.0\n"
|
||||
. "$from\n"
|
||||
. "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
|
||||
|
||||
@wp_mail($user->user_email, $subject, $notify_message, $message_headers);
|
||||
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
|
||||
/* wp_notify_moderator
|
||||
notifies the moderator of the blog (usually the admin)
|
||||
about a new comment that waits for approval
|
||||
always returns true
|
||||
*/
|
||||
if ( !function_exists('wp_notify_moderator') ) :
|
||||
function wp_notify_moderator($comment_id) {
|
||||
global $wpdb;
|
||||
|
||||
if( get_settings( "moderation_notify" ) == 0 )
|
||||
return true;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
|
||||
|
||||
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
|
||||
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
|
||||
|
||||
$notify_message = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";
|
||||
$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
|
||||
$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
|
||||
$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
|
||||
$notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
|
||||
$notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
|
||||
$notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
|
||||
$notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\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";
|
||||
$notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";
|
||||
$notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
|
||||
|
||||
$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title );
|
||||
$admin_email = get_settings("admin_email");
|
||||
|
||||
@wp_mail($admin_email, $subject, $notify_message);
|
||||
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
|
||||
?>
|
||||
38
wp-includes/streams.php
Executable file → Normal file
38
wp-includes/streams.php
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2003 Danilo Segan <danilo@kvota.net>.
|
||||
Copyright (c) 2003, 2005 Danilo Segan <danilo@kvota.net>.
|
||||
|
||||
This file is part of PHP-gettext.
|
||||
|
||||
@@ -103,11 +103,13 @@ class FileReader {
|
||||
}
|
||||
|
||||
function read($bytes) {
|
||||
fseek($this->_fd, $this->_pos);
|
||||
$data = fread($this->_fd, $bytes);
|
||||
$this->_pos = ftell($this->_fd);
|
||||
|
||||
return $data;
|
||||
if ($bytes) {
|
||||
fseek($this->_fd, $this->_pos);
|
||||
$data = fread($this->_fd, $bytes);
|
||||
$this->_pos = ftell($this->_fd);
|
||||
|
||||
return $data;
|
||||
} else return '';
|
||||
}
|
||||
|
||||
function seekto($pos) {
|
||||
@@ -130,4 +132,28 @@ class FileReader {
|
||||
|
||||
}
|
||||
|
||||
// Preloads entire file in memory first, then creates a StringReader
|
||||
// over it (it assumes knowledge of StringReader internals)
|
||||
class CachedFileReader extends StringReader {
|
||||
function CachedFileReader($filename) {
|
||||
if (file_exists($filename)) {
|
||||
|
||||
$length=filesize($filename);
|
||||
$fd = fopen($filename,'rb');
|
||||
|
||||
if (!$fd) {
|
||||
$this->error = 3; // Cannot read file, probably permissions
|
||||
return false;
|
||||
}
|
||||
$this->_str = fread($fd, $length);
|
||||
fclose($fd);
|
||||
|
||||
} else {
|
||||
$this->error = 2; // File doesn't exist
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -156,7 +156,7 @@ function wp_list_authors($args = '') {
|
||||
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
|
||||
global $wpdb;
|
||||
|
||||
$query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname";
|
||||
$query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY user_nickname";
|
||||
$authors = $wpdb->get_results($query);
|
||||
|
||||
foreach($authors as $author) {
|
||||
|
||||
@@ -1,43 +1,36 @@
|
||||
<?php
|
||||
|
||||
function get_the_category($id = false) {
|
||||
global $post, $wpdb, $category_cache;
|
||||
global $post, $category_cache;
|
||||
|
||||
if (! $id) {
|
||||
$id = $post->ID;
|
||||
}
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
|
||||
if ($category_cache[$id]) {
|
||||
$categories = $category_cache[$id];
|
||||
} else {
|
||||
$categories = $wpdb->get_results("
|
||||
SELECT category_id, cat_name, category_nicename, category_description, category_parent
|
||||
FROM $wpdb->categories, $wpdb->post2cat
|
||||
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$id'
|
||||
");
|
||||
|
||||
}
|
||||
if ( ! isset($category_cache[$id]) )
|
||||
update_post_category_cache($id);
|
||||
|
||||
if (!empty($categories))
|
||||
sort($categories);
|
||||
$categories = $category_cache[$id];
|
||||
|
||||
return $categories;
|
||||
if (!empty($categories))
|
||||
sort($categories);
|
||||
else
|
||||
$categories = array();
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
function get_category_link($category_id) {
|
||||
global $wpdb, $wp_rewrite, $querystring_start, $querystring_equal, $cache_categories;
|
||||
global $wp_rewrite;
|
||||
$catlink = $wp_rewrite->get_category_permastruct();
|
||||
|
||||
if ( empty($catlink) ) {
|
||||
$file = get_settings('home') . '/' . get_settings('blogfilename');
|
||||
$catlink = $file . '?cat=' . $category_id;
|
||||
} else {
|
||||
if ($cache_categories[$category_id]->category_nicename)
|
||||
$category_nicename = $cache_categories[$category_id]->category_nicename;
|
||||
else
|
||||
$category_nicename = $wpdb->get_var('SELECT category_nicename FROM ' . $wpdb->categories . ' WHERE cat_ID=' . $category_id);
|
||||
$category = &get_category($category_id);
|
||||
$category_nicename = $category->category_nicename;
|
||||
|
||||
if ($parent = $cache_categories[$category_id]->category_parent)
|
||||
if ($parent = $category->category_parent)
|
||||
$category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/';
|
||||
|
||||
$catlink = str_replace('%category%', $category_nicename, $catlink);
|
||||
@@ -46,11 +39,10 @@ function get_category_link($category_id) {
|
||||
return apply_filters('category_link', $catlink, $category_id);
|
||||
}
|
||||
|
||||
function the_category($separator = '', $parents='') {
|
||||
function get_the_category_list($separator = '', $parents='') {
|
||||
$categories = get_the_category();
|
||||
if (empty($categories)) {
|
||||
_e('Uncategorized');
|
||||
return;
|
||||
return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
|
||||
}
|
||||
|
||||
$thelist = '';
|
||||
@@ -64,10 +56,10 @@ function the_category($separator = '', $parents='') {
|
||||
if ($category->category_parent) {
|
||||
$thelist .= get_category_parents($category->category_parent, TRUE);
|
||||
}
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
break;
|
||||
case 'single':
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">';
|
||||
if ($category->category_parent) {
|
||||
$thelist .= get_category_parents($category->category_parent, FALSE);
|
||||
}
|
||||
@@ -75,7 +67,7 @@ function the_category($separator = '', $parents='') {
|
||||
break;
|
||||
case '':
|
||||
default:
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
}
|
||||
}
|
||||
$thelist .= '</ul>';
|
||||
@@ -87,38 +79,36 @@ function the_category($separator = '', $parents='') {
|
||||
switch(strtolower($parents)) {
|
||||
case 'multiple':
|
||||
if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, TRUE);
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
break;
|
||||
case 'single':
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';
|
||||
if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, FALSE);
|
||||
$thelist .= "$category->cat_name</a>";
|
||||
break;
|
||||
case '':
|
||||
default:
|
||||
$thelist .= '<a href="' . get_category_link($category->category_id) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
echo apply_filters('the_category', $thelist, $separator, $parents);
|
||||
return apply_filters('the_category', $thelist, $separator, $parents);
|
||||
}
|
||||
|
||||
function the_category($separator = '', $parents='') {
|
||||
echo get_the_category_list($separator, $parents);
|
||||
}
|
||||
|
||||
function get_the_category_by_ID($cat_ID) {
|
||||
global $cache_categories, $wpdb;
|
||||
if ( !$cache_categories[$cat_ID] ) {
|
||||
$cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
|
||||
$cache_categories[$cat_ID]->cat_name = $cat_name;
|
||||
} else {
|
||||
$cat_name = $cache_categories[$cat_ID]->cat_name;
|
||||
}
|
||||
return($cat_name);
|
||||
$cat_ID = (int) $cat_ID;
|
||||
$category = &get_category($cat_ID);
|
||||
return $category->cat_name;
|
||||
}
|
||||
|
||||
function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
|
||||
global $cache_categories;
|
||||
$chain = '';
|
||||
$parent = $cache_categories[$id];
|
||||
$parent = &get_category($id);
|
||||
if ($nicename) {
|
||||
$name = $parent->category_nicename;
|
||||
} else {
|
||||
@@ -134,23 +124,27 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
|
||||
}
|
||||
|
||||
function get_category_children($id, $before = '/', $after = '') {
|
||||
global $cache_categories;
|
||||
$c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy
|
||||
$chain = '';
|
||||
foreach ($c_cache as $category){
|
||||
if ($category->category_parent == $id){
|
||||
$chain .= $before.$category->cat_ID.$after;
|
||||
$chain .= get_category_children($category->cat_ID, $before, $after);
|
||||
}
|
||||
}
|
||||
return $chain;
|
||||
global $cache_categories;
|
||||
|
||||
if ( ! isset($cache_categories))
|
||||
update_category_cache();
|
||||
|
||||
$c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy
|
||||
$chain = '';
|
||||
foreach ($c_cache as $category){
|
||||
if ($category->category_parent == $id){
|
||||
$chain .= $before.$category->cat_ID.$after;
|
||||
$chain .= get_category_children($category->cat_ID, $before, $after);
|
||||
}
|
||||
}
|
||||
return $chain;
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
function the_category_ID($echo = true) {
|
||||
// Grab the first cat in the list.
|
||||
$categories = get_the_category();
|
||||
$cat = $categories[0]->category_id;
|
||||
$cat = $categories[0]->cat_ID;
|
||||
|
||||
if ($echo) echo $cat;
|
||||
|
||||
@@ -172,11 +166,10 @@ function the_category_head($before='', $after='') {
|
||||
}
|
||||
|
||||
function category_description($category = 0) {
|
||||
global $cat, $wpdb, $cache_categories;
|
||||
global $cat;
|
||||
if (!$category) $category = $cat;
|
||||
$category_description = $cache_categories[$category]->category_description;
|
||||
$category_description = apply_filters('category_description', $category_description, $category);
|
||||
return $category_description;
|
||||
$category = & get_category($category);
|
||||
return apply_filters('category_description', $category->category_description, $category->cat_ID);
|
||||
}
|
||||
|
||||
// out of the WordPress loop
|
||||
@@ -208,9 +201,9 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
echo "<select name='cat' class='postform'>\n";
|
||||
if (intval($optionall) == 1) {
|
||||
$all = apply_filters('list_cats', $all);
|
||||
echo "\t<option value='all'>$all</option>\n";
|
||||
echo "\t<option value='0'>$all</option>\n";
|
||||
}
|
||||
if (intval($optionnone) == 1) echo "\t<option value='0'>None</option>\n";
|
||||
if (intval($optionnone) == 1) echo "\t<option value='-1'>".__('None')."</option>\n";
|
||||
if ($categories) {
|
||||
foreach ($categories as $category) {
|
||||
$cat_name = apply_filters('list_cats', $category->cat_name, $category);
|
||||
@@ -269,27 +262,20 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
}
|
||||
}
|
||||
|
||||
if ($hide_empty) {
|
||||
$categories = array();
|
||||
$extra_fields = 'cat_name, category_nicename, category_description,';
|
||||
} else {
|
||||
if (intval($categories)==0 && !$hide_empty){
|
||||
$sort_column = 'cat_'.$sort_column;
|
||||
if (intval($categories)==0){
|
||||
$sort_column = 'cat_'.$sort_column;
|
||||
|
||||
$query = "
|
||||
SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
|
||||
FROM $wpdb->categories
|
||||
WHERE cat_ID > 0 $exclusions
|
||||
ORDER BY $sort_column $sort_order";
|
||||
$query = "
|
||||
SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
|
||||
FROM $wpdb->categories
|
||||
WHERE cat_ID > 0 $exclusions
|
||||
ORDER BY $sort_column $sort_order";
|
||||
|
||||
$categories = $wpdb->get_results($query);
|
||||
}
|
||||
$extra_fields = '';
|
||||
$categories = $wpdb->get_results($query);
|
||||
}
|
||||
|
||||
if (!count($category_posts)) {
|
||||
$now = current_time('mysql', 1);
|
||||
$cat_counts = $wpdb->get_results(" SELECT cat_ID, $extra_fields
|
||||
$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)
|
||||
@@ -301,9 +287,6 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
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 ($hide_empty) {
|
||||
$categories[] = $cat_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,7 +391,7 @@ function in_category($category) { // Check if the current post is in the given c
|
||||
global $post, $category_cache;
|
||||
$cats = '';
|
||||
foreach ($category_cache[$post->ID] as $cat) :
|
||||
$cats[] = $cat->category_id;
|
||||
$cats[] = $cat->cat_ID;
|
||||
endforeach;
|
||||
|
||||
if ( in_array($category, $cats) )
|
||||
@@ -416,4 +399,4 @@ function in_category($category) { // Check if the current post is in the given c
|
||||
else
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -25,10 +25,10 @@ function get_sidebar() {
|
||||
|
||||
|
||||
function wp_loginout() {
|
||||
global $user_level;
|
||||
global $user_ID;
|
||||
get_currentuserinfo();
|
||||
|
||||
if (0 == $user_level) :
|
||||
if ('' == $user_ID) :
|
||||
$link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>';
|
||||
else :
|
||||
$link = '<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>';
|
||||
@@ -38,13 +38,13 @@ function wp_loginout() {
|
||||
}
|
||||
|
||||
function wp_register( $before = '<li>', $after = '</li>' ) {
|
||||
global $user_level;
|
||||
global $user_ID;
|
||||
|
||||
get_currentuserinfo();
|
||||
|
||||
if (0 == $user_level && get_settings('users_can_register') ) :
|
||||
if ('' == $user_ID && get_settings('users_can_register') ) :
|
||||
$link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
|
||||
elseif (0 == $user_level && !get_settings('users_can_register') ) :
|
||||
elseif ('' == $user_ID && !get_settings('users_can_register') ) :
|
||||
$link = '';
|
||||
else :
|
||||
$link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
|
||||
@@ -193,8 +193,8 @@ function single_post_title($prefix = '', $display = true) {
|
||||
if (!$p) {
|
||||
$p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'");
|
||||
}
|
||||
$post_data = get_postdata($p);
|
||||
$title = $post_data['Title'];
|
||||
$post = & get_post($p);
|
||||
$title = $post->post_title;
|
||||
$title = apply_filters('single_post_title', $title);
|
||||
if ($display) {
|
||||
echo $prefix.strip_tags($title);
|
||||
@@ -205,16 +205,16 @@ function single_post_title($prefix = '', $display = true) {
|
||||
}
|
||||
|
||||
function single_cat_title($prefix = '', $display = true ) {
|
||||
$cat = get_query_var('cat');
|
||||
if(!empty($cat) && !(strtoupper($cat) == 'ALL')) {
|
||||
$my_cat_name = get_the_category_by_ID($cat);
|
||||
if(!empty($my_cat_name)) {
|
||||
if ($display)
|
||||
echo $prefix.strip_tags($my_cat_name);
|
||||
else
|
||||
return strip_tags($my_cat_name);
|
||||
}
|
||||
}
|
||||
$cat = intval( get_query_var('cat') );
|
||||
if( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
|
||||
$my_cat_name = get_the_category_by_ID($cat);
|
||||
if( !empty($my_cat_name) ) {
|
||||
if ($display)
|
||||
echo $prefix.strip_tags($my_cat_name);
|
||||
else
|
||||
return strip_tags($my_cat_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function single_month_title($prefix = '', $display = true ) {
|
||||
@@ -275,11 +275,6 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
|
||||
// this is what will separate dates on weekly archive links
|
||||
$archive_week_separator = '–';
|
||||
|
||||
// archive link url
|
||||
$archive_link_m = get_settings('siteurl') . '/?m='; # monthly archive;
|
||||
$archive_link_w = get_settings('siteurl') . '/?w='; # weekly archive;
|
||||
$archive_link_p = get_settings('siteurl') . '/?p='; # post-by-post archive;
|
||||
|
||||
// over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride
|
||||
$archive_date_format_over_ride = 0;
|
||||
|
||||
@@ -347,11 +342,11 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
|
||||
}
|
||||
}
|
||||
} elseif ('postbypost' == $type) {
|
||||
$arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
|
||||
$arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
|
||||
if ($arcresults) {
|
||||
foreach ($arcresults as $arcresult) {
|
||||
if ($arcresult->post_date != '0000-00-00 00:00:00') {
|
||||
$url = get_permalink($arcresult->ID);
|
||||
$url = get_permalink($arcresult);
|
||||
$arc_title = $arcresult->post_title;
|
||||
if ($arc_title) {
|
||||
$text = strip_tags($arc_title);
|
||||
|
||||
@@ -22,9 +22,7 @@ function permalink_anchor($mode = 'id') {
|
||||
}
|
||||
}
|
||||
|
||||
function get_permalink($id = false) {
|
||||
global $post, $wpdb;
|
||||
|
||||
function get_permalink($id = 0) {
|
||||
$rewritecode = array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
@@ -39,29 +37,24 @@ function get_permalink($id = false) {
|
||||
'%pagename%'
|
||||
);
|
||||
|
||||
if ($id) {
|
||||
$idpost = $wpdb->get_row("SELECT ID, post_date, post_name, post_status, post_author FROM $wpdb->posts WHERE ID = $id");
|
||||
} else {
|
||||
$idpost = $post;
|
||||
}
|
||||
|
||||
if ($idpost->post_status == 'static') {
|
||||
return get_page_link($idpost->ID);
|
||||
$post = & get_post($id);
|
||||
if ($post->post_status == 'static') {
|
||||
return get_page_link($post->ID);
|
||||
}
|
||||
|
||||
$permalink = get_settings('permalink_structure');
|
||||
|
||||
if ('' != $permalink) {
|
||||
$unixtime = strtotime($idpost->post_date);
|
||||
if ('' != $permalink && 'draft' != $post->post_status) {
|
||||
$unixtime = strtotime($post->post_date);
|
||||
|
||||
$category = '';
|
||||
if (strstr($permalink, '%category%')) {
|
||||
$cats = get_the_category($idpost->ID);
|
||||
$cats = get_the_category($post->ID);
|
||||
$category = $cats[0]->category_nicename;
|
||||
if ($parent=$cats[0]->category_parent) $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
|
||||
}
|
||||
|
||||
$authordata = get_userdata($idpost->post_author);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$author = $authordata->user_nicename;
|
||||
$rewritereplace =
|
||||
array(
|
||||
@@ -71,16 +64,16 @@ function get_permalink($id = false) {
|
||||
date('H', $unixtime),
|
||||
date('i', $unixtime),
|
||||
date('s', $unixtime),
|
||||
$idpost->post_name,
|
||||
$idpost->ID,
|
||||
$post->post_name,
|
||||
$post->ID,
|
||||
$category,
|
||||
$author,
|
||||
$idpost->post_name,
|
||||
$post->post_name,
|
||||
);
|
||||
return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $idpost);
|
||||
return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post);
|
||||
} else { // if they're not using the fancy permalink option
|
||||
$permalink = get_settings('home') . '/?p=' . $idpost->ID;
|
||||
return apply_filters('post_link', $permalink, $idpost);
|
||||
$permalink = get_settings('home') . '/?p=' . $post->ID;
|
||||
return apply_filters('post_link', $permalink, $post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,9 +161,9 @@ function get_feed_link($feed='rss2') {
|
||||
$output = get_settings('home') . $permalink;
|
||||
} else {
|
||||
if ( false !== strpos($feed, 'comments_') )
|
||||
$feed = str_replace('comments_', 'comments', $feed);
|
||||
$feed = str_replace('comments_', 'comments-', $feed);
|
||||
|
||||
$output = get_settings('siteurl') . "/wp-{$feed}.php";
|
||||
$output = get_settings('home') . "/?feed={$feed}";
|
||||
}
|
||||
|
||||
return apply_filters('feed_link', $output, $feed);
|
||||
@@ -205,59 +198,69 @@ function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
|
||||
// Navigation links
|
||||
|
||||
function get_previous_post($in_same_cat = false, $excluded_categories = '') {
|
||||
global $post, $wpdb;
|
||||
global $post, $wpdb;
|
||||
|
||||
if(! is_single()) {
|
||||
return null;
|
||||
}
|
||||
if(! is_single()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$current_post_date = $post->post_date;
|
||||
$current_category = $post->post_category;
|
||||
$current_post_date = $post->post_date;
|
||||
|
||||
$sqlcat = '';
|
||||
if ($in_same_cat) {
|
||||
$sqlcat = " AND post_category = '$current_category' ";
|
||||
}
|
||||
$join = '';
|
||||
if ($in_same_cat) {
|
||||
$join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
|
||||
$cat_array = get_the_category($post->ID);
|
||||
$join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);
|
||||
for ($i = 1; $i < (count($cat_array)); $i++) {
|
||||
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
|
||||
}
|
||||
$join .= ')';
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
if (!empty($excluded_categories)) {
|
||||
$blah = explode('and', $excluded_categories);
|
||||
foreach($blah as $category) {
|
||||
$category = intval($category);
|
||||
$sql_exclude_cats .= " AND post_category != $category";
|
||||
}
|
||||
}
|
||||
$sql_exclude_cats = '';
|
||||
if (!empty($excluded_categories)) {
|
||||
$blah = explode('and', $excluded_categories);
|
||||
foreach($blah as $category) {
|
||||
$category = intval($category);
|
||||
$sql_exclude_cats .= " AND post_category != $category";
|
||||
}
|
||||
}
|
||||
|
||||
return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1");
|
||||
return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1");
|
||||
}
|
||||
|
||||
function get_next_post($in_same_cat = false, $excluded_categories = '') {
|
||||
global $post, $wpdb;
|
||||
global $post, $wpdb;
|
||||
|
||||
if(! is_single()) {
|
||||
return null;
|
||||
}
|
||||
if(! is_single()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$current_post_date = $post->post_date;
|
||||
$current_category = $post->post_category;
|
||||
$current_post_date = $post->post_date;
|
||||
|
||||
$sqlcat = '';
|
||||
if ($in_same_cat) {
|
||||
$sqlcat = " AND post_category = '$current_category' ";
|
||||
}
|
||||
$join = '';
|
||||
if ($in_same_cat) {
|
||||
$join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
|
||||
$cat_array = get_the_category($post->ID);
|
||||
$join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);
|
||||
for ($i = 1; $i < (count($cat_array)); $i++) {
|
||||
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
|
||||
}
|
||||
$join .= ')';
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
if (!empty($excluded_categories)) {
|
||||
$blah = explode('and', $excluded_categories);
|
||||
foreach($blah as $category) {
|
||||
$category = intval($category);
|
||||
$sql_exclude_cats .= " AND post_category != $category";
|
||||
}
|
||||
}
|
||||
$sql_exclude_cats = '';
|
||||
if (!empty($excluded_categories)) {
|
||||
$blah = explode('and', $excluded_categories);
|
||||
foreach($blah as $category) {
|
||||
$category = intval($category);
|
||||
$sql_exclude_cats .= " AND post_category != $category";
|
||||
}
|
||||
}
|
||||
|
||||
$now = current_time('mysql');
|
||||
$now = current_time('mysql');
|
||||
|
||||
return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats AND ID != $post->ID ORDER BY post_date ASC LIMIT 1");
|
||||
return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts $join WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats AND ID != $post->ID ORDER BY post_date ASC LIMIT 1");
|
||||
}
|
||||
|
||||
function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
|
||||
@@ -300,139 +303,113 @@ function next_post_link($format='%link »', $link='%title', $in_same_cat =
|
||||
echo $format;
|
||||
}
|
||||
|
||||
// Deprecated. Use previous_post_link().
|
||||
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
|
||||
global $id, $post, $wpdb;
|
||||
global $posts, $posts_per_page, $s;
|
||||
|
||||
if(($posts_per_page == 1) || is_single()) {
|
||||
if ( empty($in_same_cat) || 'no' == $in_same_cat )
|
||||
$in_same_cat = false;
|
||||
else
|
||||
$in_same_cat = true;
|
||||
|
||||
$current_post_date = $post->post_date;
|
||||
$current_category = $post->post_category;
|
||||
$post = get_previous_post($in_same_cat, $excluded_categories);
|
||||
|
||||
$sqlcat = '';
|
||||
if ($in_same_cat != 'no') {
|
||||
$sqlcat = " AND post_category = '$current_category' ";
|
||||
}
|
||||
if(! $post) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
if (!empty($excluded_categories)) {
|
||||
$blah = explode('and', $excluded_categories);
|
||||
foreach($blah as $category) {
|
||||
$category = intval($category);
|
||||
$sql_exclude_cats .= " AND post_category != $category";
|
||||
}
|
||||
}
|
||||
|
||||
$limitprev--;
|
||||
$lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1");
|
||||
if ($lastpost) {
|
||||
$string = '<a href="'.get_permalink($lastpost->ID).'">'.$previous;
|
||||
if ($title == 'yes') {
|
||||
$string .= wptexturize($lastpost->post_title);
|
||||
}
|
||||
$string .= '</a>';
|
||||
$format = str_replace('%', $string, $format);
|
||||
echo $format;
|
||||
}
|
||||
}
|
||||
$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
|
||||
if ($title == 'yes') {
|
||||
$string .= apply_filters('the_title', $post->post_title, $post);
|
||||
}
|
||||
$string .= '</a>';
|
||||
$format = str_replace('%', $string, $format);
|
||||
echo $format;
|
||||
}
|
||||
|
||||
// Deprecated. Use next_post_link().
|
||||
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
|
||||
global $posts_per_page, $post, $wpdb;
|
||||
if(1 == $posts_per_page || is_single()) {
|
||||
|
||||
if ( empty($in_same_cat) || 'no' == $in_same_cat )
|
||||
$in_same_cat = false;
|
||||
else
|
||||
$in_same_cat = true;
|
||||
|
||||
$current_post_date = $post->post_date;
|
||||
$current_category = $post->post_category;
|
||||
$post = get_next_post($in_same_cat, $excluded_categories);
|
||||
|
||||
$sqlcat = '';
|
||||
if ($in_same_cat != 'no') {
|
||||
$sqlcat = " AND post_category='$current_category' ";
|
||||
}
|
||||
if(! $post) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
if (!empty($excluded_categories)) {
|
||||
$blah = explode('and', $excluded_categories);
|
||||
foreach($blah as $category) {
|
||||
$category = intval($category);
|
||||
$sql_exclude_cats .= " AND post_category != $category";
|
||||
}
|
||||
}
|
||||
|
||||
$now = current_time('mysql', 1);
|
||||
|
||||
$limitnext--;
|
||||
|
||||
$nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts WHERE post_date > '$current_post_date' AND post_date_gmt < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats AND ID != $post->ID ORDER BY post_date ASC LIMIT $limitnext,1");
|
||||
if ($nextpost) {
|
||||
$string = '<a href="'.get_permalink($nextpost->ID).'">'.$next;
|
||||
if ($title=='yes') {
|
||||
$string .= wptexturize($nextpost->post_title);
|
||||
}
|
||||
$string .= '</a>';
|
||||
$format = str_replace('%', $string, $format);
|
||||
echo $format;
|
||||
}
|
||||
}
|
||||
$string = '<a href="'.get_permalink($post->ID).'">'.$next;
|
||||
if ($title=='yes') {
|
||||
$string .= apply_filters('the_title', $post->post_title, $nextpost);
|
||||
}
|
||||
$string .= '</a>';
|
||||
$format = str_replace('%', $string, $format);
|
||||
echo $format;
|
||||
}
|
||||
|
||||
function get_pagenum_link($pagenum = 1){
|
||||
function get_pagenum_link($pagenum = 1) {
|
||||
global $wp_rewrite;
|
||||
|
||||
$qstr = $_SERVER['REQUEST_URI'];
|
||||
$qstr = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$page_querystring = "paged";
|
||||
$page_modstring = "page/";
|
||||
$page_modregex = "page/?";
|
||||
$permalink = 0;
|
||||
$index = 'index.php';
|
||||
$page_querystring = "paged";
|
||||
$page_modstring = "page/";
|
||||
$page_modregex = "page/?";
|
||||
$permalink = 0;
|
||||
|
||||
$home_root = parse_url(get_settings('home'));
|
||||
$home_root = $home_root['path'];
|
||||
$home_root = trailingslashit($home_root);
|
||||
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
|
||||
$qstr = preg_replace('|^/+|', '', $qstr);
|
||||
$home_root = parse_url(get_settings('home'));
|
||||
$home_root = $home_root['path'];
|
||||
$home_root = trailingslashit($home_root);
|
||||
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
|
||||
$qstr = preg_replace('|^/+|', '', $qstr);
|
||||
|
||||
// if we already have a QUERY style page string
|
||||
if( stristr( $qstr, $page_querystring ) ) {
|
||||
$replacement = "$page_querystring=$pagenum";
|
||||
$qstr = preg_replace("/".$page_querystring."[^\d]+\d+/", $replacement, $qstr);
|
||||
// if we already have a mod_rewrite style page string
|
||||
} elseif ( preg_match( '|'.$page_modregex.'\d+|', $qstr ) ){
|
||||
$permalink = 1;
|
||||
$qstr = preg_replace('|'.$page_modregex.'\d+|',"$page_modstring$pagenum",$qstr);
|
||||
$index = $_SERVER['PHP_SELF'];
|
||||
$index = preg_replace('|^'. $home_root . '|', '', $index);
|
||||
$index = preg_replace('|^/+|', '', $index);
|
||||
|
||||
// if we don't have a page string at all ...
|
||||
// lets see what sort of URL we have...
|
||||
} else {
|
||||
// we need to know the way queries are being written
|
||||
// if there's a querystring_start (a "?" usually), it's deffinitely not mod_rewritten
|
||||
if ( stristr( $qstr, '?' ) ){
|
||||
// so append the query string (using &, since we already have ?)
|
||||
$qstr .= '&' . $page_querystring . '=' . $pagenum;
|
||||
// otherwise, it could be rewritten, OR just the default index ...
|
||||
} elseif( '' != get_settings('permalink_structure')) {
|
||||
$permalink = 1;
|
||||
// if we already have a QUERY style page string
|
||||
if( stristr( $qstr, $page_querystring ) ) {
|
||||
$replacement = "$page_querystring=$pagenum";
|
||||
$qstr = preg_replace("/".$page_querystring."[^\d]+\d+/", $replacement, $qstr);
|
||||
// if we already have a mod_rewrite style page string
|
||||
} elseif ( preg_match( '|'.$page_modregex.'\d+|', $qstr ) ){
|
||||
$permalink = 1;
|
||||
$qstr = preg_replace('|'.$page_modregex.'\d+|',"$page_modstring$pagenum",$qstr);
|
||||
|
||||
// If it's not a path info permalink structure, trim the index.
|
||||
if (! $wp_rewrite->using_index_permalinks()) {
|
||||
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
|
||||
} else {
|
||||
// If using path info style permalinks, make sure the index is in
|
||||
// the URI.
|
||||
if (strpos($qstr, $index) === false) {
|
||||
$qstr = '/' . $index . $qstr;
|
||||
}
|
||||
}
|
||||
// if we don't have a page string at all ...
|
||||
// lets see what sort of URL we have...
|
||||
} else {
|
||||
// we need to know the way queries are being written
|
||||
// if there's a querystring_start (a "?" usually), it's definitely not mod_rewritten
|
||||
if ( stristr( $qstr, '?' ) ){
|
||||
// so append the query string (using &, since we already have ?)
|
||||
$qstr .= '&' . $page_querystring . '=' . $pagenum;
|
||||
// otherwise, it could be rewritten, OR just the default index ...
|
||||
} elseif( '' != get_settings('permalink_structure') && ! is_admin()) {
|
||||
$permalink = 1;
|
||||
$index = $wp_rewrite->index;
|
||||
// If it's not a path info permalink structure, trim the index.
|
||||
if (! $wp_rewrite->using_index_permalinks()) {
|
||||
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
|
||||
} else {
|
||||
// If using path info style permalinks, make sure the index is in
|
||||
// the URI.
|
||||
if (strpos($qstr, $index) === false) {
|
||||
$qstr = '/' . $index . $qstr;
|
||||
}
|
||||
}
|
||||
|
||||
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
|
||||
} else {
|
||||
$qstr = $index . '?' . $page_querystring . '=' . $pagenum;
|
||||
}
|
||||
}
|
||||
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
|
||||
} else {
|
||||
$qstr = $index . '?' . $page_querystring . '=' . $pagenum;
|
||||
}
|
||||
}
|
||||
|
||||
$qstr = preg_replace('|^/+|', '', $qstr);
|
||||
if ($permalink) $qstr = trailingslashit($qstr);
|
||||
return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
|
||||
$qstr = preg_replace('|^/+|', '', $qstr);
|
||||
if ($permalink) $qstr = trailingslashit($qstr);
|
||||
return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
|
||||
}
|
||||
|
||||
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
||||
@@ -448,12 +425,16 @@ function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
||||
}
|
||||
|
||||
function next_posts_link($label='Next Page »', $max_page=0) {
|
||||
global $paged, $result, $request, $posts_per_page, $wpdb;
|
||||
global $paged, $result, $request, $posts_per_page, $wpdb, $max_num_pages;
|
||||
if (!$max_page) {
|
||||
if ( isset($max_num_pages) ) {
|
||||
$max_page = $max_num_pages;
|
||||
} else {
|
||||
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||
$fromwhere = $matches[1];
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||
$max_page = ceil($numposts / $posts_per_page);
|
||||
$max_page = $max_num_pages = ceil($numposts / $posts_per_page);
|
||||
}
|
||||
}
|
||||
if (!$paged)
|
||||
$paged = 1;
|
||||
@@ -486,19 +467,21 @@ function previous_posts_link($label='« Previous Page') {
|
||||
}
|
||||
|
||||
function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') {
|
||||
global $request, $posts_per_page, $wpdb;
|
||||
global $request, $posts_per_page, $wpdb, $max_num_pages;
|
||||
if (! is_single()) {
|
||||
|
||||
if (get_query_var('what_to_show') == 'posts') {
|
||||
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||
$fromwhere = $matches[1];
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||
$max_page = ceil($numposts / $posts_per_page);
|
||||
if ( ! isset($max_num_pages) ) {
|
||||
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
|
||||
$fromwhere = $matches[1];
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
|
||||
$max_num_pages = ceil($numposts / $posts_per_page);
|
||||
}
|
||||
} else {
|
||||
$max_page = 999999;
|
||||
$max_num_pages = 999999;
|
||||
}
|
||||
|
||||
if ($max_page > 1) {
|
||||
if ($max_num_pages > 1) {
|
||||
previous_posts_link($prelabel);
|
||||
echo preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $sep);
|
||||
next_posts_link($nxtlabel, $max_page);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
function get_the_password_form() {
|
||||
$output = '<form action="' . get_settings('siteurl') . '/wp-pass.php" method="post">
|
||||
<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
|
||||
<p><label>' . __("Password:") . ' <input name="post_password" type="text" size="20" /></label> <input type="submit" name="Submit" value="Submit" /></p>
|
||||
<p><label>' . __("Password:") . ' <input name="post_password" type="password" size="20" /></label> <input type="submit" name="Submit" value="Submit" /></p>
|
||||
</form>
|
||||
';
|
||||
return $output;
|
||||
@@ -16,7 +16,7 @@ function the_ID() {
|
||||
|
||||
function the_title($before = '', $after = '', $echo = true) {
|
||||
$title = get_the_title();
|
||||
if (!empty($title)) {
|
||||
if ( strlen($title) > 0 ) {
|
||||
$title = apply_filters('the_title', $before . $title . $after, $before, $after);
|
||||
if ($echo)
|
||||
echo $title;
|
||||
@@ -26,34 +26,23 @@ function the_title($before = '', $after = '', $echo = true) {
|
||||
}
|
||||
|
||||
function get_the_title($id = 0) {
|
||||
global $post, $wpdb;
|
||||
|
||||
if ( 0 != $id ) {
|
||||
$id_post = $wpdb->get_row("SELECT post_title, post_password FROM $wpdb->posts WHERE ID = $id");
|
||||
$title = $id_post->post_title;
|
||||
if (!empty($id_post->post_password))
|
||||
$title = sprintf(__('Protected: %s'), $title);
|
||||
}
|
||||
else {
|
||||
$title = $post->post_title;
|
||||
if (!empty($post->post_password))
|
||||
$title = sprintf(__('Protected: %s'), $title);
|
||||
}
|
||||
$post = &get_post($id);
|
||||
|
||||
$title = $post->post_title;
|
||||
if (!empty($post->post_password))
|
||||
$title = sprintf(__('Protected: %s'), $title);
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
function get_the_guid( $id = 0 ) {
|
||||
global $post, $wpdb;
|
||||
$guid = $post->guid;
|
||||
|
||||
if ( 0 != $id )
|
||||
$guid = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE ID = $id");
|
||||
$guid = apply_filters('get_the_guid', $guid);
|
||||
return $guid;
|
||||
$post = &get_post($id);
|
||||
|
||||
return apply_filters('get_the_guid', $post->guid);
|
||||
}
|
||||
|
||||
function the_guid( $id = 0 ) {
|
||||
echo get_the_guid();
|
||||
echo get_the_guid($id);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +140,7 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
|
||||
if ('' == get_settings('permalink_structure')) {
|
||||
echo '<a href="' . get_permalink() . '&page=' . $i . '">';
|
||||
} else {
|
||||
echo '<a href="' . get_permalink() . $i . '/">';
|
||||
echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
|
||||
}
|
||||
}
|
||||
echo $j;
|
||||
@@ -234,6 +223,8 @@ function get_post_custom_values($key='') {
|
||||
}
|
||||
|
||||
function post_custom( $key = '' ) {
|
||||
global $id, $post_meta_cache;
|
||||
|
||||
if ( 1 == count($post_meta_cache[$id][$key]) ) return $post_meta_cache[$id][$key][0];
|
||||
else return $post_meta_cache[$id][$key];
|
||||
}
|
||||
@@ -259,69 +250,78 @@ function the_meta() {
|
||||
// Pages
|
||||
//
|
||||
|
||||
function get_pages($args = '') {
|
||||
global $wpdb, $cache_pages;
|
||||
function &get_page_children($page_id, $pages) {
|
||||
global $page_cache;
|
||||
|
||||
if (!isset($cache_pages) || empty($cache_pages)) {
|
||||
if ( empty($pages) )
|
||||
$pages = &$page_cache;
|
||||
|
||||
parse_str($args, $r);
|
||||
|
||||
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
||||
if (!isset($r['sort_column'])) $r['sort_column'] = 'post_title';
|
||||
if (!isset($r['sort_order'])) $r['sort_order'] = 'ASC';
|
||||
|
||||
$exclusions = '';
|
||||
if (!empty($r['exclude'])) {
|
||||
$expages = preg_split('/[\s,]+/',$r['exclude']);
|
||||
if (count($expages)) {
|
||||
foreach ($expages as $expage) {
|
||||
$exclusions .= ' AND ID <> ' . intval($expage) . ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dates = ",UNIX_TIMESTAMP(post_modified) AS time_modified";
|
||||
$dates .= ",UNIX_TIMESTAMP(post_date) AS time_created";
|
||||
|
||||
$post_parent = '';
|
||||
if ($r['child_of']) {
|
||||
$post_parent = ' AND post_parent=' . $r['child_of'] . ' ';
|
||||
}
|
||||
|
||||
$pages = $wpdb->get_results("SELECT " .
|
||||
"ID, post_title, post_name, post_parent " .
|
||||
"$dates " .
|
||||
"FROM $wpdb->posts " .
|
||||
"WHERE post_status = 'static' " .
|
||||
"$post_parent" .
|
||||
"$exclusions " .
|
||||
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
|
||||
|
||||
$cache_pages = array();
|
||||
if (count($pages)) {
|
||||
foreach($pages as $page) {
|
||||
$cache_pages[$page->ID] = $page;
|
||||
$page_list = array();
|
||||
foreach ($pages as $page) {
|
||||
if ($page->post_parent == $page_id) {
|
||||
$page_list[] = $page;
|
||||
if ( $children = get_page_children($page->ID, $pages)) {
|
||||
$page_list = array_merge($page_list, $children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $cache_pages;
|
||||
return $page_list;
|
||||
}
|
||||
|
||||
function &get_pages($args = '') {
|
||||
global $wpdb;
|
||||
|
||||
parse_str($args, $r);
|
||||
|
||||
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
||||
if (!isset($r['sort_column'])) $r['sort_column'] = 'post_title';
|
||||
if (!isset($r['sort_order'])) $r['sort_order'] = 'ASC';
|
||||
|
||||
$exclusions = '';
|
||||
if (!empty($r['exclude'])) {
|
||||
$expages = preg_split('/[\s,]+/',$r['exclude']);
|
||||
if (count($expages)) {
|
||||
foreach ($expages as $expage) {
|
||||
$exclusions .= ' AND ID <> ' . intval($expage) . ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pages = $wpdb->get_results("SELECT * " .
|
||||
"FROM $wpdb->posts " .
|
||||
"WHERE post_status = 'static' " .
|
||||
"$exclusions " .
|
||||
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
|
||||
|
||||
if ( empty($pages) )
|
||||
return array();
|
||||
|
||||
// Update cache.
|
||||
update_page_cache($pages);
|
||||
|
||||
if ($r['child_of'])
|
||||
$pages = & get_page_children($r['child_of'], $pages);
|
||||
|
||||
return $pages;
|
||||
}
|
||||
|
||||
function wp_list_pages($args = '') {
|
||||
parse_str($args, $r);
|
||||
if (!isset($r['depth'])) $r['depth'] = 0;
|
||||
if (!isset($r['show_date'])) $r['show_date'] = '';
|
||||
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
||||
if ( !isset($r['depth']) ) $r['depth'] = 0;
|
||||
if ( !isset($r['show_date']) ) $r['show_date'] = '';
|
||||
if ( !isset($r['child_of']) ) $r['child_of'] = 0;
|
||||
if ( !isset($r['title_li']) ) $r['title_li'] = __('Pages');
|
||||
|
||||
if ( !isset($r['echo']) ) $r['echo'] = 1;
|
||||
|
||||
$output = '';
|
||||
|
||||
// Query pages.
|
||||
$pages = get_pages($args);
|
||||
$pages = & get_pages($args);
|
||||
if ( $pages ) :
|
||||
|
||||
if ( $r['title_li'] )
|
||||
echo '<li id="pagenav">' . $r['title_li'] . '<ul>';
|
||||
$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
|
||||
// Now loop over all pages that were selected
|
||||
$page_tree = Array();
|
||||
foreach($pages as $page) {
|
||||
@@ -336,9 +336,9 @@ function wp_list_pages($args = '') {
|
||||
// ts field.
|
||||
if (! empty($r['show_date'])) {
|
||||
if ('modified' == $r['show_date'])
|
||||
$page_tree[$page->ID]['ts'] = $page->time_modified;
|
||||
$page_tree[$page->ID]['ts'] = $page->post_modified;
|
||||
else
|
||||
$page_tree[$page->ID]['ts'] = $page->time_created;
|
||||
$page_tree[$page->ID]['ts'] = $page->post_date;
|
||||
}
|
||||
|
||||
// The tricky bit!!
|
||||
@@ -346,21 +346,31 @@ function wp_list_pages($args = '') {
|
||||
// array index we set the curent page as a child of that page.
|
||||
// We can now start looping over the $page_tree array
|
||||
// with any ID which will output the page links from that ID downwards.
|
||||
$page_tree[$page->post_parent]['children'][] = $page->ID;
|
||||
if ( $page->post_parent != $page->ID)
|
||||
$page_tree[$page->post_parent]['children'][] = $page->ID;
|
||||
}
|
||||
// Output of the pages starting with child_of as the root ID.
|
||||
// child_of defaults to 0 if not supplied in the query.
|
||||
_page_level_out($r['child_of'],$page_tree, $r);
|
||||
$output .= _page_level_out($r['child_of'],$page_tree, $r, 0, false);
|
||||
if ( $r['title_li'] )
|
||||
echo '</ul></li>';
|
||||
$output .= '</ul></li>';
|
||||
endif;
|
||||
|
||||
$output = apply_filters('wp_list_pages', $output);
|
||||
|
||||
if ( $r['echo'] )
|
||||
echo $output;
|
||||
else
|
||||
return $output;
|
||||
}
|
||||
|
||||
function _page_level_out($parent, $page_tree, $args, $depth = 0) {
|
||||
function _page_level_out($parent, $page_tree, $args, $depth = 0, $echo = true) {
|
||||
global $wp_query;
|
||||
|
||||
$queried_obj = $wp_query->get_queried_object();
|
||||
|
||||
$output = '';
|
||||
|
||||
if($depth)
|
||||
$indent = str_repeat("\t", $depth);
|
||||
//$indent = join('', array_fill(0,$depth,"\t"));
|
||||
@@ -374,13 +384,13 @@ function _page_level_out($parent, $page_tree, $args, $depth = 0) {
|
||||
$css_class .= ' current_page_item';
|
||||
}
|
||||
|
||||
echo $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '">' . $title . '</a>';
|
||||
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '">' . $title . '</a>';
|
||||
|
||||
if(isset($cur_page['ts'])) {
|
||||
$format = get_settings('date_format');
|
||||
if(isset($args['date_format']))
|
||||
$format = $args['date_format'];
|
||||
echo " " . gmdate($format,$cur_page['ts']);
|
||||
$output .= " " . mysql2date($format, $cur_page['ts']);
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
@@ -388,13 +398,17 @@ function _page_level_out($parent, $page_tree, $args, $depth = 0) {
|
||||
$new_depth = $depth + 1;
|
||||
|
||||
if(!$args['depth'] || $depth < ($args['depth']-1)) {
|
||||
echo "$indent<ul>\n";
|
||||
_page_level_out($page_id,$page_tree, $args, $new_depth);
|
||||
echo "$indent</ul>\n";
|
||||
$output .= "$indent<ul>\n";
|
||||
$output .= _page_level_out($page_id, $page_tree, $args, $new_depth, false);
|
||||
$output .= "$indent</ul>\n";
|
||||
}
|
||||
}
|
||||
echo "$indent</li>\n";
|
||||
$output .= "$indent</li>\n";
|
||||
}
|
||||
if ( $echo )
|
||||
echo $output;
|
||||
else
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -35,6 +35,7 @@ $is_IE = (($is_macIE) || ($is_winIE));
|
||||
|
||||
// Server detection
|
||||
$is_apache = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? 1 : 0;
|
||||
$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
|
||||
|
||||
// if the config file does not provide the smilies array, let's define it here
|
||||
if (!isset($wpsmiliestrans)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// This just holds the version number, in a separate file so we can bump it without cluttering the CVS
|
||||
// This just holds the version number, in a separate file so we can bump it without cluttering the SVN
|
||||
|
||||
$wp_version = '1.5';
|
||||
$wp_version = '1.5.1.2';
|
||||
|
||||
?>
|
||||
@@ -44,7 +44,7 @@ class wpdb {
|
||||
if (!$this->dbh) {
|
||||
$this->bail("
|
||||
<h1>Error establishing a database connection</h1>
|
||||
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>.</p>
|
||||
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>. This could mean your host's database server is down.</p>
|
||||
<ul>
|
||||
<li>Are you sure you have the correct username and password?</li>
|
||||
<li>Are you sure that you have typed the correct hostname?</li>
|
||||
@@ -69,7 +69,7 @@ class wpdb {
|
||||
<li>Are you sure it exists?</li>
|
||||
<li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
|
||||
</ul>
|
||||
<p>If you continue to have connection problems you should contact your host. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
|
||||
<p>If you don't know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,6 +301,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');
|
||||
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">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
if ( defined('WPLANG') && '' != constant('WPLANG') ) {
|
||||
require_once(ABSPATH . 'wp-includes/streams.php');
|
||||
require_once(ABSPATH . 'wp-includes/gettext.php');
|
||||
include_once(ABSPATH . 'wp-includes/streams.php');
|
||||
include_once(ABSPATH . 'wp-includes/gettext.php');
|
||||
}
|
||||
|
||||
function get_locale() {
|
||||
@@ -54,7 +54,10 @@ function __ngettext($single, $plural, $number, $domain = 'default') {
|
||||
if (isset($l10n[$domain])) {
|
||||
return $l10n[$domain]->ngettext($single, $plural, $number);
|
||||
} else {
|
||||
return $text;
|
||||
if ($number != 1)
|
||||
return $plural;
|
||||
else
|
||||
return $single;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +69,7 @@ function load_textdomain($domain, $mofile) {
|
||||
}
|
||||
|
||||
if ( is_readable($mofile)) {
|
||||
$input = new FileReader($mofile);
|
||||
$input = new CachedFileReader($mofile);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ if ((empty($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
|
||||
<body>
|
||||
<?php $sql = "SELECT $wpdb->links.link_url, link_rss, $wpdb->links.link_name, $wpdb->links.link_category, $wpdb->linkcategories.cat_name, link_updated
|
||||
FROM $wpdb->links
|
||||
LEFT JOIN $wpdb->linkcategories on $wpdb->links.link_category = $wpdb->linkcategories.cat_id
|
||||
JOIN $wpdb->linkcategories on $wpdb->links.link_category = $wpdb->linkcategories.cat_id
|
||||
$sql_cat
|
||||
ORDER BY $wpdb->linkcategories.cat_name, $wpdb->links.link_name \n";
|
||||
//echo("<!-- $sql -->");
|
||||
|
||||
66
wp-login.php
66
wp-login.php
@@ -8,6 +8,7 @@ header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
|
||||
|
||||
if ( defined('RELOCATE') ) { // Move flag is set
|
||||
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
|
||||
@@ -23,18 +24,18 @@ case 'logout':
|
||||
|
||||
wp_clearcookie();
|
||||
do_action('wp_logout');
|
||||
header('Expires: Mon, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate, max-age=0');
|
||||
header('Pragma: no-cache');
|
||||
header('Location: wp-login.php');
|
||||
wp_redirect('wp-login.php');
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
case 'lostpassword':
|
||||
|
||||
?>
|
||||
do_action('lost_password');
|
||||
?>
|
||||
<!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">
|
||||
<head>
|
||||
@@ -66,9 +67,9 @@ if ($error)
|
||||
<form name="lostpass" action="wp-login.php" method="post" id="lostpass">
|
||||
<p>
|
||||
<input type="hidden" name="action" value="retrievepassword" />
|
||||
<label><?php _e('Login') ?>:<br />
|
||||
<label><?php _e('Username:') ?><br />
|
||||
<input type="text" name="user_login" id="user_login" value="" size="20" tabindex="1" /></label></p>
|
||||
<p><label><?php _e('E-mail') ?>:<br />
|
||||
<p><label><?php _e('E-mail:') ?><br />
|
||||
<input type="text" name="email" id="email" value="" size="25" tabindex="2" /></label><br />
|
||||
</p>
|
||||
<p class="submit"><input type="submit" name="submit" id="submit" value="<?php _e('Retrieve Password'); ?> »" tabindex="3" /></p>
|
||||
@@ -95,18 +96,20 @@ case 'retrievepassword':
|
||||
if (!$user_email || $user_email != $_POST['email'])
|
||||
die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.'), 'wp-login.php?action=lostpassword'));
|
||||
|
||||
do_action('retreive_password', $user_login); // Misspelled and deprecated.
|
||||
do_action('retrieve_password', $user_login);
|
||||
|
||||
// Generate something random for a password... md5'ing current time with a rand salt
|
||||
$key = substr( md5( uniqid( microtime() ) ), 0, 50);
|
||||
// now insert the new pass md5'd into the db
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_activation_key = '$key' WHERE user_login = '$user_login'");
|
||||
$message .= __("Someone has asked to reset a password for the login this site\n\n " . get_option('siteurl') ) . "\n\n";
|
||||
$message .= __('Login') . ": $user_login\r\n\r\n";
|
||||
$message .= __("To reset your password visit the following address, otherwise just ignore this email and nothing will happen.\n\n");
|
||||
$message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key=$key";
|
||||
$message .= __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
|
||||
$message .= get_option('siteurl') . "\r\n\r\n";
|
||||
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
||||
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
|
||||
$message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key=$key\r\n";
|
||||
|
||||
$m = wp_mail($user_email, sprintf(__("[%s] Password Reset"), get_settings('blogname')), $message);
|
||||
|
||||
do_action('retreive_password', $user_login);
|
||||
$m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_settings('blogname')), $message);
|
||||
|
||||
if ($m == false) {
|
||||
echo '<p>' . __('The e-mail could not be sent.') . "<br />\n";
|
||||
@@ -124,29 +127,32 @@ case 'resetpass' :
|
||||
|
||||
// Generate something random for a password... md5'ing current time with a rand salt
|
||||
$key = $_GET['key'];
|
||||
if ( empty($key) )
|
||||
die( __('Sorry, that key does not appear to be valid.') );
|
||||
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'");
|
||||
if ( !$user )
|
||||
die( __('Sorry, that key does not appear to be valid.') );
|
||||
|
||||
$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'");
|
||||
$message = __('Login') . ": $user->user_login\r\n";
|
||||
$message .= __('Password') . ": $new_pass\r\n";
|
||||
$message .= get_settings('siteurl') . '/wp-login.php';
|
||||
|
||||
$m = wp_mail($user->user_email, sprintf(__("[%s] Your new password"), get_settings('blogname')), $message);
|
||||
|
||||
do_action('password_reset');
|
||||
|
||||
$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'");
|
||||
$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";
|
||||
|
||||
$m = wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_settings('blogname')), $message);
|
||||
|
||||
if ($m == false) {
|
||||
echo '<p>' . __('The e-mail could not be sent.') . "<br />\n";
|
||||
echo __('Possible reason: your host may have disabled the mail() function...') . "</p>";
|
||||
echo '<p>' . __('The e-mail could not be sent.') . "<br />\n";
|
||||
echo __('Possible reason: your host may have disabled the mail() function...') . '</p>';
|
||||
die();
|
||||
} else {
|
||||
echo '<p>' . sprintf(__("Your new password is in the mail."), $user_login) . '<br />';
|
||||
echo '<p>' . sprintf(__('Your new password is in the mail.'), $user_login) . '<br />';
|
||||
echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>';
|
||||
// send a copy of password change notification to the admin
|
||||
wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), sprintf(__('Password Lost and Changed for user: %s'), $user->user_login));
|
||||
$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
|
||||
wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), $message);
|
||||
die();
|
||||
}
|
||||
break;
|
||||
@@ -172,6 +178,8 @@ default:
|
||||
}
|
||||
}
|
||||
|
||||
do_action('wp_authenticate', array(&$user_login, &$user_pass));
|
||||
|
||||
if ($user_login && $user_pass) {
|
||||
$user = get_userdatabylogin($user_login);
|
||||
if ( 0 == $user->user_level )
|
||||
@@ -182,7 +190,7 @@ default:
|
||||
wp_setcookie($user_login, $user_pass);
|
||||
}
|
||||
do_action('wp_login', $user_login);
|
||||
header("Location: $redirect_to");
|
||||
wp_redirect($redirect_to);
|
||||
exit();
|
||||
} else {
|
||||
if ($using_cookie)
|
||||
@@ -220,8 +228,8 @@ if ( $error )
|
||||
?>
|
||||
|
||||
<form name="loginform" id="loginform" action="wp-login.php" method="post">
|
||||
<p><label><?php _e('Login') ?>:<br /><input type="text" name="log" id="log" value="" size="20" tabindex="1" /></label></p>
|
||||
<p><label><?php _e('Password') ?>:<br /> <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" /></label></p>
|
||||
<p><label><?php _e('Username:') ?><br /><input type="text" name="log" id="log" value="" size="20" tabindex="1" /></label></p>
|
||||
<p><label><?php _e('Password:') ?><br /> <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" /></label></p>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> »" tabindex="3" />
|
||||
<input type="hidden" name="redirect_to" value="<?php echo $redirect_to; ?>" />
|
||||
@@ -242,4 +250,4 @@ if ( $error )
|
||||
|
||||
break;
|
||||
} // end action switch
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -7,6 +7,5 @@ if ( get_magic_quotes_gpc() )
|
||||
// 10 days
|
||||
setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH);
|
||||
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
|
||||
wp_redirect($_SERVER['HTTP_REFERER']);
|
||||
?>
|
||||
@@ -25,7 +25,7 @@ $more = 1;
|
||||
<title><?php bloginfo_rss('name') ?></title>
|
||||
<link><?php bloginfo_rss('url') ?></link>
|
||||
<description><?php bloginfo_rss('description') ?></description>
|
||||
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></dc:date>
|
||||
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
|
||||
<admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
|
||||
<sy:updatePeriod>hourly</sy:updatePeriod>
|
||||
<sy:updateFrequency>1</sy:updateFrequency>
|
||||
@@ -42,7 +42,7 @@ $more = 1;
|
||||
<item rdf:about="<?php permalink_single_rss() ?>">
|
||||
<title><?php the_title_rss() ?></title>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt); ?></dc:date>
|
||||
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
|
||||
<dc:creator><?php the_author() ?></dc:creator>
|
||||
<?php the_category_rss('rdf') ?>
|
||||
<?php if (get_settings('rss_use_excerpt')) : ?>
|
||||
|
||||
@@ -17,9 +17,10 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!get_settings('users_can_register')) {
|
||||
if ( !get_settings('users_can_register') )
|
||||
$action = 'disabled';
|
||||
}
|
||||
|
||||
header( 'Content-Type: ' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') );
|
||||
|
||||
switch($action) {
|
||||
|
||||
@@ -28,9 +29,9 @@ case 'register':
|
||||
$user_login = $_POST['user_login'];
|
||||
$user_email = $_POST['user_email'];
|
||||
|
||||
/* checking login has been typed */
|
||||
/* checking that username has been typed */
|
||||
if ($user_login == '') {
|
||||
die (__('<strong>ERROR</strong>: Please enter a login.'));
|
||||
die (__('<strong>ERROR</strong>: Please enter a username.'));
|
||||
}
|
||||
|
||||
/* checking e-mail address */
|
||||
@@ -40,10 +41,10 @@ case 'register':
|
||||
die (__('<strong>ERROR</strong>: The email address isn’t correct.'));
|
||||
}
|
||||
|
||||
/* checking the login isn't already used by another user */
|
||||
/* checking the username isn't already used by another user */
|
||||
$result = $wpdb->get_results("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
|
||||
if (count($result) >= 1) {
|
||||
die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
|
||||
die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
|
||||
}
|
||||
|
||||
$user_ip = $_SERVER['REMOTE_ADDR'] ;
|
||||
@@ -54,7 +55,7 @@ case 'register':
|
||||
$user_nickname = $user_login;
|
||||
$user_nicename = sanitize_title($user_nickname);
|
||||
$now = gmdate('Y-m-d H:i:s');
|
||||
if (get_settings('new_users_can_blog') >= 1) $user_level = 1;
|
||||
$user_level = get_settings('new_users_can_blog');
|
||||
$password = substr( md5( uniqid( microtime() ) ), 0, 7);
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->users
|
||||
@@ -73,13 +74,15 @@ case 'register':
|
||||
$stars .= '*';
|
||||
}
|
||||
|
||||
$message = __('Login') . ": $user_login\r\n";
|
||||
$message .= __('Password') . ": $password\r\n";
|
||||
$message .= get_settings('siteurl') . '/wp-login.php';
|
||||
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
|
||||
$message .= sprintf(__('Password: %s'), $password) . "\r\n";
|
||||
$message .= get_settings('siteurl') . "/wp-login.php\r\n";
|
||||
|
||||
wp_mail($user_email, sprintf(__("[%s] Your login information"), get_settings('blogname')), $message);
|
||||
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message);
|
||||
|
||||
$message = sprintf(__("New user registration on your blog %1\$s:\n\nLogin: %2\$s \n\nE-mail: %3\$s"), get_settings('blogname'), $user_login, $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);
|
||||
|
||||
@@ -100,9 +103,9 @@ case 'register':
|
||||
|
||||
<div id="login">
|
||||
<h2><?php _e('Registration Complete') ?></h2>
|
||||
<p><?php _e('Login:') ?> <strong><?php echo $user_login; ?></strong><br />
|
||||
<?php _e('Password:') ?> <strong>emailed to you</strong><br />
|
||||
<?php _e('E-mail:') ?> <strong><?php echo $user_email; ?></strong></p>
|
||||
<p><?php printf(__('Username: %s'), "<strong>$user_login</strong>") ?><br />
|
||||
<?php printf(__('Password: %s'), '<strong>' . __('emailed to you') . '</strong>') ?> <br />
|
||||
<?php printf(__('E-mail: %s'), "<strong>$user_email</strong>") ?></p>
|
||||
<p class="submit"><a href="wp-login.php"><?php _e('Login'); ?> »</a></p>
|
||||
</div>
|
||||
</body>
|
||||
@@ -160,8 +163,8 @@ default:
|
||||
|
||||
<form method="post" action="wp-register.php" id="registerform">
|
||||
<p><input type="hidden" name="action" value="register" />
|
||||
<label for="user_login"><?php _e('Login:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" /><br /></p>
|
||||
<p><label for="user_email"><?php _e('E-mail') ?></label>:<br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" /></p>
|
||||
<label for="user_login"><?php _e('Username:') ?></label><br /> <input type="text" name="user_login" id="user_login" size="20" maxlength="20" /><br /></p>
|
||||
<p><label for="user_email"><?php _e('E-mail:') ?></label><br /> <input type="text" name="user_email" id="user_email" size="25" maxlength="100" /></p>
|
||||
<p>A password will be emailed to you.</p>
|
||||
<p class="submit"><input type="submit" value="<?php _e('Register') ?> »" id="submit" name="submit" /></p>
|
||||
</form>
|
||||
@@ -178,4 +181,4 @@ default:
|
||||
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -18,7 +18,7 @@ $more = 1;
|
||||
<title><?php bloginfo_rss('name') ?></title>
|
||||
<link><?php bloginfo_rss('url') ?></link>
|
||||
<description><?php bloginfo_rss('description') ?></description>
|
||||
<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></lastBuildDate>
|
||||
<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
|
||||
<docs>http://backend.userland.com/rss092</docs>
|
||||
<language><?php echo get_option('rss_language'); ?></language>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ $more = 1;
|
||||
<title><?php bloginfo_rss('name'); ?></title>
|
||||
<link><?php bloginfo_rss('url') ?></link>
|
||||
<description><?php bloginfo_rss("description") ?></description>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></pubDate>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
||||
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
||||
<language><?php echo get_option('rss_language'); ?></language>
|
||||
|
||||
@@ -33,7 +33,7 @@ $more = 1;
|
||||
<title><?php the_title_rss() ?></title>
|
||||
<link><?php permalink_single_rss() ?></link>
|
||||
<comments><?php comments_link(); ?></comments>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_the_time('Y-m-d H:i:s')); ?></pubDate>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<dc:creator><?php the_author() ?></dc:creator>
|
||||
<?php the_category_rss() ?>
|
||||
|
||||
|
||||
@@ -69,12 +69,12 @@ require (ABSPATH . WPINC . '/default-filters.php');
|
||||
require_once (ABSPATH . WPINC . '/wp-l10n.php');
|
||||
|
||||
$wpdb->hide_errors();
|
||||
if ( !update_user_cache() && !strstr($_SERVER['PHP_SELF'], 'install.php') ) {
|
||||
if ( !update_user_cache() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {
|
||||
if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
|
||||
$link = 'install.php';
|
||||
else
|
||||
$link = 'wp-admin/install.php';
|
||||
die("It doesn't look like you've installed WP yet. Try running <a href='$link'>install.php</a>.");
|
||||
die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link));
|
||||
}
|
||||
$wpdb->show_errors();
|
||||
|
||||
@@ -110,12 +110,16 @@ if (get_settings('hack_file')) {
|
||||
|
||||
if ( get_settings('active_plugins') ) {
|
||||
$current_plugins = get_settings('active_plugins');
|
||||
foreach ($current_plugins as $plugin) {
|
||||
if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin))
|
||||
include_once(ABSPATH . 'wp-content/plugins/' . $plugin);
|
||||
if ( is_array($current_plugins) ) {
|
||||
foreach ($current_plugins as $plugin) {
|
||||
if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin))
|
||||
include_once(ABSPATH . 'wp-content/plugins/' . $plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require (ABSPATH . WPINC . '/pluggable-functions.php');
|
||||
|
||||
if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
|
||||
wp_cache_postload();
|
||||
|
||||
@@ -143,4 +147,4 @@ register_shutdown_function('shutdown_action_hook');
|
||||
|
||||
// Everything is loaded.
|
||||
do_action('init');
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -27,9 +27,9 @@ function trackback_response($error = 0, $error_message = '') {
|
||||
// trackback is done by a POST
|
||||
$request_array = 'HTTP_POST_VARS';
|
||||
|
||||
if (!$tb_id) {
|
||||
if ( !$_GET['tb_id'] ) {
|
||||
$tb_id = explode('/', $_SERVER['REQUEST_URI']);
|
||||
$tb_id = intval($tb_id[count($tb_id)-1]);
|
||||
$tb_id = intval( $tb_id[ count($tb_id) - 1 ] );
|
||||
}
|
||||
|
||||
$tb_url = $_POST['url'];
|
||||
@@ -41,7 +41,7 @@ $charset = $_POST['charset'];
|
||||
if ($charset)
|
||||
$charset = strtoupper( trim($charset) );
|
||||
else
|
||||
$charset = 'auto';
|
||||
$charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
|
||||
|
||||
if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
|
||||
$title = mb_convert_encoding($title, get_settings('blog_charset'), $charset);
|
||||
@@ -52,7 +52,7 @@ if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
|
||||
if ( is_single() || is_page() )
|
||||
$tb_id = $posts[0]->ID;
|
||||
|
||||
if ( !$tb_id )
|
||||
if ( !intval( $tb_id ) )
|
||||
trackback_response(1, 'I really need an ID for this to work.');
|
||||
|
||||
if (empty($title) && empty($tb_url) && empty($blog_name)) {
|
||||
@@ -66,7 +66,7 @@ if ( !empty($tb_url) && !empty($title) && !empty($tb_url) ) {
|
||||
|
||||
$pingstatus = $wpdb->get_var("SELECT ping_status FROM $wpdb->posts WHERE ID = $tb_id");
|
||||
|
||||
if ('open' != $pingstatus)
|
||||
if ( 'open' != $pingstatus )
|
||||
trackback_response(1, 'Sorry, trackbacks are closed for this item.');
|
||||
|
||||
$title = wp_specialchars( strip_tags( $title ) );
|
||||
|
||||
21
xmlrpc.php
21
xmlrpc.php
@@ -523,7 +523,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
logIO('O', 'Post cats: ' . printr($catnames,true));
|
||||
$post_category = array();
|
||||
|
||||
if ($catnames) {
|
||||
if (is_array($catnames)) {
|
||||
foreach ($catnames as $cat) {
|
||||
$post_category[] = get_cat_ID($cat);
|
||||
}
|
||||
@@ -576,10 +576,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
|
||||
$catnames = $content_struct['categories'];
|
||||
|
||||
if ($catnames) {
|
||||
if (is_array($catnames)) {
|
||||
foreach ($catnames as $cat) {
|
||||
$post_category[] = get_cat_ID($cat);
|
||||
}
|
||||
} else {
|
||||
$post_category[] = 1;
|
||||
}
|
||||
|
||||
$post_excerpt = $content_struct['mt_excerpt'];
|
||||
@@ -1160,16 +1162,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
sleep(1);
|
||||
|
||||
// Let's check the remote site
|
||||
$fp = @fopen($pagelinkedfrom, 'r');
|
||||
if (!$fp) {
|
||||
// The source URI does not exist
|
||||
$linea = wp_remote_fopen( $pagelinkedfrom );
|
||||
if ( !$linea )
|
||||
return new IXR_Error(16, 'The source URI does not exist.');
|
||||
}
|
||||
|
||||
$puntero = 4096;
|
||||
while($remote_read = fread($fp, $puntero)) {
|
||||
$linea .= $remote_read;
|
||||
}
|
||||
|
||||
// Work around bug in strip_tags():
|
||||
$linea = str_replace('<!DOCTYPE','<DOCTYPE',$linea);
|
||||
@@ -1177,7 +1172,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$linea = strip_all_but_one_link($linea, $pagelinkedto);
|
||||
// I don't think we need this? -- emc3
|
||||
//$linea = preg_replace('#&([^amp\;])#is', '&$1', $linea);
|
||||
if (empty($matchtitle)) {
|
||||
if ( empty($matchtitle) ) {
|
||||
preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
|
||||
}
|
||||
$pos2 = strpos($linea, $pagelinkedto);
|
||||
@@ -1190,8 +1185,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$context = str_replace("\n", ' ', $context);
|
||||
$context = str_replace('&', '&', $context);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
if (empty($context)) {
|
||||
// URL pattern not found
|
||||
|
||||
Reference in New Issue
Block a user