True); function uiaclprefs() { $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); } function index() { $acl_app = get_var('acl_app',array('POST','GET')); $owner = get_var('owner',array('POST','GET')); if (! $acl_app) { $acl_app = 'preferences'; $acl_app_not_passed = True; } else { $GLOBALS['phpgw']->translation->add_app($acl_app); } $_SESSION['acl_app'] = $acl_app; $GLOBALS['phpgw_info']['flags']['currentapp'] = $acl_app; if ($acl_app_not_passed) { if(is_object($GLOBALS['phpgw']->log)) { $GLOBALS['phpgw']->log->message(array( 'text' => 'F-BadmenuactionVariable, failed to pass acl_app.', 'line' => __LINE__, 'file' => __FILE__ )); $GLOBALS['phpgw']->log->commit(); } } if ($GLOBALS['phpgw_info']['server']['deny_user_grants_access'] && !isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) { echo '
'; //print_r($just_owner_array); //echo ''; // end jakjr if ($_POST['submit']) { $processed = $_POST['processed']; $to_remove = unserialize(urldecode($processed)); /* User records */ $user_variable = $_POST['u_'.$GLOBALS['phpgw_info']['flags']['currentapp']]; /* Group records */ $group_variable = $_POST['g_'.$GLOBALS['phpgw_info']['flags']['currentapp']]; $keys_to_keep = array(); if(!empty($user_variable)) { foreach($user_variable as $key_user=>$value) { $temp = explode("_",$key_user); $keys_to_keep[(int)$temp[0]] = 1; } } $to_remove_count = count($to_remove); for($i=0;$i<$to_remove_count;++$i) { if(!array_key_exists((int)$to_remove[$i],$keys_to_keep)) { $this->acl->persist_shared_groups($to_remove[$i]); } $this->acl->delete($GLOBALS['phpgw_info']['flags']['currentapp'],$to_remove[$i]); } /* Group records */ //$group_variable = $_POST['g_'.$GLOBALS['phpgw_info']['flags']['currentapp']]; if (!$group_variable) $group_variable = array(); @reset($group_variable); $totalacl = array(); while(list($rowinfo,$perm) = each($group_variable)) { list($group_id,$rights) = preg_split('/_/',$rowinfo); $totalacl[$group_id] += $rights; } @reset($totalacl); while(list($group_id,$rights) = @each($totalacl)) { if($is_group) $rights &= ~PHPGW_ACL_PRIVATE; if(array_key_exists($user_id,$keys_to_keep)) if(($rights & 1) == 0) { $this->acl->persist_shared_groups($user_id); } $this->acl->add($GLOBALS['phpgw_info']['flags']['currentapp'],$group_id,$rights); } /* User records */ //$user_variable = $_POST['u_'.$GLOBALS['phpgw_info']['flags']['currentapp']]; if (!$user_variable) $user_variable = array(); @reset($user_variable); $totalacl = array(); while(list($rowinfo,$perm) = each($user_variable)) { list($user_id,$rights) = preg_split('/_/',$rowinfo); $totalacl[$user_id] += $rights; } @reset($totalacl); while(list($user_id,$rights) = @each($totalacl)) { if($is_group) $rights &= ~ PHPGW_ACL_PRIVATE; $this->acl->add($GLOBALS['phpgw_info']['flags']['currentapp'],$user_id,$rights); } $this->acl->save_repository(); $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('../'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/index.php')); } $processed = Array(); $GLOBALS['phpgw_info']['flags']['app_header'] = lang('%1 - Preferences',$GLOBALS['phpgw_info']['apps'][$acl_app]['title']).' - '.lang('acl').': '.$owner_name; if(!@is_object($GLOBALS['phpgw']->js)) { $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); } $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); $this->template = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('preferences')); $templates = Array ( 'preferences' => 'preference_acl.tpl', 'acl_row' => 'preference_acl_row.tpl', 'acl_hidden' => 'preference_acl_hidden.tpl' ); $this->template->set_file($templates); $this->template->set_var("users_list", lang("Users List")); $this->template->set_var("attributes", lang("Attributes")); $this->template->set_var("read", lang("Read")); $this->template->set_var("add", lang("Add")); $this->template->set_var("edit", lang("Edit")); $this->template->set_var("delete", lang("Delete")); $this->template->set_var("private", lang("Private")); $this->template->set_var("remove", lang("Remove")); $this->template->set_var("cancel", lang("Cancel")); if($acl_app=='contactcenter') { $this->template->set_var("private_invisible", "style='display:none'"); } else { $this->template->set_var("add_invisible", ""); $this->template->set_var("private_invisible", ""); } if ($submit) $this->template->set_var('errors',lang('ACL grants have been updated')); $common_hidden_vars = ' '."\n" . ' '."\n"; $var = Array( 'errors' => '', 'title' => '