aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/filestorage.php8
-rw-r--r--mod/manage.php18
-rw-r--r--mod/parse_url.php9
-rw-r--r--mod/ping.php15
-rw-r--r--mod/profiles.php18
-rw-r--r--mod/settings.php5
6 files changed, 54 insertions, 19 deletions
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 1767ea6bf..6b731e440 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -32,7 +32,7 @@ function filestorage_post(&$a) {
$str_group_deny = perms2str($_REQUEST['group_deny']);
$str_contact_deny = perms2str($_REQUEST['contact_deny']);
- attach_change_permissions($channel_id, $resource, $str_contact_allow, $str_group_allow, $str_contact_deny,$str_group_deny, $recurse = false);
+ attach_change_permissions($channel_id, $resource, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, $recurse);
//Build directory tree and redirect
$channel = $a->get_channel();
@@ -127,10 +127,14 @@ function filestorage_content(&$a) {
$lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock');
+ // Encode path that is used for link so it's a valid URL
+ // Keep slashes as slashes, otherwise mod_rewrite doesn't work correctly
+ $encoded_path = str_replace('%2F', '/', rawurlencode($cloudpath));
+
$o = replace_macros(get_markup_template('attach_edit.tpl'), array(
'$header' => t('Edit file permissions'),
'$file' => $f,
- '$cloudpath' => z_root() . '/' . $cloudpath,
+ '$cloudpath' => z_root() . '/' . $encoded_path,
'$parentpath' => $parentpath,
'$uid' => $channel['channel_id'],
'$channelnick' => $channel['channel_address'],
diff --git a/mod/manage.php b/mod/manage.php
index 00c6db7f0..b0de945bf 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -28,8 +28,13 @@ function manage_content(&$a) {
if($change_channel) {
$r = change_channel($change_channel);
- if($r && $r['channel_startpage'])
- goaway(z_root() . '/' . $r['channel_startpage']);
+ if((argc() > 2) && !(argv(2) === 'default')) {
+ goaway(z_root() . '/' . implode('/',array_slice($a->argv,2))); // Go to whatever is after /manage/, but with the new channel
+ }
+ else {
+ if($r && $r['channel_startpage'])
+ goaway(z_root() . '/' . $r['channel_startpage']); // If nothing extra is specified, go to the default page
+ }
goaway(z_root());
}
@@ -41,15 +46,12 @@ function manage_content(&$a) {
intval(PAGE_REMOVED)
);
- $selected_channel = null;
$account = get_app()->get_account();
if($r && count($r)) {
$channels = $r;
for($x = 0; $x < count($channels); $x ++) {
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['channel_id']);
- if($channels[$x]['channel_id'] == local_user())
- $selected_channel = $channels[$x];
$channels[$x]['default'] = (($channels[$x]['channel_id'] == $account['account_default_channel']) ? "1" : '');
$channels[$x]['default_links'] = '1';
@@ -147,12 +149,14 @@ function manage_content(&$a) {
$o = replace_macros(get_markup_template('channels.tpl'), array(
'$header' => t('Channel Manager'),
'$msg_selected' => t('Current Channel'),
- '$selected' => $selected_channel,
- '$desc' => t('Attach to one of your channels by selecting it.'),
+ '$selected' => local_user(),
+ '$desc' => t('Switch to one of your channels by selecting it.'),
'$msg_default' => t('Default Channel'),
'$msg_make_default' => t('Make Default'),
'$links' => $links,
'$all_channels' => $channels,
+ '$mail_format' => t('%d new messages'),
+ '$intros_format' => t('%d new introductions'),
'$channel_usage_message' => $channel_usage_message,
));
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 340e1a67e..23d608411 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -307,7 +307,14 @@ function parse_url_content(&$a) {
$max_images = intval($max_images);
foreach ($siteinfo["images"] as $imagedata) {
- $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
+ if ($url) {
+ $image .= sprintf('[url=%s]', $url);
+ }
+ $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]';
+ if ($url) {
+ $image .= '[/url]';
+ }
+ $image .= "\n";
$total_images ++;
if($max_images && $max_images >= $total_images)
break;
diff --git a/mod/ping.php b/mod/ping.php
index ef8afd91c..593ae21f8 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -46,6 +46,7 @@ function ping_init(&$a) {
if(local_user()) {
$vnotify = get_pconfig(local_user(),'system','vnotify');
$evdays = intval(get_pconfig(local_user(),'system','evdays'));
+ $ob_hash = get_observer_hash();
}
// if unset show all visual notification types
@@ -275,10 +276,12 @@ function ping_init(&$a) {
$result = array();
$r = q("SELECT * FROM item
- WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d",
+ WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d
+ and author_xchan != '%s' ORDER BY created DESC",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
- intval(local_user())
+ intval(local_user()),
+ dbesc($ob_hash)
);
if($r) {
@@ -297,7 +300,7 @@ function ping_init(&$a) {
if(argc() > 1 && (argv(1) === 'intros')) {
$result = array();
- $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0)",
+ $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0) ORDER BY abook_created DESC",
intval(local_user()),
intval(ABOOK_FLAG_PENDING),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
@@ -381,10 +384,12 @@ function ping_init(&$a) {
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$r = q("SELECT id, item_restrict, item_flags FROM item
- WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d",
+ WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d
+ and author_xchan != '%s'",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
- intval(local_user())
+ intval(local_user()),
+ dbesc($ob_hash)
);
if($r) {
diff --git a/mod/profiles.php b/mod/profiles.php
index 1d784c506..f2695f332 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -156,9 +156,14 @@ function profiles_init(&$a) {
// Run profile_load() here to make sure the theme is set before
// we start loading content
- if((argc() > 1) && (intval(argv(1)))) {
+ if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) {
+ if(feature_enabled(local_user(),'multi_profiles'))
+ $id = $a->argv[1];
+ else
+ $id = q("select id from profile where uid = %d and is_default = 1",local_user())[0]['id'];
+
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($a->argv[1]),
+ intval($id),
intval(local_user())
);
if(! count($r)) {
@@ -556,9 +561,14 @@ function profiles_content(&$a) {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
- if((argc() > 1) && (intval(argv(1)))) {
+ if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_user(),'multi_profiles')) {
+ if(feature_enabled(local_user(),'multi_profiles'))
+ $id = $a->argv[1];
+ else
+ $id = q("select id from profile where uid = %d and is_default = 1",local_user())[0]['id'];
+
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($a->argv[1]),
+ intval($id),
intval(local_user())
);
if(! count($r)) {
diff --git a/mod/settings.php b/mod/settings.php
index ea7b2ba06..be6f2cfb9 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -449,6 +449,8 @@ function settings_post(&$a) {
if(x($_POST,'vnotify11'))
$vnotify += intval($_POST['vnotify11']);
+ $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
+
$channel = $a->get_channel();
$err = '';
@@ -478,6 +480,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','blocktags',$blocktags);
set_pconfig(local_user(),'system','channel_menu',$channel_menu);
set_pconfig(local_user(),'system','vnotify',$vnotify);
+ set_pconfig(local_user(),'system','always_show_in_notices',$always_show_in_notices);
set_pconfig(local_user(),'system','evdays',$evdays);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
@@ -995,6 +998,7 @@ function settings_content(&$a) {
$permissions_role = get_pconfig(local_user(),'system','permissions_role');
$permissions_set = (($permissions_role && $permissions_role != 'custom') ? true : false);
$vnotify = get_pconfig(local_user(),'system','vnotify');
+ $always_show_in_notices = get_pconfig(local_user(),'system','always_show_in_notices');
if($vnotify === false)
$vnotify = (-1);
@@ -1080,6 +1084,7 @@ function settings_content(&$a) {
'$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended')),
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended')),
'$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, ''),
+ '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, ''),
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),