aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-11 14:02:27 -0800
committerfriendica <info@friendica.com>2015-01-11 14:02:27 -0800
commitb018b39e6473b74599a9cefe1ed8bae923424ff4 (patch)
tree4c1bda793d1ec245e31af91d0c88c55978d23c85 /include
parent4c31598555cfbe5623c3cfa73b41cded7a6981f5 (diff)
parent6599ae052b5efd43fced4b79ea00757406a3611e (diff)
downloadvolse-hubzilla-b018b39e6473b74599a9cefe1ed8bae923424ff4.tar.gz
volse-hubzilla-b018b39e6473b74599a9cefe1ed8bae923424ff4.tar.bz2
volse-hubzilla-b018b39e6473b74599a9cefe1ed8bae923424ff4.zip
Merge branch 'master' into trinidad
Diffstat (limited to 'include')
-rw-r--r--include/account.php26
-rw-r--r--include/identity.php2
2 files changed, 27 insertions, 1 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();
diff --git a/include/identity.php b/include/identity.php
index 17238ea99..2f400520f 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -34,7 +34,7 @@ function identity_check_service_class($account_id) {
$ret['total_identities'] = intval($r[0]['total']);
- if(! service_class_allows($account_id,'total_identities',$r[0]['total'])) {
+ if(! account_service_class_allows($account_id,'total_identities',$r[0]['total'])) {
$result['message'] .= upgrade_message();
return $result;
}