mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Kill PhabricatorFileURI
Summary: we used to need this function for security purposes, but no longer need it. remove it so that some call sites can be optimized via smarter data fetching, and so the whole codebase can have one less thing in it. Test Plan: verified the images displayed properly for each of the following - viewed a diff with added images. - viewed a user feed - viewed a user profile - viewed all image macros - viewed a paste and clicked through "raw link" weakness in testing around proxy files and transformed files. not sure what these are. changes here are very programmatic however. Reviewers: epriestley Reviewed By: epriestley CC: aran, btrahan, epriestley Maniphest Tasks: T672 Differential Revision: https://secure.phabricator.com/D1354
This commit is contained in:
parent
b9cac3bcd1
commit
84ea5c53e4
36 changed files with 122 additions and 133 deletions
|
@ -475,7 +475,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFileStorageEngine' => 'applications/files/engine/base',
|
||||
'PhabricatorFileStorageEngineSelector' => 'applications/files/engineselector/base',
|
||||
'PhabricatorFileTransformController' => 'applications/files/controller/transform',
|
||||
'PhabricatorFileURI' => 'applications/files/uri',
|
||||
'PhabricatorFileUploadController' => 'applications/files/controller/upload',
|
||||
'PhabricatorFileUploadException' => 'applications/files/exception/upload',
|
||||
'PhabricatorFileUploadView' => 'applications/files/view/upload',
|
||||
|
|
|
@ -867,7 +867,6 @@ class DifferentialChangesetParser {
|
|||
$range_len = null,
|
||||
$mask_force = array()) {
|
||||
|
||||
|
||||
// "Top level" renders are initial requests for the whole file, versus
|
||||
// requests for a specific range generated by clicking "show more". We
|
||||
// generate property changes and "shield" UI elements only for toplevel
|
||||
|
@ -915,21 +914,37 @@ class DifferentialChangesetParser {
|
|||
}
|
||||
|
||||
if ($old_phid || $new_phid) {
|
||||
|
||||
// grab the files, (micro) optimization for 1 query not 2
|
||||
$file_phids = array();
|
||||
if ($old_phid) {
|
||||
$old_uri = PhabricatorFileURI::getViewURIForPHID($old_phid);
|
||||
$old = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $old_uri,
|
||||
));
|
||||
$file_phids[] = $old_phid;
|
||||
}
|
||||
if ($new_phid) {
|
||||
$new_uri = PhabricatorFileURI::getViewURIForPHID($new_phid);
|
||||
$cur = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $new_uri,
|
||||
));
|
||||
$file_phids[] = $new_phid;
|
||||
}
|
||||
|
||||
$files = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid IN (%Ls)',
|
||||
$file_phids);
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (empty($file)) {
|
||||
continue;
|
||||
}
|
||||
if ($file->getPHID() == $old_phid) {
|
||||
$old = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $file->getBestURI(),
|
||||
));
|
||||
} else {
|
||||
$cur = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $file->getBestURI(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ phutil_require_module('phabricator', 'aphront/writeguard');
|
|||
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/changeset');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/inlinecomment');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/markup/syntax');
|
||||
phutil_require_module('phabricator', 'infrastructure/diff/engine');
|
||||
phutil_require_module('phabricator', 'infrastructure/events/constant/type');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -66,9 +66,8 @@ class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
|
|||
}
|
||||
|
||||
if ($full_size) {
|
||||
if (!empty($objects[$author_phid])) {
|
||||
$image_phid = $objects[$author_phid]->getProfileImagePHID();
|
||||
$image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
|
||||
if (!empty($handles[$author_phid])) {
|
||||
$image_uri = $handles[$author_phid]->getImageURI();
|
||||
$view->setImage($image_uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
phutil_require_module('phabricator', 'applications/differential/constants/action');
|
||||
phutil_require_module('phabricator', 'applications/feed/story/base');
|
||||
phutil_require_module('phabricator', 'applications/feed/view/story');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -42,6 +42,7 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
|||
$task_phid = $data->getValue('taskPHID');
|
||||
|
||||
$objects = $this->getObjects();
|
||||
$handles = $this->getHandles();
|
||||
$action = $data->getValue('action');
|
||||
|
||||
$view = new PhabricatorFeedStoryView();
|
||||
|
@ -82,9 +83,8 @@ class PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
|
|||
$view->setEpoch($data->getEpoch());
|
||||
|
||||
if ($full_size) {
|
||||
if (!empty($objects[$author_phid])) {
|
||||
$image_phid = $objects[$author_phid]->getProfileImagePHID();
|
||||
$image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
|
||||
if (!empty($handles[$author_phid])) {
|
||||
$image_uri = $handles[$author_phid]->getImageURI();
|
||||
$view->setImage($image_uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
phutil_require_module('phabricator', 'applications/feed/story/base');
|
||||
phutil_require_module('phabricator', 'applications/feed/view/story');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/action');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -62,9 +62,8 @@ class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory {
|
|||
}
|
||||
|
||||
if ($full_size) {
|
||||
if (!empty($objects[$author_phid])) {
|
||||
$image_phid = $objects[$author_phid]->getProfileImagePHID();
|
||||
$image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
|
||||
if (!empty($handles[$author_phid])) {
|
||||
$image_uri = $handles[$author_phid]->getImageURI();
|
||||
$view->setImage($image_uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
phutil_require_module('phabricator', 'applications/feed/story/base');
|
||||
phutil_require_module('phabricator', 'applications/feed/view/story');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/phriction/constants/action');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -44,9 +44,8 @@ class PhabricatorFeedStoryStatus extends PhabricatorFeedStory {
|
|||
'<strong>'.$handles[$author_phid]->renderLink().'</strong>');
|
||||
$view->setEpoch($data->getEpoch());
|
||||
|
||||
if (!empty($objects[$author_phid])) {
|
||||
$image_phid = $objects[$author_phid]->getProfileImagePHID();
|
||||
$image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
|
||||
if (!empty($handles[$author_phid])) {
|
||||
$image_uri = $handles[$author_phid]->getImageURI();
|
||||
$view->setImage($image_uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
phutil_require_module('phabricator', 'applications/feed/story/base');
|
||||
phutil_require_module('phabricator', 'applications/feed/view/story');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -52,11 +52,12 @@ class PhabricatorFileMacroListController extends PhabricatorFileController {
|
|||
$handles = id(new PhabricatorObjectHandleData($author_phids))
|
||||
->loadHandles();
|
||||
}
|
||||
$files_map = mpull($files, null, 'getPHID');
|
||||
|
||||
$rows = array();
|
||||
foreach ($macros as $macro) {
|
||||
$src = PhabricatorFileURI::getViewURIForPHID($macro->getFilePHID());
|
||||
$file_phid = $macro->getFilePHID();
|
||||
$file = $files_map[$file_phid];
|
||||
$author_link = isset($author_phids[$file_phid])
|
||||
? $handles[$author_phids[$file_phid]]->renderLink()
|
||||
: null;
|
||||
|
@ -73,13 +74,13 @@ class PhabricatorFileMacroListController extends PhabricatorFileController {
|
|||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $src,
|
||||
'href' => $file->getBestURI(),
|
||||
'target' => '_blank',
|
||||
),
|
||||
phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $src,
|
||||
'src' => $file->getBestURI(),
|
||||
))),
|
||||
javelin_render_tag(
|
||||
'a',
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
phutil_require_module('phabricator', 'applications/files/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/imagemacro');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/files/view/sidenav');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -52,7 +52,16 @@ class PhabricatorFileProxyController extends PhabricatorFileController {
|
|||
}
|
||||
|
||||
if ($proxy) {
|
||||
$view_uri = PhabricatorFileURI::getViewURIForPHID($proxy->getFilePHID());
|
||||
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s',
|
||||
$proxy->getFilePHID());
|
||||
if ($file) {
|
||||
$view_uri = $file->getBestURI();
|
||||
} else {
|
||||
$bad_phid = $proxy->getFilePHID();
|
||||
throw new Exception(
|
||||
"Unable to load file with phid {$bad_phid}."
|
||||
);
|
||||
}
|
||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ phutil_require_module('phabricator', 'aphront/writeguard');
|
|||
phutil_require_module('phabricator', 'applications/files/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/proxyimage');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -113,10 +113,21 @@ class PhabricatorFileTransformController extends PhabricatorFileController {
|
|||
private function buildTransformedFileResponse(
|
||||
PhabricatorTransformedFile $xform) {
|
||||
|
||||
$file = id(new PhabricatorFile())->loadOneWhere(
|
||||
'phid = %s',
|
||||
$xform->getTransformedPHID());
|
||||
if ($file) {
|
||||
$uri = $file->getBestURI();
|
||||
} else {
|
||||
$bad_phid = $xform->getTransformedPHID();
|
||||
throw new Exception(
|
||||
"Unable to load file with phid {$bad_phid}."
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: We could just delegate to the file view controller instead,
|
||||
// which would save the client a roundtrip, but is slightly more complex.
|
||||
return id(new AphrontRedirectResponse())->setURI(
|
||||
PhabricatorFileURI::getViewURIForPHID($xform->getTransformedPHID()));
|
||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||
}
|
||||
|
||||
private function executeThumbTransform(PhabricatorFile $file, $x, $y) {
|
||||
|
|
|
@ -14,7 +14,6 @@ phutil_require_module('phabricator', 'applications/files/controller/base');
|
|||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/transformed');
|
||||
phutil_require_module('phabricator', 'applications/files/transform');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -184,6 +184,11 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
|||
$transformations = id(new PhabricatorTransformedFile())->loadAllWhere(
|
||||
'originalPHID = %s',
|
||||
$file->getPHID());
|
||||
$transformed_phids = mpull($transformations, 'getTransformedPHID');
|
||||
$transformed_files = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid in (%Ls)',
|
||||
$transformed_phids);
|
||||
$transformed_map = mpull($transformed_files, null, 'getPHID');
|
||||
$rows = array();
|
||||
foreach ($transformations as $transformed) {
|
||||
$phid = $transformed->getTransformedPHID();
|
||||
|
@ -192,7 +197,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
|||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => PhabricatorFileURI::getViewURIForPHID($phid),
|
||||
'href' => $transformed_map[$phid]->getBestURI(),
|
||||
),
|
||||
$phid));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ phutil_require_module('phabricator', 'aphront/response/redirect');
|
|||
phutil_require_module('phabricator', 'applications/files/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/transformed');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/people/storage/user');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class PhabricatorFileURI {
|
||||
|
||||
public static function getViewURIForPHID($phid) {
|
||||
|
||||
// TODO: Get rid of this class, the advent of the applet attack makes the
|
||||
// tiny optimization it represented effectively obsolete.
|
||||
|
||||
$file = id(new PhabricatorFile())->loadOneWhere(
|
||||
'phid = %s',
|
||||
$phid);
|
||||
if ($file) {
|
||||
return $file->getViewURI();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorFileURI.php');
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -62,7 +62,7 @@ class PhabricatorPasteViewController extends PhabricatorPasteController {
|
|||
),
|
||||
'Fork This'));
|
||||
|
||||
$raw_uri = PhabricatorFileURI::getViewURIForPHID($paste->getFilePHID());
|
||||
$raw_uri = $file->getBestURI();
|
||||
$paste_panel->addButton(
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
phutil_require_module('phabricator', 'aphront/response/400');
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/markup/syntax');
|
||||
phutil_require_module('phabricator', 'applications/paste/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/paste/storage/paste');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -115,7 +115,12 @@ class PhabricatorPeopleProfileController extends PhabricatorPeopleController {
|
|||
}
|
||||
|
||||
$src_phid = $user->getProfileImagePHID();
|
||||
$picture = PhabricatorFileURI::getViewURIForPHID($src_phid);
|
||||
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
|
||||
if ($file) {
|
||||
$picture = $file->getBestURI();
|
||||
} else {
|
||||
$picture = null;
|
||||
}
|
||||
|
||||
$header = new PhabricatorProfileHeaderView();
|
||||
$header
|
||||
|
|
|
@ -10,7 +10,7 @@ phutil_require_module('phabricator', 'aphront/response/404');
|
|||
phutil_require_module('phabricator', 'applications/auth/oauth/provider/base');
|
||||
phutil_require_module('phabricator', 'applications/feed/builder/feed');
|
||||
phutil_require_module('phabricator', 'applications/feed/query');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/markup/engine');
|
||||
phutil_require_module('phabricator', 'applications/people/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/people/storage/profile');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -96,8 +96,14 @@ class PhabricatorUserProfileSettingsPanelController
|
|||
}
|
||||
}
|
||||
|
||||
$img_src = PhabricatorFileURI::getViewURIForPHID(
|
||||
$file = id(new PhabricatorFile())->loadOneWhere(
|
||||
'phid = %s',
|
||||
$user->getProfileImagePHID());
|
||||
if ($file) {
|
||||
$img_src = $file->getBestURI();
|
||||
} else {
|
||||
$img_src = null;
|
||||
}
|
||||
$profile_uri = PhabricatorEnv::getURI('/p/'.$user->getUsername().'/');
|
||||
|
||||
$form = new AphrontFormView();
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/transform');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/people/controller/settings/panels/base');
|
||||
phutil_require_module('phabricator', 'applications/people/storage/profile');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
|
|
@ -140,7 +140,7 @@ class PhabricatorObjectHandleData {
|
|||
$images = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid IN (%Ls)',
|
||||
$image_phids);
|
||||
$images = mpull($images, 'getViewURI', 'getPHID');
|
||||
$images = mpull($images, 'getBestURI', 'getPHID');
|
||||
}
|
||||
|
||||
foreach ($phids as $phid) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -44,7 +44,15 @@ class PhabricatorProjectProfileController
|
|||
if (!$src_phid) {
|
||||
$src_phid = $user->getProfileImagePHID();
|
||||
}
|
||||
$picture = PhabricatorFileURI::getViewURIForPHID($src_phid);
|
||||
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s',
|
||||
$src_phid);
|
||||
if ($file) {
|
||||
$picture = $file->getBestURI();
|
||||
} else {
|
||||
$picture = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$nav_view = new AphrontSideNavFilterView();
|
||||
$uri = new PhutilURI('/project/view/'.$project->getID().'/');
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'applications/feed/builder/feed');
|
||||
phutil_require_module('phabricator', 'applications/feed/query');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/query');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/tasksummary');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -54,17 +54,7 @@ final class PhabricatorSearchResultView extends AphrontView {
|
|||
),
|
||||
PhabricatorEnv::getProductionURI($handle->getURI()));
|
||||
|
||||
switch ($handle->getType()) {
|
||||
case PhabricatorPHIDConstants::PHID_TYPE_USER:
|
||||
if ($this->object) {
|
||||
$img_phid = $this->object->getProfileImagePHID();
|
||||
$img = PhabricatorFileURI::getViewURIForPHID($img_phid);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$img = null;
|
||||
break;
|
||||
}
|
||||
$img = $handle->getImageURI();
|
||||
|
||||
if ($img) {
|
||||
$img = phutil_render_tag(
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -403,8 +403,7 @@ class PhabricatorSlowvotePollController
|
|||
continue;
|
||||
}
|
||||
|
||||
$profile_image = PhabricatorFileURI::getViewURIForPHID(
|
||||
$object->getProfileImagePHID());
|
||||
$profile_image = $handle->getImageURI();
|
||||
|
||||
$user_markup[] = phutil_render_tag(
|
||||
'a',
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
phutil_require_module('phabricator', 'applications/markup/engine');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/slowvote/controller/base');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -69,11 +69,17 @@ class PhabricatorRemarkupRuleImageMacro
|
|||
$phid = $this->images[$matches[1]];
|
||||
}
|
||||
|
||||
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $phid);
|
||||
if ($file) {
|
||||
$src_uri = $file->getBestURI();
|
||||
} else {
|
||||
$src_uri = null;
|
||||
}
|
||||
|
||||
$img = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => PhabricatorFileURI::getViewURIForPHID($phid),
|
||||
'src' => $src_uri,
|
||||
'alt' => $matches[1],
|
||||
'title' => $matches[1]),
|
||||
null);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/imagemacro');
|
||||
phutil_require_module('phabricator', 'applications/files/uri');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/base');
|
||||
|
|
Loading…
Reference in a new issue