@@ -107,14 +107,14 @@ |
||
107 | 107 | return $resu; |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * @author Sebastien Piraux <[email protected]> |
|
112 | - * @param sql : a sql query (as a string) |
|
113 | - * @return hours_array |
|
114 | - * @desc Return an assoc array. Keys are the hours, values are |
|
115 | - * the number of time this hours was found. |
|
116 | - * key 'total' return the sum of all number of time hours |
|
117 | - * appear |
|
110 | + /** |
|
111 | + * @author Sebastien Piraux <[email protected]> |
|
112 | + * @param sql : a sql query (as a string) |
|
113 | + * @return hours_array |
|
114 | + * @desc Return an assoc array. Keys are the hours, values are |
|
115 | + * the number of time this hours was found. |
|
116 | + * key 'total' return the sum of all number of time hours |
|
117 | + * appear |
|
118 | 118 | */ |
119 | 119 | public static function hoursTab($sql) |
120 | 120 | { |
@@ -5,42 +5,42 @@ |
||
5 | 5 | * @deprecated Don't use this class |
6 | 6 | */ |
7 | 7 | class Rights { |
8 | - private static $rights_cache = array(); |
|
9 | - private static $rights = array ( |
|
10 | - 'show_tabs:reports' => |
|
11 | - array ( |
|
12 | - 'type' => 'const', |
|
13 | - 'const' => 'true' ) |
|
14 | - ); |
|
8 | + private static $rights_cache = array(); |
|
9 | + private static $rights = array ( |
|
10 | + 'show_tabs:reports' => |
|
11 | + array ( |
|
12 | + 'type' => 'const', |
|
13 | + 'const' => 'true' ) |
|
14 | + ); |
|
15 | 15 | |
16 | - // warning the goal of this function is to enforce rights managment in Chamilo |
|
17 | - // thus default return value is always true |
|
18 | - public static function hasRight($handler) { |
|
19 | - if (array_key_exists($handler, self::$rights_cache)) |
|
20 | - return self::$rights_cache[$handler]; |
|
16 | + // warning the goal of this function is to enforce rights managment in Chamilo |
|
17 | + // thus default return value is always true |
|
18 | + public static function hasRight($handler) { |
|
19 | + if (array_key_exists($handler, self::$rights_cache)) |
|
20 | + return self::$rights_cache[$handler]; |
|
21 | 21 | |
22 | - if (!array_key_exists($handler, self::$rights)) |
|
23 | - return true; // handler does not exists |
|
22 | + if (!array_key_exists($handler, self::$rights)) |
|
23 | + return true; // handler does not exists |
|
24 | 24 | |
25 | - if (self::$rights[$handler]['type'] == 'sql') { |
|
26 | - $result = Database::query(self::$rights[$handler]['sql']); |
|
27 | - if (Database::num_rows($result) > 0) |
|
28 | - $result = true; |
|
29 | - else |
|
30 | - $result = false; |
|
31 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
32 | - $result = self::$rights[$handler]['const']; |
|
33 | - else if (self::$rights[$handler]['type'] == 'func') |
|
34 | - $result = self::$rights[$handler]['func'](); |
|
35 | - else // handler type not implemented |
|
36 | - return true; |
|
37 | - self::$rights_cache[$handler] = $result; |
|
38 | - return $result; |
|
39 | - } |
|
25 | + if (self::$rights[$handler]['type'] == 'sql') { |
|
26 | + $result = Database::query(self::$rights[$handler]['sql']); |
|
27 | + if (Database::num_rows($result) > 0) |
|
28 | + $result = true; |
|
29 | + else |
|
30 | + $result = false; |
|
31 | + } else if (self::$rights[$handler]['type'] == 'const') |
|
32 | + $result = self::$rights[$handler]['const']; |
|
33 | + else if (self::$rights[$handler]['type'] == 'func') |
|
34 | + $result = self::$rights[$handler]['func'](); |
|
35 | + else // handler type not implemented |
|
36 | + return true; |
|
37 | + self::$rights_cache[$handler] = $result; |
|
38 | + return $result; |
|
39 | + } |
|
40 | 40 | |
41 | - public static function hasRightClosePageWithError($handler) { |
|
42 | - if (hasRight($handler) == false) |
|
43 | - die("You are not allowed here"); //FIXME |
|
44 | - } |
|
41 | + public static function hasRightClosePageWithError($handler) { |
|
42 | + if (hasRight($handler) == false) |
|
43 | + die("You are not allowed here"); //FIXME |
|
44 | + } |
|
45 | 45 | |
46 | 46 | } |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | * @todo convert queries to use Database API |
13 | 13 | */ |
14 | 14 | /** |
15 | - * Class |
|
16 | - * @package chamilo.library |
|
17 | - */ |
|
15 | + * Class |
|
16 | + * @package chamilo.library |
|
17 | + */ |
|
18 | 18 | class ExerciseShowFunctions |
19 | 19 | { |
20 | - /** |
|
21 | - * Shows the answer to a fill-in-the-blanks question, as HTML |
|
22 | - * @param string Answer text |
|
23 | - * @param int Exercise ID |
|
24 | - * @param int Question ID |
|
20 | + /** |
|
21 | + * Shows the answer to a fill-in-the-blanks question, as HTML |
|
22 | + * @param string Answer text |
|
23 | + * @param int Exercise ID |
|
24 | + * @param int Question ID |
|
25 | 25 | * @param int $resultsDisabled |
26 | 26 | * @param string $originalStudentAnswer |
27 | - * @return void |
|
28 | - */ |
|
29 | - public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
27 | + * @return void |
|
28 | + */ |
|
29 | + public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
30 | 30 | { |
31 | 31 | $answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled); |
32 | 32 | if (strpos($originalStudentAnswer, 'font color') !== false) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | </tr> |
56 | 56 | <?php |
57 | 57 | } |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Shows the answer to a calculated question, as HTML |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - /** |
|
94 | - * Shows the answer to a free-answer question, as HTML |
|
95 | - * @param string Answer text |
|
96 | - * @param int Exercise ID |
|
97 | - * @param int Question ID |
|
98 | - * @return void |
|
99 | - */ |
|
100 | - static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
93 | + /** |
|
94 | + * Shows the answer to a free-answer question, as HTML |
|
95 | + * @param string Answer text |
|
96 | + * @param int Exercise ID |
|
97 | + * @param int Question ID |
|
98 | + * @return void |
|
99 | + */ |
|
100 | + static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
101 | 101 | { |
102 | 102 | $comments = Event::get_comments($exe_id, $questionId); |
103 | 103 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | echo '</tr>'; |
116 | 116 | } |
117 | 117 | } |
118 | - } |
|
118 | + } |
|
119 | 119 | |
120 | - static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
120 | + static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
121 | 121 | { |
122 | 122 | if (isset($nano)) { |
123 | 123 | echo $nano->show_audio_file(); |
@@ -151,22 +151,22 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - /** |
|
155 | - * Displays the answer to a hotspot question |
|
156 | - * |
|
157 | - * @param int $answerId |
|
158 | - * @param string $answer |
|
159 | - * @param string $studentChoice |
|
160 | - * @param string $answerComment |
|
161 | - */ |
|
162 | - static function display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $in_results_disabled) |
|
163 | - { |
|
154 | + /** |
|
155 | + * Displays the answer to a hotspot question |
|
156 | + * |
|
157 | + * @param int $answerId |
|
158 | + * @param string $answer |
|
159 | + * @param string $studentChoice |
|
160 | + * @param string $answerComment |
|
161 | + */ |
|
162 | + static function display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $in_results_disabled) |
|
163 | + { |
|
164 | 164 | $hide_expected_answer = false; |
165 | 165 | if ($feedback_type == 0 && $in_results_disabled == 2) { |
166 | 166 | $hide_expected_answer = true; |
167 | 167 | } |
168 | 168 | |
169 | - $hotspot_colors = array( |
|
169 | + $hotspot_colors = array( |
|
170 | 170 | "", // $i starts from 1 on next loop (ugly fix) |
171 | 171 | "#4271B5", |
172 | 172 | "#FE8E16", |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | "#ED2024", |
182 | 182 | "#3B3B3B", |
183 | 183 | "#F7BDE2"); |
184 | - ?> |
|
184 | + ?> |
|
185 | 185 | <table class="data_table"> |
186 | 186 | <tr> |
187 | 187 | <td class="text-center" width="5%"> |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | <td class="text-left" width="10%"> |
194 | 194 | <?php |
195 | 195 | if (!$hide_expected_answer) { |
196 | - $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
197 | - echo $my_choice; |
|
196 | + $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
197 | + echo $my_choice; |
|
198 | 198 | } |
199 | - ?> |
|
199 | + ?> |
|
200 | 200 | </td> |
201 | 201 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
202 | 202 | <td class="text-left" width="60%"> |
@@ -204,29 +204,29 @@ discard block |
||
204 | 204 | if ($studentChoice) { |
205 | 205 | echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
206 | 206 | } |
207 | - ?> |
|
207 | + ?> |
|
208 | 208 | </td> |
209 | 209 | <?php } else { ?> |
210 | 210 | <td class="text-left" width="60%"> </td> |
211 | 211 | <?php } ?> |
212 | 212 | </tr> |
213 | 213 | <?php |
214 | - } |
|
214 | + } |
|
215 | 215 | |
216 | - /** |
|
217 | - * Display the answers to a multiple choice question |
|
218 | - * @param int $feedback_type Feedback type |
|
219 | - * @param integer Answer type |
|
220 | - * @param integer Student choice |
|
221 | - * @param string Textual answer |
|
222 | - * @param string Comment on answer |
|
223 | - * @param string Correct answer comment |
|
224 | - * @param integer Exercise ID |
|
225 | - * @param integer Question ID |
|
226 | - * @param boolean Whether to show the answer comment or not |
|
227 | - * @return void |
|
228 | - */ |
|
229 | - static function display_unique_or_multiple_answer( |
|
216 | + /** |
|
217 | + * Display the answers to a multiple choice question |
|
218 | + * @param int $feedback_type Feedback type |
|
219 | + * @param integer Answer type |
|
220 | + * @param integer Student choice |
|
221 | + * @param string Textual answer |
|
222 | + * @param string Comment on answer |
|
223 | + * @param string Correct answer comment |
|
224 | + * @param integer Exercise ID |
|
225 | + * @param integer Question ID |
|
226 | + * @param boolean Whether to show the answer comment or not |
|
227 | + * @return void |
|
228 | + */ |
|
229 | + static function display_unique_or_multiple_answer( |
|
230 | 230 | $feedback_type, |
231 | 231 | $answerType, |
232 | 232 | $studentChoice, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if ($feedback_type == 0 && $in_results_disabled == 2) { |
244 | 244 | $hide_expected_answer = true; |
245 | 245 | } |
246 | - ?> |
|
246 | + ?> |
|
247 | 247 | <tr> |
248 | 248 | <td width="5%"> |
249 | 249 | <img src="../img/<?php echo (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION))) ? 'radio':'checkbox'; echo $studentChoice?'_on':'_off'; ?>.gif" |
@@ -259,43 +259,43 @@ discard block |
||
259 | 259 | </td> |
260 | 260 | <td width="40%"> |
261 | 261 | <?php |
262 | - echo $answer; |
|
263 | - ?> |
|
262 | + echo $answer; |
|
263 | + ?> |
|
264 | 264 | </td> |
265 | 265 | |
266 | 266 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
267 | 267 | <td width="20%"> |
268 | 268 | <?php |
269 | 269 | if ($studentChoice) { |
270 | - if ($answerCorrect) { |
|
270 | + if ($answerCorrect) { |
|
271 | 271 | $color = 'green'; |
272 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
273 | - } else { |
|
272 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
273 | + } else { |
|
274 | 274 | $color = 'black'; |
275 | 275 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
276 | - } |
|
276 | + } |
|
277 | 277 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
278 | 278 | |
279 | - } else { |
|
280 | - if ($answerCorrect) { |
|
281 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
282 | - } else { |
|
279 | + } else { |
|
280 | + if ($answerCorrect) { |
|
281 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
282 | + } else { |
|
283 | 283 | //echo '<span style="font-weight: normal; color: #000;">'.nl2br($answerComment).'</span>'; |
284 | - } |
|
285 | - } |
|
286 | - ?> |
|
284 | + } |
|
285 | + } |
|
286 | + ?> |
|
287 | 287 | </td> |
288 | 288 | <?php |
289 | - if ($ans==1) { |
|
290 | - $comm = Event::get_comments($id,$questionId); |
|
291 | - } |
|
292 | - ?> |
|
289 | + if ($ans==1) { |
|
290 | + $comm = Event::get_comments($id,$questionId); |
|
291 | + } |
|
292 | + ?> |
|
293 | 293 | <?php } else { ?> |
294 | 294 | <td> </td> |
295 | 295 | <?php } ?> |
296 | 296 | </tr> |
297 | 297 | <?php |
298 | - } |
|
298 | + } |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Display the answers to a multiple choice question |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | if (isset($new_options[$studentChoice])) { |
340 | 340 | echo get_lang($new_options[$studentChoice]['name']); |
341 | 341 | } else { |
342 | - echo '-'; |
|
342 | + echo '-'; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | ?> |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | <td width="5%"> |
348 | 348 | <?php |
349 | 349 | |
350 | - //Expected choice |
|
350 | + //Expected choice |
|
351 | 351 | if (!$hide_expected_answer) { |
352 | 352 | if (isset($new_options[$answerCorrect])) { |
353 | 353 | echo get_lang($new_options[$answerCorrect]['name']); |
@@ -387,19 +387,19 @@ discard block |
||
387 | 387 | <?php |
388 | 388 | } |
389 | 389 | |
390 | - /** |
|
391 | - * Display the answers to a multiple choice question |
|
392 | - * |
|
393 | - * @param integer Answer type |
|
394 | - * @param integer Student choice |
|
395 | - * @param string Textual answer |
|
396 | - * @param string Comment on answer |
|
397 | - * @param string Correct answer comment |
|
398 | - * @param integer Exercise ID |
|
399 | - * @param integer Question ID |
|
400 | - * @param boolean Whether to show the answer comment or not |
|
401 | - * @return void |
|
402 | - */ |
|
390 | + /** |
|
391 | + * Display the answers to a multiple choice question |
|
392 | + * |
|
393 | + * @param integer Answer type |
|
394 | + * @param integer Student choice |
|
395 | + * @param string Textual answer |
|
396 | + * @param string Comment on answer |
|
397 | + * @param string Correct answer comment |
|
398 | + * @param integer Exercise ID |
|
399 | + * @param integer Question ID |
|
400 | + * @param boolean Whether to show the answer comment or not |
|
401 | + * @return void |
|
402 | + */ |
|
403 | 403 | static function display_multiple_answer_combination_true_false( |
404 | 404 | $feedback_type, |
405 | 405 | $answerType, |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | <tr> |
421 | 421 | <td width="5%"> |
422 | 422 | <?php |
423 | - //Your choice |
|
423 | + //Your choice |
|
424 | 424 | $question = new MultipleAnswerCombinationTrueFalse(); |
425 | 425 | if (isset($question->options[$studentChoice])) { |
426 | 426 | echo $question->options[$studentChoice]; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | </td> |
432 | 432 | <td width="5%"> |
433 | 433 | <?php |
434 | - //Expected choice |
|
434 | + //Expected choice |
|
435 | 435 | if (!$hide_expected_answer) { |
436 | 436 | if (isset($question->options[$answerCorrect])) { |
437 | 437 | echo $question->options[$answerCorrect]; |
@@ -456,20 +456,20 @@ discard block |
||
456 | 456 | <?php |
457 | 457 | //@todo replace this harcoded value |
458 | 458 | if ($studentChoice) { |
459 | - $color = "black"; |
|
459 | + $color = "black"; |
|
460 | 460 | if ($studentChoice == $answerCorrect) { |
461 | 461 | $color = "green"; |
462 | 462 | } |
463 | 463 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
464 | 464 | } |
465 | 465 | if ($studentChoice == 2 || $studentChoice == '') { |
466 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
466 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
467 | 467 | } else { |
468 | - if ($studentChoice == $answerCorrect) { |
|
469 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
470 | - } else { |
|
468 | + if ($studentChoice == $answerCorrect) { |
|
469 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
470 | + } else { |
|
471 | 471 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
472 | - } |
|
472 | + } |
|
473 | 473 | } |
474 | 474 | ?> |
475 | 475 | </td> |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This is a library with some functions to sort tabular data |
|
5 | - * |
|
6 | - * @package chamilo.library |
|
7 | - */ |
|
4 | + * This is a library with some functions to sort tabular data |
|
5 | + * |
|
6 | + * @package chamilo.library |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | define('SORT_DATE', 3); |
10 | 10 | define('SORT_IMAGE', 4); |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | class TableSort |
16 | 16 | { |
17 | 17 | /** |
18 | - * Sorts 2-dimensional table. |
|
19 | - * @param array $data The data to be sorted. |
|
20 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | - * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | - * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | - * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | - * @return array The sorted dataset |
|
25 | - * @author [email protected] |
|
26 | - */ |
|
27 | - public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
18 | + * Sorts 2-dimensional table. |
|
19 | + * @param array $data The data to be sorted. |
|
20 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | + * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | + * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | + * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | + * @return array The sorted dataset |
|
25 | + * @author [email protected] |
|
26 | + */ |
|
27 | + public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
28 | 28 | { |
29 | 29 | if (!is_array($data) || empty($data)) { |
30 | 30 | return array(); |
@@ -71,20 +71,20 @@ discard block |
||
71 | 71 | usort($data, create_function('$a, $b', $compare_function)); |
72 | 72 | |
73 | 73 | return $data; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | - * @param array $data The data to be sorted. |
|
79 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | - * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | - * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
82 | - * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | - * @return array The sorted dataset |
|
85 | - * @author [email protected] |
|
86 | - */ |
|
87 | - public static function sort_table_config( |
|
76 | + /** |
|
77 | + * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | + * @param array $data The data to be sorted. |
|
79 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | + * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | + * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
82 | + * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
83 | + * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | + * @return array The sorted dataset |
|
85 | + * @author [email protected] |
|
86 | + */ |
|
87 | + public static function sort_table_config( |
|
88 | 88 | $data, |
89 | 89 | $column = 0, |
90 | 90 | $direction = SORT_ASC, |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | if (!empty($data)) { |
133 | 133 | foreach ($data as $document) { |
134 | 134 | if ($document['type'] == 'folder') { |
135 | - $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
135 | + $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
136 | 136 | } else { |
137 | - $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
137 | + $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
138 | 138 | } |
139 | 139 | $new_data[$document['id']] = $document; |
140 | 140 | } |
@@ -196,91 +196,91 @@ discard block |
||
196 | 196 | usort($data, create_function('$a, $b', $compare_function)); |
197 | 197 | } |
198 | 198 | |
199 | - if (is_array($column_show) && !empty($column_show)) { |
|
199 | + if (is_array($column_show) && !empty($column_show)) { |
|
200 | 200 | |
201 | - // We show only the columns data that were set up on the $column_show array |
|
202 | - $new_order_data = array(); |
|
203 | - $count_data = count($data); |
|
204 | - $count_column_show = count($column_show); |
|
205 | - for ($j = 0; $j < $count_data; $j++) { |
|
206 | - $k = 0; |
|
207 | - for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | - if ($column_show[$i]) { |
|
209 | - $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | - } |
|
211 | - $k++; |
|
212 | - } |
|
213 | - } |
|
214 | - // Replace the multi-arrays |
|
215 | - $data = $new_order_data; |
|
216 | - } |
|
201 | + // We show only the columns data that were set up on the $column_show array |
|
202 | + $new_order_data = array(); |
|
203 | + $count_data = count($data); |
|
204 | + $count_column_show = count($column_show); |
|
205 | + for ($j = 0; $j < $count_data; $j++) { |
|
206 | + $k = 0; |
|
207 | + for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | + if ($column_show[$i]) { |
|
209 | + $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | + } |
|
211 | + $k++; |
|
212 | + } |
|
213 | + } |
|
214 | + // Replace the multi-arrays |
|
215 | + $data = $new_order_data; |
|
216 | + } |
|
217 | 217 | |
218 | - return $data; |
|
219 | - } |
|
218 | + return $data; |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * Checks whether a column of a 2D-array contains only numeric values |
|
223 | - * @param array $data The data-array |
|
224 | - * @param int $column The index of the column to check |
|
225 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | - * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | - * @author [email protected] |
|
228 | - */ |
|
229 | - private static function is_numeric_column(& $data, $column) |
|
221 | + /** |
|
222 | + * Checks whether a column of a 2D-array contains only numeric values |
|
223 | + * @param array $data The data-array |
|
224 | + * @param int $column The index of the column to check |
|
225 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | + * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | + * @author [email protected] |
|
228 | + */ |
|
229 | + private static function is_numeric_column(& $data, $column) |
|
230 | 230 | { |
231 | - $is_numeric = true; |
|
232 | - foreach ($data as $index => & $row) { |
|
233 | - $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | - if (!$is_numeric) { |
|
235 | - break; |
|
236 | - } |
|
237 | - } |
|
238 | - return $is_numeric; |
|
239 | - } |
|
231 | + $is_numeric = true; |
|
232 | + foreach ($data as $index => & $row) { |
|
233 | + $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | + if (!$is_numeric) { |
|
235 | + break; |
|
236 | + } |
|
237 | + } |
|
238 | + return $is_numeric; |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | - * @param array $data The data-array |
|
244 | - * @param int $column The index of the column to check |
|
245 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | - * @author [email protected] |
|
247 | - */ |
|
248 | - private static function is_date_column(& $data, $column) |
|
241 | + /** |
|
242 | + * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | + * @param array $data The data-array |
|
244 | + * @param int $column The index of the column to check |
|
245 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | + * @author [email protected] |
|
247 | + */ |
|
248 | + private static function is_date_column(& $data, $column) |
|
249 | 249 | { |
250 | - $is_date = true; |
|
251 | - foreach ($data as $index => & $row) { |
|
252 | - if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | - $check_date = strtotime(strip_tags($row[$column])); |
|
254 | - // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | - // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | - $is_date &= ($check_date != -1 && $check_date); |
|
257 | - } else { |
|
258 | - $is_date &= false; |
|
259 | - } |
|
260 | - if (!$is_date) { |
|
261 | - break; |
|
262 | - } |
|
263 | - } |
|
264 | - return $is_date; |
|
265 | - } |
|
250 | + $is_date = true; |
|
251 | + foreach ($data as $index => & $row) { |
|
252 | + if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | + $check_date = strtotime(strip_tags($row[$column])); |
|
254 | + // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | + // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | + $is_date &= ($check_date != -1 && $check_date); |
|
257 | + } else { |
|
258 | + $is_date &= false; |
|
259 | + } |
|
260 | + if (!$is_date) { |
|
261 | + break; |
|
262 | + } |
|
263 | + } |
|
264 | + return $is_date; |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | - * @param array $data The data-array |
|
270 | - * @param int $column The index of the column to check |
|
271 | - * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | - * @author [email protected] |
|
273 | - */ |
|
274 | - private static function is_image_column(& $data, $column) |
|
267 | + /** |
|
268 | + * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | + * @param array $data The data-array |
|
270 | + * @param int $column The index of the column to check |
|
271 | + * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | + * @author [email protected] |
|
273 | + */ |
|
274 | + private static function is_image_column(& $data, $column) |
|
275 | 275 | { |
276 | - $is_image = true; |
|
277 | - foreach ($data as $index => & $row) { |
|
278 | - $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | - $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | - if (!$is_image) { |
|
281 | - break; |
|
282 | - } |
|
283 | - } |
|
284 | - return $is_image; |
|
285 | - } |
|
276 | + $is_image = true; |
|
277 | + foreach ($data as $index => & $row) { |
|
278 | + $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | + $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | + if (!$is_image) { |
|
281 | + break; |
|
282 | + } |
|
283 | + } |
|
284 | + return $is_image; |
|
285 | + } |
|
286 | 286 | } |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * @param string $pluginName |
|
177 | - * @param int $urlId |
|
178 | - */ |
|
176 | + * @param string $pluginName |
|
177 | + * @param int $urlId |
|
178 | + */ |
|
179 | 179 | public function uninstall($pluginName, $urlId = null) |
180 | 180 | { |
181 | 181 | if (empty($urlId)) { |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @param string $region |
|
256 | - * @param string $template |
|
257 | - * @param bool $forced |
|
258 | - * |
|
259 | - * @return null|string |
|
260 | - */ |
|
255 | + * @param string $region |
|
256 | + * @param string $template |
|
257 | + * @param bool $forced |
|
258 | + * |
|
259 | + * @return null|string |
|
260 | + */ |
|
261 | 261 | public function load_region($region, $template, $forced = false) |
262 | 262 | { |
263 | 263 | if ($region == 'course_tool_plugin') { |
@@ -167,9 +167,9 @@ |
||
167 | 167 | ini_set('session.use_cookies', $old_use_cookies); |
168 | 168 | session_cache_limiter($old_session_cache_limiter); |
169 | 169 | } else { |
170 | - if (isset($_OLD_SESSION)) { |
|
171 | - $_SESSION = $_OLD_SESSION; |
|
172 | - unset($_OLD_SESSION); |
|
170 | + if (isset($_OLD_SESSION)) { |
|
171 | + $_SESSION = $_OLD_SESSION; |
|
172 | + unset($_OLD_SESSION); |
|
173 | 173 | } else { |
174 | 174 | unset($_SESSION); |
175 | 175 | } |
@@ -257,27 +257,27 @@ discard block |
||
257 | 257 | switch ($hash) { |
258 | 258 | case 'md2': |
259 | 259 | $this->b = 16; |
260 | - $this->hash = array($this, '_md2'); |
|
261 | - break; |
|
260 | + $this->hash = array($this, '_md2'); |
|
261 | + break; |
|
262 | 262 | case 'md5': |
263 | 263 | case 'md5-96': |
264 | 264 | $this->b = 64; |
265 | - $this->hash = array($this, '_md5'); |
|
266 | - break; |
|
265 | + $this->hash = array($this, '_md5'); |
|
266 | + break; |
|
267 | 267 | case 'sha256': |
268 | 268 | $this->b = 64; |
269 | - $this->hash = array($this, '_sha256'); |
|
270 | - break; |
|
269 | + $this->hash = array($this, '_sha256'); |
|
270 | + break; |
|
271 | 271 | case 'sha384': |
272 | 272 | case 'sha512': |
273 | 273 | $this->b = 128; |
274 | - $this->hash = array($this, '_sha512'); |
|
275 | - break; |
|
274 | + $this->hash = array($this, '_sha512'); |
|
275 | + break; |
|
276 | 276 | case 'sha1': |
277 | 277 | case 'sha1-96': |
278 | 278 | default: |
279 | 279 | $this->b = 64; |
280 | - $this->hash = array($this, '_sha1'); |
|
280 | + $this->hash = array($this, '_sha1'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | $this->ipad = str_repeat(chr(0x36), $this->b); |
@@ -378,24 +378,24 @@ discard block |
||
378 | 378 | function _md2($m) |
379 | 379 | { |
380 | 380 | static $s = array( |
381 | - 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, |
|
382 | - 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, |
|
383 | - 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, |
|
381 | + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, |
|
382 | + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, |
|
383 | + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, |
|
384 | 384 | 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, |
385 | 385 | 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, |
386 | 386 | 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, |
387 | - 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, |
|
387 | + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, |
|
388 | 388 | 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, |
389 | 389 | 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, |
390 | 390 | 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, |
391 | - 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, |
|
392 | - 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, |
|
391 | + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, |
|
392 | + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, |
|
393 | 393 | 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, |
394 | 394 | 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, |
395 | - 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, |
|
395 | + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, |
|
396 | 396 | 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, |
397 | 397 | 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, |
398 | - 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 |
|
398 | + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 |
|
399 | 399 | ); |
400 | 400 | |
401 | 401 | // Step 1. Append Padding Bytes |
@@ -494,11 +494,11 @@ discard block |
||
494 | 494 | // Extend the sixteen 32-bit words into sixty-four 32-bit words |
495 | 495 | for ($i = 16; $i < 64; $i++) { |
496 | 496 | $s0 = $this->_rightRotate($w[$i - 15], 7) ^ |
497 | - $this->_rightRotate($w[$i - 15], 18) ^ |
|
498 | - $this->_rightShift( $w[$i - 15], 3); |
|
497 | + $this->_rightRotate($w[$i - 15], 18) ^ |
|
498 | + $this->_rightShift( $w[$i - 15], 3); |
|
499 | 499 | $s1 = $this->_rightRotate($w[$i - 2], 17) ^ |
500 | - $this->_rightRotate($w[$i - 2], 19) ^ |
|
501 | - $this->_rightShift( $w[$i - 2], 10); |
|
500 | + $this->_rightRotate($w[$i - 2], 19) ^ |
|
501 | + $this->_rightShift( $w[$i - 2], 10); |
|
502 | 502 | $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1); |
503 | 503 | |
504 | 504 | } |
@@ -509,18 +509,18 @@ discard block |
||
509 | 509 | // Main loop |
510 | 510 | for ($i = 0; $i < 64; $i++) { |
511 | 511 | $s0 = $this->_rightRotate($a, 2) ^ |
512 | - $this->_rightRotate($a, 13) ^ |
|
513 | - $this->_rightRotate($a, 22); |
|
512 | + $this->_rightRotate($a, 13) ^ |
|
513 | + $this->_rightRotate($a, 22); |
|
514 | 514 | $maj = ($a & $b) ^ |
515 | - ($a & $c) ^ |
|
516 | - ($b & $c); |
|
515 | + ($a & $c) ^ |
|
516 | + ($b & $c); |
|
517 | 517 | $t2 = $this->_add($s0, $maj); |
518 | 518 | |
519 | 519 | $s1 = $this->_rightRotate($e, 6) ^ |
520 | - $this->_rightRotate($e, 11) ^ |
|
521 | - $this->_rightRotate($e, 25); |
|
520 | + $this->_rightRotate($e, 11) ^ |
|
521 | + $this->_rightRotate($e, 25); |
|
522 | 522 | $ch = ($e & $f) ^ |
523 | - ($this->_not($e) & $g); |
|
523 | + ($this->_not($e) & $g); |
|
524 | 524 | $t1 = $this->_add($h, $s1, $ch, $k[$i], $w[$i]); |
525 | 525 | |
526 | 526 | $h = $g; |
@@ -635,16 +635,16 @@ discard block |
||
635 | 635 | // Extend the sixteen 32-bit words into eighty 32-bit words |
636 | 636 | for ($i = 16; $i < 80; $i++) { |
637 | 637 | $temp = array( |
638 | - $w[$i - 15]->bitwise_rightRotate(1), |
|
639 | - $w[$i - 15]->bitwise_rightRotate(8), |
|
640 | - $w[$i - 15]->bitwise_rightShift(7) |
|
638 | + $w[$i - 15]->bitwise_rightRotate(1), |
|
639 | + $w[$i - 15]->bitwise_rightRotate(8), |
|
640 | + $w[$i - 15]->bitwise_rightShift(7) |
|
641 | 641 | ); |
642 | 642 | $s0 = $temp[0]->bitwise_xor($temp[1]); |
643 | 643 | $s0 = $s0->bitwise_xor($temp[2]); |
644 | 644 | $temp = array( |
645 | - $w[$i - 2]->bitwise_rightRotate(19), |
|
646 | - $w[$i - 2]->bitwise_rightRotate(61), |
|
647 | - $w[$i - 2]->bitwise_rightShift(6) |
|
645 | + $w[$i - 2]->bitwise_rightRotate(19), |
|
646 | + $w[$i - 2]->bitwise_rightRotate(61), |
|
647 | + $w[$i - 2]->bitwise_rightShift(6) |
|
648 | 648 | ); |
649 | 649 | $s1 = $temp[0]->bitwise_xor($temp[1]); |
650 | 650 | $s1 = $s1->bitwise_xor($temp[2]); |
@@ -625,13 +625,13 @@ |
||
625 | 625 | $l^= $p[++$i]; |
626 | 626 | $r^= ($sb_0[$l >> 24 & 0xff] + |
627 | 627 | $sb_1[$l >> 16 & 0xff] ^ |
628 | - $sb_2[$l >> 8 & 0xff]) + |
|
628 | + $sb_2[$l >> 8 & 0xff]) + |
|
629 | 629 | $sb_3[$l & 0xff]; |
630 | 630 | |
631 | 631 | $r^= $p[++$i]; |
632 | 632 | $l^= ($sb_0[$r >> 24 & 0xff] + |
633 | 633 | $sb_1[$r >> 16 & 0xff] ^ |
634 | - $sb_2[$r >> 8 & 0xff]) + |
|
634 | + $sb_2[$r >> 8 & 0xff]) + |
|
635 | 635 | $sb_3[$r & 0xff]; |
636 | 636 | |
637 | 637 | } |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | if ($this->continuousBuffer) { |
1138 | 1138 | $this->encryptIV = $xor; |
1139 | 1139 | if ($start = strlen($plaintext) & 7) { |
1140 | - $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1140 | + $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1141 | 1141 | } |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | if ($this->continuousBuffer) { |
1333 | 1333 | $this->decryptIV = $xor; |
1334 | 1334 | if ($start = strlen($ciphertext) % 8) { |
1335 | - $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1335 | + $buffer['xor'] = substr($key, $start) . $buffer['xor']; |
|
1336 | 1336 | } |
1337 | 1337 | } |
1338 | 1338 | } |
@@ -1518,13 +1518,13 @@ discard block |
||
1518 | 1518 | $t = unpack('Nl/Nr', $block); |
1519 | 1519 | list($l, $r) = array($t['l'], $t['r']); |
1520 | 1520 | $block = ($shuffle[$ipmap[$r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") | |
1521 | - ($shuffle[$ipmap[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1522 | - ($shuffle[$ipmap[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1523 | - ($shuffle[$ipmap[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1524 | - ($shuffle[$ipmap[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1525 | - ($shuffle[$ipmap[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1526 | - ($shuffle[$ipmap[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1527 | - ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1521 | + ($shuffle[$ipmap[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1522 | + ($shuffle[$ipmap[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1523 | + ($shuffle[$ipmap[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1524 | + ($shuffle[$ipmap[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1525 | + ($shuffle[$ipmap[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1526 | + ($shuffle[$ipmap[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1527 | + ($shuffle[$ipmap[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1528 | 1528 | |
1529 | 1529 | // Extract L0 and R0. |
1530 | 1530 | $t = unpack('Nl/Nr', $block); |
@@ -1540,9 +1540,9 @@ discard block |
||
1540 | 1540 | |
1541 | 1541 | // S-box indexing. |
1542 | 1542 | $t = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ |
1543 | - $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ |
|
1544 | - $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ |
|
1545 | - $sbox7[$b1 & 0x3F] ^ $sbox8[$b2 & 0x3F] ^ $l; |
|
1543 | + $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ |
|
1544 | + $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ |
|
1545 | + $sbox7[$b1 & 0x3F] ^ $sbox8[$b2 & 0x3F] ^ $l; |
|
1546 | 1546 | // end of "the Feistel (F) function" |
1547 | 1547 | |
1548 | 1548 | $l = $r; |
@@ -1551,13 +1551,13 @@ discard block |
||
1551 | 1551 | |
1552 | 1552 | // Perform the inverse IP permutation. |
1553 | 1553 | return ($shuffle[$invipmap[($l >> 24) & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x80") | |
1554 | - ($shuffle[$invipmap[($r >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1555 | - ($shuffle[$invipmap[($l >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1556 | - ($shuffle[$invipmap[($r >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1557 | - ($shuffle[$invipmap[($l >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1558 | - ($shuffle[$invipmap[($r >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1559 | - ($shuffle[$invipmap[$l & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1560 | - ($shuffle[$invipmap[$r & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1554 | + ($shuffle[$invipmap[($r >> 24) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x40") | |
|
1555 | + ($shuffle[$invipmap[($l >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x20") | |
|
1556 | + ($shuffle[$invipmap[($r >> 16) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x10") | |
|
1557 | + ($shuffle[$invipmap[($l >> 8) & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x08") | |
|
1558 | + ($shuffle[$invipmap[($r >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x04") | |
|
1559 | + ($shuffle[$invipmap[$l & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x02") | |
|
1560 | + ($shuffle[$invipmap[$r & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x01"); |
|
1561 | 1561 | } |
1562 | 1562 | |
1563 | 1563 | /** |
@@ -2025,13 +2025,13 @@ discard block |
||
2025 | 2025 | $t = unpack('Nl/Nr', $key); |
2026 | 2026 | list($l, $r) = array($t['l'], $t['r']); |
2027 | 2027 | $key = ($this->shuffle[$pc1map[$r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x00") | |
2028 | - ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") | |
|
2029 | - ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") | |
|
2030 | - ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") | |
|
2031 | - ($this->shuffle[$pc1map[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") | |
|
2032 | - ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") | |
|
2033 | - ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") | |
|
2034 | - ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00"); |
|
2028 | + ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") | |
|
2029 | + ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") | |
|
2030 | + ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") | |
|
2031 | + ($this->shuffle[$pc1map[$l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") | |
|
2032 | + ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") | |
|
2033 | + ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") | |
|
2034 | + ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00"); |
|
2035 | 2035 | $key = unpack('Nc/Nd', $key); |
2036 | 2036 | $c = ($key['c'] >> 4) & 0x0FFFFFFF; |
2037 | 2037 | $d = (($key['d'] >> 4) & 0x0FFFFFF0) | ($key['c'] & 0x0F); |
@@ -2045,9 +2045,9 @@ discard block |
||
2045 | 2045 | |
2046 | 2046 | // Perform the PC-2 transformation. |
2047 | 2047 | $cp = $pc2mapc1[$c >> 24] | $pc2mapc2[($c >> 16) & 0xFF] | |
2048 | - $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[$c & 0xFF]; |
|
2048 | + $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[$c & 0xFF]; |
|
2049 | 2049 | $dp = $pc2mapd1[$d >> 24] | $pc2mapd2[($d >> 16) & 0xFF] | |
2050 | - $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[$d & 0xFF]; |
|
2050 | + $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[$d & 0xFF]; |
|
2051 | 2051 | |
2052 | 2052 | // Reorder: odd bytes/even bytes. Push the result in key schedule. |
2053 | 2053 | $keys[] = array( |