X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fgroup.php;h=5b28784f5663cc1b7056125b26619416e9e76b6d;hb=e5a6d91cc4dc8f8546580c656ed6acc7016d4a28;hp=a282dbccf571c8ff5558a099c928b666235545da;hpb=8a80ea24d1d8039be6dc532c9db23c60e71eb467;p=friendica.git diff --git a/mod/group.php b/mod/group.php index a282dbccf5..5b28784f56 100644 --- a/mod/group.php +++ b/mod/group.php @@ -7,7 +7,7 @@ function validate_members(&$item) { function group_init(&$a) { if(local_user()) { require_once('include/group.php'); - $a->page['aside'] = group_side('contacts','group',false,(($a->argc > 1) ? intval($a->argv[1]) : 0)); + $a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0)); } } @@ -22,7 +22,7 @@ function group_post(&$a) { if(($a->argc == 2) && ($a->argv[1] === 'new')) { check_form_security_token_redirectOnErr('/group/new', 'group_edit'); - + $name = notags(trim($_POST['groupname'])); $r = group_add(local_user(),$name); if($r) { @@ -32,13 +32,13 @@ function group_post(&$a) { goaway($a->get_baseurl() . '/group/' . $r); } else - notice( t('Could not create group.') . EOL ); + notice( t('Could not create group.') . EOL ); goaway($a->get_baseurl() . '/group'); return; // NOTREACHED } if(($a->argc == 2) && (intval($a->argv[1]))) { check_form_security_token_redirectOnErr('/group', 'group_edit'); - + $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), intval(local_user()) @@ -51,7 +51,7 @@ function group_post(&$a) { $group = $r[0]; $groupname = notags(trim($_POST['groupname'])); if((strlen($groupname)) && ($groupname != $group['name'])) { - $r = q("UPDATE `group` SET `name` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + $r = q("UPDATE `group` SET `name` = '%s' WHERE `uid` = %d AND `id` = %d", dbesc($groupname), intval(local_user()), intval($group['id']) @@ -62,12 +62,12 @@ function group_post(&$a) { $a->page['aside'] = group_side(); } - return; + return; } function group_content(&$a) { $change = false; - + if(! local_user()) { notice( t('Permission denied') . EOL); return; @@ -82,10 +82,13 @@ function group_content(&$a) { $switchtotext = 400; $tpl = get_markup_template('group_edit.tpl'); - $context = array('$submit' => t('Submit')); + + $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: '), '', ''), @@ -98,13 +101,13 @@ function group_content(&$a) { 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)) + if(count($r)) $result = group_rmv(local_user(),$r[0]['name']); if($result) info( t('Group removed.') . EOL); @@ -117,7 +120,7 @@ function group_content(&$a) { if(($a->argc > 2) && intval($a->argv[1]) && intval($a->argv[2])) { check_form_security_token_ForbiddenOnErr('group_member_change', 't'); - + $r = q("SELECT `id` FROM `contact` WHERE `id` = %d AND `uid` = %d and `self` = 0 and `blocked` = 0 AND `pending` = 0 LIMIT 1", intval($a->argv[2]), intval(local_user()) @@ -169,9 +172,7 @@ function group_content(&$a) { '$form_security_token' => get_form_security_token("group_drop"), )); - $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); - $context = $context + array( '$title' => t('Group Editor'), '$gname' => array('groupname',t('Group Name: '),$group['name'], ''), @@ -189,9 +190,10 @@ function group_content(&$a) { 'label_members' => t('Members'), 'members' => array(), 'label_contacts' => t('All Contacts'), + 'group_is_empty' => t('Group is empty'), 'contacts' => array(), ); - + $sec_token = addslashes(get_form_security_token('group_member_change')); $textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false); foreach($members as $member) { @@ -203,7 +205,7 @@ function group_content(&$a) { group_rmv_member(local_user(),$group['name'],$member['id']); } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0 ORDER BY `name` ASC", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC", intval(local_user()) ); @@ -225,8 +227,7 @@ function group_content(&$a) { echo replace_macros($tpl, $context); killme(); } - + return replace_macros($tpl, $context); } -