aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/follow.php36
-rw-r--r--include/plugin.php15
-rw-r--r--view/en/update_fail_eml.tpl2
3 files changed, 51 insertions, 2 deletions
diff --git a/include/follow.php b/include/follow.php
index 22288a0da..b4d1732b8 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -62,6 +62,11 @@ function new_contact($uid,$url,$interactive = false) {
}
}
+
+
+
+
+
// This extra param just confuses things, remove it
if($ret['network'] === NETWORK_DIASPORA)
$ret['url'] = str_replace('?absolute=true','',$ret['url']);
@@ -89,6 +94,11 @@ function new_contact($uid,$url,$interactive = false) {
$ret['notify'] = '';
}
+
+
+
+
+
if(! $ret['notify']) {
$result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
}
@@ -129,6 +139,32 @@ function new_contact($uid,$url,$interactive = false) {
}
else {
+
+ // check service class limits
+
+ $r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
+ intval($uid)
+ );
+ if(count($r))
+ $total_contacts = $r[0]['total'];
+
+ if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
+ $result['message'] .= upgrade_message();
+ return $result;
+ }
+
+ $r = q("select count(network) as total from contact where uid = %d and network = '%s' and pending = 0 and self = 0",
+ intval($uid),
+ dbesc($network)
+ );
+ if(count($r))
+ $total_network = $r[0]['total'];
+
+ if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
+ $result['message'] .= upgrade_message();
+ return $result;
+ }
+
$new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
if($ret['network'] === NETWORK_DIASPORA)
$new_relation = CONTACT_IS_FOLLOWER;
diff --git a/include/plugin.php b/include/plugin.php
index 3b6faa072..89715485e 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -353,4 +353,17 @@ function service_class_allows($uid,$property,$usage = false) {
return true;
return (((intval($usage)) < intval($arr[$property])) ? true : false);
}
-} \ No newline at end of file
+}
+
+function upgrade_link() {
+ $l = get_config('service_class','upgrade_link');
+ $t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
+ if($l)
+ return $t;
+ return '';
+}
+
+function upgrade_message() {
+ $x = upgrade_link();
+ return t('This action exceeds the limits set by your subscription plan.') . (($x) ? ' ' . $x : '') ;
+}
diff --git a/view/en/update_fail_eml.tpl b/view/en/update_fail_eml.tpl
index f68a3dece..548e1a0df 100644
--- a/view/en/update_fail_eml.tpl
+++ b/view/en/update_fail_eml.tpl
@@ -1,5 +1,5 @@
Hey,
-I'm $sitename.
+I'm $sitename;
The friendica developers released update $update recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a