aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2016-01-28 23:19:13 +0100
committermrjive <mrjive@mrjive.it>2016-01-28 23:19:13 +0100
commit28943af494eae225b256b9771a5699a1b05d7a2f (patch)
tree1f135da64c0935053f468281f8353e8279a18448 /mod
parentc49e4f52ae83441c4a1dcf52e433dded8d767679 (diff)
parent5f1eb18da4d6380b64e83e0eeda6f1037de2fec9 (diff)
downloadvolse-hubzilla-28943af494eae225b256b9771a5699a1b05d7a2f.tar.gz
volse-hubzilla-28943af494eae225b256b9771a5699a1b05d7a2f.tar.bz2
volse-hubzilla-28943af494eae225b256b9771a5699a1b05d7a2f.zip
Merge pull request #19 from redmatrix/master
updating from original codebase
Diffstat (limited to 'mod')
-rw-r--r--mod/_well_known.php13
-rw-r--r--mod/channel.php2
-rw-r--r--mod/connections.php2
-rw-r--r--mod/directory.php7
-rw-r--r--mod/dirsearch.php2
-rw-r--r--mod/group.php22
-rw-r--r--mod/hostxrd.php1
-rw-r--r--mod/import.php2
-rw-r--r--mod/lostpass.php2
-rw-r--r--mod/magic.php2
-rw-r--r--mod/manage.php2
-rw-r--r--mod/network.php4
-rw-r--r--mod/new_channel.php15
-rw-r--r--mod/photos.php2
-rw-r--r--mod/ping.php2
-rw-r--r--mod/settings.php5
-rw-r--r--mod/thing.php1
17 files changed, 61 insertions, 25 deletions
diff --git a/mod/_well_known.php b/mod/_well_known.php
index d88bc2391..58ed13ece 100644
--- a/mod/_well_known.php
+++ b/mod/_well_known.php
@@ -33,6 +33,19 @@ function _well_known_init(&$a){
break;
default:
+ // look in $WEBROOT/well_known for the requested file in case it is
+ // something a site requires and for which we do not have a module
+
+ // @fixme - we may need to determine the content-type and stick it in the header
+ // for now this can be done with a php script masquerading as the requested file
+
+ $wk_file = str_replace('.well-known','well_known',$a->cmd);
+ if(file_exists($wk_file)) {
+ echo file_get_contents($wk_file);
+ killme();
+ }
+ elseif(file_exists($wk_file . '.php'))
+ require_once($wk_file . '.php');
break;
}
diff --git a/mod/channel.php b/mod/channel.php
index 074017466..3b80e2cb8 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -163,6 +163,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$simple_update = '';
if(($update) && (! $load)) {
+
if ($mid) {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1",
@@ -258,7 +259,6 @@ function channel_content(&$a, $update = 0, $load = false) {
$items = array();
}
-
if((! $update) && (! $load)) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
diff --git a/mod/connections.php b/mod/connections.php
index f43dec73e..1de8279c4 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -269,6 +269,8 @@ function connections_content(&$a) {
'connected' => datetime_convert('UTC',date_default_timezone_get(),$rr['abook_created'], 'c'),
'approve_hover' => t('Approve connection'),
'approve' => (($rr['abook_pending']) ? t('Approve') : false),
+ 'ignore_hover' => t('Ignore connection'),
+ 'ignore' => ((! $rr['abook_ignored']) ? t('Ignore') : false),
'recent_label' => t('Recent activity'),
'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id'])
);
diff --git a/mod/directory.php b/mod/directory.php
index 4ab118b17..dca96694e 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -144,11 +144,14 @@ function directory_content(&$a) {
}
if($url) {
- // We might want to make the tagadelic count (&kw=) configurable or turn it off completely.
$numtags = get_config('system','directorytags');
- $kw = ((intval($numtags)) ? $numtags : 50);
+ $kw = ((intval($numtags) > 0) ? intval($numtags) : 50);
+
+ if(get_config('system','disable_directory_keywords'))
+ $kw = 0;
+
$query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : '');
if($token)
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 388e5f3ac..bc2fa108f 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -75,6 +75,8 @@ function dirsearch_content(&$a) {
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
+ if(get_config('system','disable_directory_keywords'))
+ $kw = 0;
// by default use a safe search
diff --git a/mod/group.php b/mod/group.php
index ce9633669..7eaad771f 100644
--- a/mod/group.php
+++ b/mod/group.php
@@ -17,13 +17,13 @@ function group_post(&$a) {
$public = intval($_POST['public']);
$r = group_add(local_channel(),$name,$public);
if($r) {
- info( t('Collection created.') . EOL );
+ info( t('Privacy group created.') . EOL );
$r = group_byname(local_channel(),$name);
if($r)
goaway($a->get_baseurl() . '/group/' . $r);
}
else
- notice( t('Could not create collection.') . EOL );
+ notice( t('Could not create privacy group.') . EOL );
goaway($a->get_baseurl() . '/group');
}
@@ -35,7 +35,7 @@ function group_post(&$a) {
intval(local_channel())
);
if(! $r) {
- notice( t('Collection not found.') . EOL );
+ notice( t('Privacy group not found.') . EOL );
goaway($a->get_baseurl() . '/connections');
}
@@ -51,7 +51,7 @@ function group_post(&$a) {
intval($group['id'])
);
if($r)
- info( t('Collection updated.') . EOL );
+ info( t('Privacy group updated.') . EOL );
}
goaway(z_root() . '/group/' . argv(1) . '/' . argv(2));
@@ -83,8 +83,8 @@ function group_content(&$a) {
if((argc() == 2) && (argv(1) === 'new')) {
return replace_macros($tpl, $context + array(
- '$title' => t('Create a collection of channels.'),
- '$gname' => array('groupname',t('Collection Name: '), '', ''),
+ '$title' => t('Create a group of channels.'),
+ '$gname' => array('groupname',t('Privacy group name: '), '', ''),
'$gid' => 'new',
'$public' => array('public',t('Members are visible to other channels'), false, ''),
'$form_security_token' => get_form_security_token("group_edit"),
@@ -104,9 +104,9 @@ function group_content(&$a) {
if($r)
$result = group_rmv(local_channel(),$r[0]['name']);
if($result)
- info( t('Collection removed.') . EOL);
+ info( t('Privacy group removed.') . EOL);
else
- notice( t('Unable to remove collection.') . EOL);
+ notice( t('Unable to remove privacy group.') . EOL);
}
goaway($a->get_baseurl() . '/group');
// NOTREACHED
@@ -134,7 +134,7 @@ function group_content(&$a) {
intval(local_channel())
);
if(! $r) {
- notice( t('Collection not found.') . EOL );
+ notice( t('Privacy group not found.') . EOL );
goaway($a->get_baseurl() . '/connections');
}
$group = $r[0];
@@ -176,8 +176,8 @@ function group_content(&$a) {
$context = $context + array(
- '$title' => t('Collection Editor'),
- '$gname' => array('groupname',t('Collection Name: '),$group['name'], ''),
+ '$title' => t('Privacy group editor'),
+ '$gname' => array('groupname',t('Privacy group name: '),$group['name'], ''),
'$gid' => $group['id'],
'$drop' => $drop_txt,
'$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''),
diff --git a/mod/hostxrd.php b/mod/hostxrd.php
index 0e18c133b..18066b7bf 100644
--- a/mod/hostxrd.php
+++ b/mod/hostxrd.php
@@ -12,6 +12,7 @@ function hostxrd_init(&$a) {
));
$arr = array('xrd' => $x);
call_hooks('hostxrd',$arr);
+
echo $arr['xrd'];
killme();
}
diff --git a/mod/import.php b/mod/import.php
index 02e71233a..b6091d944 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -123,7 +123,7 @@ function import_account(&$a, $account_id) {
if(array_key_exists('channel',$data)) {
if($completed < 1) {
- $channel = import_channel($data['channel'], $account_id);
+ $channel = import_channel($data['channel'], $account_id, $seize);
}
else {
diff --git a/mod/lostpass.php b/mod/lostpass.php
index 3dbc2fe7d..ffdd7b62e 100644
--- a/mod/lostpass.php
+++ b/mod/lostpass.php
@@ -87,7 +87,7 @@ function lostpass_content(&$a) {
'$lbl2' => t('Your password has been reset as requested.'),
'$lbl3' => t('Your new password is'),
'$lbl4' => t('Save or copy your new password - and then'),
- '$lbl5' => '<a href="' . $a->get_baseurl() . '">' . t('click here to login') . '</a>.',
+ '$lbl5' => '<a href="' . $a->get_baseurl() . '/login">' . t('click here to login') . '</a>.',
'$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'),
'$newpass' => $new_password,
'$baseurl' => $a->get_baseurl()
diff --git a/mod/magic.php b/mod/magic.php
index 2fee87241..12679773b 100644
--- a/mod/magic.php
+++ b/mod/magic.php
@@ -105,6 +105,7 @@ function magic_init(&$a) {
$r = q("select * from channel left join hubloc on channel_hash = hubloc_hash where hubloc_addr = '%s' limit 1",
dbesc($delegate)
);
+
if($r && intval($r[0]['channel_id'])) {
$allowed = perm_is_allowed($r[0]['channel_id'],get_observer_hash(),'delegate');
if($allowed) {
@@ -112,6 +113,7 @@ function magic_init(&$a) {
$_SESSION['delegate'] = get_observer_hash();
$_SESSION['account_id'] = intval($r[0]['channel_account_id']);
change_channel($r[0]['channel_id']);
+
$delegation_success = true;
}
}
diff --git a/mod/manage.php b/mod/manage.php
index b609ede44..671003efd 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -148,6 +148,8 @@ function manage_content(&$a) {
for($x = 0; $x < count($delegates); $x ++) {
$delegates[$x]['link'] = 'magic?f=&dest=' . urlencode($delegates[$x]['xchan_url'])
. '&delegate=' . urlencode($delegates[$x]['xchan_addr']);
+ $delegates[$x]['channel_name'] = $delegates[$x]['xchan_name'];
+ $delegates[$x]['delegate'] = 1;
}
}
else {
diff --git a/mod/network.php b/mod/network.php
index ba2ef761b..17f57f498 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -204,7 +204,7 @@ function network_content(&$a, $update = 0, $load = false) {
}
else {
$contact_str = ' 0 ';
- info( t('Collection is empty'));
+ info( t('Privacy group is empty'));
}
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
@@ -213,7 +213,7 @@ function network_content(&$a, $update = 0, $load = false) {
if($x) {
$title = replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => t('Collection: ') . $x['name']
+ '$title' => t('Privacy group: ') . $x['name']
));
}
diff --git a/mod/new_channel.php b/mod/new_channel.php
index bec2a3c09..630984bf2 100644
--- a/mod/new_channel.php
+++ b/mod/new_channel.php
@@ -64,7 +64,14 @@ function new_channel_post(&$a) {
$arr = $_POST;
- if(($arr['account_id'] = get_account_id()) === false) {
+ $acc = $a->get_account();
+ $arr['account_id'] = get_account_id();
+
+ // prevent execution by delegated channels as well as those not logged in.
+ // get_account_id() returns the account_id from the session. But $a->account
+ // may point to the original authenticated account.
+
+ if((! $acc) || ($acc['account_id'] != $arr['account_id'])) {
notice( t('Permission denied.') . EOL );
return;
}
@@ -95,7 +102,10 @@ function new_channel_post(&$a) {
function new_channel_content(&$a) {
- if(! get_account_id()) {
+
+ $acc = $a->get_account();
+
+ if((! $acc) || $acc['account_id'] != get_account_id()) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -123,6 +133,7 @@ function new_channel_content(&$a) {
'$label_name' => t('Channel Name'),
'$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '),
'$label_nick' => t('Choose a short nickname'),
+ '$nick_hub' => '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')),
'$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,
diff --git a/mod/photos.php b/mod/photos.php
index b0d9bc631..f1b7aceed 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -463,7 +463,7 @@ function photos_post(&$a) {
$_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
}
- $r = attach_store($a->channel,get_observer_hash(), '', $_REQUEST);
+ $r = attach_store($channel,get_observer_hash(), '', $_REQUEST);
if(! $r['success']) {
notice($r['message'] . EOL);
diff --git a/mod/ping.php b/mod/ping.php
index 394dbf089..69d504da1 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -299,7 +299,7 @@ function ping_init(&$a) {
if($r) {
foreach($r as $rr) {
$result[] = array(
- 'notify_link' => $a->get_baseurl() . '/connedit/' . $rr['abook_id'],
+ 'notify_link' => $a->get_baseurl() . '/connections/ifpending',
'name' => $rr['xchan_name'],
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
diff --git a/mod/settings.php b/mod/settings.php
index d2ba590a2..c1a4b019d 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -354,7 +354,7 @@ function settings_post(&$a) {
);
}
else {
- notice( sprintf('Default privacy collection \'%s\' not found. Please create and re-submit permission change.', t('Friends')) . EOL);
+ notice( sprintf('Default privacy group \'%s\' not found. Please create and re-submit permission change.', t('Friends')) . EOL);
return;
}
}
@@ -917,6 +917,7 @@ function settings_content(&$a) {
$maxreq = $channel['channel_max_friend_req'];
$expire = $channel['channel_expire_days'];
$adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT);
+ $sys_expire = get_config('system','default_expire_days');
// $unkmail = $a->user['unkmail'];
// $cntunkmail = $a->user['cntunkmail'];
@@ -1050,7 +1051,7 @@ function settings_content(&$a) {
'$lbl_p2macro' => t('Advanced Privacy Settings'),
- '$expire' => array('expire',t('Expire other channel content after this many days'),$expire,t('0 or blank prevents expiration')),
+ '$expire' => array('expire',t('Expire other channel content after this many days'),$expire,sprintf( t('0 or blank to use the website limit. The website expires after %d days.'),intval($sys_expire))),
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')),
'$permissions' => t('Default Post Permissions'),
'$permdesc' => t("\x28click to open/close\x29"),
diff --git a/mod/thing.php b/mod/thing.php
index 280cc194d..7c5020e62 100644
--- a/mod/thing.php
+++ b/mod/thing.php
@@ -14,7 +14,6 @@ function thing_init(&$a) {
if(! local_channel())
return;
- $account_id = $a->get_account();
$channel = $a->get_channel();
$term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : '');