aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authoranaqreon <tamanning@zoho.com>2014-12-30 16:06:35 -0600
committeranaqreon <tamanning@zoho.com>2014-12-30 16:06:35 -0600
commitb78a545a1056e6db9f4b6b4f262182b0a5c56e67 (patch)
tree515c2f742a5a39e18b00debf1849ee9703fa4a42 /mod
parentd67c5a6ffd134602084a6dcb37b316bf768bf715 (diff)
parent43671a0a323afa758df56c06822ce3c46da026df (diff)
downloadvolse-hubzilla-b78a545a1056e6db9f4b6b4f262182b0a5c56e67.tar.gz
volse-hubzilla-b78a545a1056e6db9f4b6b4f262182b0a5c56e67.tar.bz2
volse-hubzilla-b78a545a1056e6db9f4b6b4f262182b0a5c56e67.zip
Merge pull request #1 from friendica/master
Pull from upstream
Diffstat (limited to 'mod')
-rw-r--r--mod/apps.php1
-rw-r--r--mod/channel.php14
-rw-r--r--mod/connedit.php1
-rw-r--r--mod/directory.php53
-rw-r--r--mod/dirsearch.php6
-rw-r--r--mod/display.php10
-rw-r--r--mod/editblock.php6
-rw-r--r--mod/editlayout.php6
-rw-r--r--mod/editpost.php6
-rw-r--r--mod/editwebpage.php6
-rw-r--r--mod/filestorage.php11
-rw-r--r--mod/home.php1
-rw-r--r--mod/import.php30
-rw-r--r--mod/item.php265
-rw-r--r--mod/manage.php18
-rw-r--r--mod/network.php40
-rw-r--r--mod/new_channel.php2
-rw-r--r--mod/photo.php18
-rw-r--r--mod/photos.php3
-rw-r--r--mod/ping.php15
-rw-r--r--mod/profiles.php22
-rw-r--r--mod/search.php1
-rw-r--r--mod/settings.php21
-rw-r--r--mod/siteinfo.php6
-rw-r--r--mod/smilies.php14
-rw-r--r--mod/uexport.php39
26 files changed, 259 insertions, 356 deletions
diff --git a/mod/apps.php b/mod/apps.php
index 07d1968d2..8c9706d2f 100644
--- a/mod/apps.php
+++ b/mod/apps.php
@@ -30,6 +30,7 @@ function apps_content(&$a) {
}
return replace_macros(get_markup_template('myapps.tpl'), array(
+ '$sitename' => get_config('system','sitename'),
'$title' => t('Apps'),
'$apps' => $apps,
));
diff --git a/mod/channel.php b/mod/channel.php
index 54b25ad8b..e819de0e0 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -47,7 +47,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$category = $datequery = $datequery2 = '';
- $mid = $_GET['mid'];
+ $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
@@ -57,6 +57,7 @@ function channel_content(&$a, $update = 0, $load = false) {
}
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
+ $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$groups = array();
@@ -137,7 +138,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
- if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode'))
+ if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode') && (! $mid))
$page_mode = 'list';
else
$page_mode = 'client';
@@ -146,7 +147,7 @@ function channel_content(&$a, $update = 0, $load = false) {
if(($update) && (! $load)) {
if ($mid) {
$r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d AND item_restrict = 0
- AND (item_flags & %d)>0 AND (item_flags & %d)>0 $sql_extra limit 1",
+ AND (item_flags & %d) > 0 AND (item_flags & %d) > 0 $sql_extra limit 1",
dbesc($mid),
intval($a->profile['profile_uid']),
intval(ITEM_WALL),
@@ -156,7 +157,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$r = q("SELECT distinct parent AS `item_id`, created from item
left join abook on item.author_xchan = abook.abook_xchan
WHERE uid = %d AND item_restrict = 0
- AND (item_flags & %d)>0 AND ( item_flags & %d )>0
+ AND (item_flags & %d) > 0 AND ( item_flags & %d ) > 0
AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra
ORDER BY created DESC",
@@ -170,10 +171,12 @@ function channel_content(&$a, $update = 0, $load = false) {
}
else {
-
if(x($category)) {
$sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
}
+ if(x($hashtags)) {
+ $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG));
+ }
if($datequery) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
@@ -281,6 +284,7 @@ function channel_content(&$a, $update = 0, $load = false) {
'$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),
'$file' => '',
'$cats' => (($category) ? $category : ''),
+ '$tags' => (($hashtags) ? $hashtags : ''),
'$mid' => $mid,
'$dend' => $datequery,
'$dbegin' => $datequery2
diff --git a/mod/connedit.php b/mod/connedit.php
index 917e2c73b..5bf9c130b 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -504,6 +504,7 @@ function connedit_content(&$a) {
$slider_tpl = get_markup_template('contact_slider.tpl');
$slide = replace_macros($slider_tpl,array(
'$me' => t('Me'),
+ '$min' => 1,
'$val' => (($contact['abook_closeness']) ? $contact['abook_closeness'] : 99),
'$intimate' => t('Best Friends'),
'$friends' => t('Friends'),
diff --git a/mod/directory.php b/mod/directory.php
index c06a14d9e..4ceda293d 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -1,5 +1,6 @@
<?php
+require_once('include/socgraph.php');
require_once('include/dir_fns.php');
require_once('include/widgets.php');
require_once('include/bbcode.php');
@@ -7,6 +8,12 @@ require_once('include/bbcode.php');
function directory_init(&$a) {
$a->set_pager_itemspage(60);
+ if(x($_GET,'ignore')) {
+ q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ",
+ intval(local_user()),
+ dbesc($_GET['ignore'])
+ );
+ }
}
function directory_content(&$a) {
@@ -43,14 +50,38 @@ function directory_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
+
if(strpos($search,'=') && local_user() && get_pconfig(local_user(),'feature','expert'))
$advanced = $search;
+
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
+ // Suggest channels if no search terms or keywords are given
+ $suggest = (local_user() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
+
+ if($suggest) {
+ $r = suggestion_query(local_user(),get_observer_hash());
+
+ // Remember in which order the suggestions were
+ $addresses = array();
+ $index = 0;
+ foreach($r as $rr) {
+ $addresses[$rr['xchan_addr']] = $index++;
+ }
+
+ // Build query to get info about suggested people
+ $advanced = '';
+ foreach(array_keys($addresses) as $address) {
+ $advanced .= "address=\"$address\" ";
+ }
+ // Remove last space in the advanced query
+ $advanced = rtrim($advanced);
+
+ }
+
$tpl = get_markup_template('directory_header.tpl');
-
$dirmode = intval(get_config('system','directory_mode'));
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
@@ -99,9 +130,7 @@ function directory_content(&$a) {
if(! is_null($pubforums))
$query .= '&pubforums=' . intval($pubforums);
- $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
- if($pubforums)
- $sort_order = 'normal';
+ $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : 'normal');
if($sort_order)
$query .= '&order=' . urlencode($sort_order);
@@ -238,19 +267,28 @@ function directory_content(&$a) {
'online' => $online,
'kw' => (($out) ? t('Keywords: ') : ''),
'keywords' => $out,
+ 'ignlink' => $suggest ? $a->get_baseurl() . '/directory?ignore=' . $rr['hash'] : '',
+ 'ignore_label' => "Don't suggest",
);
$arr = array('contact' => $rr, 'entry' => $entry);
call_hooks('directory_item', $arr);
- $entries[] = $arr['entry'];
+ if($sort_order == '' && $suggest) {
+ $entries[$addresses[$rr['address']]] = $arr['entry']; // Use the same indexes as originally to get the best suggestion first
+ }
+ else {
+ $entries[] = $arr['entry'];
+ }
unset($profile);
unset($location);
}
+ ksort($entries); // Sort array by key so that foreach-constructs work as expected
+
if($j['keywords']) {
$a->data['directory_keywords'] = $j['keywords'];
}
@@ -271,15 +309,16 @@ function directory_content(&$a) {
killme();
}
else {
+ $maxheight = 175;
- $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
+ $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>";
$o .= replace_macros($tpl, array(
'$search' => $search,
'$desc' => t('Find'),
'$finddsc' => t('Finding:'),
'$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'),
'$entries' => $entries,
- '$dirlbl' => t('Directory'),
+ '$dirlbl' => $suggest ? t('Channel Suggestions') : t('Directory'),
'$submit' => t('Find'),
'$next' => alt_pager($a,$j['records'], t('next page'), t('previous page'))
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 1ecf33393..a88db0a2c 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -64,7 +64,7 @@ function dirsearch_content(&$a) {
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
- $forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : null);
+ $forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
@@ -111,7 +111,7 @@ function dirsearch_content(&$a) {
if($keywords)
$sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords);
- if(! is_null($forums))
+ if($forums)
$sql_extra .= dir_flag_build($joiner,'xprof_flags',XCHAN_FLAGS_PUBFORUM, $forums);
@@ -183,6 +183,8 @@ function dirsearch_content(&$a) {
$order = " order by xchan_name asc ";
elseif($sort_order == 'reverse')
$order = " order by xchan_name desc ";
+ elseif($sort_order == 'reversedate')
+ $order = " order by xchan_name_date asc ";
else
$order = " order by xchan_name_date desc ";
diff --git a/mod/display.php b/mod/display.php
index ece406543..7d7f4ca13 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -133,6 +133,7 @@ function display_content(&$a, $update = 0, $load = false) {
'$order' => '',
'$file' => '',
'$cats' => '',
+ '$tags' => '',
'$dend' => '',
'$dbegin' => '',
'$mid' => $item_hash
@@ -156,6 +157,7 @@ function display_content(&$a, $update = 0, $load = false) {
require_once('include/identity.php');
$sys = get_sys_channel();
+ $sysid = $sys['channel_id'];
if(local_user()) {
$r = q("SELECT * from item
@@ -177,8 +179,8 @@ function display_content(&$a, $update = 0, $load = false) {
// in case somebody turned off public access to sys channel content using permissions
// make that content unsearchable by ensuring the owner_xchan can't match
- if(! perm_is_allowed($sys['channel_id'],$observer_hash,'view_stream'))
- $sys['xchan_hash'] .= 'disabled';
+ if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
+ $sysid = 0;
$r = q("SELECT * from item
@@ -187,11 +189,11 @@ function display_content(&$a, $update = 0, $load = false) {
AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = ''
AND `item`.`deny_gid` = '' AND item_private = 0 )
and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
- OR owner_xchan = '%s')
+ OR uid = %d )
$sql_extra )
limit 1",
dbesc($target_item['parent_mid']),
- dbesc($sys['xchan_hash'])
+ intval($sysid)
);
}
diff --git a/mod/editblock.php b/mod/editblock.php
index c58a93410..6ec840af7 100644
--- a/mod/editblock.php
+++ b/mod/editblock.php
@@ -161,16 +161,16 @@ function editblock_content(&$a) {
'$public' => t('Public post'),
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Set title'),
+ '$placeholdertitle' => t('Title (optional)'),
'$pagetitle' => $block_title,
'$category' => '',
- '$placeholdercategory' => t('Categories (comma-separated list)'),
+ '$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
'$profile_uid' => (intval($channel['channel_id'])),
- '$preview' => ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
+ '$preview' => true, // ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => $itm[0]['app'],
'$defexpire' => '',
diff --git a/mod/editlayout.php b/mod/editlayout.php
index 94e2e628c..d76aa484d 100644
--- a/mod/editlayout.php
+++ b/mod/editlayout.php
@@ -156,16 +156,16 @@ function editlayout_content(&$a) {
'$public' => t('Public post'),
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Set title'),
+ '$placeholdertitle' => t('Title (optional)'),
'$pagetitle' => $layout_title,
'$category' => '',
- '$placeholdercategory' => t('Categories (comma-separated list)'),
+ '$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
'$profile_uid' => (intval($owner)),
- '$preview' => ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
+ '$preview' => true, // ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$defexpire' => '',
diff --git a/mod/editpost.php b/mod/editpost.php
index ed7fcff8a..dfbc8766e 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -129,15 +129,15 @@ function editpost_content(&$a) {
'$public' => t('Public post'),
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Set title'),
+ '$placeholdertitle' => t('Title (optional)'),
'$category' => $category,
- '$placeholdercategory' => t('Categories (comma-separated list)'),
+ '$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
'$profile_uid' => local_user(),
- '$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
+ '$preview' => true, // ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$catsenabled' => $catsenabled,
diff --git a/mod/editwebpage.php b/mod/editwebpage.php
index 2acb3bd84..191c9a9ac 100644
--- a/mod/editwebpage.php
+++ b/mod/editwebpage.php
@@ -195,14 +195,14 @@ function editwebpage_content(&$a) {
'$mimeselect' => $mimeselect,
'$layoutselect' => $layoutselect,
'$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Set title'),
+ '$placeholdertitle' => t('Title (optional)'),
'$category' => '',
- '$placeholdercategory' => t('Categories (comma-separated list)'),
+ '$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'lockstate' => (((strlen($itm[0]['allow_cid'])) || (strlen($itm[0]['allow_gid'])) || (strlen($itm[0]['deny_cid'])) || (strlen($itm[0]['deny_gid']))) ? 'lock' : 'unlock'),
'$bang' => '',
'$profile_uid' => (intval($owner)),
- '$preview' => ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
+ '$preview' => true, // ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => $a->sourcename,
'$defexpire' => '',
diff --git a/mod/filestorage.php b/mod/filestorage.php
index e27087a92..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'],
@@ -146,7 +150,8 @@ function filestorage_content(&$a) {
'$submit' => t('Submit')
));
- return $o;
+ echo $o;
+ killme();
}
goaway(z_root() . '/cloud/' . $which);
diff --git a/mod/home.php b/mod/home.php
index b1b8e3fd0..b2538795f 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -141,6 +141,7 @@ function home_content(&$a, $update = 0, $load = false) {
'$order' => 'comment',
'$file' => '',
'$cats' => '',
+ '$tags' => '',
'$dend' => '',
'$mid' => '',
'$dbegin' => ''
diff --git a/mod/import.php b/mod/import.php
index 6cb3767a6..c9a4edb67 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -101,9 +101,33 @@ function import_post(&$a) {
// We should probably also verify the hash
if($r) {
- logger('mod_import: duplicate channel. ', print_r($channel,true));
- notice( t('Cannot create a duplicate channel identifier on this system. Import failed.') . EOL);
- return;
+ if($r[0]['channel_guid'] === $channel['channel_guid'] || $r[0]['channel_hash'] === $channel['channel_hash']) {
+ logger('mod_import: duplicate channel. ', print_r($channel,true));
+ notice( t('Cannot create a duplicate channel identifier on this system. Import failed.') . EOL);
+ return;
+ }
+ else {
+ // try at most ten times to generate a unique address.
+ $x = 0;
+ $found_unique = false;
+ do {
+ $tmp = $channel['channel_address'] . mt_rand(1000,9999);
+ $r = q("select * from channel where channel_address = '%s' limit 1",
+ dbesc($tmp)
+ );
+ if(! $r) {
+ $channel['channel_address'] = $tmp;
+ $found_unique = true;
+ break;
+ }
+ $x ++;
+ } while ($x < 10);
+ if(! $found_unique) {
+ logger('mod_import: duplicate channel. randomisation failed.', print_r($channel,true));
+ notice( t('Unable to create a unique channel address. Import failed.') . EOL);
+ return;
+ }
+ }
}
unset($channel['channel_id']);
diff --git a/mod/item.php b/mod/item.php
index 94ff32750..f5a9a4b22 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -85,7 +85,7 @@ function item_post(&$a) {
$preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
$categories = ((x($_REQUEST,'category')) ? escape_tags($_REQUEST['category']) : '');
$webpage = ((x($_REQUEST,'webpage')) ? intval($_REQUEST['webpage']) : 0);
- $pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags(urlencode($_REQUEST['pagetitle'])) : '');
+ $pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags(urlencode($_REQUEST['pagetitle'])) : '');
$layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): '');
$plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
@@ -468,6 +468,7 @@ function item_post(&$a) {
if($mimetype === 'text/bbcode') {
+ require_once('include/text.php');
if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
require_once('include/bb2diaspora.php');
$body = diaspora2bb(escape_tags($body),true);
@@ -602,7 +603,7 @@ function item_post(&$a) {
continue;
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
- logger('handle_tag: ' . print_r($success,tue), LOGGER_DATA);
+ logger('handle_tag: ' . print_r($success,true), LOGGER_DATA);
if(($access_tag) && (! $parent_item)) {
logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA);
if ($first_access_tag && (! get_pconfig($profile_uid,'system','no_private_mention_acl_override'))) {
@@ -682,7 +683,8 @@ function item_post(&$a) {
}
}
- $item_flags |= ITEM_UNSEEN;
+ if(local_user() != $profile_uid)
+ $item_flags |= ITEM_UNSEEN;
if($post_type === 'wall' || $post_type === 'wall-comment')
$item_flags = $item_flags | ITEM_WALL;
@@ -987,263 +989,6 @@ function item_content(&$a) {
}
}
-/**
- * This function removes the tag $tag from the text $body and replaces it with
- * the appropiate link.
- *
- * @param unknown_type $body the text to replace the tag in
- * @param unknown_type $access_tag - used to return tag ACL exclusions e.g. @!foo
- * @param unknown_type $str_tags string to add the tag to
- * @param unknown_type $profile_uid
- * @param unknown_type $tag the tag to replace
- *
- * @return boolean true if replaced, false if not replaced
- */
-function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
-
- $replaced = false;
- $r = null;
-
-
- $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
- $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype);
- $termtype = ((strpos($tag,'#^[') === 0) ? TERM_BOOKMARK : $termtype);
-
-
- //is it a hash tag?
- if(strpos($tag,'#') === 0) {
- if(strpos($tag,'#^[') === 0) {
- if(preg_match('/#\^\[(url|zrl)(.*?)\](.*?)\[\/(url|zrl)\]/',$tag,$match)) {
- $basetag = $match[3];
- $url = ((substr($match[2],0,1) === '=') ? substr($match[2],1) : $match[3]);
- $replaced = true;
-
- }
- }
- // if the tag is already replaced...
- elseif((strpos($tag,'[zrl=')) || (strpos($tag,'[url='))) {
- //...do nothing
- return $replaced;
- }
- if($tag == '#getzot') {
- $basetag = 'getzot';
- $url = 'https://redmatrix.me';
- $newtag = '#[zrl=' . $url . ']' . $basetag . '[/zrl]';
- $body = str_replace($tag,$newtag,$body);
- $replaced = true;
- }
- if(! $replaced) {
-
- //base tag has the tags name only
-
- if((substr($tag,0,7) === '#&quot;') && (substr($tag,-6,6) === '&quot;')) {
- $basetag = substr($tag,7);
- $basetag = substr($basetag,0,-6);
- }
- else
- $basetag = str_replace('_',' ',substr($tag,1));
-
- //create text for link
- $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag);
- $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]';
- //replace tag by the link
- $body = str_replace($tag, $newtag, $body);
- $replaced = true;
- }
- //is the link already in str_tags?
- if(! stristr($str_tags,$newtag)) {
- //append or set str_tags
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= $newtag;
- }
- return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $basetag, 'url' => $url, 'contact' => $r[0]);
- }
-
- //is it a person tag?
-
- if(strpos($tag,'@') === 0) {
-
- // The @! tag will alter permissions
- $exclusive = ((strpos($tag,'!') === 1) ? true : false);
-
- //is it already replaced?
- if(strpos($tag,'[zrl='))
- return $replaced;
-
- //get the person's name
-
- $name = substr($tag,(($exclusive) ? 2 : 1)); // The name or name fragment we are going to replace
- $newname = $name; // a copy that we can mess with
- $tagcid = 0;
-
- $r = null;
-
- // is it some generated name?
-
- $forum = false;
- $trailing_plus_name = false;
-
- // @channel+ is a forum or network delivery tag
-
- if(substr($newname,-1,1) === '+') {
- $forum = true;
- $newname = substr($newname,0,-1);
- }
-
- // Here we're looking for an address book entry as provided by the auto-completer
- // of the form something+nnn where nnn is an abook_id or the first chars of xchan_hash
-
- if(strrpos($newname,'+')) {
- //get the id
-
- if(strrpos($tagcid,' '))
- $tagcid = substr($tagcid,0,strrpos($tagcid,' '));
-
- $tagcid = substr($newname,strrpos($newname,'+') + 1);
-
- if(strlen($tagcid) < 16)
- $abook_id = intval($tagcid);
- //remove the next word from tag's name
- if(strpos($name,' ')) {
- $name = substr($name,0,strpos($name,' '));
- }
-
- if($abook_id) { // if there was an id
- // select channel with that id from the logged in user's address book
- $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
- WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
- intval($abook_id),
- intval($profile_uid)
- );
- }
- else {
- $r = q("SELECT * FROM xchan
- WHERE xchan_hash like '%s%%' LIMIT 1",
- dbesc($tagcid)
- );
- }
- }
-
- if(! $r) {
-
- // look for matching names in the address book
-
- // Two ways to deal with spaces - doube quote the name or use underscores
- // we see this after input filtering so quotes have been html entity encoded
-
- if((substr($name,0,6) === '&quot;') && (substr($name,-6,6) === '&quot;')) {
- $newname = substr($name,6);
- $newname = substr($newname,0,-6);
- }
- else
- $newname = str_replace('_',' ',$name);
-
- // do this bit over since we started over with $name
-
- if(substr($newname,-1,1) === '+') {
- $forum = true;
- $newname = substr($newname,0,-1);
- }
-
- //select someone from this user's contacts by name
- $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
- WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
- dbesc($newname),
- intval($profile_uid)
- );
-
- if(! $r) {
- //select someone by attag or nick and the name passed in
- $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
- WHERE xchan_addr like ('%s') AND abook_channel = %d LIMIT 1",
- dbesc(((strpos($newname,'@')) ? $newname : $newname . '@%')),
- intval($profile_uid)
- );
- }
-
- if(! $r) {
-
- // it's possible somebody has a name ending with '+', which we stripped off as a forum indicator
- // This is very rare but we want to get it right.
-
- $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
- WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
- dbesc($newname . '+'),
- intval($profile_uid)
- );
- if($r)
- $trailing_plus_name = true;
- }
- }
-
- // $r is set if we found something
-
- $channel = get_app()->get_channel();
-
- if($r) {
- $profile = $r[0]['xchan_url'];
- $newname = $r[0]['xchan_name'];
- // add the channel's xchan_hash to $access_tag if exclusive
- if($exclusive) {
- $access_tag .= 'cid:' . $r[0]['xchan_hash'];
- }
- }
- else {
- // check for a group/collection exclusion tag
-
- // note that we aren't setting $replaced even though we're replacing text.
- // This tag isn't going to get a term attached to it. It's only used for
- // access control. The link points to out own channel just so it doesn't look
- // weird - as all the other tags are linked to something.
-
- if(local_user() && local_user() == $profile_uid) {
- require_once('include/group.php');
- $grp = group_byname($profile_uid,$name);
-
- if($grp) {
- $g = q("select hash from groups where id = %d and visible = 1 limit 1",
- intval($grp)
- );
- if($g && $exclusive) {
- $access_tag .= 'gid:' . $g[0]['hash'];
- }
- $channel = get_app()->get_channel();
- if($channel) {
- $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . z_root() . '/channel/' . $channel['channel_address'] . ']' . $newname . '[/zrl]';
- $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
- }
- }
- }
- }
-
- if(($exclusive) && (! $access_tag)) {
- $access_tag .= 'cid:' . $channel['channel_hash'];
- }
-
- // if there is an url for this channel
-
- if(isset($profile)) {
- $replaced = true;
- //create profile link
- $profile = str_replace(',','%2c',$profile);
- $url = $profile;
- $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . (($forum && ! $trailing_plus_name) ? '+' : '') . '[/zrl]';
- $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
- //append tag to str_tags
- if(! stristr($str_tags,$newtag)) {
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= $newtag;
- }
- }
- }
-
-
- return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $newname, 'url' => $url, 'contact' => $r[0]);
-}
-
-
function fix_attached_photo_permissions($uid,$xchan_hash,$body,
$str_contact_allow,$str_group_allow,$str_contact_deny,$str_group_deny) {
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/network.php b/mod/network.php
index 522622f03..d444dbd59 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -34,6 +34,21 @@ function network_content(&$a, $update = 0, $load = false) {
$channel = $a->get_channel();
+
+ $datequery = $datequery2 = '';
+
+ $group = 0;
+
+ $nouveau = false;
+
+ $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
+ $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
+ $nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0);
+ $gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
+ $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
+ $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
+
+
$search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
if(strpos($search,'@') === 0) {
@@ -47,23 +62,11 @@ function network_content(&$a, $update = 0, $load = false) {
}
}
elseif(strpos($search,'#') === 0) {
- $search = $_GET['search'] = substr($search,1);
+ $hashtags = substr($search,1);
+ $search = $_GET['search'] = '';
}
}
-
- $datequery = $datequery2 = '';
-
- $group = 0;
-
- $nouveau = false;
-
- $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
- $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
- $nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0);
- $gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
-
-
if($datequery)
$_GET['order'] = 'post';
@@ -199,6 +202,12 @@ function network_content(&$a, $update = 0, $load = false) {
}
}
+ if(x($category)) {
+ $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
+ }
+ if(x($hashtags)) {
+ $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG));
+ }
if(! $update) {
// The special div is needed for liveUpdate to kick in for this page.
@@ -238,7 +247,8 @@ function network_content(&$a, $update = 0, $load = false) {
'$search' => (($search) ? $search : ''),
'$order' => $order,
'$file' => $file,
- '$cats' => '',
+ '$cats' => $category,
+ '$tags' => $hashtags,
'$dend' => $datequery,
'$mid' => '',
'$dbegin' => $datequery2
diff --git a/mod/new_channel.php b/mod/new_channel.php
index 8329f0ec3..185fc7c28 100644
--- a/mod/new_channel.php
+++ b/mod/new_channel.php
@@ -116,6 +116,8 @@ function new_channel_content(&$a) {
'$label_import' => t('Or <a href="import">import an existing channel</a> from another location'),
'$name' => $name,
'$label_role' => t('Channel Type'),
+ '$questionmark' => t('?'),
+ '$what_is_role' => t('What is this?'),
'$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,
diff --git a/mod/photo.php b/mod/photo.php
index 8cb82e8ff..66280cb76 100644
--- a/mod/photo.php
+++ b/mod/photo.php
@@ -224,9 +224,21 @@ function photo_init(&$a) {
}
else {
-
- header("Expires: " . gmdate("D, d M Y H:i:s", time() + (3600*24)) . " GMT");
- header("Cache-Control: max-age=" . (3600*24));
+ // The photo cache default is 1 day to provide a privacy trade-off,
+ // as somebody reducing photo permissions on a photo that is already
+ // "in the wild" won't be able to stop the photo from being viewed
+ // for this amount amount of time once it is in the browser cache.
+ // The privacy expectations of your site members and their perception
+ // of privacy where it affects the entire project may be affected.
+ // This has performance considerations but we highly recommend you
+ // leave it alone.
+
+ $cache = get_config('system','photo_cache_time');
+ if(! $cache)
+ $cache = (3600 * 24); // 1 day
+
+ header("Expires: " . gmdate("D, d M Y H:i:s", time() + $cache) . " GMT");
+ header("Cache-Control: max-age=" . $cache);
}
echo $data;
diff --git a/mod/photos.php b/mod/photos.php
index 7a9229cc4..f4e770ec0 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -697,13 +697,10 @@ function photos_content(&$a) {
$imagelink = ($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id']
. (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''));
- $rel=("photo");
-
$photos[] = array(
'id' => $rr['id'],
'twist' => ' ' . $twist . rand(2,4),
'link' => $imagelink,
- 'rel' => $rel,
'title' => t('View Photo'),
'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
'alt' => $imgalt_e,
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 910c48743..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)) {
@@ -585,7 +595,7 @@ function profiles_content(&$a) {
$fields = $profile_fields_basic;
- $opt_tpl = get_markup_template("profile-hide_friends.tpl");
+ $opt_tpl = get_markup_template("profile_hide_friends.tpl");
$hide_friends = replace_macros($opt_tpl,array(
'$desc' => t('Hide your contact/friend list from viewers of this profile?'),
'$yes_str' => t('Yes'),
@@ -611,7 +621,7 @@ function profiles_content(&$a) {
}
}
-logger('extra_fields: ' . print_r($extra_fields,true));
+//logger('extra_fields: ' . print_r($extra_fields,true));
$f = get_config('system','birthday_input_format');
if(! $f)
diff --git a/mod/search.php b/mod/search.php
index 612ceb4bc..6df9d631a 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -107,6 +107,7 @@ function search_content(&$a,$update = 0, $load = false) {
'$order' => '',
'$file' => '',
'$cats' => '',
+ '$tags' => '',
'$mid' => '',
'$dend' => '',
'$dbegin' => ''
diff --git a/mod/settings.php b/mod/settings.php
index ab6638ccb..ea7b2ba06 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -160,7 +160,9 @@ function settings_post(&$a) {
$itemspage = 100;
- if($mobile_theme !== '') {
+ if ($mobile_theme == "---")
+ del_pconfig(local_user(),'system','mobile_theme');
+ else {
set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
}
@@ -755,7 +757,6 @@ function settings_content(&$a) {
$themes = array();
- $mobile_themes = array("---" => t('No special theme for mobile devices'));
$files = glob('view/theme/*');
if($allowed_themes) {
foreach($allowed_themes as $th) {
@@ -763,15 +764,21 @@ function settings_content(&$a) {
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
$is_mobile = file_exists('view/theme/' . $th . '/mobile');
+ $is_library = file_exists('view/theme/'. $th . '/library');
+ $mobile_themes["---"] = t("No special theme for mobile devices");
+
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
- if($is_mobile) {
- $mobile_themes[$f]=$theme_name;
- }
- else {
- $themes[$f]=$theme_name;
+ if (! $is_library) {
+ if($is_mobile) {
+ $mobile_themes[$f] = $themes[$f] = $theme_name . ' (' . t('mobile') . ')';
+ }
+ else {
+ $mobile_themes[$f] = $themes[$f] = $theme_name;
+ }
}
}
+
}
}
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 03e578467..01804e62a 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -73,6 +73,7 @@ function siteinfo_init(&$a) {
'site_name' => (($site_name) ? $site_name : ''),
'platform' => RED_PLATFORM,
'dbdriver' => $db->getdriver(),
+ 'lastpoll' => get_config('system','lastpoll'),
'info' => (($site_info) ? $site_info : ''),
'channels_total' => $channels_total_stat,
'channels_active_halfyear' => $channels_active_halfyear_stat,
@@ -134,10 +135,13 @@ function siteinfo_content(&$a) {
'$title' => t('Red'),
'$description' => t('This is a hub of the Red Matrix - a global cooperative network of decentralized privacy enhanced websites.'),
'$version' => $version,
+ '$tag_txt' => t('Tag: '),
'$tag' => $tag,
+ '$polled' => t('Last background fetch: '),
+ '$lastpoll' => get_poller_runtime(),
'$commit' => $commit,
'$web_location' => t('Running at web location') . ' ' . z_root(),
- '$visit' => t('Please visit <a href="http://getzot.com">GetZot.com</a> to learn more about the Red Matrix.'),
+ '$visit' => t('Please visit <a href="https://redmatrix.me">RedMatrix.me</a> to learn more about the Red Matrix.'),
'$bug_text' => t('Bug reports and issues: please visit'),
'$bug_link_url' => 'https://github.com/friendica/red/issues',
'$bug_link_text' => 'redmatrix issues',
diff --git a/mod/smilies.php b/mod/smilies.php
index c47f95da7..b22d0c6d2 100644
--- a/mod/smilies.php
+++ b/mod/smilies.php
@@ -1,3 +1,15 @@
<?php
-function smilies_content(&$a) { return smilies('',true); }
+function smilies_content(&$a) {
+ if ($a->argv[1]==="json"){
+ $tmp = list_smilies();
+ $results = array();
+ for($i = 0; $i < count($tmp['texts']); $i++) {
+ $results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]);
+ }
+ json_return_and_die($results);
+ }
+ else {
+ return smilies('',true);
+ }
+}
diff --git a/mod/uexport.php b/mod/uexport.php
index 6304115c8..250a001a2 100644
--- a/mod/uexport.php
+++ b/mod/uexport.php
@@ -4,22 +4,37 @@ function uexport_init(&$a) {
if(! local_user())
killme();
- $channel = $a->get_channel();
+ if(argc() > 1) {
+ $channel = $a->get_channel();
- require_once('include/identity.php');
+ require_once('include/identity.php');
- header('content-type: application/octet_stream');
- header('content-disposition: attachment; filename="' . $channel['channel_address'] . '.json"' );
+ header('content-type: application/octet_stream');
+ header('content-disposition: attachment; filename="' . $channel['channel_address'] . '.json"' );
- if(argc() > 1 && argv(1) === 'basic') {
- echo json_encode(identity_basic_export(local_user()));
- killme();
- }
+ if(argc() > 1 && argv(1) === 'basic') {
+ echo json_encode(identity_basic_export(local_user()));
+ killme();
+ }
- if(argc() > 1 && argv(1) === 'complete') {
- echo json_encode(identity_basic_export(local_user(),true));
- killme();
+ // FIXME - this basically doesn't work in the wild with a channel more than a few months old due to memory and execution time limits.
+ // It probably needs to be built at the CLI and offered to download as a tarball. Maybe stored in the members dav.
+
+ if(argc() > 1 && argv(1) === 'complete') {
+ echo json_encode(identity_basic_export(local_user(),true));
+ killme();
+ }
}
+}
-} \ No newline at end of file
+function uexport_content(&$a) {
+ $o = replace_macros(get_markup_template('uexport.tpl'), array(
+ '$title' => t('Export Channel'),
+ '$basictitle' => t('Export Channel'),
+ '$basic' => t('Export your basic channel information to a small file. This acts as a backup of your connections, permissions, profile and basic data, which can be used to import your data to a new hub, but does not contain your content.'),
+ '$fulltitle' => t('Export Content'),
+ '$full' => t('Export your channel information and all the content to a JSON backup. This backs up all of your connections, permissions, profile data and all of your content, but is generally not suitable for importing a channel to a new hub as this file may be VERY large. Please be patient - it may take several minutes for this download to begin.')
+ ));
+return $o;
+}