From e931616011b2d5d41dd42927af30043ca6da9096 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Sep 2018 17:38:14 +0200 Subject: Save combined view while deleting first message in thread --- include/message.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/message.php b/include/message.php index 4a673b961..73471f573 100644 --- a/include/message.php +++ b/include/message.php @@ -503,6 +503,26 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation intval($messageitem_id), intval($channel_id) ); + + // If it was a first message in thread + $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", + dbesc($x[0]['parent_mid']), + intval($channel_id) + ); + if (! $z) { + // Get new first message... + $r = q("SELECT * FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", + dbesc($x[0]['conv_guid']), + intval($channel_id) + ); + // ...and refer whole thread to it + q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", + dbesc($r[0]['mid']), + dbesc($x[0]['conv_guid']), + intval($channel_id) + ); + } + build_sync_packet($channel_id,array('mail' => array(encode_mail($x,true)))); return true; } -- cgit v1.2.3 From 6360dee12560050b32adebdd4432c0ba4c59cee2 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Sep 2018 17:45:42 +0200 Subject: formatting --- include/message.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/message.php b/include/message.php index 73471f573..4c59f601c 100644 --- a/include/message.php +++ b/include/message.php @@ -517,9 +517,9 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation ); // ...and refer whole thread to it q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", - dbesc($r[0]['mid']), - dbesc($x[0]['conv_guid']), - intval($channel_id) + dbesc($r[0]['mid']), + dbesc($x[0]['conv_guid']), + intval($channel_id) ); } -- cgit v1.2.3 From 8ad24ca3e8919060cf650f526ddce155f1b3bb77 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Fri, 14 Sep 2018 17:35:12 -0400 Subject: Catch errors in template rendering. Output a generic error and log problem. --- include/text.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 8a07dc113..4b5442985 100644 --- a/include/text.php +++ b/include/text.php @@ -37,7 +37,13 @@ function replace_macros($s, $r) { call_hooks('replace_macros', $arr); $t = App::template_engine(); - $output = $t->replace_macros($arr['template'], $arr['params']); + + try { + $output = $t->replace_macros($arr['template'], $arr['params']); + } catch (Exception $e) { + logger("Unable to render template: ",$e->getMessage()); + $output = "

ERROR: there was an error creating the output.

"; + } return $output; } -- cgit v1.2.3 From 85d8225cc061f8654f70e879d0afca680c734a02 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 01:01:48 +0200 Subject: less data in select --- include/message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/message.php b/include/message.php index 4c59f601c..2ac22c0ba 100644 --- a/include/message.php +++ b/include/message.php @@ -511,7 +511,7 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation ); if (! $z) { // Get new first message... - $r = q("SELECT * FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", + $r = q("SELECT mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", dbesc($x[0]['conv_guid']), intval($channel_id) ); -- cgit v1.2.3 From 8d89c4bbcef4e11db6c031c8f5af1323eb055e49 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 01:20:49 +0200 Subject: Save combined view on calling first message in thread --- include/zot.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/zot.php b/include/zot.php index e8ac2df02..f4feb1022 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2341,6 +2341,26 @@ function process_mail_delivery($sender, $arr, $deliveries) { intval($r[0]['id']), intval($channel['channel_id']) ); + + // If it was a first message in thread + $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", + dbesc($arr['mid']), + intval($channel['channel_id']) + ); + if (! $z) { + // Get new first message... + $r = q("SELECT mid, conv_guid FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", + dbesc($arr['mid']), + intval($channel['channel_id']) + ); + // ...and refer whole thread to it + q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", + dbesc($r[0]['mid']), + dbesc($r[0]['conv_guid']), + intval($channel['channel_id']) + ); + } + $DR->update('mail recalled'); $result[] = $DR->get(); logger('mail_recalled'); -- cgit v1.2.3 From 3d3f4f50fb7fb06c8e17e8ede70be4c004e39773 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 01:40:17 +0200 Subject: formatting --- include/zot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zot.php b/include/zot.php index f4feb1022..7eb2d6b96 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2341,7 +2341,7 @@ function process_mail_delivery($sender, $arr, $deliveries) { intval($r[0]['id']), intval($channel['channel_id']) ); - + // If it was a first message in thread $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", dbesc($arr['mid']), -- cgit v1.2.3 From 284e5dd2e8313f3ccd148f19699f996d4f4fe0a5 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 01:45:54 +0200 Subject: unification with zot.php code for future reuse --- include/message.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/message.php b/include/message.php index 2ac22c0ba..9e8b6be8b 100644 --- a/include/message.php +++ b/include/message.php @@ -511,14 +511,14 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation ); if (! $z) { // Get new first message... - $r = q("SELECT mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", + $r = q("SELECT mid, conv_guid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", dbesc($x[0]['conv_guid']), intval($channel_id) ); // ...and refer whole thread to it q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", dbesc($r[0]['mid']), - dbesc($x[0]['conv_guid']), + dbesc($r[0]['conv_guid']), intval($channel_id) ); } -- cgit v1.2.3 From 724dc48fe8784b52e214c8ee65e2b9e2f19b7519 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 21:41:13 +0200 Subject: Add new file --- include/msglib.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 include/msglib.php diff --git a/include/msglib.php b/include/msglib.php new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From f83c2d5cd102291c9ef3372fda904fb67bcf61da Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 22:27:39 +0200 Subject: Create msglib.php --- include/msglib.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/include/msglib.php b/include/msglib.php index e69de29bb..c55839f6c 100644 --- a/include/msglib.php +++ b/include/msglib.php @@ -0,0 +1,35 @@ + Date: Sat, 15 Sep 2018 22:31:08 +0200 Subject: formatting --- include/msglib.php | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/include/msglib.php b/include/msglib.php index c55839f6c..2c9a9a696 100644 --- a/include/msglib.php +++ b/include/msglib.php @@ -6,30 +6,27 @@ function msg_drop($message_id, $channel_id, $conv_guid) { // Delete message $r = q("DELETE FROM mail WHERE id = %d AND channel_id = %d", - $message_id, - $channel_id - ); + $message_id, + $channel_id + ); - // If it was a first message in thread - $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", - $message_id, - $channel_id - ); - if (! $z) { - // Get new first message... - $r = q("SELECT mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", - $conv_guid, - $channel_id - ); - // ...and refer whole thread to it - q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", - dbesc($r[0]['mid']), - $conv_guid, - $channel_id - ); - return true; - } else { - return false; - } + // If it was a first message in thread + $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", + $message_id, + $channel_id + ); + if (! $z) { + // Get new first message... + $r = q("SELECT mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", + $conv_guid, + $channel_id + ); + // ...and refer whole thread to it + q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", + dbesc($r[0]['mid']), + $conv_guid, + $channel_id + ); + } } -- cgit v1.2.3 From 1819704620c48ac9a5e5fac6d776ed8c417ab8da Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 22:32:07 +0200 Subject: Use common msg_drop function --- include/message.php | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/include/message.php b/include/message.php index 9e8b6be8b..00a1ada38 100644 --- a/include/message.php +++ b/include/message.php @@ -4,6 +4,7 @@ require_once('include/crypto.php'); require_once('include/attach.php'); +require_once('include/msglib.php'); function mail_prepare_binary($item) { @@ -498,31 +499,8 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation } else { xchan_mail_query($x[0]); - $x[0]['mail_deleted'] = true; - $r = q("DELETE FROM mail WHERE id = %d AND channel_id = %d", - intval($messageitem_id), - intval($channel_id) - ); - - // If it was a first message in thread - $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", - dbesc($x[0]['parent_mid']), - intval($channel_id) - ); - if (! $z) { - // Get new first message... - $r = q("SELECT mid, conv_guid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", - dbesc($x[0]['conv_guid']), - intval($channel_id) - ); - // ...and refer whole thread to it - q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", - dbesc($r[0]['mid']), - dbesc($r[0]['conv_guid']), - intval($channel_id) - ); - } - + $x[0]['mail_deleted'] = true; + msg_drop(intval($messageitem_id), intval($channel_id), dbesc($x[0]['conv_guid'])); build_sync_packet($channel_id,array('mail' => array(encode_mail($x,true)))); return true; } -- cgit v1.2.3 From 034441bd13431a4a74e222311885665477e36a54 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 15 Sep 2018 22:32:56 +0200 Subject: use common msg_drop function --- include/zot.php | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/include/zot.php b/include/zot.php index 7eb2d6b96..38435a124 100644 --- a/include/zot.php +++ b/include/zot.php @@ -12,6 +12,7 @@ require_once('include/crypto.php'); require_once('include/items.php'); require_once('include/queue_fn.php'); require_once('include/perm_upgrade.php'); +require_once('include/msglib.php'); /** @@ -2331,36 +2332,13 @@ function process_mail_delivery($sender, $arr, $deliveries) { } - $r = q("select id from mail where mid = '%s' and channel_id = %d limit 1", + $r = q("select id, conv_guid from mail where mid = '%s' and channel_id = %d limit 1", dbesc($arr['mid']), intval($channel['channel_id']) ); if($r) { if(intval($arr['mail_recalled'])) { - $x = q("delete from mail where id = %d and channel_id = %d", - intval($r[0]['id']), - intval($channel['channel_id']) - ); - - // If it was a first message in thread - $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", - dbesc($arr['mid']), - intval($channel['channel_id']) - ); - if (! $z) { - // Get new first message... - $r = q("SELECT mid, conv_guid FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", - dbesc($arr['mid']), - intval($channel['channel_id']) - ); - // ...and refer whole thread to it - q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", - dbesc($r[0]['mid']), - dbesc($r[0]['conv_guid']), - intval($channel['channel_id']) - ); - } - + msg_drop(intval($r[0]['id']), intval($channel['channel_id']), dbesc($r[0]['conv_guid'])); $DR->update('mail recalled'); $result[] = $DR->get(); logger('mail_recalled'); -- cgit v1.2.3 From 585bdf562a31e6fb822fc0b06bdfbbe5b8ba324e Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 16 Sep 2018 00:43:45 +0200 Subject: Update msglib.php --- include/msglib.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/msglib.php b/include/msglib.php index 2c9a9a696..f196e7bee 100644 --- a/include/msglib.php +++ b/include/msglib.php @@ -10,18 +10,14 @@ function msg_drop($message_id, $channel_id, $conv_guid) { $channel_id ); - // If it was a first message in thread - $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d", - $message_id, + // Get new first message... + $r = q("SELECT mid, parent_mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", + $conv_guid, $channel_id ); - if (! $z) { - // Get new first message... - $r = q("SELECT mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", - $conv_guid, - $channel_id - ); - // ...and refer whole thread to it + // ...and if wasn't first before... + if ($r[0]['mid'] != $r[0]['parent_mid']) { + // ...refer whole thread to it q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", dbesc($r[0]['mid']), $conv_guid, -- cgit v1.2.3 From abe35817cd4f81c2d9c8305573c5fa5cbe154095 Mon Sep 17 00:00:00 2001 From: "M.Dent (DM42.Net)" Date: Sat, 15 Sep 2018 23:09:16 -0400 Subject: Add attach_delete hook --- include/attach.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/attach.php b/include/attach.php index 202412263..4db5bc435 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1428,6 +1428,8 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { if(! $r) { attach_drop_photo($channel_id,$resource); + $arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; + call_hooks("attach_delete",$arr); return; } @@ -1486,6 +1488,9 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { intval($channel_id) ); + $arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; + call_hooks("attach_delete",$arr); + file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', true); return; -- cgit v1.2.3 From a0cf2b53e03098f459edec6ac395df9750efe333 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Sun, 16 Sep 2018 23:01:17 -0400 Subject: Add hook to allow addons to filter the list returned by app_list --- Zotlabs/Lib/Apps.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 6b87ac6cb..aa7e2282d 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -722,6 +722,9 @@ class Apps { ); if($r) { + $hookinfo = Array('uid'=>$uid,'deleted'=>$deleted,'cats'=>$cats,'apps'=>$r); + call_hooks('app_list',$hookinfo); + $r = $hookinfo['apps']; for($x = 0; $x < count($r); $x ++) { if(! $r[$x]['app_system']) $r[$x]['type'] = 'personal'; -- cgit v1.2.3 From 2f6cb764a4670f848123153e44d6aa58d6ab01b7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 17 Sep 2018 10:30:47 +0200 Subject: prepare submodule to interact with route --- Zotlabs/Module/Articles.php | 2 +- Zotlabs/Web/SubModule.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php index d622b221a..7af1ab6b8 100644 --- a/Zotlabs/Module/Articles.php +++ b/Zotlabs/Module/Articles.php @@ -45,7 +45,7 @@ class Articles extends Controller { return $o; } - nav_set_selected(t('Articles')); + nav_set_selected('Articles'); head_add_link([ 'rel' => 'alternate', diff --git a/Zotlabs/Web/SubModule.php b/Zotlabs/Web/SubModule.php index 7c8404201..763a55d86 100644 --- a/Zotlabs/Web/SubModule.php +++ b/Zotlabs/Web/SubModule.php @@ -2,6 +2,8 @@ namespace Zotlabs\Web; +use Zotlabs\Extend\Route; + /* * @brief * @@ -31,9 +33,23 @@ class SubModule { $filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv($whicharg)) . '.php'; $modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv($whicharg)); + if(file_exists($filename)) { $this->controller = new $modname(); } + + $routes = Route::get(); + + if($routes) { + foreach($routes as $route) { + if(is_array($route) && strtolower($route[1]) === strtolower(argv(0)) . '/' . strtolower(argv($whicharg))) { + include_once($route[0]); + if(class_exists($modname)) { + $this->controller = new $modname; + } + } + } + } } /** @@ -43,6 +59,7 @@ class SubModule { * @return boolean|mixed */ function call($method) { + if(! $this->controller) return false; -- cgit v1.2.3 From a9853e6033ed6a9af639606fa73bb5b40d2fbbcb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 17 Sep 2018 11:36:11 +0200 Subject: seperate settings for mod network --- Zotlabs/Module/Settings/Network.php | 128 ++++++++++++++++++++++++++++++++++++ view/tpl/settings_module.tpl | 15 +++++ 2 files changed, 143 insertions(+) create mode 100644 Zotlabs/Module/Settings/Network.php create mode 100755 view/tpl/settings_module.tpl diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php new file mode 100644 index 000000000..14a118f2c --- /dev/null +++ b/Zotlabs/Module/Settings/Network.php @@ -0,0 +1,128 @@ + 'settings/network', + '$form_security_token' => get_form_security_token("settings_network"), + '$title' => t('Activity Settings'), + '$features' => $arr, + '$baseurl' => z_root(), + '$submit' => t('Submit'), + )); + + return $o; + } + + function get_features() { + $arr = [ + + [ + 'archives', + t('Search by Date'), + t('Ability to select posts by date ranges'), + false, + get_config('feature_lock','archives') + ], + + [ + 'savedsearch', + t('Saved Searches'), + t('Save search terms for re-use'), + false, + get_config('feature_lock','savedsearch') + ], + + [ + 'order_tab', + t('Alternate Stream Order'), + t('Ability to order the stream by last post date, last comment date or unthreaded activities'), + false, + get_config('feature_lock','order_tab') + ], + + [ + 'name_tab', + t('Contact Filter'), + t('Ability to display only posts of a selected contact'), + false, + get_config('feature_lock','name_tab') + ], + + [ + 'forums_tab', + t('Forum Filter'), + t('Ability to display only posts of a specific forum'), + false, + get_config('feature_lock','forums_tab') + ], + + [ + 'personal_tab', + t('Personal Posts Filter'), + t('Ability to display only posts that you\'ve interacted on'), + false, + get_config('feature_lock','personal_tab') + ], + + [ + 'affinity', + t('Affinity Tool'), + t('Filter stream activity by depth of relationships'), + false, + get_config('feature_lock','affinity') + ], + + [ + 'suggest', + t('Suggest Channels'), + t('Show friend and connection suggestions'), + false, + get_config('feature_lock','suggest') + ], + + [ + 'connfilter', + t('Connection Filtering'), + t('Filter incoming posts from connections based on keywords/content'), + false, + get_config('feature_lock','connfilter') + ] + + ]; + + return $arr; + + } + +} diff --git a/view/tpl/settings_module.tpl b/view/tpl/settings_module.tpl new file mode 100755 index 000000000..b2ac5462f --- /dev/null +++ b/view/tpl/settings_module.tpl @@ -0,0 +1,15 @@ +
+
+

{{$title}}

+
+
+
+ + {{foreach $features as $feature}} + {{include file="field_checkbox.tpl" field=$feature}} + {{/foreach}} +
+ +
+
+
-- cgit v1.2.3 From 774729b2215b9d417a6736b1dbaa5bf593df760d Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 17 Sep 2018 13:15:24 +0200 Subject: Update msglib.php --- include/msglib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/msglib.php b/include/msglib.php index f196e7bee..f0bf523de 100644 --- a/include/msglib.php +++ b/include/msglib.php @@ -6,22 +6,22 @@ function msg_drop($message_id, $channel_id, $conv_guid) { // Delete message $r = q("DELETE FROM mail WHERE id = %d AND channel_id = %d", - $message_id, - $channel_id + intval($message_id), + intval($channel_id) ); // Get new first message... $r = q("SELECT mid, parent_mid FROM mail WHERE conv_guid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1", - $conv_guid, - $channel_id + dbesc($conv_guid), + intval($channel_id) ); // ...and if wasn't first before... if ($r[0]['mid'] != $r[0]['parent_mid']) { // ...refer whole thread to it q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d", dbesc($r[0]['mid']), - $conv_guid, - $channel_id + dbesc($conv_guid), + intval($channel_id) ); } -- cgit v1.2.3 From faaffdd618748c5d32f6f04c120af0f791296f0d Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 17 Sep 2018 13:15:43 +0200 Subject: Update message.php --- include/message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/message.php b/include/message.php index 00a1ada38..936c01631 100644 --- a/include/message.php +++ b/include/message.php @@ -500,7 +500,7 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation else { xchan_mail_query($x[0]); $x[0]['mail_deleted'] = true; - msg_drop(intval($messageitem_id), intval($channel_id), dbesc($x[0]['conv_guid'])); + msg_drop($messageitem_id, $channel_id, $x[0]['conv_guid']); build_sync_packet($channel_id,array('mail' => array(encode_mail($x,true)))); return true; } -- cgit v1.2.3 From 12b9106fc7b91564e968ab14618f9677a4e879bb Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 17 Sep 2018 13:16:04 +0200 Subject: Update zot.php --- include/zot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zot.php b/include/zot.php index 38435a124..7e9ee3823 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2338,7 +2338,7 @@ function process_mail_delivery($sender, $arr, $deliveries) { ); if($r) { if(intval($arr['mail_recalled'])) { - msg_drop(intval($r[0]['id']), intval($channel['channel_id']), dbesc($r[0]['conv_guid'])); + msg_drop($r[0]['id'], $channel['channel_id'], $r[0]['conv_guid']); $DR->update('mail recalled'); $result[] = $DR->get(); logger('mail_recalled'); -- cgit v1.2.3