summaryrefslogtreecommitdiff
path: root/inc/subscription.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-08-12 17:30:01 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-08-12 17:30:01 +0200
commit84c1127cc070777c8cbcf488f5422bc4b71470a8 (patch)
tree74a3b8f4613110d97e2f7ce0797203c53a0ad1e6 /inc/subscription.php
parent835242b0f53a72a555ad30543a1677108ce210af (diff)
downloadrpg-84c1127cc070777c8cbcf488f5422bc4b71470a8.tar.gz
rpg-84c1127cc070777c8cbcf488f5422bc4b71470a8.tar.bz2
correctly check if subscriptions are enabled
Diffstat (limited to 'inc/subscription.php')
-rw-r--r--inc/subscription.php26
1 files changed, 22 insertions, 4 deletions
diff --git a/inc/subscription.php b/inc/subscription.php
index 9b02225f9..742f5b1a0 100644
--- a/inc/subscription.php
+++ b/inc/subscription.php
@@ -22,6 +22,15 @@
class Subscription {
/**
+ * Check if subscription system is enabled
+ *
+ * @return bool
+ */
+ public function isenabled() {
+ return actionOK('subscribe');
+ }
+
+ /**
* Return the subscription meta file for the given ID
*
* @author Adrian Lang <lang@cosmocode.de>
@@ -156,6 +165,8 @@ class Subscription {
* @return array
*/
public function subscribers($page, $user = null, $style = null, $data = null) {
+ if(!$this->isenabled()) return array();
+
// Construct list of files which may contain relevant subscriptions.
$files = array(':' => $this->file(':'));
do {
@@ -201,6 +212,8 @@ class Subscription {
* @return bool
*/
public function add($id, $user, $style, $data = '') {
+ if(!$this->isenabled()) return false;
+
// delete any existing subscription
$this->remove($id, $user);
@@ -234,6 +247,8 @@ class Subscription {
* @return bool
*/
public function remove($id, $user = null, $style = null, $data = null) {
+ if(!$this->isenabled()) return false;
+
$file = $this->file($id);
if(!file_exists($file)) return true;
@@ -254,10 +269,9 @@ class Subscription {
* @author Adrian Lang <lang@cosmocode.de>
*/
function user_subscription($id = '', $user = '') {
- global $ID;
- global $conf;
- if(!$conf['subscribers']) return false;
+ if(!$this->isenabled()) return false;
+ global $ID;
if(!$id) $id = $ID;
if(!$user) $user = $_SERVER['REMOTE_USER'];
@@ -288,6 +302,8 @@ class Subscription {
* @return int number of sent mails
*/
public function send_bulk($page) {
+ if(!$this->isenabled()) return 0;
+
/** @var auth_basic $auth */
global $auth;
global $conf;
@@ -497,9 +513,11 @@ class Subscription {
* @return string
*/
public function notifyaddresses(&$data) {
- global $conf;
+ if(!$this->isenabled()) return false;
+
/** @var auth_basic $auth */
global $auth;
+ global $conf;
$id = $data['id'];
$self = $data['self'];