@@ -14,14 +14,14 @@ |
||
| 14 | 14 | |
| 15 | 15 | class UserCreationTask extends CreationTaskBase |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * @return IMediaWikiClient |
|
| 19 | - */ |
|
| 20 | - protected function getMediaWikiClient() |
|
| 21 | - { |
|
| 22 | - $oauth = new OAuthUserHelper($this->getTriggerUser(), $this->getDatabase(), $this->getOauthProtocolHelper(), |
|
| 23 | - $this->getSiteConfiguration()); |
|
| 17 | + /** |
|
| 18 | + * @return IMediaWikiClient |
|
| 19 | + */ |
|
| 20 | + protected function getMediaWikiClient() |
|
| 21 | + { |
|
| 22 | + $oauth = new OAuthUserHelper($this->getTriggerUser(), $this->getDatabase(), $this->getOauthProtocolHelper(), |
|
| 23 | + $this->getSiteConfiguration()); |
|
| 24 | 24 | |
| 25 | - return $oauth; |
|
| 26 | - } |
|
| 25 | + return $oauth; |
|
| 26 | + } |
|
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -15,22 +15,22 @@ |
||
| 15 | 15 | |
| 16 | 16 | class PageDropRequest extends PageCloseRequest |
| 17 | 17 | { |
| 18 | - protected function getTemplate(PdoDatabase $database) |
|
| 19 | - { |
|
| 20 | - return EmailTemplate::getDroppedTemplate(); |
|
| 21 | - } |
|
| 18 | + protected function getTemplate(PdoDatabase $database) |
|
| 19 | + { |
|
| 20 | + return EmailTemplate::getDroppedTemplate(); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - protected function confirmEmailAlreadySent(Request $request, EmailTemplate $template) |
|
| 24 | - { |
|
| 25 | - return false; |
|
| 26 | - } |
|
| 23 | + protected function confirmEmailAlreadySent(Request $request, EmailTemplate $template) |
|
| 24 | + { |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - protected function confirmAccountCreated(Request $request, EmailTemplate $template) |
|
| 29 | - { |
|
| 30 | - return false; |
|
| 31 | - } |
|
| 28 | + protected function confirmAccountCreated(Request $request, EmailTemplate $template) |
|
| 29 | + { |
|
| 30 | + return false; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - protected function sendMail(Request $request, $mailText, User $currentUser, $ccMailingList) |
|
| 34 | - { |
|
| 35 | - } |
|
| 33 | + protected function sendMail(Request $request, $mailText, User $currentUser, $ccMailingList) |
|
| 34 | + { |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -12,21 +12,21 @@ |
||
| 12 | 12 | |
| 13 | 13 | class Page404 extends InternalPageBase |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Main function for this page, when no actions are called. |
|
| 17 | - */ |
|
| 18 | - protected function main() |
|
| 19 | - { |
|
| 20 | - if (!headers_sent()) { |
|
| 21 | - header("HTTP/1.1 404 Not Found"); |
|
| 22 | - } |
|
| 15 | + /** |
|
| 16 | + * Main function for this page, when no actions are called. |
|
| 17 | + */ |
|
| 18 | + protected function main() |
|
| 19 | + { |
|
| 20 | + if (!headers_sent()) { |
|
| 21 | + header("HTTP/1.1 404 Not Found"); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - $this->skipAlerts(); |
|
| 25 | - $this->setTemplate("404.tpl"); |
|
| 26 | - } |
|
| 24 | + $this->skipAlerts(); |
|
| 25 | + $this->setTemplate("404.tpl"); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - protected function isProtectedPage() |
|
| 29 | - { |
|
| 30 | - return false; |
|
| 31 | - } |
|
| 28 | + protected function isProtectedPage() |
|
| 29 | + { |
|
| 30 | + return false; |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -13,18 +13,18 @@ |
||
| 13 | 13 | |
| 14 | 14 | class PageOtpLogin extends LoginCredentialPageBase |
| 15 | 15 | { |
| 16 | - protected function providerSpecificSetup() |
|
| 17 | - { |
|
| 18 | - $this->setTemplate('login/otp.tpl'); |
|
| 19 | - } |
|
| 16 | + protected function providerSpecificSetup() |
|
| 17 | + { |
|
| 18 | + $this->setTemplate('login/otp.tpl'); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - protected function getProviderCredentials() |
|
| 22 | - { |
|
| 23 | - $otp = WebRequest::postString("otp"); |
|
| 24 | - if ($otp === null || $otp === "") { |
|
| 25 | - throw new ApplicationLogicException("No one-time code specified"); |
|
| 26 | - } |
|
| 21 | + protected function getProviderCredentials() |
|
| 22 | + { |
|
| 23 | + $otp = WebRequest::postString("otp"); |
|
| 24 | + if ($otp === null || $otp === "") { |
|
| 25 | + throw new ApplicationLogicException("No one-time code specified"); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - return $otp; |
|
| 29 | - } |
|
| 28 | + return $otp; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | interface IXmlApiAction extends IRoutedTask, IApiAction |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Method that runs API action |
|
| 21 | - * |
|
| 22 | - * @param DOMElement $apiDocument |
|
| 23 | - * |
|
| 24 | - * @return DOMElement The modified API document |
|
| 25 | - */ |
|
| 26 | - public function executeApiAction(DOMElement $apiDocument); |
|
| 19 | + /** |
|
| 20 | + * Method that runs API action |
|
| 21 | + * |
|
| 22 | + * @param DOMElement $apiDocument |
|
| 23 | + * |
|
| 24 | + * @return DOMElement The modified API document |
|
| 25 | + */ |
|
| 26 | + public function executeApiAction(DOMElement $apiDocument); |
|
| 27 | 27 | } |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface IJsonApiAction extends IRoutedTask, IApiAction |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Method that runs API action |
|
| 20 | - * |
|
| 21 | - * @return object|array The modified API document |
|
| 22 | - */ |
|
| 23 | - public function executeApiAction(); |
|
| 18 | + /** |
|
| 19 | + * Method that runs API action |
|
| 20 | + * |
|
| 21 | + * @return object|array The modified API document |
|
| 22 | + */ |
|
| 23 | + public function executeApiAction(); |
|
| 24 | 24 | } |
@@ -16,15 +16,15 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class UnknownAction extends HelpAction implements IXmlApiAction |
| 18 | 18 | { |
| 19 | - public function executeApiAction(DOMElement $apiDocument) |
|
| 20 | - { |
|
| 21 | - $errorText = "Unknown API action specified."; |
|
| 22 | - $errorNode = $this->document->createElement("error", $errorText); |
|
| 23 | - $apiDocument->appendChild($errorNode); |
|
| 19 | + public function executeApiAction(DOMElement $apiDocument) |
|
| 20 | + { |
|
| 21 | + $errorText = "Unknown API action specified."; |
|
| 22 | + $errorNode = $this->document->createElement("error", $errorText); |
|
| 23 | + $apiDocument->appendChild($errorNode); |
|
| 24 | 24 | |
| 25 | - $helpElement = $this->getHelpElement(); |
|
| 26 | - $apiDocument->appendChild($helpElement); |
|
| 25 | + $helpElement = $this->getHelpElement(); |
|
| 26 | + $apiDocument->appendChild($helpElement); |
|
| 27 | 27 | |
| 28 | - return $apiDocument; |
|
| 29 | - } |
|
| 28 | + return $apiDocument; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -18,34 +18,34 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class HelpAction extends XmlApiPageBase implements IXmlApiAction |
| 20 | 20 | { |
| 21 | - public function executeApiAction(DOMElement $apiDocument) |
|
| 22 | - { |
|
| 23 | - $helpElement = $this->getHelpElement(); |
|
| 24 | - $apiDocument->appendChild($helpElement); |
|
| 25 | - |
|
| 26 | - return $apiDocument; |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Gets the help information |
|
| 31 | - * @return DOMElement |
|
| 32 | - */ |
|
| 33 | - protected function getHelpElement() |
|
| 34 | - { |
|
| 35 | - $helpInfo = "API help can be found at https://github.com/enwikipedia-acc/waca/wiki/API"; |
|
| 36 | - |
|
| 37 | - $help = $this->document->createElement("help"); |
|
| 38 | - $helptext = $this->document->createElement("info", $helpInfo); |
|
| 39 | - $helpactions = $this->document->createElement("actions"); |
|
| 40 | - |
|
| 41 | - foreach (ApiRequestRouter::getActionList() as $action) { |
|
| 42 | - $actionElement = $this->document->createElement("action", $action); |
|
| 43 | - $helpactions->appendChild($actionElement); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - $help->appendChild($helptext); |
|
| 47 | - $help->appendChild($helpactions); |
|
| 48 | - |
|
| 49 | - return $help; |
|
| 50 | - } |
|
| 21 | + public function executeApiAction(DOMElement $apiDocument) |
|
| 22 | + { |
|
| 23 | + $helpElement = $this->getHelpElement(); |
|
| 24 | + $apiDocument->appendChild($helpElement); |
|
| 25 | + |
|
| 26 | + return $apiDocument; |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Gets the help information |
|
| 31 | + * @return DOMElement |
|
| 32 | + */ |
|
| 33 | + protected function getHelpElement() |
|
| 34 | + { |
|
| 35 | + $helpInfo = "API help can be found at https://github.com/enwikipedia-acc/waca/wiki/API"; |
|
| 36 | + |
|
| 37 | + $help = $this->document->createElement("help"); |
|
| 38 | + $helptext = $this->document->createElement("info", $helpInfo); |
|
| 39 | + $helpactions = $this->document->createElement("actions"); |
|
| 40 | + |
|
| 41 | + foreach (ApiRequestRouter::getActionList() as $action) { |
|
| 42 | + $actionElement = $this->document->createElement("action", $action); |
|
| 43 | + $helpactions->appendChild($actionElement); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + $help->appendChild($helptext); |
|
| 47 | + $help->appendChild($helpactions); |
|
| 48 | + |
|
| 49 | + return $help; |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -23,65 +23,65 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class MonitorAction extends XmlApiPageBase implements IXmlApiAction |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @param DOMElement $apiDocument |
|
| 28 | - * |
|
| 29 | - * @return DOMElement |
|
| 30 | - */ |
|
| 31 | - public function executeApiAction(DOMElement $apiDocument) |
|
| 32 | - { |
|
| 33 | - $now = new DateTime(); |
|
| 26 | + /** |
|
| 27 | + * @param DOMElement $apiDocument |
|
| 28 | + * |
|
| 29 | + * @return DOMElement |
|
| 30 | + */ |
|
| 31 | + public function executeApiAction(DOMElement $apiDocument) |
|
| 32 | + { |
|
| 33 | + $now = new DateTime(); |
|
| 34 | 34 | |
| 35 | - $old = $this->getOldest(); |
|
| 36 | - $oldest = new DateTime($old); |
|
| 35 | + $old = $this->getOldest(); |
|
| 36 | + $oldest = new DateTime($old); |
|
| 37 | 37 | |
| 38 | - $new = $this->getNewest(); |
|
| 39 | - $newest = new DateTime($new); |
|
| 38 | + $new = $this->getNewest(); |
|
| 39 | + $newest = new DateTime($new); |
|
| 40 | 40 | |
| 41 | - $monitoringElement = $this->document->createElement("data"); |
|
| 42 | - $monitoringElement->setAttribute("date", $now->format('c')); |
|
| 43 | - $monitoringElement->setAttribute("oldest", $old === null ? null : $oldest->format('c')); |
|
| 44 | - $monitoringElement->setAttribute("newest", $new === null ? null : $newest->format('c')); |
|
| 45 | - $apiDocument->appendChild($monitoringElement); |
|
| 41 | + $monitoringElement = $this->document->createElement("data"); |
|
| 42 | + $monitoringElement->setAttribute("date", $now->format('c')); |
|
| 43 | + $monitoringElement->setAttribute("oldest", $old === null ? null : $oldest->format('c')); |
|
| 44 | + $monitoringElement->setAttribute("newest", $new === null ? null : $newest->format('c')); |
|
| 45 | + $apiDocument->appendChild($monitoringElement); |
|
| 46 | 46 | |
| 47 | - return $apiDocument; |
|
| 48 | - } |
|
| 47 | + return $apiDocument; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @return string|null |
|
| 52 | - */ |
|
| 53 | - private function getOldest() |
|
| 54 | - { |
|
| 55 | - $statement = $this->getDatabase() |
|
| 56 | - ->prepare("SELECT min(date) FROM request WHERE email != :email AND ip != :ip;"); |
|
| 57 | - $successful = $statement->execute(array( |
|
| 58 | - ':email' => $this->getSiteConfiguration()->getDataClearEmail(), |
|
| 59 | - ':ip' => $this->getSiteConfiguration()->getDataClearIp(), |
|
| 60 | - )); |
|
| 50 | + /** |
|
| 51 | + * @return string|null |
|
| 52 | + */ |
|
| 53 | + private function getOldest() |
|
| 54 | + { |
|
| 55 | + $statement = $this->getDatabase() |
|
| 56 | + ->prepare("SELECT min(date) FROM request WHERE email != :email AND ip != :ip;"); |
|
| 57 | + $successful = $statement->execute(array( |
|
| 58 | + ':email' => $this->getSiteConfiguration()->getDataClearEmail(), |
|
| 59 | + ':ip' => $this->getSiteConfiguration()->getDataClearIp(), |
|
| 60 | + )); |
|
| 61 | 61 | |
| 62 | - if (!$successful) { |
|
| 63 | - return null; |
|
| 64 | - } |
|
| 62 | + if (!$successful) { |
|
| 63 | + return null; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - $result = $statement->fetchColumn(); |
|
| 66 | + $result = $statement->fetchColumn(); |
|
| 67 | 67 | |
| 68 | - return $result; |
|
| 69 | - } |
|
| 68 | + return $result; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @return string |
|
| 73 | - */ |
|
| 74 | - private function getNewest() |
|
| 75 | - { |
|
| 76 | - $statement = $this->getDatabase() |
|
| 77 | - ->prepare("SELECT max(date) FROM request WHERE email != :email AND ip != :ip;"); |
|
| 78 | - $statement->execute(array( |
|
| 79 | - ':email' => $this->getSiteConfiguration()->getDataClearEmail(), |
|
| 80 | - ':ip' => $this->getSiteConfiguration()->getDataClearIp(), |
|
| 81 | - )); |
|
| 71 | + /** |
|
| 72 | + * @return string |
|
| 73 | + */ |
|
| 74 | + private function getNewest() |
|
| 75 | + { |
|
| 76 | + $statement = $this->getDatabase() |
|
| 77 | + ->prepare("SELECT max(date) FROM request WHERE email != :email AND ip != :ip;"); |
|
| 78 | + $statement->execute(array( |
|
| 79 | + ':email' => $this->getSiteConfiguration()->getDataClearEmail(), |
|
| 80 | + ':ip' => $this->getSiteConfiguration()->getDataClearIp(), |
|
| 81 | + )); |
|
| 82 | 82 | |
| 83 | - $result = $statement->fetchColumn(0); |
|
| 83 | + $result = $statement->fetchColumn(0); |
|
| 84 | 84 | |
| 85 | - return $result; |
|
| 86 | - } |
|
| 85 | + return $result; |
|
| 86 | + } |
|
| 87 | 87 | } |