aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php17
-rw-r--r--include/channel.php28
-rw-r--r--include/conversation.php24
-rwxr-xr-xinclude/dba/dba_driver.php4
-rwxr-xr-xinclude/dba/dba_pdo.php9
-rw-r--r--include/event.php14
-rw-r--r--include/feedutils.php4
-rwxr-xr-xinclude/items.php13
-rw-r--r--include/message.php4
-rw-r--r--include/text.php15
-rw-r--r--include/zid.php1
11 files changed, 108 insertions, 25 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index c7dea53c5..f3ecbd9e9 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -382,7 +382,7 @@ function bb_ShareAttributes($match) {
// Bob Smith wrote the following post 2 hours ago
$fmt = sprintf( t('%1$s wrote the following %2$s %3$s'),
- '<a href="' . (($auth) ? zid($profile) : $profile) . '" >' . $author . '</a>',
+ '<a href="' . (($auth) ? zid($profile) : $profile) . '" ><bdi>' . $author . '</bdi></a>',
'<a href="' . (($auth) ? zid($link) : $link) . '" >' . $type . '</a>',
$reldate
);
@@ -1111,6 +1111,12 @@ function bbcode($Text, $options = []) {
if (strpos($Text,'[/footer]') !== false) {
$Text = preg_replace("(\[footer\](.*?)\[\/footer\])ism", "<div class=\"wall-item-footer\">$1</div>", $Text);
}
+
+ // Check for bdi
+ if (strpos($Text,'[/bdi]') !== false) {
+ $Text = preg_replace("(\[bdi\](.*?)\[\/bdi\])ism", "<bdi>$1</bdi>", $Text);
+ }
+
// Check for list text
$Text = preg_replace("/<br \/>\[\*\]/ism",'[*]',$Text);
@@ -1231,9 +1237,18 @@ function bbcode($Text, $options = []) {
if (strpos($Text,'[/img]') !== false) {
$Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" />', $Text);
}
+ // [img=pathtoimage]image description[/img]
+ if (strpos($Text,'[/img]') !== false) {
+ $Text = preg_replace("/\[img=http(.*?)\](.*?)\[\/img\]/ism", '<img style="max-width: 100%;" src="http$1" alt="$2" title="$2"/>', $Text);
+ }
+ // [zmg]pathtoimage[/zmg]
if (strpos($Text,'[/zmg]') !== false) {
$Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="$1" alt="' . t('Image/photo') . '" />', $Text);
}
+ // [zmg=pathtoimage]image description[/zmg]
+ if (strpos($Text,'[/zmg]') !== false) {
+ $Text = preg_replace("/\[zmg=http(.*?)\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width: 100%;" src="http$1" alt="$2" title="$2"/>', $Text);
+ }
// [img float={left, right}]pathtoimage[/img]
if (strpos($Text,'[/img]') !== false) {
diff --git a/include/channel.php b/include/channel.php
index 32bd596fc..66ab56715 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -796,7 +796,7 @@ function get_default_export_sections() {
* @return array
* See function for details
*/
-function identity_basic_export($channel_id, $sections = null) {
+function identity_basic_export($channel_id, $sections = null, $zap_compat = false) {
/*
* basic channel export
@@ -812,12 +812,16 @@ function identity_basic_export($channel_id, $sections = null) {
// with a non-standard platform and version.
$ret['compatibility'] = [
- 'project' => PLATFORM_NAME,
+ 'project' => (($zap_compat) ? 'zap' : PLATFORM_NAME),
'version' => STD_VERSION,
'database' => DB_UPDATE_VERSION,
'server_role' => System::get_server_role()
];
+ if ($zap_compat) {
+ $ret['compatibility']['codebase'] = 'zap';
+ }
+
/*
* Process channel information regardless of it is one of the sections desired
* because we need the channel relocation information in all export files/streams.
@@ -834,6 +838,13 @@ function identity_basic_export($channel_id, $sections = null) {
unset($ret['channel']['channel_password']);
unset($ret['channel']['channel_salt']);
}
+ if ($zap_compat) {
+ $channel['channel_guid_sig'] = 'sha256.' . $channel['channel_guid_sig'];
+ $channel['channel_hash'] = $channel['channel_portable_id'];
+ unset($channel['channel_portable_id']);
+ }
+
+
}
if(in_array('channel',$sections) || in_array('profile',$sections)) {
@@ -853,7 +864,7 @@ function identity_basic_export($channel_id, $sections = null) {
$ret['photo'] = [
'type' => $r[0]['mimetype'],
'data' => (($r[0]['os_storage'])
- ? base64url_encode(file_get_contents($r[0]['content'])) : base64url_encode($r[0]['content']))
+ ? base64url_encode(file_get_contents($r[0]['content'])) : base64url_encode(dbunescbin($r[0]['content'])))
];
}
}
@@ -911,8 +922,17 @@ function identity_basic_export($channel_id, $sections = null) {
$r = q("select * from pconfig where uid = %d",
intval($channel_id)
);
- if($r)
+
+ if($r) {
+ if ($zap_compat) {
+ for($x = 0; $x < count($r); $x ++) {
+ if (preg_match('|^a:[0-9]+:{.*}$|s', $r[$x]['v'])) {
+ $r[$x]['v'] = serialise(unserialize($r[$x]['v']));
+ }
+ }
+ }
$ret['config'] = $r;
+ }
// All other term types will be included in items, if requested.
diff --git a/include/conversation.php b/include/conversation.php
index e8b8051bb..07d43e660 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -172,9 +172,9 @@ function localize_item(&$item){
$shortbodyverb = t('doesn\'t like %1$s\'s %2$s');
}
- $item['shortlocalize'] = sprintf($shortbodyverb, $objauthor, $plink);
+ $item['shortlocalize'] = sprintf($shortbodyverb, '[bdi]' . $author_name . '[/bdi]', $post_type);
- $item['body'] = $item['localize'] = sprintf($bodyverb, $author, $objauthor, $plink);
+ $item['body'] = $item['localize'] = sprintf($bodyverb, '[bdi]' . $author . '[/bdi]', '[bdi]' . $objauthor . '[/bdi]', $plink);
if($Bphoto != "")
$item['body'] .= "\n\n\n" . '[zrl=' . chanlink_url($author_link) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
@@ -205,10 +205,12 @@ function localize_item(&$item){
$Bname = $obj['title'];
- $A = '[zrl=' . chanlink_url($Alink) . ']' . $Aname . '[/zrl]';
- $B = '[zrl=' . chanlink_url($Blink) . ']' . $Bname . '[/zrl]';
+ $A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]';
+ $B = '[zrl=' . chanlink_url($Blink) . '][bdi]' . $Bname . '[/bdi][/zrl]';
if ($Bphoto!="") $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
+ $item['shortlocalize'] = sprintf( t('%1$s is now connected with %2$s'), '[bdi]' . $Aname . '[/bdi]', '[bdi]' . $Bname . '[/bdi]');
+
$item['body'] = $item['localize'] = sprintf( t('%1$s is now connected with %2$s'), $A, $B);
$item['body'] .= "\n\n\n" . $Bphoto;
}
@@ -237,8 +239,8 @@ function localize_item(&$item){
}
$Bname = $obj['title'];
- $A = '[zrl=' . chanlink_url($Alink) . ']' . $Aname . '[/zrl]';
- $B = '[zrl=' . chanlink_url($Blink) . ']' . $Bname . '[/zrl]';
+ $A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]';
+ $B = '[zrl=' . chanlink_url($Blink) . '][bdi]' . $Bname . '[/bdi][/zrl]';
if ($Bphoto!="") $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
// we can't have a translation string with three positions but no distinguishable text
@@ -252,6 +254,8 @@ function localize_item(&$item){
// then do the sprintf on the translation string
+ $item['shortlocalize'] = sprintf($txt, '[bdi]' . $Aname . '[/bdi]', '[bdi]' . $Bname . '[/bdi]');
+
$item['body'] = $item['localize'] = sprintf($txt, $A, $B);
$item['body'] .= "\n\n\n" . $Bphoto;
}
@@ -263,7 +267,7 @@ function localize_item(&$item){
$Aname = $item['author']['xchan_name'];
$Alink = $item['author']['xchan_url'];
- $A = '[zrl=' . chanlink_url($Alink) . ']' . $Aname . '[/zrl]';
+ $A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]';
$txt = t('%1$s is %2$s','mood');
@@ -1010,11 +1014,11 @@ function thread_author_menu($item, $mode = '') {
$contact = App::$contacts[$item['author_xchan']];
}
else {
- if($local_channel && $item['author']['xchan_addr'] && (! in_array($item['author']['xchan_network'],[ 'rss', 'anon','unknown' ]))) {
- $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']) . '&interactive=0';
+ $url = (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']);
+ if($local_channel && $url && (! in_array($item['author']['xchan_network'],[ 'rss', 'anon','unknown' ]))) {
+ $follow_url = z_root() . '/follow/?f=&url=' . urlencode($url) . '&interactive=0';
}
}
-
if($item['uid'] > 0 && author_is_pmable($item['author'],$contact)) {
$pm_url = z_root() . '/mail/new/?f=&hash=' . urlencode($item['author_xchan']);
}
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index cfb208e2d..b96601fec 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -307,6 +307,10 @@ function db_use_index($str) {
return \DBA::$dba->use_index($str);
}
+function db_str_to_date($str) {
+ return \DBA::$dba->str_to_date($str);
+}
+
/**
* @brief Execute a SQL query with printf style args.
*
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php
index 0279342ec..49f741601 100755
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -139,6 +139,15 @@ class dba_pdo extends dba_driver {
}
}
+ function str_to_date($str) {
+ if($this->driver_dbtype === 'pgsql') {
+ return "TO_TIMESTAMP($str, 'YYYY-MM-DD HH24:MI:SS')";
+ }
+ else {
+ return "STR_TO_DATE($str, '%Y-%m-%d %H:%i:%s')";
+ }
+ }
+
function quote_interval($txt) {
if($this->driver_dbtype === 'pgsql') {
return "'$txt'";
diff --git a/include/event.php b/include/event.php
index 9d76aabd6..64e63074c 100644
--- a/include/event.php
+++ b/include/event.php
@@ -250,7 +250,7 @@ function format_ical_sourcetext($s) {
}
-function format_event_bbcode($ev) {
+function format_event_bbcode($ev, $utc = false) {
$o = '';
@@ -258,6 +258,14 @@ function format_event_bbcode($ev) {
$o .= '[event]' . $ev['event_vdata'] . '[/event]';
}
+ if ($utc && $ev['event-timezone'] !== 'UTC') {
+ $ev['dtstart'] = datetime_convert($ev['timezone'],'UTC',$ev['dtstart'],ATOM_TIME);
+ if ($ev['dtend'] && ! $ev['nofinish']) {
+ $ev['dtend'] = datetime_convert($ev['timezone'],'UTC',$ev['dtend'],ATOM_TIME);
+ }
+ $ev['timezone'] = 'UTC';
+ }
+
if($ev['summary'])
$o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
@@ -606,7 +614,7 @@ function event_addtocal($item_id, $uid) {
$ev['event_hash'] = $item['resource_id'];
}
- if($ev->private)
+ if($ev['private'])
$ev['allow_cid'] = '<' . $channel['channel_hash'] . '>';
else {
$acl = new Zotlabs\Access\AccessList($channel);
@@ -1194,7 +1202,7 @@ function event_store_item($arr, $event) {
if(! $arr['mid']) {
$arr['uuid'] = $event['event_hash'];
- $arr['mid'] = z_root() . '/event/' . $event['event_hash'];
+ $arr['mid'] = z_root() . '/activity/' . $event['event_hash'];
}
$item_arr['aid'] = $z[0]['channel_account_id'];
diff --git a/include/feedutils.php b/include/feedutils.php
index 6d14eb5c4..9ff09cc66 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -155,7 +155,7 @@ function get_feed_for($channel, $observer_hash, $params) {
if($item['item_private'])
continue;
- $atom .= atom_entry($item, $type, null, $owner, true, '', $params['compat']);
+ $atom .= atom_entry($item, $type, null, $channel, true, '', $params['compat']);
}
}
@@ -1921,7 +1921,7 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $
$summary = '';
if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid'])
- $body = fix_private_photos($body,$owner['uid'],$item,$cid);
+ $body = fix_private_photos($body,$owner['channel_id'],$item,$cid);
if($compat) {
$compat_photos = compat_photos_list($body);
diff --git a/include/items.php b/include/items.php
index 917808ad5..9f90b2f3b 100755
--- a/include/items.php
+++ b/include/items.php
@@ -930,8 +930,19 @@ function import_author_xchan($x) {
}
// if we were told that it's a zot connection, don't probe/import anything else
- if(array_key_exists('network',$x) && $x['network'] === 'zot')
+ if(array_key_exists('network',$x) && $x['network'] === 'zot') {
+ if($x['url']) {
+ // check if we already have the zot6 xchan of this xchan_url. if not import it.
+ $r = q("SELECT xchan_hash FROM xchan WHERE xchan_url = '%s' AND xchan_network = 'zot6'",
+ dbesc($x['url'])
+ );
+
+ if(! $r)
+ discover_by_webbie($x['url'], 'zot6');
+ }
+
return $y;
+ }
// perform zot6 discovery
diff --git a/include/message.php b/include/message.php
index 7d05b9ab7..37fe6749d 100644
--- a/include/message.php
+++ b/include/message.php
@@ -299,10 +299,6 @@ function create_conversation($channel,$recipient,$subject) {
}
-
-
-
-
function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
$where = '';
diff --git a/include/text.php b/include/text.php
index 87ed9f658..1f0af08e3 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3694,3 +3694,18 @@ function svg2bb($s) {
}
return EMPTY_STR;
}
+
+
+
+function serialise($x) {
+ return ((is_array($x)) ? 'json:' . json_encode($x) : $x);
+}
+
+function unserialise($x) {
+ if (is_array($x)) {
+ return $x;
+ }
+ $y = ((substr($x,0,5) === 'json:') ? json_decode(substr($x,5),true) : '');
+ return ((is_array($y)) ? $y : $x);
+}
+
diff --git a/include/zid.php b/include/zid.php
index 3b3dd8554..325af5580 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -1,6 +1,7 @@
<?php
use Zotlabs\Lib\Verify;
+use Zotlabs\Zot\Finger;
function is_matrix_url($url) {