aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php67
1 files changed, 55 insertions, 12 deletions
diff --git a/include/identity.php b/include/identity.php
index 804f316d1..393378cc4 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -427,7 +427,7 @@ function create_identity($arr) {
}
}
- call_hooks('register_account', $newuid);
+ call_hooks('create_identity', $newuid);
proc_run('php','include/directory.php', $ret['channel']['channel_id']);
}
@@ -555,17 +555,33 @@ function identity_basic_export($channel_id, $items = false) {
if($r)
$ret['term'] = $r;
- $r = q("select * from obj where obj_channel = %d",
+
+ // add psuedo-column obj_baseurl to aid in relocations
+
+ $r = q("select obj.*, '%s' as obj_baseurl from obj where obj_channel = %d",
+ dbesc(z_root()),
intval($channel_id)
);
if($r)
$ret['obj'] = $r;
+ $r = q("select * from app where app_channel = %d",
+ intval($channel_id)
+ );
+ if($r)
+ $ret['app'] = $r;
+
+ $r = q("select * from chatroom where cr_uid = %d",
+ intval($channel_id)
+ );
+ if($r)
+ $ret['chatroom'] = $r;
+
if(! $items)
return $ret;
- $r = q("select likes.*, item.mid from likes left join item on likes.iid = item.id where likes.channel_id = %d",
+ $r = q("select * from likes where channel_id = %d",
intval($channel_id)
);
@@ -583,14 +599,17 @@ function identity_basic_export($channel_id, $items = false) {
/** @warning this may run into memory limits on smaller systems */
- /** export one year of posts. If you want to export and import all posts you have to start with
+
+ /** export three months of posts. If you want to export and import all posts you have to start with
* the first year and export/import them in ascending order.
+ *
+ * Don't export linked resource items. we'll have to pull those out separately.
*/
- $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created > %s - INTERVAL %s",
+ $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created > %s - INTERVAL %s and resource_type = '' order by created",
intval($channel_id),
db_utcnow(),
- db_quoteinterval('1 YEAR')
+ db_quoteinterval('3 MONTH')
);
if($r) {
$ret['item'] = array();
@@ -604,15 +623,27 @@ 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');
- $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s' ",
+
+ $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_wall = 1 and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s' and resource_type = '' order by created",
intval($channel_id),
dbesc($mindate),
dbesc($maxdate)
@@ -626,6 +657,17 @@ function identity_export_year($channel_id,$year) {
$ret['item'][] = encode_item($rr,true);
}
+ $r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item_id.uid = %d
+ and item.created >= '%s' and item.created < '%s' order by created ",
+ intval($channel_id),
+ dbesc($mindate),
+ dbesc($maxdate)
+ );
+
+ if($r)
+ $ret['item_id'] = $r;
+
+
return $ret;
}
@@ -649,7 +691,7 @@ function identity_export_year($channel_id,$year) {
*/
function profile_load(&$a, $nickname, $profile = '') {
- logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));
+// logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));
$user = q("select channel_id from channel where channel_address = '%s' and channel_removed = 0 limit 1",
dbesc($nickname)
@@ -912,7 +954,8 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
$profile['online'] = (($profile['online_status'] === 'online') ? t('Online Now') : False);
- logger('online: ' . $profile['online']);
+
+// logger('online: ' . $profile['online']);
if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) {
$block = true;