/**
  * Details of an upload
  */
 public function executeFiche(sfWebRequest $r)
 {
     $a = array();
     // Getting current object
     $this->u = $this->getRoute()->getObject();
     // If not found, send 404 to browser
     //$this->forward404Unless($this->u);
     // Calling edit form
     $formEdit = new UploadsForm($this->u);
     // If editing
     if ($r->isMethod('post')) {
         // Binding fields
         $formEdit->bind($r->getParameter($formEdit->getName()), $r->getFiles($formEdit->getName()));
         // If everything is correct
         if ($formEdit->isValid()) {
             // Save it !
             $formEdit->save();
             // Redirect
             $this->redirect("@uploadcats?c=" . $this->u->Categories->getSlug());
         }
     }
     // Getting some related content
     $this->coms = Doctrine::getTable('MsgMessages')->getComments("up", $this->u->getId());
     $this->ups = Doctrine::getTable('Uploads')->getUploadsByUser($this->u->getAuthor());
     // If torrent, getting related peers
     if ($this->u->getHash()) {
         $this->peers = Doctrine_Query::create()->select('p.*, u.username, u.avatar')->from('TorrentsPeers p')->leftJoin('p.Users u')->where('p.hash = ?', $this->u->getHash())->andWhere('p.updated_at > ?', date('Y-m-d H:i:s', time() - 3600))->orderBy('remain')->execute(array(), Doctrine::HYDRATE_ARRAY);
         foreach ($this->peers as $id => $peer) {
             // Injecting size of upload
             $this->peers[$id]['uploadsize'] = $this->u->getSize();
             // Don't send IP&PID to browser, keep it for us
             unset($this->peers[$id]['ip'], $this->peers[$id]['pid'], $this->peers[$id]['peer_id']);
         }
     }
     $a['description'] = $this->getTab("Description", "book_open.png", $this->u->getDescription());
     $this->files = $this->u->getFiles($this->u->getUrl());
     // Infos
     $a['infos'] = $this->getTab("Download", "document_info.png", $this->getPartial($this->getModuleName() . '/infos', array('u' => $this->u, 'ups' => $this->ups, 'files' => $this->files)));
     // Filelist
     if (is_array($this->files)) {
         $a['files'] = $this->getTab("Files", "folders.png", $this->files);
     } else {
         $a['files'] = $this->getTab("Files", "folders.png", array('url' => $this->u->getUrl()));
     }
     // If NFO, getting content
     if (is_file("uploads/nfo/" . $this->u->getNfo())) {
         $a['nfo'] = $this->getTab("NFO", "script.png", "<pre>" . htmlentities(file_get_contents("uploads/nfo/" . $this->u->getNfo())) . "</pre>");
     }
     // Comments
     $f = new UploadsComsForm();
     $f->setDefault('upid', $this->u->getId());
     $a['coms'] = $this->getTab("Commentaires", "comments.png", $this->coms->toArray());
     $a['newcom'] = $this->getTab("Add comment", "comment_add.png", $this->getComponent('messages', 'new', array("form" => $f, "submitUrl" => $this->getContext()->getController()->genUrl($this->getModuleName() . "/comment"))));
     if (isset($this->peers)) {
         $a['peers'] = $this->getTab("Peers", "status_online.png", $this->peers);
     }
     // If owner or mod or adm, editing mode
     if ($this->u->getAuthor() == $this->getUser()->getAttribute("id") || $this->getUser()->hasCredential("adm") || $this->getUser()->hasCredential("mod")) {
         $this->formEdit = $formEdit;
         $a['opt'] = $this->getTab("Options", "wrench.png", $this->getPartial($this->getModuleName() . '/edit', array("f" => $this->formEdit)));
     }
     // Returning content
     if ($r->isXmlHttpRequest()) {
         // Sending JSON mime type
         $this->getResponse()->setHttpHeader('Content-type', 'application/json');
         // Sending content
         return $this->renderText(json_encode(array("right" => $a)));
     }
 }
    </ul>
    <div class="tab-content">
      <div class="tab-pane active" id="description">
      	<?php 
echo html_entity_decode($u->getDescription());
?>
      </div>
      <div class="tab-pane" id="infos">
      	<?php 
include_partial('infos', array('u' => $u, 'ups' => $ups));
?>
      </div>
      <div class="tab-pane" id="newcom">
      	<?php 
$f = new UploadsComsForm();
include_component('messages', 'new', array("form" => $f->setDefault('upid', $u->getId()), "submitUrl" => url_for("partage/comment")));
?>
	    </div>
	  <div class="tab-pane" id="peers"><div></div></div>
    <?php 
if ($u->getAuthor() == $sf_user->getAttribute("id") || $sf_user->hasCredential("adm") || $sf_user->hasCredential("mod")) {
    ?>
	  <div class="tab-pane" id="opt">
	  	<?php 
    include_partial('edit', array("f" => $formEdit));
    ?>
	  </div>
    <?php 
}
?>
	</div>