diff options
author | redmatrix <git@macgirvin.com> | 2016-04-28 21:02:27 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-28 21:02:27 -0700 |
commit | bb96f44861c66e9eb334e18e4b4b659685433008 (patch) | |
tree | 1f1d7b789829502c61a8a3defbecf37bc4a5dba9 /include | |
parent | 30a6ae3daa42da8d1d9560fcc4c706b3e41c4d80 (diff) | |
download | volse-hubzilla-bb96f44861c66e9eb334e18e4b4b659685433008.tar.gz volse-hubzilla-bb96f44861c66e9eb334e18e4b4b659685433008.tar.bz2 volse-hubzilla-bb96f44861c66e9eb334e18e4b4b659685433008.zip |
allow engineering units (e.g. 400M, 1G) as service class limits
Diffstat (limited to 'include')
-rw-r--r-- | include/account.php | 3 | ||||
-rw-r--r-- | include/photos.php | 2 | ||||
-rw-r--r-- | include/text.php | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/include/account.php b/include/account.php index c64197b49..5998609d4 100644 --- a/include/account.php +++ b/include/account.php @@ -591,6 +591,7 @@ function service_class_allows($uid, $property, $usage = false) { if($limit === false) return true; // No service class set => everything is allowed + $limit = engr_units_to_bytes($limit); if($usage === false) { // We use negative values for not allowed properties in a subscriber plan return ((x($limit)) ? (bool) $limit : true); @@ -627,6 +628,8 @@ function account_service_class_allows($aid, $property, $usage = false) { if($limit === false) return true; // No service class is set => everything is allowed + $limit = engr_units_to_bytes($limit); + if($usage === false) { // We use negative values for not allowed properties in a subscriber plan return ((x($limit)) ? (bool) $limit : true); diff --git a/include/photos.php b/include/photos.php index d088d455a..73a29d8eb 100644 --- a/include/photos.php +++ b/include/photos.php @@ -131,7 +131,7 @@ function photo_upload($channel, $observer, $args) { intval($account_id) ); - $limit = service_class_fetch($channel_id,'photo_upload_limit'); + $limit = engr_units_to_bytes(service_class_fetch($channel_id,'photo_upload_limit')); if (($r) && ($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) { $ret['message'] = upgrade_message(); diff --git a/include/text.php b/include/text.php index 926e2eed6..f1043909d 100644 --- a/include/text.php +++ b/include/text.php @@ -1825,7 +1825,7 @@ function lang_selector() { } -function return_bytes ($size_str) { +function engr_units_to_bytes ($size_str) { switch (substr ($size_str, -1)) { case 'M': case 'm': return (int)$size_str * 1048576; case 'K': case 'k': return (int)$size_str * 1024; |