aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2017-12-27 16:45:33 +0100
committerMario <mario@mariovavti.com>2017-12-27 16:45:33 +0100
commit4a71fb08315b2b785114d90318adb51f6fa78472 (patch)
treebbc0b4fa95ad236135af7ec70abee76901b82c79 /include
parent8e626a0142e586da7f1bfbf5d35a518159e75b88 (diff)
parent5a8efc10d8ebaf5e81009eaaff8b0c5524a04aa3 (diff)
downloadvolse-hubzilla-4a71fb08315b2b785114d90318adb51f6fa78472.tar.gz
volse-hubzilla-4a71fb08315b2b785114d90318adb51f6fa78472.tar.bz2
volse-hubzilla-4a71fb08315b2b785114d90318adb51f6fa78472.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'include')
-rw-r--r--include/attach.php15
-rw-r--r--include/taxonomy.php25
2 files changed, 32 insertions, 8 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/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();