aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php75
-rw-r--r--include/channel.php2
-rw-r--r--include/features.php10
-rw-r--r--include/help.php2
-rw-r--r--include/items.php17
-rw-r--r--include/markdown.php16
-rw-r--r--include/nav.php6
-rw-r--r--include/text.php11
-rw-r--r--include/zid.php28
9 files changed, 58 insertions, 109 deletions
diff --git a/include/attach.php b/include/attach.php
index 449721793..2ee3401f6 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -2599,33 +2599,31 @@ function attach_move($channel_id, $resource_id, $new_folder_hash, $newname = '',
intval($r[0]['id'])
);
- if($r[0]['is_photo']) {
- q("update photo set album = '%s', filename = '%s', os_path = '%s', display_path = '%s'
- where resource_id = '%s' and uid = %d",
- dbesc($newalbumname),
- dbesc($filename),
- dbesc($x['os_path']),
- dbesc($x['path']),
- dbesc($resource_id),
- intval($channel_id)
- );
-
- q("update photo set content = CASE imgscale WHEN 0 THEN %s ELSE CONCAT(%s, '-', imgscale) END where resource_id = '%s' and uid = %d and os_storage = 1",
- dbescbin($newstorepath),
- dbescbin($newstorepath),
- dbesc($resource_id),
- intval($channel_id)
- );
-
- // now rename the thumbnails in os_storage - the original should have been copied before already
- $ps = q("SELECT content, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' and imgscale > 0 and os_storage = 1",
+ if ($r[0]['is_photo']) {
+ // update the photo DB entries and copy the thumbnails
+ $ps = q("SELECT imgscale FROM photo WHERE uid = %d AND resource_id = '%s' and os_storage = 1",
intval($channel_id),
dbesc($resource_id)
);
if ($recurse) {
foreach($ps as $p) {
- rename($oldstorepath . '-' . $p['imgscale'], $p['content']);
+ q("update photo set album = '%s', filename = '%s', os_path = '%s', display_path = '%s', content = '%s'
+ where resource_id = '%s' and imgscale = %d and uid = %d",
+ dbesc($newalbumname),
+ dbesc($filename),
+ dbesc($x['os_path']),
+ dbesc($x['path']),
+ dbescbin($newstorepath . ((intval($p['imgscale']) > 0) ? '-' . $p['imgscale'] : '')),
+ dbesc($resource_id),
+ intval($p['imgscale']),
+ intval($channel_id)
+ );
+
+ // the original should have been copied already
+ if (intval($p['imgscale']) > 0) {
+ rename($oldstorepath . '-' . $p['imgscale'], $newstorepath . '-' . $p['imgscale']);
+ }
}
}
}
@@ -2935,41 +2933,6 @@ function attach_syspaths($channel_id,$attach_hash) {
return [ 'os_path' => $os_path, 'path' => $path ];
}
-/**
- * in earlier releases we did not fill in os_path and display_path in the attach DB structure.
- * (It was not needed or used). Going forward we intend to make use of these fields.
- * A cron task checks for empty values (as older attachments may have arrived at our site
- * in a clone operation) and executes attach_syspaths() to generate these field values and correct
- * the attach table entry. The operation is limited to 100 DB entries at a time so as not to
- * overload the system in any cron run. Eventually it will catch up with old attach structures
- * and switch into maintenance mode to correct any that might arrive in clone packets from older
- * sites.
- */
-
-
-
-function attach_upgrade() {
- $r = q("SELECT id, uid, hash FROM attach WHERE os_path = '' OR display_path = '' LIMIT 100");
- if($r) {
- foreach($r as $rv) {
- $x = attach_syspaths($rv['uid'],$rv['hash']);
- if($x) {
- q("update attach set os_path = '%s', display_path = '%s' where id = %d",
- dbesc($x['os_path']),
- dbesc($x['path']),
- intval($rv['id'])
- );
- q("update photo set os_path = '%s', display_path = '%s' where uid = %d and resource_id = '%s'",
- dbesc($x['os_path']),
- dbesc($x['path']),
- intval($rv['uid']),
- dbesc($rv['hash'])
- );
- }
- }
- }
-}
-
/**
* Chunked uploader for integration with the blueimp jquery-uploader
diff --git a/include/channel.php b/include/channel.php
index 22b5bcde1..0ece3be74 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -3106,7 +3106,7 @@ function pchan_to_chan($pchan) {
}
function channel_url($channel) {
- return (($channel) ? z_root() . '/channel/' . $channel['channel_address'] : z_root());
+ return ((isset($channel['channel_address'])) ? z_root() . '/channel/' . $channel['channel_address'] : z_root());
}
function get_channel_hashes() {
diff --git a/include/features.php b/include/features.php
index d527f60e6..65ead6604 100644
--- a/include/features.php
+++ b/include/features.php
@@ -170,12 +170,20 @@ function get_features($filtered = true, $level = (-1)) {
[
'star_posts',
t('Star Posts'),
- t('Ability to mark special posts with a star indicator'),
+ t('Ability to mark conversations with a star'),
false,
Config::Get('feature_lock','star_posts'),
],
[
+ 'filing',
+ t('File Posts'),
+ t('Ability to file posts'),
+ false,
+ Config::Get('feature_lock','filing'),
+ ],
+
+ [
'reply_to',
t('Reply on comment'),
t('Ability to reply on selected comment'),
diff --git a/include/help.php b/include/help.php
index 12721a30b..0efe90a9f 100644
--- a/include/help.php
+++ b/include/help.php
@@ -1,6 +1,6 @@
<?php
-use \Michelf\MarkdownExtra;
+use Michelf\MarkdownExtra;
use CommerceGuys\Intl\Language\LanguageRepository;
require_once('include/items.php');
diff --git a/include/items.php b/include/items.php
index 23222892f..423d626ad 100644
--- a/include/items.php
+++ b/include/items.php
@@ -3196,7 +3196,9 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
}
else {
- $arr['uuid'] = item_message_id();
+ // To prevent duplicates from possible clones of the forum/group,
+ // will create a v5 UUID of the source item mid.
+ $arr['uuid'] = uuid_from_url($item['mid']);
$arr['mid'] = z_root() . '/item/' . $arr['uuid'];
$arr['parent_mid'] = $arr['mid'];
}
@@ -5110,25 +5112,19 @@ function copy_of_pubitem($channel,$mid) {
return $item[0];
}
-
- $r = q("select * from item where parent_mid = (select parent_mid from item where mid = '%s' and uid = %d ) order by id ",
+ $r = q("select * from item where parent_mid = (select parent_mid from item where mid = '%s' and uid = %d) and uid = %d order by id ",
dbesc($mid),
+ intval($syschan['channel_id']),
intval($syschan['channel_id'])
);
if($r) {
$items = fetch_post_tags($r,true);
foreach($items as $rv) {
- $d = q("select id from item where mid = '%s' and uid = %d limit 1",
- dbesc($rv['mid']),
- intval($channel['channel_id'])
- );
- if($d) {
- continue;
- }
unset($rv['id']);
unset($rv['parent']);
+
$rv['aid'] = $channel['channel_account_id'];
$rv['uid'] = $channel['channel_id'];
$rv['item_wall'] = 0;
@@ -5141,5 +5137,6 @@ function copy_of_pubitem($channel,$mid) {
}
}
+
return $result;
}
diff --git a/include/markdown.php b/include/markdown.php
index b2adcd0d5..90d671fe4 100644
--- a/include/markdown.php
+++ b/include/markdown.php
@@ -80,22 +80,6 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) {
$s = html2bbcode($s);
- // $s = bb_code_protect($s);
-
- // Convert everything that looks like a link to a link
- if($use_zrl) {
- if (strpos($s,'[/img]') !== false) {
- $s = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'use_zrl_cb_img', $s);
- $s = preg_replace_callback("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", 'use_zrl_cb_img_x', $s);
- }
- $s = preg_replace_callback("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)([\,\.\:\;]\s|$)/ismu", 'use_zrl_cb_link',$s);
- }
- else {
- $s = preg_replace("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)([\,\.\:\;]\s|$)/ismu", '$1[url=$2$3]$2$3[/url]$4',$s);
- }
-
- // $s = bb_code_unprotect($s);
-
// remove duplicate adjacent code tags
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);
diff --git a/include/nav.php b/include/nav.php
index f8cd6101f..1bee5a2db 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -1,8 +1,8 @@
<?php /** @file */
-use \Zotlabs\Lib\Apps;
-use \Zotlabs\Lib\Chatroom;
-use \Zotlabs\Lib\Config;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Chatroom;
+use Zotlabs\Lib\Config;
require_once('include/security.php');
require_once('include/menu.php');
diff --git a/include/text.php b/include/text.php
index 137622b7d..18a70c3a5 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2639,13 +2639,13 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0) {
if(count($arr)) {
if($abook) {
$chans = q("select * from xchan left join hubloc on hubloc_hash = xchan_hash left join abook on abook_xchan = xchan_hash and abook_channel = %d
- where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_deleted = 0 order by hubloc_primary desc",
+ where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") order by hubloc_primary desc, hubloc_deleted ASC",
intval($item['uid'])
);
}
else {
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash
- where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_deleted = 0 order by hubloc_primary desc");
+ where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") order by hubloc_primary desc, hubloc_deleted ASC");
}
$xchans = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$arr)) . ") and xchan_network in ('rss','unknown', 'anon', 'token')");
if(! $chans)
@@ -3755,12 +3755,9 @@ function cleanup_bbcode($body) {
$body = preg_replace_callback('/\[img(.*?)\[\/(img)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[zmg(.*?)\[\/(zmg)\]/ism','\red_escape_codeblock',$body);
- $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
-+\,\(\)]+)/ismu", '\nakedoembed', $body);
-
- $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
-+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
+ $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\+\,\(\)]+)/ismu", '\nakedoembed', $body);
+ $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
$body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64summary(.*?)\[\/(summary)\]/ism','\red_unescape_codeblock',$body);
diff --git a/include/zid.php b/include/zid.php
index 159a3b834..2b5d53916 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -261,25 +261,25 @@ function zidify_text($s) {
*/
function red_zrl_callback($matches) {
- // Catch and exclude trailing punctuation
- preg_match("/[.,;:!?)]*$/i", $matches[2], $pts);
- $matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0]));
+ // Catch and exclude trailing punctuation
+ preg_match("/[.,;:!?)]*$/i", $matches[2], $pts);
+ $matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0]));
- $zrl = is_matrix_url($matches[2]);
+ $zrl = is_matrix_url($matches[2]);
- $t = strip_zids($matches[2]);
- if($t !== $matches[2]) {
- $zrl = true;
- $matches[2] = $t;
- }
+ $t = strip_zids($matches[2]);
+ if($t !== $matches[2]) {
+ $zrl = true;
+ $matches[2] = $t;
+ }
- if($matches[1] === '#^')
- $matches[1] = '';
+ if($matches[1] === '#^')
+ $matches[1] = '';
- if($zrl)
- return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
+ if($zrl)
+ return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
- return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
+ return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
}
/**