Completed
Pull Request — master (#28)
by rugk
03:18
created
samples/web/include/GetPost.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author rugk
4
- * @copyright Copyright (c) 2015 rugk
5
- * @license MIT
6
- */
3
+	 * @author rugk
4
+	 * @copyright Copyright (c) 2015 rugk
5
+	 * @license MIT
6
+	 */
7 7
 
8 8
 /**
9 9
  * Returns the parameter from GET (preferred) or POST.
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function ReturnGetPost($name)
15 15
 {
16
-    if (isset($_GET[$name])) {
17
-        return $_GET[$name];
18
-    }
19
-    if (isset($_POST[$name])) {
20
-        return $_POST[$name];
21
-    }
16
+	if (isset($_GET[$name])) {
17
+		return $_GET[$name];
18
+	}
19
+	if (isset($_POST[$name])) {
20
+		return $_POST[$name];
21
+	}
22 22
 
23
-    return null;
23
+	return null;
24 24
 }
Please login to merge, or discard this patch.
samples/web/include/Connection.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author rugk
4
- * @copyright Copyright (c) 2015 rugk
5
- * @license MIT
6
- */
3
+	 * @author rugk
4
+	 * @copyright Copyright (c) 2015 rugk
5
+	 * @license MIT
6
+	 */
7 7
 
8 8
 use Threema\MsgApi\Connection;
9 9
 use Threema\MsgApi\ConnectionSettings;
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function CreateConnection($keystorePath='../../keystore.php', $useTlsOptions=true)
22 22
 {
23
-    $publicKeyStore = CreatePublicKeyStore($keystorePath);
24
-    $settings = CreateConnectionSettings($publicKeyStore, $useTlsOptions);
25
-    $connector = InitiateConnection($settings, $publicKeyStore);
23
+	$publicKeyStore = CreatePublicKeyStore($keystorePath);
24
+	$settings = CreateConnectionSettings($publicKeyStore, $useTlsOptions);
25
+	$connector = InitiateConnection($settings, $publicKeyStore);
26 26
 
27
-    return $connector;
27
+	return $connector;
28 28
 }
29 29
 
30 30
 /**
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function CreatePublicKeyStore($keystorePath)
38 38
 {
39
-    if (!file_exists($keystorePath)) {
40
-        if (!touch($keystorePath)) {
41
-            throw new Exception("PHP keystore could not be created.");
42
-        }
43
-    }
44
-    return $publicKeyStore = new Threema\MsgApi\PublicKeyStores\PhpFile($keystorePath);
39
+	if (!file_exists($keystorePath)) {
40
+		if (!touch($keystorePath)) {
41
+			throw new Exception("PHP keystore could not be created.");
42
+		}
43
+	}
44
+	return $publicKeyStore = new Threema\MsgApi\PublicKeyStores\PhpFile($keystorePath);
45 45
 }
46 46
 
47 47
 /**
@@ -54,27 +54,27 @@  discard block
 block discarded – undo
54 54
  */
55 55
 function CreateConnectionSettings($publicKeyStore, $useTlsOptions)
56 56
 {
57
-    if ($useTlsOptions == true) {
58
-        //create a connection with advanced options
59
-        $settings = new ConnectionSettings(
60
-            MSGAPI_GATEWAY_THREEMA_ID,
61
-            MSGAPI_GATEWAY_THREEMA_ID_SECRET,
62
-            null,
63
-            [
64
-                'forceHttps' => true,
65
-                'tlsVersion' => '1.2',
66
-                'tlsCipher' => 'ECDHE-RSA-AES128-GCM-SHA256'
67
-            ]
68
-        );
69
-    } else {
70
-        //create a connection with default options
71
-        $settings = new ConnectionSettings(
72
-            MSGAPI_GATEWAY_THREEMA_ID,
73
-            MSGAPI_GATEWAY_THREEMA_ID_SECRET
74
-        );
75
-    }
57
+	if ($useTlsOptions == true) {
58
+		//create a connection with advanced options
59
+		$settings = new ConnectionSettings(
60
+			MSGAPI_GATEWAY_THREEMA_ID,
61
+			MSGAPI_GATEWAY_THREEMA_ID_SECRET,
62
+			null,
63
+			[
64
+				'forceHttps' => true,
65
+				'tlsVersion' => '1.2',
66
+				'tlsCipher' => 'ECDHE-RSA-AES128-GCM-SHA256'
67
+			]
68
+		);
69
+	} else {
70
+		//create a connection with default options
71
+		$settings = new ConnectionSettings(
72
+			MSGAPI_GATEWAY_THREEMA_ID,
73
+			MSGAPI_GATEWAY_THREEMA_ID_SECRET
74
+		);
75
+	}
76 76
 
77
-    return $settings;
77
+	return $settings;
78 78
 }
79 79
 
80 80
 /**
@@ -87,5 +87,5 @@  discard block
 block discarded – undo
87 87
  */
88 88
 function InitiateConnection($settings, $publicKeyStore)
89 89
 {
90
-    return $connector = new Connection($settings, $publicKeyStore);
90
+	return $connector = new Connection($settings, $publicKeyStore);
91 91
 }
Please login to merge, or discard this patch.
samples/web/include/PublicKey.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author rugk
4
- * @copyright Copyright (c) 2015 rugk
5
- * @license MIT
6
- */
3
+	 * @author rugk
4
+	 * @copyright Copyright (c) 2015 rugk
5
+	 * @license MIT
6
+	 */
7 7
 
8 8
 /**
9 9
  * Checks whether a HEX-key is valid.
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function KeyCheck($publicKey, $suffix='')
16 16
 {
17
-    // RegExp: https://regex101.com/r/sU5tC8/1
18
-    return preg_match('/^(' . $suffix . ')?[[:alnum:]]{64}$/', $publicKey);
17
+	// RegExp: https://regex101.com/r/sU5tC8/1
18
+	return preg_match('/^(' . $suffix . ')?[[:alnum:]]{64}$/', $publicKey);
19 19
 }
20 20
 
21 21
 /**
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function KeyGetUserDisplay($publicKey)
34 34
 {
35
-    //force key to be binary
36
-    if (ctype_alnum($publicKey)) {
37
-        $publicKey = KeyHexToBin($publicKey);
38
-    }
35
+	//force key to be binary
36
+	if (ctype_alnum($publicKey)) {
37
+		$publicKey = KeyHexToBin($publicKey);
38
+	}
39 39
 
40
-    //create short hash
41
-    $shortHash = substr(hash('sha256', $publicKey, 0, 32));
42
-    return $shortHash;
40
+	//create short hash
41
+	$shortHash = substr(hash('sha256', $publicKey, 0, 32));
42
+	return $shortHash;
43 43
 }
44 44
 
45 45
 /**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function KeyHexToBin($keyHex)
53 53
 {
54
-    //delete prefix
55
-    $keyTypeCheck = substr($keyHex, 0, 8);
56
-    if ($keyTypeCheck == 'private:' || $keyTypeCheck == 'public:') {
57
-        $keyHex = substr($keyHex, 8);
58
-    }
54
+	//delete prefix
55
+	$keyTypeCheck = substr($keyHex, 0, 8);
56
+	if ($keyTypeCheck == 'private:' || $keyTypeCheck == 'public:') {
57
+		$keyHex = substr($keyHex, 8);
58
+	}
59 59
 
60
-    //convert key
61
-    $keyBin = hex2bin($keyHex);
62
-    return $keyBin;
60
+	//convert key
61
+	$keyBin = hex2bin($keyHex);
62
+	return $keyBin;
63 63
 }
Please login to merge, or discard this patch.
samples/web/include/GlobalConstants.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author rugk
4
- * @copyright Copyright (c) 2015 rugk
5
- * @license MIT
6
- */
3
+	 * @author rugk
4
+	 * @copyright Copyright (c) 2015 rugk
5
+	 * @license MIT
6
+	 */
7 7
 
8 8
 /* CONSTANTS */
9 9
 const FILENAME_CONNCRED = 'ConnectionCredentials.php';
Please login to merge, or discard this patch.
samples/web/FetchPublicKey.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,21 +32,21 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function FetchPublicKey($connector, $threemaId)
34 34
 {
35
-    $result = $connector->fetchPublicKey($threemaId);
36
-    if($result->isSuccess()) {
37
-    	return $result->getPublicKey();
38
-    }
39
-    else {
40
-    	throw new Exception($result->getErrorMessage());
41
-    }
35
+	$result = $connector->fetchPublicKey($threemaId);
36
+	if($result->isSuccess()) {
37
+		return $result->getPublicKey();
38
+	}
39
+	else {
40
+		throw new Exception($result->getErrorMessage());
41
+	}
42 42
 }
43 43
 
44 44
 //get params
45 45
 $threemaId = null;
46 46
 if (ReturnGetPost('threemaid') &&
47
-    preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('threemaid'))
47
+	preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('threemaid'))
48 48
 ) {
49
-    $threemaId = htmlentities(ReturnGetPost('threemaid'));
49
+	$threemaId = htmlentities(ReturnGetPost('threemaid'));
50 50
 }
51 51
 
52 52
 //create connection
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 
55 55
 //Fetch public key and return a 500 error in case of a failure
56 56
 if ($threemaId != null) {
57
-    try {
58
-        $publicKey = FetchPublicKey($connector, $threemaId);
59
-        echo $publicKey;
60
-    }
61
-    catch (Exception $e) {
62
-        http_response_code(500);
63
-        echo $e->getMessage();
64
-    }
57
+	try {
58
+		$publicKey = FetchPublicKey($connector, $threemaId);
59
+		echo $publicKey;
60
+	}
61
+	catch (Exception $e) {
62
+		http_response_code(500);
63
+		echo $e->getMessage();
64
+	}
65 65
 } else {
66
-    http_response_code(500);
67
-    echo 'Invalid Threema ID';
66
+	http_response_code(500);
67
+	echo 'Invalid Threema ID';
68 68
 }
Please login to merge, or discard this patch.
samples/web/index.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <!--
2 2
 <?php
3 3
 /**
4
- * @author rugk
5
- * @copyright Copyright (c) 2015 rugk
6
- * @license MIT
7
- */
4
+	 * @author rugk
5
+	 * @copyright Copyright (c) 2015 rugk
6
+	 * @license MIT
7
+	 */
8 8
 
9 9
 /* INCLUDES */
10 10
 require_once 'include/GlobalConstants.php';
@@ -18,86 +18,86 @@  discard block
 block discarded – undo
18 18
 /* SOME SMALL FUNCTIONS */
19 19
 function ShowDefaultReceiverId($addOptionsHtmlCode = false)
20 20
 {
21
-    $isShown = ReturnGetPost('threemaid') != null || ReturnGetPost('recieverid') != null || MSGAPI_DEFAULTRECEIVER <> '';
22
-
23
-    // Show previous input if there is something
24
-    if ($isShown && $addOptionsHtmlCode) {
25
-        echo '<option value="';
26
-    }
27
-
28
-    if (ReturnGetPost('threemaid') != null) {
29
-        echo htmlentities(ReturnGetPost('threemaid'));
30
-    } elseif (ReturnGetPost('recieverid') != null) {
31
-        echo htmlentities(ReturnGetPost('recieverid'));
32
-    } elseif (MSGAPI_DEFAULTRECEIVER <> '') {
33
-        // use receiver in config
34
-        echo MSGAPI_DEFAULTRECEIVER;
35
-    }
36
-
37
-    if ($isShown && $addOptionsHtmlCode) {
38
-        echo '">';
39
-    }
21
+	$isShown = ReturnGetPost('threemaid') != null || ReturnGetPost('recieverid') != null || MSGAPI_DEFAULTRECEIVER <> '';
22
+
23
+	// Show previous input if there is something
24
+	if ($isShown && $addOptionsHtmlCode) {
25
+		echo '<option value="';
26
+	}
27
+
28
+	if (ReturnGetPost('threemaid') != null) {
29
+		echo htmlentities(ReturnGetPost('threemaid'));
30
+	} elseif (ReturnGetPost('recieverid') != null) {
31
+		echo htmlentities(ReturnGetPost('recieverid'));
32
+	} elseif (MSGAPI_DEFAULTRECEIVER <> '') {
33
+		// use receiver in config
34
+		echo MSGAPI_DEFAULTRECEIVER;
35
+	}
36
+
37
+	if ($isShown && $addOptionsHtmlCode) {
38
+		echo '">';
39
+	}
40 40
 }
41 41
 
42 42
 function ShowDefaultMessage()
43 43
 {
44
-    // Show previous input if there is something
45
-    if (ReturnGetPost('message') != null) {
46
-        echo htmlentities(ReturnGetPost('message'));
47
-    }
44
+	// Show previous input if there is something
45
+	if (ReturnGetPost('message') != null) {
46
+		echo htmlentities(ReturnGetPost('message'));
47
+	}
48 48
 }
49 49
 
50 50
 /* CHECK PREREQUISITES */
51 51
 $fileConnCredentErr = '';
52 52
 if (!file_exists(FILENAME_CONNCRED)) {
53
-    $fileConnCredentErr .= ' The file does not exist.';
53
+	$fileConnCredentErr .= ' The file does not exist.';
54 54
 } else {
55
-    require_once FILENAME_CONNCRED;
56
-    if (!defined('MSGAPI_GATEWAY_THREEMA_ID') ||
57
-        !defined('MSGAPI_GATEWAY_THREEMA_ID_SECRET')
58
-    ) {
59
-        $fileConnCredentErr .= ' Not all required constants are defined.';
60
-    } else {
61
-        if (MSGAPI_GATEWAY_THREEMA_ID == '' ||
62
-            !preg_match('/' . REGEXP_THREEMAID_GATEWAY . '/', MSGAPI_GATEWAY_THREEMA_ID)
63
-        ) {
64
-            $fileConnCredentErr .= ' \'MSGAPI_GATEWAY_THREEMA_ID\' is invalid.';
65
-        }
66
-
67
-        if (MSGAPI_GATEWAY_THREEMA_ID_SECRET == '' ||
68
-            !ctype_alnum(MSGAPI_GATEWAY_THREEMA_ID_SECRET)
69
-        ) {
70
-            $fileConnCredentErr .= ' \'MSGAPI_GATEWAY_THREEMA_ID_SECRET\' is invalid.';
71
-        }
72
-
73
-        // MSGAPI_DEFAULTRECEIVER is optional
74
-        if (!defined('MSGAPI_DEFAULTRECEIVER')) {
75
-            define('MSGAPI_DEFAULTRECEIVER', '');
76
-        }
77
-
78
-        if (MSGAPI_DEFAULTRECEIVER <> '' &&
79
-            !preg_match('/' . REGEXP_THREEMAID_ANY . '/', MSGAPI_DEFAULTRECEIVER)
80
-        ) {
81
-            $fileConnCredentErr .= ' \'MSGAPI_DEFAULTRECEIVER\' is invalid.';
82
-        }
83
-    }
55
+	require_once FILENAME_CONNCRED;
56
+	if (!defined('MSGAPI_GATEWAY_THREEMA_ID') ||
57
+		!defined('MSGAPI_GATEWAY_THREEMA_ID_SECRET')
58
+	) {
59
+		$fileConnCredentErr .= ' Not all required constants are defined.';
60
+	} else {
61
+		if (MSGAPI_GATEWAY_THREEMA_ID == '' ||
62
+			!preg_match('/' . REGEXP_THREEMAID_GATEWAY . '/', MSGAPI_GATEWAY_THREEMA_ID)
63
+		) {
64
+			$fileConnCredentErr .= ' \'MSGAPI_GATEWAY_THREEMA_ID\' is invalid.';
65
+		}
66
+
67
+		if (MSGAPI_GATEWAY_THREEMA_ID_SECRET == '' ||
68
+			!ctype_alnum(MSGAPI_GATEWAY_THREEMA_ID_SECRET)
69
+		) {
70
+			$fileConnCredentErr .= ' \'MSGAPI_GATEWAY_THREEMA_ID_SECRET\' is invalid.';
71
+		}
72
+
73
+		// MSGAPI_DEFAULTRECEIVER is optional
74
+		if (!defined('MSGAPI_DEFAULTRECEIVER')) {
75
+			define('MSGAPI_DEFAULTRECEIVER', '');
76
+		}
77
+
78
+		if (MSGAPI_DEFAULTRECEIVER <> '' &&
79
+			!preg_match('/' . REGEXP_THREEMAID_ANY . '/', MSGAPI_DEFAULTRECEIVER)
80
+		) {
81
+			$fileConnCredentErr .= ' \'MSGAPI_DEFAULTRECEIVER\' is invalid.';
82
+		}
83
+	}
84 84
 }
85 85
 
86 86
 
87 87
 $fileChkPrivateKeyErr = '';
88 88
 if (!file_exists(FILENAME_PRIVKEY)) {
89
-    $fileChkPrivateKeyErr .= ' The file does not exist.';
89
+	$fileChkPrivateKeyErr .= ' The file does not exist.';
90 90
 } else {
91
-    require_once FILENAME_PRIVKEY;
92
-    if (!defined('MSGAPI_PRIVATE_KEY')) {
93
-        $fileChkPrivateKeyErr .= ' Not all constants are defined.';
94
-    } else {
95
-        if (MSGAPI_PRIVATE_KEY == '' ||
96
-            !KeyCheck(MSGAPI_PRIVATE_KEY, 'private:')
97
-        ) {
98
-            $fileChkPrivateKeyErr .= ' \'MSGAPI_PRIVATE_KEY\' is invalid.';
99
-        }
100
-    }
91
+	require_once FILENAME_PRIVKEY;
92
+	if (!defined('MSGAPI_PRIVATE_KEY')) {
93
+		$fileChkPrivateKeyErr .= ' Not all constants are defined.';
94
+	} else {
95
+		if (MSGAPI_PRIVATE_KEY == '' ||
96
+			!KeyCheck(MSGAPI_PRIVATE_KEY, 'private:')
97
+		) {
98
+			$fileChkPrivateKeyErr .= ' \'MSGAPI_PRIVATE_KEY\' is invalid.';
99
+		}
100
+	}
101 101
 }
102 102
 ?>
103 103
 -->
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
     </head>
112 112
     <body>
113 113
         <?php
114
-        // only shows content when it is not parsed by a PHP interpreter
115
-        if (false):
116
-        ?>
114
+		// only shows content when it is not parsed by a PHP interpreter
115
+		if (false):
116
+		?>
117 117
         <!-- PHP parsing error message -->
118 118
         <div class="warning">
119 119
             You are viewing this file within a browser. However you do need to call this file
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
             PHP support and access the file like this: <code>http://127.0.0.1/threema-msgapi-sdk-php/samples/web/</code>.
122 122
         </div>
123 123
         <?php
124
-        endif
125
-        ?>
124
+		endif
125
+		?>
126 126
 
127 127
         <h1 id="devui">Development UI - MSGAPI-PHP-SDK - Threema Gateway</h1>
128 128
         <p>
Please login to merge, or discard this patch.
samples/web/SendE2EText.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @author rugk
4
- * @copyright Copyright (c) 2015 rugk
5
- * @license MIT
6
- */
3
+		 * @author rugk
4
+		 * @copyright Copyright (c) 2015 rugk
5
+		 * @license MIT
6
+		 */
7 7
 
8 8
 header('Content-Type: text/plain');
9 9
 
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function SendText($connector, $receiverId, $message)
33 33
 {
34
-    //get private key
35
-    $privateKey = KeyHexToBin(MSGAPI_PRIVATE_KEY);
36
-
37
-    //send message
38
-    $e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($privateKey, $connector);
39
-    $result = $e2eHelper->sendTextMessage($receiverId, $message);
40
-
41
-    //show result
42
-    if(true === $result->isSuccess()) {
43
-    	echo 'Message ID: '.$result->getMessageId() . "\n";
44
-    } else {
45
-    	echo 'Error: '.$result->getErrorMessage() . "\n";
46
-    }
34
+	//get private key
35
+	$privateKey = KeyHexToBin(MSGAPI_PRIVATE_KEY);
36
+
37
+	//send message
38
+	$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper($privateKey, $connector);
39
+	$result = $e2eHelper->sendTextMessage($receiverId, $message);
40
+
41
+	//show result
42
+	if(true === $result->isSuccess()) {
43
+		echo 'Message ID: '.$result->getMessageId() . "\n";
44
+	} else {
45
+		echo 'Error: '.$result->getErrorMessage() . "\n";
46
+	}
47 47
 
48 48
 }
49 49
 
Please login to merge, or discard this patch.
samples/web/SendTextMessage.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function SendMessage($connector, $threemaId, $message)
40 40
 {
41
-    $e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper(KeyHexToBin(MSGAPI_PRIVATE_KEY), $connector);
42
-    $result = $e2eHelper->sendTextMessage($threemaId, $message);
41
+	$e2eHelper = new \Threema\MsgApi\Helpers\E2EHelper(KeyHexToBin(MSGAPI_PRIVATE_KEY), $connector);
42
+	$result = $e2eHelper->sendTextMessage($threemaId, $message);
43 43
 
44
-    if (true === $result->isSuccess()) {
45
-        return $result->getMessageId();
46
-    } else {
47
-        throw new Exception($result->getErrorMessage());
48
-    }
44
+	if (true === $result->isSuccess()) {
45
+		return $result->getMessageId();
46
+	} else {
47
+		throw new Exception($result->getErrorMessage());
48
+	}
49 49
 }
50 50
 
51 51
 //get params
52 52
 if (ReturnGetPost('recieverid') &&
53
-    preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('recieverid'))
53
+	preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('recieverid'))
54 54
 ) {
55
-    $threemaId = htmlentities(ReturnGetPost('recieverid'));
56
-    $message = ReturnGetPost('message');
55
+	$threemaId = htmlentities(ReturnGetPost('recieverid'));
56
+	$message = ReturnGetPost('message');
57 57
 }
58 58
 
59 59
 //create connection
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
 
62 62
 //Send message
63 63
 if ($threemaId != null && $message != null) {
64
-    if (!$isIncluded) {
65
-        header('Content-Type: text/plain');
66
-    }
67
-    $actionDone = true;
64
+	if (!$isIncluded) {
65
+		header('Content-Type: text/plain');
66
+	}
67
+	$actionDone = true;
68 68
 
69
-    try {
70
-        $messageId = SendMessage($connector, $threemaId, $message);
71
-    } catch (Exception $e) {
72
-        http_response_code(500);
73
-        $errorMessage = $e->getMessage();
74
-    }
69
+	try {
70
+		$messageId = SendMessage($connector, $threemaId, $message);
71
+	} catch (Exception $e) {
72
+		http_response_code(500);
73
+		$errorMessage = $e->getMessage();
74
+	}
75 75
 }
76 76
 
77 77
 //Show direct output if the file is called directly
78 78
 if (!$isIncluded) {
79
-    if ($errorMessage == null) {
80
-        echo 'Message ID: ' . $messageId;
81
-    } else {
82
-        echo $errorMessage;
83
-    }
79
+	if ($errorMessage == null) {
80
+		echo 'Message ID: ' . $messageId;
81
+	} else {
82
+		echo $errorMessage;
83
+	}
84 84
 }
Please login to merge, or discard this patch.