@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | /** |
524 | 524 | * Logs a string in debug mode. |
525 | 525 | * |
526 | - * @param $str the string to write |
|
526 | + * @param string $str the string to write |
|
527 | 527 | * |
528 | 528 | * @private |
529 | 529 | */ |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * This method is used by interface methods to print an error and where the function |
546 | 546 | * was originally called from. |
547 | 547 | * |
548 | - * @param $msg the message to print |
|
548 | + * @param string $msg the message to print |
|
549 | 549 | * |
550 | 550 | * @private |
551 | 551 | */ |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | /** |
679 | 679 | * This method returns the phpCAS version. |
680 | 680 | * |
681 | - * @return the phpCAS version. |
|
681 | + * @return string phpCAS version. |
|
682 | 682 | */ |
683 | 683 | function getVersion() |
684 | 684 | { |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | * @warning should not be called only after phpCAS::forceAuthentication() |
1106 | 1106 | * or phpCAS::checkAuthentication(). |
1107 | 1107 | * |
1108 | - * @return the login name of the authenticated user |
|
1108 | + * @return string login name of the authenticated user |
|
1109 | 1109 | */ |
1110 | 1110 | function getUser() |
1111 | 1111 | { |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | // hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] in IIS |
34 | 34 | // |
35 | 35 | if (!$_SERVER['REQUEST_URI']) { |
36 | - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; |
|
36 | + $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // |
40 | 40 | // another one by Vangelis Haniotakis also to make phpCAS work with PHP5 |
41 | 41 | // |
42 | 42 | if (version_compare(PHP_VERSION, '5', '>=')) { |
43 | - require_once(dirname(__FILE__) . '/CAS/domxml-php4-to-php5.php'); |
|
43 | + require_once(dirname(__FILE__).'/CAS/domxml-php4-to-php5.php'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | // ######################################################################## |
323 | 323 | |
324 | 324 | // include client class |
325 | -include_once(dirname(__FILE__) . '/CAS/client.php'); |
|
325 | +include_once(dirname(__FILE__).'/CAS/client.php'); |
|
326 | 326 | |
327 | 327 | // ######################################################################## |
328 | 328 | // INTERFACE CLASS |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | phpCAS:: traceBegin(); |
373 | 373 | if (is_object($PHPCAS_CLIENT)) { |
374 | - phpCAS:: error($PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . $PHPCAS_INIT_CALL['file'] . ':' . $PHPCAS_INIT_CALL['line'] . ')'); |
|
374 | + phpCAS:: error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')'); |
|
375 | 375 | } |
376 | 376 | if (gettype($server_version) != 'string') { |
377 | 377 | phpCAS:: error('type mismatched for parameter $server_version (should be `string\')'); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | 'done' => true, |
393 | 393 | 'file' => $dbg[0]['file'], |
394 | 394 | 'line' => $dbg[0]['line'], |
395 | - 'method' => __CLASS__ . '::' . __FUNCTION__ |
|
395 | + 'method' => __CLASS__.'::'.__FUNCTION__ |
|
396 | 396 | ); |
397 | 397 | |
398 | 398 | // initialize the global object $PHPCAS_CLIENT |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | phpCAS:: traceBegin(); |
423 | 423 | if (is_object($PHPCAS_CLIENT)) { |
424 | - phpCAS:: error($PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . $PHPCAS_INIT_CALL['file'] . ':' . $PHPCAS_INIT_CALL['line'] . ')'); |
|
424 | + phpCAS:: error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')'); |
|
425 | 425 | } |
426 | 426 | if (gettype($server_version) != 'string') { |
427 | 427 | phpCAS:: error('type mismatched for parameter $server_version (should be `string\')'); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | 'done' => true, |
443 | 443 | 'file' => $dbg[0]['file'], |
444 | 444 | 'line' => $dbg[0]['line'], |
445 | - 'method' => __CLASS__ . '::' . __FUNCTION__ |
|
445 | + 'method' => __CLASS__.'::'.__FUNCTION__ |
|
446 | 446 | ); |
447 | 447 | |
448 | 448 | // initialize the global object $PHPCAS_CLIENT |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | if (empty ($filename)) { |
478 | 478 | if (preg_match('/^Win.*/', getenv('OS'))) { |
479 | 479 | if (isset ($_ENV['TMP'])) { |
480 | - $debugDir = $_ENV['TMP'] . '/'; |
|
480 | + $debugDir = $_ENV['TMP'].'/'; |
|
481 | 481 | } else { |
482 | 482 | if (isset ($_ENV['TEMP'])) { |
483 | - $debugDir = $_ENV['TEMP'] . '/'; |
|
483 | + $debugDir = $_ENV['TEMP'].'/'; |
|
484 | 484 | } else { |
485 | 485 | $debugDir = ''; |
486 | 486 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | } else { |
489 | 489 | $debugDir = DEFAULT_DEBUG_DIR; |
490 | 490 | } |
491 | - $filename = $debugDir . 'phpCAS.log'; |
|
491 | + $filename = $debugDir.'phpCAS.log'; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | if (empty ($PHPCAS_DEBUG['unique_id'])) { |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | for ($i = 0; $i < $PHPCAS_DEBUG['indent']; $i++) { |
537 | 537 | $indent_str .= '| '; |
538 | 538 | } |
539 | - error_log($PHPCAS_DEBUG['unique_id'] . ' ' . $indent_str . $str . "\n", 3, $PHPCAS_DEBUG['filename']); |
|
539 | + error_log($PHPCAS_DEBUG['unique_id'].' '.$indent_str.$str."\n", 3, $PHPCAS_DEBUG['filename']); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | } |
567 | 567 | } |
568 | 568 | } |
569 | - echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>" . __CLASS__ . "::" . $function . '(): ' . htmlentities($msg) . "</b></font> in <b>" . $file . "</b> on line <b>" . $line . "</b><br />\n"; |
|
569 | + echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>".__CLASS__."::".$function.'(): '.htmlentities($msg)."</b></font> in <b>".$file."</b> on line <b>".$line."</b><br />\n"; |
|
570 | 570 | phpCAS:: trace($msg); |
571 | 571 | phpCAS:: traceExit(); |
572 | 572 | exit (); |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | function trace($str) |
579 | 579 | { |
580 | 580 | $dbg = phpCAS:: backtrace(); |
581 | - phpCAS:: log($str . ' [' . basename($dbg[1]['file']) . ':' . $dbg[1]['line'] . ']'); |
|
581 | + phpCAS:: log($str.' ['.basename($dbg[1]['file']).':'.$dbg[1]['line'].']'); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | $dbg = phpCAS:: backtrace(); |
592 | 592 | $str = '=> '; |
593 | 593 | if (!empty ($dbg[2]['class'])) { |
594 | - $str .= $dbg[2]['class'] . '::'; |
|
594 | + $str .= $dbg[2]['class'].'::'; |
|
595 | 595 | } |
596 | - $str .= $dbg[2]['function'] . '('; |
|
596 | + $str .= $dbg[2]['function'].'('; |
|
597 | 597 | if (is_array($dbg[2]['args'])) { |
598 | 598 | foreach ($dbg[2]['args'] as $index => $arg) { |
599 | 599 | if ($index != 0) { |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $str .= str_replace("\n", "", var_export($arg, true)); |
603 | 603 | } |
604 | 604 | } |
605 | - $str .= ') [' . basename($dbg[2]['file']) . ':' . $dbg[2]['line'] . ']'; |
|
605 | + $str .= ') ['.basename($dbg[2]['file']).':'.$dbg[2]['line'].']'; |
|
606 | 606 | phpCAS:: log($str); |
607 | 607 | $PHPCAS_DEBUG['indent']++; |
608 | 608 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $PHPCAS_DEBUG['indent']--; |
620 | 620 | $dbg = phpCAS:: backtrace(); |
621 | 621 | $str = ''; |
622 | - $str .= '<= ' . str_replace("\n", "", var_export($res, true)); |
|
622 | + $str .= '<= '.str_replace("\n", "", var_export($res, true)); |
|
623 | 623 | phpCAS:: log($str); |
624 | 624 | } |
625 | 625 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | { |
659 | 659 | global $PHPCAS_CLIENT; |
660 | 660 | if (!is_object($PHPCAS_CLIENT)) { |
661 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
661 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
662 | 662 | } |
663 | 663 | if (gettype($lang) != 'string') { |
664 | 664 | phpCAS:: error('type mismatched for parameter $lang (should be `string\')'); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | { |
704 | 704 | global $PHPCAS_CLIENT; |
705 | 705 | if (!is_object($PHPCAS_CLIENT)) { |
706 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
706 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
707 | 707 | } |
708 | 708 | if (gettype($header) != 'string') { |
709 | 709 | phpCAS:: error('type mismatched for parameter $header (should be `string\')'); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | { |
721 | 721 | global $PHPCAS_CLIENT; |
722 | 722 | if (!is_object($PHPCAS_CLIENT)) { |
723 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
723 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
724 | 724 | } |
725 | 725 | if (gettype($footer) != 'string') { |
726 | 726 | phpCAS:: error('type mismatched for parameter $footer (should be `string\')'); |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | |
751 | 751 | phpCAS:: traceBegin(); |
752 | 752 | if (!is_object($PHPCAS_CLIENT)) { |
753 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
753 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
754 | 754 | } |
755 | 755 | if (!$PHPCAS_CLIENT->isProxy()) { |
756 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
756 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
757 | 757 | } |
758 | 758 | if ($PHPCAS_AUTH_CHECK_CALL['done']) { |
759 | - phpCAS:: error('this method should only be called before ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() (called at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ')'); |
|
759 | + phpCAS:: error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')'); |
|
760 | 760 | } |
761 | 761 | if (gettype($format) != 'string') { |
762 | 762 | phpCAS:: error('type mismatched for parameter $format (should be `string\')'); |
@@ -796,13 +796,13 @@ discard block |
||
796 | 796 | |
797 | 797 | phpCAS:: traceBegin(); |
798 | 798 | if (!is_object($PHPCAS_CLIENT)) { |
799 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
799 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
800 | 800 | } |
801 | 801 | if (!$PHPCAS_CLIENT->isProxy()) { |
802 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
802 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
803 | 803 | } |
804 | 804 | if ($PHPCAS_AUTH_CHECK_CALL['done']) { |
805 | - phpCAS:: error('this method should only be called before ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() (called at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ')'); |
|
805 | + phpCAS:: error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')'); |
|
806 | 806 | } |
807 | 807 | if (gettype($user) != 'string') { |
808 | 808 | phpCAS:: error('type mismatched for parameter $user (should be `string\')'); |
@@ -857,16 +857,16 @@ discard block |
||
857 | 857 | |
858 | 858 | phpCAS:: traceBegin(); |
859 | 859 | if (!is_object($PHPCAS_CLIENT)) { |
860 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
860 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
861 | 861 | } |
862 | 862 | if (!$PHPCAS_CLIENT->isProxy()) { |
863 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
863 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
864 | 864 | } |
865 | 865 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
866 | - phpCAS:: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()'); |
|
866 | + phpCAS:: error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()'); |
|
867 | 867 | } |
868 | 868 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
869 | - phpCAS:: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
869 | + phpCAS:: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
870 | 870 | } |
871 | 871 | if (gettype($url) != 'string') { |
872 | 872 | phpCAS:: error('type mismatched for parameter $url (should be `string\')'); |
@@ -901,16 +901,16 @@ discard block |
||
901 | 901 | |
902 | 902 | phpCAS:: traceBegin(); |
903 | 903 | if (!is_object($PHPCAS_CLIENT)) { |
904 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
904 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
905 | 905 | } |
906 | 906 | if (!$PHPCAS_CLIENT->isProxy()) { |
907 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
907 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
908 | 908 | } |
909 | 909 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
910 | - phpCAS:: error('this method should only be called after the programmer is sure the user has been authenticated (by calling ' . __CLASS__ . '::checkAuthentication() or ' . __CLASS__ . '::forceAuthentication()'); |
|
910 | + phpCAS:: error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()'); |
|
911 | 911 | } |
912 | 912 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
913 | - phpCAS:: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
913 | + phpCAS:: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
914 | 914 | } |
915 | 915 | if (gettype($url) != 'string') { |
916 | 916 | phpCAS:: error('type mismatched for parameter $url (should be `string\')'); |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | { |
948 | 948 | global $PHPCAS_CLIENT; |
949 | 949 | if (!is_object($PHPCAS_CLIENT)) { |
950 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
950 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
951 | 951 | } |
952 | 952 | if (gettype($n) != 'integer') { |
953 | 953 | phpCAS:: error('type mismatched for parameter $header (should be `string\')'); |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | |
966 | 966 | phpCAS:: traceBegin(); |
967 | 967 | if (!is_object($PHPCAS_CLIENT)) { |
968 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
968 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | $auth = $PHPCAS_CLIENT->checkAuthentication(); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | 'done' => true, |
977 | 977 | 'file' => $dbg[0]['file'], |
978 | 978 | 'line' => $dbg[0]['line'], |
979 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
979 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
980 | 980 | 'result' => $auth |
981 | 981 | ); |
982 | 982 | phpCAS:: traceEnd($auth); |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | |
995 | 995 | phpCAS:: traceBegin(); |
996 | 996 | if (!is_object($PHPCAS_CLIENT)) { |
997 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
997 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
998 | 998 | } |
999 | 999 | |
1000 | 1000 | $auth = $PHPCAS_CLIENT->forceAuthentication(); |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | 'done' => true, |
1006 | 1006 | 'file' => $dbg[0]['file'], |
1007 | 1007 | 'line' => $dbg[0]['line'], |
1008 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
1008 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
1009 | 1009 | 'result' => $auth |
1010 | 1010 | ); |
1011 | 1011 | |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | phpCAS:: trace('user is not authenticated, redirecting to the CAS server'); |
1014 | 1014 | $PHPCAS_CLIENT->forceAuthentication(); |
1015 | 1015 | } else { |
1016 | - phpCAS:: trace('no need to authenticate (user `' . phpCAS:: getUser() . '\' is already authenticated)'); |
|
1016 | + phpCAS:: trace('no need to authenticate (user `'.phpCAS:: getUser().'\' is already authenticated)'); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | phpCAS:: traceEnd(); |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | |
1030 | 1030 | phpCAS:: traceBegin(); |
1031 | 1031 | if (!is_object($PHPCAS_CLIENT)) { |
1032 | - phpCAS:: error('this method should not be called before' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1032 | + phpCAS:: error('this method should not be called before'.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | // store where the authentication has been checked and the result |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | 'done' => true, |
1039 | 1039 | 'file' => $dbg[0]['file'], |
1040 | 1040 | 'line' => $dbg[0]['line'], |
1041 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
1041 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
1042 | 1042 | 'result' => $auth |
1043 | 1043 | ); |
1044 | 1044 | |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | */ |
1052 | 1052 | function authenticate() |
1053 | 1053 | { |
1054 | - phpCAS:: error('this method is deprecated. You should use ' . __CLASS__ . '::forceAuthentication() instead'); |
|
1054 | + phpCAS:: error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead'); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | /** |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | phpCAS:: traceBegin(); |
1068 | 1068 | if (!is_object($PHPCAS_CLIENT)) { |
1069 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1069 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | // call the isAuthenticated method of the global $PHPCAS_CLIENT object |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | 'done' => true, |
1079 | 1079 | 'file' => $dbg[0]['file'], |
1080 | 1080 | 'line' => $dbg[0]['line'], |
1081 | - 'method' => __CLASS__ . '::' . __FUNCTION__, |
|
1081 | + 'method' => __CLASS__.'::'.__FUNCTION__, |
|
1082 | 1082 | 'result' => $auth |
1083 | 1083 | ); |
1084 | 1084 | phpCAS:: traceEnd($auth); |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | { |
1096 | 1096 | global $PHPCAS_CLIENT; |
1097 | 1097 | if (!is_object($PHPCAS_CLIENT)) { |
1098 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1098 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1099 | 1099 | } |
1100 | 1100 | return ($PHPCAS_CLIENT->isSessionAuthenticated()); |
1101 | 1101 | } |
@@ -1111,13 +1111,13 @@ discard block |
||
1111 | 1111 | { |
1112 | 1112 | global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; |
1113 | 1113 | if (!is_object($PHPCAS_CLIENT)) { |
1114 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1114 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1115 | 1115 | } |
1116 | 1116 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
1117 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()'); |
|
1117 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); |
|
1118 | 1118 | } |
1119 | 1119 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
1120 | - phpCAS:: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
1120 | + phpCAS:: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
1121 | 1121 | } |
1122 | 1122 | return $PHPCAS_CLIENT->getUser(); |
1123 | 1123 | } |
@@ -1133,13 +1133,13 @@ discard block |
||
1133 | 1133 | { |
1134 | 1134 | global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; |
1135 | 1135 | if (!is_object($PHPCAS_CLIENT)) { |
1136 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1136 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1137 | 1137 | } |
1138 | 1138 | if (!$PHPCAS_AUTH_CHECK_CALL['done']) { |
1139 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()'); |
|
1139 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); |
|
1140 | 1140 | } |
1141 | 1141 | if (!$PHPCAS_AUTH_CHECK_CALL['result']) { |
1142 | - phpCAS:: error('authentication was checked (by ' . $PHPCAS_AUTH_CHECK_CALL['method'] . '() at ' . $PHPCAS_AUTH_CHECK_CALL['file'] . ':' . $PHPCAS_AUTH_CHECK_CALL['line'] . ') but the method returned FALSE'); |
|
1142 | + phpCAS:: error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); |
|
1143 | 1143 | } |
1144 | 1144 | return $PHPCAS_CLIENT->getAttributes(); |
1145 | 1145 | } |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | { |
1152 | 1152 | global $PHPCAS_CLIENT; |
1153 | 1153 | if (!is_object($PHPCAS_CLIENT)) { |
1154 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1154 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1155 | 1155 | } |
1156 | 1156 | return ($PHPCAS_CLIENT->handleLogoutRequests($check_client, $allowed_clients)); |
1157 | 1157 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | { |
1167 | 1167 | global $PHPCAS_CLIENT; |
1168 | 1168 | if (!is_object($PHPCAS_CLIENT)) { |
1169 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1169 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1170 | 1170 | } |
1171 | 1171 | return $PHPCAS_CLIENT->getServerLoginURL(); |
1172 | 1172 | } |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | phpCAS:: traceBegin(); |
1183 | 1183 | if (!is_object($PHPCAS_CLIENT)) { |
1184 | 1184 | phpCAS:: error('this method should only be called after |
1185 | - ' . __CLASS__ . '::client()'); |
|
1185 | + ' . __CLASS__.'::client()'); |
|
1186 | 1186 | } |
1187 | 1187 | if (gettype($url) != 'string') { |
1188 | 1188 | phpCAS:: error('type mismatched for parameter $url (should be |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | phpCAS:: traceBegin(); |
1205 | 1205 | if (!is_object($PHPCAS_CLIENT)) { |
1206 | 1206 | phpCAS:: error('this method should only be called after |
1207 | - ' . __CLASS__ . '::client()'); |
|
1207 | + ' . __CLASS__.'::client()'); |
|
1208 | 1208 | } |
1209 | 1209 | if (gettype($url) != 'string') { |
1210 | 1210 | phpCAS:: error('type mismatched for parameter $url (should be |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | phpCAS:: traceBegin(); |
1227 | 1227 | if (!is_object($PHPCAS_CLIENT)) { |
1228 | 1228 | phpCAS:: error('this method should only be called after |
1229 | - ' . __CLASS__ . '::client()'); |
|
1229 | + ' . __CLASS__.'::client()'); |
|
1230 | 1230 | } |
1231 | 1231 | if (gettype($url) != 'string') { |
1232 | 1232 | phpCAS:: error('type mismatched for parameter $url (should be |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | phpCAS:: traceBegin(); |
1248 | 1248 | if (!is_object($PHPCAS_CLIENT)) { |
1249 | 1249 | phpCAS:: error('this method should only be called after |
1250 | - ' . __CLASS__ . '::client()'); |
|
1250 | + ' . __CLASS__.'::client()'); |
|
1251 | 1251 | } |
1252 | 1252 | if (gettype($url) != 'string') { |
1253 | 1253 | phpCAS:: error('type mismatched for parameter $url (should be |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | { |
1268 | 1268 | global $PHPCAS_CLIENT; |
1269 | 1269 | if (!is_object($PHPCAS_CLIENT)) { |
1270 | - phpCAS:: error('this method should not be called before ' . __CLASS__ . '::client() or ' . __CLASS__ . '::proxy()'); |
|
1270 | + phpCAS:: error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); |
|
1271 | 1271 | } |
1272 | 1272 | return $PHPCAS_CLIENT->getServerLogoutURL(); |
1273 | 1273 | } |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | phpCAS:: traceBegin(); |
1284 | 1284 | if (!is_object($PHPCAS_CLIENT)) { |
1285 | 1285 | phpCAS:: error('this method should only be called after |
1286 | - ' . __CLASS__ . '::client()'); |
|
1286 | + ' . __CLASS__.'::client()'); |
|
1287 | 1287 | } |
1288 | 1288 | if (gettype($url) != 'string') { |
1289 | 1289 | phpCAS:: error('type mismatched for parameter $url (should be |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | global $PHPCAS_CLIENT; |
1304 | 1304 | phpCAS:: traceBegin(); |
1305 | 1305 | if (!is_object($PHPCAS_CLIENT)) { |
1306 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1306 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1307 | 1307 | } |
1308 | 1308 | $parsedParams = array(); |
1309 | 1309 | if ($params != "") { |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | global $PHPCAS_CLIENT; |
1335 | 1335 | phpCAS:: traceBegin(); |
1336 | 1336 | if (!is_object($PHPCAS_CLIENT)) { |
1337 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1337 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1338 | 1338 | } |
1339 | 1339 | if (!is_string($service)) { |
1340 | 1340 | phpCAS:: error('type mismatched for parameter $service (should be `string\')'); |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | global $PHPCAS_CLIENT; |
1356 | 1356 | phpCAS:: traceBegin(); |
1357 | 1357 | if (!is_object($PHPCAS_CLIENT)) { |
1358 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1358 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1359 | 1359 | } |
1360 | 1360 | if (!is_string($url)) { |
1361 | 1361 | phpCAS:: error('type mismatched for parameter $url (should be `string\')'); |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | global $PHPCAS_CLIENT; |
1378 | 1378 | phpCAS:: traceBegin(); |
1379 | 1379 | if (!is_object($PHPCAS_CLIENT)) { |
1380 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1380 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1381 | 1381 | } |
1382 | 1382 | if (!is_string($service)) { |
1383 | 1383 | phpCAS:: error('type mismatched for parameter $service (should be `string\')'); |
@@ -1404,10 +1404,10 @@ discard block |
||
1404 | 1404 | global $PHPCAS_CLIENT; |
1405 | 1405 | phpCAS:: traceBegin(); |
1406 | 1406 | if (!is_object($PHPCAS_CLIENT)) { |
1407 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1407 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1408 | 1408 | } |
1409 | 1409 | if (!$PHPCAS_CLIENT->isProxy()) { |
1410 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1410 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1411 | 1411 | } |
1412 | 1412 | if (gettype($url) != 'string') { |
1413 | 1413 | phpCAS:: error('type mismatched for parameter $url (should be `string\')'); |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | global $PHPCAS_CLIENT; |
1428 | 1428 | phpCAS:: traceBegin(); |
1429 | 1429 | if (!is_object($PHPCAS_CLIENT)) { |
1430 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1430 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1431 | 1431 | } |
1432 | 1432 | if (gettype($url) != 'string') { |
1433 | 1433 | phpCAS:: error('type mismatched for parameter $url (should be `string\')'); |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | { |
1444 | 1444 | global $PHPCAS_CLIENT; |
1445 | 1445 | if (!is_object($PHPCAS_CLIENT)) { |
1446 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1446 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1447 | 1447 | } |
1448 | 1448 | return ($PHPCAS_CLIENT->getURL()); |
1449 | 1449 | } |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | { |
1456 | 1456 | global $PHPCAS_CLIENT; |
1457 | 1457 | if (!is_object($PHPCAS_CLIENT)) { |
1458 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::proxy()'); |
|
1458 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::proxy()'); |
|
1459 | 1459 | } |
1460 | 1460 | if (gettype($target_service) != 'string') { |
1461 | 1461 | phpCAS:: error('type mismatched for parameter $target_service(should be `string\')'); |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | global $PHPCAS_CLIENT; |
1474 | 1474 | phpCAS:: traceBegin(); |
1475 | 1475 | if (!is_object($PHPCAS_CLIENT)) { |
1476 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1476 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1477 | 1477 | } |
1478 | 1478 | if (gettype($cert) != 'string') { |
1479 | 1479 | phpCAS:: error('type mismatched for parameter $cert (should be `string\')'); |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | global $PHPCAS_CLIENT; |
1493 | 1493 | phpCAS:: traceBegin(); |
1494 | 1494 | if (!is_object($PHPCAS_CLIENT)) { |
1495 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1495 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1496 | 1496 | } |
1497 | 1497 | if (gettype($cert) != 'string') { |
1498 | 1498 | phpCAS:: error('type mismatched for parameter $cert (should be `string\')'); |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | global $PHPCAS_CLIENT; |
1510 | 1510 | phpCAS:: traceBegin(); |
1511 | 1511 | if (!is_object($PHPCAS_CLIENT)) { |
1512 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1512 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1513 | 1513 | } |
1514 | 1514 | $PHPCAS_CLIENT->setNoCasServerValidation(); |
1515 | 1515 | phpCAS:: traceEnd(); |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | global $PHPCAS_CLIENT; |
1529 | 1529 | phpCAS:: traceBegin(); |
1530 | 1530 | if (!is_object($PHPCAS_CLIENT)) { |
1531 | - phpCAS:: error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()'); |
|
1531 | + phpCAS:: error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); |
|
1532 | 1532 | } |
1533 | 1533 | $PHPCAS_CLIENT->setExtraCurlOption($key, $value); |
1534 | 1534 | phpCAS:: traceEnd(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | try { |
45 | 45 | $graphImage = $graphviz->createImageHtml($graph); |
46 | 46 | } catch (UnexpectedValueException $e) { |
47 | - error_log($e->getMessage() . ' - Graph could not be rendered in resources sequence because GraphViz command "dot" could not be executed - Make sure graphviz is installed.'); |
|
47 | + error_log($e->getMessage().' - Graph could not be rendered in resources sequence because GraphViz command "dot" could not be executed - Make sure graphviz is installed.'); |
|
48 | 48 | $graphImage = '<p class="text-center"><small>'.get_lang('MissingChartLibraryPleaseCheckLog').'</small></p>'; |
49 | 49 | } |
50 | 50 | echo $graphImage; |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | ); |
91 | 91 | } |
92 | 92 | |
93 | - $link = '<div class="parent" data-id="' . $id . '">'; |
|
93 | + $link = '<div class="parent" data-id="'.$id.'">'; |
|
94 | 94 | $link .= '<div class="big-icon">'; |
95 | 95 | $link .= $image; |
96 | - $link .= '<div class="sequence-course">' . $sessionInfo['name'] . '</div>'; |
|
97 | - $link .= '<a href="#" class="sequence-id">' . $id . '</a>'; |
|
96 | + $link .= '<div class="sequence-course">'.$sessionInfo['name'].'</div>'; |
|
97 | + $link .= '<a href="#" class="sequence-id">'.$id.'</a>'; |
|
98 | 98 | $link .= $linkDelete; |
99 | 99 | $link .= $linkUndo; |
100 | 100 | $link .= '</div></div>'; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | $listAction = api_get_self(); |
19 | 19 | |
20 | -$action = ''; |
|
20 | +$action = ''; |
|
21 | 21 | if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete'])) { |
22 | 22 | $action = $_GET['action']; |
23 | 23 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | } |
53 | 53 | $formToDisplay = $form->returnForm(); |
54 | 54 | |
55 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
56 | -$interbreadcrumb[] = array ('url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels')); |
|
55 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
56 | +$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels')); |
|
57 | 57 | |
58 | 58 | $tpl = new Template($action); |
59 | 59 | switch ($action) { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | $listAction = api_get_self(); |
19 | 19 | |
20 | -$action = ''; |
|
20 | +$action = ''; |
|
21 | 21 | if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete', 'move_up', 'move_down'])) { |
22 | 22 | $action = $_GET['action']; |
23 | 23 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | } |
44 | 44 | $formToDisplay = $form->returnForm(); |
45 | 45 | |
46 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
47 | -$interbreadcrumb[] = array ('url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels')); |
|
48 | -$interbreadcrumb[] = array ('url' => api_get_self(), 'name' => get_lang('SkillProfile')); |
|
46 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
47 | +$interbreadcrumb[] = array('url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels')); |
|
48 | +$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('SkillProfile')); |
|
49 | 49 | |
50 | 50 | $tpl = new Template($action); |
51 | 51 | switch ($action) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $position = $item->getPosition(); |
57 | 57 | |
58 | 58 | if (!empty($position)) { |
59 | - $item->setPosition($position-1); |
|
59 | + $item->setPosition($position - 1); |
|
60 | 60 | } |
61 | 61 | $em->persist($item); |
62 | 62 | $em->flush(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $position = $item->getPosition(); |
71 | 71 | |
72 | - $item->setPosition($position+1); |
|
72 | + $item->setPosition($position + 1); |
|
73 | 73 | |
74 | 74 | $em->persist($item); |
75 | 75 | $em->flush(); |
@@ -63,35 +63,35 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | if ($dir[0] != '/') { |
66 | - $dir = '/' . $dir; |
|
66 | + $dir = '/'.$dir; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($dir[strlen($dir) - 1] != '/') { |
70 | 70 | $dir .= '/'; |
71 | 71 | } |
72 | 72 | |
73 | -$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
|
73 | +$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
74 | 74 | |
75 | 75 | if (!is_dir($filepath)) { |
76 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
76 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
77 | 77 | $dir = '/'; |
78 | 78 | } |
79 | 79 | |
80 | 80 | //groups //TODO: clean |
81 | 81 | if (!empty($groupId)) { |
82 | 82 | $interbreadcrumb[] = array( |
83 | - "url" => "../group/group_space.php?" . api_get_cidreq(), |
|
83 | + "url" => "../group/group_space.php?".api_get_cidreq(), |
|
84 | 84 | "name" => get_lang('GroupSpace') |
85 | 85 | ); |
86 | 86 | $group = GroupManager:: get_group_properties($groupId); |
87 | 87 | $path = explode('/', $dir); |
88 | - if ('/' . $path[1] != $group['directory']) { |
|
88 | + if ('/'.$path[1] != $group['directory']) { |
|
89 | 89 | api_not_allowed(true); |
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | 93 | $interbreadcrumb[] = array( |
94 | - "url" => "./document.php?curdirpath=" . urlencode($dir) . "&" . api_get_cidreq(), |
|
94 | + "url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(), |
|
95 | 95 | "name" => get_lang('Documents') |
96 | 96 | ); |
97 | 97 | |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | |
129 | 129 | $dir_acum = ''; |
130 | 130 | for ($i = 0; $i < $array_len; $i++) { |
131 | - $url_dir = 'document.php?&curdirpath=' . $dir_acum . $dir_array[$i]; |
|
131 | + $url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i]; |
|
132 | 132 | //Max char 80 |
133 | 133 | $url_to_who = cut($dir_array[$i], 80); |
134 | 134 | $interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who); |
135 | - $dir_acum .= $dir_array[$i] . '/'; |
|
135 | + $dir_acum .= $dir_array[$i].'/'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | $service = isset($_GET['service']) ? $_GET['service'] : 'pediaphon'; |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | Display:: display_header($nameTools, 'Doc'); |
141 | 141 | |
142 | 142 | echo '<div class="actions">'; |
143 | -echo '<a href="document.php?id=' . $document_id . '">' . |
|
144 | - Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', |
|
145 | - ICON_SIZE_MEDIUM) . '</a>'; |
|
143 | +echo '<a href="document.php?id='.$document_id.'">'. |
|
144 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', |
|
145 | + ICON_SIZE_MEDIUM).'</a>'; |
|
146 | 146 | |
147 | -echo '<a href="create_audio.php?' . api_get_cidreq() . '&id=' . $document_id . '&service=pediaphon">' . |
|
148 | - Display::return_icon('pediaphon.png', get_lang('Pediaphon'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
147 | +echo '<a href="create_audio.php?'.api_get_cidreq().'&id='.$document_id.'&service=pediaphon">'. |
|
148 | + Display::return_icon('pediaphon.png', get_lang('Pediaphon'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
149 | 149 | |
150 | -echo '<a href="create_audio.php?' . api_get_cidreq() . '&id=' . $document_id . '&service=google">' . |
|
151 | - Display::return_icon('google.png', get_lang('GoogleAudio'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
150 | +echo '<a href="create_audio.php?'.api_get_cidreq().'&id='.$document_id.'&service=google">'. |
|
151 | + Display::return_icon('google.png', get_lang('GoogleAudio'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
152 | 152 | echo '</div>'; |
153 | 153 | ?> |
154 | 154 | <!-- javascript and styles for textareaCounter--> |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | $selected_language = null; |
214 | 214 | |
215 | 215 | while ($row = Database::fetch_array($result_select)) { |
216 | - $options[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')'; |
|
216 | + $options[$row['isocode']] = $row['original_name'].' ('.$row['english_name'].')'; |
|
217 | 217 | if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))) { |
218 | - $options_pedia[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')'; |
|
218 | + $options_pedia[$row['isocode']] = $row['original_name'].' ('.$row['english_name'].')'; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | 222 | if ($service == 'google') { |
223 | - $selected_language = api_get_language_isocode();//lang default is the course language |
|
223 | + $selected_language = api_get_language_isocode(); //lang default is the course language |
|
224 | 224 | |
225 | 225 | $form = new FormValidator('form1', 'post', api_get_self().'?'.api_get_cidreq(), '', array('id' => 'form1')); |
226 | 226 | $form->addHeader(get_lang('HelpText2Audio')); |
@@ -272,16 +272,16 @@ discard block |
||
272 | 272 | var voices = new Array() |
273 | 273 | |
274 | 274 | <!--German --> |
275 | - voices['de'] = ["<?php echo get_lang('Female') . ' (de1)'; ?>|de1", "<?php echo get_lang('Male') . ' (de2)'; ?>|de2", "<?php echo get_lang('Female') . ' (de3)'; ?>|de3", "<?php echo get_lang('Male') . ' (de4)'; ?>|de4", "<?php echo get_lang('Female') . ' (de5)'; ?>|de5", "<?php echo get_lang('Male') . ' (de6)'; ?>|de6", "<?php echo get_lang('Female') . ' (de7)'; ?>|de7", "<?php echo get_lang('Female') . ' (de8 HQ)'; ?>|de8"] |
|
275 | + voices['de'] = ["<?php echo get_lang('Female').' (de1)'; ?>|de1", "<?php echo get_lang('Male').' (de2)'; ?>|de2", "<?php echo get_lang('Female').' (de3)'; ?>|de3", "<?php echo get_lang('Male').' (de4)'; ?>|de4", "<?php echo get_lang('Female').' (de5)'; ?>|de5", "<?php echo get_lang('Male').' (de6)'; ?>|de6", "<?php echo get_lang('Female').' (de7)'; ?>|de7", "<?php echo get_lang('Female').' (de8 HQ)'; ?>|de8"] |
|
276 | 276 | |
277 | 277 | <!--English --> |
278 | - voices['en'] = ["<?php echo get_lang('Male') . ' (en1)'; ?>|en1", "<?php echo get_lang('Male') . ' (en2 HQ)'; ?>|en2", "<?php echo get_lang('Female') . ' (us1)'; ?>|us1", "<?php echo get_lang('Male') . ' (us2)'; ?>|us2", "<?php echo get_lang('Male') . ' (us3)'; ?>|us3", "<?php echo get_lang('Female') . '(us4 HQ)'; ?>|us4"] |
|
278 | + voices['en'] = ["<?php echo get_lang('Male').' (en1)'; ?>|en1", "<?php echo get_lang('Male').' (en2 HQ)'; ?>|en2", "<?php echo get_lang('Female').' (us1)'; ?>|us1", "<?php echo get_lang('Male').' (us2)'; ?>|us2", "<?php echo get_lang('Male').' (us3)'; ?>|us3", "<?php echo get_lang('Female').'(us4 HQ)'; ?>|us4"] |
|
279 | 279 | |
280 | 280 | <!--Spanish --> |
281 | - voices['es'] = ["<?php echo get_lang('Male') . ' (es5 HQ)'; ?>|es5"] |
|
281 | + voices['es'] = ["<?php echo get_lang('Male').' (es5 HQ)'; ?>|es5"] |
|
282 | 282 | |
283 | 283 | <!--French --> |
284 | - voices['fr'] = ["<?php echo get_lang('Female') . ' (fr8 HQ)'; ?>|fr8"] |
|
284 | + voices['fr'] = ["<?php echo get_lang('Female').' (fr8 HQ)'; ?>|fr8"] |
|
285 | 285 | |
286 | 286 | $(document).ready(function () { |
287 | 287 | $('.lang').on('change', function () { |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | */ |
313 | 313 | function downloadMP3_google($filepath, $dir) |
314 | 314 | { |
315 | - $location = 'create_audio.php?' . api_get_cidreq() . '&id=' . intval($_POST['id']) . '&service=google'; |
|
315 | + $location = 'create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&service=google'; |
|
316 | 316 | |
317 | 317 | //security |
318 | 318 | if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { |
319 | - echo '<script>window.location.href="' . $location . '"</script>'; |
|
319 | + echo '<script>window.location.href="'.$location.'"</script>'; |
|
320 | 320 | return; |
321 | 321 | } |
322 | 322 | |
@@ -326,33 +326,33 @@ discard block |
||
326 | 326 | $clean_title = trim($_POST['title']); |
327 | 327 | $clean_text = trim($_POST['text']); |
328 | 328 | if (empty($clean_title) || empty($clean_text)) { |
329 | - echo '<script>window.location.href="' . $location . '"</script>'; |
|
329 | + echo '<script>window.location.href="'.$location.'"</script>'; |
|
330 | 330 | |
331 | 331 | return; |
332 | 332 | } |
333 | 333 | $clean_title = Security::remove_XSS($clean_title); |
334 | 334 | $clean_title = Database::escape_string($clean_title); |
335 | - $clean_title = str_replace(' ', '_', $clean_title);//compound file names |
|
335 | + $clean_title = str_replace(' ', '_', $clean_title); //compound file names |
|
336 | 336 | |
337 | 337 | $clean_text = Security::remove_XSS($clean_text); |
338 | 338 | $clean_lang = Security::remove_XSS($_POST['lang']); |
339 | 339 | |
340 | 340 | $extension = 'mp3'; |
341 | - $audio_filename = $clean_title . '.' . $extension; |
|
341 | + $audio_filename = $clean_title.'.'.$extension; |
|
342 | 342 | $audio_title = str_replace('_', ' ', $clean_title); |
343 | 343 | |
344 | 344 | //prevent duplicates |
345 | - if (file_exists($filepath . '/' . $clean_title . '.' . $extension)) { |
|
345 | + if (file_exists($filepath.'/'.$clean_title.'.'.$extension)) { |
|
346 | 346 | $i = 1; |
347 | - while (file_exists($filepath . '/' . $clean_title . '_' . $i . '.' . $extension)) { |
|
347 | + while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) { |
|
348 | 348 | $i++; |
349 | 349 | } |
350 | - $audio_filename = $clean_title . '_' . $i . '.' . $extension; |
|
351 | - $audio_title = $clean_title . '_' . $i . '.' . $extension; |
|
350 | + $audio_filename = $clean_title.'_'.$i.'.'.$extension; |
|
351 | + $audio_title = $clean_title.'_'.$i.'.'.$extension; |
|
352 | 352 | $audio_title = str_replace('_', ' ', $audio_title); |
353 | 353 | } |
354 | 354 | |
355 | - $documentPath = $filepath . '/' . $audio_filename; |
|
355 | + $documentPath = $filepath.'/'.$audio_filename; |
|
356 | 356 | |
357 | 357 | $clean_text = api_replace_dangerous_char($clean_text); |
358 | 358 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | $proxySettings = api_get_configuration_value('proxy_settings'); |
363 | 363 | $key = api_get_configuration_value('translate_app_google_key'); |
364 | - $url = "https://www.googleapis.com/language/translate/v2?key=$key&" . $clean_lang . "&target=$clean_lang&q=" . urlencode($clean_text) . ""; |
|
364 | + $url = "https://www.googleapis.com/language/translate/v2?key=$key&".$clean_lang."&target=$clean_lang&q=".urlencode($clean_text).""; |
|
365 | 365 | |
366 | 366 | if (empty($proxySettings)) { |
367 | 367 | $content = file_get_contents($url); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $relativeUrlPath = $dir; |
382 | 382 | $doc_id = add_document( |
383 | 383 | $_course, |
384 | - $relativeUrlPath . $audio_filename, |
|
384 | + $relativeUrlPath.$audio_filename, |
|
385 | 385 | 'file', |
386 | 386 | filesize($documentPath), |
387 | 387 | $audio_title |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | ); |
401 | 401 | Display::display_confirmation_message(get_lang('DocumentCreated')); |
402 | 402 | //return to location |
403 | - echo '<script>window.location.href="' . $location . '"</script>'; |
|
403 | + echo '<script>window.location.href="'.$location.'"</script>'; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -413,10 +413,10 @@ discard block |
||
413 | 413 | */ |
414 | 414 | function downloadMP3_pediaphon($filepath, $dir) |
415 | 415 | { |
416 | - $location = 'create_audio.php?' . api_get_cidreq() . '&id=' . intval($_POST['id']) . '&service=pediaphon'; |
|
416 | + $location = 'create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&service=pediaphon'; |
|
417 | 417 | //security |
418 | 418 | if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { |
419 | - echo '<script>window.location.href="' . $location . '"</script>'; |
|
419 | + echo '<script>window.location.href="'.$location.'"</script>'; |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | $_course = api_get_course_info(); |
@@ -426,33 +426,33 @@ discard block |
||
426 | 426 | $clean_text = trim($_POST['text']); |
427 | 427 | $clean_voices = Security::remove_XSS($_POST['voices']); |
428 | 428 | if (empty($clean_title) || empty($clean_text) || empty($clean_voices)) { |
429 | - echo '<script>window.location.href="' . $location . '"</script>'; |
|
429 | + echo '<script>window.location.href="'.$location.'"</script>'; |
|
430 | 430 | |
431 | 431 | return; |
432 | 432 | } |
433 | 433 | $clean_title = Security::remove_XSS($clean_title); |
434 | 434 | $clean_title = Database::escape_string($clean_title); |
435 | - $clean_title = str_replace(' ', '_', $clean_title);//compound file names |
|
435 | + $clean_title = str_replace(' ', '_', $clean_title); //compound file names |
|
436 | 436 | $clean_text = Security::remove_XSS($clean_text); |
437 | 437 | $clean_lang = Security::remove_XSS($_POST['lang']); |
438 | 438 | $clean_speed = Security::remove_XSS($_POST['speed']); |
439 | 439 | |
440 | 440 | $extension = 'mp3'; |
441 | - $audio_filename = $clean_title . '.' . $extension; |
|
441 | + $audio_filename = $clean_title.'.'.$extension; |
|
442 | 442 | $audio_title = str_replace('_', ' ', $clean_title); |
443 | 443 | |
444 | 444 | //prevent duplicates |
445 | - if (file_exists($filepath . '/' . $clean_title . '.' . $extension)) { |
|
445 | + if (file_exists($filepath.'/'.$clean_title.'.'.$extension)) { |
|
446 | 446 | $i = 1; |
447 | - while (file_exists($filepath . '/' . $clean_title . '_' . $i . '.' . $extension)) { |
|
447 | + while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) { |
|
448 | 448 | $i++; |
449 | 449 | } |
450 | - $audio_filename = $clean_title . '_' . $i . '.' . $extension; |
|
451 | - $audio_title = $clean_title . '_' . $i . '.' . $extension; |
|
450 | + $audio_filename = $clean_title.'_'.$i.'.'.$extension; |
|
451 | + $audio_title = $clean_title.'_'.$i.'.'.$extension; |
|
452 | 452 | $audio_title = str_replace('_', ' ', $audio_title); |
453 | 453 | } |
454 | 454 | |
455 | - $documentPath = $filepath . '/' . $audio_filename; |
|
455 | + $documentPath = $filepath.'/'.$audio_filename; |
|
456 | 456 | $clean_text = api_replace_dangerous_char($clean_text); |
457 | 457 | |
458 | 458 | //adding the file |
@@ -461,17 +461,17 @@ discard block |
||
461 | 461 | $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi'; |
462 | 462 | $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/'; |
463 | 463 | } else { |
464 | - $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_' . $clean_lang . '.cgi';//en, es, fr |
|
465 | - $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/' . $clean_lang . '\/(.*)\.mp3\"/'; |
|
464 | + $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi'; //en, es, fr |
|
465 | + $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/'; |
|
466 | 466 | } |
467 | 467 | |
468 | - $data = "stimme=" . $clean_voices . "&inputtext=" . $clean_text . "&speed=" . $clean_speed . "&go=speak"; |
|
468 | + $data = "stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak"; |
|
469 | 469 | $opts = array( |
470 | 470 | 'http' => |
471 | 471 | array( |
472 | 472 | 'method' => 'POST', |
473 | 473 | 'header' => "Content-Type: application/x-www-form-urlencoded\r\n", |
474 | - "Content-Length: " . strlen($data) . "\r\n", |
|
474 | + "Content-Length: ".strlen($data)."\r\n", |
|
475 | 475 | 'content' => $data |
476 | 476 | ) |
477 | 477 | ); |
@@ -515,5 +515,5 @@ discard block |
||
515 | 515 | ); |
516 | 516 | Display::display_confirmation_message(get_lang('DocumentCreated')); |
517 | 517 | //return to location |
518 | - echo '<script>window.location.href="' . $location . '"</script>'; |
|
518 | + echo '<script>window.location.href="'.$location.'"</script>'; |
|
519 | 519 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $skillId = isset($_GET['skill']) ? intval($_GET['skill']) : 0; |
14 | 14 | |
15 | 15 | if (!$userId || !$skillId) { |
16 | - header('Location: ' . api_get_path(WEB_PATH)); |
|
16 | + header('Location: '.api_get_path(WEB_PATH)); |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | Display::return_message(get_lang('NoResults'), 'error') |
32 | 32 | ); |
33 | 33 | |
34 | - header('Location: ' . api_get_path(WEB_PATH)); |
|
34 | + header('Location: '.api_get_path(WEB_PATH)); |
|
35 | 35 | exit; |
36 | 36 | } |
37 | 37 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $entityManager->persist($skillIssue); |
168 | 168 | $entityManager->flush(); |
169 | 169 | |
170 | - header("Location: " . $skillIssue->getIssueUrlAll()); |
|
170 | + header("Location: ".$skillIssue->getIssueUrlAll()); |
|
171 | 171 | exit; |
172 | 172 | } |
173 | 173 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $entityManager->persist($skillUserComment); |
199 | 199 | $entityManager->flush(); |
200 | 200 | |
201 | - header("Location: " . $skillIssue->getIssueUrlAll()); |
|
201 | + header("Location: ".$skillIssue->getIssueUrlAll()); |
|
202 | 202 | exit; |
203 | 203 | } |
204 | 204 | |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | $backpack = $configBackpack; |
215 | 215 | } |
216 | 216 | |
217 | - $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>'; |
|
217 | + $htmlHeadXtra[] = '<script src="'.$backpack.'issuer.js"></script>'; |
|
218 | 218 | $objSkill = new Skill(); |
219 | 219 | $assertionUrl = $skillIssueInfo['badge_assertion']; |
220 | 220 | $skills = $objSkill->get($skillId); |
221 | - $unbakedBadge = api_get_path(SYS_UPLOAD_PATH) . "badges/".$skills['icon']; |
|
221 | + $unbakedBadge = api_get_path(SYS_UPLOAD_PATH)."badges/".$skills['icon']; |
|
222 | 222 | if (!is_file($unbakedBadge)) { |
223 | 223 | $unbakedBadge = api_get_path(WEB_CODE_PATH).'img/icons/128/badges-default.png'; |
224 | 224 | } |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | mkdir($bakedBadge, api_get_permissions_for_new_directories(), true); |
237 | 237 | } |
238 | 238 | $skillRelUserId = $skillIssueInfo['id']; |
239 | - if (!file_exists($bakedBadge . "/badge_" . $skillRelUserId)) { |
|
240 | - file_put_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png", $bakedInfo); |
|
239 | + if (!file_exists($bakedBadge."/badge_".$skillRelUserId)) { |
|
240 | + file_put_contents($bakedBadge."/badge_".$skillRelUserId.".png", $bakedInfo); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //Process to validate a baked badge |
244 | - $badgeContent = file_get_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png"); |
|
244 | + $badgeContent = file_get_contents($bakedBadge."/badge_".$skillRelUserId.".png"); |
|
245 | 245 | $verifyBakedBadge = $png->extractBadgeInfo($badgeContent); |
246 | 246 | if (!is_array($verifyBakedBadge)) { |
247 | 247 | $badgeInfoError = true; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | if (!$badgeInfoError) { |
251 | 251 | $personalBadge = UserManager::getUserPathById($userId, "web"); |
252 | - $personalBadge = $personalBadge."badges/badge_" . $skillRelUserId . ".png"; |
|
252 | + $personalBadge = $personalBadge."badges/badge_".$skillRelUserId.".png"; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function getIssueUrl() |
457 | 457 | { |
458 | - return api_get_path(WEB_PATH) . "badge/{$this->id}"; |
|
458 | + return api_get_path(WEB_PATH)."badge/{$this->id}"; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | public function getIssueUrlAll() |
466 | 466 | { |
467 | - return api_get_path(WEB_PATH) . "skill/{$this->skill->getId()}/user/{$this->user->getId()}"; |
|
467 | + return api_get_path(WEB_PATH)."skill/{$this->skill->getId()}/user/{$this->user->getId()}"; |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | */ |
474 | 474 | public function getAssertionUrl() |
475 | 475 | { |
476 | - $url = api_get_path(WEB_CODE_PATH) . "badge/assertion.php?"; |
|
476 | + $url = api_get_path(WEB_CODE_PATH)."badge/assertion.php?"; |
|
477 | 477 | |
478 | 478 | $url .= http_build_query(array( |
479 | 479 | 'user' => $this->user->getId(), |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Get user |
200 | - * @return \User |
|
200 | + * @return User |
|
201 | 201 | */ |
202 | 202 | public function getUser() |
203 | 203 | { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | /** |
514 | 514 | * Calculate the average value from the feedback comments |
515 | - * @return int |
|
515 | + * @return string |
|
516 | 516 | */ |
517 | 517 | public function getAverage() |
518 | 518 | { |
@@ -1701,7 +1701,9 @@ discard block |
||
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | global $_course; |
1704 | - if ($_course == '-1') $_course = array(); |
|
1704 | + if ($_course == '-1') { |
|
1705 | + $_course = array(); |
|
1706 | + } |
|
1705 | 1707 | return $_course; |
1706 | 1708 | } |
1707 | 1709 | |
@@ -4154,18 +4156,21 @@ discard block |
||
4154 | 4156 | switch ($lang_type) { |
4155 | 4157 | case 'platform_lang': |
4156 | 4158 | $temp_lang = api_get_setting('platformLanguage'); |
4157 | - if (!empty($temp_lang)) |
|
4158 | - $return = $temp_lang; |
|
4159 | + if (!empty($temp_lang)) { |
|
4160 | + $return = $temp_lang; |
|
4161 | + } |
|
4159 | 4162 | break; |
4160 | 4163 | case 'user_profil_lang': |
4161 | 4164 | $_user = api_get_user_info(); |
4162 | 4165 | |
4163 | - if (isset($_user['language']) && !empty($_user['language'])) |
|
4164 | - $return = $_user['language']; |
|
4166 | + if (isset($_user['language']) && !empty($_user['language'])) { |
|
4167 | + $return = $_user['language']; |
|
4168 | + } |
|
4165 | 4169 | break; |
4166 | 4170 | case 'user_selected_lang': |
4167 | - if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) |
|
4168 | - $return = $_SESSION['user_language_choice']; |
|
4171 | + if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) { |
|
4172 | + $return = $_SESSION['user_language_choice']; |
|
4173 | + } |
|
4169 | 4174 | break; |
4170 | 4175 | case 'course_lang': |
4171 | 4176 | global $_course; |
@@ -5434,8 +5439,7 @@ discard block |
||
5434 | 5439 | $is_courseAdmin = false; |
5435 | 5440 | $is_courseCoach = true; |
5436 | 5441 | $is_sessionAdmin = false; |
5437 | - } |
|
5438 | - elseif ($row[0]['session_admin_id'] == $userid) { |
|
5442 | + } elseif ($row[0]['session_admin_id'] == $userid) { |
|
5439 | 5443 | $is_courseMember = false; |
5440 | 5444 | $is_courseTutor = false; |
5441 | 5445 | $is_courseAdmin = false; |
@@ -5778,8 +5782,7 @@ discard block |
||
5778 | 5782 | elseif (isset($_ENV['OS'])) { |
5779 | 5783 | // Sometimes $_ENV['OS'] may not be present (bugs?) |
5780 | 5784 | $os = $_ENV['OS']; |
5781 | - } |
|
5782 | - elseif (defined('PHP_OS')) { |
|
5785 | + } elseif (defined('PHP_OS')) { |
|
5783 | 5786 | // PHP_OS means on which OS PHP was compiled, this is why |
5784 | 5787 | // using PHP_OS is the last choice for detection. |
5785 | 5788 | $os = PHP_OS; |
@@ -5843,12 +5846,10 @@ discard block |
||
5843 | 5846 | if ($delta_width > $delta_height) { |
5844 | 5847 | $result['width'] = ceil($image_width * $resize_factor_height); |
5845 | 5848 | $result['height'] = ceil($image_height * $resize_factor_height); |
5846 | - } |
|
5847 | - elseif ($delta_width < $delta_height) { |
|
5849 | + } elseif ($delta_width < $delta_height) { |
|
5848 | 5850 | $result['width'] = ceil($image_width * $resize_factor_width); |
5849 | 5851 | $result['height'] = ceil($image_height * $resize_factor_width); |
5850 | - } |
|
5851 | - else { |
|
5852 | + } else { |
|
5852 | 5853 | $result['width'] = ceil($target_width); |
5853 | 5854 | $result['height'] = ceil($target_height); |
5854 | 5855 | } |
@@ -6629,7 +6630,9 @@ discard block |
||
6629 | 6630 | } |
6630 | 6631 | $ip = trim($ip1); |
6631 | 6632 | } |
6632 | - if (!empty($debug)) error_log('Real IP: '.$ip); |
|
6633 | + if (!empty($debug)) { |
|
6634 | + error_log('Real IP: '.$ip); |
|
6635 | + } |
|
6633 | 6636 | return $ip; |
6634 | 6637 | } |
6635 | 6638 |
@@ -1240,6 +1240,7 @@ discard block |
||
1240 | 1240 | * Gets the list of courses a specific user is subscribed to |
1241 | 1241 | * @param int User ID |
1242 | 1242 | * @param boolean $fetch_session Whether to get session courses or not - NOT YET IMPLEMENTED |
1243 | + * @param integer $userid |
|
1243 | 1244 | * @return array Array of courses in the form [0]=>('code'=>xxx,'db'=>xxx,'dir'=>xxx,'status'=>d) |
1244 | 1245 | */ |
1245 | 1246 | function api_get_user_courses($userid, $fetch_session = true) |
@@ -2955,7 +2956,7 @@ discard block |
||
2955 | 2956 | * on the session visibility |
2956 | 2957 | * @param bool $tutor Whether to check if the user has the tutor role |
2957 | 2958 | * @param bool $coach Whether to check if the user has the coach role |
2958 | -* @return boolean true: the user has the rights to edit, false: he does not |
|
2959 | +* @return boolean|null true: the user has the rights to edit, false: he does not |
|
2959 | 2960 | */ |
2960 | 2961 | function api_is_allowed_to_session_edit($tutor = false, $coach = false) |
2961 | 2962 | { |
@@ -5188,6 +5189,7 @@ discard block |
||
5188 | 5189 | * @param string Whether we want a simple list (display a category) or |
5189 | 5190 | * a grouped list (group by variable as in settings.php default). Values: 'list' or 'group' |
5190 | 5191 | * @param int Access URL's ID. Optional. Uses 1 by default, which is the unique URL |
5192 | + * @param string $cat |
|
5191 | 5193 | * @return array Array of database results for the current settings of the current access URL |
5192 | 5194 | */ |
5193 | 5195 | function & api_get_settings($cat = null, $ordering = 'list', $access_url = 1, $url_changeable = 0) |
@@ -6614,7 +6616,7 @@ discard block |
||
6614 | 6616 | /** |
6615 | 6617 | * Returns an array of global configuration settings which should be ignored |
6616 | 6618 | * when printing the configuration settings screens |
6617 | - * @return array Array of strings, each identifying one of the excluded settings |
|
6619 | + * @return string[] Array of strings, each identifying one of the excluded settings |
|
6618 | 6620 | */ |
6619 | 6621 | function api_get_locked_settings() { |
6620 | 6622 | return array( |
@@ -6655,6 +6657,7 @@ discard block |
||
6655 | 6657 | * false if he isn't. If the user ID is given and is an integer, then the same |
6656 | 6658 | * ID is simply returned |
6657 | 6659 | * @param integer User ID |
6660 | + * @param integer $user_id |
|
6658 | 6661 | * @return boolean Integer User ID is logged in, or false otherwise |
6659 | 6662 | */ |
6660 | 6663 | function api_user_is_login($user_id = null) { |
@@ -7099,6 +7102,7 @@ discard block |
||
7099 | 7102 | /** |
7100 | 7103 | * Gets memory limit in bytes |
7101 | 7104 | * @param string The memory size (128M, 1G, 1000K, etc) |
7105 | + * @param string $mem |
|
7102 | 7106 | * @return int |
7103 | 7107 | * @assert (null) === false |
7104 | 7108 | * @assert ('1t') === 1099511627776 |
@@ -626,7 +626,6 @@ discard block |
||
626 | 626 | * Also, this function provides conversion between path types, in this case the input path points inside the Chamilo area too. |
627 | 627 | * |
628 | 628 | * See $_configuration['course_folder'] in the configuration.php to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters. |
629 | - |
|
630 | 629 | * @param string $path (optional) A path which type is to be converted. Also, it may be a defined constant for a path. |
631 | 630 | * This parameter has meaning when $type parameter has one of the following values: TO_WEB, TO_SYS, TO_REL. Otherwise it is ignored. |
632 | 631 | * @return string The requested path or the converted path. |
@@ -1733,7 +1732,6 @@ discard block |
||
1733 | 1732 | |
1734 | 1733 | /** |
1735 | 1734 | * Returns the current course info array. |
1736 | - |
|
1737 | 1735 | * Now if the course_code is given, the returned array gives info about that |
1738 | 1736 | * particular course, not specially the current one. |
1739 | 1737 | * @param int $id Numeric ID of the course |
@@ -6210,7 +6208,7 @@ discard block |
||
6210 | 6208 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6211 | 6209 | $libraries = array(); |
6212 | 6210 | if ($include_jqgrid) { |
6213 | - $libraries[]='jqgrid'; |
|
6211 | + $libraries[]='jqgrid'; |
|
6214 | 6212 | } |
6215 | 6213 | return api_get_jquery_libraries_js($libraries); |
6216 | 6214 | } |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | define('PLATFORM_ADMIN', 11); |
42 | 42 | define('SESSION_COURSE_COACH', 12); |
43 | 43 | define('SESSION_GENERAL_COACH', 13); |
44 | -define('COURSE_STUDENT', 14); //student subscribed in a course |
|
45 | -define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
44 | +define('COURSE_STUDENT', 14); //student subscribed in a course |
|
45 | +define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
46 | 46 | define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session) |
47 | 47 | define('STUDENT_BOSS', 17); // student is boss |
48 | 48 | define('INVITEE', 20); |
49 | 49 | |
50 | 50 | // Table of status |
51 | -$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
52 | -$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
53 | -$_status_list[DRH] = 'drh'; // 4 |
|
54 | -$_status_list[STUDENT] = 'user'; // 5 |
|
55 | -$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
56 | -$_status_list[INVITEE] = 'invited'; // 20 |
|
51 | +$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
52 | +$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
53 | +$_status_list[DRH] = 'drh'; // 4 |
|
54 | +$_status_list[STUDENT] = 'user'; // 5 |
|
55 | +$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
56 | +$_status_list[INVITEE] = 'invited'; // 20 |
|
57 | 57 | |
58 | 58 | // COURSE VISIBILITY CONSTANTS |
59 | 59 | /** only visible for course admin */ |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | define('IS_WINDOWS_OS', api_is_windows_os()); |
268 | 268 | |
269 | 269 | // Checks for installed optional php-extensions. |
270 | -define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
271 | -define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
272 | -define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
270 | +define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
271 | +define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
272 | +define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
273 | 273 | |
274 | 274 | // Patterns for processing paths. // Examples: |
275 | -define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
276 | -define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
277 | -define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
275 | +define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
276 | +define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
277 | +define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
278 | 278 | |
279 | 279 | // Constants for api_get_path() and api_get_path_type(), etc. - registered path types. |
280 | 280 | // basic (leaf elements) |
@@ -363,19 +363,19 @@ discard block |
||
363 | 363 | define('LINK_HOTPOTATOES', 9); |
364 | 364 | |
365 | 365 | // Score display types constants |
366 | -define('SCORE_DIV', 1); // X / Y |
|
367 | -define('SCORE_PERCENT', 2); // XX % |
|
368 | -define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
369 | -define('SCORE_AVERAGE', 4); // XX % |
|
370 | -define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
371 | -define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
372 | -define('SCORE_SIMPLE', 7); // X |
|
373 | -define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
374 | -define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
375 | -define('SCORE_CUSTOM', 10); // Good! |
|
376 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
377 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
378 | -define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
366 | +define('SCORE_DIV', 1); // X / Y |
|
367 | +define('SCORE_PERCENT', 2); // XX % |
|
368 | +define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
369 | +define('SCORE_AVERAGE', 4); // XX % |
|
370 | +define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
371 | +define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
372 | +define('SCORE_SIMPLE', 7); // X |
|
373 | +define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
374 | +define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
375 | +define('SCORE_CUSTOM', 10); // Good! |
|
376 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
377 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
378 | +define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
379 | 379 | |
380 | 380 | define('SCORE_BOTH', 1); |
381 | 381 | define('SCORE_ONLY_DEFAULT', 2); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | define('TIMELINE_STATUS_INACTIVE', '2'); |
559 | 559 | |
560 | 560 | // Event email template class |
561 | -define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
561 | +define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
562 | 562 | define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
563 | 563 | |
564 | 564 | // Course home |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | define('FILE_OVERWRITE', 3); |
575 | 575 | define('UTF8_CONVERT', false); //false by default |
576 | 576 | |
577 | -define('DOCUMENT','file'); |
|
578 | -define('FOLDER','folder'); |
|
577 | +define('DOCUMENT', 'file'); |
|
578 | +define('FOLDER', 'folder'); |
|
579 | 579 | |
580 | 580 | define('RESOURCE_DOCUMENT', 'document'); |
581 | 581 | define('RESOURCE_GLOSSARY', 'glossary'); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | $emptyConfigurationParam = false; |
657 | 657 | if (empty($configuration)) { |
658 | - $configuration = (array)$_configuration; |
|
658 | + $configuration = (array) $_configuration; |
|
659 | 659 | $emptyConfigurationParam = true; |
660 | 660 | } |
661 | 661 | |
@@ -688,10 +688,10 @@ discard block |
||
688 | 688 | && (($server_protocol == 'http' |
689 | 689 | && $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443)) |
690 | 690 | ) { |
691 | - $server_name .= ":" . $_SERVER['SERVER_PORT']; |
|
691 | + $server_name .= ":".$_SERVER['SERVER_PORT']; |
|
692 | 692 | } |
693 | - $root_web = $server_protocol . '://' . $server_name . $root_rel; |
|
694 | - $root_sys = str_replace('\\', '/', realpath(__DIR__ . '/../../../')) . '/'; |
|
693 | + $root_web = $server_protocol.'://'.$server_name.$root_rel; |
|
694 | + $root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
|
695 | 695 | } |
696 | 696 | // Here we give up, so we don't touch anything. |
697 | 697 | } |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | $sys_course_code = |
877 | 877 | isset($_SESSION['_course']['sysCode']) // User is inside a course? |
878 | 878 | ? $_SESSION['_course']['sysCode'] // Yes, then use course's directory name. |
879 | - : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
879 | + : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
880 | 880 | $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]); |
881 | 881 | } |
882 | 882 | } |
@@ -901,15 +901,15 @@ discard block |
||
901 | 901 | { |
902 | 902 | global $_configuration; |
903 | 903 | $web_root = api_get_path(WEB_PATH); |
904 | - $ext = substr($web_path,strrpos($web_path,'.')); |
|
904 | + $ext = substr($web_path, strrpos($web_path, '.')); |
|
905 | 905 | if (isset($ext[2])) { // faster version of strlen to check if len>2 |
906 | 906 | // Check for CDN definitions |
907 | 907 | if (!empty($_configuration['cdn_enable']) && !empty($ext)) { |
908 | 908 | foreach ($_configuration['cdn'] as $host => $exts) { |
909 | - if (in_array($ext,$exts)) { |
|
909 | + if (in_array($ext, $exts)) { |
|
910 | 910 | //Use host as defined in $_configuration['cdn'], without |
911 | 911 | // trailing slash |
912 | - return str_replace($web_root,$host.'/',$web_path); |
|
912 | + return str_replace($web_root, $host.'/', $web_path); |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | } |
@@ -1356,10 +1356,10 @@ discard block |
||
1356 | 1356 | |
1357 | 1357 | if (isset($user['email'])) { |
1358 | 1358 | $result['mail'] = isset($user['email']) ? $user['email'] : null; |
1359 | - $result['email'] = isset($user['email'])? $user['email'] : null; |
|
1359 | + $result['email'] = isset($user['email']) ? $user['email'] : null; |
|
1360 | 1360 | } else { |
1361 | 1361 | $result['mail'] = isset($user['mail']) ? $user['mail'] : null; |
1362 | - $result['email'] = isset($user['mail'])? $user['mail'] : null; |
|
1362 | + $result['email'] = isset($user['mail']) ? $user['mail'] : null; |
|
1363 | 1363 | } |
1364 | 1364 | $user_id = intval($user['user_id']); |
1365 | 1365 | // Maintain the user_id index for backwards compatibility |
@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | foreach ($param_list1 as $key => $enreg) { |
1878 | 1878 | list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg); |
1879 | 1879 | } |
1880 | - $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1880 | + $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1881 | 1881 | foreach ($param_list2 as $enreg) { |
1882 | 1882 | $enreg = explode('=', $enreg); |
1883 | 1883 | $key = array_search($enreg[0], $param_list1['keys']); |
@@ -1910,12 +1910,12 @@ discard block |
||
1910 | 1910 | $length = 2; |
1911 | 1911 | } |
1912 | 1912 | $password = ''; |
1913 | - for ($i = 0; $i < $length; $i ++) { |
|
1913 | + for ($i = 0; $i < $length; $i++) { |
|
1914 | 1914 | $password .= $characters[rand() % strlen($characters)]; |
1915 | 1915 | } |
1916 | 1916 | |
1917 | 1917 | // At least 2 digits |
1918 | - for ($i = 0; $i < 2; $i ++) { |
|
1918 | + for ($i = 0; $i < 2; $i++) { |
|
1919 | 1919 | $password .= $numbers[rand() % strlen($numbers)]; |
1920 | 1920 | } |
1921 | 1921 | |
@@ -1943,10 +1943,10 @@ discard block |
||
1943 | 1943 | $digits = 0; |
1944 | 1944 | $consequent_characters = 0; |
1945 | 1945 | $previous_character_code = 0; |
1946 | - for ($i = 0; $i < $password_length; $i ++) { |
|
1946 | + for ($i = 0; $i < $password_length; $i++) { |
|
1947 | 1947 | $current_character_code = api_ord(api_substr($password, $i, 1)); |
1948 | 1948 | if ($i && abs($current_character_code - $previous_character_code) <= 1) { |
1949 | - $consequent_characters ++; |
|
1949 | + $consequent_characters++; |
|
1950 | 1950 | if ($consequent_characters == 3) { |
1951 | 1951 | return false; |
1952 | 1952 | } |
@@ -1954,9 +1954,9 @@ discard block |
||
1954 | 1954 | $consequent_characters = 1; |
1955 | 1955 | } |
1956 | 1956 | if ($current_character_code >= 97 && $current_character_code <= 122) { |
1957 | - $letters ++; |
|
1957 | + $letters++; |
|
1958 | 1958 | } elseif ($current_character_code >= 48 && $current_character_code <= 57) { |
1959 | - $digits ++; |
|
1959 | + $digits++; |
|
1960 | 1960 | } else { |
1961 | 1961 | return false; |
1962 | 1962 | } |
@@ -2061,7 +2061,7 @@ discard block |
||
2061 | 2061 | if (empty($session_id)) { return null; } |
2062 | 2062 | } |
2063 | 2063 | $t = Database::get_main_table(TABLE_MAIN_SESSION); |
2064 | - $s = "SELECT name FROM $t WHERE id = ".(int)$session_id; |
|
2064 | + $s = "SELECT name FROM $t WHERE id = ".(int) $session_id; |
|
2065 | 2065 | $r = Database::query($s); |
2066 | 2066 | $c = Database::num_rows($r); |
2067 | 2067 | if ($c > 0) { |
@@ -2231,9 +2231,9 @@ discard block |
||
2231 | 2231 | */ |
2232 | 2232 | function api_get_session_image($session_id, $status_id) |
2233 | 2233 | { |
2234 | - $session_id = (int)$session_id; |
|
2234 | + $session_id = (int) $session_id; |
|
2235 | 2235 | $session_img = ''; |
2236 | - if ((int)$status_id != 5) { //check whether is not a student |
|
2236 | + if ((int) $status_id != 5) { //check whether is not a student |
|
2237 | 2237 | if ($session_id > 0) { |
2238 | 2238 | $session_img = " ".Display::return_icon( |
2239 | 2239 | 'star.png', |
@@ -2509,7 +2509,7 @@ discard block |
||
2509 | 2509 | function api_is_course_session_coach($user_id, $courseId, $session_id) |
2510 | 2510 | { |
2511 | 2511 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
2512 | - $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2512 | + $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2513 | 2513 | |
2514 | 2514 | $user_id = intval($user_id); |
2515 | 2515 | $session_id = intval($session_id); |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | ORDER BY access_start_date, access_end_date, name"; |
2584 | 2584 | $result = Database::query($sql); |
2585 | 2585 | if (!empty($sessionIsCoach)) { |
2586 | - $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result)); |
|
2586 | + $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result)); |
|
2587 | 2587 | } else { |
2588 | 2588 | $sessionIsCoach = Database::store_result($result); |
2589 | 2589 | } |
@@ -2757,7 +2757,7 @@ discard block |
||
2757 | 2757 | return ''; |
2758 | 2758 | } |
2759 | 2759 | $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); |
2760 | - $sourceurl = str_replace('lp/lp_header.php', 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview']=='studentview' ? 'false' : 'true'), $sourceurl); |
|
2760 | + $sourceurl = str_replace('lp/lp_header.php', 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview'] == 'studentview' ? 'false' : 'true'), $sourceurl); |
|
2761 | 2761 | //showinframes doesn't handle student view anyway... |
2762 | 2762 | //return ''; |
2763 | 2763 | $is_framed = true; |
@@ -3240,7 +3240,7 @@ discard block |
||
3240 | 3240 | } |
3241 | 3241 | $content .= '<div class="well">'; |
3242 | 3242 | $content .= $form->returnForm(); |
3243 | - $content .='</div>'; |
|
3243 | + $content .= '</div>'; |
|
3244 | 3244 | if (api_is_cas_activated()) { |
3245 | 3245 | $content .= "</div>"; |
3246 | 3246 | } |
@@ -3292,7 +3292,7 @@ discard block |
||
3292 | 3292 | } |
3293 | 3293 | $msg .= '<div class="well">'; |
3294 | 3294 | $msg .= $form->returnForm(); |
3295 | - $msg .='</div>'; |
|
3295 | + $msg .= '</div>'; |
|
3296 | 3296 | if ($casEnabled) { |
3297 | 3297 | $msg .= "</div>"; |
3298 | 3298 | } |
@@ -3322,7 +3322,7 @@ discard block |
||
3322 | 3322 | list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime); |
3323 | 3323 | list ($year, $month, $day) = explode('-', $last_post_date); |
3324 | 3324 | list ($hour, $min, $sec) = explode(':', $last_post_time); |
3325 | - return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year); |
|
3325 | + return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year); |
|
3326 | 3326 | } |
3327 | 3327 | |
3328 | 3328 | /** |
@@ -3794,7 +3794,7 @@ discard block |
||
3794 | 3794 | c_id = $course_id AND |
3795 | 3795 | tool = '$tool' |
3796 | 3796 | $session_condition "; |
3797 | - $rs = Database::query($sql); |
|
3797 | + $rs = Database::query($sql); |
|
3798 | 3798 | $list = array(); |
3799 | 3799 | if (Database::num_rows($rs) > 0) { |
3800 | 3800 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -3875,7 +3875,7 @@ discard block |
||
3875 | 3875 | tool = '$tool' AND |
3876 | 3876 | ref = $ref |
3877 | 3877 | $sessionCondition"; |
3878 | - $rs = Database::query($sql); |
|
3878 | + $rs = Database::query($sql); |
|
3879 | 3879 | $item_property_id = ''; |
3880 | 3880 | if (Database::num_rows($rs) > 0) { |
3881 | 3881 | $row = Database::fetch_array($rs); |
@@ -3936,7 +3936,7 @@ discard block |
||
3936 | 3936 | if ($result == false) { |
3937 | 3937 | $result = array(); |
3938 | 3938 | } else { |
3939 | - $result = Database::store_result($result,'ASSOC'); |
|
3939 | + $result = Database::store_result($result, 'ASSOC'); |
|
3940 | 3940 | } |
3941 | 3941 | |
3942 | 3942 | return $result; |
@@ -3988,7 +3988,7 @@ discard block |
||
3988 | 3988 | $rs = Database::query($sql); |
3989 | 3989 | $row = array(); |
3990 | 3990 | if (Database::num_rows($rs) > 0) { |
3991 | - $row = Database::fetch_array($rs,'ASSOC'); |
|
3991 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
3992 | 3992 | } |
3993 | 3993 | |
3994 | 3994 | return $row; |
@@ -4023,7 +4023,7 @@ discard block |
||
4023 | 4023 | $languages = $language_list['name']; |
4024 | 4024 | $folder = $language_list['folder']; |
4025 | 4025 | |
4026 | - $ret .= '<select name="' . $name . '" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4026 | + $ret .= '<select name="'.$name.'" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4027 | 4027 | foreach ($languages as $key => $value) { |
4028 | 4028 | if ($folder[$key] == $default) { |
4029 | 4029 | $selected = ' selected="selected"'; |
@@ -4073,8 +4073,8 @@ discard block |
||
4073 | 4073 | } |
4074 | 4074 | </script>'; |
4075 | 4075 | $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">'; |
4076 | - $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>'; |
|
4077 | - $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4076 | + $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>'; |
|
4077 | + $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4078 | 4078 | |
4079 | 4079 | foreach ($original_languages as $key => $value) { |
4080 | 4080 | if ($folder[$key] == $user_selected_language) { |
@@ -4082,13 +4082,13 @@ discard block |
||
4082 | 4082 | } else { |
4083 | 4083 | $option_end = '>'; |
4084 | 4084 | } |
4085 | - $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4085 | + $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4086 | 4086 | //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect. |
4087 | - $html .= $value.'</option>'; |
|
4087 | + $html .= $value.'</option>'; |
|
4088 | 4088 | } |
4089 | - $html .= '</select>'; |
|
4090 | - $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4091 | - $html .= '</form>'; |
|
4089 | + $html .= '</select>'; |
|
4090 | + $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4091 | + $html .= '</form>'; |
|
4092 | 4092 | return $html; |
4093 | 4093 | } |
4094 | 4094 | |
@@ -4306,7 +4306,7 @@ discard block |
||
4306 | 4306 | * Note: Directory names (names of themes) in the file system should contain ASCII-characters only. |
4307 | 4307 | */ |
4308 | 4308 | function api_get_themes() { |
4309 | - $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/'; |
|
4309 | + $cssdir = api_get_path(SYS_CSS_PATH).'themes/'; |
|
4310 | 4310 | $list_dir = array(); |
4311 | 4311 | $list_name = array(); |
4312 | 4312 | |
@@ -4467,7 +4467,7 @@ discard block |
||
4467 | 4467 | if (is_file($dirname) || is_link($dirname)) { |
4468 | 4468 | $res = unlink($dirname); |
4469 | 4469 | if ($res === false) { |
4470 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4470 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4471 | 4471 | } |
4472 | 4472 | return $res; |
4473 | 4473 | } |
@@ -4504,7 +4504,7 @@ discard block |
||
4504 | 4504 | if ($delete_only_content_in_folder == false) { |
4505 | 4505 | $res = rmdir($dirname); |
4506 | 4506 | if ($res === false) { |
4507 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4507 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4508 | 4508 | } |
4509 | 4509 | } |
4510 | 4510 | return $res; |
@@ -4589,7 +4589,7 @@ discard block |
||
4589 | 4589 | |
4590 | 4590 | $course_id = $course_info['real_id']; |
4591 | 4591 | |
4592 | - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); |
|
4592 | + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); |
|
4593 | 4593 | |
4594 | 4594 | $new_pathname = $base_path_document; |
4595 | 4595 | $path = ''; |
@@ -4607,7 +4607,7 @@ discard block |
||
4607 | 4607 | path = '$path' AND |
4608 | 4608 | filetype = 'folder' AND |
4609 | 4609 | session_id = '$session_id'"; |
4610 | - $rs1 = Database::query($sql); |
|
4610 | + $rs1 = Database::query($sql); |
|
4611 | 4611 | $num_rows = Database::num_rows($rs1); |
4612 | 4612 | |
4613 | 4613 | if ($num_rows == 0) { |
@@ -4767,7 +4767,7 @@ discard block |
||
4767 | 4767 | foreach (array('key', 'value1', 'value2', 'value3') as $var) { |
4768 | 4768 | $$var = isset($match[++$i]) ? $match[$i] : ''; |
4769 | 4769 | } |
4770 | - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; |
|
4770 | + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; |
|
4771 | 4771 | |
4772 | 4772 | // Parse array syntax. |
4773 | 4773 | $keys = preg_split('/\]?\[/', rtrim($key, ']')); |
@@ -4933,7 +4933,7 @@ discard block |
||
4933 | 4933 | $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
4934 | 4934 | $var = Database::escape_string($var); |
4935 | 4935 | $value = Database::escape_string($value); |
4936 | - $access_url = (int)$access_url; |
|
4936 | + $access_url = (int) $access_url; |
|
4937 | 4937 | if (empty($access_url)) { $access_url = 1; } |
4938 | 4938 | $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; |
4939 | 4939 | if (!empty($subvar)) { |
@@ -4974,11 +4974,11 @@ discard block |
||
4974 | 4974 | $row = Database::fetch_array($res); |
4975 | 4975 | $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) |
4976 | 4976 | VALUES |
4977 | - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
4978 | - "'".$row['type']."','".$row['category']."'," . |
|
4979 | - "'$value','".$row['title']."'," . |
|
4980 | - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
4981 | - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; |
|
4977 | + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
4978 | + "'".$row['type']."','".$row['category']."',". |
|
4979 | + "'$value','".$row['title']."',". |
|
4980 | + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
4981 | + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; |
|
4982 | 4982 | Database::query($insert); |
4983 | 4983 | } else { |
4984 | 4984 | // Such a setting does not exist. |
@@ -5000,11 +5000,11 @@ discard block |
||
5000 | 5000 | if ($row['access_url_changeable'] == 1) { |
5001 | 5001 | $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES |
5002 | 5002 | ('".$row['variable']."',". |
5003 | - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5004 | - "'".$row['type']."','".$row['category']."'," . |
|
5005 | - "'$value','".$row['title']."'," . |
|
5003 | + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5004 | + "'".$row['type']."','".$row['category']."',". |
|
5005 | + "'$value','".$row['title']."',". |
|
5006 | 5006 | "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". |
5007 | - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5007 | + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5008 | 5008 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5009 | 5009 | Database::query($insert); |
5010 | 5010 | } |
@@ -5037,10 +5037,10 @@ discard block |
||
5037 | 5037 | $value = Database::escape_string($value); |
5038 | 5038 | $sql = "UPDATE $t_s SET selected_value = '$value' |
5039 | 5039 | WHERE category = '$category' AND access_url = $access_url"; |
5040 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5040 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5041 | 5041 | $sql .= " AND ( "; |
5042 | 5042 | $i = 0; |
5043 | - foreach ($fieldtype as $type){ |
|
5043 | + foreach ($fieldtype as $type) { |
|
5044 | 5044 | if ($i > 0) { |
5045 | 5045 | $sql .= ' OR '; |
5046 | 5046 | } |
@@ -5055,10 +5055,10 @@ discard block |
||
5055 | 5055 | } else { |
5056 | 5056 | $sql = "UPDATE $t_s SET selected_value = NULL |
5057 | 5057 | WHERE category = '$category' AND access_url = $access_url"; |
5058 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5058 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5059 | 5059 | $sql .= " AND ( "; |
5060 | 5060 | $i = 0; |
5061 | - foreach ($fieldtype as $type){ |
|
5061 | + foreach ($fieldtype as $type) { |
|
5062 | 5062 | if ($i > 0) { |
5063 | 5063 | $sql .= ' OR '; |
5064 | 5064 | } |
@@ -5163,7 +5163,7 @@ discard block |
||
5163 | 5163 | $sql .= " ORDER BY 1,2 ASC"; |
5164 | 5164 | } |
5165 | 5165 | $result = Database::query($sql); |
5166 | - $result = Database::store_result($result,'ASSOC'); |
|
5166 | + $result = Database::store_result($result, 'ASSOC'); |
|
5167 | 5167 | |
5168 | 5168 | return $result; |
5169 | 5169 | } |
@@ -5230,12 +5230,12 @@ discard block |
||
5230 | 5230 | |
5231 | 5231 | // Item not found for this access_url, we have to check if the whole thing is missing |
5232 | 5232 | // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 |
5233 | - $insert = "INSERT INTO $t_settings " . |
|
5234 | - "(variable,selected_value," . |
|
5235 | - "type,category," . |
|
5236 | - "subkey,title," . |
|
5237 | - "comment,scope," . |
|
5238 | - "subkeytext,access_url,access_url_changeable)" . |
|
5233 | + $insert = "INSERT INTO $t_settings ". |
|
5234 | + "(variable,selected_value,". |
|
5235 | + "type,category,". |
|
5236 | + "subkey,title,". |
|
5237 | + "comment,scope,". |
|
5238 | + "subkeytext,access_url,access_url_changeable)". |
|
5239 | 5239 | " VALUES ('$var','$val',"; |
5240 | 5240 | if (isset($type)) { |
5241 | 5241 | $type = Database::escape_string($type); |
@@ -5401,7 +5401,7 @@ discard block |
||
5401 | 5401 | $result = Database::query($sql); |
5402 | 5402 | |
5403 | 5403 | //if ($row = Database::fetch_array($result)) { |
5404 | - if (Database::num_rows($result) > 0 ) { |
|
5404 | + if (Database::num_rows($result) > 0) { |
|
5405 | 5405 | $is_courseMember = true; |
5406 | 5406 | $is_courseTutor = true; |
5407 | 5407 | $is_courseCoach = true; |
@@ -5682,7 +5682,7 @@ discard block |
||
5682 | 5682 | } else { |
5683 | 5683 | return false; |
5684 | 5684 | } |
5685 | - return strtolower(substr((string)$os, 0, 3 )) == 'win'; |
|
5685 | + return strtolower(substr((string) $os, 0, 3)) == 'win'; |
|
5686 | 5686 | } |
5687 | 5687 | |
5688 | 5688 | /** |
@@ -6236,7 +6236,7 @@ discard block |
||
6236 | 6236 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6237 | 6237 | $libraries = array(); |
6238 | 6238 | if ($include_jqgrid) { |
6239 | - $libraries[]='jqgrid'; |
|
6239 | + $libraries[] = 'jqgrid'; |
|
6240 | 6240 | } |
6241 | 6241 | return api_get_jquery_libraries_js($libraries); |
6242 | 6242 | } |
@@ -6259,12 +6259,12 @@ discard block |
||
6259 | 6259 | |
6260 | 6260 | //jqgrid js and css |
6261 | 6261 | if (in_array('jqgrid', $libraries)) { |
6262 | - $languaje = 'en'; |
|
6262 | + $languaje = 'en'; |
|
6263 | 6263 | $platform_isocode = strtolower(api_get_language_isocode()); |
6264 | 6264 | |
6265 | 6265 | //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
6266 | 6266 | $jqgrid_langs = array( |
6267 | - 'bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua' |
|
6267 | + 'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua' |
|
6268 | 6268 | ); |
6269 | 6269 | |
6270 | 6270 | if (in_array($platform_isocode, $jqgrid_langs)) { |
@@ -6295,7 +6295,7 @@ discard block |
||
6295 | 6295 | |
6296 | 6296 | // jquery datepicker |
6297 | 6297 | if (in_array('datepicker', $libraries)) { |
6298 | - $languaje = 'en-GB'; |
|
6298 | + $languaje = 'en-GB'; |
|
6299 | 6299 | $platform_isocode = strtolower(api_get_language_isocode()); |
6300 | 6300 | |
6301 | 6301 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
@@ -6461,7 +6461,7 @@ discard block |
||
6461 | 6461 | * @return void |
6462 | 6462 | */ |
6463 | 6463 | function api_check_php_version($my_inc_path = null) { |
6464 | - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6464 | + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6465 | 6465 | $global_error_code = 1; |
6466 | 6466 | // Incorrect PHP version |
6467 | 6467 | $global_page = $my_inc_path.'global_error_message.inc.php'; |
@@ -6477,7 +6477,7 @@ discard block |
||
6477 | 6477 | */ |
6478 | 6478 | function api_check_archive_dir() { |
6479 | 6479 | if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { |
6480 | - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); |
|
6480 | + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); |
|
6481 | 6481 | api_not_allowed(true, $message); |
6482 | 6482 | } |
6483 | 6483 | } |
@@ -6540,7 +6540,7 @@ discard block |
||
6540 | 6540 | * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy |
6541 | 6541 | * @version CEV CHANGE 24APR2012 |
6542 | 6542 | */ |
6543 | -function api_get_real_ip(){ |
|
6543 | +function api_get_real_ip() { |
|
6544 | 6544 | // Guess the IP if behind a reverse proxy |
6545 | 6545 | global $debug; |
6546 | 6546 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6566,23 +6566,23 @@ discard block |
||
6566 | 6566 | * @author Yannick Warnier for improvements and managment of multiple ranges |
6567 | 6567 | * @todo check for IPv6 support |
6568 | 6568 | */ |
6569 | -function api_check_ip_in_range($ip,$range) |
|
6569 | +function api_check_ip_in_range($ip, $range) |
|
6570 | 6570 | { |
6571 | 6571 | if (empty($ip) or empty($range)) { |
6572 | 6572 | return false; |
6573 | 6573 | } |
6574 | - $ip_ip = ip2long ($ip); |
|
6574 | + $ip_ip = ip2long($ip); |
|
6575 | 6575 | // divide range param into array of elements |
6576 | - if (strpos($range,',')!==false) { |
|
6577 | - $ranges = explode(',',$range); |
|
6576 | + if (strpos($range, ',') !== false) { |
|
6577 | + $ranges = explode(',', $range); |
|
6578 | 6578 | } else { |
6579 | 6579 | $ranges = array($range); |
6580 | 6580 | } |
6581 | 6581 | foreach ($ranges as $range) { |
6582 | 6582 | $range = trim($range); |
6583 | 6583 | if (empty($range)) { continue; } |
6584 | - if (strpos($range,'/')===false) { |
|
6585 | - if (strcmp($ip,$range)===0) { |
|
6584 | + if (strpos($range, '/') === false) { |
|
6585 | + if (strcmp($ip, $range) === 0) { |
|
6586 | 6586 | return true; // there is a direct IP match, return OK |
6587 | 6587 | } |
6588 | 6588 | continue; //otherwise, get to the next range |
@@ -6590,7 +6590,7 @@ discard block |
||
6590 | 6590 | // the range contains a "/", so analyse completely |
6591 | 6591 | list ($net, $mask) = explode("/", $range); |
6592 | 6592 | |
6593 | - $ip_net = ip2long ($net); |
|
6593 | + $ip_net = ip2long($net); |
|
6594 | 6594 | // mask binary magic |
6595 | 6595 | $ip_mask = ~((1 << (32 - $mask)) - 1); |
6596 | 6596 | |
@@ -6928,14 +6928,14 @@ discard block |
||
6928 | 6928 | * @assert (0) === true |
6929 | 6929 | * @assert ('1G') === true |
6930 | 6930 | */ |
6931 | -function api_set_memory_limit($mem){ |
|
6931 | +function api_set_memory_limit($mem) { |
|
6932 | 6932 | //if ini_set() not available, this function is useless |
6933 | 6933 | if (!function_exists('ini_set') || is_null($mem) || $mem == -1) { |
6934 | 6934 | return false; |
6935 | 6935 | } |
6936 | 6936 | |
6937 | 6937 | $memory_limit = ini_get('memory_limit'); |
6938 | - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ |
|
6938 | + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { |
|
6939 | 6939 | ini_set('memory_limit', $mem); |
6940 | 6940 | return true; |
6941 | 6941 | } |
@@ -6952,21 +6952,21 @@ discard block |
||
6952 | 6952 | * @assert ('1m') === 1048576 |
6953 | 6953 | * @assert ('100k') === 102400 |
6954 | 6954 | */ |
6955 | -function api_get_bytes_memory_limit($mem){ |
|
6956 | - $size = strtolower(substr($mem,-1)); |
|
6955 | +function api_get_bytes_memory_limit($mem) { |
|
6956 | + $size = strtolower(substr($mem, -1)); |
|
6957 | 6957 | |
6958 | 6958 | switch ($size) { |
6959 | 6959 | case 't': |
6960 | - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; |
|
6960 | + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; |
|
6961 | 6961 | break; |
6962 | 6962 | case 'g': |
6963 | - $mem = intval(substr($mem,0,-1))*1024*1024*1024; |
|
6963 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; |
|
6964 | 6964 | break; |
6965 | 6965 | case 'm': |
6966 | - $mem = intval(substr($mem,0,-1))*1024*1024; |
|
6966 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; |
|
6967 | 6967 | break; |
6968 | 6968 | case 'k': |
6969 | - $mem = intval(substr($mem,0,-1))*1024; |
|
6969 | + $mem = intval(substr($mem, 0, -1)) * 1024; |
|
6970 | 6970 | break; |
6971 | 6971 | default: |
6972 | 6972 | // we assume it's integer only |
@@ -7029,7 +7029,7 @@ discard block |
||
7029 | 7029 | ]; |
7030 | 7030 | |
7031 | 7031 | $js = api_get_asset('pwstrength-bootstrap/dist/pwstrength-bootstrap.min.js'); |
7032 | - $js .= "<script> |
|
7032 | + $js .= "<script> |
|
7033 | 7033 | var errorMessages = { |
7034 | 7034 | password_to_short : \"" . get_lang('PasswordIsTooShort')."\", |
7035 | 7035 | same_as_username : \"".get_lang('YourPasswordCannotBeTheSameAsYourUsername')."\" |
@@ -7076,7 +7076,7 @@ discard block |
||
7076 | 7076 | return false; |
7077 | 7077 | } |
7078 | 7078 | $minutesToBlock = api_get_setting('captcha_time_to_block'); |
7079 | - $time = time() + $minutesToBlock*60; |
|
7079 | + $time = time() + $minutesToBlock * 60; |
|
7080 | 7080 | UserManager::update_extra_field_value( |
7081 | 7081 | $userInfo['user_id'], |
7082 | 7082 | 'captcha_blocked_until_date', |
@@ -7150,7 +7150,7 @@ discard block |
||
7150 | 7150 | $out_res = str_replace('"', "''", $out_res); |
7151 | 7151 | } |
7152 | 7152 | // avoid text stuck together when tags are removed, adding a space after > |
7153 | - $out_res = str_replace (">", "> ", $out_res); |
|
7153 | + $out_res = str_replace(">", "> ", $out_res); |
|
7154 | 7154 | $out_res = strip_tags($out_res); |
7155 | 7155 | |
7156 | 7156 | return $out_res; |
@@ -7359,7 +7359,7 @@ discard block |
||
7359 | 7359 | $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n "; |
7360 | 7360 | $body .= get_lang('PortalLimitType').': '.$limitName." \n "; |
7361 | 7361 | if (isset($hostingParams[$limitName])) { |
7362 | - $body .= get_lang('Value') . ': ' . $hostingParams[$limitName]; |
|
7362 | + $body .= get_lang('Value').': '.$hostingParams[$limitName]; |
|
7363 | 7363 | } |
7364 | 7364 | api_mail_html(null, $email, $subject, $body); |
7365 | 7365 | } |
@@ -7491,7 +7491,7 @@ discard block |
||
7491 | 7491 | */ |
7492 | 7492 | function api_set_site_use_cookie_warning_cookie() |
7493 | 7493 | { |
7494 | - setcookie('ChamiloUsesCookies', 'ok', time()+31556926); |
|
7494 | + setcookie('ChamiloUsesCookies', 'ok', time() + 31556926); |
|
7495 | 7495 | } |
7496 | 7496 | |
7497 | 7497 | /** |
@@ -7545,10 +7545,10 @@ discard block |
||
7545 | 7545 | return false; |
7546 | 7546 | } |
7547 | 7547 | |
7548 | - $fullPath = $parentDirectory . api_replace_dangerous_char($name); |
|
7548 | + $fullPath = $parentDirectory.api_replace_dangerous_char($name); |
|
7549 | 7549 | |
7550 | 7550 | if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { |
7551 | - $fp = fopen($fullPath . '/index.html', 'w'); |
|
7551 | + $fp = fopen($fullPath.'/index.html', 'w'); |
|
7552 | 7552 | |
7553 | 7553 | if ($fp) { |
7554 | 7554 | if (fwrite($fp, '<html><head></head><body></body></html>')) { |
@@ -7613,7 +7613,7 @@ discard block |
||
7613 | 7613 | $mail->SMTPSecure = $platform_email['SMTP_SECURE']; |
7614 | 7614 | } |
7615 | 7615 | } |
7616 | - $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG'])?$platform_email['SMTP_DEBUG']:0; |
|
7616 | + $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG']) ? $platform_email['SMTP_DEBUG'] : 0; |
|
7617 | 7617 | |
7618 | 7618 | // 5 = low, 1 = high |
7619 | 7619 | $mail->Priority = 3; |
@@ -7760,11 +7760,11 @@ discard block |
||
7760 | 7760 | error_log('ERROR: mail not sent to '.$recipient_name.' ('.$recipient_email.') because of '.$mail->ErrorInfo.'<br />'); |
7761 | 7761 | if ($mail->SMTPDebug) { |
7762 | 7762 | error_log( |
7763 | - "Connection details :: " . |
|
7764 | - "Protocol: " . $mail->Mailer . ' :: ' . |
|
7765 | - "Host/Port: " . $mail->Host . ':' . $mail->Port . ' :: ' . |
|
7766 | - "Authent/Open: " . ($mail->SMTPAuth?'Authent':'Open') . ' :: ' . |
|
7767 | - ($mail->SMTPAuth?" User/Pass: " . $mail->Username . ':' . $mail->Password:'') |
|
7763 | + "Connection details :: ". |
|
7764 | + "Protocol: ".$mail->Mailer.' :: '. |
|
7765 | + "Host/Port: ".$mail->Host.':'.$mail->Port.' :: '. |
|
7766 | + "Authent/Open: ".($mail->SMTPAuth ? 'Authent' : 'Open').' :: '. |
|
7767 | + ($mail->SMTPAuth ? " User/Pass: ".$mail->Username.':'.$mail->Password : '') |
|
7768 | 7768 | ); |
7769 | 7769 | } |
7770 | 7770 | return 0; |
@@ -7840,13 +7840,13 @@ discard block |
||
7840 | 7840 | * @return array |
7841 | 7841 | * |
7842 | 7842 | */ |
7843 | -function api_unique_multidim_array($array, $key){ |
|
7843 | +function api_unique_multidim_array($array, $key) { |
|
7844 | 7844 | $temp_array = []; |
7845 | 7845 | $i = 0; |
7846 | 7846 | $key_array = []; |
7847 | 7847 | |
7848 | - foreach($array as $val){ |
|
7849 | - if(!in_array($val[$key],$key_array)){ |
|
7848 | + foreach ($array as $val) { |
|
7849 | + if (!in_array($val[$key], $key_array)) { |
|
7850 | 7850 | $key_array[$i] = $val[$key]; |
7851 | 7851 | $temp_array[$i] = $val; |
7852 | 7852 | } |
@@ -7890,7 +7890,7 @@ discard block |
||
7890 | 7890 | // No "dangerous" files |
7891 | 7891 | $name = disable_dangerous_file($name); |
7892 | 7892 | |
7893 | - $pathId = '/'.substr((string)$itemId, 0, 1).'/'.$itemId.'/'; |
|
7893 | + $pathId = '/'.substr((string) $itemId, 0, 1).'/'.$itemId.'/'; |
|
7894 | 7894 | $path = api_get_path(SYS_UPLOAD_PATH).$type.$pathId; |
7895 | 7895 | |
7896 | 7896 | if (!is_dir($path)) { |
@@ -267,7 +267,7 @@ |
||
267 | 267 | * @param string $author |
268 | 268 | * @param string $filename |
269 | 269 | * @param int $filesize |
270 | - * @param array $recipient_ids |
|
270 | + * @param unknown_type|null $recipient_ids |
|
271 | 271 | */ |
272 | 272 | public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
273 | 273 | { |
@@ -496,13 +496,19 @@ |
||
496 | 496 | $id = intval($id); |
497 | 497 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
498 | 498 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
499 | - if (!Database::query($sql)) return false; |
|
499 | + if (!Database::query($sql)) { |
|
500 | + return false; |
|
501 | + } |
|
500 | 502 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
501 | 503 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
502 | - if (!Database::query($sql)) return false; |
|
504 | + if (!Database::query($sql)) { |
|
505 | + return false; |
|
506 | + } |
|
503 | 507 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
504 | 508 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
505 | - if (!Database::query($sql)) return false; |
|
509 | + if (!Database::query($sql)) { |
|
510 | + return false; |
|
511 | + } |
|
506 | 512 | return true; |
507 | 513 | } |
508 | 514 |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // Check if object exists already. If it does, the old object is used |
105 | 105 | // with updated information (authors, description, upload_date) |
106 | 106 | $this->isOldWork = false; |
107 | - $sql = "SELECT id, upload_date FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
107 | + $sql = "SELECT id, upload_date FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
108 | 108 | WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'"; |
109 | 109 | $result = Database::query($sql); |
110 | 110 | $res = Database::fetch_array($result); |
@@ -148,20 +148,20 @@ discard block |
||
148 | 148 | |
149 | 149 | $this->id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FILE), $params); |
150 | 150 | if ($this->id) { |
151 | - $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FILE) ." SET id = iid WHERE iid = {$this->id}"; |
|
151 | + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)." SET id = iid WHERE iid = {$this->id}"; |
|
152 | 152 | Database::query($sql); |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | $sql = "SELECT count(file_id) as count |
157 | - FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
157 | + FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
158 | 158 | WHERE c_id = $course_id AND file_id = ".intval($this->id)." AND user_id = ".$this->uploader_id; |
159 | 159 | $result = Database::query($sql); |
160 | 160 | $row = Database::fetch_array($result); |
161 | 161 | if ($row['count'] == 0) { |
162 | 162 | |
163 | 163 | // Insert entries into person table |
164 | - $sql = "INSERT INTO ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." (c_id, file_id, user_id) |
|
164 | + $sql = "INSERT INTO ".Database::get_course_table(TABLE_DROPBOX_PERSON)." (c_id, file_id, user_id) |
|
165 | 165 | VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")"; |
166 | 166 | Database::query($sql); |
167 | 167 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
180 | 180 | |
181 | 181 | // Do some sanity checks |
182 | - $id = intval($id); |
|
182 | + $id = intval($id); |
|
183 | 183 | |
184 | 184 | // Get the data from DB |
185 | 185 | $sql = "SELECT uploader_id, filename, filesize, title, description, author, upload_date, last_upload_date, cat_id |
186 | - FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
186 | + FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
187 | 187 | WHERE c_id = $course_id AND id = ".$id.""; |
188 | 188 | $result = Database::query($sql); |
189 | 189 | $res = Database::fetch_array($result, 'ASSOC'); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | // Getting the feedback on the work. |
213 | 213 | if ($action == 'viewfeedback' AND $this->id == $_GET['id']) { |
214 | 214 | $feedback2 = array(); |
215 | - $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ." |
|
215 | + $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." |
|
216 | 216 | WHERE c_id = $course_id AND file_id='".$id."' |
217 | 217 | ORDER BY feedback_id ASC"; |
218 | 218 | $result = Database::query($sql); |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | $row_feedback['feedback'] = Security::remove_XSS($row_feedback['feedback']); |
221 | 221 | $feedback2[] = $row_feedback; |
222 | 222 | } |
223 | - $this->feedback2= $feedback2; |
|
223 | + $this->feedback2 = $feedback2; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | 228 | class Dropbox_SentWork extends Dropbox_Work |
229 | 229 | { |
230 | - public $recipients; //array of ['id']['name'] arrays |
|
230 | + public $recipients; //array of ['id']['name'] arrays |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Constructor calls private functions to create a new work or retreive an existing work from DB |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $recipient_ids = array($uploader_id); |
293 | 293 | } |
294 | 294 | |
295 | - if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
295 | + if (!is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
296 | 296 | die(get_lang('GeneralError').' (code 209)'); |
297 | 297 | } |
298 | 298 | |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | $table_post = Database::get_course_table(TABLE_DROPBOX_POST); |
309 | 309 | $table_person = Database::get_course_table(TABLE_DROPBOX_PERSON); |
310 | 310 | $session_id = api_get_session_id(); |
311 | - $user = api_get_user_id(); |
|
311 | + $user = api_get_user_id(); |
|
312 | 312 | $now = api_get_utc_datetime(); |
313 | 313 | |
314 | 314 | // Insert data in dropbox_post and dropbox_person table for each recipient |
315 | 315 | foreach ($this->recipients as $rec) { |
316 | - $file_id = (int)$this->id; |
|
317 | - $user_id = (int)$rec['id']; |
|
316 | + $file_id = (int) $this->id; |
|
317 | + $user_id = (int) $rec['id']; |
|
318 | 318 | $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
319 | 319 | VALUES ($course_id, $file_id, $user_id, $session_id, '$now', 0)"; |
320 | 320 | Database::query($sql); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | // Do not add recipient in person table if mailing zip or just upload. |
332 | 332 | if (!$justSubmit) { |
333 | - Database::query($sql); // If work already exists no error is generated |
|
333 | + Database::query($sql); // If work already exists no error is generated |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $ownerid = getUserOwningThisMailing($ownerid); |
340 | 340 | } |
341 | 341 | if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) { |
342 | - $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
342 | + $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
343 | 343 | } |
344 | 344 | api_item_property_update( |
345 | 345 | $_course, |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | class Dropbox_Person |
397 | 397 | { |
398 | 398 | // The receivedWork and the sentWork arrays are sorted. |
399 | - public $receivedWork; // an array of Dropbox_Work objects |
|
400 | - public $sentWork; // an array of Dropbox_SentWork objects |
|
399 | + public $receivedWork; // an array of Dropbox_Work objects |
|
400 | + public $sentWork; // an array of Dropbox_SentWork objects |
|
401 | 401 | |
402 | 402 | public $userId = 0; |
403 | 403 | public $isCourseAdmin = false; |
404 | 404 | public $isCourseTutor = false; |
405 | - public $_orderBy = ''; // private property that determines by which field |
|
405 | + public $_orderBy = ''; // private property that determines by which field |
|
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Constructor for recreating the Dropbox_Person object |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $course_id = api_get_course_int_id(); |
472 | 472 | // Delete entries in person table concerning received works |
473 | 473 | foreach ($this->receivedWork as $w) { |
474 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
474 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
475 | 475 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
476 | 476 | Database::query($sql); |
477 | 477 | } |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | $course_id = api_get_course_int_id(); |
489 | 489 | |
490 | 490 | $id = intval($id); |
491 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
491 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
492 | 492 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
493 | 493 | if (!Database::query($sql)) return false; |
494 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
494 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
495 | 495 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
496 | 496 | if (!Database::query($sql)) return false; |
497 | 497 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | } |
526 | 526 | } |
527 | 527 | // Delete entries in person table concerning received works |
528 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
528 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
529 | 529 | WHERE c_id = $course_id AND user_id = '".$this->userId."' AND file_id ='".$id."'"; |
530 | 530 | Database::query($sql); |
531 | - removeUnusedFiles(); // Check for unused files |
|
531 | + removeUnusedFiles(); // Check for unused files |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
@@ -539,12 +539,12 @@ discard block |
||
539 | 539 | $course_id = api_get_course_int_id(); |
540 | 540 | //delete entries in person table concerning sent works |
541 | 541 | foreach ($this->sentWork as $w) { |
542 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
542 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
543 | 543 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
544 | 544 | Database::query($sql); |
545 | 545 | removeMoreIfMailing($w->id); |
546 | 546 | } |
547 | - removeUnusedFiles(); // Check for unused files |
|
547 | + removeUnusedFiles(); // Check for unused files |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | } |
574 | 574 | //$file_id = $this->sentWork[$index]->id; |
575 | 575 | // Delete entries in person table concerning sent works |
576 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
576 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
577 | 577 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'"; |
578 | 578 | Database::query($sql); |
579 | 579 | removeMoreIfMailing($id); |
580 | - removeUnusedFiles(); // Check for unused files |
|
580 | + removeUnusedFiles(); // Check for unused files |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | $wi = -1; |
600 | 600 | foreach ($this->receivedWork as $w) { |
601 | 601 | $wi++; |
602 | - if ($w->id == $id){ |
|
602 | + if ($w->id == $id) { |
|
603 | 603 | $found = true; |
604 | 604 | break; |
605 | 605 | } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
@@ -76,20 +76,20 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * private function creating a new work object |
|
81 | - * |
|
82 | - * @param int $uploader_id |
|
83 | - * @param string $title |
|
84 | - * @param string $description |
|
85 | - * @param string $author |
|
86 | - * @param string $filename |
|
87 | - * @param int $filesize |
|
88 | - * |
|
89 | - * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
90 | - * As a consequence this parameter can be removed |
|
91 | - */ |
|
92 | - public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
79 | + /** |
|
80 | + * private function creating a new work object |
|
81 | + * |
|
82 | + * @param int $uploader_id |
|
83 | + * @param string $title |
|
84 | + * @param string $description |
|
85 | + * @param string $author |
|
86 | + * @param string $filename |
|
87 | + * @param int $filesize |
|
88 | + * |
|
89 | + * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
90 | + * As a consequence this parameter can be removed |
|
91 | + */ |
|
92 | + public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
93 | 93 | { |
94 | 94 | // Fill in the properties |
95 | 95 | $this->uploader_id = intval($uploader_id); |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | // Check if object exists already. If it does, the old object is used |
105 | 105 | // with updated information (authors, description, upload_date) |
106 | 106 | $this->isOldWork = false; |
107 | - $sql = "SELECT id, upload_date FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
107 | + $sql = "SELECT id, upload_date FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
108 | 108 | WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'"; |
109 | 109 | $result = Database::query($sql); |
110 | - $res = Database::fetch_array($result); |
|
111 | - if ($res) { |
|
112 | - $this->isOldWork = true; |
|
113 | - } |
|
114 | - // Insert or update the dropbox_file table and set the id property |
|
115 | - if ($this->isOldWork) { |
|
116 | - $this->id = $res['id']; |
|
117 | - $this->upload_date = $res['upload_date']; |
|
110 | + $res = Database::fetch_array($result); |
|
111 | + if ($res) { |
|
112 | + $this->isOldWork = true; |
|
113 | + } |
|
114 | + // Insert or update the dropbox_file table and set the id property |
|
115 | + if ($this->isOldWork) { |
|
116 | + $this->id = $res['id']; |
|
117 | + $this->upload_date = $res['upload_date']; |
|
118 | 118 | |
119 | 119 | $params = [ |
120 | 120 | 'filesize' => $this->filesize, |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | $params, |
131 | 131 | ['c_id = ? AND id = ?' => [$course_id, $this->id]] |
132 | 132 | ); |
133 | - } else { |
|
134 | - $this->upload_date = $this->last_upload_date; |
|
135 | - $params = [ |
|
133 | + } else { |
|
134 | + $this->upload_date = $this->last_upload_date; |
|
135 | + $params = [ |
|
136 | 136 | 'c_id' => $course_id, |
137 | 137 | 'uploader_id' => $this->uploader_id, |
138 | 138 | 'filename' => $this->filename, |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | 'last_upload_date' => $this->last_upload_date, |
145 | 145 | 'session_id' => api_get_session_id(), |
146 | 146 | 'cat_id' => 0 |
147 | - ]; |
|
147 | + ]; |
|
148 | 148 | |
149 | - $this->id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FILE), $params); |
|
150 | - if ($this->id) { |
|
151 | - $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FILE) ." SET id = iid WHERE iid = {$this->id}"; |
|
152 | - Database::query($sql); |
|
153 | - } |
|
154 | - } |
|
149 | + $this->id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FILE), $params); |
|
150 | + if ($this->id) { |
|
151 | + $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FILE) ." SET id = iid WHERE iid = {$this->id}"; |
|
152 | + Database::query($sql); |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | 156 | $sql = "SELECT count(file_id) as count |
157 | 157 | FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")"; |
166 | 166 | Database::query($sql); |
167 | 167 | } |
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * private function creating existing object by retreiving info from db |
|
172 | - * |
|
173 | - * @param int $id |
|
174 | - */ |
|
175 | - public function _createExistingWork($id) |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * private function creating existing object by retreiving info from db |
|
172 | + * |
|
173 | + * @param int $id |
|
174 | + */ |
|
175 | + public function _createExistingWork($id) |
|
176 | 176 | { |
177 | - $course_id = api_get_course_int_id(); |
|
177 | + $course_id = api_get_course_int_id(); |
|
178 | 178 | |
179 | 179 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
180 | 180 | |
@@ -222,52 +222,52 @@ discard block |
||
222 | 222 | } |
223 | 223 | $this->feedback2= $feedback2; |
224 | 224 | } |
225 | - } |
|
225 | + } |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | class Dropbox_SentWork extends Dropbox_Work |
229 | 229 | { |
230 | - public $recipients; //array of ['id']['name'] arrays |
|
231 | - |
|
232 | - /** |
|
233 | - * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
234 | - * depending on the number of parameters |
|
235 | - * |
|
236 | - * @param unknown_type $arg1 |
|
237 | - * @param unknown_type $arg2 |
|
238 | - * @param unknown_type $arg3 |
|
239 | - * @param unknown_type $arg4 |
|
240 | - * @param unknown_type $arg5 |
|
241 | - * @param unknown_type $arg6 |
|
242 | - * @param unknown_type $arg7 |
|
243 | - * @return Dropbox_SentWork |
|
244 | - */ |
|
245 | - public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
230 | + public $recipients; //array of ['id']['name'] arrays |
|
231 | + |
|
232 | + /** |
|
233 | + * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
234 | + * depending on the number of parameters |
|
235 | + * |
|
236 | + * @param unknown_type $arg1 |
|
237 | + * @param unknown_type $arg2 |
|
238 | + * @param unknown_type $arg3 |
|
239 | + * @param unknown_type $arg4 |
|
240 | + * @param unknown_type $arg5 |
|
241 | + * @param unknown_type $arg6 |
|
242 | + * @param unknown_type $arg7 |
|
243 | + * @return Dropbox_SentWork |
|
244 | + */ |
|
245 | + public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
246 | 246 | { |
247 | - if (func_num_args() > 1) { |
|
248 | - $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
249 | - } else { |
|
250 | - $this->_createExistingSentWork($arg1); |
|
251 | - } |
|
252 | - } |
|
253 | - |
|
254 | - /** |
|
255 | - * private function creating a new SentWork object |
|
256 | - * |
|
257 | - * @param int $uploader_id |
|
258 | - * @param string $title |
|
259 | - * @param string $description |
|
260 | - * @param string $author |
|
261 | - * @param string $filename |
|
262 | - * @param int $filesize |
|
263 | - * @param array $recipient_ids |
|
264 | - */ |
|
265 | - public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
247 | + if (func_num_args() > 1) { |
|
248 | + $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
249 | + } else { |
|
250 | + $this->_createExistingSentWork($arg1); |
|
251 | + } |
|
252 | + } |
|
253 | + |
|
254 | + /** |
|
255 | + * private function creating a new SentWork object |
|
256 | + * |
|
257 | + * @param int $uploader_id |
|
258 | + * @param string $title |
|
259 | + * @param string $description |
|
260 | + * @param string $author |
|
261 | + * @param string $filename |
|
262 | + * @param int $filesize |
|
263 | + * @param array $recipient_ids |
|
264 | + */ |
|
265 | + public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
266 | 266 | { |
267 | 267 | $dropbox_cnf = getDropboxConf(); |
268 | 268 | $_course = api_get_course_info(); |
269 | 269 | |
270 | - // Call constructor of Dropbox_Work object |
|
270 | + // Call constructor of Dropbox_Work object |
|
271 | 271 | parent::__construct( |
272 | 272 | $uploader_id, |
273 | 273 | $title, |
@@ -277,33 +277,33 @@ discard block |
||
277 | 277 | $filesize |
278 | 278 | ); |
279 | 279 | |
280 | - $course_id = api_get_course_int_id(); |
|
281 | - |
|
282 | - // Do sanity checks on recipient_ids array & property fillin |
|
283 | - // The sanity check for ex-coursemembers is already done in base constructor |
|
284 | - $uploader_id = (int) $uploader_id; |
|
280 | + $course_id = api_get_course_int_id(); |
|
285 | 281 | |
286 | - $justSubmit = false; |
|
287 | - if (is_int($recipient_ids)) { |
|
288 | - $justSubmit = true; |
|
289 | - $recipient_ids = array($recipient_ids + $this->id); |
|
290 | - } elseif (count($recipient_ids) == 0) { |
|
291 | - $justSubmit = true; |
|
292 | - $recipient_ids = array($uploader_id); |
|
293 | - } |
|
282 | + // Do sanity checks on recipient_ids array & property fillin |
|
283 | + // The sanity check for ex-coursemembers is already done in base constructor |
|
284 | + $uploader_id = (int) $uploader_id; |
|
285 | + |
|
286 | + $justSubmit = false; |
|
287 | + if (is_int($recipient_ids)) { |
|
288 | + $justSubmit = true; |
|
289 | + $recipient_ids = array($recipient_ids + $this->id); |
|
290 | + } elseif (count($recipient_ids) == 0) { |
|
291 | + $justSubmit = true; |
|
292 | + $recipient_ids = array($uploader_id); |
|
293 | + } |
|
294 | 294 | |
295 | - if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
296 | - die(get_lang('GeneralError').' (code 209)'); |
|
297 | - } |
|
295 | + if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
296 | + die(get_lang('GeneralError').' (code 209)'); |
|
297 | + } |
|
298 | 298 | |
299 | - foreach ($recipient_ids as $rec) { |
|
300 | - if (empty($rec)) { |
|
301 | - continue; |
|
299 | + foreach ($recipient_ids as $rec) { |
|
300 | + if (empty($rec)) { |
|
301 | + continue; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | //this check is done when validating submitted data |
305 | - $this->recipients[] = array('id' => $rec); |
|
306 | - } |
|
305 | + $this->recipients[] = array('id' => $rec); |
|
306 | + } |
|
307 | 307 | |
308 | 308 | $table_post = Database::get_course_table(TABLE_DROPBOX_POST); |
309 | 309 | $table_person = Database::get_course_table(TABLE_DROPBOX_PERSON); |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | $mailId = get_mail_id_base(); |
314 | 314 | |
315 | 315 | // Insert data in dropbox_post and dropbox_person table for each recipient |
316 | - foreach ($this->recipients as $rec) { |
|
316 | + foreach ($this->recipients as $rec) { |
|
317 | 317 | $file_id = (int)$this->id; |
318 | 318 | $user_id = (int)$rec['id']; |
319 | - $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
|
319 | + $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
|
320 | 320 | VALUES ($course_id, $file_id, $user_id, $session_id, '$now', 0)"; |
321 | - Database::query($sql); |
|
321 | + Database::query($sql); |
|
322 | 322 | // If work already exists no error is generated |
323 | 323 | |
324 | 324 | /** |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | - // Update item_property table for each recipient |
|
339 | - if (($ownerid = $this->uploader_id) > $mailId) { |
|
340 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
341 | - } |
|
342 | - if (($recipid = $rec["id"]) > $mailId) { |
|
343 | - $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
344 | - } |
|
338 | + // Update item_property table for each recipient |
|
339 | + if (($ownerid = $this->uploader_id) > $mailId) { |
|
340 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
341 | + } |
|
342 | + if (($recipid = $rec["id"]) > $mailId) { |
|
343 | + $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
344 | + } |
|
345 | 345 | api_item_property_update( |
346 | 346 | $_course, |
347 | 347 | TOOL_DROPBOX, |
@@ -351,90 +351,90 @@ discard block |
||
351 | 351 | null, |
352 | 352 | $recipid |
353 | 353 | ); |
354 | - } |
|
355 | - } |
|
356 | - |
|
357 | - /** |
|
358 | - * private function creating existing object by retreiving info from db |
|
359 | - * |
|
360 | - * @param unknown_type $id |
|
361 | - */ |
|
362 | - public function _createExistingSentWork($id) |
|
354 | + } |
|
355 | + } |
|
356 | + |
|
357 | + /** |
|
358 | + * private function creating existing object by retreiving info from db |
|
359 | + * |
|
360 | + * @param unknown_type $id |
|
361 | + */ |
|
362 | + public function _createExistingSentWork($id) |
|
363 | 363 | { |
364 | 364 | $id = intval($id); |
365 | 365 | |
366 | - $course_id = api_get_course_int_id(); |
|
366 | + $course_id = api_get_course_int_id(); |
|
367 | 367 | |
368 | - // Call constructor of Dropbox_Work object |
|
369 | - parent::__construct($id); |
|
368 | + // Call constructor of Dropbox_Work object |
|
369 | + parent::__construct($id); |
|
370 | 370 | |
371 | - // Fill in recipients array |
|
372 | - $this->recipients = array(); |
|
373 | - $sql = "SELECT dest_user_id, feedback_date, feedback |
|
371 | + // Fill in recipients array |
|
372 | + $this->recipients = array(); |
|
373 | + $sql = "SELECT dest_user_id, feedback_date, feedback |
|
374 | 374 | FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
375 | 375 | WHERE c_id = $course_id AND file_id = ".intval($id).""; |
376 | 376 | $result = Database::query($sql); |
377 | - while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
378 | - // Check for deleted users |
|
379 | - $dest_user_id = $res['dest_user_id']; |
|
380 | - $user_info = api_get_user_info($dest_user_id); |
|
381 | - //$this->category = $res['cat_id']; |
|
382 | - if (!$user_info) { |
|
383 | - $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
384 | - } else { |
|
385 | - $this->recipients[] = array( |
|
377 | + while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
378 | + // Check for deleted users |
|
379 | + $dest_user_id = $res['dest_user_id']; |
|
380 | + $user_info = api_get_user_info($dest_user_id); |
|
381 | + //$this->category = $res['cat_id']; |
|
382 | + if (!$user_info) { |
|
383 | + $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
384 | + } else { |
|
385 | + $this->recipients[] = array( |
|
386 | 386 | 'id' => $dest_user_id, |
387 | 387 | 'name' => $user_info['complete_name'], |
388 | 388 | 'user_id' => $dest_user_id, |
389 | - 'feedback_date' => $res['feedback_date'], |
|
389 | + 'feedback_date' => $res['feedback_date'], |
|
390 | 390 | 'feedback' => $res['feedback'] |
391 | 391 | ); |
392 | - } |
|
393 | - } |
|
394 | - } |
|
392 | + } |
|
393 | + } |
|
394 | + } |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | class Dropbox_Person |
398 | 398 | { |
399 | - // The receivedWork and the sentWork arrays are sorted. |
|
400 | - public $receivedWork; // an array of Dropbox_Work objects |
|
401 | - public $sentWork; // an array of Dropbox_SentWork objects |
|
402 | - |
|
403 | - public $userId = 0; |
|
404 | - public $isCourseAdmin = false; |
|
405 | - public $isCourseTutor = false; |
|
406 | - public $_orderBy = ''; // private property that determines by which field |
|
407 | - |
|
408 | - /** |
|
409 | - * Constructor for recreating the Dropbox_Person object |
|
410 | - * |
|
411 | - * @param int $userId |
|
412 | - * @param bool $isCourseAdmin |
|
413 | - * @param bool $isCourseTutor |
|
414 | - * @return Dropbox_Person |
|
415 | - */ |
|
416 | - public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
|
399 | + // The receivedWork and the sentWork arrays are sorted. |
|
400 | + public $receivedWork; // an array of Dropbox_Work objects |
|
401 | + public $sentWork; // an array of Dropbox_SentWork objects |
|
402 | + |
|
403 | + public $userId = 0; |
|
404 | + public $isCourseAdmin = false; |
|
405 | + public $isCourseTutor = false; |
|
406 | + public $_orderBy = ''; // private property that determines by which field |
|
407 | + |
|
408 | + /** |
|
409 | + * Constructor for recreating the Dropbox_Person object |
|
410 | + * |
|
411 | + * @param int $userId |
|
412 | + * @param bool $isCourseAdmin |
|
413 | + * @param bool $isCourseTutor |
|
414 | + * @return Dropbox_Person |
|
415 | + */ |
|
416 | + public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
|
417 | 417 | { |
418 | - $course_id = api_get_course_int_id(); |
|
418 | + $course_id = api_get_course_int_id(); |
|
419 | 419 | |
420 | - // Fill in properties |
|
420 | + // Fill in properties |
|
421 | 421 | $this->userId = $userId; |
422 | 422 | $this->isCourseAdmin = $isCourseAdmin; |
423 | 423 | $this->isCourseTutor = $isCourseTutor; |
424 | 424 | $this->receivedWork = array(); |
425 | 425 | $this->sentWork = array(); |
426 | 426 | |
427 | - // Note: perhaps include an ex coursemember check to delete old files |
|
427 | + // Note: perhaps include an ex coursemember check to delete old files |
|
428 | 428 | |
429 | - $session_id = api_get_session_id(); |
|
430 | - $condition_session = api_get_session_condition($session_id); |
|
429 | + $session_id = api_get_session_id(); |
|
430 | + $condition_session = api_get_session_condition($session_id); |
|
431 | 431 | |
432 | - $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
433 | - $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
434 | - $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
432 | + $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
433 | + $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
434 | + $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
435 | 435 | |
436 | 436 | // Find all entries where this person is the recipient |
437 | - $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
437 | + $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
438 | 438 | FROM $post_tbl r |
439 | 439 | INNER JOIN $person_tbl p |
440 | 440 | ON (r.file_id = p.file_id AND r.c_id = $course_id AND p.c_id = $course_id ) |
@@ -443,12 +443,12 @@ discard block |
||
443 | 443 | r.dest_user_id = ".intval($this->userId)." $condition_session "; |
444 | 444 | |
445 | 445 | $result = Database::query($sql); |
446 | - while ($res = Database::fetch_array($result)) { |
|
447 | - $temp = new Dropbox_Work($res['file_id']); |
|
448 | - $temp->category = $res['cat_id']; |
|
449 | - $this->receivedWork[] = $temp; |
|
450 | - } |
|
451 | - // Find all entries where this person is the sender/uploader |
|
446 | + while ($res = Database::fetch_array($result)) { |
|
447 | + $temp = new Dropbox_Work($res['file_id']); |
|
448 | + $temp->category = $res['cat_id']; |
|
449 | + $this->receivedWork[] = $temp; |
|
450 | + } |
|
451 | + // Find all entries where this person is the sender/uploader |
|
452 | 452 | $sql = "SELECT DISTINCT f.id |
453 | 453 | FROM $file_tbl f |
454 | 454 | INNER JOIN $person_tbl p |
@@ -459,160 +459,160 @@ discard block |
||
459 | 459 | $condition_session |
460 | 460 | "; |
461 | 461 | $result = Database::query($sql); |
462 | - while ($res = Database::fetch_array($result)) { |
|
463 | - $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
464 | - } |
|
465 | - } |
|
466 | - |
|
467 | - /** |
|
468 | - * Deletes all the received work of this person |
|
469 | - */ |
|
470 | - public function deleteAllReceivedWork() |
|
462 | + while ($res = Database::fetch_array($result)) { |
|
463 | + $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
464 | + } |
|
465 | + } |
|
466 | + |
|
467 | + /** |
|
468 | + * Deletes all the received work of this person |
|
469 | + */ |
|
470 | + public function deleteAllReceivedWork() |
|
471 | 471 | { |
472 | - $course_id = api_get_course_int_id(); |
|
473 | - // Delete entries in person table concerning received works |
|
474 | - foreach ($this->receivedWork as $w) { |
|
472 | + $course_id = api_get_course_int_id(); |
|
473 | + // Delete entries in person table concerning received works |
|
474 | + foreach ($this->receivedWork as $w) { |
|
475 | 475 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
476 | 476 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
477 | - Database::query($sql); |
|
478 | - } |
|
477 | + Database::query($sql); |
|
478 | + } |
|
479 | 479 | // Check for unused files |
480 | - removeUnusedFiles(); |
|
481 | - } |
|
482 | - |
|
483 | - /** |
|
484 | - * Deletes all the received categories and work of this person |
|
485 | - * @param integer $id |
|
486 | - */ |
|
487 | - public function deleteReceivedWorkFolder($id) |
|
480 | + removeUnusedFiles(); |
|
481 | + } |
|
482 | + |
|
483 | + /** |
|
484 | + * Deletes all the received categories and work of this person |
|
485 | + * @param integer $id |
|
486 | + */ |
|
487 | + public function deleteReceivedWorkFolder($id) |
|
488 | 488 | { |
489 | 489 | $course_id = api_get_course_int_id(); |
490 | 490 | |
491 | - $id = intval($id); |
|
492 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
491 | + $id = intval($id); |
|
492 | + $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
493 | 493 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
494 | - if (!Database::query($sql)) return false; |
|
495 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
494 | + if (!Database::query($sql)) return false; |
|
495 | + $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
496 | 496 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
497 | - if (!Database::query($sql)) return false; |
|
498 | - $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
497 | + if (!Database::query($sql)) return false; |
|
498 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
499 | 499 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
500 | - if (!Database::query($sql)) return false; |
|
501 | - return true; |
|
502 | - } |
|
503 | - |
|
504 | - /** |
|
505 | - * Deletes a received dropbox file of this person with id=$id |
|
506 | - * |
|
507 | - * @param integer $id |
|
508 | - */ |
|
509 | - public function deleteReceivedWork($id) |
|
500 | + if (!Database::query($sql)) return false; |
|
501 | + return true; |
|
502 | + } |
|
503 | + |
|
504 | + /** |
|
505 | + * Deletes a received dropbox file of this person with id=$id |
|
506 | + * |
|
507 | + * @param integer $id |
|
508 | + */ |
|
509 | + public function deleteReceivedWork($id) |
|
510 | 510 | { |
511 | - $course_id = api_get_course_int_id(); |
|
512 | - $id = intval($id); |
|
513 | - |
|
514 | - // index check |
|
515 | - $found = false; |
|
516 | - foreach ($this->receivedWork as $w) { |
|
517 | - if ($w->id == $id) { |
|
518 | - $found = true; |
|
519 | - break; |
|
520 | - } |
|
521 | - } |
|
522 | - |
|
523 | - if (!$found) { |
|
524 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
525 | - die(get_lang('GeneralError').' (code 216)'); |
|
526 | - } |
|
527 | - } |
|
528 | - // Delete entries in person table concerning received works |
|
511 | + $course_id = api_get_course_int_id(); |
|
512 | + $id = intval($id); |
|
513 | + |
|
514 | + // index check |
|
515 | + $found = false; |
|
516 | + foreach ($this->receivedWork as $w) { |
|
517 | + if ($w->id == $id) { |
|
518 | + $found = true; |
|
519 | + break; |
|
520 | + } |
|
521 | + } |
|
522 | + |
|
523 | + if (!$found) { |
|
524 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
525 | + die(get_lang('GeneralError').' (code 216)'); |
|
526 | + } |
|
527 | + } |
|
528 | + // Delete entries in person table concerning received works |
|
529 | 529 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
530 | 530 | WHERE c_id = $course_id AND user_id = '".$this->userId."' AND file_id ='".$id."'"; |
531 | - Database::query($sql); |
|
532 | - removeUnusedFiles(); // Check for unused files |
|
533 | - } |
|
534 | - |
|
535 | - /** |
|
536 | - * Deletes all the sent dropbox files of this person |
|
537 | - */ |
|
538 | - public function deleteAllSentWork() |
|
531 | + Database::query($sql); |
|
532 | + removeUnusedFiles(); // Check for unused files |
|
533 | + } |
|
534 | + |
|
535 | + /** |
|
536 | + * Deletes all the sent dropbox files of this person |
|
537 | + */ |
|
538 | + public function deleteAllSentWork() |
|
539 | 539 | { |
540 | - $course_id = api_get_course_int_id(); |
|
541 | - //delete entries in person table concerning sent works |
|
542 | - foreach ($this->sentWork as $w) { |
|
540 | + $course_id = api_get_course_int_id(); |
|
541 | + //delete entries in person table concerning sent works |
|
542 | + foreach ($this->sentWork as $w) { |
|
543 | 543 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
544 | 544 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
545 | - Database::query($sql); |
|
546 | - removeMoreIfMailing($w->id); |
|
547 | - } |
|
548 | - removeUnusedFiles(); // Check for unused files |
|
549 | - } |
|
550 | - |
|
551 | - /** |
|
552 | - * Deletes a sent dropbox file of this person with id=$id |
|
553 | - * |
|
554 | - * @param unknown_type $id |
|
555 | - */ |
|
556 | - public function deleteSentWork($id) |
|
545 | + Database::query($sql); |
|
546 | + removeMoreIfMailing($w->id); |
|
547 | + } |
|
548 | + removeUnusedFiles(); // Check for unused files |
|
549 | + } |
|
550 | + |
|
551 | + /** |
|
552 | + * Deletes a sent dropbox file of this person with id=$id |
|
553 | + * |
|
554 | + * @param unknown_type $id |
|
555 | + */ |
|
556 | + public function deleteSentWork($id) |
|
557 | 557 | { |
558 | - $course_id = api_get_course_int_id(); |
|
559 | - |
|
560 | - $id = intval($id); |
|
561 | - |
|
562 | - // index check |
|
563 | - $found = false; |
|
564 | - foreach ($this->sentWork as $w) { |
|
565 | - if ($w->id == $id) { |
|
566 | - $found = true; |
|
567 | - break; |
|
568 | - } |
|
569 | - } |
|
570 | - if (!$found) { |
|
571 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
572 | - die(get_lang('GeneralError').' (code 219)'); |
|
573 | - } |
|
574 | - } |
|
575 | - //$file_id = $this->sentWork[$index]->id; |
|
576 | - // Delete entries in person table concerning sent works |
|
558 | + $course_id = api_get_course_int_id(); |
|
559 | + |
|
560 | + $id = intval($id); |
|
561 | + |
|
562 | + // index check |
|
563 | + $found = false; |
|
564 | + foreach ($this->sentWork as $w) { |
|
565 | + if ($w->id == $id) { |
|
566 | + $found = true; |
|
567 | + break; |
|
568 | + } |
|
569 | + } |
|
570 | + if (!$found) { |
|
571 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
572 | + die(get_lang('GeneralError').' (code 219)'); |
|
573 | + } |
|
574 | + } |
|
575 | + //$file_id = $this->sentWork[$index]->id; |
|
576 | + // Delete entries in person table concerning sent works |
|
577 | 577 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
578 | 578 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'"; |
579 | - Database::query($sql); |
|
580 | - removeMoreIfMailing($id); |
|
581 | - removeUnusedFiles(); // Check for unused files |
|
582 | - } |
|
583 | - |
|
584 | - /** |
|
585 | - * Updates feedback for received work of this person with id=$id |
|
586 | - * |
|
587 | - * @param string $id |
|
588 | - * @param string $text |
|
589 | - */ |
|
590 | - public function updateFeedback($id, $text) |
|
579 | + Database::query($sql); |
|
580 | + removeMoreIfMailing($id); |
|
581 | + removeUnusedFiles(); // Check for unused files |
|
582 | + } |
|
583 | + |
|
584 | + /** |
|
585 | + * Updates feedback for received work of this person with id=$id |
|
586 | + * |
|
587 | + * @param string $id |
|
588 | + * @param string $text |
|
589 | + */ |
|
590 | + public function updateFeedback($id, $text) |
|
591 | 591 | { |
592 | - $course_id = api_get_course_int_id(); |
|
592 | + $course_id = api_get_course_int_id(); |
|
593 | 593 | $_course = api_get_course_info(); |
594 | 594 | $dropbox_cnf = getDropboxConf(); |
595 | 595 | |
596 | - $id = intval($id); |
|
596 | + $id = intval($id); |
|
597 | 597 | |
598 | - // index check |
|
599 | - $found = false; |
|
600 | - $wi = -1; |
|
601 | - foreach ($this->receivedWork as $w) { |
|
602 | - $wi++; |
|
603 | - if ($w->id == $id){ |
|
604 | - $found = true; |
|
605 | - break; |
|
606 | - } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
607 | - } |
|
598 | + // index check |
|
599 | + $found = false; |
|
600 | + $wi = -1; |
|
601 | + foreach ($this->receivedWork as $w) { |
|
602 | + $wi++; |
|
603 | + if ($w->id == $id){ |
|
604 | + $found = true; |
|
605 | + break; |
|
606 | + } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
607 | + } |
|
608 | 608 | |
609 | - if (!$found) { |
|
610 | - return false; |
|
611 | - } |
|
609 | + if (!$found) { |
|
610 | + return false; |
|
611 | + } |
|
612 | 612 | |
613 | - $feedback_date = api_get_utc_datetime(); |
|
614 | - $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
615 | - $this->receivedWork[$wi]->feedback = $text; |
|
613 | + $feedback_date = api_get_utc_datetime(); |
|
614 | + $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
615 | + $this->receivedWork[$wi]->feedback = $text; |
|
616 | 616 | |
617 | 617 | $params = [ |
618 | 618 | 'feedback_date' => $feedback_date, |
@@ -630,11 +630,11 @@ discard block |
||
630 | 630 | ] |
631 | 631 | ); |
632 | 632 | |
633 | - // Update item_property table |
|
633 | + // Update item_property table |
|
634 | 634 | $mailId = get_mail_id_base(); |
635 | - if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $mailId) { |
|
636 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
637 | - } |
|
635 | + if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $mailId) { |
|
636 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
637 | + } |
|
638 | 638 | |
639 | 639 | api_item_property_update( |
640 | 640 | $_course, |
@@ -646,33 +646,33 @@ discard block |
||
646 | 646 | $ownerid |
647 | 647 | ); |
648 | 648 | |
649 | - } |
|
649 | + } |
|
650 | 650 | |
651 | - /** |
|
652 | - * Filter the received work |
|
653 | - * @param string $type |
|
654 | - * @param string $value |
|
655 | - */ |
|
656 | - public function filter_received_work($type, $value) |
|
651 | + /** |
|
652 | + * Filter the received work |
|
653 | + * @param string $type |
|
654 | + * @param string $value |
|
655 | + */ |
|
656 | + public function filter_received_work($type, $value) |
|
657 | 657 | { |
658 | 658 | $dropbox_cnf = getDropboxConf(); |
659 | - $new_received_work = array(); |
|
659 | + $new_received_work = array(); |
|
660 | 660 | $mailId = get_mail_id_base(); |
661 | 661 | foreach ($this->receivedWork as $work) { |
662 | - switch ($type) { |
|
663 | - case 'uploader_id': |
|
664 | - if ($work->uploader_id == $value || |
|
665 | - ($work->uploader_id > $mailId && |
|
662 | + switch ($type) { |
|
663 | + case 'uploader_id': |
|
664 | + if ($work->uploader_id == $value || |
|
665 | + ($work->uploader_id > $mailId && |
|
666 | 666 | getUserOwningThisMailing($work->uploader_id) == $value) |
667 | 667 | ) { |
668 | - $new_received_work[] = $work; |
|
669 | - } |
|
670 | - break; |
|
671 | - default: |
|
672 | - $new_received_work[] = $work; |
|
668 | + $new_received_work[] = $work; |
|
669 | + } |
|
670 | + break; |
|
671 | + default: |
|
672 | + $new_received_work[] = $work; |
|
673 | 673 | break; |
674 | - } |
|
675 | - } |
|
676 | - $this->receivedWork = $new_received_work; |
|
677 | - } |
|
674 | + } |
|
675 | + } |
|
676 | + $this->receivedWork = $new_received_work; |
|
677 | + } |
|
678 | 678 | } |