diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-12 17:56:52 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-12 17:56:52 +0000 |
commit | ba4a2062249a4d67aedc18b6991b3cf84d923584 (patch) | |
tree | 17fcde7a5cbf28d102abf6481e2b882f37338bc3 /wp-inst | |
parent | 239fc296df8cf614a627772d704b051632f5308a (diff) | |
download | wordpress-mu-ba4a2062249a4d67aedc18b6991b3cf84d923584.tar.gz wordpress-mu-ba4a2062249a4d67aedc18b6991b3cf84d923584.tar.xz wordpress-mu-ba4a2062249a4d67aedc18b6991b3cf84d923584.zip |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@465 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst')
22 files changed, 420 insertions, 277 deletions
diff --git a/wp-inst/wp-admin/admin-db.php b/wp-inst/wp-admin/admin-db.php index d0194dd..f764d3f 100644 --- a/wp-inst/wp-admin/admin-db.php +++ b/wp-inst/wp-admin/admin-db.php @@ -285,7 +285,10 @@ function wp_insert_link($linkdata) { if ( empty($link_owner) ) $link_owner = $current_user->id; - + + if ( empty($link_notes) ) + $link_notes = ''; + if ( $update ) { $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url', link_name='$link_name', link_image='$link_image', diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php index 083d137..e7d3ee5 100644 --- a/wp-inst/wp-admin/admin-functions.php +++ b/wp-inst/wp-admin/admin-functions.php @@ -95,7 +95,6 @@ function fix_attachment_links($post_ID) { $i = 0; $search = "# id=(\"|)(\d+)\\1#i"; foreach ( $anchor_matches[0] as $anchor ) { - echo "$search\n$anchor\n"; if ( 0 == preg_match($search, $anchor, $id_matches) ) continue; @@ -1077,13 +1076,39 @@ function save_mod_rewrite_rules() { function the_quicktags() { // Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari')) - : echo ' - <div id="quicktags"> + echo ' + <div id="quicktags"> <script src="../wp-includes/js/quicktags.js" type="text/javascript"></script> - <script type="text/javascript">edToolbar();</script> - '; - echo '</div>'; - endif; + <script type="text/javascript">if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();</script> + </div> +'; + else echo ' +<script type="text/javascript"> +function edInsertContent(myField, myValue) { + //IE support + if (document.selection) { + myField.focus(); + sel = document.selection.createRange(); + sel.text = myValue; + myField.focus(); + } + //MOZILLA/NETSCAPE support + else if (myField.selectionStart || myField.selectionStart == "0") { + var startPos = myField.selectionStart; + var endPos = myField.selectionEnd; + myField.value = myField.value.substring(0, startPos) + + myValue + + myField.value.substring(endPos, myField.value.length); + myField.focus(); + myField.selectionStart = startPos + myValue.length; + myField.selectionEnd = startPos + myValue.length; + } else { + myField.value += myValue; + myField.focus(); + } +} +</script> +'; } function validate_current_theme() { @@ -1800,6 +1825,17 @@ function wp_import_handle_upload() { return array('file' => $file, 'id' => $id); } + +function user_can_richedit() { + if ( 'true' != get_user_option('rich_editing') ) + return false; + + if ( preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) ) + return false; + + return true; // Best guess +} + function AJAX_search_box( $get_url, $search_field = 'newvalue', $search_results_field = 'searchresults' ) { ?> <script language="JavaScript"> diff --git a/wp-inst/wp-admin/admin-header.php b/wp-inst/wp-admin/admin-header.php index 00429ab..b9bbeb6 100644 --- a/wp-inst/wp-admin/admin-header.php +++ b/wp-inst/wp-admin/admin-header.php @@ -79,42 +79,8 @@ addLoadEvent(blurry); <script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script> <script type="text/javascript" src="list-manipulation.js"></script> <?php if ( isset( $editing ) ) : ?> -<?php if ( $editing && 'true' == get_user_option('rich_editing') ) : -$mce_plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp')); -$mce_plugins = implode($mce_plugins, ','); -$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'emotions', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp')); -$mce_buttons = implode($mce_buttons, ','); -?> -<script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?index=0&theme=advanced&plugins=<?php echo $mce_plugins; ?>"></script> -<script type="text/javascript"> -tinyMCE.init({ - mode : "specific_textareas", - textarea_trigger : "title", - width : "100%", - theme : "advanced", - theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>", - theme_advanced_buttons2 : "", - theme_advanced_buttons3 : "", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_path_location : "bottom", - theme_advanced_resizing : true, - browsers : "msie,gecko,opera", - dialog_type : "modal", - theme_advanced_resize_horizontal : false, - entity_encoding : "raw", - relative_urls : false, - remove_script_host : false, - force_p_newlines : true, - force_br_newlines : false, - convert_newlines_to_brs : false, - remove_linebreaks : true, - save_callback : "wp_save_callback", - valid_elements : "-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border=0|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr", - plugins : "<?php echo $mce_plugins; ?>" - <?php do_action('mce_options'); ?> -}); -</script> +<?php if ( $editing && user_can_richedit() ) : ?> +<script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20051211"></script> <?php endif; ?> <script type="text/javascript" src="../wp-includes/js/dbx.js"></script> <script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script> @@ -151,6 +117,7 @@ var ajaxCat = new sack(); var newcat; function newCatAddIn() { + if ( !document.getElementById('jaxcat') ) return false; var ajaxcat = document.createElement('p'); ajaxcat.id = 'ajaxcat'; diff --git a/wp-inst/wp-admin/edit-form-advanced.php b/wp-inst/wp-admin/edit-form-advanced.php index fc1340b..a46046f 100644 --- a/wp-inst/wp-admin/edit-form-advanced.php +++ b/wp-inst/wp-admin/edit-form-advanced.php @@ -7,8 +7,6 @@ $messages[3] = __('Custom field deleted.'); <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> <?php endif; ?> -<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> - <form name="post" action="post.php" method="post" id="post"> <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?> @@ -142,7 +140,7 @@ endforeach; <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> </fieldset> -<fieldset id="<?php echo $richedit ? 'postdivrich' : 'postdiv'; ?>"> +<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> <legend><?php _e('Post') ?></legend> <?php @@ -151,20 +149,15 @@ endforeach; $rows = 12; } ?> -<?php if ( !$richedit ) the_quicktags(); ?> +<?php the_quicktags(); ?> -<div><textarea <?php if ( $richedit ) echo 'title="true"'; ?> rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> +<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> </fieldset> -<?php if ( !$richedit ) : ?> <script type="text/javascript"> <!-- edCanvas = document.getElementById('content'); -//--> -</script> -<?php else : ?> -<script type="text/javascript"> -<!-- +<?php if ( user_can_richedit() ) : ?> // This code is meant to allow tabbing from Title to Post (TinyMCE). if ( tinyMCE.isMSIE ) document.getElementById('title').onkeydown = function (e) @@ -196,10 +189,9 @@ else return false; } } - +<?php endif; ?> //--> </script> -<?php endif; ?> <?php echo $form_pingback ?> <?php echo $form_prevstatus ?> diff --git a/wp-inst/wp-admin/edit-form-comment.php b/wp-inst/wp-admin/edit-form-comment.php index d9a301e..fb72058 100644 --- a/wp-inst/wp-admin/edit-form-comment.php +++ b/wp-inst/wp-admin/edit-form-comment.php @@ -4,7 +4,6 @@ $toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID); $form_action = 'editedcomment'; $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID; ?> -<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> <form name="post" action="post.php" method="post" id="post"> <div class="wrap"> @@ -32,13 +31,13 @@ addLoadEvent(focusit); <fieldset id="uridiv"> <legend><?php _e('URI:') ?></legend> <div> - <input type="text" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" /> + <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" /> </div> </fieldset> <fieldset style="clear: both;"> <legend><?php _e('Comment') ?></legend> -<?php if ( !$richedit ) the_quicktags(); ?> +<?php the_quicktags(); ?> <?php $rows = get_settings('default_post_edit_rows'); @@ -46,16 +45,47 @@ addLoadEvent(focusit); $rows = 10; } ?> -<div><textarea <?php if ( $richedit ) echo 'title="true"'; ?> rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo $richedit ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div> +<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div> </fieldset> -<?php if ( !$richedit ) : ?> <script type="text/javascript"> <!-- edCanvas = document.getElementById('content'); +<?php if ( user_can_richedit() ) : ?> +// This code is meant to allow tabbing from Author URL to Post (TinyMCE). +if ( tinyMCE.isMSIE ) + document.getElementById('newcomment_author_url').onkeydown = function (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +else + document.getElementById('newcomment_author_url').onkeypress = function (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +<?php endif; ?> //--> </script> -<?php endif; ?> <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']; ?>" /> diff --git a/wp-inst/wp-admin/edit-page-form.php b/wp-inst/wp-admin/edit-page-form.php index ec625ca..66e029e 100644 --- a/wp-inst/wp-admin/edit-page-form.php +++ b/wp-inst/wp-admin/edit-page-form.php @@ -20,8 +20,6 @@ $sendto = wp_specialchars( $sendto ); ?> -<?php $richedit = ( 'true' != get_user_option('rich_editing') ) ? false : true; ?> - <form name="post" action="post.php" method="post" id="post"> <?php @@ -119,7 +117,7 @@ endforeach; </fieldset> -<fieldset id="<?php echo ( $richedit) ? 'postdivrich' : 'postdiv'; ?>"> +<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> <legend><?php _e('Page Content') ?></legend> <?php $rows = get_settings('default_post_edit_rows'); @@ -127,18 +125,49 @@ endforeach; $rows = 10; } ?> -<?php if (! $richedit ) the_quicktags(); ?> +<?php the_quicktags(); ?> -<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $richedit ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> +<div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> </fieldset> -<?php if ( !$richedit ) : ?> <script type="text/javascript"> <!-- edCanvas = document.getElementById('content'); +<?php if ( user_can_richedit() ) : ?> +// This code is meant to allow tabbing from Title to Post (TinyMCE). +if ( tinyMCE.isMSIE ) + document.getElementById('title').onkeydown = function (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +else + document.getElementById('title').onkeypress = function (e) + { + e = e ? e : window.event; + if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { + var i = tinyMCE.selectedInstance; + if(typeof i == 'undefined') + return true; + tinyMCE.execCommand("mceStartTyping"); + this.blur(); + i.contentWindow.focus(); + e.returnValue = false; + return false; + } + } +<?php endif; ?> //--> </script> -<?php endif; ?> <p class="submit"> <?php if ( $post_ID ) : ?> diff --git a/wp-inst/wp-admin/inline-uploading.php b/wp-inst/wp-admin/inline-uploading.php index 69c5c78..26f86ee 100644 --- a/wp-inst/wp-admin/inline-uploading.php +++ b/wp-inst/wp-admin/inline-uploading.php @@ -153,6 +153,7 @@ if ( $start > 0 ) { $uwidth_sum = 0;
$html = '';
+$popups = '';
$style = '';
$script = '';
if ( count($attachments) > 0 ) {
@@ -165,6 +166,7 @@ if ( count($attachments) > 0 ) { $__using_thumbnail = __('Using Thumbnail');
$__using_original = __('Using Original');
$__no_thumbnail = '<del>'.__('No Thumbnail').'</del>';
+ $__send_to_editor = __('Send to editor');
$__close = __('Close Options');
$__confirmdelete = __('Delete this file from the server?');
$__nothumb = __('There is no thumbnail associated with this photo.');
@@ -193,7 +195,8 @@ var srcb = new Array(); add_post_meta($ID, '_wp_attachment_metadata', $meta);
}
$attachment = array_merge($attachment, $meta);
- $delete_cancel = "<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment={$ID}&all=$all&start=$start&post=$post\">$__delete</a>
+ $send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a>
+<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment={$ID}&all=$all&start=$start&post=$post\">$__delete</a>
<a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
";
$uwidth_sum += 128;
@@ -222,31 +225,33 @@ imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\ imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['post_title']}\" $height_width />';
";
$html .= "<div id='target{$ID}' class='attwrap left'>
- <div id='popup{$ID}' class='popup'>
- <a id=\"I{$ID}\" onclick=\"if($thumb)toggleImage({$ID});else alert('$__nothumb');return false;\" href=\"javascript:void()\">$thumbtext</a>
- <a id=\"L{$ID}\" onclick=\"toggleLink({$ID});return false;\" href=\"javascript:void()\">$__not_linked</a>
- {$delete_cancel}
- </div>
<div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />
</div>
</div>
";
+ $popups .= "<div id='popup{$ID}' class='popup'>
+ <a id=\"I{$ID}\" onclick=\"if($thumb)toggleImage({$ID});else alert('$__nothumb');return false;\" href=\"javascript:void()\">$thumbtext</a>
+ <a id=\"L{$ID}\" onclick=\"toggleLink({$ID});return false;\" href=\"javascript:void()\">$__not_linked</a>
+ {$send_delete_cancel}
+</div>
+";
} else {
- $script .= "a{$ID}a = '<a id=\"{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>';
-a{$ID}b = '<a id=\"{$ID}\" href=\"{$attachment['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>';
+ $script .= "aa[{$ID}] = '<a id=\"{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>';
+ab[{$ID}] = '<a id=\"{$ID}\" href=\"{$attachment['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$attachment['post_title']}\">{$attachment['post_title']}</a>';
";
$html .= "<div id='target{$ID}' class='attwrap left'>
- <div id='popup{$ID}' class='popup'>
- <div class='filetype'>File Type: ".str_replace('/',"/\n",$attachment['post_mime_type'])."</div>
- <a id=\"L{$ID}\" onclick=\"toggleOtherLink({$ID});return false;\" href=\"javascript:void()\">$__linked_to_file</a>
- {$delete_cancel}
- </div>
<div id='div{$ID}' class='otherwrap' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
<a id=\"{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$attachment['post_title']}</a>
</div>
</div>
";
+ $popups .= "<div id='popup{$ID}' class='popup'>
+ <div class='filetype'>File Type: ".str_replace('/',"/\n",$attachment['post_mime_type'])."</div>
+ <a id=\"L{$ID}\" onclick=\"toggleOtherLink({$ID});return false;\" href=\"javascript:void()\">$__linked_to_file</a>
+ {$send_delete_cancel}
+</div>
+";
}
}
}
@@ -281,13 +286,14 @@ function doPopup(i) { target = document.getElementById('target'+i);
popup = document.getElementById('popup'+i);
popup.style.left = (target.offsetLeft) + 'px';
+ popup.style.top = (target.offsetTop) + 'px';
popup.style.display = 'block';
}
-function init() {
- popup = false;
-}
+popup = false;
function selectLink(n) {
o=document.getElementById('div'+n);
+ if ( typeof document.body.createTextRange == 'undefined' || typeof win.tinyMCE == 'undefined' || win.tinyMCE.configs.length < 1 )
+ return;
r = document.body.createTextRange();
if ( typeof r != 'undefined' ) {
r.moveToElementText(o);
@@ -336,6 +342,24 @@ function toggleImage(n) { oi.innerHTML = usingthumbnail;
}
}
+
+var win = window.opener ? window.opener : window.dialogArguments;
+if (!win) win = top;
+tinyMCE = win.tinyMCE;
+richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );
+function sendToEditor(n) {
+ o = document.getElementById('div'+n);
+ h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim
+ h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes
+ h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events
+ h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames
+ h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again
+ h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML
+ if ( richedit )
+ win.tinyMCE.execCommand('mceInsertContent', false, h);
+ else
+ win.edInsertContent(win.edCanvas, h);
+}
</script>
<style type="text/css">
body {
@@ -354,9 +378,10 @@ form { width: 100%;
}
#images {
+ position: absolute;
clear: both;
margin: 0px;
- padding: 3px 15px;
+ padding: 15px 15px;
height: 96px;
/* white-space: nowrap;*/
width: <?php echo $images_width; ?>px;
@@ -495,7 +520,7 @@ form { }
</style>
</head>
-<body onload="init()">
+<body>
<ul id="upload-menu">
<li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__); ?>?action=upload&post=<?php echo $post; ?>&all=<?php echo $all; ?>"><?php _e('Upload'); ?></a></li>
<?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?>
@@ -524,9 +549,10 @@ form { </ul>
<?php if ( $action == 'view' ) : ?>
<div id="wrap">
-<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>
+<!--<div class="tip"><?php _e('You can drag and drop these items into your post. Click on one for more options.'); ?></div>-->
<div id="images">
<?php echo $html; ?>
+<?php echo $popups; ?>
</div>
</div>
<?php elseif ( $action == 'upload' ) : ?>
diff --git a/wp-inst/wp-admin/install.php b/wp-inst/wp-admin/install.php index 5dc4f75..f86d38a 100644 --- a/wp-inst/wp-admin/install.php +++ b/wp-inst/wp-admin/install.php @@ -147,21 +147,21 @@ update_option('admin_email', $admin_email); // Now drop in some default links $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')"); -$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/');"); -$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/');"); -$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/');"); -$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/');"); -$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php');"); -$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/');"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) 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, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/', '');"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/', '');"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/', '');"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/', '');"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php', '');"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/', '');"); // Default category -$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1')"); +$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')"); // 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_name, post_modified, post_modified_gmt, comment_count) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1')"); +$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')"); $wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" ); @@ -170,7 +170,7 @@ $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comm // First Page -$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, post_status) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static')"); +$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '', '', '')"); generate_page_rewrite_rules(); // Set up admin user diff --git a/wp-inst/wp-admin/options-permalink.php b/wp-inst/wp-admin/options-permalink.php index 7ef3c46..3af4ec3 100644 --- a/wp-inst/wp-admin/options-permalink.php +++ b/wp-inst/wp-admin/options-permalink.php @@ -164,7 +164,7 @@ checked="checked" </p> </form> <?php if ( $permalink_structure && !$usingpi && !$writable ) : ?> - <p><?php _e('If your <code>.htaccess</code> was <a href="http://codex.wordpress.org/Make_a_Directory_Writable">writable</a> we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> + <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Make_a_Directory_Writable">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> <form action="options-permalink.php" method="post"> <p> <textarea rows="5" style="width: 98%;" name="rules"><?php echo $wp_rewrite->mod_rewrite_rules(); ?> diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php index 9a4899c..3a66857 100644 --- a/wp-inst/wp-admin/upgrade-schema.php +++ b/wp-inst/wp-admin/upgrade-schema.php @@ -5,7 +5,7 @@ $wp_queries="CREATE TABLE $wpdb->categories ( cat_ID bigint(20) NOT NULL auto_increment, cat_name varchar(55) NOT NULL default '', category_nicename varchar(200) NOT NULL default '', - category_description longtext NOT NULL default '', + category_description longtext NOT NULL, category_parent bigint(20) NOT NULL default '0', category_count bigint(20) NOT NULL default '0', PRIMARY KEY (cat_ID), @@ -60,7 +60,7 @@ CREATE TABLE $wpdb->links ( link_rating int(11) NOT NULL default '0', link_updated datetime NOT NULL default '0000-00-00 00:00:00', link_rel varchar(255) NOT NULL default '', - link_notes mediumtext NOT NULL default '', + link_notes mediumtext NOT NULL, link_rss varchar(255) NOT NULL default '', PRIMARY KEY (link_id), KEY link_category (link_category), @@ -105,17 +105,17 @@ CREATE TABLE $wpdb->posts ( post_content longtext NOT NULL, post_title text NOT NULL, post_category int(4) NOT NULL default '0', - post_excerpt text NOT NULL default '', + post_excerpt text NOT NULL, post_status enum('publish','draft','private','static','object','attachment') NOT NULL default 'publish', comment_status enum('open','closed','registered_only') NOT NULL default 'open', ping_status enum('open','closed') NOT NULL default 'open', post_password varchar(20) NOT NULL default '', post_name varchar(200) NOT NULL default '', - to_ping text NOT NULL default '', - pinged text NOT NULL default '', + to_ping text NOT NULL, + pinged text NOT NULL, post_modified datetime NOT NULL default '0000-00-00 00:00:00', post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content_filtered text NOT NULL default '', + post_content_filtered text NOT NULL, post_parent bigint(20) NOT NULL default '0', guid varchar(255) NOT NULL default '', menu_order int(11) NOT NULL default '0', diff --git a/wp-inst/wp-admin/wp-admin.css b/wp-inst/wp-admin/wp-admin.css index d4d14f6..8861956 100644 --- a/wp-inst/wp-admin/wp-admin.css +++ b/wp-inst/wp-admin/wp-admin.css @@ -1,7 +1,9 @@ * html #poststuff { height: 100%; /* kill peekaboo bug in IE */ } - +body { + border: none; +} a { border-bottom: 1px solid #69c; color: #00019b; @@ -555,9 +557,17 @@ table .vers, table .name { margin-right: 190px; } +* html #template div { + margin-right: 0px; +} + +#template, #template div, #editcat, #addcat { + zoom: 1; +} + #template textarea { font: small 'Courier New', Courier, monospace; - width: 99%; + width: 97%; } #templateside { diff --git a/wp-inst/wp-admin/wpmu-blogs.php b/wp-inst/wp-admin/wpmu-blogs.php index 6f61463..7809107 100644 --- a/wp-inst/wp-admin/wpmu-blogs.php +++ b/wp-inst/wp-admin/wpmu-blogs.php @@ -48,14 +48,26 @@ switch( $_GET[ 'action' ] ) { </tr> <tr valign="top"> <th scope="row">Public</th> - <td><input type='radio' name='blog[public]' value='yes'<?php if( $details[ 'public' ] == '1' ) echo " checked"?>> Yes - <input type='radio' name='blog[public]' value='no'<?php if( $details[ 'public' ] == '0' ) echo " checked"?>> No + <td><input type='radio' name='blog[public]' value='1' <?php if( $details[ 'public' ] == '1' ) echo " checked"?>> Yes + <input type='radio' name='blog[public]' value='0' <?php if( $details[ 'public' ] == '0' ) echo " checked"?>> No </td> </tr> <tr valign="top"> <th scope="row">Archived</th> - <td><input type='radio' name='option[archived]' value='yes'<?php if( $archived == '1' ) echo " checked"?>> Yes - <input type='radio' name='option[archived]' value='no'<?php if( $archived == '0' ) echo " checked"?>> No + <td><input type='radio' name='blog[archived]' value='1' <?php if( $details[ 'archived' ] == '1' ) echo " checked"?>> Yes + <input type='radio' name='blog[archived]' value='0' <?php if( $details[ 'archived' ] == '0' ) echo " checked"?>> No + </td> + </tr> + <tr valign="top"> + <th scope="row">Mature</th> + <td><input type='radio' name='blog[mature]' value='1' <?php if( $details[ 'mature' ] == '1' ) echo " checked"?>> Yes + <input type='radio' name='blog[mature]' value='0' <?php if( $details[ 'mature' ] == '0' ) echo " checked"?>> No + </td> + </tr> + <tr valign="top"> + <th scope="row">Spam</th> + <td><input type='radio' name='blog[spam]' value='1' <?php if( $details[ 'spam' ] == '1' ) echo " checked"?>> Yes + <input type='radio' name='blog[spam]' value='0' <?php if( $details[ 'spam' ] == '0' ) echo " checked"?>> No </td> </tr> <tr><td colspan='2'> @@ -294,7 +306,7 @@ $posts_columns = array( 'blogname' => __('Blog Name'), 'last_updated' => __('Last Updated'), 'registered' => __('Registered'), - 'users' => __('Users'), + //'users' => __('Users'), 'plugins' => __('Actions') ); $posts_columns = apply_filters('manage_posts_columns', $posts_columns); @@ -304,6 +316,7 @@ $posts_columns['control_view'] = ''; $posts_columns['control_edit'] = ''; $posts_columns['control_backend'] = ''; $posts_columns['control_deactivate'] = ''; +$posts_columns['control_spam'] = ''; $posts_columns['control_delete'] = ''; ?> @@ -361,11 +374,13 @@ foreach($posts_columns as $column_name=>$column_display_name) { <?php break; + /* case 'users': ?> <td valign='top'><?php $blogusers = get_users_of_blog( $blog[ 'blog_id' ] ); if( is_array( $blogusers ) ) while( list( $key, $val ) = each( $blogusers ) ) { print '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a><BR>'; } ?></td> <?php break; + */ case 'control_view': ?> @@ -385,6 +400,18 @@ foreach($posts_columns as $column_name=>$column_display_name) { <?php break; + case 'control_spam': + if( get_blog_status( $blog[ 'blog_id' ], "spam" ) == '1' ) { + ?> + <td valign='top'><?php echo "<a href='wpmu-edit.php?action=unspamblog&id=".$blog[ 'blog_id' ]."' class='edit' onclick=\"return confirm('" . sprintf(__("You are about to mark this blog as not spam?\\n \'OK\' to activate, \'Cancel\' to stop.") ) . "')\">" . __('Not Spam') . "</a>"; ?></td> + <?php + } else { + ?> + <td valign='top'><?php echo "<a href='wpmu-edit.php?action=spamblog&id=".$blog[ 'blog_id' ]."' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to mark this blog as spam?\\n \'OK\' to continue, \'Cancel\' to stop.") ) . "')\">" . __('Spam') . "</a>"; ?></td> + <?php + } + break; + case 'control_deactivate': if( is_archived( $blog[ 'blog_id' ] ) == '1' ) { ?> @@ -399,7 +426,7 @@ foreach($posts_columns as $column_name=>$column_display_name) { case 'control_delete': ?> - <td valign='top'><?php echo "<a href='wpmu-edit.php?action=deleteblog&id=".$blog[ 'blog_id' ]."' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this blog?\\n \'OK\' to delete, \'Cancel\' to stop.") ) . "')\">" . __('Delete') . "</a>"; ?></td> + <td valign='top'><?php echo "<a href='wpmu-edit.php?action=deleteblog&id=".$blog[ 'blog_id' ]."&redirect=".wpmu_admin_redirect_url()."' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this blog?\\n \'OK\' to delete, \'Cancel\' to stop.") ) . "')\">" . __('Delete') . "</a>"; ?></td> <?php break; diff --git a/wp-inst/wp-admin/wpmu-edit.php b/wp-inst/wp-admin/wpmu-edit.php index 8b84764..7d5f677 100644 --- a/wp-inst/wp-admin/wpmu-edit.php +++ b/wp-inst/wp-admin/wpmu-edit.php @@ -5,6 +5,7 @@ do_action( "wpmuadminedit", "" ); function wpmu_delete_blog( $id ) { global $wpdb, $wpmuBaseTablePrefix; + do_action( "delete_blog", $id ); $drop_tables = array( $wpmuBaseTablePrefix . $id . "_categories", $wpmuBaseTablePrefix . $id . "_comments", $wpmuBaseTablePrefix . $id . "_linkcategories", @@ -47,7 +48,9 @@ switch( $_GET[ 'action' ] ) { update_site_option( "first_post", $_POST[ 'first_post' ] ); update_site_option( "welcome_email", $_POST[ 'welcome_email' ] ); update_site_option( "fileupload_maxk", $_POST[ 'fileupload_maxk' ] ); - update_site_option( "super_users", $_POST[ 'super_users' ] ); + $site_admins = explode( ' ', $_POST['site_admins'] ); + if ( is_array( $site_admins ) ) + update_site_option( 'site_admins' , $site_admins ); header( "Location: wpmu-options.php?updated=true" ); exit; break; @@ -74,8 +77,7 @@ switch( $_GET[ 'action' ] ) { $query = "SELECT " . $wpdb->users . ".ID, " . $wpdb->users . ".user_login FROM " . $wpdb->users . " WHERE user_login LIKE '%" . $search . "%' limit 0,10"; $users = $wpdb->get_results( $query ); if( is_array( $users ) ) { - while( list( $key, $val ) = each( $users ) ) - { + while( list( $key, $val ) = each( $users ) ) { print '<span onclick="javascript:return update_AJAX_search_box(\'' . $val->user_login . '\');"><a>' . $val->user_login . '</a></span><br>'; } } else { @@ -125,19 +127,17 @@ switch( $_GET[ 'action' ] ) { } } } - // update blogs table - if( $_POST[ 'blog' ][ 'domain' ] != $current_site->domain ) { - $query = "UPDATE ".$wpdb->blogs." + $query = "UPDATE $wpdb->blogs SET domain = '".$_POST[ 'blog' ][ 'domain' ]."', - path = '".$_POST[ 'blog' ][ 'path' ]."', - registered = '".$_POST[ 'blog' ][ 'registered' ]."', - last_updated = '".$_POST[ 'blog' ][ 'last_updated' ]."', - public = '".$_POST[ 'blog' ][ 'public' ]."' - WHERE blog_id = '".$id."'"; - $wpdb->query( $query ); - } - + path = '".$_POST[ 'blog' ][ 'path' ]."', + registered = '".$_POST[ 'blog' ][ 'registered' ]."', + public = '".$_POST[ 'blog' ][ 'public' ]."', + archived = '".$_POST[ 'blog' ][ 'archived' ]."', + mature = '".$_POST[ 'blog' ][ 'mature' ]."', + spam = '".$_POST[ 'blog' ][ 'spam' ]."' + WHERE blog_id = '$id'"; + $result = $wpdb->query( $query ); // user roles if( is_array( $_POST[ 'role' ] ) == true ) { $newroles = $_POST[ 'role' ]; @@ -182,7 +182,7 @@ switch( $_GET[ 'action' ] ) { $id = $_GET[ 'id' ]; if( $id != '0' && $id != '1' ) wpmu_delete_blog( $id ); - header( "Location: wpmu-blogs.php?updated=true" ); + wpmu_admin_do_redirect( "wpmu-blogs.php" ); break; case "allblogs": if( is_site_admin() == false ) { @@ -209,9 +209,25 @@ switch( $_GET[ 'action' ] ) { if( is_site_admin() == false ) { die( __('<p>You do not have permission to access this page.</p>') ); } + do_action( "deactivate_blog", $_GET[ 'id' ] ); update_archived( $_GET[ 'id' ], '1' ); header( "Location: wpmu-blogs.php?updated=true" ); break; + case "unspamblog": + if( is_site_admin() == false ) { + die( __('<p>You do not have permission to access this page.</p>') ); + } + update_blog_status( $_GET[ 'id' ], "spam", '0' ); + header( "Location: wpmu-blogs.php?updated=true" ); + break; + case "spamblog": + if( is_site_admin() == false ) { + die( __('<p>You do not have permission to access this page.</p>') ); + } + do_action( "make_spam_blog", $_GET[ 'id' ] ); + update_blog_status( $_GET[ 'id' ], "spam", '1' ); + header( "Location: wpmu-blogs.php?updated=true" ); + break; case "updateuser": if( is_site_admin() == false ) { die( __('<p>You do not have permission to access this page.</p>') ); diff --git a/wp-inst/wp-includes/classes.php b/wp-inst/wp-includes/classes.php index 9d3016f..d4fcc07 100644 --- a/wp-inst/wp-includes/classes.php +++ b/wp-inst/wp-includes/classes.php @@ -631,7 +631,7 @@ class WP_Query { // Check post status to determine if post should be displayed. if ($this->is_single) { $status = get_post_status($this->posts[0]); - if ('publish' != $status) { + if ( ('publish' != $status) && ('static' != $status) ) { if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) { // User must be logged in to view unpublished posts. $this->posts = array(); @@ -734,11 +734,10 @@ class WP_Query { $this->queried_object = $this->post; $this->queried_object_id = $this->post->ID; } else if ($this->is_author) { - global $cache_userdata; - if (isset($cache_userdata[$this->get('author')])) { - $this->queried_object = $cache_userdata[$this->get('author')]; - $this->queried_object_id = $this->get('author'); - } + $author_id = $this->get('author'); + $author = get_userdata($author_id); + $this->queried_object = $author; + $this->queried_object_id = $author_id; } return $this->queried_object; diff --git a/wp-inst/wp-includes/functions-compat.php b/wp-inst/wp-includes/functions-compat.php index bc077ab..a8ff650 100644 --- a/wp-inst/wp-includes/functions-compat.php +++ b/wp-inst/wp-includes/functions-compat.php @@ -64,7 +64,7 @@ if (!defined('CASE_UPPER')) { * @link http://php.net/function.array_change_key_case * @author Stephan Schmidt <schst@php.net> * @author Aidan Lister <aidan@php.net> - * @version $Revision: 3245 $ + * @version $Revision: 3280 $ * @since PHP 4.2.0 * @require PHP 4.0.0 (user_error) */ @@ -118,7 +118,6 @@ function glob($pattern) { $output[]=$path . '/' . $dir; } closedir($handle); - print_r($output); if(is_array($output)) return $output; diff --git a/wp-inst/wp-includes/functions-formatting.php b/wp-inst/wp-includes/functions-formatting.php index c135b29..255b6cc 100644 --- a/wp-inst/wp-includes/functions-formatting.php +++ b/wp-inst/wp-includes/functions-formatting.php @@ -995,7 +995,7 @@ function ent2ncr($text) { function wp_richedit_pre($text) { // Filtering a blank results in an annoying <br />\n - if ( empty($text) ) return '<p> </p>'; + if ( empty($text) ) return apply_filters('richedit_pre', ''); $output = $text; $output = convert_chars($output); @@ -1005,7 +1005,7 @@ function wp_richedit_pre($text) { $output = str_replace('<', '&lt;', $output); $output = str_replace('>', '&gt;', $output); - return $output; + return apply_filters('richedit_pre', $output); } ?> diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php index 557945f..91e1ac1 100644 --- a/wp-inst/wp-includes/functions-post.php +++ b/wp-inst/wp-includes/functions-post.php @@ -84,7 +84,10 @@ function wp_insert_post($postarr = array()) { $to_ping = preg_replace('|\s+|', "\n", $to_ping); else $to_ping = ''; - + + if ( ! isset($pinged) ) + $pinged = ''; + if ( isset($post_parent) ) $post_parent = (int) $post_parent; else @@ -123,6 +126,7 @@ function wp_insert_post($postarr = array()) { post_date = '$post_date', post_date_gmt = '$post_date_gmt', post_content = '$post_content', + post_content_filtered = '$post_content_filtered', post_title = '$post_title', post_excerpt = '$post_excerpt', post_status = '$post_status', @@ -131,6 +135,7 @@ function wp_insert_post($postarr = array()) { post_password = '$post_password', post_name = '$post_name', to_ping = '$to_ping', + pinged = '$pinged', post_modified = '$post_date', post_modified_gmt = '$post_date_gmt', post_parent = '$post_parent', @@ -139,9 +144,9 @@ function wp_insert_post($postarr = array()) { } else { $wpdb->query( "INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) + (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) VALUES - ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); + ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); $post_ID = $wpdb->insert_id; } @@ -197,6 +202,7 @@ function wp_insert_post($postarr = array()) { add_post_meta($post_ID, '_wp_page_template', $page_template, true); } + do_action('save_post', $post_ID); do_action('wp_insert_post', $post_ID); return $post_ID; diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php index 18e8dc0..e2b3b78 100644 --- a/wp-inst/wp-includes/functions.php +++ b/wp-inst/wp-includes/functions.php @@ -564,16 +564,22 @@ function &get_post(&$post, $output = OBJECT) { else $_post = null; } elseif ( is_object($post) ) { + if ( 'static' == $post->post_status ) + return get_page($post, $output); if ( !isset($post_cache[$post->ID]) ) $post_cache[$post->ID] = &$post; $_post = & $post_cache[$post->ID]; } else { - if ( isset($post_cache[$post]) ) + if ( $_post = wp_cache_get($post, 'pages') ) + return get_page($_post, $output); + elseif ( isset($post_cache[$post]) ) $_post = & $post_cache[$post]; else { $query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1"; - $post_cache[$post] = & $wpdb->get_row($query); - $_post = & $post_cache[$post]; + $_post = & $wpdb->get_row($query); + if ( 'static' == $_post->post_status ) + return get_page($_post, $output); + $post_cache[$post] = & $_post; } } @@ -615,17 +621,23 @@ function &get_page(&$page, $output = OBJECT) { $_page = null; } } elseif ( is_object($page) ) { + if ( 'static' != $page->post_status ) + return get_post($page, $output); wp_cache_add($page->ID, $page, 'pages'); $_page = $page; } else { if ( isset($GLOBALS['page']) && ($page == $GLOBALS['page']->ID) ) { $_page = & $GLOBALS['page']; wp_cache_add($_page->ID, $_page, 'pages'); + } elseif ( $_page = $GLOBALS['post_cache'][$page] ) { + return get_post($page, $output); } elseif ( $_page = wp_cache_get($page, 'pages') ) { // Got it. } else { $query = "SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1"; $_page = & $wpdb->get_row($query); + if ( 'static' != $_page->post_status ) + return get_post($_page, $output); wp_cache_add($_page->ID, $_page, 'pages'); } } @@ -1524,7 +1536,7 @@ function is_trackback () { function is_admin () { global $wp_query; - return $wp_query->is_admin; + return ( $wp_query->is_admin || strstr($_SERVER['REQUEST_URI'], 'wp-admin/') ); } function is_home () { diff --git a/wp-inst/wp-includes/js/quicktags.js b/wp-inst/wp-includes/js/quicktags.js index 7f4d7a3..be628e0 100644 --- a/wp-inst/wp-includes/js/quicktags.js +++ b/wp-inst/wp-includes/js/quicktags.js @@ -386,4 +386,4 @@ function edInsertImage(myField) { + '" />'; edInsertContent(myField, myValue); } -}
\ No newline at end of file +} diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce.js b/wp-inst/wp-includes/js/tinymce/tiny_mce.js index babc335..3f6c6bf 100644 --- a/wp-inst/wp-includes/js/tinymce/tiny_mce.js +++ b/wp-inst/wp-includes/js/tinymce/tiny_mce.js @@ -1027,6 +1027,10 @@ TinyMCE.prototype.handleEvent = function(e) { tinyMCE.cancelEvent(e); return false; } + + if (e.charCode == 118) { // Ctrl+V + tinyMCE.selectedInstance.execCommand("mceInsertContent", false, '<geckopastefix/>'); + } } // Return key pressed @@ -5526,7 +5530,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value) case "mceInsertContent": var insertHTMLFailed = false; this.getWin().focus(); - +/* WP if (tinyMCE.isGecko || tinyMCE.isOpera) { try { // Is plain text or HTML @@ -5560,7 +5564,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value) return; } } - +*/ // Ugly hack in Opera due to non working "inserthtml" if (tinyMCE.isOpera && insertHTMLFailed) { this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL); diff --git a/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php index 12bedc2..3feee3b 100644 --- a/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php +++ b/wp-inst/wp-includes/js/tinymce/tiny_mce_gzip.php @@ -16,7 +16,8 @@ * - Add local file cache for the GZip:ed version. */ - @ include('../../../wp-config.php'); + /* Heavily edited to add flexibilty in WordPress */ + @ require('../../../wp-config.php'); function wp_translate_tinymce_lang($text) { if ( ! function_exists('__') ) { @@ -53,15 +54,7 @@ } // General options - $suffix = ""; // Set to "_src" to use source version - $expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires - - // Get data to load - $theme = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : ""; - $language = isset($_REQUEST['language']) ? $_REQUEST['language'] : ""; - $plugins = isset($_REQUEST['plugins']) ? $_REQUEST['plugins'] : ""; - $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "en"; - $index = isset($_REQUEST['index']) ? $_REQUEST['index'] : -1; + $expiresOffset = 3600 * 24 * 30; // 30 days util client cache expires // Only gzip the contents if clients and server support it $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING'])); @@ -70,112 +63,87 @@ // Output rest of headers header("Content-type: text/javascript; charset: UTF-8"); - // header("Cache-Control: must-revalidate"); header("Vary: Accept-Encoding"); // Handle proxies header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); - if ($index > -1) { - // Write main script and patch some things - if ($index == 0) { -// WP echo file_get_contents(realpath("tiny_mce" . $suffix . ".js")); - $tinymce = file_get_contents(realpath("tiny_mce.js")); - echo wp_compact_tinymce_js($tinymce); - echo "\n\n"; - echo "TinyMCE.prototype.loadScript = function() {};\n"; - } - - // WP - $lang = $language = 'en'; - echo "\n/* WP Cancels all TinyMCE language handling */\n"; - echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n"; - echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n"; - - // Do init based on index -// WP echo "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);\n\n"; - - // Load theme, language pack and theme language packs - if ($theme) { - echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js")); - echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js"))); - } - - if ($language) - echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/" . $language . ".js"))); - - // Load all plugins and their language packs - $plugins = explode(",", $plugins); - foreach ($plugins as $plugin) { - $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js"); - $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js"); - - if ($pluginFile) - echo file_get_contents($pluginFile); - - if ($languageFile) - echo wp_translate_tinymce_lang(file_get_contents($languageFile)); - } - - die; + // Write main script + $tinymce = file_get_contents(realpath("tiny_mce.js")); + echo wp_compact_tinymce_js($tinymce); + echo "\n\n"; + + // Remove some functions + echo "\n/* WP cancels all TinyMCE language and import handling */\n"; + echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n"; + echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n"; + echo "TinyMCE.prototype.loadScript = function() {};\n"; + + // Load theme, language pack and theme language packs + $theme = apply_filters('mce_theme', 'advanced'); + echo wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template.js"))); + echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/en.js"))); + echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/en.js"))); + + // Load all plugins and their language packs + $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp')); + foreach ($plugins as $plugin) { + $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin.js"); + $languageFile = realpath("plugins/" . $plugin . "/langs/en.js"); + + if ($pluginFile) + echo file_get_contents($pluginFile); + + if ($languageFile) + echo wp_translate_tinymce_lang(file_get_contents($languageFile)); } -?> - -function TinyMCECompressed() { - this.configs = new Array(); - this.loadedFiles = new Array(); -} -TinyMCECompressed.prototype.init = function(settings) { - var elements = document.getElementsByTagName('script'); - var scriptURL = ""; - - for (var i=0; i<elements.length; i++) { - if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) { - scriptURL = elements[i].src; - break; - } - } - - settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default"; - settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : ""; - settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en"; - settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true; - this.configs[this.configs.length] = settings; - this.settings = settings; - - scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1); - document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>'); -} - -TinyMCECompressed.prototype.getOnce = function(str) { - var ar = str.split(','); - - for (var i=0; i<ar.length; i++) { - if (ar[i] == '') - continue; - - // Skip load - for (var x=0; x<this.loadedFiles.length; x++) { - if (this.loadedFiles[x] == ar[i]) - ar[i] = null; - } - - this.loadedFiles[this.loadedFiles.length] = ar[i]; - } - - // Glue - str = ""; - for (var i=0; i<ar.length; i++) { - if (ar[i] == null) - continue; - - str += ar[i]; - - if (i != ar.length-1) - str += ","; - } - - return str; -} + // Set up init variables + if ( current_user_can('unfiltered_html') ) // Use the full XHTML set provided in the docs + $valid_elements = 'a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev|shape<circle?default?poly?rect|style|tabindex|title|target|type],abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase|height|hspace|id|name|object|style|title|vspace|width],area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|shape<circle?default?poly?rect|style|tabindex|title|target],base[href|target],basefont[color|face|id|size],bdo[class|dir<ltr?rtl|id|lang|style|title],big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink],br[class|clear<all?left?none?right|id|style|title],button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type|value],caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],' + . 'cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title|valign<baseline?bottom?middle?top|width],colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title|valign<baseline?bottom?middle?top|width],dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],' + . 'fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],font[class|color|dir<ltr?rtl|face|id|lang|size|style|title],form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit|style|title|target],frame[class|frameborder|id|longdesc|marginheight|marginwidth|name|noresize<noresize|scrolling<auto?no?yes|src|style|title],frameset[class|cols|id|onload|onunload|rows|style|title],h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],head[dir<ltr?rtl|lang|profile],hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style|title|width],html[dir<ltr?rtl|lang|version],' + . 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style|title|width],img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|src|style|title|usemap|vspace|width],input[accept|accesskey|align<bottom?left?middle?right?top|alt|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect|readonly<readonly|size|src|style|tabindex|title|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text|usemap|value],ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],isindex[class|dir<ltr?rtl|id|lang|prompt|style|title],kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type|value],link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type],map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],' + . 'menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme],noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],object[align<bottom?left?middle?right?top|archive|border|class|classid|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap|vspace|width],ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|start|style|title|type],optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|selected<selected|style|title|value],p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],param[id|name|type|value|valuetype<DATA?OBJECT?REF],pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|width],q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],' + . 's[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],script[charset|defer|language|src|type],select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style|tabindex|title],small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],span[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],style[dir<ltr?rtl|lang|media|title|type],sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules|style|summary|title|width],' + . 'tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup|style|title|valign<baseline?bottom?middle?top|width],textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect|readonly<readonly|rows|style|tabindex|title],tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup|style|title|valign<baseline?bottom?middle?top|width],thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],' + . 'title[dir<ltr?rtl|lang],tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|valign<baseline?bottom?middle?top],tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type],var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]'; + else // Use a much smaller set + $valid_elements = '-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr'; + $valid_elements = apply_filters('mce_valid_elements', $valid_elements); + $plugins = implode($plugins, ','); + $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp')); + $mce_buttons = implode($mce_buttons, ','); + $mce_buttons_2 = apply_filters('mce_buttons_2', array()); + $mce_buttons_2 = implode($mce_buttons_2, ','); + $mce_buttons_3 = apply_filters('mce_buttons_3', array()); + $mce_buttons_3 = implode($mce_buttons_3, ','); + $mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera')); + $mce_browsers = implode($mce_browsers, ','); +?> +tinyMCE.init({ + mode : "specific_textareas", + textarea_trigger : "title", + width : "100%", + theme : "advanced", + theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>", + theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>", + theme_advanced_buttons3 : "<?php echo $mce_buttons_3; ?>", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_path_location : "bottom", + theme_advanced_resizing : true, + browsers : "<?php echo $mce_browsers; ?>", + dialog_type : "modal", + theme_advanced_resize_horizontal : false, + entity_encoding : "raw", + relative_urls : false, + remove_script_host : false, + force_p_newlines : true, + force_br_newlines : false, + convert_newlines_to_brs : false, + remove_linebreaks : true, + save_callback : "wp_save_callback", + valid_elements : "<?php echo $valid_elements; ?>", +<?php do_action('mce_options'); ?> + plugins : "<?php echo $plugins; ?>" +}); -var tinyMCE = new TinyMCECompressed(); -var tinyMCECompressed = tinyMCE; diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php index 174e2c1..e39e446 100644 --- a/wp-inst/wp-includes/wpmu-functions.php +++ b/wp-inst/wp-includes/wpmu-functions.php @@ -432,24 +432,22 @@ function is_site_admin( $user_login = false ) { return false; } -function get_site_option( $option, $default = false ) { +function get_site_option( $option, $default = false, $use_cache = true ) { global $wpdb; - $value = wp_cache_get($option, 'site-options'); + if( $use_cache == true ) { + $value = wp_cache_get($option, 'site-options'); + } else { + $value = false; + } if ( false === $value ) { - $cache = wpmu_get_cache( $option, "site_options" ); - if( is_array( $cache ) && ( time() - $cache[ 'time' ] ) < 300 ) { // cache for 300 seconds - $value = $cache[ 'value' ]; - } else { - $value = $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = '$option' AND site_id = '$wpdb->siteid'"); - } - if ( $value ) { - wpmu_update_cache( $option, $value, "site_options" ); + $value = $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = '$option' AND site_id = '$wpdb->siteid'"); + if ( ! is_null($value) ) { wp_cache_set($option, $value, 'site-options'); + } elseif ( $default ) { + return $default; } else { - if ( $default ) - return $default; return false; } } @@ -465,12 +463,13 @@ function get_site_option( $option, $default = false ) { function add_site_option( $key, $value ) { global $wpdb; - if ( get_site_option( $key ) ) // If we already have it + if ( get_site_option( $key, false, false ) ) // If we already have it return false; if ( is_array($value) || is_object($value) ) $value = serialize($value); $value = $wpdb->escape( $value ); + wp_cache_set($key, $value, 'site-options'); $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id , meta_key , meta_value ) VALUES ( '$wpdb->siteid', '$key', '$value')" ); return $wpdb->insert_id; } @@ -485,11 +484,11 @@ function update_site_option( $key, $value ) { $value = serialize($value); $value = $wpdb->escape( $value ); - if ( !get_site_option( $key ) ) + if ( get_site_option( $key, false, false ) == false ) add_site_option( $key, $value ); $wpdb->query( "UPDATE $wpdb->sitemeta SET meta_value = '".$wpdb->escape( $value )."' WHERE meta_key = '$key'" ); - wpmu_update_cache( $key, $value, "site_options" ); + wp_cache_replace($key, $value, "site-options"); } function get_blog_option( $blog_id, $key, $default='na' ) { @@ -843,4 +842,24 @@ function wpmu_get_cache( $key, $path ) { return false; } } + +// wpmu admin functions + +function wpmu_admin_do_redirect( $url = '' ) { + if( isset( $_GET[ 'redirect' ] ) ) { + if( substr( $_GET[ 'redirect' ], 0, 2 ) == 's_' ) { + header( "Location: {$url}?updated=true&action=blogs&s=". wp_specialchars( substr( $_GET[ 'redirect' ], 2 ) ) ); + die(); + } + } + header( "Location: {$url}?updated=true" ); + die(); +} + +function wpmu_admin_redirect_url() { + if( isset( $_GET[ 's' ] ) ) { + return "s_".$_GET[ 's' ]; + } +} + ?> |