Example #1
0
<?php

require_once "include/bittorrent.php";
dbconn();
require_once get_langfile_path();
loggedinorreturn();
include_once $rootpath . 'classes/class_attachment.php';
$Attach = new ATTACHMENT($CURUSER['id']);
$count_limit = $Attach->get_count_limit();
$count_limit = (int) $count_limit;
$count_left = $Attach->get_count_left();
$size_limit = $Attach->get_size_limit_byte();
$allowed_exts = $Attach->get_allowed_ext();
$css_uri = get_css_uri();
$altsize = $_POST['altsize'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="<?php 
echo get_font_css_uri();
?>
" type="text/css">
<link rel="stylesheet" href="<?php 
echo $css_uri . "theme.css";
?>
" type="text/css">
</head>
<body class="inframe">
<table width="100%">
<?php 
 /**
  * Called from {@link _prepare_object()}.
  * @param ATTACHMENT $obj
  * @param ENTRY $entry
  * @access private
  */
 protected function _attach_entry_to_object($obj, $entry)
 {
     $obj->set_host($entry);
 }
    /**
     * Outputs the object as HTML.
     * @param ATTACHMENT $obj
     * @access private
     */
    protected function _display_as_html($obj)
    {
        $file_name = $obj->full_file_name();
        $file_url = htmlentities($obj->full_url());
        ?>
    <table class="basic columns left-labels">
      <tr>
        <th>Name</th>
        <td>
          <?php 
        echo $obj->original_file_name;
        ?>
        </td>
      </tr>
      <tr>
        <th>Size</th>
        <td>
          <?php 
        echo file_size_as_text($obj->size);
        ?>
        </td>
      </tr>
      <tr>
        <th>Type</th>
        <td>
          <?php 
        echo $obj->mime_type;
        ?>
        </td>
      </tr>
<?php 
        if ($obj->exists() && $obj->original_file_name != $obj->file_name && $this->_options->show_interactive) {
            ?>
      <tr>
        <th></th>
        <td>
          <?php 
            $this->page->show_message('Stored as <span class="field">' . $obj->file_name . '</span> on the server.', 'info');
            ?>
        </td>
      </tr>
<?php 
        }
        echo "\n";
        if ($this->_options->show_interactive && !$obj->is_image) {
            ?>
      <tr>
        <th></th>
        <td>
        <?php 
            $menu = $this->app->make_menu();
            $menu->append('Download', $file_url, '{icons}buttons/download');
            $menu->renderer = $this->app->make_menu_renderer();
            $menu->display();
            ?>
        </td>
      </tr>
      <?php 
        }
        ?>
    </table>

<?php 
        if ($obj->is_image) {
            $this->_draw_html_image($obj, $file_url);
        } elseif ($obj->is_archive) {
            $this->_draw_html_archive($obj, $file_name);
        } else {
            $this->_echo_html_description($obj);
        }
        $this->_echo_html_user_information($obj, 'info-box-bottom');
    }