aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php15
-rw-r--r--include/channel.php9
-rw-r--r--include/feedutils.php9
-rw-r--r--include/import.php17
-rwxr-xr-xinclude/items.php7
-rw-r--r--include/network.php3
-rw-r--r--include/taxonomy.php25
-rw-r--r--include/zid.php4
-rw-r--r--include/zot.php9
9 files changed, 75 insertions, 23 deletions
diff --git a/include/attach.php b/include/attach.php
index e94454905..39269eb03 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -550,6 +550,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$type = $f['type'];
} else {
if(! x($_FILES,'userfile')) {
+ logger('No source file');
$ret['message'] = t('No source file.');
return $ret;
}
@@ -590,6 +591,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval($channel_id)
);
if(! $x) {
+ logger('update file source not found');
$ret['message'] = t('Cannot locate file to revise/update');
return $ret;
}
@@ -731,6 +733,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$maxfilesize = get_config('system','maxfilesize');
if(($maxfilesize) && ($filesize > $maxfilesize)) {
+ logger('quota_exceeded');
$ret['message'] = sprintf( t('File exceeds size limit of %d'), $maxfilesize);
if($remove_when_processed)
@unlink($src);
@@ -751,6 +754,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval($channel['channel_account_id'])
);
if(($r) && (($r[0]['total'] + $filesize) > ($limit - $existing_size))) {
+ logger('service_class limit exceeded');
$ret['message'] = upgrade_message(true) . sprintf(t("You have reached your limit of %1$.0f Mbytes attachment storage."), $limit / 1024000);
if($remove_when_processed)
@unlink($src);
@@ -783,8 +787,15 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$os_path = $os_relpath;
$display_path = ltrim($pathname . '/' . $filename,'/');
- if($src)
- @file_put_contents($os_basepath . $os_relpath,@file_get_contents($src));
+ if($src) {
+ $istream = @fopen($src,'rb');
+ $ostream = @fopen($os_basepath . $os_relpath,'wb');
+ if($istream && $ostream) {
+ pipe_streams($istream,$ostream,65535);
+ fclose($istream);
+ fclose($ostream);
+ }
+ }
if(array_key_exists('created', $arr))
$created = $arr['created'];
diff --git a/include/channel.php b/include/channel.php
index 2d40b7db6..b9adc588b 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1982,12 +1982,17 @@ function get_channel_default_perms($uid) {
}
-function profiles_build_sync($channel_id) {
+function profiles_build_sync($channel_id,$send = true) {
$r = q("select * from profile where uid = %d",
intval($channel_id)
);
if($r) {
- build_sync_packet($channel_id,array('profile' => $r));
+ if($send) {
+ build_sync_packet($channel_id,array('profile' => $r));
+ }
+ else {
+ return $r;
+ }
}
}
diff --git a/include/feedutils.php b/include/feedutils.php
index 4638ef66a..5e48cb1ee 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -1801,12 +1801,17 @@ function compat_photos_list($s) {
if($found) {
foreach($matches as $match) {
- $ret[] = [
+ $entry = [
'href' => $match[2],
- 'length' => 0,
'type' => guess_image_type($match[2])
];
+ $sizer = new \Zotlabs\Lib\Img_filesize($match[2]);
+ $size = $sizer->getSize();
+ if(intval($size)) {
+ $entry['length'] = intval($size);
+ }
+ $ret[] = $entry;
}
}
diff --git a/include/import.php b/include/import.php
index a5e8adeb5..5a655ce4c 100644
--- a/include/import.php
+++ b/include/import.php
@@ -162,13 +162,17 @@ function import_profiles($channel, $profiles) {
convert_oldfields($profile,'work','employment');
/**
- * @TODO we are going to reset all profile photos to the original
- * somebody will have to fix this later and put all the applicable
- * photos into the export.
+ * @TODO put all the applicable photos into the export.
*/
- $profile['photo'] = z_root() . '/photo/profile/l/' . $channel['channel_id'];
- $profile['thumb'] = z_root() . '/photo/profile/m/' . $channel['channel_id'];
+ if((strpos($profile['thumb'],'/photo/profile/l/') !== false) || intval($profile['is_default'])) {
+ $profile['photo'] = z_root() . '/photo/profile/l/' . $channel['channel_id'];
+ $profile['thumb'] = z_root() . '/photo/profile/m/' . $channel['channel_id'];
+ }
+ else {
+ $profile['photo'] = z_root() . '/photo/' . basename($profile['photo']);
+ $profile['thumb'] = z_root() . '/photo/' . basename($profile['thumb']);
+ }
create_table_from_array('profile', $profile);
}
@@ -1328,6 +1332,9 @@ function sync_files($channel, $files) {
}
}
}
+
+ \Zotlabs\Daemon\Master::Summon([ 'Thumbnail' , $att['hash'] ]);
+
if($f['item']) {
sync_items($channel,$f['item'],
['channel_address' => $original_channel,'url' => $oldbase]
diff --git a/include/items.php b/include/items.php
index 722757f87..d0b9cffc9 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4063,8 +4063,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$item_uids = ' true ';
$item_normal = item_normal();
-
- if ($arr['uid']) $uid= $arr['uid'];
+ if($arr['uid']) {
+ $uid = $arr['uid'];
+ }
if($channel) {
$uid = $channel['channel_id'];
@@ -4226,7 +4227,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$items = q("SELECT item.*, item.id AS item_id FROM item
WHERE $item_uids $item_restrict
$simple_update
- $sql_extra $sql_nets
+ $sql_extra $sql_nets $sql_extra3
ORDER BY item.received DESC $pager_sql"
);
diff --git a/include/network.php b/include/network.php
index 3569874be..79a8c6578 100644
--- a/include/network.php
+++ b/include/network.php
@@ -752,13 +752,14 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
if($orig_width > 1024 || $orig_height > 1024) {
$tag = (($match[1] == 'z') ? 'zmg' : 'img');
+ $linktag = (($match[1] == 'z') ? 'zrl' : 'url');
$ph->scaleImage(1024);
$new_width = $ph->getWidth();
$new_height = $ph->getHeight();
logger('data: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
$s = str_replace($mtch[0],'[' . $tag . '=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/' . $tag . ']'
. "\n" . (($include_link)
- ? '[zrl=' . $mtch[2] . ']' . t('view full size') . '[/zrl]' . "\n"
+ ? '[' . $linktag . '=' . $mtch[3] . ']' . t('view full size') . '[/' . $linktag . ']' . "\n"
: ''),$s);
logger('new string: ' . $s, LOGGER_DEBUG);
}
diff --git a/include/taxonomy.php b/include/taxonomy.php
index a13a9cf77..a646df28c 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -313,12 +313,25 @@ function dir_tagadelic($count = 0) {
$count = intval($count);
- // Fetch tags
- $r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0
- group by xtag_term order by total desc %s",
- ((intval($count)) ? "limit $count" : '')
- );
-
+ $dirmode = get_config('system','directory_mode');
+
+ if($dirmode == DIRECTORY_MODE_STANDALONE) {
+ // Fetch tags
+ $r = q("select xtag_term as term, count(xtag_term) as total from xtag
+ left join hubloc on xtag_hash = hubloc_hash
+ where xtag_flags = 0 and hubloc_url = '%s'
+ group by xtag_term order by total desc %s",
+ dbesc(z_root()),
+ ((intval($count)) ? "limit $count" : '')
+ );
+ }
+ else {
+ // Fetch tags
+ $r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0
+ group by xtag_term order by total desc %s",
+ ((intval($count)) ? "limit $count" : '')
+ );
+ }
if(! $r)
return array();
diff --git a/include/zid.php b/include/zid.php
index d1a0fa88a..6ebc9a6ab 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -105,8 +105,8 @@ function strip_zats($s) {
-function clean_query_string() {
- $x = strip_zids(\App::$query_string);
+function clean_query_string($s = '') {
+ $x = strip_zids(($s) ? $s : \App::$query_string);
$x = strip_owt($x);
$x = strip_zats($x);
diff --git a/include/zot.php b/include/zot.php
index 6c0d92a42..8e3d03ad8 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3745,6 +3745,15 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
* @TODO
* We also need to import local photos if a custom photo is selected
*/
+
+ if((strpos($profile['thumb'],'/photo/profile/l/') !== false) || intval($profile['is_default'])) {
+ $profile['photo'] = z_root() . '/photo/profile/l/' . $channel['channel_id'];
+ $profile['thumb'] = z_root() . '/photo/profile/m/' . $channel['channel_id'];
+ }
+ else {
+ $profile['photo'] = z_root() . '/photo/' . basename($profile['photo']);
+ $profile['thumb'] = z_root() . '/photo/' . basename($profile['thumb']);
+ }
}
if(count($clean)) {