Completed
Push — master ( f3d239...6aac3a )
by Fabio
16:46
created
framework/Web/UI/WebControls/TFileUploadItem.php 1 patch
Indentation   +31 added lines, -32 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@  discard block
 block discarded – undo
18 18
  * is especially needed when {@link TFileUpload::setMultiple} is set to true.
19 19
  *
20 20
  * See {@link TFileUpload} documentation for more details.
21
-
22 21
  * @author LANDWEHR Computer und Software GmbH <[email protected]>
23 22
  * @package Prado\Web\UI\WebControls
24 23
  * @since 4.0
@@ -48,11 +47,11 @@  discard block
 block discarded – undo
48 47
 
49 48
   public function __construct($fileName, $fileSize, $fileType, $errorCode, $localName)
50 49
   {
51
-    $this->_fileName = $fileName;
52
-    $this->_fileSize = $fileSize;
53
-    $this->_fileType = $fileType;
54
-    $this->_errorCode = $errorCode;
55
-    $this->_localName = $localName;
50
+	$this->_fileName = $fileName;
51
+	$this->_fileSize = $fileSize;
52
+	$this->_fileType = $fileType;
53
+	$this->_errorCode = $errorCode;
54
+	$this->_localName = $localName;
56 55
   }
57 56
 
58 57
   /**
@@ -60,7 +59,7 @@  discard block
 block discarded – undo
60 59
    */
61 60
   public function getFileName()
62 61
   {
63
-    return $this->_fileName;
62
+	return $this->_fileName;
64 63
   }
65 64
 
66 65
   /**
@@ -68,7 +67,7 @@  discard block
 block discarded – undo
68 67
    */
69 68
   public function getFileSize()
70 69
   {
71
-    return $this->_fileSize;
70
+	return $this->_fileSize;
72 71
   }
73 72
 
74 73
   /**
@@ -77,7 +76,7 @@  discard block
 block discarded – undo
77 76
    */
78 77
   public function getFileType()
79 78
   {
80
-    return $this->_fileType;
79
+	return $this->_fileType;
81 80
   }
82 81
 
83 82
   /**
@@ -86,7 +85,7 @@  discard block
 block discarded – undo
86 85
    */
87 86
   public function getLocalName()
88 87
   {
89
-    return $this->_localName;
88
+	return $this->_localName;
90 89
   }
91 90
 
92 91
   /**
@@ -94,7 +93,7 @@  discard block
 block discarded – undo
94 93
    */
95 94
   public function setLocalName($value)
96 95
   {
97
-    $this->_localName = $value;
96
+	$this->_localName = $value;
98 97
   }
99 98
 
100 99
   /**
@@ -104,7 +103,7 @@  discard block
 block discarded – undo
104 103
    */
105 104
   public function getErrorCode()
106 105
   {
107
-    return $this->_errorCode;
106
+	return $this->_errorCode;
108 107
   }
109 108
 
110 109
   /**
@@ -114,7 +113,7 @@  discard block
 block discarded – undo
114 113
    */
115 114
   public function setErrorCode($value)
116 115
   {
117
-    $this->_errorCode = $value;
116
+	$this->_errorCode = $value;
118 117
   }
119 118
 
120 119
   /**
@@ -122,7 +121,7 @@  discard block
 block discarded – undo
122 121
    */
123 122
   public function getHasFile()
124 123
   {
125
-    return $this->_errorCode===UPLOAD_ERR_OK;
124
+	return $this->_errorCode===UPLOAD_ERR_OK;
126 125
   }
127 126
 
128 127
   /**
@@ -134,17 +133,17 @@  discard block
 block discarded – undo
134 133
    */
135 134
   public function saveAs($fileName,$deleteTempFile=true)
136 135
   {
137
-    if($this->_errorCode===UPLOAD_ERR_OK)
138
-    {
139
-      if($deleteTempFile)
140
-        return move_uploaded_file($this->_localName,$fileName);
141
-      else if(is_uploaded_file($this->_localName))
142
-        return file_put_contents($fileName,file_get_contents($this->_localName))!==false;
143
-      else
144
-        return false;
145
-    }
146
-    else
147
-      return false;
136
+	if($this->_errorCode===UPLOAD_ERR_OK)
137
+	{
138
+	  if($deleteTempFile)
139
+		return move_uploaded_file($this->_localName,$fileName);
140
+	  else if(is_uploaded_file($this->_localName))
141
+		return file_put_contents($fileName,file_get_contents($this->_localName))!==false;
142
+	  else
143
+		return false;
144
+	}
145
+	else
146
+	  return false;
148 147
   }
149 148
 
150 149
   /**
@@ -152,13 +151,13 @@  discard block
 block discarded – undo
152 151
    */
153 152
   public function toArray()
154 153
   {
155
-    return array(
156
-      'fileName' => $this->_fileName,
157
-      'fileSize' => $this->_fileSize,
158
-      'fileType' => $this->_fileType,
159
-      'errorCode' => $this->_errorCode,
160
-      'localName' => $this->_localName
161
-    );
154
+	return array(
155
+	  'fileName' => $this->_fileName,
156
+	  'fileSize' => $this->_fileSize,
157
+	  'fileType' => $this->_fileType,
158
+	  'errorCode' => $this->_errorCode,
159
+	  'localName' => $this->_localName
160
+	);
162 161
   }
163 162
 
164 163
 }
165 164
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveFileUpload.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
  */
61 61
 class TActiveFileUpload extends TFileUpload implements IActiveControl, ICallbackEventHandler, INamingContainer
62 62
 {
63
-	const SCRIPT_PATH = 'activefileupload';
63
+	const SCRIPT_PATH='activefileupload';
64 64
 
65 65
 	/**
66 66
 	 * @var THiddenField a flag to tell which component is doing the callback.
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * TActiveControlAdapter. If you override this class, be sure to set the
90 90
 	 * adapter appropriately by, for example, by calling this constructor.
91 91
 	 */
92
-	public function __construct(){
92
+	public function __construct() {
93 93
 		parent::__construct();
94 94
 		$this->setAdapter(new TActiveControlAdapter($this));
95 95
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	protected function getAssetUrl($file='')
103 103
 	{
104
-		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
104
+		$base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl();
105 105
 		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
106 106
 	}
107 107
 
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function onFileUpload($param)
116 116
 	{
117
-		if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){
118
-		  $params = new TActiveFileUploadCallbackParams;
117
+		if($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param==$this->_target->getUniqueID()) {
118
+		  $params=new TActiveFileUploadCallbackParams;
119 119
 		  // save the files so that they will persist past the end of this return.
120
-		  foreach ($this->getFiles() as $file) {
121
-			  $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),''));
120
+		  foreach($this->getFiles() as $file) {
121
+			  $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), ''));
122 122
 			  $file->saveAs($localName);
123 123
 			  $file->setLocalName($localName);
124
-			  $params->files[] = $file->toArray();
124
+			  $params->files[]=$file->toArray();
125 125
 		  }
126 126
 
127 127
 			// return some javascript to display a completion status.
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
           	 Options = new Object();
130 130
           	 Options.clientID = '{$this->getClientID()}';
131 131
           	 Options.targetID = '{$this->_target->getUniqueID()}';
132
-          	 Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
132
+          	 Options.errorCode = '".(int) !$this->getHasAllFiles()."';
133 133
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
134
-          	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
135
-             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
136
-             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS) . "';
137
-             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS) . "';
134
+          	 Options.fileName = '".TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS)."';
135
+             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS)."';
136
+             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS)."';
137
+             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS)."';
138 138
           	 parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options);
139 139
            </script>";
140 140
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return string the path where the uploaded file will be stored temporarily, in namespace format
147 147
 	 * default "Application.runtime.*"
148 148
 	 */
149
-	public function getTempPath(){
149
+	public function getTempPath() {
150 150
 		return $this->getViewState('TempPath', 'Application.runtime.*');
151 151
 	}
152 152
 
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 	 * @param string the path where the uploaded file will be stored temporarily in namespace format
155 155
 	 * default "Application.runtime.*"
156 156
 	 */
157
-	public function setTempPath($value){
158
-		$this->setViewState('TempPath',$value,'Application.runtime.*');
157
+	public function setTempPath($value) {
158
+		$this->setViewState('TempPath', $value, 'Application.runtime.*');
159 159
 	}
160 160
 
161 161
 	/**
162 162
 	 * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
163 163
 	 * Note: When set to false, you will need to trigger the callback yourself.
164 164
 	 */
165
-	public function getAutoPostBack(){
165
+	public function getAutoPostBack() {
166 166
 		return $this->getViewState('AutoPostBack', true);
167 167
 	}
168 168
 
@@ -170,28 +170,28 @@  discard block
 block discarded – undo
170 170
 	 * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
171 171
 	 * Note: When set to false, you will need to trigger the callback yourself.
172 172
 	 */
173
-	public function setAutoPostBack($value){
174
-		$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true);
173
+	public function setAutoPostBack($value) {
174
+		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true);
175 175
 	}
176 176
 
177 177
 	/**
178 178
 	 * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false}
179 179
 	 */
180
-	public function getCallbackJavascript(){
180
+	public function getCallbackJavascript() {
181 181
 		return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")";
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable.
186 186
 	 */
187
-	public function onInit($sender){
187
+	public function onInit($sender) {
188 188
 		parent::onInit($sender);
189 189
 
190
-		if (!Prado::getApplication()->getCache())
191
-		  if (!Prado::getApplication()->getSecurityManager())
190
+		if(!Prado::getApplication()->getCache())
191
+		  if(!Prado::getApplication()->getSecurityManager())
192 192
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
193 193
 
194
-		if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){
194
+		if(!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) {
195 195
 			throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath());
196 196
 		}
197 197
 	}
@@ -203,18 +203,18 @@  discard block
 block discarded – undo
203 203
 	 * This method is mainly used by framework and control developers.
204 204
 	 * @param TCallbackEventParameter the event parameter
205 205
 	 */
206
- 	public function raiseCallbackEvent($param){
207
- 		$cp = $param->getCallbackParameter();
208
-		if ($key = $cp->targetID == $this->_target->getUniqueID()){
206
+ 	public function raiseCallbackEvent($param) {
207
+ 		$cp=$param->getCallbackParameter();
208
+		if($key=$cp->targetID==$this->_target->getUniqueID()) {
209 209
 
210
-			$params = $this->popParamsByToken($cp->callbackToken);
210
+			$params=$this->popParamsByToken($cp->callbackToken);
211 211
       foreach($params->files as $index => $file)
212 212
       {
213
-  			$_FILES[$key]['name'][$index] = stripslashes($file['fileName']);
214
-  			$_FILES[$key]['size'][$index] = intval($file['fileSize']);
215
-  			$_FILES[$key]['type'][$index] = $file['fileType'];
216
-  			$_FILES[$key]['error'][$index] = intval($file['errorCode']);
217
-  			$_FILES[$key]['tmp_name'][$index] = $file['localName'];
213
+  			$_FILES[$key]['name'][$index]=stripslashes($file['fileName']);
214
+  			$_FILES[$key]['size'][$index]=intval($file['fileSize']);
215
+  			$_FILES[$key]['type'][$index]=$file['fileType'];
216
+  			$_FILES[$key]['error'][$index]=intval($file['errorCode']);
217
+  			$_FILES[$key]['tmp_name'][$index]=$file['localName'];
218 218
       }
219 219
 			$this->loadPostData($key, null);
220 220
 
@@ -234,17 +234,17 @@  discard block
 block discarded – undo
234 234
 
235 235
 	protected function pushParamsAndGetToken(TActiveFileUploadCallbackParams $params)
236 236
 	{
237
-		if ($cache = Prado::getApplication()->getCache())
237
+		if($cache=Prado::getApplication()->getCache())
238 238
 			{
239 239
 				// this is the most secure method, file info can't be forged from client side, no matter what
240
-				$token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000*1000,9999*1000));
241
-				$cache->set($token, serialize($params), 5*60); // expire in 5 minutes - the callback should arrive back in seconds, actually
240
+				$token=md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000 * 1000, 9999 * 1000));
241
+				$cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually
242 242
 			}
243 243
 		else
244
-		if ($mgr = Prado::getApplication()->getSecurityManager())
244
+		if($mgr=Prado::getApplication()->getSecurityManager())
245 245
 			{
246 246
 				// this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key
247
-				$token = urlencode(base64_encode($mgr->encrypt(serialize($params))));
247
+				$token=urlencode(base64_encode($mgr->encrypt(serialize($params))));
248 248
 			}
249 249
 		else
250 250
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
 
255 255
 	protected function popParamsByToken($token)
256 256
 	{
257
-		if ($cache = Prado::getApplication()->getCache())
257
+		if($cache=Prado::getApplication()->getCache())
258 258
 			{
259
-				$v = $cache->get($token);
259
+				$v=$cache->get($token);
260 260
 				assert($v!='');
261 261
 				$cache->delete($token); // remove it from cache so it can't be used again and won't take up space either
262
-				$params = unserialize($v);
262
+				$params=unserialize($v);
263 263
 			}
264 264
 		else
265
-		if ($mgr = Prado::getApplication()->getSecurityManager())
265
+		if($mgr=Prado::getApplication()->getSecurityManager())
266 266
 			{
267
-				$v = $mgr->decrypt(base64_decode(urldecode($token)));
268
-				$params = unserialize($v);
267
+				$v=$mgr->decrypt(base64_decode(urldecode($token)));
268
+				$params=unserialize($v);
269 269
 			}
270 270
 		else
271 271
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
@@ -282,27 +282,27 @@  discard block
 block discarded – undo
282 282
 	{
283 283
 		parent::onPreRender($param);
284 284
 
285
-		if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID())
285
+		if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId']==$this->getClientID())
286 286
 		{
287
-		  $params = new TActiveFileUploadCallbackParams;
288
-		  foreach ($this->getFiles() as $file) {
289
-		    $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),''));
287
+		  $params=new TActiveFileUploadCallbackParams;
288
+		  foreach($this->getFiles() as $file) {
289
+		    $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), ''));
290 290
 		    $file->setLocalName($localName);
291 291
 		    // tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead
292 292
 		    $file->setErrorCode(UPLOAD_ERR_FORM_SIZE);
293
-		    $params->files[] = $file->toArray();
293
+		    $params->files[]=$file->toArray();
294 294
 		  }
295 295
 
296 296
 			echo "<script language='Javascript'>
297 297
           	 Options = new Object();
298 298
           	 Options.clientID = '{$_GET['TActiveFileUpload_InputId']}';
299 299
           	 Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}';
300
-			       Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
300
+			       Options.errorCode = '".(int) !$this->getHasAllFiles()."';
301 301
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
302
-          	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
303
-             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
304
-             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS) . "';
305
-             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS) . "';
302
+          	 Options.fileName = '".TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS)."';
303
+             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS)."';
304
+             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS)."';
305
+             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS)."';
306 306
            	 parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options);
307 307
            </script>";
308 308
 		}
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 	{
313 313
 		$this->getPage()->getClientScript()->registerPradoScript('activefileupload');
314 314
 
315
-		$this->_flag = new THiddenField;
315
+		$this->_flag=new THiddenField;
316 316
 		$this->_flag->setID('Flag');
317 317
 		$this->getControls()->add($this->_flag);
318 318
 
319
-		$this->_busy = new TImage;
319
+		$this->_busy=new TImage;
320 320
 		$this->_busy->setID('Busy');
321 321
 		$this->_busy->setImageUrl($this->getAssetUrl('ActiveFileUploadIndicator.gif'));
322 322
 		$this->_busy->setStyle("display:none");
323 323
 		$this->getControls()->add($this->_busy);
324 324
 
325
-		$this->_success = new TImage;
325
+		$this->_success=new TImage;
326 326
 		$this->_success->setID('Success');
327 327
 		$this->_success->setImageUrl($this->getAssetUrl('ActiveFileUploadComplete.png'));
328 328
 		$this->_success->setStyle("display:none");
329 329
 		$this->getControls()->add($this->_success);
330 330
 
331
-		$this->_error = new TImage;
331
+		$this->_error=new TImage;
332 332
 		$this->_error->setID('Error');
333 333
 		$this->_error->setImageUrl($this->getAssetUrl('ActiveFileUploadError.png'));
334 334
 		$this->_error->setStyle("display:none");
335 335
 		$this->getControls()->add($this->_error);
336 336
 
337
-		$this->_target = new TInlineFrame;
337
+		$this->_target=new TInlineFrame;
338 338
 		$this->_target->setID('Target');
339 339
 		$this->_target->setFrameUrl($this->getAssetUrl('ActiveFileUploadBlank.html'));
340 340
 		$this->_target->setStyle("width:0px; height:0px;");
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	/**
346 346
 	 * Removes localfile on ending of the callback.
347 347
 	 */
348
-	public function onUnload($param){
349
-		if ($this->getPage()->getIsCallback())
348
+	public function onUnload($param) {
349
+		if($this->getPage()->getIsCallback())
350 350
 		{
351 351
 		  foreach($this->getFiles() as $file)
352
-		    if($file->getHasFile() && file_exists($file->getLocalName())){
352
+		    if($file->getHasFile() && file_exists($file->getLocalName())) {
353 353
 		      unlink($file->getLocalName());
354 354
 		  }
355 355
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	/**
360 360
 	 * @return TBaseActiveCallbackControl standard callback control options.
361 361
 	 */
362
-	public function getActiveControl(){
362
+	public function getActiveControl() {
363 363
 		return $this->getAdapter()->getBaseActiveControl();
364 364
 	}
365 365
 
@@ -375,17 +375,17 @@  discard block
 block discarded – undo
375 375
 	 * Adds ID attribute, and renders the javascript for active component.
376 376
 	 * @param THtmlWriter the writer used for the rendering purpose
377 377
 	 */
378
-	public function addAttributesToRender($writer){
378
+	public function addAttributesToRender($writer) {
379 379
 		parent::addAttributesToRender($writer);
380
-		$writer->addAttribute('id',$this->getClientID());
380
+		$writer->addAttribute('id', $this->getClientID());
381 381
 
382
-		$this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(),$this->getClientOptions());
382
+		$this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getClientOptions());
383 383
 	}
384 384
 
385 385
 	/**
386 386
 	 * @return string corresponding javascript class name for this control.
387 387
 	 */
388
-	protected function getClientClassName(){
388
+	protected function getClientClassName() {
389 389
 		return 'Prado.WebUI.TActiveFileUpload';
390 390
 	}
391 391
 
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
 	 * 					completeID => complete client ID,
400 400
 	 * 					errorID => error client ID)
401 401
 	 */
402
-	protected function getClientOptions(){
403
-		$options['ID'] = $this->getClientID();
404
-		$options['EventTarget'] = $this->getUniqueID();
405
-
406
-		$options['inputID'] = $this->getClientID();
407
-		$options['flagID'] = $this->_flag->getClientID();
408
-		$options['targetID'] = $this->_target->getUniqueID();
409
-		$options['formID'] = $this->getPage()->getForm()->getClientID();
410
-		$options['indicatorID'] = $this->_busy->getClientID();
411
-		$options['completeID'] = $this->_success->getClientID();
412
-		$options['errorID'] = $this->_error->getClientID();
413
-		$options['autoPostBack'] = $this->getAutoPostBack();
402
+	protected function getClientOptions() {
403
+		$options['ID']=$this->getClientID();
404
+		$options['EventTarget']=$this->getUniqueID();
405
+
406
+		$options['inputID']=$this->getClientID();
407
+		$options['flagID']=$this->_flag->getClientID();
408
+		$options['targetID']=$this->_target->getUniqueID();
409
+		$options['formID']=$this->getPage()->getForm()->getClientID();
410
+		$options['indicatorID']=$this->_busy->getClientID();
411
+		$options['completeID']=$this->_success->getClientID();
412
+		$options['errorID']=$this->_error->getClientID();
413
+		$options['autoPostBack']=$this->getAutoPostBack();
414 414
 		return $options;
415 415
 	}
416 416
 
@@ -421,12 +421,12 @@  discard block
 block discarded – undo
421 421
 	 * If true, you will not be able to save the uploaded file again.
422 422
 	 * @return boolean true if the file saving is successful
423 423
 	 */
424
-	public function saveAs($fileName,$deleteTempFile=true,$index=0){
425
-		if (($this->getErrorCode($index)===UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){
426
-			if ($deleteTempFile)
427
-				return rename($this->getLocalName($index),$fileName);
424
+	public function saveAs($fileName, $deleteTempFile=true, $index=0) {
425
+		if(($this->getErrorCode($index)===UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))) {
426
+			if($deleteTempFile)
427
+				return rename($this->getLocalName($index), $fileName);
428 428
 			else
429
-				return copy($this->getLocalName($index),$fileName);
429
+				return copy($this->getLocalName($index), $fileName);
430 430
 		} else
431 431
 			return false;
432 432
 	}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 * @return TImage the image displayed when an upload
436 436
 	 * 		completes successfully.
437 437
 	 */
438
-	public function getSuccessImage(){
438
+	public function getSuccessImage() {
439 439
 		$this->ensureChildControls();
440 440
 		return $this->_success;
441 441
 	}
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * @return TImage the image displayed when an upload
445 445
 	 * 		does not complete successfully.
446 446
 	 */
447
-	public function getErrorImage(){
447
+	public function getErrorImage() {
448 448
 		$this->ensureChildControls();
449 449
 		return $this->_error;
450 450
 	}
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @return TImage the image displayed when an upload
454 454
 	 * 		is in progress.
455 455
 	 */
456
-	public function getBusyImage(){
456
+	public function getBusyImage() {
457 457
 		$this->ensureChildControls();
458 458
 		return $this->_busy;
459 459
 	}
Please login to merge, or discard this patch.