Passed
Push — master ( e85ccb...42b683 )
by
unknown
05:52
created
plugins/files/php/plugin.files.php 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -45,37 +45,37 @@
 block discarded – undo
45 45
 
46 46
 			case 'server.index.load.custom':
47 47
 				switch ($data['name']) {
48
-				case 'files_get_recipients':
49
-					RecipientHandler::doGetRecipients();
50
-					break;
48
+					case 'files_get_recipients':
49
+						RecipientHandler::doGetRecipients();
50
+						break;
51 51
 
52
-				case 'download_file':
53
-					DownloadHandler::doDownload();
54
-					break;
52
+					case 'download_file':
53
+						DownloadHandler::doDownload();
54
+						break;
55 55
 
56
-				case 'upload_file':
57
-					UploadHandler::doUpload();
58
-					break;
56
+					case 'upload_file':
57
+						UploadHandler::doUpload();
58
+						break;
59 59
 
60
-				case 'form':
61
-					if (isset($_GET['backend'])) {
62
-						$backend = urldecode($_GET["backend"]);
63
-					}
64
-					else {
65
-						$backend = '';
66
-					}
67
-					$backendstore = Files\Backend\BackendStore::getInstance();
60
+					case 'form':
61
+						if (isset($_GET['backend'])) {
62
+							$backend = urldecode($_GET["backend"]);
63
+						}
64
+						else {
65
+							$backend = '';
66
+						}
67
+						$backendstore = Files\Backend\BackendStore::getInstance();
68 68
 
69
-					if ($backendstore->backendExists($backend)) {
70
-						$backendInstance = $backendstore->getInstanceOfBackend($backend);
71
-						$formdata = $backendInstance->getFormConfig();
69
+						if ($backendstore->backendExists($backend)) {
70
+							$backendInstance = $backendstore->getInstanceOfBackend($backend);
71
+							$formdata = $backendInstance->getFormConfig();
72 72
 
73
-						exit($formdata);
74
-					}
73
+							exit($formdata);
74
+						}
75 75
 
76
-						exit("Specified backend does not exist!");
76
+							exit("Specified backend does not exist!");
77 77
 
78
-					break;
78
+						break;
79 79
 			}
80 80
 			break;
81 81
 		}
Please login to merge, or discard this patch.
plugins/smime/php/lib/X509.php 1 patch
Switch Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 		$tag = $this->peek();
16 16
 
17 17
 		switch ($tag) {
18
-		case 0:
19
-			$res['otherName'] = $this->oid(-6);
20
-			break;
21
-
22
-		case 1:
23
-			$res['rfc822Name'] = $this->next(-22);
24
-			break;
25
-
26
-		case 2:
27
-			$res['dNSName'] = $this->next(-22);
28
-			break;
29
-
30
-		case 4:
31
-			$this->next(4);
32
-			$res['directoryName'] = $this->name();
33
-			$res['directoryName_'] = $this->nameasstring($res['directoryName']);
34
-			break;
35
-
36
-		case 6:
37
-			$res['uniformResourceIdentifier'] = $this->next(-22);
38
-			break;
39
-
40
-		default:
41
-			throw new \Exception("Unsupported GeneralName: {$tag}");
42
-#                trigger_error("Unsupported GeneralName: $tag", E_USER_ERROR);
18
+			case 0:
19
+				$res['otherName'] = $this->oid(-6);
20
+				break;
21
+
22
+			case 1:
23
+				$res['rfc822Name'] = $this->next(-22);
24
+				break;
25
+
26
+			case 2:
27
+				$res['dNSName'] = $this->next(-22);
28
+				break;
29
+
30
+			case 4:
31
+				$this->next(4);
32
+				$res['directoryName'] = $this->name();
33
+				$res['directoryName_'] = $this->nameasstring($res['directoryName']);
34
+				break;
35
+
36
+			case 6:
37
+				$res['uniformResourceIdentifier'] = $this->next(-22);
38
+				break;
39
+
40
+			default:
41
+				throw new \Exception("Unsupported GeneralName: {$tag}");
42
+	#                trigger_error("Unsupported GeneralName: $tag", E_USER_ERROR);
43 43
 		}
44 44
 
45 45
 		return $res;
Please login to merge, or discard this patch.
plugins/smime/php/class.certificate.php 1 patch
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@
 block discarded – undo
33 33
 		}
34 34
 
35 35
 		switch ($this->status) {
36
-		case 'good':
37
-			return OCSP_CERT_STATUS_GOOD;
36
+			case 'good':
37
+				return OCSP_CERT_STATUS_GOOD;
38 38
 
39
-		case 'revoked':
40
-			return OCSP_CERT_STATUS_REVOKED;
39
+			case 'revoked':
40
+				return OCSP_CERT_STATUS_REVOKED;
41 41
 
42
-		default:
43
-			return OCSP_CERT_STATUS_UNKOWN;
42
+			default:
43
+				return OCSP_CERT_STATUS_UNKOWN;
44 44
 		}
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.
plugins/smime/php/class.pluginsmimemodule.php 1 patch
Switch Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -29,62 +29,62 @@
 block discarded – undo
29 29
 			if (!isset($actionType))
30 30
 				continue;
31 31
 			switch ($actionType) {
32
-			case 'certificate':
33
-				$data = $this->verifyCertificate($actionData);
34
-				$response = [
35
-					'type' => 3,
36
-					'status' => $data['status'],
37
-					'message' => $data['message'],
38
-					'data' => $data['data'],
39
-				];
40
-				$this->addActionData('certificate', $response);
41
-				$GLOBALS['bus']->addData($this->getResponseData());
42
-				break;
32
+				case 'certificate':
33
+					$data = $this->verifyCertificate($actionData);
34
+					$response = [
35
+						'type' => 3,
36
+						'status' => $data['status'],
37
+						'message' => $data['message'],
38
+						'data' => $data['data'],
39
+					];
40
+					$this->addActionData('certificate', $response);
41
+					$GLOBALS['bus']->addData($this->getResponseData());
42
+					break;
43 43
 
44
-			case 'passphrase':
45
-				$data = $this->verifyPassphrase($actionData);
46
-				$response = [
47
-					'type' => 3,
48
-					'status' => $data['status'],
49
-				];
50
-				$this->addActionData('passphrase', $response);
51
-				$GLOBALS['bus']->addData($this->getResponseData());
52
-				break;
44
+				case 'passphrase':
45
+					$data = $this->verifyPassphrase($actionData);
46
+					$response = [
47
+						'type' => 3,
48
+						'status' => $data['status'],
49
+					];
50
+					$this->addActionData('passphrase', $response);
51
+					$GLOBALS['bus']->addData($this->getResponseData());
52
+					break;
53 53
 
54
-			case 'changepassphrase':
55
-				$data = $this->changePassphrase($actionData);
56
-				if ($data === CHANGE_PASSPHRASE_SUCCESS) {
57
-					// Reset cached passphrase.
58
-					$encryptionStore = EncryptionStore::getInstance();
59
-					withPHPSession(function () use ($encryptionStore) {
60
-						$encryptionStore->add('smime', '');
61
-					});
62
-				}
63
-				$response = [
64
-					'type' => 3,
65
-					'code' => $data,
66
-				];
67
-				$this->addActionData('changepassphrase', $response);
68
-				$GLOBALS['bus']->addData($this->getResponseData());
69
-				break;
54
+				case 'changepassphrase':
55
+					$data = $this->changePassphrase($actionData);
56
+					if ($data === CHANGE_PASSPHRASE_SUCCESS) {
57
+						// Reset cached passphrase.
58
+						$encryptionStore = EncryptionStore::getInstance();
59
+						withPHPSession(function () use ($encryptionStore) {
60
+							$encryptionStore->add('smime', '');
61
+						});
62
+					}
63
+					$response = [
64
+						'type' => 3,
65
+						'code' => $data,
66
+					];
67
+					$this->addActionData('changepassphrase', $response);
68
+					$GLOBALS['bus']->addData($this->getResponseData());
69
+					break;
70 70
 
71
-			case 'list':
72
-				$data = $this->getPublicCertificates();
73
-				$this->addActionData('list', $data);
74
-				$GLOBALS['bus']->addData($this->getResponseData());
75
-				break;
71
+				case 'list':
72
+					$data = $this->getPublicCertificates();
73
+					$this->addActionData('list', $data);
74
+					$GLOBALS['bus']->addData($this->getResponseData());
75
+					break;
76 76
 
77
-			case 'delete':
78
-				// FIXME: handle multiple deletes? Separate function?
79
-				$entryid = $actionData['entryid'];
80
-				$root = mapi_msgstore_openentry($this->store);
81
-				mapi_folder_deletemessages($root, [hex2bin($entryid)]);
77
+				case 'delete':
78
+					// FIXME: handle multiple deletes? Separate function?
79
+					$entryid = $actionData['entryid'];
80
+					$root = mapi_msgstore_openentry($this->store);
81
+					mapi_folder_deletemessages($root, [hex2bin($entryid)]);
82 82
 
83
-				$this->sendFeedback(true);
84
-				break;
83
+					$this->sendFeedback(true);
84
+					break;
85 85
 
86
-			default:
87
-				$this->handleUnknownActionType($actionType);
86
+				default:
87
+					$this->handleUnknownActionType($actionType);
88 88
 			}
89 89
 		}
90 90
 		catch (Exception $e) {
Please login to merge, or discard this patch.
server/includes/modules/class.addressbooklistmodule.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -908,14 +908,14 @@
 block discarded – undo
908 908
 						// Do not show contacts' folders in the AB list view for which
909 909
 						// the user has permissions, but hasn't added them to the folder hierarchy.
910 910
 						if (!empty($sharedUserSetting) &&
911
-						    !isset($sharedUserSetting['all']) &&
912
-						    !isset($sharedUserSetting['contact']) &&
913
-						    in_array($mainUserEntryId, array_column($grants, 'userid'))) {
911
+							!isset($sharedUserSetting['all']) &&
912
+							!isset($sharedUserSetting['contact']) &&
913
+							in_array($mainUserEntryId, array_column($grants, 'userid'))) {
914 914
 							continue;
915 915
 						}
916 916
 						if (isset($sharedUserSetting['all']) ||
917
-						    isset($sharedUserSetting['contact']) ||
918
-						    in_array($mainUserEntryId, array_column($grants, 'userid')))
917
+							isset($sharedUserSetting['contact']) ||
918
+							in_array($mainUserEntryId, array_column($grants, 'userid')))
919 919
 						{
920 920
 							$this->addFolder($folders, [
921 921
 								// Postfix display name of every contact folder with respective owner name
Please login to merge, or discard this patch.
plugins/kendox/php/kendox-client/class.kendox-client.php 1 patch
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.
plugins/kendox/php/kendox-client/class.kendox-token-generator.php 1 patch
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.
server/includes/modules/class.hierarchymodule.php 2 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.
server/includes/modules/class.appointmentlistmodule.php 1 patch
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.