Completed
Push — 16.1 ( 592c74...b502d4 )
by Ralf
43:09 queued 19:16
created
api/src/Framework/Extra.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 	 * @param string $with =null
55 55
 	 * @param string $msg_type =null 'error', 'warning' or 'success' (default)
56 56
 	 */
57
-	public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null)
57
+	public static function refresh_opener($msg, $app, $id = null, $type = null, $targetapp = null, $replace = null, $with = null, $msg_type = null)
58 58
 	{
59 59
 		//error_log(__METHOD__.'('.array2string(func_get_args()).')');
60 60
 		self::$extra['refresh-opener'] = func_get_args();
61 61
 
62
-		unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type);	// used only via func_get_args();
62
+		unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args();
63 63
 	}
64 64
 
65 65
 	/**
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 * @param string $msg message to show
71 71
 	 * @param string $type ='success' 'error', 'warning' or 'success' (default)
72 72
 	 */
73
-	public static function message($msg, $type='success')
73
+	public static function message($msg, $type = 'success')
74 74
 	{
75 75
 		self::$extra['message'] = func_get_args();
76 76
 
77
-		unset($msg, $type);	// used only via func_get_args();
77
+		unset($msg, $type); // used only via func_get_args();
78 78
 	}
79 79
 
80 80
 	/**
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 	 * @param string $target
85 85
 	 * @param string $popup
86 86
 	 */
87
-	public static function popup($link, $target='_blank', $popup='640x480')
87
+	public static function popup($link, $target = '_blank', $popup = '640x480')
88 88
 	{
89 89
 		// default params are not returned by func_get_args!
90
-		$args = func_get_args()+array(null, '_blank', '640x480');
90
+		$args = func_get_args() + array(null, '_blank', '640x480');
91 91
 
92
-		unset($link, $target, $popup);	// used only via func_get_args()
92
+		unset($link, $target, $popup); // used only via func_get_args()
93 93
 
94 94
 		if (Json\Request::isJSONRequest())
95 95
 		{
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @param string $alert_msg ='' optional message to display as alert, before closing the window
108 108
 	 */
109
-	public static function window_close($alert_msg='')
109
+	public static function window_close($alert_msg = '')
110 110
 	{
111 111
 		//error_log(__METHOD__."()");
112 112
 		self::$extra['window-close'] = $alert_msg ? $alert_msg : true;
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
 	public static function get_extra()
164 164
 	{
165 165
 		// adding links of refreshed entry, to give others apps more information about necessity to refresh
166
-		if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 &&	// do not run twice
166
+		if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice
167 167
 			!empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2]))	// app/id given
168 168
 		{
169 169
 			$links = Link::get_links(self::$extra['refresh-opener'][1], self::$extra['refresh-opener'][2]);
170 170
 			$apps = array();
171
-			foreach($links as $link)
171
+			foreach ($links as $link)
172 172
 			{
173 173
 				$apps[$link['app']][] = $link['id'];
174 174
 			}
Please login to merge, or discard this patch.
api/src/Framework/Minimal.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	* @param string $template ='default' name of the template
34 34
 	* @return idots_framework
35 35
 	*/
36
-	function __construct($template='default')
36
+	function __construct($template = 'default')
37 37
 	{
38
-		parent::__construct($template);		// call the constructor of the extended class
38
+		parent::__construct($template); // call the constructor of the extended class
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	* @param array $extra =array() extra attributes passed as data-attribute to egw.js
45 45
 	* @return string with html
46 46
 	*/
47
-	function header(array $extra=array())
47
+	function header(array $extra = array())
48 48
 	{
49 49
 		// make sure header is output only once
50 50
 		if (self::$header_done) return '';
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		// as the old Template class has problems if restored from the session (php-restore)
67 67
 		$this->tpl = new Template(EGW_SERVER_ROOT.$this->template_dir, 'keep');
68 68
 		$this->tpl->set_file(array('_head' => 'head.tpl'));
69
-		$this->tpl->set_block('_head','head');
69
+		$this->tpl->set_block('_head', 'head');
70 70
 
71 71
 		$this->tpl->set_var($this->_get_header($extra));
72 72
 
73
-		$content .= $this->tpl->fp('out','head');
73
+		$content .= $this->tpl->fp('out', 'head');
74 74
 
75 75
 		return $content;
76 76
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return boolean $consider_navbar_not_yet_called_as_true=true
94 94
 	 * @return boolean
95 95
 	 */
96
-	public function isTop($consider_navbar_not_yet_called_as_true=true)
96
+	public function isTop($consider_navbar_not_yet_called_as_true = true)
97 97
 	{
98 98
 		unset($consider_navbar_not_yet_called_as_true);
99 99
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	* @access protected
110 110
 	* @return void
111 111
 	*/
112
-	function _add_topmenu_item(array $app_data,$alt_label=null)
112
+	function _add_topmenu_item(array $app_data, $alt_label = null)
113 113
 	{
114 114
 		unset($app_data, $alt_label);
115 115
 	}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	* @access protected
123 123
 	* @return void
124 124
 	*/
125
-	function _add_topmenu_info_item($content, $id=null)
125
+	function _add_topmenu_info_item($content, $id = null)
126 126
 	{
127 127
 		unset($content, $id);
128 128
 	}
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 	*/
135 135
 	function footer()
136 136
 	{
137
-		static $footer_done=0;
138
-		if ($footer_done++) return;	// prevent multiple footers, not sure we still need this (RalfBecker)
137
+		static $footer_done = 0;
138
+		if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker)
139 139
 
140
-		return "</body>\n</html>\n";	// close body and html tag, eg. for popups
140
+		return "</body>\n</html>\n"; // close body and html tag, eg. for popups
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	* @param array $file
149 149
 	* @param string $type =null 'admin', 'preferences', 'favorites', ...
150 150
 	*/
151
-	function sidebox($appname,$menu_title,$file,$type=null)
151
+	function sidebox($appname, $menu_title, $file, $type = null)
152 152
 	{
153 153
 		unset($appname, $menu_title, $file, $type);
154 154
 	}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	* @access public
165 165
 	* @return void
166 166
 	*/
167
-	function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null)
167
+	function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null)
168 168
 	{
169 169
 		unset($id, $icon_src, $iconlink, $blink, $tooltip);
170 170
 	}
Please login to merge, or discard this patch.
api/src/Ldap/ServerInfo.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	*/
147 147
 	function supportsObjectClass($_objectClass)
148 148
 	{
149
-		if($this->supportedObjectClasses[strtolower($_objectClass)])
149
+		if ($this->supportedObjectClasses[strtolower($_objectClass)])
150 150
 		{
151 151
 			return true;
152 152
 		}
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 	 * @param int $version 2 or 3
162 162
 	 * @return ldapserverinfo
163 163
 	 */
164
-	public static function get($ds, $host, $version=3)
164
+	public static function get($ds, $host, $version = 3)
165 165
 	{
166
-		$filter='(objectclass=*)';
167
-		$justthese = array('structuralObjectClass','namingContexts','supportedLDAPVersion','subschemaSubentry','vendorname');
168
-		if(($sr = @ldap_read($ds, '', $filter, $justthese)))
166
+		$filter = '(objectclass=*)';
167
+		$justthese = array('structuralObjectClass', 'namingContexts', 'supportedLDAPVersion', 'subschemaSubentry', 'vendorname');
168
+		if (($sr = @ldap_read($ds, '', $filter, $justthese)))
169 169
 		{
170
-			if(($info = ldap_get_entries($ds, $sr)))
170
+			if (($info = ldap_get_entries($ds, $sr)))
171 171
 			{
172 172
 				$ldapServerInfo = new ServerInfo($host);
173 173
 				$ldapServerInfo->setVersion($version);
174 174
 
175 175
 				// check for naming contexts
176
-				if($info[0]['namingcontexts'])
176
+				if ($info[0]['namingcontexts'])
177 177
 				{
178
-					for($i=0; $i<$info[0]['namingcontexts']['count']; $i++)
178
+					for ($i = 0; $i < $info[0]['namingcontexts']['count']; $i++)
179 179
 					{
180 180
 						$namingcontexts[] = $info[0]['namingcontexts'][$i];
181 181
 					}
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 				}
184 184
 
185 185
 				// check for ldap server type
186
-				if($info[0]['structuralobjectclass'])
186
+				if ($info[0]['structuralobjectclass'])
187 187
 				{
188
-					switch($info[0]['structuralobjectclass'][0])
188
+					switch ($info[0]['structuralobjectclass'][0])
189 189
 					{
190 190
 						case 'OpenLDAProotDSE':
191 191
 							$ldapServerType = OPENLDAP_LDAPSERVER;
@@ -202,30 +202,30 @@  discard block
 block discarded – undo
202 202
 				}
203 203
 
204 204
 				// check for subschema entry dn
205
-				if($info[0]['subschemasubentry'])
205
+				if ($info[0]['subschemasubentry'])
206 206
 				{
207 207
 					$subschemasubentry = $info[0]['subschemasubentry'][0];
208 208
 					$ldapServerInfo->setSubSchemaEntry($subschemasubentry);
209 209
 				}
210 210
 
211 211
 				// create list of supported objetclasses
212
-				if(!empty($subschemasubentry))
212
+				if (!empty($subschemasubentry))
213 213
 				{
214
-					$filter='(objectclass=*)';
214
+					$filter = '(objectclass=*)';
215 215
 					$justthese = array('objectClasses');
216 216
 
217
-					if(($sr = ldap_read($ds, $subschemasubentry, $filter, $justthese)))
217
+					if (($sr = ldap_read($ds, $subschemasubentry, $filter, $justthese)))
218 218
 					{
219
-						if(($info = ldap_get_entries($ds, $sr)))
219
+						if (($info = ldap_get_entries($ds, $sr)))
220 220
 						{
221
-							if($info[0]['objectclasses']) {
222
-								for($i=0; $i<$info[0]['objectclasses']['count']; $i++)
221
+							if ($info[0]['objectclasses']) {
222
+								for ($i = 0; $i < $info[0]['objectclasses']['count']; $i++)
223 223
 								{
224 224
 									$matches = null;
225
-									if(preg_match('/^\( (.*) NAME \'(\w*)\' /', $info[0]['objectclasses'][$i], $matches))
225
+									if (preg_match('/^\( (.*) NAME \'(\w*)\' /', $info[0]['objectclasses'][$i], $matches))
226 226
 									{
227 227
 										#_debug_array($matches);
228
-										if(count($matches) == 3)
228
+										if (count($matches) == 3)
229 229
 										{
230 230
 											$supportedObjectClasses[$matches[1]] = strtolower($matches[2]);
231 231
 										}
Please login to merge, or discard this patch.
api/src/Json/Push.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	{
60 60
 		if (!isset(self::$backend))
61 61
 		{
62
-			foreach(self::$backends as $class)
62
+			foreach (self::$backends as $class)
63 63
 			{
64 64
 				if (class_exists($class))
65 65
 				{
Please login to merge, or discard this patch.
api/src/Json/Msg.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param string $function name of the global (window) javascript function to call
65 65
 	 * @param array $parameters =array()
66 66
 	 */
67
-	public function apply($function,array $parameters=array())
67
+	public function apply($function, array $parameters = array())
68 68
 	{
69 69
 		if (is_string($function))
70 70
 		{
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function call($function)
89 89
 	{
90 90
 		$parameters = func_get_args();
91
-		array_shift($parameters);	// shift off $function
91
+		array_shift($parameters); // shift off $function
92 92
 
93 93
 		if (is_string($function))
94 94
 		{
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param string $method name of the jquery to call
111 111
 	 * @param array $parameters =array()
112 112
 	 */
113
-	public function jquery($selector,$method,array $parameters=array())
113
+	public function jquery($selector, $method, array $parameters = array())
114 114
 	{
115 115
 		if (is_string($selector) && is_string($method))
116 116
 		{
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @param string $app =null default current app from flags
170 170
 	 * or only the current application
171 171
 	 */
172
-	public function redirect($url, $global = false, $app=null)
172
+	public function redirect($url, $global = false, $app = null)
173 173
 	{
174 174
 		if (is_string($url) && is_bool($global))
175 175
 		{
Please login to merge, or discard this patch.
api/src/Json/Request.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param boolean $set =null
40 40
 	 * @return boolean
41 41
 	 */
42
-	public static function isJSONRequest($set=null)
42
+	public static function isJSONRequest($set = null)
43 43
 	{
44 44
 		$ret = self::$_hadJSONRequest;
45 45
 		if (isset($set)) self::$_hadJSONRequest = $set;
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 
63 63
 		if (get_magic_quotes_gpc()) $input_data = stripslashes($input_data);
64 64
 
65
-		$json_data = json_decode($input_data,true);
65
+		$json_data = json_decode($input_data, true);
66 66
 		if (is_array($json_data) && isset($json_data['request']) && isset($json_data['request']['parameters']) && is_array($json_data['request']['parameters']))
67 67
 		{
68 68
 			//error_log(__METHOD__.__LINE__.array2string($json_data['request']).function_backtrace());
69
-			$parameters =& $json_data['request']['parameters'];
69
+			$parameters = & $json_data['request']['parameters'];
70 70
 		}
71 71
 		else
72 72
 		{
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 		{
78 78
 			$responses = array();
79 79
 			$response = Response::get();
80
-			foreach($parameters[0] as $uid => $data)
80
+			foreach ($parameters[0] as $uid => $data)
81 81
 			{
82 82
 				//error_log("$uid: menuaction=$data[menuaction], parameters=".array2string($data['parameters']));
83 83
 				$this->handleRequest($data['menuaction'], (array)$data['parameters']);
84 84
 				$responses[$uid] = $response->initResponseArray();
85 85
 				//error_log("responses[$uid]=".array2string($responses[$uid]));
86 86
 			}
87
-			$response->data($responses);	// send all responses as data
87
+			$response->data($responses); // send all responses as data
88 88
 		}
89 89
 		else
90 90
 		{
@@ -100,32 +100,32 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function handleRequest($menuaction, array $parameters)
102 102
 	{
103
-		if (strpos($menuaction,'::') !== false && strpos($menuaction,'.') === false)	// static method name app_something::method
103
+		if (strpos($menuaction, '::') !== false && strpos($menuaction, '.') === false)	// static method name app_something::method
104 104
 		{
105
-			@list($className,$functionName,$handler) = explode('::',$menuaction);
105
+			@list($className, $functionName, $handler) = explode('::', $menuaction);
106 106
 			if (substr($className, 0, 11) == 'EGroupware\\')
107 107
 			{
108 108
 				list(,$appName) = explode('\\', strtolower($className));
109 109
 			}
110 110
 			else
111 111
 			{
112
-				list($appName) = explode('_',$className);
112
+				list($appName) = explode('_', $className);
113 113
 			}
114 114
 
115 115
 			// Check for a real static method, avoid instanciation if it is
116 116
 			$m = new ReflectionMethod($menuaction);
117
-			if($m->isStatic())
117
+			if ($m->isStatic())
118 118
 			{
119 119
 				$ajaxClass = $className;
120 120
 			}
121 121
 		}
122 122
 		else
123 123
 		{
124
-			@list($appName, $className, $functionName, $handler) = explode('.',$menuaction);
124
+			@list($appName, $className, $functionName, $handler) = explode('.', $menuaction);
125 125
 		}
126 126
 		//error_log("json.php: appName=$appName, className=$className, functionName=$functionName, handler=$handler");
127 127
 
128
-		switch($handler)
128
+		switch ($handler)
129 129
 		{
130 130
 			case '/etemplate/process_exec':
131 131
 				$_GET['menuaction'] = $appName.'.'.$className.'.'.$functionName;
@@ -151,15 +151,15 @@  discard block
 block discarded – undo
151 151
 				break;
152 152
 		}
153 153
 
154
-		if(substr($className,0,4) != 'ajax' && substr($className,-4) != 'ajax' &&
155
-			$menuaction != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax' ||
156
-			!preg_match('/^[A-Za-z0-9_\\\\-]+(\.[A-Za-z0-9_\\\\]+\.|::)[A-Za-z0-9_]+$/',$menuaction))
154
+		if (substr($className, 0, 4) != 'ajax' && substr($className, -4) != 'ajax' &&
155
+			$menuaction != 'etemplate.etemplate.process_exec' && substr($functionName, 0, 4) != 'ajax' ||
156
+			!preg_match('/^[A-Za-z0-9_\\\\-]+(\.[A-Za-z0-9_\\\\]+\.|::)[A-Za-z0-9_]+$/', $menuaction))
157 157
 		{
158 158
 			// stopped for security reasons
159 159
 			error_log("className='$className', functionName='$functionName', menuaction='$menuaction'");
160
-			error_log($_SERVER['PHP_SELF']. ' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!');
160
+			error_log($_SERVER['PHP_SELF'].' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!');
161 161
 			// send message also to the user
162
-			throw new Exception\InvalidName($_SERVER['PHP_SELF']. ' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!');
162
+			throw new Exception\InvalidName($_SERVER['PHP_SELF'].' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!');
163 163
 		}
164 164
 
165 165
 		if (isset($template))
Please login to merge, or discard this patch.
api/src/Json/Tail.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param string $filename =null if not starting with as slash relative to EGw files dir (this is strongly prefered for security reasons)
70 70
 	 */
71
-	public function __construct($filename=null)
71
+	public function __construct($filename = null)
72 72
 	{
73
-		$this->filenames =& Api\Cache::getSession('phpgwapi', __CLASS__);
73
+		$this->filenames = & Api\Cache::getSession('phpgwapi', __CLASS__);
74 74
 
75 75
 		if ($filename)
76 76
 		{
77 77
 			$this->filename = $filename;
78 78
 
79
-			if (!$this->filenames || !in_array($filename,$this->filenames)) $this->filenames[] = $filename;
79
+			if (!$this->filenames || !in_array($filename, $this->filenames)) $this->filenames[] = $filename;
80 80
 		}
81 81
 	}
82 82
 
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @param int $start =0 last position in log-file
88 88
 	 * @throws Api\Exception\WrongParameter
89 89
 	 */
90
-	public function ajax_chunk($filename,$start=0)
90
+	public function ajax_chunk($filename, $start = 0)
91 91
 	{
92
-		if (!in_array($filename,$this->filenames))
92
+		if (!in_array($filename, $this->filenames))
93 93
 		{
94 94
 			throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!");
95 95
 		}
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		if (file_exists($filename))
99 99
 		{
100 100
 			$size = filesize($filename);
101
-			if (!$start || $start < 0 || $start > $size || $size-$start > 4*self::MAX_CHUNK_SIZE)
101
+			if (!$start || $start < 0 || $start > $size || $size - $start > 4 * self::MAX_CHUNK_SIZE)
102 102
 			{
103
-				$start = $size - 4*self::MAX_CHUNK_SIZE;
103
+				$start = $size - 4 * self::MAX_CHUNK_SIZE;
104 104
 				if ($start < 0) $start = 0;
105 105
 			}
106 106
 			$hsize = Api\Vfs::hsize($size);
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	 * @param boolean $truncate =false true: truncate file, false: delete file
132 132
 	 * @throws Api\Exception\WrongParameter
133 133
 	 */
134
-	public function ajax_delete($filename,$truncate=false)
134
+	public function ajax_delete($filename, $truncate = false)
135 135
 	{
136
-		if (!in_array($filename,$this->filenames))
136
+		if (!in_array($filename, $this->filenames))
137 137
 		{
138 138
 			throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!");
139 139
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return string
156 156
 	 * @throws Api\Exception\WrongParameter
157 157
 	 */
158
-	public function show($header=null)
158
+	public function show($header = null)
159 159
 	{
160 160
 		if (!isset($this->filename))
161 161
 		{
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 <p style="float: left; margin: 5px"><b>'.htmlspecialchars($header).'</b></p>
168 168
 <div style="float: right; margin: 2px; margin-right: 5px">
169 169
 	'.Api\Html::form(
170
-		Api\Html::input('clear_log',lang('Clear window'),'button','id="clear_log"')."\n".
171
-		Api\Html::input('delete_log',lang('Delete file'),'button','id="purge_log"')."\n".
172
-		Api\Html::input('empty_log',lang('Empty file'),'button','id="empty_log"')."\n".
173
-		Api\Html::input('download_log',lang('Download'),'submit','id="download_log"'),
174
-		'','/index.php',array(
170
+		Api\Html::input('clear_log', lang('Clear window'), 'button', 'id="clear_log"')."\n".
171
+		Api\Html::input('delete_log', lang('Delete file'), 'button', 'id="purge_log"')."\n".
172
+		Api\Html::input('empty_log', lang('Empty file'), 'button', 'id="empty_log"')."\n".
173
+		Api\Html::input('download_log', lang('Download'), 'submit', 'id="download_log"'),
174
+		'', '/index.php', array(
175 175
 		'menuaction' => 'api.'.__CLASS__.'.download',
176 176
 		'filename' => $this->filename,
177 177
 	)).'
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	public function download()
188 188
 	{
189 189
 		$filename = $_GET['filename'];
190
-		if (!in_array($filename,$this->filenames))
190
+		if (!in_array($filename, $this->filenames))
191 191
 		{
192 192
 			throw new Api\Exception\WrongParameter("Not allowed to download '$filename'!");
193 193
 		}
194 194
 		Api\Header\Content::type(basename($filename), 'text/plain');
195 195
 		if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename;
196
-		for($n=ob_get_level(); $n > 0; --$n)
196
+		for ($n = ob_get_level(); $n > 0; --$n)
197 197
 		{
198
-			ob_end_clean();	// stop all output buffering, to NOT run into memory_limit
198
+			ob_end_clean(); // stop all output buffering, to NOT run into memory_limit
199 199
 		}
200 200
 		readfile($filename);
201 201
 		exit;
Please login to merge, or discard this patch.
api/src/CalDAV/PropfindIterator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @var int
73 73
 	 */
74
-	protected $start=0;
74
+	protected $start = 0;
75 75
 
76 76
 	/**
77 77
 	 * Number of entries queried from callback in one call
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param array $filter filter for propfind call
96 96
 	 * @param array $files =array() extra files/responses to return too
97 97
 	 */
98
-	public function __construct(Handler $handler, $path, array $filter,array &$files=array())
98
+	public function __construct(Handler $handler, $path, array $filter, array &$files = array())
99 99
 	{
100 100
 		if ($this->debug) error_log(__METHOD__."('$path', ".array2string($filter).",)");
101 101
 		$this->path    = $path;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		$current = current($this->files);
127 127
 
128 128
 		if ($this->debug) error_log(__METHOD__."() returning ".array2string($current['path']));
129
-		return $current['path'];	// we return path as key
129
+		return $current['path']; // we return path as key
130 130
 	}
131 131
 
132 132
 	/**
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 			return false;
147 147
 		}
148 148
 		// try query further files via propfind callback of handler and store result in $this->files
149
-		$this->files = $this->handler->propfind_callback($this->path,$this->filter,array($this->start,self::CHUNK_SIZE));
149
+		$this->files = $this->handler->propfind_callback($this->path, $this->filter, array($this->start, self::CHUNK_SIZE));
150 150
 		if (!is_array($this->files) || !($entries = count($this->files)))
151 151
 		{
152 152
 			if ($this->debug) error_log(__METHOD__."() returning FALSE (no more entries)");
153
-			return false;	// no further entries
153
+			return false; // no further entries
154 154
 		}
155 155
 		$this->start += self::CHUNK_SIZE;
156 156
 		reset($this->files);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
 		$this->start = 0;
171 171
 		$this->files = $this->common_files;
172
-		if (!$this->files) $this->next();	// otherwise valid will return false and nothing get returned
172
+		if (!$this->files) $this->next(); // otherwise valid will return false and nothing get returned
173 173
 		reset($this->files);
174 174
 	}
175 175
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return boolean
180 180
 	 */
181
-	public function valid ()
181
+	public function valid()
182 182
 	{
183 183
 		if ($this->debug) error_log(__METHOD__."() returning ".array2string(current($this->files) !== false));
184 184
 		return current($this->files) !== false;
Please login to merge, or discard this patch.
api/src/CalDAV/IcalIterator.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param array $callback_params =array() further parameters for the callback, 1. parameter is component
107 107
 	 * @param boolean $add_container =false true, add container / $this as last parameter to callback
108 108
 	 */
109
-	public function __construct($ical_file,$base='VCALENDAR',$charset=null,$callback=null,array $callback_params=array(), $add_container=false)
109
+	public function __construct($ical_file, $base = 'VCALENDAR', $charset = null, $callback = null, array $callback_params = array(), $add_container = false)
110 110
 	{
111 111
 		// call parent constructor
112 112
 		parent::__construct();
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		}
132 132
 		if (!is_resource($this->ical_file))
133 133
 		{
134
-			throw new Api\Exception\WrongParameter(__METHOD__.'($ical_file, ...) NO resource! $ical_file='.substr(array2string($ical_file),0,100));
134
+			throw new Api\Exception\WrongParameter(__METHOD__.'($ical_file, ...) NO resource! $ical_file='.substr(array2string($ical_file), 0, 100));
135 135
 		}
136 136
 	}
137 137
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		{
156 156
 			$line = array_shift($this->unread_lines);
157 157
 		}
158
-		elseif(feof($this->ical_file))
158
+		elseif (feof($this->ical_file))
159 159
 		{
160 160
 			$line = false;
161 161
 		}
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			$line = fgets($this->ical_file);
165 165
 		}
166 166
 		// check if end of container reached
167
-		if ($this->container && $line && substr($line,0,4+strlen($this->base)) === 'END:'.$this->base)
167
+		if ($this->container && $line && substr($line, 0, 4 + strlen($this->base)) === 'END:'.$this->base)
168 168
 		{
169
-			$this->unread_line($line);	// put back end-of-container, to continue to return false
169
+			$this->unread_line($line); // put back end-of-container, to continue to return false
170 170
 			$line = false;
171 171
 		}
172 172
 		//error_log(__METHOD__."() returning ".($line === false ? 'FALSE' : "'$line'"));
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	protected function unread_line($line)
183 183
 	{
184 184
 		//error_log(__METHOD__."('$line')");
185
-		array_unshift($this->unread_lines,$line);
185
+		array_unshift($this->unread_lines, $line);
186 186
 	}
187 187
 
188 188
 	/**
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 		//error_log(__METHOD__."() returning a ".gettype($this->component));
196 196
 		if ($this->callback)
197 197
 		{
198
-			$ret = is_a($this->component,'Horde_Icalendar');
198
+			$ret = is_a($this->component, 'Horde_Icalendar');
199 199
 			do {
200 200
 				if ($ret === false) $this->next();
201
-				if (!is_a($this->component,'Horde_Icalendar')) return false;
201
+				if (!is_a($this->component, 'Horde_Icalendar')) return false;
202 202
 				$params = $this->callback_params;
203
-				array_unshift($params,$this->component);
203
+				array_unshift($params, $this->component);
204 204
 			}
205
-			while(($ret = call_user_func_array($this->callback,$params)) === false);
205
+			while (($ret = call_user_func_array($this->callback, $params)) === false);
206 206
 
207 207
 			return $ret;
208 208
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	{
228 228
 		unset($this->component);
229 229
 
230
-		while (($line = $this->read_line()) && substr($line,0,6) !== 'BEGIN:')
230
+		while (($line = $this->read_line()) && substr($line, 0, 6) !== 'BEGIN:')
231 231
 		{
232 232
 			// ignore it
233 233
 		}
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 			$this->component = false;
237 237
 			return;
238 238
 		}
239
-		$type = substr(trim($line),6);
239
+		$type = substr(trim($line), 6);
240 240
 
241 241
 		//error_log(__METHOD__."() found $type component");
242 242
 
243 243
 		$data = $line;
244
-		while (($line = $this->read_line()) && substr($line,0,4+strlen($type)) !== 'END:'.$type)
244
+		while (($line = $this->read_line()) && substr($line, 0, 4 + strlen($type)) !== 'END:'.$type)
245 245
 		{
246 246
 			$data .= $line;
247 247
 		}
@@ -276,23 +276,23 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function rewind()
278 278
 	{
279
-		@fseek($this->ical_file,0,SEEK_SET);
279
+		@fseek($this->ical_file, 0, SEEK_SET);
280 280
 
281 281
 		// advance to begin of container
282
-		while(($line = $this->read_line()) && substr($line,0,6+strlen($this->base)) !== 'BEGIN:'.$this->base)
282
+		while (($line = $this->read_line()) && substr($line, 0, 6 + strlen($this->base)) !== 'BEGIN:'.$this->base)
283 283
 		{
284 284
 
285 285
 		}
286 286
 		// if no container start found --> use whole file (rewind) and set container marker
287 287
 		if (!($this->container = $line !== false))
288 288
 		{
289
-			fseek($this->ical_file,0,SEEK_SET);
289
+			fseek($this->ical_file, 0, SEEK_SET);
290 290
 		}
291 291
 		//error_log(__METHOD__."() $this->base container ".($this->container ? 'found' : 'NOT found'));
292 292
 
293 293
 		$data = $line;
294 294
 		// advance to first component
295
-		while (($line = $this->read_line()) && substr($line,0,6) !== 'BEGIN:')
295
+		while (($line = $this->read_line()) && substr($line, 0, 6) !== 'BEGIN:')
296 296
 		{
297 297
 			$matches = null;
298 298
 			if (preg_match('/^VERSION:(\d\.\d)\s*$/ism', $line, $matches))
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		{
308 308
 			$data .= "END:$this->base\n";
309 309
 			//error_log(__METHOD__."() about to call this->parsevCalendar('$data','$this->base','$this->charset')");
310
-			$this->parsevCalendar($data,$this->base,$this->charset);
310
+			$this->parsevCalendar($data, $this->base, $this->charset);
311 311
 		}
312 312
 		if ($line) $this->unread_line($line);
313 313
 
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 	 *
321 321
 	 * @return boolean
322 322
 	 */
323
-	public function valid ()
323
+	public function valid()
324 324
 	{
325 325
 		//error_log(__METHOD__."() returning ".(is_a($this->component,'Horde_Icalendar') ? 'TRUE' : 'FALSE').' get_class($this->component)='.get_class($this->component));
326
-		return is_a($this->component,'Horde_Icalendar');
326
+		return is_a($this->component, 'Horde_Icalendar');
327 327
 	}
328 328
 }
329 329
 
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	if (!is_resource($ical_file)) echo "<pre>$ical_file</pre>\n";
442 442
 	//$calendar_ical = new calendar_ical();
443 443
 	//$calendar_ical->setSupportedFields('file');
444
-	$ical_it = new IcalIterator($ical_file);//,'VCALENDAR','iso-8859-1',array($calendar_ical,'_ical2egw_callback'),array('Europe/Berlin'));
445
-	foreach($ical_it as $uid => $vevent)
444
+	$ical_it = new IcalIterator($ical_file); //,'VCALENDAR','iso-8859-1',array($calendar_ical,'_ical2egw_callback'),array('Europe/Berlin'));
445
+	foreach ($ical_it as $uid => $vevent)
446 446
 	{
447 447
 		echo "$uid<pre>".print_r($vevent->toHash(), true)."</pre>\n";
448 448
 	}
Please login to merge, or discard this patch.