From a5a89be9613dde41a45d9c146bfda9a599aeeeca Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 7 Dec 2017 20:41:20 +0100 Subject: [PATCH 1/4] fix: vue.inbox (now takes the right msg content) --- view/vue/container/inbox.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/vue/container/inbox.vue b/view/vue/container/inbox.vue index accf734..34773d6 100644 --- a/view/vue/container/inbox.vue +++ b/view/vue/container/inbox.vue @@ -9,7 +9,7 @@
-
+
From c01cbb89a79e8bc04c9b4cc5d1f7fb50b77984e3 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 7 Dec 2017 20:47:03 +0100 Subject: [PATCH 2/4] refactor bbcode() from container/*.vue to view.vue-config --- view/vue-config.js | 48 +++++++++++++++++++++++++++++++- view/vue/container/emergency.vue | 46 +----------------------------- view/vue/container/event.vue | 46 +----------------------------- view/vue/container/inbox.vue | 46 +----------------------------- 4 files changed, 50 insertions(+), 136 deletions(-) diff --git a/view/vue-config.js b/view/vue-config.js index a32fc61..2329ece 100644 --- a/view/vue-config.js +++ b/view/vue-config.js @@ -73,7 +73,53 @@ gstore.add('func', { gstore.data.notif[id].count = 0; }, - toggleMenuSize: function(){ gstore.data.min_menu=!gstore.data.min_menu; } + toggleMenuSize: function(){ gstore.data.min_menu=!gstore.data.min_menu; }, + bbcode: function(msg){ + /* (1) Escape HTML + ---------------------------------------------------------*/ + msg = msg.replace(/&/g, '&'); + msg = msg.replace(//g, '>'); + + + /* (2) Manage text format + ---------------------------------------------------------*/ + /* (1) Manage bold */ + msg = msg.replace(/\*([^\*]+)\*/g, "$1"); + + /* (2) italic */ + msg = msg.replace(/_([^_]+)_/g, "$1"); + + /* (3) underline */ + msg = msg.replace(/\[([^\]]+)\]/g, "$1"); + + /* (4) Code */ + msg = msg.replace(/`([^`]+)`/g, "$1"); + + + /* (3) Manage emojis + ---------------------------------------------------------*/ + /* (1) Smileys */ + msg = msg.replace(/:D/g, "πŸ˜ƒ"); + msg = msg.replace(/:\)/g, "πŸ™‚"); + msg = msg.replace(/:B/g, "😎"); + msg = msg.replace(/:3/g, "πŸ˜—"); + msg = msg.replace(/;\)/g, "πŸ˜‰"); + msg = msg.replace(/:P/g, "πŸ˜‹"); + msg = msg.replace(/;P/g, "😜"); + msg = msg.replace(/xD/g, "πŸ˜†"); + msg = msg.replace(/:O/ig, "😲"); + msg = msg.replace(/:S/g, "πŸ˜–"); + msg = msg.replace(/\^\^/g, "😊"); + + /* (2) Emojis */ + msg = msg.replace(/:poop:/g, "πŸ’©"); + msg = msg.replace(/:fuck:/g, "πŸ–•"); + msg = msg.replace(/\+1/g, "πŸ‘"); + msg = msg.replace(/-1/g, "πŸ‘Ž"); + + return msg; + } }); diff --git a/view/vue/container/emergency.vue b/view/vue/container/emergency.vue index 7094152..2daf475 100644 --- a/view/vue/container/emergency.vue +++ b/view/vue/container/emergency.vue @@ -60,51 +60,7 @@ export default { }, bbcode: function(msg){ - - /* (1) Escape HTML - ---------------------------------------------------------*/ - msg = msg.replace(/&/g, '&'); - msg = msg.replace(//g, '>'); - - - /* (2) Manage text format - ---------------------------------------------------------*/ - /* (1) Manage bold */ - msg = msg.replace(/\*([^\*]+)\*/g, "$1"); - - /* (2) italic */ - msg = msg.replace(/_([^_]+)_/g, "$1"); - - /* (3) underline */ - msg = msg.replace(/\[([^\]]+)\]/g, "$1"); - - /* (4) Code */ - msg = msg.replace(/`([^`]+)`/g, "$1"); - - - /* (3) Manage emojis - ---------------------------------------------------------*/ - /* (1) Smileys */ - msg = msg.replace(/:D/g, "πŸ˜ƒ"); - msg = msg.replace(/:\)/g, "πŸ™‚"); - msg = msg.replace(/:B/g, "😎"); - msg = msg.replace(/:3/g, "πŸ˜—"); - msg = msg.replace(/;\)/g, "πŸ˜‰"); - msg = msg.replace(/:P/g, "πŸ˜‹"); - msg = msg.replace(/;P/g, "😜"); - msg = msg.replace(/xD/g, "πŸ˜†"); - msg = msg.replace(/:O/ig, "😲"); - msg = msg.replace(/:S/g, "πŸ˜–"); - msg = msg.replace(/\^\^/g, "😊"); - - /* (2) Emojis */ - msg = msg.replace(/:poop:/g, "πŸ’©"); - msg = msg.replace(/:fuck:/g, "πŸ–•"); - msg = msg.replace(/\+1/g, "πŸ‘"); - msg = msg.replace(/-1/g, "πŸ‘Ž"); - - return msg; + return this.gstore.func.bbcode(msg); } } } diff --git a/view/vue/container/event.vue b/view/vue/container/event.vue index f96b542..9c7f8ac 100644 --- a/view/vue/container/event.vue +++ b/view/vue/container/event.vue @@ -60,51 +60,7 @@ export default { }, bbcode: function(msg){ - - /* (1) Escape HTML - ---------------------------------------------------------*/ - msg = msg.replace(/&/g, '&'); - msg = msg.replace(//g, '>'); - - - /* (2) Manage text format - ---------------------------------------------------------*/ - /* (1) Manage bold */ - msg = msg.replace(/\*([^\*]+)\*/g, "$1"); - - /* (2) italic */ - msg = msg.replace(/_([^_]+)_/g, "$1"); - - /* (3) underline */ - msg = msg.replace(/\[([^\]]+)\]/g, "$1"); - - /* (4) Code */ - msg = msg.replace(/`([^`]+)`/g, "$1"); - - - /* (3) Manage emojis - ---------------------------------------------------------*/ - /* (1) Smileys */ - msg = msg.replace(/:D/g, "πŸ˜ƒ"); - msg = msg.replace(/:\)/g, "πŸ™‚"); - msg = msg.replace(/:B/g, "😎"); - msg = msg.replace(/:3/g, "πŸ˜—"); - msg = msg.replace(/;\)/g, "πŸ˜‰"); - msg = msg.replace(/:P/g, "πŸ˜‹"); - msg = msg.replace(/;P/g, "😜"); - msg = msg.replace(/xD/g, "πŸ˜†"); - msg = msg.replace(/:O/ig, "😲"); - msg = msg.replace(/:S/g, "πŸ˜–"); - msg = msg.replace(/\^\^/g, "😊"); - - /* (2) Emojis */ - msg = msg.replace(/:poop:/g, "πŸ’©"); - msg = msg.replace(/:fuck:/g, "πŸ–•"); - msg = msg.replace(/\+1/g, "πŸ‘"); - msg = msg.replace(/-1/g, "πŸ‘Ž"); - - return msg; + return this.gstore.func.bbcode(msg); } } } diff --git a/view/vue/container/inbox.vue b/view/vue/container/inbox.vue index 34773d6..3f67c47 100644 --- a/view/vue/container/inbox.vue +++ b/view/vue/container/inbox.vue @@ -42,51 +42,7 @@ export default { }, bbcode: function(msg){ - - /* (1) Escape HTML - ---------------------------------------------------------*/ - msg = msg.replace(/&/g, '&'); - msg = msg.replace(//g, '>'); - - - /* (2) Manage text format - ---------------------------------------------------------*/ - /* (1) Manage bold */ - msg = msg.replace(/\*([^\*]+)\*/g, "$1"); - - /* (2) italic */ - msg = msg.replace(/_([^_]+)_/g, "$1"); - - /* (3) underline */ - msg = msg.replace(/\[([^\]]+)\]/g, "$1"); - - /* (4) Code */ - msg = msg.replace(/`([^`]+)`/g, "$1"); - - - /* (3) Manage emojis - ---------------------------------------------------------*/ - /* (1) Smileys */ - msg = msg.replace(/:D/g, "πŸ˜ƒ"); - msg = msg.replace(/:\)/g, "πŸ™‚"); - msg = msg.replace(/:B/g, "😎"); - msg = msg.replace(/:3/g, "πŸ˜—"); - msg = msg.replace(/;\)/g, "πŸ˜‰"); - msg = msg.replace(/:P/g, "πŸ˜‹"); - msg = msg.replace(/;P/g, "😜"); - msg = msg.replace(/xD/g, "πŸ˜†"); - msg = msg.replace(/:O/ig, "😲"); - msg = msg.replace(/:S/g, "πŸ˜–"); - msg = msg.replace(/\^\^/g, "😊"); - - /* (2) Emojis */ - msg = msg.replace(/:poop:/g, "πŸ’©"); - msg = msg.replace(/:fuck:/g, "πŸ–•"); - msg = msg.replace(/\+1/g, "πŸ‘"); - msg = msg.replace(/-1/g, "πŸ‘Ž"); - - return msg; + return this.gstore.func.bbcode(msg); } } } From e30b4a6098019051b1ba760cfc06c8ce83ad20f8 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 7 Dec 2017 20:51:06 +0100 Subject: [PATCH 3/4] fix: vue.emergency (now detect session.name instead of session.user) --- view/vue/container/emergency.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/vue/container/emergency.vue b/view/vue/container/emergency.vue index 2daf475..5baf3a6 100644 --- a/view/vue/container/emergency.vue +++ b/view/vue/container/emergency.vue @@ -2,7 +2,7 @@
-
+
From 79c74e98324f93fd311b6f56339c3b5e48695cba Mon Sep 17 00:00:00 2001 From: SeekDaSky Date: Thu, 7 Dec 2017 21:06:09 +0100 Subject: [PATCH 4/4] upd: Postmessage channel emergency interop --- build/api/module/message.php | 7 +++++-- config/modules.json | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build/api/module/message.php b/build/api/module/message.php index d0f103d..b975883 100644 --- a/build/api/module/message.php +++ b/build/api/module/message.php @@ -17,16 +17,19 @@ class message public function POST_emergency($argv){ extract($argv); - $wsi = new wsinterop("localhost",9997); + $wsi = new wsinterop("localhost",9998); $wsi->send([ "operation" => "PostMessage", "message" => $message, "username" => $username, + "location" => $location, "channelType" => "Emergency", - "channelName" => $URL_0 + "channelName" => is_null($URL_0) ? "" : "$URL_0" ]); + $wsi->close(); + return ["sent" => true]; //TODO: tout poster dans la BDD } diff --git a/config/modules.json b/config/modules.json index 852f7c0..5065b8b 100755 --- a/config/modules.json +++ b/config/modules.json @@ -108,7 +108,7 @@ "parameters": { "URL_0": { "description": "code departement, si le paramètre n'est pas fourni le message est envoyé en broadcast", - "type" : "varchar(2,2)", + "type" : "numeric", "optional" : true }, @@ -126,7 +126,7 @@ "location": { "description": "coordonés GPS du message, des coordonnées invalide ne seront pas affiché", - "type": "array" + "type": "array" } } }