aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-16 19:05:09 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-16 19:05:09 -0700
commit39309ad45c9bc9afa26a83c370891bafc81e6870 (patch)
tree9ccbeadc7b7ff3be46cb36d608f6011e22f95971
parent65661b7ec31d3524401e6b6d840763cb4d636935 (diff)
downloadvolse-hubzilla-39309ad45c9bc9afa26a83c370891bafc81e6870.tar.gz
volse-hubzilla-39309ad45c9bc9afa26a83c370891bafc81e6870.tar.bz2
volse-hubzilla-39309ad45c9bc9afa26a83c370891bafc81e6870.zip
start work on photo directories
-rw-r--r--include/attach.php32
1 files changed, 30 insertions, 2 deletions
diff --git a/include/attach.php b/include/attach.php
index 6cd3249cf..0835eb7dd 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -349,9 +349,10 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
$sql_options = '';
$source = (($arr) ? $arr['source'] : '');
$album = (($arr) ? $arr['album'] : '');
+ $newalbum = (($arr) ? $arr['newalbum'] : '');
$hash = (($arr && $arr['hash']) ? $arr['hash'] : null);
-logger('arr: ' . print_r($arr,true));
+// logger('arr: ' . print_r($arr,true));
// This is currently used only in mod/wall_attach
@@ -449,6 +450,21 @@ logger('arr: ' . print_r($arr,true));
$is_photo = 1;
}
+ if($is_photo) {
+ if($newalbum) {
+ $x = z_readdir($channel_id, $observer_hash, filepath_macro($newalbum));
+ }
+ elseif($album) {
+ $x = z_readdir($channel_id, $observer_hash, filepath_macro($album));
+ }
+ if(! $x['success']) {
+ // recursively create the directory path
+
+ }
+
+
+ }
+
$created = datetime_convert();
@@ -471,7 +487,7 @@ logger('arr: ' . print_r($arr,true));
intval($x[0]['aid']),
intval($channel_id),
dbesc($x[0]['hash']),
- dbesc(get_observer_hash()),
+ dbesc($observer_hash),
dbesc($filename),
dbesc($mimetype),
intval($filesize),
@@ -1393,3 +1409,15 @@ function in_group($group_id) {
return $group_members;
}
+
+
+function filepath_macro($s) {
+
+ return str_replace(
+ array( '%Y', '%M', '%D' ),
+ array( datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'),
+ datetime_convert('UTC',date_default_timezone_get(),'now', 'm'),
+ datetime_convert('UTC',date_default_timezone_get(),'now', 'd')
+ ), $s);
+
+} \ No newline at end of file