aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-17 22:20:10 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-17 22:20:10 -0700
commitf6823259241484a761bc7e69ce44db281a6cb825 (patch)
treedadad1dcf476b8f12b94810e89175fc3060fedeb /include/identity.php
parent1982fc807f9f7eb02429acb3a46bfd8e5ba32748 (diff)
downloadvolse-hubzilla-f6823259241484a761bc7e69ce44db281a6cb825.tar.gz
volse-hubzilla-f6823259241484a761bc7e69ce44db281a6cb825.tar.bz2
volse-hubzilla-f6823259241484a761bc7e69ce44db281a6cb825.zip
provide ability to export by month as well as by year
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/identity.php b/include/identity.php
index 23c099bbd..daa985c2f 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -601,14 +601,25 @@ function identity_basic_export($channel_id, $items = false) {
-function identity_export_year($channel_id,$year) {
+function identity_export_year($channel_id,$year,$month = 0) {
if(! $year)
return array();
+ if($month && $month <= 12) {
+ $target_month = sprintf('%02d',$month);
+ $target_month_plus = sprintf('%02d',$month+1);
+ }
+ else
+ $target_month = '01';
+
$ret = array();
- $mindate = datetime_convert('UTC','UTC',$year . '-01-01 00:00:00');
- $maxdate = datetime_convert('UTC','UTC',$year+1 . '-01-01 00:00:00');
+ $mindate = datetime_convert('UTC','UTC',$year . '-' . $target_month . '-01 00:00:00');
+ if($month && $month < 12)
+ $maxdate = datetime_convert('UTC','UTC',$year . '-' . $target_month_plus . '-01 00:00:00');
+ else
+ $maxdate = datetime_convert('UTC','UTC',$year+1 . '-01-01 00:00:00');
+
$r = q("select * from item where (item_flags & %d) > 0 and (item_restrict & %d) = 0 and uid = %d and created >= '%s' and created < '%s' order by created ",
intval(ITEM_WALL),
intval(ITEM_DELETED),