Wordpress 2.6.2-scripts
[autoinstalls/wordpress.git] / wp-admin / press-this.php
1 <?php
2 require_once('admin.php');
3
4 if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' ) );
5
6 function preg_quote2($string) {
7         return str_replace('/', '\/', preg_quote($string));
8 }
9 function aposfix($text) {
10         $translation_table[chr(34)] = '&quot;';
11         $translation_table[chr(38)] = '&';
12         $translation_table[chr(39)] = '&apos;';
13         return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));
14 }
15 function press_it() {
16         // define some basic variables
17         $quick['post_status'] = isset($_REQUEST['publish']) ? 'publish' : 'draft';
18         $quick['post_category'] = $_REQUEST['post_category'];
19         $quick['tags_input'] = $_REQUEST['tags_input'];
20         $quick['post_title'] = $_REQUEST['post_title'];
21         $quick['post_content'] = '';
22
23         // insert the post with nothing in it, to get an ID
24         $post_ID = wp_insert_post($quick, true);
25
26         $content = '';
27         switch ( $_REQUEST['post_type'] ) {
28                 case 'text':
29                 case 'quote':
30                         $content .= $_REQUEST['content'];
31                         break;
32
33                 case 'photo':
34                         $content = $_REQUEST['content'];
35
36                         foreach( (array) $_REQUEST['photo_src'] as $key => $image) {
37                                 
38                                 // see if files exist in content - we don't want to upload non-used selected files.
39                                 if( strpos($_REQUEST['content'], $image) !== false ) {
40                                         $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
41                                          
42                                         // Replace the POSTED content <img> with correct uploaded ones.
43                                         // escape quote for matching
44                                         $quoted = preg_quote2($image);
45                                         if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content);
46                                 }
47                         }
48
49                         break;
50
51                 case "video":
52                         if($_REQUEST['embed_code']) 
53                                 $content .= $_REQUEST['embed_code']."\n\n";
54                         $content .= $_REQUEST['content'];
55                         break;
56                 }
57         // set the post_content
58         $quick['post_content'] = $content;
59
60         // error handling for $post
61         if ( is_wp_error($post_ID)) {
62                 wp_die($id);
63                 wp_delete_post($post_ID);
64         // error handling for media_sideload
65         } elseif ( is_wp_error($upload)) {
66                 wp_die($upload);
67                 wp_delete_post($post_ID);
68         } else {
69                 $quick['ID'] = $post_ID;
70                 wp_update_post($quick);
71         }
72         return $post_ID;
73 }
74
75 // For submitted posts.
76 if ( 'post' == $_REQUEST['action'] ) { 
77         check_admin_referer('press-this'); $post_ID = press_it(); ?>
78         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
79         <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
80         <head>
81                 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
82                 <title><?php _e('Press This') ?></title>
83         <?php
84                 add_thickbox();
85                 wp_enqueue_style('press-this');
86                 wp_enqueue_style('press-this-ie');
87                 wp_enqueue_style( 'colors' );
88                 wp_enqueue_script('post');
89
90                 do_action('admin_print_styles');
91                 do_action('admin_print_scripts');
92                 do_action('admin_head');
93         ?>
94         </head>
95         <body class="press-this">
96                 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
97                 <div id="footer">
98                 <p><?php
99                 do_action('in_admin_footer', '');
100                 $upgrade = apply_filters( 'update_footer', '' );
101                 echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>');
102                 ?></p>
103                 </div>
104                 <?php do_action('admin_footer', ''); ?>
105         </body>
106         </html>
107         <?php die;
108 }
109
110 // Ajax Requests
111 $title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
112
113 $selection = trim( aposfix( stripslashes($_GET['s']) ) );
114 if ( ! empty($selection) ) {
115         $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
116         $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
117 }
118
119 $url = clean_url($_GET['u']);
120 $image = $_GET['i'];
121
122 if($_REQUEST['ajax'] == 'thickbox') { ?>
123         <script type="text/javascript" charset="utf-8">
124                 jQuery('.cancel').click(function() {
125                         tb_remove();
126                 });
127
128                 jQuery('.select').click(function() {
129                         image_selector();
130                 });
131         </script>
132         <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
133         <div class="titlewrap">
134                 <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
135         </div>
136
137         <p class="centered"><input type="hidden" name="this_photo" value="<?php echo attribute_escape($image); ?>" id="this_photo" />
138                 <a href="#" class="select"><img src="<?php echo clean_url($image); ?>" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p>
139
140         <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
141 <?php die; 
142 }
143
144 if($_REQUEST['ajax'] == 'thickbox_url') { ?>
145         <script type="text/javascript" charset="utf-8">
146                 jQuery('.cancel').click(function() {
147                         tb_remove();
148                 });
149
150                 jQuery('.select').click(function() {
151                         image_selector();
152                 });
153         </script>
154         <h3 id="title"><label for="post_title"><?php _e('URL') ?></label></h3>
155         <div class="titlewrap">
156                 <input id="this_photo" name="this_photo" class="text" onkeypress="if(event.keyCode==13) image_selector();" />
157         </div>
158
159
160         <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
161         <div class="titlewrap">
162                 <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
163         </div>
164
165         <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
166 <?php die; 
167 }
168
169 if($_REQUEST['ajax'] == 'video') { ?>
170         <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2>
171         <div class="titlewrap" >
172                 <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo format_to_edit($selection); ?></textarea>
173         </div>
174 <?php die;
175 }
176
177 if($_REQUEST['ajax'] == 'photo_images') {
178         function get_images_from_uri($uri) {
179                 if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') ) 
180                         return "'".$uri."'";
181
182                 $content = wp_remote_fopen($uri);
183                 if ( false === $content ) return '';
184
185                 $host = parse_url($uri);
186
187                 $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is';
188                 preg_match_all($pattern, $content, $matches);
189                 
190                 if ( empty($matches[1]) ) return '';
191
192                 $sources = array();
193                 foreach ($matches[3] as $src) {
194                         // if no http in url
195                         if(strpos($src, 'http') === false)
196                                 // if it doesn't have a relative uri
197                                 if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === true)
198                                         $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
199                                 else
200                                         $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
201                         
202                         $sources[] = clean_url($src);
203                 }
204                 return "'" . implode("','", $sources) . "'";
205         } 
206
207         $url = urldecode($url);
208         $url = str_replace(' ', '%20', $url);
209         echo 'new Array('.get_images_from_uri($url).')'; 
210 die;
211 }
212
213 if($_REQUEST['ajax'] == 'photo_js') { ?>
214         // gather images and load some default JS
215         var last = null
216         var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
217         var my_src = eval(
218                 jQuery.ajax({
219                         type: "GET",
220                         url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
221                         cache : false,
222                         async : false,
223                         data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
224                         dataType : "script"
225                 }).responseText
226         );
227
228         for (i = 0; i < my_src.length; i++) {
229                 img = new Image(); 
230                 img.src = my_src[i]; 
231                 img_attr = 'id="img' + i + '"'; 
232                 skip = false;
233                 if (img.width && img.height) {
234                         if (img.width * img.height < 2500) 
235                                 skip = true;
236                         aspect = img.width / img.height;
237                         scale = (aspect > 1) ? (75 / img.width) : (75 / img.height);
238
239                         w = img.width;
240                         h = img.height;
241
242                         if (scale < 1) {
243                                 w = parseInt(img.width * scale);
244                                 h = parseInt(img.height * scale);
245                         }
246                         img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
247                 }
248                 if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
249         }
250
251         function pick(img, desc) {
252                 if (img) {
253                         if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length;
254                         if(length == 0) length = 1;
255                         jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
256                         jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
257                         append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" class="aligncenter"/></p>');
258                 }
259                 tinyMCE.activeEditor.resizeToContent();
260                 return false;
261         }
262
263         function image_selector() {
264                 tb_remove();
265                 desc = jQuery('#this_photo_description').val();
266                 src = jQuery('#this_photo').val();
267                 pick(src, desc);
268                 return false;
269         }
270
271         jQuery(document).ready(function() {
272                 jQuery('#extra_fields').html('<div class="photolist"></div><small id="photo_directions"><?php _e("Click images to select:") ?> <span><a href="#" id="photo_add_url" class="thickbox"><?php _e("Add from URL") ?> +</a></span></small><div class="titlewrap"><div id="img_container"></div></div>');
273                 jQuery('#img_container').html(strtoappend);
274                 jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500');
275                 tb_init('a.thickbox, area.thickbox, input.thickbox');
276         });
277
278 <?php die;
279 }
280
281 if($_REQUEST['ajax'] == 'photo') { ?>
282
283 <?php die;
284 }
285 ?>
286 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
287 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
288 <head>
289         <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
290         <title><?php _e('Press This') ?></title>
291
292         <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js?ver=311"></script>
293 <?php
294         add_thickbox();
295         wp_enqueue_style('press-this');
296         wp_enqueue_style('press-this-ie');
297         wp_enqueue_style( 'colors' );
298         wp_enqueue_script('post');
299         wp_enqueue_script('editor_functions');
300
301         do_action('admin_print_styles');
302         do_action('admin_print_scripts');
303         do_action('admin_head');
304 ?>
305         <script type="text/javascript">
306         <?php if ( user_can_richedit() ) { 
307                 $language = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) );
308                 // Add TinyMCE languages
309                 @include_once( dirname(__FILE__).'/../wp-includes/js/tinymce/langs/wp-langs.php' );
310                 if ( isset($strings) ) echo $strings; ?>
311                         (function() {
312                                 var base = tinymce.baseURL, sl = tinymce.ScriptLoader, ln = "<?php echo $language; ?>";
313                                 sl.markDone(base + '/langs/' + ln + '.js');
314                                 sl.markDone(base + '/themes/advanced/langs/' + ln + '.js');
315                                 sl.markDone(base + '/themes/advanced/langs/' + ln + '_dlg.js');
316                         })();
317
318                         tinyMCE.init({
319                                 mode: "textareas",
320                                 editor_selector: "mceEditor",
321                                 language : "<?php echo $language; ?>",
322                                 width: "100%",
323                                 height: "300",
324                                 theme : "advanced",
325                                 theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink",
326                                 theme_advanced_buttons2 : "",
327                                 theme_advanced_buttons3 : "",
328                                 theme_advanced_toolbar_location : "top",
329                                 theme_advanced_toolbar_align : "left",
330                                 theme_advanced_statusbar_location : "bottom",
331                                 theme_advanced_resizing : true,
332                                 theme_advanced_resize_horizontal : false,
333                                 skin : "wp_theme",
334                                 dialog_type : "modal",
335                                 relative_urls : false,
336                                 remove_script_host : false,
337                                 convert_urls : false,
338                                 apply_source_formatting : false,
339                                 remove_linebreaks : true,
340                                 accessibility_focus : false,
341                                 tab_focus : ":next",
342                                 plugins : "safari,inlinepopups",
343                                 entities : "38,amp,60,lt,62,gt",
344                                 force_p_newlines : true,
345                                 save_callback : 'switchEditors.saveCallback'
346                         });
347     <?php } ?>
348
349     jQuery('#tags-input').hide();
350
351         tag_update_quickclicks();
352
353         // add the quickadd form
354         jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
355
356         jQuery('#tagadd').click( tag_flush_to_text );
357         jQuery('#newtag').focus(function() {
358                 if ( this.value == postL10n.addTag )
359                         jQuery(this).val( '' ).removeClass( 'form-input-tip' );
360         });
361         jQuery('#newtag').blur(function() {
362                 if ( this.value == '' ) 
363                         jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
364         });
365
366         // auto-save tags on post save/publish
367         jQuery('#publish').click( tag_save_on_publish );
368         jQuery('#save-post').click( tag_save_on_publish );
369
370         function set_menu(type) {
371                 jQuery('#text_button').removeClass('ui-tabs-selected');
372                 jQuery('#menu li').removeClass('ui-tabs-selected');
373                 jQuery('#' + type + '_button').addClass('ui-tabs-selected');
374                 jQuery("#post_type").val(type);
375         }
376
377         function set_editor(text) {
378                 if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
379                 if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
380         }
381
382         function append_editor(text) {
383                 if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, text);
384         }
385
386         function set_title(title) { jQuery("#content_type").text(title); }
387
388         function show(tab_name) {
389                 jQuery('body').removeClass('video_split');
390                 jQuery('#extra_fields').hide();
391                 switch(tab_name) {
392                         case 'text' :
393                                 set_menu('text');
394                                 set_title('<?php _e('Post') ?>');
395                                 <?php if ($selection) { ?>
396                                         set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</p>');
397                                 <?php } else { ?>
398                                         set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
399                                 <?php } ?>
400                                 return false;
401                                 break;
402                         case 'quote' :
403                                 set_menu('quote');
404                                 set_title('<?php _e('Quote') ?>');
405                                 set_editor('<blockquote><?php echo $selection; ?> <p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?> </a> </cite> </p></blockquote>');
406                                 return false;
407                                 break;
408                         case 'video' :
409                                 set_menu('video');
410                                 set_title('<?php _e('Caption') ?>');
411                                 jQuery('#extra_fields').show();
412                                 jQuery('body').addClass('video_split');
413                                 jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
414                                         <?php 
415                                         $content = '';
416                                         if ( preg_match("/youtube\.com\/watch/i", $url) ) {
417                                                 list($domain, $video_id) = split("v=", $url);
418                                                 $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
419
420                                         } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
421                                                 list($domain, $video_id) = split(".com/", $url);
422                                                 $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />      <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
423
424                                                 if ( trim($selection) == '' )
425                                                         $selection = '<p><a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a></p>';
426
427                                         } elseif ( strpos( $selection, '<object' ) !== false ) {
428                                                 $content = $selection;
429                                         }
430                                         ?>
431                                         jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
432
433                                         set_editor('<a href="<?php echo $url ?>"><?php echo $title; ?></a>.');
434                                 });
435                                 return false;
436                                 break;
437                         case 'photo' :
438                                 set_menu('photo');
439                                 set_title('<?php _e('Post') ?>');
440                                 <?php if ($selection) { ?>
441                                         set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
442                                 <?php } else { ?>
443                                         set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
444                                 <?php } ?>
445                                 jQuery('#extra_fields').show();
446                                 jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>');
447                                 jQuery.ajax({
448                                         type: "GET",
449                                         cache : false,
450                                         url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
451                                         data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
452                                         dataType : "script",
453                                         success : function() {
454                                                 jQuery('#waiting').remove();
455                                         }
456                                 });
457                                 return false;
458                                 break;
459                 }
460         }
461
462         jQuery(document).ready(function() {
463         jQuery('#menu li').click(function (){ 
464                         tab_name = this.id.split('_');
465                         tab_name = tab_name[0];
466                         show(tab_name);
467                 });
468                 // Set default tabs
469                 <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
470                         show('video');
471                 <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
472                         show('video');
473                 <?php  } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
474                         show('photo');
475                 <?php } ?>
476         });
477
478 </script>
479 </head>
480 <body class="press-this">
481 <div id="wphead">
482         <h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1>
483 </div>
484
485 <ul id="menu" class="ui-tabs-nav">
486         <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li>
487         <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li>
488         <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li>
489         <li id="video_button"><a href="#"><?php _e('Video') ?></a></li>
490 </ul>
491
492 <form action="press-this.php?action=post" method="post">
493         <?php wp_nonce_field('press-this') ?>
494         <input type="hidden" name="post_type" id="post_type" value="text"/>
495         <div id="posting">
496                 <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2>
497                 <div class="titlewrap">
498                         <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
499                 </div>
500
501                 <div id="extra_fields" style="display: none"></div>
502
503                 <div class="editor_area">
504                         <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
505                         <div class="editor-container">
506                                 <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea>
507                         </div>
508                 </div>
509         </div>
510
511         <div id="categories">
512                 <div class="submitbox" id="submitpost">
513                         <div id="previewview"></div>
514                         <div class="inside">
515                                 <h2><?php _e('Categories') ?></h2>
516                                 <div id="categories-all">
517                                         <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
518                                                 <?php wp_category_checklist() ?>
519                                         </ul>
520                                 </div>
521                                 
522                                 <h2><?php _e('Tags') ?></h2>
523                                 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
524                                 <div id="tagchecklist"></div>
525                         </div>
526
527                         <p class="submit">         
528                                 <input type="submit" name="draft" value="<?php _e('Save') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
529                                 <input type="submit" name="publish" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
530                                 <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
531                         </p>
532                 </div>
533         </div>
534 </form>
535 </body>
536 </html>