Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/countdown/controller/edit/PhabricatorCountdownEditController.php b/src/applications/countdown/controller/edit/PhabricatorCountdownEditController.php
index 5af29d93e6..50dbcf9693 100644
--- a/src/applications/countdown/controller/edit/PhabricatorCountdownEditController.php
+++ b/src/applications/countdown/controller/edit/PhabricatorCountdownEditController.php
@@ -1,140 +1,140 @@
<?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.
*/
class PhabricatorCountdownEditController
extends PhabricatorCountdownController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$action_label = 'Create Timer';
- if ($this->id) {
+ if ($this->id) {
$timer = id(new PhabricatorTimer())->load($this->id);
// If no timer is found
if (!$timer) {
return new Aphront404Response();
}
if (($timer->getAuthorPHID() != $user->getPHID())
&& $user->getIsAdmin() == false) {
return new Aphront404Response();
}
$action_label = 'Update Timer';
} else {
$timer = new PhabricatorTimer();
$timer->setDatePoint(time());
}
$error_view = null;
$e_text = null;
if ($request->isFormPost()) {
$errors = array();
$title = $request->getStr('title');
$datepoint = $request->getStr('datepoint');
$e_text = null;
if (!strlen($title)) {
$e_text = 'Required';
$errors[] = 'You must give it a name.';
}
// If the user types something like "5 PM", convert it to a timestamp
// using their local time, not the server time.
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
try {
$date = new DateTime($datepoint, $timezone);
$timestamp = $date->format('U');
} catch (Exception $e) {
$errors[] = 'You entered an incorrect date. You can enter date like'.
' \'2011-06-26 13:33:37\' to create an event at'.
' 13:33:37 on the 26th of June 2011.';
$timestamp = null;
}
$timer->setTitle($title);
$timer->setDatePoint($timestamp);
if (!count($errors)) {
$timer->setAuthorPHID($user->getPHID());
$timer->save();
return id(new AphrontRedirectResponse())
->setURI('/countdown/'.$timer->getID().'/');
} else {
$error_view = id(new AphrontErrorView())
->setErrors($errors)
->setTitle('It\'s not The Final Countdown (du nu nuuu nun)' .
' until you fix these problem');
}
}
if ($timer->getDatePoint()) {
$display_datepoint = phabricator_datetime(
$timer->getDatePoint(),
$user);
} else {
$display_datepoint = $request->getStr('datepoint');
}
$form = id(new AphrontFormView())
->setUser($user)
->setAction($request->getRequestURI()->getPath())
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Title')
->setValue($timer->getTitle())
->setName('title'))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('End date')
->setValue($display_datepoint)
->setName('datepoint')
->setCaption(
'Examples: '.
'<tt>2011-12-25</tt> or '.
'<tt>3 hours</tt> or '.
'<tt>June 8 2011, 5 PM</tt>.'))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton('/countdown/')
->setValue($action_label));
$panel = id(new AphrontPanelView())
->setWidth(AphrontPanelView::WIDTH_FORM)
->setHeader($action_label)
->appendChild($form);
return $this->buildStandardPageResponse(
array(
$error_view,
$panel,
),
array(
'title' => 'Edit Countdown',
));
}
}
diff --git a/src/applications/diffusion/query/filecontent/base/DiffusionFileContentQuery.php b/src/applications/diffusion/query/filecontent/base/DiffusionFileContentQuery.php
index dd0b639e94..7f839b3728 100644
--- a/src/applications/diffusion/query/filecontent/base/DiffusionFileContentQuery.php
+++ b/src/applications/diffusion/query/filecontent/base/DiffusionFileContentQuery.php
@@ -1,146 +1,144 @@
<?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.
*/
abstract class DiffusionFileContentQuery {
private $request;
private $needsBlame;
private $fileContent;
final private function __construct() {
// <private>
}
final public static function newFromDiffusionRequest(
DiffusionRequest $request) {
$repository = $request->getRepository();
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$class = 'DiffusionGitFileContentQuery';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$class = 'DiffusionSvnFileContentQuery';
break;
default:
throw new Exception("Unsupported VCS!");
}
PhutilSymbolLoader::loadClass($class);
$query = new $class();
$query->request = $request;
return $query;
}
public function getSupportsBlameOnBlame() {
return false;
}
public function getPrevRev($rev) {
// TODO: support git once the 'parent' info of a commit is saved
// to the database.
throw new Exception("Unsupported VCS!");
}
final protected function getRequest() {
return $this->request;
}
final public function loadFileContent() {
$this->fileContent = $this->executeQuery();
}
abstract protected function executeQuery();
final public function getRawData() {
return $this->fileContent->getCorpus();
}
final public function getBlameData() {
$raw_data = $this->getRawData();
$text_list = array();
$rev_list = array();
$blame_dict = array();
if (!$this->getNeedsBlame()) {
$text_list = explode("\n", rtrim($raw_data));
} else {
foreach (explode("\n", rtrim($raw_data)) as $k => $line) {
list($rev_id, $author, $text) = $this->tokenizeLine($line);
$text_list[$k] = $text;
$rev_list[$k] = $rev_id;
if (!isset($blame_dict[$rev_id]) &&
!isset($blame_dict[$rev_id]['author'] )) {
$blame_dict[$rev_id]['author'] = $author;
}
}
$repository = $this->getRequest()->getRepository();
$commits = id(new PhabricatorRepositoryCommit())->loadAllWhere(
'repositoryID = %d AND commitIdentifier IN (%Ls)', $repository->getID(),
array_unique($rev_list));
foreach ($commits as $commit) {
$blame_dict[$commit->getCommitIdentifier()]['epoch'] =
$commit->getEpoch();
}
$commits_data = id(new PhabricatorRepositoryCommitData())->loadAllWhere(
'commitID IN (%Ls)',
mpull($commits, 'getID'));
$phids = array();
foreach ($commits_data as $data) {
$phids[] = $data->getCommitDetail('authorPHID');
}
$handles = id(new PhabricatorObjectHandleData(array_unique($phids)))
->loadHandles();
foreach ($commits_data as $data) {
if ($data->getCommitDetail('authorPHID')) {
$commit_identifier =
$commits[$data->getCommitID()]->getCommitIdentifier();
$blame_dict[$commit_identifier]['author'] =
$handles[$data->getCommitDetail('authorPHID')]->renderLink();
}
}
}
return array($text_list, $rev_list, $blame_dict);
}
abstract protected function tokenizeLine($line);
- public function setNeedsBlame($needs_blame)
- {
+ public function setNeedsBlame($needs_blame) {
$this->needsBlame = $needs_blame;
}
- public function getNeedsBlame()
- {
+ public function getNeedsBlame() {
return $this->needsBlame;
}
}
diff --git a/src/infrastructure/celerity/api/CelerityAPI.php b/src/infrastructure/celerity/api/CelerityAPI.php
index 16f7b640ba..d39c66f742 100644
--- a/src/infrastructure/celerity/api/CelerityAPI.php
+++ b/src/infrastructure/celerity/api/CelerityAPI.php
@@ -1,36 +1,36 @@
<?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.
*/
/**
* Indirection layer which provisions for a terrifying future where we need to
* build multiple resource responses per page.
*
* @group celerity
*/
final class CelerityAPI {
private static $response;
public static function getStaticResourceResponse() {
if (empty(self::$response)) {
self::$response = new CelerityStaticResourceResponse();
}
return self::$response;
}
-}
\ No newline at end of file
+}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 20:43 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128542
Default Alt Text
(10 KB)

Event Timeline