+ // Switch to text mode interface if we have more than 'n' contacts or group members
+
+ $switchtotext = get_pconfig(local_user(),'system','groupedit_image_limit');
+ if($switchtotext === false)
+ $switchtotext = get_config('system','groupedit_image_limit');
+ if($switchtotext === false)
+ $switchtotext = 400;
+
+ $tpl = get_markup_template('group_edit.tpl');
+
+ $context = array(
+ '$submit' => t('Save Group'),
+ );
+
+ if(($a->argc == 2) && ($a->argv[1] === 'new')) {
+
+ return replace_macros($tpl, $context + array(
+ '$title' => t('Create a group of contacts/friends.'),
+ '$gname' => array('groupname',t('Group Name: '), '', ''),
+ '$gid' => 'new',
+ '$form_security_token' => get_form_security_token("group_edit"),
+ ));
+
+
+ }
+
+ if(($a->argc == 3) && ($a->argv[1] === 'drop')) {
+ check_form_security_token_redirectOnErr('/group', 'group_drop', 't');
+
+ if(intval($a->argv[2])) {
+ $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($a->argv[2]),
+ intval(local_user())
+ );
+ if(count($r))
+ $result = group_rmv(local_user(),$r[0]['name']);
+ if($result)
+ info( t('Group removed.') . EOL);
+ else
+ notice( t('Unable to remove group.') . EOL);
+ }
+ goaway($a->get_baseurl() . '/group');
+ // NOTREACHED
+ }
+
+ if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) {
+ check_form_security_token_ForbiddenOnErr('group_member_change', 't');