summaryrefslogtreecommitdiff
path: root/actions/postnotice.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/postnotice.php')
-rw-r--r--actions/postnotice.php30
1 files changed, 26 insertions, 4 deletions
diff --git a/actions/postnotice.php b/actions/postnotice.php
index 3d2c4d5b4..14152a83d 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -47,12 +47,28 @@ require_once INSTALLDIR.'/extlib/libomb/service_provider.php';
*/
class PostnoticeAction extends Action
{
+ /**
+ * For initializing members of the class.
+ *
+ * @param array $argarray misc. arguments
+ *
+ * @return boolean true
+ */
+ function prepare($argarray)
+ {
+ parent::prepare($argarray);
+ try {
+ $this->checkNotice();
+ } catch (Exception $e) {
+ $this->clientError($e->getMessage());
+ return false;
+ }
+ return true;
+ }
+
function handle($args)
{
parent::handle($args);
- if (!$this->checkNotice()) {
- return;
- }
try {
$srv = new OMB_Service_Provider(null, omb_oauth_datastore(),
omb_oauth_server());
@@ -70,7 +86,13 @@ class PostnoticeAction extends Action
$this->clientError(_('Invalid notice content'), 400);
return false;
}
- return true;
+ $license = $_POST['omb_notice_license'];
+ $site_license = common_config('license', 'url');
+ if ($license && !common_compatible_license($license, $site_license)) {
+ throw new Exception(sprintf(_('Notice license ā€˜%sā€™ is not ' .
+ 'compatible with site license ā€˜%sā€™.'),
+ $license, $site_license));
+ }
}
}
?>