Test Failed
Push — master ( 19e7e7...e85ccb )
by
unknown
07:48
created
plugins/kendox/php/kendox-client/class.kendox-client.php 3 patches
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -1,171 +1,171 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Kendox;
3 3
 
4
-    require_once("class.kendox-token-generator.php");
4
+	require_once("class.kendox-token-generator.php");
5 5
 
6
-    class Client
7
-    {
6
+	class Client
7
+	{
8 8
         
9
-        /**
10
-         * Generated token for user
11
-         * 
12
-         * @var StdClass
13
-         */
14
-        public $Token = null;
9
+		/**
10
+		 * Generated token for user
11
+		 * 
12
+		 * @var StdClass
13
+		 */
14
+		public $Token = null;
15 15
 
16
-        /**
17
-         * URL of Kendox Service Endpoint
18
-         * @var string
19
-         */
20
-        public $ServiceEndpoint = null;
16
+		/**
17
+		 * URL of Kendox Service Endpoint
18
+		 * @var string
19
+		 */
20
+		public $ServiceEndpoint = null;
21 21
 
22
-        /**
23
-         * Connection Id returned from service on successful login
24
-         * @var string
25
-         */
26
-        public $ConnectionId = null;
22
+		/**
23
+		 * Connection Id returned from service on successful login
24
+		 * @var string
25
+		 */
26
+		public $ConnectionId = null;
27 27
 
28
-        function __construct($serviceEndpoint)
29
-        {
30
-            if (!str_ends_with($serviceEndpoint, '/')) $serviceEndpoint .= '/';
31
-            $this->ServiceEndpoint = $serviceEndpoint;
32
-        }
28
+		function __construct($serviceEndpoint)
29
+		{
30
+			if (!str_ends_with($serviceEndpoint, '/')) $serviceEndpoint .= '/';
31
+			$this->ServiceEndpoint = $serviceEndpoint;
32
+		}
33 33
 
34
-        /**
35
-         * Login to kendox service by creating a user based token, signed by Kendox trusted certificate
36
-         * 
37
-         * @param string $pfxFile The full path and file name of the PFX-File (certificate)
38
-         * @param string $pfxPassword The password used for reading the PFX-File (certificate)
39
-         * @param string $userName Username for token generation
40
-         * 
41
-         * @return bool
42
-         */
43
-        public function loginWithToken($pfxFile, $pfxPassword, $userName) {
44
-            try {
45
-                $issuer = gethostname();
46
-                $tokenGenerator = new \Kendox\TokenGenerator($issuer, $pfxFile, $pfxPassword);
47
-                $this->Token = $tokenGenerator->generateToken($userName);                
48
-                $logonParameters = [
49
-                    "tenantName" => "",
50
-                    "token" => $this->Token,
51
-                    "tokenType" => "InfoShareToken"
52
-                ];
53
-                $result = $this->post("Authentication/LogonWithToken", $logonParameters);
54
-                $this->ConnectionId = $result->LogonWithTokenResult->ConnectionId;
55
-                return true;
56
-            } catch(\Exception $ex) {
57
-                throw new \Exception("Token-Login failed: ".$ex->getMessage());
58
-            }
59
-        }
34
+		/**
35
+		 * Login to kendox service by creating a user based token, signed by Kendox trusted certificate
36
+		 * 
37
+		 * @param string $pfxFile The full path and file name of the PFX-File (certificate)
38
+		 * @param string $pfxPassword The password used for reading the PFX-File (certificate)
39
+		 * @param string $userName Username for token generation
40
+		 * 
41
+		 * @return bool
42
+		 */
43
+		public function loginWithToken($pfxFile, $pfxPassword, $userName) {
44
+			try {
45
+				$issuer = gethostname();
46
+				$tokenGenerator = new \Kendox\TokenGenerator($issuer, $pfxFile, $pfxPassword);
47
+				$this->Token = $tokenGenerator->generateToken($userName);                
48
+				$logonParameters = [
49
+					"tenantName" => "",
50
+					"token" => $this->Token,
51
+					"tokenType" => "InfoShareToken"
52
+				];
53
+				$result = $this->post("Authentication/LogonWithToken", $logonParameters);
54
+				$this->ConnectionId = $result->LogonWithTokenResult->ConnectionId;
55
+				return true;
56
+			} catch(\Exception $ex) {
57
+				throw new \Exception("Token-Login failed: ".$ex->getMessage());
58
+			}
59
+		}
60 60
 
61
-        /**
62
-         * Logout from kendox
63
-         * 
64
-         * @return bool
65
-         */
66
-        public function logout() {
67
-            try {
68
-                $logoutParameters = [
69
-                    "connectionId" => $this->ConnectionId
70
-                ];
71
-                $result = $this->post("Authentication/Logout", $logoutParameters);
72
-                $this->ConnectionId = null;
73
-                return true;
74
-            } catch(\Exception $ex) {
75
-                throw new \Exception("Token-Login failed: ".$ex->getMessage());
76
-            }
77
-        }
61
+		/**
62
+		 * Logout from kendox
63
+		 * 
64
+		 * @return bool
65
+		 */
66
+		public function logout() {
67
+			try {
68
+				$logoutParameters = [
69
+					"connectionId" => $this->ConnectionId
70
+				];
71
+				$result = $this->post("Authentication/Logout", $logoutParameters);
72
+				$this->ConnectionId = null;
73
+				return true;
74
+			} catch(\Exception $ex) {
75
+				throw new \Exception("Token-Login failed: ".$ex->getMessage());
76
+			}
77
+		}
78 78
 
79
-        /**
80
-         * Performs a user table query and fetch the result records
81
-         * 
82
-         * @param $userTableName The name of the user table
83
-         * @param $whereClauseElements Array with fields "ColumnName", "RelationalOperator" and "Value" for filter defintion of the query
84
-         * @param $addColumnHeaders Add column headers to result?
85
-         * 
86
-         * @return array The data result as an array
87
-         */
88
-        public function userTableQuery($userTableName, $whereClauseElements, $addColumnHeaders) {
89
-            try {
90
-                $parameters = [
91
-                    "connectionId" => $this->ConnectionId,
92
-                    "userTable" => $userTableName,
93
-                    "whereClauseElements" => $whereClauseElements,
94
-                    "addColumnHeaders" => $addColumnHeaders
95
-                ];
96
-                $result = $this->post("UserTable/UserTableGetRecords", $parameters);
97
-                if (!isset($result->UserTableGetRecordsResult)) throw new \Exception("Unexpected result");
98
-                return $result->UserTableGetRecordsResult;
99
-            } catch(\Exception $ex) {
100
-                throw new \Exception("User table query failed: ".$ex->getMessage());
101
-            }
102
-        }
79
+		/**
80
+		 * Performs a user table query and fetch the result records
81
+		 * 
82
+		 * @param $userTableName The name of the user table
83
+		 * @param $whereClauseElements Array with fields "ColumnName", "RelationalOperator" and "Value" for filter defintion of the query
84
+		 * @param $addColumnHeaders Add column headers to result?
85
+		 * 
86
+		 * @return array The data result as an array
87
+		 */
88
+		public function userTableQuery($userTableName, $whereClauseElements, $addColumnHeaders) {
89
+			try {
90
+				$parameters = [
91
+					"connectionId" => $this->ConnectionId,
92
+					"userTable" => $userTableName,
93
+					"whereClauseElements" => $whereClauseElements,
94
+					"addColumnHeaders" => $addColumnHeaders
95
+				];
96
+				$result = $this->post("UserTable/UserTableGetRecords", $parameters);
97
+				if (!isset($result->UserTableGetRecordsResult)) throw new \Exception("Unexpected result");
98
+				return $result->UserTableGetRecordsResult;
99
+			} catch(\Exception $ex) {
100
+				throw new \Exception("User table query failed: ".$ex->getMessage());
101
+			}
102
+		}
103 103
 
104
-        /**
105
-         * Uploading a file
106
-         * @param string $file Path and file name of file to upload
107
-         */
108
-        public function uploadFile($file) {
109
-            $content = file_get_contents($file);
110
-            return $this->uploadContent($content);
111
-        }
104
+		/**
105
+		 * Uploading a file
106
+		 * @param string $file Path and file name of file to upload
107
+		 */
108
+		public function uploadFile($file) {
109
+			$content = file_get_contents($file);
110
+			return $this->uploadContent($content);
111
+		}
112 112
 
113
-        /**
114
-         * Uploading a stream of data
115
-         * @param Stream $stream Stream of content to upload
116
-         */
117
-        public function uploadStream($stream) {
118
-            $content = stream_get_contents($stream);
119
-            return $this->uploadContent($content);
120
-        }
113
+		/**
114
+		 * Uploading a stream of data
115
+		 * @param Stream $stream Stream of content to upload
116
+		 */
117
+		public function uploadStream($stream) {
118
+			$content = stream_get_contents($stream);
119
+			return $this->uploadContent($content);
120
+		}
121 121
 
122
-        private function uploadContent($content) {
123
-            $base64 = base64_encode($content);
124
-            $uploadParameters = [
125
-                "connectionId" => $this->ConnectionId,
126
-                "fileContentbase64" => $base64
127
-            ];            
128
-            $result = $this->post("File/UploadFileBase64", $uploadParameters);            
129
-            return $result->UploadFileBase64Result;
130
-        }
122
+		private function uploadContent($content) {
123
+			$base64 = base64_encode($content);
124
+			$uploadParameters = [
125
+				"connectionId" => $this->ConnectionId,
126
+				"fileContentbase64" => $base64
127
+			];            
128
+			$result = $this->post("File/UploadFileBase64", $uploadParameters);            
129
+			return $result->UploadFileBase64Result;
130
+		}
131 131
 
132
-        /**
133
-         * Performing a post request to service
134
-         * 
135
-         * @param string $path the route to the API endpoint (without service endpoint url)
136
-         * @param string Associated array with data to post
137
-         * 
138
-         * @return object Returns object with data. If service returns an error an exception will be thrown with detailed information
139
-         */
140
-        private function post($path, $data)
141
-        {
142
-            $ch = curl_init();
143
-            //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
144
-            curl_setopt($ch, CURLOPT_URL, $this->ServiceEndpoint.$path);
145
-            curl_setopt($ch, CURLOPT_POST, 1);
146
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
147
-            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
148
-            curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
149
-            $jsonResult = curl_exec($ch);
150
-            if (curl_errno($ch)) {
151
-                throw new \Exception("Error on post request: ".curl_errno($ch));
152
-            }
153
-            return $this->handleJsonResult($jsonResult);
132
+		/**
133
+		 * Performing a post request to service
134
+		 * 
135
+		 * @param string $path the route to the API endpoint (without service endpoint url)
136
+		 * @param string Associated array with data to post
137
+		 * 
138
+		 * @return object Returns object with data. If service returns an error an exception will be thrown with detailed information
139
+		 */
140
+		private function post($path, $data)
141
+		{
142
+			$ch = curl_init();
143
+			//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
144
+			curl_setopt($ch, CURLOPT_URL, $this->ServiceEndpoint.$path);
145
+			curl_setopt($ch, CURLOPT_POST, 1);
146
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
147
+			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
148
+			curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
149
+			$jsonResult = curl_exec($ch);
150
+			if (curl_errno($ch)) {
151
+				throw new \Exception("Error on post request: ".curl_errno($ch));
152
+			}
153
+			return $this->handleJsonResult($jsonResult);
154 154
 
155
-        }
155
+		}
156 156
         
157
-        private function handleJsonResult($json)
158
-        {
159
-            if ($json === FALSE) {
160
-                throw new \Exception("No valid JSON has been returned from service.");
161
-            }
162
-            $result = json_decode($json);
163
-            if (isset($result->ErrorNumber)) {
164
-                throw new \Exception("(".$result->ErrorNumber.") ".$result->Message);
165
-            }
166
-            return $result;
167
-        }
157
+		private function handleJsonResult($json)
158
+		{
159
+			if ($json === FALSE) {
160
+				throw new \Exception("No valid JSON has been returned from service.");
161
+			}
162
+			$result = json_decode($json);
163
+			if (isset($result->ErrorNumber)) {
164
+				throw new \Exception("(".$result->ErrorNumber.") ".$result->Message);
165
+			}
166
+			return $result;
167
+		}
168 168
 
169
-    }
169
+	}
170 170
 
171 171
 ?>
172 172
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
                 $result = $this->post("Authentication/LogonWithToken", $logonParameters);
54 54
                 $this->ConnectionId = $result->LogonWithTokenResult->ConnectionId;
55 55
                 return true;
56
-            } catch(\Exception $ex) {
57
-                throw new \Exception("Token-Login failed: ".$ex->getMessage());
56
+            } catch (\Exception $ex) {
57
+                throw new \Exception("Token-Login failed: " . $ex->getMessage());
58 58
             }
59 59
         }
60 60
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
                 $result = $this->post("Authentication/Logout", $logoutParameters);
72 72
                 $this->ConnectionId = null;
73 73
                 return true;
74
-            } catch(\Exception $ex) {
75
-                throw new \Exception("Token-Login failed: ".$ex->getMessage());
74
+            } catch (\Exception $ex) {
75
+                throw new \Exception("Token-Login failed: " . $ex->getMessage());
76 76
             }
77 77
         }
78 78
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
                 $result = $this->post("UserTable/UserTableGetRecords", $parameters);
97 97
                 if (!isset($result->UserTableGetRecordsResult)) throw new \Exception("Unexpected result");
98 98
                 return $result->UserTableGetRecordsResult;
99
-            } catch(\Exception $ex) {
100
-                throw new \Exception("User table query failed: ".$ex->getMessage());
99
+            } catch (\Exception $ex) {
100
+                throw new \Exception("User table query failed: " . $ex->getMessage());
101 101
             }
102 102
         }
103 103
 
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
         {
142 142
             $ch = curl_init();
143 143
             //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
144
-            curl_setopt($ch, CURLOPT_URL, $this->ServiceEndpoint.$path);
144
+            curl_setopt($ch, CURLOPT_URL, $this->ServiceEndpoint . $path);
145 145
             curl_setopt($ch, CURLOPT_POST, 1);
146 146
             curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
147 147
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
148 148
             curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
149 149
             $jsonResult = curl_exec($ch);
150 150
             if (curl_errno($ch)) {
151
-                throw new \Exception("Error on post request: ".curl_errno($ch));
151
+                throw new \Exception("Error on post request: " . curl_errno($ch));
152 152
             }
153 153
             return $this->handleJsonResult($jsonResult);
154 154
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             }
162 162
             $result = json_decode($json);
163 163
             if (isset($result->ErrorNumber)) {
164
-                throw new \Exception("(".$result->ErrorNumber.") ".$result->Message);
164
+                throw new \Exception("(" . $result->ErrorNumber . ") " . $result->Message);
165 165
             }
166 166
             return $result;
167 167
         }
Please login to merge, or discard this patch.
Braces   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,9 +25,10 @@  discard block
 block discarded – undo
25 25
          */
26 26
         public $ConnectionId = null;
27 27
 
28
-        function __construct($serviceEndpoint)
29
-        {
30
-            if (!str_ends_with($serviceEndpoint, '/')) $serviceEndpoint .= '/';
28
+        function __construct($serviceEndpoint) {
29
+            if (!str_ends_with($serviceEndpoint, '/')) {
30
+            	$serviceEndpoint .= '/';
31
+            }
31 32
             $this->ServiceEndpoint = $serviceEndpoint;
32 33
         }
33 34
 
@@ -40,7 +41,7 @@  discard block
 block discarded – undo
40 41
          * 
41 42
          * @return bool
42 43
          */
43
-        public function loginWithToken($pfxFile, $pfxPassword, $userName) {
44
+        public function loginWithToken($pfxFile, $pfxPassword, $userName) {
44 45
             try {
45 46
                 $issuer = gethostname();
46 47
                 $tokenGenerator = new \Kendox\TokenGenerator($issuer, $pfxFile, $pfxPassword);
@@ -53,7 +54,8 @@  discard block
 block discarded – undo
53 54
                 $result = $this->post("Authentication/LogonWithToken", $logonParameters);
54 55
                 $this->ConnectionId = $result->LogonWithTokenResult->ConnectionId;
55 56
                 return true;
56
-            } catch(\Exception $ex) {
57
+            }
58
+            catch(\Exception $ex) {
57 59
                 throw new \Exception("Token-Login failed: ".$ex->getMessage());
58 60
             }
59 61
         }
@@ -63,7 +65,7 @@  discard block
 block discarded – undo
63 65
          * 
64 66
          * @return bool
65 67
          */
66
-        public function logout() {
68
+        public function logout() {
67 69
             try {
68 70
                 $logoutParameters = [
69 71
                     "connectionId" => $this->ConnectionId
@@ -71,7 +73,8 @@  discard block
 block discarded – undo
71 73
                 $result = $this->post("Authentication/Logout", $logoutParameters);
72 74
                 $this->ConnectionId = null;
73 75
                 return true;
74
-            } catch(\Exception $ex) {
76
+            }
77
+            catch(\Exception $ex) {
75 78
                 throw new \Exception("Token-Login failed: ".$ex->getMessage());
76 79
             }
77 80
         }
@@ -85,7 +88,7 @@  discard block
 block discarded – undo
85 88
          * 
86 89
          * @return array The data result as an array
87 90
          */
88
-        public function userTableQuery($userTableName, $whereClauseElements, $addColumnHeaders) {
91
+        public function userTableQuery($userTableName, $whereClauseElements, $addColumnHeaders) {
89 92
             try {
90 93
                 $parameters = [
91 94
                     "connectionId" => $this->ConnectionId,
@@ -94,9 +97,12 @@  discard block
 block discarded – undo
94 97
                     "addColumnHeaders" => $addColumnHeaders
95 98
                 ];
96 99
                 $result = $this->post("UserTable/UserTableGetRecords", $parameters);
97
-                if (!isset($result->UserTableGetRecordsResult)) throw new \Exception("Unexpected result");
100
+                if (!isset($result->UserTableGetRecordsResult)) {
101
+                	throw new \Exception("Unexpected result");
102
+                }
98 103
                 return $result->UserTableGetRecordsResult;
99
-            } catch(\Exception $ex) {
104
+            }
105
+            catch(\Exception $ex) {
100 106
                 throw new \Exception("User table query failed: ".$ex->getMessage());
101 107
             }
102 108
         }
@@ -105,7 +111,7 @@  discard block
 block discarded – undo
105 111
          * Uploading a file
106 112
          * @param string $file Path and file name of file to upload
107 113
          */
108
-        public function uploadFile($file) {
114
+        public function uploadFile($file) {
109 115
             $content = file_get_contents($file);
110 116
             return $this->uploadContent($content);
111 117
         }
@@ -114,12 +120,12 @@  discard block
 block discarded – undo
114 120
          * Uploading a stream of data
115 121
          * @param Stream $stream Stream of content to upload
116 122
          */
117
-        public function uploadStream($stream) {
123
+        public function uploadStream($stream) {
118 124
             $content = stream_get_contents($stream);
119 125
             return $this->uploadContent($content);
120 126
         }
121 127
 
122
-        private function uploadContent($content) {
128
+        private function uploadContent($content) {
123 129
             $base64 = base64_encode($content);
124 130
             $uploadParameters = [
125 131
                 "connectionId" => $this->ConnectionId,
@@ -137,8 +143,7 @@  discard block
 block discarded – undo
137 143
          * 
138 144
          * @return object Returns object with data. If service returns an error an exception will be thrown with detailed information
139 145
          */
140
-        private function post($path, $data)
141
-        {
146
+        private function post($path, $data) {
142 147
             $ch = curl_init();
143 148
             //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
144 149
             curl_setopt($ch, CURLOPT_URL, $this->ServiceEndpoint.$path);
@@ -154,8 +159,7 @@  discard block
 block discarded – undo
154 159
 
155 160
         }
156 161
         
157
-        private function handleJsonResult($json)
158
-        {
162
+        private function handleJsonResult($json) {
159 163
             if ($json === FALSE) {
160 164
                 throw new \Exception("No valid JSON has been returned from service.");
161 165
             }
Please login to merge, or discard this patch.
plugins/kendox/php/kendox-client/class.kendox-token-generator.php 3 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -6,170 +6,170 @@
 block discarded – undo
6 6
 class TokenGenerator
7 7
 {
8 8
 
9
-    /**
10
-     * Token version
11
-     * @var string
12
-     */
13
-    private $TokenVersion = "1";
9
+	/**
10
+	 * Token version
11
+	 * @var string
12
+	 */
13
+	private $TokenVersion = "1";
14 14
 
15
-    /**
16
-     * Token lifetime in seconds
17
-     * @var int
18
-     */
19
-    private $TokenLifeTime = 99000000;
15
+	/**
16
+	 * Token lifetime in seconds
17
+	 * @var int
18
+	 */
19
+	private $TokenLifeTime = 99000000;
20 20
 
21
-    /**
22
-     * Certificate data (read from PFX-File)
23
-     * @var string
24
-     */
25
-    private $Certificate = null;
21
+	/**
22
+	 * Certificate data (read from PFX-File)
23
+	 * @var string
24
+	 */
25
+	private $Certificate = null;
26 26
 
27
-    /**
28
-     * Private key of certificate (read from PFX-file)
29
-     * @var string
30
-     */
31
-    private $CertPrivateKey = null;
27
+	/**
28
+	 * Private key of certificate (read from PFX-file)
29
+	 * @var string
30
+	 */
31
+	private $CertPrivateKey = null;
32 32
 
33
-    /**
34
-     * @param string $issuer
35
-     * @param string $pfxFile
36
-     * @param string $pfxPassword
37
-     */
38
-    function __construct(/**
39
-     * Issuer host name
40
-     */
41
-    private $Issuer, /**
42
-     * Full filename of PFX-File (Certificate)
43
-     */
44
-    private $PfxFile, /**
45
-     * Password for PFX-File (Certificate)
46
-     */
47
-    private $PfxPassword)
48
-    {
49
-        $this->loadCertificateFromPfx();        
50
-    }
33
+	/**
34
+	 * @param string $issuer
35
+	 * @param string $pfxFile
36
+	 * @param string $pfxPassword
37
+	 */
38
+	function __construct(/**
39
+	 * Issuer host name
40
+	 */
41
+	private $Issuer, /**
42
+	 * Full filename of PFX-File (Certificate)
43
+	 */
44
+	private $PfxFile, /**
45
+	 * Password for PFX-File (Certificate)
46
+	 */
47
+	private $PfxPassword)
48
+	{
49
+		$this->loadCertificateFromPfx();        
50
+	}
51 51
 
52
-    /**
53
-     * Token generation
54
-     * 
55
-     * @param string $userEMail The e-mail of the user to generate a token
56
-     * 
57
-     * @return string Token in XML format
58
-     */
59
-    public function generateToken($userEMail)
60
-    {
61
-        try {
62
-            $now = new \DateTime("now", new \DateTimeZone("utc"));
63
-            $guid = $this->createGUID();
64
-            $writerSignedInfo = xmlwriter_open_memory();        
65
-            $this->writeSignedInfo($writerSignedInfo, $userEMail, $now, $guid);
66
-            $signedInfo = xmlwriter_output_memory($writerSignedInfo);
67
-            $writer = xmlwriter_open_memory();
68
-            xmlwriter_set_indent($writer, false);
69
-            xmlwriter_start_element($writer, "InfoShareToken");
70
-                $this->writeSignedInfo($writer, $userEMail, $now, $guid);
71
-                xmlwriter_start_element($writer, "SignatureValue");
72
-                    xmlwriter_text($writer, $this->signXmlString($signedInfo));
73
-                xmlwriter_end_element($writer);                
74
-            xmlwriter_end_element($writer);
75
-            return xmlwriter_output_memory($writer);
76
-        } catch(\Exception $ex) {
77
-            throw new \Exception("Generating token failed: ".$ex->getMessage());
78
-        }
79
-    }   
52
+	/**
53
+	 * Token generation
54
+	 * 
55
+	 * @param string $userEMail The e-mail of the user to generate a token
56
+	 * 
57
+	 * @return string Token in XML format
58
+	 */
59
+	public function generateToken($userEMail)
60
+	{
61
+		try {
62
+			$now = new \DateTime("now", new \DateTimeZone("utc"));
63
+			$guid = $this->createGUID();
64
+			$writerSignedInfo = xmlwriter_open_memory();        
65
+			$this->writeSignedInfo($writerSignedInfo, $userEMail, $now, $guid);
66
+			$signedInfo = xmlwriter_output_memory($writerSignedInfo);
67
+			$writer = xmlwriter_open_memory();
68
+			xmlwriter_set_indent($writer, false);
69
+			xmlwriter_start_element($writer, "InfoShareToken");
70
+				$this->writeSignedInfo($writer, $userEMail, $now, $guid);
71
+				xmlwriter_start_element($writer, "SignatureValue");
72
+					xmlwriter_text($writer, $this->signXmlString($signedInfo));
73
+				xmlwriter_end_element($writer);                
74
+			xmlwriter_end_element($writer);
75
+			return xmlwriter_output_memory($writer);
76
+		} catch(\Exception $ex) {
77
+			throw new \Exception("Generating token failed: ".$ex->getMessage());
78
+		}
79
+	}   
80 80
 
81
-    /**
82
-     * Loads the X509-certificate from PFX-File
83
-     */
84
-    private function loadCertificateFromPfx()
85
-    {
86
-        if ($this->PfxFile == null) throw new \Exception("No PFX-File available.");
87
-        if (!file_exists($this->PfxFile)) throw new \Exception("PFX-File not found.");
88
-        if (empty($this->PfxPassword)) throw new \Exception("Password not set for PFX-File.");
89
-        $pfxContent = file_get_contents($this->PfxFile);
90
-        $results = [];
91
-        $read = openssl_pkcs12_read($pfxContent, $results, $this->PfxPassword);
92
-        if ($read == false) throw new \Exception("Error on reading PFX-File: ".openssl_error_string());
93
-        $this->Certificate = $results['pkey'].$results['cert'];
94
-        $this->CertPrivateKey = $results['pkey'];
95
-    }
81
+	/**
82
+	 * Loads the X509-certificate from PFX-File
83
+	 */
84
+	private function loadCertificateFromPfx()
85
+	{
86
+		if ($this->PfxFile == null) throw new \Exception("No PFX-File available.");
87
+		if (!file_exists($this->PfxFile)) throw new \Exception("PFX-File not found.");
88
+		if (empty($this->PfxPassword)) throw new \Exception("Password not set for PFX-File.");
89
+		$pfxContent = file_get_contents($this->PfxFile);
90
+		$results = [];
91
+		$read = openssl_pkcs12_read($pfxContent, $results, $this->PfxPassword);
92
+		if ($read == false) throw new \Exception("Error on reading PFX-File: ".openssl_error_string());
93
+		$this->Certificate = $results['pkey'].$results['cert'];
94
+		$this->CertPrivateKey = $results['pkey'];
95
+	}
96 96
 
97
-    private function writeSignedInfo($writer, $userEMail, $time, $uniqueId)
98
-    {
99
-        $utcTime = $time->format('Y-m-d H:i:s');
100
-        $utcTime = str_replace(" ", "T", $utcTime)."Z";
101
-        xmlwriter_start_element($writer, "SignedInfo");
102
-            xmlwriter_start_element($writer, "UserPrincipalName");
103
-            xmlwriter_text($writer, $userEMail);
104
-            xmlwriter_end_element($writer);    
105
-            xmlwriter_start_element($writer, "UniqueId");
106
-            xmlwriter_text($writer, $uniqueId);
107
-            xmlwriter_end_element($writer);            
108
-            xmlwriter_start_element($writer, "Version");
109
-            xmlwriter_text($writer, $this->TokenVersion);
110
-            xmlwriter_end_element($writer);      
111
-            xmlwriter_start_element($writer, "TimeStampUTC");
112
-            xmlwriter_text($writer, $utcTime);
113
-            xmlwriter_end_element($writer);                    
114
-            xmlwriter_start_element($writer, "LifeTimeSeconds");
115
-            xmlwriter_text($writer, $this->TokenLifeTime);
116
-            xmlwriter_end_element($writer);             
117
-            xmlwriter_start_element($writer, "IssueServer");
118
-            xmlwriter_text($writer, $this->Issuer);
119
-            xmlwriter_end_element($writer);     
120
-            xmlwriter_start_element($writer, "CertificateFingerprint");
121
-            xmlwriter_text($writer, strtoupper(openssl_x509_fingerprint($this->Certificate)));
122
-            xmlwriter_end_element($writer);  
123
-            xmlwriter_start_element($writer, "HashAlgorithm");
124
-            xmlwriter_text($writer, "SHA512");
125
-            xmlwriter_end_element($writer);    
126
-            xmlwriter_start_element($writer, "Attributes");
127
-            xmlwriter_text($writer, "");
128
-            xmlwriter_end_element($writer);                                                                                                                                                 
129
-        xmlwriter_end_element($writer);     
130
-    }
97
+	private function writeSignedInfo($writer, $userEMail, $time, $uniqueId)
98
+	{
99
+		$utcTime = $time->format('Y-m-d H:i:s');
100
+		$utcTime = str_replace(" ", "T", $utcTime)."Z";
101
+		xmlwriter_start_element($writer, "SignedInfo");
102
+			xmlwriter_start_element($writer, "UserPrincipalName");
103
+			xmlwriter_text($writer, $userEMail);
104
+			xmlwriter_end_element($writer);    
105
+			xmlwriter_start_element($writer, "UniqueId");
106
+			xmlwriter_text($writer, $uniqueId);
107
+			xmlwriter_end_element($writer);            
108
+			xmlwriter_start_element($writer, "Version");
109
+			xmlwriter_text($writer, $this->TokenVersion);
110
+			xmlwriter_end_element($writer);      
111
+			xmlwriter_start_element($writer, "TimeStampUTC");
112
+			xmlwriter_text($writer, $utcTime);
113
+			xmlwriter_end_element($writer);                    
114
+			xmlwriter_start_element($writer, "LifeTimeSeconds");
115
+			xmlwriter_text($writer, $this->TokenLifeTime);
116
+			xmlwriter_end_element($writer);             
117
+			xmlwriter_start_element($writer, "IssueServer");
118
+			xmlwriter_text($writer, $this->Issuer);
119
+			xmlwriter_end_element($writer);     
120
+			xmlwriter_start_element($writer, "CertificateFingerprint");
121
+			xmlwriter_text($writer, strtoupper(openssl_x509_fingerprint($this->Certificate)));
122
+			xmlwriter_end_element($writer);  
123
+			xmlwriter_start_element($writer, "HashAlgorithm");
124
+			xmlwriter_text($writer, "SHA512");
125
+			xmlwriter_end_element($writer);    
126
+			xmlwriter_start_element($writer, "Attributes");
127
+			xmlwriter_text($writer, "");
128
+			xmlwriter_end_element($writer);                                                                                                                                                 
129
+		xmlwriter_end_element($writer);     
130
+	}
131 131
 
132
-    /**
133
-     * Signing a XML-String and returns the result
134
-     * 
135
-     * @param string $xml XML-String
136
-     * 
137
-     * @return string
138
-     */
139
-    function SignXmlString($signedInfoXml)
140
-    {
141
-        try {
142
-            $data = iconv('utf-8', 'utf-16le', $signedInfoXml);    
143
-            $privateKey = \phpseclib3\Crypt\RSA::loadFormat('PKCS8', $this->CertPrivateKey)
144
-                            ->withPadding(\phpseclib3\Crypt\RSA::SIGNATURE_PKCS1)
145
-                            ->withHash('sha512');
146
-            $base64 = base64_encode($privateKey->sign($data));
147
-            return $base64;
148
-        } catch (\Exception $ex) {
149
-            throw new \Exception("XML signing failed: ".$ex->getMessage());
150
-        }
151
-    }
132
+	/**
133
+	 * Signing a XML-String and returns the result
134
+	 * 
135
+	 * @param string $xml XML-String
136
+	 * 
137
+	 * @return string
138
+	 */
139
+	function SignXmlString($signedInfoXml)
140
+	{
141
+		try {
142
+			$data = iconv('utf-8', 'utf-16le', $signedInfoXml);    
143
+			$privateKey = \phpseclib3\Crypt\RSA::loadFormat('PKCS8', $this->CertPrivateKey)
144
+							->withPadding(\phpseclib3\Crypt\RSA::SIGNATURE_PKCS1)
145
+							->withHash('sha512');
146
+			$base64 = base64_encode($privateKey->sign($data));
147
+			return $base64;
148
+		} catch (\Exception $ex) {
149
+			throw new \Exception("XML signing failed: ".$ex->getMessage());
150
+		}
151
+	}
152 152
 
153
-    /**
154
-     * Creates a unique ID
155
-     * @return string
156
-     */
157
-    private function createGUID(){
158
-        if (function_exists('com_create_guid')){
159
-            return com_create_guid();
160
-        }
161
-        else {
162
-            mt_srand((double)microtime()*10000);
163
-            $charid = strtoupper(md5(uniqid(random_int(0, mt_getrandmax()), true)));
164
-            $hyphen = chr(45);// "-"
165
-            $uuid = substr($charid, 0, 8).$hyphen
166
-                .substr($charid, 8, 4).$hyphen
167
-                .substr($charid,12, 4).$hyphen
168
-                .substr($charid,16, 4).$hyphen
169
-                .substr($charid,20,12);
170
-            return $uuid;
171
-        }
172
-    }
153
+	/**
154
+	 * Creates a unique ID
155
+	 * @return string
156
+	 */
157
+	private function createGUID(){
158
+		if (function_exists('com_create_guid')){
159
+			return com_create_guid();
160
+		}
161
+		else {
162
+			mt_srand((double)microtime()*10000);
163
+			$charid = strtoupper(md5(uniqid(random_int(0, mt_getrandmax()), true)));
164
+			$hyphen = chr(45);// "-"
165
+			$uuid = substr($charid, 0, 8).$hyphen
166
+				.substr($charid, 8, 4).$hyphen
167
+				.substr($charid,12, 4).$hyphen
168
+				.substr($charid,16, 4).$hyphen
169
+				.substr($charid,20,12);
170
+			return $uuid;
171
+		}
172
+	}
173 173
 
174 174
 }
175 175
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
                 xmlwriter_end_element($writer);                
74 74
             xmlwriter_end_element($writer);
75 75
             return xmlwriter_output_memory($writer);
76
-        } catch(\Exception $ex) {
77
-            throw new \Exception("Generating token failed: ".$ex->getMessage());
76
+        } catch (\Exception $ex) {
77
+            throw new \Exception("Generating token failed: " . $ex->getMessage());
78 78
         }
79 79
     }   
80 80
 
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
         $pfxContent = file_get_contents($this->PfxFile);
90 90
         $results = [];
91 91
         $read = openssl_pkcs12_read($pfxContent, $results, $this->PfxPassword);
92
-        if ($read == false) throw new \Exception("Error on reading PFX-File: ".openssl_error_string());
93
-        $this->Certificate = $results['pkey'].$results['cert'];
92
+        if ($read == false) throw new \Exception("Error on reading PFX-File: " . openssl_error_string());
93
+        $this->Certificate = $results['pkey'] . $results['cert'];
94 94
         $this->CertPrivateKey = $results['pkey'];
95 95
     }
96 96
 
97 97
     private function writeSignedInfo($writer, $userEMail, $time, $uniqueId)
98 98
     {
99 99
         $utcTime = $time->format('Y-m-d H:i:s');
100
-        $utcTime = str_replace(" ", "T", $utcTime)."Z";
100
+        $utcTime = str_replace(" ", "T", $utcTime) . "Z";
101 101
         xmlwriter_start_element($writer, "SignedInfo");
102 102
             xmlwriter_start_element($writer, "UserPrincipalName");
103 103
             xmlwriter_text($writer, $userEMail);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             $base64 = base64_encode($privateKey->sign($data));
147 147
             return $base64;
148 148
         } catch (\Exception $ex) {
149
-            throw new \Exception("XML signing failed: ".$ex->getMessage());
149
+            throw new \Exception("XML signing failed: " . $ex->getMessage());
150 150
         }
151 151
     }
152 152
 
@@ -154,19 +154,19 @@  discard block
 block discarded – undo
154 154
      * Creates a unique ID
155 155
      * @return string
156 156
      */
157
-    private function createGUID(){
158
-        if (function_exists('com_create_guid')){
157
+    private function createGUID() {
158
+        if (function_exists('com_create_guid')) {
159 159
             return com_create_guid();
160 160
         }
161 161
         else {
162
-            mt_srand((double)microtime()*10000);
162
+            mt_srand((double) microtime() * 10000);
163 163
             $charid = strtoupper(md5(uniqid(random_int(0, mt_getrandmax()), true)));
164
-            $hyphen = chr(45);// "-"
165
-            $uuid = substr($charid, 0, 8).$hyphen
166
-                .substr($charid, 8, 4).$hyphen
167
-                .substr($charid,12, 4).$hyphen
168
-                .substr($charid,16, 4).$hyphen
169
-                .substr($charid,20,12);
164
+            $hyphen = chr(45); // "-"
165
+            $uuid = substr($charid, 0, 8) . $hyphen
166
+                .substr($charid, 8, 4) . $hyphen
167
+                .substr($charid, 12, 4) . $hyphen
168
+                .substr($charid, 16, 4) . $hyphen
169
+                .substr($charid, 20, 12);
170 170
             return $uuid;
171 171
         }
172 172
     }
Please login to merge, or discard this patch.
Braces   +23 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
     private $PfxFile, /**
45 45
      * Password for PFX-File (Certificate)
46 46
      */
47
-    private $PfxPassword)
48
-    {
47
+    private $PfxPassword) {
49 48
         $this->loadCertificateFromPfx();        
50 49
     }
51 50
 
@@ -56,8 +55,7 @@  discard block
 block discarded – undo
56 55
      * 
57 56
      * @return string Token in XML format
58 57
      */
59
-    public function generateToken($userEMail)
60
-    {
58
+    public function generateToken($userEMail) {
61 59
         try {
62 60
             $now = new \DateTime("now", new \DateTimeZone("utc"));
63 61
             $guid = $this->createGUID();
@@ -73,7 +71,8 @@  discard block
 block discarded – undo
73 71
                 xmlwriter_end_element($writer);                
74 72
             xmlwriter_end_element($writer);
75 73
             return xmlwriter_output_memory($writer);
76
-        } catch(\Exception $ex) {
74
+        }
75
+        catch(\Exception $ex) {
77 76
             throw new \Exception("Generating token failed: ".$ex->getMessage());
78 77
         }
79 78
     }   
@@ -81,21 +80,27 @@  discard block
 block discarded – undo
81 80
     /**
82 81
      * Loads the X509-certificate from PFX-File
83 82
      */
84
-    private function loadCertificateFromPfx()
85
-    {
86
-        if ($this->PfxFile == null) throw new \Exception("No PFX-File available.");
87
-        if (!file_exists($this->PfxFile)) throw new \Exception("PFX-File not found.");
88
-        if (empty($this->PfxPassword)) throw new \Exception("Password not set for PFX-File.");
83
+    private function loadCertificateFromPfx() {
84
+        if ($this->PfxFile == null) {
85
+        	throw new \Exception("No PFX-File available.");
86
+        }
87
+        if (!file_exists($this->PfxFile)) {
88
+        	throw new \Exception("PFX-File not found.");
89
+        }
90
+        if (empty($this->PfxPassword)) {
91
+        	throw new \Exception("Password not set for PFX-File.");
92
+        }
89 93
         $pfxContent = file_get_contents($this->PfxFile);
90 94
         $results = [];
91 95
         $read = openssl_pkcs12_read($pfxContent, $results, $this->PfxPassword);
92
-        if ($read == false) throw new \Exception("Error on reading PFX-File: ".openssl_error_string());
96
+        if ($read == false) {
97
+        	throw new \Exception("Error on reading PFX-File: ".openssl_error_string());
98
+        }
93 99
         $this->Certificate = $results['pkey'].$results['cert'];
94 100
         $this->CertPrivateKey = $results['pkey'];
95 101
     }
96 102
 
97
-    private function writeSignedInfo($writer, $userEMail, $time, $uniqueId)
98
-    {
103
+    private function writeSignedInfo($writer, $userEMail, $time, $uniqueId) {
99 104
         $utcTime = $time->format('Y-m-d H:i:s');
100 105
         $utcTime = str_replace(" ", "T", $utcTime)."Z";
101 106
         xmlwriter_start_element($writer, "SignedInfo");
@@ -136,8 +141,7 @@  discard block
 block discarded – undo
136 141
      * 
137 142
      * @return string
138 143
      */
139
-    function SignXmlString($signedInfoXml)
140
-    {
144
+    function SignXmlString($signedInfoXml) {
141 145
         try {
142 146
             $data = iconv('utf-8', 'utf-16le', $signedInfoXml);    
143 147
             $privateKey = \phpseclib3\Crypt\RSA::loadFormat('PKCS8', $this->CertPrivateKey)
@@ -145,7 +149,8 @@  discard block
 block discarded – undo
145 149
                             ->withHash('sha512');
146 150
             $base64 = base64_encode($privateKey->sign($data));
147 151
             return $base64;
148
-        } catch (\Exception $ex) {
152
+        }
153
+        catch (\Exception $ex) {
149 154
             throw new \Exception("XML signing failed: ".$ex->getMessage());
150 155
         }
151 156
     }
@@ -154,10 +159,10 @@  discard block
 block discarded – undo
154 159
      * Creates a unique ID
155 160
      * @return string
156 161
      */
157
-    private function createGUID(){
162
+    private function createGUID() {
158 163
         if (function_exists('com_create_guid')){
159 164
             return com_create_guid();
160
-        }
165
+        }
161 166
         else {
162 167
             mt_srand((double)microtime()*10000);
163 168
             $charid = strtoupper(md5(uniqid(random_int(0, mt_getrandmax()), true)));
Please login to merge, or discard this patch.
plugins/smime/php/plugin.smime.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 		$a = mapi_getprops($msg, [PR_TRANSPORT_MESSAGE_HEADERS]);
392 392
 		$a = $a === false ? "" : ($a[PR_TRANSPORT_MESSAGE_HEADERS] ?? "");
393 393
 		$prop[PR_TRANSPORT_MESSAGE_HEADERS] =
394
-			"# Outer headers:\n".($prop[PR_TRANSPORT_MESSAGE_HEADERS] ?? "").
395
-			"# Inner headers:\n".$a;
394
+			"# Outer headers:\n" . ($prop[PR_TRANSPORT_MESSAGE_HEADERS] ?? "") .
395
+			"# Inner headers:\n" . $a;
396 396
 	}
397 397
 
398 398
 	/**
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		}
513 513
 
514 514
 		if (!encryptionStoreExpirationSupport()) {
515
-			withPHPSession(function () use ($encryptionStore) {
515
+			withPHPSession(function() use ($encryptionStore) {
516 516
 				$encryptionStore->add('smime', '');
517 517
 			});
518 518
 		}
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 			if (strlen($this->openssl_error) == 0)
1008 1008
 				$this->openssl_error = $s;
1009 1009
 			else
1010
-				$this->openssl_error .= "\n".$s;
1010
+				$this->openssl_error .= "\n" . $s;
1011 1011
 		$openssl_error_code = 0;
1012 1012
 		if ($this->openssl_error) {
1013 1013
 			$openssl_error_list = explode(":", $this->openssl_error);
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -386,8 +386,7 @@  discard block
 block discarded – undo
386 386
 		unlink($tmpUserCert);
387 387
 	}
388 388
 
389
-	function join_xph(&$prop, $msg)
390
-	{
389
+	function join_xph(&$prop, $msg) {
391 390
 		$a = mapi_getprops($msg, [PR_TRANSPORT_MESSAGE_HEADERS]);
392 391
 		$a = $a === false ? "" : ($a[PR_TRANSPORT_MESSAGE_HEADERS] ?? "");
393 392
 		$prop[PR_TRANSPORT_MESSAGE_HEADERS] =
@@ -988,8 +987,7 @@  discard block
 block discarded – undo
988 987
 		return !empty($rows);
989 988
 	}
990 989
 
991
-	public function clear_openssl_error()
992
-	{
990
+	public function clear_openssl_error() {
993 991
 		while (@openssl_error_string() !== false)
994 992
 			/* nothing */;
995 993
 	}
@@ -1003,11 +1001,13 @@  discard block
 block discarded – undo
1003 1001
 	 */
1004 1002
 	public function extract_openssl_error() {
1005 1003
 		$this->openssl_error = "";
1006
-		while (($s = @openssl_error_string()) !== false)
1007
-			if (strlen($this->openssl_error) == 0)
1004
+		while (($s = @openssl_error_string()) !== false) {
1005
+					if (strlen($this->openssl_error) == 0)
1008 1006
 				$this->openssl_error = $s;
1009
-			else
1010
-				$this->openssl_error .= "\n".$s;
1007
+		}
1008
+			else {
1009
+							$this->openssl_error .= "\n".$s;
1010
+			}
1011 1011
 		$openssl_error_code = 0;
1012 1012
 		if ($this->openssl_error) {
1013 1013
 			$openssl_error_list = explode(":", $this->openssl_error);
Please login to merge, or discard this patch.
server/includes/download_message.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
 	 * It also sends the eml file to the client.
18 18
 	 */
19 19
 	public function downloadMessageAsFile() {
20
-		if (!$this->message || !$this->store)
21
-			return;
20
+		if (!$this->message || !$this->store) {
21
+					return;
22
+		}
22 23
 		// get message properties.
23 24
 		$messageProps = mapi_getprops($this->message, [PR_SUBJECT, PR_MESSAGE_CLASS]);
24 25
 
@@ -49,8 +50,9 @@  discard block
 block discarded – undo
49 50
 	 * Send ZIP to the client if all the requested eml files included successfully into the same.
50 51
 	 */
51 52
 	public function downloadMessageAsZipFile() {
52
-		if (!$this->store)
53
-			return;
53
+		if (!$this->store) {
54
+					return;
55
+		}
54 56
 		// Generate random ZIP file name at default temporary path of PHP
55 57
 		$randomZipName = tempnam(sys_get_temp_dir(), 'zip');
56 58
 
Please login to merge, or discard this patch.
server/includes/util.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
 	$a = mapi_getprops($msg, [PR_TRANSPORT_MESSAGE_HEADERS]);
481 481
 	$a = $a === false ? "" : ($a[PR_TRANSPORT_MESSAGE_HEADERS] ?? "");
482 482
 	$prop[PR_TRANSPORT_MESSAGE_HEADERS] =
483
-		"# Outer headers:\n".($prop[PR_TRANSPORT_MESSAGE_HEADERS] ?? "").
484
-		"# Inner headers:\n".$a;
483
+		"# Outer headers:\n" . ($prop[PR_TRANSPORT_MESSAGE_HEADERS] ?? "") .
484
+		"# Inner headers:\n" . $a;
485 485
 }
486 486
 
487 487
 /**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 				PR_SENT_REPRESENTING_SMTP_ADDRESS => $props[PR_SENT_REPRESENTING_SMTP_ADDRESS] ?? '',
547 547
 				PR_SENT_REPRESENTING_ADDRTYPE => $props[PR_SENT_REPRESENTING_ADDRTYPE] ?? 'SMTP',
548 548
 				PR_CLIENT_SUBMIT_TIME => $props[PR_CLIENT_SUBMIT_TIME] ?? time(),
549
-				PR_TRANSPORT_MESSAGE_HEADERS => ($props[PR_TRANSPORT_MESSAGE_HEADERS] ?? "").$inner_headers,
549
+				PR_TRANSPORT_MESSAGE_HEADERS => ($props[PR_TRANSPORT_MESSAGE_HEADERS] ?? "") . $inner_headers,
550 550
 			]);
551 551
 		}
552 552
 	}
@@ -1004,8 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 		// on the day before or after. This should be fine for all the
1005 1005
 		// timezones which do not exceed 12 hour difference to UTC.
1006 1006
 		$ts = $interval > 0 ?
1007
-			$ts - ($interval < 43200 ? $interval : $interval - 86400) :
1008
-			$ts + ($interval > -43200 ? $interval : $interval - 86400);
1007
+			$ts - ($interval < 43200 ? $interval : $interval - 86400) : $ts + ($interval > -43200 ? $interval : $interval - 86400);
1009 1008
 	}
1010 1009
 
1011 1010
 	return $ts;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -475,8 +475,7 @@
 block discarded – undo
475 475
 	return $default;
476 476
 }
477 477
 
478
-function parse_smime__join_xph(&$prop, $msg)
479
-{
478
+function parse_smime__join_xph(&$prop, $msg) {
480 479
 	$a = mapi_getprops($msg, [PR_TRANSPORT_MESSAGE_HEADERS]);
481 480
 	$a = $a === false ? "" : ($a[PR_TRANSPORT_MESSAGE_HEADERS] ?? "");
482 481
 	$prop[PR_TRANSPORT_MESSAGE_HEADERS] =
Please login to merge, or discard this patch.
server/includes/modules/class.appointmentitemmodule.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -382,8 +382,7 @@
 block discarded – undo
382 382
 		// all-day events).
383 383
 		$isTzdefstartSet = isset($calendaritem['props']['tzdefstart']);
384 384
 		$tzdefstart = $isTzdefstartSet ?
385
-			hex2bin($calendaritem['props']['tzdefstart']) :
386
-			mapi_ianatz_to_tzdef("Etc/UTC");
385
+			hex2bin($calendaritem['props']['tzdefstart']) : mapi_ianatz_to_tzdef("Etc/UTC");
387 386
 
388 387
 		// Compare the timezone definitions of the client and the appointment.
389 388
 		// Further processing is only required if they don't match.
Please login to merge, or discard this patch.
server/includes/modules/class.hierarchymodule.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@
 block discarded – undo
129 129
 					if (!$store || !$parententryid || !$entryid)
130 130
 						break;
131 131
 					if (!isset($action["message_action"], $action["message_action"]["action_type"]) ||
132
-					    $action["message_action"]["action_type"] !== "removefavorites") {
132
+						$action["message_action"]["action_type"] !== "removefavorites") {
133 133
 						$this->deleteFolder($store, $parententryid, $entryid, $action);
134 134
 						break;
135 135
 					}
136 136
 					if (!isset($action["message_action"]["isSearchFolder"]) ||
137
-					    !$action["message_action"]["isSearchFolder"]) {
137
+						!$action["message_action"]["isSearchFolder"]) {
138 138
 						$this->removeFromFavorite($entryid);
139 139
 						break;
140 140
 					}
Please login to merge, or discard this patch.
Switch Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -64,150 +64,150 @@  discard block
 block discarded – undo
64 64
 				$this->store_entryid = $action["store_entryid"] ?? '';
65 65
 
66 66
 				switch ($actionType) {
67
-				case "keepalive":
68
-					/*
67
+					case "keepalive":
68
+						/*
69 69
 					 * as we haven't done any processing here but still we need to send
70 70
 					 * success message to client so client can know that there isn't any problem
71 71
 					 * on server side (this will also make bus class happy as it will cry when
72 72
 					 * there isn't any data to send to client).
73 73
 					 */
74
-					$this->sendFeedback(true);
75
-					break;
74
+						$this->sendFeedback(true);
75
+						break;
76 76
 
77
-				case "destroysession":
78
-					// This actiontype should never get this far, but should already have been
79
-					// intercepted by the Session class.
80
-					// Nevertheless implement processing here for unforeseen cases.
81
-					$this->sendFeedback(true);
82
-					break;
77
+					case "destroysession":
78
+						// This actiontype should never get this far, but should already have been
79
+						// intercepted by the Session class.
80
+						// Nevertheless implement processing here for unforeseen cases.
81
+						$this->sendFeedback(true);
82
+						break;
83 83
 
84
-				case "list":
85
-					$this->hierarchyList();
86
-					break;
84
+					case "list":
85
+						$this->hierarchyList();
86
+						break;
87 87
 
88
-				case "open":
89
-					$folder = mapi_msgstore_openentry($store, $entryid);
90
-					$data = $this->getFolderProps($store, $folder);
88
+					case "open":
89
+						$folder = mapi_msgstore_openentry($store, $entryid);
90
+						$data = $this->getFolderProps($store, $folder);
91 91
 
92
-					// return response
93
-					$this->addActionData("item", $data);
94
-					$GLOBALS["bus"]->addData($this->getResponseData());
95
-					break;
92
+						// return response
93
+						$this->addActionData("item", $data);
94
+						$GLOBALS["bus"]->addData($this->getResponseData());
95
+						break;
96 96
 
97
-				case "foldersize":
98
-					$folders = [];
97
+					case "foldersize":
98
+						$folders = [];
99 99
 
100
-					$folder = mapi_msgstore_openentry($store, $entryid);
101
-					$data = $this->getFolderProps($store, $folder);
100
+						$folder = mapi_msgstore_openentry($store, $entryid);
101
+						$data = $this->getFolderProps($store, $folder);
102 102
 
103
-					$info = $this->getFolderSize($store, $folder, '', $folders);
103
+						$info = $this->getFolderSize($store, $folder, '', $folders);
104 104
 
105
-					// It could be that the $props already contains the data,
106
-					// this happens when the folder is the IPM_SUBTREE and the
107
-					// folder size is read directly from the store. Adjust
108
-					// total_size accordingly.
109
-					if (isset($data["props"]["store_size"])) {
110
-						if (!isset($data["props"]["message_size"])) {
111
-							$data["props"]["message_size"] = $data["props"]["store_size"];
105
+						// It could be that the $props already contains the data,
106
+						// this happens when the folder is the IPM_SUBTREE and the
107
+						// folder size is read directly from the store. Adjust
108
+						// total_size accordingly.
109
+						if (isset($data["props"]["store_size"])) {
110
+							if (!isset($data["props"]["message_size"])) {
111
+								$data["props"]["message_size"] = $data["props"]["store_size"];
112
+							}
113
+							$data["props"]["total_message_size"] = $data["props"]["store_size"] + $info["total_size"];
112 114
 						}
113
-						$data["props"]["total_message_size"] = $data["props"]["store_size"] + $info["total_size"];
114
-					}
115
-					else {
116
-						$data["props"]["message_size"] = $info["size"];
117
-						$data["props"]["total_message_size"] = $info["total_size"];
118
-					}
119
-					$data["folders"] = [
120
-						"item" => $folders,
121
-					];
122
-
123
-					// return response
124
-					$this->addActionData("item", $data);
125
-					$GLOBALS["bus"]->addData($this->getResponseData());
126
-					break;
115
+						else {
116
+							$data["props"]["message_size"] = $info["size"];
117
+							$data["props"]["total_message_size"] = $info["total_size"];
118
+						}
119
+						$data["folders"] = [
120
+							"item" => $folders,
121
+						];
127 122
 
128
-				case "delete":
129
-					if (!$store || !$parententryid || !$entryid)
130
-						break;
131
-					if (!isset($action["message_action"], $action["message_action"]["action_type"]) ||
132
-					    $action["message_action"]["action_type"] !== "removefavorites") {
133
-						$this->deleteFolder($store, $parententryid, $entryid, $action);
134
-						break;
135
-					}
136
-					if (!isset($action["message_action"]["isSearchFolder"]) ||
137
-					    !$action["message_action"]["isSearchFolder"]) {
138
-						$this->removeFromFavorite($entryid);
123
+						// return response
124
+						$this->addActionData("item", $data);
125
+						$GLOBALS["bus"]->addData($this->getResponseData());
139 126
 						break;
140
-					}
141
-					$result = $this->deleteSearchFolder($store, $parententryid, $entryid, $action);
142
-					dump($result, '$result');
143
-					if ($result) {
144
-						$this->sendFeedback(true);
145
-					}
146
-					break;
147 127
 
148
-				case "save":
149
-					if (!$store || !$parententryid)
150
-						break;
151
-					if ($entryid) {
152
-						// The "message_action" object has been set, check the action_type field for
153
-						// the exact action which must be taken.
154
-						// Supported actions:
155
-						//   - copy: Copy the folder to the new destination folder
156
-						//   - move: Move the folder to the new destination folder
157
-						//   - emptyfolder: Delete all items within the folder
158
-						//   - readflags: Mark all items within the folder as read
159
-						//   - addtofavorites: Add the folder to "favorites"
160
-						if (!isset($action["message_action"]["isSearchFolder"])) {
161
-							$folder = mapi_msgstore_openentry($store, $entryid);
162
-							$data = $this->getFolderProps($store, $folder);
128
+					case "delete":
129
+						if (!$store || !$parententryid || !$entryid)
130
+							break;
131
+						if (!isset($action["message_action"], $action["message_action"]["action_type"]) ||
132
+					    	$action["message_action"]["action_type"] !== "removefavorites") {
133
+							$this->deleteFolder($store, $parententryid, $entryid, $action);
134
+							break;
163 135
 						}
164
-						if (isset($action["message_action"], $action["message_action"]["action_type"])) {
165
-							switch ($action["message_action"]["action_type"]) {
166
-							case "copy":
167
-							case "move":
168
-								$destentryid = false;
169
-								if (isset($action["message_action"]["destination_parent_entryid"])) {
170
-									$destentryid = hex2bin($action["message_action"]["destination_parent_entryid"]);
171
-								}
172
-
173
-								$deststore = $store;
174
-								if (isset($action["message_action"]["destination_store_entryid"])) {
175
-									$deststore = $GLOBALS['mapisession']->openMessageStore(hex2bin($action["message_action"]["destination_store_entryid"]));
176
-								}
136
+						if (!isset($action["message_action"]["isSearchFolder"]) ||
137
+					    	!$action["message_action"]["isSearchFolder"]) {
138
+							$this->removeFromFavorite($entryid);
139
+							break;
140
+						}
141
+						$result = $this->deleteSearchFolder($store, $parententryid, $entryid, $action);
142
+						dump($result, '$result');
143
+						if ($result) {
144
+							$this->sendFeedback(true);
145
+						}
146
+						break;
177 147
 
178
-								if ($destentryid && $deststore) {
179
-									$this->copyFolder($store, $parententryid, $entryid, $destentryid, $deststore, $action["message_action"]["action_type"] == "move");
180
-								}
181
-								if ($data["props"]["container_class"] === "IPF.Contact") {
182
-									$GLOBALS["bus"]->notify(ADDRESSBOOK_ENTRYID, OBJECT_SAVE);
183
-								}
184
-								break;
148
+					case "save":
149
+						if (!$store || !$parententryid)
150
+							break;
151
+						if ($entryid) {
152
+							// The "message_action" object has been set, check the action_type field for
153
+							// the exact action which must be taken.
154
+							// Supported actions:
155
+							//   - copy: Copy the folder to the new destination folder
156
+							//   - move: Move the folder to the new destination folder
157
+							//   - emptyfolder: Delete all items within the folder
158
+							//   - readflags: Mark all items within the folder as read
159
+							//   - addtofavorites: Add the folder to "favorites"
160
+							if (!isset($action["message_action"]["isSearchFolder"])) {
161
+								$folder = mapi_msgstore_openentry($store, $entryid);
162
+								$data = $this->getFolderProps($store, $folder);
163
+							}
164
+							if (isset($action["message_action"], $action["message_action"]["action_type"])) {
165
+								switch ($action["message_action"]["action_type"]) {
166
+									case "copy":
167
+									case "move":
168
+										$destentryid = false;
169
+										if (isset($action["message_action"]["destination_parent_entryid"])) {
170
+											$destentryid = hex2bin($action["message_action"]["destination_parent_entryid"]);
171
+										}
172
+
173
+										$deststore = $store;
174
+										if (isset($action["message_action"]["destination_store_entryid"])) {
175
+											$deststore = $GLOBALS['mapisession']->openMessageStore(hex2bin($action["message_action"]["destination_store_entryid"]));
176
+										}
177
+
178
+										if ($destentryid && $deststore) {
179
+											$this->copyFolder($store, $parententryid, $entryid, $destentryid, $deststore, $action["message_action"]["action_type"] == "move");
180
+										}
181
+										if ($data["props"]["container_class"] === "IPF.Contact") {
182
+											$GLOBALS["bus"]->notify(ADDRESSBOOK_ENTRYID, OBJECT_SAVE);
183
+										}
184
+										break;
185 185
 
186
-							case "emptyfolder":
187
-								$this->emptyFolder($store, $entryid);
188
-								break;
186
+									case "emptyfolder":
187
+										$this->emptyFolder($store, $entryid);
188
+										break;
189 189
 
190
-							case "readflags":
191
-								$this->setReadFlags($store, $entryid);
192
-								break;
190
+									case "readflags":
191
+										$this->setReadFlags($store, $entryid);
192
+										break;
193 193
 
194
-							case "addtofavorites":
195
-								if (isset($action["message_action"]["isSearchFolder"]) && $action["message_action"]["isSearchFolder"]) {
196
-									$searchStoreEntryId = $action["message_action"]["search_store_entryid"];
197
-									// Set display name to search folder.
198
-									$searchStore = $GLOBALS["mapisession"]->openMessageStore(hex2bin($searchStoreEntryId));
199
-									$searchFolder = mapi_msgstore_openentry($searchStore, $entryid);
200
-									mapi_setprops($searchFolder, [
201
-										PR_DISPLAY_NAME => $action["props"]["display_name"],
202
-									]);
203
-									mapi_savechanges($searchFolder);
204
-									$this->createLinkedSearchFolder($searchFolder);
205
-								}
206
-								else {
207
-									$this->addToFavorite($store, $entryid);
194
+									case "addtofavorites":
195
+										if (isset($action["message_action"]["isSearchFolder"]) && $action["message_action"]["isSearchFolder"]) {
196
+											$searchStoreEntryId = $action["message_action"]["search_store_entryid"];
197
+											// Set display name to search folder.
198
+											$searchStore = $GLOBALS["mapisession"]->openMessageStore(hex2bin($searchStoreEntryId));
199
+											$searchFolder = mapi_msgstore_openentry($searchStore, $entryid);
200
+											mapi_setprops($searchFolder, [
201
+												PR_DISPLAY_NAME => $action["props"]["display_name"],
202
+											]);
203
+											mapi_savechanges($searchFolder);
204
+											$this->createLinkedSearchFolder($searchFolder);
205
+										}
206
+										else {
207
+											$this->addToFavorite($store, $entryid);
208
+										}
209
+										break;
208 210
 								}
209
-								break;
210
-							}
211 211
 						}
212 212
 						else {
213 213
 							// save folder
@@ -262,93 +262,93 @@  discard block
 block discarded – undo
262 262
 					}
263 263
 					break;
264 264
 
265
-				case "closesharedfolder":
266
-					if (isset($action["folder_type"]) && $action["folder_type"] != "all") {
267
-						// We're closing a Shared folder, check if we still have other
268
-						// folders for the same user opened, if not we can safely close
269
-						// the usrstore.
270
-						$stores = $GLOBALS["settings"]->get("zarafa/v1/contexts/hierarchy/shared_stores/" . strtolower(bin2hex($action["user_name"])));
271
-						if (!isset($stores) || empty($stores) || (count($stores) == 1 && isset($stores[$action["folder_type"]]))) {
272
-							$entryid = $GLOBALS["mapisession"]->removeUserStore($action["user_name"]);
265
+					case "closesharedfolder":
266
+						if (isset($action["folder_type"]) && $action["folder_type"] != "all") {
267
+							// We're closing a Shared folder, check if we still have other
268
+							// folders for the same user opened, if not we can safely close
269
+							// the usrstore.
270
+							$stores = $GLOBALS["settings"]->get("zarafa/v1/contexts/hierarchy/shared_stores/" . strtolower(bin2hex($action["user_name"])));
271
+							if (!isset($stores) || empty($stores) || (count($stores) == 1 && isset($stores[$action["folder_type"]]))) {
272
+								$entryid = $GLOBALS["mapisession"]->removeUserStore($action["user_name"]);
273
+							}
274
+							else {
275
+								$entryid = $GLOBALS["mapisession"]->getStoreEntryIdOfUser($action["user_name"]);
276
+								$this->removeFromFavorite(hex2bin($action["entryid"]), $store, PR_WLINK_ENTRYID, false);
277
+							}
273 278
 						}
274 279
 						else {
275
-							$entryid = $GLOBALS["mapisession"]->getStoreEntryIdOfUser($action["user_name"]);
276
-							$this->removeFromFavorite(hex2bin($action["entryid"]), $store, PR_WLINK_ENTRYID, false);
280
+							// We're closing a Shared Store, simply remove it from the session.
281
+							$entryid = $GLOBALS["mapisession"]->removeUserStore($action["user_name"]);
282
+
283
+							if (isset($action["remove_favorites"]) && $action["remove_favorites"]) {
284
+								$this->removeFromFavorite(hex2bin($action["store_entryid"]), $store, PR_WLINK_STORE_ENTRYID, false);
285
+							}
277 286
 						}
278
-					}
279
-					else {
280
-						// We're closing a Shared Store, simply remove it from the session.
281
-						$entryid = $GLOBALS["mapisession"]->removeUserStore($action["user_name"]);
282 287
 
283
-						if (isset($action["remove_favorites"]) && $action["remove_favorites"]) {
284
-							$this->removeFromFavorite(hex2bin($action["store_entryid"]), $store, PR_WLINK_STORE_ENTRYID, false);
288
+						$data = [];
289
+						$data["store_entryid"] = bin2hex($entryid);
290
+						if (isset($action["folder_type"])) {
291
+							$data["folder_type"] = $action["folder_type"];
285 292
 						}
286
-					}
287 293
 
288
-					$data = [];
289
-					$data["store_entryid"] = bin2hex($entryid);
290
-					if (isset($action["folder_type"])) {
291
-						$data["folder_type"] = $action["folder_type"];
292
-					}
294
+						$this->addActionData("delete", $data);
295
+						$GLOBALS["bus"]->addData($this->getResponseData());
296
+						$GLOBALS["bus"]->notify(ADDRESSBOOK_ENTRYID, OBJECT_SAVE);
297
+						break;
293 298
 
294
-					$this->addActionData("delete", $data);
295
-					$GLOBALS["bus"]->addData($this->getResponseData());
296
-					$GLOBALS["bus"]->notify(ADDRESSBOOK_ENTRYID, OBJECT_SAVE);
297
-					break;
299
+					case "opensharedfolder":
300
+						$username = strtolower($action["user_name"]);
301
+						$store = $GLOBALS["mapisession"]->addUserStore($username);
302
+						if (!$store) {
303
+							break;
304
+						}
298 305
 
299
-				case "opensharedfolder":
300
-					$username = strtolower($action["user_name"]);
301
-					$store = $GLOBALS["mapisession"]->addUserStore($username);
302
-					if (!$store) {
303
-						break;
304
-					}
306
+						$options = [$username => [$action["folder_type"] => $action]];
307
+						$data = $GLOBALS["operations"]->getHierarchyList($this->list_properties, HIERARCHY_GET_ONE, $store, $options, $username);
305 308
 
306
-					$options = [$username => [$action["folder_type"] => $action]];
307
-					$data = $GLOBALS["operations"]->getHierarchyList($this->list_properties, HIERARCHY_GET_ONE, $store, $options, $username);
309
+						if (empty($data["item"][0]["folders"]["item"])) {
310
+							throw new MAPIException(null, MAPI_E_NO_ACCESS);
311
+						}
308 312
 
309
-					if (empty($data["item"][0]["folders"]["item"])) {
310
-						throw new MAPIException(null, MAPI_E_NO_ACCESS);
311
-					}
313
+						$folders = count($data["item"][0]["folders"]["item"]);
314
+						if ($folders === 0) {
315
+							throw new MAPIException(null, MAPI_E_NO_ACCESS);
316
+						}
312 317
 
313
-					$folders = count($data["item"][0]["folders"]["item"]);
314
-					if ($folders === 0) {
315
-						throw new MAPIException(null, MAPI_E_NO_ACCESS);
316
-					}
318
+						$noPermissionFolders = array_filter($data['item'][0]['folders']['item'], function ($item) {
319
+							return $item['props']['access'] === 0;
320
+						});
321
+						if (count($noPermissionFolders) >= $folders) {
322
+							// Throw an exception that we couldn't open the shared store,
323
+							// lets have processException() fill in our error message.
324
+							throw new MAPIException(null, MAPI_E_NO_ACCESS);
325
+						}
317 326
 
318
-					$noPermissionFolders = array_filter($data['item'][0]['folders']['item'], function ($item) {
319
-						return $item['props']['access'] === 0;
320
-					});
321
-					if (count($noPermissionFolders) >= $folders) {
322
-						// Throw an exception that we couldn't open the shared store,
323
-						// lets have processException() fill in our error message.
324
-						throw new MAPIException(null, MAPI_E_NO_ACCESS);
325
-					}
327
+						$this->addActionData("list", $data);
328
+						$GLOBALS["bus"]->addData($this->getResponseData());
329
+						$GLOBALS["bus"]->notify(ADDRESSBOOK_ENTRYID, OBJECT_SAVE);
330
+						break;
326 331
 
327
-					$this->addActionData("list", $data);
328
-					$GLOBALS["bus"]->addData($this->getResponseData());
329
-					$GLOBALS["bus"]->notify(ADDRESSBOOK_ENTRYID, OBJECT_SAVE);
330
-					break;
332
+					case "sharedstoreupdate":
333
+						$supported_types = ['inbox' => 1, 'all' => 1];
334
+						$users = $GLOBALS["settings"]->get("zarafa/v1/contexts/hierarchy/shared_stores", []);
331 335
 
332
-				case "sharedstoreupdate":
333
-					$supported_types = ['inbox' => 1, 'all' => 1];
334
-					$users = $GLOBALS["settings"]->get("zarafa/v1/contexts/hierarchy/shared_stores", []);
336
+						foreach ($users as $username => $data) {
337
+							$key = array_keys($data)[0];
338
+							$folder_type = $data[$key]['folder_type'];
335 339
 
336
-					foreach ($users as $username => $data) {
337
-						$key = array_keys($data)[0];
338
-						$folder_type = $data[$key]['folder_type'];
340
+							if (!isset($supported_types[$folder_type])) {
341
+								continue;
342
+							}
339 343
 
340
-						if (!isset($supported_types[$folder_type])) {
341
-							continue;
344
+							$GLOBALS["bus"]->notify(REQUEST_ENTRYID, HIERARCHY_UPDATE, [strtolower(hex2bin($username)), $folder_type]);
342 345
 						}
343 346
 
344
-						$GLOBALS["bus"]->notify(REQUEST_ENTRYID, HIERARCHY_UPDATE, [strtolower(hex2bin($username)), $folder_type]);
345
-					}
346
-
347
-					$this->sendFeedback(true);
348
-					break;
347
+						$this->sendFeedback(true);
348
+						break;
349 349
 
350
-				default:
351
-					$this->handleUnknownActionType($actionType);
350
+					default:
351
+						$this->handleUnknownActionType($actionType);
352 352
 				}
353 353
 			}
354 354
 			catch (MAPIException $e) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -315,7 +315,7 @@
 block discarded – undo
315 315
 						throw new MAPIException(null, MAPI_E_NO_ACCESS);
316 316
 					}
317 317
 
318
-					$noPermissionFolders = array_filter($data['item'][0]['folders']['item'], function ($item) {
318
+					$noPermissionFolders = array_filter($data['item'][0]['folders']['item'], function($item) {
319 319
 						return $item['props']['access'] === 0;
320 320
 					});
321 321
 					if (count($noPermissionFolders) >= $folders) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function execute() {
57 57
 		foreach ($this->data as $actionType => $action) {
58
-			if (!isset($actionType))
59
-				continue;
58
+			if (!isset($actionType)) {
59
+							continue;
60
+			}
60 61
 			try {
61 62
 				$store = $this->getActionStore($action);
62 63
 				$parententryid = $this->getActionParentEntryID($action);
@@ -126,8 +127,9 @@  discard block
 block discarded – undo
126 127
 					break;
127 128
 
128 129
 				case "delete":
129
-					if (!$store || !$parententryid || !$entryid)
130
-						break;
130
+					if (!$store || !$parententryid || !$entryid) {
131
+											break;
132
+					}
131 133
 					if (!isset($action["message_action"], $action["message_action"]["action_type"]) ||
132 134
 					    $action["message_action"]["action_type"] !== "removefavorites") {
133 135
 						$this->deleteFolder($store, $parententryid, $entryid, $action);
@@ -146,8 +148,9 @@  discard block
 block discarded – undo
146 148
 					break;
147 149
 
148 150
 				case "save":
149
-					if (!$store || !$parententryid)
150
-						break;
151
+					if (!$store || !$parententryid) {
152
+											break;
153
+					}
151 154
 					if ($entryid) {
152 155
 						// The "message_action" object has been set, check the action_type field for
153 156
 						// the exact action which must be taken.
Please login to merge, or discard this patch.
server/includes/modules/class.appointmentlistmodule.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -616,8 +616,8 @@
 block discarded – undo
616 616
 			// may have changed, so it's necessary to check again if they are
617 617
 			// still in the requested interval.
618 618
 			if (($start <= $item["props"]["startdate"] && $end > $item['props']['startdate']) ||
619
-			    ($start < $item["props"]["duedate"] && $end >= $item['props']['duedate']) ||
620
-			    ($start > $item["props"]["startdate"] && $end < $item['props']['duedate'])) {
619
+				($start < $item["props"]["duedate"] && $end >= $item['props']['duedate']) ||
620
+				($start > $item["props"]["startdate"] && $end < $item['props']['duedate'])) {
621 621
 				array_push($items, $item);
622 622
 			}
623 623
 		}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -521,8 +521,7 @@  discard block
 block discarded – undo
521 521
 		// all-day events) or was imported from a system which doesn't set it.
522 522
 		$isTzdefstartSet = isset($calendaritem['props']['tzdefstart']);
523 523
 		$tzdefstart = $isTzdefstartSet ?
524
-			hex2bin($calendaritem['props']['tzdefstart']) :
525
-			mapi_ianatz_to_tzdef("Etc/UTC");
524
+			hex2bin($calendaritem['props']['tzdefstart']) : mapi_ianatz_to_tzdef("Etc/UTC");
526 525
 
527 526
 		// queryrows only returns 510 chars max, so if tzdef is longer than that
528 527
 		// it was probably silently truncated. In such case we need to open
@@ -555,8 +554,7 @@  discard block
 block discarded – undo
555 554
 				// on the day before or after. This should be fine for all the
556 555
 				// timezones which do not exceed 12 hour difference to UTC.
557 556
 				$localStart = $interval > 0 ?
558
-					$calendaritem['props']['startdate'] - ($interval < 43200 ? $interval : $interval - 86400):
559
-					$calendaritem['props']['startdate'] + ($interval > -43200 ? $interval : $interval - 86400) ;
557
+					$calendaritem['props']['startdate'] - ($interval < 43200 ? $interval : $interval - 86400) : $calendaritem['props']['startdate'] + ($interval > -43200 ? $interval : $interval - 86400);
560 558
 				$calendaritem['props']['startdate'] = $calendaritem['props']['commonstart'] = $localStart;
561 559
 				$calendaritem['props']['duedate'] = $calendaritem['props']['commonend'] = $localStart + $duration;
562 560
 			}
Please login to merge, or discard this patch.