aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-10-15 09:36:51 +0200
committerMario Vavti <mario@mariovavti.com>2015-10-15 09:36:51 +0200
commit2848f5dab4e0f904280e77d6403ab69926cabe1d (patch)
treebcb2f2a70660d7abe319b126035d2e0b2ddd2c41 /include
parent3c7d2d4cea80fae5113de8c78ed522ce8b32c16d (diff)
parentf0f5a8f2b510b92aa1fde2cbaf118a784c154432 (diff)
downloadvolse-hubzilla-2848f5dab4e0f904280e77d6403ab69926cabe1d.tar.gz
volse-hubzilla-2848f5dab4e0f904280e77d6403ab69926cabe1d.tar.bz2
volse-hubzilla-2848f5dab4e0f904280e77d6403ab69926cabe1d.zip
Merge branch 'master' of https://github.com/redmatrix/hubzilla
Diffstat (limited to 'include')
-rw-r--r--include/apps.php2
-rw-r--r--include/attach.php12
-rw-r--r--include/identity.php14
-rw-r--r--include/import.php68
-rw-r--r--include/text.php2
-rw-r--r--include/zot.php6
6 files changed, 92 insertions, 12 deletions
diff --git a/include/apps.php b/include/apps.php
index 661fc2163..c036867b1 100644
--- a/include/apps.php
+++ b/include/apps.php
@@ -130,7 +130,7 @@ function translate_system_apps(&$arr) {
'Address Book' => t('Address Book'),
'Login' => t('Login'),
'Channel Manager' => t('Channel Manager'),
- 'Matrix' => t('Matrix'),
+ 'Grid' => t('Grid'),
'Settings' => t('Settings'),
'Files' => t('Files'),
'Webpages' => t('Webpages'),
diff --git a/include/attach.php b/include/attach.php
index fc95e3a75..0d4e4092b 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -1229,7 +1229,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
$channel_address = (($c) ? $c[0]['channel_address'] : 'notfound');
$photo_sql = (($is_photo) ? " and is_photo = 1 " : '');
- $r = q("SELECT hash, flags, is_dir, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1",
+ $r = q("SELECT hash, flags, is_dir, is_photo, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1",
dbesc($resource),
intval($channel_id)
);
@@ -1275,6 +1275,16 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
intval($channel_id)
);
+ if($r[0]['is_photo']) {
+ $x = q("select id, item_hidden from item where resource_id = '%s' and resource_type = 'photo' and uid = %d",
+ dbesc($resource),
+ intval($channel_id)
+ );
+ if($x) {
+ drop_item($x[0]['id'],false,(($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1),true);
+ }
+ }
+
// update the parent folder's lastmodified timestamp
$e = q("UPDATE attach SET edited = '%s' WHERE hash = '%s' AND uid = %d",
dbesc(datetime_convert()),
diff --git a/include/identity.php b/include/identity.php
index bb905e18f..ad5bfbe6d 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -635,8 +635,12 @@ function identity_basic_export($channel_id, $items = false) {
$r = q("select * from conv where uid = %d",
intval($channel_id)
);
- if($r)
+ if($r) {
+ for($x = 0; $x < count($r); $x ++) {
+ $r[$x]['subject'] = base64url_decode(str_rot47($r[$x]['subject']));
+ }
$ret['conv'] = $r;
+ }
$r = q("select mail.*, conv.guid as conv_guid from mail left join conv on mail.convid = conv.id where mail.uid = %d",
@@ -645,17 +649,11 @@ function identity_basic_export($channel_id, $items = false) {
if($r) {
$m = array();
foreach($r as $rr) {
-
-
-
-
+ $m[] = mail_encode($rr,true);
}
$ret['mail'] = $m;
}
-
-
-
$r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item_id.uid = %d",
intval($channel_id)
);
diff --git a/include/import.php b/include/import.php
index ad8bcd84e..1734bd263 100644
--- a/include/import.php
+++ b/include/import.php
@@ -790,7 +790,7 @@ function import_likes($channel,$likes) {
if($r)
continue;
- dbesc_array($config);
+ dbesc_array($like);
$r = dbq("INSERT INTO likes (`"
. implode("`, `", array_keys($like))
. "`) VALUES ('"
@@ -800,6 +800,72 @@ function import_likes($channel,$likes) {
}
}
+function import_conv($channel,$convs) {
+ if($channel && $convs) {
+ foreach($convs as $conv) {
+ if($conv['deleted']) {
+ q("delete from conv where guid = '%s' and uid = %d limit 1",
+ dbesc($conv['guid']),
+ intval($channel['channel_id'])
+ );
+ continue;
+ }
+
+ unset($conv['id']);
+
+ $conv['uid'] = $channel['channel_id'];
+ $conv['subject'] = str_rot47(base64url_encode($conv['subject']));
+
+ $r = q("select id from conv where guid = '%s' and uid = %d limit 1",
+ dbesc($conv['guid']),
+ intval($channel['channel_id'])
+ );
+ if($r)
+ continue;
+
+ dbesc_array($conv);
+ $r = dbq("INSERT INTO conv (`"
+ . implode("`, `", array_keys($conv))
+ . "`) VALUES ('"
+ . implode("', '", array_values($conv))
+ . "')" );
+ }
+ }
+}
+
+
+
+function import_mail($channel,$mails) {
+ if($channel && $mails) {
+ foreach($mails as $mail) {
+ if(array_key_exists('flags',$mail) && in_array('deleted',$mail['flags'])) {
+ q("delete from mail where mid = '%s' and uid = %d limit 1",
+ dbesc($mail['message_id']),
+ intval($channel['channel_id'])
+ );
+ continue;
+ }
+ $m = get_mail_elements($mail);
+ if(! $m)
+ continue;
+
+ if($mail['conv_guid']) {
+ $x = q("select id from conv where guid = '%s' and uid = %d limit 1",
+ dbesc($mail['conv_guid']),
+ intval($channel['channel_id'])
+ );
+ if($x) {
+ $m['convid'] = $x[0]['id'];
+ }
+ }
+ $m['aid'] = $channel['channel_account_id'];
+ $m['uid'] = $channel['channel_id'];
+ mail_store($m);
+ }
+ }
+}
+
+
diff --git a/include/text.php b/include/text.php
index 0c944f57b..3173c9eea 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2211,7 +2211,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
}
if($tag == '#getzot') {
$basetag = 'getzot';
- $url = 'https://redmatrix.me';
+ $url = 'http://hubzilla.org';
$newtag = '#[zrl=' . $url . ']' . $basetag . '[/zrl]';
$body = str_replace($tag,$newtag,$body);
$replaced = true;
diff --git a/include/zot.php b/include/zot.php
index dd9222bf3..b1cb5a8ec 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3002,6 +3002,12 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(array_key_exists('chatroom',$arr) && $arr['chatroom'])
sync_chatrooms($channel,$arr['chatroom']);
+ if(array_key_exists('conv',$arr) && $arr['conv'])
+ import_conv($channel,$arr['conv']);
+
+ if(array_key_exists('mail',$arr) && $arr['mail'])
+ import_mail($channel,$arr['mail']);
+
if(array_key_exists('event',$arr) && $arr['event'])
sync_events($channel,$arr['event']);