Newer
Older
<?php
class DeliberationWrite extends APIBase {
public function __construct($main, $action) {
parent::__construct($main, $action);
}
public function execute() {
parent::checkUserRightsAny(["deliberation-write"]);
$user = $this->getUser();
$title = Title::newFromText($this->getParameter('title'));
$value = $this->getParameter("value");
if(!Deliberation::limitHit($user, $value)) {
Deliberation::save($user, $title, $value);
}
}
public function mustBePosted() {
return true;
}
public function getAllowedParams() {
return [
"value" => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => 'true'
],
"title" => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => 'true'
]
];
}
}
?>