aboutsummaryrefslogtreecommitdiffstats
path: root/include/account.php
diff options
context:
space:
mode:
authorChristian Vogeley <christian.vogeley@hotmail.de>2015-01-11 16:12:36 +0100
committerChristian Vogeley <christian.vogeley@hotmail.de>2015-01-11 16:12:36 +0100
commit43f143a211c75138d09ceb89acc48ea7d5c31ca9 (patch)
treed2ad3711e3ad31a694973be736e3a7e705a4634e /include/account.php
parent4a0150026b5b503b64471673c8621c857a38df57 (diff)
downloadvolse-hubzilla-43f143a211c75138d09ceb89acc48ea7d5c31ca9.tar.gz
volse-hubzilla-43f143a211c75138d09ceb89acc48ea7d5c31ca9.tar.bz2
volse-hubzilla-43f143a211c75138d09ceb89acc48ea7d5c31ca9.zip
Fix for issue #763 Error creating new channel within the limits of the
subscription plan
Diffstat (limited to 'include/account.php')
-rw-r--r--include/account.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/account.php b/include/account.php
index 8df44acba..88036e2ef 100644
--- a/include/account.php
+++ b/include/account.php
@@ -590,6 +590,32 @@ function service_class_allows($uid,$property,$usage = false) {
}
}
+// like service_class_allows but queries by account rather than channel
+function account_service_class_allows($aid,$property,$usage = false) {
+ $a = get_app();
+ $r = q("select account_service_class as service_class from account where account_id = %d limit 1",
+ intval($aid)
+ );
+ if($r !== false and count($r)) {
+ $service_class = $r[0]['service_class'];
+ }
+
+ if(! x($service_class))
+ return true; // everything is allowed
+
+ $arr = get_config('service_class',$service_class);
+ if(! is_array($arr) || (! count($arr)))
+ return true;
+
+ if($usage === false)
+ return ((x($arr[$property])) ? (bool) $arr[$property] : true);
+ else {
+ if(! array_key_exists($property,$arr))
+ return true;
+ return (((intval($usage)) < intval($arr[$property])) ? true : false);
+ }
+}
+
function service_class_fetch($uid,$property) {
$a = get_app();