Completed
Push — master ( 476d4b...19a789 )
by Ralf
39:41 queued 19:06
created
api/src/Db/Pdo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		$egw_db = isset($GLOBALS['egw_setup']) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db;
74 74
 
75
-		switch($egw_db->Type)
75
+		switch ($egw_db->Type)
76 76
 		{
77 77
 			case 'mysqli':
78 78
 			case 'mysqlt':
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$dsn = self::$pdo_type.':dbname='.$egw_db->Database.($host ? ';host='.$host.($egw_db->Port ? ';port='.$egw_db->Port : '') : '');
92 92
 		// check once if pdo extension and DB specific driver is loaded or can be loaded
93
-		static $pdo_available=null;
93
+		static $pdo_available = null;
94 94
 		if (is_null($pdo_available))
95 95
 		{
96
-			foreach(array('pdo','pdo_'.self::$pdo_type) as $ext)
96
+			foreach (array('pdo', 'pdo_'.self::$pdo_type) as $ext)
97 97
 			{
98
-				check_load_extension($ext,true);	// true = throw Exception
98
+				check_load_extension($ext, true); // true = throw Exception
99 99
 			}
100 100
 			$pdo_available = true;
101 101
 		}
102 102
 		// set client charset of the connection
103
-		switch(self::$pdo_type)
103
+		switch (self::$pdo_type)
104 104
 		{
105 105
 			case 'mysql':
106 106
 				$dsn .= ';charset=utf8';
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 				break;
111 111
 		}
112 112
 		try {
113
-			self::$pdo = new \PDO($dsn,$egw_db->User,$egw_db->Password,array(
113
+			self::$pdo = new \PDO($dsn, $egw_db->User, $egw_db->Password, array(
114 114
 				\PDO::ATTR_ERRMODE=>\PDO::ERRMODE_EXCEPTION,
115 115
 			));
116 116
 		}
117
-		catch(\PDOException $e)
117
+		catch (\PDOException $e)
118 118
 		{
119 119
 			unset($e);
120 120
 			// Exception reveals password, so we ignore the exception and connect again without pw, to get the right exception without pw
121
-			self::$pdo = new \PDO($dsn,$egw_db->User,'$egw_db->Password');
121
+			self::$pdo = new \PDO($dsn, $egw_db->User, '$egw_db->Password');
122 122
 		}
123 123
 		if ($query)
124 124
 		{
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	{
138 138
 		if (is_numeric($time))
139 139
 		{
140
-			$time = date('Y-m-d H:i:s',$time);
140
+			$time = date('Y-m-d H:i:s', $time);
141 141
 		}
142 142
 		return $time;
143 143
 	}
Please login to merge, or discard this patch.
infolog/inc/class.infolog_zpush.inc.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	static public $mapping = array(
39 39
 		'body'	=> 'info_des',
40
-		'categories' => 'info_cat',	// infolog supports only a single category
41
-		'complete' => 'info_status', 	// 0 or 1 <--> 'done', ....
40
+		'categories' => 'info_cat', // infolog supports only a single category
41
+		'complete' => 'info_status', // 0 or 1 <--> 'done', ....
42 42
 		'datecompleted' => 'info_datecompleted',
43 43
 		'duedate' => 'info_enddate',
44
-		'importance' => 'info_priority',	// 0=Low, 1=Normal, 2=High (EGW additional 3=Urgent)
45
-		'sensitivity' => 'info_access',	// 0=Normal, 1=Personal, 2=Private, 3=Confiential <--> 'public', 'private'
44
+		'importance' => 'info_priority', // 0=Low, 1=Normal, 2=High (EGW additional 3=Urgent)
45
+		'sensitivity' => 'info_access', // 0=Normal, 1=Personal, 2=Private, 3=Confiential <--> 'public', 'private'
46 46
 		'startdate' => 'info_startdate',
47 47
 		'subject' => 'info_subject',
48 48
 		//'recurrence' => EGroupware InfoLog does NOT support recuring tasks
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param int $account =null account_id of addressbook or null to get array of all addressbooks
76 76
 	 * @return string|array folder name of array with int account_id => folder name pairs
77 77
 	 */
78
-	private function get_folders($account=null)
78
+	private function get_folders($account = null)
79 79
 	{
80 80
 		$folders = array(
81 81
 			$GLOBALS['egw_info']['user']['account_id'] => lang('InfoLog'),
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		foreach ($this->get_folders() as $account => $label)
96 96
 		{
97 97
 			$folderlist[] = array(
98
-				'id'	=>	$this->backend->createID('infolog',$account),
98
+				'id'	=>	$this->backend->createID('infolog', $account),
99 99
 				'mod'	=>	$label,
100 100
 				'parent'=>	'0',
101 101
 			);
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 	 * @param int $cutoffdate =null
192 192
 	 * @return array
193 193
   	 */
194
-	function GetMessageList($id, $cutoffdate=NULL)
194
+	function GetMessageList($id, $cutoffdate = NULL)
195 195
 	{
196
-		unset($cutoffdate);	// not used, but required by function signature
196
+		unset($cutoffdate); // not used, but required by function signature
197 197
 
198 198
 		if (!isset($this->infolog)) $this->infolog = new infolog_bo();
199 199
 
200 200
 		$type = $user = null;
201
-		$this->backend->splitID($id,$type,$user);
201
+		$this->backend->splitID($id, $type, $user);
202 202
 		if (!($infolog_types = $GLOBALS['egw_info']['user']['preferences']['activesync']['infolog-types']))
203 203
 		{
204 204
 			$infolog_types = 'task';
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 		$messagelist = array();
213 213
 		// reading tasks in chunks of 100, to keep memory down for huge infologs
214 214
 		$filter['num_rows'] = 100;
215
-		for($filter['start']=0; ($infologs = $this->infolog->search($filter)); $filter['start'] += $filter['num_rows'])
215
+		for ($filter['start'] = 0; ($infologs = $this->infolog->search($filter)); $filter['start'] += $filter['num_rows'])
216 216
 		{
217
-			foreach($infologs as $infolog)
217
+			foreach ($infologs as $infolog)
218 218
 			{
219 219
 				$messagelist[] = $this->StatMessage($id, $infolog);
220 220
 			}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			return false;
252 252
 		}
253 253
 		$message = new SyncTask();
254
-		foreach(self::$mapping as $key => $attr)
254
+		foreach (self::$mapping as $key => $attr)
255 255
 		{
256 256
 			switch ($attr)
257 257
 			{
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 					}
265 265
 					else
266 266
 					{
267
-						if (strlen ($infolog[$attr]) > 0)
267
+						if (strlen($infolog[$attr]) > 0)
268 268
 						{
269 269
 							ZLog::Write(LOGLEVEL_DEBUG, "airsyncbasebody!");
270 270
 							$message->asbody = new SyncBaseBody();
271
-							$message->nativebodytype=1;
271
+							$message->nativebodytype = 1;
272 272
 							$this->backend->note2messagenote($infolog[$attr], $bodypreference, $message->asbody);
273 273
 						}
274 274
 					}
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 				case 'info_cat':
278 278
 					$message->$key = array();
279
-					foreach($infolog[$attr] ? explode(',',$infolog[$attr]) : array() as $cat_id)
279
+					foreach ($infolog[$attr] ? explode(',', $infolog[$attr]) : array() as $cat_id)
280 280
 					{
281 281
 						$message->categories[] = Api\Categories::id2name($cat_id);
282 282
 					}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 					break;
301 301
 
302 302
 				case 'info_priority':
303
-					if ($infolog[$attr] > 2) $infolog[$attr] = 2;	// AS does not know 3=Urgent (only 0=Low, 1=Normal, 2=High)
303
+					if ($infolog[$attr] > 2) $infolog[$attr] = 2; // AS does not know 3=Urgent (only 0=Low, 1=Normal, 2=High)
304 304
 					// fall through
305 305
 				default:
306 306
 					if (!empty($infolog[$attr])) $message->$key = $infolog[$attr];
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function StatMessage($folderid, $infolog)
326 326
 	{
327
-		unset($folderid);	// not used, info_id does not depend on folder
327
+		unset($folderid); // not used, info_id does not depend on folder
328 328
 
329 329
 		if (!isset($this->infolog)) $this->infolog = new infolog_bo();
330 330
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	public function ChangeFolder($id, $oldid, $displayname, $type)
362 362
 	{
363
-		unset($id, $oldid, $displayname, $type);	// not used
363
+		unset($id, $oldid, $displayname, $type); // not used
364 364
 
365 365
 		ZLog::Write(LOGLEVEL_DEBUG, __METHOD__." not implemented");
366 366
 	}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	public function DeleteFolder($parentid, $id)
379 379
 	{
380
-		unset($parentid, $id);	// not used
380
+		unset($parentid, $id); // not used
381 381
 
382 382
 		ZLog::Write(LOGLEVEL_DEBUG, __METHOD__." not implemented");
383 383
 	}
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 					case 'info_cat':
433 433
 						if (is_array($message->$key))
434 434
 						{
435
-							$infolog[$attr] = implode(',', array_filter($this->infolog->find_or_add_categories($message->$key, $id),'strlen'));
435
+							$infolog[$attr] = implode(',', array_filter($this->infolog->find_or_add_categories($message->$key, $id), 'strlen'));
436 436
 						}
437 437
 						break;
438 438
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 						break;
450 450
 
451 451
 					case 'info_priority':	// AS does not know 3=Urgent (only 0=Low, 1=Normal, 2=High)
452
-						if ($infolog[$attr] == 3 && $message->$key == 2) break;	// --> do NOT change Urgent, if AS reports High
452
+						if ($infolog[$attr] == 3 && $message->$key == 2) break; // --> do NOT change Urgent, if AS reports High
453 453
 						// fall through
454 454
 					default:
455 455
 						$infolog[$attr] = $message->$key;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function DeleteMessage($folderid, $id, $contentParameters)
506 506
 	{
507
-		unset($contentParameters);	// not used
507
+		unset($contentParameters); // not used
508 508
 
509 509
 		if (!isset($this->infolog)) $this->infolog = new infolog_bo();
510 510
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	public function SetReadFlag($folderid, $id, $flags, $contentParameters)
534 534
 	{
535
-		unset($folderid, $id, $flags, $contentParameters);	// not used
535
+		unset($folderid, $id, $flags, $contentParameters); // not used
536 536
 
537 537
 		return false;
538 538
 	}
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	function ChangeMessageFlag($folderid, $id, $flags)
551 551
 	{
552
-		unset($folderid, $id, $flags);	// not used
552
+		unset($folderid, $id, $flags); // not used
553 553
 
554 554
 		return false;
555 555
 	}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 			'info_type' => explode(',', $infolog_types),
583 583
 		));
584 584
 
585
-		$changes = array();	// no change
585
+		$changes = array(); // no change
586 586
 		//$syncstate_was = $syncstate;
587 587
 
588 588
 		if ($ctag !== $syncstate)
Please login to merge, or discard this patch.
api/src/Ldap.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @var boolean $exception_on_error
51 51
 	 */
52
-	var $exception_on_error=false;
52
+	var $exception_on_error = false;
53 53
 
54 54
 	/**
55 55
 	 * Constructor
56 56
 	 *
57 57
 	 * @param boolean $exception_on_error =false true: throw Exceptions in ldapConnect instead of echoing error and returning false
58 58
 	 */
59
-	function __construct($exception_on_error=false)
59
+	function __construct($exception_on_error = false)
60 60
 	{
61 61
 		$this->exception_on_error = $exception_on_error;
62 62
 		$this->restoreSessionData();
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @throws Exception\AssertingFailed 'LDAP support unavailable!' (no ldap extension)
84 84
 	 * @throws Exception\NoPermission if bind fails
85 85
 	 */
86
-	public static function factory($ressource=true, $host='', $dn='', $passwd='')
86
+	public static function factory($ressource = true, $host = '', $dn = '', $passwd = '')
87 87
 	{
88 88
 		$key = md5($host.':'.$dn.':'.$passwd);
89 89
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	static function quote($string)
120 120
 	{
121
-		return str_replace(array('\\','*','(',')','\0',' '),array('\\\\','\*','\(','\)','\\0','\20'),$string);
121
+		return str_replace(array('\\', '*', '(', ')', '\0', ' '), array('\\\\', '\*', '\(', '\)', '\\0', '\20'), $string);
122 122
 	}
123 123
 
124 124
 	/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		if (!is_array($ldap)) return false;
133 133
 
134 134
 		$arr = array();
135
-		foreach($ldap as $var => $val)
135
+		foreach ($ldap as $var => $val)
136 136
 		{
137 137
 			if (is_int($var) || $var == 'count') continue;
138 138
 
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 	 * @throws Exception\AssertingFailed 'LDAP support unavailable!' (no ldap extension)
165 165
 	 * @throws Exception\NoPermission if bind fails
166 166
 	 */
167
-	function ldapConnect($host='', $dn='', $passwd='')
167
+	function ldapConnect($host = '', $dn = '', $passwd = '')
168 168
 	{
169
-		if(!function_exists('ldap_connect'))
169
+		if (!function_exists('ldap_connect'))
170 170
 		{
171 171
 			if ($this->exception_on_error) throw new Exception\AssertionFailed('LDAP support unavailable!');
172 172
 
173
-			printf('<b>Error: LDAP support unavailable</b><br>',$host);
173
+			printf('<b>Error: LDAP support unavailable</b><br>', $host);
174 174
 			return False;
175 175
 		}
176 176
 		if (empty($host))
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		{
189 189
 			$host = $_SESSION['ldapConnect'][$host];
190 190
 		}
191
-		foreach($hosts=preg_split('/[ ,;]+/', $host) as $h)
191
+		foreach ($hosts = preg_split('/[ ,;]+/', $host) as $h)
192 192
 		{
193 193
 			if ($this->_connect($h, $dn, $passwd))
194 194
 			{
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 				{
197 197
 					if (isset($_SESSION))	// store working host as first choice in session
198 198
 					{
199
-						$_SESSION['ldapConnect'][$host] = implode(' ',array_unique(array_merge(array($h),$hosts)));
199
+						$_SESSION['ldapConnect'][$host] = implode(' ', array_unique(array_merge(array($h), $hosts)));
200 200
 					}
201 201
 				}
202 202
 				return $this->ds;
@@ -221,20 +221,20 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	private function _connect($host, $dn, $passwd)
223 223
 	{
224
-		if (($use_tls = substr($host,0,6) == 'tls://'))
224
+		if (($use_tls = substr($host, 0, 6) == 'tls://'))
225 225
 		{
226
-			$port = parse_url($host,PHP_URL_PORT);
227
-			$host = parse_url($host,PHP_URL_HOST);
226
+			$port = parse_url($host, PHP_URL_PORT);
227
+			$host = parse_url($host, PHP_URL_HOST);
228 228
 		}
229 229
 		// connect to ldap server (never fails, as connection happens in bind!)
230
-		if(!$host || !($this->ds = !empty($port) ? ldap_connect($host, $port) : ldap_connect($host)))
230
+		if (!$host || !($this->ds = !empty($port) ? ldap_connect($host, $port) : ldap_connect($host)))
231 231
 		{
232 232
 			return False;
233 233
 		}
234 234
 		// set network timeout to not block for minutes
235 235
 		ldap_set_option($this->ds, LDAP_OPT_NETWORK_TIMEOUT, 5);
236 236
 
237
-		if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
237
+		if (ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
238 238
 		{
239 239
 			$supportedLDAPVersion = 3;
240 240
 		}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		if ($use_tls) ldap_start_tls($this->ds);
246 246
 
247 247
 		if (!isset($this->ldapserverinfo) ||
248
-			!is_a($this->ldapserverinfo,'EGroupware\Ldap\ServerInfo') ||
248
+			!is_a($this->ldapserverinfo, 'EGroupware\Ldap\ServerInfo') ||
249 249
 			$this->ldapserverinfo->host != $host)
250 250
 		{
251 251
 			//error_log("no ldap server info found");
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			$this->saveSessionData();
256 256
 		}
257 257
 
258
-		if(!@ldap_bind($this->ds, $dn, $passwd))
258
+		if (!@ldap_bind($this->ds, $dn, $passwd))
259 259
 		{
260 260
 			return False;
261 261
 		}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	function ldapDisconnect()
270 270
 	{
271
-		if(is_resource($this->ds))
271
+		if (is_resource($this->ds))
272 272
 		{
273 273
 			ldap_unbind($this->ds);
274 274
 			unset($this->ds);
Please login to merge, or discard this patch.
api/src/Auth/Sql.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param string $passwd_type ='text' 'text' for cleartext passwords (default)
53 53
 	 * @return boolean true if successful authenticated, false otherwise
54 54
 	 */
55
-	function authenticate($username, $passwd, $passwd_type='text')
55
+	function authenticate($username, $passwd, $passwd_type = 'text')
56 56
 	{
57 57
 		/* normal web form login */
58 58
 		$where = array(
@@ -65,26 +65,26 @@  discard block
 block discarded – undo
65 65
 			$where[] = 'account_lid '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote($username);
66 66
 			unset($where['account_lid']);
67 67
 		}
68
-		if($passwd_type == 'text')
68
+		if ($passwd_type == 'text')
69 69
 		{
70
-			if (!($row = $this->db->select($this->table,'account_lid,account_pwd,account_lastlogin,account_id',$where,__LINE__,__FILE__)->fetch()) ||
70
+			if (!($row = $this->db->select($this->table, 'account_lid,account_pwd,account_lastlogin,account_id', $where, __LINE__, __FILE__)->fetch()) ||
71 71
 				empty($row['account_pwd']) ||
72 72
 				$GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
73 73
 			{
74 74
 				return false;
75 75
 			}
76 76
 			$type = null;
77
-			if(!($match = Api\Auth::compare_password($passwd, $row['account_pwd'], $this->type, strtolower($username), $type)) ||
78
-				$type != $this->type && in_array($type, explode(',',strtolower($GLOBALS['egw_info']['server']['pwd_migration_types']))))
77
+			if (!($match = Api\Auth::compare_password($passwd, $row['account_pwd'], $this->type, strtolower($username), $type)) ||
78
+				$type != $this->type && in_array($type, explode(',', strtolower($GLOBALS['egw_info']['server']['pwd_migration_types']))))
79 79
 			{
80 80
 				// do we have to migrate an old password ?
81
-				if($GLOBALS['egw_info']['server']['pwd_migration_allowed'] && !empty($GLOBALS['egw_info']['server']['pwd_migration_types']))
81
+				if ($GLOBALS['egw_info']['server']['pwd_migration_allowed'] && !empty($GLOBALS['egw_info']['server']['pwd_migration_types']))
82 82
 				{
83 83
 					if (!$match)
84 84
 					{
85
-						foreach(explode(',', $GLOBALS['egw_info']['server']['pwd_migration_types']) as $type)
85
+						foreach (explode(',', $GLOBALS['egw_info']['server']['pwd_migration_types']) as $type)
86 86
 						{
87
-							if(($match = Api\Auth::compare_password($passwd,$row['account_pwd'],$type,strtolower($username))))
87
+							if (($match = Api\Auth::compare_password($passwd, $row['account_pwd'], $type, strtolower($username))))
88 88
 							{
89 89
 								break;
90 90
 							}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		else
103 103
 		{
104 104
 			$where['account_pwd'] = $passwd;
105
-			if (!($row = $this->db->select($this->table,'account_lid,account_lastlogin',$where,__LINE__,__FILE__)->fetch()) ||
105
+			if (!($row = $this->db->select($this->table, 'account_lid,account_lastlogin', $where, __LINE__, __FILE__)->fetch()) ||
106 106
 				$GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
107 107
 			{
108 108
 				return false;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			$where[] = 'account_lid '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote($username);
134 134
 			unset($where['account_lid']);
135 135
 		}
136
-		if (!($row = $this->db->select($this->table,'account_lid,account_lastpwd_change',$where,__LINE__,__FILE__)->fetch()) ||
136
+		if (!($row = $this->db->select($this->table, 'account_lid,account_lastpwd_change', $where, __LINE__, __FILE__)->fetch()) ||
137 137
 			$GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username)
138 138
 		{
139 139
 			return false;
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 * @param int $_lastpwdchange =null must be a unixtimestamp
153 153
 	 * @return boolean true if account_lastpwd_change successful changed, false otherwise
154 154
 	 */
155
-	function setLastPwdChange($account_id=0, $passwd=NULL, $_lastpwdchange=NULL)
155
+	function setLastPwdChange($account_id = 0, $passwd = NULL, $_lastpwdchange = NULL)
156 156
 	{
157 157
 		$admin = True;
158 158
 		// Don't allow password changes for other accounts when using XML-RPC
159
-		if(!$account_id || $GLOBALS['egw_info']['flags']['currentapp'] == 'login')
159
+		if (!$account_id || $GLOBALS['egw_info']['flags']['currentapp'] == 'login')
160 160
 		{
161 161
 			$admin = False;
162 162
 			$account_id = $GLOBALS['egw_info']['user']['account_id'];
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
 			$username = $GLOBALS['egw']->accounts->id2name($account_id);
168 168
 		}
169 169
 
170
-		if (($pw = $this->db->select($this->table,'account_pwd',array(
170
+		if (($pw = $this->db->select($this->table, 'account_pwd', array(
171 171
 			'account_id'     => $account_id,
172 172
 			'account_type'   => 'u',
173 173
 			'account_status' => 'A',
174
-		),__LINE__,__FILE__)->fetchColumn()) === false)
174
+		), __LINE__, __FILE__)->fetchColumn()) === false)
175 175
 		{
176
-			return false;	// account not found
176
+			return false; // account not found
177 177
 		}
178 178
 		// Check the passwd to make sure this is legal
179
-		if(!$admin && !Api\Auth::compare_password($passwd,$pw,$this->type,strtolower($username)))
179
+		if (!$admin && !Api\Auth::compare_password($passwd, $pw, $this->type, strtolower($username)))
180 180
 		{
181 181
 			return false;
182 182
 		}
183 183
 		$lastpwdchange = (is_null($_lastpwdchange) || $_lastpwdchange < 0 ? time() : $_lastpwdchange);
184
-		$this->db->update($this->table,array(
184
+		$this->db->update($this->table, array(
185 185
 			'account_lastpwd_change' => $lastpwdchange,
186
-		),array(
186
+		), array(
187 187
 			'account_id' => $account_id,
188
-		),__LINE__,__FILE__);
188
+		), __LINE__, __FILE__);
189 189
 
190
-		if(!$this->db->affected_rows()) return false;
190
+		if (!$this->db->affected_rows()) return false;
191 191
 		if (!$admin) Api\Cache::setSession('phpgwapi', 'auth_alpwchange_val', $lastpwdchange);
192 192
 		return true;
193 193
 	}
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	 * @param int $account_id account id of user whose passwd should be changed
201 201
 	 * @return boolean true if password successful changed, false otherwise
202 202
 	 */
203
-	function change_password($old_passwd, $new_passwd, $account_id=0)
203
+	function change_password($old_passwd, $new_passwd, $account_id = 0)
204 204
 	{
205 205
 		$admin = True;
206 206
 		// Don't allow password changes for other accounts when using XML-RPC
207
-		if(!$account_id)
207
+		if (!$account_id)
208 208
 		{
209 209
 			$admin = False;
210 210
 			$account_id = $GLOBALS['egw_info']['user']['account_id'];
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 			$username = $GLOBALS['egw']->accounts->id2name($account_id);
216 216
 		}
217 217
 
218
-		if (($pw = $this->db->select($this->table,'account_pwd',array(
218
+		if (($pw = $this->db->select($this->table, 'account_pwd', array(
219 219
 			'account_id'     => $account_id,
220 220
 			'account_type'   => 'u',
221
-		),__LINE__,__FILE__)->fetchColumn()) === false)
221
+		), __LINE__, __FILE__)->fetchColumn()) === false)
222 222
 		{
223
-			return false;	// account not found
223
+			return false; // account not found
224 224
 		}
225 225
 		// Check the old_passwd to make sure this is legal
226
-		if(!$admin && !Api\Auth::compare_password($old_passwd,$pw,$this->type,strtolower($username)))
226
+		if (!$admin && !Api\Auth::compare_password($old_passwd, $pw, $this->type, strtolower($username)))
227 227
 		{
228 228
 			return false;
229 229
 		}
@@ -247,21 +247,21 @@  discard block
 block discarded – undo
247 247
 	 * @param boolean $update_lastpw_change =true
248 248
 	 * @return boolean true if password successful changed, false otherwise
249 249
 	 */
250
-	private function _update_passwd($encrypted_passwd, $account_id, $admin=false, $update_lastpw_change=true)
250
+	private function _update_passwd($encrypted_passwd, $account_id, $admin = false, $update_lastpw_change = true)
251 251
 	{
252 252
 		$update = array('account_pwd' => $encrypted_passwd);
253 253
 		if ($update_lastpw_change) $update['account_lastpwd_change'] = time();
254 254
 
255
-		if (!$this->db->update($this->table,$update,array(
255
+		if (!$this->db->update($this->table, $update, array(
256 256
 			'account_id' => $account_id,
257
-		),__LINE__,__FILE__))
257
+		), __LINE__, __FILE__))
258 258
 		{
259 259
 			return false;
260 260
 		}
261 261
 
262
-		if(!$admin)
262
+		if (!$admin)
263 263
 		{
264
-			Api\Cache::setSession('phpgwapi','auth_alpwchange_val',$update['account_lastpwd_change']);
264
+			Api\Cache::setSession('phpgwapi', 'auth_alpwchange_val', $update['account_lastpwd_change']);
265 265
 		}
266 266
 		return true;
267 267
 	}
Please login to merge, or discard this patch.
admin/apcu.php 1 patch
Spacing   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 );
16 16
 include('../header.inc.php');
17 17
 
18
-if ($GLOBALS['egw']->acl->check('info_access',1,'admin'))
18
+if ($GLOBALS['egw']->acl->check('info_access', 1, 'admin'))
19 19
 {
20 20
 	$GLOBALS['egw']->redirect_link('/index.php');
21 21
 }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
  */
45 45
 
46
-$VERSION='$Id$';
46
+$VERSION = '$Id$';
47 47
 
48 48
 ////////// READ OPTIONAL CONFIGURATION FILE ////////////
49 49
 if (file_exists("apc.conf.php")) include("apc.conf.php");
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 ////////// BEGIN OF DEFAULT CONFIG AREA ///////////////////////////////////////////////////////////
53 53
 
54
-defaults('USE_AUTHENTICATION',1);			// Use (internal) authentication - best choice if
54
+defaults('USE_AUTHENTICATION', 1); // Use (internal) authentication - best choice if
55 55
 											// no other authentication is available
56 56
 											// If set to 0:
57 57
 											//  There will be no further authentication. You
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 											// If set to 1:
60 60
 											//  You need to change ADMIN_PASSWORD to make
61 61
 											//  this work!
62
-defaults('ADMIN_USERNAME','apc'); 			// Admin Username
63
-defaults('ADMIN_PASSWORD','password');  	// Admin Password - CHANGE THIS TO ENABLE!!!
62
+defaults('ADMIN_USERNAME', 'apc'); // Admin Username
63
+defaults('ADMIN_PASSWORD', 'password'); // Admin Password - CHANGE THIS TO ENABLE!!!
64 64
 
65 65
 // (beckerr) I'm using a clear text password here, because I've no good idea how to let
66 66
 //           users generate a md5 or crypt password in a easy way to fill it in above
67 67
 
68 68
 //defaults('DATE_FORMAT', "d.m.Y H:i:s");	// German
69
-defaults('DATE_FORMAT', 'Y/m/d H:i:s'); 	// US
69
+defaults('DATE_FORMAT', 'Y/m/d H:i:s'); // US
70 70
 
71
-defaults('GRAPH_SIZE',200);					// Image size
71
+defaults('GRAPH_SIZE', 200); // Image size
72 72
 
73 73
 //defaults('PROXY', 'tcp://127.0.0.1:8080');
74 74
 
@@ -76,45 +76,45 @@  discard block
 block discarded – undo
76 76
 
77 77
 
78 78
 // "define if not defined"
79
-function defaults($d,$v) {
80
-	if (!defined($d)) define($d,$v); // or just @define(...)
79
+function defaults($d, $v) {
80
+	if (!defined($d)) define($d, $v); // or just @define(...)
81 81
 }
82 82
 
83 83
 // rewrite $PHP_SELF to block XSS attacks
84 84
 //
85
-$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES, 'UTF-8') : '';
85
+$PHP_SELF = isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'], ''), ENT_QUOTES, 'UTF-8') : '';
86 86
 $time = time();
87 87
 $host = php_uname('n');
88
-if($host) { $host = '('.$host.')'; }
88
+if ($host) { $host = '('.$host.')'; }
89 89
 if (isset($_SERVER['SERVER_ADDR'])) {
90 90
   $host .= ' ('.$_SERVER['SERVER_ADDR'].')';
91 91
 }
92 92
 
93 93
 // operation constants
94
-define('OB_HOST_STATS',1);
95
-define('OB_USER_CACHE',2);
96
-define('OB_VERSION_CHECK',3);
94
+define('OB_HOST_STATS', 1);
95
+define('OB_USER_CACHE', 2);
96
+define('OB_VERSION_CHECK', 3);
97 97
 
98 98
 // check validity of input variables
99
-$vardom=array(
100
-	'OB'	=> '/^\d+$/',			// operational mode switch
101
-	'CC'	=> '/^[01]$/',			// clear cache requested
102
-	'DU'	=> '/^.*$/',			// Delete User Key
103
-	'SH'	=> '/^[a-z0-9]+$/',		// shared object description
104
-
105
-	'IMG'	=> '/^[123]$/',			// image to generate
106
-	'LO'	=> '/^1$/',				// login requested
107
-
108
-	'COUNT'	=> '/^\d+$/',			// number of line displayed in list
109
-	'SCOPE'	=> '/^[AD]$/',			// list view scope
110
-	'SORT1'	=> '/^[AHSMCDTZ]$/',	// first sort key
111
-	'SORT2'	=> '/^[DA]$/',			// second sort key
112
-	'AGGR'	=> '/^\d+$/',			// aggregation by dir level
99
+$vardom = array(
100
+	'OB'	=> '/^\d+$/', // operational mode switch
101
+	'CC'	=> '/^[01]$/', // clear cache requested
102
+	'DU'	=> '/^.*$/', // Delete User Key
103
+	'SH'	=> '/^[a-z0-9]+$/', // shared object description
104
+
105
+	'IMG'	=> '/^[123]$/', // image to generate
106
+	'LO'	=> '/^1$/', // login requested
107
+
108
+	'COUNT'	=> '/^\d+$/', // number of line displayed in list
109
+	'SCOPE'	=> '/^[AD]$/', // list view scope
110
+	'SORT1'	=> '/^[AHSMCDTZ]$/', // first sort key
111
+	'SORT2'	=> '/^[DA]$/', // second sort key
112
+	'AGGR'	=> '/^\d+$/', // aggregation by dir level
113 113
 	'SEARCH'	=> '~^[a-zA-Z0-9/_.-]*$~'			// aggregation by dir level
114 114
 );
115 115
 
116 116
 // cache scope
117
-$scope_list=array(
117
+$scope_list = array(
118 118
 	'A' => 'cache_list',
119 119
 	'D' => 'deleted_list'
120 120
 );
@@ -133,31 +133,31 @@  discard block
 block discarded – undo
133 133
 }
134 134
 
135 135
 // check parameter syntax
136
-foreach($vardom as $var => $dom) {
136
+foreach ($vardom as $var => $dom) {
137 137
 	if (!isset($_REQUEST[$var])) {
138
-		$MYREQUEST[$var]=NULL;
139
-	} else if (!is_array($_REQUEST[$var]) && preg_match($dom.'D',$_REQUEST[$var])) {
140
-		$MYREQUEST[$var]=$_REQUEST[$var];
138
+		$MYREQUEST[$var] = NULL;
139
+	} else if (!is_array($_REQUEST[$var]) && preg_match($dom.'D', $_REQUEST[$var])) {
140
+		$MYREQUEST[$var] = $_REQUEST[$var];
141 141
 	} else {
142
-		$MYREQUEST[$var]=$_REQUEST[$var]=NULL;
142
+		$MYREQUEST[$var] = $_REQUEST[$var] = NULL;
143 143
 	}
144 144
 }
145 145
 
146 146
 // check parameter sematics
147
-if (empty($MYREQUEST['SCOPE'])) $MYREQUEST['SCOPE']="A";
148
-if (empty($MYREQUEST['SORT1'])) $MYREQUEST['SORT1']="H";
149
-if (empty($MYREQUEST['SORT2'])) $MYREQUEST['SORT2']="D";
150
-if (empty($MYREQUEST['OB']))	$MYREQUEST['OB']=OB_HOST_STATS;
151
-if (!isset($MYREQUEST['COUNT'])) $MYREQUEST['COUNT']=20;
152
-if (!isset($scope_list[$MYREQUEST['SCOPE']])) $MYREQUEST['SCOPE']='A';
153
-
154
-$MY_SELF=
147
+if (empty($MYREQUEST['SCOPE'])) $MYREQUEST['SCOPE'] = "A";
148
+if (empty($MYREQUEST['SORT1'])) $MYREQUEST['SORT1'] = "H";
149
+if (empty($MYREQUEST['SORT2'])) $MYREQUEST['SORT2'] = "D";
150
+if (empty($MYREQUEST['OB']))	$MYREQUEST['OB'] = OB_HOST_STATS;
151
+if (!isset($MYREQUEST['COUNT'])) $MYREQUEST['COUNT'] = 20;
152
+if (!isset($scope_list[$MYREQUEST['SCOPE']])) $MYREQUEST['SCOPE'] = 'A';
153
+
154
+$MY_SELF =
155 155
 	"$PHP_SELF".
156 156
 	"?SCOPE=".$MYREQUEST['SCOPE'].
157 157
 	"&SORT1=".$MYREQUEST['SORT1'].
158 158
 	"&SORT2=".$MYREQUEST['SORT2'].
159 159
 	"&COUNT=".$MYREQUEST['COUNT'];
160
-$MY_SELF_WO_SORT=
160
+$MY_SELF_WO_SORT =
161 161
 	"$PHP_SELF".
162 162
 	"?SCOPE=".$MYREQUEST['SCOPE'].
163 163
 	"&COUNT=".$MYREQUEST['COUNT'];
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 // authentication needed?
166 166
 //
167 167
 if (!USE_AUTHENTICATION) {
168
-	$AUTHENTICATED=1;
168
+	$AUTHENTICATED = 1;
169 169
 } else {
170
-	$AUTHENTICATED=0;
171
-	if (ADMIN_PASSWORD!='password' && ($MYREQUEST['LO'] == 1 || isset($_SERVER['PHP_AUTH_USER']))) {
170
+	$AUTHENTICATED = 0;
171
+	if (ADMIN_PASSWORD != 'password' && ($MYREQUEST['LO'] == 1 || isset($_SERVER['PHP_AUTH_USER']))) {
172 172
 
173 173
 		if (!isset($_SERVER['PHP_AUTH_USER']) ||
174 174
 			!isset($_SERVER['PHP_AUTH_PW']) ||
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			exit;
188 188
 
189 189
 		} else {
190
-			$AUTHENTICATED=1;
190
+			$AUTHENTICATED = 1;
191 191
 		}
192 192
 	}
193 193
 }
@@ -201,39 +201,39 @@  discard block
 block discarded – undo
201 201
 	apcu_delete($MYREQUEST['DU']);
202 202
 }
203 203
 
204
-if(!function_exists('apcu_cache_info')) {
204
+if (!function_exists('apcu_cache_info')) {
205 205
 	echo "No cache info available.  APC does not appear to be running.";
206 206
   exit;
207 207
 }
208 208
 
209 209
 $cache = apcu_cache_info();
210 210
 
211
-$mem=apcu_sma_info();
211
+$mem = apcu_sma_info();
212 212
 
213 213
 // don't cache this page
214 214
 //
215
-header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
215
+header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
216 216
 header("Cache-Control: post-check=0, pre-check=0", false);
217
-header("Pragma: no-cache");                                    // HTTP/1.0
217
+header("Pragma: no-cache"); // HTTP/1.0
218 218
 
219 219
 function duration($ts) {
220 220
     global $time;
221
-    $years = (int)((($time - $ts)/(7*86400))/52.177457);
222
-    $rem = (int)(($time-$ts)-($years * 52.177457 * 7 * 86400));
223
-    $weeks = (int)(($rem)/(7*86400));
224
-    $days = (int)(($rem)/86400) - $weeks*7;
225
-    $hours = (int)(($rem)/3600) - $days*24 - $weeks*7*24;
226
-    $mins = (int)(($rem)/60) - $hours*60 - $days*24*60 - $weeks*7*24*60;
221
+    $years = (int)((($time - $ts) / (7 * 86400)) / 52.177457);
222
+    $rem = (int)(($time - $ts) - ($years * 52.177457 * 7 * 86400));
223
+    $weeks = (int)(($rem) / (7 * 86400));
224
+    $days = (int)(($rem) / 86400) - $weeks * 7;
225
+    $hours = (int)(($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
226
+    $mins = (int)(($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
227 227
     $str = '';
228
-    if($years==1) $str .= "$years year, ";
229
-    if($years>1) $str .= "$years years, ";
230
-    if($weeks==1) $str .= "$weeks week, ";
231
-    if($weeks>1) $str .= "$weeks weeks, ";
232
-    if($days==1) $str .= "$days day,";
233
-    if($days>1) $str .= "$days days,";
234
-    if($hours == 1) $str .= " $hours hour and";
235
-    if($hours>1) $str .= " $hours hours and";
236
-    if($mins == 1) $str .= " 1 minute";
228
+    if ($years == 1) $str .= "$years year, ";
229
+    if ($years > 1) $str .= "$years years, ";
230
+    if ($weeks == 1) $str .= "$weeks week, ";
231
+    if ($weeks > 1) $str .= "$weeks weeks, ";
232
+    if ($days == 1) $str .= "$days day,";
233
+    if ($days > 1) $str .= "$days days,";
234
+    if ($hours == 1) $str .= " $hours hour and";
235
+    if ($hours > 1) $str .= " $hours hours and";
236
+    if ($mins == 1) $str .= " 1 minute";
237 237
     else $str .= " $mins minutes";
238 238
     return $str;
239 239
 }
@@ -249,207 +249,207 @@  discard block
 block discarded – undo
249 249
 		exit(0);
250 250
 	}
251 251
 
252
-	function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$color2,$text='',$placeindex=0) {
253
-		$r=$diameter/2;
254
-		$w=deg2rad((360+$start+($end-$start)/2)%360);
252
+	function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0) {
253
+		$r = $diameter / 2;
254
+		$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
255 255
 
256 256
 
257 257
 		if (function_exists("imagefilledarc")) {
258 258
 			// exists only if GD 2.0.1 is avaliable
259
-			imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
259
+			imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
260 260
 			imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
261 261
 			imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED);
262 262
 		} else {
263 263
 			imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
264 264
 			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
265
-			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start+1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
266
-			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end-1))   * $r, $centerY + sin(deg2rad($end))   * $r, $color2);
267
-			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end))   * $r, $centerY + sin(deg2rad($end))   * $r, $color2);
268
-			imagefill($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $color2);
265
+			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
266
+			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end - 1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
267
+			imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
268
+			imagefill($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $color2);
269 269
 		}
270 270
 		if ($text) {
271
-			if ($placeindex>0) {
272
-				imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1);
273
-				imagestring($im,4,$diameter, $placeindex*12,$text,$color1);
271
+			if ($placeindex > 0) {
272
+				imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
273
+				imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
274 274
 
275 275
 			} else {
276
-				imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1);
276
+				imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
277 277
 			}
278 278
 		}
279 279
 	}
280 280
 
281
-	function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$text,$placeindex=0) {
282
-		$r=$diameter/2;
283
-		$w=deg2rad((360+$start+($end-$start)/2)%360);
281
+	function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $text, $placeindex = 0) {
282
+		$r = $diameter / 2;
283
+		$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
284 284
 
285
-		if ($placeindex>0) {
286
-			imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1);
287
-			imagestring($im,4,$diameter, $placeindex*12,$text,$color1);
285
+		if ($placeindex > 0) {
286
+			imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
287
+			imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
288 288
 
289 289
 		} else {
290
-			imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1);
290
+			imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
291 291
 		}
292 292
 	}
293 293
 
294
-	function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') {
294
+	function fill_box($im, $x, $y, $w, $h, $color1, $color2, $text = '', $placeindex = '') {
295 295
 		global $col_black;
296
-		$x1=$x+$w-1;
297
-		$y1=$y+$h-1;
296
+		$x1 = $x + $w - 1;
297
+		$y1 = $y + $h - 1;
298 298
 
299
-		imagerectangle($im, $x, $y1, $x1+1, $y+1, $col_black);
300
-		if($y1>$y) imagefilledrectangle($im, $x, $y, $x1, $y1, $color2);
299
+		imagerectangle($im, $x, $y1, $x1 + 1, $y + 1, $col_black);
300
+		if ($y1 > $y) imagefilledrectangle($im, $x, $y, $x1, $y1, $color2);
301 301
 		else imagefilledrectangle($im, $x, $y1, $x1, $y, $color2);
302 302
 		imagerectangle($im, $x, $y1, $x1, $y, $color1);
303 303
 		if ($text) {
304
-			if ($placeindex>0) {
304
+			if ($placeindex > 0) {
305 305
 
306
-				if ($placeindex<16)
306
+				if ($placeindex < 16)
307 307
 				{
308
-					$px=5;
309
-					$py=$placeindex*12+6;
310
-					imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2);
311
-					imageline($im,$x,$y+$h/2,$px+90,$py,$color2);
312
-					imagestring($im,2,$px,$py-6,$text,$color1);
308
+					$px = 5;
309
+					$py = $placeindex * 12 + 6;
310
+					imagefilledrectangle($im, $px + 90, $py + 3, $px + 90 - 4, $py - 3, $color2);
311
+					imageline($im, $x, $y + $h / 2, $px + 90, $py, $color2);
312
+					imagestring($im, 2, $px, $py - 6, $text, $color1);
313 313
 
314 314
 				} else {
315
-					if ($placeindex<31) {
316
-						$px=$x+40*2;
317
-						$py=($placeindex-15)*12+6;
315
+					if ($placeindex < 31) {
316
+						$px = $x + 40 * 2;
317
+						$py = ($placeindex - 15) * 12 + 6;
318 318
 					} else {
319
-						$px=$x+40*2+100*intval(($placeindex-15)/15);
320
-						$py=($placeindex%15)*12+6;
319
+						$px = $x + 40 * 2 + 100 * intval(($placeindex - 15) / 15);
320
+						$py = ($placeindex % 15) * 12 + 6;
321 321
 					}
322
-					imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2);
323
-					imageline($im,$x+$w,$y+$h/2,$px,$py,$color2);
324
-					imagestring($im,2,$px+2,$py-6,$text,$color1);
322
+					imagefilledrectangle($im, $px, $py + 3, $px - 4, $py - 3, $color2);
323
+					imageline($im, $x + $w, $y + $h / 2, $px, $py, $color2);
324
+					imagestring($im, 2, $px + 2, $py - 6, $text, $color1);
325 325
 				}
326 326
 			} else {
327
-				imagestring($im,4,$x+5,$y1-16,$text,$color1);
327
+				imagestring($im, 4, $x + 5, $y1 - 16, $text, $color1);
328 328
 			}
329 329
 		}
330 330
 	}
331 331
 
332 332
 
333 333
 	$size = GRAPH_SIZE; // image size
334
-	if ($MYREQUEST['IMG']==3)
335
-		$image = imagecreate(2*$size+150, $size+10);
334
+	if ($MYREQUEST['IMG'] == 3)
335
+		$image = imagecreate(2 * $size + 150, $size + 10);
336 336
 	else
337
-		$image = imagecreate($size+50, $size+10);
337
+		$image = imagecreate($size + 50, $size + 10);
338 338
 
339 339
 	$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
340
-	$col_red   = imagecolorallocate($image, 0xD0, 0x60,  0x30);
340
+	$col_red   = imagecolorallocate($image, 0xD0, 0x60, 0x30);
341 341
 	$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
342
-	$col_black = imagecolorallocate($image,   0,   0,   0);
343
-	imagecolortransparent($image,$col_white);
342
+	$col_black = imagecolorallocate($image, 0, 0, 0);
343
+	imagecolortransparent($image, $col_white);
344 344
 
345 345
 	switch ($MYREQUEST['IMG']) {
346 346
 
347 347
 	case 1:
348
-		$s=$mem['num_seg']*$mem['seg_size'];
349
-		$a=$mem['avail_mem'];
350
-		$x=$y=$size/2;
348
+		$s = $mem['num_seg'] * $mem['seg_size'];
349
+		$a = $mem['avail_mem'];
350
+		$x = $y = $size / 2;
351 351
 		$fuzz = 0.000001;
352 352
 
353 353
 		// This block of code creates the pie chart.  It is a lot more complex than you
354 354
 		// would expect because we try to visualize any memory fragmentation as well.
355 355
 		$angle_from = 0;
356
-		$string_placement=array();
357
-		for($i=0; $i<$mem['num_seg']; $i++) {
356
+		$string_placement = array();
357
+		for ($i = 0; $i < $mem['num_seg']; $i++) {
358 358
 			$ptr = 0;
359 359
 			$free = $mem['block_lists'][$i];
360 360
 			uasort($free, 'block_sort');
361
-			foreach($free as $block) {
362
-				if($block['offset']!=$ptr) {       // Used block
363
-					$angle_to = $angle_from+($block['offset']-$ptr)/$s;
364
-					if(($angle_to+$fuzz)>1) $angle_to = 1;
365
-					if( ($angle_to*360) - ($angle_from*360) >= 1) {
366
-						fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
367
-						if (($angle_to-$angle_from)>0.05) {
368
-							array_push($string_placement, array($angle_from,$angle_to));
361
+			foreach ($free as $block) {
362
+				if ($block['offset'] != $ptr) {       // Used block
363
+					$angle_to = $angle_from + ($block['offset'] - $ptr) / $s;
364
+					if (($angle_to + $fuzz) > 1) $angle_to = 1;
365
+					if (($angle_to * 360) - ($angle_from * 360) >= 1) {
366
+						fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
367
+						if (($angle_to - $angle_from) > 0.05) {
368
+							array_push($string_placement, array($angle_from, $angle_to));
369 369
 						}
370 370
 					}
371 371
 					$angle_from = $angle_to;
372 372
 				}
373
-				$angle_to = $angle_from+($block['size'])/$s;
374
-				if(($angle_to+$fuzz)>1) $angle_to = 1;
375
-				if( ($angle_to*360) - ($angle_from*360) >= 1) {
376
-					fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_green);
377
-					if (($angle_to-$angle_from)>0.05) {
378
-						array_push($string_placement, array($angle_from,$angle_to));
373
+				$angle_to = $angle_from + ($block['size']) / $s;
374
+				if (($angle_to + $fuzz) > 1) $angle_to = 1;
375
+				if (($angle_to * 360) - ($angle_from * 360) >= 1) {
376
+					fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_green);
377
+					if (($angle_to - $angle_from) > 0.05) {
378
+						array_push($string_placement, array($angle_from, $angle_to));
379 379
 					}
380 380
 				}
381 381
 				$angle_from = $angle_to;
382
-				$ptr = $block['offset']+$block['size'];
382
+				$ptr = $block['offset'] + $block['size'];
383 383
 			}
384 384
 			if ($ptr < $mem['seg_size']) { // memory at the end
385
-				$angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s;
386
-				if(($angle_to+$fuzz)>1) $angle_to = 1;
387
-				fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
388
-				if (($angle_to-$angle_from)>0.05) {
389
-					array_push($string_placement, array($angle_from,$angle_to));
385
+				$angle_to = $angle_from + ($mem['seg_size'] - $ptr) / $s;
386
+				if (($angle_to + $fuzz) > 1) $angle_to = 1;
387
+				fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
388
+				if (($angle_to - $angle_from) > 0.05) {
389
+					array_push($string_placement, array($angle_from, $angle_to));
390 390
 				}
391 391
 			}
392 392
 		}
393 393
 		foreach ($string_placement as $angle) {
394
-			text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0])));
394
+			text_arc($image, $x, $y, $size, $angle[0] * 360, $angle[1] * 360, $col_black, bsize($s * ($angle[1] - $angle[0])));
395 395
 		}
396 396
 		break;
397 397
 
398 398
 	case 2:
399
-		$s=$cache['num_hits']+$cache['num_misses'];
400
-		$a=$cache['num_hits'];
399
+		$s = $cache['num_hits'] + $cache['num_misses'];
400
+		$a = $cache['num_hits'];
401 401
 
402
-		fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['num_hits']*100/$s : 0));
403
-		fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['num_misses']*100/$s : 0));
402
+		fill_box($image, 30, $size, 50, $s ? (-$a * ($size - 21) / $s) : 0, $col_black, $col_green, sprintf("%.1f%%", $s ? $cache['num_hits'] * 100 / $s : 0));
403
+		fill_box($image, 130, $size, 50, $s ? -max(4, ($s - $a) * ($size - 21) / $s) : 0, $col_black, $col_red, sprintf("%.1f%%", $s ? $cache['num_misses'] * 100 / $s : 0));
404 404
 		break;
405 405
 
406 406
 	case 3:
407
-		$s=$mem['num_seg']*$mem['seg_size'];
408
-		$a=$mem['avail_mem'];
409
-		$x=130;
410
-		$y=1;
411
-		$j=1;
407
+		$s = $mem['num_seg'] * $mem['seg_size'];
408
+		$a = $mem['avail_mem'];
409
+		$x = 130;
410
+		$y = 1;
411
+		$j = 1;
412 412
 
413 413
 		// This block of code creates the bar chart.  It is a lot more complex than you
414 414
 		// would expect because we try to visualize any memory fragmentation as well.
415
-		for($i=0; $i<$mem['num_seg']; $i++) {
415
+		for ($i = 0; $i < $mem['num_seg']; $i++) {
416 416
 			$ptr = 0;
417 417
 			$free = $mem['block_lists'][$i];
418 418
 			uasort($free, 'block_sort');
419
-			foreach($free as $block) {
420
-				if($block['offset']!=$ptr) {       // Used block
421
-					$h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s;
422
-					if ($h>0) {
419
+			foreach ($free as $block) {
420
+				if ($block['offset'] != $ptr) {       // Used block
421
+					$h = (GRAPH_SIZE - 5) * ($block['offset'] - $ptr) / $s;
422
+					if ($h > 0) {
423 423
                                                 $j++;
424
-						if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j);
425
-                                                else fill_box($image,$x,$y,50,$h,$col_black,$col_red);
424
+						if ($j < 75) fill_box($image, $x, $y, 50, $h, $col_black, $col_red, bsize($block['offset'] - $ptr), $j);
425
+                                                else fill_box($image, $x, $y, 50, $h, $col_black, $col_red);
426 426
                                         }
427
-					$y+=$h;
427
+					$y += $h;
428 428
 				}
429
-				$h=(GRAPH_SIZE-5)*($block['size'])/$s;
430
-				if ($h>0) {
429
+				$h = (GRAPH_SIZE - 5) * ($block['size']) / $s;
430
+				if ($h > 0) {
431 431
                                         $j++;
432
-					if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j);
433
-					else fill_box($image,$x,$y,50,$h,$col_black,$col_green);
432
+					if ($j < 75) fill_box($image, $x, $y, 50, $h, $col_black, $col_green, bsize($block['size']), $j);
433
+					else fill_box($image, $x, $y, 50, $h, $col_black, $col_green);
434 434
                                 }
435
-				$y+=$h;
436
-				$ptr = $block['offset']+$block['size'];
435
+				$y += $h;
436
+				$ptr = $block['offset'] + $block['size'];
437 437
 			}
438 438
 			if ($ptr < $mem['seg_size']) { // memory at the end
439
-				$h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s;
439
+				$h = (GRAPH_SIZE - 5) * ($mem['seg_size'] - $ptr) / $s;
440 440
 				if ($h > 0) {
441
-					fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++);
441
+					fill_box($image, $x, $y, 50, $h, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j++);
442 442
 				}
443 443
 			}
444 444
 		}
445 445
 		break;
446 446
 
447 447
 		case 4:
448
-			$s=$cache['num_hits']+$cache['num_misses'];
449
-			$a=$cache['num_hits'];
448
+			$s = $cache['num_hits'] + $cache['num_misses'];
449
+			$a = $cache['num_hits'];
450 450
 
451
-			fill_box($image, 30,$size,50,$s ? -$a*($size-21)/$s : 0,$col_black,$col_green,sprintf("%.1f%%", $s ? $cache['num_hits']*100/$s : 0));
452
-			fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%", $s ? $cache['num_misses']*100/$s : 0));
451
+			fill_box($image, 30, $size, 50, $s ? -$a * ($size - 21) / $s : 0, $col_black, $col_green, sprintf("%.1f%%", $s ? $cache['num_hits'] * 100 / $s : 0));
452
+			fill_box($image, 130, $size, 50, $s ? -max(4, ($s - $a) * ($size - 21) / $s) : 0, $col_black, $col_red, sprintf("%.1f%%", $s ? $cache['num_misses'] * 100 / $s : 0));
453 453
 		break;
454 454
 	}
455 455
 
@@ -461,28 +461,28 @@  discard block
 block discarded – undo
461 461
 // pretty printer for byte values
462 462
 //
463 463
 function bsize($s) {
464
-	foreach (array('','K','M','G') as $i => $k) {
464
+	foreach (array('', 'K', 'M', 'G') as $i => $k) {
465 465
 		if ($s < 1024) break;
466
-		$s/=1024;
466
+		$s /= 1024;
467 467
 	}
468
-	return sprintf("%5.1f %sBytes",$s,$k);
468
+	return sprintf("%5.1f %sBytes", $s, $k);
469 469
 }
470 470
 
471 471
 // sortable table header in "scripts for this host" view
472
-function sortheader($key,$name,$extra='') {
472
+function sortheader($key, $name, $extra = '') {
473 473
 	global $MYREQUEST, $MY_SELF_WO_SORT;
474 474
 
475
-	if ($MYREQUEST['SORT1']==$key) {
476
-		$MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : 'A';
475
+	if ($MYREQUEST['SORT1'] == $key) {
476
+		$MYREQUEST['SORT2'] = $MYREQUEST['SORT2'] == 'A' ? 'D' : 'A';
477 477
 	}
478 478
 	return "<a class=sortable href=\"$MY_SELF_WO_SORT$extra&SORT1=$key&SORT2=".$MYREQUEST['SORT2']."\">$name</a>";
479 479
 
480 480
 }
481 481
 
482 482
 // create menu entry
483
-function menu_entry($ob,$title) {
484
-	global $MYREQUEST,$MY_SELF;
485
-	if ($MYREQUEST['OB']!=$ob) {
483
+function menu_entry($ob, $title) {
484
+	global $MYREQUEST, $MY_SELF;
485
+	if ($MYREQUEST['OB'] != $ob) {
486 486
 		return "<li><a href=\"$MY_SELF&OB=$ob\">$title</a></li>";
487 487
 	} else if (empty($MYREQUEST['SH'])) {
488 488
 		return "<li><span class=active>$title</span></li>";
@@ -491,14 +491,14 @@  discard block
 block discarded – undo
491 491
 	}
492 492
 }
493 493
 
494
-function put_login_link($s="Login")
494
+function put_login_link($s = "Login")
495 495
 {
496
-	global $MY_SELF,$MYREQUEST,$AUTHENTICATED;
496
+	global $MY_SELF, $MYREQUEST, $AUTHENTICATED;
497 497
 	// needs ADMIN_PASSWORD to be changed!
498 498
 	//
499 499
 	if (!USE_AUTHENTICATION) {
500 500
 		return;
501
-	} else if (ADMIN_PASSWORD=='password')
501
+	} else if (ADMIN_PASSWORD == 'password')
502 502
 	{
503 503
 		print <<<EOB
504 504
 			<a href="#" onClick="javascript:alert('You need to set a password at the top of apc.php before this will work!');return false";>$s</a>
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 		print <<<EOB
508 508
 			'{$_SERVER['PHP_AUTH_USER']}'&nbsp;logged&nbsp;in!
509 509
 EOB;
510
-	} else{
510
+	} else {
511 511
 		print <<<EOB
512 512
 			<a href="$MY_SELF&LO=1&OB={$MYREQUEST['OB']}">$s</a>
513 513
 EOB;
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 	<li><a href="$MY_SELF&OB={$MYREQUEST['OB']}&SH={$MYREQUEST['SH']}">Refresh Data</a></li>
745 745
 EOB;
746 746
 echo
747
-	menu_entry(OB_HOST_STATS,'View Host Stats'),
748
-	menu_entry(OB_USER_CACHE,'User Cache Entries'),
749
-	menu_entry(OB_VERSION_CHECK,'Version Check');
747
+	menu_entry(OB_HOST_STATS, 'View Host Stats'),
748
+	menu_entry(OB_USER_CACHE, 'User Cache Entries'),
749
+	menu_entry(OB_VERSION_CHECK, 'Version Check');
750 750
 
751 751
 if ($AUTHENTICATED) {
752 752
 	echo <<<EOB
@@ -770,19 +770,19 @@  discard block
 block discarded – undo
770 770
 // Host Stats
771 771
 // -----------------------------------------------
772 772
 case OB_HOST_STATS:
773
-	$mem_size = $mem['num_seg']*$mem['seg_size'];
774
-	$mem_avail= $mem['avail_mem'];
775
-	$mem_used = $mem_size-$mem_avail;
773
+	$mem_size = $mem['num_seg'] * $mem['seg_size'];
774
+	$mem_avail = $mem['avail_mem'];
775
+	$mem_used = $mem_size - $mem_avail;
776 776
 	$seg_size = bsize($mem['seg_size']);
777
-	$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']+$cache['num_misses'])/($time-$cache['start_time'])) : 0);
778
-	$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'])/($time-$cache['start_time'])) : 0);
779
-	$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses'])/($time-$cache['start_time'])) : 0);
780
-	$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts'])/($time-$cache['start_time'])) : 0);
777
+	$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'] + $cache['num_misses']) / ($time - $cache['start_time'])) : 0);
778
+	$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']) / ($time - $cache['start_time'])) : 0);
779
+	$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses']) / ($time - $cache['start_time'])) : 0);
780
+	$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts']) / ($time - $cache['start_time'])) : 0);
781 781
 	$apcversion = phpversion('apcu');
782 782
 	$phpversion = phpversion();
783 783
 	$number_vars = $cache['num_entries'];
784 784
     $size_vars = bsize($cache['mem_size']);
785
-	$i=0;
785
+	$i = 0;
786 786
 	echo <<< EOB
787 787
 		<div class="info div1"><h2>General Cache Information</h2>
788 788
 		<table cellspacing=0><tbody>
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
 		<tr class=tr-1><td class=td-0>PHP Version</td><td>$phpversion</td></tr>
791 791
 EOB;
792 792
 
793
-	if(!empty($_SERVER['SERVER_NAME']))
793
+	if (!empty($_SERVER['SERVER_NAME']))
794 794
 		echo "<tr class=tr-0><td class=td-0>APCu Host</td><td>{$_SERVER['SERVER_NAME']} $host</td></tr>\n";
795
-	if(!empty($_SERVER['SERVER_SOFTWARE']))
795
+	if (!empty($_SERVER['SERVER_SOFTWARE']))
796 796
 		echo "<tr class=tr-1><td class=td-0>Server Software</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n";
797 797
 
798 798
 	echo <<<EOB
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
     <br/> ({$cache['memory_type']} memory)
801 801
     </td></tr>
802 802
 EOB;
803
-	echo   '<tr class=tr-1><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$cache['start_time']),'</td></tr>';
804
-	echo   '<tr class=tr-0><td class=td-0>Uptime</td><td>',duration($cache['start_time']),'</td></tr>';
803
+	echo   '<tr class=tr-1><td class=td-0>Start Time</td><td>', date(DATE_FORMAT, $cache['start_time']), '</td></tr>';
804
+	echo   '<tr class=tr-0><td class=td-0>Uptime</td><td>', duration($cache['start_time']), '</td></tr>';
805 805
 	echo <<<EOB
806 806
 		</tbody></table>
807 807
 		</div>
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 
827 827
 	$j = 0;
828 828
 	foreach (ini_get_all('apcu') as $k => $v) {
829
-		echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>",str_replace(',',',<br />',$v['local_value']),"</td></tr>\n";
829
+		echo "<tr class=tr-$j><td class=td-0>", $k, "</td><td>", str_replace(',', ',<br />', $v['local_value']), "</td></tr>\n";
830 830
 		$j = 1 - $j;
831 831
 	}
832 832
 
833
-	if($mem['num_seg']>1 || $mem['num_seg']==1 && count($mem['block_lists'][0])>1)
833
+	if ($mem['num_seg'] > 1 || $mem['num_seg'] == 1 && count($mem['block_lists'][0]) > 1)
834 834
 		$mem_note = "Memory Usage<br /><font size=-2>(multiple slices indicate fragments)</font>";
835 835
 	else
836 836
 		$mem_note = "Memory Usage";
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		<div class="graph div3"><h2>Host Status Diagrams</h2>
843 843
 		<table cellspacing=0><tbody>
844 844
 EOB;
845
-	$size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10);
845
+	$size = 'width='.(GRAPH_SIZE + 50).' height='.(GRAPH_SIZE + 10);
846 846
 echo <<<EOB
847 847
 		<tr>
848 848
 		<td class=td-0>$mem_note</td>
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
 			  "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n"
858 858
 			: "",
859 859
 		'<tr>',
860
-		'<td class=td-0><span class="green box">&nbsp;</span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
861
-		'<td class=td-1><span class="green box">&nbsp;</span>Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n",
860
+		'<td class=td-0><span class="green box">&nbsp;</span>Free: ', bsize($mem_avail).sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size), "</td>\n",
861
+		'<td class=td-1><span class="green box">&nbsp;</span>Hits: ', $cache['num_hits'].@sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses'])), "</td>\n",
862 862
 		'</tr>',
863 863
 		'<tr>',
864
-		'<td class=td-0><span class="red box">&nbsp;</span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
865
-		'<td class=td-1><span class="red box">&nbsp;</span>Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n";
864
+		'<td class=td-0><span class="red box">&nbsp;</span>Used: ', bsize($mem_used).sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size), "</td>\n",
865
+		'<td class=td-1><span class="red box">&nbsp;</span>Misses: ', $cache['num_misses'].@sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses'])), "</td>\n";
866 866
 	echo <<< EOB
867 867
 		</tr>
868 868
 		</tbody></table>
@@ -876,28 +876,28 @@  discard block
 block discarded – undo
876 876
 
877 877
 	// Fragementation: (freeseg - 1) / total_seg
878 878
 	$nseg = $freeseg = $fragsize = $freetotal = 0;
879
-	for($i=0; $i<$mem['num_seg']; $i++) {
879
+	for ($i = 0; $i < $mem['num_seg']; $i++) {
880 880
 		$ptr = 0;
881
-		foreach($mem['block_lists'][$i] as $block) {
881
+		foreach ($mem['block_lists'][$i] as $block) {
882 882
 			if ($block['offset'] != $ptr) {
883 883
 				++$nseg;
884 884
 			}
885 885
 			$ptr = $block['offset'] + $block['size'];
886 886
                         /* Only consider blocks <5M for the fragmentation % */
887
-                        if($block['size']<(5*1024*1024)) $fragsize+=$block['size'];
888
-                        $freetotal+=$block['size'];
887
+                        if ($block['size'] < (5 * 1024 * 1024)) $fragsize += $block['size'];
888
+                        $freetotal += $block['size'];
889 889
 		}
890 890
 		$freeseg += count($mem['block_lists'][$i]);
891 891
 	}
892 892
 
893 893
 	if ($freeseg > 1) {
894
-		$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg);
894
+		$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg);
895 895
 	} else {
896 896
 		$frag = "0%";
897 897
 	}
898 898
 
899 899
 	if (graphics_avail()) {
900
-		$size='width='.(2*GRAPH_SIZE+150).' height='.(GRAPH_SIZE+10);
900
+		$size = 'width='.(2 * GRAPH_SIZE + 150).' height='.(GRAPH_SIZE + 10);
901 901
 		echo <<<EOB
902 902
 			<img alt="" $size src="$PHP_SELF?IMG=3&$time">
903 903
 EOB;
@@ -907,10 +907,10 @@  discard block
 block discarded – undo
907 907
 		</td>
908 908
 		</tr>
909 909
 EOB;
910
-        if(isset($mem['adist'])) {
911
-          foreach($mem['adist'] as $i=>$v) {
912
-            $cur = pow(2,$i); $nxt = pow(2,$i+1)-1;
913
-            if($i==0) $range = "1";
910
+        if (isset($mem['adist'])) {
911
+          foreach ($mem['adist'] as $i=>$v) {
912
+            $cur = pow(2, $i); $nxt = pow(2, $i + 1) - 1;
913
+            if ($i == 0) $range = "1";
914 914
             else $range = "$cur - $nxt";
915 915
             echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n";
916 916
           }
@@ -933,47 +933,47 @@  discard block
 block discarded – undo
933 933
 		echo '</div>';
934 934
 		break;
935 935
 	}
936
-	$fieldname='info';
937
-	$fieldheading='User Entry Label';
938
-	$fieldkey='info';
936
+	$fieldname = 'info';
937
+	$fieldheading = 'User Entry Label';
938
+	$fieldkey = 'info';
939 939
 
940
-	$cols=6;
940
+	$cols = 6;
941 941
 	echo <<<EOB
942 942
 		<div class=sorting><form>Scope:
943 943
 		<input type=hidden name=OB value={$MYREQUEST['OB']}>
944 944
 		<select name=SCOPE>
945 945
 EOB;
946 946
 	echo
947
-		"<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>",
948
-		"<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>",
947
+		"<option value=A", $MYREQUEST['SCOPE'] == 'A' ? " selected" : "", ">Active</option>",
948
+		"<option value=D", $MYREQUEST['SCOPE'] == 'D' ? " selected" : "", ">Deleted</option>",
949 949
 		"</select>",
950 950
 		", Sorting:<select name=SORT1>",
951
-		"<option value=H",$MYREQUEST['SORT1']=='H' ? " selected":"",">Hits</option>",
952
-		"<option value=Z",$MYREQUEST['SORT1']=='Z' ? " selected":"",">Size</option>",
953
-		"<option value=S",$MYREQUEST['SORT1']=='S' ? " selected":"",">$fieldheading</option>",
954
-		"<option value=A",$MYREQUEST['SORT1']=='A' ? " selected":"",">Last accessed</option>",
955
-		"<option value=M",$MYREQUEST['SORT1']=='M' ? " selected":"",">Last modified</option>",
956
-		"<option value=C",$MYREQUEST['SORT1']=='C' ? " selected":"",">Created at</option>",
957
-		"<option value=D",$MYREQUEST['SORT1']=='D' ? " selected":"",">Deleted at</option>";
958
-	if($fieldname=='info') echo
959
-		"<option value=D",$MYREQUEST['SORT1']=='T' ? " selected":"",">Timeout</option>";
951
+		"<option value=H", $MYREQUEST['SORT1'] == 'H' ? " selected" : "", ">Hits</option>",
952
+		"<option value=Z", $MYREQUEST['SORT1'] == 'Z' ? " selected" : "", ">Size</option>",
953
+		"<option value=S", $MYREQUEST['SORT1'] == 'S' ? " selected" : "", ">$fieldheading</option>",
954
+		"<option value=A", $MYREQUEST['SORT1'] == 'A' ? " selected" : "", ">Last accessed</option>",
955
+		"<option value=M", $MYREQUEST['SORT1'] == 'M' ? " selected" : "", ">Last modified</option>",
956
+		"<option value=C", $MYREQUEST['SORT1'] == 'C' ? " selected" : "", ">Created at</option>",
957
+		"<option value=D", $MYREQUEST['SORT1'] == 'D' ? " selected" : "", ">Deleted at</option>";
958
+	if ($fieldname == 'info') echo
959
+		"<option value=D", $MYREQUEST['SORT1'] == 'T' ? " selected" : "", ">Timeout</option>";
960 960
 	echo
961 961
 		'</select>',
962 962
 		'<select name=SORT2>',
963
-		'<option value=D',$MYREQUEST['SORT2']=='D' ? ' selected':'','>DESC</option>',
964
-		'<option value=A',$MYREQUEST['SORT2']=='A' ? ' selected':'','>ASC</option>',
963
+		'<option value=D', $MYREQUEST['SORT2'] == 'D' ? ' selected' : '', '>DESC</option>',
964
+		'<option value=A', $MYREQUEST['SORT2'] == 'A' ? ' selected' : '', '>ASC</option>',
965 965
 		'</select>',
966 966
 		'<select name=COUNT onChange="form.submit()">',
967
-		'<option value=10 ',$MYREQUEST['COUNT']=='10' ? ' selected':'','>Top 10</option>',
968
-		'<option value=20 ',$MYREQUEST['COUNT']=='20' ? ' selected':'','>Top 20</option>',
969
-		'<option value=50 ',$MYREQUEST['COUNT']=='50' ? ' selected':'','>Top 50</option>',
970
-		'<option value=100',$MYREQUEST['COUNT']=='100'? ' selected':'','>Top 100</option>',
971
-		'<option value=150',$MYREQUEST['COUNT']=='150'? ' selected':'','>Top 150</option>',
972
-		'<option value=200',$MYREQUEST['COUNT']=='200'? ' selected':'','>Top 200</option>',
973
-		'<option value=500',$MYREQUEST['COUNT']=='500'? ' selected':'','>Top 500</option>',
974
-		'<option value=0  ',$MYREQUEST['COUNT']=='0'  ? ' selected':'','>All</option>',
967
+		'<option value=10 ', $MYREQUEST['COUNT'] == '10' ? ' selected' : '', '>Top 10</option>',
968
+		'<option value=20 ', $MYREQUEST['COUNT'] == '20' ? ' selected' : '', '>Top 20</option>',
969
+		'<option value=50 ', $MYREQUEST['COUNT'] == '50' ? ' selected' : '', '>Top 50</option>',
970
+		'<option value=100', $MYREQUEST['COUNT'] == '100' ? ' selected' : '', '>Top 100</option>',
971
+		'<option value=150', $MYREQUEST['COUNT'] == '150' ? ' selected' : '', '>Top 150</option>',
972
+		'<option value=200', $MYREQUEST['COUNT'] == '200' ? ' selected' : '', '>Top 200</option>',
973
+		'<option value=500', $MYREQUEST['COUNT'] == '500' ? ' selected' : '', '>Top 500</option>',
974
+		'<option value=0  ', $MYREQUEST['COUNT'] == '0' ? ' selected' : '', '>All</option>',
975 975
 		'</select>',
976
-    '&nbsp; Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>',
976
+    '&nbsp; Search: <input name=SEARCH value="', $MYREQUEST['SEARCH'], '" type=text size=25/>',
977 977
 		'&nbsp;<input type=submit value="GO!">',
978 978
 		'</form></div>';
979 979
 
@@ -990,39 +990,39 @@  discard block
 block discarded – undo
990 990
   echo
991 991
 		'<div class="info"><table cellspacing=0><tbody>',
992 992
 		'<tr>',
993
-		'<th>',sortheader('S',$fieldheading,  "&OB=".$MYREQUEST['OB']),'</th>',
994
-		'<th>',sortheader('H','Hits',         "&OB=".$MYREQUEST['OB']),'</th>',
995
-		'<th>',sortheader('Z','Size',         "&OB=".$MYREQUEST['OB']),'</th>',
996
-		'<th>',sortheader('A','Last accessed',"&OB=".$MYREQUEST['OB']),'</th>',
997
-		'<th>',sortheader('M','Last modified',"&OB=".$MYREQUEST['OB']),'</th>',
998
-		'<th>',sortheader('C','Created at',   "&OB=".$MYREQUEST['OB']),'</th>';
999
-
1000
-	if($fieldname=='info') {
1001
-		$cols+=2;
1002
-		 echo '<th>',sortheader('T','Timeout',"&OB=".$MYREQUEST['OB']),'</th>';
993
+		'<th>', sortheader('S', $fieldheading, "&OB=".$MYREQUEST['OB']), '</th>',
994
+		'<th>', sortheader('H', 'Hits', "&OB=".$MYREQUEST['OB']), '</th>',
995
+		'<th>', sortheader('Z', 'Size', "&OB=".$MYREQUEST['OB']), '</th>',
996
+		'<th>', sortheader('A', 'Last accessed', "&OB=".$MYREQUEST['OB']), '</th>',
997
+		'<th>', sortheader('M', 'Last modified', "&OB=".$MYREQUEST['OB']), '</th>',
998
+		'<th>', sortheader('C', 'Created at', "&OB=".$MYREQUEST['OB']), '</th>';
999
+
1000
+	if ($fieldname == 'info') {
1001
+		$cols += 2;
1002
+		 echo '<th>', sortheader('T', 'Timeout', "&OB=".$MYREQUEST['OB']), '</th>';
1003 1003
 	}
1004
-	echo '<th>',sortheader('D','Deleted at',"&OB=".$MYREQUEST['OB']),'</th></tr>';
1004
+	echo '<th>', sortheader('D', 'Deleted at', "&OB=".$MYREQUEST['OB']), '</th></tr>';
1005 1005
 
1006 1006
 	// builds list with alpha numeric sortable keys
1007 1007
 	//
1008 1008
 	$list = array();
1009 1009
 
1010
-	foreach($cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) {
1011
-		switch($MYREQUEST['SORT1']) {
1012
-			case 'A': $k=sprintf('%015d-',$entry['access_time']);  	     break;
1013
-			case 'H': $k=sprintf('%015d-',$entry['num_hits']); 	     break;
1014
-			case 'Z': $k=sprintf('%015d-',$entry['mem_size']); 	     break;
1015
-			case 'M': $k=sprintf('%015d-',$entry['mtime']);  break;
1016
-			case 'C': $k=sprintf('%015d-',$entry['creation_time']);      break;
1017
-			case 'T': $k=sprintf('%015d-',$entry['ttl']);		     break;
1018
-			case 'D': $k=sprintf('%015d-',$entry['deletion_time']);      break;
1019
-			case 'S': $k=$entry["info"];				     break;
1010
+	foreach ($cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) {
1011
+		switch ($MYREQUEST['SORT1']) {
1012
+			case 'A': $k = sprintf('%015d-', $entry['access_time']); break;
1013
+			case 'H': $k = sprintf('%015d-', $entry['num_hits']); break;
1014
+			case 'Z': $k = sprintf('%015d-', $entry['mem_size']); break;
1015
+			case 'M': $k = sprintf('%015d-', $entry['mtime']); break;
1016
+			case 'C': $k = sprintf('%015d-', $entry['creation_time']); break;
1017
+			case 'T': $k = sprintf('%015d-', $entry['ttl']); break;
1018
+			case 'D': $k = sprintf('%015d-', $entry['deletion_time']); break;
1019
+			case 'S': $k = $entry["info"]; break;
1020 1020
 		}
1021 1021
 		if (!$AUTHENTICATED) {
1022 1022
 			// hide all path entries if not logged in
1023
-			$list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','*hidden*/',$entry);
1023
+			$list[$k.$entry[$fieldname]] = preg_replace('/^.*(\\/|\\\\)/', '*hidden*/', $entry);
1024 1024
 		} else {
1025
-			$list[$k.$entry[$fieldname]]=$entry;
1025
+			$list[$k.$entry[$fieldname]] = $entry;
1026 1026
 		}
1027 1027
 	}
1028 1028
 
@@ -1030,34 +1030,34 @@  discard block
 block discarded – undo
1030 1030
 		// sort list
1031 1031
 		//
1032 1032
 		switch ($MYREQUEST['SORT2']) {
1033
-			case "A":	krsort($list);	break;
1034
-			case "D":	ksort($list);	break;
1033
+			case "A":	krsort($list); break;
1034
+			case "D":	ksort($list); break;
1035 1035
 		}
1036 1036
 
1037 1037
 		// output list
1038
-		$i=0;
1039
-		foreach($list as $k => $entry) {
1040
-      if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) {
1041
-		$sh=md5($entry["info"]);
1042
-        $field_value = htmlentities(strip_tags($entry[$fieldname],''), ENT_QUOTES, 'UTF-8');
1038
+		$i = 0;
1039
+		foreach ($list as $k => $entry) {
1040
+      if (!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) {
1041
+		$sh = md5($entry["info"]);
1042
+        $field_value = htmlentities(strip_tags($entry[$fieldname], ''), ENT_QUOTES, 'UTF-8');
1043 1043
         echo
1044
-          '<tr id="key-'. $sh .'" class=tr-',$i%2,'>',
1045
-          "<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",$sh,"#key-". $sh ."\">",$field_value,'</a></td>',
1046
-          '<td class="td-n center">',$entry['num_hits'],'</td>',
1047
-          '<td class="td-n right">',$entry['mem_size'],'</td>',
1048
-          '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>',
1049
-          '<td class="td-n center">',date(DATE_FORMAT,$entry['mtime']),'</td>',
1050
-          '<td class="td-n center">',date(DATE_FORMAT,$entry['creation_time']),'</td>';
1051
-
1052
-        if($fieldname=='info') {
1053
-          if($entry['ttl'])
1044
+          '<tr id="key-'.$sh.'" class=tr-', $i % 2, '>',
1045
+          "<td class=td-0><a href=\"$MY_SELF&OB=", $MYREQUEST['OB'], "&SH=", $sh, "#key-".$sh."\">", $field_value, '</a></td>',
1046
+          '<td class="td-n center">', $entry['num_hits'], '</td>',
1047
+          '<td class="td-n right">', $entry['mem_size'], '</td>',
1048
+          '<td class="td-n center">', date(DATE_FORMAT, $entry['access_time']), '</td>',
1049
+          '<td class="td-n center">', date(DATE_FORMAT, $entry['mtime']), '</td>',
1050
+          '<td class="td-n center">', date(DATE_FORMAT, $entry['creation_time']), '</td>';
1051
+
1052
+        if ($fieldname == 'info') {
1053
+          if ($entry['ttl'])
1054 1054
             echo '<td class="td-n center">'.$entry['ttl'].' seconds</td>';
1055 1055
           else
1056 1056
             echo '<td class="td-n center">None</td>';
1057 1057
         }
1058 1058
         if ($entry['deletion_time']) {
1059 1059
 
1060
-          echo '<td class="td-last center">', date(DATE_FORMAT,$entry['deletion_time']), '</td>';
1060
+          echo '<td class="td-last center">', date(DATE_FORMAT, $entry['deletion_time']), '</td>';
1061 1061
         } else if ($MYREQUEST['OB'] == OB_USER_CACHE) {
1062 1062
 
1063 1063
           echo '<td class="td-last center">';
@@ -1079,14 +1079,14 @@  discard block
 block discarded – undo
1079 1079
 		}
1080 1080
 
1081 1081
 	} else {
1082
-		echo '<tr class=tr-0><td class="center" colspan=',$cols,'><i>No data</i></td></tr>';
1082
+		echo '<tr class=tr-0><td class="center" colspan=', $cols, '><i>No data</i></td></tr>';
1083 1083
 	}
1084 1084
 	echo <<< EOB
1085 1085
 		</tbody></table>
1086 1086
 EOB;
1087 1087
 
1088 1088
 	if ($list && $i < count($list)) {
1089
-		echo "<a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&COUNT=0\"><i>",count($list)-$i,' more available...</i></a>';
1089
+		echo "<a href=\"$MY_SELF&OB=", $MYREQUEST['OB'], "&COUNT=0\"><i>", count($list) - $i, ' more available...</i></a>';
1090 1090
 	}
1091 1091
 
1092 1092
 	echo <<< EOB
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 		</tr>
1107 1107
 EOB;
1108 1108
   if (defined('PROXY')) {
1109
-    $ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) );
1109
+    $ctxt = stream_context_create(array('http' => array('proxy' => PROXY, 'request_fulluri' => True)));
1110 1110
     $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss", False, $ctxt);
1111 1111
   } else {
1112 1112
     $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss");
Please login to merge, or discard this patch.
calendar/inc/class.calendar_wizard_import_csv.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		// List each custom field
37 37
 		unset($this->mapping_fields['customfields']);
38 38
 		$custom = Api\Storage\Customfields::get('calendar');
39
-		foreach($custom as $name => $data) {
39
+		foreach ($custom as $name => $data) {
40 40
 			$this->mapping_fields['#'.$name] = $data['label'];
41 41
 		}
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
57 57
 	{
58 58
 		$result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv);
59
-		$content['msg'] .= "\n*" ;
59
+		$content['msg'] .= "\n*";
60 60
 
61 61
 		return $result;
62 62
 	}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			'id'	=>	'Calendar ID'
72 72
 		);
73 73
 		
74
-		if(!$content['skip_conflicts'] && $content['plugin_options']['skip_conflicts'])
74
+		if (!$content['skip_conflicts'] && $content['plugin_options']['skip_conflicts'])
75 75
 		{
76 76
 			$content['skip_conflicts'] = $content['plugin_options']['skip_conflicts'];
77 77
 		}
Please login to merge, or discard this patch.
doc/test-cli.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		// Find all /test/*Test.php files/classes
34 34
 		foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file)
35 35
 		{
36
-			if ($file->isFile() && preg_match('|/test/[^/]+Test\.php$|', $path=$file->getPathname()))
36
+			if ($file->isFile() && preg_match('|/test/[^/]+Test\.php$|', $path = $file->getPathname()))
37 37
 			{
38 38
 				// Include the test suite, as it is NOT autoloadable in test directory!
39 39
 				require_once($path);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 					$class = 'EGroupware\\'.ucfirst($matches[1]);
47 47
 					if (!empty($matches[2]))
48 48
 					{
49
-						foreach(explode('/', $matches[3]) as $name)
49
+						foreach (explode('/', $matches[3]) as $name)
50 50
 						{
51 51
 							$class .= '\\'.ucfirst($name);
52 52
 						}
Please login to merge, or discard this patch.
api/src/loader/deprecated_factory.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function CreateObject($class)
29 29
 {
30
-	list($appname,$classname) = explode('.',$class);
30
+	list($appname, $classname) = explode('.', $class);
31 31
 
32 32
 	if (!class_exists($classname))
33 33
 	{
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				$classname = $replace[$classname];
54 54
 			}
55 55
 		}
56
-		if (!file_exists($f=EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php'))
56
+		if (!file_exists($f = EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php'))
57 57
 		{
58 58
 			throw new Api\Exception\AssertionFailed(__FUNCTION__."($classname) file $f not found!");
59 59
 		}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		require_once(EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
62 62
 	}
63 63
 	$args = func_get_args();
64
-	switch(count($args))
64
+	switch (count($args))
65 65
 	{
66 66
 		case 1:
67 67
 			$obj = new $classname;
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
 			$obj = new $classname($args[1]);
71 71
 			break;
72 72
 		case 3:
73
-			$obj = new $classname($args[1],$args[2]);
73
+			$obj = new $classname($args[1], $args[2]);
74 74
 			break;
75 75
 		case 4:
76
-			$obj = new $classname($args[1],$args[2],$args[3]);
76
+			$obj = new $classname($args[1], $args[2], $args[3]);
77 77
 			break;
78 78
 		default:
79
-			$code = '$obj = new ' . $classname . '(';
80
-			foreach(array_keys($args) as $n)
79
+			$code = '$obj = new '.$classname.'(';
80
+			foreach (array_keys($args) as $n)
81 81
 			{
82 82
 				if ($n)
83 83
 				{
84
-					$code .= ($n > 1 ? ',' : '') . '$args[' . $n . ']';
84
+					$code .= ($n > 1 ? ',' : '').'$args['.$n.']';
85 85
 				}
86 86
 			}
87 87
 			$code .= ');';
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 {
108 108
 	if (!is_callable($acm))
109 109
 	{
110
-		list(,$class,$method) = explode('.',$acm);
110
+		list(,$class, $method) = explode('.', $acm);
111 111
 
112 112
 		if (class_exists($class))
113 113
 		{
@@ -118,17 +118,17 @@  discard block
 block discarded – undo
118 118
 			$obj = CreateObject($acm);
119 119
 		}
120 120
 
121
-		if (!method_exists($obj,$method))
121
+		if (!method_exists($obj, $method))
122 122
 		{
123 123
 			echo "<p><b>".function_backtrace()."</b>: no methode '$method' in class '$class'</p>\n";
124 124
 			return False;
125 125
 		}
126
-		$acm = array($obj,$method);
126
+		$acm = array($obj, $method);
127 127
 	}
128 128
 	$args = func_get_args();
129 129
 	unset($args[0]);
130 130
 
131
-	return call_user_func_array($acm,$args);
131
+	return call_user_func_array($acm, $args);
132 132
 }
133 133
 
134 134
 /**
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function ExecMethod($method, $functionparam = '_UNDEF_', $loglevel = 3, $classparams = '_UNDEF_')
148 148
 {
149
-	unset($loglevel);	// not used
149
+	unset($loglevel); // not used
150 150
 	/* Need to make sure this is working against a single dimensional object */
151
-	$partscount = count(explode('.',$method)) - 1;
151
+	$partscount = count(explode('.', $method)) - 1;
152 152
 
153 153
 	if (!is_callable($method) && $partscount == 2)
154 154
 	{
155
-		list($appname,$classname,$functionname) = explode(".", $method);
155
+		list($appname, $classname, $functionname) = explode(".", $method);
156 156
 
157 157
 		if ($classparams != '_UNDEF_' && ($classparams || $classparams != 'True'))
158 158
 		{
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 	if (is_callable($method))
178 178
 	{
179
-		return $functionparam != '_UNDEF_' ? call_user_func($method,$functionparam) : call_user_func($method);
179
+		return $functionparam != '_UNDEF_' ? call_user_func($method, $functionparam) : call_user_func($method);
180 180
 	}
181 181
 	error_log("ExecMethod('$method', ...) Error in parts! ".function_backtrace());
182 182
 	return false;
Please login to merge, or discard this patch.
api/ntlm/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 function check_domain($url)
23 23
 {
24 24
 	$whitelisted = array(
25
-		$_SERVER['HTTP_HOST'],	// can contain :port
25
+		$_SERVER['HTTP_HOST'], // can contain :port
26 26
 		// add additional domains-names (just full qualified hostnames) here
27 27
 
28 28
 	);
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 	if (isset($_SERVER['REMOTE_USER']) && $_SERVER['REMOTE_USER'] && isset($_SERVER['AUTH_TYPE']) &&
52 52
 		isset($GLOBALS['egw_info']['server']['http_auth_types']) && $GLOBALS['egw_info']['server']['http_auth_types'] &&
53
-		in_array(strtoupper($_SERVER['AUTH_TYPE']),explode(',',strtoupper($GLOBALS['egw_info']['server']['http_auth_types']))))
53
+		in_array(strtoupper($_SERVER['AUTH_TYPE']), explode(',', strtoupper($GLOBALS['egw_info']['server']['http_auth_types']))))
54 54
 	{
55
-		if (strpos($account=$_SERVER['REMOTE_USER'],'\\') !== false)
55
+		if (strpos($account = $_SERVER['REMOTE_USER'], '\\') !== false)
56 56
 		{
57
-			list(,$account) = explode('\\',$account,2);
57
+			list(,$account) = explode('\\', $account, 2);
58 58
 		}
59
-		$sessionid = $GLOBALS['egw']->session->create($account,null,'ntlm',false,false);	// false=no auth check
59
+		$sessionid = $GLOBALS['egw']->session->create($account, null, 'ntlm', false, false); // false=no auth check
60 60
 		//error_log("create('$account',null,'ntlm',false,false)=$sessionid ({$GLOBALS['egw']->session->reason})");
61 61
 	}
62 62
 	if (!$sessionid)
Please login to merge, or discard this patch.