mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: make sure parameters are strings
This commit is contained in:
@@ -6,14 +6,15 @@
|
|||||||
|
|
||||||
# url encoding
|
# url encoding
|
||||||
:global UrlEncode do={
|
:global UrlEncode do={
|
||||||
|
:local input [ :tostr $1 ];
|
||||||
:local return "";
|
:local return "";
|
||||||
|
|
||||||
:if ([ :len $1 ] > 0) do={
|
:if ([ :len $input ] > 0) do={
|
||||||
:local chars " %&";
|
:local chars " %&";
|
||||||
:local subs { "%20"; "%25"; "%26" };
|
:local subs { "%20"; "%25"; "%26" };
|
||||||
|
|
||||||
:for i from=0 to=([ :len $1 ] - 1) do={
|
:for i from=0 to=([ :len $input ] - 1) do={
|
||||||
:local char [ :pick $1 $i ];
|
:local char [ :pick $input $i ];
|
||||||
:local replace [ :find $chars $char ];
|
:local replace [ :find $chars $char ];
|
||||||
|
|
||||||
:if ([ :len $replace ] > 0) do={
|
:if ([ :len $replace ] > 0) do={
|
||||||
@@ -29,9 +30,9 @@
|
|||||||
# send notification via e-mail and telegram
|
# send notification via e-mail and telegram
|
||||||
# Note that subject and attachment are ignored for telegram!
|
# Note that subject and attachment are ignored for telegram!
|
||||||
:global SendNotification do={
|
:global SendNotification do={
|
||||||
:local subject $1;
|
:local subject [ :tostr $1 ];
|
||||||
:local message $2;
|
:local message [ :tostr $2 ];
|
||||||
:local attach $3;
|
:local attach [ :tostr $3 ];
|
||||||
|
|
||||||
:global "email-general-to";
|
:global "email-general-to";
|
||||||
:global "email-general-cc";
|
:global "email-general-cc";
|
||||||
|
Reference in New Issue
Block a user