Completed
Push — 1.10.x ( f2aaaf...ef00db )
by Yannick
241:15 queued 197:35
created
main/admin/extra_field_workflow.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 api_protect_admin_script();
16 16
 
17 17
 // setting breadcrumbs
18
-$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
18
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19 19
 
20 20
 $tool_name = null;
21 21
 
@@ -36,35 +36,35 @@  discard block
 block discarded – undo
36 36
 $token = Security::get_token();
37 37
 
38 38
 if ($action == 'add') {
39
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extraField->type,'name' => $extraField->pageName);
40
-    $interbreadcrumb[]=array(
39
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName);
40
+    $interbreadcrumb[] = array(
41 41
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
42 42
         'name' => $extraFieldInfo['display_text']
43 43
     );
44
-    $interbreadcrumb[]=array(
44
+    $interbreadcrumb[] = array(
45 45
         'url' => 'extra_field_options.php?type='.$extraField->type.'&field_id='.$extraFieldInfo['id'],
46 46
         'name' => get_lang('EditExtraFieldOptions')
47 47
     );
48
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
48
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
49 49
 } elseif ($action == 'edit') {
50
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extraField->type,'name' => $extraField->pageName);
51
-    $interbreadcrumb[]=array(
50
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName);
51
+    $interbreadcrumb[] = array(
52 52
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
53 53
         'name' => $extraFieldInfo['display_text']
54 54
     );
55
-    $interbreadcrumb[]=array(
55
+    $interbreadcrumb[] = array(
56 56
         'url' => 'extra_field_options.php?type='.$extraField->type.'&field_id='.$extraFieldInfo['id'],
57 57
         'name' => get_lang('EditExtraFieldOptions')
58 58
     );
59 59
 
60
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit'));
60
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
61 61
 } else {
62
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extraField->type,'name' => $extraField->pageName);
63
-    $interbreadcrumb[]=array(
62
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName);
63
+    $interbreadcrumb[] = array(
64 64
         'url' =>  'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
65 65
         'name' => $extraFieldInfo['display_text']
66 66
     );
67
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('EditExtraFieldOptions'));
67
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditExtraFieldOptions'));
68 68
 }
69 69
 
70 70
 $roleId = isset($_REQUEST['roleId']) ? $_REQUEST['roleId'] : null;
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 $paramsNoRole = 'field_id='.$field_id.'&type='.$extraField->type;
75 75
 
76 76
 //The order is important you need to check the the $column variable in the model.ajax.php file
77
-$columns = array(get_lang('Name'), get_lang('Value'),  get_lang('Order'), get_lang('Actions'));
77
+$columns = array(get_lang('Name'), get_lang('Value'), get_lang('Order'), get_lang('Actions'));
78 78
 
79
-$htmlHeadXtra[]='<script>
79
+$htmlHeadXtra[] = '<script>
80 80
 
81 81
     function setHidden(obj) {
82 82
         var name = $(obj).attr("name");
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 if (!empty($roleId)) {
178 178
     $form->addElement('html', $table->toHtml());
179 179
     $group = array();
180
-    $group[]= $form->createElement('button', 'submit', get_lang('Save'));
181
-    $group[]= $form->createElement('button', 'select_all', get_lang('SelectAll'), array('class' => 'btn select_all'));
182
-    $group[]= $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), array('class' => 'btn unselect_all'));
180
+    $group[] = $form->createElement('button', 'submit', get_lang('Save'));
181
+    $group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), array('class' => 'btn select_all'));
182
+    $group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), array('class' => 'btn unselect_all'));
183 183
     $form->addGroup($group, '', null, ' ');
184 184
 
185 185
     $form->setDefaults(array('status' => $roleId));
Please login to merge, or discard this patch.
main/admin/skills_wheel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 $url = api_get_path(WEB_AJAX_PATH)."skill.ajax.php?a=get_skills_tree_json&load_user=$load_user";
38 38
 $tpl->assign('wheel_url', $url);
39 39
 
40
-$url  = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
40
+$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
41 41
 $tpl->assign('url', $url);
42 42
 $tpl->assign('isAdministration', true);
43 43
 
Please login to merge, or discard this patch.
main/admin/usergroup_import.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
             // 2. Check whether class doesn't exist yet.
24 24
             if ($usergroup->usergroup_exists($class['name'])) {
25 25
                 $class['line'] = $index + 2;
26
-                $class['error'] = get_lang('ClassNameExists') .
27
-                    ': <strong>' .$class['name'] . '</strong>';
26
+                $class['error'] = get_lang('ClassNameExists').
27
+                    ': <strong>'.$class['name'].'</strong>';
28 28
                 $errors[] = $class;
29 29
             }
30 30
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 $form = new FormValidator('import_classes');
99 99
 $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
100 100
 $group = array();
101
-$group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="example_class.csv" target="_blank">' . get_lang('ExampleCSVFile') . '</a>)', 'csv');
101
+$group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="example_class.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv');
102 102
 $form->addGroup($group, '', get_lang('FileType'), '<br/>');
103 103
 $form->addButtonImport(get_lang('Import'));
104 104
 
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
     $errors = validate_data($classes);
108 108
     if (count($errors) == 0) {
109 109
         $number_of_added_classes = save_data($classes);
110
-        Display::display_normal_message($number_of_added_classes . ' ' . get_lang('Added'));
110
+        Display::display_normal_message($number_of_added_classes.' '.get_lang('Added'));
111 111
     } else {
112 112
         $error_message = get_lang('ErrorsWhenImportingFile');
113 113
         $error_message .= '<ul>';
114 114
         foreach ($errors as $index => $error_class) {
115
-            $error_message .= '<li>' . $error_class['error'] . ' (' . get_lang('Line') . ' ' . $error_class['line'] . ')';
115
+            $error_message .= '<li>'.$error_class['error'].' ('.get_lang('Line').' '.$error_class['line'].')';
116 116
             $error_message .= '</li>';
117 117
         }
118 118
         $error_message .= '</ul>';
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 $form->display();
125 125
 ?>
126
-<p><?php echo get_lang('CSVMustLookLike') . ' (' . get_lang('MandatoryFields') . ')'; ?> :</p>
126
+<p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
127 127
 
128 128
 <pre>
129 129
 <b>name;description;</b>users
Please login to merge, or discard this patch.
main/admin/promotions.php 2 patches
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.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 $htmlHeadXtra[] = api_get_jqgrid_js();
17 17
 
18 18
 // setting breadcrumbs
19
-$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
20
-$interbreadcrumb[] = array('url' => 'career_dashboard.php','name' => get_lang('CareersAndPromotions'));
19
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
20
+$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions'));
21 21
 
22 22
 $action = isset($_GET['action']) ? $_GET['action'] : null;
23 23
 
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 $extra_params['height'] = 'auto'; //use the width of the parent
103 103
 //With this function we can add actions to the jgrid
104 104
 $action_links = 'function action_formatter (cellvalue, options, rowObject) {
105
-    return \'<a href="add_sessions_to_promotion.php?id=\'+options.rowId+\'">'.Display::return_icon('session_to_promotion.png',get_lang('SubscribeSessionsToPromotions'),'',ICON_SIZE_SMALL).'</a>'.
106
-    '&nbsp;<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
107
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
108
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a> \';
105
+    return \'<a href="add_sessions_to_promotion.php?id=\'+options.rowId+\'">'.Display::return_icon('session_to_promotion.png', get_lang('SubscribeSessionsToPromotions'), '', ICON_SIZE_SMALL).'</a>'.
106
+    '&nbsp;<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
107
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).'</a>'.
108
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a> \';
109 109
 }';
110 110
 
111 111
 ?>
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             $promotion->display();
151 151
         } else {
152 152
             echo '<div class="actions">';
153
-            echo Display::url(Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM), api_get_self());
153
+            echo Display::url(Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM), api_get_self());
154 154
             echo '</div>';
155 155
             $form->addElement('hidden', 'sec_token');
156 156
             $form->setConstants(array('sec_token' => $token));
Please login to merge, or discard this patch.
main/admin/skills_import.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	global $current_tag;
101 101
 	switch ($data) {
102 102
 		case 'Skill' :
103
-			$skill = array ();
103
+			$skill = array();
104 104
 			break;
105 105
 		default :
106 106
 			$current_tag = $data;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 api_protect_admin_script(true);
163 163
 
164 164
 $tool_name = get_lang('ImportSkillsListCSV');
165
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
165
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
166 166
 
167 167
 set_time_limit(0);
168 168
 $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 	$file_type = $_POST['file_type'];
174 174
 	Security::clear_token();
175 175
 	$tok = Security::get_token();
176
-	$allowed_file_mimetype = array('csv','xml');
176
+	$allowed_file_mimetype = array('csv', 'xml');
177 177
 	$error_kind_file = false;
178 178
     $error_message = '';
179 179
 
180
-	$ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1));
180
+	$ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
181 181
 
182
-	if (in_array($ext_import_file,$allowed_file_mimetype)) {
182
+	if (in_array($ext_import_file, $allowed_file_mimetype)) {
183 183
 		if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
184 184
 			$skills	= parse_csv_data($_FILES['import_file']['tmp_name']);
185 185
 			$errors = validate_data($skills);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	Display::display_normal_message($see_message_import);
258 258
 }
259 259
 
260
-$form = new FormValidator('user_import','post','skills_import.php');
260
+$form = new FormValidator('user_import', 'post', 'skills_import.php');
261 261
 $form->addElement('header', '', $tool_name);
262 262
 $form->addElement('hidden', 'formSent');
263 263
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
Please login to merge, or discard this patch.
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $oskill = new Skill();
71 71
             $skill_id = $oskill->add($skill);
72 72
             $parents[$saved_id] = $skill_id;
73
-		}
73
+        }
74 74
     }
75 75
 }
76 76
 
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function parse_csv_data($file)
83 83
 {
84
-	$skills = Import :: csvToArray($file);
85
-	foreach ($skills as $index => $skill) {
86
-		$skills[$index] = $skill;
87
-	}
84
+    $skills = Import :: csvToArray($file);
85
+    foreach ($skills as $index => $skill) {
86
+        $skills[$index] = $skill;
87
+    }
88 88
 
89
-	return $skills;
89
+    return $skills;
90 90
 }
91 91
 
92 92
 /**
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function element_start($parser, $data)
96 96
 {
97
-	$data = api_utf8_decode($data);
98
-	global $skill;
99
-	global $current_tag;
100
-	switch ($data) {
101
-		case 'Skill' :
102
-			$skill = array ();
103
-			break;
104
-		default :
105
-			$current_tag = $data;
106
-	}
97
+    $data = api_utf8_decode($data);
98
+    global $skill;
99
+    global $current_tag;
100
+    switch ($data) {
101
+        case 'Skill' :
102
+            $skill = array ();
103
+            break;
104
+        default :
105
+            $current_tag = $data;
106
+    }
107 107
 }
108 108
 
109 109
 /**
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function element_end($parser, $data)
113 113
 {
114
-	$data = api_utf8_decode($data);
115
-	global $skill;
116
-	global $skills;
117
-	global $current_value;
118
-	switch ($data) {
119
-		case 'Skill' :
120
-			$skills[] = $skill;
121
-			break;
122
-		default :
123
-			$skill[$data] = $current_value;
124
-			break;
125
-	}
114
+    $data = api_utf8_decode($data);
115
+    global $skill;
116
+    global $skills;
117
+    global $current_value;
118
+    switch ($data) {
119
+        case 'Skill' :
120
+            $skills[] = $skill;
121
+            break;
122
+        default :
123
+            $skill[$data] = $current_value;
124
+            break;
125
+    }
126 126
 }
127 127
 
128 128
 /**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
  */
131 131
 function character_data($parser, $data)
132 132
 {
133
-	$data = trim(api_utf8_decode($data));
134
-	global $current_value;
135
-	$current_value = $data;
133
+    $data = trim(api_utf8_decode($data));
134
+    global $current_value;
135
+    $current_value = $data;
136 136
 }
137 137
 
138 138
 /**
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
  */
143 143
 function parse_xml_data($file)
144 144
 {
145
-	global $current_tag;
146
-	global $current_value;
147
-	global $skill;
148
-	global $skills;
149
-	$skills = array();
150
-	$parser = xml_parser_create('UTF-8');
151
-	xml_set_element_handler($parser, 'element_start', 'element_end');
152
-	xml_set_character_data_handler($parser, 'character_data');
153
-	xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
154
-	xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
155
-	xml_parser_free($parser);
145
+    global $current_tag;
146
+    global $current_value;
147
+    global $skill;
148
+    global $skills;
149
+    $skills = array();
150
+    $parser = xml_parser_create('UTF-8');
151
+    xml_set_element_handler($parser, 'element_start', 'element_end');
152
+    xml_set_character_data_handler($parser, 'character_data');
153
+    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
154
+    xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
155
+    xml_parser_free($parser);
156 156
 
157
-	return $skills;
157
+    return $skills;
158 158
 }
159 159
 
160 160
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -169,81 +169,81 @@  discard block
 block discarded – undo
169 169
 $error_message = '';
170 170
 
171 171
 if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
172
-	$file_type = $_POST['file_type'];
173
-	Security::clear_token();
174
-	$tok = Security::get_token();
175
-	$allowed_file_mimetype = array('csv','xml');
176
-	$error_kind_file = false;
172
+    $file_type = $_POST['file_type'];
173
+    Security::clear_token();
174
+    $tok = Security::get_token();
175
+    $allowed_file_mimetype = array('csv','xml');
176
+    $error_kind_file = false;
177 177
     $error_message = '';
178 178
 
179
-	$ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1));
179
+    $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1));
180 180
 
181
-	if (in_array($ext_import_file,$allowed_file_mimetype)) {
182
-		if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
183
-			$skills	= parse_csv_data($_FILES['import_file']['tmp_name']);
184
-			$errors = validate_data($skills);
185
-			$error_kind_file = false;
186
-		} elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
187
-			$skills = parse_xml_data($_FILES['import_file']['tmp_name']);
188
-			$errors = validate_data($skills);
189
-			$error_kind_file = false;
190
-		} else {
191
-			$error_kind_file = true;
192
-		}
193
-	} else {
194
-		$error_kind_file = true;
195
-	}
181
+    if (in_array($ext_import_file,$allowed_file_mimetype)) {
182
+        if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) {
183
+            $skills	= parse_csv_data($_FILES['import_file']['tmp_name']);
184
+            $errors = validate_data($skills);
185
+            $error_kind_file = false;
186
+        } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) {
187
+            $skills = parse_xml_data($_FILES['import_file']['tmp_name']);
188
+            $errors = validate_data($skills);
189
+            $error_kind_file = false;
190
+        } else {
191
+            $error_kind_file = true;
192
+        }
193
+    } else {
194
+        $error_kind_file = true;
195
+    }
196 196
 
197
-	// List skill id with error.
198
-	$skills_to_insert = $skill_id_error = array();
199
-	if (is_array($errors)) {
200
-		foreach ($errors as $my_errors) {
201
-			$skill_id_error[] = $my_errors['SkillName'];
202
-		}
203
-	}
204
-	if (is_array($skills)) {
205
-		foreach ($skills as $my_skill) {
206
-			if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) {
207
-				$skills_to_insert[] = $my_skill;
208
-			}
209
-		}
210
-	}
197
+    // List skill id with error.
198
+    $skills_to_insert = $skill_id_error = array();
199
+    if (is_array($errors)) {
200
+        foreach ($errors as $my_errors) {
201
+            $skill_id_error[] = $my_errors['SkillName'];
202
+        }
203
+    }
204
+    if (is_array($skills)) {
205
+        foreach ($skills as $my_skill) {
206
+            if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) {
207
+                $skills_to_insert[] = $my_skill;
208
+            }
209
+        }
210
+    }
211 211
 
212
-	if (strcmp($file_type, 'csv') === 0) {
213
-		save_data($skills_to_insert);
214
-	} elseif (strcmp($file_type, 'xml') === 0) {
215
-		save_data($skills_to_insert);
216
-	} else {
217
-		$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
218
-	}
212
+    if (strcmp($file_type, 'csv') === 0) {
213
+        save_data($skills_to_insert);
214
+    } elseif (strcmp($file_type, 'xml') === 0) {
215
+        save_data($skills_to_insert);
216
+    } else {
217
+        $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
218
+    }
219 219
 
220
-	if (count($errors) > 0) {
221
-		$see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered');
222
-	} else {
223
-		$see_message_import = get_lang('FileImported');
224
-	}
220
+    if (count($errors) > 0) {
221
+        $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered');
222
+    } else {
223
+        $see_message_import = get_lang('FileImported');
224
+    }
225 225
 
226
-	if (count($errors) != 0) {
227
-		$warning_message = '<ul>';
228
-		foreach ($errors as $index => $error_skill) {
229
-			$warning_message .= '<li><b>'.$error_skill['error'].'</b>: ';
230
-			$warning_message .= '<strong>'.$error_skill['SkillName'].'</strong>&nbsp;('.$error_skill['SkillName'].')';
231
-			$warning_message .= '</li>';
232
-		}
233
-		$warning_message .= '</ul>';
234
-	}
226
+    if (count($errors) != 0) {
227
+        $warning_message = '<ul>';
228
+        foreach ($errors as $index => $error_skill) {
229
+            $warning_message .= '<li><b>'.$error_skill['error'].'</b>: ';
230
+            $warning_message .= '<strong>'.$error_skill['SkillName'].'</strong>&nbsp;('.$error_skill['SkillName'].')';
231
+            $warning_message .= '</li>';
232
+        }
233
+        $warning_message .= '</ul>';
234
+    }
235 235
 
236 236
     if ($error_kind_file) {
237
-		$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
238
-	}
237
+        $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
238
+    }
239 239
 }
240 240
 Display :: display_header($tool_name);
241 241
 
242 242
 if (!empty($error_message)) {
243
-	Display::display_error_message($error_message);
243
+    Display::display_error_message($error_message);
244 244
 }
245 245
 if (!empty($see_message_import)) {
246
-	Display::display_normal_message($see_message_import);
246
+    Display::display_normal_message($see_message_import);
247 247
 }
248 248
 
249 249
 $form = new FormValidator('user_import','post','skills_import.php');
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 $i = 0;
267 267
 $count_fields = count($extra_fields);
268 268
 if ($count_fields > 0) {
269
-	foreach ($extra_fields as $extra) {
270
-		$list[] = $extra[1];
271
-		$list_reponse[] = 'xxx';
272
-		$spaces = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
273
-		$result_xml .= $spaces.'&lt;'.$extra[1].'&gt;xxx&lt;/'.$extra[1].'&gt;';
274
-		if ($i != $count_fields - 1) {
275
-			$result_xml .= '<br/>';
276
-		}
277
-		$i++;
278
-	}
269
+    foreach ($extra_fields as $extra) {
270
+        $list[] = $extra[1];
271
+        $list_reponse[] = 'xxx';
272
+        $spaces = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
273
+        $result_xml .= $spaces.'&lt;'.$extra[1].'&gt;xxx&lt;/'.$extra[1].'&gt;';
274
+        if ($i != $count_fields - 1) {
275
+            $result_xml .= '<br/>';
276
+        }
277
+        $i++;
278
+    }
279 279
 }
280 280
 ?>
281 281
 <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
Please login to merge, or discard this patch.
main/admin/access_url_add_courses_to_url.php 3 patches
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.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 $cidReset = true;
11 11
 require_once '../inc/global.inc.php';
12 12
 
13
-$this_section=SECTION_PLATFORM_ADMIN;
13
+$this_section = SECTION_PLATFORM_ADMIN;
14 14
 
15 15
 api_protect_global_admin_script();
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 $form_sent = 0;
23 23
 $first_letter_course = '';
24
-$courses = array ();
24
+$courses = array();
25 25
 $url_list = array();
26 26
 $users = array();
27 27
 
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 
33 33
 /*	Header   */
34 34
 $tool_name = get_lang('AddCoursesToURL');
35
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
36
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
35
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
36
+$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
37 37
 
38 38
 Display :: display_header($tool_name);
39 39
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
50 50
     $form_sent = $_POST['form_sent'];
51
-    $courses = is_array($_POST['course_list']) ? $_POST['course_list'] : array() ;
52
-    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
51
+    $courses = is_array($_POST['course_list']) ? $_POST['course_list'] : array();
52
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
53 53
     $first_letter_course = $_POST['first_letter_course'];
54 54
 
55 55
     foreach ($users as $key => $value) {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     $sql = "SELECT count(*) as num_courses FROM $tbl_course";
71 71
     $result = Database::query($sql);
72 72
     $num_row = Database::fetch_array($result);
73
-    if ($num_row['num_courses']>1000) {
73
+    if ($num_row['num_courses'] > 1000) {
74 74
         //if there are too much num_courses to gracefully handle with the HTML select list,
75 75
         // assign a default filter on users names
76 76
         $first_letter_user = 'A';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
       <option value="">--</option>
107 107
       <?php
108 108
         echo Display :: get_alphabet_options($first_letter_course);
109
-        echo Display :: get_numeric_options(0,9,$first_letter_course);
109
+        echo Display :: get_numeric_options(0, 9, $first_letter_course);
110 110
       ?>
111 111
      </select>
112 112
     </td>
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     <td width="40%" align="center">
120 120
      <select name="course_list[]" multiple="multiple" size="20" style="width:400px;">
121 121
 		<?php foreach ($db_courses as $course) { ?>
122
-			<option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo $course['title'].' ('.$course['code'].')'; ?>
122
+			<option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>><?php echo $course['title'].' ('.$course['code'].')'; ?>
123 123
             </option>
124 124
         <?php } ?>
125 125
     </select>
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
    <td width="40%" align="center">
131 131
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
132 132
 		<?php foreach ($db_urls as $url_obj) { ?>
133
-        <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
133
+        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
134 134
         </option>
135 135
 		<?php } ?>
136 136
     </select>
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,10 @@  discard block
 block discarded – undo
119 119
     <td width="40%" align="center">
120 120
      <select name="course_list[]" multiple="multiple" size="20" style="width:400px;">
121 121
 		<?php foreach ($db_courses as $course) { ?>
122
-			<option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo $course['title'].' ('.$course['code'].')'; ?>
122
+			<option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) {
123
+    echo 'selected="selected"';
124
+}
125
+?>><?php echo $course['title'].' ('.$course['code'].')'; ?>
123 126
             </option>
124 127
         <?php } ?>
125 128
     </select>
@@ -130,7 +133,10 @@  discard block
 block discarded – undo
130 133
    <td width="40%" align="center">
131 134
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
132 135
 		<?php foreach ($db_urls as $url_obj) { ?>
133
-        <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
136
+        <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) {
137
+    echo 'selected="selected"';
138
+}
139
+?>><?php echo $url_obj['url']; ?>
134 140
         </option>
135 141
 		<?php } ?>
136 142
     </select>
Please login to merge, or discard this patch.
main/admin/ldap_import_students_to_session.php 3 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * Code
10 10
  */
11 11
 // resetting the course id
12
-$cidReset=true;
12
+$cidReset = true;
13 13
 require_once('../inc/global.inc.php');
14 14
 // setting the section (for the tabs)
15 15
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 api_protect_admin_script();
18 18
 require('../auth/ldap/authldap.php');
19 19
 
20
-$annee_base=date('Y');
20
+$annee_base = date('Y');
21 21
 
22 22
 $tool_name = get_lang('LDAPImport');
23 23
 // setting breadcrumbs
24
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
24
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
25 25
 
26 26
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
27 27
 var buttoncheck = 1;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		echo '</div>';
65 65
 
66 66
 }
67
-elseif(!empty($annee) && empty($id_session))
67
+elseif (!empty($annee) && empty($id_session))
68 68
 {
69 69
 	Display::display_header($tool_name);
70 70
 	echo '<div style="align:center">';
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 	echo '<select name="id_session">';
74 74
 
75 75
 	$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
76
-	$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date " .
76
+	$sql = "SELECT id,name,nbr_courses,access_start_date,access_end_date ".
77 77
 		" FROM $tbl_session ".
78 78
 		" ORDER BY name";
79 79
 	$result = Database::query($sql);
80 80
 
81
-	$sessions=Database::store_result($result);
82
-	$nbr_results=count($sessions);
83
-	foreach($sessions as $row) {
81
+	$sessions = Database::store_result($result);
82
+	$nbr_results = count($sessions);
83
+	foreach ($sessions as $row) {
84 84
 		echo '<option value="'.$row['id'].'">'.api_htmlentities($row['name']).' ('.$row['access_start_date'].' - '.$row['access_end_date'].')</option>';
85 85
 	}
86 86
 	echo '</select>';
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 		$info = ldap_get_entries($ds, $sr);
114 114
 
115
-		for ($key = 0; $key < $info["count"]; $key ++) {
115
+		for ($key = 0; $key < $info["count"]; $key++) {
116 116
 			$nom_form[] = $info[$key]["sn"][0];
117 117
 			$prenom_form[] = $info[$key]["givenname"][0];
118 118
 			$email_form[] = $info[$key]["mail"][0];
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		asort($nom_form);
133 133
 		reset($nom_form);
134 134
 
135
-		$statut=5;
135
+		$statut = 5;
136 136
 		include ('ldap_form_add_users_group.php');
137 137
 	} else {
138 138
 		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
@@ -143,24 +143,24 @@  discard block
 block discarded – undo
143 143
     echo '</div>';
144 144
 
145 145
 }
146
-elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
146
+elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes'))
147 147
 {
148
-	$id=$_POST['username_form'];
149
-	$UserList=array();
148
+	$id = $_POST['username_form'];
149
+	$UserList = array();
150 150
 	$userid_match_login = array();
151 151
 	foreach ($id as $form_index=>$user_id)
152 152
 	{
153
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
153
+		if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
154 154
 		{
155 155
 			$tmp = ldap_add_user($user_id);
156
-			$UserList[]= $tmp;
156
+			$UserList[] = $tmp;
157 157
 			$userid_match_login[$tmp] = $user_id;
158 158
 		}
159 159
 	}
160 160
 	if (!empty($_POST['id_session'])) {
161 161
 		$num = 0;
162 162
 		$tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
163
-		$tbl_session	  = Database::get_main_table(TABLE_MAIN_SESSION);
163
+		$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
164 164
 		foreach ($UserList as $user_id) {
165 165
                     $res_user = Database::insert(
166 166
                         $tbl_session_user,
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                     }
176 176
 		}
177 177
 
178
-		if($num>0) {
178
+		if ($num > 0) {
179 179
 			$sql = 'UPDATE '.$tbl_session.' SET nbr_users = (nbr_users + '.$num.') WHERE id = '.intval($id_session);
180 180
 			$res = Database::query($sql);
181 181
 		}
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 	else
204 204
 	{
205 205
 		Display::display_header($tool_name);
206
-		$message=get_lang('NoUserAdded');
207
-		Display :: display_normal_message($message,false);
206
+		$message = get_lang('NoUserAdded');
207
+		Display :: display_normal_message($message, false);
208 208
 	}
209 209
 	echo '<br /><br />';
210 210
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
 		echo '</form>';
64 64
 		echo '</div>';
65 65
 
66
-}
67
-elseif(!empty($annee) && empty($id_session))
66
+} elseif(!empty($annee) && empty($id_session))
68 67
 {
69 68
 	Display::display_header($tool_name);
70 69
 	echo '<div style="align:center">';
@@ -142,8 +141,7 @@  discard block
 block discarded – undo
142 141
     echo '<br /><br />';
143 142
     echo '</div>';
144 143
 
145
-}
146
-elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
144
+} elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
147 145
 {
148 146
 	$id=$_POST['username_form'];
149 147
 	$UserList=array();
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 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 :: display_normal_message($message,false);
203 203
 	}
204 204
 	*/
205
-	else
206
-	{
207
-		Display::display_header($tool_name);
208
-		$message=get_lang('NoUserAdded');
209
-		Display :: display_normal_message($message,false);
210
-	}
211
-	echo '<br /><br />';
205
+    else
206
+    {
207
+        Display::display_header($tool_name);
208
+        $message=get_lang('NoUserAdded');
209
+        Display :: display_normal_message($message,false);
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.
main/admin/access_url_add_users_to_url.php 3 patches
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.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,24 +20,24 @@  discard block
 block discarded – undo
20 20
 $form_sent = 0;
21 21
 $first_letter_user = '';
22 22
 $first_letter_course = '';
23
-$courses = array ();
23
+$courses = array();
24 24
 $url_list = array();
25 25
 $users = array();
26 26
 
27 27
 $tbl_access_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
28 28
 $tbl_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
29
-$tbl_user 		= Database :: get_main_table(TABLE_MAIN_USER);
29
+$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
30 30
 
31 31
 /*	Header	*/
32 32
 $tool_name = get_lang('AddUsersToURL');
33
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
34
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
33
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
34
+$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
35 35
 
36 36
 Display :: display_header($tool_name);
37 37
 
38 38
 echo '<div class="actions">';
39 39
 echo Display::url(
40
-    Display::return_icon('edit.png', get_lang('EditUsersToURL'),''),
40
+    Display::return_icon('edit.png', get_lang('EditUsersToURL'), ''),
41 41
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php');
42 42
 echo '</div>';
43 43
 
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 
46 46
 if ($_POST['form_sent']) {
47 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() ;
48
+	$users = is_array($_POST['user_list']) ? $_POST['user_list'] : array();
49
+	$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
50 50
 	$first_letter_user = $_POST['first_letter_user'];
51 51
 
52
-	foreach($users as $key => $value) {
52
+	foreach ($users as $key => $value) {
53 53
 		$users[$key] = intval($value);
54 54
 	}
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		if (count($users) == 0 || count($url_list) == 0) {
58 58
 			Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL'));
59 59
 		} else {
60
-			UrlManager::add_users_to_urls($users,$url_list);
60
+			UrlManager::add_users_to_urls($users, $url_list);
61 61
 			Display :: display_confirmation_message(get_lang('UsersBelongURL'));
62 62
 		}
63 63
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	$sql = "SELECT count(*) as nb_users FROM $tbl_user";
69 69
 	$result = Database::query($sql);
70 70
 	$num_row = Database::fetch_array($result);
71
-    if ($num_row['nb_users']>1000) {
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';
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     <td width="40%" align="center">
100 100
      <b><?php echo get_lang('UserList'); ?></b>
101 101
      <br/><br/>
102
-     <?php echo get_lang('Select').' ' ; echo $target_name == 'firstname'? get_lang('FirstName') : get_lang('LastName'); ?>
102
+     <?php echo get_lang('Select').' '; echo $target_name == 'firstname' ? get_lang('FirstName') : get_lang('LastName'); ?>
103 103
      <select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
104 104
       <option value="">--</option>
105 105
       <?php
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		<?php
119 119
 		foreach ($db_users as $user) {
120 120
 		?>
121
-            <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
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
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		<?php
135 135
 		foreach ($db_urls as $url_obj) {
136 136
 			?>
137
-			<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>>
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
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,10 @@  discard block
 block discarded – undo
118 118
 		<?php
119 119
 		foreach ($db_users as $user) {
120 120
 		?>
121
-            <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
121
+            <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) {
122
+    echo 'selected="selected"';
123
+}
124
+?>>
122 125
                 <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
123 126
             </option>
124 127
 		<?php
@@ -134,7 +137,10 @@  discard block
 block discarded – undo
134 137
 		<?php
135 138
 		foreach ($db_urls as $url_obj) {
136 139
 			?>
137
-			<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>>
140
+			<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) {
141
+    echo 'selected="selected"';
142
+}
143
+?>>
138 144
                 <?php echo $url_obj['url']; ?>
139 145
 			</option>
140 146
 			<?php
Please login to merge, or discard this patch.
main/admin/course_request_review.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -189,8 +189,8 @@
 block discarded – undo
189 189
 {
190 190
     $code = CourseRequestManager::get_course_request_code($id);
191 191
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=0">'.Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
192
-        '&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'),16).'</a>'.
193
-        '&nbsp;<a href="?reject_course_request='.$id.'">'.Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'),16).'</a>';
192
+        '&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>'.
193
+        '&nbsp;<a href="?reject_course_request='.$id.'">'.Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>';
194 194
     if (!CourseRequestManager::additional_info_asked($id)) {
195 195
         $result .= '&nbsp;<a href="?request_info='.$id.'">'.Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
196 196
     }
Please login to merge, or discard this patch.