Completed
Push — 1.11.x ( 7ffd51...902ebd )
by José
50:21 queued 21:28
created
main/admin/ldap_import_students_to_session.php 2 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -53,93 +53,93 @@  discard block
 block discarded – undo
53 53
 //if ($annee == "" && $composante == "" && $etape == "") {
54 54
 if (empty($annee) && empty($id_session))
55 55
 {
56
-		Display::display_header($tool_name);
57
-		echo '<div style="align:center">';
58
-		echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU');
59
-		echo '<form method="get" action="'.api_get_self().'"><br />';
60
-		echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
61
-		echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> ';
62
-		echo '<input type="submit" value="'.get_lang('Submit').'">';
63
-		echo '</form>';
64
-		echo '</div>';
56
+        Display::display_header($tool_name);
57
+        echo '<div style="align:center">';
58
+        echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU');
59
+        echo '<form method="get" action="'.api_get_self().'"><br />';
60
+        echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
61
+        echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"> ';
62
+        echo '<input type="submit" value="'.get_lang('Submit').'">';
63
+        echo '</form>';
64
+        echo '</div>';
65 65
 
66 66
 }
67 67
 elseif (!empty($annee) && empty($id_session))
68 68
 {
69
-	Display::display_header($tool_name);
70
-	echo '<div style="align:center">';
71
-	echo Display::return_icon(
72
-			'course.png',
73
-			get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />';
74
-	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
75
-	echo '<select name="id_session">';
76
-
77
-	$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
78
-	$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date ".
79
-		" FROM $tbl_session ".
80
-		" ORDER BY name";
81
-	$result = Database::query($sql);
82
-
83
-	$sessions = Database::store_result($result);
84
-	$nbr_results = count($sessions);
85
-	foreach ($sessions as $row) {
86
-		echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
87
-	}
88
-	echo '</select>';
89
-	echo '<input type="submit" value="'.get_lang('Submit').'">';
90
-	echo '</form>';
91
-	echo '</div>';
69
+    Display::display_header($tool_name);
70
+    echo '<div style="align:center">';
71
+    echo Display::return_icon(
72
+            'course.png',
73
+            get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />';
74
+    echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
75
+    echo '<select name="id_session">';
76
+
77
+    $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
78
+    $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date ".
79
+        " FROM $tbl_session ".
80
+        " ORDER BY name";
81
+    $result = Database::query($sql);
82
+
83
+    $sessions = Database::store_result($result);
84
+    $nbr_results = count($sessions);
85
+    foreach ($sessions as $row) {
86
+        echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
87
+    }
88
+    echo '</select>';
89
+    echo '<input type="submit" value="'.get_lang('Submit').'">';
90
+    echo '</form>';
91
+    echo '</div>';
92 92
 }
93 93
 // form4  annee != 0; composante != 0 etape != 0
94 94
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
95 95
 elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
96 96
 {
97
-	Display::display_header($tool_name);
98
-	echo '<div style="align: center;">';
99
-	echo '<br />';
100
-	echo '<br />';
101
-	echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
102
-	//echo "Connection ...";
103
-	$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
104
-	ldap_set_version($ds);
105
-
106
-	if ($ds) {
107
-
108
-		$r = false;
109
-		$res = ldap_handle_bind($ds, $r);
110
-
111
-		//$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
112
-		//echo "(ou=*$annee,ou=$composante)";
113
-		$sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
114
-
115
-		$info = ldap_get_entries($ds, $sr);
116
-
117
-		for ($key = 0; $key < $info["count"]; $key++) {
118
-			$nom_form[] = $info[$key]["sn"][0];
119
-			$prenom_form[] = $info[$key]["givenname"][0];
120
-			$email_form[] = $info[$key]["mail"][0];
121
-			// Get uid from dn
122
-			//$dn_array=ldap_explode_dn($info[$key]["dn"],1);
123
-			//$username_form[] = $dn_array[0]; // uid is first key
124
-			$username_form[] = $info[$key]['uid'][0];
125
-			$outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
126
-			//$val = ldap_get_values_len($ds, $entry, "userPassword");
127
-			//$password_form[] = $val[0];
128
-			$password_form[] = $info[$key]['userPassword'][0];
129
-		}
130
-		ldap_unbind($ds);
131
-
132
-		/*-----------------------------------------------*/
133
-
134
-		asort($nom_form);
135
-		reset($nom_form);
136
-
137
-		$statut = 5;
138
-		include ('ldap_form_add_users_group.php');
139
-	} else {
140
-		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
141
-	}
142
-	echo '<br /><br />';
97
+    Display::display_header($tool_name);
98
+    echo '<div style="align: center;">';
99
+    echo '<br />';
100
+    echo '<br />';
101
+    echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
102
+    //echo "Connection ...";
103
+    $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
104
+    ldap_set_version($ds);
105
+
106
+    if ($ds) {
107
+
108
+        $r = false;
109
+        $res = ldap_handle_bind($ds, $r);
110
+
111
+        //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
112
+        //echo "(ou=*$annee,ou=$composante)";
113
+        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
114
+
115
+        $info = ldap_get_entries($ds, $sr);
116
+
117
+        for ($key = 0; $key < $info["count"]; $key++) {
118
+            $nom_form[] = $info[$key]["sn"][0];
119
+            $prenom_form[] = $info[$key]["givenname"][0];
120
+            $email_form[] = $info[$key]["mail"][0];
121
+            // Get uid from dn
122
+            //$dn_array=ldap_explode_dn($info[$key]["dn"],1);
123
+            //$username_form[] = $dn_array[0]; // uid is first key
124
+            $username_form[] = $info[$key]['uid'][0];
125
+            $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
126
+            //$val = ldap_get_values_len($ds, $entry, "userPassword");
127
+            //$password_form[] = $val[0];
128
+            $password_form[] = $info[$key]['userPassword'][0];
129
+        }
130
+        ldap_unbind($ds);
131
+
132
+        /*-----------------------------------------------*/
133
+
134
+        asort($nom_form);
135
+        reset($nom_form);
136
+
137
+        $statut = 5;
138
+        include ('ldap_form_add_users_group.php');
139
+    } else {
140
+        echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
141
+    }
142
+    echo '<br /><br />';
143 143
     echo '<a href="ldap_import_students.php?annee=">'.get_lang('BackToNewSearch').'</a>';
144 144
     echo '<br /><br />';
145 145
     echo '</div>';
@@ -147,23 +147,23 @@  discard block
 block discarded – undo
147 147
 }
148 148
 elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes'))
149 149
 {
150
-	$id = $_POST['username_form'];
151
-	$UserList = array();
152
-	$userid_match_login = array();
153
-	foreach ($id as $form_index=>$user_id)
154
-	{
155
-		if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
156
-		{
157
-			$tmp = ldap_add_user($user_id);
158
-			$UserList[] = $tmp;
159
-			$userid_match_login[$tmp] = $user_id;
160
-		}
161
-	}
162
-	if (!empty($_POST['id_session'])) {
163
-		$num = 0;
164
-		$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
165
-		$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
166
-		foreach ($UserList as $user_id) {
150
+    $id = $_POST['username_form'];
151
+    $UserList = array();
152
+    $userid_match_login = array();
153
+    foreach ($id as $form_index=>$user_id)
154
+    {
155
+        if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
156
+        {
157
+            $tmp = ldap_add_user($user_id);
158
+            $UserList[] = $tmp;
159
+            $userid_match_login[$tmp] = $user_id;
160
+        }
161
+    }
162
+    if (!empty($_POST['id_session'])) {
163
+        $num = 0;
164
+        $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
165
+        $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
166
+        foreach ($UserList as $user_id) {
167 167
                     $res_user = Database::insert(
168 168
                         $tbl_session_user,
169 169
                         [
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
                     if ($res_user !== false) {
176 176
                         $num++;
177 177
                     }
178
-		}
179
-
180
-		if ($num > 0) {
181
-			$sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
182
-			$res = Database::query($sql);
183
-		}
184
-		header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session']));
185
-	}
186
-	/*
178
+        }
179
+
180
+        if ($num > 0) {
181
+            $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
182
+            $res = Database::query($sql);
183
+        }
184
+        header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session']));
185
+    }
186
+    /*
187 187
 	else
188 188
 	{
189 189
 		Display :: display_header($tool_name);
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 		Display::addFlash(Display::return_message($message, 'normal', false));
203 203
 	}
204 204
 	*/
205
-	else
206
-	{
207
-		$message = get_lang('NoUserAdded');
208
-		Display::addFlash(Display::return_message($message, 'normal', false));
205
+    else
206
+    {
207
+        $message = get_lang('NoUserAdded');
208
+        Display::addFlash(Display::return_message($message, 'normal', false));
209 209
         Display::display_header($tool_name);
210
-	}
211
-	echo '<br /><br />';
210
+    }
211
+    echo '<br /><br />';
212 212
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
213 213
     echo '<br /><br />';
214 214
 }
Please login to merge, or discard this patch.
Braces   +7 added lines, -16 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 // form1 annee = 0; composante= 0 etape = 0
53 53
 //if ($annee == "" && $composante == "" && $etape == "") {
54
-if (empty($annee) && empty($id_session))
55
-{
54
+if (empty($annee) && empty($id_session)) {
56 55
 		Display::display_header($tool_name);
57 56
 		echo '<div style="align:center">';
58 57
 		echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU');
@@ -63,9 +62,7 @@  discard block
 block discarded – undo
63 62
 		echo '</form>';
64 63
 		echo '</div>';
65 64
 
66
-}
67
-elseif (!empty($annee) && empty($id_session))
68
-{
65
+} elseif (!empty($annee) && empty($id_session)) {
69 66
 	Display::display_header($tool_name);
70 67
 	echo '<div style="align:center">';
71 68
 	echo Display::return_icon(
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
 }
93 90
 // form4  annee != 0; composante != 0 etape != 0
94 91
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
95
-elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
96
-{
92
+elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
97 93
 	Display::display_header($tool_name);
98 94
 	echo '<div style="align: center;">';
99 95
 	echo '<br />';
@@ -144,16 +140,12 @@  discard block
 block discarded – undo
144 140
     echo '<br /><br />';
145 141
     echo '</div>';
146 142
 
147
-}
148
-elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes'))
149
-{
143
+} elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) {
150 144
 	$id = $_POST['username_form'];
151 145
 	$UserList = array();
152 146
 	$userid_match_login = array();
153
-	foreach ($id as $form_index=>$user_id)
154
-	{
155
-		if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
156
-		{
147
+	foreach ($id as $form_index=>$user_id) {
148
+		if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) {
157 149
 			$tmp = ldap_add_user($user_id);
158 150
 			$UserList[] = $tmp;
159 151
 			$userid_match_login[$tmp] = $user_id;
@@ -202,8 +194,7 @@  discard block
 block discarded – undo
202 194
 		Display::addFlash(Display::return_message($message, 'normal', false));
203 195
 	}
204 196
 	*/
205
-	else
206
-	{
197
+	else {
207 198
 		$message = get_lang('NoUserAdded');
208 199
 		Display::addFlash(Display::return_message($message, 'normal', false));
209 200
         Display::display_header($tool_name);
Please login to merge, or discard this patch.
main/admin/ldap_users_synchro.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@
 block discarded – undo
60 60
 
61 61
 <?php
62 62
 if (isset($action) && ($action == "synchro")) {
63
-	$included = true;
64
-	require('ldap_synchro.php');
65
-	echo Display::return_message($message, 'normal', false);
63
+    $included = true;
64
+    require('ldap_synchro.php');
65
+    echo Display::return_message($message, 'normal', false);
66 66
 }
67 67
 Display::display_footer();
68 68
 ?>
Please login to merge, or discard this patch.
main/gradebook/lib/be/learnpathlink.class.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 
98 98
     /**
99 99
      * Get the progress of this learnpath. Only the last attempt are taken into account.
100
-     * @param $stud_id student id (default: all students who have results - then the average is returned)
100
+     * @param integer $stud_id student id (default: all students who have results - then the average is returned)
101 101
      * @param $type The type of score we want to get: best|average|ranking
102 102
      * @return    array (score, max) if student is given
103 103
      *            array (sum of scores, number of scores) otherwise
Please login to merge, or discard this patch.
plugin/vchamilo/cli/clilib.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@
 block discarded – undo
294 294
 /**
295 295
  * Print or return section separator string
296 296
  * @param bool $return false means print, true return as string
297
- * @return mixed void or string
297
+ * @return string|null void or string
298 298
  */
299 299
 function cli_separator($return = false) {
300 300
     $separator = str_repeat('-', 79)."\n";
Please login to merge, or discard this patch.
Braces   +28 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,7 +7,8 @@  discard block
 block discarded – undo
7 7
  * @param string $plugin
8 8
  * @return mixed
9 9
  */
10
-function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null) {
10
+function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null)
11
+{
11 12
     global $_configuration;
12 13
 
13 14
     $vnodes = array();
@@ -102,7 +103,8 @@  discard block
 block discarded – undo
102 103
 
103 104
     // Check for required fields.
104 105
     foreach ($required as $key => $value) {
105
-        if ($value) { // Required field missing.
106
+        if ($value) {
107
+// Required field missing.
106 108
             cli_error("fieldrequired $key");
107 109
             return;
108 110
         }
@@ -136,7 +138,9 @@  discard block
 block discarded – undo
136 138
             $key = $headers[$f];
137 139
             if (preg_match('/\|/', $key)) {
138 140
                 list($plugin, $variable) = explode('|', str_replace('plugin_', '', $key));
139
-                if (empty($variable)) die("Key error in CSV : $key ");
141
+                if (empty($variable)) {
142
+                    die("Key error in CSV : $key ");
143
+                }
140 144
                 if (!isset($vnode->$plugin)) {
141 145
                     $vnode->$plugin = new StdClass();
142 146
                 }
@@ -169,15 +173,21 @@  discard block
 block discarded – undo
169 173
  * @param bool $resetfirst
170 174
  * @return bool
171 175
  */
172
-function vchamilo_is_empty_line_or_format(&$text, $resetfirst = false) {
176
+function vchamilo_is_empty_line_or_format(&$text, $resetfirst = false)
177
+{
173 178
     global $CFG;
174 179
 
175 180
     static $textlib;
176 181
     static $first = true;
177 182
 
178 183
     // We may have a risk the BOM is present on first line
179
-    if ($resetfirst) $first = true;
180
-    if (!isset($textlib)) $textlib = new textlib(); // Singleton
184
+    if ($resetfirst) {
185
+        $first = true;
186
+    }
187
+    if (!isset($textlib)) {
188
+        $textlib = new textlib();
189
+    }
190
+    // Singleton
181 191
     $text = $textlib->trim_utf8_bom($text);
182 192
     $first = false;
183 193
 
@@ -200,7 +210,8 @@  discard block
 block discarded – undo
200 210
  * @param bool $casesensitiveoptions true if options are case sensitive
201 211
  * @return string entered text
202 212
  */
203
-function cli_input($prompt, $default = '', array $options = null, $casesensitiveoptions = false) {
213
+function cli_input($prompt, $default = '', array $options = null, $casesensitiveoptions = false)
214
+{
204 215
     echo $prompt;
205 216
     echo "\n: ";
206 217
     $input = fread(STDIN, 2048);
@@ -226,7 +237,8 @@  discard block
 block discarded – undo
226 237
  * @param array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
227 238
  * @return array array of arrays, options, unrecognised as optionlongname=>value
228 239
  */
229
-function cli_get_params(array $longoptions, array $shortmapping = null) {
240
+function cli_get_params(array $longoptions, array $shortmapping = null)
241
+{
230 242
     $shortmapping = (array) $shortmapping;
231 243
     $options      = array();
232 244
     $unrecognized = array();
@@ -296,7 +308,8 @@  discard block
 block discarded – undo
296 308
  * @param bool $return false means print, true return as string
297 309
  * @return mixed void or string
298 310
  */
299
-function cli_separator($return = false) {
311
+function cli_separator($return = false)
312
+{
300 313
     $separator = str_repeat('-', 79)."\n";
301 314
     if ($return) {
302 315
         return $separator;
@@ -311,7 +324,8 @@  discard block
 block discarded – undo
311 324
  * @param bool $return false means print, true return as string
312 325
  * @return mixed void or string
313 326
  */
314
-function cli_heading($string, $return = false) {
327
+function cli_heading($string, $return = false)
328
+{
315 329
     $string = "== $string ==\n";
316 330
     if ($return) {
317 331
         return $string;
@@ -325,7 +339,8 @@  discard block
 block discarded – undo
325 339
  * @param $text
326 340
  * @return void
327 341
  */
328
-function cli_problem($text) {
342
+function cli_problem($text)
343
+{
329 344
     fwrite(STDERR, $text."\n");
330 345
 }
331 346
 
@@ -336,7 +351,8 @@  discard block
 block discarded – undo
336 351
  * @param int $errorCode
337 352
  * @return void (does not return)
338 353
  */
339
-function cli_error($text, $errorCode = 1) {
354
+function cli_error($text, $errorCode = 1)
355
+{
340 356
     fwrite(STDERR, $text);
341 357
     fwrite(STDERR, "\n");
342 358
     die($errorCode);
Please login to merge, or discard this patch.
src/Chamilo/CoreBundle/Entity/Session.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     }
255 255
 
256 256
     /**
257
-     * @return string
257
+     * @return boolean
258 258
      */
259 259
     public function getShowDescription()
260 260
     {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     }
374 374
 
375 375
     /**
376
-     * @param $courses
376
+     * @param ArrayCollection $courses
377 377
      */
378 378
     public function setCourses($courses)
379 379
     {
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
      * Set description
516 516
      *
517 517
      * @param string $description
518
-     * @return Groups
518
+     * @return Session
519 519
      */
520 520
     public function setDescription($description)
521 521
     {
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
     }
849 849
 
850 850
     /**
851
-     * @return array
851
+     * @return string[]
852 852
      */
853 853
     public static function getStatusList()
854 854
     {
Please login to merge, or discard this patch.
main/inc/lib/extra_field.lib.php 2 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
             <a href="?action=edit&type={$this->type}&id=' + options.rowId + '" class="btn btn-link btn-xs">\
2231 2231
                 $editIcon\
2232 2232
             </a>
2233
-JAVASCRIPT;
2233
+javascript;
2234 2234
         $deleteButton = <<<JAVASCRIPT
2235 2235
             <a \
2236 2236
                 onclick="if (!confirm(\'$confirmMessage\')) {return false;}" \
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
                 class="btn btn-link btn-xs">\
2239 2239
                 $deleteIcon\
2240 2240
             </a>
2241
-JAVASCRIPT;
2241
+javascript;
2242 2242
 
2243 2243
         return "function action_formatter(cellvalue, options, rowObject) {        
2244 2244
             return '$editButton $deleteButton';
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     }
154 154
 
155 155
     /**
156
-     * @return array
156
+     * @return string[]
157 157
      */
158 158
     public static function getValidExtraFieldTypes()
159 159
     {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
     /**
240 240
      * @param array $conditions
241
-     * @param null $order_field_options_by
241
+     * @param string $order_field_options_by
242 242
      *
243 243
      * @return array
244 244
      */
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     /**
401 401
      * @param string $handler
402 402
      *
403
-     * @return array
403
+     * @return string[]
404 404
      */
405 405
     public static function get_extra_fields_by_handler($handler)
406 406
     {
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     }
628 628
 
629 629
     /**
630
-     * @return array
630
+     * @return string[]
631 631
      */
632 632
     public function get_field_types()
633 633
     {
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
     /**
638 638
      * @param int $id
639 639
      *
640
-     * @return null
640
+     * @return string|null
641 641
      */
642 642
     public function get_field_type_by_id($id)
643 643
     {
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
     }
2045 2045
 
2046 2046
     /**
2047
-     * @return array
2047
+     * @return string[]
2048 2048
      */
2049 2049
     public function getJqgridColumnNames()
2050 2050
     {
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 4 patches
Upper-Lower-Casing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
         if (!empty($userId)) {
377 377
             $return = $userId;
378
-            $sql = "UPDATE $table_user SET user_id = $return WHERE id = $return";
378
+            $sql = "update $table_user SET user_id = $return WHERE id = $return";
379 379
             Database::query($sql);
380 380
 
381 381
             if ($isAdmin) {
@@ -638,11 +638,11 @@  discard block
 block discarded – undo
638 638
 
639 639
         // If the user was added as a id_coach then set the current admin as coach see BT#
640 640
         $currentUserId = api_get_user_id();
641
-        $sql = "UPDATE $table_session SET id_coach = $currentUserId
641
+        $sql = "update $table_session SET id_coach = $currentUserId
642 642
                 WHERE id_coach = '".$user_id."'";
643 643
         Database::query($sql);
644 644
 
645
-        $sql = "UPDATE $table_session SET id_coach = $currentUserId
645
+        $sql = "update $table_session SET id_coach = $currentUserId
646 646
                 WHERE session_admin_id = '".$user_id."'";
647 647
         Database::query($sql);
648 648
 
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
         $ids = array_map('intval', $ids);
832 832
         $ids = implode(',', $ids);
833 833
 
834
-        $sql = "UPDATE $table_user SET active = 0 WHERE id IN ($ids)";
834
+        $sql = "update $table_user SET active = 0 WHERE id IN ($ids)";
835 835
         $r = Database::query($sql);
836 836
         if ($r !== false) {
837 837
             Event::addEvent(LOG_USER_DISABLE, LOG_USER_ID, $ids);
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
         $ids = array_map('intval', $ids);
862 862
         $ids = implode(',', $ids);
863 863
 
864
-        $sql = "UPDATE $table_user SET active = 1 WHERE id IN ($ids)";
864
+        $sql = "update $table_user SET active = 1 WHERE id IN ($ids)";
865 865
         $r = Database::query($sql);
866 866
         if ($r !== false) {
867 867
             Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids);
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
         if ($user_id === false) {
887 887
             return false;
888 888
         }
889
-        $sql = "UPDATE $table_user SET
889
+        $sql = "update $table_user SET
890 890
                 openid='".Database::escape_string($openid)."'";
891 891
         $sql .= " WHERE id= $user_id";
892 892
 
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
         }
1124 1124
         $user_id = intval($user_id);
1125 1125
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
1126
-        $sql = "UPDATE $table_user SET active = '$active' WHERE id = $user_id";
1126
+        $sql = "update $table_user SET active = '$active' WHERE id = $user_id";
1127 1127
         $r = Database::query($sql);
1128 1128
         $ev = LOG_USER_DISABLE;
1129 1129
         if ($active == 1) {
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
         $sessionLimitRestriction = '';
2886 2886
         if (!empty($sessionLimit)) {
2887 2887
             $sessionLimit = (int) $sessionLimit;
2888
-            $sessionLimitRestriction = "LIMIT $sessionLimit";
2888
+            $sessionLimitRestriction = "limit $sessionLimit";
2889 2889
         }
2890 2890
 
2891 2891
         $sql = "SELECT DISTINCT s.id, name, access_start_date, access_end_date
@@ -3691,7 +3691,7 @@  discard block
 block discarded – undo
3691 3691
             $last_insert_id = Database::insert_id();
3692 3692
         } else {
3693 3693
             //the tag exists we update it
3694
-            $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3694
+            $sql = "update $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3695 3695
              Database::query($sql);
3696 3696
             $last_insert_id = $tag_id;
3697 3697
         }
@@ -3724,7 +3724,7 @@  discard block
 block discarded – undo
3724 3724
         if (is_array($tags) && count($tags) > 0) {
3725 3725
             foreach ($tags as $key => $tag) {
3726 3726
                 if ($tag['count'] > '0') {
3727
-                    $sql = "UPDATE $table_user_tag SET count = count - 1  WHERE id = $key ";
3727
+                    $sql = "update $table_user_tag SET count = count - 1  WHERE id = $key ";
3728 3728
                     Database::query($sql);
3729 3729
                 }
3730 3730
                 $sql = "DELETE FROM $table_user_tag_values
@@ -4288,7 +4288,7 @@  discard block
 block discarded – undo
4288 4288
         if (isset($from) && isset($numberItems)) {
4289 4289
             $from = intval($from);
4290 4290
             $numberItems = intval($numberItems);
4291
-            $limitCondition = "LIMIT $from, $numberItems";
4291
+            $limitCondition = "limit $from, $numberItems";
4292 4292
         }
4293 4293
 
4294 4294
         $column = Database::escape_string($column);
@@ -4872,7 +4872,7 @@  discard block
 block discarded – undo
4872 4872
         $to = Database::escape_string($to);
4873 4873
 
4874 4874
         if (!empty($to) && !empty($from)) {
4875
-            $sql = "UPDATE $table_user SET language = '$to'
4875
+            $sql = "update $table_user SET language = '$to'
4876 4876
                     WHERE language = '$from'";
4877 4877
             Database::query($sql);
4878 4878
         }
@@ -5230,7 +5230,7 @@  discard block
 block discarded – undo
5230 5230
             WHERE 
5231 5231
                 firstname LIKE '$firstname%' AND
5232 5232
                 lastname LIKE '$lastname%'
5233
-SQL;
5233
+sql;
5234 5234
 
5235 5235
         $result = Database::query($sql);
5236 5236
 
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
         $connection = Database::getManager()->getConnection();
731 731
         $tableExists = $connection->getSchemaManager()->tablesExist(['plugin_bbb_room']);
732 732
         if ($tableExists) {
733
-             // Delete user from database
733
+                // Delete user from database
734 734
             $sql = "DELETE FROM plugin_bbb_room WHERE participant_id = $user_id";
735 735
             Database::query($sql);
736 736
         }
@@ -1375,13 +1375,13 @@  discard block
 block discarded – undo
1375 1375
     }
1376 1376
 
1377 1377
     /**
1378
-    * Get the users by ID
1379
-    * @param array $ids student ids
1380
-    * @param string $active
1381
-    * @param string $order
1382
-    * @param string $limit
1383
-    * @return array $result student information
1384
-    */
1378
+     * Get the users by ID
1379
+     * @param array $ids student ids
1380
+     * @param string $active
1381
+     * @param string $order
1382
+     * @param string $limit
1383
+     * @return array $result student information
1384
+     */
1385 1385
     public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null)
1386 1386
     {
1387 1387
         if (empty($ids)) {
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
      *
2547 2547
      * @return array with extra data info of a user i.e array('field_variable'=>'value');
2548 2548
      */
2549
-     public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2549
+        public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2550 2550
     {
2551 2551
         $extraFieldValue = new ExtraFieldValue('user');
2552 2552
         $extraField = new ExtraField('user');
@@ -3706,12 +3706,12 @@  discard block
 block discarded – undo
3706 3706
         if ($tag_id == 0) {
3707 3707
             //the tag doesn't exist
3708 3708
             $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)";
3709
-             Database::query($sql);
3709
+                Database::query($sql);
3710 3710
             $last_insert_id = Database::insert_id();
3711 3711
         } else {
3712 3712
             //the tag exists we update it
3713 3713
             $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3714
-             Database::query($sql);
3714
+                Database::query($sql);
3715 3715
             $last_insert_id = $tag_id;
3716 3716
         }
3717 3717
 
@@ -3906,9 +3906,9 @@  discard block
 block discarded – undo
3906 3906
     }
3907 3907
 
3908 3908
     /**
3909
-      * Get extra filtrable user fields (only type select)
3910
-      * @return array
3911
-      */
3909
+     * Get extra filtrable user fields (only type select)
3910
+     * @return array
3911
+     */
3912 3912
     public static function get_extra_filtrable_fields()
3913 3913
     {
3914 3914
         $extraFieldList = self::get_extra_fields();
@@ -3933,9 +3933,9 @@  discard block
 block discarded – undo
3933 3933
     }
3934 3934
 
3935 3935
     /**
3936
-      * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3937
-      * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3938
-      */
3936
+     * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3937
+     * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3938
+     */
3939 3939
     public static function get_search_form_where_extra_fields()
3940 3940
     {
3941 3941
         $useExtraFields = false;
@@ -4256,23 +4256,23 @@  discard block
 block discarded – undo
4256 4256
     }
4257 4257
 
4258 4258
     /**
4259
-    * Get users followed by human resource manager
4260
-    * @param int $userId
4261
-    * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
4262
-    * @param bool $getOnlyUserId
4263
-    * @param bool $getSql
4264
-    * @param bool $getCount
4265
-    * @param int $from
4266
-    * @param int $numberItems
4267
-    * @param int $column
4268
-    * @param string $direction
4269
-    * @param int $active
4270
-    * @param string $lastConnectionDate
4271
-    * @param int $status the function is called by who? COURSEMANAGER, DRH?
4272
-    * @param string $keyword
4259
+     * Get users followed by human resource manager
4260
+     * @param int $userId
4261
+     * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
4262
+     * @param bool $getOnlyUserId
4263
+     * @param bool $getSql
4264
+     * @param bool $getCount
4265
+     * @param int $from
4266
+     * @param int $numberItems
4267
+     * @param int $column
4268
+     * @param string $direction
4269
+     * @param int $active
4270
+     * @param string $lastConnectionDate
4271
+     * @param int $status the function is called by who? COURSEMANAGER, DRH?
4272
+     * @param string $keyword
4273 4273
      *
4274
-    * @return array user list
4275
-    */
4274
+     * @return array user list
4275
+     */
4276 4276
     public static function getUsersFollowedByUser(
4277 4277
         $userId,
4278 4278
         $userStatus = null,
@@ -5309,7 +5309,7 @@  discard block
 block discarded – undo
5309 5309
      * @return array
5310 5310
      * @author Evie Embrechts
5311 5311
      * @author Yannick Warnier <[email protected]>
5312
-    */
5312
+     */
5313 5313
     public static function loginAsUser($userId, $checkIfUserCanLoginAs = true)
5314 5314
     {
5315 5315
         $userId = intval($userId);
Please login to merge, or discard this patch.
Doc Comments   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     /**
132 132
      * Validates the password
133 133
      *
134
-     * @param $encoded
135
-     * @param $raw
136
-     * @param $salt
134
+     * @param string $encoded
135
+     * @param string $raw
136
+     * @param string $salt
137 137
      * @return bool
138 138
      */
139 139
     public static function isPasswordValid($encoded, $raw, $salt)
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @param string $raw
149 149
      * @param User   $user
150 150
      *
151
-     * @return bool
151
+     * @return string
152 152
      */
153 153
     public static function encryptPassword($raw, User $user)
154 154
     {
@@ -1217,6 +1217,7 @@  discard block
 block discarded – undo
1217 1217
     /**
1218 1218
      * Disables a user
1219 1219
      * @param int User id
1220
+     * @param integer $user_id
1220 1221
      * @return bool
1221 1222
      * @uses UserManager::change_active_state() to actually disable the user
1222 1223
      * @assert (0) === false
@@ -1233,6 +1234,7 @@  discard block
 block discarded – undo
1233 1234
     /**
1234 1235
      * Enable a user
1235 1236
      * @param int User id
1237
+     * @param integer $user_id
1236 1238
      * @return bool
1237 1239
      * @uses UserManager::change_active_state() to actually disable the user
1238 1240
      * @assert (0) === false
@@ -1409,6 +1411,7 @@  discard block
 block discarded – undo
1409 1411
      * Checks whether the user id exists in the database
1410 1412
      *
1411 1413
      * @param int User id
1414
+     * @param integer $userId
1412 1415
      * @return bool True if user id was found, false otherwise
1413 1416
      */
1414 1417
     public static function is_user_id_valid($userId)
@@ -1625,7 +1628,7 @@  discard block
 block discarded – undo
1625 1628
      * @param   array $userInfo user information to avoid query the DB
1626 1629
      * returns the /main/img/unknown.jpg image set it at true
1627 1630
      *
1628
-     * @return    array     Array of 2 elements: 'dir' and 'file' which contain
1631
+     * @return    integer     Array of 2 elements: 'dir' and 'file' which contain
1629 1632
      * the dir and file as the name implies if image does not exist it will
1630 1633
      * return the unknow image if anonymous parameter is true if not it returns an empty array
1631 1634
      */
@@ -1909,7 +1912,7 @@  discard block
 block discarded – undo
1909 1912
      * @see     UserManager::delete_user_picture() as the prefered way for deletion.
1910 1913
      * @param   string $source_file The full system name of the image from which user photos will be created.
1911 1914
      * @param   string $cropParameters Optional string that contents "x,y,width,height" of a cropped image format
1912
-     * @return  mixed Returns the resulting common file name of created images which usually should be stored in database.
1915
+     * @return  false|string Returns the resulting common file name of created images which usually should be stored in database.
1913 1916
      * When deletion is requested returns empty string. In case of internal error or negative validation returns FALSE.
1914 1917
      */
1915 1918
     public static function update_user_picture(
@@ -2068,7 +2071,7 @@  discard block
 block discarded – undo
2068 2071
      * Deletes user photos.
2069 2072
      * Note: This method relies on configuration setting from main/inc/conf/profile.conf.php
2070 2073
      * @param int $user_id            The user internal identification number.
2071
-     * @return mixed            Returns empty string on success, FALSE on error.
2074
+     * @return false|string            Returns empty string on success, FALSE on error.
2072 2075
      */
2073 2076
     public static function delete_user_picture($user_id)
2074 2077
     {
@@ -2125,7 +2128,7 @@  discard block
 block discarded – undo
2125 2128
     /**
2126 2129
      * Returns an array with the user's productions.
2127 2130
      *
2128
-     * @param    $user_id    User id
2131
+     * @param    integer $user_id    User id
2129 2132
      * @return   array  An array containing the user's productions
2130 2133
      */
2131 2134
     public static function get_user_productions($user_id)
@@ -2389,7 +2392,7 @@  discard block
 block discarded – undo
2389 2392
      * @param    int       $fieldType  Field's type
2390 2393
      * @param    string    $displayText Field's language var name
2391 2394
      * @param    string    $default Field's default value
2392
-     * @return int
2395
+     * @return boolean
2393 2396
      */
2394 2397
     public static function create_extra_field(
2395 2398
         $variable,
@@ -2427,6 +2430,7 @@  discard block
 block discarded – undo
2427 2430
      * @param    boolean    Whether to prefix the fields indexes with "extra_" (might be used by formvalidator)
2428 2431
      * @param    boolean    Whether to return invisible fields as well
2429 2432
      * @param    boolean    Whether to split multiple-selection fields or not
2433
+     * @param boolean $field_filter
2430 2434
      * @return    array    Array of fields => value for the given user
2431 2435
      */
2432 2436
     public static function get_extra_user_data(
@@ -3296,7 +3300,7 @@  discard block
 block discarded – undo
3296 3300
      * @param    string  $user_id   User ID
3297 3301
      * @param   string  $course course directory
3298 3302
      * @param   string  $resourcetype resourcetype: images, all
3299
-     * @return    int        User ID (or false if not found)
3303
+     * @return    string        User ID (or false if not found)
3300 3304
      */
3301 3305
     public static function get_user_upload_files_by_course(
3302 3306
         $user_id,
@@ -3383,7 +3387,7 @@  discard block
 block discarded – undo
3383 3387
     /**
3384 3388
      * Adds a new API key to the users' account
3385 3389
      * @param   int     Optional user ID (defaults to the results of api_get_user_id())
3386
-     * @return  boolean True on success, false on failure
3390
+     * @return  false|string True on success, false on failure
3387 3391
      */
3388 3392
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
3389 3393
     {
@@ -3438,6 +3442,7 @@  discard block
 block discarded – undo
3438 3442
      * Regenerate an API key from the user's account
3439 3443
      * @param   int     user ID (defaults to the results of api_get_user_id())
3440 3444
      * @param   string  API key's internal ID
3445
+     * @param string $api_service
3441 3446
      * @return  int        num
3442 3447
      */
3443 3448
     public static function update_api_key($user_id, $api_service)
@@ -3468,6 +3473,7 @@  discard block
 block discarded – undo
3468 3473
     /**
3469 3474
      * @param   int     user ID (defaults to the results of api_get_user_id())
3470 3475
      * @param   string    API key's internal ID
3476
+     * @param string $api_service
3471 3477
      * @return  int    row ID, or return false if not found
3472 3478
      */
3473 3479
     public static function get_api_key_id($user_id, $api_service)
@@ -3687,7 +3693,7 @@  discard block
 block discarded – undo
3687 3693
      * @param int $field_id
3688 3694
      * @param bool $show_links show links or not
3689 3695
      *
3690
-     * @return array
3696
+     * @return string
3691 3697
      */
3692 3698
     public static function get_user_tags_to_string($user_id, $field_id, $show_links = true)
3693 3699
     {
@@ -3784,7 +3790,7 @@  discard block
 block discarded – undo
3784 3790
      * @param mixed $tag
3785 3791
      * @param int $user_id
3786 3792
      * @param int $field_id field id of the tag
3787
-     * @return bool
3793
+     * @return boolean|null
3788 3794
      */
3789 3795
     public static function add_tag($tag, $user_id, $field_id)
3790 3796
     {
@@ -5016,7 +5022,7 @@  discard block
 block discarded – undo
5016 5022
     }
5017 5023
 
5018 5024
     /**
5019
-     * @return array
5025
+     * @return string[]
5020 5026
      */
5021 5027
     public static function get_user_field_types()
5022 5028
     {
@@ -5110,7 +5116,7 @@  discard block
 block discarded – undo
5110 5116
      * @param int $studentId
5111 5117
      * @param array $bossList
5112 5118
      * @param bool $sendNotification
5113
-     * @return int Affected rows
5119
+     * @return false|null Affected rows
5114 5120
      */
5115 5121
     public static function subscribeUserToBossList(
5116 5122
         $studentId,
@@ -5342,7 +5348,7 @@  discard block
 block discarded – undo
5342 5348
 
5343 5349
     /**
5344 5350
      * Get the boss user ID from a followed user id
5345
-     * @param $userId
5351
+     * @param integer $userId
5346 5352
      * @return bool
5347 5353
      */
5348 5354
     public static function getStudentBossList($userId)
@@ -5394,7 +5400,7 @@  discard block
 block discarded – undo
5394 5400
      * Get either a Gravatar URL or complete image tag for a specified email address.
5395 5401
      *
5396 5402
      * @param string $email The email address
5397
-     * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
5403
+     * @param integer $s Size in pixels, defaults to 80px [ 1 - 2048 ]
5398 5404
      * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
5399 5405
      * @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
5400 5406
      * @param boole $img True to return a complete IMG tag False for just the URL
@@ -5538,7 +5544,7 @@  discard block
 block discarded – undo
5538 5544
      * This function defines globals.
5539 5545
      * @param  int $userId
5540 5546
      * @param bool $checkIfUserCanLoginAs
5541
-     * @return array
5547
+     * @return boolean
5542 5548
      * @author Evie Embrechts
5543 5549
      * @author Yannick Warnier <[email protected]>
5544 5550
     */
Please login to merge, or discard this patch.
Braces   +65 added lines, -41 removed lines patch added patch discarded remove patch
@@ -2440,8 +2440,9 @@  discard block
 block discarded – undo
2440 2440
         if (empty($user_id)) {
2441 2441
             $user_id = 0;
2442 2442
         } else {
2443
-            if ($user_id != strval(intval($user_id)))
2444
-                return array();
2443
+            if ($user_id != strval(intval($user_id))) {
2444
+                            return array();
2445
+            }
2445 2446
         }
2446 2447
         $extra_data = array();
2447 2448
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2533,8 +2534,9 @@  discard block
 block discarded – undo
2533 2534
         if (empty($user_id)) {
2534 2535
             $user_id = 0;
2535 2536
         } else {
2536
-            if ($user_id != strval(intval($user_id)))
2537
-                return array();
2537
+            if ($user_id != strval(intval($user_id))) {
2538
+                            return array();
2539
+            }
2538 2540
         }
2539 2541
         $extra_data = array();
2540 2542
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2651,7 +2653,7 @@  discard block
 block discarded – undo
2651 2653
      * @return array with extra data info of a user i.e array('field_variable'=>'value');
2652 2654
      */
2653 2655
      public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2654
-    {
2656
+     {
2655 2657
         $extraFieldValue = new ExtraFieldValue('user');
2656 2658
         $extraField = new ExtraField('user');
2657 2659
 
@@ -3354,13 +3356,15 @@  discard block
 block discarded – undo
3354 3356
      */
3355 3357
     public static function get_api_keys($user_id = null, $api_service = 'dokeos')
3356 3358
     {
3357
-        if ($user_id != strval(intval($user_id)))
3358
-            return false;
3359
+        if ($user_id != strval(intval($user_id))) {
3360
+                    return false;
3361
+        }
3359 3362
         if (empty($user_id)) {
3360 3363
             $user_id = api_get_user_id();
3361 3364
         }
3362
-        if ($user_id === false)
3363
-            return false;
3365
+        if ($user_id === false) {
3366
+                    return false;
3367
+        }
3364 3368
         $service_name = Database::escape_string($api_service);
3365 3369
         if (is_string($service_name) === false) {
3366 3370
             return false;
@@ -3368,11 +3372,14 @@  discard block
 block discarded – undo
3368 3372
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3369 3373
         $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';";
3370 3374
         $res = Database::query($sql);
3371
-        if ($res === false)
3372
-            return false; //error during query
3375
+        if ($res === false) {
3376
+                    return false;
3377
+        }
3378
+        //error during query
3373 3379
         $num = Database::num_rows($res);
3374
-        if ($num == 0)
3375
-            return false;
3380
+        if ($num == 0) {
3381
+                    return false;
3382
+        }
3376 3383
         $list = array();
3377 3384
         while ($row = Database::fetch_array($res)) {
3378 3385
             $list[$row['id']] = $row['api_key'];
@@ -3387,13 +3394,15 @@  discard block
 block discarded – undo
3387 3394
      */
3388 3395
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
3389 3396
     {
3390
-        if ($user_id != strval(intval($user_id)))
3391
-            return false;
3397
+        if ($user_id != strval(intval($user_id))) {
3398
+                    return false;
3399
+        }
3392 3400
         if (empty($user_id)) {
3393 3401
             $user_id = api_get_user_id();
3394 3402
         }
3395
-        if ($user_id === false)
3396
-            return false;
3403
+        if ($user_id === false) {
3404
+                    return false;
3405
+        }
3397 3406
         $service_name = Database::escape_string($api_service);
3398 3407
         if (is_string($service_name) === false) {
3399 3408
             return false;
@@ -3402,8 +3411,10 @@  discard block
 block discarded – undo
3402 3411
         $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key
3403 3412
         $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')";
3404 3413
         $res = Database::query($sql);
3405
-        if ($res === false)
3406
-            return false; //error during query
3414
+        if ($res === false) {
3415
+                    return false;
3416
+        }
3417
+        //error during query
3407 3418
         $num = Database::insert_id();
3408 3419
         return ($num == 0) ? false : $num;
3409 3420
     }
@@ -3415,22 +3426,29 @@  discard block
 block discarded – undo
3415 3426
      */
3416 3427
     public static function delete_api_key($key_id)
3417 3428
     {
3418
-        if ($key_id != strval(intval($key_id)))
3419
-            return false;
3420
-        if ($key_id === false)
3421
-            return false;
3429
+        if ($key_id != strval(intval($key_id))) {
3430
+                    return false;
3431
+        }
3432
+        if ($key_id === false) {
3433
+                    return false;
3434
+        }
3422 3435
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3423 3436
         $sql = "SELECT * FROM $t_api WHERE id = ".$key_id;
3424 3437
         $res = Database::query($sql);
3425
-        if ($res === false)
3426
-            return false; //error during query
3438
+        if ($res === false) {
3439
+                    return false;
3440
+        }
3441
+        //error during query
3427 3442
         $num = Database::num_rows($res);
3428
-        if ($num !== 1)
3429
-            return false;
3443
+        if ($num !== 1) {
3444
+                    return false;
3445
+        }
3430 3446
         $sql = "DELETE FROM $t_api WHERE id = ".$key_id;
3431 3447
         $res = Database::query($sql);
3432
-        if ($res === false)
3433
-            return false; //error during query
3448
+        if ($res === false) {
3449
+                    return false;
3450
+        }
3451
+        //error during query
3434 3452
         return true;
3435 3453
     }
3436 3454
 
@@ -3442,10 +3460,12 @@  discard block
 block discarded – undo
3442 3460
      */
3443 3461
     public static function update_api_key($user_id, $api_service)
3444 3462
     {
3445
-        if ($user_id != strval(intval($user_id)))
3446
-            return false;
3447
-        if ($user_id === false)
3448
-            return false;
3463
+        if ($user_id != strval(intval($user_id))) {
3464
+                    return false;
3465
+        }
3466
+        if ($user_id === false) {
3467
+                    return false;
3468
+        }
3449 3469
         $service_name = Database::escape_string($api_service);
3450 3470
         if (is_string($service_name) === false) {
3451 3471
             return false;
@@ -3472,12 +3492,15 @@  discard block
 block discarded – undo
3472 3492
      */
3473 3493
     public static function get_api_key_id($user_id, $api_service)
3474 3494
     {
3475
-        if ($user_id != strval(intval($user_id)))
3476
-            return false;
3477
-        if ($user_id === false)
3478
-            return false;
3479
-        if (empty($api_service))
3480
-            return false;
3495
+        if ($user_id != strval(intval($user_id))) {
3496
+                    return false;
3497
+        }
3498
+        if ($user_id === false) {
3499
+                    return false;
3500
+        }
3501
+        if (empty($api_service)) {
3502
+                    return false;
3503
+        }
3481 3504
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3482 3505
         $api_service = Database::escape_string($api_service);
3483 3506
         $sql = "SELECT id FROM $t_api 
@@ -5418,8 +5441,9 @@  discard block
 block discarded – undo
5418 5441
         $url .= "?s=$s&d=$d&r=$r";
5419 5442
         if ($img) {
5420 5443
             $url = '<img src="'.$url.'"';
5421
-            foreach ($atts as $key => $val)
5422
-                $url .= ' '.$key.'="'.$val.'"';
5444
+            foreach ($atts as $key => $val) {
5445
+                            $url .= ' '.$key.'="'.$val.'"';
5446
+            }
5423 5447
             $url .= ' />';
5424 5448
         }
5425 5449
         return $url;
Please login to merge, or discard this patch.
plugin/studentfollowup/Entity/CarePost.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
      */
52 52
     protected $externalCareId;
53 53
 
54
-     /**
55
-     * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", cascade={"persist"})
56
-     * @ORM\JoinColumn(name="insert_user_id", referencedColumnName="id", nullable=false)
57
-     */
54
+        /**
55
+         * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", cascade={"persist"})
56
+         * @ORM\JoinColumn(name="insert_user_id", referencedColumnName="id", nullable=false)
57
+         */
58 58
     private $insertUser;
59 59
 
60 60
     /**
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
      */
111 111
     private $parent;
112 112
 
113
-     /**
114
-     * @ORM\OneToMany(targetEntity="CarePost", mappedBy="parent")
115
-     * @ORM\OrderBy({"createdAt" = "DESC"})
116
-     */
113
+        /**
114
+         * @ORM\OneToMany(targetEntity="CarePost", mappedBy="parent")
115
+         * @ORM\OrderBy({"createdAt" = "DESC"})
116
+         */
117 117
     private $children;
118 118
 
119 119
     /**
Please login to merge, or discard this patch.
main/auth/gotocourse.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 require_once __DIR__.'/../inc/global.inc.php';
15 15
 require_once api_get_path(SYS_PATH).'main/auth/cas/authcas.php';
16 16
 $msg = null;
17
-if (isset($_GET['firstpage'])) {
17
+if (isset($_GET['firstpage'])) {
18 18
     $firstpage = $_GET['firstpage'];
19 19
 
20 20
     // if course is public, go to course without auth
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     );
42 42
     $form->addButtonNext(get_lang('LoginEnter'), 'submitAuth');
43 43
     // see same text in main_api.lib.php function api_not_allowed
44
-    if (api_is_cas_activated()) {
44
+    if (api_is_cas_activated()) {
45 45
         $msg .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false);
46 46
         $msg .= Display::div("<br/><a href='".get_cas_direct_URL(api_get_course_id())."'>".getCASLogoHTML()." ".sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution"))."</a><br/><br/>", array('align'=>'center'));
47 47
         $msg .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount'));
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     $msg .= '<div class="well_login">';
53 53
     $msg .= $form->returnForm();
54 54
     $msg .= '</div>';
55
-    if (api_is_cas_activated()) {
55
+    if (api_is_cas_activated()) {
56 56
         $msg .= "</div>";
57 57
     }
58 58
     $msg .= '<hr/><p style="text-align:center"><a href="'.api_get_path(WEB_PATH).'">'.get_lang('ReturnToCourseHomepage').'</a></p>';
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     $tpl->assign('content', '<h4>'.get_lang('LoginToGoToThisCourse').'</h4>'.$msg);
61 61
     $tpl->display_one_col_template();
62 62
 
63
-} else {
63
+} else {
64 64
     api_delete_firstpage_parameter();
65 65
     header('Location: '.api_get_path(WEB_PATH).'index.php');
66 66
     exit;
Please login to merge, or discard this patch.