1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Lint slop and some cleanup.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-22 09:22:57 -08:00
parent 17a4069f01
commit 21286a723e
8 changed files with 14 additions and 12 deletions

View file

@ -233,7 +233,7 @@ return array(
// Version string displayed in the footer. You probably should leave this // Version string displayed in the footer. You probably should leave this
// alone. // alone.
'phabricator.version' => 'UNSTABLE', 'phabricator.version' => 'UNSTABLE',
// -- Files ----------------------------------------------------------------- // // -- Files ----------------------------------------------------------------- //

View file

@ -68,7 +68,7 @@ class AphrontFileResponse extends AphrontResponse {
if (strlen($this->getDownload())) { if (strlen($this->getDownload())) {
$headers[] = array('X-Download-Options', 'noopen'); $headers[] = array('X-Download-Options', 'noopen');
$filename = $this->getDownload(); $filename = $this->getDownload();
$headers[] = array( $headers[] = array(
'Content-Disposition', 'Content-Disposition',

View file

@ -34,7 +34,7 @@ class PhabricatorFileListController extends PhabricatorFileController {
'View'); 'View');
} else { } else {
$view_button = null; $view_button = null;
} }
$rows[] = array( $rows[] = array(
phutil_escape_html($file->getPHID()), phutil_escape_html($file->getPHID()),
phutil_escape_html($file->getName()), phutil_escape_html($file->getName()),

View file

@ -34,14 +34,14 @@ class PhabricatorFileViewController extends PhabricatorFileController {
if (!$file) { if (!$file) {
return new Aphront404Response(); return new Aphront404Response();
} }
switch ($this->view) { switch ($this->view) {
case 'download': case 'download':
case 'view': case 'view':
$data = $file->loadFileData(); $data = $file->loadFileData();
$response = new AphrontFileResponse(); $response = new AphrontFileResponse();
$response->setContent($data); $response->setContent($data);
if ($this->view == 'view') { if ($this->view == 'view') {
if (!$file->isViewableInBrowser()) { if (!$file->isViewableInBrowser()) {
return new Aphront400Response(); return new Aphront400Response();
@ -50,7 +50,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
} else { } else {
$download = true; $download = true;
} }
if ($download) { if ($download) {
$mime_type = $file->getMimeType(); $mime_type = $file->getMimeType();
} else { } else {
@ -58,7 +58,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
} }
$response->setMimeType($mime_type); $response->setMimeType($mime_type);
if ($download) { if ($download) {
$response->setDownload($file->getName()); $response->setDownload($file->getName());
} }
@ -68,7 +68,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
} }
$form = new AphrontFormView(); $form = new AphrontFormView();
if ($file->isViewableInBrowser()) { if ($file->isViewableInBrowser()) {
$form->setAction('/file/view/'.$file->getPHID().'/'); $form->setAction('/file/view/'.$file->getPHID().'/');
$button_name = 'View File'; $button_name = 'View File';

View file

@ -6,6 +6,7 @@
phutil_require_module('phabricator', 'aphront/response/400');
phutil_require_module('phabricator', 'aphront/response/404'); phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'aphront/response/file'); phutil_require_module('phabricator', 'aphront/response/file');
phutil_require_module('phabricator', 'applications/files/controller/base'); phutil_require_module('phabricator', 'applications/files/controller/base');

View file

@ -174,18 +174,18 @@ class PhabricatorFile extends PhabricatorFileDAO {
public function getViewURI() { public function getViewURI() {
return PhabricatorFileURI::getViewURIForPHID($this->getPHID()); return PhabricatorFileURI::getViewURIForPHID($this->getPHID());
} }
public function isViewableInBrowser() { public function isViewableInBrowser() {
return ($this->getViewableMimeType() !== null); return ($this->getViewableMimeType() !== null);
} }
public function getViewableMimeType() { public function getViewableMimeType() {
$mime_map = PhabricatorEnv::getEnvConfig('files.viewable-mime-types'); $mime_map = PhabricatorEnv::getEnvConfig('files.viewable-mime-types');
$mime_type = $this->getMimeType(); $mime_type = $this->getMimeType();
$mime_parts = explode(';', $mime_type); $mime_parts = explode(';', $mime_type);
$mime_type = reset($mime_parts); $mime_type = reset($mime_parts);
return idx($mime_map, $mime_type); return idx($mime_map, $mime_type);
} }

View file

@ -10,6 +10,7 @@ phutil_require_module('phabricator', 'applications/files/storage/base');
phutil_require_module('phabricator', 'applications/files/storage/storageblob'); phutil_require_module('phabricator', 'applications/files/storage/storageblob');
phutil_require_module('phabricator', 'applications/files/uri'); phutil_require_module('phabricator', 'applications/files/uri');
phutil_require_module('phabricator', 'applications/phid/storage/phid'); phutil_require_module('phabricator', 'applications/phid/storage/phid');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phutil', 'filesystem'); phutil_require_module('phutil', 'filesystem');
phutil_require_module('phutil', 'filesystem/tempfile'); phutil_require_module('phutil', 'filesystem/tempfile');

View file

@ -53,7 +53,7 @@ class PhabricatorPeopleProfileController extends PhabricatorPeopleController {
'Edit Profile'); 'Edit Profile');
} }
$fbuid = $user->getFacebookUID(); $fbuid = null; // TODO: pull from OAuth stuff
if ($fbuid) { if ($fbuid) {
$links[] = phutil_render_tag( $links[] = phutil_render_tag(
'a', 'a',