Passed
Pull Request — 1.10.x (#1065)
by
unknown
100:42 queued 54:05
created
main/admin/access_url_edit_users_to_url.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * 	@package chamilo.admin
5
- * 	@author Julio Montoya <[email protected]>
6
- */
4
+         * 	@package chamilo.admin
5
+         * 	@author Julio Montoya <[email protected]>
6
+         */
7 7
 // resetting the course id
8 8
 $cidReset = true;
9 9
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     ?>
262 262
     <option value="<?php echo $enreg['user_id']; ?>"><?php echo $enreg['username'].' - '.api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></option>
263 263
     <?php
264
-     }
264
+        }
265 265
     unset($nosessionUsersList);
266 266
     ?>
267 267
     </select>
Please login to merge, or discard this patch.
main/admin/add_sessions_to_promotion.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
       <option value = "%">--</option>
198 198
       <?php
199 199
         echo Display :: get_alphabet_options();
200
-      ?>
200
+        ?>
201 201
      </select>
202 202
 </td>
203 203
 <td align="center">&nbsp;</td>
@@ -207,31 +207,31 @@  discard block
 block discarded – undo
207 207
   <td align="center">
208 208
   <div id="content_source">
209 209
       <?php
210
-      if (!($add_type=='multiple')) {
210
+        if (!($add_type=='multiple')) {
211 211
         ?>
212 212
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
213 213
         <div id="ajax_list_users_single"></div>
214 214
         <?php
215
-      } else {
216
-      ?>
215
+        } else {
216
+        ?>
217 217
       <div id="ajax_list_multiple">
218 218
         <?php echo Display::select('session_not_in_promotion_name',$session_not_in_promotion, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'session_not_in_promotion','size'=>'15px'),false); ?>
219 219
       </div>
220 220
     <?php
221
-      }
222
-     ?>
221
+        }
222
+        ?>
223 223
   </div>
224 224
   </td>
225 225
   <td width="10%" valign="middle" align="center">
226 226
   <?php
227
-  if ($ajax_search) {
228
-  ?>
227
+    if ($ajax_search) {
228
+    ?>
229 229
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('session_in_promotion'))" >
230 230
         <em class="fa fa-arrow-left"></em>
231 231
     </button>
232 232
   <?php
233
-  } else {
234
-  ?>
233
+    } else {
234
+    ?>
235 235
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))">
236 236
         <em class="fa fa-arrow-right"></em>
237 237
     </button>
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
         <em class="fa fa-arrow-left"></em>
241 241
     </button>
242 242
     <?php
243
-  }
244
-  ?>
243
+    }
244
+    ?>
245 245
     <br /><br /><br /><br /><br /><br />
246 246
   </td>
247 247
   <td align="center">
Please login to merge, or discard this patch.
main/admin/dashboard_add_courses_to_user.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 
37 37
 // setting the name of the tool
38 38
 if (UserManager::is_admin($user_id)) {
39
-	$tool_name= get_lang('AssignCoursesToPlatformAdministrator');
39
+    $tool_name= get_lang('AssignCoursesToPlatformAdministrator');
40 40
 } else if ($user_info['status'] == SESSIONADMIN) {
41
-	$tool_name= get_lang('AssignCoursesToSessionsAdministrator');
41
+    $tool_name= get_lang('AssignCoursesToSessionsAdministrator');
42 42
 } else {
43
-	$tool_name= get_lang('AssignCoursesToHumanResourcesManager');
43
+    $tool_name= get_lang('AssignCoursesToHumanResourcesManager');
44 44
 }
45 45
 
46 46
 $add_type = 'multiple';
47 47
 if(isset($_GET['add_type']) && $_GET['add_type']!='') {
48
-	$add_type = Security::remove_XSS($_REQUEST['add_type']);
48
+    $add_type = Security::remove_XSS($_REQUEST['add_type']);
49 49
 }
50 50
 
51 51
 if (!api_is_platform_admin()) {
52
-	api_not_allowed(true);
52
+    api_not_allowed(true);
53 53
 }
54 54
 
55 55
 function search_courses($needle, $type)
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     $return = '';
61 61
     if (!empty($needle) && !empty($type)) {
62 62
         // xajax send utf8 datas... datas in db can be non-utf8 datas
63
-		$needle = Database::escape_string($needle);
63
+        $needle = Database::escape_string($needle);
64 64
 
65 65
         $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
66 66
         $assigned_courses_code = array_keys($assigned_courses_to_hrm);
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
                 		$without_assigned_courses ";
89 89
         }
90 90
 
91
-		$rs	= Database::query($sql);
91
+        $rs	= Database::query($sql);
92 92
 
93
-		$return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" >';
94
-		while($course = Database :: fetch_array($rs)) {
95
-			$return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'],ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
96
-		}
97
-		$return .= '</select>';
98
-		$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
99
-	}
100
-	return $xajax_response;
93
+        $return .= '<select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" >';
94
+        while($course = Database :: fetch_array($rs)) {
95
+            $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'],ENT_QUOTES).'">'.$course['title'].' ('.$course['code'].')</option>';
96
+        }
97
+        $return .= '</select>';
98
+        $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
99
+    }
100
+    return $xajax_response;
101 101
 }
102 102
 
103 103
 $xajax->processRequests();
@@ -181,23 +181,23 @@  discard block
 block discarded – undo
181 181
 $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
182 182
 $assigned_courses_code = array_keys($assigned_courses_to_hrm);
183 183
 foreach ($assigned_courses_code as &$value) {
184
-	$value = "'".$value."'";
184
+    $value = "'".$value."'";
185 185
 }
186 186
 
187 187
 $without_assigned_courses = '';
188 188
 if (count($assigned_courses_code) > 0) {
189
-	$without_assigned_courses = " AND c.code NOT IN(".implode(',',$assigned_courses_code).")";
189
+    $without_assigned_courses = " AND c.code NOT IN(".implode(',',$assigned_courses_code).")";
190 190
 }
191 191
 
192 192
 $needle = '%';
193 193
 $firstLetter = null;
194 194
 if (isset($_POST['firstLetterCourse'])) {
195
-	$firstLetter = $_POST['firstLetterCourse'];
196
-	$needle = Database::escape_string($firstLetter.'%');
195
+    $firstLetter = $_POST['firstLetterCourse'];
196
+    $needle = Database::escape_string($firstLetter.'%');
197 197
 }
198 198
 
199 199
 if (api_is_multiple_url_enabled()) {
200
-	$sql = " SELECT c.code, c.title
200
+    $sql = " SELECT c.code, c.title
201 201
             FROM $tbl_course c
202 202
             LEFT JOIN $tbl_course_rel_access_url a
203 203
             ON (a.c_id = c.id)
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             ORDER BY c.title";
208 208
 
209 209
 } else {
210
-	$sql= " SELECT c.code, c.title
210
+    $sql= " SELECT c.code, c.title
211 211
 	        FROM $tbl_course c
212 212
             WHERE  c.code LIKE '$needle' $without_assigned_courses
213 213
             ORDER BY c.title";
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 <input type="hidden" name="formSent" value="1" />
222 222
 <?php
223 223
 if(!empty($msg)) {
224
-	Display::display_normal_message($msg); //main API
224
+    Display::display_normal_message($msg); //main API
225 225
 }
226 226
 ?>
227 227
 
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
     </div>
270 270
     <div class="col-md-4">
271 271
         <h5><?php
272
-	  	if (UserManager::is_admin($user_id)) {
273
-			echo get_lang('AssignedCoursesListToPlatformAdministrator');
274
-		} else if ($user_info['status'] == SESSIONADMIN) {
275
-			echo get_lang('AssignedCoursesListToSessionsAdministrator');
276
-		} else {
277
-			echo get_lang('AssignedCoursesListToHumanResourcesManager');
278
-		}
272
+            if (UserManager::is_admin($user_id)) {
273
+            echo get_lang('AssignedCoursesListToPlatformAdministrator');
274
+        } else if ($user_info['status'] == SESSIONADMIN) {
275
+            echo get_lang('AssignedCoursesListToSessionsAdministrator');
276
+        } else {
277
+            echo get_lang('AssignedCoursesListToHumanResourcesManager');
278
+        }
279 279
             ?>: </h5>
280 280
         
281 281
         <select id='destination' name="CoursesList[]" multiple="multiple" size="20" style="width:320px;">
Please login to merge, or discard this patch.
main/admin/access_url_edit_usergroup_to_url.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $userGroupList[$item['id']] = $item;
122 122
     }
123 123
 } else {
124
-	$userGroups = UrlManager::get_url_rel_usergroup_data();
124
+    $userGroups = UrlManager::get_url_rel_usergroup_data();
125 125
 
126 126
     foreach ($userGroups as $item) {
127 127
         if ($item['access_url_id'] == $access_url_id) {
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 }
133 133
 
134 134
 if ($add_type == 'multiple') {
135
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>';
136
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
135
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>';
136
+    $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
137 137
 } else {
138
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
139
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>';
138
+    $link_add_type_unique = get_lang('SessionAddTypeUnique');
139
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>';
140 140
 }
141 141
 
142 142
 $url_list = UrlManager::get_url_data();
@@ -200,30 +200,30 @@  discard block
 block discarded – undo
200 200
     <?php } else { ?>
201 201
 	  <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
202 202
 		<?php
203
-		foreach ($noUserGroupList as $noItem) {
204
-		?>
203
+        foreach ($noUserGroupList as $noItem) {
204
+        ?>
205 205
 			<option value="<?php echo $noItem['id']; ?>">
206 206
                 <?php echo $noItem['name']; ?>
207 207
             </option>
208 208
 		<?php
209
-		}
210
-		?>
209
+        }
210
+        ?>
211 211
 	  </select>
212 212
 	<?php
213
-  	  }
214
-  	 ?>
213
+        }
214
+        ?>
215 215
   </div>
216 216
   </td>
217 217
   <td width="10%" valign="middle" align="center">
218 218
   <?php
219
-  if ($ajax_search) {
220
-	?>
219
+    if ($ajax_search) {
220
+    ?>
221 221
 	<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" >
222 222
         <em class="fa fa-arrow-left"></em>
223 223
 	</button>
224 224
   	<?php
225
-  } else {
226
-  	?>
225
+    } else {
226
+        ?>
227 227
 	<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
228 228
         <em class="fa fa-arrow-right"></em>
229 229
 	</button>
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
         <em class="fa fa-arrow-left"></em>
233 233
 	</button>
234 234
 	<?php
235
-  }
236
-  ?>
235
+    }
236
+    ?>
237 237
 	<br /><br /><br /><br /><br /><br />
238 238
   </td>
239 239
   <td align="center">
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 	<td colspan="3" align="center">
255 255
 		<br />
256 256
 		<?php
257
-		if(isset($_GET['add']))
258
-			echo '<button class="save" onclick="valide()" >'.get_lang('AddUserGroupToURL').'</button>';
259
-		else
260
-			echo '<button class="save" onclick="valide()" >'.get_lang('EditUserGroupToURL').'</button>';
261
-		?>
257
+        if(isset($_GET['add']))
258
+            echo '<button class="save" onclick="valide()" >'.get_lang('AddUserGroupToURL').'</button>';
259
+        else
260
+            echo '<button class="save" onclick="valide()" >'.get_lang('EditUserGroupToURL').'</button>';
261
+        ?>
262 262
 	</td>
263 263
 </tr>
264 264
 </table>
Please login to merge, or discard this patch.
main/admin/group_add.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 
101 101
 // Validate form
102 102
 if ($form->validate()) {
103
-	$check = Security::check_token('post');
104
-	if ($check) {
105
-		$values = $form->exportValues();
103
+    $check = Security::check_token('post');
104
+    if ($check) {
105
+        $values = $form->exportValues();
106 106
 
107 107
         $picture_element = $form->getElement('picture');
108 108
         $picture = $picture_element->getValue();
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
         $picture = $_FILES['picture'];
115 115
         $parent_group_id = intval($values['parent_group']);
116 116
 
117
-		$group_id = GroupPortalManager::add($name, $description, $url, $status);
117
+        $group_id = GroupPortalManager::add($name, $description, $url, $status);
118 118
         GroupPortalManager::set_parent_group($group_id,$parent_group_id);
119 119
 
120
-		if (!empty($picture['name'])) {
120
+        if (!empty($picture['name'])) {
121 121
             $picture_uri = GroupPortalManager::update_group_picture(
122 122
                 $group_id,
123 123
                 $_FILES['picture']['name'],
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
                 $status,
132 132
                 $picture_uri
133 133
             );
134
-		}
134
+        }
135 135
 
136
-		//@todo send emails
136
+        //@todo send emails
137 137
 
138 138
 /*		if (!empty($email) && $send_mail) {
139 139
 			$recipient_name = api_get_person_name($firstname, $lastname, null, PERSON_NAME_EMAIL_ADDRESS);
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
 			@api_mail_html($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin);
156 156
 		}*/
157 157
 
158
-		Security::clear_token();
159
-		$tok = Security::get_token();
160
-		header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupAdded')).'&sec_token='.$tok);
158
+        Security::clear_token();
159
+        $tok = Security::get_token();
160
+        header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupAdded')).'&sec_token='.$tok);
161 161
         exit ();
162
-	}
162
+    }
163 163
 } else {
164
-	if (isset($_POST['submit'])) {
165
-		Security::clear_token();
166
-	}
167
-	$token = Security::get_token();
168
-	$form->addElement('hidden', 'sec_token');
169
-	$form->setConstants(array('sec_token' => $token));
164
+    if (isset($_POST['submit'])) {
165
+        Security::clear_token();
166
+    }
167
+    $token = Security::get_token();
168
+    $form->addElement('hidden', 'sec_token');
169
+    $form->setConstants(array('sec_token' => $token));
170 170
 }
171 171
 
172 172
 // Display form
Please login to merge, or discard this patch.
main/admin/promotions.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
 <script>
113 113
 $(function() {
114 114
 <?php
115
-     echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
115
+        echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
116 116
 ?>
117 117
 });
118 118
 </script>
Please login to merge, or discard this patch.
main/admin/access_url_add_courses_to_url.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
       <?php
108 108
         echo Display :: get_alphabet_options($first_letter_course);
109 109
         echo Display :: get_numeric_options(0,9,$first_letter_course);
110
-      ?>
110
+        ?>
111 111
      </select>
112 112
     </td>
113 113
         <td width="20%">&nbsp;</td>
Please login to merge, or discard this patch.
main/admin/ldap_import_students_to_session.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -53,91 +53,91 @@  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('course.gif', get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />';
72
-	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
73
-	echo '<select name="id_session">';
74
-
75
-	$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
76
-	$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " .
77
-		" FROM $tbl_session ".
78
-		" ORDER BY name";
79
-	$result = Database::query($sql);
80
-
81
-	$sessions=Database::store_result($result);
82
-	$nbr_results=count($sessions);
83
-	foreach($sessions as $row) {
84
-		echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
85
-	}
86
-	echo '</select>';
87
-	echo '<input type="submit" value="'.get_lang('Submit').'">';
88
-	echo '</form>';
89
-	echo '</div>';
69
+    Display::display_header($tool_name);
70
+    echo '<div style="align:center">';
71
+    echo Display::return_icon('course.gif', get_lang('SelectSessionToImportUsersTo')).' '.get_lang('SelectSessionToImportUsersTo').'<br />';
72
+    echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
73
+    echo '<select name="id_session">';
74
+
75
+    $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
76
+    $sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " .
77
+        " FROM $tbl_session ".
78
+        " ORDER BY name";
79
+    $result = Database::query($sql);
80
+
81
+    $sessions=Database::store_result($result);
82
+    $nbr_results=count($sessions);
83
+    foreach($sessions as $row) {
84
+        echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
85
+    }
86
+    echo '</select>';
87
+    echo '<input type="submit" value="'.get_lang('Submit').'">';
88
+    echo '</form>';
89
+    echo '</div>';
90 90
 }
91 91
 // form4  annee != 0; composante != 0 etape != 0
92 92
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
93 93
 elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed']))
94 94
 {
95
-	Display::display_header($tool_name);
96
-	echo '<div style="align: center;">';
97
-	echo '<br />';
98
-	echo '<br />';
99
-	echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
100
-	//echo "Connection ...";
101
-	$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
102
-	ldap_set_version($ds);
103
-
104
-	if ($ds) {
105
-
106
-		$r = false;
107
-		$res = ldap_handle_bind($ds, $r);
108
-
109
-		//$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))");
110
-		//echo "(ou=*$annee,ou=$composante)";
111
-		$sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
112
-
113
-		$info = ldap_get_entries($ds, $sr);
114
-
115
-		for ($key = 0; $key < $info["count"]; $key ++) {
116
-			$nom_form[] = $info[$key]["sn"][0];
117
-			$prenom_form[] = $info[$key]["givenname"][0];
118
-			$email_form[] = $info[$key]["mail"][0];
119
-			// Get uid from dn
120
-			//$dn_array=ldap_explode_dn($info[$key]["dn"],1);
121
-			//$username_form[] = $dn_array[0]; // uid is first key
122
-			$username_form[] = $info[$key]['uid'][0];
123
-			$outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
124
-			//$val = ldap_get_values_len($ds, $entry, "userPassword");
125
-			//$password_form[] = $val[0];
126
-			$password_form[] = $info[$key]['userPassword'][0];
127
-		}
128
-		ldap_unbind($ds);
129
-
130
-		/*-----------------------------------------------*/
131
-
132
-		asort($nom_form);
133
-		reset($nom_form);
134
-
135
-		$statut=5;
136
-		include ('ldap_form_add_users_group.php');
137
-	} else {
138
-		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
139
-	}
140
-	echo '<br /><br />';
95
+    Display::display_header($tool_name);
96
+    echo '<div style="align: center;">';
97
+    echo '<br />';
98
+    echo '<br />';
99
+    echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
100
+    //echo "Connection ...";
101
+    $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
102
+    ldap_set_version($ds);
103
+
104
+    if ($ds) {
105
+
106
+        $r = false;
107
+        $res = ldap_handle_bind($ds, $r);
108
+
109
+        //$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))");
110
+        //echo "(ou=*$annee,ou=$composante)";
111
+        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
112
+
113
+        $info = ldap_get_entries($ds, $sr);
114
+
115
+        for ($key = 0; $key < $info["count"]; $key ++) {
116
+            $nom_form[] = $info[$key]["sn"][0];
117
+            $prenom_form[] = $info[$key]["givenname"][0];
118
+            $email_form[] = $info[$key]["mail"][0];
119
+            // Get uid from dn
120
+            //$dn_array=ldap_explode_dn($info[$key]["dn"],1);
121
+            //$username_form[] = $dn_array[0]; // uid is first key
122
+            $username_form[] = $info[$key]['uid'][0];
123
+            $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
124
+            //$val = ldap_get_values_len($ds, $entry, "userPassword");
125
+            //$password_form[] = $val[0];
126
+            $password_form[] = $info[$key]['userPassword'][0];
127
+        }
128
+        ldap_unbind($ds);
129
+
130
+        /*-----------------------------------------------*/
131
+
132
+        asort($nom_form);
133
+        reset($nom_form);
134
+
135
+        $statut=5;
136
+        include ('ldap_form_add_users_group.php');
137
+    } else {
138
+        echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
139
+    }
140
+    echo '<br /><br />';
141 141
     echo '<a href="ldap_import_students.php?annee=">'.get_lang('BackToNewSearch').'</a>';
142 142
     echo '<br /><br />';
143 143
     echo '</div>';
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 }
146 146
 elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
147 147
 {
148
-	$id=$_POST['username_form'];
149
-	$UserList=array();
150
-	$userid_match_login = array();
151
-	foreach ($id as $form_index=>$user_id)
152
-	{
153
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
154
-		{
155
-			$tmp = ldap_add_user($user_id);
156
-			$UserList[]= $tmp;
157
-			$userid_match_login[$tmp] = $user_id;
158
-		}
159
-	}
160
-	if (!empty($_POST['id_session'])) {
161
-		$num = 0;
162
-		$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
163
-		$tbl_session	  = Database::get_main_table(TABLE_MAIN_SESSION);
164
-		foreach ($UserList as $user_id) {
148
+    $id=$_POST['username_form'];
149
+    $UserList=array();
150
+    $userid_match_login = array();
151
+    foreach ($id as $form_index=>$user_id)
152
+    {
153
+        if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
154
+        {
155
+            $tmp = ldap_add_user($user_id);
156
+            $UserList[]= $tmp;
157
+            $userid_match_login[$tmp] = $user_id;
158
+        }
159
+    }
160
+    if (!empty($_POST['id_session'])) {
161
+        $num = 0;
162
+        $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
163
+        $tbl_session	  = Database::get_main_table(TABLE_MAIN_SESSION);
164
+        foreach ($UserList as $user_id) {
165 165
                     $res_user = Database::insert(
166 166
                         $tbl_session_user,
167 167
                         [
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
                     if ($res_user !== false) {
174 174
                         $num++;
175 175
                     }
176
-		}
177
-
178
-		if($num>0) {
179
-			$sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
180
-			$res = Database::query($sql);
181
-		}
182
-		header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session']));
183
-	}
184
-	/*
176
+        }
177
+
178
+        if($num>0) {
179
+            $sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
180
+            $res = Database::query($sql);
181
+        }
182
+        header('Location: resume_session.php?id_session='.Security::remove_XSS($_POST['id_session']));
183
+    }
184
+    /*
185 185
 	else
186 186
 	{
187 187
 		Display :: display_header($tool_name);
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 		Display :: display_normal_message($message,false);
201 201
 	}
202 202
 	*/
203
-	else
204
-	{
205
-		Display::display_header($tool_name);
206
-		$message=get_lang('NoUserAdded');
207
-		Display :: display_normal_message($message,false);
208
-	}
209
-	echo '<br /><br />';
203
+    else
204
+    {
205
+        Display::display_header($tool_name);
206
+        $message=get_lang('NoUserAdded');
207
+        Display :: display_normal_message($message,false);
208
+    }
209
+    echo '<br /><br />';
210 210
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
211 211
     echo '<br /><br />';
212 212
 }
Please login to merge, or discard this patch.
main/admin/access_url_add_users_to_url.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 
14 14
 api_protect_global_admin_script();
15 15
 if (!api_get_multiple_access_url()) {
16
-	header('Location: index.php');
17
-	exit;
16
+    header('Location: index.php');
17
+    exit;
18 18
 }
19 19
 
20 20
 $form_sent = 0;
@@ -44,36 +44,36 @@  discard block
 block discarded – undo
44 44
 api_display_tool_title($tool_name);
45 45
 
46 46
 if ($_POST['form_sent']) {
47
-	$form_sent = $_POST['form_sent'];
48
-	$users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ;
49
-	$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
50
-	$first_letter_user = $_POST['first_letter_user'];
47
+    $form_sent = $_POST['form_sent'];
48
+    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ;
49
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
50
+    $first_letter_user = $_POST['first_letter_user'];
51 51
 
52
-	foreach($users as $key => $value) {
53
-		$users[$key] = intval($value);
54
-	}
52
+    foreach($users as $key => $value) {
53
+        $users[$key] = intval($value);
54
+    }
55 55
 
56
-	if ($form_sent == 1) {
57
-		if (count($users) == 0 || count($url_list) == 0) {
58
-			Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL'));
59
-		} else {
60
-			UrlManager::add_users_to_urls($users,$url_list);
61
-			Display :: display_confirmation_message(get_lang('UsersBelongURL'));
62
-		}
63
-	}
56
+    if ($form_sent == 1) {
57
+        if (count($users) == 0 || count($url_list) == 0) {
58
+            Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL'));
59
+        } else {
60
+            UrlManager::add_users_to_urls($users,$url_list);
61
+            Display :: display_confirmation_message(get_lang('UsersBelongURL'));
62
+        }
63
+    }
64 64
 }
65 65
 
66 66
 /*	Display GUI	*/
67 67
 if (empty($first_letter_user)) {
68
-	$sql = "SELECT count(*) as nb_users FROM $tbl_user";
69
-	$result = Database::query($sql);
70
-	$num_row = Database::fetch_array($result);
68
+    $sql = "SELECT count(*) as nb_users FROM $tbl_user";
69
+    $result = Database::query($sql);
70
+    $num_row = Database::fetch_array($result);
71 71
     if ($num_row['nb_users']>1000) {
72 72
         //if there are too much users to gracefully handle with the HTML select list,
73 73
         // assign a default filter on users names
74 74
         $first_letter_user = 'A';
75 75
     }
76
-	unset($result);
76
+    unset($result);
77 77
 }
78 78
 $first_letter_user_lower = Database::escape_string(api_strtolower($first_letter_user));
79 79
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
       <option value="">--</option>
105 105
       <?php
106 106
         echo Display :: get_alphabet_options($first_letter_user);
107
-      ?>
107
+        ?>
108 108
      </select>
109 109
     </td>
110 110
         <td width="20%">&nbsp;</td>
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
     <td width="40%" align="center">
117 117
      <select name="user_list[]" multiple="multiple" size="20" style="width:380px;">
118 118
 		<?php
119
-		foreach ($db_users as $user) {
120
-		?>
119
+        foreach ($db_users as $user) {
120
+        ?>
121 121
             <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
122 122
                 <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
123 123
             </option>
124 124
 		<?php
125
-		}
126
-		?>
125
+        }
126
+        ?>
127 127
     </select>
128 128
    </td>
129 129
    <td width="20%" valign="middle" align="center">
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
    <td width="40%" align="center">
133 133
     <select name="url_list[]" multiple="multiple" size="20" style="width:230px;">
134 134
 		<?php
135
-		foreach ($db_urls as $url_obj) {
136
-			?>
135
+        foreach ($db_urls as $url_obj) {
136
+            ?>
137 137
 			<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>>
138 138
                 <?php echo $url_obj['url']; ?>
139 139
 			</option>
140 140
 			<?php
141
-		}
142
-		?>
141
+        }
142
+        ?>
143 143
     </select>
144 144
    </td>
145 145
   </tr>
Please login to merge, or discard this patch.