Completed
Push — 1.10.x ( 25211a...2f974c )
by Yannick
209:43 queued 168:30
created
main/inc/lib/xajax/xajaxCompress.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -39,6 +39,7 @@
 block discarded – undo
39 39
  * (used internally)
40 40
  *
41 41
  * @param string contains the Javascript code to compress
42
+ * @param string $sJS
42 43
  */
43 44
 function xajaxCompressJavascript($sJS)
44 45
 {
Please login to merge, or discard this patch.
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -42,141 +42,141 @@
 block discarded – undo
42 42
  */
43 43
 function xajaxCompressJavascript($sJS)
44 44
 {
45
-	//remove windows cariage returns
46
-	$sJS = str_replace("\r","",$sJS);
47
-
48
-	//array to store replaced literal strings
49
-	$literal_strings = array();
50
-
51
-	//explode the string into lines
52
-	$lines = explode("\n",$sJS);
53
-	//loop through all the lines, building a new string at the same time as removing literal strings
54
-	$clean = "";
55
-	$inComment = false;
56
-	$literal = "";
57
-	$inQuote = false;
58
-	$escaped = false;
59
-	$quoteChar = "";
60
-
61
-	for($i=0;$i<count($lines);$i++)
62
-	{
63
-		$line = $lines[$i];
64
-		$inNormalComment = false;
65
-
66
-		//loop through line's characters and take out any literal strings, replace them with ___i___ where i is the index of this string
67
-		for($j=0;$j<strlen($line);$j++)
68
-		{
69
-			$c = substr($line,$j,1);
70
-			$d = substr($line,$j,2);
71
-
72
-			//look for start of quote
73
-			if(!$inQuote && !$inComment)
74
-			{
75
-				//is this character a quote or a comment
76
-				if(($c=="\"" || $c=="'") && !$inComment && !$inNormalComment)
77
-				{
78
-					$inQuote = true;
79
-					$inComment = false;
80
-					$escaped = false;
81
-					$quoteChar = $c;
82
-					$literal = $c;
83
-				}
84
-				else if($d=="/*" && !$inNormalComment)
85
-				{
86
-					$inQuote = false;
87
-					$inComment = true;
88
-					$escaped = false;
89
-					$quoteChar = $d;
90
-					$literal = $d;
91
-					$j++;
92
-				}
93
-				else if($d=="//") //ignore string markers that are found inside comments
94
-				{
95
-					$inNormalComment = true;
96
-					$clean .= $c;
97
-				}
98
-				else
99
-				{
100
-					$clean .= $c;
101
-				}
102
-			}
103
-			else //allready in a string so find end quote
104
-			{
105
-				if($c == $quoteChar && !$escaped && !$inComment)
106
-				{
107
-					$inQuote = false;
108
-					$literal .= $c;
109
-
110
-					//subsitute in a marker for the string
111
-					$clean .= "___" . count($literal_strings) . "___";
112
-
113
-					//push the string onto our array
114
-					array_push($literal_strings,$literal);
115
-
116
-				}
117
-				else if($inComment && $d=="*/")
118
-				{
119
-					$inComment = false;
120
-					$literal .= $d;
121
-
122
-					//subsitute in a marker for the string
123
-					$clean .= "___" . count($literal_strings) . "___";
124
-
125
-					//push the string onto our array
126
-					array_push($literal_strings,$literal);
127
-
128
-					$j++;
129
-				}
130
-				else if($c == "\\" && !$escaped)
131
-					$escaped = true;
132
-				else
133
-					$escaped = false;
134
-
135
-				$literal .= $c;
136
-			}
137
-		}
138
-		if($inComment) $literal .= "\n";
139
-		$clean .= "\n";
140
-	}
141
-	//explode the clean string into lines again
142
-	$lines = explode("\n",$clean);
143
-
144
-	//now process each line at a time
145
-	for($i=0;$i<count($lines);$i++)
146
-	{
147
-		$line = $lines[$i];
148
-
149
-		//remove comments
150
-		$line = preg_replace("/\/\/(.*)/","",$line);
151
-
152
-		//strip leading and trailing whitespace
153
-		$line = trim($line);
154
-
155
-		//remove all whitespace with a single space
156
-		$line = preg_replace("/\s+/"," ",$line);
157
-
158
-		//remove any whitespace that occurs after/before an operator
159
-		$line = preg_replace("/\s*([!\}\{;,&=\|\-\+\*\/\)\(:])\s*/","\\1",$line);
160
-
161
-		$lines[$i] = $line;
162
-	}
163
-
164
-	//implode the lines
165
-	$sJS = implode("\n",$lines);
166
-
167
-	//make sure there is a max of 1 \n after each line
168
-	$sJS = preg_replace("/[\n]+/","\n",$sJS);
169
-
170
-	//strip out line breaks that immediately follow a semi-colon
171
-	$sJS = preg_replace("/;\n/",";",$sJS);
172
-
173
-	//curly brackets aren't on their own
174
-	$sJS = preg_replace("/[\n]*\{[\n]*/","{",$sJS);
175
-
176
-	//finally loop through and replace all the literal strings:
177
-	for($i=0;$i<count($literal_strings);$i++)
178
-		$sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
179
-
180
-	return $sJS;
45
+    //remove windows cariage returns
46
+    $sJS = str_replace("\r","",$sJS);
47
+
48
+    //array to store replaced literal strings
49
+    $literal_strings = array();
50
+
51
+    //explode the string into lines
52
+    $lines = explode("\n",$sJS);
53
+    //loop through all the lines, building a new string at the same time as removing literal strings
54
+    $clean = "";
55
+    $inComment = false;
56
+    $literal = "";
57
+    $inQuote = false;
58
+    $escaped = false;
59
+    $quoteChar = "";
60
+
61
+    for($i=0;$i<count($lines);$i++)
62
+    {
63
+        $line = $lines[$i];
64
+        $inNormalComment = false;
65
+
66
+        //loop through line's characters and take out any literal strings, replace them with ___i___ where i is the index of this string
67
+        for($j=0;$j<strlen($line);$j++)
68
+        {
69
+            $c = substr($line,$j,1);
70
+            $d = substr($line,$j,2);
71
+
72
+            //look for start of quote
73
+            if(!$inQuote && !$inComment)
74
+            {
75
+                //is this character a quote or a comment
76
+                if(($c=="\"" || $c=="'") && !$inComment && !$inNormalComment)
77
+                {
78
+                    $inQuote = true;
79
+                    $inComment = false;
80
+                    $escaped = false;
81
+                    $quoteChar = $c;
82
+                    $literal = $c;
83
+                }
84
+                else if($d=="/*" && !$inNormalComment)
85
+                {
86
+                    $inQuote = false;
87
+                    $inComment = true;
88
+                    $escaped = false;
89
+                    $quoteChar = $d;
90
+                    $literal = $d;
91
+                    $j++;
92
+                }
93
+                else if($d=="//") //ignore string markers that are found inside comments
94
+                {
95
+                    $inNormalComment = true;
96
+                    $clean .= $c;
97
+                }
98
+                else
99
+                {
100
+                    $clean .= $c;
101
+                }
102
+            }
103
+            else //allready in a string so find end quote
104
+            {
105
+                if($c == $quoteChar && !$escaped && !$inComment)
106
+                {
107
+                    $inQuote = false;
108
+                    $literal .= $c;
109
+
110
+                    //subsitute in a marker for the string
111
+                    $clean .= "___" . count($literal_strings) . "___";
112
+
113
+                    //push the string onto our array
114
+                    array_push($literal_strings,$literal);
115
+
116
+                }
117
+                else if($inComment && $d=="*/")
118
+                {
119
+                    $inComment = false;
120
+                    $literal .= $d;
121
+
122
+                    //subsitute in a marker for the string
123
+                    $clean .= "___" . count($literal_strings) . "___";
124
+
125
+                    //push the string onto our array
126
+                    array_push($literal_strings,$literal);
127
+
128
+                    $j++;
129
+                }
130
+                else if($c == "\\" && !$escaped)
131
+                    $escaped = true;
132
+                else
133
+                    $escaped = false;
134
+
135
+                $literal .= $c;
136
+            }
137
+        }
138
+        if($inComment) $literal .= "\n";
139
+        $clean .= "\n";
140
+    }
141
+    //explode the clean string into lines again
142
+    $lines = explode("\n",$clean);
143
+
144
+    //now process each line at a time
145
+    for($i=0;$i<count($lines);$i++)
146
+    {
147
+        $line = $lines[$i];
148
+
149
+        //remove comments
150
+        $line = preg_replace("/\/\/(.*)/","",$line);
151
+
152
+        //strip leading and trailing whitespace
153
+        $line = trim($line);
154
+
155
+        //remove all whitespace with a single space
156
+        $line = preg_replace("/\s+/"," ",$line);
157
+
158
+        //remove any whitespace that occurs after/before an operator
159
+        $line = preg_replace("/\s*([!\}\{;,&=\|\-\+\*\/\)\(:])\s*/","\\1",$line);
160
+
161
+        $lines[$i] = $line;
162
+    }
163
+
164
+    //implode the lines
165
+    $sJS = implode("\n",$lines);
166
+
167
+    //make sure there is a max of 1 \n after each line
168
+    $sJS = preg_replace("/[\n]+/","\n",$sJS);
169
+
170
+    //strip out line breaks that immediately follow a semi-colon
171
+    $sJS = preg_replace("/;\n/",";",$sJS);
172
+
173
+    //curly brackets aren't on their own
174
+    $sJS = preg_replace("/[\n]*\{[\n]*/","{",$sJS);
175
+
176
+    //finally loop through and replace all the literal strings:
177
+    for($i=0;$i<count($literal_strings);$i++)
178
+        $sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
179
+
180
+    return $sJS;
181 181
 }
182 182
 ?>
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 function xajaxCompressJavascript($sJS)
44 44
 {
45 45
 	//remove windows cariage returns
46
-	$sJS = str_replace("\r","",$sJS);
46
+	$sJS = str_replace("\r", "", $sJS);
47 47
 
48 48
 	//array to store replaced literal strings
49 49
 	$literal_strings = array();
50 50
 
51 51
 	//explode the string into lines
52
-	$lines = explode("\n",$sJS);
52
+	$lines = explode("\n", $sJS);
53 53
 	//loop through all the lines, building a new string at the same time as removing literal strings
54 54
 	$clean = "";
55 55
 	$inComment = false;
@@ -58,22 +58,22 @@  discard block
 block discarded – undo
58 58
 	$escaped = false;
59 59
 	$quoteChar = "";
60 60
 
61
-	for($i=0;$i<count($lines);$i++)
61
+	for ($i = 0; $i < count($lines); $i++)
62 62
 	{
63 63
 		$line = $lines[$i];
64 64
 		$inNormalComment = false;
65 65
 
66 66
 		//loop through line's characters and take out any literal strings, replace them with ___i___ where i is the index of this string
67
-		for($j=0;$j<strlen($line);$j++)
67
+		for ($j = 0; $j < strlen($line); $j++)
68 68
 		{
69
-			$c = substr($line,$j,1);
70
-			$d = substr($line,$j,2);
69
+			$c = substr($line, $j, 1);
70
+			$d = substr($line, $j, 2);
71 71
 
72 72
 			//look for start of quote
73
-			if(!$inQuote && !$inComment)
73
+			if (!$inQuote && !$inComment)
74 74
 			{
75 75
 				//is this character a quote or a comment
76
-				if(($c=="\"" || $c=="'") && !$inComment && !$inNormalComment)
76
+				if (($c == "\"" || $c == "'") && !$inComment && !$inNormalComment)
77 77
 				{
78 78
 					$inQuote = true;
79 79
 					$inComment = false;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 					$quoteChar = $c;
82 82
 					$literal = $c;
83 83
 				}
84
-				else if($d=="/*" && !$inNormalComment)
84
+				else if ($d == "/*" && !$inNormalComment)
85 85
 				{
86 86
 					$inQuote = false;
87 87
 					$inComment = true;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 					$literal = $d;
91 91
 					$j++;
92 92
 				}
93
-				else if($d=="//") //ignore string markers that are found inside comments
93
+				else if ($d == "//") //ignore string markers that are found inside comments
94 94
 				{
95 95
 					$inNormalComment = true;
96 96
 					$clean .= $c;
@@ -102,32 +102,32 @@  discard block
 block discarded – undo
102 102
 			}
103 103
 			else //allready in a string so find end quote
104 104
 			{
105
-				if($c == $quoteChar && !$escaped && !$inComment)
105
+				if ($c == $quoteChar && !$escaped && !$inComment)
106 106
 				{
107 107
 					$inQuote = false;
108 108
 					$literal .= $c;
109 109
 
110 110
 					//subsitute in a marker for the string
111
-					$clean .= "___" . count($literal_strings) . "___";
111
+					$clean .= "___".count($literal_strings)."___";
112 112
 
113 113
 					//push the string onto our array
114
-					array_push($literal_strings,$literal);
114
+					array_push($literal_strings, $literal);
115 115
 
116 116
 				}
117
-				else if($inComment && $d=="*/")
117
+				else if ($inComment && $d == "*/")
118 118
 				{
119 119
 					$inComment = false;
120 120
 					$literal .= $d;
121 121
 
122 122
 					//subsitute in a marker for the string
123
-					$clean .= "___" . count($literal_strings) . "___";
123
+					$clean .= "___".count($literal_strings)."___";
124 124
 
125 125
 					//push the string onto our array
126
-					array_push($literal_strings,$literal);
126
+					array_push($literal_strings, $literal);
127 127
 
128 128
 					$j++;
129 129
 				}
130
-				else if($c == "\\" && !$escaped)
130
+				else if ($c == "\\" && !$escaped)
131 131
 					$escaped = true;
132 132
 				else
133 133
 					$escaped = false;
@@ -135,47 +135,47 @@  discard block
 block discarded – undo
135 135
 				$literal .= $c;
136 136
 			}
137 137
 		}
138
-		if($inComment) $literal .= "\n";
138
+		if ($inComment) $literal .= "\n";
139 139
 		$clean .= "\n";
140 140
 	}
141 141
 	//explode the clean string into lines again
142
-	$lines = explode("\n",$clean);
142
+	$lines = explode("\n", $clean);
143 143
 
144 144
 	//now process each line at a time
145
-	for($i=0;$i<count($lines);$i++)
145
+	for ($i = 0; $i < count($lines); $i++)
146 146
 	{
147 147
 		$line = $lines[$i];
148 148
 
149 149
 		//remove comments
150
-		$line = preg_replace("/\/\/(.*)/","",$line);
150
+		$line = preg_replace("/\/\/(.*)/", "", $line);
151 151
 
152 152
 		//strip leading and trailing whitespace
153 153
 		$line = trim($line);
154 154
 
155 155
 		//remove all whitespace with a single space
156
-		$line = preg_replace("/\s+/"," ",$line);
156
+		$line = preg_replace("/\s+/", " ", $line);
157 157
 
158 158
 		//remove any whitespace that occurs after/before an operator
159
-		$line = preg_replace("/\s*([!\}\{;,&=\|\-\+\*\/\)\(:])\s*/","\\1",$line);
159
+		$line = preg_replace("/\s*([!\}\{;,&=\|\-\+\*\/\)\(:])\s*/", "\\1", $line);
160 160
 
161 161
 		$lines[$i] = $line;
162 162
 	}
163 163
 
164 164
 	//implode the lines
165
-	$sJS = implode("\n",$lines);
165
+	$sJS = implode("\n", $lines);
166 166
 
167 167
 	//make sure there is a max of 1 \n after each line
168
-	$sJS = preg_replace("/[\n]+/","\n",$sJS);
168
+	$sJS = preg_replace("/[\n]+/", "\n", $sJS);
169 169
 
170 170
 	//strip out line breaks that immediately follow a semi-colon
171
-	$sJS = preg_replace("/;\n/",";",$sJS);
171
+	$sJS = preg_replace("/;\n/", ";", $sJS);
172 172
 
173 173
 	//curly brackets aren't on their own
174
-	$sJS = preg_replace("/[\n]*\{[\n]*/","{",$sJS);
174
+	$sJS = preg_replace("/[\n]*\{[\n]*/", "{", $sJS);
175 175
 
176 176
 	//finally loop through and replace all the literal strings:
177
-	for($i=0;$i<count($literal_strings);$i++)
178
-		$sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
177
+	for ($i = 0; $i < count($literal_strings); $i++)
178
+		$sJS = str_replace("___".$i."___", $literal_strings[$i], $sJS);
179 179
 
180 180
 	return $sJS;
181 181
 }
Please login to merge, or discard this patch.
Braces   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
 					$escaped = false;
81 81
 					$quoteChar = $c;
82 82
 					$literal = $c;
83
-				}
84
-				else if($d=="/*" && !$inNormalComment)
83
+				} else if($d=="/*" && !$inNormalComment)
85 84
 				{
86 85
 					$inQuote = false;
87 86
 					$inComment = true;
@@ -89,18 +88,17 @@  discard block
 block discarded – undo
89 88
 					$quoteChar = $d;
90 89
 					$literal = $d;
91 90
 					$j++;
92
-				}
93
-				else if($d=="//") //ignore string markers that are found inside comments
91
+				} else if($d=="//") {
92
+				    //ignore string markers that are found inside comments
94 93
 				{
95 94
 					$inNormalComment = true;
96
-					$clean .= $c;
97 95
 				}
98
-				else
96
+					$clean .= $c;
97
+				} else
99 98
 				{
100 99
 					$clean .= $c;
101 100
 				}
102
-			}
103
-			else //allready in a string so find end quote
101
+			} else //allready in a string so find end quote
104 102
 			{
105 103
 				if($c == $quoteChar && !$escaped && !$inComment)
106 104
 				{
@@ -113,8 +111,7 @@  discard block
 block discarded – undo
113 111
 					//push the string onto our array
114 112
 					array_push($literal_strings,$literal);
115 113
 
116
-				}
117
-				else if($inComment && $d=="*/")
114
+				} else if($inComment && $d=="*/")
118 115
 				{
119 116
 					$inComment = false;
120 117
 					$literal .= $d;
@@ -126,16 +123,18 @@  discard block
 block discarded – undo
126 123
 					array_push($literal_strings,$literal);
127 124
 
128 125
 					$j++;
126
+				} else if($c == "\\" && !$escaped) {
127
+									$escaped = true;
128
+				} else {
129
+									$escaped = false;
129 130
 				}
130
-				else if($c == "\\" && !$escaped)
131
-					$escaped = true;
132
-				else
133
-					$escaped = false;
134 131
 
135 132
 				$literal .= $c;
136 133
 			}
137 134
 		}
138
-		if($inComment) $literal .= "\n";
135
+		if($inComment) {
136
+		    $literal .= "\n";
137
+		}
139 138
 		$clean .= "\n";
140 139
 	}
141 140
 	//explode the clean string into lines again
@@ -174,8 +173,9 @@  discard block
 block discarded – undo
174 173
 	$sJS = preg_replace("/[\n]*\{[\n]*/","{",$sJS);
175 174
 
176 175
 	//finally loop through and replace all the literal strings:
177
-	for($i=0;$i<count($literal_strings);$i++)
178
-		$sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
176
+	for($i=0;$i<count($literal_strings);$i++) {
177
+			$sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
178
+	}
179 179
 
180 180
 	return $sJS;
181 181
 }
Please login to merge, or discard this patch.
main/inc/lib/xajax/xajaxResponse.inc.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,6 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @param string  contains the character encoding string to use
98 98
 	 * @param boolean lets you set if you want special characters in the output
99 99
 	 *                converted to HTML entities
100
+	 * @param string $sEncoding
100 101
 	 *
101 102
 	 */
102 103
 	function xajaxResponse($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
@@ -223,6 +224,8 @@  discard block
 block discarded – undo
223 224
 	 * @param string contains the id of an HTML element
224 225
 	 * @param string the part of the element you wish to clear ("innerHTML",
225 226
 	 *               "value", etc.)
227
+	 * @param string $sTarget
228
+	 * @param string $sAttribute
226 229
 	 */
227 230
 	function addClear($sTarget,$sAttribute)
228 231
 	{
@@ -279,6 +282,7 @@  discard block
 block discarded – undo
279 282
 	 * <i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>
280 283
 	 *
281 284
 	 * @param string contains Javascript code to be executed
285
+	 * @param string $sJS
282 286
 	 */
283 287
 	function addScript($sJS)
284 288
 	{
@@ -290,8 +294,6 @@  discard block
 block discarded – undo
290 294
 	 *
291 295
 	 * <i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>
292 296
 	 *
293
-	 * @param string $sFunc the name of a Javascript function
294
-	 * @param mixed $args,... optional arguments to pass to the Javascript function
295 297
 	 */
296 298
 	function addScriptCall() {
297 299
 		$arguments = func_get_args();
Please login to merge, or discard this patch.
Braces   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -258,8 +258,9 @@  discard block
 block discarded – undo
258 258
 		{
259 259
 			$queryStart++;
260 260
 			$queryEnd = strpos($sURL, '#', $queryStart);
261
-			if ($queryEnd === FALSE)
262
-				$queryEnd = strlen($sURL);
261
+			if ($queryEnd === FALSE) {
262
+							$queryEnd = strlen($sURL);
263
+			}
263 264
 			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
264 265
             $queryParts = array();
265 266
 			parse_str($queryPart, $queryParts);
@@ -487,8 +488,9 @@  discard block
 block discarded – undo
487 488
 	function getXML()
488 489
 	{
489 490
 		$sXML = "<?xml version=\"1.0\"";
490
-		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
-			$sXML .= " encoding=\"".$this->sEncoding."\"";
491
+		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0) {
492
+					$sXML .= " encoding=\"".$this->sEncoding."\"";
493
+		}
492 494
 		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493 495
 
494 496
 		return $sXML;
@@ -538,20 +540,21 @@  discard block
 block discarded – undo
538 540
 			elseif (function_exists('mb_convert_encoding')) {
539 541
 			//
540 542
 				$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
-			}
542
-			else {
543
+			} else {
543 544
 				trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544 545
 			}
545 546
 		}
546 547
 		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
548
-			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
550
-			$xml .= "><![CDATA[$sData]]></cmd>";
551
-		else if ($sData !== null)
552
-			$xml .= ">$sData</cmd>";
553
-		else
554
-			$xml .= "></cmd>";
548
+		foreach($aAttributes as $sAttribute => $sValue) {
549
+					$xml .= " $sAttribute=\"$sValue\"";
550
+		}
551
+		if ($sData !== null && !stristr($sData,'<![CDATA[')) {
552
+					$xml .= "><![CDATA[$sData]]></cmd>";
553
+		} else if ($sData !== null) {
554
+					$xml .= ">$sData</cmd>";
555
+		} else {
556
+					$xml .= "></cmd>";
557
+		}
555 558
 
556 559
 		return $xml;
557 560
 	}
@@ -566,11 +569,12 @@  discard block
 block discarded – undo
566 569
 	 * @return string serialized XML
567 570
 	 */
568 571
 	function _buildObjXml($var) {
569
-		if (gettype($var) == "object") $var = get_object_vars($var);
572
+		if (gettype($var) == "object") {
573
+		    $var = get_object_vars($var);
574
+		}
570 575
 		if (!is_array($var)) {
571 576
 			return "<![CDATA[$var]]>";
572
-		}
573
-		else {
577
+		} else {
574 578
 			$data = "<xjxobj>";
575 579
 			foreach ($var as $key => $value) {
576 580
 				$data .= "<e>";
Please login to merge, or discard this patch.
Indentation   +512 added lines, -512 removed lines patch added patch discarded remove patch
@@ -67,521 +67,521 @@
 block discarded – undo
67 67
  */
68 68
 class xajaxResponse
69 69
 {
70
-	/**#@+
70
+    /**#@+
71 71
 	 * @access protected
72 72
 	 */
73
-	/**
74
-	 * @var string internal XML storage
75
-	 */
76
-	var $xml;
77
-	/**
78
-	 * @var string the encoding type to use
79
-	 */
80
-	var $sEncoding;
81
-	/**
82
-	 * @var boolean if special characters in the XML should be converted to
83
-	 *              entities
84
-	 */
85
-	var $bOutputEntities;
86
-
87
-	/**#@-*/
88
-
89
-	/**
90
-	 * The constructor's main job is to set the character encoding for the
91
-	 * response.
92
-	 *
93
-	 * <i>Note:</i> to change the character encoding for all of the
94
-	 * responses, set the XAJAX_DEFAULT_ENCODING constant before you
95
-	 * instantiate xajax.
96
-	 *
97
-	 * @param string  contains the character encoding string to use
98
-	 * @param boolean lets you set if you want special characters in the output
99
-	 *                converted to HTML entities
100
-	 *
101
-	 */
102
-	public function __construct($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
103
-	{
104
-		$this->setCharEncoding($sEncoding);
105
-		$this->bOutputEntities = $bOutputEntities;
106
-	}
107
-
108
-	/**
109
-	 * Sets the character encoding for the response based on $sEncoding, which
110
-	 * is a string containing the character encoding to use. You don't need to
111
-	 * use this method normally, since the character encoding for the response
112
-	 * gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
113
-	 * constant.
114
-	 *
115
-	 * @param string
116
-	 */
117
-	function setCharEncoding($sEncoding)
118
-	{
119
-		$this->sEncoding = $sEncoding;
120
-	}
121
-
122
-	/**
123
-	 * Tells the response object to convert special characters to HTML entities
124
-	 * automatically (only works if the mb_string extension is available).
125
-	 */
126
-	function outputEntitiesOn()
127
-	{
128
-		$this->bOutputEntities = true;
129
-	}
130
-
131
-	/**
132
-	 * Tells the response object to output special characters intact. (default
133
-	 * behavior)
134
-	 */
135
-	function outputEntitiesOff()
136
-	{
137
-		$this->bOutputEntities = false;
138
-	}
139
-
140
-	/**
141
-	 * Adds a confirm commands command message to the XML response.
142
-	 *
143
-	 * <i>Usage:</i> <kbd>$objResponse->addConfirmCommands(1, "Do you want to preview the new data?");</kbd>
144
-	 *
145
-	 * @param integer the number of commands to skip if the user presses
146
-	 *                Cancel in the browsers's confirm dialog
147
-	 * @param string  the message to show in the browser's confirm dialog
148
-	 */
149
-	function addConfirmCommands($iCmdNumber, $sMessage)
150
-	{
151
-		$this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
152
-	}
153
-
154
-	/**
155
-	 * Adds an assign command message to the XML response.
156
-	 *
157
-	 * <i>Usage:</i> <kbd>$objResponse->addAssign("contentDiv", "innerHTML", "Some Text");</kbd>
158
-	 *
159
-	 * @param string contains the id of an HTML element
160
-	 * @param string the part of the element you wish to modify ("innerHTML",
161
-	 *               "value", etc.)
162
-	 * @param string the data you want to set the attribute to
163
-	 */
164
-	function addAssign($sTarget,$sAttribute,$sData)
165
-	{
166
-		$this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
167
-	}
168
-
169
-	/**
170
-	 * Adds an append command message to the XML response.
171
-	 *
172
-	 * <i>Usage:</i> <kbd>$objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");</kbd>
173
-	 *
174
-	 * @param string contains the id of an HTML element
175
-	 * @param string the part of the element you wish to modify ("innerHTML",
176
-	 *               "value", etc.)
177
-	 * @param string the data you want to append to the end of the attribute
178
-	 */
179
-	function addAppend($sTarget,$sAttribute,$sData)
180
-	{
181
-		$this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
182
-	}
183
-
184
-	/**
185
-	 * Adds an prepend command message to the XML response.
186
-	 *
187
-	 * <i>Usage:</i> <kbd>$objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");</kbd>
188
-	 *
189
-	 * @param string contains the id of an HTML element
190
-	 * @param string the part of the element you wish to modify ("innerHTML",
191
-	 *               "value", etc.)
192
-	 * @param string the data you want to prepend to the beginning of the
193
-	 *               attribute
194
-	 */
195
-	function addPrepend($sTarget,$sAttribute,$sData)
196
-	{
197
-		$this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
198
-	}
199
-
200
-	/**
201
-	 * Adds a replace command message to the XML response.
202
-	 *
203
-	 * <i>Usage:</i> <kbd>$objResponse->addReplace("contentDiv", "innerHTML", "text", "<b>text</b>");</kbd>
204
-	 *
205
-	 * @param string contains the id of an HTML element
206
-	 * @param string the part of the element you wish to modify ("innerHTML",
207
-	 *               "value", etc.)
208
-	 * @param string the string to search for
209
-	 * @param string the string to replace the search string when found in the
210
-	 *               attribute
211
-	 */
212
-	function addReplace($sTarget,$sAttribute,$sSearch,$sData)
213
-	{
214
-		$sDta = "<s><![CDATA[$sSearch]]></s><r><![CDATA[$sData]]></r>";
215
-		$this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
216
-	}
217
-
218
-	/**
219
-	 * Adds a clear command message to the XML response.
220
-	 *
221
-	 * <i>Usage:</i> <kbd>$objResponse->addClear("contentDiv", "innerHTML");</kbd>
222
-	 *
223
-	 * @param string contains the id of an HTML element
224
-	 * @param string the part of the element you wish to clear ("innerHTML",
225
-	 *               "value", etc.)
226
-	 */
227
-	function addClear($sTarget,$sAttribute)
228
-	{
229
-		$this->addAssign($sTarget,$sAttribute,'');
230
-	}
231
-
232
-	/**
233
-	 * Adds an alert command message to the XML response.
234
-	 *
235
-	 * <i>Usage:</i> <kbd>$objResponse->addAlert("This is important information");</kbd>
236
-	 *
237
-	 * @param string the text to be displayed in the Javascript alert box
238
-	 */
239
-	function addAlert($sMsg)
240
-	{
241
-		$this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
242
-	}
243
-
244
-	/**
245
-	 * Uses the addScript() method to add a Javascript redirect to another URL.
246
-	 *
247
-	 * <i>Usage:</i> <kbd>$objResponse->addRedirect("http://www.xajaxproject.org");</kbd>
248
-	 *
249
-	 * @param string the URL to redirect the client browser to
250
-	 */
251
-	function addRedirect($sURL)
252
-	{
253
-		//we need to parse the query part so that the values are rawurlencode()'ed
254
-		//can't just use parse_url() cos we could be dealing with a relative URL which
255
-		//  parse_url() can't deal with.
256
-		$queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
257
-		if ($queryStart !== FALSE)
258
-		{
259
-			$queryStart++;
260
-			$queryEnd = strpos($sURL, '#', $queryStart);
261
-			if ($queryEnd === FALSE)
262
-				$queryEnd = strlen($sURL);
263
-			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
73
+    /**
74
+     * @var string internal XML storage
75
+     */
76
+    var $xml;
77
+    /**
78
+     * @var string the encoding type to use
79
+     */
80
+    var $sEncoding;
81
+    /**
82
+     * @var boolean if special characters in the XML should be converted to
83
+     *              entities
84
+     */
85
+    var $bOutputEntities;
86
+
87
+    /**#@-*/
88
+
89
+    /**
90
+     * The constructor's main job is to set the character encoding for the
91
+     * response.
92
+     *
93
+     * <i>Note:</i> to change the character encoding for all of the
94
+     * responses, set the XAJAX_DEFAULT_ENCODING constant before you
95
+     * instantiate xajax.
96
+     *
97
+     * @param string  contains the character encoding string to use
98
+     * @param boolean lets you set if you want special characters in the output
99
+     *                converted to HTML entities
100
+     *
101
+     */
102
+    public function __construct($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
103
+    {
104
+        $this->setCharEncoding($sEncoding);
105
+        $this->bOutputEntities = $bOutputEntities;
106
+    }
107
+
108
+    /**
109
+     * Sets the character encoding for the response based on $sEncoding, which
110
+     * is a string containing the character encoding to use. You don't need to
111
+     * use this method normally, since the character encoding for the response
112
+     * gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
113
+     * constant.
114
+     *
115
+     * @param string
116
+     */
117
+    function setCharEncoding($sEncoding)
118
+    {
119
+        $this->sEncoding = $sEncoding;
120
+    }
121
+
122
+    /**
123
+     * Tells the response object to convert special characters to HTML entities
124
+     * automatically (only works if the mb_string extension is available).
125
+     */
126
+    function outputEntitiesOn()
127
+    {
128
+        $this->bOutputEntities = true;
129
+    }
130
+
131
+    /**
132
+     * Tells the response object to output special characters intact. (default
133
+     * behavior)
134
+     */
135
+    function outputEntitiesOff()
136
+    {
137
+        $this->bOutputEntities = false;
138
+    }
139
+
140
+    /**
141
+     * Adds a confirm commands command message to the XML response.
142
+     *
143
+     * <i>Usage:</i> <kbd>$objResponse->addConfirmCommands(1, "Do you want to preview the new data?");</kbd>
144
+     *
145
+     * @param integer the number of commands to skip if the user presses
146
+     *                Cancel in the browsers's confirm dialog
147
+     * @param string  the message to show in the browser's confirm dialog
148
+     */
149
+    function addConfirmCommands($iCmdNumber, $sMessage)
150
+    {
151
+        $this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
152
+    }
153
+
154
+    /**
155
+     * Adds an assign command message to the XML response.
156
+     *
157
+     * <i>Usage:</i> <kbd>$objResponse->addAssign("contentDiv", "innerHTML", "Some Text");</kbd>
158
+     *
159
+     * @param string contains the id of an HTML element
160
+     * @param string the part of the element you wish to modify ("innerHTML",
161
+     *               "value", etc.)
162
+     * @param string the data you want to set the attribute to
163
+     */
164
+    function addAssign($sTarget,$sAttribute,$sData)
165
+    {
166
+        $this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
167
+    }
168
+
169
+    /**
170
+     * Adds an append command message to the XML response.
171
+     *
172
+     * <i>Usage:</i> <kbd>$objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");</kbd>
173
+     *
174
+     * @param string contains the id of an HTML element
175
+     * @param string the part of the element you wish to modify ("innerHTML",
176
+     *               "value", etc.)
177
+     * @param string the data you want to append to the end of the attribute
178
+     */
179
+    function addAppend($sTarget,$sAttribute,$sData)
180
+    {
181
+        $this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
182
+    }
183
+
184
+    /**
185
+     * Adds an prepend command message to the XML response.
186
+     *
187
+     * <i>Usage:</i> <kbd>$objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");</kbd>
188
+     *
189
+     * @param string contains the id of an HTML element
190
+     * @param string the part of the element you wish to modify ("innerHTML",
191
+     *               "value", etc.)
192
+     * @param string the data you want to prepend to the beginning of the
193
+     *               attribute
194
+     */
195
+    function addPrepend($sTarget,$sAttribute,$sData)
196
+    {
197
+        $this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
198
+    }
199
+
200
+    /**
201
+     * Adds a replace command message to the XML response.
202
+     *
203
+     * <i>Usage:</i> <kbd>$objResponse->addReplace("contentDiv", "innerHTML", "text", "<b>text</b>");</kbd>
204
+     *
205
+     * @param string contains the id of an HTML element
206
+     * @param string the part of the element you wish to modify ("innerHTML",
207
+     *               "value", etc.)
208
+     * @param string the string to search for
209
+     * @param string the string to replace the search string when found in the
210
+     *               attribute
211
+     */
212
+    function addReplace($sTarget,$sAttribute,$sSearch,$sData)
213
+    {
214
+        $sDta = "<s><![CDATA[$sSearch]]></s><r><![CDATA[$sData]]></r>";
215
+        $this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
216
+    }
217
+
218
+    /**
219
+     * Adds a clear command message to the XML response.
220
+     *
221
+     * <i>Usage:</i> <kbd>$objResponse->addClear("contentDiv", "innerHTML");</kbd>
222
+     *
223
+     * @param string contains the id of an HTML element
224
+     * @param string the part of the element you wish to clear ("innerHTML",
225
+     *               "value", etc.)
226
+     */
227
+    function addClear($sTarget,$sAttribute)
228
+    {
229
+        $this->addAssign($sTarget,$sAttribute,'');
230
+    }
231
+
232
+    /**
233
+     * Adds an alert command message to the XML response.
234
+     *
235
+     * <i>Usage:</i> <kbd>$objResponse->addAlert("This is important information");</kbd>
236
+     *
237
+     * @param string the text to be displayed in the Javascript alert box
238
+     */
239
+    function addAlert($sMsg)
240
+    {
241
+        $this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
242
+    }
243
+
244
+    /**
245
+     * Uses the addScript() method to add a Javascript redirect to another URL.
246
+     *
247
+     * <i>Usage:</i> <kbd>$objResponse->addRedirect("http://www.xajaxproject.org");</kbd>
248
+     *
249
+     * @param string the URL to redirect the client browser to
250
+     */
251
+    function addRedirect($sURL)
252
+    {
253
+        //we need to parse the query part so that the values are rawurlencode()'ed
254
+        //can't just use parse_url() cos we could be dealing with a relative URL which
255
+        //  parse_url() can't deal with.
256
+        $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
257
+        if ($queryStart !== FALSE)
258
+        {
259
+            $queryStart++;
260
+            $queryEnd = strpos($sURL, '#', $queryStart);
261
+            if ($queryEnd === FALSE)
262
+                $queryEnd = strlen($sURL);
263
+            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
264 264
             $queryParts = array();
265
-			parse_str($queryPart, $queryParts);
266
-			$newQueryPart = "";
267
-			foreach($queryParts as $key => $value)
268
-			{
269
-				$newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
270
-			}
271
-			$sURL = str_replace($queryPart, $newQueryPart, $sURL);
272
-		}
273
-		$this->addScript('window.location = "'.$sURL.'";');
274
-	}
275
-
276
-	/**
277
-	 * Adds a Javascript command message to the XML response.
278
-	 *
279
-	 * <i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>
280
-	 *
281
-	 * @param string contains Javascript code to be executed
282
-	 */
283
-	function addScript($sJS)
284
-	{
285
-		$this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
286
-	}
287
-
288
-	/**
289
-	 * Adds a Javascript function call command message to the XML response.
290
-	 *
291
-	 * <i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>
292
-	 *
293
-	 * @param string $sFunc the name of a Javascript function
294
-	 * @param mixed $args,... optional arguments to pass to the Javascript function
295
-	 */
296
-	function addScriptCall() {
297
-		$arguments = func_get_args();
298
-		$sFunc = array_shift($arguments);
299
-		$sData = $this->_buildObjXml($arguments);
300
-		$this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
301
-	}
302
-
303
-	/**
304
-	 * Adds a remove element command message to the XML response.
305
-	 *
306
-	 * <i>Usage:</i> <kbd>$objResponse->addRemove("Div2");</kbd>
307
-	 *
308
-	 * @param string contains the id of an HTML element to be removed
309
-	 */
310
-	function addRemove($sTarget)
311
-	{
312
-		$this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
313
-	}
314
-
315
-	/**
316
-	 * Adds a create element command message to the XML response.
317
-	 *
318
-	 * <i>Usage:</i> <kbd>$objResponse->addCreate("parentDiv", "h3", "myid");</kbd>
319
-	 *
320
-	 * @param string contains the id of an HTML element to to which the new
321
-	 *               element will be appended.
322
-	 * @param string the tag to be added
323
-	 * @param string the id to be assigned to the new element
324
-	 * @param string deprecated, use the addCreateInput() method instead
325
-	 */
326
-	function addCreate($sParent, $sTag, $sId, $sType="")
327
-	{
328
-		if ($sType)
329
-		{
330
-			trigger_error("The \$sType parameter of addCreate has been deprecated.  Use the addCreateInput() method instead.", E_USER_WARNING);
331
-			return;
332
-		}
333
-		$this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
334
-	}
335
-
336
-	/**
337
-	 * Adds a insert element command message to the XML response.
338
-	 *
339
-	 * <i>Usage:</i> <kbd>$objResponse->addInsert("childDiv", "h3", "myid");</kbd>
340
-	 *
341
-	 * @param string contains the id of the child before which the new element
342
-	 *               will be inserted
343
-	 * @param string the tag to be added
344
-	 * @param string the id to be assigned to the new element
345
-	 */
346
-	function addInsert($sBefore, $sTag, $sId)
347
-	{
348
-		$this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
349
-	}
350
-
351
-	/**
352
-	 * Adds a insert element command message to the XML response.
353
-	 *
354
-	 * <i>Usage:</i> <kbd>$objResponse->addInsertAfter("childDiv", "h3", "myid");</kbd>
355
-	 *
356
-	 * @param string contains the id of the child after which the new element
357
-	 *               will be inserted
358
-	 * @param string the tag to be added
359
-	 * @param string the id to be assigned to the new element
360
-	 */
361
-	function addInsertAfter($sAfter, $sTag, $sId)
362
-	{
363
-		$this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
364
-	}
365
-
366
-	/**
367
-	 * Adds a create input command message to the XML response.
368
-	 *
369
-	 * <i>Usage:</i> <kbd>$objResponse->addCreateInput("form1", "text", "username", "input1");</kbd>
370
-	 *
371
-	 * @param string contains the id of an HTML element to which the new input
372
-	 *               will be appended
373
-	 * @param string the type of input to be created (text, radio, checkbox,
374
-	 *               etc.)
375
-	 * @param string the name to be assigned to the new input and the variable
376
-	 *               name when it is submitted
377
-	 * @param string the id to be assigned to the new input
378
-	 */
379
-	function addCreateInput($sParent, $sType, $sName, $sId)
380
-	{
381
-		$this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
382
-	}
383
-
384
-	/**
385
-	 * Adds an insert input command message to the XML response.
386
-	 *
387
-	 * <i>Usage:</i> <kbd>$objResponse->addInsertInput("input5", "text", "username", "input1");</kbd>
388
-	 *
389
-	 * @param string contains the id of the child before which the new element
390
-	 *               will be inserted
391
-	 * @param string the type of input to be created (text, radio, checkbox,
392
-	 *               etc.)
393
-	 * @param string the name to be assigned to the new input and the variable
394
-	 *               name when it is submitted
395
-	 * @param string the id to be assigned to the new input
396
-	 */
397
-	function addInsertInput($sBefore, $sType, $sName, $sId)
398
-	{
399
-		$this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
400
-	}
401
-
402
-	/**
403
-	 * Adds an insert input command message to the XML response.
404
-	 *
405
-	 * <i>Usage:</i> <kbd>$objResponse->addInsertInputAfter("input7", "text", "email", "input2");</kbd>
406
-	 *
407
-	 * @param string contains the id of the child after which the new element
408
-	 *               will be inserted
409
-	 * @param string the type of input to be created (text, radio, checkbox,
410
-	 *               etc.)
411
-	 * @param string the name to be assigned to the new input and the variable
412
-	 *               name when it is submitted
413
-	 * @param string the id to be assigned to the new input
414
-	 */
415
-	function addInsertInputAfter($sAfter, $sType, $sName, $sId)
416
-	{
417
-		$this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
418
-	}
419
-
420
-	/**
421
-	 * Adds an event command message to the XML response.
422
-	 *
423
-	 * <i>Usage:</i> <kbd>$objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");</kbd>
424
-	 *
425
-	 * @param string contains the id of an HTML element
426
-	 * @param string the event you wish to set ("onclick", "onmouseover", etc.)
427
-	 * @param string the Javascript string you want the event to invoke
428
-	 */
429
-	function addEvent($sTarget,$sEvent,$sScript)
430
-	{
431
-		$this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
432
-	}
433
-
434
-	/**
435
-	 * Adds a handler command message to the XML response.
436
-	 *
437
-	 * <i>Usage:</i> <kbd>$objResponse->addHandler("contentDiv", "onclick", "content_click");</kbd>
438
-	 *
439
-	 * @param string contains the id of an HTML element
440
-	 * @param string the event you wish to set ("onclick", "onmouseover", etc.)
441
-	 * @param string the name of a Javascript function that will handle the
442
-	 *               event. Multiple handlers can be added for the same event
443
-	 */
444
-	function addHandler($sTarget,$sEvent,$sHandler)
445
-	{
446
-		$this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
447
-	}
448
-
449
-	/**
450
-	 * Adds a remove handler command message to the XML response.
451
-	 *
452
-	 * <i>Usage:</i> <kbd>$objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");</kbd>
453
-	 *
454
-	 * @param string contains the id of an HTML element
455
-	 * @param string the event you wish to remove ("onclick", "onmouseover",
456
-	 *               etc.)
457
-	 * @param string the name of a Javascript handler function that you want to
458
-	 *               remove
459
-	 */
460
-	function addRemoveHandler($sTarget,$sEvent,$sHandler)
461
-	{
462
-		$this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
463
-	}
464
-
465
-	/**
466
-	 * Adds an include script command message to the XML response.
467
-	 *
468
-	 * <i>Usage:</i> <kbd>$objResponse->addIncludeScript("functions.js");</kbd>
469
-	 *
470
-	 * @param string URL of the Javascript file to include
471
-	 */
472
-	function addIncludeScript($sFileName)
473
-	{
474
-		$this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
475
-	}
476
-
477
-	/**
478
-	 * Returns the XML to be returned from your function to the xajax processor
479
-	 * on your page. Since xajax 0.2, you can also return an xajaxResponse
480
-	 * object from your function directly, and xajax will automatically request
481
-	 * the XML using this method call.
482
-	 *
483
-	 * <i>Usage:</i> <kbd>return $objResponse->getXML();</kbd>
484
-	 *
485
-	 * @return string response XML data
486
-	 */
487
-	function getXML()
488
-	{
489
-		$sXML = "<?xml version=\"1.0\"";
490
-		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
-			$sXML .= " encoding=\"".$this->sEncoding."\"";
492
-		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493
-
494
-		return $sXML;
495
-	}
496
-
497
-	/**
498
-	 * Adds the commands of the provided response XML output to this response
499
-	 * object
500
-	 *
501
-	 * <i>Usage:</i>
502
-	 * <code>$r1 = $objResponse1->getXML();
503
-	 * $objResponse2->loadXML($r1);
504
-	 * return $objResponse2->getXML();</code>
505
-	 *
506
-	 * @param string the response XML (returned from a getXML() method) to add
507
-	 *               to the end of this response object
508
-	 */
509
-	function loadXML($mXML)
510
-	{
511
-		if (is_a($mXML, "xajaxResponse")) {
512
-			$mXML = $mXML->getXML();
513
-		}
514
-		$sNewXML = "";
515
-		$iStartPos = strpos($mXML, "<xjx>") + 5;
516
-		$sNewXML = substr($mXML, $iStartPos);
517
-		$iEndPos = strpos($sNewXML, "</xjx>");
518
-		$sNewXML = substr($sNewXML, 0, $iEndPos);
519
-		$this->xml .= $sNewXML;
520
-	}
521
-
522
-	/**
523
-	 * Generates XML from command data
524
-	 *
525
-	 * @access private
526
-	 * @param array associative array of attributes
527
-	 * @param string data
528
-	 * @return string XML command
529
-	 */
530
-	function _cmdXML($aAttributes, $sData)
531
-	{
532
-		if ($this->bOutputEntities) {
533
-			// An adaptation for the Dokeos LMS, 22-AUG-2009.
534
-			if (function_exists('api_convert_encoding')) {
535
-				$sData = call_user_func_array('api_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
536
-			}
537
-			//if (function_exists('mb_convert_encoding')) {
538
-			elseif (function_exists('mb_convert_encoding')) {
539
-			//
540
-				$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
-			}
542
-			else {
543
-				trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544
-			}
545
-		}
546
-		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
548
-			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
550
-			$xml .= "><![CDATA[$sData]]></cmd>";
551
-		else if ($sData !== null)
552
-			$xml .= ">$sData</cmd>";
553
-		else
554
-			$xml .= "></cmd>";
555
-
556
-		return $xml;
557
-	}
558
-
559
-	/**
560
-	 * Recursively serializes a data structure in XML so it can be sent to
561
-	 * the client. It could be thought of as the opposite of
562
-	 * {@link xajax::_parseObjXml()}.
563
-	 *
564
-	 * @access private
565
-	 * @param mixed data structure to serialize to XML
566
-	 * @return string serialized XML
567
-	 */
568
-	function _buildObjXml($var) {
569
-		if (gettype($var) == "object") $var = get_object_vars($var);
570
-		if (!is_array($var)) {
571
-			return "<![CDATA[$var]]>";
572
-		}
573
-		else {
574
-			$data = "<xjxobj>";
575
-			foreach ($var as $key => $value) {
576
-				$data .= "<e>";
577
-				$data .= "<k>" . htmlspecialchars($key) . "</k>";
578
-				$data .= "<v>" . $this->_buildObjXml($value) . "</v>";
579
-				$data .= "</e>";
580
-			}
581
-			$data .= "</xjxobj>";
582
-			return $data;
583
-		}
584
-	}
265
+            parse_str($queryPart, $queryParts);
266
+            $newQueryPart = "";
267
+            foreach($queryParts as $key => $value)
268
+            {
269
+                $newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
270
+            }
271
+            $sURL = str_replace($queryPart, $newQueryPart, $sURL);
272
+        }
273
+        $this->addScript('window.location = "'.$sURL.'";');
274
+    }
275
+
276
+    /**
277
+     * Adds a Javascript command message to the XML response.
278
+     *
279
+     * <i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>
280
+     *
281
+     * @param string contains Javascript code to be executed
282
+     */
283
+    function addScript($sJS)
284
+    {
285
+        $this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
286
+    }
287
+
288
+    /**
289
+     * Adds a Javascript function call command message to the XML response.
290
+     *
291
+     * <i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>
292
+     *
293
+     * @param string $sFunc the name of a Javascript function
294
+     * @param mixed $args,... optional arguments to pass to the Javascript function
295
+     */
296
+    function addScriptCall() {
297
+        $arguments = func_get_args();
298
+        $sFunc = array_shift($arguments);
299
+        $sData = $this->_buildObjXml($arguments);
300
+        $this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
301
+    }
302
+
303
+    /**
304
+     * Adds a remove element command message to the XML response.
305
+     *
306
+     * <i>Usage:</i> <kbd>$objResponse->addRemove("Div2");</kbd>
307
+     *
308
+     * @param string contains the id of an HTML element to be removed
309
+     */
310
+    function addRemove($sTarget)
311
+    {
312
+        $this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
313
+    }
314
+
315
+    /**
316
+     * Adds a create element command message to the XML response.
317
+     *
318
+     * <i>Usage:</i> <kbd>$objResponse->addCreate("parentDiv", "h3", "myid");</kbd>
319
+     *
320
+     * @param string contains the id of an HTML element to to which the new
321
+     *               element will be appended.
322
+     * @param string the tag to be added
323
+     * @param string the id to be assigned to the new element
324
+     * @param string deprecated, use the addCreateInput() method instead
325
+     */
326
+    function addCreate($sParent, $sTag, $sId, $sType="")
327
+    {
328
+        if ($sType)
329
+        {
330
+            trigger_error("The \$sType parameter of addCreate has been deprecated.  Use the addCreateInput() method instead.", E_USER_WARNING);
331
+            return;
332
+        }
333
+        $this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
334
+    }
335
+
336
+    /**
337
+     * Adds a insert element command message to the XML response.
338
+     *
339
+     * <i>Usage:</i> <kbd>$objResponse->addInsert("childDiv", "h3", "myid");</kbd>
340
+     *
341
+     * @param string contains the id of the child before which the new element
342
+     *               will be inserted
343
+     * @param string the tag to be added
344
+     * @param string the id to be assigned to the new element
345
+     */
346
+    function addInsert($sBefore, $sTag, $sId)
347
+    {
348
+        $this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
349
+    }
350
+
351
+    /**
352
+     * Adds a insert element command message to the XML response.
353
+     *
354
+     * <i>Usage:</i> <kbd>$objResponse->addInsertAfter("childDiv", "h3", "myid");</kbd>
355
+     *
356
+     * @param string contains the id of the child after which the new element
357
+     *               will be inserted
358
+     * @param string the tag to be added
359
+     * @param string the id to be assigned to the new element
360
+     */
361
+    function addInsertAfter($sAfter, $sTag, $sId)
362
+    {
363
+        $this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
364
+    }
365
+
366
+    /**
367
+     * Adds a create input command message to the XML response.
368
+     *
369
+     * <i>Usage:</i> <kbd>$objResponse->addCreateInput("form1", "text", "username", "input1");</kbd>
370
+     *
371
+     * @param string contains the id of an HTML element to which the new input
372
+     *               will be appended
373
+     * @param string the type of input to be created (text, radio, checkbox,
374
+     *               etc.)
375
+     * @param string the name to be assigned to the new input and the variable
376
+     *               name when it is submitted
377
+     * @param string the id to be assigned to the new input
378
+     */
379
+    function addCreateInput($sParent, $sType, $sName, $sId)
380
+    {
381
+        $this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
382
+    }
383
+
384
+    /**
385
+     * Adds an insert input command message to the XML response.
386
+     *
387
+     * <i>Usage:</i> <kbd>$objResponse->addInsertInput("input5", "text", "username", "input1");</kbd>
388
+     *
389
+     * @param string contains the id of the child before which the new element
390
+     *               will be inserted
391
+     * @param string the type of input to be created (text, radio, checkbox,
392
+     *               etc.)
393
+     * @param string the name to be assigned to the new input and the variable
394
+     *               name when it is submitted
395
+     * @param string the id to be assigned to the new input
396
+     */
397
+    function addInsertInput($sBefore, $sType, $sName, $sId)
398
+    {
399
+        $this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
400
+    }
401
+
402
+    /**
403
+     * Adds an insert input command message to the XML response.
404
+     *
405
+     * <i>Usage:</i> <kbd>$objResponse->addInsertInputAfter("input7", "text", "email", "input2");</kbd>
406
+     *
407
+     * @param string contains the id of the child after which the new element
408
+     *               will be inserted
409
+     * @param string the type of input to be created (text, radio, checkbox,
410
+     *               etc.)
411
+     * @param string the name to be assigned to the new input and the variable
412
+     *               name when it is submitted
413
+     * @param string the id to be assigned to the new input
414
+     */
415
+    function addInsertInputAfter($sAfter, $sType, $sName, $sId)
416
+    {
417
+        $this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
418
+    }
419
+
420
+    /**
421
+     * Adds an event command message to the XML response.
422
+     *
423
+     * <i>Usage:</i> <kbd>$objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");</kbd>
424
+     *
425
+     * @param string contains the id of an HTML element
426
+     * @param string the event you wish to set ("onclick", "onmouseover", etc.)
427
+     * @param string the Javascript string you want the event to invoke
428
+     */
429
+    function addEvent($sTarget,$sEvent,$sScript)
430
+    {
431
+        $this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
432
+    }
433
+
434
+    /**
435
+     * Adds a handler command message to the XML response.
436
+     *
437
+     * <i>Usage:</i> <kbd>$objResponse->addHandler("contentDiv", "onclick", "content_click");</kbd>
438
+     *
439
+     * @param string contains the id of an HTML element
440
+     * @param string the event you wish to set ("onclick", "onmouseover", etc.)
441
+     * @param string the name of a Javascript function that will handle the
442
+     *               event. Multiple handlers can be added for the same event
443
+     */
444
+    function addHandler($sTarget,$sEvent,$sHandler)
445
+    {
446
+        $this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
447
+    }
448
+
449
+    /**
450
+     * Adds a remove handler command message to the XML response.
451
+     *
452
+     * <i>Usage:</i> <kbd>$objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");</kbd>
453
+     *
454
+     * @param string contains the id of an HTML element
455
+     * @param string the event you wish to remove ("onclick", "onmouseover",
456
+     *               etc.)
457
+     * @param string the name of a Javascript handler function that you want to
458
+     *               remove
459
+     */
460
+    function addRemoveHandler($sTarget,$sEvent,$sHandler)
461
+    {
462
+        $this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
463
+    }
464
+
465
+    /**
466
+     * Adds an include script command message to the XML response.
467
+     *
468
+     * <i>Usage:</i> <kbd>$objResponse->addIncludeScript("functions.js");</kbd>
469
+     *
470
+     * @param string URL of the Javascript file to include
471
+     */
472
+    function addIncludeScript($sFileName)
473
+    {
474
+        $this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
475
+    }
476
+
477
+    /**
478
+     * Returns the XML to be returned from your function to the xajax processor
479
+     * on your page. Since xajax 0.2, you can also return an xajaxResponse
480
+     * object from your function directly, and xajax will automatically request
481
+     * the XML using this method call.
482
+     *
483
+     * <i>Usage:</i> <kbd>return $objResponse->getXML();</kbd>
484
+     *
485
+     * @return string response XML data
486
+     */
487
+    function getXML()
488
+    {
489
+        $sXML = "<?xml version=\"1.0\"";
490
+        if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
+            $sXML .= " encoding=\"".$this->sEncoding."\"";
492
+        $sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493
+
494
+        return $sXML;
495
+    }
496
+
497
+    /**
498
+     * Adds the commands of the provided response XML output to this response
499
+     * object
500
+     *
501
+     * <i>Usage:</i>
502
+     * <code>$r1 = $objResponse1->getXML();
503
+     * $objResponse2->loadXML($r1);
504
+     * return $objResponse2->getXML();</code>
505
+     *
506
+     * @param string the response XML (returned from a getXML() method) to add
507
+     *               to the end of this response object
508
+     */
509
+    function loadXML($mXML)
510
+    {
511
+        if (is_a($mXML, "xajaxResponse")) {
512
+            $mXML = $mXML->getXML();
513
+        }
514
+        $sNewXML = "";
515
+        $iStartPos = strpos($mXML, "<xjx>") + 5;
516
+        $sNewXML = substr($mXML, $iStartPos);
517
+        $iEndPos = strpos($sNewXML, "</xjx>");
518
+        $sNewXML = substr($sNewXML, 0, $iEndPos);
519
+        $this->xml .= $sNewXML;
520
+    }
521
+
522
+    /**
523
+     * Generates XML from command data
524
+     *
525
+     * @access private
526
+     * @param array associative array of attributes
527
+     * @param string data
528
+     * @return string XML command
529
+     */
530
+    function _cmdXML($aAttributes, $sData)
531
+    {
532
+        if ($this->bOutputEntities) {
533
+            // An adaptation for the Dokeos LMS, 22-AUG-2009.
534
+            if (function_exists('api_convert_encoding')) {
535
+                $sData = call_user_func_array('api_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
536
+            }
537
+            //if (function_exists('mb_convert_encoding')) {
538
+            elseif (function_exists('mb_convert_encoding')) {
539
+            //
540
+                $sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
+            }
542
+            else {
543
+                trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544
+            }
545
+        }
546
+        $xml = "<cmd";
547
+        foreach($aAttributes as $sAttribute => $sValue)
548
+            $xml .= " $sAttribute=\"$sValue\"";
549
+        if ($sData !== null && !stristr($sData,'<![CDATA['))
550
+            $xml .= "><![CDATA[$sData]]></cmd>";
551
+        else if ($sData !== null)
552
+            $xml .= ">$sData</cmd>";
553
+        else
554
+            $xml .= "></cmd>";
555
+
556
+        return $xml;
557
+    }
558
+
559
+    /**
560
+     * Recursively serializes a data structure in XML so it can be sent to
561
+     * the client. It could be thought of as the opposite of
562
+     * {@link xajax::_parseObjXml()}.
563
+     *
564
+     * @access private
565
+     * @param mixed data structure to serialize to XML
566
+     * @return string serialized XML
567
+     */
568
+    function _buildObjXml($var) {
569
+        if (gettype($var) == "object") $var = get_object_vars($var);
570
+        if (!is_array($var)) {
571
+            return "<![CDATA[$var]]>";
572
+        }
573
+        else {
574
+            $data = "<xjxobj>";
575
+            foreach ($var as $key => $value) {
576
+                $data .= "<e>";
577
+                $data .= "<k>" . htmlspecialchars($key) . "</k>";
578
+                $data .= "<v>" . $this->_buildObjXml($value) . "</v>";
579
+                $data .= "</e>";
580
+            }
581
+            $data .= "</xjxobj>";
582
+            return $data;
583
+        }
584
+    }
585 585
 
586 586
 }// end class xajaxResponse
587 587
 ?>
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *                converted to HTML entities
100 100
 	 *
101 101
 	 */
102
-	public function __construct($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
102
+	public function __construct($sEncoding = XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities = false)
103 103
 	{
104 104
 		$this->setCharEncoding($sEncoding);
105 105
 		$this->bOutputEntities = $bOutputEntities;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	function addConfirmCommands($iCmdNumber, $sMessage)
150 150
 	{
151
-		$this->xml .= $this->_cmdXML(array("n"=>"cc","t"=>$iCmdNumber),$sMessage);
151
+		$this->xml .= $this->_cmdXML(array("n"=>"cc", "t"=>$iCmdNumber), $sMessage);
152 152
 	}
153 153
 
154 154
 	/**
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 *               "value", etc.)
162 162
 	 * @param string the data you want to set the attribute to
163 163
 	 */
164
-	function addAssign($sTarget,$sAttribute,$sData)
164
+	function addAssign($sTarget, $sAttribute, $sData)
165 165
 	{
166
-		$this->xml .= $this->_cmdXML(array("n"=>"as","t"=>$sTarget,"p"=>$sAttribute),$sData);
166
+		$this->xml .= $this->_cmdXML(array("n"=>"as", "t"=>$sTarget, "p"=>$sAttribute), $sData);
167 167
 	}
168 168
 
169 169
 	/**
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 *               "value", etc.)
177 177
 	 * @param string the data you want to append to the end of the attribute
178 178
 	 */
179
-	function addAppend($sTarget,$sAttribute,$sData)
179
+	function addAppend($sTarget, $sAttribute, $sData)
180 180
 	{
181
-		$this->xml .= $this->_cmdXML(array("n"=>"ap","t"=>$sTarget,"p"=>$sAttribute),$sData);
181
+		$this->xml .= $this->_cmdXML(array("n"=>"ap", "t"=>$sTarget, "p"=>$sAttribute), $sData);
182 182
 	}
183 183
 
184 184
 	/**
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 * @param string the data you want to prepend to the beginning of the
193 193
 	 *               attribute
194 194
 	 */
195
-	function addPrepend($sTarget,$sAttribute,$sData)
195
+	function addPrepend($sTarget, $sAttribute, $sData)
196 196
 	{
197
-		$this->xml .= $this->_cmdXML(array("n"=>"pp","t"=>$sTarget,"p"=>$sAttribute),$sData);
197
+		$this->xml .= $this->_cmdXML(array("n"=>"pp", "t"=>$sTarget, "p"=>$sAttribute), $sData);
198 198
 	}
199 199
 
200 200
 	/**
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 * @param string the string to replace the search string when found in the
210 210
 	 *               attribute
211 211
 	 */
212
-	function addReplace($sTarget,$sAttribute,$sSearch,$sData)
212
+	function addReplace($sTarget, $sAttribute, $sSearch, $sData)
213 213
 	{
214 214
 		$sDta = "<s><![CDATA[$sSearch]]></s><r><![CDATA[$sData]]></r>";
215
-		$this->xml .= $this->_cmdXML(array("n"=>"rp","t"=>$sTarget,"p"=>$sAttribute),$sDta);
215
+		$this->xml .= $this->_cmdXML(array("n"=>"rp", "t"=>$sTarget, "p"=>$sAttribute), $sDta);
216 216
 	}
217 217
 
218 218
 	/**
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 	 * @param string the part of the element you wish to clear ("innerHTML",
225 225
 	 *               "value", etc.)
226 226
 	 */
227
-	function addClear($sTarget,$sAttribute)
227
+	function addClear($sTarget, $sAttribute)
228 228
 	{
229
-		$this->addAssign($sTarget,$sAttribute,'');
229
+		$this->addAssign($sTarget, $sAttribute, '');
230 230
 	}
231 231
 
232 232
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	function addAlert($sMsg)
240 240
 	{
241
-		$this->xml .= $this->_cmdXML(array("n"=>"al"),$sMsg);
241
+		$this->xml .= $this->_cmdXML(array("n"=>"al"), $sMsg);
242 242
 	}
243 243
 
244 244
 	/**
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 			$queryEnd = strpos($sURL, '#', $queryStart);
261 261
 			if ($queryEnd === FALSE)
262 262
 				$queryEnd = strlen($sURL);
263
-			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
263
+			$queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
264 264
             $queryParts = array();
265 265
 			parse_str($queryPart, $queryParts);
266 266
 			$newQueryPart = "";
267
-			foreach($queryParts as $key => $value)
267
+			foreach ($queryParts as $key => $value)
268 268
 			{
269 269
 				$newQueryPart .= rawurlencode($key).'='.rawurlencode($value).ini_get('arg_separator.output');
270 270
 			}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	function addScript($sJS)
284 284
 	{
285
-		$this->xml .= $this->_cmdXML(array("n"=>"js"),$sJS);
285
+		$this->xml .= $this->_cmdXML(array("n"=>"js"), $sJS);
286 286
 	}
287 287
 
288 288
 	/**
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$arguments = func_get_args();
298 298
 		$sFunc = array_shift($arguments);
299 299
 		$sData = $this->_buildObjXml($arguments);
300
-		$this->xml .= $this->_cmdXML(array("n"=>"jc","t"=>$sFunc),$sData);
300
+		$this->xml .= $this->_cmdXML(array("n"=>"jc", "t"=>$sFunc), $sData);
301 301
 	}
302 302
 
303 303
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	function addRemove($sTarget)
311 311
 	{
312
-		$this->xml .= $this->_cmdXML(array("n"=>"rm","t"=>$sTarget),'');
312
+		$this->xml .= $this->_cmdXML(array("n"=>"rm", "t"=>$sTarget), '');
313 313
 	}
314 314
 
315 315
 	/**
@@ -323,14 +323,14 @@  discard block
 block discarded – undo
323 323
 	 * @param string the id to be assigned to the new element
324 324
 	 * @param string deprecated, use the addCreateInput() method instead
325 325
 	 */
326
-	function addCreate($sParent, $sTag, $sId, $sType="")
326
+	function addCreate($sParent, $sTag, $sId, $sType = "")
327 327
 	{
328 328
 		if ($sType)
329 329
 		{
330 330
 			trigger_error("The \$sType parameter of addCreate has been deprecated.  Use the addCreateInput() method instead.", E_USER_WARNING);
331 331
 			return;
332 332
 		}
333
-		$this->xml .= $this->_cmdXML(array("n"=>"ce","t"=>$sParent,"p"=>$sId),$sTag);
333
+		$this->xml .= $this->_cmdXML(array("n"=>"ce", "t"=>$sParent, "p"=>$sId), $sTag);
334 334
 	}
335 335
 
336 336
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	function addInsert($sBefore, $sTag, $sId)
347 347
 	{
348
-		$this->xml .= $this->_cmdXML(array("n"=>"ie","t"=>$sBefore,"p"=>$sId),$sTag);
348
+		$this->xml .= $this->_cmdXML(array("n"=>"ie", "t"=>$sBefore, "p"=>$sId), $sTag);
349 349
 	}
350 350
 
351 351
 	/**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	function addInsertAfter($sAfter, $sTag, $sId)
362 362
 	{
363
-		$this->xml .= $this->_cmdXML(array("n"=>"ia","t"=>$sAfter,"p"=>$sId),$sTag);
363
+		$this->xml .= $this->_cmdXML(array("n"=>"ia", "t"=>$sAfter, "p"=>$sId), $sTag);
364 364
 	}
365 365
 
366 366
 	/**
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	function addCreateInput($sParent, $sType, $sName, $sId)
380 380
 	{
381
-		$this->xml .= $this->_cmdXML(array("n"=>"ci","t"=>$sParent,"p"=>$sId,"c"=>$sType),$sName);
381
+		$this->xml .= $this->_cmdXML(array("n"=>"ci", "t"=>$sParent, "p"=>$sId, "c"=>$sType), $sName);
382 382
 	}
383 383
 
384 384
 	/**
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 */
397 397
 	function addInsertInput($sBefore, $sType, $sName, $sId)
398 398
 	{
399
-		$this->xml .= $this->_cmdXML(array("n"=>"ii","t"=>$sBefore,"p"=>$sId,"c"=>$sType),$sName);
399
+		$this->xml .= $this->_cmdXML(array("n"=>"ii", "t"=>$sBefore, "p"=>$sId, "c"=>$sType), $sName);
400 400
 	}
401 401
 
402 402
 	/**
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	function addInsertInputAfter($sAfter, $sType, $sName, $sId)
416 416
 	{
417
-		$this->xml .= $this->_cmdXML(array("n"=>"iia","t"=>$sAfter,"p"=>$sId,"c"=>$sType),$sName);
417
+		$this->xml .= $this->_cmdXML(array("n"=>"iia", "t"=>$sAfter, "p"=>$sId, "c"=>$sType), $sName);
418 418
 	}
419 419
 
420 420
 	/**
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 	 * @param string the event you wish to set ("onclick", "onmouseover", etc.)
427 427
 	 * @param string the Javascript string you want the event to invoke
428 428
 	 */
429
-	function addEvent($sTarget,$sEvent,$sScript)
429
+	function addEvent($sTarget, $sEvent, $sScript)
430 430
 	{
431
-		$this->xml .= $this->_cmdXML(array("n"=>"ev","t"=>$sTarget,"p"=>$sEvent),$sScript);
431
+		$this->xml .= $this->_cmdXML(array("n"=>"ev", "t"=>$sTarget, "p"=>$sEvent), $sScript);
432 432
 	}
433 433
 
434 434
 	/**
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 	 * @param string the name of a Javascript function that will handle the
442 442
 	 *               event. Multiple handlers can be added for the same event
443 443
 	 */
444
-	function addHandler($sTarget,$sEvent,$sHandler)
444
+	function addHandler($sTarget, $sEvent, $sHandler)
445 445
 	{
446
-		$this->xml .= $this->_cmdXML(array("n"=>"ah","t"=>$sTarget,"p"=>$sEvent),$sHandler);
446
+		$this->xml .= $this->_cmdXML(array("n"=>"ah", "t"=>$sTarget, "p"=>$sEvent), $sHandler);
447 447
 	}
448 448
 
449 449
 	/**
@@ -457,9 +457,9 @@  discard block
 block discarded – undo
457 457
 	 * @param string the name of a Javascript handler function that you want to
458 458
 	 *               remove
459 459
 	 */
460
-	function addRemoveHandler($sTarget,$sEvent,$sHandler)
460
+	function addRemoveHandler($sTarget, $sEvent, $sHandler)
461 461
 	{
462
-		$this->xml .= $this->_cmdXML(array("n"=>"rh","t"=>$sTarget,"p"=>$sEvent),$sHandler);
462
+		$this->xml .= $this->_cmdXML(array("n"=>"rh", "t"=>$sTarget, "p"=>$sEvent), $sHandler);
463 463
 	}
464 464
 
465 465
 	/**
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	function addIncludeScript($sFileName)
473 473
 	{
474
-		$this->xml .= $this->_cmdXML(array("n"=>"in"),$sFileName);
474
+		$this->xml .= $this->_cmdXML(array("n"=>"in"), $sFileName);
475 475
 	}
476 476
 
477 477
 	/**
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 		$sXML = "<?xml version=\"1.0\"";
490 490
 		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491 491
 			$sXML .= " encoding=\"".$this->sEncoding."\"";
492
-		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
492
+		$sXML .= " ?"."><xjx>".$this->xml."</xjx>";
493 493
 
494 494
 		return $sXML;
495 495
 	}
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 			}
545 545
 		}
546 546
 		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
547
+		foreach ($aAttributes as $sAttribute => $sValue)
548 548
 			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
549
+		if ($sData !== null && !stristr($sData, '<![CDATA['))
550 550
 			$xml .= "><![CDATA[$sData]]></cmd>";
551 551
 		else if ($sData !== null)
552 552
 			$xml .= ">$sData</cmd>";
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 			$data = "<xjxobj>";
575 575
 			foreach ($var as $key => $value) {
576 576
 				$data .= "<e>";
577
-				$data .= "<k>" . htmlspecialchars($key) . "</k>";
578
-				$data .= "<v>" . $this->_buildObjXml($value) . "</v>";
577
+				$data .= "<k>".htmlspecialchars($key)."</k>";
578
+				$data .= "<v>".$this->_buildObjXml($value)."</v>";
579 579
 				$data .= "</e>";
580 580
 			}
581 581
 			$data .= "</xjxobj>";
Please login to merge, or discard this patch.
main/inc/lib/zombie/zombie_report.class.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -121,6 +121,9 @@
 block discarded – undo
121 121
         return $form->isSubmitted() == false || $form->validate();
122 122
     }
123 123
 
124
+    /**
125
+     * @param string $format
126
+     */
124 127
     function get_ceiling($format = null)
125 128
     {
126 129
         $result = Request::get('ceiling');
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         }
168 168
 
169 169
         $action = $this->get_action();
170
-        $f = array($this, 'action_' . $action);
170
+        $f = array($this, 'action_'.$action);
171 171
         if (is_callable($f)) {
172 172
             return call_user_func($f, $ids);
173 173
         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             $text = get_lang('No');
293 293
         }
294 294
 
295
-        $result = Display::return_icon($image . '.png', $text);
295
+        $result = Display::return_icon($image.'.png', $text);
296 296
         return $result;
297 297
     }
298 298
 
Please login to merge, or discard this patch.
main/install/install.lib.php 4 patches
Doc Comments   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  * This function return the value of a php.ini setting if not "" or if exists,
98 98
  * otherwise return false
99 99
  * @param   string  $phpSetting The name of a PHP setting
100
- * @return  mixed   The value of the setting, or false if not found
100
+ * @return  string|false   The value of the setting, or false if not found
101 101
  */
102 102
 function checkPhpSettingExists($phpSetting)
103 103
 {
@@ -1268,6 +1268,10 @@  discard block
 block discarded – undo
1268 1268
  * @param   string  Extra notice (to show on the right side)
1269 1269
  * @param   boolean Whether to display in update mode
1270 1270
  * @param   string  Additional attribute for the <tr> element
1271
+ * @param string $installType
1272
+ * @param string $parameterName
1273
+ * @param string $formFieldName
1274
+ * @param string $extra_notice
1271 1275
  * @return  void    Direct output
1272 1276
  */
1273 1277
 function displayDatabaseParameter(
@@ -1481,6 +1485,11 @@  discard block
 block discarded – undo
1481 1485
 
1482 1486
     <?php
1483 1487
 }
1488
+/**
1489
+ * @param string $content
1490
+ * @param string $title
1491
+ * @param string $id
1492
+ */
1484 1493
 function panel($content = null, $title = null, $id = null, $style = null) {
1485 1494
     $html = '';
1486 1495
     if (empty($style)) {
@@ -1837,8 +1846,8 @@  discard block
 block discarded – undo
1837 1846
 }
1838 1847
 
1839 1848
 /**
1840
- * @param $current_value
1841
- * @param $wanted_value
1849
+ * @param string $current_value
1850
+ * @param string $wanted_value
1842 1851
  * @return string
1843 1852
  */
1844 1853
 function compare_setting_values($current_value, $wanted_value)
@@ -1855,8 +1864,8 @@  discard block
 block discarded – undo
1855 1864
 }
1856 1865
 
1857 1866
 /**
1858
- * @param $course_dir
1859
- * @param $course_attempt_name
1867
+ * @param string $course_dir
1868
+ * @param string $course_attempt_name
1860 1869
  * @param string $file
1861 1870
  * @return bool
1862 1871
  */
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     if (!is_array($result)) {
397 397
         $result = array();
398 398
         $exceptions = array('.', '..', 'CVS', '.svn');
399
-        $search       = array('_latin',   '_unicode',   '_corporate',   '_org'  , '_KM',   '_');
399
+        $search       = array('_latin', '_unicode', '_corporate', '_org', '_KM', '_');
400 400
         $replace_with = array(' (Latin)', ' (unicode)', ' (corporate)', ' (org)', ' (KM)', ' ');
401 401
         $dirname = api_get_path(SYS_LANG_PATH);
402 402
         $handle = opendir($dirname);
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
     if ($handle = opendir($directory)) {
431 431
         while (false !== ($file = readdir($handle))) {
432 432
             if ($file != "." && $file != "..") {
433
-                if (is_dir($directory. "/" . $file)) {
434
-                    $array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file));
435
-                    $file = $directory . "/" . $file;
433
+                if (is_dir($directory."/".$file)) {
434
+                    $array_items = array_merge($array_items, my_directory_to_array($directory.'/'.$file));
435
+                    $file = $directory."/".$file;
436 436
                     $array_items[] = preg_replace("/\/\//si", '/', $file);
437 437
                 }
438 438
             }
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
     <h2><?php get_lang('WelcomeToTheChamiloInstaller'); ?></h2>
637 637
     <div class="RequirementHeading">
638 638
         <h2><?php echo display_step_sequence(); ?>
639
-            <?php echo get_lang('InstallationLanguage');?>
639
+            <?php echo get_lang('InstallationLanguage'); ?>
640 640
         </h2>
641 641
         <p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
642 642
         <form id="lang_form" method="post" action="<?php echo api_get_self(); ?>">
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
     if (phpversion() < REQUIRED_PHP_VERSION) {
710 710
         echo '<strong><font color="red">'.get_lang('PHPVersionError').'</font></strong>';
711 711
     } else {
712
-        echo '<strong><font color="green">'.get_lang('PHPVersionOK'). ' '.phpversion().'</font></strong>';
712
+        echo '<strong><font color="green">'.get_lang('PHPVersionOK').' '.phpversion().'</font></strong>';
713 713
     }
714 714
     echo '</td>
715 715
             </tr>
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
             if ($file_course_test_was_created == true) {
882 882
                 break;
883 883
             }
884
-            $r = @touch($course_dir.'/test.php',$perm);
884
+            $r = @touch($course_dir.'/test.php', $perm);
885 885
             if ($r === true) {
886 886
                 $fil_perm_verified = $perm;
887 887
                 if (check_course_script_interpretation($course_dir, $course_attempt_name, 'test.php')) {
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 function get_contact_registration_form()
1138 1138
 {
1139 1139
 
1140
-    $html ='
1140
+    $html = '
1141 1141
    <form class="form-horizontal">
1142 1142
     <div class="panel panel-default">
1143 1143
     <div class="panel-body">
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
             <div class="col-sm-9">
1235 1235
                 <div class="radio">
1236 1236
                     <label>
1237
-                        <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes') . '
1237
+                        <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes').'
1238 1238
                     </label>
1239 1239
                 </div>
1240 1240
                 <div class="radio">
@@ -1293,8 +1293,8 @@  discard block
 block discarded – undo
1293 1293
             echo '<input type="hidden" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />';
1294 1294
             echo api_htmlentities($parameterValue);
1295 1295
         } else {
1296
-            echo '<div class="col-sm-5"><input type="' . $inputType . '" class="form-control" size="' . DATABASE_FORM_FIELD_DISPLAY_LENGTH . '" maxlength="' . $maxLength . '" name="' . $formFieldName . '" id="' . $formFieldName . '" value="' . api_htmlentities($parameterValue) . '" />' . "</div>";
1297
-            echo '<div class="col-sm-3">' . $extra_notice . '</div>';
1296
+            echo '<div class="col-sm-5"><input type="'.$inputType.'" class="form-control" size="'.DATABASE_FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.$maxLength.'" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />'."</div>";
1297
+            echo '<div class="col-sm-3">'.$extra_notice.'</div>';
1298 1298
         }
1299 1299
 
1300 1300
     }
@@ -1330,12 +1330,12 @@  discard block
 block discarded – undo
1330 1330
         $dbNameForm = $_configuration['main_database'];
1331 1331
         $dbPortForm = isset($_configuration['db_port']) ? $_configuration['db_port'] : '';
1332 1332
 
1333
-        echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>';
1333
+        echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>';
1334 1334
         echo '<div class="RequirementContent">';
1335 1335
         echo get_lang('DBSettingUpgradeIntro');
1336 1336
         echo '</div>';
1337 1337
     } else {
1338
-        echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>';
1338
+        echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>';
1339 1339
         echo '<div class="RequirementContent">';
1340 1340
         echo get_lang('DBSettingIntro');
1341 1341
         echo '</div>';
@@ -1345,12 +1345,12 @@  discard block
 block discarded – undo
1345 1345
         <div class="panel-body">
1346 1346
         <div class="form-group">
1347 1347
             <label class="col-sm-4"><?php echo get_lang('DBHost'); ?> </label>
1348
-            <?php if ($installType == 'update'){ ?>
1348
+            <?php if ($installType == 'update') { ?>
1349 1349
             <div class="col-sm-5">
1350 1350
                 <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?>
1351 1351
             </div>
1352 1352
             <div class="col-sm-3"></div>
1353
-            <?php }else{ ?>
1353
+            <?php } else { ?>
1354 1354
             <div class="col-sm-5">
1355 1355
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
1356 1356
             </div>
@@ -1359,12 +1359,12 @@  discard block
 block discarded – undo
1359 1359
         </div>
1360 1360
         <div class="form-group">
1361 1361
             <label class="col-sm-4"><?php echo get_lang('DBPort'); ?> </label>
1362
-            <?php if ($installType == 'update'){ ?>
1362
+            <?php if ($installType == 'update') { ?>
1363 1363
             <div class="col-sm-5">
1364 1364
                 <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?>
1365 1365
             </div>
1366 1366
             <div class="col-sm-3"></div>
1367
-            <?php }else{ ?>
1367
+            <?php } else { ?>
1368 1368
             <div class="col-sm-5">
1369 1369
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" />
1370 1370
             </div>
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
             <?php
1391 1391
             //Database Name fix replace weird chars
1392 1392
             if ($installType != INSTALL_TYPE_UPDATE) {
1393
-                $dbNameForm = str_replace(array('-','*', '$', ' ', '.'), '', $dbNameForm);
1393
+                $dbNameForm = str_replace(array('-', '*', '$', ' ', '.'), '', $dbNameForm);
1394 1394
             }
1395 1395
 
1396 1396
             displayDatabaseParameter(
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
     if (!empty($title)) {
1490 1490
         $panelTitle = Display::div($title, array('class' => 'panel-heading'));
1491 1491
         $panelBody = Display::div($content, array('class' => 'panel-body'));
1492
-        $panelParent = Display::div($panelTitle . $panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
1492
+        $panelParent = Display::div($panelTitle.$panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
1493 1493
     } else {
1494 1494
         $panelBody = Display::div($html, array('class' => 'panel-body'));
1495 1495
         $panelParent = Display::div($panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
@@ -1514,9 +1514,9 @@  discard block
 block discarded – undo
1514 1514
     $displayWhenUpdate = 'true'
1515 1515
 ) {
1516 1516
     $html = '<div class="form-group">';
1517
-    $html .= '<label class="col-sm-6 control-label">' . $parameterName . '</label>';
1517
+    $html .= '<label class="col-sm-6 control-label">'.$parameterName.'</label>';
1518 1518
     if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) {
1519
-        $html .= '<input type="hidden" name="' . $formFieldName . '" value="'. api_htmlentities($parameterValue, ENT_QUOTES). '" />' . $parameterValue;
1519
+        $html .= '<input type="hidden" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'.$parameterValue;
1520 1520
     } else {
1521 1521
         $html .= '<div class="col-sm-6"><input class="form-control" type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</div>";
1522 1522
     }
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
         $languageForm = $_SESSION['install_language'];
1564 1564
     }
1565 1565
     echo '<div class="RequirementHeading">';
1566
-    echo "<h2>" . display_step_sequence() . get_lang("CfgSetting") . "</h2>";
1566
+    echo "<h2>".display_step_sequence().get_lang("CfgSetting")."</h2>";
1567 1567
     echo '</div>';
1568 1568
 
1569 1569
     echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>app/config/configuration.php</strong></p>';
@@ -1581,14 +1581,14 @@  discard block
 block discarded – undo
1581 1581
 
1582 1582
     // Parameters 3 and 4: administrator's names
1583 1583
 
1584
-    $html .=  display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
1585
-    $html .=  display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
1584
+    $html .= display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
1585
+    $html .= display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
1586 1586
 
1587 1587
     //Parameter 3: administrator's email
1588
-    $html .=  display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
1588
+    $html .= display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
1589 1589
 
1590 1590
     //Parameter 6: administrator's telephone
1591
-    $html .=  display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
1591
+    $html .= display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
1592 1592
 
1593 1593
 
1594 1594
     echo panel($html, get_lang('Administrator'), 'administrator');
@@ -1607,12 +1607,12 @@  discard block
 block discarded – undo
1607 1607
         $html .= display_language_selection_box('languageForm', $languageForm);
1608 1608
         $html .= '</div>';
1609 1609
     }
1610
-    $html.= "</div>";
1610
+    $html .= "</div>";
1611 1611
 
1612 1612
 
1613 1613
     //Second parameter: Chamilo URL
1614 1614
     $html .= '<div class="form-group">';
1615
-    $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL') .get_lang('ThisFieldIsRequired').'</label>';
1615
+    $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL').get_lang('ThisFieldIsRequired').'</label>';
1616 1616
 
1617 1617
 
1618 1618
 
@@ -1636,34 +1636,34 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
 
1638 1638
     $html .= '<div class="form-group">
1639
-            <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass") . '</label>
1639
+            <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass").'</label>
1640 1640
         <div class="col-sm-6">';
1641 1641
     if ($installType == 'update') {
1642
-        $html .= '<input type="hidden" name="encryptPassForm" value="'. $encryptPassForm .'" />'. $encryptPassForm;
1642
+        $html .= '<input type="hidden" name="encryptPassForm" value="'.$encryptPassForm.'" />'.$encryptPassForm;
1643 1643
     } else {
1644 1644
 
1645 1645
         $html .= '<div class="checkbox">
1646 1646
                     <label>
1647
-                        <input  type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ':'') .'/> bcrypt
1647
+                        <input  type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ' : '').'/> bcrypt
1648 1648
                     </label>';
1649 1649
 
1650 1650
         $html .= '<label>
1651
-                        <input  type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ':'') .'/> sha1
1651
+                        <input  type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ' : '').'/> sha1
1652 1652
                     </label>';
1653 1653
 
1654 1654
         $html .= '<label>
1655
-                        <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ':'') .'/> md5
1655
+                        <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ' : '').'/> md5
1656 1656
                     </label>';
1657 1657
 
1658 1658
         $html .= '<label>
1659
-                        <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ':'') .'/>'. get_lang('None').'
1659
+                        <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ' : '').'/>'.get_lang('None').'
1660 1660
                     </label>';
1661 1661
         $html .= '</div>';
1662 1662
     }
1663 1663
     $html .= '</div></div>';
1664 1664
 
1665 1665
     $html .= '<div class="form-group">
1666
-            <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg') . '</label>
1666
+            <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg').'</label>
1667 1667
             <div class="col-sm-6">';
1668 1668
     if ($installType == 'update') {
1669 1669
         if ($allowSelfReg == 'true') {
@@ -1673,17 +1673,17 @@  discard block
 block discarded – undo
1673 1673
         } else {
1674 1674
             $label = get_lang('AfterApproval');
1675 1675
         }
1676
-        $html .= '<input type="hidden" name="allowSelfReg" value="'. $allowSelfReg .'" />'. $label;
1676
+        $html .= '<input type="hidden" name="allowSelfReg" value="'.$allowSelfReg.'" />'.$label;
1677 1677
     } else {
1678 1678
         $html .= '<div class="control-group">';
1679 1679
         $html .= '<label class="checkbox-inline">
1680
-                        <input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .'
1680
+                        <input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '').' /> '.get_lang('Yes').'
1681 1681
                     </label>';
1682 1682
         $html .= '<label class="checkbox-inline">
1683
-                        <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1683
+                        <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ').' /> '.get_lang('No').'
1684 1684
                     </label>';
1685 1685
          $html .= '<label class="checkbox-inline">
1686
-                    <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1686
+                    <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ').' /> '.get_lang('AfterApproval').'
1687 1687
                 </label>';
1688 1688
         $html .= '</div>';
1689 1689
     }
@@ -1691,7 +1691,7 @@  discard block
 block discarded – undo
1691 1691
     $html .= '</div>';
1692 1692
 
1693 1693
     $html .= '<div class="form-group">';
1694
-    $html .= '<label class="col-sm-6 control-label">'. get_lang('AllowSelfRegProf') .'</label>
1694
+    $html .= '<label class="col-sm-6 control-label">'.get_lang('AllowSelfRegProf').'</label>
1695 1695
         <div class="col-sm-6">';
1696 1696
     if ($installType == 'update') {
1697 1697
         if ($allowSelfRegProf == 'true') {
@@ -1699,16 +1699,16 @@  discard block
 block discarded – undo
1699 1699
         } else {
1700 1700
             $label = get_lang('No');
1701 1701
         }
1702
-        $html .= '<input type="hidden" name="allowSelfRegProf" value="'. $allowSelfRegProf.'" />'. $label;
1702
+        $html .= '<input type="hidden" name="allowSelfRegProf" value="'.$allowSelfRegProf.'" />'.$label;
1703 1703
     } else {
1704 1704
         $html .= '<div class="control-group">
1705 1705
                 <label class="checkbox-inline">
1706
-                    <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '') .'/>
1707
-                ' . get_lang('Yes') .'
1706
+                    <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '').'/>
1707
+                ' . get_lang('Yes').'
1708 1708
                 </label>';
1709 1709
         $html .= '<label class="checkbox-inline">
1710
-                    <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ') .' />
1711
-                   '. get_lang('No') .'
1710
+                    <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ').' />
1711
+                   '. get_lang('No').'
1712 1712
                 </label>';
1713 1713
         $html .= '</div>';
1714 1714
     }
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
         "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar",
1774 1774
         "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway",
1775 1775
         "Oman",
1776
-        "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland","Portugal",
1776
+        "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal",
1777 1777
         "Qatar",
1778 1778
         "Romania", "Russia", "Rwanda",
1779 1779
         "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria",
@@ -1820,11 +1820,11 @@  discard block
 block discarded – undo
1820 1820
     $permissions_for_new_directories = isset($_SESSION['permissions_for_new_directories']) ? $_SESSION['permissions_for_new_directories'] : 0770;
1821 1821
     $permissions_for_new_files = isset($_SESSION['permissions_for_new_files']) ? $_SESSION['permissions_for_new_files'] : 0660;
1822 1822
     // use decoct() to store as string
1823
-    $sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_directories) . "'
1823
+    $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_directories)."'
1824 1824
               WHERE variable  = 'permissions_for_new_directories'";
1825 1825
     Database::query($sql);
1826 1826
 
1827
-    $sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_files) . "' WHERE variable  = 'permissions_for_new_files'";
1827
+    $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_files)."' WHERE variable  = 'permissions_for_new_files'";
1828 1828
     Database::query($sql);
1829 1829
 
1830 1830
     if (isset($_SESSION['permissions_for_new_directories'])) {
@@ -1844,8 +1844,8 @@  discard block
 block discarded – undo
1844 1844
 function compare_setting_values($current_value, $wanted_value)
1845 1845
 {
1846 1846
     $current_value_string = $current_value;
1847
-    $current_value = (float)$current_value;
1848
-    $wanted_value = (float)$wanted_value;
1847
+    $current_value = (float) $current_value;
1848
+    $wanted_value = (float) $wanted_value;
1849 1849
 
1850 1850
     if ($current_value >= $wanted_value) {
1851 1851
         return Display::label($current_value_string, 'success');
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 
1897 1897
                     fwrite($fp, $out);
1898 1898
                     while (!feof($fp)) {
1899
-                        $result = str_replace("\r\n", '',fgets($fp, 128));
1899
+                        $result = str_replace("\r\n", '', fgets($fp, 128));
1900 1900
                         if (!empty($result) && $result == '123') {
1901 1901
                             $output = true;
1902 1902
                         }
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
                     curl_setopt($ch, CURLOPT_URL, $url);
1920 1920
                     //curl_setopt($ch, CURLOPT_TIMEOUT, 30);
1921 1921
                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1922
-                    $result = curl_exec ($ch);
1922
+                    $result = curl_exec($ch);
1923 1923
                     if (!empty($result) && $result == '123') {
1924 1924
                         $output = true;
1925 1925
                     }
@@ -2679,12 +2679,12 @@  discard block
 block discarded – undo
2679 2679
         $adminPhoneForm,
2680 2680
         '', //$picture_uri = '',
2681 2681
         PLATFORM_AUTH_SOURCE,
2682
-        '',//$expirationDate,
2682
+        '', //$expirationDate,
2683 2683
         1,
2684 2684
         0,
2685 2685
         null,
2686 2686
         '',
2687
-        false,  //$send_mail = false,
2687
+        false, //$send_mail = false,
2688 2688
         true //$isAdmin = false
2689 2689
     );
2690 2690
 
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
         0,
2707 2707
         null,
2708 2708
         '',
2709
-        false,  //$send_mail = false,
2709
+        false, //$send_mail = false,
2710 2710
         false //$isAdmin = false
2711 2711
     );
2712 2712
 
@@ -2772,7 +2772,7 @@  discard block
 block discarded – undo
2772 2772
                 SET selected_value = '".$param->selected_value."'
2773 2773
                 WHERE variable = '".$param->variable."'";
2774 2774
         if (!empty($param->subkey)) {
2775
-            $sql .= " AND subkey='" . $param->subkey . "'";
2775
+            $sql .= " AND subkey='".$param->subkey."'";
2776 2776
         }
2777 2777
         Database::query($sql);
2778 2778
     }
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
         $html .= '<label class="checkbox-inline">
1683 1683
                         <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1684 1684
                     </label>';
1685
-         $html .= '<label class="checkbox-inline">
1685
+            $html .= '<label class="checkbox-inline">
1686 1686
                     <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1687 1687
                 </label>';
1688 1688
         $html .= '</div>';
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
     </div>';
1717 1717
 
1718 1718
     echo panel($html, get_lang('Platform'), 'platform');
1719
- ?>
1719
+    ?>
1720 1720
     <div class='form-group'>
1721 1721
         <div class="col-sm-6">
1722 1722
             <button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button>
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -973,8 +973,7 @@  discard block
 block discarded – undo
973 973
                 <?php echo get_lang('Error'); ?>!<br />
974 974
                 Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>.
975 975
             </div>
976
-        <?php }
977
-        else {
976
+        <?php } else {
978 977
             echo '<br />';
979 978
         }
980 979
         ?>
@@ -1060,14 +1059,19 @@  discard block
 block discarded – undo
1060 1059
         <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" >
1061 1060
             <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?>
1062 1061
         </button>
1063
-        <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> >
1062
+        <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) {
1063
+    echo 'disabled="disabled"';
1064
+}
1065
+?> >
1064 1066
             <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?>
1065 1067
         </button>
1066 1068
         <input type="hidden" name="is_executable" id="is_executable" value="-" />
1067 1069
         <?php
1068 1070
         // Real code
1069 1071
         echo '<button type="submit" class="btn btn-default" name="step2_update_8" value="Upgrade from Chamilo 1.9.x"';
1070
-        if ($error) echo ' disabled="disabled"';
1072
+        if ($error) {
1073
+            echo ' disabled="disabled"';
1074
+        }
1071 1075
         echo ' ><em class="fa fa-forward"> </em> '.get_lang('UpgradeFromLMS19x').'</button>';
1072 1076
 
1073 1077
         echo '</p>';
@@ -1350,7 +1354,7 @@  discard block
 block discarded – undo
1350 1354
                 <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?>
1351 1355
             </div>
1352 1356
             <div class="col-sm-3"></div>
1353
-            <?php }else{ ?>
1357
+            <?php } else{ ?>
1354 1358
             <div class="col-sm-5">
1355 1359
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
1356 1360
             </div>
@@ -1364,7 +1368,7 @@  discard block
 block discarded – undo
1364 1368
                 <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?>
1365 1369
             </div>
1366 1370
             <div class="col-sm-3"></div>
1367
-            <?php }else{ ?>
1371
+            <?php } else{ ?>
1368 1372
             <div class="col-sm-5">
1369 1373
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" />
1370 1374
             </div>
@@ -1446,9 +1450,12 @@  discard block
 block discarded – undo
1446 1450
             Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/>
1447 1451
             Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/>
1448 1452
         </div>
1449
-    <?php else: ?>
1453
+    <?php else {
1454
+    : ?>
1450 1455
         <div id="db_status" class="alert alert-danger">
1451
-            <p><?php echo get_lang('FailedConectionDatabase'); ?></strong></p>
1456
+            <p><?php echo get_lang('FailedConectionDatabase');
1457
+}
1458
+?></strong></p>
1452 1459
             <code><?php echo $database_exists_text ?></code>
1453 1460
         </div>
1454 1461
     <?php endif; ?>
Please login to merge, or discard this patch.
main/newscorm/aicc.class.php 4 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     /**
217 217
      * Import the aicc object (as a result from the parse_config_files function) into the database structure
218 218
      * @param	string	$course_code
219
-     * @return	bool	Returns -1 on error
219
+     * @return	false|null	Returns -1 on error
220 220
      */
221 221
     public function import_aicc($course_code)
222 222
     {
@@ -780,7 +780,8 @@  discard block
 block discarded – undo
780 780
      * Static function to parse AICC ini files.
781 781
      * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
782 782
      * @param	string	File path
783
-     * @return	array	Structured array
783
+     * @param string $f
784
+     * @return	string	Structured array
784 785
      */
785 786
     function parse_ini_file_quotes_safe($f) {
786 787
         $null = '';
@@ -831,7 +832,7 @@  discard block
 block discarded – undo
831 832
      * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
832 833
      * @param		string	INI File string
833 834
      * @param		array	List of names of sections that should be considered as containing only hard string data (no variables), provided in lower case
834
-     * @return	array	Structured array
835
+     * @return	string	Structured array
835 836
      */
836 837
     function parse_ini_string_quotes_safe($s, $pure_strings = array()) {
837 838
         $null = '';
@@ -894,6 +895,7 @@  discard block
 block discarded – undo
894 895
      * @param	string	CSV delimiter
895 896
      * @param	string	CSV enclosure
896 897
      * @param	boolean	Might one field name happen more than once on the same line? (then split by comma in the values)
898
+     * @param string $f
897 899
      * @return array	Simple structured array
898 900
      */
899 901
     function parse_csv_file($f, $delim = ',', $enclosure = '"', $multiples = false) {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
         }
321 321
     }
322 322
 
323
-     /**
324
-     * Intermediate to import_package only to allow import from local zip files
325
-     * @param	string	Path to the zip file, from the dokeos sys root
326
-     * @param	string	Current path (optional)
327
-     * @return string	Absolute path to the AICC description files or empty string on error
328
-     */
323
+        /**
324
+         * Intermediate to import_package only to allow import from local zip files
325
+         * @param	string	Path to the zip file, from the dokeos sys root
326
+         * @param	string	Current path (optional)
327
+         * @return string	Absolute path to the AICC description files or empty string on error
328
+         */
329 329
     function import_local_package($file_path, $current_dir = '')
330 330
     {
331 331
         // TODO: Prepare info as given by the $_FILES[''] vector.
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
357 357
 
358
-         //$uploaded_filename = $_FILES['userFile']['name'];
358
+            //$uploaded_filename = $_FILES['userFile']['name'];
359 359
         // Get the name of the zip file without the extension.
360 360
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: '.$zip_file_path, 0); }
361 361
         $file_info = pathinfo($zip_file_name);
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 class aicc extends learnpath
13 13
 {
14 14
     public $config = array();
15
-    public $config_basename = '';	// The configuration files might be multiple and might have
15
+    public $config_basename = ''; // The configuration files might be multiple and might have
16 16
                                     // funny names. We need to keep the name of that file while we
17 17
                                     // install the content.
18 18
     public $config_files = array();
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     public $cstlist = array();
33 33
     public $orelist = array();
34 34
 
35
-    public $subdir = '';	// Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package.
36
-    public $zipname = '';	// Keeps the zipfile safe for the object's life so that we can use it if there is no title available.
37
-    public $lastzipnameindex = 0;	// Keeps an index of the number of uses of the zipname so far.
35
+    public $subdir = ''; // Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package.
36
+    public $zipname = ''; // Keeps the zipfile safe for the object's life so that we can use it if there is no title available.
37
+    public $lastzipnameindex = 0; // Keeps an index of the number of uses of the zipname so far.
38 38
     public $config_encoding = 'ISO-8859-1';
39 39
     public $debug = 0;
40 40
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             //echo '<pre>des:'.print_r($des_params, true).'</pre>';
133 133
             if ($this->debug > 1) { error_log('New LP - In aicc::parse_config_files() - '.$des_file.' has been parsed', 0); }
134 134
             // Distribute des params into the aicc object.
135
-            foreach ($des_params as $des){
135
+            foreach ($des_params as $des) {
136 136
                 // One AU in AICC is equivalent to one SCO in SCORM (scormItem class).
137 137
                 $oDes = new aiccResource('config', $des);
138 138
                 $this->deslist[$oDes->identifier] = $oDes;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 
243 243
         $this->config_encoding = "ISO-8859-1"; // TODO: We may apply detection for this value, see the function api_detect_encoding().
244 244
 
245
-        $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)" .
246
-                "VALUES " .
247
-                "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."'," .
248
-                "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."'," .
245
+        $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)".
246
+                "VALUES ".
247
+                "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."',".
248
+                "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."',".
249 249
                 "'aicc_api.php','".$this->course_creator."',$dsp)";
250
-        if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '. $sql, 0); }
250
+        if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '.$sql, 0); }
251 251
         Database::query($sql);
252 252
         $lp_id = Database::insert_id();
253 253
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $previous = 0;
278 278
         foreach ($this->aulist as $identifier => $dummy) {
279
-            $oAu =& $this->aulist[$identifier];
279
+            $oAu = & $this->aulist[$identifier];
280 280
             //echo "Item ".$oAu->identifier;
281 281
             $field_add = '';
282 282
             $value_add = '';
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
             $parent = 0; // TODO: Deal with the parent.
295 295
             $previous = 0;
296 296
             $prereq = $oAu->prereq_string;
297
-            $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) " .
298
-                    "VALUES " .
299
-                    "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."'," .
300
-                    "'$path',0,100, $value_add" .
301
-                    "$parent, $previous, 0, " .
302
-                    "'$prereq', 0,'".(!empty($oAu->parameters)?Database::escape_string($oAu->parameters):'')."'" .
297
+            $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) ".
298
+                    "VALUES ".
299
+                    "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."',".
300
+                    "'$path',0,100, $value_add".
301
+                    "$parent, $previous, 0, ".
302
+                    "'$prereq', 0,'".(!empty($oAu->parameters) ? Database::escape_string($oAu->parameters) : '')."'".
303 303
                     ")";
304 304
             Database::query($sql_item);
305 305
             if ($this->debug > 1) { error_log('New LP - In aicc::import_aicc() - inserting item : '.$sql_item.' : ', 0); }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         $zip_file_name = $zip_file_info['name'];
351 351
 
352 352
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); }
353
-        $course_rel_dir  = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses
353
+        $course_rel_dir = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses
354 354
         $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path of this course.
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Base file name is : '.$file_base_name, 0); }
368 368
         $new_dir = api_replace_dangerous_char(trim($file_base_name));
369 369
         $this->subdir = $new_dir;
370
-        if($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); }
370
+        if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); }
371 371
 
372 372
         /*
373 373
         if (check_name_exist($course_sys_dir.$current_dir.'/'.$new_dir)) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         $subdir_isset = true;
414 414
                     } else {
415 415
                         if (!$subdir_isset) {
416
-                            if (preg_match('?^.*/aicc$?i',dirname($thisContent['filename']))) {
416
+                            if (preg_match('?^.*/aicc$?i', dirname($thisContent['filename']))) {
417 417
                                 //echo "Cutting subdir<br/>";
418 418
                                 $this->subdir .= '/'.substr(dirname($thisContent['filename']), 0, -5);
419 419
                             } else {
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
517 517
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
518 518
                         $find_str = array('\\', '.php', '.phtml');
519
-                        $repl_str = array('/',  '.txt', '.txt');
519
+                        $repl_str = array('/', '.txt', '.txt');
520 520
                         $safe_file = str_replace($find_str, $repl_str, $file);
521 521
 
522 522
                         if ($safe_file != $file) {
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
         if ($this->debug > 0) { error_log('In aicc::get_res_path('.$id.') method', 0); }
718 718
         $path = '';
719 719
         if (isset($this->resources[$id])) {
720
-            $oRes =& $this->resources[$id];
720
+            $oRes = & $this->resources[$id];
721 721
             $path = @$oRes->get_path();
722 722
         }
723 723
         return $path;
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
         if ($this->debug > 0) { error_log('In aicc::get_res_type('.$id.') method', 0); }
734 734
         $type = '';
735 735
         if (isset($this->resources[$id])) {
736
-            $oRes =& $this->resources[$id];
736
+            $oRes = & $this->resources[$id];
737 737
             $temptype = $oRes->get_scorm_type();
738 738
             if (!empty($temptype)) {
739 739
                 $type = $temptype;
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
      * Gets the default organisation's title
747 747
      * @return	string	The organization's title
748 748
      */
749
-    function get_title(){
749
+    function get_title() {
750 750
         if ($this->debug > 0) { error_log('In aicc::get_title() method', 0); }
751 751
         $title = '';
752 752
         if (isset($this->config['organizations']['default'])) {
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
             $chr = $data{$i};
908 908
             switch ($chr) {
909 909
                 case $enclosure:
910
-                    if ($enclosed && $data{$i+1} == $enclosure) {
910
+                    if ($enclosed && $data{$i + 1} == $enclosure) {
911 911
                         $fldval .= $chr;
912 912
                         ++$i; // Skip the next character.
913 913
                     } else
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
                         $fldval .= $chr;
922 922
                     break;
923 923
                 case "\r":
924
-                    if (!$enclosed&&$data{$i+1} == "\n")
924
+                    if (!$enclosed && $data{$i + 1} == "\n")
925 925
                         continue;
926 926
                 case "\n":
927 927
                     if (!$enclosed) {
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                         $fldval .= $chr;
933 933
                     break;
934 934
                 case "\\r":
935
-                    if (!$enclosed&&$data{$i+1} == "\\n")
935
+                    if (!$enclosed && $data{$i + 1} == "\\n")
936 936
                         continue;
937 937
                 case "\\n":
938 938
                     if (!$enclosed) {
Please login to merge, or discard this patch.
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -459,11 +459,12 @@  discard block
 block discarded – undo
459 459
             }
460 460
         }
461 461
 
462
-        if ($package_type == '' || !$mandatory)
463
-        // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC)
462
+        if ($package_type == '' || !$mandatory) {
463
+                // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC)
464 464
         {
465 465
             return api_failure::set_failure('not_aicc_content');
466 466
         }
467
+        }
467 468
 
468 469
         if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) {
469 470
             return api_failure::set_failure('not_enough_space');
@@ -511,7 +512,9 @@  discard block
 block discarded – undo
511 512
                     if ($file != '.' && $file != '..') {
512 513
                         $filetype = 'file';
513 514
 
514
-                        if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder';
515
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
516
+                            $filetype = 'folder';
517
+                        }
515 518
 
516 519
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
517 520
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
@@ -910,37 +913,43 @@  discard block
 block discarded – undo
910 913
                     if ($enclosed && $data{$i+1} == $enclosure) {
911 914
                         $fldval .= $chr;
912 915
                         ++$i; // Skip the next character.
913
-                    } else
914
-                        $enclosed = !$enclosed;
916
+                    } else {
917
+                                            $enclosed = !$enclosed;
918
+                    }
915 919
                     break;
916 920
                 case $delim:
917 921
                     if (!$enclosed) {
918 922
                         $ret_array[$linecount][$fldcount++] = $fldval;
919 923
                         $fldval = '';
920
-                    } else
921
-                        $fldval .= $chr;
924
+                    } else {
925
+                                            $fldval .= $chr;
926
+                    }
922 927
                     break;
923 928
                 case "\r":
924
-                    if (!$enclosed&&$data{$i+1} == "\n")
925
-                        continue;
929
+                    if (!$enclosed&&$data{$i+1} == "\n") {
930
+                                            continue;
931
+                    }
926 932
                 case "\n":
927 933
                     if (!$enclosed) {
928 934
                         $ret_array[$linecount++][$fldcount] = $fldval;
929 935
                         $fldcount = 0;
930 936
                         $fldval = '';
931
-                    } else
932
-                        $fldval .= $chr;
937
+                    } else {
938
+                                            $fldval .= $chr;
939
+                    }
933 940
                     break;
934 941
                 case "\\r":
935
-                    if (!$enclosed&&$data{$i+1} == "\\n")
936
-                        continue;
942
+                    if (!$enclosed&&$data{$i+1} == "\\n") {
943
+                                            continue;
944
+                    }
937 945
                 case "\\n":
938 946
                     if (!$enclosed) {
939 947
                         $ret_array[$linecount++][$fldcount] = $fldval;
940 948
                         $fldcount = 0;
941 949
                         $fldval = '';
942
-                    } else
943
-                        $fldval .= $chr;
950
+                    } else {
951
+                                            $fldval .= $chr;
952
+                    }
944 953
                     break;
945 954
                 default:
946 955
                     $fldval .= $chr;
Please login to merge, or discard this patch.
main/newscorm/learnpath_functions.inc.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -60,6 +60,7 @@
 block discarded – undo
60 60
 /**
61 61
  * This function deletes an entire directory
62 62
  * @param	string	The directory path
63
+ * @param string $dir
63 64
  * @return boolean	True on success, false on failure
64 65
  */
65 66
 function deldir($dir) {
Please login to merge, or discard this patch.
main/newscorm/learnpathItem.class.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
 
1870 1870
     /**
1871 1871
      * Get the extra terms (tags) that identify this item
1872
-     * @return mixed
1872
+     * @return string
1873 1873
      */
1874 1874
     public function get_terms()
1875 1875
     {
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
 
2070 2070
     /**
2071 2071
      * Opens/launches the item. Initialises runtime values.
2072
-     * @return    boolean    True on success, false on failure.
2072
+     * @return    boolean|null    True on success, false on failure.
2073 2073
      */
2074 2074
     public function open($allow_new_attempt = false)
2075 2075
     {
@@ -3494,7 +3494,7 @@  discard block
 block discarded – undo
3494 3494
 
3495 3495
     /**
3496 3496
      * Checks if the current status is part of the list of status given
3497
-     * @param  array  $list  An array of status to check for.
3497
+     * @param  string[]  $list  An array of status to check for.
3498 3498
      * If the current status is one of the strings, return true
3499 3499
      *
3500 3500
      * @return boolean True if the status was one of the given strings,
@@ -3671,7 +3671,7 @@  discard block
 block discarded – undo
3671 3671
     /**
3672 3672
      * Write objectives to DB. This method is separate from write_to_db() because otherwise
3673 3673
      * objectives are lost as a side effect to AJAX and session concurrent access
3674
-     * @return    boolean        True or false on error
3674
+     * @return    boolean|null        True or false on error
3675 3675
      */
3676 3676
     public function write_objectives_to_db()
3677 3677
     {
@@ -4312,7 +4312,7 @@  discard block
 block discarded – undo
4312 4312
      * Removes the relation between the current item and an audio file. The file
4313 4313
      * is only removed from the lp_item table, but remains in the document table
4314 4314
      * and directory
4315
-     * @return bool
4315
+     * @return false|null
4316 4316
      */
4317 4317
     public function remove_audio()
4318 4318
     {
@@ -4333,7 +4333,7 @@  discard block
 block discarded – undo
4333 4333
      * @param $status
4334 4334
      * @param bool $decorate
4335 4335
      * @param string $type classic|simple
4336
-     * @return array|string
4336
+     * @return string
4337 4337
      */
4338 4338
     static function humanize_status($status, $decorate = true, $type = 'classic')
4339 4339
     {
Please login to merge, or discard this patch.
Spacing   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
             $res = Database::query($sql);
200 200
             if (Database::num_rows($res) > 0) {
201 201
                 $se_ref = Database::fetch_array($res);
202
-                $this->search_did = (int)$se_ref['search_did'];
202
+                $this->search_did = (int) $se_ref['search_did'];
203 203
             }
204 204
         }
205 205
         $this->audio = $row['audio'];
206 206
         if (self::debug > 0) {
207 207
             error_log(
208
-                'New LP - End of learnpathItem constructor for item ' . $id,
208
+                'New LP - End of learnpathItem constructor for item '.$id,
209 209
                 0
210 210
             );
211 211
         }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     public function delete()
315 315
     {
316 316
         if (self::debug > 0) {
317
-            error_log('learnpath_item::delete() for item ' . $this->db_id, 0);
317
+            error_log('learnpath_item::delete() for item '.$this->db_id, 0);
318 318
         }
319 319
         $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
320 320
         $lp_item = Database::get_course_table(TABLE_LP_ITEM);
@@ -322,29 +322,29 @@  discard block
 block discarded – undo
322 322
         $course_id = api_get_course_int_id();
323 323
 
324 324
         $sql = "DELETE FROM $lp_item_view
325
-                WHERE c_id = $course_id AND lp_item_id = " . $this->db_id;
325
+                WHERE c_id = $course_id AND lp_item_id = ".$this->db_id;
326 326
         if (self::debug > 0) {
327
-            error_log('Deleting from lp_item_view: ' . $sql, 0);
327
+            error_log('Deleting from lp_item_view: '.$sql, 0);
328 328
         }
329 329
         Database::query($sql);
330 330
 
331 331
         $sql = "SELECT * FROM $lp_item
332
-                WHERE c_id = $course_id AND id = " . $this->db_id;
332
+                WHERE c_id = $course_id AND id = ".$this->db_id;
333 333
         $res_sel = Database::query($sql);
334 334
         if (Database::num_rows($res_sel) < 1) {
335 335
             return false;
336 336
         }
337 337
 
338 338
         $sql = "DELETE FROM $lp_item
339
-                WHERE c_id = $course_id AND id = " . $this->db_id;
339
+                WHERE c_id = $course_id AND id = ".$this->db_id;
340 340
         Database::query($sql);
341 341
         if (self::debug > 0) {
342
-            error_log('Deleting from lp_item: ' . $sql);
342
+            error_log('Deleting from lp_item: '.$sql);
343 343
         }
344 344
 
345 345
         if (api_get_setting('search_enabled') == 'true') {
346 346
             if (!is_null($this->search_did)) {
347
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
347
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
348 348
                 $di = new ChamiloIndexer();
349 349
                 $di->remove_document($this->search_did);
350 350
             }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     {
381 381
         if (self::debug > 0) {
382 382
             error_log(
383
-                'learnpathItem::get_attempt_id() on item ' . $this->db_id,
383
+                'learnpathItem::get_attempt_id() on item '.$this->db_id,
384 384
                 0
385 385
             );
386 386
         }
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
         }
391 391
         if (self::debug > 0) {
392 392
             error_log(
393
-                'New LP - End of learnpathItem::get_attempt_id() on item ' .
394
-                $this->db_id . ' - Returning ' . $res,
393
+                'New LP - End of learnpathItem::get_attempt_id() on item '.
394
+                $this->db_id.' - Returning '.$res,
395 395
                 0
396 396
             );
397 397
         }
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
             if (self::debug > 2) {
454 454
                 error_log(
455 455
                     'learnpathItem::get_credit() - get_prevent_reinit!=0 and '.
456
-                    'status is ' . $status,
456
+                    'status is '.$status,
457 457
                     0
458 458
                 );
459 459
             }
460 460
             //0=not attempted - 1 = incomplete
461
-            if ($status != $this->possible_status[0]&&
461
+            if ($status != $this->possible_status[0] &&
462 462
                 $status != $this->possible_status[1]
463 463
             ) {
464 464
                 $credit = 'no-credit';
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
                 case TOOL_DOCUMENT:
533 533
                     $table_doc = Database::get_course_table(TABLE_DOCUMENT);
534 534
                     $sql = 'SELECT path
535
-                            FROM ' . $table_doc . '
535
+                            FROM ' . $table_doc.'
536 536
                             WHERE
537
-                                c_id = ' . $course_id . ' AND
537
+                                c_id = ' . $course_id.' AND
538 538
                                 id = ' . $path;
539 539
                     $res = Database::query($sql);
540 540
                     $row = Database::fetch_array($res);
541
-                    $real_path = 'document' . $row['path'];
541
+                    $real_path = 'document'.$row['path'];
542 542
                     return $real_path;
543 543
                 case TOOL_STUDENTPUBLICATION:
544 544
                 case TOOL_QUIZ:
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             }
551 551
         } else {
552 552
             if (!empty($path_to_scorm_dir)) {
553
-                $path = $path_to_scorm_dir . $path;
553
+                $path = $path_to_scorm_dir.$path;
554 554
             }
555 555
             return $path;
556 556
         }
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
         $sql = "SELECT id FROM $tbl
587 587
                 WHERE
588 588
                     c_id = $course_id AND
589
-                    lp_item_id = " . $this->db_id . " AND
590
-                    lp_view_id = " . $this->view_id . " AND
589
+                    lp_item_id = ".$this->db_id." AND
590
+                    lp_view_id = " . $this->view_id." AND
591 591
                     view_count = " . $this->attempt_id;
592 592
         $res = Database::query($sql);
593 593
         if (Database::num_rows($res) > 0) {
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
             $sql = "SELECT id FROM $tbl
631 631
                     WHERE
632 632
                         c_id = $course_id AND
633
-                        lp_item_id = " . $this->db_id . " AND
634
-                        lp_view_id = " . $this->view_id ." AND
633
+                        lp_item_id = ".$this->db_id." AND
634
+                        lp_view_id = " . $this->view_id." AND
635 635
                         view_count = " . $this->get_attempt_id();
636 636
             $res = Database::query($sql);
637 637
             if (Database::num_rows($res) > 0) {
@@ -671,13 +671,13 @@  discard block
 block discarded – undo
671 671
         foreach ($this->interactions as $id => $in) {
672 672
             $return .= "[
673 673
                 '$id',
674
-                '" . $in[1] . "',
675
-                '" . $in[2] . "',
676
-                '" . $in[3] . "',
677
-                '" . $in[4] . "',
678
-                '" . $in[5] . "',
679
-                '" . $in[6] . "',
680
-                '" . $in[7] . "'],";
674
+                '".$in[1]."',
675
+                '" . $in[2]."',
676
+                '" . $in[3]."',
677
+                '" . $in[4]."',
678
+                '" . $in[5]."',
679
+                '" . $in[6]."',
680
+                '" . $in[7]."'],";
681 681
         }
682 682
         if (!empty($return)) {
683 683
             $return = substr($return, 0, -1);
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
                 $table = Database::get_course_table(TABLE_LP_MAIN);
920 920
                 $sql = "SELECT prevent_reinit
921 921
                     FROM $table
922
-                    WHERE c_id = $course_id AND id = " . $this->lp_id;
922
+                    WHERE c_id = $course_id AND id = ".$this->lp_id;
923 923
                 $res = Database::query($sql);
924 924
                 if (Database::num_rows($res) < 1) {
925 925
                     $this->error = "Could not find parent learnpath in lp table";
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         }
942 942
         if (self::debug > 2) {
943 943
             error_log(
944
-                'New LP - End of learnpathItem::get_prevent_reinit() - Returned ' . $this->prevent_reinit,
944
+                'New LP - End of learnpathItem::get_prevent_reinit() - Returned '.$this->prevent_reinit,
945 945
                 0
946 946
             );
947 947
         }
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
                 $table = Database::get_course_table(TABLE_LP_MAIN);
967 967
                 $sql = "SELECT seriousgame_mode
968 968
                         FROM $table
969
-                        WHERE c_id = $course_id AND id = " . $this->lp_id;
969
+                        WHERE c_id = $course_id AND id = ".$this->lp_id;
970 970
                 $res = Database::query($sql);
971 971
                 if (Database::num_rows($res) < 1) {
972 972
                     $this->error = "Could not find parent learnpath in learnpath table";
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
         }
988 988
         if (self::debug > 2) {
989 989
             error_log(
990
-                'New LP - End of learnpathItem::get_seriousgame_mode() - Returned ' . $this->seriousgame_mode,
990
+                'New LP - End of learnpathItem::get_seriousgame_mode() - Returned '.$this->seriousgame_mode,
991 991
                 0
992 992
             );
993 993
         }
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
         }
1033 1033
         if (!isset($abs_path)) {
1034 1034
             $path = $this->get_file_path();
1035
-            $abs_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . $path;
1035
+            $abs_path = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$path;
1036 1036
         }
1037 1037
 
1038 1038
         $files_list = array();
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                                                             $abs_path
1308 1308
                                                         );
1309 1309
                                                         $new_abs_path = realpath(
1310
-                                                            $dir . '/' . $second_part
1310
+                                                            $dir.'/'.$second_part
1311 1311
                                                         );
1312 1312
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1313 1313
                                                             TOOL_DOCUMENT,
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
                                                             $abs_path
1346 1346
                                                         );
1347 1347
                                                         $new_abs_path = realpath(
1348
-                                                            $dir . '/' . $second_part
1348
+                                                            $dir.'/'.$second_part
1349 1349
                                                         );
1350 1350
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1351 1351
                                                             TOOL_DOCUMENT,
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
                                                             $abs_path
1453 1453
                                                         );
1454 1454
                                                         $new_abs_path = realpath(
1455
-                                                            $dir . '/' . $source
1455
+                                                            $dir.'/'.$source
1456 1456
                                                         );
1457 1457
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1458 1458
                                                             TOOL_DOCUMENT,
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
                                                             $abs_path
1491 1491
                                                         );
1492 1492
                                                         $new_abs_path = realpath(
1493
-                                                            $dir . '/' . $source
1493
+                                                            $dir.'/'.$source
1494 1494
                                                         );
1495 1495
                                                         $in_files_list[] = learnpathItem::get_resources_from_source(
1496 1496
                                                             TOOL_DOCUMENT,
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
                                                 );
1575 1575
                                                 $dir = dirname($abs_path);
1576 1576
                                                 $new_abs_path = realpath(
1577
-                                                    $dir . '/' . $source
1577
+                                                    $dir.'/'.$source
1578 1578
                                                 );
1579 1579
                                                 $in_files_list[] = learnpathItem::get_resources_from_source(
1580 1580
                                                     TOOL_DOCUMENT,
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
                                                 );
1620 1620
                                                 $dir = dirname($abs_path);
1621 1621
                                                 $new_abs_path = realpath(
1622
-                                                    $dir . '/' . $source
1622
+                                                    $dir.'/'.$source
1623 1623
                                                 );
1624 1624
                                                 $in_files_list[] = learnpathItem::get_resources_from_source(
1625 1625
                                                     TOOL_DOCUMENT,
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
         }
1680 1680
         if (self::debug > 1) {
1681 1681
             error_log(
1682
-                'New LP - Out of learnpathItem::get_score() - returning ' . $res,
1682
+                'New LP - Out of learnpathItem::get_score() - returning '.$res,
1683 1683
                 0
1684 1684
             );
1685 1685
         }
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
         $course_id = api_get_course_int_id();
1700 1700
         $debug = self::debug;
1701 1701
         if ($debug > 0) {
1702
-            error_log('learnpathItem::get_status() on item ' . $this->db_id, 0);
1702
+            error_log('learnpathItem::get_status() on item '.$this->db_id, 0);
1703 1703
         }
1704 1704
         if ($check_db) {
1705 1705
             if ($debug > 2) {
@@ -1710,12 +1710,12 @@  discard block
 block discarded – undo
1710 1710
                 $sql = "SELECT status FROM $table
1711 1711
                         WHERE
1712 1712
                             c_id = $course_id AND
1713
-                            id = '" . $this->db_item_view_id . "' AND
1714
-                            view_count = '" . $this->get_attempt_id() . "'";
1713
+                            id = '".$this->db_item_view_id."' AND
1714
+                            view_count = '" . $this->get_attempt_id()."'";
1715 1715
 
1716 1716
                 if ($debug > 2) {
1717 1717
                     error_log(
1718
-                        'learnpathItem::get_status() - Checking DB: ' . $sql,
1718
+                        'learnpathItem::get_status() - Checking DB: '.$sql,
1719 1719
                         0
1720 1720
                     );
1721 1721
                 }
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
                     if ($update_local) {
1727 1727
                         if ($debug > 2) {
1728 1728
                             error_log(
1729
-                                'learnpathItem::set_status() :' . $row['status'],
1729
+                                'learnpathItem::set_status() :'.$row['status'],
1730 1730
                                 0
1731 1731
                             );
1732 1732
                         }
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
                     }
1735 1735
                     if ($debug > 2) {
1736 1736
                         error_log(
1737
-                            'learnpathItem::get_status() - Returning db value ' . $row['status'],
1737
+                            'learnpathItem::get_status() - Returning db value '.$row['status'],
1738 1738
                             0
1739 1739
                         );
1740 1740
                     }
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
             if (!empty($this->status)) {
1752 1752
                 if ($debug > 2) {
1753 1753
                     error_log(
1754
-                        'learnpathItem::get_status() - Returning attrib: ' . $this->status,
1754
+                        'learnpathItem::get_status() - Returning attrib: '.$this->status,
1755 1755
                         0
1756 1756
                     );
1757 1757
                 }
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 
1762 1762
         if ($debug > 2) {
1763 1763
             error_log(
1764
-                'learnpathItem::get_status() - Returning default ' . $this->possible_status[0],
1764
+                'learnpathItem::get_status() - Returning default '.$this->possible_status[0],
1765 1765
                 0
1766 1766
             );
1767 1767
         }
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
             if ($origin == 'js') {
1802 1802
                 return '00 : 00: 00';
1803 1803
             } else {
1804
-                return '00 ' . $h . ' 00 \' 00"';
1804
+                return '00 '.$h.' 00 \' 00"';
1805 1805
             }
1806 1806
         } else {
1807 1807
             return api_format_time($time, $origin);
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
         if (!isset($given_time)) {
1827 1827
             if (self::debug > 2) {
1828 1828
                 error_log(
1829
-                    'learnpathItem::get_scorm_time(): given time empty, current_start_time = ' . $this->current_start_time,
1829
+                    'learnpathItem::get_scorm_time(): given time empty, current_start_time = '.$this->current_start_time,
1830 1830
                     0
1831 1831
                 );
1832 1832
             }
@@ -1836,8 +1836,8 @@  discard block
 block discarded – undo
1836 1836
                         FROM $table
1837 1837
                         WHERE
1838 1838
                             c_id = $course_id AND
1839
-                            id = '" . $this->db_item_view_id . "' AND
1840
-                            view_count = '" . $this->get_attempt_id() . "'";
1839
+                            id = '".$this->db_item_view_id."' AND
1840
+                            view_count = '" . $this->get_attempt_id()."'";
1841 1841
                 $res = Database::query($sql);
1842 1842
                 $row = Database::fetch_array($res);
1843 1843
                 $start = $row['start_time'];
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
         }
1859 1859
         if (self::debug > 2) {
1860 1860
             error_log(
1861
-                'learnpathItem::get_scorm_time(): intermediate = ' . $time,
1861
+                'learnpathItem::get_scorm_time(): intermediate = '.$time,
1862 1862
                 0
1863 1863
             );
1864 1864
         }
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
         $sql = "SELECT * FROM $lp_item
1879 1879
                 WHERE
1880 1880
                     c_id = $course_id AND
1881
-                    id='" . intval($this->db_id) . "'";
1881
+                    id='".intval($this->db_id)."'";
1882 1882
         $res = Database::query($sql);
1883 1883
         $row = Database::fetch_array($res);
1884 1884
         return $row['terms'];
@@ -1907,9 +1907,9 @@  discard block
 block discarded – undo
1907 1907
     {
1908 1908
         if (self::debug > 0) {
1909 1909
             error_log(
1910
-                'learnpathItem::get_total_time() for item ' . $this->db_id .
1911
-                ' - Initially, current_start_time = ' . $this->current_start_time .
1912
-                ' and current_stop_time = ' . $this->current_stop_time,
1910
+                'learnpathItem::get_total_time() for item '.$this->db_id.
1911
+                ' - Initially, current_start_time = '.$this->current_start_time.
1912
+                ' and current_stop_time = '.$this->current_stop_time,
1913 1913
                 0
1914 1914
             );
1915 1915
         }
@@ -1950,9 +1950,9 @@  discard block
 block discarded – undo
1950 1950
         } else {
1951 1951
             if (self::debug > 2) {
1952 1952
                 error_log(
1953
-                    'learnpathItem::get_total_time() - Current start time = ' .
1954
-                    $this->current_start_time . ', current stop time = ' .
1955
-                    $this->current_stop_time . ' Returning ' . $time . "-----------\n",
1953
+                    'learnpathItem::get_total_time() - Current start time = '.
1954
+                    $this->current_start_time.', current stop time = '.
1955
+                    $this->current_stop_time.' Returning '.$time."-----------\n",
1956 1956
                     0
1957 1957
                 );
1958 1958
             }
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
         }
1973 1973
         if (self::debug > 2) {
1974 1974
             error_log(
1975
-                'learnpathItem::get_type() - Returning ' . $res . ' for item ' . $this->db_id,
1975
+                'learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id,
1976 1976
                 0
1977 1977
             );
1978 1978
         }
@@ -2012,8 +2012,8 @@  discard block
 block discarded – undo
2012 2012
         if ($this->status_is($completedStatusList)) {
2013 2013
             if (self::debug > 2) {
2014 2014
                 error_log(
2015
-                    'learnpath::is_done() - Item ' . $this->get_id(
2016
-                    ) . ' is complete',
2015
+                    'learnpath::is_done() - Item '.$this->get_id(
2016
+                    ).' is complete',
2017 2017
                     0
2018 2018
                 );
2019 2019
             }
@@ -2022,8 +2022,8 @@  discard block
 block discarded – undo
2022 2022
         } else {
2023 2023
             if (self::debug > 2) {
2024 2024
                 error_log(
2025
-                    'learnpath::is_done() - Item ' . $this->get_id(
2026
-                    ) . ' is not complete',
2025
+                    'learnpath::is_done() - Item '.$this->get_id(
2026
+                    ).' is not complete',
2027 2027
                     0
2028 2028
                 );
2029 2029
             }
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
         }
2061 2061
         if (self::debug > 2) {
2062 2062
             error_log(
2063
-                'New LP - End of learnpathItem::is_restart_allowed() - Returning ' . $restart,
2063
+                'New LP - End of learnpathItem::is_restart_allowed() - Returning '.$restart,
2064 2064
                 0
2065 2065
             );
2066 2066
         }
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
     {
2140 2140
         if (self::debug > 0) {
2141 2141
             error_log(
2142
-                'learnpathItem::parse_prereq() for learnpath ' . $this->lp_id . ' with string ' . $prereqs_string,
2142
+                'learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string,
2143 2143
                 0
2144 2144
             );
2145 2145
         }
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
                                 // Strange...
2333 2333
                                 if (self::debug > 1) {
2334 2334
                                     error_log(
2335
-                                        'New LP - Found ~ but strange string: ' . $prereqs_string,
2335
+                                        'New LP - Found ~ but strange string: '.$prereqs_string,
2336 2336
                                         0
2337 2337
                                     );
2338 2338
                                 }
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
                                     //  the big brackets-enclosed condition.
2361 2361
                                     if (self::debug > 1) {
2362 2362
                                         error_log(
2363
-                                            'New LP - Dealing with group ' . $gr,
2363
+                                            'New LP - Dealing with group '.$gr,
2364 2364
                                             0
2365 2365
                                         );
2366 2366
                                     }
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
                                     ) {
2375 2375
                                         if (self::debug > 1) {
2376 2376
                                             error_log(
2377
-                                                'New LP - Found multiplier ' . $multi[0],
2377
+                                                'New LP - Found multiplier '.$multi[0],
2378 2378
                                                 0
2379 2379
                                             );
2380 2380
                                         }
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
                                                     $mytrue++;
2391 2391
                                                     if (self::debug > 1) {
2392 2392
                                                         error_log(
2393
-                                                            'New LP - Found true item, counting.. (' . ($mytrue) . ')',
2393
+                                                            'New LP - Found true item, counting.. ('.($mytrue).')',
2394 2394
                                                             0
2395 2395
                                                         );
2396 2396
                                                     }
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
                                             } else {
2399 2399
                                                 if (self::debug > 1) {
2400 2400
                                                     error_log(
2401
-                                                        'New LP - item ' . $cond . ' does not exist in items list',
2401
+                                                        'New LP - item '.$cond.' does not exist in items list',
2402 2402
                                                         0
2403 2403
                                                     );
2404 2404
                                                 }
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
                                                 } else {
2446 2446
                                                     if (self::debug > 1) {
2447 2447
                                                         error_log(
2448
-                                                            'New LP - ' .
2448
+                                                            'New LP - '.
2449 2449
                                                             ' Found false item, the set is not true, return false',
2450 2450
                                                             0
2451 2451
                                                         );
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
                                             } else {
2457 2457
                                                 if (self::debug > 1) {
2458 2458
                                                     error_log(
2459
-                                                        'New LP - item ' . $cond . ' does not exist in items list',
2459
+                                                        'New LP - item '.$cond.' does not exist in items list',
2460 2460
                                                         0
2461 2461
                                                     );
2462 2462
                                                 }
@@ -2482,7 +2482,7 @@  discard block
 block discarded – undo
2482 2482
                                 //  value of the corresponding resource completion status.
2483 2483
                                 if (self::debug > 1) {
2484 2484
                                     error_log(
2485
-                                        'New LP - Didnt find any group, returning value for ' . $prereqs_string,
2485
+                                        'New LP - Didnt find any group, returning value for '.$prereqs_string,
2486 2486
                                         0
2487 2487
                                     );
2488 2488
                                 }
@@ -2499,14 +2499,14 @@  discard block
 block discarded – undo
2499 2499
                                         if (!$returnstatus) {
2500 2500
                                             if (self::debug > 1) {
2501 2501
                                                 error_log(
2502
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' not complete',
2502
+                                                    'New LP - Prerequisite '.$prereqs_string.' not complete',
2503 2503
                                                     0
2504 2504
                                                 );
2505 2505
                                             }
2506 2506
                                         } else {
2507 2507
                                             if (self::debug > 1) {
2508 2508
                                                 error_log(
2509
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' complete',
2509
+                                                    'New LP - Prerequisite '.$prereqs_string.' complete',
2510 2510
                                                     0
2511 2511
                                                 );
2512 2512
                                             }
@@ -2518,12 +2518,12 @@  discard block
 block discarded – undo
2518 2518
                                             if ($returnstatus) {
2519 2519
                                                 //AND origin_lp_item_id = '.$user_id.'
2520 2520
                                                 $sql = 'SELECT exe_result, exe_weighting
2521
-                                                        FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . '
2521
+                                                        FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'
2522 2522
                                                         WHERE
2523
-                                                            exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND
2524
-                                                            exe_user_id = ' . $user_id . ' AND
2525
-                                                            orig_lp_id = ' . $this->lp_id . ' AND
2526
-                                                            orig_lp_item_id = ' . $prereqs_string . ' AND
2523
+                                                            exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND
2524
+                                                            exe_user_id = ' . $user_id.' AND
2525
+                                                            orig_lp_id = ' . $this->lp_id.' AND
2526
+                                                            orig_lp_item_id = ' . $prereqs_string.' AND
2527 2527
                                                             status <> "incomplete"
2528 2528
                                                         ORDER BY exe_date DESC
2529 2529
                                                         LIMIT 0, 1';
@@ -2561,12 +2561,12 @@  discard block
 block discarded – undo
2561 2561
 
2562 2562
                                             // Checking in the database.
2563 2563
                                             $sql = 'SELECT exe_result, exe_weighting
2564
-                                                    FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . '
2564
+                                                    FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'
2565 2565
                                                     WHERE
2566
-                                                        exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND
2567
-                                                        exe_user_id = ' . $user_id . ' AND
2568
-                                                        orig_lp_id = ' . $this->lp_id . ' AND
2569
-                                                        orig_lp_item_id = ' . $prereqs_string . ' ';
2566
+                                                        exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND
2567
+                                                        exe_user_id = ' . $user_id.' AND
2568
+                                                        orig_lp_id = ' . $this->lp_id.' AND
2569
+                                                        orig_lp_item_id = ' . $prereqs_string.' ';
2570 2570
 
2571 2571
                                             $rs_quiz = Database::query($sql);
2572 2572
                                             if (Database::num_rows($rs_quiz) > 0) {
@@ -2612,14 +2612,14 @@  discard block
 block discarded – undo
2612 2612
                                         if (!$returnstatus) {
2613 2613
                                             if (self::debug > 1) {
2614 2614
                                                 error_log(
2615
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' not complete',
2615
+                                                    'New LP - Prerequisite '.$prereqs_string.' not complete',
2616 2616
                                                     0
2617 2617
                                                 );
2618 2618
                                             }
2619 2619
                                         } else {
2620 2620
                                             if (self::debug > 1) {
2621 2621
                                                 error_log(
2622
-                                                    'New LP - Prerequisite ' . $prereqs_string . ' complete',
2622
+                                                    'New LP - Prerequisite '.$prereqs_string.' complete',
2623 2623
                                                     0
2624 2624
                                                 );
2625 2625
                                             }
@@ -2634,11 +2634,11 @@  discard block
 block discarded – undo
2634 2634
                                                 TABLE_LP_VIEW
2635 2635
                                             );
2636 2636
 
2637
-                                            $sql = 'SELECT id FROM ' . $lp_view . '
2637
+                                            $sql = 'SELECT id FROM '.$lp_view.'
2638 2638
                                                     WHERE
2639
-                                                        c_id = ' . $course_id . ' AND
2640
-                                                        user_id = ' . $user_id . '  AND
2641
-                                                        lp_id = ' . $this->lp_id . ' AND
2639
+                                                        c_id = ' . $course_id.' AND
2640
+                                                        user_id = ' . $user_id.'  AND
2641
+                                                        lp_id = ' . $this->lp_id.' AND
2642 2642
                                                         session_id = '.$sessionId.'
2643 2643
                                                     LIMIT 0, 1';
2644 2644
                                             $rs_lp = Database::query($sql);
@@ -2647,11 +2647,11 @@  discard block
 block discarded – undo
2647 2647
                                             );
2648 2648
                                             $my_lp_id = $lp_id[0];
2649 2649
 
2650
-                                            $sql = 'SELECT status FROM ' . $lp_item_view . '
2650
+                                            $sql = 'SELECT status FROM '.$lp_item_view.'
2651 2651
                                                    WHERE
2652
-                                                        c_id = ' . $course_id . ' AND
2653
-                                                        lp_view_id = ' . $my_lp_id . ' AND
2654
-                                                        lp_item_id = ' . $refs_list[$prereqs_string] . '
2652
+                                                        c_id = ' . $course_id.' AND
2653
+                                                        lp_view_id = ' . $my_lp_id.' AND
2654
+                                                        lp_item_id = ' . $refs_list[$prereqs_string].'
2655 2655
                                                     LIMIT 0, 1';
2656 2656
                                             $rs_lp = Database::query($sql);
2657 2657
                                             $status_array = Database :: fetch_row(
@@ -2668,14 +2668,14 @@  discard block
 block discarded – undo
2668 2668
                                             if (!$returnstatus) {
2669 2669
                                                 if (self::debug > 1) {
2670 2670
                                                     error_log(
2671
-                                                        'New LP - Prerequisite ' . $prereqs_string . ' not complete',
2671
+                                                        'New LP - Prerequisite '.$prereqs_string.' not complete',
2672 2672
                                                         0
2673 2673
                                                     );
2674 2674
                                                 }
2675 2675
                                             } else {
2676 2676
                                                 if (self::debug > 1) {
2677 2677
                                                     error_log(
2678
-                                                        'New LP - Prerequisite ' . $prereqs_string . ' complete',
2678
+                                                        'New LP - Prerequisite '.$prereqs_string.' complete',
2679 2679
                                                         0
2680 2680
                                                     );
2681 2681
                                                 }
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
                                 } else {
2687 2687
                                     if (self::debug > 1) {
2688 2688
                                         error_log(
2689
-                                            'New LP - Could not find ' . $prereqs_string . ' in ' . print_r(
2689
+                                            'New LP - Could not find '.$prereqs_string.' in '.print_r(
2690 2690
                                                 $refs_list,
2691 2691
                                                 true
2692 2692
                                             ),
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
                 foreach ($list as $condition) {
2710 2710
                     if (self::debug > 1) {
2711 2711
                         error_log(
2712
-                            'New LP - Found OR, adding it (' . $condition . ')',
2712
+                            'New LP - Found OR, adding it ('.$condition.')',
2713 2713
                             0
2714 2714
                         );
2715 2715
                     }
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 
2763 2763
         if (self::debug > 1) {
2764 2764
             error_log(
2765
-                'New LP - End of parse_prereq. Error code is now ' . $this->prereq_alert,
2765
+                'New LP - End of parse_prereq. Error code is now '.$this->prereq_alert,
2766 2766
                 0
2767 2767
             );
2768 2768
         }
@@ -2880,7 +2880,7 @@  discard block
 block discarded – undo
2880 2880
                                 $this->set_score($value);
2881 2881
                                 if (self::debug > 2) {
2882 2882
                                     error_log(
2883
-                                        'learnpathItem::save() - setting score to ' . $value,
2883
+                                        'learnpathItem::save() - setting score to '.$value,
2884 2884
                                         0
2885 2885
                                     );
2886 2886
                                 }
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
                                 $this->set_max_score($value);
2890 2890
                                 if (self::debug > 2) {
2891 2891
                                     error_log(
2892
-                                        'learnpathItem::save() - setting view_max_score to ' . $value,
2892
+                                        'learnpathItem::save() - setting view_max_score to '.$value,
2893 2893
                                         0
2894 2894
                                     );
2895 2895
                                 }
@@ -2898,7 +2898,7 @@  discard block
 block discarded – undo
2898 2898
                                 $this->min_score = $value;
2899 2899
                                 if (self::debug > 2) {
2900 2900
                                     error_log(
2901
-                                        'learnpathItem::save() - setting min_score to ' . $value,
2901
+                                        'learnpathItem::save() - setting min_score to '.$value,
2902 2902
                                         0
2903 2903
                                     );
2904 2904
                                 }
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
                                     $this->set_status($value);
2909 2909
                                     if (self::debug > 2) {
2910 2910
                                         error_log(
2911
-                                            'learnpathItem::save() - setting status to ' . $value,
2911
+                                            'learnpathItem::save() - setting status to '.$value,
2912 2912
                                             0
2913 2913
                                         );
2914 2914
                                     }
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
                                 $this->set_time($value);
2919 2919
                                 if (self::debug > 2) {
2920 2920
                                     error_log(
2921
-                                        'learnpathItem::save() - setting time to ' . $value,
2921
+                                        'learnpathItem::save() - setting time to '.$value,
2922 2922
                                         0
2923 2923
                                     );
2924 2924
                                 }
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
                                 $this->current_data = $value;
2928 2928
                                 if (self::debug > 2) {
2929 2929
                                     error_log(
2930
-                                        'learnpathItem::save() - setting suspend_data to ' . $value,
2930
+                                        'learnpathItem::save() - setting suspend_data to '.$value,
2931 2931
                                         0
2932 2932
                                     );
2933 2933
                                 }
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
                                 $this->set_lesson_location($value);
2937 2937
                                 if (self::debug > 2) {
2938 2938
                                     error_log(
2939
-                                        'learnpathItem::save() - setting lesson_location to ' . $value,
2939
+                                        'learnpathItem::save() - setting lesson_location to '.$value,
2940 2940
                                         0
2941 2941
                                     );
2942 2942
                                 }
@@ -2945,7 +2945,7 @@  discard block
 block discarded – undo
2945 2945
                                 $this->set_core_exit($value);
2946 2946
                                 if (self::debug > 2) {
2947 2947
                                     error_log(
2948
-                                        'learnpathItem::save() - setting core_exit to ' . $value,
2948
+                                        'learnpathItem::save() - setting core_exit to '.$value,
2949 2949
                                         0
2950 2950
                                     );
2951 2951
                                 }
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
     public function set_level($int = 0)
3093 3093
     {
3094 3094
         if (self::debug > 0) {
3095
-            error_log('learnpathItem::set_level(' . $int . ')', 0);
3095
+            error_log('learnpathItem::set_level('.$int.')', 0);
3096 3096
         }
3097 3097
         if (!empty($int) AND $int == strval(intval($int))) {
3098 3098
             $this->level = $int;
@@ -3121,7 +3121,7 @@  discard block
 block discarded – undo
3121 3121
         if (empty($lpItemId)) {
3122 3122
             if (self::debug > 0) {
3123 3123
                 error_log(
3124
-                    'learnpathItem::set_lp_view(' . $lp_view_id . ') $lpItemId is empty',
3124
+                    'learnpathItem::set_lp_view('.$lp_view_id.') $lpItemId is empty',
3125 3125
                     0
3126 3126
                 );
3127 3127
             }
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
         if (empty($lp_view_id)) {
3133 3133
             if (self::debug > 0) {
3134 3134
                 error_log(
3135
-                    'learnpathItem::set_lp_view(' . $lp_view_id . ') $lp_view_id is empty',
3135
+                    'learnpathItem::set_lp_view('.$lp_view_id.') $lp_view_id is empty',
3136 3136
                     0
3137 3137
                 );
3138 3138
             }
@@ -3141,7 +3141,7 @@  discard block
 block discarded – undo
3141 3141
         }
3142 3142
 
3143 3143
         if (self::debug > 0) {
3144
-            error_log('learnpathItem::set_lp_view(' . $lp_view_id . ')', 0);
3144
+            error_log('learnpathItem::set_lp_view('.$lp_view_id.')', 0);
3145 3145
         }
3146 3146
 
3147 3147
         $this->view_id = $lp_view_id;
@@ -3151,13 +3151,13 @@  discard block
 block discarded – undo
3151 3151
         $sql = "SELECT * FROM $item_view_table
3152 3152
                 WHERE
3153 3153
                     c_id = $course_id AND
3154
-                    lp_item_id = " . $lpItemId . " AND
3155
-                    lp_view_id = " . $lp_view_id . "
3154
+                    lp_item_id = ".$lpItemId." AND
3155
+                    lp_view_id = " . $lp_view_id."
3156 3156
                 ORDER BY view_count DESC";
3157 3157
 
3158 3158
         if (self::debug > 2) {
3159 3159
             error_log(
3160
-                'learnpathItem::set_lp_view() - Querying lp_item_view: ' . $sql,
3160
+                'learnpathItem::set_lp_view() - Querying lp_item_view: '.$sql,
3161 3161
                 0
3162 3162
             );
3163 3163
         }
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
             $sql = "SELECT * FROM $item_view_interaction_table
3190 3190
                     WHERE
3191 3191
                         c_id = $course_id AND
3192
-                        lp_iv_id = '" . $this->db_item_view_id . "'";
3192
+                        lp_iv_id = '".$this->db_item_view_id."'";
3193 3193
 
3194 3194
             $res = Database::query($sql);
3195 3195
             if ($res !== false) {
@@ -3204,7 +3204,7 @@  discard block
 block discarded – undo
3204 3204
             $sql = "SELECT * FROM $item_view_objective_table
3205 3205
                     WHERE
3206 3206
                         c_id = $course_id AND
3207
-                        lp_iv_id = '" . $this->db_item_view_id . "'";
3207
+                        lp_iv_id = '".$this->db_item_view_id."'";
3208 3208
 
3209 3209
             $res = Database::query($sql);
3210 3210
             if ($res !== false) {
@@ -3265,7 +3265,7 @@  discard block
 block discarded – undo
3265 3265
     {
3266 3266
         $debug = self::debug;
3267 3267
         if ($debug > 0) {
3268
-            error_log('learnpathItem::set_score(' . $score . ')', 0);
3268
+            error_log('learnpathItem::set_score('.$score.')', 0);
3269 3269
         }
3270 3270
         if (($this->max_score <= 0 || $score <= $this->max_score) && ($score >= $this->min_score)) {
3271 3271
             $this->current_score = $score;
@@ -3278,9 +3278,9 @@  discard block
 block discarded – undo
3278 3278
             }
3279 3279
 
3280 3280
             if ($debug > 0) {
3281
-                error_log('get_mastery_score: ' . $masteryScore);
3282
-                error_log('current_status: ' . $current_status);
3283
-                error_log('current score : ' . $this->current_score);
3281
+                error_log('get_mastery_score: '.$masteryScore);
3282
+                error_log('current_status: '.$current_status);
3283
+                error_log('current score : '.$this->current_score);
3284 3284
             }
3285 3285
 
3286 3286
             // If mastery_score is set AND the current score reaches the mastery
@@ -3308,15 +3308,15 @@  discard block
 block discarded – undo
3308 3308
     public function set_max_score($score)
3309 3309
     {
3310 3310
         if (self::debug > 0) {
3311
-            error_log('learnpathItem::set_max_score(' . $score . ')', 0);
3311
+            error_log('learnpathItem::set_max_score('.$score.')', 0);
3312 3312
         }
3313 3313
         if (is_int($score) || $score == '') {
3314 3314
             $this->view_max_score = $score;
3315 3315
             if (self::debug > 1) {
3316 3316
                 error_log(
3317
-                    'learnpathItem::set_max_score() - ' .
3318
-                    'Updated object score of item ' . $this->db_id .
3319
-                    ' to ' . $this->view_max_score,
3317
+                    'learnpathItem::set_max_score() - '.
3318
+                    'Updated object score of item '.$this->db_id.
3319
+                    ' to '.$this->view_max_score,
3320 3320
                     0
3321 3321
                 );
3322 3322
             }
@@ -3334,12 +3334,12 @@  discard block
 block discarded – undo
3334 3334
     public function set_status($status)
3335 3335
     {
3336 3336
         if (self::debug > 0) {
3337
-            error_log('learnpathItem::set_status(' . $status . ')', 0);
3337
+            error_log('learnpathItem::set_status('.$status.')', 0);
3338 3338
         }
3339 3339
 
3340 3340
         $found = false;
3341 3341
         foreach ($this->possible_status as $possible) {
3342
-            if (preg_match('/^' . $possible . '$/i', $status)) {
3342
+            if (preg_match('/^'.$possible.'$/i', $status)) {
3343 3343
                 $found = true;
3344 3344
             }
3345 3345
         }
@@ -3349,8 +3349,8 @@  discard block
 block discarded – undo
3349 3349
             if (self::debug > 1) {
3350 3350
                 error_log(
3351 3351
                     'learnpathItem::set_status() - '.
3352
-                        'Updated object status of item ' . $this->db_id .
3353
-                        ' to ' . $this->status,
3352
+                        'Updated object status of item '.$this->db_id.
3353
+                        ' to '.$this->status,
3354 3354
                     0
3355 3355
                 );
3356 3356
             }
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
         $lp_item = Database::get_course_table(TABLE_LP_ITEM);
3375 3375
         require_once api_get_path(
3376 3376
                 LIBRARY_PATH
3377
-            ) . 'search/ChamiloIndexer.class.php';
3377
+            ).'search/ChamiloIndexer.class.php';
3378 3378
         $a_terms = preg_split('/,/', $terms);
3379 3379
         $i_terms = preg_split('/,/', $this->get_terms());
3380 3380
         foreach ($i_terms as $term) {
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
                 SET terms = '$terms'
3392 3392
                 WHERE
3393 3393
                     c_id = $course_id AND
3394
-                    id=" . $this->get_id();
3394
+                    id=".$this->get_id();
3395 3395
         Database::query($sql);
3396 3396
         // Save it to search engine.
3397 3397
         if (api_get_setting('search_enabled') == 'true') {
@@ -3419,7 +3419,7 @@  discard block
 block discarded – undo
3419 3419
     public function set_time($scorm_time, $format = 'scorm')
3420 3420
     {
3421 3421
         if (self::debug > 0) {
3422
-            error_log('learnpathItem::set_time(' . $scorm_time . ')', 0);
3422
+            error_log('learnpathItem::set_time('.$scorm_time.')', 0);
3423 3423
         }
3424 3424
         if ($scorm_time == '0'
3425 3425
                 and ($this->type != 'sco')
@@ -3430,8 +3430,8 @@  discard block
 block discarded – undo
3430 3430
                 $this->update_time($my_time);
3431 3431
                 if (self::debug > 0) {
3432 3432
                     error_log(
3433
-                        'learnpathItem::set_time(' . $scorm_time . ') - ' .
3434
-                            'found asset - set time to ' . $my_time,
3433
+                        'learnpathItem::set_time('.$scorm_time.') - '.
3434
+                            'found asset - set time to '.$my_time,
3435 3435
                         0
3436 3436
                     );
3437 3437
                 }
@@ -3504,10 +3504,10 @@  discard block
 block discarded – undo
3504 3504
     {
3505 3505
         if (self::debug > 1) {
3506 3506
             error_log(
3507
-                'learnpathItem::status_is(' . print_r(
3507
+                'learnpathItem::status_is('.print_r(
3508 3508
                     $list,
3509 3509
                     true
3510
-                ) . ') on item ' . $this->db_id,
3510
+                ).') on item '.$this->db_id,
3511 3511
                 0
3512 3512
             );
3513 3513
         }
@@ -3517,11 +3517,11 @@  discard block
 block discarded – undo
3517 3517
         }
3518 3518
         $found = false;
3519 3519
         foreach ($list as $status) {
3520
-            if (preg_match('/^' . $status . '$/i', $currentStatus)) {
3520
+            if (preg_match('/^'.$status.'$/i', $currentStatus)) {
3521 3521
                 if (self::debug > 2) {
3522 3522
                     error_log(
3523
-                        'New LP - learnpathItem::status_is() - Found status ' .
3524
-                            $status . ' corresponding to current status',
3523
+                        'New LP - learnpathItem::status_is() - Found status '.
3524
+                            $status.' corresponding to current status',
3525 3525
                         0
3526 3526
                     );
3527 3527
                 }
@@ -3532,8 +3532,8 @@  discard block
 block discarded – undo
3532 3532
         }
3533 3533
         if (self::debug > 2) {
3534 3534
             error_log(
3535
-                'New LP - learnpathItem::status_is() - Status ' .
3536
-                    $currentStatus . ' did not match request',
3535
+                'New LP - learnpathItem::status_is() - Status '.
3536
+                    $currentStatus.' did not match request',
3537 3537
                 0
3538 3538
             );
3539 3539
         }
@@ -3550,7 +3550,7 @@  discard block
 block discarded – undo
3550 3550
     public function update_time($total_sec = 0)
3551 3551
     {
3552 3552
         if (self::debug > 0) {
3553
-            error_log('learnpathItem::update_time(' . $total_sec . ')', 0);
3553
+            error_log('learnpathItem::update_time('.$total_sec.')', 0);
3554 3554
         }
3555 3555
         if ($total_sec >= 0) {
3556 3556
             // Getting start time from finish time. The only problem in the calculation is it might be
@@ -3602,11 +3602,11 @@  discard block
 block discarded – undo
3602 3602
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
3603 3603
         $course_id = api_get_course_int_id();
3604 3604
 
3605
-        $get_view_sql = 'SELECT total_time, status FROM ' . $item_view_table . '
3606
-                         WHERE c_id = ' . $course_id . '
3607
-                            AND lp_item_id="' . $this->db_id . '"
3608
-                            AND lp_view_id="' . $this->view_id . '"
3609
-                            AND view_count="' . $this->attempt_id . '" ;';
3605
+        $get_view_sql = 'SELECT total_time, status FROM '.$item_view_table.'
3606
+                         WHERE c_id = ' . $course_id.'
3607
+                            AND lp_item_id="' . $this->db_id.'"
3608
+                            AND lp_view_id="' . $this->view_id.'"
3609
+                            AND view_count="' . $this->attempt_id.'" ;';
3610 3610
         $result = Database::query($get_view_sql);
3611 3611
         $row = Database::fetch_array($result);
3612 3612
 
@@ -3659,12 +3659,12 @@  discard block
 block discarded – undo
3659 3659
     {
3660 3660
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
3661 3661
         $course_id = api_get_course_int_id();
3662
-        $sql = 'UPDATE ' . $item_view_table . '
3663
-                SET total_time = 0, start_time=' . time() . '
3664
-                WHERE c_id = ' . $course_id . '
3665
-                    AND lp_item_id="' . $this->db_id . '"
3666
-                    AND lp_view_id="' . $this->view_id . '"
3667
-                    AND view_count="' . $this->attempt_id . '" ;';
3662
+        $sql = 'UPDATE '.$item_view_table.'
3663
+                SET total_time = 0, start_time=' . time().'
3664
+                WHERE c_id = ' . $course_id.'
3665
+                    AND lp_item_id="' . $this->db_id.'"
3666
+                    AND lp_view_id="' . $this->view_id.'"
3667
+                    AND view_count="' . $this->attempt_id.'" ;';
3668 3668
         Database::query($sql);
3669 3669
     }
3670 3670
 
@@ -3686,8 +3686,8 @@  discard block
 block discarded – undo
3686 3686
                     FROM $tbl
3687 3687
                     WHERE
3688 3688
                         c_id = $course_id AND
3689
-                        lp_item_id = " . $this->db_id . " AND
3690
-                        lp_view_id = " . $this->view_id . " AND
3689
+                        lp_item_id = ".$this->db_id." AND
3690
+                        lp_view_id = " . $this->view_id." AND
3691 3691
                         view_count = " . $this->attempt_id;
3692 3692
             $res = Database::query($sql);
3693 3693
             if (Database::num_rows($res) > 0) {
@@ -3695,8 +3695,8 @@  discard block
 block discarded – undo
3695 3695
                 $lp_iv_id = $row[0];
3696 3696
                 if (self::debug > 2) {
3697 3697
                     error_log(
3698
-                        'learnpathItem::write_to_db() - Got item_view_id ' .
3699
-                            $lp_iv_id . ', now checking objectives ',
3698
+                        'learnpathItem::write_to_db() - Got item_view_id '.
3699
+                            $lp_iv_id.', now checking objectives ',
3700 3700
                         0
3701 3701
                     );
3702 3702
                 }
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
                                 WHERE
3709 3709
                                     c_id = $course_id AND
3710 3710
                                     lp_iv_id = $lp_iv_id AND
3711
-                                    objective_id = '" . Database::escape_string($objective[0]) . "'";
3711
+                                    objective_id = '".Database::escape_string($objective[0])."'";
3712 3712
                     $iva_res = Database::query($iva_sql);
3713 3713
                     // id(0), type(1), time(2), weighting(3),
3714 3714
                     // correct_responses(4), student_response(5),
@@ -3717,22 +3717,22 @@  discard block
 block discarded – undo
3717 3717
                         // Update (or don't).
3718 3718
                         $iva_row = Database::fetch_array($iva_res);
3719 3719
                         $iva_id = $iva_row[0];
3720
-                        $ivau_sql = "UPDATE $iva_table " .
3721
-                            "SET objective_id = '" . Database::escape_string(
3720
+                        $ivau_sql = "UPDATE $iva_table ".
3721
+                            "SET objective_id = '".Database::escape_string(
3722 3722
                                 $objective[0]
3723
-                            ) . "'," .
3724
-                            "status = '" . Database::escape_string(
3723
+                            )."',".
3724
+                            "status = '".Database::escape_string(
3725 3725
                                 $objective[1]
3726
-                            ) . "'," .
3727
-                            "score_raw = '" . Database::escape_string(
3726
+                            )."',".
3727
+                            "score_raw = '".Database::escape_string(
3728 3728
                                 $objective[2]
3729
-                            ) . "'," .
3730
-                            "score_min = '" . Database::escape_string(
3729
+                            )."',".
3730
+                            "score_min = '".Database::escape_string(
3731 3731
                                 $objective[4]
3732
-                            ) . "'," .
3733
-                            "score_max = '" . Database::escape_string(
3732
+                            )."',".
3733
+                            "score_max = '".Database::escape_string(
3734 3734
                                 $objective[3]
3735
-                            ) . "' " .
3735
+                            )."' ".
3736 3736
                             "WHERE c_id = $course_id AND id = $iva_id";
3737 3737
                         Database::query($ivau_sql);
3738 3738
                     } else {
@@ -3782,12 +3782,12 @@  discard block
 block discarded – undo
3782 3782
         $credit = $this->get_credit();
3783 3783
 
3784 3784
         $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
3785
-        $sql = 'SELECT status FROM ' . $item_view_table . '
3785
+        $sql = 'SELECT status FROM '.$item_view_table.'
3786 3786
                 WHERE
3787
-                    c_id = ' . $course_id . ' AND
3788
-                    lp_item_id="' . $this->db_id . '" AND
3789
-                    lp_view_id="' . $this->view_id . '" AND
3790
-                    view_count="' . $this->get_attempt_id() . '" ';
3787
+                    c_id = ' . $course_id.' AND
3788
+                    lp_item_id="' . $this->db_id.'" AND
3789
+                    lp_view_id="' . $this->view_id.'" AND
3790
+                    view_count="' . $this->get_attempt_id().'" ';
3791 3791
         $rs_verified = Database::query($sql);
3792 3792
         $row_verified = Database::fetch_array($rs_verified);
3793 3793
 
@@ -3815,8 +3815,8 @@  discard block
 block discarded – undo
3815 3815
                     "This info shouldn't be saved as the credit or lesson mode info prevent it"
3816 3816
                 );
3817 3817
                 error_log(
3818
-                    'learnpathItem::write_to_db() - credit(' . $credit . ') or'.
3819
-                        ' lesson_mode(' . $mode . ') prevent recording!',
3818
+                    'learnpathItem::write_to_db() - credit('.$credit.') or'.
3819
+                        ' lesson_mode('.$mode.') prevent recording!',
3820 3820
                     0
3821 3821
                 );
3822 3822
             }
@@ -3840,14 +3840,14 @@  discard block
 block discarded – undo
3840 3840
                     "max_score" => $this->get_max(),
3841 3841
                     "lp_item_id" => $this->db_id,
3842 3842
                     "lp_view_id" => $this->view_id,
3843
-                    "view_count" => $this->get_attempt_id() ,
3843
+                    "view_count" => $this->get_attempt_id(),
3844 3844
                     "suspend_data" => $this->current_data,
3845 3845
                     //"max_time_allowed" => ,
3846 3846
                     "lesson_location" => $this->lesson_location
3847 3847
                 );
3848 3848
                 if (self::debug > 2) {
3849 3849
                     error_log(
3850
-                        'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1),
3850
+                        'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1),
3851 3851
                         0
3852 3852
                     );
3853 3853
                 }
@@ -3855,7 +3855,7 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
                 if ($this->db_item_view_id) {
3857 3857
                     $sql = "UPDATE $item_view_table SET id = iid
3858
-                            WHERE iid = " . $this->db_item_view_id;
3858
+                            WHERE iid = ".$this->db_item_view_id;
3859 3859
                     Database::query($sql);
3860 3860
                     $inserted = true;
3861 3861
                 }
@@ -3865,12 +3865,12 @@  discard block
 block discarded – undo
3865 3865
             $sql = "SELECT * FROM $item_view_table
3866 3866
                     WHERE
3867 3867
                         c_id = $course_id AND
3868
-                        lp_item_id = " . $this->db_id . " AND
3869
-                        lp_view_id = " . $this->view_id . " AND
3868
+                        lp_item_id = ".$this->db_id." AND
3869
+                        lp_view_id = " . $this->view_id." AND
3870 3870
                         view_count = " . intval($this->get_attempt_id());
3871 3871
             if (self::debug > 2) {
3872 3872
                 error_log(
3873
-                    'learnpathItem::write_to_db() - Querying item_view: ' . $sql,
3873
+                    'learnpathItem::write_to_db() - Querying item_view: '.$sql,
3874 3874
                     0
3875 3875
                 );
3876 3876
             }
@@ -3887,7 +3887,7 @@  discard block
 block discarded – undo
3887 3887
                     "max_score" => $this->get_max(),
3888 3888
                     "lp_item_id" => $this->db_id,
3889 3889
                     "lp_view_id" => $this->view_id,
3890
-                    "view_count" => $this->get_attempt_id() ,
3890
+                    "view_count" => $this->get_attempt_id(),
3891 3891
                     "suspend_data" => $this->current_data,
3892 3892
                     //"max_time_allowed" => ,$this->get_max_time_allowed()
3893 3893
                     "lesson_location" => $this->lesson_location
@@ -3895,7 +3895,7 @@  discard block
 block discarded – undo
3895 3895
 
3896 3896
                 if (self::debug > 2) {
3897 3897
                     error_log(
3898
-                        'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1),
3898
+                        'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1),
3899 3899
                         0
3900 3900
                     );
3901 3901
                 }
@@ -3904,7 +3904,7 @@  discard block
 block discarded – undo
3904 3904
 
3905 3905
                 if ($this->db_item_view_id) {
3906 3906
                     $sql = "UPDATE $item_view_table SET id = iid
3907
-                            WHERE iid = " . $this->db_item_view_id;
3907
+                            WHERE iid = ".$this->db_item_view_id;
3908 3908
                     Database::query($sql);
3909 3909
                 }
3910 3910
             } else {
@@ -3944,8 +3944,8 @@  discard block
 block discarded – undo
3944 3944
                             $time_exe_date = convert_sql_date(
3945 3945
                                 $row_dates['exe_date']
3946 3946
                             );
3947
-                            $mytime = ((int)$time_exe_date - (int)$time_start_date);
3948
-                            $total_time = " total_time = " . $mytime . ", ";
3947
+                            $mytime = ((int) $time_exe_date - (int) $time_start_date);
3948
+                            $total_time = " total_time = ".$mytime.", ";
3949 3949
                         }
3950 3950
                     } else {
3951 3951
                         $my_type_lp = learnpath::get_type_static($this->lp_id);
@@ -3959,16 +3959,16 @@  discard block
 block discarded – undo
3959 3959
 
3960 3960
                         // Is not multiple attempts
3961 3961
                         if ($this->seriousgame_mode == 1 && $this->type == 'sco') {
3962
-                            $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3963
-                            $my_status = " status = '" . $this->get_status(false) . "' ,";
3962
+                            $total_time = " total_time = total_time +".$this->get_total_time().", ";
3963
+                            $my_status = " status = '".$this->get_status(false)."' ,";
3964 3964
                         } elseif ($this->get_prevent_reinit() == 1) {
3965 3965
                             // Process of status verified into data base.
3966
-                            $sql = 'SELECT status FROM ' . $item_view_table . '
3966
+                            $sql = 'SELECT status FROM '.$item_view_table.'
3967 3967
                                     WHERE
3968
-                                        c_id = ' . $course_id . ' AND
3969
-                                        lp_item_id="' . $this->db_id . '" AND
3970
-                                        lp_view_id="' . $this->view_id . '" AND
3971
-                                        view_count="' . $this->get_attempt_id() . '"
3968
+                                        c_id = ' . $course_id.' AND
3969
+                                        lp_item_id="' . $this->db_id.'" AND
3970
+                                        lp_view_id="' . $this->view_id.'" AND
3971
+                                        view_count="' . $this->get_attempt_id().'"
3972 3972
                                     ';
3973 3973
                             $rs_verified = Database::query($sql);
3974 3974
                             $row_verified = Database::fetch_array($rs_verified);
@@ -3978,26 +3978,26 @@  discard block
 block discarded – undo
3978 3978
                             if (!in_array($this->get_status(false), $case_completed) &&
3979 3979
                                 $my_type_lp == 2
3980 3980
                             ) {
3981
-                                $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3982
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
3981
+                                $total_time = " total_time = total_time +".$this->get_total_time().", ";
3982
+                                $my_status = " status = '".$this->get_status(false)."' ,";
3983 3983
                             } else {
3984 3984
                                 // Verified into database.
3985 3985
                                 if (!in_array($row_verified['status'], $case_completed) &&
3986 3986
                                     $my_type_lp == 2
3987 3987
                                 ) {
3988
-                                    $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3989
-                                    $my_status = " status = '" . $this->get_status(false) . "' ,";
3990
-                                } elseif (in_array($row_verified['status'], $case_completed ) &&
3988
+                                    $total_time = " total_time = total_time +".$this->get_total_time().", ";
3989
+                                    $my_status = " status = '".$this->get_status(false)."' ,";
3990
+                                } elseif (in_array($row_verified['status'], $case_completed) &&
3991 3991
                                     $my_type_lp == 2 && $this->type != 'sco'
3992 3992
                                 ) {
3993
-                                    $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
3994
-                                    $my_status = " status = '" . $this->get_status(false) . "' ,";
3993
+                                    $total_time = " total_time = total_time +".$this->get_total_time().", ";
3994
+                                    $my_status = " status = '".$this->get_status(false)."' ,";
3995 3995
                                 } else {
3996 3996
                                     if (($my_type_lp == 3 && $this->type == 'au') ||
3997 3997
                                         ($my_type_lp == 1 && $this->type != 'chapter')) {
3998 3998
                                         // Is AICC or Chamilo LP
3999
-                                        $total_time = " total_time = total_time + " . $this->get_total_time() . ", ";
4000
-                                        $my_status = " status = '" . $this->get_status(false) . "' ,";
3999
+                                        $total_time = " total_time = total_time + ".$this->get_total_time().", ";
4000
+                                        $my_status = " status = '".$this->get_status(false)."' ,";
4001 4001
                                     }
4002 4002
                                 }
4003 4003
                             }
@@ -4009,27 +4009,27 @@  discard block
 block discarded – undo
4009 4009
                                 ) && $my_type_lp == 2
4010 4010
                             ) {
4011 4011
                                 // Reset zero new attempt ?
4012
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
4012
+                                $my_status = " status = '".$this->get_status(false)."' ,";
4013 4013
                             } elseif (!in_array($this->get_status(false), $case_completed) &&
4014 4014
                                 $my_type_lp == 2
4015 4015
                             ) {
4016
-                                $total_time = " total_time = " . $this->get_total_time() . ", ";
4017
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
4016
+                                $total_time = " total_time = ".$this->get_total_time().", ";
4017
+                                $my_status = " status = '".$this->get_status(false)."' ,";
4018 4018
                             } else {
4019 4019
                                 // It is chamilo LP.
4020
-                                $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
4021
-                                $my_status = " status = '" . $this->get_status(false) . "' ,";
4020
+                                $total_time = " total_time = total_time +".$this->get_total_time().", ";
4021
+                                $my_status = " status = '".$this->get_status(false)."' ,";
4022 4022
                             }
4023 4023
 
4024 4024
                             // This code line fixes the problem of wrong status.
4025 4025
                             if ($my_type_lp == 2) {
4026 4026
                                 // Verify current status in multiples attempts.
4027
-                                $sql = 'SELECT status FROM ' . $item_view_table . '
4027
+                                $sql = 'SELECT status FROM '.$item_view_table.'
4028 4028
                                         WHERE
4029
-                                            c_id = ' . $course_id . ' AND
4030
-                                            lp_item_id="' . $this->db_id . '" AND
4031
-                                            lp_view_id="' . $this->view_id . '" AND
4032
-                                            view_count="' . $this->get_attempt_id() . '" ';
4029
+                                            c_id = ' . $course_id.' AND
4030
+                                            lp_item_id="' . $this->db_id.'" AND
4031
+                                            lp_view_id="' . $this->view_id.'" AND
4032
+                                            view_count="' . $this->get_attempt_id().'" ';
4033 4033
                                 $rs_status = Database::query($sql);
4034 4034
                                 $current_status = Database::result(
4035 4035
                                     $rs_status,
@@ -4040,7 +4040,7 @@  discard block
 block discarded – undo
4040 4040
                                     $my_status = '';
4041 4041
                                     $total_time = '';
4042 4042
                                 } else {
4043
-                                    $total_time = " total_time = total_time +" . $this->get_total_time() . ", ";
4043
+                                    $total_time = " total_time = total_time +".$this->get_total_time().", ";
4044 4044
                                 }
4045 4045
                             }
4046 4046
                         }
@@ -4051,38 +4051,38 @@  discard block
 block discarded – undo
4051 4051
                         //" . //start_time = ".$this->get_current_start_time().", " . //scorm_init_time does it
4052 4052
                         ////" max_time_allowed = '".$this->get_max_time_allowed()."'," .
4053 4053
                         $sql = "UPDATE $item_view_table SET
4054
-                                    score = " . $this->get_score() . ",
4054
+                                    score = ".$this->get_score().",
4055 4055
                                     $my_status
4056
-                                    max_score = '" . $this->get_max() . "',
4057
-                                    suspend_data = '" . Database::escape_string($this->current_data) . "',
4058
-                                    lesson_location = '" . $this->lesson_location . "'
4056
+                                    max_score = '".$this->get_max()."',
4057
+                                    suspend_data = '" . Database::escape_string($this->current_data)."',
4058
+                                    lesson_location = '" . $this->lesson_location."'
4059 4059
                                 WHERE
4060 4060
                                     c_id = $course_id AND
4061
-                                    lp_item_id = " . $this->db_id . " AND
4062
-                                    lp_view_id = " . $this->view_id . "  AND
4061
+                                    lp_item_id = ".$this->db_id." AND
4062
+                                    lp_view_id = " . $this->view_id."  AND
4063 4063
                                     view_count = " . $this->get_attempt_id();
4064 4064
 
4065 4065
                     } else {
4066 4066
                         //" max_time_allowed = '".$this->get_max_time_allowed()."'," .
4067 4067
                         $sql = "UPDATE $item_view_table SET
4068 4068
                                     $total_time
4069
-                                    start_time = " . $this->get_current_start_time() . ",
4070
-                                    score = " . $this->get_score() . ",
4069
+                                    start_time = ".$this->get_current_start_time().",
4070
+                                    score = " . $this->get_score().",
4071 4071
                                     $my_status
4072
-                                    max_score = '" . $this->get_max() . "',
4073
-                                    suspend_data = '" . Database::escape_string($this->current_data) . "',
4074
-                                    lesson_location = '" . $this->lesson_location . "'
4072
+                                    max_score = '".$this->get_max()."',
4073
+                                    suspend_data = '" . Database::escape_string($this->current_data)."',
4074
+                                    lesson_location = '" . $this->lesson_location."'
4075 4075
                                 WHERE
4076 4076
                                     c_id = $course_id AND
4077
-                                    lp_item_id = " . $this->db_id . " AND
4078
-                                    lp_view_id = " . $this->view_id . " AND
4077
+                                    lp_item_id = ".$this->db_id." AND
4078
+                                    lp_view_id = " . $this->view_id." AND
4079 4079
                                     view_count = " . $this->get_attempt_id();
4080 4080
                     }
4081 4081
                     $this->current_start_time = time();
4082 4082
                 }
4083 4083
                 if (self::debug > 2) {
4084 4084
                     error_log(
4085
-                        'learnpathItem::write_to_db() - Updating item_view: ' . $sql,
4085
+                        'learnpathItem::write_to_db() - Updating item_view: '.$sql,
4086 4086
                         0
4087 4087
                     );
4088 4088
                 }
@@ -4095,8 +4095,8 @@  discard block
 block discarded – undo
4095 4095
                 $sql = "SELECT id FROM $tbl
4096 4096
                         WHERE
4097 4097
                             c_id = $course_id AND
4098
-                            lp_item_id = " . $this->db_id . " AND
4099
-                            lp_view_id = " . $this->view_id . " AND
4098
+                            lp_item_id = ".$this->db_id." AND
4099
+                            lp_view_id = " . $this->view_id." AND
4100 4100
                             view_count = " . $this->get_attempt_id();
4101 4101
                 $res = Database::query($sql);
4102 4102
                 if (Database::num_rows($res) > 0) {
@@ -4104,8 +4104,8 @@  discard block
 block discarded – undo
4104 4104
                     $lp_iv_id = $row[0];
4105 4105
                     if (self::debug > 2) {
4106 4106
                         error_log(
4107
-                            'learnpathItem::write_to_db() - Got item_view_id ' .
4108
-                                $lp_iv_id . ', now checking interactions ',
4107
+                            'learnpathItem::write_to_db() - Got item_view_id '.
4108
+                                $lp_iv_id.', now checking interactions ',
4109 4109
                             0
4110 4110
                         );
4111 4111
                     }
@@ -4116,7 +4116,7 @@  discard block
 block discarded – undo
4116 4116
                             ) && !empty($interaction[4][0])
4117 4117
                         ) {
4118 4118
                             foreach ($interaction[4] as $resp) {
4119
-                                $correct_resp .= $resp . ',';
4119
+                                $correct_resp .= $resp.',';
4120 4120
                             }
4121 4121
                             $correct_resp = substr(
4122 4122
                                 $correct_resp,
@@ -4135,7 +4135,7 @@  discard block
 block discarded – undo
4135 4135
                                         lp_iv_id = $lp_iv_id AND
4136 4136
                                         (
4137 4137
                                             order_id = $index OR
4138
-                                            interaction_id = '" . Database::escape_string($interaction[0]) . "'
4138
+                                            interaction_id = '".Database::escape_string($interaction[0])."'
4139 4139
                                         )
4140 4140
                                     ";
4141 4141
                         $iva_res = Database::query($iva_sql);
@@ -4208,11 +4208,11 @@  discard block
 block discarded – undo
4208 4208
     public function add_audio()
4209 4209
     {
4210 4210
         $course_info = api_get_course_info();
4211
-        $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/';
4211
+        $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/';
4212 4212
 
4213
-        if (!is_dir($filepath . 'audio')) {
4213
+        if (!is_dir($filepath.'audio')) {
4214 4214
             mkdir(
4215
-                $filepath . 'audio',
4215
+                $filepath.'audio',
4216 4216
                 api_get_permissions_for_new_directories()
4217 4217
             );
4218 4218
             $audio_id = add_document(
@@ -4271,10 +4271,10 @@  discard block
 block discarded – undo
4271 4271
             // Store the mp3 file in the lp_item table.
4272 4272
             $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
4273 4273
             $sql = "UPDATE $tbl_lp_item SET
4274
-                        audio = '" . Database::escape_string($file_path) . "'
4274
+                        audio = '".Database::escape_string($file_path)."'
4275 4275
                     WHERE
4276 4276
                         c_id = {$course_info['real_id']} AND
4277
-                        id = '" . intval($this->db_id) . "'";
4277
+                        id = '".intval($this->db_id)."'";
4278 4278
             Database::query($sql);
4279 4279
         }
4280 4280
 
@@ -4299,10 +4299,10 @@  discard block
 block discarded – undo
4299 4299
             // Store the mp3 file in the lp_item table.
4300 4300
             $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
4301 4301
             $sql = "UPDATE $tbl_lp_item SET
4302
-                        audio = '" . Database::escape_string($file_path) . "'
4302
+                        audio = '".Database::escape_string($file_path)."'
4303 4303
                     WHERE
4304 4304
                         c_id = {$course_info['real_id']} AND
4305
-                        id = " . intval($this->db_id);
4305
+                        id = ".intval($this->db_id);
4306 4306
             Database::query($sql);
4307 4307
         }
4308 4308
         return $file_path;
@@ -4323,7 +4323,7 @@  discard block
 block discarded – undo
4323 4323
         }
4324 4324
         $sql = "UPDATE $tbl_lp_item SET
4325 4325
                 audio = ''
4326
-                WHERE c_id = $course_id AND id IN (" . $this->db_id . ")";
4326
+                WHERE c_id = $course_id AND id IN (".$this->db_id.")";
4327 4327
         Database::query($sql);
4328 4328
     }
4329 4329
 
@@ -4369,7 +4369,7 @@  discard block
 block discarded – undo
4369 4369
 
4370 4370
         if ($type == 'simple') {
4371 4371
             if (in_array($status, array('failed', 'passed', 'browsed'))) {
4372
-                $myLessonStatus = get_lang('ScormIncomplete');;
4372
+                $myLessonStatus = get_lang('ScormIncomplete'); ;
4373 4373
                 $classStatus = 'warning';
4374 4374
             }
4375 4375
         }
@@ -4518,7 +4518,7 @@  discard block
 block discarded – undo
4518 4518
      */
4519 4519
     public function createForumThread($currentForumId)
4520 4520
     {
4521
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
4521
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
4522 4522
 
4523 4523
         $em = Database::getManager();
4524 4524
         $threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread');
Please login to merge, or discard this patch.
main/newscorm/learnpathList.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * @param   int     $categoryId
35 35
      * @param bool $ignoreCategoryFilter
36 36
      *
37
-     * @return	void
37
+     * @return	false|null
38 38
      */
39 39
     public function __construct(
40 40
         $user_id,
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                     ";
106 106
         $res = Database::query($sql);
107 107
         $names = array();
108
-        while ($row = Database::fetch_array($res,'ASSOC')) {
108
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
109 109
             // Use domesticate here instead of Database::escape_string because
110 110
             // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
111 111
             // is done using domesticate()
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
         $lessons = array();
237 237
         while ($row = Database::fetch_array($result)) {
238
-            if (api_get_item_visibility($course, 'learnpath', $row['id'],  $session_id)) {
238
+            if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) {
239 239
                 $lessons[$row['id']] = $row;
240 240
             }
241 241
         }
Please login to merge, or discard this patch.
main/newscorm/lp_ajax_save_item.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
  * @param   int $user_id User ID
21 21
  * @param   int $view_id View ID
22 22
  * @param   int $item_id Item ID
23
- * @param   float  $score Current score
24
- * @param   float  $max Maximum score
25
- * @param   float  $min Minimum score
23
+ * @param   integer  $score Current score
24
+ * @param   integer  $max Maximum score
25
+ * @param   integer  $min Minimum score
26 26
  * @param   string  $status Lesson status
27 27
  * @param   int  $time Session time
28 28
  * @param   string  $suspend Suspend data
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -458,7 +458,7 @@
 block discarded – undo
458 458
     }
459 459
 
460 460
     if ($myLP->get_type() == 2) {
461
-         $return .= "update_stats();";
461
+            $return .= "update_stats();";
462 462
     }
463 463
 
464 464
     // To be sure progress is updated.
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // Set status to completed for hotpotatoes if score > 80%.
164 164
         if ($my_type == 'hotpotatoes') {
165 165
             if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) {
166
-                if (($score/$max) > 0.8) {
166
+                if (($score / $max) > 0.8) {
167 167
                     $myStatus = 'completed';
168 168
                     if ($debug > 1) {
169 169
                         error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                         error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0);
175 175
                     }
176 176
                 }
177
-            } elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) {
177
+            } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) {
178 178
                 $myStatus = 'failed';
179 179
                 if ($debug > 1) {
180 180
                     error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $myLPI->current_data = $suspend;
368 368
         }
369 369
 
370
-        if (isset($location) && $location != '' && $location!='undefined') {
370
+        if (isset($location) && $location != '' && $location != 'undefined') {
371 371
             $myLPI->set_lesson_location($location);
372 372
         }
373 373
 
Please login to merge, or discard this patch.