aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Access
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-07 16:44:58 -0700
committerredmatrix <git@macgirvin.com>2016-07-07 16:44:58 -0700
commite11330a5c8e5111d08d6aee1f4dc6dda6f7c7f2a (patch)
tree5550a81eee45c59574d94fbac9176449aa69b0e7 /Zotlabs/Access
parent08a4763bfff2becc750185f99a99919e2425ab5f (diff)
downloadvolse-hubzilla-e11330a5c8e5111d08d6aee1f4dc6dda6f7c7f2a.tar.gz
volse-hubzilla-e11330a5c8e5111d08d6aee1f4dc6dda6f7c7f2a.tar.bz2
volse-hubzilla-e11330a5c8e5111d08d6aee1f4dc6dda6f7c7f2a.zip
revise how we store perm_limits
Diffstat (limited to 'Zotlabs/Access')
-rw-r--r--Zotlabs/Access/PermissionLimits.php39
1 files changed, 8 insertions, 31 deletions
diff --git a/Zotlabs/Access/PermissionLimits.php b/Zotlabs/Access/PermissionLimits.php
index ef254c3cf..909b654d5 100644
--- a/Zotlabs/Access/PermissionLimits.php
+++ b/Zotlabs/Access/PermissionLimits.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Access;
+use \Zotlabs\Lib as ZLib;
+
class PermissionLimits {
static public function Std_Limits() {
@@ -17,43 +19,18 @@ class PermissionLimits {
}
static public function Set($channel_id,$perm,$perm_limit) {
- $r = q("select * from perm_limits where channel_id = %d and perm = '%s' limit 1",
- intval($channel_id),
- dbesc($perm)
- );
- if($r) {
- if($r[0]['perm_limit'] != $perm_limit) {
- $x = q("update perm_limits set perm_limit = %d where id = %d",
- dbesc($perm_limit),
- intval($r[0]['id'])
- );
- }
- }
- else {
- $r = q("insert into perm_limits ( perm, channel_id, perm_limit )
- values ( '%s', %d, %d ) ",
- dbesc($perm),
- intval($channel_id),
- intval($perm_limit)
- );
- }
+ ZLib\PConfig::Set($channel_id,'perm_limits',$perm,$perm_limit);
}
static public function Get($channel_id,$perm = '') {
if($perm) {
- $r = q("select * from perm_limits where channel_id = %d and perm = '%s' limit 1",
- intval($channel_id),
- dbesc($perm)
- );
- if($r)
- return $r[0];
- return false;
+ return Zlib\PConfig::Get($channel_id,'perm_limits',$perm);
}
else {
- return q("select * from perm_limits where channel_id = %d",
- intval($channel_id)
- );
+ Zlib\PConfig::Load($channel_id);
+ if(array_key_exists($channel_id,\App::$config) && array_key_exists('perm_limits',\App::$config[$channel_id]))
+ return \App::$config[$channel_id]['perm_limits'];
+ return false;
}
}
-
} \ No newline at end of file