Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php final class PhabricatorDashboardArchiveController extends PhabricatorDashboardCon..
Decoded Output download
<?php
final class PhabricatorDashboardArchiveController
extends PhabricatorDashboardController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$dashboard) {
return new Aphront404Response();
}
$view_uri = $dashboard->getURI();
if ($request->isFormPost()) {
if ($dashboard->isArchived()) {
$new_status = PhabricatorDashboard::STATUS_ACTIVE;
} else {
$new_status = PhabricatorDashboard::STATUS_ARCHIVED;
}
$xactions = array();
$xactions[] = id(new PhabricatorDashboardTransaction())
->setTransactionType(
PhabricatorDashboardStatusTransaction::TRANSACTIONTYPE)
->setNewValue($new_status);
id(new PhabricatorDashboardTransactionEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->applyTransactions($dashboard, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
if ($dashboard->isArchived()) {
$title = pht('Activate Dashboard');
$body = pht('This dashboard will become active again.');
$button = pht('Activate Dashboard');
} else {
$title = pht('Archive Dashboard');
$body = pht('This dashboard will be marked as archived.');
$button = pht('Archive Dashboard');
}
return $this->newDialog()
->setTitle($title)
->appendChild($body)
->addCancelButton($view_uri)
->addSubmitButton($button);
}
}
?>
Did this file decode correctly?
Original Code
<?php
final class PhabricatorDashboardArchiveController
extends PhabricatorDashboardController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$dashboard) {
return new Aphront404Response();
}
$view_uri = $dashboard->getURI();
if ($request->isFormPost()) {
if ($dashboard->isArchived()) {
$new_status = PhabricatorDashboard::STATUS_ACTIVE;
} else {
$new_status = PhabricatorDashboard::STATUS_ARCHIVED;
}
$xactions = array();
$xactions[] = id(new PhabricatorDashboardTransaction())
->setTransactionType(
PhabricatorDashboardStatusTransaction::TRANSACTIONTYPE)
->setNewValue($new_status);
id(new PhabricatorDashboardTransactionEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true)
->applyTransactions($dashboard, $xactions);
return id(new AphrontRedirectResponse())->setURI($view_uri);
}
if ($dashboard->isArchived()) {
$title = pht('Activate Dashboard');
$body = pht('This dashboard will become active again.');
$button = pht('Activate Dashboard');
} else {
$title = pht('Archive Dashboard');
$body = pht('This dashboard will be marked as archived.');
$button = pht('Archive Dashboard');
}
return $this->newDialog()
->setTitle($title)
->appendChild($body)
->addCancelButton($view_uri)
->addSubmitButton($button);
}
}
Function Calls
None |
Stats
MD5 | a0ec2c8d441ec935f27417d6f4bd913d |
Eval Count | 0 |
Decode Time | 122 ms |