Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/controller/PhrictionDiffController.php
<?php | <?php | ||||
/** | /** | ||||
* @group phriction | * @group phriction | ||||
*/ | */ | ||||
final class PhrictionDiffController | final class PhrictionDiffController | ||||
extends PhrictionController { | extends PhrictionController { | ||||
private $id; | private $id; | ||||
public function willProcessRequest(array $data) { | public function willProcessRequest(array $data) { | ||||
$this->id = $data['id']; | $this->id = $data['id']; | ||||
} | } | ||||
public function processRequest() { | public function processRequest() { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$user = $request->getUser(); | $user = $request->getUser(); | ||||
$document = id(new PhrictionDocument())->load($this->id); | $document = id(new PhrictionDocumentQuery()) | ||||
->setViewer($user) | |||||
->withIDs(array($this->id)) | |||||
->needContent(true) | |||||
->executeOne(); | |||||
if (!$document) { | if (!$document) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$current = id(new PhrictionContent())->load($document->getContentID()); | $current = $document->getContent(); | ||||
$l = $request->getInt('l'); | $l = $request->getInt('l'); | ||||
$r = $request->getInt('r'); | $r = $request->getInt('r'); | ||||
$ref = $request->getStr('ref'); | $ref = $request->getStr('ref'); | ||||
if ($ref) { | if ($ref) { | ||||
list($l, $r) = explode(',', $ref); | list($l, $r) = explode(',', $ref); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |