@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | return true; |
291 | 291 | } else { |
292 | 292 | $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
293 | - $tbl_item_property = $this_course . 'item_property'; |
|
293 | + $tbl_item_property = $this_course.'item_property'; |
|
294 | 294 | $doc_url = Database::escape_string($doc_url); |
295 | 295 | $query = "SELECT 1 FROM $tbl_document AS docs,$tbl_item_property AS props |
296 | 296 | WHERE |
@@ -340,18 +340,18 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | header('Content-type: application/octet-stream'); |
343 | - header('Content-length: ' . $len); |
|
343 | + header('Content-length: '.$len); |
|
344 | 344 | if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
345 | - header('Content-Disposition: filename= ' . $filename); |
|
345 | + header('Content-Disposition: filename= '.$filename); |
|
346 | 346 | } else { |
347 | - header('Content-Disposition: attachment; filename= ' . $filename); |
|
347 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
348 | 348 | } |
349 | 349 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
350 | 350 | header('Pragma: '); |
351 | 351 | header('Cache-Control: '); |
352 | 352 | header('Cache-Control: public'); // IE cannot download from sessions without a cache |
353 | 353 | } |
354 | - header('Content-Description: ' . $filename); |
|
354 | + header('Content-Description: '.$filename); |
|
355 | 355 | header('Content-Transfer-Encoding: binary'); |
356 | 356 | |
357 | 357 | $res = fopen($full_file_name, 'r'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | } else { |
379 | 379 | $encoding = @api_detect_encoding_html(file_get_contents($full_file_name)); |
380 | 380 | if (!empty($encoding)) { |
381 | - $content_type .= '; charset=' . $encoding; |
|
381 | + $content_type .= '; charset='.$encoding; |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | break; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } else { |
389 | 389 | $encoding = @api_detect_encoding(strip_tags(file_get_contents($full_file_name))); |
390 | 390 | if (!empty($encoding)) { |
391 | - $content_type .= '; charset=' . $encoding; |
|
391 | + $content_type .= '; charset='.$encoding; |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | break; |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | header('Content-type: application/octet-stream'); |
398 | 398 | break; |
399 | 399 | } |
400 | - header('Content-type: ' . $content_type); |
|
401 | - header('Content-Length: ' . $len); |
|
400 | + header('Content-type: '.$content_type); |
|
401 | + header('Content-Length: '.$len); |
|
402 | 402 | $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); |
403 | 403 | if (strpos($user_agent, 'msie')) { |
404 | - header('Content-Disposition: ; filename= ' . $filename); |
|
404 | + header('Content-Disposition: ; filename= '.$filename); |
|
405 | 405 | } else { |
406 | - header('Content-Disposition: inline; filename= ' . $filename); |
|
406 | + header('Content-Disposition: inline; filename= '.$filename); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if ($fixLinksHttpToHttps) { |
@@ -444,18 +444,18 @@ discard block |
||
444 | 444 | |
445 | 445 | header('Content-type: application/octet-stream'); |
446 | 446 | //header('Content-Type: application/force-download'); |
447 | - header('Content-length: ' . $len); |
|
447 | + header('Content-length: '.$len); |
|
448 | 448 | if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
449 | - header('Content-Disposition: filename= ' . $filename); |
|
449 | + header('Content-Disposition: filename= '.$filename); |
|
450 | 450 | } else { |
451 | - header('Content-Disposition: attachment; filename= ' . $filename); |
|
451 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
452 | 452 | } |
453 | 453 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
454 | 454 | header('Pragma: '); |
455 | 455 | header('Cache-Control: '); |
456 | 456 | header('Cache-Control: public'); // IE cannot download from sessions without a cache |
457 | 457 | } |
458 | - header('Content-Description: ' . $filename); |
|
458 | + header('Content-Description: '.$filename); |
|
459 | 459 | header('Content-transfer-encoding: binary'); |
460 | 460 | echo $full_string; |
461 | 461 | |
@@ -468,30 +468,30 @@ discard block |
||
468 | 468 | |
469 | 469 | $content_type = self::file_get_mime_type($filename); |
470 | 470 | header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); |
471 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
471 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
472 | 472 | header('Cache-Control: no-cache, must-revalidate'); |
473 | 473 | header('Pragma: no-cache'); |
474 | 474 | switch ($content_type) { |
475 | 475 | case 'text/html': |
476 | 476 | $encoding = @api_detect_encoding_html($full_string); |
477 | 477 | if (!empty($encoding)) { |
478 | - $content_type .= '; charset=' . $encoding; |
|
478 | + $content_type .= '; charset='.$encoding; |
|
479 | 479 | } |
480 | 480 | break; |
481 | 481 | case 'text/plain': |
482 | 482 | $encoding = @api_detect_encoding(strip_tags($full_string)); |
483 | 483 | if (!empty($encoding)) { |
484 | - $content_type .= '; charset=' . $encoding; |
|
484 | + $content_type .= '; charset='.$encoding; |
|
485 | 485 | } |
486 | 486 | break; |
487 | 487 | } |
488 | - header('Content-type: ' . $content_type); |
|
489 | - header('Content-Length: ' . $len); |
|
488 | + header('Content-type: '.$content_type); |
|
489 | + header('Content-Length: '.$len); |
|
490 | 490 | $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); |
491 | 491 | if (strpos($user_agent, 'msie')) { |
492 | - header('Content-Disposition: ; filename= ' . $filename); |
|
492 | + header('Content-Disposition: ; filename= '.$filename); |
|
493 | 493 | } else { |
494 | - header('Content-Disposition: inline; filename= ' . $filename); |
|
494 | + header('Content-Disposition: inline; filename= '.$filename); |
|
495 | 495 | } |
496 | 496 | echo($full_string); |
497 | 497 | //You have to ensure that the calling script then stops processing (exit();) |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | if (!empty($students)) { |
585 | 585 | $conditionList = array(); |
586 | 586 | foreach ($students as $studentId => $studentInfo) { |
587 | - $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id']; |
|
587 | + $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id']; |
|
588 | 588 | } |
589 | - $sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")'; |
|
589 | + $sharedCondition .= ' AND docs.path IN ("'.implode('","', $conditionList).'")'; |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
@@ -612,8 +612,8 @@ discard block |
||
612 | 612 | last.c_id = {$_course['real_id']} |
613 | 613 | ) |
614 | 614 | WHERE |
615 | - docs.path LIKE '" . Database::escape_string($path . $added_slash.'%'). "' AND |
|
616 | - docs.path NOT LIKE '" . Database::escape_string($path . $added_slash.'%/%')."' AND |
|
615 | + docs.path LIKE '".Database::escape_string($path.$added_slash.'%')."' AND |
|
616 | + docs.path NOT LIKE '" . Database::escape_string($path.$added_slash.'%/%')."' AND |
|
617 | 617 | docs.path NOT LIKE '%_DELETED_%' AND |
618 | 618 | $userGroupFilter AND |
619 | 619 | last.visibility $visibility_bit |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES); |
655 | 655 | $sql = "SELECT id FROM $table_template |
656 | 656 | WHERE |
657 | - course_code = '" . $_course['code'] . "' AND |
|
657 | + course_code = '".$_course['code']."' AND |
|
658 | 658 | user_id = '".api_get_user_id()."' AND |
659 | 659 | ref_doc = '".$row['id']."'"; |
660 | 660 | $template_result = Database::query($sql); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | if (!empty($students)) { |
765 | 765 | $conditionList = array(); |
766 | 766 | foreach ($students as $studentId => $studentInfo) { |
767 | - $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id']; |
|
767 | + $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id']; |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | INNER JOIN $TABLE_DOCUMENT AS docs |
789 | 789 | ON ( |
790 | 790 | docs.id = last.ref AND |
791 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
791 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
792 | 792 | last.c_id = {$_course['real_id']} AND |
793 | 793 | docs.c_id = {$_course['real_id']} |
794 | 794 | ) |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | INNER JOIN $TABLE_DOCUMENT AS docs |
806 | 806 | ON ( |
807 | 807 | docs.id = last.ref AND |
808 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
808 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
809 | 809 | last.c_id = {$_course['real_id']} AND |
810 | 810 | docs.c_id = {$_course['real_id']} |
811 | 811 | ) |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | WHERE |
853 | 853 | docs.id = last.ref AND |
854 | 854 | docs.filetype = 'folder' AND |
855 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
855 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
856 | 856 | $groupCondition AND |
857 | 857 | last.visibility = 1 |
858 | 858 | $condition_session AND |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | WHERE |
874 | 874 | docs.id = last.ref AND |
875 | 875 | docs.filetype = 'folder' AND |
876 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
876 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
877 | 877 | $groupCondition AND |
878 | 878 | last.visibility = 0 $condition_session AND |
879 | 879 | last.c_id = {$_course['real_id']} AND |
@@ -889,9 +889,9 @@ discard block |
||
889 | 889 | FROM $TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs |
890 | 890 | WHERE |
891 | 891 | docs.id = last.ref AND |
892 | - docs.path LIKE '" . Database::escape_string($row['path'].'/%') . "' AND |
|
892 | + docs.path LIKE '".Database::escape_string($row['path'].'/%')."' AND |
|
893 | 893 | docs.filetype = 'folder' AND |
894 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
894 | + last.tool = '" . TOOL_DOCUMENT."' AND |
|
895 | 895 | $groupCondition AND |
896 | 896 | last.visibility = 1 $condition_session AND |
897 | 897 | last.c_id = {$_course['real_id']} AND |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | tp.c_id = $course_id AND |
969 | 969 | td.session_id = $sessionId AND |
970 | 970 | tp.ref= td.id AND |
971 | - (path='" . $path . "' OR path LIKE BINARY '" . $path . "/%' ) "; |
|
971 | + (path='".$path."' OR path LIKE BINARY '".$path."/%' ) "; |
|
972 | 972 | // Get all id's of documents that are deleted |
973 | 973 | $what_to_check_result = Database::query($sql); |
974 | 974 | |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | $res = Database::query($sql); |
1312 | 1312 | if (Database::num_rows($res) > 0) { |
1313 | 1313 | $row2 = Database::fetch_array($res); |
1314 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
1314 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
1315 | 1315 | $di = new ChamiloIndexer(); |
1316 | 1316 | $di->remove_document((int) $row2['search_did']); |
1317 | 1317 | } |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | Database::query($sql); |
1321 | 1321 | |
1322 | 1322 | // remove terms from db |
1323 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
1323 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
1324 | 1324 | delete_all_values_for_item($course_id, TOOL_DOCUMENT, $document_id); |
1325 | 1325 | } |
1326 | 1326 | } |
@@ -1408,12 +1408,12 @@ discard block |
||
1408 | 1408 | $path = str_replace('%2F', '/', $url_path); |
1409 | 1409 | $pathinfo = pathinfo($row['path']); |
1410 | 1410 | |
1411 | - $row['url'] = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?cidReq=' . $course_code . '&id=' . $id; |
|
1412 | - $row['document_url'] = api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . $course_code . '&id=' . $id; |
|
1413 | - $row['absolute_path'] = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path']; |
|
1414 | - $row['absolute_path_from_document'] = '/document' . $row['path']; |
|
1415 | - $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'] . '/'; |
|
1416 | - $row['direct_url'] = $www . $path; |
|
1411 | + $row['url'] = api_get_path(WEB_CODE_PATH).'document/showinframes.php?cidReq='.$course_code.'&id='.$id; |
|
1412 | + $row['document_url'] = api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.$course_code.'&id='.$id; |
|
1413 | + $row['absolute_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path']; |
|
1414 | + $row['absolute_path_from_document'] = '/document'.$row['path']; |
|
1415 | + $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'].'/'; |
|
1416 | + $row['direct_url'] = $www.$path; |
|
1417 | 1417 | |
1418 | 1418 | if (dirname($row['path']) == '.') { |
1419 | 1419 | $row['parent_id'] = '0'; |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | $real_dir = ''; |
1433 | 1433 | |
1434 | 1434 | for ($i = 1; $i < $array_len; $i++) { |
1435 | - $real_dir .= '/' . (isset($dir_array[$i]) ? $dir_array[$i] : ''); |
|
1435 | + $real_dir .= '/'.(isset($dir_array[$i]) ? $dir_array[$i] : ''); |
|
1436 | 1436 | $parent_id = self::get_document_id($course_info, $real_dir); |
1437 | 1437 | if ($session_id != 0 && empty($parent_id)) { |
1438 | 1438 | $parent_id = self::get_document_id($course_info, $real_dir, 0); |
@@ -1506,21 +1506,21 @@ discard block |
||
1506 | 1506 | $user_id = intval($user_id); |
1507 | 1507 | $document_id = intval($document_id); |
1508 | 1508 | |
1509 | - $sql = 'SELECT id FROM ' . $table_template . ' |
|
1509 | + $sql = 'SELECT id FROM '.$table_template.' |
|
1510 | 1510 | WHERE |
1511 | - course_code="' . $course_code . '" AND |
|
1512 | - user_id="' . $user_id . '" AND |
|
1513 | - ref_doc="' . $document_id . '"'; |
|
1511 | + course_code="' . $course_code.'" AND |
|
1512 | + user_id="' . $user_id.'" AND |
|
1513 | + ref_doc="' . $document_id.'"'; |
|
1514 | 1514 | $result = Database::query($sql); |
1515 | 1515 | $template_id = Database::result($result, 0, 0); |
1516 | 1516 | |
1517 | - my_delete(api_get_path(SYS_CODE_PATH) . 'upload/template_thumbnails/' . $template_id . '.jpg'); |
|
1517 | + my_delete(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/'.$template_id.'.jpg'); |
|
1518 | 1518 | |
1519 | - $sql = 'DELETE FROM ' . $table_template . ' |
|
1519 | + $sql = 'DELETE FROM '.$table_template.' |
|
1520 | 1520 | WHERE |
1521 | - course_code="' . $course_code . '" AND |
|
1522 | - user_id="' . $user_id . '" AND |
|
1523 | - ref_doc="' . $document_id . '"'; |
|
1521 | + course_code="' . $course_code.'" AND |
|
1522 | + user_id="' . $user_id.'" AND |
|
1523 | + ref_doc="' . $document_id.'"'; |
|
1524 | 1524 | |
1525 | 1525 | Database::query($sql); |
1526 | 1526 | } |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | INNER JOIN $propTable ip |
1582 | 1582 | ON (d.id = ip.ref AND d.c_id = $course_id AND ip.c_id = $course_id) |
1583 | 1583 | WHERE |
1584 | - ip.tool = '" . TOOL_DOCUMENT . "' $condition AND |
|
1584 | + ip.tool = '".TOOL_DOCUMENT."' $condition AND |
|
1585 | 1585 | filetype = '$file_type' AND |
1586 | 1586 | locate(concat(path,'/'), '$doc_path')=1 |
1587 | 1587 | "; |
@@ -1745,12 +1745,12 @@ discard block |
||
1745 | 1745 | if (empty($session_id)) { |
1746 | 1746 | $sql_session = 'AND (session_id = 0 OR isnull(session_id)) '; |
1747 | 1747 | } elseif ($session_id > 0) { |
1748 | - $sql_session = 'AND session_id=' . intval($session_id); |
|
1748 | + $sql_session = 'AND session_id='.intval($session_id); |
|
1749 | 1749 | } else { |
1750 | 1750 | $sql_session = ''; |
1751 | 1751 | } |
1752 | - $sql = 'UPDATE ' . $tbl_category . ' SET document_id="' . intval($document_id) . '" |
|
1753 | - WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; |
|
1752 | + $sql = 'UPDATE '.$tbl_category.' SET document_id="'.intval($document_id).'" |
|
1753 | + WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session; |
|
1754 | 1754 | Database::query($sql); |
1755 | 1755 | } |
1756 | 1756 | |
@@ -1772,12 +1772,12 @@ discard block |
||
1772 | 1772 | if (empty($session_id)) { |
1773 | 1773 | $sql_session = 'AND (session_id = 0 OR isnull(session_id)) '; |
1774 | 1774 | } elseif ($session_id > 0) { |
1775 | - $sql_session = 'AND session_id=' . intval($session_id); |
|
1775 | + $sql_session = 'AND session_id='.intval($session_id); |
|
1776 | 1776 | } else { |
1777 | 1777 | $sql_session = ''; |
1778 | 1778 | } |
1779 | - $sql = 'SELECT document_id FROM ' . $tbl_category . ' |
|
1780 | - WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; |
|
1779 | + $sql = 'SELECT document_id FROM '.$tbl_category.' |
|
1780 | + WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session; |
|
1781 | 1781 | |
1782 | 1782 | $rs = Database::query($sql); |
1783 | 1783 | $num = Database::num_rows($rs); |
@@ -1818,7 +1818,7 @@ discard block |
||
1818 | 1818 | $all_user_info = array(); |
1819 | 1819 | if (Database::num_rows($rs)) { |
1820 | 1820 | $row = Database::fetch_array($rs); |
1821 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path']; |
|
1821 | + $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path']; |
|
1822 | 1822 | if (is_file($filepath)) { |
1823 | 1823 | $my_content_html = file_get_contents($filepath); |
1824 | 1824 | } |
@@ -1901,9 +1901,9 @@ discard block |
||
1901 | 1901 | $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY); |
1902 | 1902 | } |
1903 | 1903 | |
1904 | - $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id']; |
|
1904 | + $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id']; |
|
1905 | 1905 | |
1906 | - $externalStyleFile = api_get_path(SYS_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/certificate.css'; |
|
1906 | + $externalStyleFile = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/certificate.css'; |
|
1907 | 1907 | $externalStyle = ''; |
1908 | 1908 | |
1909 | 1909 | if (is_file($externalStyleFile)) { |
@@ -1925,7 +1925,7 @@ discard block |
||
1925 | 1925 | $course_info['name'], |
1926 | 1926 | $info_grade_certificate['grade'], |
1927 | 1927 | $url, |
1928 | - '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>', |
|
1928 | + '<a href="'.$url.'" target="_blank">'.get_lang('CertificateOnlineLink').'</a>', |
|
1929 | 1929 | '((certificate_barcode))', |
1930 | 1930 | $externalStyle |
1931 | 1931 | ); |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | if (!empty($extraFields)) { |
1952 | 1952 | foreach ($extraFields as $extraField) { |
1953 | 1953 | $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : ''; |
1954 | - $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))'; |
|
1954 | + $info_to_be_replaced_in_content_html[] = '(('.strtolower($extraField['variable']).'))'; |
|
1955 | 1955 | $info_to_replace_in_content_html[] = $valueExtra; |
1956 | 1956 | } |
1957 | 1957 | } |
@@ -1979,17 +1979,17 @@ discard block |
||
1979 | 1979 | $tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
1980 | 1980 | $session_id = api_get_session_id(); |
1981 | 1981 | if ($session_id == 0 || is_null($session_id)) { |
1982 | - $sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) '; |
|
1982 | + $sql_session = 'AND (session_id='.intval($session_id).' OR isnull(session_id)) '; |
|
1983 | 1983 | } elseif ($session_id > 0) { |
1984 | - $sql_session = 'AND session_id=' . intval($session_id); |
|
1984 | + $sql_session = 'AND session_id='.intval($session_id); |
|
1985 | 1985 | } else { |
1986 | 1986 | $sql_session = ''; |
1987 | 1987 | } |
1988 | 1988 | |
1989 | - $sql = 'UPDATE ' . $tbl_category . ' SET document_id=null |
|
1989 | + $sql = 'UPDATE '.$tbl_category.' SET document_id=null |
|
1990 | 1990 | WHERE |
1991 | - course_code = "' . Database::escape_string($course_id) . '" AND |
|
1992 | - document_id="' . $default_certificate_id . '" ' . $sql_session; |
|
1991 | + course_code = "' . Database::escape_string($course_id).'" AND |
|
1992 | + document_id="' . $default_certificate_id.'" '.$sql_session; |
|
1993 | 1993 | Database::query($sql); |
1994 | 1994 | } |
1995 | 1995 | } |
@@ -2005,10 +2005,10 @@ discard block |
||
2005 | 2005 | if (!empty($courseInfo)) { |
2006 | 2006 | $to_group_id = 0; |
2007 | 2007 | $to_user_id = null; |
2008 | - $course_dir = $courseInfo['path'] . "/document/"; |
|
2008 | + $course_dir = $courseInfo['path']."/document/"; |
|
2009 | 2009 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
2010 | - $base_work_dir = $sys_course_path . $course_dir; |
|
2011 | - $base_work_dir_test = $base_work_dir . 'certificates'; |
|
2010 | + $base_work_dir = $sys_course_path.$course_dir; |
|
2011 | + $base_work_dir_test = $base_work_dir.'certificates'; |
|
2012 | 2012 | $dir_name = '/certificates'; |
2013 | 2013 | $post_dir_name = get_lang('CertificatesFiles'); |
2014 | 2014 | $visibility_command = 'invisible'; |
@@ -2235,9 +2235,9 @@ discard block |
||
2235 | 2235 | //$new_abs_path = realpath($dir.'/'.$second_part); |
2236 | 2236 | $dir = ''; |
2237 | 2237 | if (!empty($abs_path)) { |
2238 | - $dir = dirname($abs_path) . '/'; |
|
2238 | + $dir = dirname($abs_path).'/'; |
|
2239 | 2239 | } |
2240 | - $new_abs_path = realpath($dir . $second_part); |
|
2240 | + $new_abs_path = realpath($dir.$second_part); |
|
2241 | 2241 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
2242 | 2242 | if (count($in_files_list) > 0) { |
2243 | 2243 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2250,9 +2250,9 @@ discard block |
||
2250 | 2250 | $files_list[] = array($second_part, 'local', 'rel'); |
2251 | 2251 | $dir = ''; |
2252 | 2252 | if (!empty($abs_path)) { |
2253 | - $dir = dirname($abs_path) . '/'; |
|
2253 | + $dir = dirname($abs_path).'/'; |
|
2254 | 2254 | } |
2255 | - $new_abs_path = realpath($dir . $second_part); |
|
2255 | + $new_abs_path = realpath($dir.$second_part); |
|
2256 | 2256 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
2257 | 2257 | if (count($in_files_list) > 0) { |
2258 | 2258 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2286,9 +2286,9 @@ discard block |
||
2286 | 2286 | $files_list[] = array($source, 'local', 'rel'); |
2287 | 2287 | $dir = ''; |
2288 | 2288 | if (!empty($abs_path)) { |
2289 | - $dir = dirname($abs_path) . '/'; |
|
2289 | + $dir = dirname($abs_path).'/'; |
|
2290 | 2290 | } |
2291 | - $new_abs_path = realpath($dir . $source); |
|
2291 | + $new_abs_path = realpath($dir.$source); |
|
2292 | 2292 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
2293 | 2293 | if (count($in_files_list) > 0) { |
2294 | 2294 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2301,9 +2301,9 @@ discard block |
||
2301 | 2301 | $files_list[] = array($source, 'local', 'rel'); |
2302 | 2302 | $dir = ''; |
2303 | 2303 | if (!empty($abs_path)) { |
2304 | - $dir = dirname($abs_path) . '/'; |
|
2304 | + $dir = dirname($abs_path).'/'; |
|
2305 | 2305 | } |
2306 | - $new_abs_path = realpath($dir . $source); |
|
2306 | + $new_abs_path = realpath($dir.$source); |
|
2307 | 2307 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
2308 | 2308 | if (count($in_files_list) > 0) { |
2309 | 2309 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2337,9 +2337,9 @@ discard block |
||
2337 | 2337 | $files_list[] = array($source, 'local', 'rel'); |
2338 | 2338 | $dir = ''; |
2339 | 2339 | if (!empty($abs_path)) { |
2340 | - $dir = dirname($abs_path) . '/'; |
|
2340 | + $dir = dirname($abs_path).'/'; |
|
2341 | 2341 | } |
2342 | - $new_abs_path = realpath($dir . $source); |
|
2342 | + $new_abs_path = realpath($dir.$source); |
|
2343 | 2343 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
2344 | 2344 | if (count($in_files_list) > 0) { |
2345 | 2345 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2352,9 +2352,9 @@ discard block |
||
2352 | 2352 | $files_list[] = array($source, 'local', 'rel'); |
2353 | 2353 | $dir = ''; |
2354 | 2354 | if (!empty($abs_path)) { |
2355 | - $dir = dirname($abs_path) . '/'; |
|
2355 | + $dir = dirname($abs_path).'/'; |
|
2356 | 2356 | } |
2357 | - $new_abs_path = realpath($dir . $source); |
|
2357 | + $new_abs_path = realpath($dir.$source); |
|
2358 | 2358 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
2359 | 2359 | if (count($in_files_list) > 0) { |
2360 | 2360 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2413,24 +2413,24 @@ discard block |
||
2413 | 2413 | // then possible closing brackets if we were in the opening bracket case |
2414 | 2414 | // OR something like @import() |
2415 | 2415 | $res = preg_match_all( |
2416 | - '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' . |
|
2416 | + '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))'. |
|
2417 | 2417 | // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much |
2418 | 2418 | // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name |
2419 | - '([ \n\t\r]+)?(' . |
|
2419 | + '([ \n\t\r]+)?('. |
|
2420 | 2420 | // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself |
2421 | - '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' . |
|
2422 | - '|' . |
|
2421 | + '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))'. |
|
2422 | + '|'. |
|
2423 | 2423 | // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself |
2424 | - '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' . |
|
2425 | - '))' . |
|
2426 | - '|' . |
|
2424 | + '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))'. |
|
2425 | + '))'. |
|
2426 | + '|'. |
|
2427 | 2427 | // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities) |
2428 | 2428 | '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/', |
2429 | 2429 | $attrString, |
2430 | 2430 | $regs |
2431 | 2431 | ); |
2432 | 2432 | } catch (Exception $e) { |
2433 | - error_log('Caught exception: ' . $e->getMessage(), 0); |
|
2433 | + error_log('Caught exception: '.$e->getMessage(), 0); |
|
2434 | 2434 | } |
2435 | 2435 | if ($res) { |
2436 | 2436 | for ($i = 0; $i < count($regs[1]); $i++) { |
@@ -2508,14 +2508,14 @@ discard block |
||
2508 | 2508 | $orig_course_info_path = $origin_course_info_path; |
2509 | 2509 | } |
2510 | 2510 | } else { |
2511 | - $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'] . '/'; |
|
2511 | + $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'].'/'; |
|
2512 | 2512 | $orig_course_info_path = $orig_course_info['path']; |
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | $destination_course_code = CourseManager::get_course_id_from_path($destination_course_directory); |
2516 | 2516 | $destination_course_info = api_get_course_info($destination_course_code); |
2517 | - $dest_course_path = api_get_path(SYS_COURSE_PATH) . $destination_course_directory . '/'; |
|
2518 | - $dest_course_path_rel = api_get_path(REL_COURSE_PATH) . $destination_course_directory . '/'; |
|
2517 | + $dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/'; |
|
2518 | + $dest_course_path_rel = api_get_path(REL_COURSE_PATH).$destination_course_directory.'/'; |
|
2519 | 2519 | |
2520 | 2520 | $user_id = api_get_user_id(); |
2521 | 2521 | |
@@ -2524,7 +2524,7 @@ discard block |
||
2524 | 2524 | |
2525 | 2525 | // Get information about source url |
2526 | 2526 | $real_orig_url = $source[0]; // url |
2527 | - $scope_url = $source[1]; // scope (local, remote) |
|
2527 | + $scope_url = $source[1]; // scope (local, remote) |
|
2528 | 2528 | $type_url = $source[2]; // type (rel, abs, url) |
2529 | 2529 | |
2530 | 2530 | // Get path and query from origin url |
@@ -2536,7 +2536,7 @@ discard block |
||
2536 | 2536 | $dest_url_query = ''; |
2537 | 2537 | |
2538 | 2538 | if (!empty($real_orig_query)) { |
2539 | - $dest_url_query = '?' . $real_orig_query; |
|
2539 | + $dest_url_query = '?'.$real_orig_query; |
|
2540 | 2540 | if (strpos($dest_url_query, $origin_course_code) !== false) { |
2541 | 2541 | $dest_url_query = str_replace($origin_course_code, $destination_course_code, $dest_url_query); |
2542 | 2542 | } |
@@ -2617,7 +2617,7 @@ discard block |
||
2617 | 2617 | |
2618 | 2618 | //$destination_url = $url_course_path . $destination_course_directory . '/' . $document_file . $dest_url_query; |
2619 | 2619 | // See BT#7780 |
2620 | - $destination_url = $dest_course_path_rel . $document_file . $dest_url_query; |
|
2620 | + $destination_url = $dest_course_path_rel.$document_file.$dest_url_query; |
|
2621 | 2621 | |
2622 | 2622 | // If the course code doesn't exist in the path? what we do? Nothing! see BT#1985 |
2623 | 2623 | if (strpos($real_orig_path, $origin_course_code) === false) { |
@@ -2652,14 +2652,14 @@ discard block |
||
2652 | 2652 | public function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path) |
2653 | 2653 | { |
2654 | 2654 | if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') { |
2655 | - $original = $original_path . $file_name; |
|
2655 | + $original = $original_path.$file_name; |
|
2656 | 2656 | } else { |
2657 | - $original = $original_path . '/' . $file_name; |
|
2657 | + $original = $original_path.'/'.$file_name; |
|
2658 | 2658 | } |
2659 | 2659 | if (substr($destiny_path, strlen($destiny_path) - 1, strlen($destiny_path)) == '/') { |
2660 | - $destination = $destiny_path . $file_name; |
|
2660 | + $destination = $destiny_path.$file_name; |
|
2661 | 2661 | } else { |
2662 | - $destination = $destiny_path . '/' . $file_name; |
|
2662 | + $destination = $destiny_path.'/'.$file_name; |
|
2663 | 2663 | } |
2664 | 2664 | $original_count = count(explode('/', $original)); |
2665 | 2665 | $destination_count = count(explode('/', $destination)); |
@@ -2673,8 +2673,8 @@ discard block |
||
2673 | 2673 | $mode = 'inside'; |
2674 | 2674 | } |
2675 | 2675 | //We do not select the $original_path becayse the file was already moved |
2676 | - $content_html = file_get_contents($destiny_path . '/' . $file_name); |
|
2677 | - $destination_file = $destiny_path . '/' . $file_name; |
|
2676 | + $content_html = file_get_contents($destiny_path.'/'.$file_name); |
|
2677 | + $destination_file = $destiny_path.'/'.$file_name; |
|
2678 | 2678 | |
2679 | 2679 | $pre_original = strstr($original_path, 'document'); |
2680 | 2680 | $pre_destin = strstr($destiny_path, 'document'); |
@@ -2696,11 +2696,11 @@ discard block |
||
2696 | 2696 | } |
2697 | 2697 | |
2698 | 2698 | if ($pre_original != '') { |
2699 | - $pre_original = '..' . $pre_original . '/'; |
|
2699 | + $pre_original = '..'.$pre_original.'/'; |
|
2700 | 2700 | } |
2701 | 2701 | |
2702 | 2702 | if ($pre_destin != '') { |
2703 | - $pre_destin = '..' . $pre_destin . '/'; |
|
2703 | + $pre_destin = '..'.$pre_destin.'/'; |
|
2704 | 2704 | } |
2705 | 2705 | |
2706 | 2706 | $levels = explode('/', $pre_original); |
@@ -2718,7 +2718,7 @@ discard block |
||
2718 | 2718 | //echo '$count_pre_destination_levels '. $count_pre_destination_levels; |
2719 | 2719 | $pre_remove = ''; |
2720 | 2720 | for ($i = 1; $i <= $count_pre_destination_levels; $i++) { |
2721 | - $pre_remove .='..\/'; |
|
2721 | + $pre_remove .= '..\/'; |
|
2722 | 2722 | } |
2723 | 2723 | |
2724 | 2724 | $orig_source_html = DocumentManager::get_resources_from_source_html($content_html); |
@@ -2726,9 +2726,9 @@ discard block |
||
2726 | 2726 | foreach ($orig_source_html as $source) { |
2727 | 2727 | |
2728 | 2728 | // get information about source url |
2729 | - $real_orig_url = $source[0]; // url |
|
2730 | - $scope_url = $source[1]; // scope (local, remote) |
|
2731 | - $type_url = $source[2]; // tyle (rel, abs, url) |
|
2729 | + $real_orig_url = $source[0]; // url |
|
2730 | + $scope_url = $source[1]; // scope (local, remote) |
|
2731 | + $type_url = $source[2]; // tyle (rel, abs, url) |
|
2732 | 2732 | // Get path and query from origin url |
2733 | 2733 | $orig_parse_url = parse_url($real_orig_url); |
2734 | 2734 | $real_orig_path = $orig_parse_url['path']; |
@@ -2755,11 +2755,11 @@ discard block |
||
2755 | 2755 | $real_orig_url_temp = ''; |
2756 | 2756 | if ($mode == 'inside') { |
2757 | 2757 | $real_orig_url_temp = str_replace('../', '', $real_orig_url); |
2758 | - $destination_url = $link_to_add . $real_orig_url_temp; |
|
2758 | + $destination_url = $link_to_add.$real_orig_url_temp; |
|
2759 | 2759 | } else { |
2760 | 2760 | $real_orig_url_temp = $real_orig_url; |
2761 | 2761 | |
2762 | - $destination_url = preg_replace("/" . $pre_remove . "/", '', $real_orig_url, 1); |
|
2762 | + $destination_url = preg_replace("/".$pre_remove."/", '', $real_orig_url, 1); |
|
2763 | 2763 | } |
2764 | 2764 | if ($real_orig_url == $destination_url) { |
2765 | 2765 | //echo 'continue2'; |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | { |
2786 | 2786 | $course_data = api_get_course_info($course_code); |
2787 | 2787 | $document_data = self::get_document_data_by_id($document_id, $course_code); |
2788 | - $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path']; |
|
2788 | + $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path']; |
|
2789 | 2789 | $pdf = new PDF('A4-L', 'L'); |
2790 | 2790 | $pdf->html_to_pdf($file_path, $document_data['title'], $course_code); |
2791 | 2791 | } |
@@ -2818,9 +2818,9 @@ discard block |
||
2818 | 2818 | ) { |
2819 | 2819 | $course_info = api_get_course_info(); |
2820 | 2820 | $sessionId = api_get_session_id(); |
2821 | - $course_dir = $course_info['path'] . '/document'; |
|
2821 | + $course_dir = $course_info['path'].'/document'; |
|
2822 | 2822 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
2823 | - $base_work_dir = $sys_course_path . $course_dir; |
|
2823 | + $base_work_dir = $sys_course_path.$course_dir; |
|
2824 | 2824 | |
2825 | 2825 | if (isset($files[$fileKey])) { |
2826 | 2826 | $upload_ok = process_uploaded_file($files[$fileKey], $show_output); |
@@ -3007,7 +3007,7 @@ discard block |
||
3007 | 3007 | } |
3008 | 3008 | if (isset($output)) { |
3009 | 3009 | foreach ($output as & $line) { |
3010 | - $content .= $line . "\n"; |
|
3010 | + $content .= $line."\n"; |
|
3011 | 3011 | } |
3012 | 3012 | return $content; |
3013 | 3013 | } else { |
@@ -3039,13 +3039,13 @@ discard block |
||
3039 | 3039 | $group_condition = null; |
3040 | 3040 | if (isset($group_id)) { |
3041 | 3041 | $group_id = intval($group_id); |
3042 | - $group_condition = " AND props.to_group_id='" . $group_id . "' "; |
|
3042 | + $group_condition = " AND props.to_group_id='".$group_id."' "; |
|
3043 | 3043 | } |
3044 | 3044 | |
3045 | 3045 | $session_condition = null; |
3046 | 3046 | if (isset($session_id)) { |
3047 | 3047 | $session_id = intval($session_id); |
3048 | - $session_condition = " AND props.session_id='" . $session_id . "' "; |
|
3048 | + $session_condition = " AND props.session_id='".$session_id."' "; |
|
3049 | 3049 | } |
3050 | 3050 | |
3051 | 3051 | $sql = "SELECT SUM(size) |
@@ -3055,7 +3055,7 @@ discard block |
||
3055 | 3055 | WHERE |
3056 | 3056 | props.c_id = $course_id AND |
3057 | 3057 | docs.c_id = $course_id AND |
3058 | - props.tool = '" . TOOL_DOCUMENT . "' AND |
|
3058 | + props.tool = '".TOOL_DOCUMENT."' AND |
|
3059 | 3059 | props.visibility <> 2 |
3060 | 3060 | $group_condition |
3061 | 3061 | $session_condition |
@@ -3078,8 +3078,8 @@ discard block |
||
3078 | 3078 | $course_quota_m = round($course_quota / 1048576); |
3079 | 3079 | $already_consumed_space_m = round($already_consumed_space / 1048576); |
3080 | 3080 | |
3081 | - $message = get_lang('MaximumAllowedQuota') . ' <strong>' . $course_quota_m . ' megabyte</strong>.<br />'; |
|
3082 | - $message .= get_lang('CourseCurrentlyUses') . ' <strong>' . $already_consumed_space_m . ' megabyte</strong>.<br />'; |
|
3081 | + $message = get_lang('MaximumAllowedQuota').' <strong>'.$course_quota_m.' megabyte</strong>.<br />'; |
|
3082 | + $message .= get_lang('CourseCurrentlyUses').' <strong>'.$already_consumed_space_m.' megabyte</strong>.<br />'; |
|
3083 | 3083 | |
3084 | 3084 | $percentage = round(($already_consumed_space / $course_quota * 100), 1); |
3085 | 3085 | |
@@ -3087,33 +3087,33 @@ discard block |
||
3087 | 3087 | |
3088 | 3088 | // Decide where to place percentage in graph |
3089 | 3089 | if ($percentage >= 50) { |
3090 | - $text_in_filled = ' ' . $other_percentage . '%'; |
|
3090 | + $text_in_filled = ' '.$other_percentage.'%'; |
|
3091 | 3091 | $text_in_unfilled = ''; |
3092 | 3092 | } else { |
3093 | - $text_in_unfilled = ' ' . $other_percentage . '%'; |
|
3093 | + $text_in_unfilled = ' '.$other_percentage.'%'; |
|
3094 | 3094 | $text_in_filled = ''; |
3095 | 3095 | } |
3096 | 3096 | |
3097 | 3097 | // Decide the background colour of the graph |
3098 | 3098 | if ($percentage < 65) { |
3099 | - $colour = '#00BB00'; // Safe - green |
|
3099 | + $colour = '#00BB00'; // Safe - green |
|
3100 | 3100 | } elseif ($percentage < 90) { |
3101 | - $colour = '#ffd400'; // Filling up - yelloworange |
|
3101 | + $colour = '#ffd400'; // Filling up - yelloworange |
|
3102 | 3102 | } else { |
3103 | - $colour = '#DD0000'; // Full - red |
|
3103 | + $colour = '#DD0000'; // Full - red |
|
3104 | 3104 | } |
3105 | 3105 | |
3106 | 3106 | // This is used for the table width: a table of only 100 pixels looks too small |
3107 | 3107 | $visual_percentage = 4 * $percentage; |
3108 | 3108 | $visual_other_percentage = 4 * $other_percentage; |
3109 | 3109 | |
3110 | - $message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' . |
|
3111 | - get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />'; |
|
3110 | + $message .= get_lang('PercentageQuotaInUse').': <strong>'.$percentage.'%</strong>.<br />'. |
|
3111 | + get_lang('PercentageQuotaFree').': <strong>'.$other_percentage.'%</strong>.<br />'; |
|
3112 | 3112 | |
3113 | - $show_percentage = ' ' . $percentage . '%'; |
|
3114 | - $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' . |
|
3115 | - '<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;"> </div>' . |
|
3116 | - '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>'; |
|
3113 | + $show_percentage = ' '.$percentage.'%'; |
|
3114 | + $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\''.api_get_path(WEB_CODE_PATH).'css/'.api_get_visual_theme().'/images/bg-header4.png\');" class="document-quota-bar">'. |
|
3115 | + '<div style="width:'.$percentage.'%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;"> </div>'. |
|
3116 | + '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">'.$show_percentage.'</span></div>'; |
|
3117 | 3117 | echo $message; |
3118 | 3118 | } |
3119 | 3119 | |
@@ -3129,7 +3129,7 @@ discard block |
||
3129 | 3129 | $percentage = $already_consumed_space / $course_quota * 100; |
3130 | 3130 | $percentage = round($percentage, 1); |
3131 | 3131 | $message = get_lang('YouAreCurrentlyUsingXOfYourX'); |
3132 | - $message = sprintf($message, $already_consumed_space_m, $percentage . '%', $course_quota_m . ' '); |
|
3132 | + $message = sprintf($message, $already_consumed_space_m, $percentage.'%', $course_quota_m.' '); |
|
3133 | 3133 | echo Display::div($message, array('id' => 'document_quota')); |
3134 | 3134 | } |
3135 | 3135 | |
@@ -3161,13 +3161,13 @@ discard block |
||
3161 | 3161 | */ |
3162 | 3162 | public static function generate_jplayer_jquery($params = array()) |
3163 | 3163 | { |
3164 | - $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/'; |
|
3164 | + $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; |
|
3165 | 3165 | |
3166 | 3166 | $js = ' |
3167 | - $("#jquery_jplayer_' . $params['count'] . '").jPlayer({ |
|
3167 | + $("#jquery_jplayer_' . $params['count'].'").jPlayer({ |
|
3168 | 3168 | ready: function() { |
3169 | 3169 | $(this).jPlayer("setMedia", { |
3170 | - ' . $params['extension'] . ' : "' . $params['url'] . '" |
|
3170 | + ' . $params['extension'].' : "'.$params['url'].'" |
|
3171 | 3171 | }); |
3172 | 3172 | }, |
3173 | 3173 | play: function() { // To avoid both jPlayers playing together. |
@@ -3175,12 +3175,12 @@ discard block |
||
3175 | 3175 | }, |
3176 | 3176 | //errorAlerts: true, |
3177 | 3177 | //warningAlerts: true, |
3178 | - swfPath: "' . $js_path . 'jquery-jplayer/jplayer/", |
|
3178 | + swfPath: "' . $js_path.'jquery-jplayer/jplayer/", |
|
3179 | 3179 | //supplied: "m4a, oga, mp3, ogg, wav", |
3180 | - supplied: "' . $params['extension'] . '", |
|
3180 | + supplied: "' . $params['extension'].'", |
|
3181 | 3181 | wmode: "window", |
3182 | 3182 | solution: "flash, html", // Do not change this setting |
3183 | - cssSelectorAncestor: "#jp_container_' . $params['count'] . '", |
|
3183 | + cssSelectorAncestor: "#jp_container_' . $params['count'].'", |
|
3184 | 3184 | }); ' . "\n\n"; |
3185 | 3185 | |
3186 | 3186 | return $js; |
@@ -3210,16 +3210,16 @@ discard block |
||
3210 | 3210 | } |
3211 | 3211 | |
3212 | 3212 | //Shows only the play button |
3213 | - $html = '<div id="jquery_jplayer_' . $i . '" class="jp-jplayer"></div> |
|
3214 | - <div id="jp_container_' . $i . '" class="jp-audio"> |
|
3213 | + $html = '<div id="jquery_jplayer_'.$i.'" class="jp-jplayer"></div> |
|
3214 | + <div id="jp_container_' . $i.'" class="jp-audio"> |
|
3215 | 3215 | <div class="jp-type-single"> |
3216 | 3216 | <div class="jp-gui jp-interface"> |
3217 | 3217 | <ul class="jp-controls"> |
3218 | 3218 | <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li> |
3219 | 3219 | <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li> |
3220 | - ' . $extra_controls . ' |
|
3220 | + ' . $extra_controls.' |
|
3221 | 3221 | </ul> |
3222 | - ' . $progress . ' |
|
3222 | + ' . $progress.' |
|
3223 | 3223 | </div> |
3224 | 3224 | </div> |
3225 | 3225 | </div>'; |
@@ -3272,8 +3272,8 @@ discard block |
||
3272 | 3272 | </div> |
3273 | 3273 | </div> |
3274 | 3274 | <div class="jp-no-solution"> |
3275 | - <span>' . get_lang('UpdateRequire') . '</span> |
|
3276 | - ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile") . ' |
|
3275 | + <span>' . get_lang('UpdateRequire').'</span> |
|
3276 | + ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile").' |
|
3277 | 3277 | </div> |
3278 | 3278 | </div> |
3279 | 3279 | </div>'; |
@@ -3354,7 +3354,7 @@ discard block |
||
3354 | 3354 | |
3355 | 3355 | $add_folder_filter = null; |
3356 | 3356 | if (!empty($filter_by_folder)) { |
3357 | - $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'"; |
|
3357 | + $add_folder_filter = " AND docs.path LIKE '".Database::escape_string($filter_by_folder)."%'"; |
|
3358 | 3358 | } |
3359 | 3359 | |
3360 | 3360 | // If we are in LP display hidden folder https://support.chamilo.org/issues/6679 |
@@ -3389,7 +3389,7 @@ discard block |
||
3389 | 3389 | |
3390 | 3390 | $notLikeCondition = null; |
3391 | 3391 | for ($i = 1; $i <= $num; $i++) { |
3392 | - $repeat = str_repeat('/%', $i+1); |
|
3392 | + $repeat = str_repeat('/%', $i + 1); |
|
3393 | 3393 | $notLikeCondition .= " AND docs.path NOT LIKE '".Database::escape_string($cleanedPath.$repeat)."' "; |
3394 | 3394 | } |
3395 | 3395 | |
@@ -3414,7 +3414,7 @@ discard block |
||
3414 | 3414 | ON (docs.id = last.ref AND docs.c_id = last.c_id) |
3415 | 3415 | WHERE |
3416 | 3416 | docs.path NOT LIKE '%_DELETED_%' AND |
3417 | - last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND |
|
3417 | + last.tool = '".TOOL_DOCUMENT."' $condition_session AND |
|
3418 | 3418 | (last.visibility = '1' $lp_visibility_condition) AND |
3419 | 3419 | last.visibility <> 2 AND |
3420 | 3420 | docs.c_id = {$course_info['real_id']} AND |
@@ -3444,7 +3444,7 @@ discard block |
||
3444 | 3444 | Display::url( |
3445 | 3445 | Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL), |
3446 | 3446 | ' javascript:void(0);', |
3447 | - array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div') |
|
3447 | + array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div') |
|
3448 | 3448 | ), |
3449 | 3449 | array('style' => 'position:absolute;right:10px') |
3450 | 3450 | ); |
@@ -3548,7 +3548,7 @@ discard block |
||
3548 | 3548 | $('#'+tempId).hide(); |
3549 | 3549 | } else { |
3550 | 3550 | image.addClass('open'); |
3551 | - image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "'); |
|
3551 | + image.attr('src', '" . Display::returnIconPath('nolines_minus.gif')."'); |
|
3552 | 3552 | $('#'+id).hide(); |
3553 | 3553 | $('#'+tempId).show(); |
3554 | 3554 | |
@@ -3595,7 +3595,7 @@ discard block |
||
3595 | 3595 | $target, |
3596 | 3596 | $overwrite_url |
3597 | 3597 | ) { |
3598 | - $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/'; |
|
3598 | + $img_sys_path = api_get_path(SYS_CODE_PATH).'img/'; |
|
3599 | 3599 | $web_code_path = api_get_path(WEB_CODE_PATH); |
3600 | 3600 | |
3601 | 3601 | $documentId = $resource['id']; |
@@ -3610,7 +3610,7 @@ discard block |
||
3610 | 3610 | // It's a file. |
3611 | 3611 | $icon = choose_image($path); |
3612 | 3612 | $position = strrpos($icon, '.'); |
3613 | - $icon = substr($icon, 0, $position) . '_small.gif'; |
|
3613 | + $icon = substr($icon, 0, $position).'_small.gif'; |
|
3614 | 3614 | $my_file_title = $resource['title']; |
3615 | 3615 | $visibility = $resource['visibility']; |
3616 | 3616 | |
@@ -3622,29 +3622,29 @@ discard block |
||
3622 | 3622 | // Show the "image name" not the filename of the image. |
3623 | 3623 | if ($lp_id) { |
3624 | 3624 | // LP URL |
3625 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=add_item&type=' . TOOL_DOCUMENT . '&file=' . $documentId . '&lp_id=' . $lp_id; |
|
3625 | + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&file='.$documentId.'&lp_id='.$lp_id; |
|
3626 | 3626 | if (!empty($overwrite_url)) { |
3627 | - $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.''; |
|
3627 | + $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.''; |
|
3628 | 3628 | } |
3629 | 3629 | } else { |
3630 | 3630 | // Direct document URL |
3631 | - $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId; |
|
3631 | + $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId; |
|
3632 | 3632 | if (!empty($overwrite_url)) { |
3633 | - $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId; |
|
3633 | + $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId; |
|
3634 | 3634 | } |
3635 | 3635 | } |
3636 | 3636 | |
3637 | 3637 | $img = Display::returnIconPath($icon); |
3638 | - if (!file_exists($img_sys_path . $icon)) { |
|
3638 | + if (!file_exists($img_sys_path.$icon)) { |
|
3639 | 3639 | $img = Display::returnIconPath('default_small.gif'); |
3640 | 3640 | } |
3641 | 3641 | |
3642 | 3642 | $link = Display::url( |
3643 | - '<img alt="" src="' . $img . '" title="" /> ' . $my_file_title, $url, |
|
3643 | + '<img alt="" src="'.$img.'" title="" /> '.$my_file_title, $url, |
|
3644 | 3644 | array('target' => $target, 'class' => 'moved') |
3645 | 3645 | ); |
3646 | 3646 | |
3647 | - $directUrl = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId; |
|
3647 | + $directUrl = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId; |
|
3648 | 3648 | |
3649 | 3649 | $link .= Display::url( |
3650 | 3650 | Display::return_icon('preview_view.png', get_lang('Preview')), |
@@ -3659,12 +3659,12 @@ discard block |
||
3659 | 3659 | $return = null; |
3660 | 3660 | |
3661 | 3661 | if ($lp_id == false) { |
3662 | - $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >'; |
|
3662 | + $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >'; |
|
3663 | 3663 | } else { |
3664 | - $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >'; |
|
3664 | + $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >'; |
|
3665 | 3665 | } |
3666 | 3666 | |
3667 | - $return .= '<div class="item_data" style="margin-left:' . ($num * 5 ) . 'px;margin-right:5px;">'; |
|
3667 | + $return .= '<div class="item_data" style="margin-left:'.($num * 5).'px;margin-right:5px;">'; |
|
3668 | 3668 | |
3669 | 3669 | if ($add_move_button) { |
3670 | 3670 | $return .= '<a class="moved" href="#">'; |
@@ -3729,7 +3729,7 @@ discard block |
||
3729 | 3729 | if (isset($resource['visible']) && $resource['visible'] == 0) { |
3730 | 3730 | $folder_class_hidden = "doc_folder_hidden"; // in base.css |
3731 | 3731 | } |
3732 | - $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"'; |
|
3732 | + $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"'; |
|
3733 | 3733 | } |
3734 | 3734 | $return = null; |
3735 | 3735 | |
@@ -3737,22 +3737,22 @@ discard block |
||
3737 | 3737 | $return = '<ul class="lp_resource">'; |
3738 | 3738 | } |
3739 | 3739 | |
3740 | - $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_' . $resource['id'] . '" style="margin-left:' . ($num * 18) . 'px; ">'; |
|
3740 | + $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_'.$resource['id'].'" style="margin-left:'.($num * 18).'px; ">'; |
|
3741 | 3741 | |
3742 | 3742 | $image = Display::returnIconPath('nolines_plus.gif'); |
3743 | 3743 | if (empty($path)) { |
3744 | 3744 | $image = Display::returnIconPath('nolines_minus.gif'); |
3745 | 3745 | } |
3746 | - $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'] . '" '.$onclick.'>'; |
|
3746 | + $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'].'" '.$onclick.'>'; |
|
3747 | 3747 | $return .= Display::return_icon('lp_folder.gif').' '; |
3748 | 3748 | $return .= '<span '.$onclick.' style="cursor: pointer;" >'.$title.'</span>'; |
3749 | 3749 | $return .= '</li>'; |
3750 | 3750 | |
3751 | 3751 | if (empty($path)) { |
3752 | 3752 | if ($folderId == false) { |
3753 | - $return .= '<div id="res_' . $resource['id'] . '" >'; |
|
3753 | + $return .= '<div id="res_'.$resource['id'].'" >'; |
|
3754 | 3754 | } else { |
3755 | - $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >'; |
|
3755 | + $return .= '<div id="res_'.$resource['id'].'" style="display: none;" >'; |
|
3756 | 3756 | } |
3757 | 3757 | } |
3758 | 3758 | |
@@ -3914,9 +3914,9 @@ discard block |
||
3914 | 3914 | $session_id = api_get_session_id(); |
3915 | 3915 | } |
3916 | 3916 | $course_info = api_get_course_info($course_code); |
3917 | - $course_dir = $course_info['path'] . '/document'; |
|
3917 | + $course_dir = $course_info['path'].'/document'; |
|
3918 | 3918 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
3919 | - $base_work_dir = $sys_course_path . $course_dir; |
|
3919 | + $base_work_dir = $sys_course_path.$course_dir; |
|
3920 | 3920 | |
3921 | 3921 | $course_id = $course_info['real_id']; |
3922 | 3922 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
@@ -3925,7 +3925,7 @@ discard block |
||
3925 | 3925 | $result = Database::query($qry); |
3926 | 3926 | if (Database::num_rows($result) == 1) { |
3927 | 3927 | $row = Database::fetch_array($result); |
3928 | - $doc_path = api_get_path(SYS_COURSE_PATH) . $course_dir . $row['path']; |
|
3928 | + $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; |
|
3929 | 3929 | //TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0 |
3930 | 3930 | // now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while |
3931 | 3931 | $doc_mime = mime_content_type($doc_path); |
@@ -3956,8 +3956,8 @@ discard block |
||
3956 | 3956 | $file_content = self::get_text_content($doc_path, $doc_mime); |
3957 | 3957 | $course_code = Database::escape_string($course_code); |
3958 | 3958 | |
3959 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
3960 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
3959 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
3960 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
3961 | 3961 | |
3962 | 3962 | $ic_slide = new IndexableChunk(); |
3963 | 3963 | $ic_slide->addValue('title', $file_title); |
@@ -3974,7 +3974,7 @@ discard block |
||
3974 | 3974 | $di = new ChamiloIndexer(); |
3975 | 3975 | $return = $di->connectDb(null, null, $lang); |
3976 | 3976 | |
3977 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
3977 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
3978 | 3978 | $specific_fields = get_specific_field_list(); |
3979 | 3979 | |
3980 | 3980 | // process different depending on what to do if file exists |
@@ -4011,7 +4011,7 @@ discard block |
||
4011 | 4011 | } else { //if the specific field is not defined, force an empty one |
4012 | 4012 | $sterms = ''; |
4013 | 4013 | } |
4014 | - $all_specific_terms .= ' ' . $sterms; |
|
4014 | + $all_specific_terms .= ' '.$sterms; |
|
4015 | 4015 | $sterms = explode(',', $sterms); |
4016 | 4016 | foreach ($sterms as $sterm) { |
4017 | 4017 | $sterm = trim($sterm); |
@@ -4025,7 +4025,7 @@ discard block |
||
4025 | 4025 | } |
4026 | 4026 | } |
4027 | 4027 | // Add terms also to content to make terms findable by probabilistic search |
4028 | - $file_content = $all_specific_terms . ' ' . $file_content; |
|
4028 | + $file_content = $all_specific_terms.' '.$file_content; |
|
4029 | 4029 | |
4030 | 4030 | if (!$simulation) { |
4031 | 4031 | $ic_slide->addValue('content', $file_content); |
@@ -4051,7 +4051,7 @@ discard block |
||
4051 | 4051 | } else { //if the specific field is not defined, force an empty one |
4052 | 4052 | $sterms = ''; |
4053 | 4053 | } |
4054 | - $all_specific_terms .= ' ' . $sterms; |
|
4054 | + $all_specific_terms .= ' '.$sterms; |
|
4055 | 4055 | if (!empty($sterms)) { |
4056 | 4056 | $sterms = explode(',', $sterms); |
4057 | 4057 | foreach ($sterms as $sterm) { |
@@ -4063,7 +4063,7 @@ discard block |
||
4063 | 4063 | } |
4064 | 4064 | } |
4065 | 4065 | // Add terms also to content to make terms findable by probabilistic search |
4066 | - $file_content = $all_specific_terms . ' ' . $file_content; |
|
4066 | + $file_content = $all_specific_terms.' '.$file_content; |
|
4067 | 4067 | if (!$simulation) { |
4068 | 4068 | $ic_slide->addValue('content', $file_content); |
4069 | 4069 | $di->addChunk($ic_slide); |
@@ -4346,7 +4346,7 @@ discard block |
||
4346 | 4346 | $defaultVisibility = 'visible'; |
4347 | 4347 | |
4348 | 4348 | if (isset($settings['documents'])) { |
4349 | - $portalDefaultVisibility = 'invisible'; |
|
4349 | + $portalDefaultVisibility = 'invisible'; |
|
4350 | 4350 | if ($settings['documents'] == 'true') { |
4351 | 4351 | $portalDefaultVisibility = 'visible'; |
4352 | 4352 | } |
@@ -4585,7 +4585,7 @@ discard block |
||
4585 | 4585 | //make htaccess with allow from all, and file index.html into temp/audio |
4586 | 4586 | $htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess'; |
4587 | 4587 | if (!file_exists($htaccess)) { |
4588 | - $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
4588 | + $htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
4589 | 4589 | $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w'); |
4590 | 4590 | if ($fp) { |
4591 | 4591 | fwrite($fp, $htaccess_content); |
@@ -4594,9 +4594,9 @@ discard block |
||
4594 | 4594 | } |
4595 | 4595 | |
4596 | 4596 | //encript temp name file |
4597 | - $name_crip = sha1(uniqid());//encript |
|
4598 | - $findext= explode(".", $file); |
|
4599 | - $extension = $findext[count($findext)-1]; |
|
4597 | + $name_crip = sha1(uniqid()); //encript |
|
4598 | + $findext = explode(".", $file); |
|
4599 | + $extension = $findext[count($findext) - 1]; |
|
4600 | 4600 | $file_crip = $name_crip.'.'.$extension; |
4601 | 4601 | |
4602 | 4602 | //copy file to temp/audio directory |
@@ -4700,7 +4700,7 @@ discard block |
||
4700 | 4700 | $comment = null; |
4701 | 4701 | |
4702 | 4702 | $fileName = api_replace_dangerous_char($title); |
4703 | - $filePath = api_get_path(SYS_COURSE_PATH) . "{$courseData['path']}/document{$dir}"; |
|
4703 | + $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['path']}/document{$dir}"; |
|
4704 | 4704 | $fileFullPath = "{$filePath}/{$fileName}.html"; |
4705 | 4705 | $fileSize = 0; |
4706 | 4706 | $fileType = 'file'; |
@@ -4752,7 +4752,7 @@ discard block |
||
4752 | 4752 | $fileSize, |
4753 | 4753 | $title, |
4754 | 4754 | $comment, |
4755 | - 0,//$readonly = 0, |
|
4755 | + 0, //$readonly = 0, |
|
4756 | 4756 | true, //$save_visibility = true, |
4757 | 4757 | null, //$group_id = null, |
4758 | 4758 | $sessionId |
@@ -5038,8 +5038,8 @@ discard block |
||
5038 | 5038 | $sessionId, |
5039 | 5039 | $groupId |
5040 | 5040 | )) { |
5041 | - $uniqueName = self::addSuffixToFileName($name, '_' . $counter); |
|
5042 | - $filePath = $path . $uniqueName; |
|
5041 | + $uniqueName = self::addSuffixToFileName($name, '_'.$counter); |
|
5042 | + $filePath = $path.$uniqueName; |
|
5043 | 5043 | $counter++; |
5044 | 5044 | } |
5045 | 5045 | |
@@ -5078,7 +5078,7 @@ discard block |
||
5078 | 5078 | $folder_sql = implode("','", $escaped_folders); |
5079 | 5079 | |
5080 | 5080 | $sql = "SELECT * FROM $doc_table |
5081 | - WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')"; |
|
5081 | + WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('".$folder_sql."')"; |
|
5082 | 5082 | $res = Database::query($sql); |
5083 | 5083 | $folder_titles = array(); |
5084 | 5084 | while ($obj = Database::fetch_object($res)) { |
@@ -5115,9 +5115,9 @@ discard block |
||
5115 | 5115 | $folder_titles[$folder] = cut($folder_titles[$folder], 80); |
5116 | 5116 | $counter = count($path_parts) - 2; |
5117 | 5117 | if ($counter > 0) { |
5118 | - $label = str_repeat(' ', $counter) . ' — ' . $folder_titles[$folder]; |
|
5118 | + $label = str_repeat(' ', $counter).' — '.$folder_titles[$folder]; |
|
5119 | 5119 | } else { |
5120 | - $label = ' — ' . $folder_titles[$folder]; |
|
5120 | + $label = ' — '.$folder_titles[$folder]; |
|
5121 | 5121 | } |
5122 | 5122 | $parent_select->addOption($label, $folder_id); |
5123 | 5123 | if ($selected != '') { |
@@ -5135,7 +5135,7 @@ discard block |
||
5135 | 5135 | } else { |
5136 | 5136 | $path_parts = explode('/', str_replace($group_dir, '', $folder)); |
5137 | 5137 | $label = cut($label, 80); |
5138 | - $label = str_repeat(' ', count($path_parts) - 2) . ' — ' . $label; |
|
5138 | + $label = str_repeat(' ', count($path_parts) - 2).' — '.$label; |
|
5139 | 5139 | } |
5140 | 5140 | $parent_select->addOption($label, $folder_id); |
5141 | 5141 | if ($selected != '') { |
@@ -5168,7 +5168,7 @@ discard block |
||
5168 | 5168 | ) { |
5169 | 5169 | global $dbl_click_id; |
5170 | 5170 | $course_info = api_get_course_info(); |
5171 | - $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document'; |
|
5171 | + $www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document'; |
|
5172 | 5172 | $webOdflist = DocumentManager::get_web_odf_extension_list(); |
5173 | 5173 | |
5174 | 5174 | // Get the title or the basename depending on what we're using |
@@ -5192,11 +5192,11 @@ discard block |
||
5192 | 5192 | |
5193 | 5193 | if (!$show_as_icon) { |
5194 | 5194 | // Build download link (icon) |
5195 | - $forcedownload_link = ($filetype == 'folder') ? api_get_self() . '?' . api_get_cidreq() . '&action=downloadfolder&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id']; |
|
5195 | + $forcedownload_link = ($filetype == 'folder') ? api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq().'&action=download&id='.$document_data['id']; |
|
5196 | 5196 | // Folder download or file download? |
5197 | 5197 | $forcedownload_icon = ($filetype == 'folder') ? 'save_pack.png' : 'save.png'; |
5198 | 5198 | // Prevent multiple clicks on zipped folder download |
5199 | - $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_" . ($dbl_click_id++) . "=false;',10000); } else { return false; }\"" : ''; |
|
5199 | + $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"" : ''; |
|
5200 | 5200 | } |
5201 | 5201 | |
5202 | 5202 | $target = '_self'; |
@@ -5212,17 +5212,17 @@ discard block |
||
5212 | 5212 | |
5213 | 5213 | if ($is_browser_viewable_file) { |
5214 | 5214 | if ($ext == 'pdf' || in_array($ext, $webOdflist)) { |
5215 | - $url = api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id']; |
|
5215 | + $url = api_get_self().'?'.api_get_cidreq().'&action=download&id='.$document_data['id']; |
|
5216 | 5216 | } else { |
5217 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
5217 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
5218 | 5218 | } |
5219 | 5219 | } else { |
5220 | 5220 | // url-encode for problematic characters (we may not call them dangerous characters...) |
5221 | - $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq(); |
|
5222 | - $url = $www . $path; |
|
5221 | + $path = str_replace('%2F', '/', $url_path).'?'.api_get_cidreq(); |
|
5222 | + $url = $www.$path; |
|
5223 | 5223 | } |
5224 | 5224 | } else { |
5225 | - $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
5225 | + $url = api_get_self().'?'.api_get_cidreq().'&id='.$document_data['id']; |
|
5226 | 5226 | } |
5227 | 5227 | |
5228 | 5228 | // The little download icon |
@@ -5232,10 +5232,10 @@ discard block |
||
5232 | 5232 | if ($path == '/shared_folder') { |
5233 | 5233 | $tooltip_title_alt = get_lang('UserFolders'); |
5234 | 5234 | } elseif (strstr($path, 'shared_folder_session_')) { |
5235 | - $tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')'; |
|
5235 | + $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name(api_get_session_id()).')'; |
|
5236 | 5236 | } elseif (strstr($tooltip_title, 'sf_user_')) { |
5237 | 5237 | $userinfo = api_get_user_info(substr($tooltip_title, 8)); |
5238 | - $tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name']; |
|
5238 | + $tooltip_title_alt = get_lang('UserFolder').' '.$userinfo['complete_name']; |
|
5239 | 5239 | } elseif ($path == '/chat_files') { |
5240 | 5240 | $tooltip_title_alt = get_lang('ChatFiles'); |
5241 | 5241 | } elseif ($path == '/learning_path') { |
@@ -5267,24 +5267,24 @@ discard block |
||
5267 | 5267 | ) { |
5268 | 5268 | //filter when I am into shared folder, I can show for donwload only my shared folder |
5269 | 5269 | if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) { |
5270 | - if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) || |
|
5271 | - preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) || |
|
5270 | + if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) || |
|
5271 | + preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) || |
|
5272 | 5272 | api_is_allowed_to_edit() || api_is_platform_admin() |
5273 | 5273 | ) { |
5274 | - $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
5275 | - Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5274 | + $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
5275 | + Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5276 | 5276 | } |
5277 | 5277 | } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) || |
5278 | 5278 | api_is_allowed_to_edit() || |
5279 | 5279 | api_is_platform_admin() |
5280 | 5280 | ) { |
5281 | - $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
5282 | - Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5281 | + $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
5282 | + Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5283 | 5283 | } |
5284 | 5284 | } |
5285 | 5285 | } else { |
5286 | - $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
5287 | - Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5286 | + $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
5287 | + Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5288 | 5288 | } |
5289 | 5289 | |
5290 | 5290 | // Copy files to users myfiles |
@@ -5292,12 +5292,12 @@ discard block |
||
5292 | 5292 | api_get_setting('users_copy_files') === 'true' && |
5293 | 5293 | !api_is_anonymous() |
5294 | 5294 | ) { |
5295 | - $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq(); |
|
5295 | + $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq(); |
|
5296 | 5296 | |
5297 | 5297 | if ($filetype == 'file') { |
5298 | 5298 | |
5299 | - $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
5300 | - Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . ' </a>'; |
|
5299 | + $copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
5300 | + Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).' </a>'; |
|
5301 | 5301 | |
5302 | 5302 | if (api_get_setting('allow_my_files') === 'false') { |
5303 | 5303 | $copy_to_myfiles = ''; |
@@ -5316,13 +5316,13 @@ discard block |
||
5316 | 5316 | $filetype == 'file' && |
5317 | 5317 | in_array($extension, array('html', 'htm')) |
5318 | 5318 | ) { |
5319 | - $pdf_icon = ' <a style="float:right".' . $prevent_multiple_click . ' href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $document_data['id'] . '">' . |
|
5320 | - Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a> '; |
|
5319 | + $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$document_data['id'].'">'. |
|
5320 | + Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> '; |
|
5321 | 5321 | } |
5322 | 5322 | |
5323 | 5323 | if ($is_browser_viewable_file) { |
5324 | - $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' . |
|
5325 | - Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . ' </a>'; |
|
5324 | + $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'. |
|
5325 | + Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).' </a>'; |
|
5326 | 5326 | } |
5327 | 5327 | |
5328 | 5328 | if ($filetype == 'file') { |
@@ -5331,9 +5331,9 @@ discard block |
||
5331 | 5331 | (preg_match('/wav$/i', urldecode($checkExtension))) || |
5332 | 5332 | preg_match('/ogg$/i', urldecode($checkExtension)) |
5333 | 5333 | ) { |
5334 | - return '<span style="float:left" ' . $visibility_class . '>' . |
|
5335 | - $title . |
|
5336 | - '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; |
|
5334 | + return '<span style="float:left" '.$visibility_class.'>'. |
|
5335 | + $title. |
|
5336 | + '</span>'.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; |
|
5337 | 5337 | } elseif ( |
5338 | 5338 | |
5339 | 5339 | // Show preview |
@@ -5346,7 +5346,7 @@ discard block |
||
5346 | 5346 | preg_match('/svg$/i', urldecode($checkExtension)) |
5347 | 5347 | ) { |
5348 | 5348 | // Simpler version of showinframesmin.php with no headers |
5349 | - $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
5349 | + $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
5350 | 5350 | $class = 'ajax'; |
5351 | 5351 | if ($visibility == false) { |
5352 | 5352 | $class = "ajax invisible"; |
@@ -5361,34 +5361,34 @@ discard block |
||
5361 | 5361 | 'style' => 'float: left;' |
5362 | 5362 | ] |
5363 | 5363 | ) |
5364 | - . $force_download_html . $send_to . $copy_to_myfiles |
|
5365 | - . $open_in_new_window_link . $pdf_icon; |
|
5364 | + . $force_download_html.$send_to.$copy_to_myfiles |
|
5365 | + . $open_in_new_window_link.$pdf_icon; |
|
5366 | 5366 | } else { |
5367 | 5367 | // For PDF Download the file. |
5368 | 5368 | $pdfPreview = null; |
5369 | 5369 | if ($ext != 'pdf' && !in_array($ext, $webOdflist)) { |
5370 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
5370 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
5371 | 5371 | } else { |
5372 | 5372 | $pdfPreview = Display::url( |
5373 | 5373 | Display::return_icon('preview.gif', get_lang('Preview')), |
5374 | - api_get_path(WEB_CODE_PATH).'document/showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'], |
|
5374 | + api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'], |
|
5375 | 5375 | array('style' => 'float:right') |
5376 | 5376 | ); |
5377 | 5377 | } |
5378 | 5378 | // No plugin just the old and good showinframes.php page |
5379 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' . |
|
5380 | - $pdfPreview.$force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; |
|
5379 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" style="float:left" '.$visibility_class.' >'.$title.'</a>'. |
|
5380 | + $pdfPreview.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; |
|
5381 | 5381 | } |
5382 | 5382 | } else { |
5383 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . $title . '</a>' . |
|
5384 | - $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; |
|
5383 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.$title.'</a>'. |
|
5384 | + $force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; |
|
5385 | 5385 | } |
5386 | 5386 | // end copy files to users myfiles |
5387 | 5387 | } else { |
5388 | 5388 | // Icon column |
5389 | 5389 | if (preg_match('/shared_folder/', urldecode($checkExtension)) && |
5390 | 5390 | preg_match('/shared_folder$/', urldecode($checkExtension)) == false && |
5391 | - preg_match('/shared_folder_session_' . $current_session_id . '$/', urldecode($url)) == false |
|
5391 | + preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url)) == false |
|
5392 | 5392 | ) { |
5393 | 5393 | if ($filetype == 'file') { |
5394 | 5394 | //Sound preview with jplayer |
@@ -5408,19 +5408,19 @@ discard block |
||
5408 | 5408 | preg_match('/bmp$/i', urldecode($checkExtension)) || |
5409 | 5409 | preg_match('/svg$/i', urldecode($checkExtension)) |
5410 | 5410 | ) { |
5411 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
5412 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
5413 | - DocumentManager::build_document_icon_tag($filetype, $path) . |
|
5414 | - Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; |
|
5411 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
5412 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
5413 | + DocumentManager::build_document_icon_tag($filetype, $path). |
|
5414 | + Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>'; |
|
5415 | 5415 | } else { |
5416 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
5417 | - DocumentManager::build_document_icon_tag($filetype, $path) . |
|
5418 | - Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; |
|
5416 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
5417 | + DocumentManager::build_document_icon_tag($filetype, $path). |
|
5418 | + Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>'; |
|
5419 | 5419 | } |
5420 | 5420 | } else { |
5421 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' . |
|
5422 | - DocumentManager::build_document_icon_tag($filetype, $path) . |
|
5423 | - Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; |
|
5421 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'. |
|
5422 | + DocumentManager::build_document_icon_tag($filetype, $path). |
|
5423 | + Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>'; |
|
5424 | 5424 | } |
5425 | 5425 | } else { |
5426 | 5426 | if ($filetype == 'file') { |
@@ -5443,16 +5443,16 @@ discard block |
||
5443 | 5443 | preg_match('/bmp$/i', urldecode($checkExtension)) || |
5444 | 5444 | preg_match('/svg$/i', urldecode($checkExtension)) |
5445 | 5445 | ) { |
5446 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview |
|
5447 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
5448 | - DocumentManager::build_document_icon_tag($filetype, $path) . '</a>'; |
|
5446 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; //without preview |
|
5447 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
5448 | + DocumentManager::build_document_icon_tag($filetype, $path).'</a>'; |
|
5449 | 5449 | } else { |
5450 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
5451 | - DocumentManager::build_document_icon_tag($filetype, $path) . '</a>'; |
|
5450 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
5451 | + DocumentManager::build_document_icon_tag($filetype, $path).'</a>'; |
|
5452 | 5452 | } |
5453 | 5453 | } else { |
5454 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' . |
|
5455 | - DocumentManager::build_document_icon_tag($filetype, $path) . '</a>'; |
|
5454 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'. |
|
5455 | + DocumentManager::build_document_icon_tag($filetype, $path).'</a>'; |
|
5456 | 5456 | } |
5457 | 5457 | } |
5458 | 5458 | } |
@@ -5487,13 +5487,13 @@ discard block |
||
5487 | 5487 | $userinfo = api_get_user_info(substr($basename, 8)); |
5488 | 5488 | $icon = $userinfo['avatar_small']; |
5489 | 5489 | |
5490 | - $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name']; |
|
5490 | + $basename = get_lang('UserFolder').' '.$userinfo['complete_name']; |
|
5491 | 5491 | $user_image = true; |
5492 | 5492 | } elseif (strstr($path, 'shared_folder_session_')) { |
5493 | 5493 | if ($is_allowed_to_edit) { |
5494 | - $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder'); |
|
5494 | + $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder'); |
|
5495 | 5495 | } else { |
5496 | - $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')'; |
|
5496 | + $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')'; |
|
5497 | 5497 | } |
5498 | 5498 | $icon = 'folder_users.gif'; |
5499 | 5499 | } else { |
@@ -5587,16 +5587,16 @@ discard block |
||
5587 | 5587 | // Build URL-parameters for table-sorting |
5588 | 5588 | $sort_params = array(); |
5589 | 5589 | if (isset($_GET['column'])) { |
5590 | - $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']); |
|
5590 | + $sort_params[] = 'column='.Security::remove_XSS($_GET['column']); |
|
5591 | 5591 | } |
5592 | 5592 | if (isset($_GET['page_nr'])) { |
5593 | - $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']); |
|
5593 | + $sort_params[] = 'page_nr='.Security::remove_XSS($_GET['page_nr']); |
|
5594 | 5594 | } |
5595 | 5595 | if (isset($_GET['per_page'])) { |
5596 | - $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']); |
|
5596 | + $sort_params[] = 'per_page='.Security::remove_XSS($_GET['per_page']); |
|
5597 | 5597 | } |
5598 | 5598 | if (isset($_GET['direction'])) { |
5599 | - $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']); |
|
5599 | + $sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']); |
|
5600 | 5600 | } |
5601 | 5601 | $sort_params = implode('&', $sort_params); |
5602 | 5602 | $visibility_icon = ($visibility == 0) ? 'invisible' : 'visible'; |
@@ -5609,89 +5609,89 @@ discard block |
||
5609 | 5609 | if ($is_read_only /* or ($session_id!=api_get_session_id()) */) { |
5610 | 5610 | if (api_is_course_admin() || api_is_platform_admin()) { |
5611 | 5611 | if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { |
5612 | - $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5613 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5614 | - } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
5615 | - $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5616 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5612 | + $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5613 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5614 | + } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
5615 | + $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5616 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5617 | 5617 | } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { |
5618 | - $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5619 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5618 | + $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5619 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5620 | 5620 | } else { |
5621 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' . |
|
5622 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5621 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5622 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5623 | 5623 | } |
5624 | 5624 | } else { |
5625 | 5625 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
5626 | 5626 | } |
5627 | - $modify_icons .= ' ' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL); |
|
5627 | + $modify_icons .= ' '.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL); |
|
5628 | 5628 | if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
5629 | - $modify_icons .= ' ' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL); |
|
5629 | + $modify_icons .= ' '.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL); |
|
5630 | 5630 | } |
5631 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); |
|
5631 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); |
|
5632 | 5632 | } else { |
5633 | 5633 | //Edit button |
5634 | 5634 | if (in_array($path, DocumentManager::get_system_folders())) { |
5635 | 5635 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
5636 | - } elseif ($is_certificate_mode ) { |
|
5636 | + } elseif ($is_certificate_mode) { |
|
5637 | 5637 | // gradebook category doesn't seem to be taken into account |
5638 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5638 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&curdirpath=/certificates">'.Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5639 | 5639 | } else { |
5640 | 5640 | if (api_get_session_id()) { |
5641 | 5641 | if ($document_data['session_id'] == api_get_session_id()) { |
5642 | 5642 | if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { |
5643 | - $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5644 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5645 | - } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
5646 | - $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5647 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5643 | + $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5644 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5645 | + } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
5646 | + $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5647 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5648 | 5648 | } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { |
5649 | - $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5650 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5649 | + $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5650 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5651 | 5651 | } else { |
5652 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5653 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5652 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5653 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5654 | 5654 | } |
5655 | 5655 | } else { |
5656 | - $modify_icons .= ' ' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5656 | + $modify_icons .= ' '.Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5657 | 5657 | } |
5658 | 5658 | } else { |
5659 | 5659 | if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { |
5660 | - $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5661 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5662 | - } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
5663 | - $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5664 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5660 | + $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5661 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5662 | + } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
5663 | + $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5664 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5665 | 5665 | } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { |
5666 | - $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5667 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5666 | + $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5667 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5668 | 5668 | } else { |
5669 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
5670 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5669 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
5670 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
5671 | 5671 | } |
5672 | 5672 | } |
5673 | 5673 | } |
5674 | 5674 | |
5675 | 5675 | // Move button. |
5676 | 5676 | if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) { |
5677 | - $modify_icons .= ' ' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5677 | + $modify_icons .= ' '.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5678 | 5678 | } else { |
5679 | 5679 | if (api_get_session_id()) { |
5680 | 5680 | if ($document_data['session_id'] == api_get_session_id()) { |
5681 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&id=' . $parent_id . '&move=' . $document_id . '">' . |
|
5682 | - Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5681 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'&move='.$document_id.'">'. |
|
5682 | + Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5683 | 5683 | } else { |
5684 | - $modify_icons .= ' ' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5684 | + $modify_icons .= ' '.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5685 | 5685 | } |
5686 | 5686 | } else { |
5687 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&id=' . $parent_id . '&move=' . $document_id . '">' . |
|
5688 | - Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5687 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'&move='.$document_id.'">'. |
|
5688 | + Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5689 | 5689 | } |
5690 | 5690 | } |
5691 | 5691 | |
5692 | 5692 | //Visibility button |
5693 | 5693 | if ($is_certificate_mode) { |
5694 | - $modify_icons .= ' ' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5694 | + $modify_icons .= ' '.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5695 | 5695 | } else { |
5696 | 5696 | if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
5697 | 5697 | if ($visibility_icon == 'invisible') { |
@@ -5699,14 +5699,14 @@ discard block |
||
5699 | 5699 | } else { |
5700 | 5700 | $tip_visibility = get_lang('Hide'); |
5701 | 5701 | } |
5702 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&id=' . $parent_id . '&' . $visibility_command . '=' . $id . '&' . $sort_params . '">' . |
|
5703 | - Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>'; |
|
5702 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'&'.$visibility_command.'='.$id.'&'.$sort_params.'">'. |
|
5703 | + Display::return_icon($visibility_icon.'.png', $tip_visibility, '', ICON_SIZE_SMALL).'</a>'; |
|
5704 | 5704 | } |
5705 | 5705 | } |
5706 | 5706 | |
5707 | 5707 | // Delete button |
5708 | 5708 | if (in_array($path, DocumentManager::get_system_folders())) { |
5709 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
5709 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
5710 | 5710 | } else { |
5711 | 5711 | $titleToShow = addslashes(basename($document_data['title'])); |
5712 | 5712 | |
@@ -5714,23 +5714,23 @@ discard block |
||
5714 | 5714 | $_GET['curdirpath'] == '/certificates' && |
5715 | 5715 | DocumentManager::get_default_certificate_id(api_get_course_id()) == $id |
5716 | 5716 | ) { |
5717 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' . |
|
5718 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5717 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'delete_certificate_id='.$id.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
5718 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5719 | 5719 | } else { |
5720 | 5720 | if ($is_certificate_mode) { |
5721 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id . '&' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' . |
|
5722 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5721 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
5722 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5723 | 5723 | } else { |
5724 | 5724 | if (api_get_session_id()) { |
5725 | 5725 | if ($document_data['session_id'] == api_get_session_id()) { |
5726 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'. |
|
5727 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5726 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
5727 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5728 | 5728 | } else { |
5729 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
5729 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
5730 | 5730 | } |
5731 | 5731 | } else { |
5732 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' . |
|
5733 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5732 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
5733 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5734 | 5734 | } |
5735 | 5735 | } |
5736 | 5736 | } |
@@ -5742,15 +5742,15 @@ discard block |
||
5742 | 5742 | // nothing to do |
5743 | 5743 | } else { |
5744 | 5744 | if ($usePpt2lp && $formatType) { |
5745 | - $modify_icons .= ' <a class="convertAction" href="#" ' . |
|
5746 | - 'data-documentId = ' . $document_id . |
|
5747 | - ' data-formatType = ' . $formatType . '>' . |
|
5745 | + $modify_icons .= ' <a class="convertAction" href="#" '. |
|
5746 | + 'data-documentId = '.$document_id. |
|
5747 | + ' data-formatType = '.$formatType.'>'. |
|
5748 | 5748 | Display::return_icon( |
5749 | 5749 | 'convert.png', |
5750 | 5750 | get_lang('Convert'), |
5751 | 5751 | array(), |
5752 | 5752 | ICON_SIZE_SMALL |
5753 | - ) . '</a>'; |
|
5753 | + ).'</a>'; |
|
5754 | 5754 | } |
5755 | 5755 | } |
5756 | 5756 | } |
@@ -5758,8 +5758,8 @@ discard block |
||
5758 | 5758 | if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) { |
5759 | 5759 | if ($is_template == 0) { |
5760 | 5760 | if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) { |
5761 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&add_as_template=' . $id . '&' . $sort_params . '">' . |
|
5762 | - Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5761 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&add_as_template='.$id.'&'.$sort_params.'">'. |
|
5762 | + Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5763 | 5763 | } |
5764 | 5764 | if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course |
5765 | 5765 | $visibility_icon_certificate = 'nocertificate'; |
@@ -5773,21 +5773,21 @@ discard block |
||
5773 | 5773 | $certificate = get_lang('NoDefaultCertificate'); |
5774 | 5774 | } |
5775 | 5775 | if (isset($_GET['selectcat'])) { |
5776 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&selectcat=' . intval($_GET['selectcat']) . '&set_certificate=' . $id . '&' . $sort_params . '">'; |
|
5776 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&selectcat='.intval($_GET['selectcat']).'&set_certificate='.$id.'&'.$sort_params.'">'; |
|
5777 | 5777 | $modify_icons .= Display::return_icon($visibility_icon_certificate.'.png', $certificate); |
5778 | 5778 | $modify_icons .= '</a>'; |
5779 | 5779 | if ($is_preview) { |
5780 | - $modify_icons .= ' <a target="_blank" href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&set_preview=' . $id . '&' . $sort_params . '" >' . |
|
5781 | - Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>'; |
|
5780 | + $modify_icons .= ' <a target="_blank" href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&set_preview='.$id.'&'.$sort_params.'" >'. |
|
5781 | + Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL).'</a>'; |
|
5782 | 5782 | } |
5783 | 5783 | } |
5784 | 5784 | } |
5785 | 5785 | } else { |
5786 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&remove_as_template=' . $id. '&' . $sort_params . '">' . |
|
5787 | - Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>'; |
|
5786 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&remove_as_template='.$id.'&'.$sort_params.'">'. |
|
5787 | + Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL).'</a>'; |
|
5788 | 5788 | } |
5789 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' . |
|
5790 | - Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
5789 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$id.'">'. |
|
5790 | + Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a>'; |
|
5791 | 5791 | } |
5792 | 5792 | |
5793 | 5793 | return $modify_icons; |
@@ -5859,7 +5859,7 @@ discard block |
||
5859 | 5859 | // 3. inside a subfolder of the folder you want to move |
5860 | 5860 | if (($curdirpath != $folder) && |
5861 | 5861 | ($folder != $move_file) && |
5862 | - (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') |
|
5862 | + (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/') |
|
5863 | 5863 | ) { |
5864 | 5864 | $path_displayed = $folder; |
5865 | 5865 | // If document title is used, we have to display titles instead of real paths... |
@@ -5876,7 +5876,7 @@ discard block |
||
5876 | 5876 | foreach ($folders as $folder) { |
5877 | 5877 | if (($curdirpath != $folder) && |
5878 | 5878 | ($folder != $move_file) && |
5879 | - (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') |
|
5879 | + (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/') |
|
5880 | 5880 | ) { |
5881 | 5881 | // Cannot copy dir into his own subdir |
5882 | 5882 | $path_displayed = DocumentManager::get_titles_of_path($folder); |
@@ -5919,10 +5919,10 @@ discard block |
||
5919 | 5919 | // If this path has soon been stored here we don't need a new query |
5920 | 5920 | $path_displayed .= $tmp_folders_titles[$tmp_path]; |
5921 | 5921 | } else { |
5922 | - $sql = 'SELECT title FROM ' . Database::get_course_table(TABLE_DOCUMENT) . ' |
|
5923 | - WHERE c_id = ' . $course_id . ' AND path LIKE BINARY "' . $tmp_path . '"'; |
|
5922 | + $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).' |
|
5923 | + WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"'; |
|
5924 | 5924 | $rs = Database::query($sql); |
5925 | - $tmp_title = '/' . Database::result($rs, 0, 0); |
|
5925 | + $tmp_title = '/'.Database::result($rs, 0, 0); |
|
5926 | 5926 | $path_displayed .= $tmp_title; |
5927 | 5927 | $tmp_folders_titles[$tmp_path] = $tmp_title; |
5928 | 5928 | } |
@@ -5959,7 +5959,7 @@ discard block |
||
5959 | 5959 | $clean_curdirpath = Security::remove_XSS($curdirpath); |
5960 | 5960 | if ($clean_curdirpath == '/shared_folder') { |
5961 | 5961 | return true; |
5962 | - } elseif ($clean_curdirpath == '/shared_folder_session_' . $current_session_id) { |
|
5962 | + } elseif ($clean_curdirpath == '/shared_folder_session_'.$current_session_id) { |
|
5963 | 5963 | return true; |
5964 | 5964 | } else { |
5965 | 5965 | return false; |
@@ -5975,7 +5975,7 @@ discard block |
||
5975 | 5975 | $clean_path = Security::remove_XSS($path); |
5976 | 5976 | if (strpos($clean_path, 'shared_folder/sf_user_')) { |
5977 | 5977 | return true; |
5978 | - } elseif (strpos($clean_path, 'shared_folder_session_' . $current_session_id . '/sf_user_')) { |
|
5978 | + } elseif (strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')) { |
|
5979 | 5979 | return true; |
5980 | 5980 | } else { |
5981 | 5981 | return false; |
@@ -5988,11 +5988,11 @@ discard block |
||
5988 | 5988 | */ |
5989 | 5989 | public static function is_my_shared_folder($user_id, $path, $current_session_id) |
5990 | 5990 | { |
5991 | - $clean_path = Security::remove_XSS($path) . '/'; |
|
5991 | + $clean_path = Security::remove_XSS($path).'/'; |
|
5992 | 5992 | //for security does not remove the last slash |
5993 | - $main_user_shared_folder = '/shared_folder\/sf_user_' . $user_id . '\//'; |
|
5993 | + $main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//'; |
|
5994 | 5994 | //for security does not remove the last slash |
5995 | - $main_user_shared_folder_session = '/shared_folder_session_' . $current_session_id . '\/sf_user_' . $user_id . '\//'; |
|
5995 | + $main_user_shared_folder_session = '/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//'; |
|
5996 | 5996 | |
5997 | 5997 | if (preg_match($main_user_shared_folder, $clean_path)) { |
5998 | 5998 | return true; |
@@ -6265,7 +6265,7 @@ discard block |
||
6265 | 6265 | ON (i.c_id = d.c_id) |
6266 | 6266 | WHERE |
6267 | 6267 | d.id = i.ref AND |
6268 | - i.tool = '" . TOOL_DOCUMENT . "' |
|
6268 | + i.tool = '".TOOL_DOCUMENT."' |
|
6269 | 6269 | $conditionSession AND |
6270 | 6270 | i.c_id = $courseId AND |
6271 | 6271 | d.c_id = $courseId "; |
@@ -6273,9 +6273,9 @@ discard block |
||
6273 | 6273 | $result = Database::query($sql); |
6274 | 6274 | $documents = Database::store_result($result, 'ASSOC'); |
6275 | 6275 | if ($documents) { |
6276 | - $course_dir = $courseInfo['directory'] . '/document'; |
|
6276 | + $course_dir = $courseInfo['directory'].'/document'; |
|
6277 | 6277 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
6278 | - $base_work_dir = $sys_course_path . $course_dir; |
|
6278 | + $base_work_dir = $sys_course_path.$course_dir; |
|
6279 | 6279 | |
6280 | 6280 | foreach ($documents as $document) { |
6281 | 6281 | $documentId = $document['id']; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | /** |
278 | 278 | * @param string |
279 | 279 | * @param string |
280 | - * @return true if the user is allowed to see the document, false otherwise |
|
280 | + * @return boolean if the user is allowed to see the document, false otherwise |
|
281 | 281 | * @author Sergio A Kessler, first version |
282 | 282 | * @author Roan Embrechts, bugfix |
283 | 283 | * @todo not only check if a file is visible, but also check if the user is allowed to see the file?? |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | * Return true if the documentpath have visibility=1 as |
1530 | 1530 | * item_property (you should use the is_visible_by_id) |
1531 | 1531 | * |
1532 | - * @param string $document_path the relative complete path of the document |
|
1532 | + * @param string $doc_path the relative complete path of the document |
|
1533 | 1533 | * @param array $course the _course array info of the document's course |
1534 | 1534 | * @param int |
1535 | 1535 | * @param string |
@@ -1615,6 +1615,8 @@ discard block |
||
1615 | 1615 | * @param int |
1616 | 1616 | * @param int |
1617 | 1617 | * @param bool |
1618 | + * @param integer $session_id |
|
1619 | + * @param integer $user_id |
|
1618 | 1620 | * @return bool |
1619 | 1621 | */ |
1620 | 1622 | public static function is_visible_by_id( |
@@ -1966,7 +1968,7 @@ discard block |
||
1966 | 1968 | * Remove default certificate |
1967 | 1969 | * @param string $course_id The course code |
1968 | 1970 | * @param int $default_certificate_id The document id of the default certificate |
1969 | - * @return void |
|
1971 | + * @return false|null |
|
1970 | 1972 | */ |
1971 | 1973 | public static function remove_attach_certificate($course_id, $default_certificate_id) |
1972 | 1974 | { |
@@ -2101,6 +2103,7 @@ discard block |
||
2101 | 2103 | * @param bool is file or string html |
2102 | 2104 | * @param string type (one of the app tools) - optional (otherwise takes the current item's type) |
2103 | 2105 | * @param int level of recursivity we're in |
2106 | + * @param string $source_html |
|
2104 | 2107 | * @return array List of file paths. An additional field containing 'local' or 'remote' helps determine |
2105 | 2108 | * if the file should be copied into the zip or just linked |
2106 | 2109 | */ |
@@ -2940,6 +2943,7 @@ discard block |
||
2940 | 2943 | |
2941 | 2944 | /** |
2942 | 2945 | * Obtains the text inside the file with the right parser |
2946 | + * @param string $doc_path |
|
2943 | 2947 | */ |
2944 | 2948 | public static function get_text_content($doc_path, $doc_mime) |
2945 | 2949 | { |
@@ -3191,6 +3195,7 @@ discard block |
||
3191 | 3195 | * Shows a play icon next to the document title in the document list |
3192 | 3196 | * @param int |
3193 | 3197 | * @param string |
3198 | + * @param integer|null $i |
|
3194 | 3199 | * @return string html content |
3195 | 3200 | */ |
3196 | 3201 | public static function generate_media_preview($i, $type = 'simple') |
@@ -4089,7 +4094,7 @@ discard block |
||
4089 | 4094 | } |
4090 | 4095 | |
4091 | 4096 | /** |
4092 | - * @return array |
|
4097 | + * @return string[] |
|
4093 | 4098 | */ |
4094 | 4099 | public static function get_web_odf_extension_list() |
4095 | 4100 | { |
@@ -4098,10 +4103,10 @@ discard block |
||
4098 | 4103 | |
4099 | 4104 | /** |
4100 | 4105 | * Set of extension allowed to use Jodconverter |
4101 | - * @param $mode 'from' |
|
4106 | + * @param string $mode 'from' |
|
4102 | 4107 | * 'to' |
4103 | 4108 | * 'all' |
4104 | - * @param $format 'text' |
|
4109 | + * @param string $format 'text' |
|
4105 | 4110 | * 'spreadsheet' |
4106 | 4111 | * 'presentation' |
4107 | 4112 | * 'drawing' |
@@ -4305,7 +4310,7 @@ discard block |
||
4305 | 4310 | } |
4306 | 4311 | |
4307 | 4312 | /** |
4308 | - * @return array |
|
4313 | + * @return string[] |
|
4309 | 4314 | */ |
4310 | 4315 | public static function get_system_folders() |
4311 | 4316 | { |
@@ -4323,7 +4328,7 @@ discard block |
||
4323 | 4328 | } |
4324 | 4329 | |
4325 | 4330 | /** |
4326 | - * @return array |
|
4331 | + * @return string[] |
|
4327 | 4332 | */ |
4328 | 4333 | public static function getProtectedFolderFromStudent() |
4329 | 4334 | { |
@@ -4479,7 +4484,7 @@ discard block |
||
4479 | 4484 | * Requires the ffmpeg lib. In ubuntu: sudo apt-get install ffmpeg |
4480 | 4485 | * @param string $wavFile |
4481 | 4486 | * @param bool $removeWavFileIfSuccess |
4482 | - * @return bool |
|
4487 | + * @return string|false |
|
4483 | 4488 | */ |
4484 | 4489 | public static function convertWavToMp3($wavFile, $removeWavFileIfSuccess = false) |
4485 | 4490 | { |
@@ -5055,6 +5060,8 @@ discard block |
||
5055 | 5060 | * @param string The current folder (path inside of the "document" directory, including the prefix "/") |
5056 | 5061 | * @param string Group directory, if empty, prevents documents to be uploaded (because group documents cannot be uploaded in root) |
5057 | 5062 | * @param boolean Whether to change the renderer (this will add a template <span> to the QuickForm object displaying the form) |
5063 | + * @param string $document_id |
|
5064 | + * @param FormValidator $form |
|
5058 | 5065 | |
5059 | 5066 | * @return string html form |
5060 | 5067 | */ |
@@ -5560,9 +5567,6 @@ discard block |
||
5560 | 5567 | /** |
5561 | 5568 | * Creates the row of edit icons for a file/folder |
5562 | 5569 | * |
5563 | - * @param string $curdirpath current path (cfr open folder) |
|
5564 | - * @param string $type (file/folder) |
|
5565 | - * @param string $path dbase path of file/folder |
|
5566 | 5570 | * @param int $visibility (1/0) |
5567 | 5571 | * @param int $id dbase id of the document |
5568 | 5572 | * @return string html img tags with hyperlinks |
@@ -5896,7 +5900,7 @@ discard block |
||
5896 | 5900 | /** |
5897 | 5901 | * Gets the path translated with title of docs and folders |
5898 | 5902 | * @param string $path the real path |
5899 | - * @return the path which should be displayed |
|
5903 | + * @return string path which should be displayed |
|
5900 | 5904 | */ |
5901 | 5905 | public static function get_titles_of_path($path) |
5902 | 5906 | { |
@@ -5952,7 +5956,8 @@ discard block |
||
5952 | 5956 | |
5953 | 5957 | /** |
5954 | 5958 | * Checks whether the user is in shared folder |
5955 | - * @return return bool Return true when user is into shared folder |
|
5959 | + * @param integer $current_session_id |
|
5960 | + * @return boolean bool Return true when user is into shared folder |
|
5956 | 5961 | */ |
5957 | 5962 | public static function is_shared_folder($curdirpath, $current_session_id) |
5958 | 5963 | { |
@@ -5968,7 +5973,7 @@ discard block |
||
5968 | 5973 | |
5969 | 5974 | /** |
5970 | 5975 | * Checks whether the user is into any user shared folder |
5971 | - * @return return bool Return true when user is in any user shared folder |
|
5976 | + * @return boolean bool Return true when user is in any user shared folder |
|
5972 | 5977 | */ |
5973 | 5978 | public static function is_any_user_shared_folder($path, $current_session_id) |
5974 | 5979 | { |
@@ -6182,7 +6187,7 @@ discard block |
||
6182 | 6187 | * @param int $id |
6183 | 6188 | * @param array $courseInfo |
6184 | 6189 | * @param int $sessionId |
6185 | - * @return bool |
|
6190 | + * @return boolean|null |
|
6186 | 6191 | */ |
6187 | 6192 | public static function downloadDeletedDocument($id, $courseInfo, $sessionId) |
6188 | 6193 | { |
@@ -6201,7 +6206,7 @@ discard block |
||
6201 | 6206 | * @param array $courseInfo |
6202 | 6207 | * @param int $sessionId |
6203 | 6208 | * |
6204 | - * @return bool |
|
6209 | + * @return false|null |
|
6205 | 6210 | */ |
6206 | 6211 | public static function downloadAllDeletedDocument($courseInfo, $sessionId) |
6207 | 6212 | { |
@@ -6240,7 +6245,7 @@ discard block |
||
6240 | 6245 | * @param array $courseInfo |
6241 | 6246 | * @param int $sessionId |
6242 | 6247 | * |
6243 | - * @return bool |
|
6248 | + * @return false|null |
|
6244 | 6249 | */ |
6245 | 6250 | public static function deleteDocumentsFromSession($courseInfo, $sessionId) |
6246 | 6251 | { |
@@ -84,7 +84,7 @@ |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Available driver list. |
87 | - * @return array |
|
87 | + * @return string[] |
|
88 | 88 | */ |
89 | 89 | private function getDefaultDriverList() |
90 | 90 | { |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $promotion = new Promotion(); |
63 | 63 | $promotion_list = $promotion->get_all_promotions_by_career_id($career_id); |
64 | 64 | if (!empty($promotion_list)) { |
65 | - foreach($promotion_list as $item) { |
|
65 | + foreach ($promotion_list as $item) { |
|
66 | 66 | $params['id'] = $item['id']; |
67 | 67 | $params['status'] = $status; |
68 | 68 | $promotion->update($params); |
@@ -85,12 +85,12 @@ |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | if(!empty($url_string)) { |
88 | - Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); |
|
88 | + Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // checking the current installation |
92 | 92 | if ($current_access_url_id==-1) { |
93 | - Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); |
|
93 | + Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); |
|
94 | 94 | } elseif(api_is_platform_admin()) { |
95 | 95 | $quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id); |
96 | 96 | if ($quant==0) { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
22 | -$interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
22 | +$interbreadcrumb[] = array("url" => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
23 | 23 | $tool_name = get_lang('MultipleAccessURLs'); |
24 | 24 | Display :: display_header($tool_name); |
25 | 25 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | case 'register': |
56 | 56 | // we are going to register the admin |
57 | 57 | if (api_is_platform_admin()) { |
58 | - if ($current_access_url_id!=-1) { |
|
58 | + if ($current_access_url_id != -1) { |
|
59 | 59 | $url_str = ''; |
60 | 60 | foreach ($url_list as $my_url) { |
61 | 61 | if (!in_array($my_url['id'], $my_user_url_list)) { |
62 | 62 | UrlManager::add_user_to_url(api_get_user_id(), $my_url['id']); |
63 | - $url_str.=$my_url['url'].' <br />'; |
|
63 | + $url_str .= $my_url['url'].' <br />'; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | Display:: display_normal_message( |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | $url_string .= $my_url['url'].' <br />'; |
85 | 85 | } |
86 | 86 | } |
87 | -if(!empty($url_string)) { |
|
88 | - Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); |
|
87 | +if (!empty($url_string)) { |
|
88 | + Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string, false); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // checking the current installation |
92 | -if ($current_access_url_id==-1) { |
|
92 | +if ($current_access_url_id == -1) { |
|
93 | 93 | Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); |
94 | -} elseif(api_is_platform_admin()) { |
|
95 | - $quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id); |
|
96 | - if ($quant==0) { |
|
94 | +} elseif (api_is_platform_admin()) { |
|
95 | + $quant = UrlManager::relation_url_user_exist(api_get_user_id(), $current_access_url_id); |
|
96 | + if ($quant == 0) { |
|
97 | 97 | Display:: display_warning_message( |
98 | 98 | '<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>', |
99 | 99 | false |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | |
143 | 143 | //Status |
144 | 144 | $active = $row['active']; |
145 | - if ($active=='1') { |
|
146 | - $action='lock'; |
|
147 | - $image='right'; |
|
145 | + if ($active == '1') { |
|
146 | + $action = 'lock'; |
|
147 | + $image = 'right'; |
|
148 | 148 | } |
149 | - if ($active=='0') { |
|
150 | - $action='unlock'; |
|
151 | - $image='wrong'; |
|
149 | + if ($active == '0') { |
|
150 | + $action = 'unlock'; |
|
151 | + $image = 'wrong'; |
|
152 | 152 | } |
153 | 153 | // you cannot lock the default |
154 | - if ($row['id']=='1') { |
|
154 | + if ($row['id'] == '1') { |
|
155 | 155 | $status = Display::return_icon($image.'.gif', get_lang(ucfirst($action))); |
156 | 156 | } else { |
157 | 157 | $status = '<a href="access_urls.php?action='.$action.'&url_id='.$row['id'].'">'. |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $url_id = $row['id']; |
162 | 162 | $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id"); |
163 | 163 | if ($url_id != '1') { |
164 | - $actions .= '<a href="access_urls.php?action=delete_url&url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'. |
|
164 | + $actions .= '<a href="access_urls.php?action=delete_url&url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'. |
|
165 | 165 | Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
166 | 166 | } |
167 | 167 | $urls[] = array($url, $description, $status, $actions); |
@@ -274,7 +274,7 @@ |
||
274 | 274 | } |
275 | 275 | break; |
276 | 276 | case "delete": |
277 | - if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $eventId) )) { |
|
277 | + if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $eventId))) { |
|
278 | 278 | // a coach can only delete an element belonging to his session |
279 | 279 | $content = $agenda->deleteEvent($eventId); |
280 | 280 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $renderer->setHeaderTemplate('<legend>{header}</legend>'); |
100 | 100 | |
101 | 101 | //Set required field template |
102 | - $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); |
|
102 | + $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'); |
|
103 | 103 | $noteTemplate = <<<EOT |
104 | 104 | <div class="form-group"> |
105 | 105 | <div class="col-sm-offset-2 col-sm-10">{requiredNote}</div> |
@@ -851,9 +851,9 @@ discard block |
||
851 | 851 | $label = get_lang('PleaseStandBy'); |
852 | 852 | } |
853 | 853 | $this->with_progress_bar = true; |
854 | - $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','" . $label . "','" . $this->getAttribute('id') . "')\""); |
|
855 | - $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
856 | - $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>'); |
|
854 | + $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','".$label."','".$this->getAttribute('id')."')\""); |
|
855 | + $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
856 | + $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>'); |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | return; |
871 | 871 | } |
872 | 872 | |
873 | - $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH) . 'upload.xajax.php'); |
|
873 | + $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH).'upload.xajax.php'); |
|
874 | 874 | |
875 | 875 | $xajax_upload->registerFunction('updateProgress'); |
876 | 876 | // IMPORTANT : must be the first element of the form |
877 | - $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="' . $upload_id . '" />'), $element_after); |
|
877 | + $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="'.$upload_id.'" />'), $element_after); |
|
878 | 878 | |
879 | 879 | $this->addElement('html', '<br />'); |
880 | 880 | |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $this->addElement( |
883 | 883 | 'html', |
884 | 884 | '<div id="dynamic_div_container" style="display:none"> |
885 | - <div id="dynamic_div_label">' . get_lang('UploadFile') . '</div> |
|
885 | + <div id="dynamic_div_label">' . get_lang('UploadFile').'</div> |
|
886 | 886 | <div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url(' . Display::returnIconPath('real_upload_frame.gif').');"> |
887 | 887 | <div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . Display::returnIconPath('real_upload_step.gif').');background-repeat:repeat-x;background-position:center;"></div> |
888 | 888 | </div> |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $this->addElement('html', ' |
894 | 894 | <div id="dynamic_div_waiter_container" style="display:none"> |
895 | 895 | <div id="dynamic_div_waiter_label"> |
896 | - ' . get_lang('SlideshowConversion') . ' |
|
896 | + ' . get_lang('SlideshowConversion').' |
|
897 | 897 | </div> |
898 | 898 | <div id="dynamic_div_waiter_frame"> |
899 | 899 | '.Display::return_icon('real_upload_frame.gif').' |
@@ -903,18 +903,18 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | // Get the xajax code |
906 | - $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH) . 'xajax')); |
|
906 | + $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax')); |
|
907 | 907 | |
908 | 908 | // Get the upload code |
909 | - $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
910 | - $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>'); |
|
909 | + $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
910 | + $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>'); |
|
911 | 911 | |
912 | 912 | if (!$wait_after_upload) { |
913 | 913 | $wait_after_upload = 0; |
914 | 914 | } |
915 | 915 | |
916 | 916 | // Add the upload event |
917 | - $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','" . $upload_id . "','" . $this->getAttribute('id') . "'," . $wait_after_upload . ")\""); |
|
917 | + $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','".$upload_id."','".$this->getAttribute('id')."',".$wait_after_upload.")\""); |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | /** |
@@ -954,7 +954,7 @@ |
||
954 | 954 | /** |
955 | 955 | * This function has been created for avoiding changes directly within QuickForm class. |
956 | 956 | * When we use it, the element is threated as 'required' to be dealt during validation. |
957 | - * @param array $element The array of elements |
|
957 | + * @param array $elements The array of elements |
|
958 | 958 | * @param string $message The message displayed |
959 | 959 | */ |
960 | 960 | public function add_multiple_required_rule($elements, $message) |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | |
55 | 55 | /* Breadcrumbs */ |
56 | 56 | |
57 | -if (isset($_SESSION['gradebook'])){ |
|
57 | +if (isset($_SESSION['gradebook'])) { |
|
58 | 58 | $gradebook = Security::remove_XSS($_SESSION['gradebook']); |
59 | 59 | } |
60 | 60 | |
61 | 61 | if (!empty($gradebook) && $gradebook == 'view') { |
62 | - $interbreadcrumb[] = array ( |
|
62 | + $interbreadcrumb[] = array( |
|
63 | 63 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
64 | 64 | 'name' => get_lang('ToolGradebook') |
65 | 65 | ); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups')); |
118 | 118 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']); |
119 | 119 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']); |
120 | - $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('NewTopic')); |
|
120 | + $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => get_lang('NewTopic')); |
|
121 | 121 | } else { |
122 | 122 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools); |
123 | 123 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']); |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | |
128 | 128 | /* Resource Linker */ |
129 | 129 | if (isset($_POST['add_resources']) AND $_POST['add_resources'] == get_lang('Resources')) { |
130 | - $_SESSION['formelements'] = $_POST; |
|
131 | - $_SESSION['origin'] = $_SERVER['REQUEST_URI']; |
|
132 | - $_SESSION['breadcrumbs'] = $interbreadcrumb; |
|
130 | + $_SESSION['formelements'] = $_POST; |
|
131 | + $_SESSION['origin'] = $_SERVER['REQUEST_URI']; |
|
132 | + $_SESSION['breadcrumbs'] = $interbreadcrumb; |
|
133 | 133 | header('Location: ../resourcelinker/resourcelinker.php'); |
134 | 134 | exit; |
135 | 135 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | if (!empty($gradebook) && $gradebook == 'view') { |
48 | - $interbreadcrumb[] = array ( |
|
48 | + $interbreadcrumb[] = array( |
|
49 | 49 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
50 | 50 | 'name' => get_lang('ToolGradebook') |
51 | 51 | ); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups')); |
108 | 108 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']); |
109 | 109 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $currentForum['forum_title']); |
110 | - $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('EditThread')); |
|
110 | + $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => get_lang('EditThread')); |
|
111 | 111 | } else { |
112 | 112 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools); |
113 | 113 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | echo '<div class="actions">'; |
157 | 157 | echo '<span style="float:right;">'.search_link().'</span>'; |
158 | 158 | echo '<a href="viewforum.php?forum='.intval($_GET['forum']).'&'.$cidreq.'">'. |
159 | - Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
159 | + Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
160 | 160 | echo '</div>'; |
161 | 161 | |
162 | 162 | $threadData = getThreadInfo($threadId, $cId); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // Are we in a lp ? |
41 | 41 | $origin = ''; |
42 | 42 | if (isset($_GET['origin'])) { |
43 | - $origin = Security::remove_XSS($_GET['origin']); |
|
43 | + $origin = Security::remove_XSS($_GET['origin']); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Name of the tool |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | |
49 | 49 | // Breadcrumbs |
50 | 50 | |
51 | -if (isset($_SESSION['gradebook'])){ |
|
51 | +if (isset($_SESSION['gradebook'])) { |
|
52 | 52 | $gradebook = $_SESSION['gradebook']; |
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!empty($gradebook) && $gradebook == 'view') { |
56 | - $interbreadcrumb[] = array ( |
|
56 | + $interbreadcrumb[] = array( |
|
57 | 57 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
58 | 58 | 'name' => get_lang('ToolGradebook') |
59 | 59 | ); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); |
67 | 67 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')'); |
68 | 68 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(), 'name' => prepare4display($current_forum['forum_title'])); |
69 | - $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(),'name' => get_lang('ForumSearch')); |
|
69 | + $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(), 'name' => get_lang('ForumSearch')); |
|
70 | 70 | } else { |
71 | 71 | $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(), 'name' => $nameTools); |
72 | 72 | $nameTools = get_lang('ForumSearch'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ($slide_id != 'all') { |
65 | 65 | $image = null; |
66 | 66 | if (isset($image_files_only[$slide])) { |
67 | - $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
67 | + $image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide]; |
|
68 | 68 | } |
69 | 69 | if (file_exists($image)) { |
70 | 70 | echo '<div class="actions-pagination">'; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $last = Display::return_icon('action_last_na.png', get_lang('LastSlide')); |
106 | 106 | } else { |
107 | 107 | $imgn = 'action_next.png'; |
108 | - $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
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 | } |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | |
123 | 123 | // Exit the slideshow |
124 | 124 | echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
125 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
125 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
126 | 126 | |
127 | 127 | // Show thumbnails |
128 | 128 | if ($slide_id != 'all') { |
129 | 129 | echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
130 | - Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
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().'">'. |
136 | - Display::return_icon('settings.png', get_lang('SetSlideshowOptions'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
136 | + Display::return_icon('settings.png', get_lang('SetSlideshowOptions'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
137 | 137 | |
138 | 138 | echo '</div>'; |
139 | 139 | echo '<br />'; |
@@ -157,7 +157,7 @@ discard block |
||
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 | -if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
|
160 | +if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
|
161 | 161 | $target_width = $_SESSION["image_resizing_width"]; |
162 | 162 | $target_height = $_SESSION["image_resizing_height"]; |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | /* THUMBNAIL VIEW */ |
166 | 166 | |
167 | 167 | // This is for viewing all the images in the slideshow as thumbnails. |
168 | -$image_tag = array (); |
|
168 | +$image_tag = array(); |
|
169 | 169 | $html = ''; |
170 | 170 | if ($slide_id == 'all') { |
171 | 171 | |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png'); |
174 | 174 | $max_thumbnail_width = 250; |
175 | 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 |
|
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 | 179 | $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
180 | 180 | |
181 | 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; |
|
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 | 187 | // Create the template_thumbnails folder (if no exist) |
188 | 188 | |
@@ -195,20 +195,20 @@ discard block |
||
195 | 195 | |
196 | 196 | foreach ($image_files_only as $one_image_file) { |
197 | 197 | $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
198 | - $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
198 | + $image_thumbnail = $directory_thumbnails.'.'.$one_image_file; |
|
199 | 199 | |
200 | 200 | if (file_exists($image)) { |
201 | 201 | //check thumbnail |
202 | 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 | 209 | $original_image_size = api_getimagesize($image); |
210 | 210 | |
211 | - switch($imagetype) { |
|
211 | + switch ($imagetype) { |
|
212 | 212 | case 'gif': |
213 | 213 | $source_img = imagecreatefromgif($image); |
214 | 214 | break; |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | $max_thumbnail_height |
231 | 231 | ); |
232 | 232 | |
233 | - if($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
234 | - $new_thumbnail_size['width']=$original_image_size['width']; |
|
235 | - $new_thumbnail_size['height']=$original_image_size['height']; |
|
233 | + if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) { |
|
234 | + $new_thumbnail_size['width'] = $original_image_size['width']; |
|
235 | + $new_thumbnail_size['height'] = $original_image_size['height']; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
239 | 239 | |
240 | 240 | // preserve transparency |
241 | - if($imagetype == "png"){ |
|
241 | + if ($imagetype == "png") { |
|
242 | 242 | imagesavealpha($crop, true); |
243 | - $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
243 | + $color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127); |
|
244 | 244 | imagefill($crop, 0, 0, $color); |
245 | 245 | } |
246 | 246 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $transindex = imagecolortransparent($source_img); |
249 | 249 | $palletsize = imagecolorstotal($source_img); |
250 | 250 | //GIF89a for transparent and anim (first clip), either GIF87a |
251 | - if ($transindex >= 0 && $transindex < $palletsize){ |
|
251 | + if ($transindex >= 0 && $transindex < $palletsize) { |
|
252 | 252 | $transcol = imagecolorsforindex($source_img, $transindex); |
253 | 253 | $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
254 | 254 | imagefill($crop, 0, 0, $transindex); |
@@ -272,16 +272,16 @@ discard block |
||
272 | 272 | |
273 | 273 | switch ($imagetype) { |
274 | 274 | case 'gif': |
275 | - imagegif($crop,$image_thumbnail); |
|
275 | + imagegif($crop, $image_thumbnail); |
|
276 | 276 | break; |
277 | 277 | case 'jpg': |
278 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
278 | + imagejpeg($crop, $image_thumbnail, $jpg_quality); |
|
279 | 279 | break; |
280 | 280 | case 'jpeg': |
281 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
281 | + imagejpeg($crop, $image_thumbnail, $jpg_quality); |
|
282 | 282 | break; |
283 | 283 | case 'png': |
284 | - imagepng($crop,$image_thumbnail,$png_compression); |
|
284 | + imagepng($crop, $image_thumbnail, $png_compression); |
|
285 | 285 | break; |
286 | 286 | } |
287 | 287 | |
@@ -291,26 +291,26 @@ discard block |
||
291 | 291 | |
292 | 292 | //show thumbnail and link |
293 | 293 | |
294 | - $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
294 | + $one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail |
|
295 | 295 | $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
296 | 296 | $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
297 | 297 | } else { |
298 | 298 | //if images aren't support by gd (not gif, jpg, jpeg, png) |
299 | - if ($imagetype=="bmp") { |
|
299 | + if ($imagetype == "bmp") { |
|
300 | 300 | // 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 |
301 | 301 | $original_image_size = getimagesize($image); |
302 | - if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
303 | - $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 |
|
302 | + if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) { |
|
303 | + $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 |
|
304 | 304 | $image_height = $thumbnail_size['height']; |
305 | 305 | $image_width = $thumbnail_size['width']; |
306 | 306 | } else { |
307 | - $image_height=$original_image_size[0]; |
|
308 | - $image_width=$original_image_size[1]; |
|
307 | + $image_height = $original_image_size[0]; |
|
308 | + $image_width = $original_image_size[1]; |
|
309 | 309 | } |
310 | 310 | } else { |
311 | 311 | //example for svg files,... |
312 | - $image_width=$max_thumbnail_width; |
|
313 | - $image_height=$max_thumbnail_height; |
|
312 | + $image_width = $max_thumbnail_width; |
|
313 | + $image_height = $max_thumbnail_height; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | $i = 0; |
328 | 328 | $count_image = count($image_tag); |
329 | - $number_iteration = ceil($count_image/$number_image); |
|
329 | + $number_iteration = ceil($count_image / $number_image); |
|
330 | 330 | $p = 0; |
331 | 331 | $html = ''; |
332 | 332 | $html .= '<div class="gallery">'; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
339 | 339 | $html .= '<div class="frame">'; |
340 | 340 | $html .= '<div class="photo">'; |
341 | - $html .= $image_tag[$p]; |
|
341 | + $html .= $image_tag[$p]; |
|
342 | 342 | $html .= '</div>'; |
343 | 343 | $html .= '</div>'; |
344 | 344 | $html .= '</a>'; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | list($width, $height) = getimagesize($image); |
395 | 395 | // Auto resize |
396 | - if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
396 | + if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
397 | 397 | ?> |
398 | 398 | |
399 | 399 | <script type="text/javascript"> |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | start_height=initial_height; |
411 | 411 | } |
412 | 412 | |
413 | - document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide] ;?>">'); |
|
413 | + document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide]; ?>">'); |
|
414 | 414 | |
415 | 415 | function resizeImage() { |
416 | 416 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | echo '</a>'; |
455 | 455 | echo '<div class="caption text-center">'; |
456 | 456 | echo Display::tag('h3', $row['title']); |
457 | - echo '<p>' . $row['comment'] . '</p>'; |
|
457 | + echo '<p>'.$row['comment'].'</p>'; |
|
458 | 458 | echo '</div>'; |
459 | 459 | echo '</div>'; |
460 | 460 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $resize_info = get_lang('Resizing').'<br />'; |
468 | 468 | $resize_width = $_SESSION["image_resizing_width"].' x '; |
469 | 469 | $resize_height = $_SESSION['image_resizing_height']; |
470 | - } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing'){ |
|
470 | + } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing') { |
|
471 | 471 | $resize_info = get_lang('Resizing').'<br />'; |
472 | 472 | $resize_width = get_lang('Auto').' x '; |
473 | 473 | $resize_height = get_lang('Auto'); |
@@ -478,10 +478,10 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | echo '<li class="text-center">'; |
481 | - echo $image_files_only[$slide] . ' '; |
|
481 | + echo $image_files_only[$slide].' '; |
|
482 | 482 | echo Display::toolbarButton( |
483 | 483 | get_lang('Modify'), |
484 | - 'edit_document.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
484 | + 'edit_document.php?'.api_get_cidreq().'&'.http_build_query([ |
|
485 | 485 | 'id' => $row['id'], |
486 | 486 | 'origin' => 'slideshow', |
487 | 487 | 'origin_opt' => $edit_slide_id, |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | false |
494 | 494 | ); |
495 | 495 | echo '</li>'; |
496 | - echo '<li class="text-center">' . $width.' x '.$height . '</li>'; |
|
497 | - echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
498 | - echo '<li class="text-center">' . $resize_info . '</li>'; |
|
499 | - echo '<li class="text-center">' . $resize_width . '</li>'; |
|
500 | - echo '<li class="text-center">' . $resize_height . '</li>'; |
|
496 | + echo '<li class="text-center">'.$width.' x '.$height.'</li>'; |
|
497 | + echo '<li class="text-center">'.round((filesize($image) / 1024), 2).' KB - '.$ext.'</li>'; |
|
498 | + echo '<li class="text-center">'.$resize_info.'</li>'; |
|
499 | + echo '<li class="text-center">'.$resize_width.'</li>'; |
|
500 | + echo '<li class="text-center">'.$resize_height.'</li>'; |
|
501 | 501 | echo '</ul>'; |
502 | 502 | } |
503 | 503 |
@@ -15,15 +15,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'], |
@@ -230,33 +230,33 @@ discard block |
||
230 | 230 | $max_thumbnail_height |
231 | 231 | ); |
232 | 232 | |
233 | - if($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
234 | - $new_thumbnail_size['width']=$original_image_size['width']; |
|
235 | - $new_thumbnail_size['height']=$original_image_size['height']; |
|
236 | - } |
|
233 | + if($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
234 | + $new_thumbnail_size['width']=$original_image_size['width']; |
|
235 | + $new_thumbnail_size['height']=$original_image_size['height']; |
|
236 | + } |
|
237 | 237 | |
238 | - $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
238 | + $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
239 | 239 | |
240 | - // preserve transparency |
|
241 | - if($imagetype == "png"){ |
|
242 | - imagesavealpha($crop, true); |
|
243 | - $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
244 | - imagefill($crop, 0, 0, $color); |
|
245 | - } |
|
240 | + // preserve transparency |
|
241 | + if($imagetype == "png"){ |
|
242 | + imagesavealpha($crop, true); |
|
243 | + $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
244 | + imagefill($crop, 0, 0, $color); |
|
245 | + } |
|
246 | 246 | |
247 | - if ($imagetype == "gif") { |
|
248 | - $transindex = imagecolortransparent($source_img); |
|
247 | + if ($imagetype == "gif") { |
|
248 | + $transindex = imagecolortransparent($source_img); |
|
249 | 249 | $palletsize = imagecolorstotal($source_img); |
250 | - //GIF89a for transparent and anim (first clip), either GIF87a |
|
251 | - if ($transindex >= 0 && $transindex < $palletsize){ |
|
252 | - $transcol = imagecolorsforindex($source_img, $transindex); |
|
253 | - $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
254 | - imagefill($crop, 0, 0, $transindex); |
|
255 | - imagecolortransparent($crop, $transindex); |
|
256 | - } |
|
257 | - } |
|
258 | - |
|
259 | - //resampled image |
|
250 | + //GIF89a for transparent and anim (first clip), either GIF87a |
|
251 | + if ($transindex >= 0 && $transindex < $palletsize){ |
|
252 | + $transcol = imagecolorsforindex($source_img, $transindex); |
|
253 | + $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
254 | + imagefill($crop, 0, 0, $transindex); |
|
255 | + imagecolortransparent($crop, $transindex); |
|
256 | + } |
|
257 | + } |
|
258 | + |
|
259 | + //resampled image |
|
260 | 260 | imagecopyresampled( |
261 | 261 | $crop, |
262 | 262 | $source_img, |
@@ -270,69 +270,69 @@ discard block |
||
270 | 270 | $original_image_size['height'] |
271 | 271 | ); |
272 | 272 | |
273 | - switch ($imagetype) { |
|
274 | - case 'gif': |
|
275 | - imagegif($crop,$image_thumbnail); |
|
276 | - break; |
|
277 | - case 'jpg': |
|
278 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
279 | - break; |
|
280 | - case 'jpeg': |
|
281 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
282 | - break; |
|
283 | - case 'png': |
|
284 | - imagepng($crop,$image_thumbnail,$png_compression); |
|
285 | - break; |
|
286 | - } |
|
287 | - |
|
288 | - //clean memory |
|
289 | - imagedestroy($crop); |
|
290 | - }//end !exist thumbnail |
|
291 | - |
|
292 | - //show thumbnail and link |
|
293 | - |
|
294 | - $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
295 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
296 | - $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
297 | - } else { |
|
298 | - //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
299 | - if ($imagetype=="bmp") { |
|
273 | + switch ($imagetype) { |
|
274 | + case 'gif': |
|
275 | + imagegif($crop,$image_thumbnail); |
|
276 | + break; |
|
277 | + case 'jpg': |
|
278 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
279 | + break; |
|
280 | + case 'jpeg': |
|
281 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
282 | + break; |
|
283 | + case 'png': |
|
284 | + imagepng($crop,$image_thumbnail,$png_compression); |
|
285 | + break; |
|
286 | + } |
|
287 | + |
|
288 | + //clean memory |
|
289 | + imagedestroy($crop); |
|
290 | + }//end !exist thumbnail |
|
291 | + |
|
292 | + //show thumbnail and link |
|
293 | + |
|
294 | + $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
295 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
296 | + $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
297 | + } else { |
|
298 | + //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
299 | + if ($imagetype=="bmp") { |
|
300 | 300 | // 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 |
301 | - $original_image_size = getimagesize($image); |
|
302 | - if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
303 | - $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 |
|
304 | - $image_height = $thumbnail_size['height']; |
|
305 | - $image_width = $thumbnail_size['width']; |
|
306 | - } else { |
|
307 | - $image_height=$original_image_size[0]; |
|
308 | - $image_width=$original_image_size[1]; |
|
309 | - } |
|
310 | - } else { |
|
311 | - //example for svg files,... |
|
312 | - $image_width=$max_thumbnail_width; |
|
313 | - $image_height=$max_thumbnail_height; |
|
314 | - } |
|
315 | - |
|
316 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
317 | - $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
318 | - |
|
319 | - }//end allowed image types |
|
320 | - }//end if exist file image |
|
321 | - }//end foreach |
|
322 | - }//end image files only |
|
323 | - |
|
324 | - // Creating the table |
|
325 | - $html_table = ''; |
|
326 | - |
|
327 | - $i = 0; |
|
328 | - $count_image = count($image_tag); |
|
329 | - $number_iteration = ceil($count_image/$number_image); |
|
330 | - $p = 0; |
|
301 | + $original_image_size = getimagesize($image); |
|
302 | + if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
303 | + $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 |
|
304 | + $image_height = $thumbnail_size['height']; |
|
305 | + $image_width = $thumbnail_size['width']; |
|
306 | + } else { |
|
307 | + $image_height=$original_image_size[0]; |
|
308 | + $image_width=$original_image_size[1]; |
|
309 | + } |
|
310 | + } else { |
|
311 | + //example for svg files,... |
|
312 | + $image_width=$max_thumbnail_width; |
|
313 | + $image_height=$max_thumbnail_height; |
|
314 | + } |
|
315 | + |
|
316 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
317 | + $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
318 | + |
|
319 | + }//end allowed image types |
|
320 | + }//end if exist file image |
|
321 | + }//end foreach |
|
322 | + }//end image files only |
|
323 | + |
|
324 | + // Creating the table |
|
325 | + $html_table = ''; |
|
326 | + |
|
327 | + $i = 0; |
|
328 | + $count_image = count($image_tag); |
|
329 | + $number_iteration = ceil($count_image/$number_image); |
|
330 | + $p = 0; |
|
331 | 331 | $html = ''; |
332 | 332 | $html .= '<div class="gallery">'; |
333 | - for ($k = 0; $k < $number_iteration; $k++) { |
|
334 | - for ($i = 0; $i < $number_image; $i++) { |
|
335 | - if (isset($image_tag[$p])) { |
|
333 | + for ($k = 0; $k < $number_iteration; $k++) { |
|
334 | + for ($i = 0; $i < $number_image; $i++) { |
|
335 | + if (isset($image_tag[$p])) { |
|
336 | 336 | $html .= '<div class="col-xs-6 col-sm-3 col-md-2">'; |
337 | 337 | $html .= '<div class="canvas-one">'; |
338 | 338 | $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | $html .= '</a>'; |
345 | 345 | $html .= '</div>'; |
346 | 346 | $html .= '</div>'; |
347 | - } |
|
348 | - $p++; |
|
349 | - } |
|
350 | - } |
|
347 | + } |
|
348 | + $p++; |
|
349 | + } |
|
350 | + } |
|
351 | 351 | $html .= '</div>'; |
352 | 352 | |
353 | 353 | }//end slide==all |
@@ -358,43 +358,43 @@ discard block |
||
358 | 358 | // This is for viewing all the images in the slideshow one at a time. |
359 | 359 | |
360 | 360 | if ($slide_id != 'all' && !empty($image_files_only)) { |
361 | - if (file_exists($image) && is_file($image)) { |
|
362 | - $image_height_width = resize_image($image, $target_width, $target_height); |
|
363 | - |
|
364 | - $image_height = $image_height_width[0]; |
|
365 | - $image_width = $image_height_width[1]; |
|
366 | - |
|
367 | - $height_width_tags = null; |
|
368 | - if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
369 | - $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
370 | - } |
|
371 | - |
|
372 | - // This is done really quickly and should be cleaned up a little bit using the API functions |
|
373 | - $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
374 | - if ($path == '/') { |
|
375 | - $pathpart = '/'; |
|
376 | - } else { |
|
377 | - $pathpart = $path.'/'; |
|
378 | - } |
|
379 | - $sql = "SELECT * FROM $tbl_documents |
|
361 | + if (file_exists($image) && is_file($image)) { |
|
362 | + $image_height_width = resize_image($image, $target_width, $target_height); |
|
363 | + |
|
364 | + $image_height = $image_height_width[0]; |
|
365 | + $image_width = $image_height_width[1]; |
|
366 | + |
|
367 | + $height_width_tags = null; |
|
368 | + if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
369 | + $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
370 | + } |
|
371 | + |
|
372 | + // This is done really quickly and should be cleaned up a little bit using the API functions |
|
373 | + $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
374 | + if ($path == '/') { |
|
375 | + $pathpart = '/'; |
|
376 | + } else { |
|
377 | + $pathpart = $path.'/'; |
|
378 | + } |
|
379 | + $sql = "SELECT * FROM $tbl_documents |
|
380 | 380 | WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'"; |
381 | - $result = Database::query($sql); |
|
382 | - $row = Database::fetch_array($result); |
|
381 | + $result = Database::query($sql); |
|
382 | + $row = Database::fetch_array($result); |
|
383 | 383 | |
384 | 384 | echo '<div class="thumbnail">'; |
385 | - if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
386 | - echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
387 | - } else { |
|
388 | - echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
389 | - } |
|
385 | + if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
386 | + echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
387 | + } else { |
|
388 | + echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
389 | + } |
|
390 | 390 | if ($path == '/') { |
391 | - $path = ''; |
|
391 | + $path = ''; |
|
392 | 392 | } |
393 | 393 | |
394 | - list($width, $height) = getimagesize($image); |
|
395 | - // Auto resize |
|
396 | - if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
397 | - ?> |
|
394 | + list($width, $height) = getimagesize($image); |
|
395 | + // Auto resize |
|
396 | + if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
397 | + ?> |
|
398 | 398 | |
399 | 399 | <script type="text/javascript"> |
400 | 400 | var initial_width='<?php echo $width; ?>'; |
@@ -447,21 +447,21 @@ discard block |
||
447 | 447 | |
448 | 448 | </script> |
449 | 449 | <?php |
450 | - } else { |
|
451 | - 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.">"; |
|
452 | - } |
|
450 | + } else { |
|
451 | + 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.">"; |
|
452 | + } |
|
453 | 453 | |
454 | - echo '</a>'; |
|
454 | + echo '</a>'; |
|
455 | 455 | echo '<div class="caption text-center">'; |
456 | 456 | echo Display::tag('h3', $row['title']); |
457 | 457 | echo '<p>' . $row['comment'] . '</p>'; |
458 | 458 | echo '</div>'; |
459 | 459 | echo '</div>'; |
460 | 460 | |
461 | - if (api_is_allowed_to_edit(null, true)) { |
|
461 | + if (api_is_allowed_to_edit(null, true)) { |
|
462 | 462 | echo '<ul class="list-unstyled">'; |
463 | - $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
464 | - $ext = $aux[count($aux) - 1]; |
|
463 | + $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
464 | + $ext = $aux[count($aux) - 1]; |
|
465 | 465 | |
466 | 466 | if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
467 | 467 | $resize_info = get_lang('Resizing').'<br />'; |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | $resize_height = get_lang('Auto'); |
474 | 474 | } else { |
475 | 475 | $resize_info = get_lang('NoResizing').'<br />'; |
476 | - $resize_width = ''; |
|
477 | - $resize_height = ''; |
|
476 | + $resize_width = ''; |
|
477 | + $resize_height = ''; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | echo '<li class="text-center">'; |
@@ -494,16 +494,16 @@ discard block |
||
494 | 494 | ); |
495 | 495 | echo '</li>'; |
496 | 496 | echo '<li class="text-center">' . $width.' x '.$height . '</li>'; |
497 | - echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
497 | + echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
498 | 498 | echo '<li class="text-center">' . $resize_info . '</li>'; |
499 | - echo '<li class="text-center">' . $resize_width . '</li>'; |
|
500 | - echo '<li class="text-center">' . $resize_height . '</li>'; |
|
499 | + echo '<li class="text-center">' . $resize_width . '</li>'; |
|
500 | + echo '<li class="text-center">' . $resize_height . '</li>'; |
|
501 | 501 | echo '</ul>'; |
502 | - } |
|
502 | + } |
|
503 | 503 | |
504 | - } else { |
|
505 | - Display::display_warning_message(get_lang('FileNotFound')); |
|
506 | - } |
|
504 | + } else { |
|
505 | + Display::display_warning_message(get_lang('FileNotFound')); |
|
506 | + } |
|
507 | 507 | } else { |
508 | 508 | if ($slide_id != 'all') { |
509 | 509 | Display::display_warning_message(get_lang('NoDataAvailable')); |