From de697a42671e3c50106dab29eb108a122753a825 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 14:16:16 -0700 Subject: issue #86 - like/dislike in photos not working --- include/text.php | 2 +- mod/photos.php | 14 +++++++------- mod/siteinfo.php | 2 +- view/tpl/photo_view.tpl | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/text.php b/include/text.php index 205736502..775076e93 100644 --- a/include/text.php +++ b/include/text.php @@ -2221,7 +2221,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/mod/photos.php b/mod/photos.php index cd293b39d..887f663ca 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -982,13 +982,13 @@ function photos_content(&$a) { $likebuttons = ''; if($can_post || $can_comment) { - $likebuttons = replace_macros($like_tpl,array( - '$id' => $link_item['id'], - '$likethis' => t("I like this \x28toggle\x29"), - '$nolike' => t("I don't like this \x28toggle\x29"), - '$share' => t('Share'), - '$wait' => t('Please wait') - )); + $likebuttons = array( + 'id' => $link_item['id'], + 'likethis' => t("I like this \x28toggle\x29"), + 'nolike' => t("I don't like this \x28toggle\x29"), + 'share' => t('Share'), + 'wait' => t('Please wait') + ); } $comments = ''; diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 14aaef144..2fffccc73 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -165,7 +165,7 @@ function siteinfo_content(&$a) { '$loadavg_all' => $loadavg[0] . ', ' . $loadavg[1] . ', ' . $loadavg[2], '$commit' => $commit, '$web_location' => t('Running at web location') . ' ' . z_root(), - '$visit' => t('Please visit redmatrix.me to learn more about $Projectname.'), + '$visit' => t('Please visit hubzilla.org to learn more about $Projectname.'), '$bug_text' => t('Bug reports and issues: please visit'), '$bug_link_url' => 'https://github.com/redmatrix/hubzilla/issues', '$bug_link_text' => t('$projectname issues'), diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index 225b4f6b0..867a1e87b 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -133,14 +133,14 @@ {{/if}} {{if $likebuttons}}
- -
-
+
{{/if}}
-- cgit v1.2.3 From 8af3dc140e34094ce101f050feb3da2b8b39470b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 15:08:07 -0700 Subject: issue #87 - photos not getting deleted from mod_photo when deleted in DAV or cloud --- include/attach.php | 12 +++++++++++- mod/photos.php | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) 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/mod/photos.php b/mod/photos.php index 887f663ca..320e2beed 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -149,8 +149,9 @@ function photos_post(&$a) { if($r) { foreach($r as $i) { attach_delete($page_owner_uid, $i['resource_id'], 1 ); - drop_item($i['id'],false,DROPITEM_PHASE1,true /* force removal of linked items */); - proc_run('php','include/notifier.php','drop',$i['id']); + // This is now being done in attach_delete() + // drop_item($i['id'],false,DROPITEM_PHASE1,true /* force removal of linked items */); + // proc_run('php','include/notifier.php','drop',$i['id']); } } -- cgit v1.2.3 From dc80431438e273e88a7c96e319fb257e428591b1 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Wed, 14 Oct 2015 19:43:40 -0400 Subject: Replaced RedMatrix icon and label in app list --- app/grid.apd | 4 ++++ app/matrix.apd | 4 ---- app/matrix.png | Bin 3925 -> 0 bytes 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 app/grid.apd delete mode 100644 app/matrix.apd delete mode 100644 app/matrix.png diff --git a/app/grid.apd b/app/grid.apd new file mode 100644 index 000000000..bc77aa6f1 --- /dev/null +++ b/app/grid.apd @@ -0,0 +1,4 @@ +url: $baseurl/network +requires: local_channel +name: Grid +photo: $baseurl/images/hubzilla_logo_6.png diff --git a/app/matrix.apd b/app/matrix.apd deleted file mode 100644 index 68188bfd3..000000000 --- a/app/matrix.apd +++ /dev/null @@ -1,4 +0,0 @@ -url: $baseurl/network -requires: local_channel -name: Matrix -photo: $baseurl/app/matrix.png diff --git a/app/matrix.png b/app/matrix.png deleted file mode 100644 index aba2c35dd..000000000 Binary files a/app/matrix.png and /dev/null differ -- cgit v1.2.3 From b33a9a71f6d13efb68d140ecbc41cc442564cde0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 17:40:50 -0700 Subject: more work on import & sync of private mail and conversations --- include/import.php | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++- include/zot.php | 6 +++++ mod/import.php | 6 +++++ 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/include/import.php b/include/import.php index ad8bcd84e..d5ff0d617 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,71 @@ 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/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']); diff --git a/mod/import.php b/mod/import.php index b6e36d734..72d8f92e9 100644 --- a/mod/import.php +++ b/mod/import.php @@ -441,6 +441,12 @@ function import_post(&$a) { if(is_array($data['chatroom'])) import_chatrooms($channel,$data['chatroom']); + if(is_array($data['conv'])) + import_conv($channel,$data['conv']); + + if(is_array($data['mail'])) + import_mail($channel,$data['mail']); + if(is_array($data['event'])) import_events($channel,$data['event']); -- cgit v1.2.3 From c8e3ea955d21f764d7cc930bde207604beae3c9f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 17:49:35 -0700 Subject: more mail sync work --- include/identity.php | 14 ++++++-------- include/import.php | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) 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 d5ff0d617..1734bd263 100644 --- a/include/import.php +++ b/include/import.php @@ -848,6 +848,7 @@ function import_mail($channel,$mails) { $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']), -- cgit v1.2.3 From 0563ce93a1ba3df8e5282e047603b21bb190c43f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 14 Oct 2015 18:03:05 -0700 Subject: change name of matrix app --- include/apps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'), -- cgit v1.2.3