Completed
Push — 1.10.x ( c135db...ea3352 )
by Julito
26:21
created
main/admin/ldap_import_students_to_session.php 1 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/ldap_import_students.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 //if ($annee == "" && $composante == "" && $etape == "") {
57 57
 if (empty($annee) && empty($course))
58 58
 {
59
-		Display::display_header($tool_name);
60
-		echo '<div style="align:center">';
61
-		Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU'));
62
-		echo get_lang('LDAPSelectFilterOnUsersOU');
63
-		//echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />';
64
-		///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />';
65
-
66
-		echo '<form method="get" action="'.api_get_self().'"><br />';
67
-		echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
68
-		echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />';
69
-		echo '<input type="submit" value="'.get_lang('Submit').'">';
70
-		echo '</form>';
71
-		echo '</div>';
59
+        Display::display_header($tool_name);
60
+        echo '<div style="align:center">';
61
+        Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU'));
62
+        echo get_lang('LDAPSelectFilterOnUsersOU');
63
+        //echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />';
64
+        ///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />';
65
+
66
+        echo '<form method="get" action="'.api_get_self().'"><br />';
67
+        echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
68
+        echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />';
69
+        echo '<input type="submit" value="'.get_lang('Submit').'">';
70
+        echo '</form>';
71
+        echo '</div>';
72 72
 
73 73
 }
74 74
 /*
@@ -200,71 +200,71 @@  discard block
 block discarded – undo
200 200
 */
201 201
 elseif(!empty($annee) && empty($course))
202 202
 {
203
-	Display::display_header($tool_name);
204
-	echo '<div style="align:center">';
205
-	echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />';
206
-	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207
-	echo '<select name="course">';
208
-	$courses = CourseManager::get_courses_list();
209
-	foreach($courses as $row)
210
-	{
211
-		echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212
-	}
213
-	echo '</select>';
214
-	echo '<input type="submit" value="'.get_lang('Submit').'">';
215
-	echo '</form>';
216
-	echo '</div>';
203
+    Display::display_header($tool_name);
204
+    echo '<div style="align:center">';
205
+    echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />';
206
+    echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207
+    echo '<select name="course">';
208
+    $courses = CourseManager::get_courses_list();
209
+    foreach($courses as $row)
210
+    {
211
+        echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212
+    }
213
+    echo '</select>';
214
+    echo '<input type="submit" value="'.get_lang('Submit').'">';
215
+    echo '</form>';
216
+    echo '</div>';
217 217
 }
218 218
 // form4  annee != 0; composante != 0 etape != 0
219 219
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
220 220
 elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed']))
221 221
 {
222
-	Display::display_header($tool_name);
223
-	echo '<div style="align: center;">';
224
-	echo '<br />';
225
-	echo '<br />';
226
-	echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
227
-	//echo "Connection ...";
228
-	$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
229
-	ldap_set_version($ds);
230
-
231
-	if ($ds) {
232
-
233
-		$r = false;
234
-		$res = ldap_handle_bind($ds, $r);
235
-
236
-		//$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))");
237
-		//echo "(ou=*$annee,ou=$composante)";
238
-		$sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
239
-
240
-		$info = ldap_get_entries($ds, $sr);
241
-
242
-		for ($key = 0; $key < $info["count"]; $key ++) {
243
-			$nom_form[] = $info[$key]["sn"][0];
244
-			$prenom_form[] = $info[$key]["givenname"][0];
245
-			$email_form[] = $info[$key]["mail"][0];
246
-			// Get uid from dn
247
-			//$dn_array=ldap_explode_dn($info[$key]["dn"],1);
248
-			//$username_form[] = $dn_array[0]; // uid is first key
249
-			$username_form[] = $info[$key]['uid'][0];
250
-			$outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
251
-			//$val = ldap_get_values_len($ds, $entry, "userPassword");
252
-			//$password_form[] = $val[0];
253
-			$password_form[] = $info[$key]['userPassword'][0];
254
-		}
255
-		ldap_unbind($ds);
256
-
257
-		/*-----------------------------------------------*/
258
-
259
-		asort($nom_form);
260
-		reset($nom_form);
261
-
262
-		$statut=5;
263
-		include ('ldap_form_add_users_group.php');
264
-	} else {
265
-		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
266
-	}
267
-	echo '<br /><br />';
222
+    Display::display_header($tool_name);
223
+    echo '<div style="align: center;">';
224
+    echo '<br />';
225
+    echo '<br />';
226
+    echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
227
+    //echo "Connection ...";
228
+    $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
229
+    ldap_set_version($ds);
230
+
231
+    if ($ds) {
232
+
233
+        $r = false;
234
+        $res = ldap_handle_bind($ds, $r);
235
+
236
+        //$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))");
237
+        //echo "(ou=*$annee,ou=$composante)";
238
+        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
239
+
240
+        $info = ldap_get_entries($ds, $sr);
241
+
242
+        for ($key = 0; $key < $info["count"]; $key ++) {
243
+            $nom_form[] = $info[$key]["sn"][0];
244
+            $prenom_form[] = $info[$key]["givenname"][0];
245
+            $email_form[] = $info[$key]["mail"][0];
246
+            // Get uid from dn
247
+            //$dn_array=ldap_explode_dn($info[$key]["dn"],1);
248
+            //$username_form[] = $dn_array[0]; // uid is first key
249
+            $username_form[] = $info[$key]['uid'][0];
250
+            $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
251
+            //$val = ldap_get_values_len($ds, $entry, "userPassword");
252
+            //$password_form[] = $val[0];
253
+            $password_form[] = $info[$key]['userPassword'][0];
254
+        }
255
+        ldap_unbind($ds);
256
+
257
+        /*-----------------------------------------------*/
258
+
259
+        asort($nom_form);
260
+        reset($nom_form);
261
+
262
+        $statut=5;
263
+        include ('ldap_form_add_users_group.php');
264
+    } else {
265
+        echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
266
+    }
267
+    echo '<br /><br />';
268 268
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
269 269
     echo '<br /><br />';
270 270
     echo '</div>';
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 }
273 273
 elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
274 274
 {
275
-	$id=$_POST['username_form'];
276
-	$UserList=array();
277
-	$userid_match_login = array();
278
-	foreach ($id as $form_index=>$user_id)
279
-	{
280
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
281
-		{
282
-			$tmp = ldap_add_user($user_id);
283
-			$UserList[]= $tmp;
284
-			$userid_match_login[$tmp] = $user_id;
285
-		}
286
-	}
287
-	if (!empty($_POST['course']))
288
-	{
289
-		foreach($UserList as $user_id)
290
-		{
291
-			CourseManager::add_user_to_course($user_id,$_POST['course']);
292
-		}
293
-		header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294
-	}
295
-	/*
275
+    $id=$_POST['username_form'];
276
+    $UserList=array();
277
+    $userid_match_login = array();
278
+    foreach ($id as $form_index=>$user_id)
279
+    {
280
+        if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
281
+        {
282
+            $tmp = ldap_add_user($user_id);
283
+            $UserList[]= $tmp;
284
+            $userid_match_login[$tmp] = $user_id;
285
+        }
286
+    }
287
+    if (!empty($_POST['course']))
288
+    {
289
+        foreach($UserList as $user_id)
290
+        {
291
+            CourseManager::add_user_to_course($user_id,$_POST['course']);
292
+        }
293
+        header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294
+    }
295
+    /*
296 296
 	else
297 297
 	{
298 298
 		Display :: display_header($tool_name);
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		Display :: display_normal_message($message,false);
312 312
 	}
313 313
 	*/
314
-	else
315
-	{
316
-		Display::display_header($tool_name);
317
-		$message=get_lang('NoUserAdded');
318
-		Display :: display_normal_message($message,false);
319
-	}
320
-	echo '<br /><br />';
314
+    else
315
+    {
316
+        Display::display_header($tool_name);
317
+        $message=get_lang('NoUserAdded');
318
+        Display :: display_normal_message($message,false);
319
+    }
320
+    echo '<br /><br />';
321 321
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
322 322
     echo '<br /><br />';
323 323
 }
Please login to merge, or discard this patch.
main/document/create_paint.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,26 +50,26 @@  discard block
 block discarded – undo
50 50
 // Please, do not modify this dirname formatting
51 51
 
52 52
 if (strstr($dir, '..')) {
53
-	$dir = '/';
53
+    $dir = '/';
54 54
 }
55 55
 
56 56
 if ($dir[0] == '.') {
57
-	$dir = substr($dir, 1);
57
+    $dir = substr($dir, 1);
58 58
 }
59 59
 
60 60
 if ($dir[0] != '/') {
61
-	$dir = '/'.$dir;
61
+    $dir = '/'.$dir;
62 62
 }
63 63
 
64 64
 if ($dir[strlen($dir) - 1] != '/') {
65
-	$dir .= '/';
65
+    $dir .= '/';
66 66
 }
67 67
 
68 68
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
69 69
 
70 70
 if (!is_dir($filepath)) {
71
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
72
-	$dir = '/';
71
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
72
+    $dir = '/';
73 73
 }
74 74
 
75 75
 $groupId = api_get_group_id();
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 }
98 98
 
99 99
 if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
100
-	DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))
100
+    DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))
101 101
 ) {
102 102
     api_not_allowed(true);
103 103
 }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 // Interbreadcrumb for the current directory root path
116 116
 if (empty($document_data['parents'])) {
117
-	$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
117
+    $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
118 118
 } else {
119 119
     foreach ($document_data['parents'] as $document_sub_data) {
120 120
         $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
 $locktitle="false";
148 148
 
149 149
 if ($_SERVER['HTTP_HOST']=="localhost") {
150
-	$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
151
-	if (!file_exists($path_and_file)) {
152
-		$crossdomain='<?xml version="1.0"?>
150
+    $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
151
+    if (!file_exists($path_and_file)) {
152
+        $crossdomain='<?xml version="1.0"?>
153 153
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
154 154
 			<cross-domain-policy>
155 155
 				<allow-access-from domain="cdn.pixlr.com" />
156 156
 				<site-control permitted-cross-domain-policies="master-only"/>
157 157
 				<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
158 158
 			</cross-domain-policy>';//more open domain="*"
159
-		@file_put_contents($path_and_file, $crossdomain);
160
-	}
159
+        @file_put_contents($path_and_file, $crossdomain);
160
+    }
161 161
     $credentials = "true";
162 162
 } else {
163 163
     $credentials = "false";
Please login to merge, or discard this patch.
main/document/edit_paint.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -61,44 +61,44 @@  discard block
 block discarded – undo
61 61
 /* Please, do not modify this dirname formatting */
62 62
 
63 63
 if (strstr($dir, '..')) {
64
-	$dir = '/';
64
+    $dir = '/';
65 65
 }
66 66
 
67 67
 if ($dir[0] == '.') {
68
-	$dir = substr($dir, 1);
68
+    $dir = substr($dir, 1);
69 69
 }
70 70
 
71 71
 if ($dir[0] != '/') {
72
-	$dir = '/'.$dir;
72
+    $dir = '/'.$dir;
73 73
 }
74 74
 
75 75
 if ($dir[strlen($dir) - 1] != '/') {
76
-	$dir .= '/';
76
+    $dir .= '/';
77 77
 }
78 78
 
79 79
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
80 80
 
81 81
 if (!is_dir($filepath)) {
82
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
83
-	$dir = '/';
82
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
83
+    $dir = '/';
84 84
 }
85 85
 
86 86
 //groups //TODO:clean
87 87
 if (!empty($groupId)) {
88
-	$interbreadcrumb[] = array(
89
-		'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
90
-		'name' => get_lang('GroupSpace'),
91
-	);
92
-	$group_document = true;
93
-	$noPHP_SELF = true;
88
+    $interbreadcrumb[] = array(
89
+        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
90
+        'name' => get_lang('GroupSpace'),
91
+    );
92
+    $group_document = true;
93
+    $noPHP_SELF = true;
94 94
 }
95 95
 
96 96
 $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
97 97
 
98 98
 if (!$is_certificate_mode)
99
-	$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
99
+    $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
100 100
 else
101
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
101
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
102 102
 
103 103
 // Interbreadcrumb for the current directory root path
104 104
 if (empty($document_data['parents'])) {
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 }
114 114
 
115 115
 $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] ||
116
-	DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
116
+    DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
117 117
 
118 118
 if (!$is_allowedToEdit) {
119
-	api_not_allowed(true);
119
+    api_not_allowed(true);
120 120
 }
121 121
 
122 122
 Event::event_access_tool(TOOL_DOCUMENT);
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
 $locktitle="false";
149 149
 
150 150
 if ($_SERVER['HTTP_HOST']=="localhost") {
151
-	$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
152
-	if (!file_exists($path_and_file)) {
153
-		$crossdomain='<?xml version="1.0"?>
151
+    $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
152
+    if (!file_exists($path_and_file)) {
153
+        $crossdomain='<?xml version="1.0"?>
154 154
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
155 155
 			<cross-domain-policy>
156 156
 				<allow-access-from domain="cdn.pixlr.com" />
157 157
 				<site-control permitted-cross-domain-policies="master-only"/>
158 158
 				<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
159 159
 			</cross-domain-policy>';//more open domain="*"
160
-		@file_put_contents($path_and_file, $crossdomain);
161
-	}
162
-	$credentials="true";
160
+        @file_put_contents($path_and_file, $crossdomain);
161
+    }
162
+    $credentials="true";
163 163
 }
164 164
 else {
165
-	$credentials="false";
165
+    $credentials="false";
166 166
 }
167 167
 
168 168
 //make temp images
@@ -175,23 +175,23 @@  discard block
 block discarded – undo
175 175
 $htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
176 176
 if (!file_exists($htaccess)) {
177 177
 
178
-	$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
178
+    $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
179 179
 
180
-	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181
-	if ($fp) {
182
-		fwrite($fp, $htaccess_content);
183
-		fclose($fp);
184
-	}
180
+    $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181
+    if ($fp) {
182
+        fwrite($fp, $htaccess_content);
183
+        fclose($fp);
184
+    }
185 185
 }
186 186
 
187 187
 $html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
188 188
 if (!file_exists($html_index)) {
189
-	$html_index_content="<html><head></head><body></body></html>";
190
-	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191
-	if ($fp) {
192
-		fwrite($fp, $html_index_content);
193
-		fclose($fp);
194
-	}
189
+    $html_index_content="<html><head></head><body></body></html>";
190
+    $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191
+    if ($fp) {
192
+        fwrite($fp, $html_index_content);
193
+        fclose($fp);
194
+    }
195 195
 }
196 196
 
197 197
 //encript temp name file
Please login to merge, or discard this patch.
main/inc/lib/pear/HTML/QuickForm.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
     public function &addElement($element)
631 631
     {
632 632
         if (is_object($element) && is_subclass_of($element, 'html_quickform_element')) {
633
-           $elementObject = &$element;
634
-           $elementObject->onQuickFormEvent('updateValue', null, $this);
633
+            $elementObject = &$element;
634
+            $elementObject->onQuickFormEvent('updateValue', null, $this);
635 635
         } else {
636 636
             $args = func_get_args();
637 637
             $elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1));
@@ -676,22 +676,22 @@  discard block
 block discarded – undo
676 676
     // }}}
677 677
     // {{{ insertElementBefore()
678 678
 
679
-   /**
680
-    * Inserts a new element right before the other element
681
-    *
682
-    * Warning: it is not possible to check whether the $element is already
683
-    * added to the form, therefore if you want to move the existing form
684
-    * element to a new position, you'll have to use removeElement():
685
-    * $form->insertElementBefore($form->removeElement('foo', false), 'bar');
686
-    *
687
-    * @access   public
688
-    * @since    3.2.4
689
-    * @param    HTML_QuickForm_element  Element to insert
690
-    * @param    string                  Name of the element before which the new
691
-    *                                   one is inserted
692
-    * @return   HTML_QuickForm_element  reference to inserted element
693
-    * @throws   HTML_QuickForm_Error
694
-    */
679
+    /**
680
+     * Inserts a new element right before the other element
681
+     *
682
+     * Warning: it is not possible to check whether the $element is already
683
+     * added to the form, therefore if you want to move the existing form
684
+     * element to a new position, you'll have to use removeElement():
685
+     * $form->insertElementBefore($form->removeElement('foo', false), 'bar');
686
+     *
687
+     * @access   public
688
+     * @since    3.2.4
689
+     * @param    HTML_QuickForm_element  Element to insert
690
+     * @param    string                  Name of the element before which the new
691
+     *                                   one is inserted
692
+     * @return   HTML_QuickForm_element  reference to inserted element
693
+     * @throws   HTML_QuickForm_Error
694
+     */
695 695
     function &insertElementBefore(&$element, $nameAfter)
696 696
     {
697 697
         if (!empty($this->_duplicateIndex[$nameAfter])) {
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
             if ((is_array($value) || null === $value) && isset($this->_submitFiles[$base])) {
871 871
                 $props = array('name', 'type', 'size', 'tmp_name', 'error');
872 872
                 $code  = "if (!isset(\$this->_submitFiles['{$base}']['name']{$idx})) {\n" .
873
-                         "    return null;\n" .
874
-                         "} else {\n" .
875
-                         "    \$v = array();\n";
873
+                            "    return null;\n" .
874
+                            "} else {\n" .
875
+                            "    \$v = array();\n";
876 876
                 foreach ($props as $prop) {
877 877
                     $code .= "    \$v = HTML_QuickForm::arrayMerge(\$v, \$this->_reindexFiles(\$this->_submitFiles['{$base}']['{$prop}']{$idx}, '{$prop}'));\n";
878 878
                 }
@@ -917,13 +917,13 @@  discard block
 block discarded – undo
917 917
         return $value;
918 918
     }
919 919
 
920
-   /**
921
-    * A helper function to change the indexes in $_FILES array
922
-    *
923
-    * @param  mixed   Some value from the $_FILES array
924
-    * @param  string  The key from the $_FILES array that should be appended
925
-    * @return array
926
-    */
920
+    /**
921
+     * A helper function to change the indexes in $_FILES array
922
+     *
923
+     * @param  mixed   Some value from the $_FILES array
924
+     * @param  string  The key from the $_FILES array that should be appended
925
+     * @return array
926
+     */
927 927
     function _reindexFiles($value, $key)
928 928
     {
929 929
         if (!is_array($value)) {
@@ -976,27 +976,27 @@  discard block
 block discarded – undo
976 976
         }
977 977
     } // end func setElementError
978 978
 
979
-     // }}}
980
-     // {{{ getElementType()
981
-
982
-     /**
983
-      * Returns the type of the given element
984
-      *
985
-      * @param      string    $element    Name of form element
986
-      * @since      1.1
987
-      * @access     public
988
-      * @return     string    Type of the element, false if the element is not found
989
-      */
990
-     function getElementType($element)
991
-     {
992
-         if (isset($this->_elementIndex[$element])) {
993
-             return $this->_elements[$this->_elementIndex[$element]]->getType();
994
-         }
995
-         return false;
996
-     } // end func getElementType
997
-
998
-     // }}}
999
-     // {{{ updateElementAttr()
979
+        // }}}
980
+        // {{{ getElementType()
981
+
982
+        /**
983
+         * Returns the type of the given element
984
+         *
985
+         * @param      string    $element    Name of form element
986
+         * @since      1.1
987
+         * @access     public
988
+         * @return     string    Type of the element, false if the element is not found
989
+         */
990
+        function getElementType($element)
991
+        {
992
+            if (isset($this->_elementIndex[$element])) {
993
+                return $this->_elements[$this->_elementIndex[$element]]->getType();
994
+            }
995
+            return false;
996
+        } // end func getElementType
997
+
998
+        // }}}
999
+        // {{{ updateElementAttr()
1000 1000
 
1001 1001
     /**
1002 1002
      * Updates Attributes for one or more elements
@@ -1263,18 +1263,18 @@  discard block
 block discarded – undo
1263 1263
     // }}}
1264 1264
     // {{{ addFormRule()
1265 1265
 
1266
-   /**
1267
-    * Adds a global validation rule
1268
-    *
1269
-    * This should be used when for a rule involving several fields or if
1270
-    * you want to use some completely custom validation for your form.
1271
-    * The rule function/method should return true in case of successful
1272
-    * validation and array('element name' => 'error') when there were errors.
1273
-    *
1274
-    * @access   public
1275
-    * @param    mixed   Callback, either function name or array(&$object, 'method')
1276
-    * @throws   HTML_QuickForm_Error
1277
-    */
1266
+    /**
1267
+     * Adds a global validation rule
1268
+     *
1269
+     * This should be used when for a rule involving several fields or if
1270
+     * you want to use some completely custom validation for your form.
1271
+     * The rule function/method should return true in case of successful
1272
+     * validation and array('element name' => 'error') when there were errors.
1273
+     *
1274
+     * @access   public
1275
+     * @param    mixed   Callback, either function name or array(&$object, 'method')
1276
+     * @throws   HTML_QuickForm_Error
1277
+     */
1278 1278
     function addFormRule($rule)
1279 1279
     {
1280 1280
         if (!is_callable($rule)) {
@@ -1351,18 +1351,18 @@  discard block
 block discarded – undo
1351 1351
     // }}}
1352 1352
     // {{{ arrayMerge()
1353 1353
 
1354
-   /**
1355
-    * Merges two arrays
1356
-    *
1357
-    * Merges two array like the PHP function array_merge but recursively.
1358
-    * The main difference is that existing keys will not be renumbered
1359
-    * if they are integers.
1360
-    *
1361
-    * @access   public
1362
-    * @param    array   $a  original array
1363
-    * @param    array   $b  array which will be merged into first one
1364
-    * @return   array   merged array
1365
-    */
1354
+    /**
1355
+     * Merges two arrays
1356
+     *
1357
+     * Merges two array like the PHP function array_merge but recursively.
1358
+     * The main difference is that existing keys will not be renumbered
1359
+     * if they are integers.
1360
+     *
1361
+     * @access   public
1362
+     * @param    array   $a  original array
1363
+     * @param    array   $b  array which will be merged into first one
1364
+     * @return   array   merged array
1365
+     */
1366 1366
     static function arrayMerge($a, $b)
1367 1367
     {
1368 1368
         foreach ($b as $k => $v) {
@@ -1493,10 +1493,10 @@  discard block
 block discarded – undo
1493 1493
      */
1494 1494
     function isElementFrozen($element)
1495 1495
     {
1496
-         if (isset($this->_elementIndex[$element])) {
1497
-             return $this->_elements[$this->_elementIndex[$element]]->isFrozen();
1498
-         }
1499
-         return false;
1496
+            if (isset($this->_elementIndex[$element])) {
1497
+                return $this->_elements[$this->_elementIndex[$element]]->isFrozen();
1498
+            }
1499
+            return false;
1500 1500
     } // end func isElementFrozen
1501 1501
 
1502 1502
     // }}}
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
      */
1686 1686
     function isFrozen()
1687 1687
     {
1688
-         return $this->_freezeAll;
1688
+            return $this->_freezeAll;
1689 1689
     }
1690 1690
 
1691 1691
     /**
@@ -1707,14 +1707,14 @@  discard block
 block discarded – undo
1707 1707
         return call_user_func($callback, $values);
1708 1708
     }
1709 1709
 
1710
-   /**
1711
-    * Accepts a renderer
1712
-    *
1713
-    * @param object     An HTML_QuickForm_Renderer object
1714
-    * @since 3.0
1715
-    * @access public
1716
-    * @return void
1717
-    */
1710
+    /**
1711
+     * Accepts a renderer
1712
+     *
1713
+     * @param object     An HTML_QuickForm_Renderer object
1714
+     * @since 3.0
1715
+     * @access public
1716
+     * @return void
1717
+     */
1718 1718
     function accept(&$renderer) {
1719 1719
         $renderer->startForm($this);
1720 1720
         foreach (array_keys($this->_elements) as $key) {
@@ -1727,13 +1727,13 @@  discard block
 block discarded – undo
1727 1727
         $renderer->finishForm($this);
1728 1728
     }
1729 1729
 
1730
-   /**
1731
-    * Returns a reference to default renderer object
1732
-    *
1733
-    * @access public
1734
-    * @since 3.0
1735
-    * @return HTML_QuickForm_Renderer_Default
1736
-    */
1730
+    /**
1731
+     * Returns a reference to default renderer object
1732
+     *
1733
+     * @access public
1734
+     * @since 3.0
1735
+     * @return HTML_QuickForm_Renderer_Default
1736
+     */
1737 1737
     function &defaultRenderer() {
1738 1738
         if (!isset($GLOBALS['_HTML_QuickForm_default_renderer'])) {
1739 1739
             // Modified by Ivan Tcholakov, 16-MAR-2010. Suppressing a deprecation warning on PHP 5.3
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
         //
1890 1890
         $this->accept($renderer);
1891 1891
         return $renderer->toArray();
1892
-     }
1892
+        }
1893 1893
 
1894 1894
     /**
1895 1895
      * Returns a 'safe' element's value
@@ -1961,15 +1961,15 @@  discard block
 block discarded – undo
1961 1961
         return $values;
1962 1962
     }
1963 1963
 
1964
-   /**
1965
-    * Tells whether the form was already submitted
1966
-    *
1967
-    * This is useful since the _submitFiles and _submitValues arrays
1968
-    * may be completely empty after the trackSubmit value is removed.
1969
-    *
1970
-    * @access public
1971
-    * @return bool
1972
-    */
1964
+    /**
1965
+     * Tells whether the form was already submitted
1966
+     *
1967
+     * This is useful since the _submitFiles and _submitValues arrays
1968
+     * may be completely empty after the trackSubmit value is removed.
1969
+     *
1970
+     * @access public
1971
+     * @return bool
1972
+     */
1973 1973
     function isSubmitted()
1974 1974
     {
1975 1975
         return $this->_flagSubmitted;
@@ -2056,21 +2056,21 @@  discard block
 block discarded – undo
2056 2056
 {
2057 2057
 
2058 2058
     /**
2059
-    * Prefix for all error messages
2060
-    * @var string
2061
-    */
2059
+     * Prefix for all error messages
2060
+     * @var string
2061
+     */
2062 2062
     var $error_message_prefix = 'QuickForm Error: ';
2063 2063
 
2064 2064
     /**
2065
-    * Creates a quickform error object, extending the PEAR_Error class
2066
-    *
2067
-    * @param int   $code the error code
2068
-    * @param int   $mode the reaction to the error, either return, die or trigger/callback
2069
-    * @param int   $level intensity of the error (PHP error code)
2070
-    * @param mixed $debuginfo any information that can inform user as to nature of the error
2071
-    */
2065
+     * Creates a quickform error object, extending the PEAR_Error class
2066
+     *
2067
+     * @param int   $code the error code
2068
+     * @param int   $mode the reaction to the error, either return, die or trigger/callback
2069
+     * @param int   $level intensity of the error (PHP error code)
2070
+     * @param mixed $debuginfo any information that can inform user as to nature of the error
2071
+     */
2072 2072
     function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
2073
-                         $level = E_USER_NOTICE, $debuginfo = null)
2073
+                            $level = E_USER_NOTICE, $debuginfo = null)
2074 2074
     {
2075 2075
         if (is_int($code)) {
2076 2076
             $this->PEAR_Error(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
Please login to merge, or discard this patch.
main/document/slideshow.php 1 patch
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 $slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null;
16 16
 
17 17
 if (empty($slide_id)) {
18
-	$edit_slide_id = 1;
18
+    $edit_slide_id = 1;
19 19
 } else {
20
-	$edit_slide_id = $slide_id;
20
+    $edit_slide_id = $slide_id;
21 21
 }
22 22
 
23 23
 if ($path != '/') {
24
-	$folder = $path.'/';
24
+    $folder = $path.'/';
25 25
 } else {
26
-	$folder = '/';
26
+    $folder = '/';
27 27
 }
28 28
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
29 29
 
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Loading the slides from the session
43 43
 if (isset($_SESSION['image_files_only'])) {
44
-	$image_files_only = $_SESSION['image_files_only'];
44
+    $image_files_only = $_SESSION['image_files_only'];
45 45
 }
46 46
 
47 47
 // Calculating the current slide, next slide, previous slide and the number of slides
48 48
 $slide = null;
49 49
 if ($slide_id != 'all') {
50
-	$slide = $slide_id ? $slide_id : 0;
51
-	$previous_slide = $slide - 1;
52
-	$next_slide = $slide + 1;
50
+    $slide = $slide_id ? $slide_id : 0;
51
+    $previous_slide = $slide - 1;
52
+    $next_slide = $slide + 1;
53 53
 }
54 54
 $total_slides = count($image_files_only);
55 55
 ?>
@@ -62,62 +62,62 @@  discard block
 block discarded – undo
62 62
 <?php
63 63
 
64 64
 if ($slide_id != 'all') {
65
-	$image = null;
66
-	if (isset($image_files_only[$slide])) {
67
-		$image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
68
-	}
69
-	if (file_exists($image)) {
70
-		echo '<div class="actions-pagination">';
71
-
72
-		// Back forward buttons
73
-		if ($slide == 0) {
74
-			$imgp = 'action_prev_na.png';
75
-			$first = Display::return_icon('action_first_na.png');
76
-		} else {
77
-			$imgp = 'action_prev.png';
78
-			$first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
65
+    $image = null;
66
+    if (isset($image_files_only[$slide])) {
67
+        $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
68
+    }
69
+    if (file_exists($image)) {
70
+        echo '<div class="actions-pagination">';
71
+
72
+        // Back forward buttons
73
+        if ($slide == 0) {
74
+            $imgp = 'action_prev_na.png';
75
+            $first = Display::return_icon('action_first_na.png');
76
+        } else {
77
+            $imgp = 'action_prev.png';
78
+            $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
79 79
 			          '.Display::return_icon('action_first.png', get_lang('FirstSlide')).'
80 80
 			          </a>';
81
-		}
81
+        }
82 82
 
83
-		// First slide
84
-		echo $first;
83
+        // First slide
84
+        echo $first;
85 85
 
86
-		// Previous slide
87
-		if ($slide > 0) {
88
-			echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
89
-		}
86
+        // Previous slide
87
+        if ($slide > 0) {
88
+            echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
89
+        }
90 90
 
91 91
         echo Display::return_icon($imgp, get_lang('Previous'));
92
-		if ($slide > 0) {
93
-			echo '</a>';
94
-		}
95
-
96
-		// Divider
97
-		echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
98
-
99
-		// Next slide
100
-		if ($slide < $total_slides - 1) {
101
-			echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
102
-		}
103
-		if ($slide == $total_slides - 1) {
104
-			$imgn = 'action_next_na.png';
92
+        if ($slide > 0) {
93
+            echo '</a>';
94
+        }
95
+
96
+        // Divider
97
+        echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
98
+
99
+        // Next slide
100
+        if ($slide < $total_slides - 1) {
101
+            echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
102
+        }
103
+        if ($slide == $total_slides - 1) {
104
+            $imgn = 'action_next_na.png';
105 105
             $last = Display::return_icon('action_last_na.png', get_lang('LastSlide'));
106
-		} else {
107
-			$imgn = 'action_next.png';
108
-			$last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'">
106
+        } else {
107
+            $imgn = 'action_next.png';
108
+            $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'">
109 109
 			        '.Display::return_icon('action_last.png', get_lang('LastSlide')).'
110 110
                 </a>';
111
-		}
111
+        }
112 112
         echo Display::return_icon($imgn, get_lang('Next'));
113
-		if ($slide > 0) {
114
-			echo '</a>';
115
-		}
116
-
117
-		// Last slide
118
-		echo $last;
119
-		echo '</div>';
120
-	}
113
+        if ($slide > 0) {
114
+            echo '</a>';
115
+        }
116
+
117
+        // Last slide
118
+        echo $last;
119
+        echo '</div>';
120
+    }
121 121
 }
122 122
 
123 123
 // Exit the slideshow
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 
127 127
 // Show thumbnails
128 128
 if ($slide_id != 'all') {
129
-	echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
129
+    echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
130 130
         Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>';
131 131
 } else {
132
-	echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
132
+    echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
133 133
 }
134 134
 // Slideshow options
135 135
 echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
@@ -142,24 +142,24 @@  discard block
 block discarded – undo
142 142
 
143 143
 // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options
144 144
 if (isset($_POST['Submit'])) {
145
-	// We come from slideshowoptions.php
146
-	//$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
147
-	$_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
148
-	if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
149
-		//echo "resizing";
150
-		$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
151
-		$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
152
-	} else {
153
-		//echo "unsetting the session heighte and width";
154
-		$_SESSION["image_resizing_width"] = null;
155
-		$_SESSION["image_resizing_height"] = null;
156
-	}
145
+    // We come from slideshowoptions.php
146
+    //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
147
+    $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
148
+    if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
149
+        //echo "resizing";
150
+        $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
151
+        $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
152
+    } else {
153
+        //echo "unsetting the session heighte and width";
154
+        $_SESSION["image_resizing_width"] = null;
155
+        $_SESSION["image_resizing_height"] = null;
156
+    }
157 157
 }
158 158
 $target_width = $target_height = null;
159 159
 // The target height and width depends if we choose resizing or no resizing
160 160
 if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resizing") {
161
-	$target_width = $_SESSION["image_resizing_width"];
162
-	$target_height = $_SESSION["image_resizing_height"];
161
+    $target_width = $_SESSION["image_resizing_width"];
162
+    $target_height = $_SESSION["image_resizing_height"];
163 163
 }
164 164
 
165 165
 /*	THUMBNAIL VIEW */
@@ -169,59 +169,59 @@  discard block
 block discarded – undo
169 169
 $html = '';
170 170
 if ($slide_id == 'all') {
171 171
 
172
-	// Config for make thumbnails
172
+    // Config for make thumbnails
173 173
     $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
174
-	$max_thumbnail_width     = 250;
175
-	$max_thumbnail_height    = 250;
176
-	$png_compression	     = 0; // 0(none)-9
177
-	$jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
174
+    $max_thumbnail_width     = 250;
175
+    $max_thumbnail_height    = 250;
176
+    $png_compression	     = 0; // 0(none)-9
177
+    $jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
178 178
 
179
-	$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
179
+    $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
180 180
 
181
-	//Other parameters only for show tumbnails
182
-	$row_items 			     = 4;//only in slideshow.php
183
-	$number_image 			 = 7;//num icons cols to show
184
-	$thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x
185
-	$thumbnail_height_frame = $max_thumbnail_height;
181
+    //Other parameters only for show tumbnails
182
+    $row_items 			     = 4;//only in slideshow.php
183
+    $number_image 			 = 7;//num icons cols to show
184
+    $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x
185
+    $thumbnail_height_frame = $max_thumbnail_height;
186 186
 
187
-	// Create the template_thumbnails folder (if no exist)
187
+    // Create the template_thumbnails folder (if no exist)
188 188
 
189
-	if (!file_exists($directory_thumbnails)) {
190
-		@mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
189
+    if (!file_exists($directory_thumbnails)) {
190
+        @mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
191 191
     }
192 192
 
193
-	// check files and thumbnails
194
-	if (is_array($image_files_only)) {
193
+    // check files and thumbnails
194
+    if (is_array($image_files_only)) {
195 195
 
196
-		foreach ($image_files_only as $one_image_file) {
197
-			$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
-			$image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
196
+        foreach ($image_files_only as $one_image_file) {
197
+            $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
+            $image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
199 199
 
200
-			if (file_exists($image)) {
201
-				//check thumbnail
202
-				$imagetype = explode(".", $image);
200
+            if (file_exists($image)) {
201
+                //check thumbnail
202
+                $imagetype = explode(".", $image);
203 203
                 //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
204
-				$imagetype = strtolower($imagetype[count($imagetype)-1]);
204
+                $imagetype = strtolower($imagetype[count($imagetype)-1]);
205 205
 
206
-				if (in_array($imagetype,$allowed_thumbnail_types)) {
207
-					if (!file_exists($image_thumbnail)){
206
+                if (in_array($imagetype,$allowed_thumbnail_types)) {
207
+                    if (!file_exists($image_thumbnail)){
208 208
                         //run each once we view thumbnails is too heavy, then need move into  !file_exists($image_thumbnail, and only run when haven't the thumbnail
209
-						$original_image_size = api_getimagesize($image);
210
-
211
-						switch($imagetype) {
212
-							case 'gif':
213
-								$source_img = imagecreatefromgif($image);
214
-								break;
215
-							case 'jpg':
216
-								$source_img = imagecreatefromjpeg($image);
217
-								break;
218
-							case 'jpeg':
219
-								$source_img = imagecreatefromjpeg($image);
220
-								break;
221
-							case 'png':
222
-								$source_img = imagecreatefrompng($image);
223
-								break;
224
-						}
209
+                        $original_image_size = api_getimagesize($image);
210
+
211
+                        switch($imagetype) {
212
+                            case 'gif':
213
+                                $source_img = imagecreatefromgif($image);
214
+                                break;
215
+                            case 'jpg':
216
+                                $source_img = imagecreatefromjpeg($image);
217
+                                break;
218
+                            case 'jpeg':
219
+                                $source_img = imagecreatefromjpeg($image);
220
+                                break;
221
+                            case 'png':
222
+                                $source_img = imagecreatefrompng($image);
223
+                                break;
224
+                        }
225 225
 
226 226
                         $new_thumbnail_size = api_calculate_image_size(
227 227
                             $original_image_size['width'],
@@ -229,33 +229,33 @@  discard block
 block discarded – undo
229 229
                             $max_thumbnail_width,
230 230
                             $max_thumbnail_height
231 231
                         );
232
-						if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
233
-							$new_thumbnail_size['width']=$original_image_size['width'];
234
-							$new_thumbnail_size['height']=$original_image_size['height'];
235
-						}
236
-
237
-						$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238
-
239
-						// preserve transparency
240
-						if ($imagetype == "png"){
241
-							imagesavealpha($crop, true);
242
-							$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
-							imagefill($crop, 0, 0, $color);
244
-						}
245
-
246
-						if ($imagetype == "gif") {
247
-							$transindex = imagecolortransparent($source_img);
232
+                        if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
233
+                            $new_thumbnail_size['width']=$original_image_size['width'];
234
+                            $new_thumbnail_size['height']=$original_image_size['height'];
235
+                        }
236
+
237
+                        $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238
+
239
+                        // preserve transparency
240
+                        if ($imagetype == "png"){
241
+                            imagesavealpha($crop, true);
242
+                            $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
+                            imagefill($crop, 0, 0, $color);
244
+                        }
245
+
246
+                        if ($imagetype == "gif") {
247
+                            $transindex = imagecolortransparent($source_img);
248 248
                             $palletsize = imagecolorstotal($source_img);
249
-							 //GIF89a for transparent and anim (first clip), either GIF87a
250
-							 if ($transindex >= 0 && $transindex < $palletsize){
251
-								 $transcol = imagecolorsforindex($source_img, $transindex);
252
-								 $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253
-								 imagefill($crop, 0, 0, $transindex);
254
-								 imagecolortransparent($crop, $transindex);
255
-							 }
256
-						}
257
-
258
-						//resampled image
249
+                                //GIF89a for transparent and anim (first clip), either GIF87a
250
+                                if ($transindex >= 0 && $transindex < $palletsize){
251
+                                    $transcol = imagecolorsforindex($source_img, $transindex);
252
+                                    $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253
+                                    imagefill($crop, 0, 0, $transindex);
254
+                                    imagecolortransparent($crop, $transindex);
255
+                                }
256
+                        }
257
+
258
+                        //resampled image
259 259
                         imagecopyresampled(
260 260
                             $crop,
261 261
                             $source_img,
@@ -269,69 +269,69 @@  discard block
 block discarded – undo
269 269
                             $original_image_size['height']
270 270
                         );
271 271
 
272
-						switch ($imagetype) {
273
-							case 'gif':
274
-								imagegif($crop,$image_thumbnail);
275
-								break;
276
-							case 'jpg':
277
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
-								break;
279
-							case 'jpeg':
280
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
-								break;
282
-							case 'png':
283
-								imagepng($crop,$image_thumbnail,$png_compression);
284
-								break;
285
-						}
286
-
287
-						//clean memory
288
-						imagedestroy($crop);
289
-					}//end !exist thumbnail
290
-
291
-					//show thumbnail and link
292
-
293
-					$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
-					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295
-					$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296
-				} else {
297
-					//if images aren't support by gd (not gif, jpg, jpeg, png)
298
-					if ($imagetype=="bmp") {
272
+                        switch ($imagetype) {
273
+                            case 'gif':
274
+                                imagegif($crop,$image_thumbnail);
275
+                                break;
276
+                            case 'jpg':
277
+                                imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
+                                break;
279
+                            case 'jpeg':
280
+                                imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
+                                break;
282
+                            case 'png':
283
+                                imagepng($crop,$image_thumbnail,$png_compression);
284
+                                break;
285
+                        }
286
+
287
+                        //clean memory
288
+                        imagedestroy($crop);
289
+                    }//end !exist thumbnail
290
+
291
+                    //show thumbnail and link
292
+
293
+                    $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
+                    $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295
+                    $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296
+                } else {
297
+                    //if images aren't support by gd (not gif, jpg, jpeg, png)
298
+                    if ($imagetype=="bmp") {
299 299
                         // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy
300
-						$original_image_size = getimagesize($image);
301
-						if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
302
-							$thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
303
-							$image_height = $thumbnail_size['height'];
304
-							$image_width  = $thumbnail_size['width'];
305
-						} else {
306
-							$image_height=$original_image_size[0];
307
-							$image_width=$original_image_size[1];
308
-						}
309
-					} else {
310
-						//example for svg files,...
311
-						$image_width=$max_thumbnail_width;
312
-						$image_height=$max_thumbnail_height;
313
-					}
314
-
315
-					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
316
-					$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
317
-
318
-				}//end allowed image types
319
-			}//end if exist file image
320
-		}//end foreach
321
-	}//end image files only
322
-
323
-	// Creating the table
324
-	$html_table = '';
325
-
326
-	$i = 0;
327
-	$count_image = count($image_tag);
328
-	$number_iteration = ceil($count_image/$number_image);
329
-	$p = 0;
300
+                        $original_image_size = getimagesize($image);
301
+                        if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
302
+                            $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
303
+                            $image_height = $thumbnail_size['height'];
304
+                            $image_width  = $thumbnail_size['width'];
305
+                        } else {
306
+                            $image_height=$original_image_size[0];
307
+                            $image_width=$original_image_size[1];
308
+                        }
309
+                    } else {
310
+                        //example for svg files,...
311
+                        $image_width=$max_thumbnail_width;
312
+                        $image_height=$max_thumbnail_height;
313
+                    }
314
+
315
+                    $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
316
+                    $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
317
+
318
+                }//end allowed image types
319
+            }//end if exist file image
320
+        }//end foreach
321
+    }//end image files only
322
+
323
+    // Creating the table
324
+    $html_table = '';
325
+
326
+    $i = 0;
327
+    $count_image = count($image_tag);
328
+    $number_iteration = ceil($count_image/$number_image);
329
+    $p = 0;
330 330
     $html = '';
331 331
     $html .= '<div class="gallery">';
332
-	for ($k = 0; $k < $number_iteration; $k++) {
333
-		for ($i = 0; $i < $number_image; $i++) {
334
-			if (isset($image_tag[$p])) {
332
+    for ($k = 0; $k < $number_iteration; $k++) {
333
+        for ($i = 0; $i < $number_image; $i++) {
334
+            if (isset($image_tag[$p])) {
335 335
                             $html .= '<div class="col-xs-6 col-sm-3 col-md-2">';
336 336
                             $html .= '<div class="canvas-one">';
337 337
                             $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
                             $html .= '</a>';
344 344
                             $html .= '</div>';
345 345
                             $html .= '</div>';
346
-			}
347
-			$p++;
348
-		}
349
-	}
346
+            }
347
+            $p++;
348
+        }
349
+    }
350 350
     $html .= '</div>';
351 351
 
352 352
 }//end slide==all
@@ -357,43 +357,43 @@  discard block
 block discarded – undo
357 357
 // This is for viewing all the images in the slideshow one at a time.
358 358
 
359 359
 if ($slide_id != 'all' && !empty($image_files_only)) {
360
-	if (file_exists($image) && is_file($image)) {
361
-		$image_height_width = resize_image($image, $target_width, $target_height);
362
-
363
-		$image_height = $image_height_width[0];
364
-		$image_width = $image_height_width[1];
365
-
366
-		$height_width_tags = null;
367
-		if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
368
-			$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
369
-		}
370
-
371
-		// This is done really quickly and should be cleaned up a little bit using the API functions
372
-		$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
373
-		if ($path == '/') {
374
-			$pathpart = '/';
375
-		} else {
376
-			$pathpart = $path.'/';
377
-		}
378
-		$sql = "SELECT * FROM $tbl_documents
360
+    if (file_exists($image) && is_file($image)) {
361
+        $image_height_width = resize_image($image, $target_width, $target_height);
362
+
363
+        $image_height = $image_height_width[0];
364
+        $image_width = $image_height_width[1];
365
+
366
+        $height_width_tags = null;
367
+        if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
368
+            $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
369
+        }
370
+
371
+        // This is done really quickly and should be cleaned up a little bit using the API functions
372
+        $tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
373
+        if ($path == '/') {
374
+            $pathpart = '/';
375
+        } else {
376
+            $pathpart = $path.'/';
377
+        }
378
+        $sql = "SELECT * FROM $tbl_documents
379 379
 		        WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
380
-		$result = Database::query($sql);
381
-		$row = Database::fetch_array($result);
380
+        $result = Database::query($sql);
381
+        $row = Database::fetch_array($result);
382 382
 
383 383
         echo '<div class="thumbnail">';
384
-		if ($slide < $total_slides - 1 && $slide_id != 'all') {
385
-			echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
386
-		} else {
387
-			echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
388
-		}
384
+        if ($slide < $total_slides - 1 && $slide_id != 'all') {
385
+            echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
386
+        } else {
387
+            echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
388
+        }
389 389
         if ($path == '/') {
390
-        	$path = '';
390
+            $path = '';
391 391
         }
392 392
 
393
-		list($width, $height) = getimagesize($image);
394
-		// Auto resize
395
-		if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
396
-		?>
393
+        list($width, $height) = getimagesize($image);
394
+        // Auto resize
395
+        if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
396
+        ?>
397 397
 
398 398
 		<script type="text/javascript">
399 399
 			var initial_width='<?php echo $width; ?>';
@@ -446,21 +446,21 @@  discard block
 block discarded – undo
446 446
 
447 447
 		</script>
448 448
     <?php
449
-		} else {
450
-			echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
451
-		}
449
+        } else {
450
+            echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
451
+        }
452 452
 
453
-		echo '</a>';
453
+        echo '</a>';
454 454
         echo '<div class="caption text-center">';
455 455
         echo Display::tag('h3', $row['title']);
456 456
         echo '<p>' . $row['comment'] . '</p>';
457 457
         echo '</div>';
458 458
         echo '</div>';
459 459
 
460
-		if (api_is_allowed_to_edit(null, true)) {
460
+        if (api_is_allowed_to_edit(null, true)) {
461 461
             echo '<ul class="list-unstyled">';
462
-			$aux = explode('.', htmlspecialchars($image_files_only[$slide]));
463
-			$ext = $aux[count($aux) - 1];
462
+            $aux = explode('.', htmlspecialchars($image_files_only[$slide]));
463
+            $ext = $aux[count($aux) - 1];
464 464
 
465 465
             if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
466 466
                 $resize_info = get_lang('Resizing').'<br />';
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
                 $resize_height = get_lang('Auto');
473 473
             } else {
474 474
                 $resize_info = get_lang('NoResizing').'<br />';
475
-				$resize_width = '';
476
-				$resize_height = '';
475
+                $resize_width = '';
476
+                $resize_height = '';
477 477
             }
478 478
 
479 479
             echo '<li class="text-center">';
@@ -493,16 +493,16 @@  discard block
 block discarded – undo
493 493
             );
494 494
             echo '</li>';
495 495
             echo '<li class="text-center">' . $width.' x '.$height . '</li>';
496
-			echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>';
496
+            echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>';
497 497
             echo '<li class="text-center">' . $resize_info . '</li>';
498
-			echo '<li class="text-center">' . $resize_width . '</li>';
499
-			echo '<li class="text-center">' . $resize_height . '</li>';
498
+            echo '<li class="text-center">' . $resize_width . '</li>';
499
+            echo '<li class="text-center">' . $resize_height . '</li>';
500 500
             echo '</ul>';
501
-		}
501
+        }
502 502
 
503
-	} else {
504
-		Display::display_warning_message(get_lang('FileNotFound'));
505
-	}
503
+    } else {
504
+        Display::display_warning_message(get_lang('FileNotFound'));
505
+    }
506 506
 } else {
507 507
     if ($slide_id != 'all') {
508 508
         Display::display_warning_message(get_lang('NoDataAvailable'));
Please login to merge, or discard this patch.
main/course_description/index.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
 $actions = array('listing', 'add', 'edit', 'delete', 'history');
25 25
 $action = 'listing';
26 26
 if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
27
-	$action = $_GET['action'];
27
+    $action = $_GET['action'];
28 28
 }
29 29
 
30 30
 $description_type = '';
31 31
 if (isset($_GET['description_type'])) {
32
-	$description_type = intval($_GET['description_type']);
32
+    $description_type = intval($_GET['description_type']);
33 33
 }
34 34
 
35 35
 $id = null;
Please login to merge, or discard this patch.
main/course_description/add.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,39 +13,39 @@  discard block
 block discarded – undo
13 13
 // display categories
14 14
 $categories = array ();
15 15
 foreach ($default_description_titles as $id => $title) {
16
-	$categories[$id] = $title;
16
+    $categories[$id] = $title;
17 17
 }
18 18
 $categories[ADD_BLOCK] = get_lang('NewBloc');
19 19
 
20 20
 $i=1;
21 21
 echo '<div class="actions" style="margin-bottom:30px">';
22 22
 echo '<a href="index.php?'.api_get_cidreq().'">'.
23
-	Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
24
-	'</a>';
23
+    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
24
+    '</a>';
25 25
 ksort($categories);
26 26
 foreach ($categories as $id => $title) {
27
-	if ($i == ADD_BLOCK) {
28
-		echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
29
-			Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
30
-		break;
31
-	} else {
32
-		echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
33
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
34
-		$i++;
35
-	}
27
+    if ($i == ADD_BLOCK) {
28
+        echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
29
+            Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
30
+        break;
31
+    } else {
32
+        echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
33
+            Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
34
+        $i++;
35
+    }
36 36
 }
37 37
 echo '</div>';
38 38
 
39 39
 // error messages
40 40
 if (isset($error) && intval($error) == 1) {
41
-	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
41
+    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
42 42
 }
43 43
 
44 44
 // default header title form
45 45
 $header = '';
46 46
 $description_type = intval($description_type);
47 47
 if ($description_type >= ADD_BLOCK) {
48
-	$header = $default_description_titles[ADD_BLOCK];
48
+    $header = $default_description_titles[ADD_BLOCK];
49 49
 }
50 50
 
51 51
 // display form
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 
75 75
 // display default questions
76 76
 if (isset ($question[$description_type])) {
77
-	$message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
78
-	$message .= $question[$description_type];
79
-	Display::display_normal_message($message, false);
77
+    $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
78
+    $message .= $question[$description_type];
79
+    Display::display_normal_message($message, false);
80 80
 }
81 81
 $form->display();
Please login to merge, or discard this patch.
main/reports/templates/exercicesMultiCourses.reports.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $reports_template['exercicesMultiCourses'] = array(
4
-	'description' => 'Result of each test per student',
5
-	'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
6
-	'wizard' =>
4
+    'description' => 'Result of each test per student',
5
+    'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
6
+    'wizard' =>
7 7
 '
8 8
 <span id="exercicesMultiCourses" class="step">
9 9
 	<span class="font_normal_07em_black">Result of each test per student</span><br />
@@ -32,39 +32,39 @@  discard block
 block discarded – undo
32 32
 ');
33 33
 
34 34
 function reports_template_exercicesMultiCourses_getSQL() {
35
-	// foreach quiz
36
-	$result = array();
37
-	$columns = Database::query('select r.id as kid, c.title as course, '.
38
-		'r.child_name as test from '.
39
-		Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
40
-		Database::get_main_table(TABLE_MAIN_COURSE).' c '.
41
-		'where r.course_id=c.id and r.tool_id='.
42
-		reports_getToolId(TOOL_QUIZ).
43
-		' order by r.course_id, r.child_name');
44
-	if (Database::num_rows($columns) == 0)
45
-		die('<b>'.get_lang('no data found').'</b>');
46
-	$query = 'select u.lastname Name, u.firstname Firstname';
47
-	$columns = Database::store_result($columns);
48
-	if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
49
-		$function = $_REQUEST['tattempt'];
50
-	else
51
-		$function = 'avg';
52
-	foreach ($columns as $key => $column)
53
-		$query .= ', '.$function.'(k'.$key.'.score) as `'.
54
-				$column['course'].' - '.
55
-				$column['test'].'` ';
56
-	$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
57
-	foreach ($columns as $key => $column) // fixme sessions
58
-		$query .= 'left outer join '.
59
-			Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
60
-			' k'.$key.
61
-			' on k'.$key.'.key_id = '.$column['kid'].
62
-				' and k'.$key.'.user_id = u.user_id ';
63
-	$query .= ' group by ';
64
-	foreach ($columns as $key => $column) // grouping attempt
65
-		$query .= 'k'.$key.'.attempt, ';
66
-	$query = substr($query, 0, -2); // removing last ', ';
35
+    // foreach quiz
36
+    $result = array();
37
+    $columns = Database::query('select r.id as kid, c.title as course, '.
38
+        'r.child_name as test from '.
39
+        Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
40
+        Database::get_main_table(TABLE_MAIN_COURSE).' c '.
41
+        'where r.course_id=c.id and r.tool_id='.
42
+        reports_getToolId(TOOL_QUIZ).
43
+        ' order by r.course_id, r.child_name');
44
+    if (Database::num_rows($columns) == 0)
45
+        die('<b>'.get_lang('no data found').'</b>');
46
+    $query = 'select u.lastname Name, u.firstname Firstname';
47
+    $columns = Database::store_result($columns);
48
+    if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
49
+        $function = $_REQUEST['tattempt'];
50
+    else
51
+        $function = 'avg';
52
+    foreach ($columns as $key => $column)
53
+        $query .= ', '.$function.'(k'.$key.'.score) as `'.
54
+                $column['course'].' - '.
55
+                $column['test'].'` ';
56
+    $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
57
+    foreach ($columns as $key => $column) // fixme sessions
58
+        $query .= 'left outer join '.
59
+            Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
60
+            ' k'.$key.
61
+            ' on k'.$key.'.key_id = '.$column['kid'].
62
+                ' and k'.$key.'.user_id = u.user_id ';
63
+    $query .= ' group by ';
64
+    foreach ($columns as $key => $column) // grouping attempt
65
+        $query .= 'k'.$key.'.attempt, ';
66
+    $query = substr($query, 0, -2); // removing last ', ';
67 67
 
68 68
 
69
-	return $query;
69
+    return $query;
70 70
 }
Please login to merge, or discard this patch.