[ Index ]

WordPress Source Cross Reference

title

Body

[close]

/wp-admin/ -> inline-uploading.php (source)

   1  <?php
   2  
   3  require_once ('admin.php');
   4  
   5  header('Content-Type: text/html; charset=' . get_option('blog_charset'));
   6  
   7  if (!current_user_can('upload_files'))
   8      wp_die(__('You do not have permission to upload files.'));
   9  
  10  wp_reset_vars(array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment'));
  11  
  12  $post = (int) $post;
  13  $images_width = 1;
  14  
  15  switch($action) {
  16  case 'links':
  17  // Do not pass GO.
  18  break;
  19  
  20  case 'delete':
  21  
  22  check_admin_referer('inlineuploading');
  23  
  24  if ( !current_user_can('edit_post', (int) $attachment) )
  25      wp_die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
  26  
  27  wp_delete_attachment($attachment);
  28  
  29  wp_redirect(basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start");
  30  die;
  31  
  32  case 'save':
  33  
  34  check_admin_referer('inlineuploading');
  35  
  36  $overrides = array('action'=>'save');
  37  
  38  $file = wp_handle_upload($_FILES['image'], $overrides);
  39  
  40  if ( isset($file['error']) )
  41      wp_die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
  42  
  43  $url = $file['url'];
  44  $type = $file['type'];
  45  $file = $file['file'];
  46  $filename = basename($file);
  47  
  48  // Construct the attachment array
  49  $attachment = array(
  50      'post_title' => $imgtitle ? $imgtitle : $filename,
  51      'post_content' => $descr,
  52      'post_type' => 'attachment',
  53      'post_parent' => $post,
  54      'post_mime_type' => $type,
  55      'guid' => $url
  56      );
  57  
  58  // Save the data
  59  $id = wp_insert_attachment($attachment, $file, $post);
  60  
  61  if ( preg_match('!^image/!', $attachment['post_mime_type']) ) {
  62      // Generate the attachment's postmeta.
  63      $imagesize = getimagesize($file);
  64      $imagedata['width'] = $imagesize['0'];
  65      $imagedata['height'] = $imagesize['1'];
  66      list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']);
  67      $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'";
  68      $imagedata['file'] = $file;
  69  
  70      add_post_meta($id, '_wp_attachment_metadata', $imagedata);
  71  
  72      if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
  73          if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
  74              $thumb = wp_create_thumbnail($file, 128);
  75          elseif ( $imagedata['height'] > 96 )
  76              $thumb = wp_create_thumbnail($file, 96);
  77  
  78          if ( @file_exists($thumb) ) {
  79              $newdata = $imagedata;
  80              $newdata['thumb'] = basename($thumb);
  81              update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata);
  82          } else {
  83              $error = $thumb;
  84          }
  85      }
  86  } else {
  87      add_post_meta($id, '_wp_attachment_metadata', array());
  88  }
  89  
  90  wp_redirect(basename(__FILE__) . "?post=$post&all=$all&action=view&start=0");
  91  die();
  92  
  93  case 'upload':
  94  
  95  $current_1 = ' class="current"';
  96  $back = $next = false;
  97  break;
  98  
  99  case 'view':
 100  
 101  // How many images do we show? How many do we query?
 102  $num = 5;
 103  $double = $num * 2;
 104  
 105  if ( $post && (empty($all) || $all == 'false') ) {
 106      $and_post = "AND post_parent = '$post'";
 107      $current_2 = ' class="current"';
 108  } else {
 109      $current_3 = ' class="current"';
 110  }
 111  
 112  if (! current_user_can('edit_others_posts') )
 113      $and_user = "AND post_author = " . $user_ID;
 114  
 115  if ( $last )
 116      $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment' $and_user $and_post") - $num;
 117  else
 118      $start = (int) $start;
 119  
 120  if ( $start < 0 )
 121      $start = 0;
 122  
 123  if ( '' == $sort )
 124      $sort = "post_date_gmt DESC";
 125  
 126  $attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_type = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);
 127  
 128  if ( count($attachments) == 0 ) {
 129      wp_redirect( basename(__FILE__) ."?post=$post&action=upload" );
 130      die;
 131  } elseif ( count($attachments) > $num ) {
 132      $next = $start + count($attachments) - $num;
 133  } else {
 134      $next = false;
 135  }
 136  
 137  if ( $start > 0 ) {
 138      $back = $start - $num;
 139      if ( $back < 1 )
 140          $back = '0';
 141  } else {
 142      $back = false;
 143  }
 144  
 145  $uwidth_sum = 0;
 146  $html = '';
 147  $popups = '';
 148  $style = '';
 149  $script = '';
 150  if ( count($attachments) > 0 ) {
 151      $attachments = array_slice( $attachments, 0, $num );
 152      $__delete = __('Delete');
 153      $__not_linked = __('Not Linked');
 154      $__linked_to_page = __('Linked to Page');
 155      $__linked_to_image = __('Linked to Image');
 156      $__linked_to_file = __('Linked to File');
 157      $__using_thumbnail = __('Using Thumbnail');
 158      $__using_original = __('Using Original');
 159      $__using_title = __('Using Title');
 160      $__using_filename = __('Using Filename');
 161      $__using_icon = __('Using Icon');
 162      $__no_thumbnail = '<del>'.__('No Thumbnail').'</del>';
 163      $__send_to_editor = __('Send to editor');
 164      $__close = __('Close Options');
 165      $__confirmdelete = __('Delete this file from the server?');
 166      $__nothumb = __('There is no thumbnail associated with this photo.');
 167      $script .= "notlinked = '$__not_linked';
 168  linkedtoimage = '$__linked_to_image';
 169  linkedtopage = '$__linked_to_page';
 170  linkedtofile = '$__linked_to_file';
 171  usingthumbnail = '$__using_thumbnail';
 172  usingoriginal = '$__using_original';
 173  usingtitle = '$__using_title';
 174  usingfilename = '$__using_filename';
 175  usingicon = '$__using_icon';
 176  var aa = new Array();
 177  var ab = new Array();
 178  var imga = new Array();
 179  var imgb = new Array();
 180  var srca = new Array();
 181  var srcb = new Array();
 182  var title = new Array();
 183  var filename = new Array();
 184  var icon = new Array();
 185  ";
 186      foreach ( $attachments as $key => $attachment ) {
 187          $ID = $attachment['ID'];
 188          $href = get_attachment_link($ID);
 189          $meta = get_post_meta($ID, '_wp_attachment_metadata', true);
 190          if (!is_array($meta)) {
 191              $meta = get_post_meta($ID, 'imagedata', true); // Try 1.6 Alpha meta key
 192              if (!is_array($meta)) {
 193                  $meta = array();
 194              }
 195              add_post_meta($ID, '_wp_attachment_metadata', $meta);
 196          }
 197          $attachment = array_merge($attachment, $meta);
 198          $noscript = "<noscript>
 199          <div class='caption'><a href=\"".basename(__FILE__)."?action=links&amp;attachment={$ID}&amp;post={$post}&amp;all={$all}&amp;start={$start}\">Choose Links</a></div>
 200          </noscript>
 201  ";
 202          $send_delete_cancel = "<a onclick=\"sendToEditor({$ID});return false;\" href=\"javascript:void()\">$__send_to_editor</a>
 203  <a onclick=\"return confirm('$__confirmdelete')\" href=\"" . wp_nonce_url( basename(__FILE__) . "?action=delete&amp;attachment={$ID}&amp;all=$all&amp;start=$start&amp;post=$post", inlineuploading) . "\">$__delete</a>
 204          <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
 205  ";
 206          $uwidth_sum += 128;
 207          if ( preg_match('!^image/!', $attachment['post_mime_type'] ) ) {
 208              $image = & $attachment;
 209              if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) {
 210                  $src = str_replace(basename($image['guid']), $image['thumb'], $image['guid']);
 211                  $script .= "srca[{$ID}] = '$src';
 212  srcb[{$ID}] = '{$image['guid']}';
 213  ";
 214                  $thumb = 'true';
 215                  $thumbtext = $__using_thumbnail;
 216              } else {
 217                  $src = $image['guid'];
 218                  $thumb = 'false';
 219                  $thumbtext = $__no_thumbnail;
 220              }
 221              list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']);
 222              $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"';
 223              $xpadding = (128 - $image['uwidth']) / 2;
 224              $ypadding = (96 - $image['uheight']) / 2;
 225              $style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
 226              $title = wp_specialchars($image['post_title'], ENT_QUOTES);
 227              $script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 228  ab[{$ID}] = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 229  imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />';
 230  imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$title}\" $height_width />';
 231  ";
 232              $html .= "<div id='target{$ID}' class='attwrap left'>
 233      <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
 234          <img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />
 235      </div>
 236      {$noscript}
 237  </div>
 238  ";
 239              $popups .= "<div id='popup{$ID}' class='popup'>
 240      <a id=\"I{$ID}\" onclick=\"if($thumb)toggleImage({$ID});else alert('$__nothumb');return false;\" href=\"javascript:void()\">$thumbtext</a>
 241      <a id=\"L{$ID}\" onclick=\"toggleLink({$ID});return false;\" href=\"javascript:void()\">$__not_linked</a>
 242      {$send_delete_cancel}
 243  </div>
 244  ";
 245          } else {
 246              $title = wp_specialchars($attachment['post_title'], ENT_QUOTES);
 247              $filename = basename($attachment['guid']);
 248              $icon = get_attachment_icon($ID);
 249              $toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>";
 250              $script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 251  ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
 252  title[{$ID}] = '{$title}';
 253  filename[{$ID}] = '{$filename}';
 254  icon[{$ID}] = '{$icon}';
 255  ";
 256              $html .= "<div id='target{$ID}' class='attwrap left'>
 257      <div id='div{$ID}' class='otherwrap usingtext' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
 258          <a id=\"p{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$title}</a>
 259      </div>
 260      {$noscript}
 261  </div>
 262  ";
 263              $popups .= "<div id='popup{$ID}' class='popup'>
 264      <div class='filetype'>".__('File Type:').' '.str_replace('/',"/\n",$attachment['post_mime_type'])."</div>
 265      <a id=\"L{$ID}\" onclick=\"toggleOtherLink({$ID});return false;\" href=\"javascript:void()\">$__linked_to_file</a>
 266      {$toggle_icon}
 267      {$send_delete_cancel}
 268  </div>
 269  ";
 270          }
 271      }
 272  }
 273  
 274  $images_width = $uwidth_sum + ( count($images) * 6 ) + 35;
 275  
 276  break;
 277  
 278  default:
 279  wp_die(__('This script was not meant to be called directly.'));
 280  }
 281  
 282  ?>
 283  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 284  <html xmlns="http://www.w3.org/1999/xhtml">
 285  <head>
 286  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
 287  <title></title>
 288  <meta http-equiv="imagetoolbar" content="no" />
 289  <script type="text/javascript">
 290  // <![CDATA[
 291  /* Define any variables we'll need, such as alternate URLs. */
 292  <?php echo $script; ?>
 293  function htmldecode(st) {
 294      o = document.getElementById('htmldecode');
 295      if (! o) {
 296          o = document.createElement("A");
 297          o.id = "htmldecode"
 298      }
 299      o.innerHTML = st;
 300      r = o.innerHTML;
 301      return r;
 302  }
 303  function cancelUpload() {
 304      o = document.getElementById('uploadForm');
 305      o.method = 'GET';
 306      o.action.value = 'view';
 307      o.submit();
 308  }
 309  function doPopup(i) {
 310      if ( popup )
 311      popup.style.display = 'none';
 312      target = document.getElementById('target'+i);
 313      popup = document.getElementById('popup'+i);
 314      popup.style.left = (target.offsetLeft) + 'px';
 315      popup.style.top = (target.offsetTop) + 'px';
 316      popup.style.display = 'block';
 317  }
 318  popup = false;
 319  function selectLink(n) {
 320      o=document.getElementById('div'+n);
 321      if ( typeof document.body.createTextRange == 'undefined' || typeof win.tinyMCE == 'undefined' || win.tinyMCE.configs.length < 1 )
 322          return;
 323      r = document.body.createTextRange();
 324      if ( typeof r != 'undefined' ) {
 325          r.moveToElementText(o);
 326          r.select();
 327      }
 328  }
 329  function toggleLink(n) {
 330      ol=document.getElementById('L'+n);
 331      if ( ol.innerHTML == htmldecode(notlinked) ) {
 332          ol.innerHTML = linkedtoimage;
 333      } else if ( ol.innerHTML == htmldecode(linkedtoimage) ) {
 334          ol.innerHTML = linkedtopage;
 335      } else {
 336          ol.innerHTML = notlinked;
 337      }
 338      updateImage(n);
 339  }
 340  function toggleOtherLink(n) {
 341      ol=document.getElementById('L'+n);
 342      if ( ol.innerHTML == htmldecode(linkedtofile) ) {
 343          ol.innerHTML = linkedtopage;
 344      } else {
 345          ol.innerHTML = linkedtofile;
 346      }
 347      updateOtherIcon(n);
 348  }
 349  function toggleImage(n) {
 350      oi = document.getElementById('I'+n);
 351      if ( oi.innerHTML == htmldecode(usingthumbnail) ) {
 352          oi.innerHTML = usingoriginal;
 353      } else {
 354          oi.innerHTML = usingthumbnail;
 355      }
 356      updateImage(n);
 357  }
 358  function toggleOtherIcon(n) {
 359      od = document.getElementById('div'+n);
 360      oi = document.getElementById('I'+n);
 361      if ( oi.innerHTML == htmldecode(usingtitle) ) {
 362          oi.innerHTML = usingfilename;
 363          od.className = 'otherwrap usingtext';
 364      } else if ( oi.innerHTML == htmldecode(usingfilename) && icon[n] != '' ) {
 365          oi.innerHTML = usingicon;
 366          od.className = 'otherwrap usingicon';
 367      } else {
 368          oi.innerHTML = usingtitle;
 369          od.className = 'otherwrap usingtext';
 370      }
 371      updateOtherIcon(n);
 372  }
 373  function updateImage(n) {
 374      od=document.getElementById('div'+n);
 375      ol=document.getElementById('L'+n);
 376      oi=document.getElementById('I'+n);
 377      if ( oi.innerHTML == htmldecode(usingthumbnail) ) {
 378          img = imga[n];
 379      } else {
 380          img = imgb[n];
 381      }
 382      if ( ol.innerHTML == htmldecode(linkedtoimage) ) {
 383          od.innerHTML = ab[n]+img+'</a>';
 384      } else if ( ol.innerHTML == htmldecode(linkedtopage) ) {
 385          od.innerHTML = aa[n]+img+'</a>';
 386      } else {
 387          od.innerHTML = img;
 388      }
 389  }
 390  function updateOtherIcon(n) {
 391      od=document.getElementById('div'+n);
 392      ol=document.getElementById('L'+n);
 393      oi=document.getElementById('I'+n);
 394      if ( oi.innerHTML == htmldecode(usingfilename) ) {
 395          txt = filename[n];
 396      } else if ( oi.innerHTML == htmldecode(usingicon) ) {
 397          txt = icon[n];
 398      } else {
 399          txt = title[n];
 400      }
 401      if ( ol.innerHTML == htmldecode(linkedtofile) ) {
 402          od.innerHTML = ab[n]+txt+'</a>';
 403      } else if ( ol.innerHTML == htmldecode(linkedtopage) ) {
 404          od.innerHTML = aa[n]+txt+'</a>';
 405      } else {
 406          od.innerHTML = txt;
 407      }
 408  }
 409  
 410  var win = window.opener ? window.opener : window.dialogArguments;
 411  if (!win) win = top;
 412  tinyMCE = win.tinyMCE;
 413  richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );
 414  function sendToEditor(n) {
 415      o = document.getElementById('div'+n);
 416      h = o.innerHTML.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // Trim
 417      h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose attribs in quotes
 418      h = h.replace(new RegExp(' (width|height)=".*?"', 'g'), ''); // Drop size constraints
 419      h = h.replace(new RegExp(' on(click|mousedown)="[^"]*"', 'g'), ''); // Drop menu events
 420      h = h.replace(new RegExp('<(/?)A', 'g'), '<$1a'); // Lowercase tagnames
 421      h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again
 422      h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML
 423      if ( richedit )
 424          win.tinyMCE.execCommand('mceInsertContent', false, h);
 425      else
 426          win.edInsertContent(win.edCanvas, h);
 427  }
 428  // ]]>
 429  </script>
 430  <style type="text/css">
 431  <?php if ( $action == 'links' ) : ?>
 432  * html { overflow-x: hidden; }
 433  <?php else : ?>
 434  * html { overflow-y: hidden; }
 435  <?php endif; ?>
 436  body {
 437      font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
 438      border: none;
 439      margin: 0px;
 440      height: 150px;
 441      background: #dfe8f1;
 442  }
 443  form {
 444      margin: 3px 2px 0px 6px;
 445  }
 446  #wrap {
 447      clear: both;
 448      padding: 0px;
 449      width: 100%;
 450  }
 451  #images {
 452      position: absolute;
 453      clear: both;
 454      margin: 0px;
 455      padding: 15px 15px;
 456      width: <?php echo $images_width; ?>px;
 457  }
 458  #images img {
 459      background-color: rgb(209, 226, 239);
 460  }
 461  <?php echo $style; ?>
 462  .attwrap, .attwrap * {
 463      margin: 0px;
 464      padding: 0px;
 465      border: 0px;
 466  }
 467  .imagewrap {
 468      margin-right: 5px;
 469      overflow: hidden;
 470      width: 128px;
 471  }
 472  .otherwrap {
 473      margin-right: 5px;
 474      overflow: hidden;
 475      background-color: #f9fcfe;
 476  }
 477  .otherwrap a {
 478      display: block;
 479  }
 480  .otherwrap a, .otherwrap a:hover, .otherwrap a:active, .otherwrap a:visited {
 481      color: blue;
 482  }
 483  .usingicon {
 484      padding: 0px;
 485      height: 96px;
 486      text-align: center;
 487      width: 128px;
 488  }
 489  .usingtext {
 490      padding: 3px;
 491      height: 90px;
 492      text-align: left;
 493      width: 122px;
 494  }
 495  .filetype {
 496      font-size: 80%;
 497      border-bottom: 3px double #89a
 498  }
 499  .imagewrap, .imagewrap img, .imagewrap a, .imagewrap a img, .imagewrap a:hover img, .imagewrap a:visited img, .imagewrap a:active img {
 500      text-decoration: none;
 501  }
 502  #upload-menu {
 503      background: #fff;
 504      margin: 0px;
 505      padding: 0;
 506      list-style: none;
 507      height: 2em;
 508      border-bottom: 1px solid #448abd;
 509      width: 100%;
 510  }
 511  #upload-menu li {
 512      float: left;
 513      margin: 0 0 0 .75em;
 514  }
 515  #upload-menu a {
 516      display: block;
 517      padding: 5px;
 518      text-decoration: none;
 519      color: #000;
 520      border-top: 3px solid #fff;
 521  }
 522  #upload-menu .current a {
 523      background: #dfe8f1;
 524      border-right: 2px solid #448abd;
 525  }
 526  #upload-menu a:hover {
 527      background: #dfe8f1;
 528      color: #000;
 529  }
 530  .tip {
 531      color: rgb(68, 138, 189);
 532      padding: 2px 1em;
 533  }
 534  .inactive {
 535      color: #fff;
 536      padding: 1px 3px;
 537  }
 538  .left {
 539      float: left;
 540  }
 541  .right {
 542      float: right;
 543  }
 544  .center {
 545      text-align: center;
 546  }
 547  #upload-menu li.spacer {
 548      margin-left: 40px;
 549  }
 550  #title, #descr {
 551      width: 99%;
 552      margin-top: 1px;
 553  }
 554  th {
 555      width: 4.5em;
 556  }
 557  #descr {
 558      height: 36px;
 559  }
 560  #buttons {
 561      margin-top: 2px;
 562      text-align: right;
 563  }
 564  .popup {
 565      margin: 4px 4px;
 566      padding: 1px;
 567      position: absolute;
 568      width: 114px;
 569      display: none;
 570      background-color: rgb(240, 240, 238);
 571      border-top: 2px solid #fff;
 572      border-right: 2px solid #ddd;
 573      border-bottom: 2px solid #ddd;
 574      border-left: 2px solid #fff;
 575      text-align: center;
 576  }
 577  .imagewrap .popup {
 578      opacity: .90;
 579      filter:alpha(opacity=90);
 580  }
 581  .otherwrap .popup {
 582      padding-top: 20px;
 583  }
 584  .popup a, .popup a:visited, .popup a:active {
 585      background-color: transparent;
 586      display: block;
 587      width: 100%;
 588      text-decoration: none;
 589      color: #246;
 590  }
 591  .popup a:hover {
 592      background-color: #fff;
 593      color: #000;
 594  }
 595  .caption {
 596      text-align: center;
 597  }
 598  #submit {
 599      margin: 1px;
 600      width: 99%;
 601  }
 602  #submit input, #submit input:focus {
 603      background: url( images/fade-butt.png );
 604      border: 3px double #999;
 605      border-left-color: #ccc;
 606      border-top-color: #ccc;
 607      color: #333;
 608      padding: 0.25em;
 609  }
 610  #submit input:active {
 611      background: #f4f4f4;
 612      border: 3px double #ccc;
 613      border-left-color: #999;
 614      border-top-color: #999;
 615  }
 616  .zerosize {
 617      width: 0px;
 618      height: 0px;
 619      overflow: hidden;
 620      position: absolute;
 621  }
 622  #links {
 623      margin: 3px 8px;
 624      line-height: 2em;
 625  }
 626  #links textarea {
 627      width: 95%;
 628      height: 4.5em;
 629  }
 630  </style>
 631  </head>
 632  <body>
 633  <ul id="upload-menu">
 634  <li<?php echo $current_1; ?>><a href="<?php echo basename(__FILE__) . "?action=upload&amp;post=$post&amp;all=$all&amp;start=$start"; ?>"><?php _e('Upload'); ?></a></li>
 635  <?php if ( $attachments = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post'") ) { ?>
 636  <li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__) . "?action=view&amp;post=$post&amp;all=false"; ?>"><?php _e('Browse'); ?></a></li>
 637  <?php } ?>
 638  <?php if ($wpdb->