diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 74 | ||||
-rw-r--r-- | mod/channel.php | 2 | ||||
-rw-r--r-- | mod/connedit.php | 12 | ||||
-rwxr-xr-x | mod/events.php | 2 | ||||
-rw-r--r-- | mod/item.php | 7 | ||||
-rw-r--r-- | mod/network.php | 2 | ||||
-rw-r--r-- | mod/new_channel.php | 12 | ||||
-rw-r--r-- | mod/rpost.php | 2 | ||||
-rw-r--r-- | mod/settings.php | 2 | ||||
-rw-r--r-- | mod/wfinger.php | 5 | ||||
-rw-r--r-- | mod/xrd.php | 1 |
11 files changed, 109 insertions, 12 deletions
diff --git a/mod/admin.php b/mod/admin.php index 85ab3627c..c175a4a61 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -62,6 +62,9 @@ function admin_post(&$a){ case 'hubloc': admin_page_hubloc_post($a); break; + case 'features': + admin_page_features_post($a); + break; case 'dbsync': admin_page_dbsync_post($a); break; @@ -113,6 +116,9 @@ function admin_content(&$a) { // case 'hubloc': // $o = admin_page_hubloc($a); // break; + case 'features': + $o = admin_page_features($a); + break; case 'logs': $o = admin_page_logs($a); break; @@ -530,6 +536,74 @@ function admin_page_hubloc_post(&$a){ goaway($a->get_baseurl(true) . '/admin/hubloc' ); } + +function admin_page_features_post(&$a) { + + check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features'); + + logger('postvars: ' . print_r($_POST,true)); + + $arr = array(); + $features = get_features(false); + + foreach($features as $fname => $fdata) { + foreach(array_slice($fdata,1) as $f) { + $feature = $f[0]; + + if(array_key_exists('feature_' . $feature,$_POST)) + $val = intval($_POST['feature_' . $feature]); + else + $val = 0; + set_config('feature',$feature,$val); + + if(array_key_exists('featurelock_' . $feature,$_POST)) + set_config('feature_lock',$feature,$val); + else + del_config('feature_lock',$feature); + } + } + + goaway(z_root() . '/admin/features' ); + +} + +function admin_page_features(&$a) { + + if((argc() > 1) && (argv(1) === 'features')) { + $arr = array(); + $features = get_features(false); + + foreach($features as $fname => $fdata) { + $arr[$fname] = array(); + $arr[$fname][0] = $fdata[0]; + foreach(array_slice($fdata,1) as $f) { + + $set = get_config('feature',$f[0]); + if($set === false) + $set = $f[3]; + $arr[$fname][1][] = array( + array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))), + array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? 1 : 0),'',array(t('Off'),t('On'))) + ); + } + } + + $tpl = get_markup_template("admin_settings_features.tpl"); + $o .= replace_macros($tpl, array( + '$form_security_token' => get_form_security_token("admin_manage_features"), + '$title' => t('Manage Additional Features'), + '$features' => $arr, + '$submit' => t('Submit'), + )); + + return $o; + } +} + + + + + function admin_page_hubloc(&$a) { $hubloc = q("SELECT hubloc_id, hubloc_addr, hubloc_host, hubloc_status FROM hubloc"); diff --git a/mod/channel.php b/mod/channel.php index 2b9d0ed89..074017466 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -128,7 +128,7 @@ function channel_content(&$a, $update = 0, $load = false) { 'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''), 'nickname' => $a->profile['channel_address'], 'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl) : ''), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true,(($a->profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), diff --git a/mod/connedit.php b/mod/connedit.php index 9c46fa999..77b54d262 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -397,7 +397,6 @@ function connedit_content(&$a) { } if($cmd === 'update') { - // pull feed and consume it, which should subscribe to the hub. proc_run('php',"include/poller.php","$contact_id"); goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); @@ -405,8 +404,15 @@ function connedit_content(&$a) { } if($cmd === 'refresh') { - if(! zot_refresh($orig_record[0],get_app()->get_channel())) - notice( t('Refresh failed - channel is currently unavailable.') ); + if($orig_record[0]['xchan_network'] === 'zot') { + if(! zot_refresh($orig_record[0],get_app()->get_channel())) + notice( t('Refresh failed - channel is currently unavailable.') ); + } + else { + + // if you are on a different network we'll force a refresh of the connection basic info + proc_run('php','include/notifier.php','permission_update',$contact_id); + } goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); } diff --git a/mod/events.php b/mod/events.php index 74b44906c..ed9f0f2e3 100755 --- a/mod/events.php +++ b/mod/events.php @@ -434,7 +434,7 @@ function events_content(&$a) { '$xchan' => $event_xchan, '$mid' => $mid, '$event_hash' => $event_id, - '$summary' => array('summary', (($event_id) ? t('Edit event titel') : t('Event titel')), $t_orig, t('Required'), '*'), + '$summary' => array('summary', (($event_id) ? t('Edit event title') : t('Event title')), $t_orig, t('Required'), '*'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), '$c_text' => (($event_id) ? t('Edit Category') : t('Category')), diff --git a/mod/item.php b/mod/item.php index b3ef57529..b6d00e030 100644 --- a/mod/item.php +++ b/mod/item.php @@ -210,7 +210,7 @@ function item_post(&$a) { } } else { - if(! perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_wall')) { + if(! perm_is_allowed($profile_uid,$observer['xchan_hash'],($webpage) ? 'write_pages' : 'post_wall')) { notice( t('Permission denied.') . EOL) ; if(x($_REQUEST,'return')) goaway($a->get_baseurl() . "/" . $return_path ); @@ -720,8 +720,7 @@ function item_post(&$a) { $datarray = array(); - $item_thead_top = ((! $parent) ? 1 : 0); - + $item_thread_top = ((! $parent) ? 1 : 0); if ((! $plink) && ($item_thread_top)) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; @@ -919,7 +918,7 @@ function item_post(&$a) { else { $parent = $post_id; - if($datarray['owner_xchan'] != $datarray['author_xchan']) { + if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($datarray['item_type'] == ITEM_TYPE_POST)) { notification(array( 'type' => NOTIFY_WALL, 'from_xchan' => $datarray['author_xchan'], diff --git a/mod/network.php b/mod/network.php index 9f0604296..ba2ef761b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -166,7 +166,7 @@ function network_content(&$a, $update = 0, $load = false) { 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], 'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl)), + 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, (($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')), 'bang' => (($private_editing) ? '!' : ''), 'visitor' => true, 'profile_uid' => local_channel() diff --git a/mod/new_channel.php b/mod/new_channel.php index 047048f0a..bec2a3c09 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -100,6 +100,17 @@ function new_channel_content(&$a) { return; } + $default_role = ''; + $aid = get_account_id(); + if($aid) { + $r = q("select count(channel_id) as total from channel where channel_account_id = %d", + intval($aid) + ); + if($r && (! intval($r[0]['total']))) { + $default_role = get_config('system','default_permissions_role'); + } + } + $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); @@ -117,6 +128,7 @@ function new_channel_content(&$a) { '$name' => $name, '$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' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()), + '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create') )); diff --git a/mod/rpost.php b/mod/rpost.php index d519a996b..ab5ef4ccd 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -111,7 +111,7 @@ function rpost_content(&$a) { 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], 'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'), - 'acl' => populate_acl($channel_acl), + 'acl' => populate_acl($channel_acl,true,(($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')), 'bang' => '', 'visitor' => true, 'profile_uid' => local_channel(), diff --git a/mod/settings.php b/mod/settings.php index 339f83cfe..275b2a96f 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -367,7 +367,7 @@ function settings_post(&$a) { } $r = q("update abook set abook_my_perms = %d where abook_channel = %d and abook_self = 1", - intval(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0), + intval((array_key_exists('perms_accept',$role_permissions)) ? $role_permissions['perms_accept'] : 0), intval(local_channel()) ); set_pconfig(local_channel(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0)); diff --git a/mod/wfinger.php b/mod/wfinger.php index 8b9abe4af..5270c8f31 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -101,6 +101,11 @@ function wfinger_init(&$a) { ), array( + 'rel' => 'http://ostatus.org/schema/1.0/subscribe', + 'template' => z_root() . '/follow/url={uri}', + ), + + array( 'rel' => 'http://purl.org/zot/protocol', 'href' => z_root() . '/.well-known/zot-info' . '?address=' . $r[0]['xchan_addr'], ) diff --git a/mod/xrd.php b/mod/xrd.php index a373f8bf5..34ed47149 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -50,6 +50,7 @@ function xrd_init(&$a) { // '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'], // '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'] . '/mention', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, + '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', // '$bigkey' => salmon_key($r[0]['pubkey']) )); |