Completed
Push — 16.1 ( 2b6741...abc73d )
by Nathan
50:22 queued 36:36
created
api/src/Hooks.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 
65 65
 		if (!isset(self::$locations)) self::read();
66 66
 		$hooks = self::$locations[$location];
67
-		if (!isset($hooks) || empty($hooks)) return array();	// not a single app implements that hook
67
+		if (!isset($hooks) || empty($hooks)) return array(); // not a single app implements that hook
68 68
 
69 69
 		$apps = array_keys($hooks);
70 70
 		if (!$no_permission_check)
71 71
 		{
72 72
 			// on install of a new egroupware both hook-apps and user apps may be empty/not set
73
-			$apps = array_intersect((array)$apps,array_keys((array)$GLOBALS['egw_info']['user']['apps']));
73
+			$apps = array_intersect((array)$apps, array_keys((array)$GLOBALS['egw_info']['user']['apps']));
74 74
 		}
75 75
 		if ($order)
76 76
 		{
77
-			$apps = array_unique(array_merge((array)$order,$apps));
77
+			$apps = array_unique(array_merge((array)$order, $apps));
78 78
 		}
79 79
 		$results = array();
80
-		foreach((array)$apps as $appname)
80
+		foreach ((array)$apps as $appname)
81 81
 		{
82
-			$results[$appname] = self::single($args,$appname,$no_permission_check);
82
+			$results[$appname] = self::single($args, $appname, $no_permission_check);
83 83
 		}
84 84
 		return $results;
85 85
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 
117 117
 		$ret = array();
118
-		foreach((array)self::$locations[$location][$appname] as $hook)
118
+		foreach ((array)self::$locations[$location][$appname] as $hook)
119 119
 		{
120 120
 			try {
121 121
 				// old style file hook
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		}
150 150
 
151 151
 		// hooks only existing in filesystem used by setup
152
-		if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook='/'.$appname.'/inc/hook_'.$location.'.inc.php')))
152
+		if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook = '/'.$appname.'/inc/hook_'.$location.'.inc.php')))
153 153
 		{
154 154
 			include(EGW_SERVER_ROOT.$hook);
155 155
 			return true;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param boolean $return_methods =false true: return hook-method(s)
182 182
 	 * @return int|array the number of found hooks or for $return_methods array with methods
183 183
 	 */
184
-	public static function exists($location, $app, $return_methods=false)
184
+	public static function exists($location, $app, $return_methods = false)
185 185
 	{
186 186
 		if (!isset(self::$locations)) self::read();
187 187
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param boolan $force_rescan =false true: do not use instance cache
210 210
 	 */
211
-	public static function read($force_rescan=false)
211
+	public static function read($force_rescan = false)
212 212
 	{
213 213
 		//$starttime = microtime(true);
214 214
 		if ($force_rescan) Cache::unsetInstance(__CLASS__, 'locations');
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
 
225 225
 			// read all apps using just filesystem data
226 226
 			$locations = array();
227
-			foreach(array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
227
+			foreach (array_merge(array('api'), array_keys($GLOBALS['egw_info']['apps'])) as $appname)
228 228
 			{
229 229
 				if ($appname[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$appname)) continue;
230 230
 
231
-				$f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
231
+				$f = EGW_SERVER_ROOT.'/'.$appname.'/setup/setup.inc.php';
232 232
 				$setup_info = array($appname => array());
233
-				if(@file_exists($f)) include($f);
233
+				if (@file_exists($f)) include($f);
234 234
 
235 235
 				// some apps have setup_info for more then themselfs (eg. api for groupdav)
236
-				foreach($setup_info as $appname => $data)
236
+				foreach ($setup_info as $appname => $data)
237 237
 				{
238
-					foreach((array)$data['hooks'] as $location => $methods)
238
+					foreach ((array)$data['hooks'] as $location => $methods)
239 239
 					{
240 240
 						if (is_int($location))
241 241
 						{
Please login to merge, or discard this patch.
api/src/Country.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @param boolean $translated =true use translated name or english
365 365
 	 * @return string
366 366
 	 */
367
-	public static function get_full_name($code,$translated=true)
367
+	public static function get_full_name($code, $translated = true)
368 368
 	{
369 369
 		if ($translated)
370 370
 		{
@@ -383,36 +383,36 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	public static function country_code($name)
385 385
 	{
386
-		if (!$name) return '';	// nothing to do
386
+		if (!$name) return ''; // nothing to do
387 387
 
388 388
 		if (strlen($name) == 2 && isset(self::$country_array[$name]))
389 389
 		{
390
-			return $name;	// $name is already a country-code
390
+			return $name; // $name is already a country-code
391 391
 		}
392 392
 
393
-		if (($code = array_search(strtoupper($name),self::$country_array)) !== false)
393
+		if (($code = array_search(strtoupper($name), self::$country_array)) !== false)
394 394
 		{
395 395
 			return $code;
396 396
 		}
397 397
 		if (!self::$countries_translated) self::_translate_countries();
398 398
 
399
-		if (($code = array_search(strtoupper($name),self::$countries_translated)) !== false ||
400
-			($code = array_search($name,self::$countries_translated)) !== false)
399
+		if (($code = array_search(strtoupper($name), self::$countries_translated)) !== false ||
400
+			($code = array_search($name, self::$countries_translated)) !== false)
401 401
 		{
402 402
 			return $code;
403 403
 		}
404 404
 		// search case-insensitive all translations for the english phrase of given country $name
405 405
 		// we do that to catch all possible cases of translations
406
-		static $en_names = array();	// we do some caching to minimize db-accesses
406
+		static $en_names = array(); // we do some caching to minimize db-accesses
407 407
 		if (isset($en_names[$name]))
408 408
 		{
409 409
 			$name = $en_names[$name];
410 410
 		}
411
-		elseif (($name_en = Translation::get_message_id($name,'common')))
411
+		elseif (($name_en = Translation::get_message_id($name, 'common')))
412 412
 		{
413 413
 			$name = $en_names[$name] = strtoupper($name_en);
414 414
 		}
415
-		if (($code = array_search(strtoupper($name),self::$country_array)) !== false)
415
+		if (($code = array_search(strtoupper($name), self::$country_array)) !== false)
416 416
 		{
417 417
 			return $code;
418 418
 		}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 * @param boolean $translated =true use translated names or english
426 426
 	 * @return array with 2-letter code => name pairs
427 427
 	 */
428
-	public static function countries($translated=true)
428
+	public static function countries($translated = true)
429 429
 	{
430 430
 		if ($translated)
431 431
 		{
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 
448 448
 		self::$countries_translated = self::$country_array;
449 449
 		// try to translate them and sort alphabetic
450
-		foreach(self::$countries_translated as $k => $name)
450
+		foreach (self::$countries_translated as $k => $name)
451 451
 		{
452 452
 			self::$countries_translated[$k] = lang($name);
453 453
 		}
454 454
 
455
-		if(class_exists('Collator') && class_exists('Locale'))
455
+		if (class_exists('Collator') && class_exists('Locale'))
456 456
 		{
457 457
 			$col = new \Collator(Preferences::setlocale());
458 458
 			$col->asort(self::$countries_translated);
Please login to merge, or discard this patch.
api/src/Auth/Fallbackmail2sql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	/**
23 23
 	 * Constructor
24 24
 	 */
25
-	function __construct($primary='mail', $fallback='sql')
25
+	function __construct($primary = 'mail', $fallback = 'sql')
26 26
 	{
27 27
 		parent::__construct($primary, $fallback);
28 28
 	}
Please login to merge, or discard this patch.
api/src/Auth/Nis.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,22 +26,22 @@  discard block
 block discarded – undo
26 26
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
27 27
 	 * @return boolean true if successful authenticated, false otherwise
28 28
 	 */
29
-	function authenticate($username, $passwd, $passwd_type='text')
29
+	function authenticate($username, $passwd, $passwd_type = 'text')
30 30
 	{
31
-		unset($passwd_type);	// not used but required by interface
31
+		unset($passwd_type); // not used but required by interface
32 32
 
33 33
 		$domain = yp_get_default_domain();
34
-		if(!empty($GLOBALS['egw_info']['server']['nis_domain']))
34
+		if (!empty($GLOBALS['egw_info']['server']['nis_domain']))
35 35
 		{
36 36
 			$domain = $GLOBALS['egw_info']['server']['nis_domain'];
37 37
 		}
38 38
 
39 39
 		$map = "passwd.byname";
40
-		if(!empty($GLOBALS['egw_info']['server']['nis_map']))
40
+		if (!empty($GLOBALS['egw_info']['server']['nis_map']))
41 41
 		{
42 42
 			$map = $GLOBALS['egw_info']['server']['nis_map'];
43 43
 		}
44
-		$entry = yp_match( $domain, $map, $username );
44
+		$entry = yp_match($domain, $map, $username);
45 45
 
46 46
 		/*
47 47
 		 * we assume that the map is structured in the usual
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 	 * @param int $account_id =0 account id of user whose passwd should be changed
64 64
 	 * @return boolean true if password successful changed, false otherwise
65 65
 	 */
66
-	function change_password($old_passwd, $new_passwd, $account_id=0)
66
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
67 67
 	{
68
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by interface
68
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by interface
69 69
 
70 70
 		// can't change passwords unless server runs as root (bad idea)
71
-		return( False );
71
+		return(False);
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
api/src/Auth/Sqlssl.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
30 30
 	 * @return boolean true if successful authenticated, false otherwise
31 31
 	 */
32
-	function authenticate($username, $passwd, $passwd_type='text')
32
+	function authenticate($username, $passwd, $passwd_type = 'text')
33 33
 	{
34
-		unset($passwd_type);	// not used but required by interface
34
+		unset($passwd_type); // not used but required by interface
35 35
 
36 36
 		$local_debug = False;
37 37
 
38
-		if($local_debug)
38
+		if ($local_debug)
39 39
 		{
40 40
 			echo "<b>Debug SQL: uid - $username passwd - $passwd</b>";
41 41
 		}
42
-		if (!($row = $this->db->select($this->table,'account_lid,account_pwd',array(
42
+		if (!($row = $this->db->select($this->table, 'account_lid,account_pwd', array(
43 43
 			'account_lid' => $username,
44 44
 			'account_status' => 'A',
45 45
 			'account_type'   => 'u',
46
-		),__LINE__,__FILE__)->fetch()) || $GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
46
+		), __LINE__, __FILE__)->fetch()) || $GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
47 47
 		{
48 48
 			return false;
49 49
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		# Apache + mod_ssl provide the data in the environment
52 52
 		# Certificate (chain) verification occurs inside mod_ssl
53 53
 		# see http://www.modssl.org/docs/2.8/ssl_howto.html#ToC6
54
-		if(!isset($_SERVER['SSL_CLIENT_S_DN']))
54
+		if (!isset($_SERVER['SSL_CLIENT_S_DN']))
55 55
 		{
56 56
 			# if we're not doing SSL authentication, behave like auth_sql
57 57
 			return Api\Auth::compare_password($passwd, $row['account_pwd'], 'md5', strtolower($username));
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @param int $account_id =0 account id of user whose passwd should be changed
68 68
 	 * @return boolean true if password successful changed, false otherwise
69 69
 	 */
70
-	function change_password($old_passwd, $new_passwd, $account_id=0)
70
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
71 71
 	{
72
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by interface
72
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by interface
73 73
 
74 74
 		// deny password changes.
75 75
 		return False;
Please login to merge, or discard this patch.
api/src/Auth/Pam.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
31 31
 	 * @return boolean true if successful authenticated, false otherwise
32 32
 	 */
33
-	function authenticate($username, $passwd, $passwd_type='text')
33
+	function authenticate($username, $passwd, $passwd_type = 'text')
34 34
 	{
35
-		unset($passwd_type);	// not used but required by interface
35
+		unset($passwd_type); // not used but required by interface
36 36
 
37 37
 		if (pam_auth($username, get_magic_quotes_gpc() ? stripslashes($passwd) : $passwd))
38 38
 		{
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 			if (!$GLOBALS['egw']->accounts->name2id($username) &&
41 41
 				function_exists('posix_getpwnam') && ($data = posix_getpwnam($username)))
42 42
 			{
43
-				list($fullname) = explode(',',$data['gecos']);
44
-				$parts = explode(' ',$fullname);
43
+				list($fullname) = explode(',', $data['gecos']);
44
+				$parts = explode(' ', $fullname);
45 45
 				if (count($parts) > 1)
46 46
 				{
47 47
 					$lastname = array_pop($parts);
48
-					$firstname = implode(' ',$parts);
48
+					$firstname = implode(' ', $parts);
49 49
 					$email = Api\Accounts::email($firstname, $lastname, $username);
50 50
 
51 51
 					$GLOBALS['auto_create_acct'] = array(
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param int $account_id =0 account id of user whose passwd should be changed
70 70
 	 * @return boolean true if password successful changed, false otherwise
71 71
 	 */
72
-	function change_password($old_passwd, $new_passwd, $account_id=0)
72
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
73 73
 	{
74
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by interface
74
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by interface
75 75
 
76 76
 		// deny password changes.
77 77
 		return False;
Please login to merge, or discard this patch.
api/src/Auth/Mail.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
35 35
 	 * @return boolean true if successful authenticated, false otherwise
36 36
 	 */
37
-	function authenticate($username, $passwd, $passwd_type='text')
37
+	function authenticate($username, $passwd, $passwd_type = 'text')
38 38
 	{
39
-		unset($passwd_type);	// not used but required by function signature
39
+		unset($passwd_type); // not used but required by function signature
40 40
 
41 41
 		switch ($GLOBALS['egw_info']['server']['mail_login_type'])
42 42
 		{
43 43
 			case 'vmailmgr':
44
-				$username = $username . '@' . $GLOBALS['egw_info']['server']['mail_suffix'];
44
+				$username = $username.'@'.$GLOBALS['egw_info']['server']['mail_suffix'];
45 45
 				break;
46 46
 			case 'email':
47 47
 				$username = $GLOBALS['egw']->accounts->id2name($username, 'account_email');
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$mailauth = true;
69 69
 				$imap->logout();
70 70
 			}
71
-			catch(Horde_Imap_Client_Exception $e) {
71
+			catch (Horde_Imap_Client_Exception $e) {
72 72
 				// throw everything but authentication failed as exception
73 73
 				if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) throw $e;
74 74
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 				case 'imap':
86 86
 				default:
87 87
 					if (!isset($port)) $port = 143;
88
-					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username , $passwd);
88
+					$mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username, $passwd);
89 89
 					break;
90 90
 				case 'imaps':
91 91
 					if (!isset($port)) $port = 993;
92
-					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
92
+					$mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
93 93
 					break;
94 94
 				case 'pop3':
95 95
 					if (!isset($port)) $port = 110;
96
-					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
96
+					$mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
97 97
 					break;
98 98
 				case 'pop3s':
99 99
 					if (!isset($port)) $port = 995;
100
-					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd);
100
+					$mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd);
101 101
 					break;
102 102
 			}
103 103
 			if ($mailauth) imap_close($mailauth);
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 * @param int $account_id =0 account id of user whose passwd should be changed
114 114
 	 * @return boolean true if password successful changed, false otherwise
115 115
 	 */
116
-	function change_password($old_passwd, $new_passwd, $account_id=0)
116
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
117 117
 	{
118
-		unset($old_passwd, $new_passwd, $account_id);	// not used but required by function sigature
118
+		unset($old_passwd, $new_passwd, $account_id); // not used but required by function sigature
119 119
 
120 120
 		return False;
121 121
 	}
Please login to merge, or discard this patch.
api/src/Auth/Backend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
26 26
 	 * @return boolean true if successful authenticated, false otherwise
27 27
 	 */
28
-	function authenticate($username, $passwd, $passwd_type='text');
28
+	function authenticate($username, $passwd, $passwd_type = 'text');
29 29
 
30 30
 	/**
31 31
 	 * changes password in sql datababse
@@ -36,5 +36,5 @@  discard block
 block discarded – undo
36 36
 	 * @throws Exception to give a verbose error, why changing password failed
37 37
 	 * @return boolean true if password successful changed, false otherwise
38 38
 	 */
39
-	function change_password($old_passwd, $new_passwd, $account_id=0);
39
+	function change_password($old_passwd, $new_passwd, $account_id = 0);
40 40
 }
Please login to merge, or discard this patch.
api/src/Auth/Cas.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
30 30
 	 * @return boolean true if successful authenticated, false otherwise
31 31
 	 */
32
-	function authenticate($username, $passwd, $passwd_type='text')
32
+	function authenticate($username, $passwd, $passwd_type = 'text')
33 33
 	{
34 34
 		/* if program goes here, authenticate is, normaly, already verified by CAS */
35 35
 		if ($GLOBALS['egw_info']['server']['account_repository'] != 'ldap' &&
36 36
 			$GLOBALS['egw_info']['server']['account_repository'] != 'ldsq') /* For anonymous LDAP connection */
37 37
 		{
38
-			if (!($id = $GLOBALS['egw']->accounts->name2id($username,'account_lid','u')) &&
38
+			if (!($id = $GLOBALS['egw']->accounts->name2id($username, 'account_lid', 'u')) &&
39 39
 				$GLOBALS['egw_info']['server']['auto_create_acct'])
40 40
 			{
41 41
 				// create a global array with all availible info about that account
42 42
 				$GLOBALS['auto_create_acct'] = array();
43
-				foreach(array(
43
+				foreach (array(
44 44
 					'givenname' => 'firstname',
45 45
 					'sn'        => 'lastname',
46 46
 					'uidnumber' => 'id',
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 					'gidnumber' => 'primary_group',
49 49
 					) as $ldap_name => $acct_name)
50 50
 				{
51
-					$GLOBALS['auto_create_acct'][$acct_name] = Api\Translation::convert($allValues[0][$ldap_name][0],'utf-8');
51
+					$GLOBALS['auto_create_acct'][$acct_name] = Api\Translation::convert($allValues[0][$ldap_name][0], 'utf-8');
52 52
 				}
53 53
 				return True;
54 54
 			}
55
-			return $id && $GLOBALS['egw']->accounts->id2name($id,'account_status') == 'A' && phpCAS::checkAuthentication();
55
+			return $id && $GLOBALS['egw']->accounts->id2name($id, 'account_status') == 'A' && phpCAS::checkAuthentication();
56 56
 		}
57 57
 		return phpCAS::checkAuthentication();
58 58
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param int $account_id =0 account id of user whose passwd should be changed
66 66
 	 * @return boolean true if password successful changed, false otherwise
67 67
 	 */
68
-	function change_password($old_passwd, $new_passwd, $account_id=0)
68
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
69 69
 	{
70 70
 		/* Not allowed */
71 71
 		return false;
Please login to merge, or discard this patch.