This commit is contained in:
friendica 2012-11-14 21:27:05 -08:00
parent 160258fd5d
commit 5fee78b215
3 changed files with 17 additions and 28 deletions

2
done
View File

@ -108,7 +108,7 @@ mod/
follow.php follow.php
friendica.php friendica.php
fsuggest.php fsuggest.php
group.php + group.php
hcard.php hcard.php
help.php help.php
+ home.php + home.php

View File

@ -32,7 +32,7 @@ function connections_aside(&$a) {
$a->set_widget('follow', follow_widget()); $a->set_widget('follow', follow_widget());
$a->set_widget('collections', group_side('connnections','group',false,0,$abook_id)); $a->set_widget('collections', group_side('connnections','group',false,0,$abook_id));
$a->set_widget('fidpeople',findpeople_widget()); $a->set_widget('findpeople',findpeople_widget());
} }

View File

@ -1,18 +1,13 @@
<?php <?php
function validate_members(&$item) { function group_aside(&$a) {
$item = intval($item);
}
function group_init(&$a) {
if(local_user()) { if(local_user()) {
require_once('include/group.php'); require_once('include/group.php');
$a->page['aside'] = group_side('collections','group',false,(($a->argc > 1) ? intval($a->argv[1]) : 0)); $a->set_widget('groups_edit',group_side('collections','group',false,(($a->argc > 1) ? intval($a->argv[1]) : 0)));
} }
} }
function group_post(&$a) { function group_post(&$a) {
if(! local_user()) { if(! local_user()) {
@ -20,7 +15,7 @@ function group_post(&$a) {
return; return;
} }
if(($a->argc == 2) && ($a->argv[1] === 'new')) { if((argc() == 2) && (argv(1) === 'new')) {
check_form_security_token_redirectOnErr('/group/new', 'group_edit'); check_form_security_token_redirectOnErr('/group/new', 'group_edit');
$name = notags(trim($_POST['groupname'])); $name = notags(trim($_POST['groupname']));
@ -36,14 +31,14 @@ function group_post(&$a) {
goaway($a->get_baseurl() . '/group'); goaway($a->get_baseurl() . '/group');
} }
if(($a->argc == 2) && (intval($a->argv[1]))) { if((argc() == 2) && (intval(argv(1)))) {
check_form_security_token_redirectOnErr('/group', 'group_edit'); check_form_security_token_redirectOnErr('/group', 'group_edit');
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[1]), intval(argv(1)),
intval(local_user()) intval(local_user())
); );
if(! count($r)) { if(! $r) {
notice( t('Collection not found.') . EOL ); notice( t('Collection not found.') . EOL );
goaway($a->get_baseurl() . '/connections'); goaway($a->get_baseurl() . '/connections');
@ -60,7 +55,7 @@ function group_post(&$a) {
info( t('Collection name changed.') . EOL ); info( t('Collection name changed.') . EOL );
} }
$a->page['aside'] = group_side(); goaway(z_root() . '/group/' . argv(1) . '/' . argv(2));
} }
return; return;
} }
@ -84,7 +79,7 @@ function group_content(&$a) {
$tpl = get_markup_template('group_edit.tpl'); $tpl = get_markup_template('group_edit.tpl');
$context = array('$submit' => t('Submit')); $context = array('$submit' => t('Submit'));
if(($a->argc == 2) && ($a->argv[1] === 'new')) { if((argc() == 2) && (argv(1) === 'new')) {
return replace_macros($tpl, $context + array( return replace_macros($tpl, $context + array(
'$title' => t('Create a collection of connections.'), '$title' => t('Create a collection of connections.'),
@ -96,15 +91,15 @@ function group_content(&$a) {
} }
if(($a->argc == 3) && ($a->argv[1] === 'drop')) { if((argc() == 3) && (argv(1) === 'drop')) {
check_form_security_token_redirectOnErr('/group', 'group_drop', 't'); check_form_security_token_redirectOnErr('/group', 'group_drop', 't');
if(intval($a->argv[2])) { if(intval(argv(2))) {
$r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]), intval(argv(2)),
intval(local_user()) intval(local_user())
); );
if(count($r)) if($r)
$result = group_rmv(local_user(),$r[0]['name']); $result = group_rmv(local_user(),$r[0]['name']);
if($result) if($result)
info( t('Collection removed.') . EOL); info( t('Collection removed.') . EOL);
@ -130,14 +125,14 @@ function group_content(&$a) {
} }
if(($a->argc > 1) && (intval($a->argv[1]))) { if((argc() > 1) && (intval(argv(1)))) {
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval($a->argv[1]), intval(argv(1)),
intval(local_user()) intval(local_user())
); );
if(! count($r)) { if(! $r) {
notice( t('Collection not found.') . EOL ); notice( t('Collection not found.') . EOL );
goaway($a->get_baseurl() . '/connnections'); goaway($a->get_baseurl() . '/connnections');
} }
@ -151,8 +146,6 @@ function group_content(&$a) {
$preselected[] = $member['xchan_hash']; $preselected[] = $member['xchan_hash'];
} }
if($change) { if($change) {
if(in_array($change,$preselected)) { if(in_array($change,$preselected)) {
@ -171,8 +164,6 @@ function group_content(&$a) {
} }
} }
$drop_tpl = get_markup_template('group_drop.tpl'); $drop_tpl = get_markup_template('group_drop.tpl');
$drop_txt = replace_macros($drop_tpl, array( $drop_txt = replace_macros($drop_tpl, array(
'$id' => $group['id'], '$id' => $group['id'],
@ -180,8 +171,6 @@ function group_content(&$a) {
'$form_security_token' => get_form_security_token("group_drop"), '$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( $context = $context + array(
'$title' => t('Collection Editor'), '$title' => t('Collection Editor'),