aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/attach.php95
-rwxr-xr-xinclude/items.php1
-rw-r--r--include/zid.php21
3 files changed, 36 insertions, 81 deletions
diff --git a/include/attach.php b/include/attach.php
index bfe3d5d46..179a57a90 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -947,9 +947,9 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
}
if($notify) {
- //$cloudPath = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['0']['display_path'];
- //$object = get_file_activity_object($channel['channel_id'], $r['0']['hash'], $cloudPath);
- //file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify);
+ $cloudPath = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['0']['display_path'];
+ $object = get_file_activity_object($channel['channel_id'], $r['0']['hash'], $cloudPath);
+ file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify);
}
return $ret;
@@ -1421,7 +1421,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
intval($channel_id)
);
- file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', $notify=1);
+ file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', true);
return;
}
@@ -2341,6 +2341,11 @@ function attach_move($channel_id, $resource_id, $new_folder_hash) {
}
+/**
+ * Used to generate a select input box of all your folders
+ */
+
+
function attach_folder_select_list($channel_id) {
$r = q("select * from attach where is_dir = 1 and uid = %d",
@@ -2391,6 +2396,10 @@ function attach_folder_rpaths($all_folders,$that_folder) {
return (($error) ? false : [ $current_hash , $path ]);
}
+/**
+ * @brief Given a channel_id and attach_hash, return an array with the full relative path and os_path
+ */
+
function attach_syspaths($channel_id,$attach_hash) {
@@ -2414,6 +2423,17 @@ 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() {
@@ -2440,6 +2460,12 @@ function attach_upgrade() {
}
+/**
+ * Chunked uploader for integration with the blueimp jquery-uploader
+ * This is currently used.
+ */
+
+
function save_chunk($channel,$start,$end,$len) {
$result = [];
@@ -2478,64 +2504,3 @@ function save_chunk($channel,$start,$end,$len) {
}
-/**
- * @brief Submit handler for chunked uploads.
- *
- * @param array $channel
- * @param array $arr
- * @return array
- */
-function chunkloader($channel, $arr) {
-
- logger('request: ' . print_r($arr,true), LOGGER_DEBUG);
- logger('files: ' . print_r($_FILES,true), LOGGER_DEBUG);
-
- $result = [];
-
- $tmp_path = $_FILES['file']['tmp_name'];
- $new_base = 'store/[data]/' . $channel['channel_address'] . '/tmp';
- os_mkdir($new_base,STORAGE_DEFAULT_PERMISSIONS,true);
-
- $new_path = $new_base . '/' . $arr['resumableFilename'];
-
- rename($tmp_path,$new_path . '.' . intval($arr['resumableChunkNumber']));
-
- $missing_parts = false;
- for($x = 1; $x <= intval($arr['resumableTotalChunks']); $x ++) {
- if(! file_exists($new_path . '.' . $x)) {
- $missing_parts = true;
- break;
- }
- }
-
- if($missing_parts) {
- $result['partial'] = true;
- return $result;
- }
-
- if(intval($arr['resumableTotalChunks']) === 1) {
- rename($new_path . '.' . '1', $new_path);
- }
- else {
- for($x = 1; $x <= intval($arr['resumableTotalChunks']); $x ++) {
- $istream = fopen($new_path . '.' . $x,'rb');
- $ostream = fopen($new_path,'ab');
- if($istream && $ostream) {
- pipe_streams($istream,$ostream);
- fclose($istream);
- fclose($ostream);
- }
- unlink($new_path . '.' . $x);
- }
- }
-
- $result['name'] = $arr['resumableFilename'];
- $result['type'] = $arr['resumableType'];
- $result['tmp_name'] = $new_path;
- $result['error'] = 0;
- $result['size'] = $arr['resumableTotalSize'];
- $result['complete'] = true;
-
- return $result;
-}
-
diff --git a/include/items.php b/include/items.php
index 3934f6194..5d592c736 100755
--- a/include/items.php
+++ b/include/items.php
@@ -230,6 +230,7 @@ function can_comment_on_post($observer_xchan, $item) {
$x = [
'observer_hash' => $observer_xchan,
'item' => $item,
+ 'allowed' => 'unset'
];
/**
* @hooks can_comment_on_post
diff --git a/include/zid.php b/include/zid.php
index 359b1721f..d1a0fa88a 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -103,25 +103,14 @@ function strip_zats($s) {
return preg_replace('/[\?&]zat=(.*?)(&|$)/ism','$2',$s);
}
-function strip_auth_query_params() {
- $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
- $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
- $_SERVER['QUERY_STRING'] = strip_owt($_SERVER['QUERY_STRING']);
- $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
- $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
- $_SERVER['REQUEST_URI'] = strip_owt($_SERVER['REQUEST_URI']);
-
-
- $_ENV['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['QUERY_STRING']);
- $_ENV['QUERY_STRING'] = strip_zids($_ENV['QUERY_STRING']);
- $_ENV['QUERY_STRING'] = strip_owt($_ENV['QUERY_STRING']);
-
- $_ENV['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['REQUEST_URI']);
- $_ENV['REQUEST_URI'] = strip_zids($_ENV['REQUEST_URI']);
- $_ENV['REQUEST_URI'] = strip_owt($_ENV['REQUEST_URI']);
+function clean_query_string() {
+ $x = strip_zids(\App::$query_string);
+ $x = strip_owt($x);
+ $x = strip_zats($x);
+ return strip_query_param($x,'f');
}