Completed
Push — master ( 6257ee...7420f9 )
by José
82:44 queued 52:54
created
main/session/session_category_edit.php 1 patch
Braces   +354 added lines, -88 removed lines patch added patch discarded remove patch
@@ -84,7 +84,12 @@  discard block
 block discarded – undo
84 84
         <div class="form-group">
85 85
             <label class="col-sm-3 control-label"><?php echo get_lang('SessionName') ?></label>
86 86
             <div class="col-sm-6">
87
-                <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>">
87
+                <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) {
88
+    echo api_htmlentities($name,ENT_QUOTES,$charset);
89
+} else {
90
+    echo api_htmlentities($infos['name'],ENT_QUOTES,$charset);
91
+}
92
+?>">
88 93
             </div>
89 94
             <div class="col-sm-3"></div>
90 95
         </div>
@@ -100,58 +105,184 @@  discard block
 block discarded – undo
100 105
                 <div class="col-sm-6">
101 106
                     <select name="day_start">
102 107
                         <option value="1">01</option>
103
-                        <option value="2" <?php if($day_start == 2) echo 'selected="selected"'; ?> >02</option>
104
-                        <option value="3" <?php if($day_start == 3) echo 'selected="selected"'; ?> >03</option>
105
-                        <option value="4" <?php if($day_start == 4) echo 'selected="selected"'; ?> >04</option>
106
-                        <option value="5" <?php if($day_start == 5) echo 'selected="selected"'; ?> >05</option>
107
-                        <option value="6" <?php if($day_start == 6) echo 'selected="selected"'; ?> >06</option>
108
-                        <option value="7" <?php if($day_start == 7) echo 'selected="selected"'; ?> >07</option>
109
-                        <option value="8" <?php if($day_start == 8) echo 'selected="selected"'; ?> >08</option>
110
-                        <option value="9" <?php if($day_start == 9) echo 'selected="selected"'; ?> >09</option>
111
-                        <option value="10" <?php if($day_start == 10) echo 'selected="selected"'; ?> >10</option>
112
-                        <option value="11" <?php if($day_start == 11) echo 'selected="selected"'; ?> >11</option>
113
-                        <option value="12" <?php if($day_start == 12) echo 'selected="selected"'; ?> >12</option>
114
-                        <option value="13" <?php if($day_start == 13) echo 'selected="selected"'; ?> >13</option>
115
-                        <option value="14" <?php if($day_start == 14) echo 'selected="selected"'; ?> >14</option>
116
-                        <option value="15" <?php if($day_start == 15) echo 'selected="selected"'; ?> >15</option>
117
-                        <option value="16" <?php if($day_start == 16) echo 'selected="selected"'; ?> >16</option>
118
-                        <option value="17" <?php if($day_start == 17) echo 'selected="selected"'; ?> >17</option>
119
-                        <option value="18" <?php if($day_start == 18) echo 'selected="selected"'; ?> >18</option>
120
-                        <option value="19" <?php if($day_start == 19) echo 'selected="selected"'; ?> >19</option>
121
-                        <option value="20" <?php if($day_start == 20) echo 'selected="selected"'; ?> >20</option>
122
-                        <option value="21" <?php if($day_start == 21) echo 'selected="selected"'; ?> >21</option>
123
-                        <option value="22" <?php if($day_start == 22) echo 'selected="selected"'; ?> >22</option>
124
-                        <option value="23" <?php if($day_start == 23) echo 'selected="selected"'; ?> >23</option>
125
-                        <option value="24" <?php if($day_start == 24) echo 'selected="selected"'; ?> >24</option>
126
-                        <option value="25" <?php if($day_start == 25) echo 'selected="selected"'; ?> >25</option>
127
-                        <option value="26" <?php if($day_start == 26) echo 'selected="selected"'; ?> >26</option>
128
-                        <option value="27" <?php if($day_start == 27) echo 'selected="selected"'; ?> >27</option>
129
-                        <option value="28" <?php if($day_start == 28) echo 'selected="selected"'; ?> >28</option>
130
-                        <option value="29" <?php if($day_start == 29) echo 'selected="selected"'; ?> >29</option>
131
-                        <option value="30" <?php if($day_start == 30) echo 'selected="selected"'; ?> >30</option>
132
-                        <option value="31" <?php if($day_start == 31) echo 'selected="selected"'; ?> >31</option>
108
+                        <option value="2" <?php if($day_start == 2) {
109
+    echo 'selected="selected"';
110
+}
111
+?> >02</option>
112
+                        <option value="3" <?php if($day_start == 3) {
113
+    echo 'selected="selected"';
114
+}
115
+?> >03</option>
116
+                        <option value="4" <?php if($day_start == 4) {
117
+    echo 'selected="selected"';
118
+}
119
+?> >04</option>
120
+                        <option value="5" <?php if($day_start == 5) {
121
+    echo 'selected="selected"';
122
+}
123
+?> >05</option>
124
+                        <option value="6" <?php if($day_start == 6) {
125
+    echo 'selected="selected"';
126
+}
127
+?> >06</option>
128
+                        <option value="7" <?php if($day_start == 7) {
129
+    echo 'selected="selected"';
130
+}
131
+?> >07</option>
132
+                        <option value="8" <?php if($day_start == 8) {
133
+    echo 'selected="selected"';
134
+}
135
+?> >08</option>
136
+                        <option value="9" <?php if($day_start == 9) {
137
+    echo 'selected="selected"';
138
+}
139
+?> >09</option>
140
+                        <option value="10" <?php if($day_start == 10) {
141
+    echo 'selected="selected"';
142
+}
143
+?> >10</option>
144
+                        <option value="11" <?php if($day_start == 11) {
145
+    echo 'selected="selected"';
146
+}
147
+?> >11</option>
148
+                        <option value="12" <?php if($day_start == 12) {
149
+    echo 'selected="selected"';
150
+}
151
+?> >12</option>
152
+                        <option value="13" <?php if($day_start == 13) {
153
+    echo 'selected="selected"';
154
+}
155
+?> >13</option>
156
+                        <option value="14" <?php if($day_start == 14) {
157
+    echo 'selected="selected"';
158
+}
159
+?> >14</option>
160
+                        <option value="15" <?php if($day_start == 15) {
161
+    echo 'selected="selected"';
162
+}
163
+?> >15</option>
164
+                        <option value="16" <?php if($day_start == 16) {
165
+    echo 'selected="selected"';
166
+}
167
+?> >16</option>
168
+                        <option value="17" <?php if($day_start == 17) {
169
+    echo 'selected="selected"';
170
+}
171
+?> >17</option>
172
+                        <option value="18" <?php if($day_start == 18) {
173
+    echo 'selected="selected"';
174
+}
175
+?> >18</option>
176
+                        <option value="19" <?php if($day_start == 19) {
177
+    echo 'selected="selected"';
178
+}
179
+?> >19</option>
180
+                        <option value="20" <?php if($day_start == 20) {
181
+    echo 'selected="selected"';
182
+}
183
+?> >20</option>
184
+                        <option value="21" <?php if($day_start == 21) {
185
+    echo 'selected="selected"';
186
+}
187
+?> >21</option>
188
+                        <option value="22" <?php if($day_start == 22) {
189
+    echo 'selected="selected"';
190
+}
191
+?> >22</option>
192
+                        <option value="23" <?php if($day_start == 23) {
193
+    echo 'selected="selected"';
194
+}
195
+?> >23</option>
196
+                        <option value="24" <?php if($day_start == 24) {
197
+    echo 'selected="selected"';
198
+}
199
+?> >24</option>
200
+                        <option value="25" <?php if($day_start == 25) {
201
+    echo 'selected="selected"';
202
+}
203
+?> >25</option>
204
+                        <option value="26" <?php if($day_start == 26) {
205
+    echo 'selected="selected"';
206
+}
207
+?> >26</option>
208
+                        <option value="27" <?php if($day_start == 27) {
209
+    echo 'selected="selected"';
210
+}
211
+?> >27</option>
212
+                        <option value="28" <?php if($day_start == 28) {
213
+    echo 'selected="selected"';
214
+}
215
+?> >28</option>
216
+                        <option value="29" <?php if($day_start == 29) {
217
+    echo 'selected="selected"';
218
+}
219
+?> >29</option>
220
+                        <option value="30" <?php if($day_start == 30) {
221
+    echo 'selected="selected"';
222
+}
223
+?> >30</option>
224
+                        <option value="31" <?php if($day_start == 31) {
225
+    echo 'selected="selected"';
226
+}
227
+?> >31</option>
133 228
                   </select>
134 229
                   /
135 230
                   <select name="month_start">
136 231
                         <option value="1">01</option>
137
-                        <option value="2" <?php if($month_start == 2) echo 'selected="selected"'; ?> >02</option>
138
-                        <option value="3" <?php if($month_start == 3) echo 'selected="selected"'; ?> >03</option>
139
-                        <option value="4" <?php if($month_start == 4) echo 'selected="selected"'; ?> >04</option>
140
-                        <option value="5" <?php if($month_start == 5) echo 'selected="selected"'; ?> >05</option>
141
-                        <option value="6" <?php if($month_start == 6) echo 'selected="selected"'; ?> >06</option>
142
-                        <option value="7" <?php if($month_start == 7) echo 'selected="selected"'; ?> >07</option>
143
-                        <option value="8" <?php if($month_start == 8) echo 'selected="selected"'; ?> >08</option>
144
-                        <option value="9" <?php if($month_start == 9) echo 'selected="selected"'; ?> >09</option>
145
-                        <option value="10" <?php if($month_start == 10) echo 'selected="selected"'; ?> >10</option>
146
-                        <option value="11" <?php if($month_start == 11) echo 'selected="selected"'; ?> >11</option>
147
-                        <option value="12" <?php if($month_start == 12) echo 'selected="selected"'; ?> >12</option>
232
+                        <option value="2" <?php if($month_start == 2) {
233
+    echo 'selected="selected"';
234
+}
235
+?> >02</option>
236
+                        <option value="3" <?php if($month_start == 3) {
237
+    echo 'selected="selected"';
238
+}
239
+?> >03</option>
240
+                        <option value="4" <?php if($month_start == 4) {
241
+    echo 'selected="selected"';
242
+}
243
+?> >04</option>
244
+                        <option value="5" <?php if($month_start == 5) {
245
+    echo 'selected="selected"';
246
+}
247
+?> >05</option>
248
+                        <option value="6" <?php if($month_start == 6) {
249
+    echo 'selected="selected"';
250
+}
251
+?> >06</option>
252
+                        <option value="7" <?php if($month_start == 7) {
253
+    echo 'selected="selected"';
254
+}
255
+?> >07</option>
256
+                        <option value="8" <?php if($month_start == 8) {
257
+    echo 'selected="selected"';
258
+}
259
+?> >08</option>
260
+                        <option value="9" <?php if($month_start == 9) {
261
+    echo 'selected="selected"';
262
+}
263
+?> >09</option>
264
+                        <option value="10" <?php if($month_start == 10) {
265
+    echo 'selected="selected"';
266
+}
267
+?> >10</option>
268
+                        <option value="11" <?php if($month_start == 11) {
269
+    echo 'selected="selected"';
270
+}
271
+?> >11</option>
272
+                        <option value="12" <?php if($month_start == 12) {
273
+    echo 'selected="selected"';
274
+}
275
+?> >12</option>
148 276
                   </select>
149 277
                   /
150 278
                 <select name="year_start">
151 279
                         <?php
152 280
                         for($i=$thisYear-5;$i <= ($thisYear+5);$i++)
153 281
                         { ?>
154
-                                <option value="<?php echo $i; ?>" <?php if($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
282
+                                <option value="<?php echo $i; ?>" <?php if($year_start == $i) {
283
+    echo 'selected="selected"';
284
+}
285
+?> ><?php echo $i; ?></option>
155 286
                         <?php
156 287
                         } ?>
157 288
                 </select>
@@ -163,53 +294,182 @@  discard block
 block discarded – undo
163 294
                 <div class="col-sm-6">
164 295
                     <select name="day_end">
165 296
                         <option value="0">--</option>
166
-                        <option value="1" <?php if($day_end == 1) echo 'selected="selected"'; ?> >01</option>
167
-                        <option value="2" <?php if($day_end == 2) echo 'selected="selected"'; ?> >02</option>
168
-                        <option value="3" <?php if($day_end == 3) echo 'selected="selected"'; ?> >03</option>
169
-                        <option value="4" <?php if($day_end == 4) echo 'selected="selected"'; ?> >04</option>
170
-                        <option value="5" <?php if($day_end == 5) echo 'selected="selected"'; ?> >05</option>
171
-                        <option value="6" <?php if($day_end == 6) echo 'selected="selected"'; ?> >06</option>
172
-                        <option value="7" <?php if($day_end == 7) echo 'selected="selected"'; ?> >07</option>
173
-                        <option value="8" <?php if($day_end == 8) echo 'selected="selected"'; ?> >08</option>
174
-                        <option value="9" <?php if($day_end == 9) echo 'selected="selected"'; ?> >09</option>
175
-                        <option value="10" <?php if($day_end == 10) echo 'selected="selected"'; ?> >10</option>
176
-                        <option value="11" <?php if($day_end == 11) echo 'selected="selected"'; ?> >11</option>
177
-                        <option value="12" <?php if($day_end == 12) echo 'selected="selected"'; ?> >12</option>
178
-                        <option value="13" <?php if($day_end == 13) echo 'selected="selected"'; ?> >13</option>
179
-                        <option value="14" <?php if($day_end == 14) echo 'selected="selected"'; ?> >14</option>
180
-                        <option value="15" <?php if($day_end == 15) echo 'selected="selected"'; ?> >15</option>
181
-                        <option value="16" <?php if($day_end == 16) echo 'selected="selected"'; ?> >16</option>
182
-                        <option value="17" <?php if($day_end == 17) echo 'selected="selected"'; ?> >17</option>
183
-                        <option value="18" <?php if($day_end == 18) echo 'selected="selected"'; ?> >18</option>
184
-                        <option value="19" <?php if($day_end == 19) echo 'selected="selected"'; ?> >19</option>
185
-                        <option value="20" <?php if($day_end == 20) echo 'selected="selected"'; ?> >20</option>
186
-                        <option value="21" <?php if($day_end == 21) echo 'selected="selected"'; ?> >21</option>
187
-                        <option value="22" <?php if($day_end == 22) echo 'selected="selected"'; ?> >22</option>
188
-                        <option value="23" <?php if($day_end == 23) echo 'selected="selected"'; ?> >23</option>
189
-                        <option value="24" <?php if($day_end == 24) echo 'selected="selected"'; ?> >24</option>
190
-                        <option value="25" <?php if($day_end == 25) echo 'selected="selected"'; ?> >25</option>
191
-                        <option value="26" <?php if($day_end == 26) echo 'selected="selected"'; ?> >26</option>
192
-                        <option value="27" <?php if($day_end == 27) echo 'selected="selected"'; ?> >27</option>
193
-                        <option value="28" <?php if($day_end == 28) echo 'selected="selected"'; ?> >28</option>
194
-                        <option value="29" <?php if($day_end == 29) echo 'selected="selected"'; ?> >29</option>
195
-                        <option value="30" <?php if($day_end == 30) echo 'selected="selected"'; ?> >30</option>
196
-                        <option value="31" <?php if($day_end == 31) echo 'selected="selected"'; ?> >31</option>
297
+                        <option value="1" <?php if($day_end == 1) {
298
+    echo 'selected="selected"';
299
+}
300
+?> >01</option>
301
+                        <option value="2" <?php if($day_end == 2) {
302
+    echo 'selected="selected"';
303
+}
304
+?> >02</option>
305
+                        <option value="3" <?php if($day_end == 3) {
306
+    echo 'selected="selected"';
307
+}
308
+?> >03</option>
309
+                        <option value="4" <?php if($day_end == 4) {
310
+    echo 'selected="selected"';
311
+}
312
+?> >04</option>
313
+                        <option value="5" <?php if($day_end == 5) {
314
+    echo 'selected="selected"';
315
+}
316
+?> >05</option>
317
+                        <option value="6" <?php if($day_end == 6) {
318
+    echo 'selected="selected"';
319
+}
320
+?> >06</option>
321
+                        <option value="7" <?php if($day_end == 7) {
322
+    echo 'selected="selected"';
323
+}
324
+?> >07</option>
325
+                        <option value="8" <?php if($day_end == 8) {
326
+    echo 'selected="selected"';
327
+}
328
+?> >08</option>
329
+                        <option value="9" <?php if($day_end == 9) {
330
+    echo 'selected="selected"';
331
+}
332
+?> >09</option>
333
+                        <option value="10" <?php if($day_end == 10) {
334
+    echo 'selected="selected"';
335
+}
336
+?> >10</option>
337
+                        <option value="11" <?php if($day_end == 11) {
338
+    echo 'selected="selected"';
339
+}
340
+?> >11</option>
341
+                        <option value="12" <?php if($day_end == 12) {
342
+    echo 'selected="selected"';
343
+}
344
+?> >12</option>
345
+                        <option value="13" <?php if($day_end == 13) {
346
+    echo 'selected="selected"';
347
+}
348
+?> >13</option>
349
+                        <option value="14" <?php if($day_end == 14) {
350
+    echo 'selected="selected"';
351
+}
352
+?> >14</option>
353
+                        <option value="15" <?php if($day_end == 15) {
354
+    echo 'selected="selected"';
355
+}
356
+?> >15</option>
357
+                        <option value="16" <?php if($day_end == 16) {
358
+    echo 'selected="selected"';
359
+}
360
+?> >16</option>
361
+                        <option value="17" <?php if($day_end == 17) {
362
+    echo 'selected="selected"';
363
+}
364
+?> >17</option>
365
+                        <option value="18" <?php if($day_end == 18) {
366
+    echo 'selected="selected"';
367
+}
368
+?> >18</option>
369
+                        <option value="19" <?php if($day_end == 19) {
370
+    echo 'selected="selected"';
371
+}
372
+?> >19</option>
373
+                        <option value="20" <?php if($day_end == 20) {
374
+    echo 'selected="selected"';
375
+}
376
+?> >20</option>
377
+                        <option value="21" <?php if($day_end == 21) {
378
+    echo 'selected="selected"';
379
+}
380
+?> >21</option>
381
+                        <option value="22" <?php if($day_end == 22) {
382
+    echo 'selected="selected"';
383
+}
384
+?> >22</option>
385
+                        <option value="23" <?php if($day_end == 23) {
386
+    echo 'selected="selected"';
387
+}
388
+?> >23</option>
389
+                        <option value="24" <?php if($day_end == 24) {
390
+    echo 'selected="selected"';
391
+}
392
+?> >24</option>
393
+                        <option value="25" <?php if($day_end == 25) {
394
+    echo 'selected="selected"';
395
+}
396
+?> >25</option>
397
+                        <option value="26" <?php if($day_end == 26) {
398
+    echo 'selected="selected"';
399
+}
400
+?> >26</option>
401
+                        <option value="27" <?php if($day_end == 27) {
402
+    echo 'selected="selected"';
403
+}
404
+?> >27</option>
405
+                        <option value="28" <?php if($day_end == 28) {
406
+    echo 'selected="selected"';
407
+}
408
+?> >28</option>
409
+                        <option value="29" <?php if($day_end == 29) {
410
+    echo 'selected="selected"';
411
+}
412
+?> >29</option>
413
+                        <option value="30" <?php if($day_end == 30) {
414
+    echo 'selected="selected"';
415
+}
416
+?> >30</option>
417
+                        <option value="31" <?php if($day_end == 31) {
418
+    echo 'selected="selected"';
419
+}
420
+?> >31</option>
197 421
                   </select>
198 422
                   /
199 423
                   <select name="month_end">
200 424
                         <option value="0">--</option>
201
-                        <option value="1" <?php if($month_end == 1) echo 'selected="selected"'; ?> >01</option>
202
-                        <option value="2" <?php if($month_end == 2) echo 'selected="selected"'; ?> >02</option>
203
-                        <option value="3" <?php if($month_end == 3) echo 'selected="selected"'; ?> >03</option>
204
-                        <option value="4" <?php if($month_end == 4) echo 'selected="selected"'; ?> >04</option>
205
-                        <option value="5" <?php if($month_end == 5) echo 'selected="selected"'; ?> >05</option>
206
-                        <option value="6" <?php if($month_end == 6) echo 'selected="selected"'; ?> >06</option>
207
-                        <option value="7" <?php if($month_end == 7) echo 'selected="selected"'; ?> >07</option>
208
-                        <option value="8" <?php if($month_end == 8) echo 'selected="selected"'; ?> >08</option>
209
-                        <option value="9" <?php if($month_end == 9) echo 'selected="selected"'; ?> >09</option>
210
-                        <option value="10" <?php if($month_end == 10) echo 'selected="selected"'; ?> >10</option>
211
-                        <option value="11" <?php if($month_end == 11) echo 'selected="selected"'; ?> >11</option>
212
-                        <option value="12" <?php if($month_end == 12) echo 'selected="selected"'; ?> >12</option>
425
+                        <option value="1" <?php if($month_end == 1) {
426
+    echo 'selected="selected"';
427
+}
428
+?> >01</option>
429
+                        <option value="2" <?php if($month_end == 2) {
430
+    echo 'selected="selected"';
431
+}
432
+?> >02</option>
433
+                        <option value="3" <?php if($month_end == 3) {
434
+    echo 'selected="selected"';
435
+}
436
+?> >03</option>
437
+                        <option value="4" <?php if($month_end == 4) {
438
+    echo 'selected="selected"';
439
+}
440
+?> >04</option>
441
+                        <option value="5" <?php if($month_end == 5) {
442
+    echo 'selected="selected"';
443
+}
444
+?> >05</option>
445
+                        <option value="6" <?php if($month_end == 6) {
446
+    echo 'selected="selected"';
447
+}
448
+?> >06</option>
449
+                        <option value="7" <?php if($month_end == 7) {
450
+    echo 'selected="selected"';
451
+}
452
+?> >07</option>
453
+                        <option value="8" <?php if($month_end == 8) {
454
+    echo 'selected="selected"';
455
+}
456
+?> >08</option>
457
+                        <option value="9" <?php if($month_end == 9) {
458
+    echo 'selected="selected"';
459
+}
460
+?> >09</option>
461
+                        <option value="10" <?php if($month_end == 10) {
462
+    echo 'selected="selected"';
463
+}
464
+?> >10</option>
465
+                        <option value="11" <?php if($month_end == 11) {
466
+    echo 'selected="selected"';
467
+}
468
+?> >11</option>
469
+                        <option value="12" <?php if($month_end == 12) {
470
+    echo 'selected="selected"';
471
+}
472
+?> >12</option>
213 473
                   </select>
214 474
                   /
215 475
                   <select name="year_end">
@@ -217,7 +477,10 @@  discard block
 block discarded – undo
217 477
                         <?php
218 478
                         for($i=$thisYear-5;$i <= ($thisYear+5);$i++)
219 479
                         { ?>
220
-                         <option value="<?php echo $i; ?>" <?php if($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
480
+                         <option value="<?php echo $i; ?>" <?php if($year_end == $i) {
481
+    echo 'selected="selected"';
482
+}
483
+?> ><?php echo $i; ?></option>
221 484
                         <?php
222 485
                         } ?>
223 486
                  </select>
@@ -238,7 +501,10 @@  discard block
 block discarded – undo
238 501
 
239 502
 
240 503
 <script>
241
-<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?>
504
+<?php if($year_start=="0000") {
505
+    echo "setDisable(document.form.nolimit);\r\n";
506
+}
507
+?>
242 508
 function setDisable(select){
243 509
 	document.form.day_start.disabled = (select.checked) ? true : false;
244 510
 	document.form.month_start.disabled = (select.checked) ? true : false;
Please login to merge, or discard this patch.
main/webservices/registration.soap.php 1 patch
Braces   +186 added lines, -64 removed lines patch added patch discarded remove patch
@@ -63,14 +63,16 @@  discard block
 block discarded – undo
63 63
         list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
64 64
         $ip = trim($ip1);
65 65
     }
66
-    if ($debug)
67
-        error_log("ip: $ip");
66
+    if ($debug) {
67
+            error_log("ip: $ip");
68
+    }
68 69
     // Check if a file that limits access from webservices exists and contains
69 70
     // the restraining check
70 71
     if (is_file('webservice-auth-ip.conf.php')) {
71 72
         include 'webservice-auth-ip.conf.php';
72
-        if ($debug)
73
-            error_log("webservice-auth-ip.conf.php file included");
73
+        if ($debug) {
74
+                    error_log("webservice-auth-ip.conf.php file included");
75
+        }
74 76
         if (!empty($ws_auth_ip)) {
75 77
             $check_ip = true;
76 78
             $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
@@ -554,7 +556,9 @@  discard block
 block discarded – undo
554 556
 
555 557
     // First check wether the login already exists
556 558
     if (!UserManager::is_username_available($loginName)) {
557
-        if ($debug) error_log("Username $loginName is not available");
559
+        if ($debug) {
560
+            error_log("Username $loginName is not available");
561
+        }
558 562
         return 0;
559 563
     }
560 564
 
@@ -1045,9 +1049,15 @@  discard block
 block discarded – undo
1045 1049
         );
1046 1050
     }
1047 1051
 
1048
-    if ($debug) error_log('$userId found: '. $userId);
1049
-    if ($debug) error_log('$courseId found: '. $courseId);
1050
-    if ($debug) error_log('$sessionId found: '. $sessionId);
1052
+    if ($debug) {
1053
+        error_log('$userId found: '. $userId);
1054
+    }
1055
+    if ($debug) {
1056
+        error_log('$courseId found: '. $courseId);
1057
+    }
1058
+    if ($debug) {
1059
+        error_log('$sessionId found: '. $sessionId);
1060
+    }
1051 1061
 
1052 1062
     return [
1053 1063
         'user_id' => $userId,
@@ -1077,13 +1087,17 @@  discard block
 block discarded – undo
1077 1087
 {
1078 1088
     global $debug;
1079 1089
 
1080
-    if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
1090
+    if ($debug) {
1091
+        error_log('WSSubscribeTeacherToSessionCourse');
1092
+    }
1081 1093
 
1082 1094
     if (!WSHelperVerifyKey($params)) {
1083 1095
         return returnError(WS_ERROR_SECRET_KEY);
1084 1096
     }
1085 1097
 
1086
-    if ($debug) error_log('Params '. print_r($params, 1));
1098
+    if ($debug) {
1099
+        error_log('Params '. print_r($params, 1));
1100
+    }
1087 1101
 
1088 1102
     $params = parseCourseSessionUserParams($params);
1089 1103
 
@@ -1096,13 +1110,17 @@  discard block
 block discarded – undo
1096 1110
     $result = 0;
1097 1111
 
1098 1112
     if (!empty($coaches)) {
1099
-        if ($debug) error_log('Coaches:  '. print_r($coaches, 1));
1113
+        if ($debug) {
1114
+            error_log('Coaches:  '. print_r($coaches, 1));
1115
+        }
1100 1116
         if (in_array($userId, $coaches)) {
1101 1117
             $result = 1;
1102 1118
         }
1103 1119
     }
1104 1120
 
1105
-    if ($debug) error_log('Result:  '. $result);
1121
+    if ($debug) {
1122
+        error_log('Result:  '. $result);
1123
+    }
1106 1124
 
1107 1125
     return $result;
1108 1126
 }
@@ -1128,13 +1146,17 @@  discard block
 block discarded – undo
1128 1146
 {
1129 1147
     global $debug;
1130 1148
 
1131
-    if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
1149
+    if ($debug) {
1150
+        error_log('WSSubscribeTeacherToSessionCourse');
1151
+    }
1132 1152
 
1133 1153
     if (!WSHelperVerifyKey($params)) {
1134 1154
         return returnError(WS_ERROR_SECRET_KEY);
1135 1155
     }
1136 1156
 
1137
-    if ($debug) error_log('Params '. print_r($params, 1));
1157
+    if ($debug) {
1158
+        error_log('Params '. print_r($params, 1));
1159
+    }
1138 1160
 
1139 1161
     $params = parseCourseSessionUserParams($params);
1140 1162
 
@@ -1148,7 +1170,9 @@  discard block
 block discarded – undo
1148 1170
     $result = 0;
1149 1171
 
1150 1172
     if (!empty($coaches)) {
1151
-        if ($debug) error_log('Coaches:  ' . print_r($coaches, 1));
1173
+        if ($debug) {
1174
+            error_log('Coaches:  ' . print_r($coaches, 1));
1175
+        }
1152 1176
         if (!in_array($userId, $coaches)) {
1153 1177
             $result = 1;
1154 1178
         }
@@ -1156,7 +1180,9 @@  discard block
 block discarded – undo
1156 1180
         $result = 1;
1157 1181
     }
1158 1182
 
1159
-    if ($debug) error_log('Final Result: '. $result);
1183
+    if ($debug) {
1184
+        error_log('Final Result: '. $result);
1185
+    }
1160 1186
 
1161 1187
     return $result;
1162 1188
 }
@@ -1208,8 +1234,12 @@  discard block
 block discarded – undo
1208 1234
 {
1209 1235
     global $_user, $_configuration, $debug;
1210 1236
     $debug = 1;
1211
-    if ($debug) error_log('WSCreateUserPasswordCrypted');
1212
-    if ($debug) error_log(print_r($params,1));
1237
+    if ($debug) {
1238
+        error_log('WSCreateUserPasswordCrypted');
1239
+    }
1240
+    if ($debug) {
1241
+        error_log(print_r($params,1));
1242
+    }
1213 1243
 
1214 1244
     if (!WSHelperVerifyKey($params)) {
1215 1245
         return returnError(WS_ERROR_SECRET_KEY);
@@ -1241,22 +1271,30 @@  discard block
 block discarded – undo
1241 1271
         if ($_configuration['password_encryption'] === $encrypt_method ) {
1242 1272
             if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) {
1243 1273
                 $msg = "Encryption $encrypt_method is invalid";
1244
-                if ($debug) error_log($msg);
1274
+                if ($debug) {
1275
+                    error_log($msg);
1276
+                }
1245 1277
                 return $msg;
1246 1278
 
1247 1279
             } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) {
1248 1280
                 $msg = "Encryption $encrypt_method is invalid";
1249
-                if ($debug) error_log($msg);
1281
+                if ($debug) {
1282
+                    error_log($msg);
1283
+                }
1250 1284
                 return $msg;
1251 1285
             }
1252 1286
         } else {
1253 1287
             $msg = "This encryption $encrypt_method is not configured";
1254
-            if ($debug) error_log($msg);
1288
+            if ($debug) {
1289
+                error_log($msg);
1290
+            }
1255 1291
             return $msg;
1256 1292
         }
1257 1293
     } else {
1258 1294
         $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured';
1259
-        if ($debug) error_log($msg);
1295
+        if ($debug) {
1296
+            error_log($msg);
1297
+        }
1260 1298
         return $msg;
1261 1299
     }
1262 1300
 
@@ -1276,10 +1314,14 @@  discard block
 block discarded – undo
1276 1314
         $original_user_id_name
1277 1315
     );
1278 1316
 
1279
-    if ($debug) error_log('Ready to create user');
1317
+    if ($debug) {
1318
+        error_log('Ready to create user');
1319
+    }
1280 1320
 
1281 1321
     if ($user_id > 0) {
1282
-        if ($debug) error_log('User found with id: '.$user_id);
1322
+        if ($debug) {
1323
+            error_log('User found with id: '.$user_id);
1324
+        }
1283 1325
 
1284 1326
         // Check whether user is not active
1285 1327
         //@todo why this condition exists??
@@ -1290,7 +1332,9 @@  discard block
 block discarded – undo
1290 1332
         $count_check_user = Database::num_rows($resu);
1291 1333
         if ($count_check_user > 0) {
1292 1334
 
1293
-            if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1');
1335
+            if ($debug) {
1336
+                error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1');
1337
+            }
1294 1338
 
1295 1339
             $sql = "UPDATE $table_user SET
1296 1340
                     lastname='".Database::escape_string($lastName)."',
@@ -1311,7 +1355,9 @@  discard block
 block discarded – undo
1311 1355
                     hr_dept_id=".intval($hr_dept_id)." 
1312 1356
                 WHERE user_id='".$r_check_user[0]."'";
1313 1357
 
1314
-            if ($debug) error_log($sql);
1358
+            if ($debug) {
1359
+                error_log($sql);
1360
+            }
1315 1361
             Database::query($sql);
1316 1362
 
1317 1363
             if (is_array($extra_list) && count($extra_list) > 0) {
@@ -1328,11 +1374,15 @@  discard block
 block discarded – undo
1328 1374
             }
1329 1375
             return $r_check_user[0];
1330 1376
         } else {
1331
-            if ($debug) error_log('User exists but is active. Cant be updated');
1377
+            if ($debug) {
1378
+                error_log('User exists but is active. Cant be updated');
1379
+            }
1332 1380
             return 0;
1333 1381
         }
1334 1382
     } else {
1335
-        if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
1383
+        if ($debug) {
1384
+            error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
1385
+        }
1336 1386
     }
1337 1387
 
1338 1388
     // Default language.
@@ -1348,12 +1398,16 @@  discard block
 block discarded – undo
1348 1398
 
1349 1399
     // First check wether the login already exists
1350 1400
     if (!UserManager::is_username_available($loginName)) {
1351
-        if ($debug) error_log("Username $loginName is not available");
1401
+        if ($debug) {
1402
+            error_log("Username $loginName is not available");
1403
+        }
1352 1404
         return 0;
1353 1405
     }
1354 1406
 
1355 1407
     $queryExpirationDate = '';
1356
-    if (!empty($params['expiration_date'])) $queryExpirationDate = "expiration_date     = '".Database::escape_string($expiration_date)."', ";
1408
+    if (!empty($params['expiration_date'])) {
1409
+        $queryExpirationDate = "expiration_date     = '".Database::escape_string($expiration_date)."', ";
1410
+    }
1357 1411
 
1358 1412
     $sql = "INSERT INTO $table_user SET
1359 1413
             lastname            = '".Database::escape_string(trim($lastName))."',
@@ -1373,7 +1427,9 @@  discard block
 block discarded – undo
1373 1427
             ".$queryExpirationDate."
1374 1428
             hr_dept_id          = '".Database::escape_string($hr_dept_id)."',
1375 1429
             active              = '".Database::escape_string($active)."'";
1376
-    if ($debug) error_log($sql);
1430
+    if ($debug) {
1431
+        error_log($sql);
1432
+    }
1377 1433
 
1378 1434
     Database::query($sql);
1379 1435
     $return = Database::insert_id();
@@ -1385,7 +1441,9 @@  discard block
 block discarded – undo
1385 1441
 
1386 1442
         $url_id = api_get_current_access_url_id();
1387 1443
         UrlManager::add_user_to_url($return, $url_id);
1388
-        if ($debug) error_log("Adding user_id = $return to URL id $url_id ");
1444
+        if ($debug) {
1445
+            error_log("Adding user_id = $return to URL id $url_id ");
1446
+        }
1389 1447
 
1390 1448
         // Create extra field for the original_user_id_name
1391 1449
         UserManager::create_extra_field(
@@ -1422,7 +1480,9 @@  discard block
 block discarded – undo
1422 1480
             }
1423 1481
         }
1424 1482
     } else {
1425
-        if ($debug) error_log('Error while inserting a user');
1483
+        if ($debug) {
1484
+            error_log('Error while inserting a user');
1485
+        }
1426 1486
 
1427 1487
         return 0;
1428 1488
     }
@@ -4504,7 +4564,9 @@  discard block
 block discarded – undo
4504 4564
     if (!WSHelperVerifyKey($params)) {
4505 4565
         return returnError(WS_ERROR_SECRET_KEY);
4506 4566
     }
4507
-    if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4567
+    if ($debug) {
4568
+        error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4569
+    }
4508 4570
 
4509 4571
     $results = array();
4510 4572
     $userscourses = $params['userscourses'];
@@ -4523,7 +4585,9 @@  discard block
 block discarded – undo
4523 4585
             $original_user_id['original_user_id_value'],
4524 4586
             $original_user_id['original_user_id_name']
4525 4587
         );
4526
-        if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4588
+        if ($debug) {
4589
+            error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4590
+        }
4527 4591
 
4528 4592
         if ($user_id == 0) {
4529 4593
             // If user was not found, there was a problem
@@ -4541,13 +4605,19 @@  discard block
 block discarded – undo
4541 4605
                 // Course was not found
4542 4606
                 $resultValue = 0;
4543 4607
             } else {
4544
-                if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4608
+                if ($debug) {
4609
+                    error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4610
+                }
4545 4611
                 $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false);
4546 4612
                 if ($result) {
4547 4613
                     $resultValue = 1;
4548
-                    if ($debug) error_log('WSSubscribeUserToCourse subscribed');
4614
+                    if ($debug) {
4615
+                        error_log('WSSubscribeUserToCourse subscribed');
4616
+                    }
4549 4617
                 } else {
4550
-                    if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: ');
4618
+                    if ($debug) {
4619
+                        error_log('WSSubscribeUserToCourse NOT subscribed: ');
4620
+                    }
4551 4621
                 }
4552 4622
             }
4553 4623
         }
@@ -4606,8 +4676,12 @@  discard block
 block discarded – undo
4606 4676
 function WSSubscribeUserToCourseSimple($params) {
4607 4677
     global $debug;
4608 4678
 
4609
-    if ($debug) error_log('WSSubscribeUserToCourseSimple');
4610
-    if ($debug) error_log('Params '. print_r($params, 1));
4679
+    if ($debug) {
4680
+        error_log('WSSubscribeUserToCourseSimple');
4681
+    }
4682
+    if ($debug) {
4683
+        error_log('Params '. print_r($params, 1));
4684
+    }
4611 4685
     if (!WSHelperVerifyKey($params)) {
4612 4686
         return returnError(WS_ERROR_SECRET_KEY);
4613 4687
     }
@@ -4625,7 +4699,9 @@  discard block
 block discarded – undo
4625 4699
     if (empty($user_data)) {
4626 4700
         // If user was not found, there was a problem
4627 4701
         $result = "User $user_id does not exist";
4628
-        if ($debug) error_log($result);
4702
+        if ($debug) {
4703
+            error_log($result);
4704
+        }
4629 4705
         return $result;
4630 4706
     }
4631 4707
     if (!empty($course_code)) {
@@ -4633,14 +4709,22 @@  discard block
 block discarded – undo
4633 4709
         if (empty($course_data)) {
4634 4710
             // Course was not found
4635 4711
             $result = "Course $course_code does not exist in the platform ";
4636
-            if ($debug) error_log($result);
4712
+            if ($debug) {
4713
+                error_log($result);
4714
+            }
4637 4715
         } else {
4638
-            if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4716
+            if ($debug) {
4717
+                error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4718
+            }
4639 4719
             if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) {
4640 4720
                 $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions ';
4641
-                if ($debug) error_log($result);
4721
+                if ($debug) {
4722
+                    error_log($result);
4723
+                }
4642 4724
             } else {
4643
-                if ($debug) error_log('User registered to the course: '.$course_data['code']);
4725
+                if ($debug) {
4726
+                    error_log('User registered to the course: '.$course_data['code']);
4727
+                }
4644 4728
                 $result = 1;
4645 4729
             }
4646 4730
         }
@@ -4693,8 +4777,12 @@  discard block
 block discarded – undo
4693 4777
 function WSGetUser($params)
4694 4778
 {
4695 4779
     global $debug;
4696
-    if ($debug) error_log('WSGetUser');
4697
-    if ($debug) error_log('$params: '.print_r($params, 1));
4780
+    if ($debug) {
4781
+        error_log('WSGetUser');
4782
+    }
4783
+    if ($debug) {
4784
+        error_log('$params: '.print_r($params, 1));
4785
+    }
4698 4786
 
4699 4787
     if (!WSHelperVerifyKey($params)) {
4700 4788
         return returnError(WS_ERROR_SECRET_KEY);
@@ -4748,8 +4836,12 @@  discard block
 block discarded – undo
4748 4836
 function WSGetUserFromUsername($params)
4749 4837
 {
4750 4838
     global $debug;
4751
-    if ($debug) error_log('WSGetUserFromUsername');
4752
-    if ($debug) error_log('$params: '.print_r($params, 1));
4839
+    if ($debug) {
4840
+        error_log('WSGetUserFromUsername');
4841
+    }
4842
+    if ($debug) {
4843
+        error_log('$params: '.print_r($params, 1));
4844
+    }
4753 4845
 
4754 4846
     if (!WSHelperVerifyKey($params)) {
4755 4847
         return returnError(WS_ERROR_SECRET_KEY);
@@ -5216,7 +5308,9 @@  discard block
 block discarded – undo
5216 5308
                 SessionManager::suscribe_users_to_session($sessionId, array($user_id), SESSION_VISIBLE_READ_ONLY, false);
5217 5309
                 $results[] = 1;
5218 5310
 
5219
-                if ($debug) error_log("subscribe user:$user_id to session $sessionId");
5311
+                if ($debug) {
5312
+                    error_log("subscribe user:$user_id to session $sessionId");
5313
+                }
5220 5314
             }
5221 5315
         }
5222 5316
     } // end principal foreach
@@ -5300,7 +5394,9 @@  discard block
 block discarded – undo
5300 5394
                 SESSION_VISIBLE_READ_ONLY,
5301 5395
                 false
5302 5396
             );
5303
-            if ($debug) error_log('User registered to the course: '.$session_id);
5397
+            if ($debug) {
5398
+                error_log('User registered to the course: '.$session_id);
5399
+            }
5304 5400
             $result = 1;
5305 5401
         }
5306 5402
     }
@@ -5448,7 +5544,9 @@  discard block
 block discarded – undo
5448 5544
 
5449 5545
                 $results[] = 1;
5450 5546
 
5451
-                if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session");
5547
+                if ($debug) {
5548
+                    error_log("Unsubscribe user:$user_id to session:$id_session");
5549
+                }
5452 5550
             }
5453 5551
         }
5454 5552
     } // end principal foreach
@@ -5595,7 +5693,9 @@  discard block
 block discarded – undo
5595 5693
         return returnError(WS_ERROR_SECRET_KEY);
5596 5694
     }
5597 5695
 
5598
-    if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5696
+    if ($debug) {
5697
+        error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5698
+    }
5599 5699
 
5600 5700
     $coursessessions_params = $params['coursessessions'];
5601 5701
     $results = array();
@@ -5641,7 +5741,9 @@  discard block
 block discarded – undo
5641 5741
                     array($courseInfo['real_id']),
5642 5742
                     false
5643 5743
                 );
5644
-                if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5744
+                if ($debug) {
5745
+                    error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5746
+                }
5645 5747
 
5646 5748
                 $results[] = 1;
5647 5749
             }
@@ -6914,7 +7016,9 @@  discard block
 block discarded – undo
6914 7016
     if (!WSHelperVerifyKey($params)) {
6915 7017
         return returnError(WS_ERROR_SECRET_KEY);
6916 7018
     }
6917
-    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1));
7019
+    if ($debug) {
7020
+        error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1));
7021
+    }
6918 7022
 
6919 7023
     $results = array();
6920 7024
     $userscourses = $params['userscourses'];
@@ -6930,7 +7034,9 @@  discard block
 block discarded – undo
6930 7034
             $original_user_id['original_user_id_value'],
6931 7035
             $original_user_id['original_user_id_name']
6932 7036
         );
6933
-        if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId);
7037
+        if ($debug) {
7038
+            error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId);
7039
+        }
6934 7040
 
6935 7041
         if ($userId == 0) {
6936 7042
             // If user was not found, there was a problem
@@ -6947,13 +7053,19 @@  discard block
 block discarded – undo
6947 7053
                 // Course was not found
6948 7054
                 $resultValue = 0;
6949 7055
             } else {
6950
-                if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode);
7056
+                if ($debug) {
7057
+                    error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode);
7058
+                }
6951 7059
                 $result = CourseManager::addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible);
6952 7060
                 if ($result) {
6953 7061
                     $resultValue = 1;
6954
-                    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue registered');
7062
+                    if ($debug) {
7063
+                        error_log('WSAddUserVisibilityToCourseCatalogue registered');
7064
+                    }
6955 7065
                 } else {
6956
-                    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: ');
7066
+                    if ($debug) {
7067
+                        error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: ');
7068
+                    }
6957 7069
                 }
6958 7070
             }
6959 7071
         }
@@ -6986,7 +7098,9 @@  discard block
 block discarded – undo
6986 7098
     if (!WSHelperVerifyKey($params)) {
6987 7099
         return returnError(WS_ERROR_SECRET_KEY);
6988 7100
     }
6989
-    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1));
7101
+    if ($debug) {
7102
+        error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1));
7103
+    }
6990 7104
 
6991 7105
     $results = array();
6992 7106
     $userscourses = $params['userscourses'];
@@ -7002,7 +7116,9 @@  discard block
 block discarded – undo
7002 7116
             $original_user_id['original_user_id_value'],
7003 7117
             $original_user_id['original_user_id_name']
7004 7118
         );
7005
-        if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId);
7119
+        if ($debug) {
7120
+            error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId);
7121
+        }
7006 7122
 
7007 7123
         if ($userId == 0) {
7008 7124
             // If user was not found, there was a problem
@@ -7020,13 +7136,19 @@  discard block
 block discarded – undo
7020 7136
                 // Course was not found
7021 7137
                 $resultValue = 0;
7022 7138
             } else {
7023
-                if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode);
7139
+                if ($debug) {
7140
+                    error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode);
7141
+                }
7024 7142
                 $result = CourseManager::removeUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible);
7025 7143
                 if ($result) {
7026 7144
                     $resultValue = 1;
7027
-                    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue removed');
7145
+                    if ($debug) {
7146
+                        error_log('WSRemoveUserVisibilityToCourseInCatalogue removed');
7147
+                    }
7028 7148
                 } else {
7029
-                    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: ');
7149
+                    if ($debug) {
7150
+                        error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: ');
7151
+                    }
7030 7152
                 }
7031 7153
             }
7032 7154
         }
Please login to merge, or discard this patch.
plugin/ims_lti/OAuthSimple.php 1 patch
Braces   +7 added lines, -12 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@  discard block
 block discarded – undo
74 74
         if (empty($this->_parameters))
75 75
 		{
76 76
 			$this->_parameters = $parameters;
77
-		}
78
-        else if (!empty($parameters))
77
+		} else if (!empty($parameters))
79 78
 		{
80 79
 			$this->_parameters = array_merge($this->_parameters,$parameters);
81 80
 		}
@@ -324,8 +323,7 @@  discard block
 block discarded – undo
324 323
                 {
325 324
                     $result .= $pName .'="' . self::_oauthEscape($val) . '", ';
326 325
                 }
327
-            }
328
-            else
326
+            } else
329 327
             {
330 328
                 $result .= $pName . '="' . self::_oauthEscape($pValue) . '", ';
331 329
             }
@@ -350,14 +348,13 @@  discard block
 block discarded – undo
350 348
                 if (!is_array($result[$key]))
351 349
 				{
352 350
                     $result[$key] = array($result[$key],$token);
353
-				}
354
-                else
351
+				} else
355 352
 				{
356 353
                     array_push($result[$key],$token);
357 354
 				}
355
+            } else {
356
+                            $result[$key]=$token;
358 357
             }
359
-            else
360
-                $result[$key]=$token;
361 358
         }
362 359
         return $result;
363 360
     }
@@ -447,8 +444,7 @@  discard block
 block discarded – undo
447 444
 					{
448 445
 						array_push($normalized_keys[self::_oauthEscape($paramName)],  self::_oauthEscape($item));
449 446
 					}
450
-				}
451
-				else
447
+				} else
452 448
 				{
453 449
 					$normalized_keys[self::_oauthEscape($paramName)] = self::_oauthEscape($paramValue);
454 450
 				}
@@ -466,8 +462,7 @@  discard block
 block discarded – undo
466 462
 				{
467 463
 					array_push($return_array, $key . "=" . $element);
468 464
 				}
469
-			}
470
-			else
465
+			} else
471 466
 			{
472 467
 				array_push($return_array, $key .'='. $val);
473 468
 			}
Please login to merge, or discard this patch.
main/gradebook/lib/be/abstractlink.class.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -244,14 +244,20 @@
 block discarded – undo
244 244
             $paramcount ++;
245 245
         }
246 246
         if (isset($type)) {
247
-            if ($paramcount != 0) $sql .= ' AND';
248
-            else $sql .= ' WHERE';
247
+            if ($paramcount != 0) {
248
+                $sql .= ' AND';
249
+            } else {
250
+                $sql .= ' WHERE';
251
+            }
249 252
             $sql .= ' type = '.intval($type);
250 253
             $paramcount ++;
251 254
         }
252 255
         if (isset($ref_id)) {
253
-            if ($paramcount != 0) $sql .= ' AND';
254
-            else $sql .= ' WHERE';
256
+            if ($paramcount != 0) {
257
+                $sql .= ' AND';
258
+            } else {
259
+                $sql .= ' WHERE';
260
+            }
255 261
             $sql .= ' ref_id = '.intval($ref_id);
256 262
             $paramcount ++;
257 263
         }
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2896,10 +2896,11 @@
 block discarded – undo
2896 2896
                                 c_id = $courseId AND
2897 2897
                                 user_id = $user_id ";
2898 2898
                     $result = Database::query($sql);
2899
-                    if (Database::affected_rows($result) > 0)
2900
-                        return true;
2901
-                    else
2902
-                        return false;
2899
+                    if (Database::affected_rows($result) > 0) {
2900
+                                            return true;
2901
+                    } else {
2902
+                                            return false;
2903
+                    }
2903 2904
                 } else {
2904 2905
                     // The user is not subscribed to the session, so make sure
2905 2906
                     // he isn't subscribed to a course in this session either
Please login to merge, or discard this patch.
main/lp/lp_controller.php 1 patch
Braces   +83 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 $use_anonymous = true;
15 15
 
16 16
 $debug = 0;
17
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
17
+if ($debug > 0) {
18
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
19
+}
18 20
 
19 21
 // Language files that needs to be included.
20 22
 if (isset($_GET['action'])) {
@@ -210,10 +212,14 @@  discard block
 block discarded – undo
210 212
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
211 213
     Session::erase('refresh');
212 214
     $myrefresh = 1;
213
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
214
-}
215
+    if ($debug > 0) {
216
+        error_log('New LP - Refresh asked', 0);
217
+    }
218
+    }
215 219
 
216
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
220
+if ($debug > 0) {
221
+    error_log('New LP - Passed refresh check', 0);
222
+}
217 223
 
218 224
 if (!empty($_REQUEST['dialog_box'])) {
219 225
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -223,17 +229,23 @@  discard block
 block discarded – undo
223 229
 $lp_found = false;
224 230
 
225 231
 if (isset($_SESSION['lpobject'])) {
226
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
232
+    if ($debug > 0) {
233
+        error_log('New LP - SESSION[lpobject] is defined', 0);
234
+    }
227 235
     $oLP = unserialize($_SESSION['lpobject']);
228 236
     if (isset($oLP) && is_object($oLP)) {
229
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
237
+        if ($debug > 0) {
238
+            error_log('New LP - oLP is object', 0);
239
+        }
230 240
         if ($myrefresh == 1 ||
231 241
             empty($oLP->cc) ||
232 242
             $oLP->cc != api_get_course_id() ||
233 243
             $oLP->lp_view_session_id != $session_id ||
234 244
             $oLP->scorm_debug == '1'
235 245
         ) {
236
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
246
+            if ($debug > 0) {
247
+                error_log('New LP - Course has changed, discard lp object', 0);
248
+            }
237 249
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
238 250
             $oLP = null;
239 251
             Session::erase('oLP');
@@ -247,13 +259,19 @@  discard block
 block discarded – undo
247 259
 
248 260
 $course_id = api_get_course_int_id();
249 261
 
250
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
262
+if ($debug>0) {
263
+    error_log('New LP - Passed data remains check', 0);
264
+}
251 265
 
252 266
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
253
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
267
+    if ($debug > 0) {
268
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
269
+    }
254 270
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
255 271
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
256
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
272
+        if ($debug > 0) {
273
+            error_log('New LP - lp_id is defined', 0);
274
+        }
257 275
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
258 276
         // right object.
259 277
         if (!empty($_REQUEST['lp_id'])) {
@@ -265,16 +283,22 @@  discard block
 block discarded – undo
265 283
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
266 284
         if (is_numeric($lp_id)) {
267 285
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
268
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
286
+            if ($debug > 0) {
287
+                error_log('New LP - querying '.$sel, 0);
288
+            }
269 289
             $res = Database::query($sel);
270 290
 
271 291
             if (Database::num_rows($res)) {
272 292
                 $row = Database::fetch_array($res);
273 293
                 $type = $row['lp_type'];
274
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
294
+                if ($debug > 0) {
295
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
296
+                }
275 297
                 switch ($type) {
276 298
                     case 1:
277
-                        if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
299
+                        if ($debug > 0) {
300
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
301
+                        }
278 302
 
279 303
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
280 304
                         if ($oLP !== false) {
@@ -284,7 +308,9 @@  discard block
 block discarded – undo
284 308
                         }
285 309
                         break;
286 310
                     case 2:
287
-                        if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
311
+                        if ($debug > 0) {
312
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
313
+                        }
288 314
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
289 315
                         if ($oLP !== false) {
290 316
                             $lp_found = true;
@@ -293,7 +319,9 @@  discard block
 block discarded – undo
293 319
                         }
294 320
                         break;
295 321
                     case 3:
296
-                        if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
322
+                        if ($debug > 0) {
323
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
324
+                        }
297 325
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
298 326
                         if ($oLP !== false) {
299 327
                             $lp_found = true;
@@ -302,7 +330,9 @@  discard block
 block discarded – undo
302 330
                         }
303 331
                         break;
304 332
                     default:
305
-                        if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
333
+                        if ($debug > 0) {
334
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
335
+                        }
306 336
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
307 337
                         if ($oLP !== false) {
308 338
                             $lp_found = true;
@@ -313,17 +343,23 @@  discard block
 block discarded – undo
313 343
                 }
314 344
             }
315 345
         } else {
316
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
346
+            if ($debug > 0) {
347
+                error_log('New LP - Request[lp_id] is not numeric', 0);
348
+            }
317 349
         }
318 350
     } else {
319
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
351
+        if ($debug > 0) {
352
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
353
+        }
320 354
     }
321 355
     if ($lp_found) {
322 356
         $_SESSION['oLP'] = $oLP;
323 357
     }
324 358
 }
325 359
 
326
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
360
+if ($debug > 0) {
361
+    error_log('New LP - Passed oLP creation check', 0);
362
+}
327 363
 
328 364
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
329 365
 
@@ -360,7 +396,9 @@  discard block
 block discarded – undo
360 396
 }
361 397
 
362 398
 $redirectTo = '';
363
-if ($debug > 0) error_log('New LP - action "'.$action.'" triggered');
399
+if ($debug > 0) {
400
+    error_log('New LP - action "'.$action.'" triggered');
401
+}
364 402
 
365 403
 switch ($action) {
366 404
     case 'add_item':
@@ -369,7 +407,9 @@  discard block
 block discarded – undo
369 407
         }
370 408
         if (!$lp_found) {
371 409
             //check if the learnpath ID was defined, otherwise send back to list
372
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
410
+            if ($debug > 0) {
411
+                error_log('New LP - No learnpath given for add item', 0);
412
+            }
373 413
             require 'lp_list.php';
374 414
         } else {
375 415
             $_SESSION['refresh'] = 1;
@@ -459,7 +499,9 @@  discard block
 block discarded – undo
459 499
         }
460 500
         if (!$lp_found) {
461 501
             //check if the learnpath ID was defined, otherwise send back to list
462
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
502
+            if ($debug > 0) {
503
+                error_log('New LP - No learnpath given for add audio', 0);
504
+            }
463 505
             require 'lp_list.php';
464 506
         } else {
465 507
             $_SESSION['refresh'] = 1;
@@ -607,8 +649,7 @@  discard block
 block discarded – undo
607 649
             if (!$is_allowed_to_edit) {
608 650
                 api_not_allowed(true);
609 651
             }
610
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
611
-            else {
652
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
612 653
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
613 654
                 require 'lp_list.php';
614 655
                 exit;
@@ -689,8 +730,7 @@  discard block
 block discarded – undo
689 730
         if (!$is_allowed_to_edit) {
690 731
             api_not_allowed(true);
691 732
         }
692
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
693
-        else {
733
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
694 734
             if (isset($_POST['submit_button'])) {
695 735
                 //Updating the lp.modified_on
696 736
                 $_SESSION['oLP']->set_modified_on();
@@ -1119,16 +1159,24 @@  discard block
 block discarded – undo
1119 1159
         }
1120 1160
         break;
1121 1161
     case 'content':
1122
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1162
+        if ($debug > 0) {
1163
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1164
+        }
1123 1165
         if (!$lp_found) {
1124 1166
             error_log('New LP - No learnpath given for content', 0);
1125 1167
             require 'lp_list.php';
1126 1168
         } else {
1127
-            if ($debug > 0) error_log('New LP - save_last()', 0);
1169
+            if ($debug > 0) {
1170
+                error_log('New LP - save_last()', 0);
1171
+            }
1128 1172
             $_SESSION['oLP']->save_last();
1129
-            if ($debug > 0) error_log('New LP - set_current_item()', 0);
1173
+            if ($debug > 0) {
1174
+                error_log('New LP - set_current_item()', 0);
1175
+            }
1130 1176
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1131
-            if ($debug > 0) error_log('New LP - start_current_item()', 0);
1177
+            if ($debug > 0) {
1178
+                error_log('New LP - start_current_item()', 0);
1179
+            }
1132 1180
             $_SESSION['oLP']->start_current_item();
1133 1181
             require 'lp_content.php';
1134 1182
         }
@@ -1244,8 +1292,7 @@  discard block
 block discarded – undo
1244 1292
         require 'lp_message.php';
1245 1293
         break;
1246 1294
     case 'return_to_course_homepage':
1247
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1248
-        else {
1295
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1249 1296
             $_SESSION['oLP']->save_current();
1250 1297
             $_SESSION['oLP']->save_last();
1251 1298
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1438,8 +1485,10 @@  discard block
 block discarded – undo
1438 1485
 
1439 1486
 if (!empty($_SESSION['oLP'])) {
1440 1487
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1441
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1442
-}
1488
+    if ($debug > 0) {
1489
+        error_log('New LP - lpobject is serialized in session', 0);
1490
+    }
1491
+    }
1443 1492
 
1444 1493
 if (!empty($redirectTo)) {
1445 1494
     header("Location: $redirectTo");
Please login to merge, or discard this patch.
main/admin/user_move_stats.php 1 patch
Braces   +99 added lines, -43 removed lines patch added patch discarded remove patch
@@ -108,7 +108,9 @@  discard block
 block discarded – undo
108 108
                 //Check if the user is registered in the session otherwise we will add it
109 109
                 $result = SessionManager::get_users_by_session($new_session_id);
110 110
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
111
-                    if ($debug) echo 'User added to the session';
111
+                    if ($debug) {
112
+                        echo 'User added to the session';
113
+                    }
112 114
                     //Registering user to the new session
113 115
                     SessionManager::subscribe_users_to_session($new_session_id,array($user_id),false);
114 116
                 }
@@ -143,10 +145,11 @@  discard block
 block discarded – undo
143 145
                     $list[$row['exe_id']]= $row;
144 146
                 }
145 147
 
146
-                if (!empty($list))
147
-                    foreach ($list as $exe_id =>$data) {
148
+                if (!empty($list)) {
149
+                                    foreach ($list as $exe_id =>$data) {
148 150
                         if ($update_database) {
149 151
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
152
+                }
150 153
                             $res = Database::query($sql);
151 154
                             $result_message[$TABLETRACK_EXERCICES]++;
152 155
                         } else {
@@ -170,10 +173,11 @@  discard block
 block discarded – undo
170 173
                         $list[$row['exe_id']]= $row;
171 174
                     }
172 175
 
173
-                    if (!empty($list))
174
-                        foreach ($list as $exe_id =>$data) {
176
+                    if (!empty($list)) {
177
+                                            foreach ($list as $exe_id =>$data) {
175 178
                             if ($update_database) {
176 179
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
180
+                    }
177 181
                                 $res = Database::query($sql);
178 182
                                 $result_message[$TABLETRACK_EXERCICES]++;
179 183
                             } else {
@@ -198,10 +202,11 @@  discard block
 block discarded – undo
198 202
                     $list[$row['course_access_id']] = $row;
199 203
                 }
200 204
 
201
-                if (!empty($list))
202
-                    foreach ($list as $id => $data) {
205
+                if (!empty($list)) {
206
+                                    foreach ($list as $id => $data) {
203 207
                         if ($update_database) {
204 208
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
209
+                }
205 210
                             if ($debug) {
206 211
                                 echo $sql;
207 212
                             }
@@ -220,13 +225,18 @@  discard block
 block discarded – undo
220 225
                 while($row = Database::fetch_array($res,'ASSOC')) {
221 226
                     $list[] = $row['access_id'];
222 227
                 }
223
-                if (!empty($list))
224
-                    foreach ($list as $id) {
228
+                if (!empty($list)) {
229
+                                    foreach ($list as $id) {
225 230
                         if ($update_database) {
226 231
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
227
-                            if ($debug) echo $sql;
232
+                }
233
+                            if ($debug) {
234
+                                echo $sql;
235
+                            }
228 236
                             $res = Database::query($sql);
229
-                            if ($debug) var_dump($res);
237
+                            if ($debug) {
238
+                                var_dump($res);
239
+                            }
230 240
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
231 241
                         }
232 242
                     }
@@ -250,13 +260,18 @@  discard block
 block discarded – undo
250 260
                     }
251 261
                 }
252 262
 
253
-                if (!empty($list))
254
-                    foreach ($list as $id=>$data) {
263
+                if (!empty($list)) {
264
+                                    foreach ($list as $id=>$data) {
255 265
                         if ($update_database) {
256 266
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
257
-                            if ($debug) var_dump($sql);
267
+                }
268
+                            if ($debug) {
269
+                                var_dump($sql);
270
+                            }
258 271
                             $res = Database::query($sql);
259
-                            if ($debug) var_dump($res);
272
+                            if ($debug) {
273
+                                var_dump($res);
274
+                            }
260 275
                             $result_message[$TBL_LP_VIEW]++;
261 276
                         } else {
262 277
                             //Getting all information of that lp_item_id
@@ -283,10 +298,11 @@  discard block
 block discarded – undo
283 298
                             $list[$row['id']] = $row;
284 299
                         }
285 300
                     }
286
-                    if (!empty($list))
287
-                        foreach ($list as $id=>$data) {
301
+                    if (!empty($list)) {
302
+                                            foreach ($list as $id=>$data) {
288 303
                             //Getting all information of that lp_item_id
289 304
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
305
+                    }
290 306
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
291 307
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
292 308
                         }
@@ -302,9 +318,13 @@  discard block
 block discarded – undo
302 318
                     $id = $row['ref'];
303 319
                     if ($update_database) {
304 320
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
305
-                        if ($debug) var_dump($sql);
321
+                        if ($debug) {
322
+                            var_dump($sql);
323
+                        }
306 324
                         $res_update = Database::query($sql);
307
-                        if ($debug) var_dump($res_update);
325
+                        if ($debug) {
326
+                            var_dump($res_update);
327
+                        }
308 328
                         $result_message['agenda']++;
309 329
                     }
310 330
                 }
@@ -316,22 +336,30 @@  discard block
 block discarded – undo
316 336
                 //echo '<h1>Student publication</h1>';
317 337
 
318 338
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
319
-                if ($debug) echo $sql;
339
+                if ($debug) {
340
+                    echo $sql;
341
+                }
320 342
                 $res = Database::query($sql);
321 343
                 while($row = Database::fetch_array($res,'ASSOC')) {
322 344
                     $id = $row['ref'];
323 345
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
324
-                    if ($debug) var_dump($sql);
346
+                    if ($debug) {
347
+                        var_dump($sql);
348
+                    }
325 349
                     $sub_res = Database::query($sql);
326 350
                     if (Database::num_rows($sub_res) > 0 ) {
327 351
                         $data = Database::fetch_array($sub_res,'ASSOC');
328
-                        if ($debug) var_dump($data);
352
+                        if ($debug) {
353
+                            var_dump($data);
354
+                        }
329 355
                         $parent_id = $data['parent_id'];
330 356
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
331 357
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
332 358
                             $select_res     = Database::query($sql);
333 359
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
334
-                            if ($debug)     var_dump($parent_data);
360
+                            if ($debug) {
361
+                                var_dump($parent_data);
362
+                            }
335 363
 
336 364
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
337 365
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -346,7 +374,9 @@  discard block
 block discarded – undo
346 374
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
347 375
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
348 376
                             		ORDER BY id desc  LIMIT 1";
349
-                            if ($debug) echo $sql;
377
+                            if ($debug) {
378
+                                echo $sql;
379
+                            }
350 380
                             $sub_res = Database::query($sql);
351 381
                             $num_rows = Database::num_rows($sub_res);
352 382
 
@@ -390,7 +420,9 @@  discard block
 block discarded – undo
390 420
 
391 421
                             //Creating student_publication_assignment if exists
392 422
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
393
-                            if ($debug) var_dump($sql);
423
+                            if ($debug) {
424
+                                var_dump($sql);
425
+                            }
394 426
                             $rest_select     = Database::query($sql);
395 427
                             if (Database::num_rows($rest_select) > 0 ) {
396 428
                                 if ($update_database) {
@@ -402,7 +434,9 @@  discard block
 block discarded – undo
402 434
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
403 435
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
404 436
                                        publication_id       = '".$new_parent_id."'";
405
-                                    if ($debug) echo $sql_add_publication;
437
+                                    if ($debug) {
438
+                                        echo $sql_add_publication;
439
+                                    }
406 440
                                     $rest_select     = Database::query($sql_add_publication);
407 441
                                     $id = Database::insert_id();
408 442
 
@@ -410,11 +444,15 @@  discard block
 block discarded – undo
410 444
                                         "has_properties         = '".$id."',
411 445
                                        view_properties    = '1'
412 446
                                        WHERE id   = ".$new_parent_id;
413
-                                    if ($debug) echo $sql_update;
447
+                                    if ($debug) {
448
+                                        echo $sql_update;
449
+                                    }
414 450
                                     $rest_update     = Database::query($sql_update);
415 451
 
416 452
 
417
-                                    if ($debug) var_dump($sql_update);
453
+                                    if ($debug) {
454
+                                        var_dump($sql_update);
455
+                                    }
418 456
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
419 457
                                 }
420 458
                             }
@@ -455,7 +493,9 @@  discard block
 block discarded – undo
455 493
                                     if ($result) {
456 494
                                         unlink($full_file_name);
457 495
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
458
-                                        if ($debug) var_dump($sql);
496
+                                        if ($debug) {
497
+                                            var_dump($sql);
498
+                                        }
459 499
                                         $result_delete     = Database::query($sql);
460 500
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
461 501
                                     }
@@ -471,22 +511,30 @@  discard block
 block discarded – undo
471 511
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
472 512
 
473 513
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
474
-                if ($debug) var_dump($sql);
514
+                if ($debug) {
515
+                    var_dump($sql);
516
+                }
475 517
                 $res = Database::query($sql);
476 518
                 while($row = Database::fetch_array($res,'ASSOC')) {
477 519
                     $id = $row['id'];
478 520
                     if ($update_database) {
479 521
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
480
-                        if ($debug) var_dump($sql);
522
+                        if ($debug) {
523
+                            var_dump($sql);
524
+                        }
481 525
                         $res = Database::query($sql);
482
-                        if ($debug) var_dump($res);
526
+                        if ($debug) {
527
+                            var_dump($res);
528
+                        }
483 529
 
484 530
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
485
-                        if ($debug)
486
-                            var_dump($sql);
531
+                        if ($debug) {
532
+                                                    var_dump($sql);
533
+                        }
487 534
                         $res = Database::query($sql);
488
-                        if ($debug)
489
-                            var_dump($res);
535
+                        if ($debug) {
536
+                                                    var_dump($res);
537
+                        }
490 538
                         $result_message[$TBL_DROPBOX_FILE]++;
491 539
                     }
492 540
                 }
@@ -495,23 +543,30 @@  discard block
 block discarded – undo
495 543
 
496 544
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
497 545
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
498
-                if ($debug) var_dump($sql);
546
+                if ($debug) {
547
+                    var_dump($sql);
548
+                }
499 549
                 $res = Database::query($sql);
500 550
                 while($row = Database::fetch_array($res,'ASSOC')) {
501 551
                     $id = $row['notebook_id'];
502 552
                     if ($update_database) {
503 553
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
504
-                        if ($debug) var_dump($sql);
554
+                        if ($debug) {
555
+                            var_dump($sql);
556
+                        }
505 557
                         $res = Database::query($sql);
506
-                        if ($debug) var_dump($res);
558
+                        if ($debug) {
559
+                            var_dump($res);
560
+                        }
507 561
                     }
508 562
                 }
509 563
 
510 564
                 if ($update_database) {
511 565
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
512
-                    if (is_array($result_message))
513
-                        foreach ($result_message as $table=>$times) {
566
+                    if (is_array($result_message)) {
567
+                                            foreach ($result_message as $table=>$times) {
514 568
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
569
+                    }
515 570
                         }
516 571
                 } else {
517 572
                     echo '<h2>'.get_lang('UserInformationOfThisCourse').'</h2>';
@@ -626,10 +681,11 @@  discard block
 block discarded – undo
626 681
 }
627 682
 $navigation .= '&nbsp;';
628 683
 $page ++;
629
-if ($page < $nro_pages)
684
+if ($page < $nro_pages) {
630 685
     $navigation .= '<a href="'.api_get_self().'?page='.$page.'">'.get_lang('Next').'</a>';
631
-else
686
+} else {
632 687
     $navigation .= get_lang('Next');
688
+}
633 689
 
634 690
 echo $navigation;
635 691
 $user_list      = UserManager::get_user_list(array(), array(), $begin, $default);
Please login to merge, or discard this patch.