Completed
Push — master ( aa44e9...fa84e5 )
by Ralf
90:14 queued 73:21
created
mail/setup/default_records.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
 // if no rows/rights found, give Default group rights
25 25
 if (!$GLOBALS['egw_setup']->db->affected_rows())
26 26
 {
27
-	$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
28
-	$GLOBALS['egw_setup']->add_acl('mail','run',$defaultgroup);
27
+	$defaultgroup = $GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False);
28
+	$GLOBALS['egw_setup']->add_acl('mail', 'run', $defaultgroup);
29 29
 }
30 30
 
31 31
 // change common/default_app pref to mail, if it was felamimail
Please login to merge, or discard this patch.
mail/inc/class.mail_wizard.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 		parent::__construct();
33 33
 
34 34
 		// need emailadmin's app.css file
35
-		Framework::includeCSS('admin','app');
35
+		Framework::includeCSS('admin', 'app');
36 36
 
37 37
 		// and translations
38 38
 		Api\Translation::add_app('admin');
Please login to merge, or discard this patch.
mail/inc/class.mail_integration.inc.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 * @param int $_icServerID mail profile id
66 66
 	 * @throws Api\Exception\AssertionFailed
67 67
 	 */
68
-	public static function integrate ($_to_emailAddress=false,$_subject=false,$_body=false,$_attachments=false,$_date=false,$_rawMail=null,$_icServerID=null)
68
+	public static function integrate($_to_emailAddress = false, $_subject = false, $_body = false, $_attachments = false, $_date = false, $_rawMail = null, $_icServerID = null)
69 69
 	{
70 70
 		// App name which is called for integration
71
-		$app = isset($GLOBALS['egw_info']['user']['apps'][$_GET['app']])? $_GET['app'] : null;
71
+		$app = isset($GLOBALS['egw_info']['user']['apps'][$_GET['app']]) ? $_GET['app'] : null;
72 72
 
73 73
 		// preset app entry id, selected by user from app_entry_dialog
74 74
 		$app_entry_id = $_GET['entry_id'];
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		if (!$_date)
78 78
 		{
79 79
 			$time = time();
80
-			$_date = Api\DateTime::server2user($time->now,'ts');
80
+			$_date = Api\DateTime::server2user($time->now, 'ts');
81 81
 		}
82 82
 
83 83
 		// For dealing with multiple files of the same name
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 			$sessionLocation = 'mail';
92 92
 			$mailbox = base64_decode($_GET['mailbox']);
93 93
 
94
-			if (!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')&&is_array($_attachments))
94
+			if (!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'] === 'text_only') && is_array($_attachments))
95 95
 			{
96 96
 				// initialize mail open connection requirements
97
-				if (!isset($_icServerID)) $_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
98
-				$mo = mail_bo::getInstance(true,$_icServerID);
97
+				if (!isset($_icServerID)) $_icServerID = & Api\Cache::getSession($sessionLocation, 'activeProfileID');
98
+				$mo = mail_bo::getInstance(true, $_icServerID);
99 99
 				$mo->openConnection();
100 100
 				$messagePartId = $messageFolder = null;
101 101
 				foreach ($_attachments as $attachment)
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 					//error_log(__METHOD__.__LINE__.array2string($attachment));
104 104
 					if (trim(strtoupper($attachment['type'])) == 'MESSAGE/RFC822' && !empty($attachment['uid']) && !empty($attachment['folder']))
105 105
 					{
106
-						$mo->reopen(($attachment['folder']?$attachment['folder']:$mailbox));
106
+						$mo->reopen(($attachment['folder'] ? $attachment['folder'] : $mailbox));
107 107
 
108 108
 						// get the message itself, and attach it, as we are able to display it in egw
109 109
 						// instead of fetching only the attachments attached files (as we did previously)
110
-						$message = $mo->getMessageRawBody($attachment['uid'],$attachment['partID'],($attachment['folder']?$attachment['folder']:$mailbox));
111
-						$headers = $mo->getMessageHeader($attachment['uid'],$attachment['partID'],true,false,($attachment['folder']?$attachment['folder']:$mailbox));
110
+						$message = $mo->getMessageRawBody($attachment['uid'], $attachment['partID'], ($attachment['folder'] ? $attachment['folder'] : $mailbox));
111
+						$headers = $mo->getMessageHeader($attachment['uid'], $attachment['partID'], true, false, ($attachment['folder'] ? $attachment['folder'] : $mailbox));
112 112
 						$subject = mail_bo::adaptSubjectForImport($headers['SUBJECT']);
113
-						$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
114
-						$tmpfile = fopen($attachment_file,'w');
115
-						fwrite($tmpfile,$message);
113
+						$attachment_file = tempnam($GLOBALS['egw_info']['server']['temp_dir'], $GLOBALS['egw_info']['flags']['currentapp']."_");
114
+						$tmpfile = fopen($attachment_file, 'w');
115
+						fwrite($tmpfile, $message);
116 116
 						fclose($tmpfile);
117 117
 						$size = filesize($attachment_file);
118 118
 						$attachments[] = array(
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
 							$messageUid = $attachment['uid'];
133 133
 							$messagePartId = $attachment['partID'];
134 134
 							$mo->reopen($attachment['folder']);
135
-							$attachmentData = $mo->getAttachment($attachment['uid'],$attachment['partID'],$is_winmail,false,false,$attachment['folder']);
136
-							$attachment['file'] =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
137
-							$tmpfile = fopen($attachment['file'],'w');
138
-							fwrite($tmpfile,$attachmentData['attachment']);
135
+							$attachmentData = $mo->getAttachment($attachment['uid'], $attachment['partID'], $is_winmail, false, false, $attachment['folder']);
136
+							$attachment['file'] = tempnam($GLOBALS['egw_info']['server']['temp_dir'], $GLOBALS['egw_info']['flags']['currentapp']."_");
137
+							$tmpfile = fopen($attachment['file'], 'w');
138
+							fwrite($tmpfile, $attachmentData['attachment']);
139 139
 							fclose($tmpfile);
140 140
 						}
141 141
 						//make sure we search for our attached file in our configured temp_dir
142
-						if (isset($attachment['file']) && parse_url($attachment['file'],PHP_URL_SCHEME) != 'vfs' &&
142
+						if (isset($attachment['file']) && parse_url($attachment['file'], PHP_URL_SCHEME) != 'vfs' &&
143 143
 							file_exists($GLOBALS['egw_info']['server']['temp_dir'].SEP.basename($attachment['file'])))
144 144
 						{
145 145
 							$attachment['file'] = $GLOBALS['egw_info']['server']['temp_dir'].SEP.basename($attachment['file']);
146 146
 						}
147
-						if(in_array($attachment['name'], $file_list))
147
+						if (in_array($attachment['name'], $file_list))
148 148
 						{
149 149
 							$dupe_count[$attachment['name']]++;
150
-							$attachment['name'] = pathinfo($attachment['name'], PATHINFO_FILENAME) .
151
-								' ('.($dupe_count[$attachment['name']] + 1).')' . '.' .
150
+							$attachment['name'] = pathinfo($attachment['name'], PATHINFO_FILENAME).
151
+								' ('.($dupe_count[$attachment['name']] + 1).')'.'.'.
152 152
 								pathinfo($attachment['name'], PATHINFO_EXTENSION);
153 153
 						}
154 154
 						$attachments[] = array(
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 					//error_log(__METHOD__.__LINE__."#".$messageUid.'#'.$messageFolder);
167 167
 					try // message may be deleted already, as it maybe done by autosave
168 168
 					{
169
-						$mo->deleteMessages(array($messageUid),$messageFolder);
169
+						$mo->deleteMessages(array($messageUid), $messageFolder);
170 170
 					}
171 171
 					catch (Api\Exception $e)
172 172
 					{
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			}
179 179
 			// this one adds the mail itself (as message/rfc822 (.eml) file) to the app as additional attachment
180 180
 			// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
181
-			if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw' &&
181
+			if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'] === 'add_raw' &&
182 182
 				$_rawMail && file_exists($_rawMail))
183 183
 			{
184 184
 				$subject = mail_bo::adaptSubjectForImport($_subject);
@@ -193,24 +193,24 @@  discard block
 block discarded – undo
193 193
 			}
194 194
 
195 195
 			$toaddr = array();
196
-			foreach(array('to','cc','bcc') as $x)
196
+			foreach (array('to', 'cc', 'bcc') as $x)
197 197
 			{
198 198
 				if (is_array($_to_emailAddress[$x]) && !empty($_to_emailAddress[$x]))
199 199
 				{
200
-					$toaddr = array_merge($toaddr,$_to_emailAddress[$x]);
200
+					$toaddr = array_merge($toaddr, $_to_emailAddress[$x]);
201 201
 				}
202 202
 			}
203 203
 			$body_striped = strip_tags($_body); //we need to fix broken tags (or just stuff like "<800 USD/p" )
204
-			$body_decoded = htmlspecialchars_decode($body_striped,ENT_QUOTES);
204
+			$body_decoded = htmlspecialchars_decode($body_striped, ENT_QUOTES);
205 205
 			$body = mail_bo::createHeaderInfoSection(array('FROM'=>$_to_emailAddress['from'],
206
-				'TO'=>(!empty($_to_emailAddress['to'])?implode(',',$_to_emailAddress['to']):null),
207
-				'CC'=>(!empty($_to_emailAddress['cc'])?implode(',',$_to_emailAddress['cc']):null),
208
-				'BCC'=>(!empty($_to_emailAddress['bcc'])?implode(',',$_to_emailAddress['bcc']):null),
206
+				'TO'=>(!empty($_to_emailAddress['to']) ? implode(',', $_to_emailAddress['to']) : null),
207
+				'CC'=>(!empty($_to_emailAddress['cc']) ? implode(',', $_to_emailAddress['cc']) : null),
208
+				'BCC'=>(!empty($_to_emailAddress['bcc']) ? implode(',', $_to_emailAddress['bcc']) : null),
209 209
 				'SUBJECT'=>$_subject,
210 210
 				'DATE'=>mail_bo::_strtotime($_date))).$body_decoded;
211 211
 
212 212
 			$mailcontent = array(
213
-				'mailaddress' => implode(',',$toaddr),
213
+				'mailaddress' => implode(',', $toaddr),
214 214
 				'subject' => $_subject,
215 215
 				'message' => $body,
216 216
 				'attachments' => $attachments,
@@ -225,28 +225,28 @@  discard block
 block discarded – undo
225 225
 			$hA = mail_ui::splitRowID($_GET['rowid']);
226 226
 			$sessionLocation = $hA['app']; // THIS is part of the row ID, we may use this for validation
227 227
 			// Check the mail app
228
-			if ($sessionLocation != 'mail') throw new Api\Exception\AssertionFailed(lang('Application mail expected but got: %1',$sessionLocation));
228
+			if ($sessionLocation != 'mail') throw new Api\Exception\AssertionFailed(lang('Application mail expected but got: %1', $sessionLocation));
229 229
 			$uid = $hA['msgUID'];
230 230
 			$mailbox = $hA['folder'];
231 231
 			$icServerID = $hA['profileID'];
232 232
 
233 233
 			if ($uid && $mailbox)
234 234
 			{
235
-				if (!isset($icServerID)) $icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
236
-				$mo	= mail_bo::getInstance(true,$icServerID);
235
+				if (!isset($icServerID)) $icServerID = & Api\Cache::getSession($sessionLocation, 'activeProfileID');
236
+				$mo = mail_bo::getInstance(true, $icServerID);
237 237
 				$mo->openConnection();
238 238
 				$mo->reopen($mailbox);
239
-				$mailcontent = mail_bo::get_mailcontent($mo,$uid,'',$mailbox,false,true,(!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')));
239
+				$mailcontent = mail_bo::get_mailcontent($mo, $uid, '', $mailbox, false, true, (!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'] === 'text_only')));
240 240
 				// this one adds the mail itself (as message/rfc822 (.eml) file) to the app as additional attachment
241 241
 				// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
242
-				if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw')
242
+				if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'] === 'add_raw')
243 243
 				{
244
-					$message = $mo->getMessageRawBody($uid, '',$mailbox);
245
-					$headers = $mo->getMessageHeader($uid, '',true,false,$mailbox);
244
+					$message = $mo->getMessageRawBody($uid, '', $mailbox);
245
+					$headers = $mo->getMessageHeader($uid, '', true, false, $mailbox);
246 246
 					$subject = mail_bo::adaptSubjectForImport($headers['SUBJECT']);
247
-					$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."mail_integrate");
248
-					$tmpfile = fopen($attachment_file,'w');
249
-					fwrite($tmpfile,$message);
247
+					$attachment_file = tempnam($GLOBALS['egw_info']['server']['temp_dir'], $GLOBALS['egw_info']['flags']['currentapp']."mail_integrate");
248
+					$tmpfile = fopen($attachment_file, 'w');
249
+					fwrite($tmpfile, $message);
250 250
 					fclose($tmpfile);
251 251
 					$size = filesize($attachment_file);
252 252
 					$mailcontent['attachments'][] = array(
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 
265 265
 		// Convert addresses to email and personal
266
-		$addresses = imap_rfc822_parse_adrlist($mailcontent['mailaddress'],'');
266
+		$addresses = imap_rfc822_parse_adrlist($mailcontent['mailaddress'], '');
267 267
 		foreach ($addresses as $address)
268 268
 		{
269
-			$email = sprintf('%s@%s',trim($address->mailbox),trim($address->host));
270
-			$data_addresses[] = array (
269
+			$email = sprintf('%s@%s', trim($address->mailbox), trim($address->host));
270
+			$data_addresses[] = array(
271 271
 				'email' => $email,
272 272
 				'name' => !empty($address->personal) ? $address->personal : $email
273 273
 			);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		$data_message = preg_replace_callback(
278 278
 			'/[-_+=~\.]{'.self::MAX_LINE_CHARS.',}/m',
279 279
 			function($matches) {
280
-				return substr($matches[0],0,self::MAX_LINE_CHARS);
280
+				return substr($matches[0], 0, self::MAX_LINE_CHARS);
281 281
 			},
282 282
 			$mailcontent['message']
283 283
 		);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		// Get attachments ready for integration as link
286 286
 		if (is_array($mailcontent['attachments']))
287 287
 		{
288
-			foreach($mailcontent['attachments'] as $key => $attachment)
288
+			foreach ($mailcontent['attachments'] as $key => $attachment)
289 289
 			{
290 290
 				$data_attachments[$key] = array(
291 291
 					'name' => $mailcontent['attachments'][$key]['name'],
@@ -296,28 +296,28 @@  discard block
 block discarded – undo
296 296
 				if ($uid && !$mailcontent['attachments'][$key]['add_raw'])
297 297
 				{
298 298
 					$data_attachments[$key]['egw_data'] = Link::set_data($mailcontent['attachments'][$key]['mimeType'],
299
-						'EGroupware\\Api\\Mail::getAttachmentAccount',array($icServerID, $mailbox, $uid, $attachment['partID'], $is_winmail, true),true);
299
+						'EGroupware\\Api\\Mail::getAttachmentAccount', array($icServerID, $mailbox, $uid, $attachment['partID'], $is_winmail, true), true);
300 300
 				}
301 301
 				unset($mailcontent['attachments'][$key]['add_raw']);
302 302
 			}
303 303
 		}
304 304
 
305 305
 		// Check if the hook is registered
306
-		if (Api\Hooks::exists('mail_import',$app) == 0)
306
+		if (Api\Hooks::exists('mail_import', $app) == 0)
307 307
 		{
308 308
 			// Try to register hook
309 309
 			Api\Hooks::read(true);
310 310
 		}
311 311
 
312 312
 		// Get the registered hook method of requested app for integration
313
-		$hook = Api\Hooks::single(array('location' => 'mail_import'),$app);
313
+		$hook = Api\Hooks::single(array('location' => 'mail_import'), $app);
314 314
 
315 315
 		// Load Api\Translation for the app since the original URL
316 316
 		// is from mail integration and only loads mail Api\Translation
317 317
 		Api\Translation::add_app($app);
318 318
 
319 319
 		// Execute import mail with provided content
320
-		ExecMethod($hook['menuaction'],array (
320
+		ExecMethod($hook['menuaction'], array(
321 321
 			'addresses' => $data_addresses,
322 322
 			'attachments' => $data_attachments,
323 323
 			'message' => $data_message,
Please login to merge, or discard this patch.
Braces   +16 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
  * to be used to integrate mail's message into other applications
19 19
  *
20 20
  */
21
-class mail_integration {
21
+class mail_integration
22
+{
22 23
 
23 24
 	/**
24 25
 	 * Public functions
@@ -94,7 +95,10 @@  discard block
 block discarded – undo
94 95
 			if (!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')&&is_array($_attachments))
95 96
 			{
96 97
 				// initialize mail open connection requirements
97
-				if (!isset($_icServerID)) $_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
98
+				if (!isset($_icServerID))
99
+				{
100
+					$_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
101
+				}
98 102
 				$mo = mail_bo::getInstance(true,$_icServerID);
99 103
 				$mo->openConnection();
100 104
 				$messagePartId = $messageFolder = null;
@@ -225,14 +229,20 @@  discard block
 block discarded – undo
225 229
 			$hA = mail_ui::splitRowID($_GET['rowid']);
226 230
 			$sessionLocation = $hA['app']; // THIS is part of the row ID, we may use this for validation
227 231
 			// Check the mail app
228
-			if ($sessionLocation != 'mail') throw new Api\Exception\AssertionFailed(lang('Application mail expected but got: %1',$sessionLocation));
232
+			if ($sessionLocation != 'mail')
233
+			{
234
+				throw new Api\Exception\AssertionFailed(lang('Application mail expected but got: %1',$sessionLocation));
235
+			}
229 236
 			$uid = $hA['msgUID'];
230 237
 			$mailbox = $hA['folder'];
231 238
 			$icServerID = $hA['profileID'];
232 239
 
233 240
 			if ($uid && $mailbox)
234 241
 			{
235
-				if (!isset($icServerID)) $icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
242
+				if (!isset($icServerID))
243
+				{
244
+					$icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
245
+				}
236 246
 				$mo	= mail_bo::getInstance(true,$icServerID);
237 247
 				$mo->openConnection();
238 248
 				$mo->reopen($mailbox);
@@ -276,7 +286,8 @@  discard block
 block discarded – undo
276 286
 		// shorten long (> self::max_line_chars) lines of "line" chars (-_+=~) in mails
277 287
 		$data_message = preg_replace_callback(
278 288
 			'/[-_+=~\.]{'.self::MAX_LINE_CHARS.',}/m',
279
-			function($matches) {
289
+			function($matches)
290
+			{
280 291
 				return substr($matches[0],0,self::MAX_LINE_CHARS);
281 292
 			},
282 293
 			$mailcontent['message']
Please login to merge, or discard this patch.
mail/inc/class.mail_hooks.inc.php 4 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
 	}
70 70
 
71 71
 	/**
72
-     * Hook called by link-class to include mail in the appregistry of the linkage
73
-     *
74
-     * @param array|string $location location and other parameters (not used)
75
-     * @return array with method-names
76
-     */
77
-    static function search_link($location)
78
-    {
72
+	 * Hook called by link-class to include mail in the appregistry of the linkage
73
+	 *
74
+	 * @param array|string $location location and other parameters (not used)
75
+	 * @return array with method-names
76
+	 */
77
+	static function search_link($location)
78
+	{
79 79
 		unset($location);	// not used, but required by function signature
80 80
 
81
-        return array(
81
+		return array(
82 82
 			'view'  => array(
83 83
 				'menuaction' => 'mail.mail_ui.displayMessage',
84 84
 			),
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 			),
108 108
 			'entry' => 'Mail',
109 109
 			'entries' => 'Mails',
110
-        );
111
-    }
110
+		);
111
+	}
112 112
 
113 113
 	/**
114 114
 	 * Settings hook
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 			if (true /* ToDo check ACL available */ || $account['acc_imap_type'] == 'managementserver_imap')
38 38
 			{
39
-				$actions[] = array (
39
+				$actions[] = array(
40 40
 					'id' => 'mail_acl',
41 41
 					'caption' => 'Folder ACL',
42 42
 					'icon' => 'lock',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			}
52 52
 			if ($account['acc_sieve_enabled'] || $account['acc_imap_type'] == 'managementserver_imap')
53 53
 			{
54
-				$actions[] = array (
54
+				$actions[] = array(
55 55
 					'id' => 'mail_vacation',
56 56
 					'caption' => 'Vacation notice',
57 57
 					'icon' => 'mail/navbar',
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     static function search_link($location)
78 78
     {
79
-		unset($location);	// not used, but required by function signature
79
+		unset($location); // not used, but required by function signature
80 80
 
81 81
         return array(
82 82
 			'view'  => array(
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			'0' => lang('no'),
132 132
 			'1' => lang('yes')
133 133
 		);
134
-		$no_yes_copy = array_merge($no_yes,array('2'=>lang('yes, offer copy option')));
134
+		$no_yes_copy = array_merge($no_yes, array('2'=>lang('yes, offer copy option')));
135 135
 
136 136
 		$forwardOptions = array(
137 137
 			'asmail' => lang('forward as attachment'),
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		);
140 140
 		$trustServersUnseenOptions = array_merge(
141 141
 			$no_yes,
142
-			array('2' => lang('yes') . ' - ' . lang('but check shared folders'))
142
+			array('2' => lang('yes').' - '.lang('but check shared folders'))
143 143
 		);
144 144
 
145 145
 		$deleteOptions = array(
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	static function admin($hook_data)
366 366
 	{
367
-		unset($hook_data);	// not used, but required by function signature
367
+		unset($hook_data); // not used, but required by function signature
368 368
 
369 369
 		unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
370 370
 		// Only Modify the $file and $title variables.....
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 			$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
375 375
 
376 376
 		$file = Array(
377
-			'Site Configuration' => Egw::link('/index.php',array('menuaction'=>'admin.uiconfig.index','appname'=>'mail')),
377
+			'Site Configuration' => Egw::link('/index.php', array('menuaction'=>'admin.uiconfig.index', 'appname'=>'mail')),
378 378
 		);
379
-		display_section($appname,$title,$file);
379
+		display_section($appname, $title, $file);
380 380
 	}
381 381
 
382 382
 	/**
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
 	 */
387 387
 	static function sidebox_menu($hook_data)
388 388
 	{
389
-		unset($hook_data);	// not used, but required by function signature
389
+		unset($hook_data); // not used, but required by function signature
390 390
 
391 391
 		//error_log(__METHOD__);
392 392
 		// always show the side bar
393 393
 		unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
394 394
 		$appname = 'mail';
395
-		$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
395
+		$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu');
396 396
 /*
397 397
 		$file = array();
398 398
 		$profileID = 0;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			}
428 428
 		}
429 429
 */
430
-		$file=array();
430
+		$file = array();
431 431
 		// Destination div for folder tree
432 432
 		$file[] = array(
433 433
 			'no_lang' => true,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		);
448 448
 
449 449
 		$file += array(
450
-			'import message' => "javascript:egw_openWindowCentered2('".Egw::link('/index.php', $linkData,false)."','importMessageDialog',600,100,'no','$appname');",
450
+			'import message' => "javascript:egw_openWindowCentered2('".Egw::link('/index.php', $linkData, false)."','importMessageDialog',600,100,'no','$appname');",
451 451
 		);
452 452
 
453 453
 
@@ -455,20 +455,20 @@  discard block
 block discarded – undo
455 455
 		if (self::access('createaccount'))
456 456
 		{
457 457
 			$file += array(
458
-				'create new account' => "javascript:egw_openWindowCentered2('" .
458
+				'create new account' => "javascript:egw_openWindowCentered2('".
459 459
 					Egw::link('/index.php', array('menuaction' => 'mail.mail_wizard.add'), '').
460 460
 					"','_blank',640,480,'yes')",
461 461
 			);
462 462
 		}
463 463
 		// display them all
464
-		display_sidebox($appname,$menu_title,$file);
464
+		display_sidebox($appname, $menu_title, $file);
465 465
 
466 466
 		if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
467 467
 		{
468 468
 			$file = Array(
469
-				'Site Configuration' => Egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
469
+				'Site Configuration' => Egw::link('/index.php', 'menuaction=admin.uiconfig.index&appname='.$appname),
470 470
 			);
471
-			display_sidebox($appname,lang('Admin'),$file);
471
+			display_sidebox($appname, lang('Admin'), $file);
472 472
 		}
473 473
 		Api\Hooks::pgp_encryption_menu('mail');
474 474
 
@@ -482,31 +482,31 @@  discard block
 block discarded – undo
482 482
 	static function notification_check_mailbox()
483 483
 	{
484 484
 		// should not run more often then every 3 minutes;
485
-		$lastRun = Api\Cache::getCache(Api\Cache::INSTANCE,'email','mailNotifyLastRun'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*24*2);
485
+		$lastRun = Api\Cache::getCache(Api\Cache::INSTANCE, 'email', 'mailNotifyLastRun'.trim($GLOBALS['egw_info']['user']['account_id']), null, array(), $expiration = 60 * 60 * 24 * 2);
486 486
 		$currentTime = time();
487
-		if (!empty($lastRun) && $lastRun>$currentTime-3*60)
487
+		if (!empty($lastRun) && $lastRun > $currentTime - 3 * 60)
488 488
 		{
489 489
 			//error_log(__METHOD__.__LINE__." Job should not run too often; we limit this to once every 3 Minutes :". ($currentTime-$lastRun). " Seconds to go!");
490 490
 			return true;
491 491
 		}
492 492
 		$accountsToSearchObj = Mail\Account::search(true, true);
493 493
 
494
-		foreach($accountsToSearchObj as $acc_id => $identity_name)
494
+		foreach ($accountsToSearchObj as $acc_id => $identity_name)
495 495
 		{
496 496
 			//error_log(__METHOD__.__LINE__.' '.$acc_id.':'.$identity_name);
497
-				$folders2notify[$acc_id] = Mail\Notifications::read($acc_id);// read all, even those set for acc_id 0 (folders for all acounts?)
498
-			$accountsToSearchArray[$acc_id] = str_replace(array('<','>'),array('[',']'),$identity_name);
497
+				$folders2notify[$acc_id] = Mail\Notifications::read($acc_id); // read all, even those set for acc_id 0 (folders for all acounts?)
498
+			$accountsToSearchArray[$acc_id] = str_replace(array('<', '>'), array('[', ']'), $identity_name);
499 499
 		}
500
-		$notified_mail_uidsCache = Api\Cache::getCache(Api\Cache::INSTANCE,'email','notified_mail_uids'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*24*2);
500
+		$notified_mail_uidsCache = Api\Cache::getCache(Api\Cache::INSTANCE, 'email', 'notified_mail_uids'.trim($GLOBALS['egw_info']['user']['account_id']), null, array(), $expiration = 60 * 60 * 24 * 2);
501 501
 		//error_log(__METHOD__.__LINE__.array2string($notified_mail_uidsCache));
502 502
 		if (!is_array($folders2notify)) return true;
503 503
 		foreach ($folders2notify as $nFKey =>$notifyfolders)
504 504
 		{
505 505
 			try
506 506
 			{
507
-				$currentRecipient = (object)$GLOBALS['egw']->accounts->read(($notifyfolders['notify_account_id']?$notifyfolders['notify_account_id']:$GLOBALS['egw_info']['user']['account_id']));
507
+				$currentRecipient = (object)$GLOBALS['egw']->accounts->read(($notifyfolders['notify_account_id'] ? $notifyfolders['notify_account_id'] : $GLOBALS['egw_info']['user']['account_id']));
508 508
 				$notify_folders = $notifyfolders['notify_folders'];
509
-				if(count($notify_folders) == 0) {
509
+				if (count($notify_folders) == 0) {
510 510
 					continue; //no folders configured for notifying
511 511
 				}
512 512
 				//error_log(__METHOD__.__LINE__.' '.$nFKey.' =>'.array2string($notifyfolders));
@@ -514,14 +514,14 @@  discard block
 block discarded – undo
514 514
 				//error_log(__METHOD__.__LINE__.' (user: '.$currentRecipient->account_lid.') Active Profile:'.$activeProfile);
515 515
 				try
516 516
 				{
517
-					$bomail = Mail::getInstance(false, $activeProfile,false);
517
+					$bomail = Mail::getInstance(false, $activeProfile, false);
518 518
 				} catch (Exception $e)
519 519
 				{
520 520
 					error_log(__METHOD__.__LINE__.' (user: '.$currentRecipient->account_lid.') notification for Profile:'.$activeProfile.' failed.'.$e->getMessage());
521 521
 					continue; //fail silently
522 522
 				}
523 523
 				//error_log(__METHOD__.__LINE__.' '.$nFKey.' =>'.array2string($bomail->icServer->params));
524
-				$icServerParams=$bomail->icServer->params;
524
+				$icServerParams = $bomail->icServer->params;
525 525
 				if (empty($icServerParams['acc_imap_host']))
526 526
 				{
527 527
 					error_log(__METHOD__.__LINE__.' (user: '.$currentRecipient->account_lid.') notification for Profile:'.$activeProfile.' failed: NO IMAP HOST configured!');
@@ -542,41 +542,41 @@  discard block
 block discarded – undo
542 542
 				//$notified_mail_uidsCache = array();
543 543
 				$recent_messages = array();
544 544
 				$folder_status = array();
545
-				foreach($notify_folders as $id=>$notify_folder) {
545
+				foreach ($notify_folders as $id=>$notify_folder) {
546 546
 					if (empty($notify_folder)) continue;
547
-					if(!is_array($notified_mail_uidsCache[$activeProfile][$notify_folder])) {
547
+					if (!is_array($notified_mail_uidsCache[$activeProfile][$notify_folder])) {
548 548
 						$notified_mail_uidsCache[$activeProfile][$notify_folder] = array();
549 549
 					}
550 550
 					$folder_status[$notify_folder] = $bomail->getFolderStatus($notify_folder);
551
-					$cutoffdate = time() - (60*60*24*14); // last 14 days
552
-					$_filter = array('status'=>array('UNSEEN','UNDELETED'),'type'=>"SINCE",'string'=> date("d-M-Y", $cutoffdate));
551
+					$cutoffdate = time() - (60 * 60 * 24 * 14); // last 14 days
552
+					$_filter = array('status'=>array('UNSEEN', 'UNDELETED'), 'type'=>"SINCE", 'string'=> date("d-M-Y", $cutoffdate));
553 553
 					//error_log(__METHOD__.__LINE__.' (user: '.$currentRecipient->account_lid.') Mailbox:'.$notify_folder.' filter:'.array2string($_filter));
554 554
 					// $_folderName, $_startMessage, $_numberOfMessages, $_sort, $_reverse, $_filter, $_thisUIDOnly=null, $_cacheResult=true
555
-					$headers = $bomail->getHeaders($notify_folder, 1, 999, 0, true, $_filter,null,false);
556
-					if(is_array($headers['header']) && count($headers['header']) > 0) {
557
-						foreach($headers['header'] as $id=>$header) {
555
+					$headers = $bomail->getHeaders($notify_folder, 1, 999, 0, true, $_filter, null, false);
556
+					if (is_array($headers['header']) && count($headers['header']) > 0) {
557
+						foreach ($headers['header'] as $id=>$header) {
558 558
 							//error_log(__METHOD__.__LINE__.' Found Message:'.$header['uid'].' Subject:'.$header['subject']);
559 559
 							// check if unseen mail has already been notified
560
-							$headerrowid = mail_ui::generateRowID($activeProfile, $notify_folder, $header['uid'], $_prependApp=false);
561
-						 	if(!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder])) {
560
+							$headerrowid = mail_ui::generateRowID($activeProfile, $notify_folder, $header['uid'], $_prependApp = false);
561
+						 	if (!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder])) {
562 562
 						 		// got a REAL recent message
563 563
 						 		$header['folder'] = $notify_folder;
564 564
 						 		$header['folder_display_name'] = $folder_status[$notify_folder]['displayName'];
565
-						 		$header['folder_base64'] =  base64_encode($notify_folder);
565
+						 		$header['folder_base64'] = base64_encode($notify_folder);
566 566
 						 		$recent_messages[] = $header;
567 567
 						 	}
568 568
 						}
569 569
 					}
570 570
 				}
571 571
 				//error_log(__METHOD__.__LINE__.' Found Messages for Profile'.$activeProfile.':'.array2string($recent_messages).'<->'.array2string($notified_mail_uidsCache[$activeProfile]));
572
-				if(count($recent_messages) > 0) {
572
+				if (count($recent_messages) > 0) {
573 573
 					// create notify message
574 574
 					$notification_subject = lang("You've got new mail").':'.$accountsToSearchArray[$activeProfile];
575 575
 					$values = array();
576 576
 					$values[] = array(); // content array starts at index 1
577
-					foreach($recent_messages as $id=>$recent_message) {
577
+					foreach ($recent_messages as $id=>$recent_message) {
578 578
 						//error_log(__METHOD__.__LINE__.' Found Message for Profile '.$activeProfile.':'.array2string($recent_message));
579
-						$values[] =	array(
579
+						$values[] = array(
580 580
 							'mail_uid'				=> $recent_message['uid'],
581 581
 							'mail_folder' 			=> $recent_message['folder_display_name'],
582 582
 							'mail_folder_base64' 	=> $recent_message['folder_base64'],
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 							'mail_received'			=> $recent_message['date'],
586 586
 						);
587 587
 						// save notification status
588
-						$notified_mail_uidsCache[$activeProfile][$recent_message['folder']][] = mail_ui::generateRowID($activeProfile, $recent_message['folder'], $recent_message['uid'], $_prependApp=false);
588
+						$notified_mail_uidsCache[$activeProfile][$recent_message['folder']][] = mail_ui::generateRowID($activeProfile, $recent_message['folder'], $recent_message['uid'], $_prependApp = false);
589 589
 					}
590 590
 					// create etemplate
591 591
 					$tpl = new etemplate('mail.checkmailbox');
@@ -601,13 +601,13 @@  discard block
 block discarded – undo
601 601
 					$notification->set_skip_backends(array('email'));
602 602
 					$notification->send();
603 603
 				}
604
-				Api\Cache::setCache(Api\Cache::INSTANCE,'email','notified_mail_uids'.trim($GLOBALS['egw_info']['user']['account_id']),$notified_mail_uidsCache, $expiration=60*60*24*2);
604
+				Api\Cache::setCache(Api\Cache::INSTANCE, 'email', 'notified_mail_uids'.trim($GLOBALS['egw_info']['user']['account_id']), $notified_mail_uidsCache, $expiration = 60 * 60 * 24 * 2);
605 605
 			} catch (Exception $e) {
606 606
 				// fail silently per server, if possible
607 607
 				error_log(__METHOD__.__LINE__.' Notification on new messages for Profile '.$activeProfile.' ('.$accountsToSearchArray[$activeProfile].') failed:'.$e->getMessage());
608 608
 			}
609 609
 		}
610
-		Api\Cache::setCache(Api\Cache::INSTANCE,'email','mailNotifyLastRun'.trim($GLOBALS['egw_info']['user']['account_id']),time(), $expiration=60*60*24*2);
610
+		Api\Cache::setCache(Api\Cache::INSTANCE, 'email', 'mailNotifyLastRun'.trim($GLOBALS['egw_info']['user']['account_id']), time(), $expiration = 60 * 60 * 24 * 2);
611 611
 		//error_log(__METHOD__.__LINE__.array2string($notified_mail_uidsCache));
612 612
 		return true;
613 613
 	}
@@ -623,21 +623,21 @@  discard block
 block discarded – undo
623 623
 	 */
624 624
 	public static function access($feature)
625 625
 	{
626
-		static $config=null;
626
+		static $config = null;
627 627
 		if ($GLOBALS['egw_info']['user']['apps']['admin'] || $GLOBALS['egw_info']['user']['apps']['emailadmin'])
628 628
 		{
629
-			return true;	// allways give admins or emailadmins all rights, even if they are in a denied group
629
+			return true; // allways give admins or emailadmins all rights, even if they are in a denied group
630 630
 		}
631 631
 		if (!isset($config)) $config = (array)Api\Config::read('mail');
632 632
 		//error_log(__METHOD__.__LINE__.' '.$feature.':'.array2string($config['deny_'.$feature]));
633 633
 		if (!empty($config['deny_'.$feature]))
634 634
 		{
635 635
 			//error_log(__METHOD__.__LINE__.' feature:'.$feature.':'.array2string($config['deny_'.$feature]));
636
-			$denied_groups = (is_array($config['deny_'.$feature])?$config['deny_'.$feature]:explode(',', $config['deny_'.$feature]));
636
+			$denied_groups = (is_array($config['deny_'.$feature]) ? $config['deny_'.$feature] : explode(',', $config['deny_'.$feature]));
637 637
 			//error_log(__METHOD__.__LINE__.array2string($GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true)));
638 638
 			//error_log(__METHOD__.__LINE__.array2string(array_intersect($denied_groups, $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true))));
639 639
 			// since access asks positively, the stored deny_$feature must return false if we find the denied group in the users membership-list
640
-			return (array_intersect($denied_groups, $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true))?false:true);
640
+			return (array_intersect($denied_groups, $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true)) ? false : true);
641 641
 		}
642 642
 		return true;
643 643
 	}
Please login to merge, or discard this patch.
Braces   +56 added lines, -20 removed lines patch added patch discarded remove patch
@@ -118,13 +118,18 @@  discard block
 block discarded – undo
118 118
 	static function settings($hook_data)
119 119
 	{
120 120
 		unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
121
-		if (!$hook_data['setup'])	// does not work on setup time
121
+		if (!$hook_data['setup'])
122
+		{
123
+			// does not work on setup time
122 124
 		{
123 125
 			$folderList = array();
126
+		}
124 127
 
125 128
 			$profileID = 0;
126 129
 			if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
127
-				$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
130
+			{
131
+							$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
132
+			}
128 133
 		}
129 134
 
130 135
 		$no_yes = array(
@@ -176,7 +181,10 @@  discard block
 block discarded – undo
176 181
 		);
177 182
 
178 183
 		// otherwise we get warnings during setup
179
-		if (!is_array($folderList)) $folderList = array();
184
+		if (!is_array($folderList))
185
+		{
186
+			$folderList = array();
187
+		}
180 188
 
181 189
 		// modify folderlist, add a none entry, to be able to force the regarding settings, if no folders apply
182 190
 		$folderList['none'] = lang('no folders');
@@ -353,7 +361,10 @@  discard block
 block discarded – undo
353 361
 				'default' => '0'
354 362
 			),
355 363
 		);
356
-		if (!$GLOBALS['egw_info']['apps']['stylite']) unset($settingsArray['attachVCardAtCompose']);
364
+		if (!$GLOBALS['egw_info']['apps']['stylite'])
365
+		{
366
+			unset($settingsArray['attachVCardAtCompose']);
367
+		}
357 368
 		return $settingsArray;
358 369
 	}
359 370
 
@@ -371,7 +382,9 @@  discard block
 block discarded – undo
371 382
 		$title = $appname = 'mail';
372 383
 		$profileID = 0;
373 384
 		if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
374
-			$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
385
+		{
386
+					$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
387
+		}
375 388
 
376 389
 		$file = Array(
377 390
 			'Site Configuration' => Egw::link('/index.php',array('menuaction'=>'admin.uiconfig.index','appname'=>'mail')),
@@ -499,14 +512,18 @@  discard block
 block discarded – undo
499 512
 		}
500 513
 		$notified_mail_uidsCache = Api\Cache::getCache(Api\Cache::INSTANCE,'email','notified_mail_uids'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*24*2);
501 514
 		//error_log(__METHOD__.__LINE__.array2string($notified_mail_uidsCache));
502
-		if (!is_array($folders2notify)) return true;
515
+		if (!is_array($folders2notify))
516
+		{
517
+			return true;
518
+		}
503 519
 		foreach ($folders2notify as $nFKey =>$notifyfolders)
504 520
 		{
505 521
 			try
506 522
 			{
507 523
 				$currentRecipient = (object)$GLOBALS['egw']->accounts->read(($notifyfolders['notify_account_id']?$notifyfolders['notify_account_id']:$GLOBALS['egw_info']['user']['account_id']));
508 524
 				$notify_folders = $notifyfolders['notify_folders'];
509
-				if(count($notify_folders) == 0) {
525
+				if(count($notify_folders) == 0)
526
+				{
510 527
 					continue; //no folders configured for notifying
511 528
 				}
512 529
 				//error_log(__METHOD__.__LINE__.' '.$nFKey.' =>'.array2string($notifyfolders));
@@ -515,7 +532,8 @@  discard block
 block discarded – undo
515 532
 				try
516 533
 				{
517 534
 					$bomail = Mail::getInstance(false, $activeProfile,false);
518
-				} catch (Exception $e)
535
+				}
536
+				catch (Exception $e)
519 537
 				{
520 538
 					error_log(__METHOD__.__LINE__.' (user: '.$currentRecipient->account_lid.') notification for Profile:'.$activeProfile.' failed.'.$e->getMessage());
521 539
 					continue; //fail silently
@@ -530,11 +548,15 @@  discard block
 block discarded – undo
530 548
 				try
531 549
 				{
532 550
 					$bomail->openConnection($activeProfile);
533
-				} catch (Exception $e) {
551
+				}
552
+				catch (Exception $e) {
534 553
 					// TODO: This is ugly. Log a bit nicer!
535 554
 					$error = $e->getMessage();
536 555
 					error_log(__METHOD__.__LINE__.' # '.' (user: '.$currentRecipient->account_lid.'): cannot connect to mailbox with Profile:'.$activeProfile.'. Please check your prefs!');
537
-					if (!empty($error)) error_log(__METHOD__.__LINE__.' # '.$error);
556
+					if (!empty($error))
557
+					{
558
+						error_log(__METHOD__.__LINE__.' # '.$error);
559
+					}
538 560
 					error_log(__METHOD__.__LINE__.' # Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid']);
539 561
 					return false; // cannot connect to mailbox
540 562
 				}
@@ -542,9 +564,14 @@  discard block
 block discarded – undo
542 564
 				//$notified_mail_uidsCache = array();
543 565
 				$recent_messages = array();
544 566
 				$folder_status = array();
545
-				foreach($notify_folders as $id=>$notify_folder) {
546
-					if (empty($notify_folder)) continue;
547
-					if(!is_array($notified_mail_uidsCache[$activeProfile][$notify_folder])) {
567
+				foreach($notify_folders as $id=>$notify_folder)
568
+				{
569
+					if (empty($notify_folder))
570
+					{
571
+						continue;
572
+					}
573
+					if(!is_array($notified_mail_uidsCache[$activeProfile][$notify_folder]))
574
+					{
548 575
 						$notified_mail_uidsCache[$activeProfile][$notify_folder] = array();
549 576
 					}
550 577
 					$folder_status[$notify_folder] = $bomail->getFolderStatus($notify_folder);
@@ -553,12 +580,15 @@  discard block
 block discarded – undo
553 580
 					//error_log(__METHOD__.__LINE__.' (user: '.$currentRecipient->account_lid.') Mailbox:'.$notify_folder.' filter:'.array2string($_filter));
554 581
 					// $_folderName, $_startMessage, $_numberOfMessages, $_sort, $_reverse, $_filter, $_thisUIDOnly=null, $_cacheResult=true
555 582
 					$headers = $bomail->getHeaders($notify_folder, 1, 999, 0, true, $_filter,null,false);
556
-					if(is_array($headers['header']) && count($headers['header']) > 0) {
557
-						foreach($headers['header'] as $id=>$header) {
583
+					if(is_array($headers['header']) && count($headers['header']) > 0)
584
+					{
585
+						foreach($headers['header'] as $id=>$header)
586
+						{
558 587
 							//error_log(__METHOD__.__LINE__.' Found Message:'.$header['uid'].' Subject:'.$header['subject']);
559 588
 							// check if unseen mail has already been notified
560 589
 							$headerrowid = mail_ui::generateRowID($activeProfile, $notify_folder, $header['uid'], $_prependApp=false);
561
-						 	if(!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder])) {
590
+						 	if(!in_array($headerrowid, $notified_mail_uidsCache[$activeProfile][$notify_folder]))
591
+						 	{
562 592
 						 		// got a REAL recent message
563 593
 						 		$header['folder'] = $notify_folder;
564 594
 						 		$header['folder_display_name'] = $folder_status[$notify_folder]['displayName'];
@@ -569,12 +599,14 @@  discard block
 block discarded – undo
569 599
 					}
570 600
 				}
571 601
 				//error_log(__METHOD__.__LINE__.' Found Messages for Profile'.$activeProfile.':'.array2string($recent_messages).'<->'.array2string($notified_mail_uidsCache[$activeProfile]));
572
-				if(count($recent_messages) > 0) {
602
+				if(count($recent_messages) > 0)
603
+				{
573 604
 					// create notify message
574 605
 					$notification_subject = lang("You've got new mail").':'.$accountsToSearchArray[$activeProfile];
575 606
 					$values = array();
576 607
 					$values[] = array(); // content array starts at index 1
577
-					foreach($recent_messages as $id=>$recent_message) {
608
+					foreach($recent_messages as $id=>$recent_message)
609
+					{
578 610
 						//error_log(__METHOD__.__LINE__.' Found Message for Profile '.$activeProfile.':'.array2string($recent_message));
579 611
 						$values[] =	array(
580 612
 							'mail_uid'				=> $recent_message['uid'],
@@ -602,7 +634,8 @@  discard block
 block discarded – undo
602 634
 					$notification->send();
603 635
 				}
604 636
 				Api\Cache::setCache(Api\Cache::INSTANCE,'email','notified_mail_uids'.trim($GLOBALS['egw_info']['user']['account_id']),$notified_mail_uidsCache, $expiration=60*60*24*2);
605
-			} catch (Exception $e) {
637
+			}
638
+			catch (Exception $e) {
606 639
 				// fail silently per server, if possible
607 640
 				error_log(__METHOD__.__LINE__.' Notification on new messages for Profile '.$activeProfile.' ('.$accountsToSearchArray[$activeProfile].') failed:'.$e->getMessage());
608 641
 			}
@@ -628,7 +661,10 @@  discard block
 block discarded – undo
628 661
 		{
629 662
 			return true;	// allways give admins or emailadmins all rights, even if they are in a denied group
630 663
 		}
631
-		if (!isset($config)) $config = (array)Api\Config::read('mail');
664
+		if (!isset($config))
665
+		{
666
+			$config = (array)Api\Config::read('mail');
667
+		}
632 668
 		//error_log(__METHOD__.__LINE__.' '.$feature.':'.array2string($config['deny_'.$feature]));
633 669
 		if (!empty($config['deny_'.$feature]))
634 670
 		{
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
374 374
 			$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
375 375
 
376
-		$file = Array(
376
+		$file = array(
377 377
 			'Site Configuration' => Egw::link('/index.php',array('menuaction'=>'admin.uiconfig.index','appname'=>'mail')),
378 378
 		);
379 379
 		display_section($appname,$title,$file);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
 		if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
467 467
 		{
468
-			$file = Array(
468
+			$file = array(
469 469
 				'Site Configuration' => Egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
470 470
 			);
471 471
 			display_sidebox($appname,lang('Admin'),$file);
Please login to merge, or discard this patch.
mail/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,4 +11,4 @@
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 header('Location: ../index.php?menuaction=mail.mail_ui.index'.
14
-    	(isset($_GET['sessionid']) ? '&sessionid='.$_GET['sessionid'].'&kp3='.$_GET['kp3'] : ''));
14
+		(isset($_GET['sessionid']) ? '&sessionid='.$_GET['sessionid'].'&kp3='.$_GET['kp3'] : ''));
Please login to merge, or discard this patch.
pixelegg/stylesheet2svg.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 }
33 33
 if ($args[0] == '-c')
34 34
 {
35
-	$color = explode(',',$args[1]);
35
+	$color = explode(',', $args[1]);
36 36
 	array_shift($args);
37 37
 	array_shift($args);
38 38
 }
39
-foreach($args as $path)
39
+foreach ($args as $path)
40 40
 {
41 41
 	if (!preg_match('|^([^/]+)/.*/(.*).svg$|', $path, $matches) || !($svg = file_get_contents($path)))
42 42
 	{
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	$svg = preg_replace('/(<svg.*) id="[^"]+"/', '\\1 id="'.$id.'"', $svg);
54 54
 	
55 55
 	// Replace fill color with color[0]
56
-	$svg = preg_replace('/(<.*) fill="[^"]*"/','\\1 fill="'.$color[0] .'"', $svg);
56
+	$svg = preg_replace('/(<.*) fill="[^"]*"/', '\\1 fill="'.$color[0].'"', $svg);
57 57
 	// Replace stroke color with color[1]
58
-	$svg = preg_replace('/(<.*) stroke="[^"]*"/', '\\1 stroke="'.$color[1] .'"', $svg);
58
+	$svg = preg_replace('/(<.*) stroke="[^"]*"/', '\\1 stroke="'.$color[1].'"', $svg);
59 59
 	
60
-	error_log(__METHOD__."svg: ". var_dump($svg));
60
+	error_log(__METHOD__."svg: ".var_dump($svg));
61 61
 	// store image again
62 62
 	file_put_contents($path, $svg);
63 63
 	echo "$path: added $style_url and id=\"$id\"\n";
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	array_pop($i_parts);
70 70
 	$rel_parts = $s_parts = explode('/', $stylesheet);
71 71
 
72
-	foreach($i_parts as $n => $i_part)
72
+	foreach ($i_parts as $n => $i_part)
73 73
 	{
74 74
 		if (isset($s_parts[$n]) && $s_parts[$n] === $i_part)
75 75
 		{
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,18 +10,24 @@
 block discarded – undo
10 10
  * @version $Id$
11 11
  */
12 12
 
13
-if (php_sapi_name() !== 'cli') die("This is a commandline ONLY tool!\n");
13
+if (php_sapi_name() !== 'cli')
14
+{
15
+	die("This is a commandline ONLY tool!\n");
16
+}
14 17
 
15 18
 $args = $_SERVER['argv'];
16 19
 $prog = array_shift($args);
17 20
 
18
-if ($_SERVER['argc'] <= 1 || $prog != 'pixelegg/stylesheet2svg.php') die("
21
+if ($_SERVER['argc'] <= 1 || $prog != 'pixelegg/stylesheet2svg.php')
22
+{
23
+	die("
19 24
 Usage: pixelegg/stylesheet2svg [-s stylesheet|-c color] svg-image(s)
20 25
 Add an external stylesheet to an svg image and sets id of svg tag to app_image
21 26
 Examples:
22 27
 - pixelegg/stylesheet2svg -s pixelegg/less/svg.css */templates/pixelegg/images/*.svg pixelegg/images/*.svg
23 28
 - pixelegg/stylesheet2svg -c '#6e6e6e,#939393' */templates/pixelegg/images/*.svg pixelegg/images/*.svg
24 29
 \n");
30
+}
25 31
 
26 32
 $stylesheet = 'pixelegg/less/svg.css';
27 33
 if ($args[0] == '-s')
Please login to merge, or discard this patch.
pixelegg/hook_settings.inc.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $apps = $no_navbar_apps = array();
16 16
 if (!$hook_data['setup'] && !isset($GLOBALS['egw_setup']))	// does not work on setup time
17 17
 {
18
-	foreach(ExecMethod('pixelegg.pixelegg_framework.navbar_apps') as $app => $data)
18
+	foreach (ExecMethod('pixelegg.pixelegg_framework.navbar_apps') as $app => $data)
19 19
 	{
20 20
 		if (!$data['noNavbar'])
21 21
 		{
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	'#b4b4b4' => lang('Gray'),
40 40
 );
41 41
 asort($colors);
42
-$colors['custom'] = lang('Custom color');	// custom allways last
42
+$colors['custom'] = lang('Custom color'); // custom allways last
43 43
 $template_colors = array();
44
-foreach($colors as $color => $label)
44
+foreach ($colors as $color => $label)
45 45
 {
46 46
 	$template_colors[$color] = $label.' ('.$color.') '.lang('Sidebox, header, and logo');
47 47
 }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 $GLOBALS['settings'] = array(
52 52
 	'prefssection' => array(
53 53
 		'type'   => 'section',
54
-		'title'  => lang('Preferences for the %1 template set','Pixelegg'),
54
+		'title'  => lang('Preferences for the %1 template set', 'Pixelegg'),
55 55
 		'no_lang'=> true,
56 56
 		'xmlrpc' => False,
57 57
 		'admin'  => False,
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		'label' => 'Custom color',
101 101
 		'no_lang' => true,
102 102
 		'name' => 'template_custom_color',
103
-		'help' => lang('Use eg. %1 or %2','#FF0000','orange'),
103
+		'help' => lang('Use eg. %1 or %2', '#FF0000', 'orange'),
104 104
 		'xmlrpc' => True,
105 105
 		'admin'  => False,
106 106
 	),
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		'label' => 'Custom sidebar menu active color, defaults to above color darkened',
110 110
 		'no_lang' => true,
111 111
 		'name' => 'sidebox_custom_color',
112
-		'help' => lang('Use eg. %1 or %2','#FF0000','orange'),
112
+		'help' => lang('Use eg. %1 or %2', '#FF0000', 'orange'),
113 113
 		'xmlrpc' => True,
114 114
 		'admin'  => False,
115 115
 	),
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 		'label' => 'Custom login box color, defaults to above color darkened',
119 119
 		'no_lang' => true,
120 120
 		'name' => 'loginbox_custom_color',
121
-		'help' => lang('Use eg. %1 or %2','#FF0000','orange'),
121
+		'help' => lang('Use eg. %1 or %2', '#FF0000', 'orange'),
122 122
 		'xmlrpc' => True,
123 123
 		'admin'  => False,
124 124
 	),
125
-	'navbar_format' => false,	// not used in JDots (defined in common prefs)
126
-	'default_app' => false,		// not used in JDots, as we can have multiple tabs open ...
125
+	'navbar_format' => false, // not used in JDots (defined in common prefs)
126
+	'default_app' => false, // not used in JDots, as we can have multiple tabs open ...
127 127
 );
128 128
 unset($apps);
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,13 +13,16 @@
 block discarded – undo
13 13
  * @todo extend Stylite template preferences instead of this copy (simple include fails)
14 14
  */
15 15
 $apps = $no_navbar_apps = array();
16
-if (!$hook_data['setup'] && !isset($GLOBALS['egw_setup']))	// does not work on setup time
16
+if (!$hook_data['setup'] && !isset($GLOBALS['egw_setup']))
17
+{
18
+	// does not work on setup time
17 19
 {
18 20
 	foreach(ExecMethod('pixelegg.pixelegg_framework.navbar_apps') as $app => $data)
19 21
 	{
20 22
 		if (!$data['noNavbar'])
21 23
 		{
22 24
 			$apps[$app] = $data['title'];
25
+}
23 26
 		}
24 27
 		else
25 28
 		{
Please login to merge, or discard this patch.
resources/sitemgr/class.module_resources_reservation.inc.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,13 +98,13 @@
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	/**
101
-	* generate the module content AND process submitted forms
102
-	* Overridden from parent to pass arguments
103
-	*
104
-	* @param array &$arguments $arguments['arg1']-$arguments['arg3'] will be passed for non-submitted forms (first call)
105
-	* @param array $properties
106
-	* @return string the Api\Html content
107
-	*/
101
+	 * generate the module content AND process submitted forms
102
+	 * Overridden from parent to pass arguments
103
+	 *
104
+	 * @param array &$arguments $arguments['arg1']-$arguments['arg3'] will be passed for non-submitted forms (first call)
105
+	 * @param array $properties
106
+	 * @return string the Api\Html content
107
+	 */
108 108
 	function get_content(&$arguments,$properties)
109 109
 	{
110 110
 		list($app) = explode('.',$this->etemplate_method);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		$categories = new Api\Categories('', 'resources');
27 27
 		$cat_list = $categories->return_sorted_array();
28 28
 		$cat_options = array();
29
-		foreach($cat_list as $category)
29
+		foreach ($cat_list as $category)
30 30
 		{
31 31
 			$cat_options[$category['id']] = $category['name'];
32 32
 		}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'email_message' => array(
55 55
 				'type' => 'textarea',
56 56
 				'large' => true,
57
-				'label' => lang('Confirmation email text').'<br />%1 = ' . lang('Event start').'<br/>%2 = link<br />%3 = '.lang('expiry'),
57
+				'label' => lang('Confirmation email text').'<br />%1 = '.lang('Event start').'<br/>%2 = link<br />%3 = '.lang('expiry'),
58 58
 				'params' => array(
59 59
 					'rows'	=> 8,
60 60
 					'cols'	=> 110
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				'label' => lang('Confirmed addressbook.').' ('.lang('The anonymous user needs add rights for it!').')',
66 66
 				'options' => array(
67 67
 					'' => lang('None'),
68
-				)+registration_bo::get_allowed_addressbooks(registration_bo::CONFIRMED)
68
+				) + registration_bo::get_allowed_addressbooks(registration_bo::CONFIRMED)
69 69
 			),
70 70
 			'include_group' => array(
71 71
 				'type' => 'select',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		// Add resources from selected category
91 91
 		$bo = new resources_bo();
92 92
 		$bo->get_rows($query, $list, $readonlys);
93
-		foreach($list as $resource)
93
+		foreach ($list as $resource)
94 94
 		{
95 95
 			$this->arguments['resource']['options'][$resource['res_id']] = $resource['name'];
96 96
 		}
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	* @param array $properties
106 106
 	* @return string the Api\Html content
107 107
 	*/
108
-	function get_content(&$arguments,$properties)
108
+	function get_content(&$arguments, $properties)
109 109
 	{
110
-		list($app) = explode('.',$this->etemplate_method);
110
+		list($app) = explode('.', $this->etemplate_method);
111 111
 		Api\Translation::add_app($app);
112 112
 
113 113
 		$extra = "<style type=\"text/css\">\n<!--\n@import url(".$GLOBALS['egw_info']['server']['webserver_url'].
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 		$extra .= "-->\n</style>\n";
123 123
 		$extra .= '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/js/etemplate.js" type="text/javascript"></script>'."\n";
124 124
 		$ret = false;
125
-		if($_POST['etemplate_exec_id'])
125
+		if ($_POST['etemplate_exec_id'])
126 126
 		{
127 127
 				$ret = ExecMethod('etemplate.etemplate.process_exec');
128 128
 		}
129
-		if($_GET['date']) $arguments['date'] = strtotime($_GET['date']);
129
+		if ($_GET['date']) $arguments['date'] = strtotime($_GET['date']);
130 130
 		$arguments['link'] = $this->link();
131 131
 		$arguments['sitemgr_version'] = $this->block->version;
132
-		return $extra.($ret ? $ret : ExecMethod2($this->etemplate_method,null,$arguments));
132
+		return $extra.($ret ? $ret : ExecMethod2($this->etemplate_method, null, $arguments));
133 133
 	}
134 134
 
135 135
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,10 @@
 block discarded – undo
126 126
 		{
127 127
 				$ret = ExecMethod('etemplate.etemplate.process_exec');
128 128
 		}
129
-		if($_GET['date']) $arguments['date'] = strtotime($_GET['date']);
129
+		if($_GET['date'])
130
+		{
131
+			$arguments['date'] = strtotime($_GET['date']);
132
+		}
130 133
 		$arguments['link'] = $this->link();
131 134
 		$arguments['sitemgr_version'] = $this->block->version;
132 135
 		return $extra.($ret ? $ret : ExecMethod2($this->etemplate_method,null,$arguments));
Please login to merge, or discard this patch.
resources/setup/setup.inc.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,32 +11,32 @@
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 
14
-$setup_info['resources']['name']	= 'resources';
15
-$setup_info['resources']['title']	= 'Resources';
16
-$setup_info['resources']['version']	= '16.1';
17
-$setup_info['resources']['app_order']	= 5;
18
-$setup_info['resources']['tables']	= array('egw_resources','egw_resources_extra');
14
+$setup_info['resources']['name'] = 'resources';
15
+$setup_info['resources']['title'] = 'Resources';
16
+$setup_info['resources']['version'] = '16.1';
17
+$setup_info['resources']['app_order'] = 5;
18
+$setup_info['resources']['tables']	= array('egw_resources', 'egw_resources_extra');
19 19
 $setup_info['resources']['enable']	= 1;
20
-$setup_info['resources']['index']	= 'resources.resources_ui.index&ajax=true' ;
20
+$setup_info['resources']['index'] = 'resources.resources_ui.index&ajax=true';
21 21
 
22 22
 $setup_info['resources']['author']	= 'Cornelius Weiss';
23
-$setup_info['resources']['license']	= 'GPL';
23
+$setup_info['resources']['license'] = 'GPL';
24 24
 $setup_info['resources']['description'] = 'A resource management and booking system, which integrates into eGroupWare\'s calendar.';
25
-$setup_info['resources']['note']	= '';
26
-$setup_info['resources']['maintainer']	= array(
25
+$setup_info['resources']['note'] = '';
26
+$setup_info['resources']['maintainer'] = array(
27 27
 	'name' => 'eGroupware coreteam',
28 28
 	'email' => '[email protected]'
29 29
 );
30 30
 
31
-$setup_info['resources']['hooks']['categories']	= 'resources_hooks::categories';
32
-$setup_info['resources']['hooks']['admin']		= 'resources.resources_hooks.admin_prefs_sidebox';
33
-$setup_info['resources']['hooks']['sidebox_menu']	= 'resources.resources_hooks.admin_prefs_sidebox';
34
-$setup_info['resources']['hooks']['search_link']	= 'resources.resources_hooks.search_link';
35
-$setup_info['resources']['hooks']['calendar_resources']	= 'resources.resources_hooks.calendar_resources';
36
-$setup_info['resources']['hooks']['delete_category']	= 'resources.resources_hooks.delete_category';
31
+$setup_info['resources']['hooks']['categories'] = 'resources_hooks::categories';
32
+$setup_info['resources']['hooks']['admin'] = 'resources.resources_hooks.admin_prefs_sidebox';
33
+$setup_info['resources']['hooks']['sidebox_menu'] = 'resources.resources_hooks.admin_prefs_sidebox';
34
+$setup_info['resources']['hooks']['search_link'] = 'resources.resources_hooks.search_link';
35
+$setup_info['resources']['hooks']['calendar_resources'] = 'resources.resources_hooks.calendar_resources';
36
+$setup_info['resources']['hooks']['delete_category'] = 'resources.resources_hooks.delete_category';
37 37
 $setup_info['resources']['hooks']['settings'] = 'resources_hooks::settings';
38 38
 
39
-$setup_info['resources']['depends'][]	= array(
39
+$setup_info['resources']['depends'][] = array(
40 40
 	 'appname' => 'api',
41 41
 	 'versions' => Array('16.1')
42 42
 );
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
 $setup_info['resources']['depends'][]	= array(
40 40
 	 'appname' => 'api',
41
-	 'versions' => Array('16.1')
41
+	 'versions' => array('16.1')
42 42
 );
43 43
 
44 44
 
Please login to merge, or discard this patch.