aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php18
-rw-r--r--include/attach.php34
-rw-r--r--include/bbcode.php6
-rw-r--r--include/comanche.php5
-rw-r--r--include/contact_selectors.php2
-rw-r--r--include/contact_widgets.php3
-rw-r--r--include/conversation.php9
-rwxr-xr-xinclude/diaspora.php14
-rw-r--r--include/dir_fns.php61
-rw-r--r--include/event.php88
-rw-r--r--include/identity.php40
-rwxr-xr-xinclude/items.php31
-rw-r--r--include/network.php24
-rw-r--r--include/permissions.php68
-rw-r--r--include/photo/photo_driver.php8
-rw-r--r--include/photos.php10
-rw-r--r--include/security.php6
-rw-r--r--include/taxonomy.php23
-rw-r--r--include/text.php4
-rw-r--r--include/widgets.php13
-rw-r--r--include/zot.php54
21 files changed, 342 insertions, 179 deletions
diff --git a/include/Contact.php b/include/Contact.php
index e7aa4f861..6b5f9388c 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -331,6 +331,24 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc(datetime_convert()),
intval($channel_id)
);
+ // if this was the default channel, set another one as default
+ if($a->account['account_default_channel'] == $channel_id) {
+ $r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1",
+ intval($a->account['account_id']),
+ intval(PAGE_REMOVED));
+ if ($r) {
+ $rr = q("update account set account_default_channel = %d where account_id = %d",
+ intval($r[0]['channel_id']),
+ intval($a->account['account_id']));
+ logger("Default channel deleted, changing default to channel_id " . $r[0]['channel_id']);
+ }
+ else {
+ $rr = q("update account set account_default_channel = 0 where account_id = %d",
+ intval($r[0]['channel_id']),
+ intval($a->account['account_id']));
+ }
+ }
+
$r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",
dbesc($channel['channel_hash']),
diff --git a/include/attach.php b/include/attach.php
index 812090d5c..e89ca7cb2 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -391,13 +391,18 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$hash = (($arr && $arr['hash']) ? $arr['hash'] : null);
$upload_path = (($arr && $arr['directory']) ? $arr['directory'] : '');
- // logger('arr: ' . print_r($arr,true));
+ logger('arr: ' . print_r($arr,true));
if(! perm_is_allowed($channel_id,get_observer_hash(), 'write_storage')) {
$ret['message'] = t('Permission denied.');
return $ret;
}
+ $str_group_allow = perms2str($arr['group_allow']);
+ $str_contact_allow = perms2str($arr['contact_allow']);
+ $str_group_deny = perms2str($arr['group_deny']);
+ $str_contact_deny = perms2str($arr['contact_deny']);
+
// The 'update' option sets db values without uploading a new attachment
// 'replace' replaces the existing uploaded data
@@ -473,14 +478,13 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
}
$darr = array('pathname' => $pathname);
- if($arr && array_key_exists('allow_cid',$arr))
- $darr['allow_cid'] = $arr['allow_cid'];
- if($arr && array_key_exists('allow_gid',$arr))
- $darr['allow_gid'] = $arr['allow_gid'];
- if($arr && array_key_exists('deny_cid',$arr))
- $darr['deny_cid'] = $arr['deny_cid'];
- if($arr && array_key_exists('deny_gid',$arr))
- $darr['deny_gid'] = $arr['deny_gid'];
+
+ // if we need to create a directory, use the channel default permissions.
+
+ $darr['allow_cid'] = $channel['allow_cid'];
+ $darr['allow_gid'] = $channel['allow_gid'];
+ $darr['deny_cid'] = $channel['deny_cid'];
+ $darr['deny_gid'] = $channel['deny_gid'];
if($pathname) {
@@ -652,9 +656,9 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
dbesc($created),
dbesc($created),
dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow),
- dbesc(($arr && array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : ''),
- dbesc(($arr && array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : ''),
- dbesc(($arr && array_key_exists('deny_gid',$arr)) ? $arr['deny_gid'] : '')
+ dbesc(($arr && array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : $str_group_allow),
+ dbesc(($arr && array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : $str_contact_deny),
+ dbesc(($arr && array_key_exists('deny_gid',$arr)) ? $arr['deny_gid'] : $str_group_deny)
);
}
@@ -662,6 +666,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$args = array( 'source' => $source, 'visible' => 0, 'resource_id' => $hash, 'album' => basename($pathname), 'os_path' => $os_basepath . $os_relpath, 'filename' => $filename, 'getimagesize' => $gis);
if($arr['contact_allow'])
$args['contact_allow'] = $arr['contact_allow'];
+ if($arr['group_allow'])
+ $args['group_allow'] = $arr['group_allow'];
+ if($arr['contact_deny'])
+ $args['contact_deny'] = $arr['contact_deny'];
+ if($arr['group_deny'])
+ $args['group_deny'] = $arr['group_deny'];
$p = photo_upload($channel,get_app()->get_observer(),$args);
if($p['success']) {
$ret['body'] = $p['body'];
diff --git a/include/bbcode.php b/include/bbcode.php
index aa2562d62..2e201344c 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -174,10 +174,14 @@ function bb_parse_app($match) {
function bb_parse_element($match) {
$j = json_decode(base64url_decode($match[1]),true);
- if ($j) {
+ if ($j && local_channel()) {
$text = sprintf( t('Install %s element: '), translate_design_element($j['type'])) . $j['pagetitle'];
$o = EOL . '<a href="#" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . $text . '</a>' . EOL;
}
+ else {
+ $text = sprintf( t('This post contains an installable %s element, however you lack permissions to install it on this site.' ), translate_design_element($j['type'])) . $j['pagetitle'];
+ $o = EOL . $text . EOL;
+ }
return $o;
}
diff --git a/include/comanche.php b/include/comanche.php
index 57056ae2a..9585a6578 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -284,6 +284,11 @@ function comanche_widget($name, $text) {
if(file_exists('widget/' . trim($name) . '.php'))
require_once('widget/' . trim($name) . '.php');
+ else {
+ $theme_widget = 'widget_' . trim($name) . '.php';
+ if(theme_include($theme_widget))
+ require_once(theme_include($theme_widget));
+ }
$func = 'widget_' . trim($name);
if (function_exists($func))
diff --git a/include/contact_selectors.php b/include/contact_selectors.php
index 726efce9d..8671f1bd1 100644
--- a/include/contact_selectors.php
+++ b/include/contact_selectors.php
@@ -5,7 +5,7 @@ function contact_profile_assign($current) {
$o = '';
- $o .= "<select id=\"contact-profile-selector\" name=\"profile_assign\" />\r\n";
+ $o .= "<select id=\"contact-profile-selector\" name=\"profile_assign\" class=\"form-control\"/>\r\n";
$r = q("SELECT profile_guid, profile_name FROM `profile` WHERE `uid` = %d",
intval($_SESSION['uid']));
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 2c41ea92e..a60b8b1c3 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -79,7 +79,8 @@ function categories_widget($baseurl,$selected = '') {
where item.uid = %d
and term.uid = item.uid
and term.type = %d
- and item.author_xchan = '%s'
+ and item.owner_xchan = '%s'
+ and item.item_wall = 1
$item_normal
order by term.term asc",
intval($a->profile['profile_uid']),
diff --git a/include/conversation.php b/include/conversation.php
index 332f9487c..d14d7ba84 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1168,7 +1168,7 @@ function status_editor($a, $x, $popup = false) {
'$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''),
'$id_select' => $id_select,
'$id_seltext' => t('Post as'),
- '$writefiles' => (perm_is_allowed($x['profile_uid'], get_observer_hash(), 'post_photos') || perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage')),
+ '$writefiles' => perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
@@ -1377,7 +1377,8 @@ function render_location_default($item) {
function prepare_page($item) {
$a = get_app();
- $naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
+ $naked = 1;
+// $naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
$observer = $a->get_observer();
//240 chars is the longest we can have before we start hitting problems with suhosin sites
$preview = substr(urlencode($item['body']), 0, 240);
@@ -1586,7 +1587,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
'id' => 'profile-tab',
);
}
- if ($p['view_photos']) {
+ if ($p['view_storage']) {
$tabs[] = array(
'label' => t('Photos'),
'url' => $a->get_baseurl() . '/photos/' . $nickname,
@@ -1594,8 +1595,6 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
'title' => t('Photo Albums'),
'id' => 'photo-tab',
);
- }
- if ($p['view_storage']) {
$tabs[] = array(
'label' => t('Files'),
'url' => $a->get_baseurl() . '/cloud/' . $nickname . ((get_observer_hash()) ? '' : '?f=&davguest=1'),
diff --git a/include/diaspora.php b/include/diaspora.php
index d59da6fff..187793d2b 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -329,6 +329,7 @@ function diaspora_get_contact_by_handle($uid,$handle) {
function find_diaspora_person_by_handle($handle) {
$person = false;
+ $refresh = false;
if(diaspora_is_blacklisted($handle))
return false;
@@ -339,9 +340,13 @@ function find_diaspora_person_by_handle($handle) {
if($r) {
$person = $r[0];
logger('find_diaspora_person_by handle: in cache ' . print_r($r,true), LOGGER_DATA);
+ if($person['xchan_name_date'] < datetime_convert('UTC','UTC', 'now - 1 month')) {
+ logger('Updating Diaspora cached record for ' . $handle);
+ $refresh = true;
+ }
}
- if(! $person) {
+ if((! $person) || ($refresh)) {
// try webfinger. Make sure to distinguish between diaspora,
// hubzilla w/diaspora protocol and friendica w/diaspora protocol.
@@ -349,7 +354,7 @@ function find_diaspora_person_by_handle($handle) {
$result = discover_by_webbie($handle);
if($result) {
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
- dbesc($handle)
+ dbesc(str_replace('acct:','',$handle))
);
if($r) {
$person = $r[0];
@@ -1003,6 +1008,11 @@ function diaspora_post($importer,$xml,$msg) {
return 202;
}
+ if(! is_importable($datarray,$contact)) {
+ logger('diaspora_post: filtering this author.');
+ return 202;
+ }
+
$result = item_store($datarray);
return;
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 902a0c1a3..38c92dd94 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -72,33 +72,20 @@ function check_upstream_directory() {
set_config('system', 'directory_server', '');
}
-function get_globaldir_setting($observer) {
-
- if($observer)
- $globaldir = get_xconfig($observer,'directory','globaldir');
- else
- $globaldir = ((array_key_exists('globaldir',$_SESSION)) ? intval($_SESSION['globaldir']) : false);
-
- if($globaldir === false)
- $globaldir = get_config('directory','globaldir');
-
- return $globaldir;
-}
-
-function get_safemode_setting($observer) {
+function get_directory_setting($observer, $setting) {
if ($observer)
- $safe_mode = get_xconfig($observer,'directory','safe_mode');
+ $ret = get_xconfig($observer, 'directory', $setting);
else
- $safe_mode = ((array_key_exists('safemode',$_SESSION)) ? intval($_SESSION['safemode']) : false);
+ $ret = ((array_key_exists($setting,$_SESSION)) ? intval($_SESSION[$setting]) : false);
- if($safe_mode === false)
- $safe_mode = get_config('directory','safe_mode');
+ if($ret === false)
+ $ret = get_config('directory', $setting);
- if($safe_mode === false)
- $safe_mode = 1;
+ if($setting == 'safemode' && $ret === false)
+ $ret = 1;
- return $safe_mode;
+ return $ret;
}
/**
@@ -110,49 +97,37 @@ function dir_sort_links() {
$observer = get_observer_hash();
- $safe_mode = get_safemode_setting($observer);
- $globaldir = get_globaldir_setting($observer);
+ $safe_mode = get_directory_setting($observer, 'safemode');
+ $globaldir = get_directory_setting($observer, 'globaldir');
+ $pubforums = get_directory_setting($observer, 'pubforums');
// Build urls without order and pubforums so it's easy to tack on the changed value
// Probably there's an easier way to do this
-
$directory_sort_order = get_config('system','directory_sort_order');
if(! $directory_sort_order)
$directory_sort_order = 'date';
-
$current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : $directory_sort_order);
- $url = 'directory?f=';
+ $suggest = (($_REQUEST['suggest']) ? '&suggest=' . $_REQUEST['suggest'] : '');
- $tmp = array_merge($_GET,$_POST);
- unset($tmp['order']);
- unset($tmp['q']);
- unset($tmp['f']);
- $sorturl = $url . http_build_query($tmp);
+ $url = 'directory?f=';
$tmp = array_merge($_GET,$_POST);
+ unset($tmp['suggest']);
unset($tmp['pubforums']);
unset($tmp['global']);
unset($tmp['safe']);
unset($tmp['q']);
unset($tmp['f']);
- $forumsurl = $url . http_build_query($tmp);
+ $forumsurl = $url . http_build_query($tmp) . $suggest;
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
'$header' => t('Directory Options'),
- '$normal' => t('Alphabetic'),
- '$reverse' => t('Reverse Alphabetic'),
- '$date' => t('Newest to Oldest'),
- '$reversedate' => t('Oldest to Newest'),
- '$sort' => t('Sort'),
- '$selected_sort' => $current_order,
- '$sorturl' => $sorturl,
'$forumsurl' => $forumsurl,
- '$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'','',' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
-
- '$pubforums' => array('pubforums', t('Public Forums Only'),(x($_REQUEST,'pubforums') ? $_REQUEST['pubforums'] : ''),'','',' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''),
- '$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'','',' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''),
+ '$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
+ '$pubforums' => array('pubforums', t('Public Forums Only'),$pubforums,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''),
+ '$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''),
));
return $o;
diff --git a/include/event.php b/include/event.php
index 0d8b2132b..659b7e6cc 100644
--- a/include/event.php
+++ b/include/event.php
@@ -90,6 +90,7 @@ function format_event_ical($ev) {
$o .= "\nLOCATION:" . format_ical_text($ev['location']);
if($ev['description'])
$o .= "\nDESCRIPTION:" . format_ical_text($ev['description']);
+ $o .= "\nUID:" . $ev['event_hash'] ;
$o .= "\nEND:VEVENT\n";
return $o;
@@ -100,7 +101,7 @@ function format_ical_text($s) {
require_once('include/bbcode.php');
require_once('include/html2plain.php');
- return(wordwrap(html2plain(bbcode($s)),72,"\n ",true));
+ return(wordwrap(str_replace(',','\\,',html2plain(bbcode($s))),72,"\n ",true));
}
@@ -208,6 +209,7 @@ function event_store_event($arr) {
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
$arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
+
// Existing event being modified
if($arr['id'] || $arr['event_hash']) {
@@ -275,7 +277,11 @@ function event_store_event($arr) {
// New event. Store it.
- $hash = random_string();
+
+ if(array_key_exists('external_id',$arr))
+ $hash = $arr['external_id'];
+ else
+ $hash = random_string();
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid)
@@ -364,6 +370,84 @@ function event_addtocal($item_id, $uid) {
}
+function parse_ical_file($f,$uid) {
+ require_once('library/ical.php');
+ $ical = new ICal($f);
+ if($ical) {
+ $events = $ical->events();
+ if($events) {
+ foreach($events as $ev) {
+ logger('event parsed: ' . print_r($ev,true), LOGGER_ALL);
+ event_import_ical($ev,$uid);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+
+
+function event_import_ical($ical, $uid) {
+
+ $c = q("select * from channel where channel_id = %d limit 1",
+ intval($uid)
+ );
+
+ if(! $c)
+ return false;
+
+ $channel = $c[0];
+ $ev = array();
+
+ if($ical['CREATED'])
+ $ev['created'] = datetime_convert('UTC','UTC',$ical['CREATED']);
+ if($ical['LAST-MODIFIED'])
+ $ev['edited'] = datetime_convert('UTC','UTC',$ical['LAST-MODIFIED']);
+ if($ical['LOCATION'])
+ $ev['location'] = $ical['LOCATION'];
+ if($ical['DESCRIPTION'])
+ $ev['description'] = $ical['DESCRIPTION'];
+ if($ical['SUMMARY'])
+ $ev['summary'] = $ical['SUMMARY'];
+ if($ical['DTEND'])
+ $ev['finish'] = datetime_convert('UTC','UTC', $ical['DTEND']);
+ else
+ $ev['nofinish'] = 1;
+ $ev['start'] = datetime_convert('UTC','UTC',$ical['DTSTART']);
+ if(substr($ical['DTSTART'],-1) === 'Z')
+ $ev['adjust'] = 1;
+
+ if($ical['UID']) {
+ $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1",
+ dbesc($ical['UID']),
+ intval($arr['uid'])
+ );
+ if($r)
+ $ev['event_hash'] = $ical['UID'];
+ else
+ $ev['external_id'] = $ical['UID'];
+ }
+
+ if($ical['SUMMARY'] && $ical['DTSTART']) {
+ $ev['event_xchan'] = $channel['channel_hash'];
+ $ev['uid'] = $channel['channel_id'];
+ $ev['account'] = $channel['channel_account_id'];
+ $ev['private'] = 1;
+
+ logger('storing event: ' . print_r($ev,true), LOGGER_ALL);
+ $event = event_store_event($ev);
+ if($event) {
+ $item_id = event_store_item($ev,$event);
+ return true;
+ }
+ }
+
+ return false;
+
+}
+
+
function event_store_item($arr, $event) {
require_once('include/datetime.php');
diff --git a/include/identity.php b/include/identity.php
index 8ba5d64db..804f316d1 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -583,9 +583,41 @@ function identity_basic_export($channel_id, $items = false) {
/** @warning this may run into memory limits on smaller systems */
- $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d",
- intval($channel_id)
+ /** export one year of posts. If you want to export and import all posts you have to start with
+ * the first year and export/import them in ascending order.
+ */
+
+ $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created > %s - INTERVAL %s",
+ intval($channel_id),
+ db_utcnow(),
+ db_quoteinterval('1 YEAR')
+ );
+ if($r) {
+ $ret['item'] = array();
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+ foreach($r as $rr)
+ $ret['item'][] = encode_item($rr,true);
+ }
+
+ return $ret;
+}
+
+
+function identity_export_year($channel_id,$year) {
+
+ if(! $year)
+ return array();
+
+ $ret = array();
+ $mindate = datetime_convert('UTC','UTC',$year . '-01-01 00:00:00');
+ $maxdate = datetime_convert('UTC','UTC',$year+1 . '-01-01 00:00:00');
+ $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s' ",
+ intval($channel_id),
+ dbesc($mindate),
+ dbesc($maxdate)
);
+
if($r) {
$ret['item'] = array();
xchan_query($r);
@@ -1360,10 +1392,10 @@ function get_theme_uid() {
* with the specified size.
*
* @param int $size
-* one of (175, 80, 48)
+* one of (300, 80, 48)
* @returns string
*/
-function get_default_profile_photo($size = 175) {
+function get_default_profile_photo($size = 300) {
$scheme = get_config('system','default_profile_photo');
if(! $scheme)
$scheme = 'rainbow_man';
diff --git a/include/items.php b/include/items.php
index c067d3c1e..5d85e875e 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1282,10 +1282,12 @@ function encode_item($item,$mirror = false) {
if($item['diaspora_meta']) {
$z = json_decode($item['diaspora_meta'],true);
if($z) {
- if(array_key_exists('iv',$z))
+ if(is_array($z) && array_key_exists('iv',$z))
$x['diaspora_signature'] = crypto_unencapsulate($z,$key);
else
$x['diaspora_signature'] = $z;
+ if(! is_array($z))
+ logger('encode_item: diaspora meta is not an array: ' . print_r($z,true));
}
}
logger('encode_item: ' . print_r($x,true), LOGGER_DATA);
@@ -2685,11 +2687,12 @@ function item_store_update($arr,$allow_exec = false) {
return $ret;
}
+ $r = q("delete from term where oid = %d and otype = %d",
+ intval($orig_post_id),
+ intval(TERM_OBJ_POST)
+ );
+
if(is_array($terms)) {
- $r = q("delete from term where oid = %d and otype = %d",
- intval($orig_post_id),
- intval(TERM_OBJ_POST)
- );
foreach($terms as $t) {
q("insert into term (uid,oid,otype,type,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
@@ -2701,7 +2704,6 @@ function item_store_update($arr,$allow_exec = false) {
dbesc($t['url'])
);
}
-
$arr['term'] = $terms;
}
@@ -3374,14 +3376,18 @@ function post_is_importable($item,$abook) {
if(! $item)
return false;
- if((! $abook['abook_incl']) && (! $abook['abook_excl']))
+ if(! ($abook['abook_incl'] || $abook['abook_excl']))
return true;
-
require_once('include/html2plain.php');
$text = prepare_text($item['body'],$item['mimetype']);
$text = html2plain($text);
+ $lang = null;
+
+ if((strpos($abook['abook_incl'],'lang=') !== false) || (strpos($abook['abook_excl'],'lang=') !== false)) {
+ $lang = detect_language($text);
+ }
$tags = ((count($item['term'])) ? $item['term'] : false);
// exclude always has priority
@@ -3398,6 +3404,8 @@ function post_is_importable($item,$abook) {
}
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return false;
+ elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
+ return false;
elseif(stristr($text,$word) !== false)
return false;
}
@@ -3415,6 +3423,8 @@ function post_is_importable($item,$abook) {
}
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return true;
+ elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
+ return true;
elseif(stristr($text,$word) !== false)
return true;
}
@@ -3755,6 +3765,10 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$author['owner_avatar'] = $contact['thumb'];
}
+ if(! is_importable($datarray,$contact))
+ continue;
+
+
logger('consume_feed: author ' . print_r($author,true),LOGGER_DEBUG);
logger('consume_feed: ' . print_r($datarray,true),LOGGER_DATA);
@@ -4389,7 +4403,6 @@ function first_post_date($uid,$wall = false) {
$r = q("select id, created from item
where uid = %d and id = parent $item_normal $wall_sql
order by created asc limit 1",
- intval(ITEM_VISIBLE),
intval($uid)
);
diff --git a/include/network.php b/include/network.php
index f331da488..5d01b7eba 100644
--- a/include/network.php
+++ b/include/network.php
@@ -531,7 +531,7 @@ function avatar_img($email) {
$avatar = array();
$a = get_app();
- $avatar['size'] = 175;
+ $avatar['size'] = 300;
$avatar['email'] = $email;
$avatar['url'] = '';
$avatar['success'] = false;
@@ -1135,9 +1135,27 @@ function discover_by_webbie($webbie) {
}
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
- dbesc($webbie)
+ dbesc($addr)
);
- if(! $r) {
+
+ /**
+ *
+ * Diaspora communications are notoriously unreliable and receiving profile update messages (indeed any messages)
+ * are pretty much random luck. We'll check the timestamp of the xchan_name_date at a higher level and refresh
+ * this record once a month; because if you miss a profile update message and they update their profile photo or name
+ * you're otherwise stuck with stale info until they change their profile again - which could be years from now.
+ *
+ */
+
+ if($r) {
+ $r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s' where xchan_hash = '%s' limit 1",
+ dbesc($vcard['fn']),
+ dbesc($network),
+ dbesc(datetime_convert()),
+ dbesc($addr)
+ );
+ }
+ else {
$r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_instance_url, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
dbesc($addr),
diff --git a/include/permissions.php b/include/permissions.php
index 59c6694d6..a8e761f87 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -25,9 +25,8 @@ function get_perms() {
// Read only permissions
'view_stream' => array('channel_r_stream', intval(PERMS_R_STREAM), true, t('Can view my normal stream and posts'), ''),
'view_profile' => array('channel_r_profile', intval(PERMS_R_PROFILE), true, t('Can view my default channel profile'), ''),
- 'view_photos' => array('channel_r_photos', intval(PERMS_R_PHOTOS), true, t('Can view my photo albums'), ''),
'view_contacts' => array('channel_r_abook', intval(PERMS_R_ABOOK), true, t('Can view my connections'), ''),
- 'view_storage' => array('channel_r_storage', intval(PERMS_R_STORAGE), true, t('Can view my file storage'), ''),
+ 'view_storage' => array('channel_r_storage', intval(PERMS_R_STORAGE), true, t('Can view my file storage and photos'), ''),
'view_pages' => array('channel_r_pages', intval(PERMS_R_PAGES), true, t('Can view my webpages'), ''),
// Write permissions
@@ -35,12 +34,11 @@ function get_perms() {
'post_wall' => array('channel_w_wall', intval(PERMS_W_WALL), false, t('Can post on my channel page ("wall")'), ''),
'post_comments' => array('channel_w_comment', intval(PERMS_W_COMMENT), false, t('Can comment on or like my posts'), ''),
'post_mail' => array('channel_w_mail', intval(PERMS_W_MAIL), false, t('Can send me private mail messages'), ''),
- 'post_photos' => array('channel_w_photos', intval(PERMS_W_PHOTOS), false, t('Can post photos to my photo albums'), ''),
'post_like' => array('channel_w_like', intval(PERMS_W_LIKE), false, t('Can like/dislike stuff'), t('Profiles and things other than posts/comments')),
'tag_deliver' => array('channel_w_tagwall', intval(PERMS_W_TAGWALL), false, t('Can forward to all my channel contacts via post @mentions'), t('Advanced - useful for creating group forum channels')),
'chat' => array('channel_w_chat', intval(PERMS_W_CHAT), false, t('Can chat with me (when available)'), t('')),
- 'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my file storage'), ''),
+ 'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my file storage and photos'), ''),
'write_pages' => array('channel_w_pages', intval(PERMS_W_PAGES), false, t('Can edit my webpages'), ''),
'republish' => array('channel_a_republish', intval(PERMS_A_REPUBLISH), false, t('Can source my public posts in derived channels'), t('Somewhat advanced - very useful in open communities')),
@@ -496,7 +494,6 @@ function site_default_perms() {
$typical = array(
'view_stream' => PERMS_PUBLIC,
'view_profile' => PERMS_PUBLIC,
- 'view_photos' => PERMS_PUBLIC,
'view_contacts' => PERMS_PUBLIC,
'view_storage' => PERMS_PUBLIC,
'view_pages' => PERMS_PUBLIC,
@@ -504,7 +501,6 @@ function site_default_perms() {
'post_wall' => PERMS_SPECIFIC,
'post_comments' => PERMS_SPECIFIC,
'post_mail' => PERMS_SPECIFIC,
- 'post_photos' => PERMS_SPECIFIC,
'tag_deliver' => PERMS_SPECIFIC,
'chat' => PERMS_SPECIFIC,
'write_storage' => PERMS_SPECIFIC,
@@ -554,22 +550,20 @@ function get_role_perms($role) {
$ret['default_collection'] = false;
$ret['directory_publish'] = true;
$ret['online'] = true;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -586,22 +580,20 @@ function get_role_perms($role) {
$ret['default_collection'] = true;
$ret['directory_publish'] = true;
$ret['online'] = true;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -618,22 +610,20 @@ function get_role_perms($role) {
$ret['default_collection'] = true;
$ret['directory_publish'] = false;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_SPECIFIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -650,22 +640,20 @@ function get_role_perms($role) {
$ret['default_collection'] = false;
$ret['directory_publish'] = true;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -682,22 +670,20 @@ function get_role_perms($role) {
$ret['default_collection'] = true;
$ret['directory_publish'] = true;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE|PERMS_W_TAGWALL;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -714,22 +700,20 @@ function get_role_perms($role) {
$ret['default_collection'] = true;
$ret['directory_publish'] = false;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILEPERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_SPECIFIC;
- $ret['channel_r_photos'] = PERMS_SPECIFIC;
$ret['channel_r_abook'] = PERMS_SPECIFIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_SPECIFIC;
@@ -746,22 +730,20 @@ function get_role_perms($role) {
$ret['default_collection'] = false;
$ret['directory_publish'] = true;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -778,22 +760,20 @@ function get_role_perms($role) {
$ret['default_collection'] = true;
$ret['directory_publish'] = false;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -810,20 +790,18 @@ function get_role_perms($role) {
$ret['default_collection'] = false;
$ret['directory_publish'] = true;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
@@ -840,22 +818,20 @@ function get_role_perms($role) {
$ret['default_collection'] = false;
$ret['directory_publish'] = true;
$ret['online'] = false;
- $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_W_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
- $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
+ $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
|PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_W_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
- $ret['channel_r_photos'] = PERMS_PUBLIC;
$ret['channel_r_abook'] = PERMS_PUBLIC;
$ret['channel_w_stream'] = PERMS_SPECIFIC;
$ret['channel_w_wall'] = PERMS_SPECIFIC;
$ret['channel_w_tagwall'] = PERMS_SPECIFIC;
$ret['channel_w_comment'] = PERMS_SPECIFIC;
$ret['channel_w_mail'] = PERMS_SPECIFIC;
- $ret['channel_w_photos'] = PERMS_SPECIFIC;
$ret['channel_w_chat'] = PERMS_SPECIFIC;
$ret['channel_a_delegate'] = PERMS_SPECIFIC;
$ret['channel_r_storage'] = PERMS_PUBLIC;
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 1501e6712..426eb6aac 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -605,16 +605,16 @@ function import_profile_photo($photo,$xchan,$thing = false) {
if(($width / $height) > 1.2) {
// crop out the sides
$margin = $width - $height;
- $img->cropImage(175,($margin / 2),0,$height,$height);
+ $img->cropImage(300,($margin / 2),0,$height,$height);
}
elseif(($height / $width) > 1.2) {
// crop out the bottom
$margin = $height - $width;
- $img->cropImage(175,0,0,$width,$width);
+ $img->cropImage(300,0,0,$width,$width);
}
else {
- $img->scaleImageSquare(175);
+ $img->scaleImageSquare(300);
}
}
@@ -681,7 +681,7 @@ function import_channel_photo($photo,$type,$aid,$uid) {
$img = photo_factory($photo, $type);
if($img->is_valid()) {
- $img->scaleImageSquare(175);
+ $img->scaleImageSquare(300);
$p = array('aid' => $aid, 'uid' => $uid, 'resource_id' => $hash, 'filename' => $filename, 'album' => t('Profile Photos'), 'photo_usage' => PHOTO_PROFILE, 'scale' => 4);
diff --git a/include/photos.php b/include/photos.php
index 867571f8f..c5ea3971a 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -22,7 +22,7 @@ function photo_upload($channel, $observer, $args) {
$channel_id = $channel['channel_id'];
$account_id = $channel['channel_account_id'];
- if(! perm_is_allowed($channel_id, $observer['xchan_hash'], 'post_photos')) {
+ if(! perm_is_allowed($channel_id, $observer['xchan_hash'], 'write_storage')) {
$ret['message'] = t('Permission denied.');
return $ret;
}
@@ -313,7 +313,7 @@ function photo_upload($channel, $observer, $args) {
*
* @param array $channel
* @param array $observer
- * @return bool|array false if no view_photos permission or an array
+ * @return bool|array false if no view_storage permission or an array
* * success (bool)
* * albums (array)
*/
@@ -322,7 +322,7 @@ function photos_albums_list($channel, $observer) {
$channel_id = $channel['channel_id'];
$observer_xchan = (($observer) ? $observer['xchan_hash'] : '');
- if(! perm_is_allowed($channel_id, $observer_xchan, 'view_photos'))
+ if(! perm_is_allowed($channel_id, $observer_xchan, 'view_storage'))
return false;
/** @FIXME create a permissions SQL which works on arbitrary observers and channels, regardless of login or web status */
@@ -378,7 +378,7 @@ function photos_album_widget($channelx,$observer,$albums = null) {
'$title' => t('Photo Albums'),
'$albums' => $albums['albums'],
'$baseurl' => z_root(),
- '$upload' => ((perm_is_allowed($channelx['channel_id'],(($observer) ? $observer['xchan_hash'] : ''),'post_photos'))
+ '$upload' => ((perm_is_allowed($channelx['channel_id'],(($observer) ? $observer['xchan_hash'] : ''),'write_storage'))
? t('Upload New Photos') : '')
));
}
@@ -399,7 +399,7 @@ function photos_list_photos($channel, $observer, $album = '') {
$channel_id = $channel['channel_id'];
$observer_xchan = (($observer) ? $observer['xchan_hash'] : '');
- if(! perm_is_allowed($channel_id,$observer_xchan,'view_photos'))
+ if(! perm_is_allowed($channel_id,$observer_xchan,'view_storage'))
return false;
$sql_extra = permissions_sql($channel_id);
diff --git a/include/security.php b/include/security.php
index e1f6cd556..7cc93fc06 100644
--- a/include/security.php
+++ b/include/security.php
@@ -418,6 +418,9 @@ function stream_perms_api_uids($perms = NULL, $limit = 0, $rand = 0 ) {
$str .= intval($rr);
}
}
+ else
+ $str = "''";
+
logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG);
return $str;
@@ -448,6 +451,9 @@ function stream_perms_xchans($perms = NULL ) {
$str .= "'" . dbesc($rr) . "'";
}
}
+ else
+ $str = "''";
+
logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG);
return $str;
diff --git a/include/taxonomy.php b/include/taxonomy.php
index ea41369ad..b57cfc5c4 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -101,7 +101,7 @@ function format_term_for_display($term) {
// Tag cloud functions - need to be adpated to this database format
-function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $type = TERM_HASHTAG) {
+function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $restrict = 0, $type = TERM_HASHTAG) {
require_once('include/security.php');
@@ -124,6 +124,11 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
$sql_options .= " and author_xchan in (" . implode(',',$authors) . ") ";
}
+ if($owner) {
+ $sql_options .= " and owner_xchan = '" . dbesc($owner) . "' ";
+ }
+
+
// Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
where term.uid = %d and term.type = %d
@@ -215,10 +220,10 @@ function dir_tagadelic($count = 0) {
}
-function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
+function tagblock($link,$uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
$o = '';
- $r = tagadelic($uid,$count,$authors,$flags,$restrict,$type);
+ $r = tagadelic($uid,$count,$authors,$owner, $flags,$restrict,$type);
if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
@@ -232,10 +237,10 @@ function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$
}
-function wtagblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
+function wtagblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
$o = '';
- $r = tagadelic($uid,$count,$authors,$flags,$restrict,$type);
+ $r = tagadelic($uid,$count,$authors,$owner, $flags,$restrict,$type);
if($r) {
$c = q("select channel_address from channel where channel_id = %d limit 1",
@@ -253,10 +258,10 @@ function wtagblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type
}
-function catblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
+function catblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
$o = '';
- $r = tagadelic($uid,$count,$authors,$flags,$restrict,$type);
+ $r = tagadelic($uid,$count,$authors,$owner,$flags,$restrict,$type);
if($r) {
$c = q("select channel_address from channel where channel_id = %d limit 1",
@@ -278,7 +283,7 @@ function dir_tagblock($link,$r) {
$o = '';
$observer = get_observer_hash();
- if(! get_globaldir_setting($observer))
+ if(! get_directory_setting($observer, 'globaldir'))
return $o;
@@ -409,4 +414,4 @@ function get_things($profile_hash,$uid) {
//logger('things: ' . print_r($sorted_things,true));
return $sorted_things;
-} \ No newline at end of file
+}
diff --git a/include/text.php b/include/text.php
index be465d0f4..cc084f6f1 100644
--- a/include/text.php
+++ b/include/text.php
@@ -807,7 +807,7 @@ function contact_block() {
$shown = get_pconfig($a->profile['uid'],'system','display_friend_count');
if($shown === false)
- $shown = 24;
+ $shown = 25;
if($shown == 0)
return;
@@ -1448,7 +1448,7 @@ function prepare_body(&$item,$attach = false) {
// else {
call_hooks('prepare_body_init', $item);
// unobscure($item);
- $s = prepare_text($item['body'],$item['mimetype'], true);
+ $s = prepare_text($item['body'],$item['mimetype'], false);
// }
$prep_arr = array('item' => $item, 'html' => $s);
diff --git a/include/widgets.php b/include/widgets.php
index 2b5a2076f..36671e719 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -29,7 +29,7 @@ function widget_tagcloud($args) {
$type = TERM_CATEGORY;
// FIXME there exists no $authors variable
- $r = tagadelic($uid, $count, $authors, $flags, ITEM_TYPE_WEBPAGE, $type);
+ $r = tagadelic($uid, $count, $authors, $owner, $flags, ITEM_TYPE_WEBPAGE, $type);
if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
@@ -132,7 +132,7 @@ function widget_suggestions($arr) {
'profile' => $rr['xchan_url'],
'name' => $rr['xchan_name'],
'photo' => $rr['xchan_photo_m'],
- 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'],
+ 'ignlnk' => z_root() . '/directory?ignore=' . $rr['xchan_hash'],
'conntxt' => t('Connect'),
'connlnk' => $connlnk,
'ignore' => t('Ignore/Hide')
@@ -380,6 +380,7 @@ function widget_categories($arr) {
$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
return categories_widget($srchurl, $cat);
+
}
function widget_tagcloud_wall($arr) {
@@ -392,7 +393,7 @@ function widget_tagcloud_wall($arr) {
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
if(feature_enabled($a->profile['profile_uid'], 'tagadelic'))
- return wtagblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], 'wall');
+ return wtagblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
return '';
}
@@ -407,7 +408,7 @@ function widget_catcloud_wall($arr) {
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
- return catblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], 'wall');
+ return catblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
}
@@ -604,7 +605,7 @@ function widget_photo_albums($arr) {
if(! $a->profile['profile_uid'])
return '';
$channelx = channelx_by_n($a->profile['profile_uid']);
- if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_photos')))
+ if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_storage')))
return '';
require_once('include/photos.php');
@@ -903,7 +904,7 @@ function widget_random_block($arr) {
item_type = %d $sql_options order by $randfunc limit 1",
intval($channel_id),
dbesc('%' . $contains . '%'),
- intval(ITEM_TYPE_BUILDBLOCK)
+ intval(ITEM_TYPE_BLOCK)
);
if($r) {
diff --git a/include/zot.php b/include/zot.php
index 4ac346002..0cb3ab9ed 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -566,7 +566,7 @@ function zot_gethub($arr) {
}
/**
- * @brief Registers an unknown hup.
+ * @brief Registers an unknown hub.
*
* A communication has been received which has an unknown (to us) sender.
* Perform discovery based on our calculated hash of the sender at the
@@ -1088,11 +1088,19 @@ function zot_import($arr, $sender_url) {
logger('specific recipients');
$recip_arr = array();
foreach($i['notify']['recipients'] as $recip) {
- $recip_arr[] = make_xchan_hash($recip['guid'],$recip['guid_sig']);
+ if(is_array($recip)) {
+ $recip_arr[] = make_xchan_hash($recip['guid'],$recip['guid_sig']);
+ }
+ }
+
+ $r = false;
+ if($recip_arr) {
+ stringify_array_elms($recip_arr);
+ $recips = implode(',',$recip_arr);
+ $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " )
+ and channel_removed = 0 ");
}
- stringify_array_elms($recip_arr);
- $recips = implode(',',$recip_arr);
- $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and channel_removed = 0 ");
+
if(! $r) {
logger('recips: no recipients on this site');
continue;
@@ -1248,7 +1256,8 @@ function public_recips($msg) {
$include_sys = false;
if($msg['message']['type'] === 'activity') {
- $include_sys = true;
+ if(! get_config('system','disable_discover_tab'))
+ $include_sys = true;
$col = 'channel_w_stream';
$field = PERMS_W_STREAM;
if(array_key_exists('flags',$msg['message']) && in_array('thread_parent', $msg['message']['flags'])) {
@@ -2852,6 +2861,11 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) {
+ if(array_key_exists('channel_page_flags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) {
+ $arr['channel']['channel_removed'] = (($arr['channel']['channel_pageflags'] & 0x8000) ? 1 : 0);
+ $arr['channel']['channel_system'] = (($arr['channel']['channel_pageflags'] & 0x1000) ? 1 : 0);
+ }
+
$disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags');
$clean = array();
@@ -2883,28 +2897,20 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
$total_feeds ++;
}
- $disallowed = array('abook_id','abook_account','abook_channel');
+ $disallowed = array('abook_id','abook_account','abook_channel','abook_rating','abook_rating_text');
foreach($arr['abook'] as $abook) {
if(! array_key_exists('abook_blocked',$abook)) {
// convert from redmatrix
- if($abook['abook_flags'] & 0x0001)
- $abook['abook_blocked'] = 1;
- if($abook['abook_flags'] & 0x0002)
- $abook['abook_ignored'] = 1;
- if($abook['abook_flags'] & 0x0004)
- $abook['abook_hidden'] = 1;
- if($abook['abook_flags'] & 0x0008)
- $abook['abook_archived'] = 1;
- if($abook['abook_flags'] & 0x0010)
- $abook['abook_pending'] = 1;
- if($abook['abook_flags'] & 0x0020)
- $abook['abook_unconnected'] = 1;
- if($abook['abook_flags'] & 0x0080)
- $abook['abook_self'] = 1;
- if($abook['abook_flags'] & 0x0100)
- $abook['abook_feed'] = 1;
+ $abook['abook_blocked'] = (($abook['abook_flags'] & 0x0001) ? 1 : 0);
+ $abook['abook_ignored'] = (($abook['abook_flags'] & 0x0002) ? 1 : 0);
+ $abook['abook_hidden'] = (($abook['abook_flags'] & 0x0004) ? 1 : 0);
+ $abook['abook_archived'] = (($abook['abook_flags'] & 0x0008) ? 1 : 0);
+ $abook['abook_pending'] = (($abook['abook_flags'] & 0x0010) ? 1 : 0);
+ $abook['abook_unconnected'] = (($abook['abook_flags'] & 0x0020) ? 1 : 0);
+ $abook['abook_self'] = (($abook['abook_flags'] & 0x0080) ? 1 : 0);
+ $abook['abook_feed'] = (($abook['abook_flags'] & 0x0100) ? 1 : 0);
}
$clean = array();
@@ -3165,7 +3171,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
}
if(count($clean)) {
foreach($clean as $k => $v) {
- $r = dbq("UPDATE profile set " . dbesc($k) . " = '" . dbesc($v)
+ $r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v)
. "' where profile_guid = '" . dbesc($profile['profile_guid']) . "' and uid = " . intval($channel['channel_id']));
}
}