diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 8 | ||||
-rw-r--r-- | include/channel.php | 17 | ||||
-rw-r--r-- | include/conversation.php | 24 | ||||
-rwxr-xr-x | include/dba/dba_driver.php | 4 | ||||
-rwxr-xr-x | include/dba/dba_pdo.php | 9 | ||||
-rw-r--r-- | include/event.php | 12 | ||||
-rw-r--r-- | include/feedutils.php | 4 | ||||
-rw-r--r-- | include/message.php | 4 |
8 files changed, 60 insertions, 22 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index c7dea53c5..301ffbd24 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); diff --git a/include/channel.php b/include/channel.php index 32bd596fc..e7d119b1e 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']))) ]; } } 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..59057e7d5 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]'; @@ -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/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 = ''; |