Passed
Push — php-cs-fixer ( b7e6c1...b932d3 )
by Fabio
31:05 queued 15:54
created
framework/Web/UI/ActiveControls/TInPlaceTextBox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	{
104 104
 		$client = $this->getPage()->getCallbackClient();
105 105
 		$code = $this->getClientClassName() . '.' . $func;
106
-		$client->callClientFunction($code, [$this,$value]);
106
+		$client->callClientFunction($code, [$this, $value]);
107 107
 	}
108 108
 
109 109
 	/**
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 * @param boolean $value value
159 159
 	 * @since 3.1.2
160 160
 	 */
161
-	public function setReadOnly ($value)
161
+	public function setReadOnly($value)
162 162
 	{
163 163
 		$value = TPropertyValue::ensureBoolean($value);
164 164
 		if(TTextBox::getReadOnly() === $value)
165 165
 			return;
166 166
 
167 167
 		TTextBox::setReadOnly($value);
168
-		if ($this->getActiveControl()->canUpdateClientSide())
168
+		if($this->getActiveControl()->canUpdateClientSide())
169 169
 		{
170 170
 			$this->callClientFunction('setReadOnly', $value);
171 171
 		}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveFileUpload.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -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
 	}
@@ -114,10 +114,10 @@  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()){
117
+		if($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()) {
118 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) {
120
+		  foreach($this->getFiles() as $file) {
121 121
 			  $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), ''));
122 122
 			  $file->saveAs($localName);
123 123
 			  $file->setLocalName($localName);
@@ -129,7 +129,7 @@  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 134
           	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
135 135
              Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
@@ -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,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string $value 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){
157
+	public function setTempPath($value) {
158 158
 		$this->setViewState('TempPath', $value, 'Application.runtime.*');
159 159
 	}
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
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 $value 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){
173
+	public function setAutoPostBack($value) {
174 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,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	 * This method is mainly used by framework and control developers.
204 204
 	 * @param TCallbackEventParameter $param the event parameter
205 205
 	 */
206
-	public function raiseCallbackEvent($param){
206
+	public function raiseCallbackEvent($param) {
207 207
 		$cp = $param->getCallbackParameter();
208
-		if ($key = $cp->targetID == $this->_target->getUniqueID()){
208
+		if($key = $cp->targetID == $this->_target->getUniqueID()) {
209 209
 
210 210
 			$params = $this->popParamsByToken($cp->callbackToken);
211 211
 	  foreach($params->files as $index => $file)
@@ -234,13 +234,13 @@  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 240
 				$token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000));
241 241
 				$cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually
242 242
 			}
243
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
243
+		elseif($mgr = Prado::getApplication()->getSecurityManager())
244 244
 			{
245 245
 				// this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key
246 246
 				$token = urlencode(base64_encode($mgr->encrypt(serialize($params))));
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
 
254 254
 	protected function popParamsByToken($token)
255 255
 	{
256
-		if ($cache = Prado::getApplication()->getCache())
256
+		if($cache = Prado::getApplication()->getCache())
257 257
 			{
258 258
 				$v = $cache->get($token);
259 259
 				assert($v != '');
260 260
 				$cache->delete($token); // remove it from cache so it can't be used again and won't take up space either
261 261
 				$params = unserialize($v);
262 262
 			}
263
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
263
+		elseif($mgr = Prado::getApplication()->getSecurityManager())
264 264
 			{
265 265
 				$v = $mgr->decrypt(base64_decode(urldecode($token)));
266 266
 				$params = unserialize($v);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID())
284 284
 		{
285 285
 		  $params = new TActiveFileUploadCallbackParams;
286
-		  foreach ($this->getFiles() as $file) {
286
+		  foreach($this->getFiles() as $file) {
287 287
 			$localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), ''));
288 288
 			$file->setLocalName($localName);
289 289
 			// tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
           	 Options = new Object();
296 296
           	 Options.clientID = '{$_GET['TActiveFileUpload_InputId']}';
297 297
           	 Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}';
298
-			       Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
298
+			       Options.errorCode = '" . (int) !$this->getHasAllFiles() . "';
299 299
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
300 300
           	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
301 301
              Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 	/**
344 344
 	 * Removes localfile on ending of the callback.
345 345
 	 */
346
-	public function onUnload($param){
347
-		if ($this->getPage()->getIsCallback())
346
+	public function onUnload($param) {
347
+		if($this->getPage()->getIsCallback())
348 348
 		{
349 349
 		  foreach($this->getFiles() as $file)
350
-			if($file->getHasFile() && file_exists($file->getLocalName())){
350
+			if($file->getHasFile() && file_exists($file->getLocalName())) {
351 351
 			  unlink($file->getLocalName());
352 352
 		  }
353 353
 		}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	/**
358 358
 	 * @return TBaseActiveCallbackControl standard callback control options.
359 359
 	 */
360
-	public function getActiveControl(){
360
+	public function getActiveControl() {
361 361
 		return $this->getAdapter()->getBaseActiveControl();
362 362
 	}
363 363
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * Adds ID attribute, and renders the javascript for active component.
374 374
 	 * @param THtmlWriter $writer the writer used for the rendering purpose
375 375
 	 */
376
-	public function addAttributesToRender($writer){
376
+	public function addAttributesToRender($writer) {
377 377
 		parent::addAttributesToRender($writer);
378 378
 		$writer->addAttribute('id', $this->getClientID());
379 379
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	/**
384 384
 	 * @return string corresponding javascript class name for this control.
385 385
 	 */
386
-	protected function getClientClassName(){
386
+	protected function getClientClassName() {
387 387
 		return 'Prado.WebUI.TActiveFileUpload';
388 388
 	}
389 389
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	 * 					completeID => complete client ID,
398 398
 	 * 					errorID => error client ID)
399 399
 	 */
400
-	protected function getClientOptions(){
400
+	protected function getClientOptions() {
401 401
 		$options['ID'] = $this->getClientID();
402 402
 		$options['EventTarget'] = $this->getUniqueID();
403 403
 
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 	 * If true, you will not be able to save the uploaded file again.
420 420
 	 * @return boolean true if the file saving is successful
421 421
 	 */
422
-	public function saveAs($fileName, $deleteTempFile = true, $index = 0){
423
-		if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){
424
-			if ($deleteTempFile)
422
+	public function saveAs($fileName, $deleteTempFile = true, $index = 0) {
423
+		if(($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))) {
424
+			if($deleteTempFile)
425 425
 				return rename($this->getLocalName($index), $fileName);
426 426
 			else
427 427
 				return copy($this->getLocalName($index), $fileName);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @return TImage the image displayed when an upload
434 434
 	 * 		completes successfully.
435 435
 	 */
436
-	public function getSuccessImage(){
436
+	public function getSuccessImage() {
437 437
 		$this->ensureChildControls();
438 438
 		return $this->_success;
439 439
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 * @return TImage the image displayed when an upload
443 443
 	 * 		does not complete successfully.
444 444
 	 */
445
-	public function getErrorImage(){
445
+	public function getErrorImage() {
446 446
 		$this->ensureChildControls();
447 447
 		return $this->_error;
448 448
 	}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 * @return TImage the image displayed when an upload
452 452
 	 * 		is in progress.
453 453
 	 */
454
-	public function getBusyImage(){
454
+	public function getBusyImage() {
455 455
 		$this->ensureChildControls();
456 456
 		return $this->_busy;
457 457
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TReCaptcha.php 1 patch
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -167,19 +167,18 @@  discard block
 block discarded – undo
167 167
 	public function getClientSideOptions()
168 168
 	{
169 169
 		$options = [];
170
-		if ($theme = $this->getThemeName())
170
+		if($theme = $this->getThemeName())
171 171
 			$options['theme'] = $theme;
172
-		if ($lang = $this->getLanguage())
172
+		if($lang = $this->getLanguage())
173 173
 			$options['lang'] = $lang;
174
-		if ($trans = $this->getCustomTranslations())
174
+		if($trans = $this->getCustomTranslations())
175 175
 			$options['custom_translations'] = $trans;
176 176
 		return $options;
177 177
 	}
178 178
 
179 179
 	public function validate()
180 180
 	{
181
-		if (!
182
-			  (
181
+		if(!(
183 182
 			($challenge = @$_POST[$this->getChallengeFieldName()])
184 183
 			and
185 184
 			($response = @$_POST[$this->getResponseFieldName()])
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
 	{
225 224
 		// if we're in a callback, then schedule re-rendering of the control
226 225
 		// if not, don't do anything, because a new challenge will be rendered anyway
227
-		if ($this->Page->IsCallback)
226
+		if($this->Page->IsCallback)
228 227
 			$this->Page->CallbackClient->jQuery($this->getClientID() . ' #recaptcha_reload', 'click');
229 228
 	}
230 229
 
@@ -236,7 +235,7 @@  discard block
 block discarded – undo
236 235
 		$divid = $id . '_1_recaptchadiv';
237 236
 		$writer->write('<div id="' . htmlspecialchars($divid) . '">');
238 237
 
239
-		if (!$this->Page->IsCallback)
238
+		if(!$this->Page->IsCallback)
240 239
 			{
241 240
 				$writer->write(TJavaScript::renderScriptBlock(
242 241
 					'var RecaptchaOptions = ' . TJavaScript::jsonEncode($this->getClientSideOptions()) . ';'
@@ -290,7 +289,7 @@  discard block
 block discarded – undo
290 289
 	{
291 290
 		$server = $use_ssl ? self::RECAPTCHA_API_SECURE_SERVER : $server = self::RECAPTCHA_API_SERVER;
292 291
 		$errorpart = '';
293
-		if ($error)
292
+		if($error)
294 293
 			$errorpart = "&amp;error=" . $error;
295 294
 
296 295
 		return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
@@ -306,9 +305,9 @@  discard block
 block discarded – undo
306 305
 	 * @param $data $data - array of string elements to be encoded
307 306
 	 * @return string - encoded request
308 307
 	 */
309
-	private function recaptcha_qsencode ($data) {
308
+	private function recaptcha_qsencode($data) {
310 309
 		$req = "";
311
-		foreach ($data as $key => $value)
310
+		foreach($data as $key => $value)
312 311
 			$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
313 312
 
314 313
 		// Cut the last '&'
@@ -342,7 +341,7 @@  discard block
 block discarded – undo
342 341
 
343 342
 		fwrite($fs, $http_request);
344 343
 
345
-		while (!feof($fs))
344
+		while(!feof($fs))
346 345
 			$response .= fgets($fs, 1160); // One TCP-IP packet
347 346
 		fclose($fs);
348 347
 		$response = explode("\r\n\r\n", $response, 2);
@@ -362,7 +361,7 @@  discard block
 block discarded – undo
362 361
 	private function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = [])
363 362
 	{
364 363
 		//discard spam submissions
365
-		if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0)
364
+		if($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0)
366 365
 			return false;
367 366
 
368 367
 		$response = $this->recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
@@ -376,7 +375,7 @@  discard block
 block discarded – undo
376 375
 
377 376
 		$answers = explode("\n", $response [1]);
378 377
 
379
-		if (trim($answers [0]) == 'true')
378
+		if(trim($answers [0]) == 'true')
380 379
 			return true;
381 380
 		else
382 381
 			return false;
Please login to merge, or discard this patch.