From 34fd387438f5f3d06b0a1c26d5c7ca5c1f5bd270 Mon Sep 17 00:00:00 2001 From: marijus Date: Mon, 10 Mar 2014 17:17:49 +0100 Subject: this commit is an attempt to make conv items better scalable on smaller screens. also save some horizontal space. --- include/bbcode.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 8bbf7ae01..cd0bf527e 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -46,7 +46,7 @@ function tryzrlvideo($match) { } if($zrl) $link = zid($link); - return ''; + return ''; } @@ -620,24 +620,24 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // [img=widthxheight]pathtoimage[/img] if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); + $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); } if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); + $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); } // [img=widthxheight float={left, right}]pathtoimage[/img] if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); + $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); } if (strpos($Text,'[/img]') !== false) { - $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); + $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); } if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); + $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=left\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); } if (strpos($Text,'[/zmg]') !== false) { - $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); + $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*) float=right\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); } // style (sanitized) -- cgit v1.2.3 From 55fe471ce889cd377a54d9b219e9c8c0bff10bfb Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Mar 2014 15:29:26 -0700 Subject: version update --- include/event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/event.php b/include/event.php index 08b94dafa..8e6a3fe71 100644 --- a/include/event.php +++ b/include/event.php @@ -8,7 +8,7 @@ function format_event_html($ev) { if(! ((is_array($ev)) && count($ev))) return ''; - $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM + $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8:01 AM $o = '
' . "\r\n"; -- cgit v1.2.3 From 5e41ef921999e1dc4d29101d4d764db967e257ee Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Mar 2014 17:41:56 -0700 Subject: protect filed conversations from expiration - we check the parent to see if it is filed, but one may have filed a comment and that will vanish when the parent expires unless the parent is protected. --- include/expire.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/expire.php b/include/expire.php index f1002b890..2d94d64c0 100644 --- a/include/expire.php +++ b/include/expire.php @@ -9,7 +9,7 @@ function expire_run($argv, $argc){ // physically remove anything that has been deleted for more than two months - $r = q("delete from item where item_flags & %d and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY", + $r = q("delete from item where ( item_flags & %d ) and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY", intval(ITEM_DELETED) ); -- cgit v1.2.3 From 3f337dad2c783e62338a88887d1ef3d7754da410 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Mar 2014 21:45:20 -0700 Subject: file had wrong extension --- include/config.php | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include') diff --git a/include/config.php b/include/config.php index 8d98d56fa..add7b5f71 100644 --- a/include/config.php +++ b/include/config.php @@ -25,14 +25,6 @@ function load_config($family) { $r = q("SELECT * FROM config WHERE cat = '%s'", dbesc($family)); - // This is often one of the earliest database calls in the life of the page. - // If the DB was successfully opened, but we can't read from it, - // we must assume catastrophic failure of the DB. Report the system down. - -// if($r === false) { -// system_unavailable(); -// } - if($r !== false) { if($r) { foreach($r as $rr) { @@ -285,7 +277,6 @@ function load_xconfig($xchan,$family = '') { $a->config[$xchan][$c][$k] = $rr['v']; } } - } -- cgit v1.2.3 From 3cb179aff19d803b91261e410c50b36e4bae1246 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 13 Mar 2014 17:13:36 -0700 Subject: contact_block() not being shown to unauthenticated visitors - even if perms allow. Also separate the permissions logic for this function so that we can have a mini-profile widget and a separate contact_block widget instead of always lumping them together. We probably also should move contact_block() outside of include/text.php as it doesn't really belong there. Just not sure where it belongs - perhaps contact_widgets wouold be a good place. --- include/identity.php | 5 +---- include/text.php | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index ed6920e67..efc0d7d87 100644 --- a/include/identity.php +++ b/include/identity.php @@ -711,10 +711,7 @@ logger('online: ' . $profile['online']); ? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name']); $lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname)))); - if(is_array($observer) - && perm_is_allowed($profile['uid'],$observer['xchan_hash'],'view_contacts')) { - $contact_block = contact_block(); - } + $contact_block = contact_block(); $channel_menu = false; $menu = get_pconfig($profile['uid'],'system','channel_menu'); diff --git a/include/text.php b/include/text.php index 839e63f5e..53b92c05f 100755 --- a/include/text.php +++ b/include/text.php @@ -656,6 +656,12 @@ function contact_block() { $o = ''; $a = get_app(); + if(! $a->profile['uid']) + return; + + if(! perm_is_allowed($a->profile['uid'],get_observer_hash(),'view_contacts')) + return; + $shown = get_pconfig($a->profile['uid'],'system','display_friend_count'); if($shown === false) -- cgit v1.2.3 From f0736fc955e69d4650f95dc937f26be222967199 Mon Sep 17 00:00:00 2001 From: Christian Vogeley Date: Sat, 15 Mar 2014 21:52:20 +0100 Subject: API: statusnet_html:trim was trimming too much --- include/api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/api.php b/include/api.php index 47c78113a..f39039332 100644 --- a/include/api.php +++ b/include/api.php @@ -1552,7 +1552,8 @@ require_once('include/items.php'); 'geo' => '', 'favorited' => (($item['item_flags'] & ITEM_STARRED) ? true : false), 'user' => $status_user , - 'statusnet_html' => trim(prepare_text($item['body']),$item['mimetype']), + //'statusnet_html' => trim(prepare_text($item['body']),$item['mimetype']), + 'statusnet_html' => trim(prepare_text($item['body'])), 'statusnet_conversation_id' => $item['parent'], ); -- cgit v1.2.3 From 6f9fde997bd0d6c59045220a1afc2060b857c83a Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Mar 2014 15:20:04 -0700 Subject: this is the correct fix --- include/api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/api.php b/include/api.php index f39039332..dd6733fe0 100644 --- a/include/api.php +++ b/include/api.php @@ -1552,8 +1552,8 @@ require_once('include/items.php'); 'geo' => '', 'favorited' => (($item['item_flags'] & ITEM_STARRED) ? true : false), 'user' => $status_user , - //'statusnet_html' => trim(prepare_text($item['body']),$item['mimetype']), - 'statusnet_html' => trim(prepare_text($item['body'])), + 'statusnet_html' => trim(prepare_text($item['body'],$item['mimetype'])), + 'statusnet_conversation_id' => $item['parent'], ); -- cgit v1.2.3 From ecb2e52a7411a8a39b8030964604f0f28f2facce Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Mar 2014 20:34:21 -0700 Subject: little fixes of hopefully nil significance --- include/api.php | 14 ++++---------- include/bbcode.php | 9 ++++++--- include/oembed.php | 2 +- include/reddav.php | 4 ++-- include/text.php | 5 +++++ 5 files changed, 18 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/api.php b/include/api.php index dd6733fe0..57551a3b0 100644 --- a/include/api.php +++ b/include/api.php @@ -533,12 +533,6 @@ require_once('include/items.php'); api_register_func('api/red/channel/export/basic','api_export_basic', true); - - - - - - function api_channel_stream(&$a, $type) { if(api_user() === false) { logger('api_channel_stream: no user'); @@ -700,12 +694,12 @@ require_once('include/items.php'); function red_item_new(&$a, $type) { if (api_user() === false) { - logger('api_statuses_update: no user'); + logger('api_red_item_new: no user'); return false; } - logger('api_statuses_update: REQUEST ' . print_r($_REQUEST,true)); - logger('api_statuses_update: FILES ' . print_r($_FILES,true)); + logger('api_red_item_new: REQUEST ' . print_r($_REQUEST,true)); + logger('api_red_item_new: FILES ' . print_r($_FILES,true)); // set this so that the item_post() function is quiet and doesn't redirect or emit json @@ -1698,7 +1692,7 @@ require_once('include/items.php'); 'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false', 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, 'shorturllength' => '30', - 'friendica' => array( + 'redmatrix' => array( 'RED_PLATFORM' => RED_PLATFORM, 'RED_VERSION' => RED_VERSION, 'ZOT_REVISION' => ZOT_REVISION, diff --git a/include/bbcode.php b/include/bbcode.php index cd0bf527e..c8d1ab425 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -229,9 +229,12 @@ function bb_location($match) { function bbiframe($match) { $a = get_app(); - if(strpos($match[1],get_app()->get_hostname())) - return '' . $match[1] . ''; - return ''; + + // use sandbox mode to prevent malicious goings on rather than host restriction + // if(strpos($match[1],get_app()->get_hostname())) + // return '' . $match[1] . ''; + + return ''; } function bb_ShareAttributesSimple($match) { diff --git a/include/oembed.php b/include/oembed.php index 57631b051..46b1d72c4 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -165,7 +165,7 @@ function oembed_iframe($src,$width,$height) { $a = get_app(); $s = $a->get_baseurl()."/oembed/".base64url_encode($src); - return ''; + return ''; } diff --git a/include/reddav.php b/include/reddav.php index 2a26ac42a..a39a84e21 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -708,7 +708,7 @@ function RedFileData($file, &$auth,$test = false) { $r = q("select id, uid, hash, filename, filetype, filesize, revision, folder, flags, created, edited from attach where folder = '%s' and filename = '%s' and uid = %d $perms group by filename limit 1", dbesc($folder), - basename($file), + dbesc(basename($file)), intval($channel_id) ); @@ -719,7 +719,7 @@ function RedFileData($file, &$auth,$test = false) { $r = q("select id, uid, hash, filename, filetype, filesize, revision, folder, flags, created, edited from attach where folder = '%s' and filename = '%s' and uid = %d group by filename limit 1", dbesc($folder), - basename($file), + dbesc(basename($file)), intval($channel_id) ); if($r) diff --git a/include/text.php b/include/text.php index 53b92c05f..e3b1f1c4e 100755 --- a/include/text.php +++ b/include/text.php @@ -278,6 +278,11 @@ function hex2bin($s) { if(! (is_string($s) && strlen($s))) return ''; + if(strlen($s) & 1) { + logger('hex2bin: illegal hex string: ' . $s); + return $s; + } + if(! ctype_xdigit($s)) { return($s); } -- cgit v1.2.3 From e57bf86a276cbacac0e112b794c85202cbca7dcf Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Mar 2014 20:49:29 -0700 Subject: mail notification goes to old link --- include/enotify.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index 036d5275e..5a55aee09 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -88,7 +88,7 @@ function notification($params) { $sitelink = t('Please visit %s to view and/or reply to your private messages.'); $tsitelink = sprintf( $sitelink, $siteurl . '/mail/' . $params['item']['id'] ); $hsitelink = sprintf( $sitelink, '' . $sitename . ''); - $itemlink = $siteurl . '/message/' . $params['item']['id']; + $itemlink = $siteurl . '/mail/' . $params['item']['id']; } if($params['type'] == NOTIFY_COMMENT) { -- cgit v1.2.3 From e7981c8a0348a3d28e0fecfca536ca6f5a8c88d4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Mar 2014 21:34:51 -0700 Subject: remove mysql dependencies from cache api --- include/cache.php | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/include/cache.php b/include/cache.php index b546cd0e9..a70650b5e 100644 --- a/include/cache.php +++ b/include/cache.php @@ -6,52 +6,37 @@ class Cache { public static function get($key){ - $r = q("SELECT `v` FROM `cache` WHERE `k`='%s' limit 1", + $r = q("SELECT v FROM cache WHERE k = '%s' limit 1", dbesc($key) ); - if (count($r)) return $r[0]['v']; + if ($r) + return $r[0]['v']; return null; } public static function set($key,$value) { - q("REPLACE INTO `cache` (`k`,`v`,`updated`) VALUES ('%s','%s','%s')", + $r = q("SELECT * FROM cache WHERE k = '%s' limit 1", + dbesc($key) + ); + if($r) { + q("UPDATE cache SET v = '%s', updated = '%s' WHERE k = '%s' limit 1", + dbesc($value), + dbesc(datetime_convert()), + dbesc($key)); + } + else { + q("INSERT INTO cache ( k, v, updated) VALUES ('%s','%s','%s')", dbesc($key), dbesc($value), dbesc(datetime_convert())); + } } -/* - * - * Leaving this legacy code temporaily to see how REPLACE fares - * as opposed to non-atomic checks when faced with fast moving key duplication. - * As a MySQL extension it isn't portable, but we're not yet very portable. - */ - -/* - * $r = q("SELECT * FROM `cache` WHERE `k`='%s' limit 1", - * dbesc($key) - * ); - * if(count($r)) { - * q("UPDATE `cache` SET `v` = '%s', `updated = '%s' WHERE `k` = '%s' limit 1", - * dbesc($value), - * dbesc(datetime_convert()), - * dbesc($key)); - * } - * else { - * q("INSERT INTO `cache` (`k`,`v`,`updated`) VALUES ('%s','%s','%s')", - * dbesc($key), - * dbesc($value), - * dbesc(datetime_convert())); - * } - * } - */ - - public static function clear(){ - q("DELETE FROM `cache` WHERE `updated` < '%s'", + q("DELETE FROM cache WHERE updated < '%s'", dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); } -- cgit v1.2.3 From aa07edbdd107b512caf5a83d863c9d79a6e46694 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 17 Mar 2014 18:44:01 -0700 Subject: sprintf error --- include/reddav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/reddav.php b/include/reddav.php index a39a84e21..d6c3d126b 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -276,7 +276,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { for($x = 1; $x < count($path_arr); $x ++) { - $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and (flags & %d)", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d)", dbesc($folder), dbesc($path_arr[$x]), intval($channel_id), -- cgit v1.2.3 From 1446cc80960d278d26a2c2a0a529728beed10215 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 18 Mar 2014 02:41:58 +0000 Subject: Missed one --- include/reddav.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/reddav.php b/include/reddav.php index d6c3d126b..c65cb569b 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -276,7 +276,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { for($x = 1; $x < count($path_arr); $x ++) { - $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d)", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = '%d' and (flags & %d)", dbesc($folder), dbesc($path_arr[$x]), intval($channel_id), @@ -581,9 +581,10 @@ function RedCollectionData($file,&$auth) { for($x = 1; $x < count($path_arr); $x ++) { - $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and (flags & %d) $perms limit 1", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d) $perms limit 1", dbesc($folder), dbesc($path_arr[$x]), + intval($channel_id), intval(ATTACH_FLAG_DIR) ); if(! $r) { -- cgit v1.2.3 From c8fb979ed86403bc38baaf92c90f299434b25fdf Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 18 Mar 2014 02:43:36 +0000 Subject: oops --- include/reddav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/reddav.php b/include/reddav.php index c65cb569b..1047bdc9e 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -276,7 +276,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { for($x = 1; $x < count($path_arr); $x ++) { - $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = '%d' and (flags & %d)", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d)", dbesc($folder), dbesc($path_arr[$x]), intval($channel_id), -- cgit v1.2.3 From 8c177fbc4b20c297afbd7035dbb5e59d94fb4020 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Mar 2014 16:50:46 -0700 Subject: cleanup --- include/items.php | 28 +++++++++++++++------------- include/reddav.php | 3 ++- include/zot.php | 31 +++++++++++++++++++------------ 3 files changed, 36 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 70e098415..6788ac3da 100755 --- a/include/items.php +++ b/include/items.php @@ -3931,23 +3931,25 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C if(isset($arr['start']) && isset($arr['records'])) $pager_sql = sprintf(" LIMIT %d, %d ",intval($arr['start']), intval($arr['records'])); - if(($arr['cmin'] != 0) || ($arr['cmax'] != 99)) { + if(array_key_exists('cmin',$arr) || array_key_exists('cmax',$arr)) { + if(($arr['cmin'] != 0) || ($arr['cmax'] != 99)) { - // Not everybody who shows up in the network stream will be in your address book. - // By default those that aren't are assumed to have closeness = 99; but this isn't - // recorded anywhere. So if cmax is 99, we'll open the search up to anybody in - // the stream with a NULL address book entry. + // Not everybody who shows up in the network stream will be in your address book. + // By default those that aren't are assumed to have closeness = 99; but this isn't + // recorded anywhere. So if cmax is 99, we'll open the search up to anybody in + // the stream with a NULL address book entry. - $sql_nets .= " AND "; + $sql_nets .= " AND "; - if($arr['cmax'] == 99) - $sql_nets .= " ( "; + if($arr['cmax'] == 99) + $sql_nets .= " ( "; - $sql_nets .= "( abook.abook_closeness >= " . intval($arr['cmin']) . " "; - $sql_nets .= " AND abook.abook_closeness <= " . intval($arr['cmax']) . " ) "; - if($cmax == 99) - $sql_nets .= " OR abook.abook_closeness IS NULL ) "; - } + $sql_nets .= "( abook.abook_closeness >= " . intval($arr['cmin']) . " "; + $sql_nets .= " AND abook.abook_closeness <= " . intval($arr['cmax']) . " ) "; + if($cmax == 99) + $sql_nets .= " OR abook.abook_closeness IS NULL ) "; + } + } $simple_update = (($client_mode & CLIENT_MODE_UPDATE) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) " : ''); if($client_mode & CLIENT_MODE_LOAD) diff --git a/include/reddav.php b/include/reddav.php index 1047bdc9e..b7bb94fa0 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -590,9 +590,10 @@ function RedCollectionData($file,&$auth) { if(! $r) { // path wasn't found. Try without permissions to see if it was the result of permissions. $errors = true; - $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and (flags & %d) limit 1", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d) limit 1", dbesc($folder), basename($path_arr[$x]), + intval($channel_id), intval(ATTACH_FLAG_DIR) ); if($r) { diff --git a/include/zot.php b/include/zot.php index 934348d2d..d4d77157a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -872,21 +872,28 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { } // get rid of any hubs we have for this channel which weren't reported. + // This was needed at one time to resolve complicated cross-site inconsistencies, but can cause sync conflict. + // currently disabled. + +// if($xisting) { +// foreach($xisting as $x) { +// if(! array_key_exists('updated',$x)) { +// logger('import_xchan: removing unreferenced hub location ' . $x['hubloc_url']); +// $r = q("delete from hubloc where hubloc_id = %d limit 1", +// intval($x['hubloc_id']) +// ); +// $what .= 'removed_hub'; +// $changed = true; +// } +// } +// } - if($xisting) { - foreach($xisting as $x) { - if(! array_key_exists('updated',$x)) { - logger('import_xchan: removing unreferenced hub location ' . $x['hubloc_url']); - $r = q("delete from hubloc where hubloc_id = %d limit 1", - intval($x['hubloc_id']) - ); - $what .= 'removed_hub'; - $changed = true; - } - } - } } + + + + // Are we a directory server of some kind? if($dirmode != DIRECTORY_MODE_NORMAL) { -- cgit v1.2.3 From 68fc2a220e81589d86af0233b533b6b713545a24 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Mar 2014 19:53:14 -0700 Subject: prune_hub_reinstalls() and add cron weekly as a side effect --- include/hubloc.php | 32 ++++++++++++++++++++++++++++++++ include/poller.php | 17 +++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 include/hubloc.php (limited to 'include') diff --git a/include/hubloc.php b/include/hubloc.php new file mode 100644 index 000000000..b6f0c8c57 --- /dev/null +++ b/include/hubloc.php @@ -0,0 +1,32 @@ + 1) { + + $d1 = datetime_convert('UTC','UTC',$x[0]['c']); + $d2 = datetime_convert('UTC','UTC','now - 3 days'); + + // allow some slop period, say 3 days - just in case this is a glitch or transient occurrence + + if($d1 < $d2) { + logger('prune_hub_reinstalls: removing dead hublocs at ' . $rr['site_url']); + $y = q("delete from hubloc where hubloc_sitekey = '%s'", + dbesc($x[0]['hubloc_sitekey']) + ); + } + } + } + } +} \ No newline at end of file diff --git a/include/poller.php b/include/poller.php index 423ee46c1..bae39dd2e 100644 --- a/include/poller.php +++ b/include/poller.php @@ -105,6 +105,23 @@ function poller_run($argv, $argc){ if($d2 != intval($d1)) { + $d3 = intval(datetime_convert('UTC','UTC','now','N')); + if($d3 == 7) { + + /** + * Cron Weekly + * + * Actions in the following block are executed once per day only on Sunday (once per week). + * + */ + + require_once('include/hubloc.php'); + prune_hub_reinstalls(); + + + } + + // expire any read notifications over a month old q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); -- cgit v1.2.3 From fa5ac2682879bd98362fba5317cf75ae1e8abff1 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Mar 2014 19:56:21 -0700 Subject: doco --- include/hubloc.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/hubloc.php b/include/hubloc.php index b6f0c8c57..35d9dbeb1 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -19,6 +19,7 @@ function prune_hub_reinstalls() { $d2 = datetime_convert('UTC','UTC','now - 3 days'); // allow some slop period, say 3 days - just in case this is a glitch or transient occurrence + // Then remove any hublocs pointing to the oldest entry. if($d1 < $d2) { logger('prune_hub_reinstalls: removing dead hublocs at ' . $rr['site_url']); -- cgit v1.2.3 From 1156b141db8939474ce3a318276af271e34b8ff5 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 20 Mar 2014 16:45:19 -0700 Subject: increase log info to track down source of ownership failures --- include/zot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index d4d77157a..c8e95f993 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1360,7 +1360,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) { // We've validated the sender. Now make sure that the sender is the owner or author if($sender['hash'] != $arr['owner_xchan'] && $sender['hash'] != $arr['author_xchan']) { - logger('process_delivery: sender is not owner or author'); + logger("process_delivery: sender {$sender['hash']} is not owner {$arr['owner_xchan']} or author {$arr['author_xchan']} - mid {$arr['mid']}"); return; } -- cgit v1.2.3 From 6d37e41fc3b716d86e90fd5a6bc0d9b89cb1d71b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 20 Mar 2014 22:08:16 -0700 Subject: found what I believe is the root cause of issue #230, but don't yet have a workable solution. This one is hard. --- include/zot.php | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index c8e95f993..35b322b54 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1578,7 +1578,16 @@ function delete_imported_item($sender,$item,$uid) { } require_once('include/items.php'); - drop_item($r[0]['id'],false); + + // FIXME issue #230 is related + // Chicken/egg problem because we have to drop_item, but this removes information that tag_deliver may need to do its stuff. + // We can't reverse the order because drop_item refuses to run if the item already has the deleted flag set and we need to + // set that flag prior to calling tag_deliver. + + // One possibility would be to set the deleted flag, call both tag_deliver and the notifier to notify downstream channels + // and then clean up after ourselves with a cron job after a day or two to do the delete_item_lowlevel(). + + drop_item($r[0]['uid'],false); tag_deliver($uid,$r[0]['id']); @@ -1676,20 +1685,19 @@ function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_ $arr = array(); $arr['xprof_hash'] = $hash; - $arr['xprof_desc'] = (($profile['description']) ? htmlspecialchars($profile['description'], ENT_COMPAT,'UTF-8',false) : ''); $arr['xprof_dob'] = datetime_convert('','',$profile['birthday'],'Y-m-d'); // !!!! check this for 0000 year - $arr['xprof_age'] = (($profile['age']) ? intval($profile['age']) : 0); - $arr['xprof_gender'] = (($profile['gender']) ? htmlspecialchars($profile['gender'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_marital'] = (($profile['marital']) ? htmlspecialchars($profile['marital'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_sexual'] = (($profile['sexual']) ? htmlspecialchars($profile['sexual'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_locale'] = (($profile['locale']) ? htmlspecialchars($profile['locale'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_region'] = (($profile['region']) ? htmlspecialchars($profile['region'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_age'] = (($profile['age']) ? intval($profile['age']) : 0); + $arr['xprof_desc'] = (($profile['description']) ? htmlspecialchars($profile['description'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_gender'] = (($profile['gender']) ? htmlspecialchars($profile['gender'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_marital'] = (($profile['marital']) ? htmlspecialchars($profile['marital'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_sexual'] = (($profile['sexual']) ? htmlspecialchars($profile['sexual'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_locale'] = (($profile['locale']) ? htmlspecialchars($profile['locale'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_region'] = (($profile['region']) ? htmlspecialchars($profile['region'], ENT_COMPAT,'UTF-8',false) : ''); $arr['xprof_postcode'] = (($profile['postcode']) ? htmlspecialchars($profile['postcode'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_country'] = (($profile['country']) ? htmlspecialchars($profile['country'], ENT_COMPAT,'UTF-8',false) : ''); - - $arr['xprof_about'] = (($profile['about']) ? htmlspecialchars($profile['about'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_homepage'] = (($profile['homepage']) ? htmlspecialchars($profile['homepage'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['xprof_hometown'] = (($profile['hometown']) ? htmlspecialchars($profile['hometown'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_country'] = (($profile['country']) ? htmlspecialchars($profile['country'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_about'] = (($profile['about']) ? htmlspecialchars($profile['about'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_homepage'] = (($profile['homepage']) ? htmlspecialchars($profile['homepage'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['xprof_hometown'] = (($profile['hometown']) ? htmlspecialchars($profile['hometown'], ENT_COMPAT,'UTF-8',false) : ''); $clean = array(); if(array_key_exists('keywords',$profile) and is_array($profile['keywords'])) { -- cgit v1.2.3 From caa284e786d22d8c1d985fe9c86128ab7e195769 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 21 Mar 2014 01:14:51 -0700 Subject: we don't allow forgeries to be received - save some bandwidth by not allowing them to be sent. We do have to figure out how some secondary delivery chains are ending up with posts belonging to the original owner instead of the chain owner, but that's for another day. --- include/notifier.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/notifier.php b/include/notifier.php index 81f971107..a4a9051c3 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -288,6 +288,11 @@ function notifier_run($argv, $argc){ if($s) $channel = $s[0]; + if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan']) { + logger("notifier: Sending channel {$channel['channel_hash']} is not owner {$target_item['owner_xchan']} or author {$target_item['author_xchan']}"); + return; + } + if($target_item['id'] == $target_item['parent']) { $parent_item = $target_item; -- cgit v1.2.3 From 13916566f016a6b754401ca6cd6423f2a7ecaccf Mon Sep 17 00:00:00 2001 From: marijus Date: Sat, 22 Mar 2014 21:10:26 +0100 Subject: use border-box for everything --- include/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index 82af4aaeb..be386f1c9 100644 --- a/include/photos.php +++ b/include/photos.php @@ -426,4 +426,4 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { $item_id = $result['item_id']; return $item_id; -} \ No newline at end of file +} -- cgit v1.2.3 From 7d90340edaf4e47932fc2add392571ff80c27881 Mon Sep 17 00:00:00 2001 From: marijus Date: Sat, 22 Mar 2014 21:59:32 +0100 Subject: add width and height to uploaded photo body --- include/photos.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index be386f1c9..c0243cc15 100644 --- a/include/photos.php +++ b/include/photos.php @@ -164,6 +164,7 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 1; $r2 = $ph->save($p); $smallest = 1; + $width_x_height = $ph->getWidth() . 'x' . $ph->getHeight(); if(! $r2) $errors = true; } @@ -173,6 +174,7 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 2; $r3 = $ph->save($p); $smallest = 2; + $width_x_height = $ph->getWidth() . 'x' . $ph->getHeight(); if(! $r3) $errors = true; } @@ -221,7 +223,7 @@ function photo_upload($channel, $observer, $args) { $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' - . '[zmg]' . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/zmg]' + . '[zmg=' . $width_x_height. ']' . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/zmg]' . '[/zrl]'; $result = item_store($arr); -- cgit v1.2.3 From 7666aaea6a8613c11c685ca1863b772ceaaacc48 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 14:45:08 -0700 Subject: improve curl error logging --- include/network.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index 1fb4beaa7..27f912508 100644 --- a/include/network.php +++ b/include/network.php @@ -116,6 +116,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); if(! $ret['success']) { $ret['debug'] = $curl_info; + logger('z_fetch_url: error:' . curl_error($ch), LOGGER_DEBUG); logger('z_fetch_url: debug:' . print_r($curl_info,true), LOGGER_DATA); } $ret['body'] = substr($s,strlen($header)); @@ -218,7 +219,8 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); if(! $ret['success']) { $ret['debug'] = $curl_info; - logger('z_fetch_url: debug:' . print_r($curl_info,true), LOGGER_DATA); + logger('z_post_url: error:' . curl_error($ch), LOGGER_DEBUG); + logger('z_post_url: debug:' . print_r($curl_info,true), LOGGER_DATA); } $ret['body'] = substr($s,strlen($header)); -- cgit v1.2.3 From b6b4ffa68d6deab233dcda06113a849ac78f8f84 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 15:24:38 -0700 Subject: add curl error text to mod/probe so we can remotely diagnose communication issues from other sites. --- include/network.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index 27f912508..7fc3d835e 100644 --- a/include/network.php +++ b/include/network.php @@ -115,8 +115,9 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $ret['return_code'] = $rc; $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); if(! $ret['success']) { + $ret['error'] = curl_error($ch); $ret['debug'] = $curl_info; - logger('z_fetch_url: error:' . curl_error($ch), LOGGER_DEBUG); + logger('z_fetch_url: error:' . $ret['error'], LOGGER_DEBUG); logger('z_fetch_url: debug:' . print_r($curl_info,true), LOGGER_DATA); } $ret['body'] = substr($s,strlen($header)); @@ -218,8 +219,9 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { $ret['return_code'] = $rc; $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); if(! $ret['success']) { + $ret['error'] = curl_error($ch); $ret['debug'] = $curl_info; - logger('z_post_url: error:' . curl_error($ch), LOGGER_DEBUG); + logger('z_post_url: error:' . $ret['error'], LOGGER_DEBUG); logger('z_post_url: debug:' . print_r($curl_info,true), LOGGER_DATA); } -- cgit v1.2.3 From 34eb79e6ba2255113eca6d30ae6c65b28d63abfa Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 16:20:44 -0700 Subject: provide 'style' option to archive widget to choose between 'select' and 'list' format --- include/widgets.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/widgets.php b/include/widgets.php index 90586397f..82769d925 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -306,6 +306,7 @@ function widget_archive($arr) { $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0); + $style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select'); $url = z_root() . '/' . $a->cmd; @@ -318,6 +319,7 @@ function widget_archive($arr) { '$title' => t('Archives'), '$size' => ((count($ret) > 6) ? 6 : count($ret)), '$url' => $url, + '$style' => $style, '$dates' => $ret )); return $o; -- cgit v1.2.3 From 944d051e459aa86559734ea1794ec6c87129d98d Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 18:12:32 -0700 Subject: create_sys_channel during setup bypasses our check when creating the first account that there is a site keypair. Esnure that a site keypair is created before any sys channels are created. --- include/identity.php | 9 +++++++++ include/zot.php | 2 ++ 2 files changed, 11 insertions(+) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index efc0d7d87..78c4a4aed 100644 --- a/include/identity.php +++ b/include/identity.php @@ -80,6 +80,15 @@ function validate_channelname($name) { function create_sys_channel() { if(get_sys_channel()) return; + + // Ensure that there is a host keypair. + + if((! get_config('system','pubkey')) && (! get_config('system','prvkey'))) { + $hostkey = new_keypair(4096); + set_config('system','pubkey',$hostkey['pubkey']); + set_config('system','prvkey',$hostkey['prvkey']); + } + create_identity(array( 'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required 'nickname' => 'sys', diff --git a/include/zot.php b/include/zot.php index 35b322b54..3c9731f05 100644 --- a/include/zot.php +++ b/include/zot.php @@ -943,6 +943,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { $ret['hash'] = $xchan_hash; } + + logger('import_xchan: result: ' . print_r($ret,true), LOGGER_DATA); return $ret; } -- cgit v1.2.3 From 0a5d0d98f8eda3b7e7dbe22e8031d19ea4f00520 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 18:26:48 -0700 Subject: cheange encode_item() logging to logger_data because it's way too noisy and had no loglevel set --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 6788ac3da..428767676 100755 --- a/include/items.php +++ b/include/items.php @@ -859,7 +859,7 @@ function encode_item($item) { if($item['term']) $x['tags'] = encode_item_terms($item['term']); - logger('encode_item: ' . print_r($x,true)); + logger('encode_item: ' . print_r($x,true), LOGGER_DATA); return $x; -- cgit v1.2.3 From 7575ff11fb06c03364fd0cb15a08e8aebbfc2e41 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 18:34:17 -0700 Subject: make sure crypto is loaded before creating a keypair --- include/identity.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 78c4a4aed..c25a3da43 100644 --- a/include/identity.php +++ b/include/identity.php @@ -84,6 +84,7 @@ function create_sys_channel() { // Ensure that there is a host keypair. if((! get_config('system','pubkey')) && (! get_config('system','prvkey'))) { + require_once('include/crypto.php'); $hostkey = new_keypair(4096); set_config('system','pubkey',$hostkey['pubkey']); set_config('system','prvkey',$hostkey['prvkey']); -- cgit v1.2.3 From 350624e993ebc3693350d74ce06fb35fc73b4d3c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 23 Mar 2014 18:45:42 -0700 Subject: don't allow normal channels to have the name 'sys'. --- include/identity.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index c25a3da43..c8a925dac 100644 --- a/include/identity.php +++ b/include/identity.php @@ -177,6 +177,11 @@ function create_identity($arr) { return $ret; } + if($nick === 'sys' && (! ($pageflags & PAGE_SYSTEM))) { + $ret['message'] = t('Reserved nickname. Please choose another.'); + return $ret; + } + if(check_webbie(array($nick)) !== $nick) { $ret['message'] = t('Nickname has unsupported characters or is already being used on this site.'); return $ret; -- cgit v1.2.3 From e6ea4a757452f93d49a80bf1f4fa76c88c3659ff Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Mar 2014 17:16:01 -0700 Subject: ssl ciphers - be liberal in what we accept, conservative in what we generate --- include/network.php | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index 7fc3d835e..0bf05c0f0 100644 --- a/include/network.php +++ b/include/network.php @@ -43,8 +43,14 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Red)"); + $ciphers = @get_config('system','curl_ssl_ciphers'); + if(! $ciphers) + $ciphers = 'ALL:!eNULL'; + + @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); + if (x($opts,'accept_content')){ - curl_setopt($ch,CURLOPT_HTTPHEADER, array ( + @curl_setopt($ch,CURLOPT_HTTPHEADER, array ( "Accept: " . $opts['accept_content'] )); } @@ -138,21 +144,27 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(($redirects > 8) || (! $ch)) return ret; - curl_setopt($ch, CURLOPT_HEADER, true); + @curl_setopt($ch, CURLOPT_HEADER, true); @curl_setopt($ch, CURLOPT_CAINFO, get_capath()); - curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); - curl_setopt($ch, CURLOPT_POST,1); - curl_setopt($ch, CURLOPT_POSTFIELDS,$params); - curl_setopt($ch, CURLOPT_USERAGENT, "Red"); + @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); + @curl_setopt($ch, CURLOPT_POST,1); + @curl_setopt($ch, CURLOPT_POSTFIELDS,$params); + @curl_setopt($ch, CURLOPT_USERAGENT, "Red"); + + $ciphers = @get_config('system','curl_ssl_ciphers'); + if(! $ciphers) + $ciphers = 'ALL:!eNULL'; + + @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, Z_CURL_CIPHERS); if (x($opts,'accept_content')){ - curl_setopt($ch,CURLOPT_HTTPHEADER, array ( + @curl_setopt($ch,CURLOPT_HTTPHEADER, array ( "Accept: " . $opts['accept_content'] )); } if(x($opts,'headers')) - curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); + @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); if(x($opts,'timeout') && intval($opts['timeout'])) { @curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']); @@ -172,11 +184,11 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { $prx = get_config('system','proxy'); if(strlen($prx)) { - curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); - curl_setopt($ch, CURLOPT_PROXY, $prx); + @curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); + @curl_setopt($ch, CURLOPT_PROXY, $prx); $prxusr = get_config('system','proxyuser'); if(strlen($prxusr)) - curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr); + @curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr); } // don't let curl abort the entire application @@ -185,7 +197,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { $s = @curl_exec($ch); $base = $s; - $curl_info = curl_getinfo($ch); + $curl_info = @curl_getinfo($ch); $http_code = $curl_info['http_code']; $header = ''; -- cgit v1.2.3 From 10f18675214acff5b4246bd6c4b13807b8e0e44f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Mar 2014 18:42:54 -0700 Subject: that didn't work out well --- include/network.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index 0bf05c0f0..8e781272a 100644 --- a/include/network.php +++ b/include/network.php @@ -47,7 +47,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if(! $ciphers) $ciphers = 'ALL:!eNULL'; - @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); +// @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); if (x($opts,'accept_content')){ @curl_setopt($ch,CURLOPT_HTTPHEADER, array ( @@ -155,7 +155,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(! $ciphers) $ciphers = 'ALL:!eNULL'; - @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, Z_CURL_CIPHERS); +// @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, Z_CURL_CIPHERS); if (x($opts,'accept_content')){ -- cgit v1.2.3 From 235b0335608439b98d74a205a380d0f77baf6b4f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Mar 2014 19:01:20 -0700 Subject: that should fix it. --- include/network.php | 4 ++-- include/socgraph.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index 8e781272a..14771d88f 100644 --- a/include/network.php +++ b/include/network.php @@ -47,7 +47,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if(! $ciphers) $ciphers = 'ALL:!eNULL'; -// @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); + @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); if (x($opts,'accept_content')){ @curl_setopt($ch,CURLOPT_HTTPHEADER, array ( @@ -155,7 +155,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(! $ciphers) $ciphers = 'ALL:!eNULL'; -// @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, Z_CURL_CIPHERS); + @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); if (x($opts,'accept_content')){ diff --git a/include/socgraph.php b/include/socgraph.php index 10d52da66..65e23f9df 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -62,6 +62,11 @@ function poco_load($xchan = '',$url = null) { $j = json_decode($s['body'],true); + if(! $j) { + logger('poco_load: unable to json_decode returned data.'); + return; + } + logger('poco_load: ' . print_r($j,true),LOGGER_DATA); if($xchan) { -- cgit v1.2.3 From 50a7e9ce8fe30959d6e4343e8fdafaeca1e7856c Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Mar 2014 19:40:36 -0700 Subject: this should improve queue performance dramatically. --- include/directory.php | 5 +++-- include/notifier.php | 6 ++++-- include/queue.php | 8 ++++++-- include/zot.php | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/directory.php b/include/directory.php index 794420b6f..c69fb1f4b 100644 --- a/include/directory.php +++ b/include/directory.php @@ -69,11 +69,12 @@ function directory_run($argv, $argc){ // the directory packet. That means we'll try again on the next poll run. $hash = random_string(); - q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) - values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )", + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) + values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($channel['channel_account_id']), intval($channel['channel_id']), + dbesc('zot'), dbesc($url), intval(1), dbesc(datetime_convert()), diff --git a/include/notifier.php b/include/notifier.php index a4a9051c3..4bf2ac153 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -486,10 +486,11 @@ function notifier_run($argv, $argc){ $hash = random_string(); if($packet_type === 'refresh' || $packet_type === 'purge') { $n = zot_build_packet($channel,$packet_type); - q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )", + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($channel['channel_account_id']), intval($channel['channel_id']), + dbesc('zot'), dbesc($hub['hubloc_callback']), intval(1), dbesc(datetime_convert()), @@ -500,10 +501,11 @@ function notifier_run($argv, $argc){ } else { $n = zot_build_packet($channel,'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash); - q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )", + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($target_item['aid']), intval($target_item['uid']), + dbesc('zot'), dbesc($hub['hubloc_callback']), intval(1), dbesc(datetime_convert()), diff --git a/include/queue.php b/include/queue.php index ec7246cb2..239d61fc0 100644 --- a/include/queue.php +++ b/include/queue.php @@ -33,8 +33,12 @@ function queue_run($argv, $argc){ // For the first 12 hours we'll try to deliver every 15 minutes // After that, we'll only attempt delivery once per hour. - - $r = q("SELECT * FROM outq WHERE outq_delivered = 0 and (( outq_created > UTC_TIMESTAMP() - INTERVAL 12 HOUR and outq_updated < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( outq_updated < UTC_TIMESTAMP() - INTERVAL 1 HOUR ))"); + // This currently only handles the default queue drivers ('zot' or '') which we will group by posturl + // so that we don't start off a thousand deliveries for a couple of dead hubs. + // The zot driver will deliver everything destined for a single hub once contact is made (*if* contact is made). + // Other drivers will have to do something different here and may need their own query. + + $r = q("SELECT * FROM outq WHERE outq_delivered = 0 and (( outq_created > UTC_TIMESTAMP() - INTERVAL 12 HOUR and outq_updated < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( outq_updated < UTC_TIMESTAMP() - INTERVAL 1 HOUR )) and outq_driver in ('','zot') group by outq_posturl"); } if(! $r) return; diff --git a/include/zot.php b/include/zot.php index 3c9731f05..c82918b3a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2074,10 +2074,11 @@ function build_sync_packet($uid = 0, $packet = null) { foreach($synchubs as $hub) { $hash = random_string(); $n = zot_build_packet($channel,'notify',$env_recips,$hub['hubloc_sitekey'],$hash); - q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )", + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($channel['channel_account']), intval($channel['channel_id']), + dbesc('zot'), dbesc($hub['hubloc_callback']), intval(1), dbesc(datetime_convert()), -- cgit v1.2.3 From f5467a6d511c2fbf2ba88e026f75e8a304a9ab2d Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 25 Mar 2014 04:24:26 +0000 Subject: Fix wall photo uploads. --- include/photos.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index c0243cc15..f9f160eb5 100644 --- a/include/photos.php +++ b/include/photos.php @@ -221,9 +221,13 @@ function photo_upload($channel, $observer, $args) { $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; + if ($width_x_height) + $tag = '[zmg=' . $width_x_height. ']'; + else + $tag = '[zmg]'; $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' - . '[zmg=' . $width_x_height. ']' . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/zmg]' + . $tag . z_root() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/zmg]' . '[/zrl]'; $result = item_store($arr); -- cgit v1.2.3 From 8547e4b2a8f41b6a600006b2673809e5b383059b Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Mar 2014 12:44:30 -0700 Subject: ensure wall_upload always has width and height if the image is valid --- include/photos.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index c0243cc15..d1462a27f 100644 --- a/include/photos.php +++ b/include/photos.php @@ -174,10 +174,10 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 2; $r3 = $ph->save($p); $smallest = 2; - $width_x_height = $ph->getWidth() . 'x' . $ph->getHeight(); if(! $r3) $errors = true; } + if($errors) { q("delete from photo where resource_id = '%s' and uid = %d", @@ -190,6 +190,10 @@ function photo_upload($channel, $observer, $args) { return $ret; } + // This will be the width and height of the smallest representation + + $width_x_height = $ph->getWidth() . 'x' . $ph->getHeight(); + $basename = basename($filename); $mid = item_message_id(); -- cgit v1.2.3 From dc091800c3a138810b2c14127dfa2fe4fab3616b Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Mar 2014 12:47:29 -0700 Subject: missed one --- include/photos.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index d1462a27f..65d2dfb30 100644 --- a/include/photos.php +++ b/include/photos.php @@ -164,7 +164,6 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 1; $r2 = $ph->save($p); $smallest = 1; - $width_x_height = $ph->getWidth() . 'x' . $ph->getHeight(); if(! $r2) $errors = true; } -- cgit v1.2.3 From 7375e305060df3818f01a96fbbd811921468ad89 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Mar 2014 15:19:18 -0700 Subject: This should be a slight improvement in setting ciphers - we'll punt on RedHat but open up the list just for openssl distros which seem to have all the problems at the moment. --- include/network.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/network.php b/include/network.php index 14771d88f..9f68328b7 100644 --- a/include/network.php +++ b/include/network.php @@ -44,10 +44,8 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Red)"); $ciphers = @get_config('system','curl_ssl_ciphers'); - if(! $ciphers) - $ciphers = 'ALL:!eNULL'; - - @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); + if($ciphers) + @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); if (x($opts,'accept_content')){ @curl_setopt($ch,CURLOPT_HTTPHEADER, array ( @@ -152,10 +150,8 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERAGENT, "Red"); $ciphers = @get_config('system','curl_ssl_ciphers'); - if(! $ciphers) - $ciphers = 'ALL:!eNULL'; - - @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); + if($ciphers) + @curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); if (x($opts,'accept_content')){ -- cgit v1.2.3 From 79f5fd8e2a4959b78cf8be6312962849e14e9d85 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 16:09:07 -0700 Subject: allow zotfeed to create a firehose of a site. --- include/identity.php | 9 +++++++++ include/items.php | 31 ++++++++++++++++++++----------- include/security.php | 14 ++++++++------ 3 files changed, 37 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index c8a925dac..97c29516c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -109,6 +109,15 @@ function get_sys_channel() { return false; } +function is_sys_channel($channel_id) { + $r = q("select channel_pageflags from channel where channel_id = %d limit 1", + intval($channel_id) + ); + if(($r) && ($r[0]['channel_pageflags'] & PAGE_SYSTEM)) + return true; + return false; +} + /** * @channel_total() diff --git a/include/items.php b/include/items.php index 428767676..dd5f4aac1 100755 --- a/include/items.php +++ b/include/items.php @@ -3763,24 +3763,33 @@ function zot_feed($uid,$observer_xchan,$mindate) { $items = array(); - $r = q("SELECT item.*, item.id as item_id from item - WHERE uid = %d AND item_restrict = 0 and id = parent - AND (item_flags & %d) - $sql_extra ORDER BY created ASC $limit", - intval($uid), - intval(ITEM_WALL) - ); - if($r) { + if(is_sys_channel($uid)) { + $r = q("SELECT item.*, item.id as item_id from item + WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent + AND (item_flags & %d) + $sql_extra ORDER BY created ASC $limit", + intval($uid), + intval(ITEM_WALL) + ); + } + else { + $r = q("SELECT item.*, item.id as item_id from item + WHERE uid = %d AND item_restrict = 0 and id = parent + AND (item_flags & %d) + $sql_extra ORDER BY created ASC $limit", + intval($uid), + intval(ITEM_WALL) + ); + } + if($r) { $parents_str = ids_to_querystr($r,'id'); $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` - WHERE `item`.`uid` = %d AND `item`.`item_restrict` = 0 + WHERE `item`.`item_restrict` = 0 AND `item`.`parent` IN ( %s ) ", - intval($uid), dbesc($parents_str) ); - } if($items) { diff --git a/include/security.php b/include/security.php index f52615357..6b20e2904 100644 --- a/include/security.php +++ b/include/security.php @@ -346,8 +346,9 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $ret = array(); if(local_user()) $ret[] = local_user(); - $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d", - intval($perms_min) + $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) ", + intval($perms_min), + intval(PAGE_ADULT) ); if($r) foreach($r as $rr) @@ -361,7 +362,7 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $str .= ','; $str .= intval($rr); } -logger('stream_perms_api_uids: ' . $str); +logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG); return $str; } @@ -370,8 +371,9 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { if(local_user()) $ret[] = get_observer_hash(); - $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d", - intval($perms_min) + $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", + intval($perms_min), + intval(PAGE_ADULT) ); if($r) foreach($r as $rr) @@ -385,6 +387,6 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { $str .= ','; $str .= "'" . dbesc($rr) . "'"; } -logger('stream_perms_xchans: ' . $str); +logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG); return $str; } -- cgit v1.2.3 From 9a3a2819c11cccdbce72adbe611f45e559e36655 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 17:05:45 -0700 Subject: add admin/channels --- include/security.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/security.php b/include/security.php index 6b20e2904..d974efb8f 100644 --- a/include/security.php +++ b/include/security.php @@ -346,9 +346,9 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $ret = array(); if(local_user()) $ret[] = local_user(); - $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) ", + $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", intval($perms_min), - intval(PAGE_ADULT) + intval(PAGE_CENSORED) ); if($r) foreach($r as $rr) @@ -373,7 +373,7 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", intval($perms_min), - intval(PAGE_ADULT) + intval(PAGE_CENSORED) ); if($r) foreach($r as $rr) -- cgit v1.2.3 From ed14c1f224afadb5dd5417d4078f853ff97b30cb Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 18:45:01 -0700 Subject: more work on firehose --- include/expire.php | 4 ++++ include/items.php | 2 +- include/poller.php | 24 ++++++++++++++++++++++++ include/security.php | 10 ++++++---- include/zot.php | 12 +++++++----- 5 files changed, 42 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/expire.php b/include/expire.php index 2d94d64c0..ee9956ef3 100644 --- a/include/expire.php +++ b/include/expire.php @@ -29,6 +29,10 @@ function expire_run($argv, $argc){ } } + $x = get_sys_channel(); + if($x) + item_expire($x['channel_id'],30); + return; } diff --git a/include/items.php b/include/items.php index dd5f4aac1..5cc1ef05c 100755 --- a/include/items.php +++ b/include/items.php @@ -3767,7 +3767,7 @@ function zot_feed($uid,$observer_xchan,$mindate) { $r = q("SELECT item.*, item.id as item_id from item WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent AND (item_flags & %d) - $sql_extra ORDER BY created ASC $limit", + and item_private = 0 ORDER BY created ASC $limit", intval($uid), intval(ITEM_WALL) ); diff --git a/include/poller.php b/include/poller.php index bae39dd2e..aa09afd5d 100644 --- a/include/poller.php +++ b/include/poller.php @@ -167,6 +167,30 @@ function poller_run($argv, $argc){ } } + // pull in some public posts + + $r = q("select site_url from site where site_url != '%s' order by rand() limit 1", + dbesc(z_root()) + ); + + if($r) { + $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 1 month')); + $x = z_fetch_url($feedurl); + if(($x) && ($x['success'])) { + $total = 0; + $j = json_decode($x['body'],true); + if($j['success'] && $j['messages']) { + require_once('include/identity.php'); + $sys = get_sys_channel(); + foreach($j['messages'] as $message) { + $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), + array(array('hash' => $sys['xchan_hash'])), false, true); + $total ++; + } + logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); + } + } + } $manual_id = 0; $generation = 0; diff --git a/include/security.php b/include/security.php index d974efb8f..282c8ab73 100644 --- a/include/security.php +++ b/include/security.php @@ -346,9 +346,10 @@ function stream_perms_api_uids($perms_min = PERMS_SITE) { $ret = array(); if(local_user()) $ret[] = local_user(); - $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", + $r = q("select channel_id from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) and not (channel_pageflags & %d)", intval($perms_min), - intval(PAGE_CENSORED) + intval(PAGE_CENSORED), + intval(PAGE_SYSTEM) ); if($r) foreach($r as $rr) @@ -371,9 +372,10 @@ function stream_perms_xchans($perms_min = PERMS_SITE) { if(local_user()) $ret[] = get_observer_hash(); - $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d)", + $r = q("select channel_hash from channel where channel_r_stream > 0 and channel_r_stream <= %d and not (channel_pageflags & %d) and not (channel_pageflags & %d)", intval($perms_min), - intval(PAGE_CENSORED) + intval(PAGE_CENSORED), + intval(PAGE_SYSTEM) ); if($r) foreach($r as $rr) diff --git a/include/zot.php b/include/zot.php index c82918b3a..186f1da10 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1354,16 +1354,18 @@ function allowed_public_recips($msg) { } -function process_delivery($sender,$arr,$deliveries,$relay) { +function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $result = array(); // We've validated the sender. Now make sure that the sender is the owner or author - if($sender['hash'] != $arr['owner_xchan'] && $sender['hash'] != $arr['author_xchan']) { - logger("process_delivery: sender {$sender['hash']} is not owner {$arr['owner_xchan']} or author {$arr['author_xchan']} - mid {$arr['mid']}"); - return; + if(! $public) { + if($sender['hash'] != $arr['owner_xchan'] && $sender['hash'] != $arr['author_xchan']) { + logger("process_delivery: sender {$sender['hash']} is not owner {$arr['owner_xchan']} or author {$arr['author_xchan']} - mid {$arr['mid']}"); + return; + } } foreach($deliveries as $d) { @@ -1394,7 +1396,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) { } } - if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery)) { + if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $public)) { logger("permission denied for delivery {$channel['channel_id']}"); $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); continue; -- cgit v1.2.3 From e476ed6be5d89c1fedd683d69b1562928951fb2f Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 19:13:26 -0700 Subject: there's the problem --- include/items.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 5cc1ef05c..e858955b6 100755 --- a/include/items.php +++ b/include/items.php @@ -3751,8 +3751,10 @@ function zot_feed($uid,$observer_xchan,$mindate) { return $result; } - require_once('include/security.php'); - $sql_extra = item_permissions_sql($uid); + if(! is_sys_channel($uid)) { + require_once('include/security.php'); + $sql_extra = item_permissions_sql($uid); + } if($mindate != '0000-00-00 00:00:00') { $sql_extra .= " and created > '$mindate' "; @@ -3767,8 +3769,7 @@ function zot_feed($uid,$observer_xchan,$mindate) { $r = q("SELECT item.*, item.id as item_id from item WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent AND (item_flags & %d) - and item_private = 0 ORDER BY created ASC $limit", - intval($uid), + and item_private = 0 $sql_extra ORDER BY created ASC $limit", intval(ITEM_WALL) ); } -- cgit v1.2.3 From 20717e34162d3759408fd5300548fc4cfa1b2263 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 19:23:45 -0700 Subject: let's limit this to two weeks so it doesn't pound servers and waste too much space --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/poller.php b/include/poller.php index aa09afd5d..d873058a6 100644 --- a/include/poller.php +++ b/include/poller.php @@ -174,7 +174,7 @@ function poller_run($argv, $argc){ ); if($r) { - $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 1 month')); + $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { $total = 0; -- cgit v1.2.3 From a00c581e272af71eb064a1a29edd3334d9148d9d Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 20:22:57 -0700 Subject: need include --- include/items.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index e858955b6..cd86918d6 100755 --- a/include/items.php +++ b/include/items.php @@ -3766,6 +3766,8 @@ function zot_feed($uid,$observer_xchan,$mindate) { $items = array(); if(is_sys_channel($uid)) { + + require_once('include/security.php'); $r = q("SELECT item.*, item.id as item_id from item WHERE uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0 and id = parent AND (item_flags & %d) -- cgit v1.2.3 From 5a3903a40c508a6b5e9a90986564e5c4918223cc Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 22:05:19 -0700 Subject: firehose testing (network?f=&fh=1) - some possible security bugs so testing purposes only --- include/poller.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/poller.php b/include/poller.php index d873058a6..9b8ac4165 100644 --- a/include/poller.php +++ b/include/poller.php @@ -176,6 +176,7 @@ function poller_run($argv, $argc){ if($r) { $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); $x = z_fetch_url($feedurl); + if(($x) && ($x['success'])) { $total = 0; $j = json_decode($x['body'],true); -- cgit v1.2.3 From 41d8cfa72a4c4d82bce37959512da95b040dba7b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 00:25:34 -0700 Subject: link in the firehose --- include/conversation.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 16ac4e909..6a0936a09 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1333,6 +1333,7 @@ function network_tabs() { $conv_active = ''; $spam_active = ''; $postord_active = ''; + $public_active = ''; if(x($_GET,'new')) { $new_active = 'active'; @@ -1354,13 +1355,18 @@ function network_tabs() { $spam_active = 'active'; } + if(x($_GET,'fh')) { + $public_active = 'active'; + } + if (($new_active == '') && ($starred_active == '') && ($conv_active == '') && ($search_active == '') - && ($spam_active == '')) { + && ($spam_active == '') + && ($public_active == '')) { $no_active = 'active'; } @@ -1377,6 +1383,13 @@ function network_tabs() { // tabs $tabs = array( + array( + 'label' => t('Public'), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), + 'sel'=> $public_active, + 'title'=> t('View Public Streams'), + ), + array( 'label' => t('Commented Order'), 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), -- cgit v1.2.3 From a0674af4169a8c929c89887d4e7796b21ee55a91 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 15:35:29 -0700 Subject: firehose fixes and optimisations. In particular get rid of the unresponsive script warning when trying to load updates (sine they aren't our posts, we can't check for unseen, hence we can't really load updates). Also make the url selection pluggable. --- include/ConversationObject.php | 10 ++++++-- include/conversation.php | 4 ++-- include/externals.php | 54 ++++++++++++++++++++++++++++++++++++++++++ include/poller.php | 25 ++----------------- 4 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 include/externals.php (limited to 'include') diff --git a/include/ConversationObject.php b/include/ConversationObject.php index 103c3664b..d97438a5d 100644 --- a/include/ConversationObject.php +++ b/include/ConversationObject.php @@ -52,8 +52,14 @@ class Conversation extends BaseObject { switch($mode) { case 'network': - $this->profile_owner = local_user(); - $this->writable = true; + if(array_key_exists('firehose',$a->data) && intval($a->data['firehose'])) { + $this->profile_owner = intval($a->data['firehose']); + $this->writable = false; + } + else { + $this->profile_owner = local_user(); + $this->writable = true; + } break; case 'channel': $this->profile_owner = $a->profile['profile_uid']; diff --git a/include/conversation.php b/include/conversation.php index 6a0936a09..eef2635df 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1384,10 +1384,10 @@ function network_tabs() { // tabs $tabs = array( array( - 'label' => t('Public'), + 'label' => t('External'), 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), 'sel'=> $public_active, - 'title'=> t('View Public Streams'), + 'title'=> t('Imported public streams'), ), array( diff --git a/include/externals.php b/include/externals.php new file mode 100644 index 000000000..48aeaf6b3 --- /dev/null +++ b/include/externals.php @@ -0,0 +1,54 @@ + ''); + call_hooks('externals_url_select',$arr); + + if($arr['url']) { + $url = $arr['url']; + } + else { + $r = q("select site_url from site where site_url != '%s' order by rand() limit 1", + dbesc(z_root()) + ); + if($r) + $url = $r[0]['site_url']; + } + + if($url) { + $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); + $x = z_fetch_url($feedurl); + + if(($x) && ($x['success'])) { + $total = 0; + $j = json_decode($x['body'],true); + if($j['success'] && $j['messages']) { + $sys = get_sys_channel(); + foreach($j['messages'] as $message) { + $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), + array(array('hash' => $sys['xchan_hash'])), false, true); + $total ++; + } + logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); + } + } + } + +} + +if (array_search(__file__,get_included_files())===0){ + externals_run($argv,$argc); + killme(); +} diff --git a/include/poller.php b/include/poller.php index 9b8ac4165..19037ef17 100644 --- a/include/poller.php +++ b/include/poller.php @@ -167,31 +167,10 @@ function poller_run($argv, $argc){ } } - // pull in some public posts - $r = q("select site_url from site where site_url != '%s' order by rand() limit 1", - dbesc(z_root()) - ); + // pull in some public posts + proc_run('php','include/externals.php'); - if($r) { - $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); - $x = z_fetch_url($feedurl); - - if(($x) && ($x['success'])) { - $total = 0; - $j = json_decode($x['body'],true); - if($j['success'] && $j['messages']) { - require_once('include/identity.php'); - $sys = get_sys_channel(); - foreach($j['messages'] as $message) { - $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), - array(array('hash' => $sys['xchan_hash'])), false, true); - $total ++; - } - logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); - } - } - } $manual_id = 0; $generation = 0; -- cgit v1.2.3 From 1f931c0e3c687d91e53fdf1b6337febc8125bd74 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 16:40:10 -0700 Subject: firehose: provide system prefs to allow folks to fine tune to their needs --- include/expire.php | 13 +++++++++++-- include/externals.php | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/expire.php b/include/expire.php index ee9956ef3..efce64ee4 100644 --- a/include/expire.php +++ b/include/expire.php @@ -29,10 +29,19 @@ function expire_run($argv, $argc){ } } + $x = get_sys_channel(); - if($x) - item_expire($x['channel_id'],30); + if($x) { + + // this should probably just fetch the channel_expire_days from the sys channel, + // but there's no convenient way to set it. + $expire_days = get_config('externals','expire_days'); + if($expire_days === false) + $expire_days = 30; + if($expire_days) + item_expire($x['channel_id'],$expire_days); + } return; } diff --git a/include/externals.php b/include/externals.php index 48aeaf6b3..946931033 100644 --- a/include/externals.php +++ b/include/externals.php @@ -28,7 +28,11 @@ function externals_run($argv, $argc){ } if($url) { - $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); + $days = intval(getconfig('externals','since_days')); + if($days === false) + $days = 15; + + $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . $days . ' days')); $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { -- cgit v1.2.3 From 6394f066353f01d6ea82cf94a46aea564add7b51 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 28 Mar 2014 00:36:38 +0000 Subject: typo --- include/externals.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 946931033..80476d4a7 100644 --- a/include/externals.php +++ b/include/externals.php @@ -28,7 +28,7 @@ function externals_run($argv, $argc){ } if($url) { - $days = intval(getconfig('externals','since_days')); + $days = intval(get_config('externals','since_days')); if($days === false) $days = 15; -- cgit v1.2.3 From 8594d069a1fd00c0aacb30f544555c26465991c2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 18:03:19 -0700 Subject: new connection notification --- include/enotify.php | 6 +++--- include/zot.php | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index 5a55aee09..96a152d31 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -253,14 +253,14 @@ function notification($params) { if($params['type'] == NOTIFY_INTRO) { $subject = sprintf( t('[Red:Notify] Introduction received')); - $preamble = sprintf( t('%1$s, you\'ve received an introduction from \'%2$s\' at %3$s'), $recip['channel_name'], $sender['xchan_name'], $sitename); - $epreamble = sprintf( t('%1$s, you\'ve received [zrl=%2$s]an introduction[/zrl] from %3$s.'), + $preamble = sprintf( t('%1$s, you\'ve received an new connection request from \'%2$s\' at %3$s'), $recip['channel_name'], $sender['xchan_name'], $sitename); + $epreamble = sprintf( t('%1$s, you\'ve received [zrl=%2$s]a new connection request[/zrl] from %3$s.'), $recip['channel_name'], $itemlink, '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]'); $body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']); - $sitelink = t('Please visit %s to approve or reject the introduction.'); + $sitelink = t('Please visit %s to approve or reject the connection request.'); $tsitelink = sprintf( $sitelink, $siteurl ); $hsitelink = sprintf( $sitelink, '' . $sitename . ''); $itemlink = $params['link']; diff --git a/include/zot.php b/include/zot.php index 186f1da10..394563563 100644 --- a/include/zot.php +++ b/include/zot.php @@ -425,6 +425,15 @@ function zot_refresh($them,$channel = null, $force = false) { intval($channel['channel_id']), dbesc($x['hash']) ); + if(($new_connection) && (! $default_perms)) { + require_once('include/enotify.php'); + notification(array( + 'type' => NOTIFY_INTRO, + 'from_xchan' => $x['hash'], + 'to_xchan' => $channel['channel_hash'], + 'link' => z_root() . '/connedit/' . $new_connection[0]['abook_id'], + )); + } if($new_connection && (! ($new_connection[0]['abook_flags'] & ABOOK_FLAG_PENDING)) && ($their_perms & PERMS_R_STREAM)) proc_run('php','include/onepoll.php',$new_connection[0]['abook_id']); -- cgit v1.2.3 From 8c3efd20f4a56517d714bc533549251f41308d7e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 18:53:14 -0700 Subject: this should work a bit better --- include/externals.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 80476d4a7..244b4a59e 100644 --- a/include/externals.php +++ b/include/externals.php @@ -28,11 +28,14 @@ function externals_run($argv, $argc){ } if($url) { - $days = intval(get_config('externals','since_days')); + logger('externals: pulling public content from ' . $url, LOGGER_DEBUG); + $days = get_config('externals','since_days'); if($days === false) $days = 15; - $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . $days . ' days')); + $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); + + logger('externals: pulling public content from ' . $feedurl, LOGGER_DEBUG); $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { @@ -45,7 +48,7 @@ function externals_run($argv, $argc){ array(array('hash' => $sys['xchan_hash'])), false, true); $total ++; } - logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); + logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); } } } -- cgit v1.2.3 From a6d8668a5f31def1a74fcdfe15a184acfe3d696d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 20:28:48 -0700 Subject: try and sort out the item delete mess --- include/expire.php | 16 ++++++++++++-- include/items.php | 65 ++++++++++++++++++++++++++++++++++++++++++------------ include/zot.php | 6 ++--- 3 files changed, 68 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/expire.php b/include/expire.php index efce64ee4..442914a39 100644 --- a/include/expire.php +++ b/include/expire.php @@ -7,10 +7,20 @@ function expire_run($argv, $argc){ cli_startup(); + $r = q("select id from item where (item_restrict & %d) and not (item_restrict & %d) and changed < UTC_TIMESTAMP() - INTERVAL 10 DAY", + intval(ITEM_DELETED), + intval(ITEM_PENDING_REMOVE) + ); + if($r) { + foreach($r as $rr) { + drop_item($rr['id'],false,DROPITEM_PHASE2); + } + } + // physically remove anything that has been deleted for more than two months - $r = q("delete from item where ( item_flags & %d ) and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY", - intval(ITEM_DELETED) + $r = q("delete from item where ( item_restrict & %d ) and changed < UTC_TIMESTAMP() - INTERVAL 36 DAY", + intval(ITEM_PENDING_REMOVE) ); // make this optional as it could have a performance impact on large sites @@ -42,6 +52,8 @@ function expire_run($argv, $argc){ if($expire_days) item_expire($x['channel_id'],$expire_days); } + + return; } diff --git a/include/items.php b/include/items.php index cd86918d6..dcf9f5bc2 100755 --- a/include/items.php +++ b/include/items.php @@ -3493,7 +3493,12 @@ function drop_items($items) { // permissions to carry out this act. If it is non-interactive, we are deleting something at the // system's request and do not check permission. This is very important to know. -function drop_item($id,$interactive = true) { +// Some deletion requests (those coming from remote sites) must be staged. +// $stage = 0 => unstaged +// $stage = 1 => set deleted flag on the item and perform intial notifications +// $stage = 2 => perform low level delete at a later stage + +function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { $a = get_app(); @@ -3503,7 +3508,7 @@ function drop_item($id,$interactive = true) { intval($id) ); - if((! $r) || ($r[0]['item_restrict'] & ITEM_DELETED)) { + if((! $r) || (($r[0]['item_restrict'] & ITEM_DELETED) && ($stage === DROPITEM_NORMAL))) { if(! $interactive) return 0; notice( t('Item not found.') . EOL); @@ -3537,7 +3542,7 @@ function drop_item($id,$interactive = true) { intval($item['id']) ); - $arr = array('item' => $item); + $arr = array('item' => $item, 'interactive' => $interactive, 'stage' => $stage); call_hooks('drop_item', $arr ); $notify_id = intval($item['id']); @@ -3548,10 +3553,10 @@ function drop_item($id,$interactive = true) { ); if($items) { foreach($items as $i) - delete_item_lowlevel($i); + delete_item_lowlevel($i,$stage); } else - delete_item_lowlevel($item); + delete_item_lowlevel($item,$stage); if(! $interactive) return 1; @@ -3559,7 +3564,7 @@ function drop_item($id,$interactive = true) { // send the notification upstream/downstream as the case may be // only send notifications to others if this is the owner's wall item. - if($item['item_flags'] & ITEM_WALL) + if(($item['item_flags'] & ITEM_WALL) && ($stage != DROPITEM_PHASE2)) proc_run('php','include/notifier.php','drop',$notify_id); goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); @@ -3578,15 +3583,47 @@ function drop_item($id,$interactive = true) { // It merely destroys all resources associated with an item. // Please do not use without a suitable wrapper. -function delete_item_lowlevel($item) { +function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL) { - $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), title = '', body = '', - changed = '%s', edited = '%s' WHERE id = %d LIMIT 1", - intval(ITEM_DELETED), - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($item['id']) - ); + + switch($stage) { + case DROPITEM_PHASE2: + $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), body = '', title = '', + changed = '%s', edited = '%s' WHERE id = %d LIMIT 1", + intval(ITEM_PENDING_REMOVE), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($item['id']) + ); + break; + + case DROPITEM_PHASE1: + $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), + changed = '%s', edited = '%s' WHERE id = %d LIMIT 1", + intval(ITEM_DELETED), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($item['id']) + ); + break; + + case DROPITEM_NORMAL: + default: + $r = q("UPDATE item SET item_restrict = ( item_restrict | %d ), body = '', title = '', + changed = '%s', edited = '%s' WHERE id = %d LIMIT 1", + intval(ITEM_DELETED), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($item['id']) + ); + break; + } + + // network deletion request. Keep the message structure so that we can deliver delete notifications. + // Come back after several days (or perhaps a month) to do the lowlevel delete (DROPITEM_PHASE2). + + if($stage == DROPITEM_PHASE1) + return true; $r = q("delete from term where otype = %d and oid = %d limit 1", intval(TERM_OBJ_POST), diff --git a/include/zot.php b/include/zot.php index 394563563..b23c18bdb 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1597,10 +1597,10 @@ function delete_imported_item($sender,$item,$uid) { // We can't reverse the order because drop_item refuses to run if the item already has the deleted flag set and we need to // set that flag prior to calling tag_deliver. - // One possibility would be to set the deleted flag, call both tag_deliver and the notifier to notify downstream channels - // and then clean up after ourselves with a cron job after a day or two to do the delete_item_lowlevel(). + // Use phased deletion to set the deleted flag, call both tag_deliver and the notifier to notify downstream channels + // and then clean up after ourselves with a cron job after several days to do the delete_item_lowlevel() (DROPITEM_PHASE2). - drop_item($r[0]['uid'],false); + drop_item($r[0]['id'],false, DROPITEM_PHASE1); tag_deliver($uid,$r[0]['id']); -- cgit v1.2.3 From 52c456d254fff199bc4cfde75f9a9948f8532fdc Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 20:57:45 -0700 Subject: don't include standalone test sites in external host list --- include/externals.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 244b4a59e..290f93a68 100644 --- a/include/externals.php +++ b/include/externals.php @@ -20,8 +20,9 @@ function externals_run($argv, $argc){ $url = $arr['url']; } else { - $r = q("select site_url from site where site_url != '%s' order by rand() limit 1", - dbesc(z_root()) + $r = q("select site_url from site where site_url != '%s' and site_flags != %d order by rand() limit 1", + dbesc(z_root()), + intval(DIRECTORY_MODE_STANDALONE) ); if($r) $url = $r[0]['site_url']; -- cgit v1.2.3 From 6925cf9fe55e5a420fbe7385dd170d8dd7a65d57 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 28 Mar 2014 01:24:30 -0700 Subject: external -> discover --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index eef2635df..ac1b4e456 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1384,7 +1384,7 @@ function network_tabs() { // tabs $tabs = array( array( - 'label' => t('External'), + 'label' => t('Discover'), 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), 'sel'=> $public_active, 'title'=> t('Imported public streams'), -- cgit v1.2.3 From fc5f3f480092f6c9d48db45230ed99ece97e5ccf Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 28 Mar 2014 15:58:58 -0700 Subject: externals/discover: try up to 3 times to find a site that actually has content. Then give up until the next queue run. --- include/externals.php | 77 +++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 290f93a68..2ae78c11a 100644 --- a/include/externals.php +++ b/include/externals.php @@ -9,51 +9,56 @@ function externals_run($argv, $argc){ cli_startup(); $a = get_app(); + + $total = 0; + $attempts = 0; // pull in some public posts - $arr = array('url' => ''); - call_hooks('externals_url_select',$arr); - - if($arr['url']) { - $url = $arr['url']; - } - else { - $r = q("select site_url from site where site_url != '%s' and site_flags != %d order by rand() limit 1", - dbesc(z_root()), - intval(DIRECTORY_MODE_STANDALONE) - ); - if($r) - $url = $r[0]['site_url']; - } - if($url) { - logger('externals: pulling public content from ' . $url, LOGGER_DEBUG); - $days = get_config('externals','since_days'); - if($days === false) - $days = 15; - - $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); - - logger('externals: pulling public content from ' . $feedurl, LOGGER_DEBUG); - $x = z_fetch_url($feedurl); - - if(($x) && ($x['success'])) { - $total = 0; - $j = json_decode($x['body'],true); - if($j['success'] && $j['messages']) { - $sys = get_sys_channel(); - foreach($j['messages'] as $message) { - $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), - array(array('hash' => $sys['xchan_hash'])), false, true); - $total ++; + while($total == 0 && $attempts < 3) { + $arr = array('url' => ''); + call_hooks('externals_url_select',$arr); + + if($arr['url']) { + $url = $arr['url']; + } + else { + $r = q("select site_url from site where site_url != '%s' and site_flags != %d order by rand() limit 1", + dbesc(z_root()), + intval(DIRECTORY_MODE_STANDALONE) + ); + if($r) + $url = $r[0]['site_url']; + } + + $attempts ++; + + if($url) { + $days = get_config('externals','since_days'); + if($days === false) + $days = 15; + + $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); + + logger('externals: pulling public content from ' . $feedurl, LOGGER_DEBUG); + $x = z_fetch_url($feedurl); + + if(($x) && ($x['success'])) { + $j = json_decode($x['body'],true); + if($j['success'] && $j['messages']) { + $sys = get_sys_channel(); + foreach($j['messages'] as $message) { + $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), + array(array('hash' => $sys['xchan_hash'])), false, true); + $total ++; + } + logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); } - logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); } } } - } if (array_search(__file__,get_included_files())===0){ -- cgit v1.2.3 From fedd19ec95bfe963ab19d9e55f184b8ffe9f0da0 Mon Sep 17 00:00:00 2001 From: Alexandre Hannud Abdo Date: Sat, 29 Mar 2014 23:20:43 -0300 Subject: Let the site admin choose whether to display the Discover tab. --- include/conversation.php | 21 +++++++++++---------- include/poller.php | 3 ++- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index ac1b4e456..342392398 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1382,14 +1382,17 @@ function network_tabs() { $cmd = $a->cmd; // tabs - $tabs = array( - array( - 'label' => t('Discover'), - 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel'=> $public_active, - 'title'=> t('Imported public streams'), - ), + $tabs = array(); + + if(get_config('system','discover_tab')) + $tabs[] = array( + 'label' => t('Discover'), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), + 'sel'=> $public_active, + 'title'=> t('Imported public streams'), + ); + array_push($tabs, array( 'label' => t('Commented Order'), 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), @@ -1402,7 +1405,6 @@ function network_tabs() { 'sel'=>$postord_active, 'title' => t('Sort by Post Date'), ), - array( 'label' => t('Personal'), 'url' => $a->get_baseurl(true) . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&conv=1', @@ -1414,8 +1416,7 @@ function network_tabs() { 'url' => $a->get_baseurl(true) . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&new=1' . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), 'sel' => $new_active, 'title' => t('Activity Stream - by date'), - ), - + ) ); if(feature_enabled(local_user(),'star_posts')) diff --git a/include/poller.php b/include/poller.php index 19037ef17..0eb161862 100644 --- a/include/poller.php +++ b/include/poller.php @@ -169,7 +169,8 @@ function poller_run($argv, $argc){ // pull in some public posts - proc_run('php','include/externals.php'); + if(get_config('system','discover_tab')) + proc_run('php','include/externals.php'); $manual_id = 0; -- cgit v1.2.3 From 1108eaaed0cf451668dcaf04bd532a3615724dbc Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 29 Mar 2014 21:53:50 -0700 Subject: source routing stuff --- include/items.php | 34 ++++++++++++++++++++++++++++++++++ include/zot.php | 3 +++ 2 files changed, 37 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index dcf9f5bc2..71e89e1e2 100755 --- a/include/items.php +++ b/include/items.php @@ -81,6 +81,18 @@ function collect_recipients($item,&$private) { $recipients = check_list_permissions($item['uid'],$recipients,'view_stream'); + $routes = q("select * from route where iid = %d", + intval($item['id']) + ); + + if($routes) { + $route = explode(',',$routes[0]['route']); + if(count($route)) { + $route = array_unique($route); + $recipients = array_diff($recipients,$route); + } + } + // add ourself just in case we have nomadic clones that need to get a copy. $recipients[] = $item['author_xchan']; @@ -141,6 +153,28 @@ function can_comment_on_post($observer_xchan,$item) { } +function add_source_route($iid,$hash) { + if((! $iid) || (! $route)) + return; + $r = q("select * from route where iid = %d limit 1", + intval($iid) + ); + if($r && $r[0]['route']) { + q("update route set route = '%s' where iid = %d limit 1", + dbesc(',' . $hash), + intval($iid) + ); + } + else { + q("insert into route ( iid, route ) values ( %d, '%s') ", + intval($iid), + dbesc($route) + ); + } +} + + + /** * @function red_zrl_callback * preg_match function when fixing 'naked' links in mod item.php diff --git a/include/zot.php b/include/zot.php index b23c18bdb..48240d5aa 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1452,6 +1452,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { } $xyz = event_store($ev); + add_source_route($xyz,$sender['hash']); $result = array($d['hash'],'event processed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); continue; @@ -1476,6 +1477,8 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $arr['uid'] = $channel['channel_id']; $item_result = item_store($arr); $item_id = $item_result['item_id']; + add_source_route($item_id,$sender['hash']); + $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); } -- cgit v1.2.3 From 0b7588b1eb61053a92c71046a12c169300b7fff4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 29 Mar 2014 23:43:31 -0700 Subject: issue #384 --- include/conversation.php | 63 +++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 342392398..294c7e3e3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1384,58 +1384,65 @@ function network_tabs() { // tabs $tabs = array(); - if(get_config('system','discover_tab')) + if(get_config('system','discover_tab')) { $tabs[] = array( - 'label' => t('Discover'), - 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel'=> $public_active, - 'title'=> t('Imported public streams'), - ); + 'label' => t('Discover'), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), + 'sel'=> $public_active, + 'title'=> t('Imported public streams'), + ); + } - array_push($tabs, - array( - 'label' => t('Commented Order'), - 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel'=>$all_active, - 'title'=> t('Sort by Comment Date'), - ), - array( - 'label' => t('Posted Order'), - 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), - 'sel'=>$postord_active, - 'title' => t('Sort by Post Date'), - ), - array( + $tabs[] = array( + 'label' => t('Commented Order'), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), + 'sel'=>$all_active, + 'title'=> t('Sort by Comment Date'), + ); + + $tabs[] = array( + 'label' => t('Posted Order'), + 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), + 'sel'=>$postord_active, + 'title' => t('Sort by Post Date'), + ); + + if(feature_enabled(local_user(),'personal_tab')) { + $tabs[] = array( 'label' => t('Personal'), 'url' => $a->get_baseurl(true) . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&conv=1', 'sel' => $conv_active, 'title' => t('Posts that mention or involve you'), - ), - array( + ); + } + + if(feature_enable(local_user(),'new_tab')) { + $tabs[] = array( 'label' => t('New'), 'url' => $a->get_baseurl(true) . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&new=1' . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), 'sel' => $new_active, 'title' => t('Activity Stream - by date'), - ) - ); + ); + } - if(feature_enabled(local_user(),'star_posts')) + if(feature_enabled(local_user(),'star_posts')) { $tabs[] = array( 'label' => t('Starred'), 'url'=>$a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1', 'sel'=>$starred_active, 'title' => t('Favourite Posts'), ); - + } // Not yet implemented - if(feature_enabled(local_user(),'spam_filter')) + if(feature_enabled(local_user(),'spam_filter')) { $tabs[] = array( 'label' => t('Spam'), 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1', 'sel'=> $spam_active, 'title' => t('Posts flagged as SPAM'), - ); + ); + } $arr = array('tabs' => $tabs); call_hooks('network_tabs', $arr); -- cgit v1.2.3 From 9e5f4243941f3e7f3290698d1072895c1019d917 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 29 Mar 2014 23:45:21 -0700 Subject: typo --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 294c7e3e3..a6e81dd7f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1416,7 +1416,7 @@ function network_tabs() { ); } - if(feature_enable(local_user(),'new_tab')) { + if(feature_enabled(local_user(),'new_tab')) { $tabs[] = array( 'label' => t('New'), 'url' => $a->get_baseurl(true) . '/' . $cmd . '?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&new=1' . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), -- cgit v1.2.3 From 1093e8d83efeabc7f4154ce04b5f7f554b9957e5 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 30 Mar 2014 22:59:37 +0100 Subject: Default discover to on. --- include/conversation.php | 2 +- include/poller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index a6e81dd7f..af41e8fa7 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1384,7 +1384,7 @@ function network_tabs() { // tabs $tabs = array(); - if(get_config('system','discover_tab')) { + if(! get_config('system','disable_discover_tab')) { $tabs[] = array( 'label' => t('Discover'), 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&fh=1' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'gid')) ? '&gid=' . $_GET['gid'] : ''), diff --git a/include/poller.php b/include/poller.php index 0eb161862..9592c29e4 100644 --- a/include/poller.php +++ b/include/poller.php @@ -169,7 +169,7 @@ function poller_run($argv, $argc){ // pull in some public posts - if(get_config('system','discover_tab')) + if(! get_config('system','disable_discover_tab')) proc_run('php','include/externals.php'); -- cgit v1.2.3 From b00478d3b5e6d12e2c726fbdde931b5e64ad5da9 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Mar 2014 15:01:51 -0700 Subject: revise the sandbox --- include/bbcode.php | 2 +- include/oembed.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index c8d1ab425..6f6e43568 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -234,7 +234,7 @@ function bbiframe($match) { // if(strpos($match[1],get_app()->get_hostname())) // return '' . $match[1] . ''; - return ''; + return ''; } function bb_ShareAttributesSimple($match) { diff --git a/include/oembed.php b/include/oembed.php index 46b1d72c4..691ef48fd 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -165,7 +165,7 @@ function oembed_iframe($src,$width,$height) { $a = get_app(); $s = $a->get_baseurl()."/oembed/".base64url_encode($src); - return ''; + return ''; } -- cgit v1.2.3 From 653d7df86df781d50e1bc4b3ed61468563629df2 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Mar 2014 20:53:59 -0700 Subject: issue #378, failure to correctly link tags where one tag contains a substring of the other (depends on the order they are discovered). --- include/items.php | 1 + include/text.php | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index dcf9f5bc2..cf2bdd4f3 100755 --- a/include/items.php +++ b/include/items.php @@ -2294,6 +2294,7 @@ function tag_deliver($uid,$item_id) { logger('tag_deliver: community tag activity received'); if(($item['owner_xchan'] === $u[0]['channel_hash']) && (! get_pconfig($u[0]['channel_id'],'system','blocktags'))) { + logger('tag_deliver: community tag recipient: ' . $u[0]['channel_name']); $j_tgt = json_decode_plus($item['target']); if($j_tgt && $j_tgt['id']) { $p = q("select * from item where mid = '%s' and uid = %d limit 1", diff --git a/include/text.php b/include/text.php index e3b1f1c4e..d549f206e 100755 --- a/include/text.php +++ b/include/text.php @@ -619,12 +619,28 @@ function get_tags($s) { } } + // make sure the longer tags are returned first so that if two or more have common substrings + // we'll replace the longest ones first. Otherwise the common substring would be found in + // both strings and the string replacement would link both to the shorter strings and + // fail to link the longer string. RedMatrix github issue #378 + + usort($ret,'tag_sort_length'); - // logger('get_tags: ' . print_r($ret,true)); + + //logger('get_tags: ' . print_r($ret,true)); return $ret; } +function tag_sort_length($a,$b) { + if(mb_strlen($a) == mb_strlen($b)) + return 0; + return((mb_strlen($b) < mb_strlen($a)) ? (-1) : 1); +} + + + + function strip_zids($s) { return preg_replace('/[\?&]zid=(.*?)(&|$)/ism','$2',$s); -- cgit v1.2.3 From 04d9187c7ac63b5af3f63ed8d04e737e5801d0e1 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 15:04:56 -0700 Subject: photo timestamp was missing from main profile photo url which prevents photo changes from being immediately seen there. --- include/identity.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 97c29516c..eb0ba230b 100644 --- a/include/identity.php +++ b/include/identity.php @@ -547,12 +547,20 @@ function profile_load(&$a, $nickname, $profile = '') { ); } + if(! $p) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice( t('Requested profile is not available.') . EOL ); $a->error = 404; return; } + + $z = q("select xchan_photo_date from xchan where xchan_hash = '%s' limit 1", + dbesc($p[0]['channel_hash']) + ); + if($z) + $p[0]['picdate'] = $z[0]['xchan_photo_date']; + // fetch user tags if this isn't the default profile -- cgit v1.2.3 From 57a9ba4574e61a803c0a732135fe457733901850 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 15:56:58 -0700 Subject: this is a mess and makes a complicated security model that one can probably drive a truck through. It will have to be fixed. It does make youtubes work again. --- include/bbcode.php | 7 +++---- include/oembed.php | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 6f6e43568..96242fdac 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -230,11 +230,10 @@ function bb_location($match) { function bbiframe($match) { $a = get_app(); - // use sandbox mode to prevent malicious goings on rather than host restriction - // if(strpos($match[1],get_app()->get_hostname())) - // return '' . $match[1] . ''; - return ''; + $sandbox = ((strpos($match[1],get_app()->get_hostname())) ? ' sandbox="allow-scripts" ' : ''); + + return ''; } function bb_ShareAttributesSimple($match) { diff --git a/include/oembed.php b/include/oembed.php index 691ef48fd..42a9881ed 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -164,8 +164,11 @@ function oembed_iframe($src,$width,$height) { $a = get_app(); + $sandbox = ((strpos($src,get_app()->get_hostname())) ? ' sandbox="allow-scripts" ' : ''); + $s = $a->get_baseurl()."/oembed/".base64url_encode($src); - return ''; + + return ''; } -- cgit v1.2.3 From ced6d826334c3d4979c296bb292fbc393cc6a034 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 16:25:05 -0700 Subject: finish up the source route storage so we can prevent messages from flowing upstream in complicated delivery chains --- include/items.php | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 71e89e1e2..b60c0c2f1 100755 --- a/include/items.php +++ b/include/items.php @@ -81,12 +81,8 @@ function collect_recipients($item,&$private) { $recipients = check_list_permissions($item['uid'],$recipients,'view_stream'); - $routes = q("select * from route where iid = %d", - intval($item['id']) - ); - - if($routes) { - $route = explode(',',$routes[0]['route']); + if($item['route']) { + $route = explode(',',$item['route']); if(count($route)) { $route = array_unique($route); $recipients = array_diff($recipients,$route); @@ -156,21 +152,16 @@ function can_comment_on_post($observer_xchan,$item) { function add_source_route($iid,$hash) { if((! $iid) || (! $route)) return; - $r = q("select * from route where iid = %d limit 1", + $r = q("select route from item where id = %d limit 1", intval($iid) ); - if($r && $r[0]['route']) { - q("update route set route = '%s' where iid = %d limit 1", - dbesc(',' . $hash), + if($r) { + $new_route = (($r[0]['route']) ? $r[0]['route'] . ',' : '') . $hash; + q("update item set route = '%s' where id = %d limit 1", + (dbesc($new_route)), intval($iid) ); } - else { - q("insert into route ( iid, route ) values ( %d, '%s') ", - intval($iid), - dbesc($route) - ); - } } @@ -670,6 +661,7 @@ function get_item_elements($x) { $arr['app'] = (($x['app']) ? htmlspecialchars($x['app'], ENT_COMPAT,'UTF-8',false) : ''); + $arr['route'] = (($x['route']) ? htmlspecialchars($x['route'], ENT_COMPAT,'UTF-8',false) : ''); $arr['mid'] = (($x['message_id']) ? htmlspecialchars($x['message_id'], ENT_COMPAT,'UTF-8',false) : ''); $arr['parent_mid'] = (($x['message_top']) ? htmlspecialchars($x['message_top'], ENT_COMPAT,'UTF-8',false) : ''); $arr['thr_parent'] = (($x['message_parent']) ? htmlspecialchars($x['message_parent'], ENT_COMPAT,'UTF-8',false) : ''); @@ -681,7 +673,7 @@ function get_item_elements($x) { $arr['mimetype'] = (($x['mimetype']) ? htmlspecialchars($x['mimetype'], ENT_COMPAT,'UTF-8',false) : ''); $arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts'); + $arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts'); $arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : ''); @@ -870,6 +862,7 @@ function encode_item($item) { $x['location'] = $item['location']; $x['longlat'] = $item['coord']; $x['signature'] = $item['sig']; + $x['route'] = $item['route']; $x['owner'] = encode_item_xchan($item['owner']); $x['author'] = encode_item_xchan($item['author']); -- cgit v1.2.3 From 421df717fecba69a952167ceb8cb4e58f0b4db39 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 16:29:46 -0700 Subject: doco --- include/items.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index b60c0c2f1..3c7732b28 100755 --- a/include/items.php +++ b/include/items.php @@ -81,6 +81,11 @@ function collect_recipients($item,&$private) { $recipients = check_list_permissions($item['uid'],$recipients,'view_stream'); + // remove any upstream recipients from our list. + // If it is ourself we'll add it back in a second. + // This should prevent complex delivery chains from getting overly complex by not + // sending to anybody who is on our list of those who sent it to us. + if($item['route']) { $route = explode(',',$item['route']); if(count($route)) { -- cgit v1.2.3 From 93f90040a12cdf7ba70d16773b36a29afa5ad83a Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 17:03:07 -0700 Subject: community tags don't show up in the tagged posts because we removed the displayed list of hashtags at the bottom (which are usually redundant since hashtags are usually present in the message text). This brings them back, but only for tags which aren't currently present in the message body (e.g. community tags) --- include/items.php | 1 + include/text.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index ec324b6a3..f1778e722 100755 --- a/include/items.php +++ b/include/items.php @@ -2339,6 +2339,7 @@ function tag_deliver($uid,$item_id) { if($j_obj && $j_obj['id'] && $j_obj['title']) { if(is_array($j_obj['link'])) $taglink = get_rel_link($j_obj['link'],'alternate'); + store_item_tag($u[0]['channel_id'],$p[0]['id'],TERM_OBJ_POST,TERM_HASHTAG,$j_obj['title'],$j_obj['id']); $x = q("update item set edited = '%s', received = '%s', changed = '%s' where mid = '%s' and uid = %d limit 1", dbesc(datetime_convert()), diff --git a/include/text.php b/include/text.php index d549f206e..95e59c54c 100755 --- a/include/text.php +++ b/include/text.php @@ -1190,6 +1190,33 @@ function format_categories(&$item,$writeable) { return $s; } +// Add any hashtags which weren't mentioned in the message body, e.g. community tags + +function format_hashtags(&$item) { + + $s = ''; + $terms = get_terms_oftype($item['term'],TERM_HASHTAG); + if($terms) { + $categories = array(); + foreach($terms as $t) { + $term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8',false) ; + if(! trim($term)) + continue; + if(strpos($item['body'], $t['url'])) + continue; + + if($s) + $s .= ' '; + + $s .= '#' . $term . ''; + } + } + return $s; +} + + + + function format_filer(&$item) { @@ -1242,6 +1269,9 @@ function prepare_body(&$item,$attach = false) { $writeable = ((get_observer_hash() == $item['owner_xchan']) ? true : false); + + $s .= format_hashtags($item); + $s .= format_categories($item,$writeable); if(local_user() == $item['uid']) -- cgit v1.2.3 From 8ffdccb99ff67ea752c8880b859ef8b9f21be585 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 17:14:56 -0700 Subject: crank up logging --- include/items.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index f1778e722..0384352ba 100755 --- a/include/items.php +++ b/include/items.php @@ -155,6 +155,8 @@ function can_comment_on_post($observer_xchan,$item) { function add_source_route($iid,$hash) { + logger('add_source_route ' . $iid . ' ' . $hash, LOGGER_DEBUG); + if((! $iid) || (! $route)) return; $r = q("select route from item where id = %d limit 1", -- cgit v1.2.3 From 78d7425a1d9de91343c60be1d0f0a467a674d84d Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 31 Mar 2014 17:21:16 -0700 Subject: wrong var name in add_source_route --- include/items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 0384352ba..af0d4d297 100755 --- a/include/items.php +++ b/include/items.php @@ -155,9 +155,9 @@ function can_comment_on_post($observer_xchan,$item) { function add_source_route($iid,$hash) { - logger('add_source_route ' . $iid . ' ' . $hash, LOGGER_DEBUG); +// logger('add_source_route ' . $iid . ' ' . $hash, LOGGER_DEBUG); - if((! $iid) || (! $route)) + if((! $iid) || (! $hash)) return; $r = q("select route from item where id = %d limit 1", intval($iid) -- cgit v1.2.3 From f4dd8657cb8fc085c055ee2632188a965b17dc13 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 1 Apr 2014 19:36:56 +0100 Subject: Let admins set a default expire days value. --- include/identity.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index eb0ba230b..d15f3861e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -224,10 +224,13 @@ function create_identity($arr) { $perms_vals .= ', ' . intval($v); } + $expire = get_config('system', 'default_expire_days'); + $expire = (($expire===false)? '0': $expire); + $r = q("insert into channel ( channel_account_id, channel_primary, channel_name, channel_address, channel_guid, channel_guid_sig, - channel_hash, channel_prvkey, channel_pubkey, channel_pageflags $perms_keys ) - values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d $perms_vals ) ", + channel_hash, channel_prvkey, channel_pubkey, channel_pageflags, channel_expire_days $perms_keys ) + values ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d $perms_vals ) ", intval($arr['account_id']), intval($primary), @@ -238,7 +241,8 @@ function create_identity($arr) { dbesc($hash), dbesc($key['prvkey']), dbesc($key['pubkey']), - intval($pageflags) + intval($pageflags), + intval($expire) ); -- cgit v1.2.3 From 27fec9cb6460a897098bde11b15a9543d09562db Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Apr 2014 15:13:50 -0700 Subject: more efficient public feed fetching --- include/externals.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 2ae78c11a..95ced24bf 100644 --- a/include/externals.php +++ b/include/externals.php @@ -25,7 +25,7 @@ function externals_run($argv, $argc){ $url = $arr['url']; } else { - $r = q("select site_url from site where site_url != '%s' and site_flags != %d order by rand() limit 1", + $r = q("select site_url, site_pull from site where site_url != '%s' and site_flags != %d order by rand() limit 1", dbesc(z_root()), intval(DIRECTORY_MODE_STANDALONE) ); @@ -36,16 +36,27 @@ function externals_run($argv, $argc){ $attempts ++; if($url) { - $days = get_config('externals','since_days'); - if($days === false) - $days = 15; + if($r[0]['site_pull'] !== '0000-00-00 00:00:00') + $mindate = urlencode($r[0]['site_pull']); + else { + $days = get_config('externals','since_days'); + if($days === false) + $days = 15; + $mindate = urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); + } - $feedurl = $url . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - ' . intval($days) . ' days')); + $feedurl = $url . '/zotfeed?f=&mindate=' . $mindate; logger('externals: pulling public content from ' . $feedurl, LOGGER_DEBUG); - $x = z_fetch_url($feedurl); + $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { + + q("update site set site_pull = '%s' where site_url = '%s limit 1", + dbesc(datetime_convert()), + dbesc($url) + ); + $j = json_decode($x['body'],true); if($j['success'] && $j['messages']) { $sys = get_sys_channel(); -- cgit v1.2.3 From d68b202cad520db4c95b544bb08a9130fd263606 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Apr 2014 16:26:39 -0700 Subject: start of legacy probe utility --- include/probe.php | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 include/probe.php (limited to 'include') diff --git a/include/probe.php b/include/probe.php new file mode 100644 index 000000000..29635f963 --- /dev/null +++ b/include/probe.php @@ -0,0 +1,99 @@ + Date: Fri, 4 Apr 2014 16:56:49 -0700 Subject: introduce a connection type called 'ifpending' for number 6 of issue #395 - so that we can still have an unconditional 'pending' link. Needs testing before integrating with the nav menu --- include/nav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/nav.php b/include/nav.php index 3aa50226d..6a28ebe93 100644 --- a/include/nav.php +++ b/include/nav.php @@ -162,7 +162,7 @@ EOT; $nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '',''); - $nav['intros'] = array('connections/pending', t('Intros'), "", t('New Connections')); + $nav['intros'] = array('connections/pending', t('Connections'), "", t('Connections')); $nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications')); -- cgit v1.2.3 From 32e71cf06b7471923dec37b613da3a044f51f28d Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 4 Apr 2014 17:43:44 -0700 Subject: finish "ifpending" connections --- include/nav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/nav.php b/include/nav.php index 6a28ebe93..a97b434bc 100644 --- a/include/nav.php +++ b/include/nav.php @@ -162,7 +162,7 @@ EOT; $nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '',''); - $nav['intros'] = array('connections/pending', t('Connections'), "", t('Connections')); + $nav['intros'] = array('connections/ifpending', t('Connections'), "", t('Connections')); $nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications')); -- cgit v1.2.3 From 4901ef8faf743fd7fef97fc75a1c727804bf3df5 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 5 Apr 2014 02:32:07 -0700 Subject: provide the ability for rpost to post as another of your channels. This does not yet work, so the functionality has not been enabled. --- include/conversation.php | 9 +++++++++ include/identity.php | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index af41e8fa7..880639bf4 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1052,6 +1052,13 @@ function status_editor($a,$x,$popup=false) { } + if(array_key_exists('channel_select',$x) && $x['channel_select']) { + require_once('include/identity.php'); + $id_select = identity_selector(); + } + else + $id_select = ''; + $webpage = ((x($x,'webpage')) ? $x['webpage'] : ''); @@ -1098,6 +1105,8 @@ function status_editor($a,$x,$popup=false) { '$webpage' => $webpage, '$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link title')), '$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''), + '$id_select' => $id_select, + '$id_seltext' => t('Post as'), '$upload' => t('Upload photo'), '$shortupload' => t('upload photo'), '$attach' => t('Attach file'), diff --git a/include/identity.php b/include/identity.php index d15f3861e..e773bb314 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1257,3 +1257,24 @@ function get_channel_by_nick($nick) { return(($r) ? $r[0] : false); } + + +function identity_selector() { + if(local_user()) { + $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and not ( channel_pageflags & %d ) order by channel_name ", + intval(get_account_id()), + intval(PAGE_REMOVED) + ); + if(count($r) > 1) { + $selected_channel = null; + $account = get_app()->get_account(); + $o = replace_macros(get_markup_template('channel_id_select.tpl'),array( + '$channels' => $r, + '$selected' => local_user() + )); + return $o; + } + } + + return ''; +} \ No newline at end of file -- cgit v1.2.3 From a2b949f3393206ffe2e1195d6abaa883f299b471 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sat, 5 Apr 2014 22:55:38 +0100 Subject: Typo in externals SQL. --- include/externals.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 95ced24bf..e7e9504a0 100644 --- a/include/externals.php +++ b/include/externals.php @@ -52,7 +52,7 @@ function externals_run($argv, $argc){ $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { - q("update site set site_pull = '%s' where site_url = '%s limit 1", + q("update site set site_pull = '%s' where site_url = '%s' limit 1", dbesc(datetime_convert()), dbesc($url) ); -- cgit v1.2.3 From 9f54a8f96b7664c82ab9228608970a7ce6bd41a9 Mon Sep 17 00:00:00 2001 From: sasiflo Date: Sun, 6 Apr 2014 00:34:52 +0200 Subject: Hope I have repaired the channel admin page. Channel blocking and deleting was copied from user actions. This was not done to an end. Hope what I do is enough to enable channel blocking and deleting the correct way. On deletion all entities that belong to the channel are deleted. But the channel itself is just marked as deleted. Do not really understand why it is done this way. --- include/Contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/Contact.php b/include/Contact.php index 9883c598d..540e1169d 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -263,7 +263,7 @@ function channel_remove($channel_id, $local = true) { q("DELETE FROM `event` WHERE `uid` = %d", intval($channel_id)); q("DELETE FROM `item` WHERE `uid` = %d", intval($channel_id)); q("DELETE FROM `item_id` WHERE `uid` = %d", intval($channel_id)); - q("DELETE FROM `mail` WHERE `uid` = %d", intval($channel_id)); + q("DELETE FROM `mail` WHERE `channel_id` = %d", intval($channel_id)); q("DELETE FROM `notify` WHERE `uid` = %d", intval($channel_id)); q("DELETE FROM `photo` WHERE `uid` = %d", intval($channel_id)); q("DELETE FROM `attach` WHERE `uid` = %d", intval($channel_id)); -- cgit v1.2.3 From ad60e2c566930409d853517ca9392f169fc8e747 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 Apr 2014 02:57:33 -0700 Subject: use parent_mid in the parent query for enotify instead of of the parent id. This should fix the issue with encrypted content in the notification messages (for locally posted replies). The fix was a bit harder than anticipated because we store the parent id as an int in the notify table so this had to be modified to char storage as well. --- include/enotify.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index 96a152d31..5be21f180 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -102,7 +102,7 @@ function notification($params) { if(array_key_exists('item',$params) && (! visible_activity($params['item']))) return; - $parent_id = $params['parent']; + $parent_mid = $params['parent_mid']; // Check to see if there was already a notify for this post. // If so don't create a second notification @@ -123,9 +123,9 @@ function notification($params) { $p = null; - if($params['otype'] === 'item' && $parent_id) { - $p = q("select * from item where id = %d and uid = %d limit 1", - intval($parent_id), + if($params['otype'] === 'item' && $parent_mid) { + $p = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($parent_mid), intval($recip['channel_id']) ); } @@ -135,6 +135,7 @@ function notification($params) { $item_post_type = item_post_type($p[0]); $private = $p[0]['item_private']; + $parent_id = $p[0]['id']; //$possess_desc = str_replace('',$possess_desc); @@ -338,7 +339,7 @@ function notification($params) { $datarray['aid'] = $recip['channel_account_id']; $datarray['uid'] = $recip['channel_id']; $datarray['link'] = $itemlink; - $datarray['parent'] = $parent_id; + $datarray['parent'] = $parent_mid; $datarray['type'] = $params['type']; $datarray['verb'] = $params['verb']; $datarray['otype'] = $params['otype']; @@ -355,7 +356,7 @@ function notification($params) { // create notification entry in DB $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,type,verb,otype) - values('%s','%s','%s','%s','%s',%d,%d,'%s',%d,%d,'%s','%s')", + values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,'%s','%s')", dbesc($datarray['hash']), dbesc($datarray['name']), dbesc($datarray['url']), @@ -364,7 +365,7 @@ function notification($params) { intval($datarray['aid']), intval($datarray['uid']), dbesc($datarray['link']), - intval($datarray['parent']), + dbesc($datarray['parent']), intval($datarray['type']), dbesc($datarray['verb']), dbesc($datarray['otype']) @@ -432,7 +433,7 @@ function notification($params) { $datarray['sitename'] = $sitename; $datarray['siteurl'] = $siteurl; $datarray['type'] = $params['type']; - $datarray['parent'] = $params['parent']; + $datarray['parent'] = $params['parent_mid']; $datarray['source_name'] = $sender['xchan_name']; $datarray['source_link'] = $sender['xchan_url']; $datarray['source_photo'] = $sender['xchan_photo_s']; -- cgit v1.2.3 From 64dfe3ab64a7f39c2c88d141a7d8a8b9d60756ff Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 Apr 2014 03:47:53 -0700 Subject: issue #395, item 2 --- include/conversation.php | 6 ++++-- include/reddav.php | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 880639bf4..149da3ac7 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1472,6 +1472,8 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ if (is_null($nickname)) $nickname = $channel['channel_address']; + + $uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_user()); if(x($_GET,'tab')) $tab = notags(trim($_GET['tab'])); @@ -1489,7 +1491,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ ), ); - $p = get_all_perms($a->profile['profile_uid'],get_observer_hash()); + $p = get_all_perms($uid,get_observer_hash()); if($p['view_profile']) { $tabs[] = array( @@ -1550,7 +1552,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ } - if($is_owner && feature_enabled($a->profile['profile_uid'],'webpages')) { + if($is_owner && feature_enabled($uid,'webpages')) { $tabs[] = array( 'label' => t('Webpages'), 'url' => $a->get_baseurl() . '/webpages/' . $nickname, diff --git a/include/reddav.php b/include/reddav.php index b7bb94fa0..7c14ca472 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -884,8 +884,12 @@ class RedBrowser extends DAV\Browser\Plugin { date_default_timezone_set($this->auth->timezone); $version = ''; + require_once('include/conversation.php'); - $html = " + if($this->auth->channel_name) + $html = profile_tabs(get_app(),(($this->auth->channel_id == local_user()) ? true : false),$this->auth->channel_name); + + $html .= "

Index for " . $this->escapeHTML($path) . "/

-- cgit v1.2.3 From f7cb4e0ef0b6d40427858810404ad9caedb27ae3 Mon Sep 17 00:00:00 2001 From: marijus Date: Sun, 6 Apr 2014 21:14:24 +0200 Subject: jot and location style fixes --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 149da3ac7..df3f5f03c 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1296,7 +1296,7 @@ function render_location_default($item) { if($coord) { if($location) - $location .= '
(' . $coord . ')'; + $location .= ' (' . $coord . ')'; else $location = '' . $coord . ''; } -- cgit v1.2.3 From 6f555c50e110235d125645113a58d1a2fda2eee8 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 Apr 2014 18:40:37 -0700 Subject: a bit more work towards issue #395 - cleaning up some cases which were going to the url directly and which weren't going through chanview. Also worth noting - mentions in posts do not go through chanview. Perhaps it is time to kill chanview (except we then cannot implemented a "connected" or "connect" button since we don't have any control over the landing page). For the time being I'm just trying to trap as many of the "visit URL" links as possible and sending them to a common place. Then we can figure out how that common place should behave. --- include/conversation.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index df3f5f03c..e5cd3358f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -911,7 +911,7 @@ function item_photo_menu($item){ } } - $profile_link = z_root() . "/chanview/?f=&hash=" . $item['author_xchan']; + $profile_link = chanlink_hash($item['author_xchan']); $pm_url = $a->get_baseurl($ssl_state) . '/mail/new/?f=&hash=' . $item['author_xchan']; if($a->contacts && array_key_exists($item['author_xchan'],$a->contacts)) @@ -964,13 +964,7 @@ function like_puller($a,$item,&$arr,$mode) { $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE); if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) { - $url = $item['author']['xchan_url']; - if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { - $url = $a->get_baseurl(true) . '/redir/' . $item['contact-id']; - $sparkle = ' class="sparkle" '; - } - else - $url = zid($url); + $url = chanlink_url($item['author']['xchan_url']); if(! $item['thr_parent']) $item['thr_parent'] = $item['parent_mid']; @@ -981,7 +975,7 @@ function like_puller($a,$item,&$arr,$mode) { $arr[$item['thr_parent']] = 1; else $arr[$item['thr_parent']] ++; - $arr[$item['thr_parent'] . '-l'][] = '' . $item['author']['xchan_name'] . ''; + $arr[$item['thr_parent'] . '-l'][] = '' . $item['author']['xchan_name'] . ''; } return; } -- cgit v1.2.3 From 28b7eedc45695021e96af6112dab20195b118873 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 Apr 2014 19:59:00 -0700 Subject: check_webbie (webbie validator) returning bad webbies --- include/text.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 95e59c54c..48a7ed368 100755 --- a/include/text.php +++ b/include/text.php @@ -1763,6 +1763,7 @@ function check_webbie($arr) { $str .= "'" . dbesc($y) . "'"; } } + if(strlen($str)) { $r = q("select channel_address from channel where channel_address in ( $str ) "); if(count($r)) { @@ -1771,8 +1772,9 @@ function check_webbie($arr) { } } foreach($arr as $x) { - if(! in_array($x,$taken)) { - return $x; + $y = legal_webbie($x); + if(! in_array($y,$taken)) { + return $y; } } } -- cgit v1.2.3 From 10167fdf515e69c4645da9b0a020d0594c7a55a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Apr 2014 02:55:00 -0700 Subject: prevent follows of and notifications to deceased channels --- include/enotify.php | 5 +++-- include/follow.php | 6 ++++++ include/zot.php | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/enotify.php b/include/enotify.php index 5be21f180..7ab4fe5ed 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -18,8 +18,9 @@ function notification($params) { } if($params['to_xchan']) { $y = q("select channel.*, account.* from channel left join account on channel_account_id = account_id - where channel_hash = '%s' limit 1", - dbesc($params['to_xchan']) + where channel_hash = '%s' and not (channel_pageflags & %d) limit 1", + dbesc($params['to_xchan']), + intval(PAGE_REMOVED) ); } if($x & $y) { diff --git a/include/follow.php b/include/follow.php index 0508a8b37..d98a58198 100644 --- a/include/follow.php +++ b/include/follow.php @@ -75,11 +75,17 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) return $result; } + // do we have an xchan and hubloc? // If not, create them. $x = import_xchan($j); + if(array_key_exists('deleted',$j) && intval($j['deleted'])) { + $result['message'] = t('Channel was deleted and no longer exists.'); + return $result; + } + if(! $x['success']) return $x; diff --git a/include/zot.php b/include/zot.php index 48240d5aa..45df09661 100644 --- a/include/zot.php +++ b/include/zot.php @@ -632,6 +632,13 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { if($adult_changed) $new_flags = $new_flags ^ XCHAN_FLAGS_SELFCENSORED; + $deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false); + $deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false); + if($deleted_changed) + $new_flags = $new_flags ^ XCHAN_FLAGS_DELETED; + + + if(($r[0]['xchan_name_date'] != $arr['name_updated']) || ($r[0]['xchan_connurl'] != $arr['connections_url']) @@ -676,6 +683,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { $new_flags = 0; if($arr['adult_content']) $new_flags |= XCHAN_FLAGS_SELFCENSORED; + if($arr['deleted']) + $new_flags |= XCHAN_FLAGS_DELETED; $x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype, xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags) -- cgit v1.2.3 From 7e160a7b048c50a8b7c7a7e6e99687bbedcb3487 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Apr 2014 13:13:00 -0700 Subject: undo one of yesterday's changes - if a channel was deleted we want to mark the hubloc deleted - but not the xchan. The channel might be alive at another hubloc. We should only mark the xchan deleted when removing a channel from the entire network - e.g. there are no hubs left to service it. --- include/zot.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index 45df09661..490d63798 100644 --- a/include/zot.php +++ b/include/zot.php @@ -632,10 +632,10 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { if($adult_changed) $new_flags = $new_flags ^ XCHAN_FLAGS_SELFCENSORED; - $deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false); - $deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false); - if($deleted_changed) - $new_flags = $new_flags ^ XCHAN_FLAGS_DELETED; +// $deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false); +// $deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false); +// if($deleted_changed) +// $new_flags = $new_flags ^ XCHAN_FLAGS_DELETED; @@ -683,8 +683,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { $new_flags = 0; if($arr['adult_content']) $new_flags |= XCHAN_FLAGS_SELFCENSORED; - if($arr['deleted']) - $new_flags |= XCHAN_FLAGS_DELETED; +// if($arr['deleted']) +// $new_flags |= XCHAN_FLAGS_DELETED; $x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype, xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags) -- cgit v1.2.3 From 74029a9ee9b0dfdb98d88a3697beabfcd8ab29d0 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Apr 2014 16:10:43 -0700 Subject: this should be better - "xchan deleted" state on remote sites only follows the xchan_flags and not the channel_pageflags; XCHAN_FLAGS_DELETED should only be set if the channel is to be removed from the entire network. As mentioned in a previous commit, channel_pageflags could be set to PAGE_REMOVED but still leave living clones on other sites. --- include/zot.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index 490d63798..19512c1ec 100644 --- a/include/zot.php +++ b/include/zot.php @@ -632,13 +632,10 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { if($adult_changed) $new_flags = $new_flags ^ XCHAN_FLAGS_SELFCENSORED; -// $deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false); -// $deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false); -// if($deleted_changed) -// $new_flags = $new_flags ^ XCHAN_FLAGS_DELETED; - - - + $deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false); + $deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false); + if($deleted_changed) + $new_flags = $new_flags ^ XCHAN_FLAGS_DELETED; if(($r[0]['xchan_name_date'] != $arr['name_updated']) || ($r[0]['xchan_connurl'] != $arr['connections_url']) @@ -683,8 +680,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { $new_flags = 0; if($arr['adult_content']) $new_flags |= XCHAN_FLAGS_SELFCENSORED; -// if($arr['deleted']) -// $new_flags |= XCHAN_FLAGS_DELETED; + if(array_key_exists('deleted',$arr) && $arr['deleted']) + $new_flags |= XCHAN_FLAGS_DELETED; $x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype, xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags) -- cgit v1.2.3 From 03753f463e05c965a460e64efca9478efc0271c1 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Apr 2014 16:25:35 -0700 Subject: convert /network saved search to bootstrap buttons --- include/text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 48a7ed368..520c9c506 100755 --- a/include/text.php +++ b/include/text.php @@ -801,9 +801,9 @@ function searchbox($s,$id='search-box',$url='/search',$save = false) { $o .= '
'; $o .= ''; $o .= ''; - $o .= ''; + $o .= ''; if(feature_enabled(local_user(),'savedsearch')) - $o .= ''; + $o .= ''; $o .= ''; return $o; } -- cgit v1.2.3 From 95751dddff2b1b7a2074d37a5b3102f256842ae4 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Apr 2014 20:20:28 -0700 Subject: some fixes to #395 --- include/conversation.php | 2 +- include/reddav.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index e5cd3358f..8803e74e7 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1516,7 +1516,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ } require_once('include/chat.php'); - $chats = chatroom_list($a->profile['profile_uid']); + $chats = chatroom_list($uid); $subdued = ((count($chats)) ? '' : ' subdued'); $tabs[] = array( 'label' => t('Chatrooms'), diff --git a/include/reddav.php b/include/reddav.php index 7c14ca472..03cfe1aab 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -887,7 +887,7 @@ class RedBrowser extends DAV\Browser\Plugin { require_once('include/conversation.php'); if($this->auth->channel_name) - $html = profile_tabs(get_app(),(($this->auth->channel_id == local_user()) ? true : false),$this->auth->channel_name); + $html = profile_tabs(get_app(),(($this->auth->owner_id == local_user()) ? true : false),$this->auth->owner_nick); $html .= " -- cgit v1.2.3 From 9f621dac85c1c417b17d031e3ca2798c6b63ece7 Mon Sep 17 00:00:00 2001 From: marijus Date: Tue, 8 Apr 2014 22:07:06 +0200 Subject: change the way jot tools are displayed/hidden --- include/conversation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 8803e74e7..5a7e9e2cd 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1144,9 +1144,9 @@ function status_editor($a,$x,$popup=false) { '$source' => ((x($x,'source')) ? $x['source'] : ''), '$jotplugins' => $jotplugins, '$defexpire' => '', - '$feature_expire' => ((feature_enabled($x['profile_uid'],'content_expire') && (! $webpage)) ? 'block' : 'none'), + '$feature_expire' => ((feature_enabled($x['profile_uid'],'content_expire') && (! $webpage)) ? true : false), '$expires' => t('Set expiration date'), - '$feature_encrypt' => ((feature_enabled($x['profile_uid'],'content_encrypt') && (! $webpage)) ? 'block' : 'none'), + '$feature_encrypt' => ((feature_enabled($x['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false), '$encrypt' => t('Encrypt text'), '$cipher' => $cipher, '$expiryModalOK' => t('OK'), -- cgit v1.2.3 From b88a7fc23a185a6ecfbc451bddc7da33ea2c4d4c Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 9 Apr 2014 18:29:22 +0200 Subject: use $showacl to show/hide acl in jot.tpl - remove $pvisit and repair editblock and editlayout which still depended on it. --- include/conversation.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 5a7e9e2cd..09bdc022f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1129,7 +1129,6 @@ function status_editor($a,$x,$popup=false) { '$baseurl' => $a->get_baseurl(true), '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], - '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), '$public' => t('Public post'), '$jotnets' => $jotnets, '$emtitle' => t('Example: bob@example.com, mary@example.com'), @@ -1137,7 +1136,7 @@ function status_editor($a,$x,$popup=false) { '$acl' => $x['acl'], '$mimeselect' => $mimeselect, '$layoutselect' => $layoutselect, - '$showacl' => ((array_key_exists('showacl',$x)) ? $x['showacl'] : 'yes'), + '$showacl' => ((array_key_exists('showacl',$x)) ? $x['showacl'] : true), '$bang' => $x['bang'], '$profile_uid' => $x['profile_uid'], '$preview' => $preview, -- cgit v1.2.3 From bf41ccbf359a6105255055bfb110b904ee268688 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 9 Apr 2014 16:30:03 -0700 Subject: 'anybody in this network' permissions were not being allowed for non-connected channels. --- include/permissions.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/permissions.php b/include/permissions.php index eb1a7966f..01dd18f8d 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -100,6 +100,13 @@ function get_all_perms($uid,$observer_xchan,$internal_use = true) { dbesc($observer_xchan), intval(ABOOK_FLAG_SELF) ); + if(! $x) { + // not in address book, see if they've got an xchan + $y = q("select xchan_network from xchan where xchan_hash = '%s' limit 1", + dbesc($observer_xchan) + ); + } + $abook_checked = true; } @@ -144,9 +151,11 @@ function get_all_perms($uid,$observer_xchan,$internal_use = true) { // If we're still here, we have an observer, check the network. - if(($r[0][$channel_perm] & PERMS_NETWORK) && ($x[0]['xchan_network'] === 'zot')) { - $ret[$perm_name] = true; - continue; + if($r[0][$channel_perm] & PERMS_NETWORK) { + if(($x && $x[0]['xchan_network'] === 'zot') || ($y && $y[0]['xchan_network'] === 'zot')) { + $ret[$perm_name] = true; + continue; + } } // If PERMS_SITE is specified, find out if they've got an account on this hub @@ -263,6 +272,12 @@ function perm_is_allowed($uid,$observer_xchan,$permission) { if(($x) && (! $global_perms[$permission][2]) && ($x[0]['abook_flags'] & ABOOK_FLAG_IGNORED)) return false; + if(! $x) { + // not in address book, see if they've got an xchan + $y = q("select xchan_network from xchan where xchan_hash = '%s' limit 1", + dbesc($observer_xchan) + ); + } } @@ -283,9 +298,10 @@ function perm_is_allowed($uid,$observer_xchan,$permission) { // If we're still here, we have an observer, check the network. - if(($r[0][$channel_perm] & PERMS_NETWORK) && ($x[0]['xchan_network'] === 'zot')) - return true; - + if($r[0][$channel_perm] & PERMS_NETWORK) { + if (($x && $x[0]['xchan_network'] === 'zot') || ($y && $y[0]['xchan_network'] === 'zot')) + return true; + } // If PERMS_SITE is specified, find out if they've got an account on this hub -- cgit v1.2.3 From 795d74171358abe23cc4be01dac0e48d04ee46b4 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 9 Apr 2014 21:11:49 -0700 Subject: issue #400 - lock not showing up for previews of private mentions (or 'new/search' item view) also reformat the new/search template to pick up recent changes to conv_item.tpl --- include/conversation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 8803e74e7..d56e468ad 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -635,7 +635,11 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ $star = false; $isstarred = "unstarred icon-star-empty"; - $lock = false; + $lock = (($item['item_private'] || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) + ? t('Private Message') + : false + ); + $likebuttons = false; $shareable = false; -- cgit v1.2.3 From bf1f18e172808b0bbeb70180cd0eff305627645a Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 Apr 2014 16:14:19 -0700 Subject: Include the entire original item when notifying other channels of deletions as it contains important routing and scope information. Previously we were only sending a couple of critical fields like the message-id, flags, and creation date. The thinking was that it is deleted, let's not resend the deleted contents anywhere. But in order to route this through the same path the original post took we really need the entire original post with all of its baggage attached. --- include/items.php | 5 ----- include/zot.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index af0d4d297..78166a8ab 100755 --- a/include/items.php +++ b/include/items.php @@ -843,12 +843,7 @@ function encode_item($item) { } if($item['item_restrict'] & ITEM_DELETED) { - $x['message_id'] = $item['mid']; - $x['created'] = $item['created']; $x['flags'] = array('deleted'); - $x['owner'] = encode_item_xchan($item['owner']); - $x['author'] = encode_item_xchan($item['author']); - return $x; } $x['message_id'] = $item['mid']; diff --git a/include/zot.php b/include/zot.php index 19512c1ec..f9d527b33 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1412,7 +1412,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { } if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $public)) { - logger("permission denied for delivery {$channel['channel_id']}"); + logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); continue; } -- cgit v1.2.3 From a49069db4e4c11c5aed147d59b86b5c01d797b3d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 Apr 2014 16:26:27 -0700 Subject: move the deleted flag setting to encode_item_flags() where it belongs now that we aren't giving deleted posts special treatment. --- include/items.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 78166a8ab..a7d3a21ce 100755 --- a/include/items.php +++ b/include/items.php @@ -842,9 +842,6 @@ function encode_item($item) { $item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key); } - if($item['item_restrict'] & ITEM_DELETED) { - $x['flags'] = array('deleted'); - } $x['message_id'] = $item['mid']; $x['message_top'] = $item['parent_mid']; @@ -1029,9 +1026,11 @@ function encode_item_flags($item) { // most of item_flags and item_restrict are local settings which don't apply when transmitted. // We may need those for the case of syncing other hub locations which you are attached to. -// ITEM_DELETED is handled in encode_item directly so we don't need to handle it here. $ret = array(); + + if($item['item_restrict'] & ITEM_DELETED) + $ret[] = 'deleted'; if($item['item_flags'] & ITEM_THREAD_TOP) $ret[] = 'thread_parent'; if($item['item_flags'] & ITEM_NSFW) -- cgit v1.2.3 From 9bb7811d741339404ea6b372363c805d41a84794 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 Apr 2014 18:06:09 -0700 Subject: Discover page: when importing public items, alter the item so that it has the characteristics of one that was sourced by the sys channel instead of just being stored under the sys channel uid. This should allow comments and likes to flow upstream if permissions allow and may fix issue #398. Permission may still be denied by the original poster, but without this the comment/like is treated as a forgery and is blocked from transmission. --- include/externals.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index e7e9504a0..96644d68d 100644 --- a/include/externals.php +++ b/include/externals.php @@ -64,6 +64,25 @@ function externals_run($argv, $argc){ $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), array(array('hash' => $sys['xchan_hash'])), false, true); $total ++; + $z = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($message['message_id']), + intval($sys['channel_id']) + ); + if($z) { + $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK; + // preserve the source + + $r = q("update item set source_xchan = owner_xchan where id = %d limit 1", + intval($z[0]['id']) + ); + + $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s' + where id = %d limit 1", + intval($flag_bits), + dbesc($sys['xchan_hash']), + intval($z[0]['id']) + ); + } } logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); } -- cgit v1.2.3 From e64ec31a9de2995d8d717b5bebe55b10b985cd98 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 10 Apr 2014 22:17:35 -0700 Subject: add the message-id to delivery reports. This _could_ allow an enterprising developer to collect the delivery reports for a given post and store them in a DB table so that the sender could track and verify where a message had been sent on a web page and verify the success or failure of those attempts without requiring admin access. (To be fair this would also need an extra flag which hasn't yet been implemented to indicate that a channel created a second delivery chain of the message). --- include/zot.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index f9d527b33..c0916755f 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1413,7 +1413,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $public)) { logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); - $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); continue; } @@ -1423,12 +1423,12 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { remove_community_tag($sender,$arr,$channel['channel_id']); $item_id = delete_imported_item($sender,$arr,$channel['channel_id']); - $result[] = array($d['hash'],(($item_id) ? 'deleted' : 'delete_failed'),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result[] = array($d['hash'],(($item_id) ? 'deleted' : 'delete_failed'),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); if($relay && $item_id) { logger('process_delivery: invoking relay'); proc_run('php','include/notifier.php','relay',intval($item_id)); - $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); } continue; @@ -1460,7 +1460,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $xyz = event_store($ev); add_source_route($xyz,$sender['hash']); - $result = array($d['hash'],'event processed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result = array($d['hash'],'event processed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); continue; } } @@ -1475,7 +1475,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $arr['uid'] = $channel['channel_id']; update_imported_item($sender,$arr,$channel['channel_id']); } - $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); $item_id = $r[0]['id']; } else { @@ -1485,18 +1485,18 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { $item_id = $item_result['item_id']; add_source_route($item_id,$sender['hash']); - $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); } if($relay && $item_id) { logger('process_delivery: invoking relay'); proc_run('php','include/notifier.php','relay',intval($item_id)); - $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); } } if(! $deliveries) - $result[] = array('','no recipients'); + $result[] = array('','no recipients','',$arr['mid']); logger('process_delivery: local results: ' . print_r($result,true), LOGGER_DEBUG); @@ -1643,7 +1643,7 @@ function process_mail_delivery($sender,$arr,$deliveries) { if(! perm_is_allowed($channel['channel_id'],$sender['hash'],'post_mail')) { logger("permission denied for mail delivery {$channel['channel_id']}"); - $result[] = array($d['hash'],'permission denied',$channel['channel_name']); + $result[] = array($d['hash'],'permission denied',$channel['channel_name'],$arr['mid']); continue; } @@ -1657,11 +1657,11 @@ function process_mail_delivery($sender,$arr,$deliveries) { intval($r[0]['id']), intval($channel['channel_id']) ); - $result[] = array($d['hash'],'mail recalled',$channel['channel_name']); + $result[] = array($d['hash'],'mail recalled',$channel['channel_name'],$arr['mid']); logger('mail_recalled'); } else { - $result[] = array($d['hash'],'duplicate mail received',$channel['channel_name']); + $result[] = array($d['hash'],'duplicate mail received',$channel['channel_name'],$arr['mid']); logger('duplicate mail received'); } continue; @@ -1670,7 +1670,7 @@ function process_mail_delivery($sender,$arr,$deliveries) { $arr['account_id'] = $channel['channel_account_id']; $arr['channel_id'] = $channel['channel_id']; $item_id = mail_store($arr); - $result[] = array($d['hash'],'mail delivered',$channel['channel_name']); + $result[] = array($d['hash'],'mail delivered',$channel['channel_name'],$arr['mid']); } } @@ -2136,7 +2136,7 @@ function process_channel_sync_delivery($sender,$arr,$deliveries) { if($channel['channel_hash'] != $sender['hash']) { logger('process_channel_sync_delivery: possible forgery. Sender ' . $sender['hash'] . ' is not ' . $channel['channel_hash']); - $result[] = array($d['hash'],'channel mismatch',$channel['channel_name']); + $result[] = array($d['hash'],'channel mismatch',$channel['channel_name'],''); continue; } @@ -2231,7 +2231,7 @@ function process_channel_sync_delivery($sender,$arr,$deliveries) { } } - $result[] = array($d['hash'],'channel sync updated',$channel['channel_name']); + $result[] = array($d['hash'],'channel sync updated',$channel['channel_name'],''); } -- cgit v1.2.3 From 4582b8dd64a5f4dadc0406e047e441b238087584 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 11 Apr 2014 14:54:07 +0100 Subject: Bring BBCode to profiles --- include/identity.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index e773bb314..ad787c22c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -976,7 +976,7 @@ function advanced_profile(&$a) { if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']); - if($a->profile['with']) $profile['marital']['with'] = $a->profile['with']; + if($a->profile['with']) $profile['marital']['with'] = bbcode($a->profile['with']); if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') { $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s')); @@ -994,32 +994,32 @@ function advanced_profile(&$a) { if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); - if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); + if($txt = bbcode($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); - if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); + if($txt = bbcode($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); - if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); + if($txt = bbcode($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); - if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); + if($txt = bbcode($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); - if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); + if($txt = bbcode($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); - if($txt = prepare_text($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); + if($txt = bbcode($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); - if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); + if($txt = bbcode($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); - if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); + if($txt = bbcode($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); - if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); + if($txt = bbcode($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); - if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); + if($txt = bbcode($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); - if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); + if($txt = bbcode($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); - if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); + if($txt = bbcode($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); - if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); + if($txt = bbcode($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']); @@ -1277,4 +1277,4 @@ function identity_selector() { } return ''; -} \ No newline at end of file +} -- cgit v1.2.3 From 3197ccbf5edf51eab49623c7c21e63af7de7f127 Mon Sep 17 00:00:00 2001 From: marijus Date: Fri, 11 Apr 2014 16:06:39 +0200 Subject: bootstrapify aclselector --- include/acl_selectors.php | 10 ++++++++-- include/conversation.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 749ca75eb..6ce4c3f9b 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -230,15 +230,21 @@ function populate_acl($defaults = null,$unused = false) { array_walk($deny_gid,'fixacl'); } + $jotnets = ''; + call_hooks('jot_networks', $jotnets); + $tpl = get_markup_template("acl_selector.tpl"); $o = replace_macros($tpl, array( '$showall'=> t("Visible to everybody"), - '$show' => t("show"), - '$hide' => t("don't show"), + '$show' => t("Show"), + '$hide' => t("Don't show"), '$allowcid' => json_encode($allow_cid), '$allowgid' => json_encode($allow_gid), '$denycid' => json_encode($deny_cid), '$denygid' => json_encode($deny_gid), + '$jotnets' => $jotnets, + '$aclModalTitle' => t('Permissions'), + '$aclModalDismiss' => t('Close') )); diff --git a/include/conversation.php b/include/conversation.php index 9ffa1e77a..541da1d9b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1153,7 +1153,7 @@ function status_editor($a,$x,$popup=false) { '$encrypt' => t('Encrypt text'), '$cipher' => $cipher, '$expiryModalOK' => t('OK'), - '$expiryModalCANCEL' => t('Cancel'), + '$expiryModalCANCEL' => t('Cancel') )); -- cgit v1.2.3 From 81b06754a42685d9e8cad8e5301ceb50175849b6 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 11 Apr 2014 15:11:22 +0100 Subject: Don't count deleted channels when figuring out where to send a user on login. --- include/security.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/security.php b/include/security.php index 282c8ab73..0edbf854d 100644 --- a/include/security.php +++ b/include/security.php @@ -53,8 +53,9 @@ function authenticate_success($user_record, $login_initial = false, $interactive /* This account has never created a channel. Send them to new_channel by default */ if($a->module === 'login') { - $r = q("select count(channel_id) as total from channel where channel_account_id = %d", - intval($a->account['account_id']) + $r = q("select count(channel_id) as total from channel where channel_account_id = %d and not ( channel_pageflags & %d)", + intval($a->account['account_id']), + intval(PAGE_REMOVED) ); if(($r) && (! $r[0]['total'])) goaway(z_root() . '/new_channel'); -- cgit v1.2.3 From e10509e2bd29d8225f726b7f05b8540f072cfa1e Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 11 Apr 2014 14:01:33 -0700 Subject: soft revert 9bb7811 until we can look at it more closely. --- include/externals.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/externals.php b/include/externals.php index 96644d68d..1d9fd2902 100644 --- a/include/externals.php +++ b/include/externals.php @@ -64,10 +64,11 @@ function externals_run($argv, $argc){ $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), array(array('hash' => $sys['xchan_hash'])), false, true); $total ++; - $z = q("select id from item where mid = '%s' and uid = %d limit 1", - dbesc($message['message_id']), - intval($sys['channel_id']) - ); +// $z = q("select id from item where mid = '%s' and uid = %d limit 1", +// dbesc($message['message_id']), +// intval($sys['channel_id']) +// ); +$z = null; if($z) { $flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK; // preserve the source -- cgit v1.2.3 From 202582cbd6f66d7d4a23298a7c9d09400a2642ef Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 11 Apr 2014 15:08:40 -0700 Subject: we also need a loop breaker --- include/notifier.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/notifier.php b/include/notifier.php index 4bf2ac153..5b7f6ddc6 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -90,6 +90,8 @@ function notifier_run($argv, $argc){ if(! $item_id) return; + $sys = get_sys_channel(); + if($cmd == 'permission_update') { // Get the recipient $r = q("select abook.*, hubloc.* from abook @@ -313,6 +315,10 @@ function notifier_run($argv, $argc){ $top_level_post = false; } + // avoid looping of discover items 12/4/2014 + + if($sys && $parent_item['uid'] == $sys['channel_id']) + return; $encoded_item = encode_item($target_item); -- cgit v1.2.3 From 7e6804b599a94c29fb9ca5e9a89ec847b6cef9ab Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 11 Apr 2014 15:14:01 -0700 Subject: make sure we can find that function --- include/notifier.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/notifier.php b/include/notifier.php index 5b7f6ddc6..4b387513b 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -90,6 +90,7 @@ function notifier_run($argv, $argc){ if(! $item_id) return; + require_once('include/identity.php'); $sys = get_sys_channel(); if($cmd == 'permission_update') { -- cgit v1.2.3 From a82b1fe5902a7721d68aba27aad6f4bcb42854fa Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sat, 12 Apr 2014 00:08:50 +0100 Subject: Revert to prepare_text, use bbcode only for with --- include/identity.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index ad787c22c..7258d752b 100644 --- a/include/identity.php +++ b/include/identity.php @@ -870,7 +870,7 @@ logger('online: ' . $profile['online']); function get_events() { - require_once('include/bbcode.php'); + require_once('include/prepare_text.php'); $a = get_app(); @@ -909,7 +909,7 @@ logger('online: ' . $profile['online']); $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m'); $md .= "/#link-".$rr['id']; - $title = substr(strip_tags(bbcode($rr['desc'])),0,32) . '... '; + $title = substr(strip_tags(prepare_text($rr['desc'])),0,32) . '... '; if(! $title) $title = t('[No description]'); @@ -994,32 +994,32 @@ function advanced_profile(&$a) { if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); - if($txt = bbcode($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); + if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); - if($txt = bbcode($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); + if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); - if($txt = bbcode($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); + if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); - if($txt = bbcode($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); + if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); - if($txt = bbcode($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); + if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); - if($txt = bbcode($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); + if($txt = prepare_text($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); - if($txt = bbcode($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); + if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); - if($txt = bbcode($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); + if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); - if($txt = bbcode($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); + if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); - if($txt = bbcode($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); + if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); - if($txt = bbcode($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); + if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); - if($txt = bbcode($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); + if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); - if($txt = bbcode($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); + if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']); -- cgit v1.2.3 From 163c83a9e5198100f89745b844fce5b786a79b7c Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sat, 12 Apr 2014 00:11:43 +0100 Subject: Ooops, replaced too many --- include/identity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 7258d752b..66e572866 100644 --- a/include/identity.php +++ b/include/identity.php @@ -870,7 +870,7 @@ logger('online: ' . $profile['online']); function get_events() { - require_once('include/prepare_text.php'); + require_once('include/bbcode.php'); $a = get_app(); @@ -909,7 +909,7 @@ logger('online: ' . $profile['online']); $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m'); $md .= "/#link-".$rr['id']; - $title = substr(strip_tags(prepare_text($rr['desc'])),0,32) . '... '; + $title = substr(strip_tags(bbcode($rr['desc'])),0,32) . '... '; if(! $title) $title = t('[No description]'); -- cgit v1.2.3