aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php3
-rw-r--r--mod/connedit.php22
-rw-r--r--mod/import.php42
-rw-r--r--mod/new_channel.php7
-rw-r--r--mod/uexport.php2
-rw-r--r--mod/xchan.php30
6 files changed, 81 insertions, 25 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 836b12281..68ce6fe85 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -768,7 +768,7 @@ function admin_page_channels_post(&$a){
);
proc_run('php','include/directory.php',$uid,'nopush');
}
- notice( sprintf( tt("%s channel censored/uncensored", "%s channelss censored/uncensored", count($channels)), count($channels)) );
+ notice( sprintf( tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)) );
}
if (x($_POST,'page_channels_delete')){
require_once("include/Contact.php");
@@ -814,6 +814,7 @@ function admin_page_channels(&$a){
intval(PAGE_CENSORED),
intval( $uid )
);
+ proc_run('php','include/directory.php',$uid,'nopush');
notice( sprintf( (($channel[0]['channel_pageflags'] & PAGE_CENSORED) ? t("Channel '%s' uncensored"): t("Channel '%s' censored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL);
}; break;
diff --git a/mod/connedit.php b/mod/connedit.php
index b2de42343..7ad719738 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -255,6 +255,28 @@ function connedit_content(&$a) {
return login();
}
+ $my_perms = 0;
+ $role = get_pconfig(local_user(),'system','permissions_role');
+ if($role) {
+ $x = get_role_perms($role);
+ if($x['perms_accept'])
+ $my_perms = $x['perms_accept'];
+ }
+ if($my_perms) {
+ $o .= "<script>function connectDefaultShare() {
+ \$('.abook-edit-me').each(function() {
+ if(! $(this).is(':disabled'))
+ $(this).removeAttr('checked');
+ });\n\n";
+ $perms = get_perms();
+ foreach($perms as $p => $v) {
+ if($my_perms & $v[1]) {
+ $o .= "\$('#me_id_perms_" . $p . "').attr('checked','checked'); \n";
+ }
+ }
+ $o .= "abook_perms_msg(); }\n</script>\n";
+ }
+
if(argc() == 3) {
$contact_id = intval(argv(1));
diff --git a/mod/import.php b/mod/import.php
index 7452bcdc9..2fbb71fc4 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -9,10 +9,25 @@ require_once('include/identity.php');
function import_post(&$a) {
- if(! get_account_id()) {
+ $account_id = get_account_id();
+ if(! $account_id)
return;
+
+ $max_identities = account_service_class_fetch($account_id,'total_identities');
+ $max_friends = account_service_class_fetch($account_id,'total_channels');
+ $max_feeds = account_service_class_fetch($account_id,'total_feeds');
+
+ if($max_identities !== false) {
+ $r = q("select channel_id from channel where channel_account_id = %d",
+ intval($account_id)
+ );
+ if($r && count($r) > $max_identities) {
+ notice( sprintf( t('Your service plan only allows %d channels.'), $max_identities) . EOL);
+ return;
+ }
}
+
$data = null;
$seize = ((x($_REQUEST,'make_primary')) ? intval($_REQUEST['make_primary']) : 0);
@@ -276,10 +291,18 @@ function import_post(&$a) {
// FIXME - ensure we have an xchan if somebody is trying to pull a fast one
+ $friends = 0;
+ $feeds = 0;
+
// import contacts
$abooks = $data['abook'];
if($abooks) {
foreach($abooks as $abook) {
+ if($max_friends !== false && $friends > $max_friends)
+ continue;
+ if($max_feeds !== false && ($abook['abook_flags'] & ABOOK_FLAG_FEED) && $feeds > $max_feeds)
+ continue;
+
unset($abook['abook_id']);
$abook['abook_account'] = get_account_id();
$abook['abook_channel'] = $channel['channel_id'];
@@ -289,6 +312,10 @@ function import_post(&$a) {
. "`) VALUES ('"
. implode("', '", array_values($abook))
. "')" );
+
+ $friends ++;
+ if($abook['abook_flags'] & ABOOK_FLAG_FEED)
+ $feeds ++;
}
}
@@ -349,18 +376,20 @@ function import_post(&$a) {
}
}
+//FIXME just a note here for when folks want to import content - be very careful to unset ITEM_ORIGIN on all imported content. Or you could end up with a nasty routing loop when somebody tries to reply to one of those posts.
+
+
// FIXME - ensure we have a self entry if somebody is trying to pull a fast one
- if($seize) {
- // notify old server that it is no longer primary.
-
- }
+ // send out refresh requests
+ // notify old server that it may no longer be primary.
+
+ proc_run('php','include/notifier.php','location',$channel['channel_id']);
// This will indirectly perform a refresh_all *and* update the directory
proc_run('php', 'include/directory.php', $channel['channel_id']);
- // send out refresh requests
notice( t('Import completed.') . EOL);
@@ -368,7 +397,6 @@ function import_post(&$a) {
goaway(z_root() . '/network' );
-
}
diff --git a/mod/new_channel.php b/mod/new_channel.php
index eafef2c08..8329f0ec3 100644
--- a/mod/new_channel.php
+++ b/mod/new_channel.php
@@ -1,6 +1,8 @@
<?php
require_once('include/identity.php');
+require_once('include/permissions.php');
+
function new_channel_init(&$a) {
@@ -100,7 +102,7 @@ function new_channel_content(&$a) {
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" );
$nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" );
-
+ $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
$o = replace_macros(get_markup_template('new_channel.tpl'), array(
@@ -113,6 +115,9 @@ function new_channel_content(&$a) {
'$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'),
'$label_import' => t('Or <a href="import">import an existing channel</a> from another location'),
'$name' => $name,
+ '$label_role' => t('Channel Type'),
+ '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'),
+ '$role_select' => role_selector(($privacy_role) ? $privacy_role : 'social'),
'$nickname' => $nickname,
'$submit' => t('Create')
));
diff --git a/mod/uexport.php b/mod/uexport.php
index f3a2ce67c..6304115c8 100644
--- a/mod/uexport.php
+++ b/mod/uexport.php
@@ -18,7 +18,7 @@ function uexport_init(&$a) {
}
if(argc() > 1 && argv(1) === 'complete') {
- echo json_encode('not yet implemented');
+ echo json_encode(identity_basic_export(local_user(),true));
killme();
}
diff --git a/mod/xchan.php b/mod/xchan.php
index e51cc53cc..714603f6e 100644
--- a/mod/xchan.php
+++ b/mod/xchan.php
@@ -7,7 +7,7 @@ function xchan_content(&$a) {
$o .= '<h3>Xchan Lookup</h3>';
$o .= '<form action="xchan" method="get">';
- $o .= 'Lookup xchan beginning with: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
+ $o .= 'Lookup xchan beginning with (or webbie): <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />';
@@ -15,28 +15,28 @@ function xchan_content(&$a) {
if(x($_GET,'addr')) {
$addr = trim($_GET['addr']);
- $r = q("select * from xchan where xchan_hash like '%s%%'",
+ $r = q("select * from xchan where xchan_hash like '%s%%' or xchan_addr = '%s' group by xchan_hash",
+ dbesc($addr),
dbesc($addr)
);
if($r) {
- foreach($r as $rr)
- $o .= str_replace("\n","<br />",print_r($rr,true)) . EOL;
+ foreach($r as $rr) {
+ $o .= str_replace(array("\n"," "),array("<br/>","&nbsp;"),print_r($rr,true)) . EOL;
+
+ $s = q("select * from hubloc where hubloc_hash like '%s'",
+ dbesc($r[0]['xchan_hash'])
+ );
+
+ if($s) {
+ foreach($s as $rr)
+ $o .= str_replace(array("\n"," "),array("<br/>","&nbsp;"),print_r($rr,true)) . EOL;
+ }
+ }
}
else
notice( t('Not found.') . EOL);
- $r = q("select * from hubloc where hubloc_hash like '%s%%'",
- dbesc($addr)
- );
-
- if($r) {
- foreach($r as $rr)
- $o .= str_replace("\n","<br />",print_r($rr,true)) . EOL;
-
- }
-
-
}
return $o;
}