summaryrefslogtreecommitdiff
path: root/actions/postnotice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-21 08:29:51 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-21 08:29:51 -0400
commitc78772b2748f70acc8158b665218fe53b277a031 (patch)
tree8ff1886b3a95002880c605745029ba52b7303b4f /actions/postnotice.php
parentcb2184ed448ecb043d825d4d12b8193d63c4d84c (diff)
parent70235d7f05d2ce7dda77af88518612fa005783df (diff)
Merge branch '0.9.x' of git@gitorious.org:laconica/mainline into 0.9.x
Conflicts: actions/postnotice.php
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));
+ }
}
}
?>