Passed
Push — 1.10.x ( 08890a...2189d7 )
by Yannick
116:38 queued 75:46
created
app/Resources/public/assets/ckeditor/samples/old/assets/posteddata.php 1 patch
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,14 +29,16 @@
 block discarded – undo
29 29
 {
30 30
 	foreach ( $_POST as $key => $value )
31 31
 	{
32
-		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
-			continue;
32
+		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) {
33
+					continue;
34
+		}
34 35
 
35
-		if ( get_magic_quotes_gpc() )
36
-			$value = htmlspecialchars( stripslashes((string)$value) );
37
-		else
38
-			$value = htmlspecialchars( (string)$value );
39
-?>
36
+		if ( get_magic_quotes_gpc() ) {
37
+					$value = htmlspecialchars( stripslashes((string)$value) );
38
+		} else {
39
+					$value = htmlspecialchars( (string)$value );
40
+		}
41
+		?>
40 42
 		<tr>
41 43
 			<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
42 44
 			<td><pre class="samples"><?php echo $value; ?></pre></td>
Please login to merge, or discard this patch.
main/auth/openid/xrds.lib.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
45 45
     if (in_array(OPENID_NS_2_0 .'/signon', $xrds_current_service['types']) ||
46 46
         in_array(OPENID_NS_2_0 .'/server', $xrds_current_service['types'])) {
47 47
       $xrds_current_service['version'] = 2;
48
-    }
49
-    elseif (in_array(OPENID_NS_1_1, $xrds_current_service['types']) ||
48
+    } elseif (in_array(OPENID_NS_1_1, $xrds_current_service['types']) ||
50 49
             in_array(OPENID_NS_1_0, $xrds_current_service['types'])) {
51 50
       $xrds_current_service['version'] = 1;
52 51
     }
Please login to merge, or discard this patch.
main/auth/openid/openid.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@
 block discarded – undo
61 61
  */
62 62
 function _openid_is_xri($identifier) {
63 63
     $firstchar = substr($identifier, 0, 1);
64
-    if ($firstchar == "@" || $firstchar == "=")
65
-        return TRUE;
64
+    if ($firstchar == "@" || $firstchar == "=") {
65
+            return TRUE;
66
+    }
66 67
 
67 68
     if (stristr($identifier, 'xri://') !== FALSE) {
68 69
         return TRUE;
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/PGTStorage/pgt-file.php 1 patch
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,8 +137,12 @@  discard block
 block discarded – undo
137 137
       // call the ancestor's constructor
138 138
       $this->PGTStorage($cas_parent);
139 139
 
140
-      if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
141
-      if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
140
+      if (empty($format) ) {
141
+          $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
142
+      }
143
+      if (empty($path) ) {
144
+          $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
145
+      }
142 146
 
143 147
       // check that the path is an absolute path
144 148
       if (getenv("OS")=="Windows_NT"){
@@ -147,8 +151,7 @@  discard block
 block discarded – undo
147 151
 	     	phpCAS::error('an absolute path is needed for PGT storage to file');
148 152
       	}
149 153
       	
150
-      }
151
-      else
154
+      } else
152 155
       {
153 156
       
154 157
       	if ( $path[0] != '/' ) {
@@ -186,8 +189,9 @@  discard block
 block discarded – undo
186 189
     {
187 190
       phpCAS::traceBegin();
188 191
       // if the storage has already been initialized, return immediatly
189
-      if ( $this->isInitialized() )
190
-	return;
192
+      if ( $this->isInitialized() ) {
193
+      	return;
194
+      }
191 195
       // call the ancestor's method (mark as initialized)
192 196
       parent::init();
193 197
       phpCAS::traceEnd();      
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/PGTStorage/pgt-db.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -166,11 +166,21 @@  discard block
 block discarded – undo
166 166
       // call the ancestor's constructor
167 167
       $this->PGTStorage($cas_parent);
168 168
 
169
-      if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170
-      if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171
-      if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172
-      if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173
-      if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
169
+      if ( empty($database_type) ) {
170
+          $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
171
+      }
172
+      if ( empty($hostname) ) {
173
+          $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
174
+      }
175
+      if ( $port==0 ) {
176
+          $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
177
+      }
178
+      if ( empty($database) ) {
179
+          $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
180
+      }
181
+      if ( empty($table) ) {
182
+          $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
183
+      }
174 184
 
175 185
       // build and store the PEAR DB URL
176 186
       $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
@@ -192,8 +202,9 @@  discard block
 block discarded – undo
192 202
     {
193 203
       phpCAS::traceBegin();
194 204
       // if the storage has already been initialized, return immediatly
195
-      if ( $this->isInitialized() )
196
-		return;
205
+      if ( $this->isInitialized() ) {
206
+      		return;
207
+      }
197 208
       // call the ancestor's method (mark as initialized)
198 209
       parent::init();
199 210
       
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/domxml-php4-to-php5.php 1 patch
Braces   +124 added lines, -57 removed lines patch added patch discarded remove patch
@@ -55,8 +55,12 @@  discard block
 block discarded – undo
55 55
 {
56 56
 	$dom=new php4DOMDocument($mode);
57 57
 	$errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION');
58
-	if ($errorMode) libxml_use_internal_errors(true);
59
-	if (!$dom->myDOMNode->load($filename)) $dom=null;
58
+	if ($errorMode) {
59
+	    libxml_use_internal_errors(true);
60
+	}
61
+	if (!$dom->myDOMNode->load($filename)) {
62
+	    $dom=null;
63
+	}
60 64
 	if ($errorMode)
61 65
 	{
62 66
 		$error=array_map('_error_report',libxml_get_errors());
@@ -68,8 +72,12 @@  discard block
 block discarded – undo
68 72
 {
69 73
 	$dom=new php4DOMDocument($mode);
70 74
 	$errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION');
71
-	if ($errorMode) libxml_use_internal_errors(true);
72
-	if (!$dom->myDOMNode->loadXML($str)) $dom=null;
75
+	if ($errorMode) {
76
+	    libxml_use_internal_errors(true);
77
+	}
78
+	if (!$dom->myDOMNode->loadXML($str)) {
79
+	    $dom=null;
80
+	}
73 81
 	if ($errorMode)
74 82
 	{
75 83
 		$error=array_map('_error_report',libxml_get_errors());
@@ -80,8 +88,11 @@  discard block
 block discarded – undo
80 88
 function html_doc($html_doc,$from_file=false)
81 89
 {
82 90
 	$dom=new php4DOMDocument();
83
-	if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc);
84
-	else $result=$dom->myDOMNode->loadHTML($html_doc);
91
+	if ($from_file) {
92
+	    $result=$dom->myDOMNode->loadHTMLFile($html_doc);
93
+	} else {
94
+	    $result=$dom->myDOMNode->loadHTML($html_doc);
95
+	}
85 96
 	return $result ? $dom : null;
86 97
 }
87 98
 function html_doc_file($filename) {return html_doc($filename,true);}
@@ -97,8 +108,11 @@  discard block
 block discarded – undo
97 108
 {
98 109
 	function __get($name)
99 110
 	{
100
-		if ($name==='name') return $this->myDOMNode->name;
101
-		else return parent::__get($name);
111
+		if ($name==='name') {
112
+		    return $this->myDOMNode->name;
113
+		} else {
114
+		    return parent::__get($name);
115
+		}
102 116
 	}
103 117
 	function name() {return $this->myDOMNode->name;}
104 118
 	function set_content($text) {}
@@ -113,14 +127,24 @@  discard block
 block discarded – undo
113 127
 	{
114 128
 		$this->myDOMNode=new DOMDocument();
115 129
 		$this->myOwnerDocument=$this;
116
-		if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse=true;
117
-		if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover=true;
118
-		if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities=true;
119
-		if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace=false;
130
+		if ($mode & DOMXML_LOAD_VALIDATING) {
131
+		    $this->myDOMNode->validateOnParse=true;
132
+		}
133
+		if ($mode & DOMXML_LOAD_RECOVERING) {
134
+		    $this->myDOMNode->recover=true;
135
+		}
136
+		if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) {
137
+		    $this->myDOMNode->substituteEntities=true;
138
+		}
139
+		if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) {
140
+		    $this->myDOMNode->preserveWhiteSpace=false;
141
+		}
120 142
 	}
121 143
 	function add_root($name)
122 144
 	{
123
-		if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
145
+		if ($this->myDOMNode->hasChildNodes()) {
146
+		    $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
147
+		}
124 148
 		return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument);
125 149
 	}
126 150
 	function create_attribute($name,$value)
@@ -134,8 +158,12 @@  discard block
 block discarded – undo
134 158
 	function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
135 159
 	function create_element_ns($uri,$name,$prefix=null)
136 160
 	{
137
-		if ($prefix==null) $prefix=$this->myDOMNode->lookupPrefix($uri);
138
-		if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix='a'.sprintf('%u',crc32($uri));
161
+		if ($prefix==null) {
162
+		    $prefix=$this->myDOMNode->lookupPrefix($uri);
163
+		}
164
+		if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) {
165
+		    $prefix='a'.sprintf('%u',crc32($uri));
166
+		}
139 167
 		return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this);
140 168
 	}
141 169
 	function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22
@@ -155,15 +183,22 @@  discard block
 block discarded – undo
155 183
 		$format0=$this->myDOMNode->formatOutput;
156 184
 		$this->myDOMNode->formatOutput=$format;
157 185
 		$encoding0=$this->myDOMNode->encoding;
158
-		if ($encoding) $this->myDOMNode->encoding=$encoding;
186
+		if ($encoding) {
187
+		    $this->myDOMNode->encoding=$encoding;
188
+		}
159 189
 		$dump=$this->myDOMNode->saveXML();
160 190
 		$this->myDOMNode->formatOutput=$format0;
161
-		if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding
191
+		if ($encoding) {
192
+		    $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0;
193
+		}
194
+		//UTF-8 is XML default encoding
162 195
 		return $dump;
163 196
 	}
164 197
 	function free()
165 198
 	{
166
-		if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
199
+		if ($this->myDOMNode->hasChildNodes()) {
200
+		    $this->myDOMNode->removeChild($this->myDOMNode->firstChild);
201
+		}
167 202
 		$this->myDOMNode=null;
168 203
 		$this->myOwnerDocument=null;
169 204
 	}
@@ -173,8 +208,9 @@  discard block
 block discarded – undo
173 208
 		$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
174 209
 		$nodeSet=array();
175 210
 		$i=0;
176
-		if (isset($myDOMNodeList))
177
-			while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this);
211
+		if (isset($myDOMNodeList)) {
212
+					while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this);
213
+		}
178 214
 		return $nodeSet;
179 215
 	}
180 216
 	function html_dump_mem() {return $this->myDOMNode->saveHTML();}
@@ -187,8 +223,9 @@  discard block
 block discarded – undo
187 223
 {
188 224
 	function add_namespace($uri,$prefix)
189 225
 	{
190
-		if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false;
191
-		else
226
+		if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) {
227
+		    return false;
228
+		} else
192 229
 		{
193 230
 			$this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08
194 231
 			return true;
@@ -201,8 +238,9 @@  discard block
 block discarded – undo
201 238
 		$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
202 239
 		$nodeSet=array();
203 240
 		$i=0;
204
-		if (isset($myDOMNodeList))
205
-			while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
241
+		if (isset($myDOMNodeList)) {
242
+					while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
243
+		}
206 244
 		return $nodeSet;
207 245
 	}
208 246
 	function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
@@ -222,17 +260,23 @@  discard block
 block discarded – undo
222 260
 	}*/
223 261
 	function set_name($name)
224 262
 	{
225
-		if ($this->myDOMNode->prefix=='') $newNode=$this->myDOMNode->ownerDocument->createElement($name);
226
-		else $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name);
263
+		if ($this->myDOMNode->prefix=='') {
264
+		    $newNode=$this->myDOMNode->ownerDocument->createElement($name);
265
+		} else {
266
+		    $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name);
267
+		}
227 268
 		$myDOMNodeList=$this->myDOMNode->attributes;
228 269
 		$i=0;
229
-		if (isset($myDOMNodeList))
230
-			while ($node=$myDOMNodeList->item($i++))
270
+		if (isset($myDOMNodeList)) {
271
+					while ($node=$myDOMNodeList->item($i++))
231 272
 				if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value);
232
-				else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value);
273
+		} else {
274
+				    $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value);
275
+				}
233 276
 		$myDOMNodeList=$this->myDOMNode->childNodes;
234
-		if (isset($myDOMNodeList))
235
-			while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node);
277
+		if (isset($myDOMNodeList)) {
278
+					while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node);
279
+		}
236 280
 		$this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode);
237 281
 		$this->myDOMNode=$newNode;
238 282
 		return true;
@@ -270,10 +314,14 @@  discard block
 block discarded – undo
270 314
 	function attributes()
271 315
 	{
272 316
 		$myDOMNodeList=$this->myDOMNode->attributes;
273
-		if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null;
317
+		if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) {
318
+		    return null;
319
+		}
274 320
 		$nodeSet=array();
275 321
 		$i=0;
276
-		while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
322
+		while ($node=$myDOMNodeList->item($i++)) {
323
+		    $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
324
+		}
277 325
 		return $nodeSet;
278 326
 	}
279 327
 	function child_nodes()
@@ -281,8 +329,9 @@  discard block
 block discarded – undo
281 329
 		$myDOMNodeList=$this->myDOMNode->childNodes;
282 330
 		$nodeSet=array();
283 331
 		$i=0;
284
-		if (isset($myDOMNodeList))
285
-			while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument);
332
+		if (isset($myDOMNodeList)) {
333
+					while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument);
334
+		}
286 335
 		return $nodeSet;
287 336
 	}
288 337
 	function children() {return $this->child_nodes();}
@@ -342,15 +391,20 @@  discard block
 block discarded – undo
342 391
 			$parent->removeAttributeNode($this->myDOMNode);
343 392
 			$parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue);
344 393
 			$this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName);
345
-		}
346
-		elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE)
394
+		} elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE)
347 395
 		{
348 396
 			$NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName);
349
-			foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true));
350
-			foreach ($this->myDOMNode->childNodes as $n) $NewNode->appendChild($n->cloneNode(true));
397
+			foreach ($this->myDOMNode->attributes as $n) {
398
+			    $NewNode->appendChild($n->cloneNode(true));
399
+			}
400
+			foreach ($this->myDOMNode->childNodes as $n) {
401
+			    $NewNode->appendChild($n->cloneNode(true));
402
+			}
351 403
 			$xpath=new DOMXPath($this->myDOMNode->ownerDocument);
352 404
 			$myDOMNodeList=$xpath->query('namespace::*[name()!="xml"]',$this->myDOMNode); //Add old namespaces
353
-			foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue); 
405
+			foreach ($myDOMNodeList as $n) {
406
+			    $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue);
407
+			}
354 408
 			$this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode);
355 409
 			$this->myDOMNode=$NewNode;
356 410
 		}
@@ -359,14 +413,19 @@  discard block
 block discarded – undo
359 413
 	{
360 414
 		if ($this->myDOMNode->parentNode!=null)
361 415
 		{
362
-			if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode);
363
-			else $this->myDOMNode->parentNode->removeChild($this->myDOMNode);
416
+			if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) {
417
+			    $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode);
418
+			} else {
419
+			    $this->myDOMNode->parentNode->removeChild($this->myDOMNode);
420
+			}
364 421
 		}
365 422
 	}
366 423
 	protected function _importNode($newnode) {return $this->myOwnerDocument===$newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode,true);} //To import DOMNode from another DOMDocument
367 424
 	static function _newDOMElement($aDOMNode,$aOwnerDocument)
368 425
 	{//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper
369
-		if ($aDOMNode==null) return null;
426
+		if ($aDOMNode==null) {
427
+		    return null;
428
+		}
370 429
 		switch ($aDOMNode->nodeType)
371 430
 		{
372 431
 			case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument);
@@ -388,8 +447,11 @@  discard block
 block discarded – undo
388 447
 {
389 448
 	function __get($name)
390 449
 	{
391
-		if ($name==='tagname') return '#text';
392
-		else return parent::__get($name);
450
+		if ($name==='tagname') {
451
+		    return '#text';
452
+		} else {
453
+		    return parent::__get($name);
454
+		}
393 455
 	}
394 456
 	function tagname() {return '#text';}
395 457
 	function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;}
@@ -417,8 +479,9 @@  discard block
 block discarded – undo
417 479
 	public $value;
418 480
 	function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
419 481
 	{
420
-		if (!isset($aDOMNodelist)) return; 
421
-		elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist))
482
+		if (!isset($aDOMNodelist)) {
483
+		    return;
484
+		} elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist))
422 485
 		{
423 486
 			if ($aDOMNodelist->length>0)
424 487
 			{
@@ -426,20 +489,19 @@  discard block
 block discarded – undo
426 489
 				$this->nodeset=array();
427 490
 				$this->type=XPATH_NODESET;
428 491
 				$i=0;
429
-				while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument);
492
+				while ($node=$this->myDOMNodelist->item($i++)) {
493
+				    $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument);
494
+				}
430 495
 			}
431
-		}
432
-		elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist))
496
+		} elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist))
433 497
 		{
434 498
 			$this->type=XPATH_NUMBER;
435 499
 			$this->value=$aDOMNodelist;
436
-		}
437
-		elseif (is_bool($aDOMNodelist))
500
+		} elseif (is_bool($aDOMNodelist))
438 501
 		{
439 502
 			$this->type=XPATH_BOOLEAN;
440 503
 			$this->value=$aDOMNodelist;
441
-		}
442
-		elseif (is_string($aDOMNodelist))
504
+		} elseif (is_string($aDOMNodelist))
443 505
 		{
444 506
 			$this->type=XPATH_STRING;
445 507
 			$this->value=$aDOMNodelist;
@@ -459,8 +521,11 @@  discard block
 block discarded – undo
459 521
 	}
460 522
 	function xpath_eval($eval_str,$contextnode=null)
461 523
 	{
462
-		if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str);
463
-		else $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str);
524
+		if (method_exists($this->myDOMXPath,'evaluate')) {
525
+		    $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str);
526
+		} else {
527
+		    $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str);
528
+		}
464 529
 		$xp=new php4DOMNodelist($xp,$this->myOwnerDocument);
465 530
 		return ($xp->type===XPATH_UNDEFINED) ? false : $xp;
466 531
 	}
@@ -482,7 +547,9 @@  discard block
 block discarded – undo
482 547
 		}
483 548
 		function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
484 549
 		{
485
-			foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value);
550
+			foreach ($xslt_parameters as $param=>$value) {
551
+			    $this->myxsltProcessor->setParameter('',$param,$value);
552
+			}
486 553
 			$myphp4DOMDocument=new php4DOMDocument();
487 554
 			$myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
488 555
 			return $myphp4DOMDocument;
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/client.php 1 patch
Braces   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -193,8 +193,9 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	function getLang()
195 195
 		{
196
-		if ( empty($this->_lang) )
197
-			$this->setLang(PHPCAS_LANG_DEFAULT);
196
+		if ( empty($this->_lang) ) {
197
+					$this->setLang(PHPCAS_LANG_DEFAULT);
198
+		}
198 199
 		return $this->_lang;
199 200
 		}
200 201
 	
@@ -596,14 +597,14 @@  discard block
 block discarded – undo
596 597
 					phpCAS::trace("No session found, creating new session");
597 598
 					session_start();
598 599
 				}
599
-			}else{
600
+			} else{
600 601
 				phpCAS::trace("Ticket found");
601 602
 				// We have to copy any old data before renaming the session
602 603
 				if (session_id()) {
603 604
 					phpCAS::trace("Old active session found, saving old data and destroying session");
604 605
 					$old_session = $_SESSION;
605 606
 					session_destroy();	
606
-				}else{
607
+				} else{
607 608
 					session_start();
608 609
 					phpCAS::trace("Starting possible old session to copy variables");
609 610
 					$old_session = $_SESSION;
@@ -620,7 +621,7 @@  discard block
 block discarded – undo
620 621
 					$_SESSION = $old_session;
621 622
 				}
622 623
 			}
623
-		}else{
624
+		} else{
624 625
 			phpCAS::trace("Skipping session creation");
625 626
 		}
626 627
 		
@@ -631,9 +632,10 @@  discard block
 block discarded – undo
631 632
 		//check version
632 633
 		switch ($server_version) {
633 634
 			case CAS_VERSION_1_0:
634
-				if ( $this->isProxy() )
635
-					phpCAS::error('CAS proxies are not supported in CAS '
635
+				if ( $this->isProxy() ) {
636
+									phpCAS::error('CAS proxies are not supported in CAS '
636 637
 						.$server_version);
638
+				}
637 639
 				break;
638 640
 			case CAS_VERSION_2_0:
639 641
 				break;
@@ -817,8 +819,9 @@  discard block
 block discarded – undo
817 819
 	function renewAuthentication(){
818 820
 		phpCAS::traceBegin();
819 821
 		// Either way, the user is authenticated by CAS
820
-		if( isset( $_SESSION['phpCAS']['auth_checked'] ) )
821
-			unset($_SESSION['phpCAS']['auth_checked']);
822
+		if( isset( $_SESSION['phpCAS']['auth_checked'] ) ) {
823
+					unset($_SESSION['phpCAS']['auth_checked']);
824
+		}
822 825
 		if ( $this->isAuthenticated() ) {
823 826
 			phpCAS::trace('user already authenticated; renew');
824 827
 			$this->redirectToCas(false,true);
@@ -897,8 +900,10 @@  discard block
 block discarded – undo
897 900
 			//	    // never reached
898 901
 			//	    $res = FALSE;
899 902
 			// avoid a check against CAS on every request
900
-			if (! isset($_SESSION['phpCAS']['unauth_count']) )
901
-				$_SESSION['phpCAS']['unauth_count'] = -2; // uninitialized
903
+			if (! isset($_SESSION['phpCAS']['unauth_count']) ) {
904
+							$_SESSION['phpCAS']['unauth_count'] = -2;
905
+			}
906
+			// uninitialized
902 907
 			
903 908
 			if (($_SESSION['phpCAS']['unauth_count'] != -2 && $this->_cache_times_for_auth_recheck == -1) 
904 909
 					|| ($_SESSION['phpCAS']['unauth_count'] >= 0 && $_SESSION['phpCAS']['unauth_count'] < $this->_cache_times_for_auth_recheck))
@@ -909,13 +914,11 @@  discard block
 block discarded – undo
909 914
 				{
910 915
 					$_SESSION['phpCAS']['unauth_count']++;
911 916
 					phpCAS::trace('user is not authenticated (cached for '.$_SESSION['phpCAS']['unauth_count'].' times of '.$this->_cache_times_for_auth_recheck.')');
912
-				}
913
-				else
917
+				} else
914 918
 				{
915 919
 					phpCAS::trace('user is not authenticated (cached for until login pressed)');
916 920
 				}
917
-			}
918
-			else
921
+			} else
919 922
 			{
920 923
 				$_SESSION['phpCAS']['unauth_count'] = 0;
921 924
 				$_SESSION['phpCAS']['auth_checked'] = true;
@@ -948,8 +951,7 @@  discard block
 block discarded – undo
948 951
 			// authenticated, nothing to be done.
949 952
 			phpCAS::trace('user was already authenticated, no need to look for tickets');
950 953
 			$res = TRUE;
951
-		}
952
-		else {
954
+		} else {
953 955
 			if ( $this->hasST() ) {
954 956
 				// if a Service Ticket was given, validate it
955 957
 				phpCAS::trace('ST `'.$this->getST().'\' is present');
@@ -962,8 +964,7 @@  discard block
 block discarded – undo
962 964
 				}
963 965
 				$_SESSION['phpCAS']['user'] = $this->getUser();
964 966
 				$res = TRUE;
965
-			}
966
-			elseif ( $this->hasPT() ) {
967
+			} elseif ( $this->hasPT() ) {
967 968
 				// if a Proxy Ticket was given, validate it
968 969
 				phpCAS::trace('PT `'.$this->getPT().'\' is present');
969 970
 				$this->validatePT($validate_url,$text_response,$tree_response); // note: if it fails, it halts
@@ -975,8 +976,7 @@  discard block
 block discarded – undo
975 976
 				}
976 977
 				$_SESSION['phpCAS']['user'] = $this->getUser();
977 978
 				$res = TRUE;
978
-			}
979
-			elseif ( $this->hasSA() ) {
979
+			} elseif ( $this->hasSA() ) {
980 980
 				// if we have a SAML ticket, validate it.
981 981
 				phpCAS::trace('SA `'.$this->getSA().'\' is present');
982 982
 				$this->validateSA($validate_url,$text_response,$tree_response); // if it fails, it halts
@@ -984,8 +984,7 @@  discard block
 block discarded – undo
984 984
 				$_SESSION['phpCAS']['user'] = $this->getUser();
985 985
 				$_SESSION['phpCAS']['attributes'] = $this->getAttributes();
986 986
 				$res = TRUE;
987
-			}
988
-			else {
987
+			} else {
989 988
 				// no ticket given, not authenticated
990 989
 				phpCAS::trace('no ticket found');
991 990
 			}
@@ -1581,8 +1580,7 @@  discard block
 block discarded – undo
1581 1580
 			foreach($attr_array as $attr_key => $attr_value) {
1582 1581
 				if(count($attr_value) > 1) {
1583 1582
 					$this->_attributes[$attr_key] = $attr_value;
1584
-				}
1585
-				else {
1583
+				} else {
1586 1584
 					$this->_attributes[$attr_key] = $attr_value[0];
1587 1585
 				}
1588 1586
 			}
@@ -2601,8 +2599,9 @@  discard block
 block discarded – undo
2601 2599
 				$query_string	= $this->removeParameterFromQueryString('ticket', $request_uri[1]);
2602 2600
 				
2603 2601
 				// If the query string still has anything left, append it to the final URI
2604
-				if ($query_string !== '')
2605
-					$final_uri	.= "?$query_string";
2602
+				if ($query_string !== '') {
2603
+									$final_uri	.= "?$query_string";
2604
+				}
2606 2605
 				
2607 2606
 			}
2608 2607
 			
@@ -2680,10 +2679,11 @@  discard block
 block discarded – undo
2680 2679
 						phpCAS::trace('Reason: CAS error');
2681 2680
 						break;
2682 2681
 					case CAS_VERSION_2_0:
2683
-						if ( empty($err_code) )
2684
-							phpCAS::trace('Reason: no CAS error');
2685
-						else
2686
-							phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg);
2682
+						if ( empty($err_code) ) {
2683
+													phpCAS::trace('Reason: no CAS error');
2684
+						} else {
2685
+													phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg);
2686
+						}
2687 2687
 						break;
2688 2688
 				}
2689 2689
 			}
Please login to merge, or discard this patch.
main/auth/conditional_login/complete_phone_number.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,8 +4,9 @@
 block discarded – undo
4 4
 require_once dirname(__FILE__).'/../../inc/global.inc.php';
5 5
 $url =  api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php';
6 6
 
7
-if (! isset($_SESSION['conditional_login']['uid']))
7
+if (! isset($_SESSION['conditional_login']['uid'])) {
8 8
   die("Not Authorised");
9
+}
9 10
 ?>
10 11
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
11 12
 <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">
Please login to merge, or discard this patch.
main/auth/external_login/functions.inc.php 1 patch
Braces   +37 added lines, -24 removed lines patch added patch discarded remove patch
@@ -95,30 +95,43 @@
 block discarded – undo
95 95
  * */
96 96
 function external_add_user($u) {
97 97
     //Setting default
98
-    if (empty($u['password']))
99
-        $u['password'] = null;
100
-    if (empty($u['status']))
101
-        $u['status'] = 5;
102
-    if (!isset($u['official_code']))
103
-        $u['official_code'] = '';
104
-    if (!isset($u['language']))
105
-        $u['language'] = '';
106
-    if (!isset($u['phone']))
107
-        $u['phone'] = '';
108
-    if (!isset($u['picture_uri']))
109
-        $u['picture_uri'] = '';
110
-    if (!isset($u['auth_source']))
111
-        $u['auth_source'] = PLATFORM_AUTH_SOURCE;
112
-    if (!isset($u['expiration_date']))
113
-        $u['expiration_date'] = '0000-00-00 00:00:00';
114
-    if (!isset($u['active']))
115
-        $u['active'] = 1;
116
-    if (!isset($u['hr_dept_id']))
117
-        $u['hr_dept_id'] = 0; //id of responsible HR
118
-    if (!isset($u['extra']))
119
-        $u['extra'] = null;
120
-    if (!isset($u['encrypt_method']))
121
-        $u['encrypt_method'] = '';
98
+    if (empty($u['password'])) {
99
+            $u['password'] = null;
100
+    }
101
+    if (empty($u['status'])) {
102
+            $u['status'] = 5;
103
+    }
104
+    if (!isset($u['official_code'])) {
105
+            $u['official_code'] = '';
106
+    }
107
+    if (!isset($u['language'])) {
108
+            $u['language'] = '';
109
+    }
110
+    if (!isset($u['phone'])) {
111
+            $u['phone'] = '';
112
+    }
113
+    if (!isset($u['picture_uri'])) {
114
+            $u['picture_uri'] = '';
115
+    }
116
+    if (!isset($u['auth_source'])) {
117
+            $u['auth_source'] = PLATFORM_AUTH_SOURCE;
118
+    }
119
+    if (!isset($u['expiration_date'])) {
120
+            $u['expiration_date'] = '0000-00-00 00:00:00';
121
+    }
122
+    if (!isset($u['active'])) {
123
+            $u['active'] = 1;
124
+    }
125
+    if (!isset($u['hr_dept_id'])) {
126
+            $u['hr_dept_id'] = 0;
127
+    }
128
+    //id of responsible HR
129
+    if (!isset($u['extra'])) {
130
+            $u['extra'] = null;
131
+    }
132
+    if (!isset($u['encrypt_method'])) {
133
+            $u['encrypt_method'] = '';
134
+    }
122 135
 
123 136
     $chamilo_uid = UserManager::create_user($u['firstname'], $u['lastname'], $u['status'], $u['email'], $u['username'], $u['password'], $u['official_code'], $u['language'], $u['phone'], $u['picture_uri'], $u['auth_source'], $u['expiration_date'], $u['active'], $u['hr_dept_id'], $u['extra'], $u['encrypt_method']);
124 137
     return $chamilo_uid;
Please login to merge, or discard this patch.