1
0
Fork 0

post permission hooks

This commit is contained in:
Friendika 2011-02-09 19:39:49 -08:00
parent 05c52ae81d
commit de2c9531db
2 changed files with 24 additions and 0 deletions

View file

@ -3,6 +3,8 @@
function group_select($selname,$selclass,$preselected = false,$size = 4) { function group_select($selname,$selclass,$preselected = false,$size = 4) {
$a = get_app();
$o = ''; $o = '';
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
@ -11,6 +13,13 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$_SESSION['uid'] $_SESSION['uid']
); );
$arr = array('group' => $r, 'entry' => $o);
// e.g. 'network_pre_group_deny', 'profile_pre_group_allow'
call_hooks($a->module . '_pre_' . $selname, $arr);
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
@ -25,6 +34,8 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
} }
$o .= "</select>\r\n"; $o .= "</select>\r\n";
call_hooks($a->module . '_post_' . $selname, $o);
return $o; return $o;
} }
@ -60,6 +71,15 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
intval(local_user()) intval(local_user())
); );
$arr = array('contact' => $r, 'entry' => $o);
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
call_hooks($a->module . '_pre_' . $selname, $arr);
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
@ -73,8 +93,10 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
} }
} }
$o .= "</select>\r\n"; $o .= "</select>\r\n";
call_hooks($a->module . '_post_' . $selname, $o);
return $o; return $o;
} }

View file

@ -22,6 +22,8 @@ function item_post(&$a) {
$uid = local_user(); $uid = local_user();
call_hooks('post_local_start', $_POST);
$parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0); $parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0);
$parent_item = null; $parent_item = null;