1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +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
// alone.
'phabricator.version' => 'UNSTABLE',
// -- Files ----------------------------------------------------------------- //

View file

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

View file

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

View file

@ -34,14 +34,14 @@ class PhabricatorFileViewController extends PhabricatorFileController {
if (!$file) {
return new Aphront404Response();
}
switch ($this->view) {
case 'download':
case 'view':
$data = $file->loadFileData();
$response = new AphrontFileResponse();
$response->setContent($data);
if ($this->view == 'view') {
if (!$file->isViewableInBrowser()) {
return new Aphront400Response();
@ -50,7 +50,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
} else {
$download = true;
}
if ($download) {
$mime_type = $file->getMimeType();
} else {
@ -58,7 +58,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
}
$response->setMimeType($mime_type);
if ($download) {
$response->setDownload($file->getName());
}
@ -68,7 +68,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
}
$form = new AphrontFormView();
if ($file->isViewableInBrowser()) {
$form->setAction('/file/view/'.$file->getPHID().'/');
$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/file');
phutil_require_module('phabricator', 'applications/files/controller/base');

View file

@ -174,18 +174,18 @@ class PhabricatorFile extends PhabricatorFileDAO {
public function getViewURI() {
return PhabricatorFileURI::getViewURIForPHID($this->getPHID());
}
public function isViewableInBrowser() {
return ($this->getViewableMimeType() !== null);
}
public function getViewableMimeType() {
$mime_map = PhabricatorEnv::getEnvConfig('files.viewable-mime-types');
$mime_type = $this->getMimeType();
$mime_parts = explode(';', $mime_type);
$mime_type = reset($mime_parts);
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/uri');
phutil_require_module('phabricator', 'applications/phid/storage/phid');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phutil', 'filesystem');
phutil_require_module('phutil', 'filesystem/tempfile');

View file

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