aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php23
-rw-r--r--include/follow.php1
-rw-r--r--include/hubloc.php12
-rw-r--r--include/import.php14
-rwxr-xr-xinclude/items.php20
-rw-r--r--include/message.php4
-rw-r--r--include/nav.php1
7 files changed, 61 insertions, 14 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 7531bd774..36f943e46 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -117,6 +117,26 @@ function tryzrlvideo($match) {
return '<video ' . $poster . ' controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>';
}
+function videowithopts($match) {
+ $link = $match[2];
+ $zrl = is_matrix_url($link);
+ if($zrl)
+ $link = zid($link);
+
+ $attributes = $match[1];
+
+ $poster = "";
+
+ preg_match("/poster='(.*?)'/ism", $attributes, $matches);
+ if ($matches[1] != "")
+ $poster = 'poster="' . (($zrl) ? zid($matches[1]) : $matches[1]) . '"';
+
+ return '<video ' . $poster . ' controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>';
+}
+
+
+
+
// [noparse][i]italic[/i][/noparse] turns into
// [noparse][ i ]italic[ /i ][/noparse],
// to hide them from parser.
@@ -1251,12 +1271,14 @@ function bbcode($Text, $options = []) {
// html5 video and audio
if (strpos($Text,'[/video]') !== false) {
+ $Text = preg_replace_callback("/\[video (.*?)\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/video\]/ism", 'videowithopts', $Text);
$Text = preg_replace_callback("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/video\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text,'[/audio]') !== false) {
$Text = preg_replace_callback("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3|opus|m4a))\[\/audio\]/ism", 'tryzrlaudio', $Text);
}
if (strpos($Text,'[/zvideo]') !== false) {
+ $Text = preg_replace_callback("/\[zvideo (.*?)\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/zvideo\]/ism", 'videowithopts', $Text);
$Text = preg_replace_callback("/\[zvideo\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/zvideo\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text,'[/zaudio]') !== false) {
@@ -1360,4 +1382,3 @@ function bbcode($Text, $options = []) {
return $Text;
}
-
diff --git a/include/follow.php b/include/follow.php
index db77a0160..1b35f1b32 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -119,6 +119,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
if( array_key_exists('permissions',$j) && array_key_exists('data',$j['permissions'])) {
$permissions = crypto_unencapsulate(array(
'data' => $j['permissions']['data'],
+ 'alg' => $j['permissions']['alg'],
'key' => $j['permissions']['key'],
'iv' => $j['permissions']['iv']),
$channel['channel_prvkey']);
diff --git a/include/hubloc.php b/include/hubloc.php
index 7cb00f788..4a1f77733 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -311,7 +311,9 @@ function z6_discover() {
// find unregistered zot6 clone hublocs
- $c = q("select channel_hash, portable_id from channel where channel_deleted = 0");
+ $c = q("select channel_hash, channel_portable_id from channel where channel_deleted = '%s'",
+ dbesc(NULL_DATE)
+ );
if ($c) {
foreach ($c as $entry) {
$q1 = q("select * from hubloc left join site on hubloc_url = site_url where hubloc_deleted = 0 and site_dead = 0 and hubloc_hash = '%s' and hubloc_url != '%s'",
@@ -325,19 +327,19 @@ function z6_discover() {
// does this particular server have a zot6 clone registered on our site for this channel?
foreach ($q1 as $q) {
$q2 = q("select * from hubloc left join site on hubloc_url = site_url where hubloc_deleted = 0 and site_dead = 0 and hubloc_hash = '%s' and hubloc_url = '%s'",
- dbesc($entry['portable_id']),
+ dbesc($entry['channel_portable_id']),
dbesc($q['hubloc_url'])
);
if ($q2) {
continue;
}
// zot6 hubloc not found.
- if(strpos($entry['site_project'],'hubzilla') !== false && version_compare($entry['site_version'],'4.0') >= 0) {
+ if(strpos($q['site_project'],'hubzilla') !== false && version_compare($q['site_version'],'4.0') >= 0) {
// probe and store results - only for zot6 (over-ride the zot default)
- discover_by_webbie($entry['hubloc_addr'],'zot6');
+ discover_by_webbie($q['hubloc_addr'],'zot6');
}
}
}
}
-} \ No newline at end of file
+}
diff --git a/include/import.php b/include/import.php
index 8d1a19202..7a1e9aa55 100644
--- a/include/import.php
+++ b/include/import.php
@@ -1155,6 +1155,9 @@ function sync_files($channel, $files) {
require_once('include/attach.php');
if($channel && $files) {
+
+ $limit = service_class_fetch($channel['channel_id'], 'attach_upload_limit');
+
foreach($files as $f) {
if(! $f)
continue;
@@ -1275,6 +1278,17 @@ function sync_files($channel, $files) {
}
else {
logger('sync_files attach does not exists: ' . print_r($att,true), LOGGER_DEBUG);
+
+ if($limit !== false) {
+ $r = q("select sum(filesize) as total from attach where aid = %d ",
+ intval($channel['channel_account_id'])
+ );
+ if(($r) && (($r[0]['total'] + $att['filesize']) > $limit)) {
+ logger('service class limit exceeded');
+ continue;
+ }
+ }
+
create_table_from_array('attach',$att);
}
diff --git a/include/items.php b/include/items.php
index c9c2e2d48..c08deb3a0 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1930,11 +1930,21 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
if($parent_deleted)
$arr['item_deleted'] = 1;
- $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d and revision = %d LIMIT 1",
- dbesc($arr['mid']),
- intval($arr['uid']),
- intval($arr['revision'])
- );
+ if($arr['uuid']) {
+ $r = q("SELECT id FROM item WHERE uuid = '%s' AND uid = %d and revision = %d LIMIT 1",
+ dbesc($arr['uuid']),
+ intval($arr['uid']),
+ intval($arr['revision'])
+ );
+ }
+ else {
+ $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d and revision = %d LIMIT 1",
+ dbesc($arr['mid']),
+ intval($arr['uid']),
+ intval($arr['revision'])
+ );
+ }
+
if($r) {
logger('duplicate item ignored. ' . print_r($arr,true));
$ret['message'] = 'duplicate post.';
diff --git a/include/message.php b/include/message.php
index 037c59c60..2486beb83 100644
--- a/include/message.php
+++ b/include/message.php
@@ -220,8 +220,8 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
foreach($images as $image) {
if(! stristr($image,z_root() . '/photo/'))
continue;
- $image_uri = substr($image,strrpos($image,'/') + 1);
- $image_uri = substr($image_uri,0, strpos($image_uri,'-'));
+ $image_uri = substr($image, strrpos($image, '/') + 1);
+ $image_uri = substr($image_uri, 0, strpos($image_uri, '.') - 2);
$r = q("UPDATE photo SET allow_cid = '%s' WHERE resource_id = '%s' AND uid = %d and allow_cid = '%s'",
dbesc('<' . $recipient . '>'),
dbesc($image_uri),
diff --git a/include/nav.php b/include/nav.php
index 9baadc9b2..3e1acd306 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -183,7 +183,6 @@ function nav($template = 'default') {
$search_form_action = 'search';
}
-
$nav['search'] = ['search', t('Search'), "", t('Search site @name, !forum, #tag, ?docs, content'), $search_form_action];
/**