Completed
Pull Request — 1.11.x (#1237)
by José
45:45
created
main/inc/lib/getid3/getid3.php 4 patches
Doc Comments   +22 added lines patch added patch discarded remove patch
@@ -456,6 +456,10 @@  discard block
 block discarded – undo
456 456
 
457 457
 
458 458
     // Add warning(s) to $this->warnings[]
459
+
460
+    /**
461
+     * @param string $message
462
+     */
459 463
     public function warning($message) {
460 464
 
461 465
         if (is_array($message)) {
@@ -482,6 +486,11 @@  discard block
 block discarded – undo
482 486
 
483 487
 
484 488
     // Convert string between charsets -- iconv() wrapper
489
+
490
+    /**
491
+     * @param string $out_charset
492
+     * @param string $string
493
+     */
485 494
     public function iconv($in_charset, $out_charset, $string, $drop01 = false) {
486 495
 
487 496
         if ($drop01 && ($string === "\x00" || $string === "\x01")) {
@@ -509,6 +518,9 @@  discard block
 block discarded – undo
509 518
 
510 519
 
511 520
 
521
+    /**
522
+     * @param string $name
523
+     */
512 524
     public function include_module($name) {
513 525
 
514 526
         if (!file_exists($this->include_path.'module.'.$name.'.php')) {
@@ -1342,6 +1354,10 @@  discard block
 block discarded – undo
1342 1354
 
1343 1355
 
1344 1356
     // Convert Big Endian byte string to int - max 32 bits
1357
+
1358
+    /**
1359
+     * @param string $byte_word
1360
+     */
1345 1361
     public static function BigEndian2Int($byte_word, $signed = false) {
1346 1362
 
1347 1363
         $int_value = 0;
@@ -1391,6 +1407,9 @@  discard block
 block discarded – undo
1391 1407
 
1392 1408
 
1393 1409
 
1410
+    /**
1411
+     * @param string $byte_word
1412
+     */
1394 1413
     public static function BigEndian2Float($byte_word) {
1395 1414
 
1396 1415
 		// ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
@@ -1478,6 +1497,9 @@  discard block
 block discarded – undo
1478 1497
 
1479 1498
 
1480 1499
 
1500
+	/**
1501
+	 * @param string $binary_numerator
1502
+	 */
1481 1503
 	public static function DecimalBinary2Float($binary_numerator) {
1482 1504
 		$numerator   = bindec($binary_numerator);
1483 1505
 		$denominator = bindec('1'.str_repeat('0', strlen($binary_numerator)));
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         $class = new $class_name($this);
301 301
 
302 302
         try {
303
-             $this->option_analyze and $class->Analyze();
303
+                $this->option_analyze and $class->Analyze();
304 304
             }
305 305
         catch (getid3_exception $e) {
306 306
             throw $e;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             // CalculateReplayGain() {
384 384
             if (@$this->info['replay_gain']) {
385 385
                 if (!@$this->info['replay_gain']['reference_volume']) {
386
-                     $this->info['replay_gain']['reference_volume'] = 89;
386
+                        $this->info['replay_gain']['reference_volume'] = 89;
387 387
                 }
388 388
                 if (isset($this->info['replay_gain']['track']['adjustment'])) {
389 389
                     $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment'];
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
             // ProcessAudioStreams() {
405 405
             if (@!$this->info['audio']['streams'] && (@$this->info['audio']['bitrate'] || @$this->info['audio']['channels'] || @$this->info['audio']['sample_rate'])) {
406
-                  foreach ($this->info['audio'] as $key => $value) {
406
+                    foreach ($this->info['audio'] as $key => $value) {
407 407
                     if ($key != 'streams') {
408 408
                         $this->info['audio']['streams'][0][$key] = $value;
409 409
                     }
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
                             'group'     => 'audio',
545 545
                             'module'    => 'ac3',
546 546
                             'mime_type' => 'audio/ac3',
547
-                          ),
547
+                            ),
548 548
 
549 549
                 // AAC  - audio       - Advanced Audio Coding (AAC) - ADIF format
550 550
                 'adif' => array (
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                             'module'    => 'aac_adif',
554 554
                             'mime_type' => 'application/octet-stream',
555 555
                             'fail_ape'  => 'WARNING',
556
-                          ),
556
+                            ),
557 557
 
558 558
 
559 559
                 // AAC  - audio       - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3)
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                             'module'    => 'aac_adts',
564 564
                             'mime_type' => 'application/octet-stream',
565 565
                             'fail_ape'  => 'WARNING',
566
-                          ),
566
+                            ),
567 567
 
568 568
 
569 569
                 // AU   - audio       - NeXT/Sun AUdio (AU)
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
                             'group'     => 'audio',
573 573
                             'module'    => 'au',
574 574
                             'mime_type' => 'audio/basic',
575
-                          ),
575
+                            ),
576 576
 
577 577
                 // AVR  - audio       - Audio Visual Research
578 578
                 'avr'  => array (
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
                             'group'     => 'audio',
581 581
                             'module'    => 'avr',
582 582
                             'mime_type' => 'application/octet-stream',
583
-                          ),
583
+                            ),
584 584
 
585 585
                 // BONK - audio       - Bonk v0.9+
586 586
                 'bonk' => array (
@@ -588,15 +588,15 @@  discard block
 block discarded – undo
588 588
                             'group'     => 'audio',
589 589
                             'module'    => 'bonk',
590 590
                             'mime_type' => 'audio/xmms-bonk',
591
-                          ),
591
+                            ),
592 592
 
593 593
                 // DTS  - audio       - Dolby Theatre System
594
-				'dts'  => array(
595
-							'pattern'   => '^\x7F\xFE\x80\x01',
596
-							'group'     => 'audio',
597
-							'module'    => 'dts',
598
-							'mime_type' => 'audio/dts',
599
-						),
594
+                'dts'  => array(
595
+                            'pattern'   => '^\x7F\xFE\x80\x01',
596
+                            'group'     => 'audio',
597
+                            'module'    => 'dts',
598
+                            'mime_type' => 'audio/dts',
599
+                        ),
600 600
 
601 601
                 // FLAC - audio       - Free Lossless Audio Codec
602 602
                 'flac' => array (
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                             'group'     => 'audio',
605 605
                             'module'    => 'xiph',
606 606
                             'mime_type' => 'audio/x-flac',
607
-                          ),
607
+                            ),
608 608
 
609 609
                 // LA   - audio       - Lossless Audio (LA)
610 610
                 'la'   => array (
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
                             'group'     => 'audio',
613 613
                             'module'    => 'la',
614 614
                             'mime_type' => 'application/octet-stream',
615
-                          ),
615
+                            ),
616 616
 
617 617
                 // LPAC - audio       - Lossless Predictive Audio Compression (LPAC)
618 618
                 'lpac' => array (
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
                             'group'     => 'audio',
621 621
                             'module'    => 'lpac',
622 622
                             'mime_type' => 'application/octet-stream',
623
-                          ),
623
+                            ),
624 624
 
625 625
                 // MIDI - audio       - MIDI (Musical Instrument Digital Interface)
626 626
                 'midi' => array (
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
                             'group'     => 'audio',
629 629
                             'module'    => 'midi',
630 630
                             'mime_type' => 'audio/midi',
631
-                          ),
631
+                            ),
632 632
 
633 633
                 // MAC  - audio       - Monkey's Audio Compressor
634 634
                 'mac'  => array (
@@ -636,31 +636,31 @@  discard block
 block discarded – undo
636 636
                             'group'     => 'audio',
637 637
                             'module'    => 'monkey',
638 638
                             'mime_type' => 'application/octet-stream',
639
-                          ),
639
+                            ),
640 640
 
641 641
                 // MOD  - audio       - MODule (assorted sub-formats)
642 642
                 'mod'  => array (
643 643
                             'pattern'   => '^.{1080}(M.K.|[5-9]CHN|[1-3][0-9]CH)',
644 644
                             'mime_type' => 'audio/mod',
645
-                          ),
645
+                            ),
646 646
 
647 647
                 // MOD  - audio       - MODule (Impulse Tracker)
648 648
                 'it'   => array (
649 649
                             'pattern'   => '^IMPM',
650 650
                             'mime_type' => 'audio/it',
651
-                          ),
651
+                            ),
652 652
 
653 653
                 // MOD  - audio       - MODule (eXtended Module, various sub-formats)
654 654
                 'xm'   => array (
655 655
                             'pattern'   => '^Extended Module',
656 656
                             'mime_type' => 'audio/xm',
657
-                          ),
657
+                            ),
658 658
 
659 659
                 // MOD  - audio       - MODule (ScreamTracker)
660 660
                 's3m'  => array (
661 661
                             'pattern'   => '^.{44}SCRM',
662 662
                             'mime_type' => 'audio/s3m',
663
-                          ),
663
+                            ),
664 664
 
665 665
                 // MPC  - audio       - Musepack / MPEGplus SV7+
666 666
                 'mpc'  => array (
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                             'group'     => 'audio',
669 669
                             'module'    => 'mpc',
670 670
                             'mime_type' => 'audio/x-musepack',
671
-                          ),
671
+                            ),
672 672
 
673 673
                 // MPC  - audio       - Musepack / MPEGplus SV4-6
674 674
                 'mpc_old' => array (
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                             'group'     => 'audio',
677 677
                             'module'    => 'mpc_old',
678 678
                             'mime_type' => 'application/octet-stream',
679
-                          ),
679
+                            ),
680 680
 
681 681
 
682 682
                 // MP3  - audio       - MPEG-audio Layer 3 (very similar to AAC-ADTS)
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
                             'group'     => 'audio',
686 686
                             'module'    => 'mp3',
687 687
                             'mime_type' => 'audio/mpeg',
688
-                          ),
688
+                            ),
689 689
 
690 690
                 // OFR  - audio       - OptimFROG
691 691
                 'ofr'  => array (
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
                             'group'     => 'audio',
694 694
                             'module'    => 'optimfrog',
695 695
                             'mime_type' => 'application/octet-stream',
696
-                          ),
696
+                            ),
697 697
 
698 698
                 // RKAU - audio       - RKive AUdio compressor
699 699
                 'rkau' => array (
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
                             'group'     => 'audio',
702 702
                             'module'    => 'rkau',
703 703
                             'mime_type' => 'application/octet-stream',
704
-                          ),
704
+                            ),
705 705
 
706 706
                 // SHN  - audio       - Shorten
707 707
                 'shn'  => array (
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
                             'mime_type' => 'audio/xmms-shn',
712 712
                             'fail_id3'  => 'ERROR',
713 713
                             'fail_ape'  => 'ERROR',
714
-                          ),
714
+                            ),
715 715
 
716 716
                 // TTA  - audio       - TTA Lossless Audio Compressor (http://tta.corecodec.org)
717 717
                 'tta'  => array (
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
                             'group'     => 'audio',
720 720
                             'module'    => 'tta',
721 721
                             'mime_type' => 'application/octet-stream',
722
-                          ),
722
+                            ),
723 723
 
724 724
                 // VOC  - audio       - Creative Voice (VOC)
725 725
                 'voc'  => array (
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
                             'group'     => 'audio',
728 728
                             'module'    => 'voc',
729 729
                             'mime_type' => 'audio/voc',
730
-                          ),
730
+                            ),
731 731
 
732 732
                 // VQF  - audio       - transform-domain weighted interleave Vector Quantization Format (VQF)
733 733
                 'vqf'  => array (
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
                             'group'     => 'audio',
736 736
                             'module'    => 'vqf',
737 737
                             'mime_type' => 'application/octet-stream',
738
-                          ),
738
+                            ),
739 739
 
740 740
                 // WV  - audio        - WavPack (v4.0+)
741 741
                 'vw'  => array(
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
                             'group'     => 'audio',
744 744
                             'module'    => 'wavpack',
745 745
                             'mime_type' => 'application/octet-stream',
746
-                          ),
746
+                            ),
747 747
 
748 748
 
749 749
                 // Audio-Video formats
@@ -754,13 +754,13 @@  discard block
 block discarded – undo
754 754
                             'group'     => 'audio-video',
755 755
                             'module'    => 'asf',
756 756
                             'mime_type' => 'video/x-ms-asf',
757
-                          ),
757
+                            ),
758 758
 
759 759
                 // BINK  - audio/video - Bink / Smacker
760 760
                 'bink' => array(
761 761
                             'pattern'   => '^(BIK|SMK)',
762 762
                             'mime_type' => 'application/octet-stream',
763
-                          ),
763
+                            ),
764 764
 
765 765
                 // FLV  - audio/video - FLash Video
766 766
                 'flv' => array(
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
                             'group'     => 'audio-video',
769 769
                             'module'    => 'flv',
770 770
                             'mime_type' => 'video/x-flv',
771
-                          ),
771
+                            ),
772 772
 
773 773
                 // MKAV - audio/video - Mastroka
774 774
                 'matroska' => array (
775 775
                             'pattern'   => '^\x1A\x45\xDF\xA3',
776 776
                             'mime_type' => 'application/octet-stream',
777
-                          ),
777
+                            ),
778 778
 
779 779
                 // MPEG - audio/video - MPEG (Moving Pictures Experts Group)
780 780
                 'mpeg' => array (
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
                             'group'     => 'audio-video',
783 783
                             'module'    => 'mpeg',
784 784
                             'mime_type' => 'video/mpeg',
785
-                          ),
785
+                            ),
786 786
 
787 787
                 // NSV  - audio/video - Nullsoft Streaming Video (NSV)
788 788
                 'nsv'  => array (
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
                             'group'     => 'audio-video',
791 791
                             'module'    => 'nsv',
792 792
                             'mime_type' => 'application/octet-stream',
793
-                          ),
793
+                            ),
794 794
 
795 795
                 // Ogg  - audio/video - Ogg (Ogg Vorbis, OggFLAC, Speex, Ogg Theora(*), Ogg Tarkin(*))
796 796
                 'ogg'  => array (
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                             'mime_type' => 'application/ogg',
801 801
                             'fail_id3'  => 'WARNING',
802 802
                             'fail_ape'  => 'WARNING',
803
-                          ),
803
+                            ),
804 804
 
805 805
                 // QT   - audio/video - Quicktime
806 806
                 'quicktime' => array (
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
                             'group'     => 'audio-video',
809 809
                             'module'    => 'quicktime',
810 810
                             'mime_type' => 'video/quicktime',
811
-                          ),
811
+                            ),
812 812
 
813 813
                 // RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF)
814 814
                 'riff' => array (
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
                             'module'    => 'riff',
818 818
                             'mime_type' => 'audio/x-wave',
819 819
                             'fail_ape'  => 'WARNING',
820
-                          ),
820
+                            ),
821 821
 
822 822
                 // Real - audio/video - RealAudio, RealVideo
823 823
                 'real' => array (
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
                             'group'     => 'audio-video',
826 826
                             'module'    => 'real',
827 827
                             'mime_type' => 'audio/x-realaudio',
828
-                          ),
828
+                            ),
829 829
 
830 830
                 // SWF - audio/video - ShockWave Flash
831 831
                 'swf' => array (
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                             'group'     => 'audio-video',
834 834
                             'module'    => 'swf',
835 835
                             'mime_type' => 'application/x-shockwave-flash',
836
-                          ),
836
+                            ),
837 837
 
838 838
 
839 839
                 // Still-Image formats
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
                             'mime_type' => 'image/bmp',
847 847
                             'fail_id3'  => 'ERROR',
848 848
                             'fail_ape'  => 'ERROR',
849
-                          ),
849
+                            ),
850 850
 
851 851
                 // GIF  - still image - Graphics Interchange Format
852 852
                 'gif'  => array (
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
                             'mime_type' => 'image/gif',
857 857
                             'fail_id3'  => 'ERROR',
858 858
                             'fail_ape'  => 'ERROR',
859
-                          ),
859
+                            ),
860 860
 
861 861
                 // JPEG - still image - Joint Photographic Experts Group (JPEG)
862 862
                 'jpeg'  => array (
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
                             'mime_type' => 'image/jpeg',
867 867
                             'fail_id3'  => 'ERROR',
868 868
                             'fail_ape'  => 'ERROR',
869
-                          ),
869
+                            ),
870 870
 
871 871
                 // PCD  - still image - Kodak Photo CD
872 872
                 'pcd'  => array (
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
                             'mime_type' => 'image/x-photo-cd',
877 877
                             'fail_id3'  => 'ERROR',
878 878
                             'fail_ape'  => 'ERROR',
879
-                          ),
879
+                            ),
880 880
 
881 881
 
882 882
                 // PNG  - still image - Portable Network Graphics (PNG)
@@ -887,16 +887,16 @@  discard block
 block discarded – undo
887 887
                             'mime_type' => 'image/png',
888 888
                             'fail_id3'  => 'ERROR',
889 889
                             'fail_ape'  => 'ERROR',
890
-                          ),
890
+                            ),
891 891
 
892 892
 
893 893
                 // SVG  - still image - Scalable Vector Graphics (SVG)
894
-				'svg'  => array(
895
-							'pattern'   => '<!DOCTYPE svg PUBLIC ',
896
-							'mime_type' => 'image/svg+xml',
897
-							'fail_id3'  => 'ERROR',
898
-							'fail_ape'  => 'ERROR',
899
-						),
894
+                'svg'  => array(
895
+                            'pattern'   => '<!DOCTYPE svg PUBLIC ',
896
+                            'mime_type' => 'image/svg+xml',
897
+                            'fail_id3'  => 'ERROR',
898
+                            'fail_ape'  => 'ERROR',
899
+                        ),
900 900
 
901 901
 
902 902
                 // TIFF  - still image - Tagged Information File Format (TIFF)
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                             'mime_type' => 'image/tiff',
908 908
                             'fail_id3'  => 'ERROR',
909 909
                             'fail_ape'  => 'ERROR',
910
-                          ),
910
+                            ),
911 911
 
912 912
 
913 913
                 // Data formats
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
                             'mime_type' => 'application/octet-stream',
918 918
                             'fail_id3'  => 'ERROR',
919 919
                             'fail_ape'  => 'ERROR',
920
-                          ),
920
+                            ),
921 921
 
922 922
                 // ISO  - data        - International Standards Organization (ISO) CD-ROM Image
923 923
                 'iso'  => array (
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
                             'mime_type' => 'application/octet-stream',
928 928
                             'fail_id3'  => 'ERROR',
929 929
                             'fail_ape'  => 'ERROR',
930
-                          ),
930
+                            ),
931 931
 
932 932
                 // RAR  - data        - RAR compressed data
933 933
                 'rar'  => array(
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                             'mime_type' => 'application/octet-stream',
936 936
                             'fail_id3'  => 'ERROR',
937 937
                             'fail_ape'  => 'ERROR',
938
-                          ),
938
+                            ),
939 939
 
940 940
                 // SZIP - audio       - SZIP compressed data
941 941
                 'szip' => array (
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
                             'mime_type' => 'application/octet-stream',
946 946
                             'fail_id3'  => 'ERROR',
947 947
                             'fail_ape'  => 'ERROR',
948
-                          ),
948
+                            ),
949 949
 
950 950
                 // TAR  - data        - TAR compressed data
951 951
                 'tar'  => array(
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                             'mime_type' => 'application/x-tar',
956 956
                             'fail_id3'  => 'ERROR',
957 957
                             'fail_ape'  => 'ERROR',
958
-                          ),
958
+                            ),
959 959
 
960 960
                 // GZIP  - data        - GZIP compressed data
961 961
                 'gz'  => array(
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
                             'mime_type' => 'application/x-gzip',
966 966
                             'fail_id3'  => 'ERROR',
967 967
                             'fail_ape'  => 'ERROR',
968
-                          ),
968
+                            ),
969 969
 
970 970
 
971 971
                 // ZIP  - data        - ZIP compressed data
@@ -976,33 +976,33 @@  discard block
 block discarded – undo
976 976
                             'mime_type' => 'application/zip',
977 977
                             'fail_id3'  => 'ERROR',
978 978
                             'fail_ape'  => 'ERROR',
979
-                          ),
979
+                            ),
980 980
 
981 981
 
982 982
                 // PAR2 - data        - Parity Volume Set Specification 2.0
983 983
                 'par2' => array (
984
-                			'pattern'   => '^PAR2\x00PKT',
985
-							'mime_type' => 'application/octet-stream',
986
-							'fail_id3'  => 'ERROR',
987
-							'fail_ape'  => 'ERROR',
988
-						),
984
+                            'pattern'   => '^PAR2\x00PKT',
985
+                            'mime_type' => 'application/octet-stream',
986
+                            'fail_id3'  => 'ERROR',
987
+                            'fail_ape'  => 'ERROR',
988
+                        ),
989 989
 
990 990
 
991
-                 // PDF  - data       - Portable Document Format
992
-                 'pdf' => array(
991
+                    // PDF  - data       - Portable Document Format
992
+                    'pdf' => array(
993 993
                             'pattern'   => '^\x25PDF',
994 994
                             'mime_type' => 'application/pdf',
995 995
                             'fail_id3'  => 'ERROR',
996 996
                             'fail_ape'  => 'ERROR',
997
-                           ),
997
+                            ),
998 998
 
999
-                 // DOC  - data       - Microsoft Word
1000
-                 'msoffice' => array(
999
+                    // DOC  - data       - Microsoft Word
1000
+                    'msoffice' => array(
1001 1001
                             'pattern'   => '^\xD0\xCF\x11\xE0', // D0CF11E == DOCFILE == Microsoft Office Document
1002 1002
                             'mime_type' => 'application/octet-stream',
1003 1003
                             'fail_id3'  => 'ERROR',
1004 1004
                             'fail_ape'  => 'ERROR',
1005
-                          ),
1005
+                            ),
1006 1006
             );
1007 1007
 
1008 1008
         return $format_info;
@@ -1393,99 +1393,99 @@  discard block
 block discarded – undo
1393 1393
 
1394 1394
     public static function BigEndian2Float($byte_word) {
1395 1395
 
1396
-		// ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
1397
-		// http://www.psc.edu/general/software/packages/ieee/ieee.html
1398
-		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
1396
+        // ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
1397
+        // http://www.psc.edu/general/software/packages/ieee/ieee.html
1398
+        // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
1399 1399
 
1400
-		$bit_word = getid3_lib::BigEndian2Bin($byte_word);
1401
-		if (!$bit_word) {
1400
+        $bit_word = getid3_lib::BigEndian2Bin($byte_word);
1401
+        if (!$bit_word) {
1402 1402
             return 0;
1403 1403
         }
1404
-		$sign_bit = $bit_word{0};
1405
-
1406
-		switch (strlen($byte_word) * 8) {
1407
-			case 32:
1408
-				$exponent_bits = 8;
1409
-				$fraction_bits = 23;
1410
-				break;
1411
-
1412
-			case 64:
1413
-				$exponent_bits = 11;
1414
-				$fraction_bits = 52;
1415
-				break;
1416
-
1417
-			case 80:
1418
-				// 80-bit Apple SANE format
1419
-				// http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
1420
-				$exponent_string = substr($bit_word, 1, 15);
1421
-				$is_normalized = intval($bit_word{16});
1422
-				$fraction_string = substr($bit_word, 17, 63);
1423
-				$exponent = pow(2, getid3_lib::Bin2Dec($exponent_string) - 16383);
1424
-				$fraction = $is_normalized + getid3_lib::DecimalBinary2Float($fraction_string);
1425
-				$float_value = $exponent * $fraction;
1426
-				if ($sign_bit == '1') {
1427
-					$float_value *= -1;
1428
-				}
1429
-				return $float_value;
1430
-				break;
1431
-
1432
-			default:
1433
-				return false;
1434
-				break;
1435
-		}
1436
-		$exponent_string = substr($bit_word, 1, $exponent_bits);
1437
-		$fraction_string = substr($bit_word, $exponent_bits + 1, $fraction_bits);
1438
-		$exponent = bindec($exponent_string);
1439
-		$fraction = bindec($fraction_string);
1440
-
1441
-		if (($exponent == (pow(2, $exponent_bits) - 1)) && ($fraction != 0)) {
1442
-			// Not a Number
1443
-			$float_value = false;
1444
-		} elseif (($exponent == (pow(2, $exponent_bits) - 1)) && ($fraction == 0)) {
1445
-			if ($sign_bit == '1') {
1446
-				$float_value = '-infinity';
1447
-			} else {
1448
-				$float_value = '+infinity';
1449
-			}
1450
-		} elseif (($exponent == 0) && ($fraction == 0)) {
1451
-			if ($sign_bit == '1') {
1452
-				$float_value = -0;
1453
-			} else {
1454
-				$float_value = 0;
1455
-			}
1456
-			$float_value = ($sign_bit ? 0 : -0);
1457
-		} elseif (($exponent == 0) && ($fraction != 0)) {
1458
-			// These are 'unnormalized' values
1459
-			$float_value = pow(2, (-1 * (pow(2, $exponent_bits - 1) - 2))) * getid3_lib::DecimalBinary2Float($fraction_string);
1460
-			if ($sign_bit == '1') {
1461
-				$float_value *= -1;
1462
-			}
1463
-		} elseif ($exponent != 0) {
1464
-			$float_value = pow(2, ($exponent - (pow(2, $exponent_bits - 1) - 1))) * (1 + getid3_lib::DecimalBinary2Float($fraction_string));
1465
-			if ($sign_bit == '1') {
1466
-				$float_value *= -1;
1467
-			}
1468
-		}
1469
-		return (float) $float_value;
1470
-	}
1471
-
1472
-
1473
-
1474
-	public static function LittleEndian2Float($byte_word) {
1475
-
1476
-		return getid3_lib::BigEndian2Float(strrev($byte_word));
1477
-	}
1478
-
1479
-
1480
-
1481
-	public static function DecimalBinary2Float($binary_numerator) {
1482
-		$numerator   = bindec($binary_numerator);
1483
-		$denominator = bindec('1'.str_repeat('0', strlen($binary_numerator)));
1484
-		return ($numerator / $denominator);
1485
-	}
1486
-
1487
-
1488
-	public static function PrintHexBytes($string, $hex=true, $spaces=true, $html_safe=true) {
1404
+        $sign_bit = $bit_word{0};
1405
+
1406
+        switch (strlen($byte_word) * 8) {
1407
+            case 32:
1408
+                $exponent_bits = 8;
1409
+                $fraction_bits = 23;
1410
+                break;
1411
+
1412
+            case 64:
1413
+                $exponent_bits = 11;
1414
+                $fraction_bits = 52;
1415
+                break;
1416
+
1417
+            case 80:
1418
+                // 80-bit Apple SANE format
1419
+                // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
1420
+                $exponent_string = substr($bit_word, 1, 15);
1421
+                $is_normalized = intval($bit_word{16});
1422
+                $fraction_string = substr($bit_word, 17, 63);
1423
+                $exponent = pow(2, getid3_lib::Bin2Dec($exponent_string) - 16383);
1424
+                $fraction = $is_normalized + getid3_lib::DecimalBinary2Float($fraction_string);
1425
+                $float_value = $exponent * $fraction;
1426
+                if ($sign_bit == '1') {
1427
+                    $float_value *= -1;
1428
+                }
1429
+                return $float_value;
1430
+                break;
1431
+
1432
+            default:
1433
+                return false;
1434
+                break;
1435
+        }
1436
+        $exponent_string = substr($bit_word, 1, $exponent_bits);
1437
+        $fraction_string = substr($bit_word, $exponent_bits + 1, $fraction_bits);
1438
+        $exponent = bindec($exponent_string);
1439
+        $fraction = bindec($fraction_string);
1440
+
1441
+        if (($exponent == (pow(2, $exponent_bits) - 1)) && ($fraction != 0)) {
1442
+            // Not a Number
1443
+            $float_value = false;
1444
+        } elseif (($exponent == (pow(2, $exponent_bits) - 1)) && ($fraction == 0)) {
1445
+            if ($sign_bit == '1') {
1446
+                $float_value = '-infinity';
1447
+            } else {
1448
+                $float_value = '+infinity';
1449
+            }
1450
+        } elseif (($exponent == 0) && ($fraction == 0)) {
1451
+            if ($sign_bit == '1') {
1452
+                $float_value = -0;
1453
+            } else {
1454
+                $float_value = 0;
1455
+            }
1456
+            $float_value = ($sign_bit ? 0 : -0);
1457
+        } elseif (($exponent == 0) && ($fraction != 0)) {
1458
+            // These are 'unnormalized' values
1459
+            $float_value = pow(2, (-1 * (pow(2, $exponent_bits - 1) - 2))) * getid3_lib::DecimalBinary2Float($fraction_string);
1460
+            if ($sign_bit == '1') {
1461
+                $float_value *= -1;
1462
+            }
1463
+        } elseif ($exponent != 0) {
1464
+            $float_value = pow(2, ($exponent - (pow(2, $exponent_bits - 1) - 1))) * (1 + getid3_lib::DecimalBinary2Float($fraction_string));
1465
+            if ($sign_bit == '1') {
1466
+                $float_value *= -1;
1467
+            }
1468
+        }
1469
+        return (float) $float_value;
1470
+    }
1471
+
1472
+
1473
+
1474
+    public static function LittleEndian2Float($byte_word) {
1475
+
1476
+        return getid3_lib::BigEndian2Float(strrev($byte_word));
1477
+    }
1478
+
1479
+
1480
+
1481
+    public static function DecimalBinary2Float($binary_numerator) {
1482
+        $numerator   = bindec($binary_numerator);
1483
+        $denominator = bindec('1'.str_repeat('0', strlen($binary_numerator)));
1484
+        return ($numerator / $denominator);
1485
+    }
1486
+
1487
+
1488
+    public static function PrintHexBytes($string, $hex=true, $spaces=true, $html_safe=true) {
1489 1489
 
1490 1490
         $return_string = '';
1491 1491
         for ($i = 0; $i < strlen($string); $i++) {
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -27,42 +27,42 @@  discard block
 block discarded – undo
27 27
     //// Settings Section - do NOT modify this file - change setting after newing getid3!
28 28
 
29 29
     // Encoding
30
-    public $encoding                 = 'ISO-8859-1';      // CASE SENSITIVE! - i.e. (must be supported by iconv() - see http://www.gnu.org/software/libiconv/).  Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE.
31
-    public $encoding_id3v1           = 'ISO-8859-1';      // Override SPECIFICATION encoding for broken ID3v1 tags caused by bad tag programs. Examples: 'EUC-CN' for "Chinese MP3s" and 'CP1251' for "Cyrillic".
32
-    public $encoding_id3v2           = 'ISO-8859-1';      // Override ISO-8859-1 encoding for broken ID3v2 tags caused by BRAINDEAD tag programs that writes system codepage as 'ISO-8859-1' instead of UTF-8.
30
+    public $encoding                 = 'ISO-8859-1'; // CASE SENSITIVE! - i.e. (must be supported by iconv() - see http://www.gnu.org/software/libiconv/).  Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE.
31
+    public $encoding_id3v1           = 'ISO-8859-1'; // Override SPECIFICATION encoding for broken ID3v1 tags caused by bad tag programs. Examples: 'EUC-CN' for "Chinese MP3s" and 'CP1251' for "Cyrillic".
32
+    public $encoding_id3v2           = 'ISO-8859-1'; // Override ISO-8859-1 encoding for broken ID3v2 tags caused by BRAINDEAD tag programs that writes system codepage as 'ISO-8859-1' instead of UTF-8.
33 33
 
34 34
     // Tags - disable for speed
35
-    public $option_tag_id3v1         = false;              // Read and process ID3v1 tags.
36
-    public $option_tag_id3v2         = false;              // Read and process ID3v2 tags.
37
-    public $option_tag_lyrics3       = false;              // Read and process Lyrics3 tags.
38
-    public $option_tag_apetag        = false;              // Read and process APE tags.
35
+    public $option_tag_id3v1         = false; // Read and process ID3v1 tags.
36
+    public $option_tag_id3v2         = false; // Read and process ID3v2 tags.
37
+    public $option_tag_lyrics3       = false; // Read and process Lyrics3 tags.
38
+    public $option_tag_apetag        = false; // Read and process APE tags.
39 39
 
40 40
     // Misc calucations - disable for speed
41
-    public $option_analyze           = true;              // Analyze file - disable if you only need to detect file format.
42
-    public $option_accurate_results  = true;              // Disable to greatly speed up parsing of some file formats at the cost of accuracy.
43
-    public $option_tags_process      = true;              // Copy tags to root key 'tags' and 'comments' and encode to $this->encoding.
44
-    public $option_tags_images       = false;             // Scan tags for binary image data - ID3v2 and vorbiscomments only.
45
-    public $option_extra_info        = true;              // Calculate/return additional info such as bitrate, channelmode etc.
46
-    public $option_max_2gb_check     = false;             // Check whether file is larger than 2 Gb and thus not supported by PHP.
41
+    public $option_analyze           = true; // Analyze file - disable if you only need to detect file format.
42
+    public $option_accurate_results  = true; // Disable to greatly speed up parsing of some file formats at the cost of accuracy.
43
+    public $option_tags_process      = true; // Copy tags to root key 'tags' and 'comments' and encode to $this->encoding.
44
+    public $option_tags_images       = false; // Scan tags for binary image data - ID3v2 and vorbiscomments only.
45
+    public $option_extra_info        = true; // Calculate/return additional info such as bitrate, channelmode etc.
46
+    public $option_max_2gb_check     = false; // Check whether file is larger than 2 Gb and thus not supported by PHP.
47 47
 
48 48
     // Misc data hashes - slow - require hash module
49
-    public $option_md5_data          = false;             // Get MD5 sum of data part - slow.
50
-    public $option_md5_data_source   = false;             // Use MD5 of source file if available - only FLAC, MAC, OptimFROG and Wavpack4.
51
-    public $option_sha1_data         = false;             // Get SHA1 sum of data part - slow.
49
+    public $option_md5_data          = false; // Get MD5 sum of data part - slow.
50
+    public $option_md5_data_source   = false; // Use MD5 of source file if available - only FLAC, MAC, OptimFROG and Wavpack4.
51
+    public $option_sha1_data         = false; // Get SHA1 sum of data part - slow.
52 52
 
53 53
     // Public variables
54
-    public $filename;                                     // Filename of file being analysed.
55
-    public $fp;                                           // Filepointer to file being analysed.
56
-    public $info;                                         // Result array.
54
+    public $filename; // Filename of file being analysed.
55
+    public $fp; // Filepointer to file being analysed.
56
+    public $info; // Result array.
57 57
 
58 58
     // Protected variables
59
-    protected $include_path;                              // getid3 include path.
60
-    protected $warnings = array ();
59
+    protected $include_path; // getid3 include path.
60
+    protected $warnings = array();
61 61
     protected $iconv_present;
62 62
 
63 63
     // Class constants
64 64
     const VERSION           = '2.0.0b4';
65
-    const FREAD_BUFFER_SIZE = 16384;                      // Read buffer size in bytes.
65
+    const FREAD_BUFFER_SIZE = 16384; // Read buffer size in bytes.
66 66
     const ICONV_TEST_STRING = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~�������������������������������� �����������������������������������������������������������������������������������������������';
67 67
 
68 68
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         }
88 88
 
89 89
         // Get include_path
90
-        $this->include_path = $include_path = dirname(__FILE__) . '/';
90
+        $this->include_path = $include_path = dirname(__FILE__).'/';
91 91
 
92 92
         // Check for presence of iconv() and make sure it works (simpel test only).
93 93
         if (function_exists('iconv') && @iconv('UTF-16LE', 'ISO-8859-1', @iconv('ISO-8859-1', 'UTF-16LE', getid3::ICONV_TEST_STRING)) == getid3::ICONV_TEST_STRING) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 
125 125
         // Check safe_mode off
126
-        if ((bool)ini_get('safe_mode')) {
126
+        if ((bool) ini_get('safe_mode')) {
127 127
             $this->warning('Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbis/flac tag writing disabled.');
128 128
         }
129 129
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 
138 138
         // Init and save values
139 139
         $this->filename = $filename;
140
-        $this->warnings = array ();
140
+        $this->warnings = array();
141 141
 
142 142
         // Init result array and set parameters
143
-        $this->info = array ();
143
+        $this->info = array();
144 144
         $this->info['GETID3_VERSION'] = getid3::VERSION;
145 145
 
146 146
         // Remote files not supported
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
             fseek($this->fp, 0, SEEK_SET);
181 181
             $header = fread($this->fp, 10);
182
-            if (substr($header, 0, 3) == 'ID3'  &&  strlen($header) == 10) {
182
+            if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) {
183 183
                 $this->info['id3v2']['header']        = true;
184 184
                 $this->info['id3v2']['majorversion']  = ord($header{3});
185 185
                 $this->info['id3v2']['minorversion']  = ord($header{4});
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 
190 190
 
191 191
         // Handle tags
192
-        foreach (array ("id3v2", "id3v1", "apetag", "lyrics3") as $tag_name) {
192
+        foreach (array("id3v2", "id3v1", "apetag", "lyrics3") as $tag_name) {
193 193
 
194
-            $option_tag = 'option_tag_' . $tag_name;
194
+            $option_tag = 'option_tag_'.$tag_name;
195 195
             if ($this->$option_tag) {
196 196
                 $this->include_module('tag.'.$tag_name);
197 197
                 try {
198
-                    $tag_class = 'getid3_' . $tag_name;
198
+                    $tag_class = 'getid3_'.$tag_name;
199 199
                     $tag = new $tag_class($this);
200 200
                     $tag->Analyze();
201 201
                 }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                     return $this->info;
232 232
                 }
233 233
 
234
-                $determined_format = $info;  // copy $info deleted by foreach()
234
+                $determined_format = $info; // copy $info deleted by foreach()
235 235
                 continue;
236 236
             }
237 237
         }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
             // Set playtime string
343 343
             if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
344
-                $this->info['playtime_string'] =  floor(round($this->info['playtime_seconds']) / 60) . ':' . str_pad(floor(round($this->info['playtime_seconds']) % 60), 2, 0, STR_PAD_LEFT);;
344
+                $this->info['playtime_string'] = floor(round($this->info['playtime_seconds']) / 60).':'.str_pad(floor(round($this->info['playtime_seconds']) % 60), 2, 0, STR_PAD_LEFT); ;
345 345
             }
346 346
 
347 347
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             if (@$this->info['video'] && @$this->info['video']['resolution_x'] && @$this->info['video']['resolution_y'] && @$this->info['video']['bits_per_sample']) {
350 350
 
351 351
                 // From static image formats
352
-                if (in_array($this->info['video']['dataformat'], array ('bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff'))) {
352
+                if (in_array($this->info['video']['dataformat'], array('bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff'))) {
353 353
                     $frame_rate         = 1;
354 354
                     $bitrate_compressed = $this->info['filesize'] * 8;
355 355
                 }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     //  Clear all warnings when cloning
472 472
     public function __clone() {
473 473
 
474
-        $this->warnings = array ();
474
+        $this->warnings = array();
475 475
 
476 476
         // Copy info array, otherwise it will be a reference.
477 477
         $temp = $this->info;
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             return $result;
504 504
         }
505 505
 
506
-        $this->warning('iconv() was unable to convert the string: "' . $string . '" from ' . $in_charset . ' to ' . $out_charset);
506
+        $this->warning('iconv() was unable to convert the string: "'.$string.'" from '.$in_charset.' to '.$out_charset);
507 507
         return $string;
508 508
     }
509 509
 
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
     // Return array containing information about all supported formats
535 535
     public static function GetFileFormatArray() {
536 536
 
537
-        static $format_info = array (
537
+        static $format_info = array(
538 538
 
539 539
                 // Audio formats
540 540
 
541 541
                 // AC-3   - audio      - Dolby AC-3 / Dolby Digital
542
-                'ac3'  => array (
542
+                'ac3'  => array(
543 543
                             'pattern'   => '^\x0B\x77',
544 544
                             'group'     => 'audio',
545 545
                             'module'    => 'ac3',
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                           ),
548 548
 
549 549
                 // AAC  - audio       - Advanced Audio Coding (AAC) - ADIF format
550
-                'adif' => array (
550
+                'adif' => array(
551 551
                             'pattern'   => '^ADIF',
552 552
                             'group'     => 'audio',
553 553
                             'module'    => 'aac_adif',
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 
559 559
                 // AAC  - audio       - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3)
560
-                'adts' => array (
560
+                'adts' => array(
561 561
                             'pattern'   => '^\xFF[\xF0-\xF1\xF8-\xF9]',
562 562
                             'group'     => 'audio',
563 563
                             'module'    => 'aac_adts',
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 
568 568
 
569 569
                 // AU   - audio       - NeXT/Sun AUdio (AU)
570
-                'au'   => array (
570
+                'au'   => array(
571 571
                             'pattern'   => '^\.snd',
572 572
                             'group'     => 'audio',
573 573
                             'module'    => 'au',
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
                           ),
576 576
 
577 577
                 // AVR  - audio       - Audio Visual Research
578
-                'avr'  => array (
578
+                'avr'  => array(
579 579
                             'pattern'   => '^2BIT',
580 580
                             'group'     => 'audio',
581 581
                             'module'    => 'avr',
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                           ),
584 584
 
585 585
                 // BONK - audio       - Bonk v0.9+
586
-                'bonk' => array (
586
+                'bonk' => array(
587 587
                             'pattern'   => '^\x00(BONK|INFO|META| ID3)',
588 588
                             'group'     => 'audio',
589 589
                             'module'    => 'bonk',
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 						),
600 600
 
601 601
                 // FLAC - audio       - Free Lossless Audio Codec
602
-                'flac' => array (
602
+                'flac' => array(
603 603
                             'pattern'   => '^fLaC',
604 604
                             'group'     => 'audio',
605 605
                             'module'    => 'xiph',
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                           ),
608 608
 
609 609
                 // LA   - audio       - Lossless Audio (LA)
610
-                'la'   => array (
610
+                'la'   => array(
611 611
                             'pattern'   => '^LA0[2-4]',
612 612
                             'group'     => 'audio',
613 613
                             'module'    => 'la',
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
                           ),
616 616
 
617 617
                 // LPAC - audio       - Lossless Predictive Audio Compression (LPAC)
618
-                'lpac' => array (
618
+                'lpac' => array(
619 619
                             'pattern'   => '^LPAC',
620 620
                             'group'     => 'audio',
621 621
                             'module'    => 'lpac',
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                           ),
624 624
 
625 625
                 // MIDI - audio       - MIDI (Musical Instrument Digital Interface)
626
-                'midi' => array (
626
+                'midi' => array(
627 627
                             'pattern'   => '^MThd',
628 628
                             'group'     => 'audio',
629 629
                             'module'    => 'midi',
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                           ),
632 632
 
633 633
                 // MAC  - audio       - Monkey's Audio Compressor
634
-                'mac'  => array (
634
+                'mac'  => array(
635 635
                             'pattern'   => '^MAC ',
636 636
                             'group'     => 'audio',
637 637
                             'module'    => 'monkey',
@@ -639,31 +639,31 @@  discard block
 block discarded – undo
639 639
                           ),
640 640
 
641 641
                 // MOD  - audio       - MODule (assorted sub-formats)
642
-                'mod'  => array (
642
+                'mod'  => array(
643 643
                             'pattern'   => '^.{1080}(M.K.|[5-9]CHN|[1-3][0-9]CH)',
644 644
                             'mime_type' => 'audio/mod',
645 645
                           ),
646 646
 
647 647
                 // MOD  - audio       - MODule (Impulse Tracker)
648
-                'it'   => array (
648
+                'it'   => array(
649 649
                             'pattern'   => '^IMPM',
650 650
                             'mime_type' => 'audio/it',
651 651
                           ),
652 652
 
653 653
                 // MOD  - audio       - MODule (eXtended Module, various sub-formats)
654
-                'xm'   => array (
654
+                'xm'   => array(
655 655
                             'pattern'   => '^Extended Module',
656 656
                             'mime_type' => 'audio/xm',
657 657
                           ),
658 658
 
659 659
                 // MOD  - audio       - MODule (ScreamTracker)
660
-                's3m'  => array (
660
+                's3m'  => array(
661 661
                             'pattern'   => '^.{44}SCRM',
662 662
                             'mime_type' => 'audio/s3m',
663 663
                           ),
664 664
 
665 665
                 // MPC  - audio       - Musepack / MPEGplus SV7+
666
-                'mpc'  => array (
666
+                'mpc'  => array(
667 667
                             'pattern'   => '^(MP\+)',
668 668
                             'group'     => 'audio',
669 669
                             'module'    => 'mpc',
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
                           ),
672 672
 
673 673
                 // MPC  - audio       - Musepack / MPEGplus SV4-6
674
-                'mpc_old' => array (
674
+                'mpc_old' => array(
675 675
                             'pattern'   => '^([\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0])',
676 676
                             'group'     => 'audio',
677 677
                             'module'    => 'mpc_old',
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 
681 681
 
682 682
                 // MP3  - audio       - MPEG-audio Layer 3 (very similar to AAC-ADTS)
683
-                'mp3'  => array (
683
+                'mp3'  => array(
684 684
                             'pattern'   => '^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]',
685 685
                             'group'     => 'audio',
686 686
                             'module'    => 'mp3',
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
                           ),
689 689
 
690 690
                 // OFR  - audio       - OptimFROG
691
-                'ofr'  => array (
691
+                'ofr'  => array(
692 692
                             'pattern'   => '^(\*RIFF|OFR)',
693 693
                             'group'     => 'audio',
694 694
                             'module'    => 'optimfrog',
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
                           ),
697 697
 
698 698
                 // RKAU - audio       - RKive AUdio compressor
699
-                'rkau' => array (
699
+                'rkau' => array(
700 700
                             'pattern'   => '^RKA',
701 701
                             'group'     => 'audio',
702 702
                             'module'    => 'rkau',
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
                           ),
705 705
 
706 706
                 // SHN  - audio       - Shorten
707
-                'shn'  => array (
707
+                'shn'  => array(
708 708
                             'pattern'   => '^ajkg',
709 709
                             'group'     => 'audio',
710 710
                             'module'    => 'shorten',
@@ -714,15 +714,15 @@  discard block
 block discarded – undo
714 714
                           ),
715 715
 
716 716
                 // TTA  - audio       - TTA Lossless Audio Compressor (http://tta.corecodec.org)
717
-                'tta'  => array (
718
-                            'pattern'   => '^TTA',  // could also be '^TTA(\x01|\x02|\x03|2|1)'
717
+                'tta'  => array(
718
+                            'pattern'   => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)'
719 719
                             'group'     => 'audio',
720 720
                             'module'    => 'tta',
721 721
                             'mime_type' => 'application/octet-stream',
722 722
                           ),
723 723
 
724 724
                 // VOC  - audio       - Creative Voice (VOC)
725
-                'voc'  => array (
725
+                'voc'  => array(
726 726
                             'pattern'   => '^Creative Voice File',
727 727
                             'group'     => 'audio',
728 728
                             'module'    => 'voc',
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                           ),
731 731
 
732 732
                 // VQF  - audio       - transform-domain weighted interleave Vector Quantization Format (VQF)
733
-                'vqf'  => array (
733
+                'vqf'  => array(
734 734
                             'pattern'   => '^TWIN',
735 735
                             'group'     => 'audio',
736 736
                             'module'    => 'vqf',
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                 // Audio-Video formats
750 750
 
751 751
                 // ASF  - audio/video - Advanced Streaming Format, Windows Media Video, Windows Media Audio
752
-                'asf'  => array (
752
+                'asf'  => array(
753 753
                             'pattern'   => '^\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C',
754 754
                             'group'     => 'audio-video',
755 755
                             'module'    => 'asf',
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
                           ),
772 772
 
773 773
                 // MKAV - audio/video - Mastroka
774
-                'matroska' => array (
774
+                'matroska' => array(
775 775
                             'pattern'   => '^\x1A\x45\xDF\xA3',
776 776
                             'mime_type' => 'application/octet-stream',
777 777
                           ),
778 778
 
779 779
                 // MPEG - audio/video - MPEG (Moving Pictures Experts Group)
780
-                'mpeg' => array (
780
+                'mpeg' => array(
781 781
                             'pattern'   => '^\x00\x00\x01(\xBA|\xB3)',
782 782
                             'group'     => 'audio-video',
783 783
                             'module'    => 'mpeg',
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                           ),
786 786
 
787 787
                 // NSV  - audio/video - Nullsoft Streaming Video (NSV)
788
-                'nsv'  => array (
788
+                'nsv'  => array(
789 789
                             'pattern'   => '^NSV[sf]',
790 790
                             'group'     => 'audio-video',
791 791
                             'module'    => 'nsv',
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
                           ),
794 794
 
795 795
                 // Ogg  - audio/video - Ogg (Ogg Vorbis, OggFLAC, Speex, Ogg Theora(*), Ogg Tarkin(*))
796
-                'ogg'  => array (
796
+                'ogg'  => array(
797 797
                             'pattern'   => '^OggS',
798 798
                             'group'     => 'audio',
799 799
                             'module'    => 'xiph',
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                           ),
804 804
 
805 805
                 // QT   - audio/video - Quicktime
806
-                'quicktime' => array (
806
+                'quicktime' => array(
807 807
                             'pattern'   => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)',
808 808
                             'group'     => 'audio-video',
809 809
                             'module'    => 'quicktime',
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                           ),
812 812
 
813 813
                 // RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF)
814
-                'riff' => array (
814
+                'riff' => array(
815 815
                             'pattern'   => '^(RIFF|SDSS|FORM)',
816 816
                             'group'     => 'audio-video',
817 817
                             'module'    => 'riff',
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
                           ),
821 821
 
822 822
                 // Real - audio/video - RealAudio, RealVideo
823
-                'real' => array (
823
+                'real' => array(
824 824
                             'pattern'   => '^(\.RMF|.ra)',
825 825
                             'group'     => 'audio-video',
826 826
                             'module'    => 'real',
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                           ),
829 829
 
830 830
                 // SWF - audio/video - ShockWave Flash
831
-                'swf' => array (
831
+                'swf' => array(
832 832
                             'pattern'   => '^(F|C)WS',
833 833
                             'group'     => 'audio-video',
834 834
                             'module'    => 'swf',
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
                 // Still-Image formats
840 840
 
841 841
                 // BMP  - still image - Bitmap (Windows, OS/2; uncompressed, RLE8, RLE4)
842
-                'bmp'  => array (
842
+                'bmp'  => array(
843 843
                             'pattern'   => '^BM',
844 844
                             'group'     => 'graphic',
845 845
                             'module'    => 'bmp',
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
                           ),
850 850
 
851 851
                 // GIF  - still image - Graphics Interchange Format
852
-                'gif'  => array (
852
+                'gif'  => array(
853 853
                             'pattern'   => '^GIF',
854 854
                             'group'     => 'graphic',
855 855
                             'module'    => 'gif',
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
                           ),
860 860
 
861 861
                 // JPEG - still image - Joint Photographic Experts Group (JPEG)
862
-                'jpeg'  => array (
862
+                'jpeg'  => array(
863 863
                             'pattern'   => '^\xFF\xD8\xFF',
864 864
                             'group'     => 'graphic',
865 865
                             'module'    => 'jpeg',
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                           ),
870 870
 
871 871
                 // PCD  - still image - Kodak Photo CD
872
-                'pcd'  => array (
872
+                'pcd'  => array(
873 873
                             'pattern'   => '^.{2048}PCD_IPI\x00',
874 874
                             'group'     => 'graphic',
875 875
                             'module'    => 'pcd',
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 
881 881
 
882 882
                 // PNG  - still image - Portable Network Graphics (PNG)
883
-                'png'  => array (
883
+                'png'  => array(
884 884
                             'pattern'   => '^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A',
885 885
                             'group'     => 'graphic',
886 886
                             'module'    => 'png',
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 
901 901
 
902 902
                 // TIFF  - still image - Tagged Information File Format (TIFF)
903
-                'tiff' => array (
903
+                'tiff' => array(
904 904
                             'pattern'   => '^(II\x2A\x00|MM\x00\x2A)',
905 905
                             'group'     => 'graphic',
906 906
                             'module'    => 'tiff',
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
                           ),
921 921
 
922 922
                 // ISO  - data        - International Standards Organization (ISO) CD-ROM Image
923
-                'iso'  => array (
923
+                'iso'  => array(
924 924
                             'pattern'   => '^.{32769}CD001',
925 925
                             'group'     => 'misc',
926 926
                             'module'    => 'iso',
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
                           ),
939 939
 
940 940
                 // SZIP - audio       - SZIP compressed data
941
-                'szip' => array (
941
+                'szip' => array(
942 942
                             'pattern'   => '^SZ\x0A\x04',
943 943
                             'group'     => 'archive',
944 944
                             'module'    => 'szip',
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 
970 970
 
971 971
                 // ZIP  - data        - ZIP compressed data
972
-                'zip'  => array (
972
+                'zip'  => array(
973 973
                             'pattern'   => '^PK\x03\x04',
974 974
                             'group'     => 'archive',
975 975
                             'module'    => 'zip',
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 
981 981
 
982 982
                 // PAR2 - data        - Parity Volume Set Specification 2.0
983
-                'par2' => array (
983
+                'par2' => array(
984 984
                 			'pattern'   => '^PAR2\x00PKT',
985 985
 							'mime_type' => 'application/octet-stream',
986 986
 							'fail_id3'  => 'ERROR',
@@ -1039,22 +1039,22 @@  discard block
 block discarded – undo
1039 1039
     protected function HandleAllTags() {
1040 1040
 
1041 1041
         // Key name => array (tag name, character encoding)
1042
-        static $tags = array (
1043
-            'asf'       => array ('asf',           'UTF-16LE'),
1044
-            'midi'      => array ('midi',          'ISO-8859-1'),
1045
-            'nsv'       => array ('nsv',           'ISO-8859-1'),
1046
-            'ogg'       => array ('vorbiscomment', 'UTF-8'),
1047
-            'png'       => array ('png',           'UTF-8'),
1048
-            'tiff'      => array ('tiff',          'ISO-8859-1'),
1049
-            'quicktime' => array ('quicktime',     'ISO-8859-1'),
1050
-            'real'      => array ('real',          'ISO-8859-1'),
1051
-            'vqf'       => array ('vqf',           'ISO-8859-1'),
1052
-            'zip'       => array ('zip',           'ISO-8859-1'),
1053
-            'riff'      => array ('riff',          'ISO-8859-1'),
1054
-            'lyrics3'   => array ('lyrics3',       'ISO-8859-1'),
1055
-            'id3v1'     => array ('id3v1',         ''),            // change below - cannot assign variable to static array
1056
-            'id3v2'     => array ('id3v2',         'UTF-8'),       // module converts all frames to UTF-8
1057
-            'ape'       => array ('ape',           'UTF-8')
1042
+        static $tags = array(
1043
+            'asf'       => array('asf', 'UTF-16LE'),
1044
+            'midi'      => array('midi', 'ISO-8859-1'),
1045
+            'nsv'       => array('nsv', 'ISO-8859-1'),
1046
+            'ogg'       => array('vorbiscomment', 'UTF-8'),
1047
+            'png'       => array('png', 'UTF-8'),
1048
+            'tiff'      => array('tiff', 'ISO-8859-1'),
1049
+            'quicktime' => array('quicktime', 'ISO-8859-1'),
1050
+            'real'      => array('real', 'ISO-8859-1'),
1051
+            'vqf'       => array('vqf', 'ISO-8859-1'),
1052
+            'zip'       => array('zip', 'ISO-8859-1'),
1053
+            'riff'      => array('riff', 'ISO-8859-1'),
1054
+            'lyrics3'   => array('lyrics3', 'ISO-8859-1'),
1055
+            'id3v1'     => array('id3v1', ''), // change below - cannot assign variable to static array
1056
+            'id3v2'     => array('id3v2', 'UTF-8'), // module converts all frames to UTF-8
1057
+            'ape'       => array('ape', 'UTF-8')
1058 1058
         );
1059 1059
         $tags['id3v1'][1] = $this->encoding_id3v1;
1060 1060
 
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
             list($tag_name, $encoding) = $tag_name_encoding_array;
1064 1064
 
1065 1065
             // Fill in default encoding type if not already present
1066
-            @$this->info[$comment_name]  and  $this->info[$comment_name]['encoding'] = $encoding;
1066
+            @$this->info[$comment_name] and $this->info[$comment_name]['encoding'] = $encoding;
1067 1067
 
1068 1068
             // Copy comments if key name set
1069 1069
             if (@$this->info[$comment_name]['comments']) {
@@ -1142,11 +1142,11 @@  discard block
 block discarded – undo
1142 1142
 abstract class getid3_handler
1143 1143
 {
1144 1144
 
1145
-    protected $getid3;                          // pointer
1145
+    protected $getid3; // pointer
1146 1146
 
1147
-    protected $data_string_flag = false;        // analyzing filepointer or string
1148
-    protected $data_string;                     // string to analyze
1149
-    protected $data_string_position = 0;        // seek position in string
1147
+    protected $data_string_flag = false; // analyzing filepointer or string
1148
+    protected $data_string; // string to analyze
1149
+    protected $data_string_position = 0; // seek position in string
1150 1150
 
1151 1151
 
1152 1152
     public function __construct(getID3 $getid3) {
@@ -1247,20 +1247,20 @@  discard block
 block discarded – undo
1247 1247
     public function __construct($filename) {
1248 1248
 
1249 1249
         if (!file_exists($filename)) {
1250
-            throw new getid3_exception('File does not exist: "' . $filename . '"');
1250
+            throw new getid3_exception('File does not exist: "'.$filename.'"');
1251 1251
         }
1252 1252
 
1253 1253
         if (!is_writeable($filename)) {
1254
-            throw new getid3_exception('File is not writeable: "' . $filename . '"');
1254
+            throw new getid3_exception('File is not writeable: "'.$filename.'"');
1255 1255
         }
1256 1256
 
1257 1257
         if (!is_writeable(dirname($filename))) {
1258
-            throw new getid3_exception('Directory is not writeable: ' . dirname($filename) . ' (need to write lock file).');
1258
+            throw new getid3_exception('Directory is not writeable: '.dirname($filename).' (need to write lock file).');
1259 1259
         }
1260 1260
 
1261 1261
         $this->user_abort = ignore_user_abort(true);
1262 1262
 
1263
-        $this->fp_lock = fopen($filename . '.getid3.lock', 'w');
1263
+        $this->fp_lock = fopen($filename.'.getid3.lock', 'w');
1264 1264
         flock($this->fp_lock, LOCK_EX);
1265 1265
 
1266 1266
         $this->filename = $filename;
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 
1272 1272
         flock($this->fp_lock, LOCK_UN);
1273 1273
         fclose($this->fp_lock);
1274
-        unlink($this->filename . '.getid3.lock');
1274
+        unlink($this->filename.'.getid3.lock');
1275 1275
 
1276 1276
         ignore_user_abort($this->user_abort);
1277 1277
     }
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 
1326 1326
 
1327 1327
     // Convert number to Little Endian byte string
1328
-    public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) {
1328
+    public static function LittleEndian2String($number, $minbytes = 1, $synchsafe = false) {
1329 1329
         $intstring = '';
1330 1330
         while ($number > 0) {
1331 1331
             if ($synchsafe) {
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 	}
1486 1486
 
1487 1487
 
1488
-	public static function PrintHexBytes($string, $hex=true, $spaces=true, $html_safe=true) {
1488
+	public static function PrintHexBytes($string, $hex = true, $spaces = true, $html_safe = true) {
1489 1489
 
1490 1490
         $return_string = '';
1491 1491
         for ($i = 0; $i < strlen($string); $i++) {
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 
1546 1546
     public static function NameLookup($name_code) {
1547 1547
 
1548
-        static $lookup = array (
1548
+        static $lookup = array(
1549 1549
             0 => 'not set',
1550 1550
             1 => 'Track Gain Adjustment',
1551 1551
             2 => 'Album Gain Adjustment'
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 
1559 1559
     public static function OriginatorLookup($originator_code) {
1560 1560
 
1561
-        static $lookup = array (
1561
+        static $lookup = array(
1562 1562
             0 => 'unspecified',
1563 1563
             1 => 'pre-set by artist/producer/mastering engineer',
1564 1564
             2 => 'set by user',
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 
1573 1573
     public static function AdjustmentLookup($raw_adjustment, $sign_bit) {
1574 1574
 
1575
-        return (float)$raw_adjustment / 10 * ($sign_bit == 1 ? -1 : 1);
1575
+        return (float) $raw_adjustment / 10 * ($sign_bit == 1 ? -1 : 1);
1576 1576
     }
1577 1577
 
1578 1578
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -17 removed lines patch added patch discarded remove patch
@@ -198,8 +198,7 @@  discard block
 block discarded – undo
198 198
                     $tag_class = 'getid3_' . $tag_name;
199 199
                     $tag = new $tag_class($this);
200 200
                     $tag->Analyze();
201
-                }
202
-                catch (getid3_exception $e) {
201
+                } catch (getid3_exception $e) {
203 202
                     throw $e;
204 203
                 }
205 204
             }
@@ -243,9 +242,7 @@  discard block
 block discarded – undo
243 242
             // use assume format on these if format detection failed
244 243
             if (preg_match('/\.mp[123a]$/i', $filename)) {
245 244
                 $determined_format = $file_format_array['mp3'];
246
-            }
247
-
248
-            else {
245
+            } else {
249 246
                 fclose($this->fp);
250 247
                 throw new getid3_exception('Unable to determine file format');
251 248
             }
@@ -259,8 +256,7 @@  discard block
 block discarded – undo
259 256
             if ($determined_format['fail_id3'] === 'ERROR') {
260 257
                 fclose($this->fp);
261 258
                 throw new getid3_exception('ID3 tags not allowed on this file type.');
262
-            }
263
-            elseif ($determined_format['fail_id3'] === 'WARNING') {
259
+            } elseif ($determined_format['fail_id3'] === 'WARNING') {
264 260
                 @$this->info['id3v1'] and $this->warning('ID3v1 tags not allowed on this file type.');
265 261
                 @$this->info['id3v2'] and $this->warning('ID3v2 tags not allowed on this file type.');
266 262
             }
@@ -301,11 +297,9 @@  discard block
 block discarded – undo
301 297
 
302 298
         try {
303 299
              $this->option_analyze and $class->Analyze();
304
-            }
305
-        catch (getid3_exception $e) {
300
+            } catch (getid3_exception $e) {
306 301
             throw $e;
307
-        }
308
-        catch (Exception $e) {
302
+        } catch (Exception $e) {
309 303
             throw new getid3_exception('Corrupt file.');
310 304
         }
311 305
 
@@ -460,8 +454,7 @@  discard block
 block discarded – undo
460 454
 
461 455
         if (is_array($message)) {
462 456
             $this->warnings = array_merge($this->warnings, $message);
463
-        }
464
-        else {
457
+        } else {
465 458
             $this->warnings[] = $message;
466 459
         }
467 460
     }
@@ -1101,8 +1094,7 @@  discard block
 block discarded – undo
1101 1094
                             if (empty($this->info['comments'][$tag_name])) {
1102 1095
 
1103 1096
                                 // fall through and append value
1104
-                            }
1105
-                            elseif ($tag_type == 'id3v1') {
1097
+                            } elseif ($tag_type == 'id3v1') {
1106 1098
 
1107 1099
                                 $new_value_length = strlen(trim($value));
1108 1100
                                 foreach ($this->info['comments'][$tag_name] as $existing_key => $existing_value) {
@@ -1112,8 +1104,7 @@  discard block
 block discarded – undo
1112 1104
                                         break 2;
1113 1105
                                     }
1114 1106
                                 }
1115
-                            }
1116
-                            else {
1107
+                            } else {
1117 1108
 
1118 1109
                                 $new_value_length = strlen(trim($value));
1119 1110
                                 foreach ($this->info['comments'][$tag_name] as $existing_key => $existing_value) {
Please login to merge, or discard this patch.
main/inc/lib/getid3/module.audio-video.flv.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -276,6 +276,9 @@  discard block
 block discarded – undo
276 276
 	public $pos;
277 277
 
278 278
 
279
+	/**
280
+	 * @param string $bytes
281
+	 */
279 282
 	public function AMFStream($bytes) {
280 283
 
281 284
 		$this->bytes = $bytes;
@@ -389,6 +392,9 @@  discard block
 block discarded – undo
389 392
 {
390 393
 	public $stream;
391 394
 
395
+	/**
396
+	 * @param AMFStream $stream
397
+	 */
392 398
 	public function __construct($stream) {
393 399
 
394 400
 		$this->stream = $stream;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 class getid3_flv extends getid3_handler {
49 49
 
50
-    const TAG_AUDIO    =  8;
51
-    const TAG_VIDEO    =  9;
50
+    const TAG_AUDIO    = 8;
51
+    const TAG_VIDEO    = 9;
52 52
     const TAG_META     = 18;
53 53
 
54 54
     const VIDEO_H263   = 2;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 	    $info = &$this->getid3->info;
62 62
 
63
-	    $info['flv'] = array ();
63
+	    $info['flv'] = array();
64 64
 	    $info_flv = &$info['flv'];
65 65
 
66 66
 		fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$flv_header = fread($this->getid3->fp, 5);
70 70
 
71 71
 		$info['fileformat'] = 'flv';
72
-		$info_flv['header']['signature'] =                           substr($flv_header, 0, 3);
72
+		$info_flv['header']['signature'] = substr($flv_header, 0, 3);
73 73
 		$info_flv['header']['version']   = getid3_lib::BigEndian2Int(substr($flv_header, 3, 1));
74 74
 		$type_flags                      = getid3_lib::BigEndian2Int(substr($flv_header, 4, 1));
75 75
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 
88 88
 			$this_tag_header = fread($this->getid3->fp, 16);
89 89
 
90
-			$previous_tag_length = getid3_lib::BigEndian2Int(substr($this_tag_header,  0, 4));
91
-			$tag_type            = getid3_lib::BigEndian2Int(substr($this_tag_header,  4, 1));
92
-			$data_length         = getid3_lib::BigEndian2Int(substr($this_tag_header,  5, 3));
93
-			$timestamp           = getid3_lib::BigEndian2Int(substr($this_tag_header,  8, 3));
90
+			$previous_tag_length = getid3_lib::BigEndian2Int(substr($this_tag_header, 0, 4));
91
+			$tag_type            = getid3_lib::BigEndian2Int(substr($this_tag_header, 4, 1));
92
+			$data_length         = getid3_lib::BigEndian2Int(substr($this_tag_header, 5, 3));
93
+			$timestamp           = getid3_lib::BigEndian2Int(substr($this_tag_header, 8, 3));
94 94
 			$last_header_byte    = getid3_lib::BigEndian2Int(substr($this_tag_header, 15, 1));
95 95
 			$next_offset         = ftell($this->getid3->fp) - 1 + $data_length;
96 96
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 				case getid3_flv::TAG_AUDIO:
100 100
 					if (!isset($info_flv['audio']['audioFormat'])) {
101
-						$info_flv['audio']['audioFormat']     =  $last_header_byte & 0x07;
101
+						$info_flv['audio']['audioFormat']     = $last_header_byte & 0x07;
102 102
 						$info_flv['audio']['audioRate']       = ($last_header_byte & 0x30) / 0x10;
103 103
 						$info_flv['audio']['audioSampleSize'] = ($last_header_byte & 0x40) / 0x40;
104 104
 						$info_flv['audio']['audioType']       = ($last_header_byte & 0x80) / 0x80;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 		$type = $this->stream->readByte();
403 403
 
404
-		switch($type) {
404
+		switch ($type) {
405 405
 			// Double
406 406
 			case 0:
407 407
 				$value = $this->readDouble();
Please login to merge, or discard this patch.
Indentation   +401 added lines, -401 removed lines patch added patch discarded remove patch
@@ -56,522 +56,522 @@
 block discarded – undo
56 56
     const VIDEO_VP6    = 4;
57 57
 
58 58
 
59
-	public function Analyze()
60
-	{
61
-	    $info = &$this->getid3->info;
62
-
63
-	    $info['flv'] = array ();
64
-	    $info_flv = &$info['flv'];
65
-
66
-		fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
67
-
68
-		$flv_data_length = $info['avdataend'] - $info['avdataoffset'];
69
-		$flv_header = fread($this->getid3->fp, 5);
70
-
71
-		$info['fileformat'] = 'flv';
72
-		$info_flv['header']['signature'] =                           substr($flv_header, 0, 3);
73
-		$info_flv['header']['version']   = getid3_lib::BigEndian2Int(substr($flv_header, 3, 1));
74
-		$type_flags                      = getid3_lib::BigEndian2Int(substr($flv_header, 4, 1));
75
-
76
-		$info_flv['header']['hasAudio'] = (bool) ($type_flags & 0x04);
77
-		$info_flv['header']['hasVideo'] = (bool) ($type_flags & 0x01);
78
-
79
-		$frame_size_data_length = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4));
80
-		$flv_header_frame_length = 9;
81
-		if ($frame_size_data_length > $flv_header_frame_length) {
82
-			fseek($this->getid3->fp, $frame_size_data_length - $flv_header_frame_length, SEEK_CUR);
83
-		}
84
-
85
-		$duration = 0;
86
-		while ((ftell($this->getid3->fp) + 1) < $info['avdataend']) {
87
-
88
-			$this_tag_header = fread($this->getid3->fp, 16);
89
-
90
-			$previous_tag_length = getid3_lib::BigEndian2Int(substr($this_tag_header,  0, 4));
91
-			$tag_type            = getid3_lib::BigEndian2Int(substr($this_tag_header,  4, 1));
92
-			$data_length         = getid3_lib::BigEndian2Int(substr($this_tag_header,  5, 3));
93
-			$timestamp           = getid3_lib::BigEndian2Int(substr($this_tag_header,  8, 3));
94
-			$last_header_byte    = getid3_lib::BigEndian2Int(substr($this_tag_header, 15, 1));
95
-			$next_offset         = ftell($this->getid3->fp) - 1 + $data_length;
96
-
97
-			switch ($tag_type) {
98
-
99
-				case getid3_flv::TAG_AUDIO:
100
-					if (!isset($info_flv['audio']['audioFormat'])) {
101
-						$info_flv['audio']['audioFormat']     =  $last_header_byte & 0x07;
102
-						$info_flv['audio']['audioRate']       = ($last_header_byte & 0x30) / 0x10;
103
-						$info_flv['audio']['audioSampleSize'] = ($last_header_byte & 0x40) / 0x40;
104
-						$info_flv['audio']['audioType']       = ($last_header_byte & 0x80) / 0x80;
105
-					}
106
-					break;
107
-
108
-
109
-				case getid3_flv::TAG_VIDEO:
110
-					if (!isset($info_flv['video']['videoCodec'])) {
111
-						$info_flv['video']['videoCodec'] = $last_header_byte & 0x07;
112
-
113
-						$flv_video_header = fread($this->getid3->fp, 11);
114
-
115
-						if ($info_flv['video']['videoCodec'] != getid3_flv::VIDEO_VP6) {
116
-
117
-							$picture_size_type = (getid3_lib::BigEndian2Int(substr($flv_video_header, 3, 2))) >> 7;
118
-							$picture_size_type = $picture_size_type & 0x0007;
119
-							$info_flv['header']['videoSizeType'] = $picture_size_type;
120
-
121
-							switch ($picture_size_type) {
122
-								case 0:
123
-									$picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 2));
124
-									$picture_size_enc <<= 1;
125
-									$info['video']['resolution_x'] = ($picture_size_enc & 0xFF00) >> 8;
126
-									$picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 6, 2));
127
-									$picture_size_enc <<= 1;
128
-									$info['video']['resolution_y'] = ($picture_size_enc & 0xFF00) >> 8;
129
-									break;
130
-
131
-								case 1:
132
-									$picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 4));
133
-									$picture_size_enc <<= 1;
134
-									$info['video']['resolution_x'] = ($picture_size_enc & 0xFFFF0000) >> 16;
135
-
136
-									$picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 7, 4));
137
-									$picture_size_enc <<= 1;
138
-									$info['video']['resolution_y'] = ($picture_size_enc & 0xFFFF0000) >> 16;
139
-									break;
140
-
141
-								case 2:
142
-									$info['video']['resolution_x'] = 352;
143
-									$info['video']['resolution_y'] = 288;
144
-									break;
145
-
146
-								case 3:
147
-									$info['video']['resolution_x'] = 176;
148
-									$info['video']['resolution_y'] = 144;
149
-									break;
150
-
151
-								case 4:
152
-									$info['video']['resolution_x'] = 128;
153
-									$info['video']['resolution_y'] = 96;
154
-									break;
155
-
156
-								case 5:
157
-									$info['video']['resolution_x'] = 320;
158
-									$info['video']['resolution_y'] = 240;
159
-									break;
160
-
161
-								case 6:
162
-									$info['video']['resolution_x'] = 160;
163
-									$info['video']['resolution_y'] = 120;
164
-									break;
165
-
166
-								default:
167
-									$info['video']['resolution_x'] = 0;
168
-									$info['video']['resolution_y'] = 0;
169
-									break;
170
-							}
171
-						}
172
-					}
173
-					break;
174
-
175
-
176
-				// Meta tag
177
-				case getid3_flv::TAG_META:
178
-
179
-					fseek($this->getid3->fp, -1, SEEK_CUR);
180
-					$reader = new AMFReader(new AMFStream(fread($this->getid3->fp, $data_length)));
181
-					$event_name = $reader->readData();
182
-					$info['meta'][$event_name] = $reader->readData();
183
-					unset($reader);
184
-
185
-					$info['video']['frame_rate']   = @$info['meta']['onMetaData']['framerate'];
186
-					$info['video']['resolution_x'] = @$info['meta']['onMetaData']['width'];
187
-					$info['video']['resolution_y'] = @$info['meta']['onMetaData']['height'];
188
-					break;
189
-
190
-				default:
191
-					// noop
192
-					break;
193
-			}
194
-
195
-			if ($timestamp > $duration) {
196
-				$duration = $timestamp;
197
-			}
198
-
199
-			fseek($this->getid3->fp, $next_offset, SEEK_SET);
200
-		}
201
-
202
-		if ($info['playtime_seconds'] = $duration / 1000) {
203
-		    $info['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds'];
204
-		}
205
-
206
-		if ($info_flv['header']['hasAudio']) {
207
-			$info['audio']['codec']           = $this->FLVaudioFormat($info_flv['audio']['audioFormat']);
208
-			$info['audio']['sample_rate']     = $this->FLVaudioRate($info_flv['audio']['audioRate']);
209
-			$info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info_flv['audio']['audioSampleSize']);
210
-
211
-			$info['audio']['channels']   = $info_flv['audio']['audioType'] + 1; // 0=mono,1=stereo
212
-			$info['audio']['lossless']   = ($info_flv['audio']['audioFormat'] ? false : true); // 0=uncompressed
213
-			$info['audio']['dataformat'] = 'flv';
214
-		}
215
-		if (@$info_flv['header']['hasVideo']) {
216
-			$info['video']['codec']      = $this->FLVvideoCodec($info_flv['video']['videoCodec']);
217
-			$info['video']['dataformat'] = 'flv';
218
-			$info['video']['lossless']   = false;
219
-		}
220
-
221
-		return true;
222
-	}
223
-
224
-
225
-	public static function FLVaudioFormat($id) {
226
-
227
-		static $lookup = array(
228
-			0 => 'uncompressed',
229
-			1 => 'ADPCM',
230
-			2 => 'mp3',
231
-			5 => 'Nellymoser 8kHz mono',
232
-			6 => 'Nellymoser',
233
-		);
234
-		return (@$lookup[$id] ? @$lookup[$id] : false);
235
-	}
236
-
237
-
238
-	public static function FLVaudioRate($id) {
239
-
240
-		static $lookup = array(
241
-			0 =>  5500,
242
-			1 => 11025,
243
-			2 => 22050,
244
-			3 => 44100,
245
-		);
246
-		return (@$lookup[$id] ? @$lookup[$id] : false);
247
-	}
248
-
249
-
250
-	public static function FLVaudioBitDepth($id) {
251
-
252
-		static $lookup = array(
253
-			0 =>  8,
254
-			1 => 16,
255
-		);
256
-		return (@$lookup[$id] ? @$lookup[$id] : false);
257
-	}
258
-
259
-
260
-	public static function FLVvideoCodec($id) {
261
-
262
-		static $lookup = array(
263
-			getid3_flv::VIDEO_H263   => 'Sorenson H.263',
264
-			getid3_flv::VIDEO_SCREEN => 'Screen video',
265
-			getid3_flv::VIDEO_VP6    => 'On2 VP6',
266
-		);
267
-		return (@$lookup[$id] ? @$lookup[$id] : false);
268
-	}
59
+    public function Analyze()
60
+    {
61
+        $info = &$this->getid3->info;
62
+
63
+        $info['flv'] = array ();
64
+        $info_flv = &$info['flv'];
65
+
66
+        fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
67
+
68
+        $flv_data_length = $info['avdataend'] - $info['avdataoffset'];
69
+        $flv_header = fread($this->getid3->fp, 5);
70
+
71
+        $info['fileformat'] = 'flv';
72
+        $info_flv['header']['signature'] =                           substr($flv_header, 0, 3);
73
+        $info_flv['header']['version']   = getid3_lib::BigEndian2Int(substr($flv_header, 3, 1));
74
+        $type_flags                      = getid3_lib::BigEndian2Int(substr($flv_header, 4, 1));
75
+
76
+        $info_flv['header']['hasAudio'] = (bool) ($type_flags & 0x04);
77
+        $info_flv['header']['hasVideo'] = (bool) ($type_flags & 0x01);
78
+
79
+        $frame_size_data_length = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4));
80
+        $flv_header_frame_length = 9;
81
+        if ($frame_size_data_length > $flv_header_frame_length) {
82
+            fseek($this->getid3->fp, $frame_size_data_length - $flv_header_frame_length, SEEK_CUR);
83
+        }
84
+
85
+        $duration = 0;
86
+        while ((ftell($this->getid3->fp) + 1) < $info['avdataend']) {
87
+
88
+            $this_tag_header = fread($this->getid3->fp, 16);
89
+
90
+            $previous_tag_length = getid3_lib::BigEndian2Int(substr($this_tag_header,  0, 4));
91
+            $tag_type            = getid3_lib::BigEndian2Int(substr($this_tag_header,  4, 1));
92
+            $data_length         = getid3_lib::BigEndian2Int(substr($this_tag_header,  5, 3));
93
+            $timestamp           = getid3_lib::BigEndian2Int(substr($this_tag_header,  8, 3));
94
+            $last_header_byte    = getid3_lib::BigEndian2Int(substr($this_tag_header, 15, 1));
95
+            $next_offset         = ftell($this->getid3->fp) - 1 + $data_length;
96
+
97
+            switch ($tag_type) {
98
+
99
+                case getid3_flv::TAG_AUDIO:
100
+                    if (!isset($info_flv['audio']['audioFormat'])) {
101
+                        $info_flv['audio']['audioFormat']     =  $last_header_byte & 0x07;
102
+                        $info_flv['audio']['audioRate']       = ($last_header_byte & 0x30) / 0x10;
103
+                        $info_flv['audio']['audioSampleSize'] = ($last_header_byte & 0x40) / 0x40;
104
+                        $info_flv['audio']['audioType']       = ($last_header_byte & 0x80) / 0x80;
105
+                    }
106
+                    break;
107
+
108
+
109
+                case getid3_flv::TAG_VIDEO:
110
+                    if (!isset($info_flv['video']['videoCodec'])) {
111
+                        $info_flv['video']['videoCodec'] = $last_header_byte & 0x07;
112
+
113
+                        $flv_video_header = fread($this->getid3->fp, 11);
114
+
115
+                        if ($info_flv['video']['videoCodec'] != getid3_flv::VIDEO_VP6) {
116
+
117
+                            $picture_size_type = (getid3_lib::BigEndian2Int(substr($flv_video_header, 3, 2))) >> 7;
118
+                            $picture_size_type = $picture_size_type & 0x0007;
119
+                            $info_flv['header']['videoSizeType'] = $picture_size_type;
120
+
121
+                            switch ($picture_size_type) {
122
+                                case 0:
123
+                                    $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 2));
124
+                                    $picture_size_enc <<= 1;
125
+                                    $info['video']['resolution_x'] = ($picture_size_enc & 0xFF00) >> 8;
126
+                                    $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 6, 2));
127
+                                    $picture_size_enc <<= 1;
128
+                                    $info['video']['resolution_y'] = ($picture_size_enc & 0xFF00) >> 8;
129
+                                    break;
130
+
131
+                                case 1:
132
+                                    $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 4));
133
+                                    $picture_size_enc <<= 1;
134
+                                    $info['video']['resolution_x'] = ($picture_size_enc & 0xFFFF0000) >> 16;
135
+
136
+                                    $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 7, 4));
137
+                                    $picture_size_enc <<= 1;
138
+                                    $info['video']['resolution_y'] = ($picture_size_enc & 0xFFFF0000) >> 16;
139
+                                    break;
140
+
141
+                                case 2:
142
+                                    $info['video']['resolution_x'] = 352;
143
+                                    $info['video']['resolution_y'] = 288;
144
+                                    break;
145
+
146
+                                case 3:
147
+                                    $info['video']['resolution_x'] = 176;
148
+                                    $info['video']['resolution_y'] = 144;
149
+                                    break;
150
+
151
+                                case 4:
152
+                                    $info['video']['resolution_x'] = 128;
153
+                                    $info['video']['resolution_y'] = 96;
154
+                                    break;
155
+
156
+                                case 5:
157
+                                    $info['video']['resolution_x'] = 320;
158
+                                    $info['video']['resolution_y'] = 240;
159
+                                    break;
160
+
161
+                                case 6:
162
+                                    $info['video']['resolution_x'] = 160;
163
+                                    $info['video']['resolution_y'] = 120;
164
+                                    break;
165
+
166
+                                default:
167
+                                    $info['video']['resolution_x'] = 0;
168
+                                    $info['video']['resolution_y'] = 0;
169
+                                    break;
170
+                            }
171
+                        }
172
+                    }
173
+                    break;
174
+
175
+
176
+                // Meta tag
177
+                case getid3_flv::TAG_META:
178
+
179
+                    fseek($this->getid3->fp, -1, SEEK_CUR);
180
+                    $reader = new AMFReader(new AMFStream(fread($this->getid3->fp, $data_length)));
181
+                    $event_name = $reader->readData();
182
+                    $info['meta'][$event_name] = $reader->readData();
183
+                    unset($reader);
184
+
185
+                    $info['video']['frame_rate']   = @$info['meta']['onMetaData']['framerate'];
186
+                    $info['video']['resolution_x'] = @$info['meta']['onMetaData']['width'];
187
+                    $info['video']['resolution_y'] = @$info['meta']['onMetaData']['height'];
188
+                    break;
189
+
190
+                default:
191
+                    // noop
192
+                    break;
193
+            }
194
+
195
+            if ($timestamp > $duration) {
196
+                $duration = $timestamp;
197
+            }
198
+
199
+            fseek($this->getid3->fp, $next_offset, SEEK_SET);
200
+        }
201
+
202
+        if ($info['playtime_seconds'] = $duration / 1000) {
203
+            $info['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds'];
204
+        }
205
+
206
+        if ($info_flv['header']['hasAudio']) {
207
+            $info['audio']['codec']           = $this->FLVaudioFormat($info_flv['audio']['audioFormat']);
208
+            $info['audio']['sample_rate']     = $this->FLVaudioRate($info_flv['audio']['audioRate']);
209
+            $info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info_flv['audio']['audioSampleSize']);
210
+
211
+            $info['audio']['channels']   = $info_flv['audio']['audioType'] + 1; // 0=mono,1=stereo
212
+            $info['audio']['lossless']   = ($info_flv['audio']['audioFormat'] ? false : true); // 0=uncompressed
213
+            $info['audio']['dataformat'] = 'flv';
214
+        }
215
+        if (@$info_flv['header']['hasVideo']) {
216
+            $info['video']['codec']      = $this->FLVvideoCodec($info_flv['video']['videoCodec']);
217
+            $info['video']['dataformat'] = 'flv';
218
+            $info['video']['lossless']   = false;
219
+        }
220
+
221
+        return true;
222
+    }
223
+
224
+
225
+    public static function FLVaudioFormat($id) {
226
+
227
+        static $lookup = array(
228
+            0 => 'uncompressed',
229
+            1 => 'ADPCM',
230
+            2 => 'mp3',
231
+            5 => 'Nellymoser 8kHz mono',
232
+            6 => 'Nellymoser',
233
+        );
234
+        return (@$lookup[$id] ? @$lookup[$id] : false);
235
+    }
236
+
237
+
238
+    public static function FLVaudioRate($id) {
239
+
240
+        static $lookup = array(
241
+            0 =>  5500,
242
+            1 => 11025,
243
+            2 => 22050,
244
+            3 => 44100,
245
+        );
246
+        return (@$lookup[$id] ? @$lookup[$id] : false);
247
+    }
248
+
249
+
250
+    public static function FLVaudioBitDepth($id) {
251
+
252
+        static $lookup = array(
253
+            0 =>  8,
254
+            1 => 16,
255
+        );
256
+        return (@$lookup[$id] ? @$lookup[$id] : false);
257
+    }
258
+
259
+
260
+    public static function FLVvideoCodec($id) {
261
+
262
+        static $lookup = array(
263
+            getid3_flv::VIDEO_H263   => 'Sorenson H.263',
264
+            getid3_flv::VIDEO_SCREEN => 'Screen video',
265
+            getid3_flv::VIDEO_VP6    => 'On2 VP6',
266
+        );
267
+        return (@$lookup[$id] ? @$lookup[$id] : false);
268
+    }
269 269
 }
270 270
 
271 271
 
272 272
 
273 273
 class AMFStream
274 274
 {
275
-	public $bytes;
276
-	public $pos;
275
+    public $bytes;
276
+    public $pos;
277 277
 
278 278
 
279
-	public function AMFStream($bytes) {
279
+    public function AMFStream($bytes) {
280 280
 
281
-		$this->bytes = $bytes;
282
-		$this->pos = 0;
283
-	}
281
+        $this->bytes = $bytes;
282
+        $this->pos = 0;
283
+    }
284 284
 
285 285
 
286
-	public function readByte() {
286
+    public function readByte() {
287 287
 
288
-		return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1));
289
-	}
288
+        return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1));
289
+    }
290 290
 
291 291
 
292
-	public function readInt() {
292
+    public function readInt() {
293 293
 
294
-		return ($this->readByte() << 8) + $this->readByte();
295
-	}
294
+        return ($this->readByte() << 8) + $this->readByte();
295
+    }
296 296
 
297 297
 
298
-	public function readLong() {
298
+    public function readLong() {
299 299
 
300
-		return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte();
301
-	}
300
+        return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte();
301
+    }
302 302
 
303 303
 
304
-	public function readDouble() {
304
+    public function readDouble() {
305 305
 
306
-		return getid3_lib::BigEndian2Float($this->read(8));
307
-	}
306
+        return getid3_lib::BigEndian2Float($this->read(8));
307
+    }
308 308
 
309 309
 
310
-	public function readUTF() {
310
+    public function readUTF() {
311 311
 
312
-		$length = $this->readInt();
313
-		return $this->read($length);
314
-	}
312
+        $length = $this->readInt();
313
+        return $this->read($length);
314
+    }
315 315
 
316 316
 
317
-	public function readLongUTF() {
317
+    public function readLongUTF() {
318 318
 
319
-		$length = $this->readLong();
320
-		return $this->read($length);
321
-	}
319
+        $length = $this->readLong();
320
+        return $this->read($length);
321
+    }
322 322
 
323 323
 
324
-	public function read($length) {
324
+    public function read($length) {
325 325
 
326
-		$val = substr($this->bytes, $this->pos, $length);
327
-		$this->pos += $length;
328
-		return $val;
329
-	}
326
+        $val = substr($this->bytes, $this->pos, $length);
327
+        $this->pos += $length;
328
+        return $val;
329
+    }
330 330
 
331 331
 
332
-	public function peekByte() {
332
+    public function peekByte() {
333 333
 
334
-		$pos = $this->pos;
335
-		$val = $this->readByte();
336
-		$this->pos = $pos;
337
-		return $val;
338
-	}
334
+        $pos = $this->pos;
335
+        $val = $this->readByte();
336
+        $this->pos = $pos;
337
+        return $val;
338
+    }
339 339
 
340 340
 
341
-	public function peekInt() {
341
+    public function peekInt() {
342 342
 
343
-		$pos = $this->pos;
344
-		$val = $this->readInt();
345
-		$this->pos = $pos;
346
-		return $val;
347
-	}
343
+        $pos = $this->pos;
344
+        $val = $this->readInt();
345
+        $this->pos = $pos;
346
+        return $val;
347
+    }
348 348
 
349 349
 
350
-	public function peekLong() {
350
+    public function peekLong() {
351 351
 
352
-		$pos = $this->pos;
353
-		$val = $this->readLong();
354
-		$this->pos = $pos;
355
-		return $val;
356
-	}
352
+        $pos = $this->pos;
353
+        $val = $this->readLong();
354
+        $this->pos = $pos;
355
+        return $val;
356
+    }
357 357
 
358 358
 
359
-	public function peekDouble() {
359
+    public function peekDouble() {
360 360
 
361
-		$pos = $this->pos;
362
-		$val = $this->readDouble();
363
-		$this->pos = $pos;
364
-		return $val;
365
-	}
361
+        $pos = $this->pos;
362
+        $val = $this->readDouble();
363
+        $this->pos = $pos;
364
+        return $val;
365
+    }
366 366
 
367 367
 
368
-	public function peekUTF() {
368
+    public function peekUTF() {
369 369
 
370
-		$pos = $this->pos;
371
-		$val = $this->readUTF();
372
-		$this->pos = $pos;
373
-		return $val;
374
-	}
370
+        $pos = $this->pos;
371
+        $val = $this->readUTF();
372
+        $this->pos = $pos;
373
+        return $val;
374
+    }
375 375
 
376 376
 
377
-	public function peekLongUTF() {
377
+    public function peekLongUTF() {
378 378
 
379
-		$pos = $this->pos;
380
-		$val = $this->readLongUTF();
381
-		$this->pos = $pos;
382
-		return $val;
383
-	}
379
+        $pos = $this->pos;
380
+        $val = $this->readLongUTF();
381
+        $this->pos = $pos;
382
+        return $val;
383
+    }
384 384
 }
385 385
 
386 386
 
387 387
 
388 388
 class AMFReader
389 389
 {
390
-	public $stream;
390
+    public $stream;
391 391
 
392
-	public function __construct($stream) {
392
+    public function __construct($stream) {
393 393
 
394
-		$this->stream = $stream;
395
-	}
394
+        $this->stream = $stream;
395
+    }
396 396
 
397 397
 
398
-	public function readData() {
398
+    public function readData() {
399 399
 
400
-		$value = null;
400
+        $value = null;
401 401
 
402
-		$type = $this->stream->readByte();
402
+        $type = $this->stream->readByte();
403 403
 
404
-		switch($type) {
405
-			// Double
406
-			case 0:
407
-				$value = $this->readDouble();
408
-			break;
404
+        switch($type) {
405
+            // Double
406
+            case 0:
407
+                $value = $this->readDouble();
408
+            break;
409 409
 
410
-			// Boolean
411
-			case 1:
412
-				$value = $this->readBoolean();
413
-				break;
410
+            // Boolean
411
+            case 1:
412
+                $value = $this->readBoolean();
413
+                break;
414 414
 
415
-			// String
416
-			case 2:
417
-				$value = $this->readString();
418
-				break;
415
+            // String
416
+            case 2:
417
+                $value = $this->readString();
418
+                break;
419 419
 
420
-			// Object
421
-			case 3:
422
-				$value = $this->readObject();
423
-				break;
420
+            // Object
421
+            case 3:
422
+                $value = $this->readObject();
423
+                break;
424 424
 
425
-			// null
426
-			case 6:
427
-				return null;
428
-				break;
425
+            // null
426
+            case 6:
427
+                return null;
428
+                break;
429 429
 
430
-			// Mixed array
431
-			case 8:
432
-				$value = $this->readMixedArray();
433
-				break;
430
+            // Mixed array
431
+            case 8:
432
+                $value = $this->readMixedArray();
433
+                break;
434 434
 
435
-			// Array
436
-			case 10:
437
-				$value = $this->readArray();
438
-				break;
435
+            // Array
436
+            case 10:
437
+                $value = $this->readArray();
438
+                break;
439 439
 
440
-			// Date
441
-			case 11:
442
-				$value = $this->readDate();
443
-				break;
440
+            // Date
441
+            case 11:
442
+                $value = $this->readDate();
443
+                break;
444 444
 
445
-			// Long string
446
-			case 13:
447
-				$value = $this->readLongString();
448
-				break;
445
+            // Long string
446
+            case 13:
447
+                $value = $this->readLongString();
448
+                break;
449 449
 
450
-			// XML (handled as string)
451
-			case 15:
452
-				$value = $this->readXML();
453
-				break;
450
+            // XML (handled as string)
451
+            case 15:
452
+                $value = $this->readXML();
453
+                break;
454 454
 
455
-			// Typed object (handled as object)
456
-			case 16:
457
-				$value = $this->readTypedObject();
458
-				break;
455
+            // Typed object (handled as object)
456
+            case 16:
457
+                $value = $this->readTypedObject();
458
+                break;
459 459
 
460
-			// Long string
461
-			default:
462
-				$value = '(unknown or unsupported data type)';
463
-			break;
464
-		}
460
+            // Long string
461
+            default:
462
+                $value = '(unknown or unsupported data type)';
463
+            break;
464
+        }
465 465
 
466
-		return $value;
467
-	}
466
+        return $value;
467
+    }
468 468
 
469 469
 
470
-	public function readDouble() {
470
+    public function readDouble() {
471 471
 
472
-		return $this->stream->readDouble();
473
-	}
472
+        return $this->stream->readDouble();
473
+    }
474 474
 
475 475
 
476
-	public function readBoolean() {
476
+    public function readBoolean() {
477 477
 
478
-		return $this->stream->readByte() == 1;
479
-	}
478
+        return $this->stream->readByte() == 1;
479
+    }
480 480
 
481 481
 
482
-	public function readString() {
482
+    public function readString() {
483 483
 
484
-		return $this->stream->readUTF();
485
-	}
484
+        return $this->stream->readUTF();
485
+    }
486 486
 
487 487
 
488
-	public function readObject() {
488
+    public function readObject() {
489 489
 
490
-		// Get highest numerical index - ignored
491
-		$highestIndex = $this->stream->readLong();
490
+        // Get highest numerical index - ignored
491
+        $highestIndex = $this->stream->readLong();
492 492
 
493
-		$data = array();
493
+        $data = array();
494 494
 
495
-		while ($key = $this->stream->readUTF()) {
496
-			// Mixed array record ends with empty string (0x00 0x00) and 0x09
497
-			if (($key == '') && ($this->stream->peekByte() == 0x09)) {
498
-				// Consume byte
499
-				$this->stream->readByte();
500
-				break;
501
-			}
495
+        while ($key = $this->stream->readUTF()) {
496
+            // Mixed array record ends with empty string (0x00 0x00) and 0x09
497
+            if (($key == '') && ($this->stream->peekByte() == 0x09)) {
498
+                // Consume byte
499
+                $this->stream->readByte();
500
+                break;
501
+            }
502 502
 
503
-			$data[$key] = $this->readData();
504
-		}
503
+            $data[$key] = $this->readData();
504
+        }
505 505
 
506
-		return $data;
507
-	}
506
+        return $data;
507
+    }
508 508
 
509 509
 
510
-	public function readMixedArray() {
510
+    public function readMixedArray() {
511 511
 
512
-		// Get highest numerical index - ignored
513
-		$highestIndex = $this->stream->readLong();
512
+        // Get highest numerical index - ignored
513
+        $highestIndex = $this->stream->readLong();
514 514
 
515
-		$data = array();
515
+        $data = array();
516 516
 
517
-		while ($key = $this->stream->readUTF()) {
518
-			// Mixed array record ends with empty string (0x00 0x00) and 0x09
519
-			if (($key == '') && ($this->stream->peekByte() == 0x09)) {
520
-				// Consume byte
521
-				$this->stream->readByte();
522
-				break;
523
-			}
517
+        while ($key = $this->stream->readUTF()) {
518
+            // Mixed array record ends with empty string (0x00 0x00) and 0x09
519
+            if (($key == '') && ($this->stream->peekByte() == 0x09)) {
520
+                // Consume byte
521
+                $this->stream->readByte();
522
+                break;
523
+            }
524 524
 
525
-			if (is_numeric($key)) {
526
-				$key = (float) $key;
527
-			}
525
+            if (is_numeric($key)) {
526
+                $key = (float) $key;
527
+            }
528 528
 
529
-			$data[$key] = $this->readData();
530
-		}
529
+            $data[$key] = $this->readData();
530
+        }
531 531
 
532
-		return $data;
533
-	}
532
+        return $data;
533
+    }
534 534
 
535 535
 
536
-	public function readArray() {
536
+    public function readArray() {
537 537
 
538
-		$length = $this->stream->readLong();
538
+        $length = $this->stream->readLong();
539 539
 
540
-		$data = array();
540
+        $data = array();
541 541
 
542
-		for ($i = 0; $i < count($length); $i++) {
543
-			$data[] = $this->readData();
544
-		}
542
+        for ($i = 0; $i < count($length); $i++) {
543
+            $data[] = $this->readData();
544
+        }
545 545
 
546
-		return $data;
547
-	}
546
+        return $data;
547
+    }
548 548
 
549 549
 
550
-	public function readDate() {
550
+    public function readDate() {
551 551
 
552
-		$timestamp = $this->stream->readDouble();
553
-		$timezone = $this->stream->readInt();
554
-		return $timestamp;
555
-	}
552
+        $timestamp = $this->stream->readDouble();
553
+        $timezone = $this->stream->readInt();
554
+        return $timestamp;
555
+    }
556 556
 
557 557
 
558
-	public function readLongString() {
558
+    public function readLongString() {
559 559
 
560
-		return $this->stream->readLongUTF();
561
-	}
560
+        return $this->stream->readLongUTF();
561
+    }
562 562
 
563 563
 
564
-	public function readXML() {
564
+    public function readXML() {
565 565
 
566
-		return $this->stream->readLongUTF();
567
-	}
566
+        return $this->stream->readLongUTF();
567
+    }
568 568
 
569 569
 
570
-	public function readTypedObject() {
570
+    public function readTypedObject() {
571 571
 
572
-		$className = $this->stream->readUTF();
573
-		return $this->readObject();
574
-	}
572
+        $className = $this->stream->readUTF();
573
+        return $this->readObject();
574
+    }
575 575
 }
576 576
 
577 577
 ?>
Please login to merge, or discard this patch.
main/inc/lib/grade_model.lib.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -248,6 +248,9 @@
 block discarded – undo
248 248
 	    //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
249 249
     }
250 250
 
251
+    /**
252
+     * @param CatForm $form
253
+     */
251 254
     public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null)
252 255
     {
253 256
         if (api_get_setting('gradebook_enable_grade_model') == 'false') {
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * Displays the title + grid
53 53
      */
54
-	public function display()
54
+    public function display()
55 55
     {
56
-		// action links
57
-		echo '<div class="actions" style="margin-bottom:20px">';
56
+        // action links
57
+        echo '<div class="actions" style="margin-bottom:20px">';
58 58
         echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
59
-		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>';
60
-		echo '</div>';
59
+        echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>';
60
+        echo '</div>';
61 61
         echo Display::grid_html('grade_model');
62
-	}
62
+    }
63 63
 
64 64
     /**
65 65
      * Returns a Form validator Obj
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         }
117 117
 
118 118
         $form->addElement('hidden', 'maxvalue', '100');
119
-		$form->addElement('hidden', 'minvalue', '0');
119
+        $form->addElement('hidden', 'minvalue', '0');
120 120
         $renderer = & $form->defaultRenderer();
121 121
 
122 122
         $component_array = array();
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         // Setting the rules
194 194
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
195 195
 
196
-		return $form;
196
+        return $form;
197 197
     }
198 198
 
199 199
     /**
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function save($params, $show_query = false)
218 218
     {
219
-	    $id = parent::save($params, $show_query);
220
-	    if (!empty($id)) {
219
+        $id = parent::save($params, $show_query);
220
+        if (!empty($id)) {
221 221
             foreach ($params['components'] as $component) {
222 222
                 if (!empty($component['title']) && !empty($component['percentage']) && !empty($component['acronym'])) {
223 223
                     $obj = new GradeModelComponents();
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         }
229 229
 
230 230
         //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
231
-   		return $id;
231
+            return $id;
232 232
     }
233 233
 
234 234
     /**
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public function delete($id)
259 259
     {
260
-	    parent::delete($id);
260
+        parent::delete($id);
261 261
     }
262 262
 
263 263
     public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null)
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
     /**
306 306
      * GradeModelComponents constructor.
307 307
      */
308
-	public function __construct()
308
+    public function __construct()
309 309
     {
310 310
         parent::__construct();
311 311
         $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
312
-	}
312
+    }
313 313
 
314 314
     /**
315 315
      * @param array $params
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function save($params, $show_query = false)
320 320
     {
321
-	    $id = parent::save($params, $show_query);
321
+        $id = parent::save($params, $show_query);
322 322
         
323 323
         return $id;
324 324
     }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function __construct()
17 17
     {
18 18
         parent::__construct();
19
-        $this->table =  Database::get_main_table(TABLE_GRADE_MODEL);
19
+        $this->table = Database::get_main_table(TABLE_GRADE_MODEL);
20 20
     }
21 21
 
22 22
     /**
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
     {
56 56
 		// action links
57 57
 		echo '<div class="actions" style="margin-bottom:20px">';
58
-        echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
59
-		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>';
58
+        echo '<a href="grade_models.php">'.Display::return_icon('back.png', get_lang('Back'), '', '32').'</a>';
59
+		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>';
60 60
 		echo '</div>';
61 61
         echo Display::grid_html('grade_model');
62 62
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
         if ($action == 'edit') {
113 113
             if (!empty($components)) {
114
-                $nr_items = count($components) -1;
114
+                $nr_items = count($components) - 1;
115 115
             }
116 116
         }
117 117
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             $form->addElement('hidden', 'components['.$i.'][id]', null);
130 130
 
131 131
             $template_percentage =
132
-            '<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="control-group">
132
+            '<div id='.$i.' style="display: '.(($i <= $nr_items) ? 'inline' : 'none').';" class="control-group">
133 133
                 <p>
134 134
                 <label class="control-label">{label}</label>
135 135
                 <div class="controls">
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 
143 143
             $template_title =
144 144
             '&nbsp{element} <!-- BEGIN error --> <span class="form_error">{error}</span><!-- END error -->
145
-             <a href="javascript:plusItem(' . ($counter+1) . ')">
146
-                <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::return_icon('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'">
145
+             <a href="javascript:plusItem(' . ($counter + 1).')">
146
+                <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="'.Display::return_icon('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'">
147 147
             </a>
148
-            <a href="javascript:minItem(' . ($counter) . ')">
149
-                <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::return_icon('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'">
148
+            <a href="javascript:minItem(' . ($counter).')">
149
+                <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="min-'.$counter.'" src="'.Display::return_icon('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'">
150 150
             </a>
151 151
             </div></p></div>';
152 152
 
Please login to merge, or discard this patch.
main/inc/lib/groupmanager.lib.php 2 patches
Doc Comments   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      * @author Christophe Gesche <[email protected]>
370 370
      * @author Hugues Peeters <[email protected]>
371 371
      * @author Bart Mollet
372
-     * @param  mixed  $groupIdList - group(s) to delete. It can be a single id
372
+     * @param  mixed  $group_ids - group(s) to delete. It can be a single id
373 373
      *                                (int) or a list of id (array).
374 374
      * @param string $course_code Default is current course
375 375
      * @return integer              - number of groups deleted.
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
      * @param bool      Whether self registration is allowed or not
574 574
      * @param bool      Whether self unregistration is allowed or not
575 575
      * @param int       $categoryId
576
-     * @return bool     TRUE if properties are successfully changed, false otherwise
576
+     * @return Statement|null     TRUE if properties are successfully changed, false otherwise
577 577
      */
578 578
     public static function set_group_properties(
579 579
         $group_id,
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      * @param int $group_id The id of the group
725 725
      * @param string $course_code The course in which the group is (default =
726 726
      * current course)
727
-     * @return array The category
727
+     * @return integer The category
728 728
      */
729 729
     public static function get_category_from_group($group_id, $course_code = null)
730 730
     {
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
      * Create group category
787 787
      * @param string $title The title of the new category
788 788
      * @param string $description The description of the new category
789
-     * @param bool $self_registration_allowed
790
-     * @param bool $self_unregistration_allowed
791
-     * @param int $max_number_of_students
789
+     * @param integer $self_registration_allowed
790
+     * @param integer $self_unregistration_allowed
791
+     * @param int $maximum_number_of_students
792 792
      * @param int $groups_per_user
793 793
      */
794 794
     public static function create_category(
@@ -994,6 +994,8 @@  discard block
 block discarded – undo
994 994
      * @param int $limit
995 995
      * @param bool $getCount
996 996
      * @param int $courseId
997
+     * @param string $column
998
+     * @param string $direction
997 999
      * @return array list of user id
998 1000
      */
999 1001
     public static function get_users(
@@ -1172,7 +1174,7 @@  discard block
 block discarded – undo
1172 1174
      *         Hugues Peeters     <[email protected]> - original version
1173 1175
      * @author Roan Embrechts - virtual course support, code cleaning
1174 1176
      * @author Bart Mollet - code cleaning, use other GroupManager-functions
1175
-     * @return void
1177
+     * @return false|null
1176 1178
      */
1177 1179
     public static function fill_groups($group_ids)
1178 1180
     {
@@ -1625,7 +1627,7 @@  discard block
 block discarded – undo
1625 1627
      * Unsubscribe user(s) from a specified group in current course
1626 1628
      * @param mixed $user_ids Can be an array with user-id's or a single user-id
1627 1629
      * @param int $group_id
1628
-     * @return bool TRUE if successful
1630
+     * @return boolean|null TRUE if successful
1629 1631
      */
1630 1632
     public static function unsubscribe_users($user_ids, $group_id)
1631 1633
     {
@@ -1644,7 +1646,7 @@  discard block
 block discarded – undo
1644 1646
 
1645 1647
     /**
1646 1648
      * Unsubscribe all users from one or more groups
1647
-     * @param mixed $group_id Can be an array with group-id's or a single group-id
1649
+     * @param mixed $group_ids Can be an array with group-id's or a single group-id
1648 1650
      * @return bool TRUE if successful
1649 1651
      */
1650 1652
     public static function unsubscribe_all_users($group_ids)
@@ -1676,7 +1678,7 @@  discard block
 block discarded – undo
1676 1678
 
1677 1679
     /**
1678 1680
      * Unsubscribe all tutors from one or more groups
1679
-     * @param mixed $group_id Can be an array with group-id's or a single group-id
1681
+     * @param mixed $group_ids Can be an array with group-id's or a single group-id
1680 1682
      * @see unsubscribe_all_users. This function is almost an exact copy of that function.
1681 1683
      * @return bool TRUE if successful
1682 1684
      * @author Patrick Cool <[email protected]>, Ghent University
@@ -1861,6 +1863,7 @@  discard block
 block discarded – undo
1861 1863
      *
1862 1864
      * @param $user_array_in list of users (must be sorted).
1863 1865
      * @param string $compare_field, the field to be compared
1866
+     * @param string $compare_field
1864 1867
      */
1865 1868
     public static function filter_duplicates($user_array_in, $compare_field)
1866 1869
     {
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
             $sql = "UPDATE $table_group SET id = iid WHERE iid = $lastId";
212 212
             Database::query($sql);
213 213
 
214
-            $desired_dir_name= '/'.api_replace_dangerous_char($name).'_groupdocs';
215
-            $my_path = api_get_path(SYS_COURSE_PATH) . $currentCourseRepository . '/document';
214
+            $desired_dir_name = '/'.api_replace_dangerous_char($name).'_groupdocs';
215
+            $my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';
216 216
 
217 217
             $newFolderData = create_unexisting_directory(
218 218
                 $_course,
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
                 $values['default_view_type_group']['default_view_type'] = api_get_setting('default_forum_view');
276 276
                 $values['group_forum'] = $lastId;
277 277
                 if ($forumState == '1') {
278
-                    $values['public_private_group_forum_group']['public_private_group_forum']='public';
278
+                    $values['public_private_group_forum_group']['public_private_group_forum'] = 'public';
279 279
                 } elseif ($forumState == '2') {
280
-                    $values['public_private_group_forum_group']['public_private_group_forum']='private';
280
+                    $values['public_private_group_forum_group']['public_private_group_forum'] = 'private';
281 281
                 } elseif ($forumState == '0') {
282
-                    $values['public_private_group_forum_group']['public_private_group_forum']='unavailable';
282
+                    $values['public_private_group_forum_group']['public_private_group_forum'] = 'unavailable';
283 283
                 }
284 284
                 store_forum($values);
285 285
             }
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
             1
311 311
         );
312 312
         $users = self::get_users($group_id);
313
-        $group_ids = array ();
313
+        $group_ids = array();
314 314
 
315
-        for ($group_nr = 1; $group_nr <= $number_of_groups; $group_nr ++) {
315
+        for ($group_nr = 1; $group_nr <= $number_of_groups; $group_nr++) {
316 316
             $group_ids[] = self::create_group(
317 317
                 get_lang('Subgroup').' '.$group_nr,
318 318
                 $category_id,
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                 0,
357 357
                 count($users_ids)
358 358
             );
359
-            self::subscribe_users($users_ids,$group_id);
359
+            self::subscribe_users($users_ids, $group_id);
360 360
             $group_ids[] = $group_id;
361 361
         }
362 362
         return $group_ids;
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
         $group_table = Database:: get_course_table(TABLE_GROUP);
382 382
         $forum_table = Database:: get_course_table(TABLE_FORUM);
383 383
 
384
-        $group_ids = is_array($group_ids) ? $group_ids : array ($group_ids);
385
-        $group_ids = array_map('intval',$group_ids);
384
+        $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
385
+        $group_ids = array_map('intval', $group_ids);
386 386
 
387 387
         if (api_is_course_coach()) {
388 388
             //a coach can only delete courses from his session
389 389
             for ($i = 0; $i < count($group_ids); $i++) {
390
-                if (!api_is_element_in_the_session(TOOL_GROUP,$group_ids[$i])) {
391
-                    array_splice($group_ids,$i,1);
390
+                if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
391
+                    array_splice($group_ids, $i, 1);
392 392
                     $i--;
393 393
                 }
394 394
             }
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         } elseif ($forum_state === 0) {
624 624
             $sql2 .= " forum_group_public_private='unavailable' ";
625 625
         }
626
-        $sql2 .=" WHERE c_id = $course_id AND forum_of_group=".$group_id;
626
+        $sql2 .= " WHERE c_id = $course_id AND forum_of_group=".$group_id;
627 627
         Database::query($sql2);
628 628
         return $result;
629 629
     }
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
     public static function get_categories($course_code = null)
654 654
     {
655 655
         $course_info = api_get_course_info($course_code);
656
-        $course_id     = $course_info['real_id'];
656
+        $course_id = $course_info['real_id'];
657 657
         $table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY);
658 658
         $sql = "SELECT * FROM $table_group_cat
659 659
                 WHERE c_id = $course_id
660 660
                 ORDER BY display_order";
661 661
         $res = Database::query($sql);
662
-        $cats = array ();
662
+        $cats = array();
663 663
         while ($cat = Database::fetch_array($res)) {
664 664
             $cats[] = $cat;
665 665
         }
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
                 WHERE c_id = $course_id AND category_id='".$cat_id."'";
772 772
         $res = Database::query($sql);
773 773
         if (Database::num_rows($res) > 0) {
774
-            $groups_to_delete = array ();
774
+            $groups_to_delete = array();
775 775
             while ($group = Database::fetch_object($res)) {
776 776
                 $groups_to_delete[] = $group->id;
777 777
             }
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
      */
940 940
     public static function get_current_max_groups_per_user($category_id = null, $course_code = null)
941 941
     {
942
-        $course_info = api_get_course_info ($course_code);
942
+        $course_info = api_get_course_info($course_code);
943 943
         $group_table = Database :: get_course_table(TABLE_GROUP);
944 944
         $group_user_table = Database :: get_course_table(TABLE_GROUP_USER);
945 945
         $sql = 'SELECT COUNT(gu.group_id) AS current_max
@@ -1182,17 +1182,17 @@  discard block
 block discarded – undo
1182 1182
     {
1183 1183
         $_course = api_get_course_info();
1184 1184
 
1185
-        $group_ids = is_array($group_ids) ? $group_ids : array ($group_ids);
1185
+        $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
1186 1186
         $group_ids = array_map('intval', $group_ids);
1187 1187
 
1188 1188
         if (api_is_course_coach()) {
1189
-            for ($i=0 ; $i < count($group_ids) ; $i++) {
1190
-                if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])){
1191
-                    array_splice($group_ids,$i,1);
1189
+            for ($i = 0; $i < count($group_ids); $i++) {
1190
+                if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
1191
+                    array_splice($group_ids, $i, 1);
1192 1192
                     $i--;
1193 1193
                 }
1194 1194
             }
1195
-            if (count($group_ids)==0) {
1195
+            if (count($group_ids) == 0) {
1196 1196
                 return false;
1197 1197
             }
1198 1198
         }
@@ -1231,9 +1231,9 @@  discard block
 block discarded – undo
1231 1231
          * Retrieve course users (reverse) ordered by the number
1232 1232
          * of group they are already enrolled
1233 1233
          */
1234
-        for ($i = 0; $i < count($complete_user_list); $i ++) {
1234
+        for ($i = 0; $i < count($complete_user_list); $i++) {
1235 1235
             //find # of groups the user is enrolled in
1236
-            $number_of_groups = self :: user_in_number_of_groups($complete_user_list[$i]["user_id"], (isset($category['id'])?$category['id']:null));
1236
+            $number_of_groups = self :: user_in_number_of_groups($complete_user_list[$i]["user_id"], (isset($category['id']) ? $category['id'] : null));
1237 1237
             //add # of groups to user list
1238 1238
             $complete_user_list[$i]['number_groups_left'] = $number_groups_per_user - $number_of_groups;
1239 1239
         }
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
         //now sort by # of group left
1247 1247
         $complete_user_list = TableSort :: sort_table($complete_user_list, 'number_groups_left', SORT_DESC);
1248
-        $userToken = array ();
1248
+        $userToken = array();
1249 1249
         foreach ($complete_user_list as $this_user) {
1250 1250
             if ($this_user['number_groups_left'] > 0) {
1251 1251
                 $userToken[$this_user['user_id']] = $this_user['number_groups_left'];
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
                 if ($category['groups_per_user'] == self::GROUP_PER_MEMBER_NO_LIMIT) {
1441 1441
                     $category['groups_per_user'] = self::INFINITE;
1442 1442
                 }
1443
-                $result = self:: user_in_number_of_groups($user_id, $category['id'] ) < $category['groups_per_user'];
1443
+                $result = self:: user_in_number_of_groups($user_id, $category['id']) < $category['groups_per_user'];
1444 1444
                 if ($result == false) {
1445 1445
                     return false;
1446 1446
                 }
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
                     tg.group_id='".$group_id."' AND
1552 1552
                     tg.user_id=u.user_id".$order_clause;
1553 1553
         $db_result = Database::query($sql);
1554
-        $users = array ();
1554
+        $users = array();
1555 1555
         while ($user = Database::fetch_object($db_result)) {
1556 1556
             if (!$id_only) {
1557 1557
                 $member['user_id'] = $user->user_id;
@@ -1616,8 +1616,8 @@  discard block
 block discarded – undo
1616 1616
         foreach ($user_ids as $user_id) {
1617 1617
             $user_id = intval($user_id);
1618 1618
             if (self::can_user_subscribe($user_id, $group_id, false)) {
1619
-                $sql = "INSERT INTO " . $table_group_tutor . " (c_id, user_id, group_id)
1620
-                        VALUES ('$course_id', '" . $user_id . "', '" . $group_id . "')";
1619
+                $sql = "INSERT INTO ".$table_group_tutor." (c_id, user_id, group_id)
1620
+                        VALUES ('$course_id', '".$user_id."', '".$group_id."')";
1621 1621
                 $result &= Database::query($sql);
1622 1622
             }
1623 1623
         }
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
      */
1634 1634
     public static function unsubscribe_users($user_ids, $group_id)
1635 1635
     {
1636
-        $user_ids = is_array($user_ids) ? $user_ids : array ($user_ids);
1636
+        $user_ids = is_array($user_ids) ? $user_ids : array($user_ids);
1637 1637
         $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
1638 1638
         $group_id = intval($group_id);
1639 1639
         $course_id = api_get_course_int_id();
@@ -2179,7 +2179,7 @@  discard block
 block discarded – undo
2179 2179
          * Retrieve course users (reverse) ordered by the number
2180 2180
          * of group they are already enrolled
2181 2181
          */
2182
-        for ($i = 0; $i < count($complete_user_list); $i ++) {
2182
+        for ($i = 0; $i < count($complete_user_list); $i++) {
2183 2183
             // find # of groups the user is enrolled in
2184 2184
             $number_of_groups = self:: user_in_number_of_groups(
2185 2185
                 $complete_user_list[$i]["user_id"],
@@ -2312,14 +2312,14 @@  discard block
 block discarded – undo
2312 2312
                 !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)
2313 2313
             ) {
2314 2314
                 $edit_actions = '<a href="'.$url.'settings.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'"  title="'.get_lang('Edit').'">'.
2315
-                    Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
2315
+                    Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2316 2316
 
2317 2317
                 if ($this_group['status'] == 1) {
2318
-                    $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true,false) . '&category=' . $category_id . '&action=set_invisible&id=' . $this_group['id'] . '" title="' . get_lang('Hide') . '">' .
2319
-                        Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
2318
+                    $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=set_invisible&id='.$this_group['id'].'" title="'.get_lang('Hide').'">'.
2319
+                        Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2320 2320
                 } else {
2321
-                    $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&action=set_visible&id=' . $this_group['id'] . '" title="' . get_lang('Show') . '">' .
2322
-                        Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
2321
+                    $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=set_visible&id='.$this_group['id'].'" title="'.get_lang('Show').'">'.
2322
+                        Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2323 2323
                 }
2324 2324
 
2325 2325
                 $edit_actions .= '<a href="'.$url.'member_settings.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'"  title="'.get_lang('GroupMembers').'">'.
@@ -2332,10 +2332,10 @@  discard block
 block discarded – undo
2332 2332
                     Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';*/
2333 2333
 
2334 2334
                 $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=fill_one&id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('FillGroup').'">'.
2335
-                    Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
2335
+                    Display::return_icon('fill.png', get_lang('FillGroup'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2336 2336
 
2337 2337
                 $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=delete_one&id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'.
2338
-                    Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
2338
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2339 2339
 
2340 2340
                 $row[] = $edit_actions;
2341 2341
             }
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
         $activeTutor = null;
2708 2708
         $activeMember = null;
2709 2709
 
2710
-        switch($default) {
2710
+        switch ($default) {
2711 2711
             case 'settings':
2712 2712
                 $activeSettings = 'active';
2713 2713
                 break;
Please login to merge, or discard this patch.
main/inc/lib/hook/HookManagement.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
 
139 139
     /**
140 140
      * Return a list an associative array where keys are the active hook observer class name
141
-     * @param $eventName
141
+     * @param string $eventName
142 142
      *
143 143
      * @return array
144 144
      */
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
     public function listHookObservers($eventName)
146 146
     {
147 147
         $array = array();
148
-        $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
149
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
150
-            ' ON hc.hook_event_id = he.id ' .
151
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
148
+        $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
149
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
150
+            ' ON hc.hook_event_id = he.id '.
151
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
152 152
             ' ON hc.hook_observer_id = ho.id ';
153 153
         $columns = 'ho.class_name, ho.path, ho.plugin_name, hc.enabled';
154 154
         $where = array('where' => array('he.class_name = ? ' => $eventName, 'AND hc.enabled = ? ' => 1));
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
     public function listAllHookCalls()
203 203
     {
204 204
         $array = array();
205
-        $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
206
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
207
-            ' ON hc.hook_event_id = he.id ' .
208
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
205
+        $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
206
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
207
+            ' ON hc.hook_event_id = he.id '.
208
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
209 209
             ' ON hc.hook_observer_id = ho.id ';
210 210
         $columns = 'he.class_name AS event_class_name, ho.class_name AS observer_class_name, hc.id AS id, hc.type AS type';
211 211
         $rows = Database::select($columns, $joinTable);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         if (isset($eventName) && !isset($this->hookEvents[$eventName])) {
232 232
             $attributes = array(
233 233
                 'class_name' => $eventName,
234
-                'description' => get_lang('HookDescription' . $eventName),
234
+                'description' => get_lang('HookDescription'.$eventName),
235 235
             );
236 236
             $id = Database::insert($this->tables[TABLE_HOOK_EVENT], $attributes);
237 237
             $this->hookEvents[$eventName] = $id;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         // Check if exists hook observer
241 241
         if (isset($observerClassName) &&
242 242
             !isset($this->hookObservers[$observerClassName])
243
-        ){
243
+        ) {
244 244
             $object = $observerClassName::create();
245 245
             $attributes = array(
246 246
                 'class_name' => $observerClassName,
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
         $eventName = Database::escape_string($eventName);
339 339
         $observerClassName($observerClassName);
340 340
         $type = Database::escape_string($type);
341
-        $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
342
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
343
-            ' ON hc.hook_event_id = he.id ' .
344
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
341
+        $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
342
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
343
+            ' ON hc.hook_event_id = he.id '.
344
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
345 345
             ' ON hc.hook_observer_id = ho.id ';
346 346
         $row = Database::select(
347 347
             'id',
Please login to merge, or discard this patch.
main/inc/lib/login.lib.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -266,6 +266,7 @@  discard block
 block discarded – undo
266 266
      * @global bool   $is_platformAdmin
267 267
      * @global bool   $is_allowedCreateCourse
268 268
      * @global object $_user
269
+     * @param boolean $reset
269 270
      */
270 271
     public static function init_user($user_id, $reset)
271 272
     {
@@ -355,7 +356,7 @@  discard block
 block discarded – undo
355 356
      * @global type $is_allowed_in_course
356 357
      *
357 358
      * @param type $course_id
358
-     * @param type $reset
359
+     * @param boolean $reset
359 360
      */
360 361
     static function init_course($course_id, $reset)
361 362
     {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -852,14 +852,14 @@  discard block
 block discarded – undo
852 852
             $email = false;
853 853
         }
854 854
 
855
-		if ($email) {
856
-			$condition = "LOWER(email) = '".Database::escape_string($username)."' ";
857
-		} else {
855
+        if ($email) {
856
+            $condition = "LOWER(email) = '".Database::escape_string($username)."' ";
857
+        } else {
858 858
             $condition = "LOWER(username) = '".Database::escape_string($username)."'";
859 859
         }
860 860
 
861
-		$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
862
-		$query = "SELECT 
861
+        $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
862
+        $query = "SELECT 
863 863
 		            user_id AS uid, 
864 864
 		            lastname AS lastName, 
865 865
 		            firstname AS firstName, 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
                     auth_source
875 875
 				 FROM $tbl_user
876 876
 				 WHERE ( $condition AND active = 1) ";
877
-		$result = Database::query($query);
877
+        $result = Database::query($query);
878 878
         $num_rows = Database::num_rows($result);
879 879
         if ($result && $num_rows > 0) {
880 880
             return Database::fetch_assoc($result);
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
             if ($by_username) {
38 38
                 $secret_word = self::get_secret_word($user['email']);
39 39
                 if ($reset) {
40
-                    $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $user['uid'];
40
+                    $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$user['uid'];
41 41
                 } else {
42
-                    $reset_link = get_lang('Pass') . " : $user[password]";
42
+                    $reset_link = get_lang('Pass')." : $user[password]";
43 43
                 }
44
-                $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . '';
44
+                $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.'';
45 45
 
46 46
                 if ($user_account_list) {
47
-                    $user_account_list = "\n-----------------------------------------------\n" . $user_account_list;
47
+                    $user_account_list = "\n-----------------------------------------------\n".$user_account_list;
48 48
                 }
49 49
             } else {
50 50
                 foreach ($user as $this_user) {
51 51
                     $secret_word = self::get_secret_word($this_user['email']);
52 52
                     if ($reset) {
53
-                        $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $this_user['uid'];
53
+                        $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$this_user['uid'];
54 54
                     } else {
55
-                        $reset_link = get_lang('Pass') . " : $this_user[password]";
55
+                        $reset_link = get_lang('Pass')." : $this_user[password]";
56 56
                     }
57
-                    $user_account_list[] = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $this_user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . '';
57
+                    $user_account_list[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$this_user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.'';
58 58
                 }
59 59
                 if ($user_account_list) {
60 60
                     $user_account_list = implode("\n-----------------------------------------------\n", $user_account_list);
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
             if (!$by_username) {
65 65
                 $user = $user[0];
66 66
             }
67
-            $reset_link = get_lang('Pass') . " : $user[password]";
68
-            $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . $reset_link . '';
67
+            $reset_link = get_lang('Pass')." : $user[password]";
68
+            $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.'';
69 69
         }
70 70
         return $user_account_list;
71 71
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public static function send_password_to_user($user, $by_username = false)
80 80
     {
81
-        $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
81
+        $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
82 82
 
83 83
         if ($by_username) { // Show only for lost password
84 84
             $user_account_list = self::get_user_account_list($user, false, $by_username); // BODY
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             }
98 98
         }
99 99
 
100
-        $email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n$user_account_list";
100
+        $email_body = get_lang('YourAccountParam')." ".$portal_url."\n\n$user_account_list";
101 101
         // SEND MESSAGE
102 102
         $sender_name = api_get_person_name(
103 103
             api_get_setting('administratorName'),
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public static function handle_encrypted_password($user, $by_username = false)
138 138
     {
139
-        $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
139
+        $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
140 140
 
141 141
         if ($by_username) {
142 142
         // Show only for lost password
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
             $user_account_list = self::get_user_account_list($user, true); // BODY
147 147
             $email_to = $user[0]['email'];
148 148
         }
149
-        $email_body = get_lang('DearUser') . " :\n" . get_lang('password_request') . "\n";
150
-        $email_body .= $user_account_list . "\n-----------------------------------------------\n\n";
149
+        $email_body = get_lang('DearUser')." :\n".get_lang('password_request')."\n";
150
+        $email_body .= $user_account_list."\n-----------------------------------------------\n\n";
151 151
         $email_body .= get_lang('PasswordEncryptedForSecurity');
152 152
 
153
-        $email_body .= "\n\n" . get_lang('SignatureFormula') . ",\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('PlataformAdmin') . " - " . api_get_setting('siteName');
153
+        $email_body .= "\n\n".get_lang('SignatureFormula').",\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n".get_lang('PlataformAdmin')." - ".api_get_setting('siteName');
154 154
 
155 155
         $sender_name = api_get_person_name(
156 156
             api_get_setting('administratorName'),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                     password,
252 252
                     email,
253 253
                     auth_source
254
-                FROM " . $tbl_user . "
254
+                FROM " . $tbl_user."
255 255
                 WHERE user_id = $id";
256 256
         $result = Database::query($sql);
257 257
         $num_rows = Database::num_rows($result);
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                         ON user.user_id = a.user_id
310 310
                         LEFT JOIN $track_e_login login
311 311
                         ON user.user_id  = login.login_user_id
312
-                        WHERE user.user_id = '" . $_user['user_id'] . "'
312
+                        WHERE user.user_id = '".$_user['user_id']."'
313 313
                         ORDER BY login.login_date DESC LIMIT 1";
314 314
 
315 315
                 $result = Database::query($sql);
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                     Session::write('is_platformAdmin', $is_platformAdmin);
340 340
                     Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
341 341
                 } else {
342
-                    header('location:' . api_get_path(WEB_PATH));
342
+                    header('location:'.api_get_path(WEB_PATH));
343 343
                     //exit("WARNING UNDEFINED UID !! ");
344 344
                 }
345 345
             } else { // no uid => logout or Anonymous
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
         global $_course;
388 388
         global $_real_cid;
389 389
 
390
-        global $is_courseAdmin;  //course teacher
391
-        global $is_courseTutor;  //course teacher - some rights
392
-        global $is_courseCoach;  //course coach
390
+        global $is_courseAdmin; //course teacher
391
+        global $is_courseTutor; //course teacher - some rights
392
+        global $is_courseCoach; //course coach
393 393
         global $is_courseMember; //course student
394 394
         global $is_sessionAdmin;
395 395
         global $is_allowed_in_course;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
                     if (!empty($_GET['id_session'])) {
448 448
                         $_SESSION['id_session'] = intval($_GET['id_session']);
449
-                        $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"';
449
+                        $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"';
450 450
                         $rs = Database::query($sql);
451 451
                         list($_SESSION['session_name']) = Database::fetch_array($rs);
452 452
                     } else {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
                     }
463 463
                 } else {
464 464
                     //exit("WARNING UNDEFINED CID !! ");
465
-                    header('location:' . api_get_path(WEB_PATH));
465
+                    header('location:'.api_get_path(WEB_PATH));
466 466
                 }
467 467
             } else {
468 468
                 Session::erase('_cid');
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         } else {
490 490
             // Continue with the previous values
491 491
             if (empty($_SESSION['_course']) OR empty($_SESSION['_cid'])) { //no previous values...
492
-                $_cid = -1;        //set default values that will be caracteristic of being unset
492
+                $_cid = -1; //set default values that will be caracteristic of being unset
493 493
                 $_course = -1;
494 494
             } else {
495 495
                 $_cid = $_SESSION['_cid'];
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                 // Moreover, if we want to track a course with another session it can be usefull
500 500
                 if (!empty($_GET['id_session'])) {
501 501
                     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
502
-                    $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"';
502
+                    $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"';
503 503
                     $rs = Database::query($sql);
504 504
                     list($_SESSION['session_name']) = Database::fetch_array($rs);
505 505
                     $_SESSION['id_session'] = intval($_GET['id_session']);
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
                             //But only if the login date is < than now + max_life_time
540 540
                             $sql = "SELECT course_access_id FROM $course_tracking_table
541 541
                                     WHERE
542
-                                        user_id     = " . intval($_user ['user_id']) . " AND
542
+                                        user_id     = ".intval($_user ['user_id'])." AND
543 543
                                         c_id = '".api_get_course_int_id()."' AND
544
-                                        session_id  = " . api_get_session_id() . " AND
544
+                                        session_id  = " . api_get_session_id()." AND
545 545
                                         login_course_date > now() - INTERVAL $session_lifetime SECOND
546 546
                                     ORDER BY login_course_date DESC LIMIT 0,1";
547 547
                             $result = Database::query($sql);
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
                                 //We update the course tracking table
552 552
                                 $sql = "UPDATE $course_tracking_table
553 553
                                         SET logout_course_date = '$time', counter = counter+1
554
-                                        WHERE course_access_id = " . intval($i_course_access_id) . " AND session_id = " . api_get_session_id();
554
+                                        WHERE course_access_id = ".intval($i_course_access_id)." AND session_id = ".api_get_session_id();
555 555
                                 Database::query($sql);
556 556
                             } else {
557
-                                $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)" .
558
-                                        "VALUES('" . api_get_course_int_id() . "', '" . $_user['user_id'] . "', '$time', '$time', '1','" . api_get_session_id() . "')";
557
+                                $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)".
558
+                                        "VALUES('".api_get_course_int_id()."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')";
559 559
                                 Database::query($sql);
560 560
                             }
561 561
                         }
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                 $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
584 584
                 $sql = "SELECT * FROM $course_user_table
585 585
                        WHERE
586
-                        user_id  = '" . $user_id . "' AND
586
+                        user_id  = '".$user_id."' AND
587 587
                         relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
588 588
                         course_code = '$course_id'";
589 589
                 $result = Database::query($sql);
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
                         );
606 606
 
607 607
                         if (!$user_is_subscribed) {
608
-                            $url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id;
609
-                            header('Location: ' . $url);
608
+                            $url = api_get_path(WEB_CODE_PATH).'course_info/legal.php?course_code='.$_course['code'].'&session_id='.$session_id;
609
+                            header('Location: '.$url);
610 610
                             exit;
611 611
                         }
612 612
                     }
@@ -647,11 +647,11 @@  discard block
 block discarded – undo
647 647
                         } else {
648 648
                             //Im a coach or a student?
649 649
                             $sql = "SELECT user_id, status
650
-                                    FROM " . $tbl_session_course_user . "
650
+                                    FROM " . $tbl_session_course_user."
651 651
                                     WHERE
652 652
                                         c_id = '$_cid' AND
653
-                                        user_id = '" . $user_id . "' AND
654
-                                        session_id = '" . $session_id . "'
653
+                                        user_id = '".$user_id."' AND
654
+                                        session_id = '" . $session_id."'
655 655
                                     LIMIT 1";
656 656
                             $result = Database::query($sql);
657 657
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
         if ($reset) { // session data refresh requested
798 798
             if ($group_id && $_cid && !empty($_course['real_id'])) { // have keys to search data
799 799
                 $group_table = Database::get_course_table(TABLE_GROUP);
800
-                $sql = "SELECT * FROM $group_table WHERE c_id = " . $_course['real_id'] . " AND id = '$group_id'";
800
+                $sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$group_id'";
801 801
                 $result = Database::query($sql);
802 802
                 if (Database::num_rows($result) > 0) { // This group has recorded status related to this course
803 803
                     $gpData = Database::fetch_array($result);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
      */
851 851
     public static function get_user_accounts_by_username($username)
852 852
     {
853
-        if (strpos($username,'@')){
853
+        if (strpos($username, '@')) {
854 854
             $username = api_strtolower($username);
855 855
             $email = true;
856 856
         } else {
Please login to merge, or discard this patch.
main/inc/lib/model.lib.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -25,6 +25,7 @@
 block discarded – undo
25 25
 
26 26
     /**
27 27
      * Useful finder - experimental akelos like only use in notification.lib.php send function
28
+     * @param string $type
28 29
      */
29 30
     public function find($type, $options = null)
30 31
     {
Please login to merge, or discard this patch.
main/inc/lib/myspace.lib.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -634,7 +634,6 @@  discard block
 block discarded – undo
634 634
      * @param   int $sessionId  The session ID
635 635
      * @param   int $courseId   The course ID
636 636
      * @param   int $exerciseId The quiz ID
637
-     * @param   int $answer Answer status (0 = incorrect, 1 = correct, 2 = both)
638 637
      * @return  string  HTML array of results formatted for gridJS
639 638
      * @author César Perales <[email protected]>, Beeznest Team
640 639
      */
@@ -1222,6 +1221,7 @@  discard block
 block discarded – undo
1222 1221
      * @param int Number of items to select
1223 1222
      * @param string Column to order on
1224 1223
      * @param string Order direction
1224
+     * @param integer $number_of_items
1225 1225
      * @return array Results
1226 1226
      */
1227 1227
     public static function get_course_data_tracking_overview($from, $number_of_items, $column, $direction)
@@ -1556,6 +1556,7 @@  discard block
 block discarded – undo
1556 1556
      * @param int Number of items to select
1557 1557
      * @param string Column to order on
1558 1558
      * @param string Order direction
1559
+     * @param integer $number_of_items
1559 1560
      * @return array Results
1560 1561
      */
1561 1562
     public static function get_session_data_tracking_overview($from, $number_of_items, $column, $direction)
@@ -1576,7 +1577,6 @@  discard block
 block discarded – undo
1576 1577
     /**
1577 1578
      * Fills in session reporting data
1578 1579
      *
1579
-     * @param integer $user_id the id of the user
1580 1580
      * @param array $url_params additonal url parameters
1581 1581
      * @param array $row the row information (the other columns)
1582 1582
      * @return string html code
@@ -2206,6 +2206,7 @@  discard block
 block discarded – undo
2206 2206
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
2207 2207
      * @version Dokeos 1.8.6
2208 2208
      * @since October 2008
2209
+     * @param integer $number_of_items
2209 2210
      */
2210 2211
     public static function get_user_data_tracking_overview($from, $number_of_items, $column, $direction)
2211 2212
     {
@@ -2308,7 +2309,6 @@  discard block
 block discarded – undo
2308 2309
     /**
2309 2310
      * Checks if there are repeted users in a given array
2310 2311
      * @param  array $usernames list of the usernames in the uploaded file
2311
-     * @param  array $user_array['username'] and $user_array['sufix'] where sufix is the number part in a login i.e -> jmontoya2
2312 2312
      * @return array with the $usernames array and the $user_array array
2313 2313
      * @author Julio Montoya Armas
2314 2314
      */
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2097,7 +2097,9 @@
 block discarded – undo
2097 2097
                 FROM $tbl_course course
2098 2098
                 WHERE course.code IN (".implode(',',$courses_code).")";
2099 2099
 
2100
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2100
+        if (!in_array($direction, array('ASC','DESC'))) {
2101
+            $direction = 'ASC';
2102
+        }
2101 2103
 
2102 2104
         $column = intval($column);
2103 2105
         $from = intval($from);
Please login to merge, or discard this patch.
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $session_id  = intval($session_id);
135 135
 
136 136
         $sql = 'SELECT login_course_date, logout_course_date
137
-                FROM ' . $tbl_track_course . '
137
+                FROM ' . $tbl_track_course.'
138 138
                 WHERE
139 139
                     user_id = '.$user_id.' AND
140 140
                     c_id = '.$courseId.' AND
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         foreach ($course_list as $course_item) {
174 174
             $courseInfo = api_get_course_info($course_item['code']);
175 175
             $courseId = $courseInfo['real_id'];
176
-            $new_course_list[] =  '"'.$courseId.'"';
176
+            $new_course_list[] = '"'.$courseId.'"';
177 177
         }
178 178
         $course_list = implode(', ', $new_course_list);
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             return false;
182 182
         }
183 183
         $sql = 'SELECT login_course_date, logout_course_date, c_id
184
-                FROM ' . $tbl_track_course . '
184
+                FROM ' . $tbl_track_course.'
185 185
                 WHERE
186 186
                     user_id = '.$user_id.' AND
187 187
                     c_id IN ('.$course_list.') AND
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             // student score
260 260
             $avg_score = Tracking :: get_avg_student_score($user_id, $courseCode);
261 261
             if (is_numeric($avg_score)) {
262
-                $avg_score = round($avg_score,2);
262
+                $avg_score = round($avg_score, 2);
263 263
             } else {
264 264
                 $$avg_score = '-';
265 265
             }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
297 297
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
298
-        $t_head .=      '<tr>';
298
+        $t_head .= '<tr>';
299 299
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
300 300
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
301 301
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         $addparams = array('view' => 'admin', 'display' => 'user');
315 315
 
316
-        $table = new SortableTable('tracking_user_overview', array('MySpace','get_number_of_users_tracking_overview'), array('MySpace','get_user_data_tracking_overview'), 0);
316
+        $table = new SortableTable('tracking_user_overview', array('MySpace', 'get_number_of_users_tracking_overview'), array('MySpace', 'get_user_data_tracking_overview'), 0);
317 317
         $table->additional_parameters = $addparams;
318 318
 
319 319
         $table->set_header(0, get_lang('OfficialCode'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         }
327 327
         $table->set_header(3, get_lang('LoginName'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
328 328
         $table->set_header(4, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
329
-        $table->set_column_filter(4, array('MySpace','course_info_tracking_filter'));
329
+        $table->set_column_filter(4, array('MySpace', 'course_info_tracking_filter'));
330 330
         $table->display();
331 331
     }
332 332
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $table -> set_header(7, get_lang('Sessions'), false);
372 372
 
373 373
         if ($is_western_name_order) {
374
-            $csv_header[] = array (
374
+            $csv_header[] = array(
375 375
                 get_lang('FirstName', ''),
376 376
                 get_lang('LastName', ''),
377 377
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                 get_lang('NumberOfSessions', '')
382 382
             );
383 383
         } else {
384
-            $csv_header[] = array (
384
+            $csv_header[] = array(
385 385
                 get_lang('LastName', ''),
386 386
                 get_lang('FirstName', ''),
387 387
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 
524 524
         if ($tracking_column != 3) {
525 525
             if ($tracking_direction == 'DESC') {
526
-                usort($all_datas, array('MySpace','rsort_users'));
526
+                usort($all_datas, array('MySpace', 'rsort_users'));
527 527
             } else {
528
-                usort($all_datas, array('MySpace','sort_users'));
528
+                usort($all_datas, array('MySpace', 'sort_users'));
529 529
             }
530 530
         }
531 531
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
         /**
585 585
          * Column config
586 586
          */
587
-        $column_model   = array(
587
+        $column_model = array(
588 588
             array(
589 589
                 'name' => 'username',
590 590
                 'index' => 'username',
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
         $action_links = '';
627 627
         // jqgrid will use this URL to do the selects
628
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
628
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
629 629
 
630 630
         //Table Id
631 631
         $tableId = 'lpProgress';
@@ -647,11 +647,11 @@  discard block
 block discarded – undo
647 647
             true
648 648
         );
649 649
 
650
-        $return = '<script>$(function() {'. $table .
650
+        $return = '<script>$(function() {'.$table.
651 651
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
652 652
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
653 653
                        caption:"",
654
-                       title:"' . get_lang('ExportExcel') . '",
654
+                       title:"' . get_lang('ExportExcel').'",
655 655
                        onClickButton : function () {
656 656
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
657 657
                        }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
         /**
702 702
          * Column config
703 703
          */
704
-        $column_model   = array(
704
+        $column_model = array(
705 705
             array('name'=>'session', 'index'=>'session', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
706 706
             array('name'=>'exercise_id', 'index'=>'exercise_id', 'align'=>'left', 'search' => 'true'),
707 707
             array('name'=>'quiz_title', 'index'=>'quiz_title', 'align'=>'left', 'search' => 'true'),
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         //get dynamic column names
719 719
 
720 720
         // jqgrid will use this URL to do the selects
721
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . $sessionId . '&course_id=' . $courseId  . '&exercise_id=' . $exerciseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
721
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id='.$sessionId.'&course_id='.$courseId.'&exercise_id='.$exerciseId.'&date_to='.$date_to.'&date_from='.$date_from;
722 722
 
723 723
         // Autowidth
724 724
         $extra_params['autowidth'] = 'true';
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
         $tableId = 'exerciseProgressOverview';
730 730
         $table = Display::grid_js($tableId, $url, $columns, $column_model, $extra_params, array(), '', true);
731 731
 
732
-        $return = '<script>$(function() {'. $table .
732
+        $return = '<script>$(function() {'.$table.
733 733
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
734 734
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
735 735
                        caption:"",
736
-                       title:"' . get_lang('ExportExcel') . '",
736
+                       title:"' . get_lang('ExportExcel').'",
737 737
                        onClickButton : function () {
738 738
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
739 739
                        }
@@ -819,8 +819,8 @@  discard block
 block discarded – undo
819 819
 
820 820
                     $column[] = $title;
821 821
                     $column_model[] = array(
822
-                        'name' => 'exer' . $i,
823
-                        'index' => 'exer' . $i,
822
+                        'name' => 'exer'.$i,
823
+                        'index' => 'exer'.$i,
824 824
                         'align' => 'center',
825 825
                         'search' => 'true',
826 826
                         'wrap_cell' => "true"
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 
833 833
         //end get dynamic column names
834 834
         // jqgrid will use this URL to do the selects
835
-        $url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_exercise_grade&session_id=' . $sessionId . '&course_id=' . $courseId;
835
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_grade&session_id='.$sessionId.'&course_id='.$courseId;
836 836
 
837 837
         // Autowidth
838 838
         $extra_params['autowidth'] = 'true';
@@ -843,13 +843,13 @@  discard block
 block discarded – undo
843 843
         $tableId = 'exerciseGradeOverview';
844 844
         $table = Display::grid_js($tableId, $url, $column, $column_model, $extra_params, array(), '', true);
845 845
 
846
-        $return = '<script>$(function() {' . $table .
847
-            'jQuery("#' . $tableId . '").jqGrid("navGrid","#' . $tableId . '_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
848
-                jQuery("#' . $tableId . '").jqGrid("navButtonAdd","#' . $tableId . '_pager",{
846
+        $return = '<script>$(function() {'.$table.
847
+            'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
848
+                jQuery("#' . $tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
849 849
                        caption:"",
850
-                       title:"' . get_lang('ExportExcel') . '",
850
+                       title:"' . get_lang('ExportExcel').'",
851 851
                        onClickButton : function () {
852
-                           jQuery("#' . $tableId . '").jqGrid("excelExport",{"url":"' . $url . '&export_format=xls"});
852
+                           jQuery("#' . $tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
853 853
                        }
854 854
                 });
855 855
             });</script>';
@@ -882,10 +882,10 @@  discard block
 block discarded – undo
882 882
         /**
883 883
          * Column config
884 884
          */
885
-        $column_model   = array(
886
-            array('name'=>'username',   'index'=>'username',    'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
887
-            array('name'=>'firstname',  'index'=>'firstname',   'align'=>'left', 'search' => 'true'),
888
-            array('name'=>'lastname',   'index'=>'lastname',    'align'=>'left', 'search' => 'true'),
885
+        $column_model = array(
886
+            array('name'=>'username', 'index'=>'username', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
887
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left', 'search' => 'true'),
888
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left', 'search' => 'true'),
889 889
         );
890 890
         //get dinamic column names
891 891
         foreach ($questions as $question_id => $question) {
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
         $action_links = '';
902 902
 
903 903
         // jqgrid will use this URL to do the selects
904
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id=' . $sessionId . '&course_id=' . $courseId . '&survey_id=' . $surveyId . '&date_to=' . $date_to . '&date_from=' . $date_from;
904
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id='.$sessionId.'&course_id='.$courseId.'&survey_id='.$surveyId.'&date_to='.$date_to.'&date_from='.$date_from;
905 905
 
906 906
         // Table Id
907 907
         $tableId = 'lpProgress';
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
             true
924 924
         );
925 925
 
926
-        $return = '<script>$(function() {'. $table .
926
+        $return = '<script>$(function() {'.$table.
927 927
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
928 928
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
929 929
                        caption:"",
930
-                       title:"' . get_lang('ExportExcel') . '",
930
+                       title:"' . get_lang('ExportExcel').'",
931 931
                        onClickButton : function () {
932 932
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
933 933
                        }
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
      * Display a sortable table that contains an overview off all the progress of the user in a session
943 943
      * @author César Perales <[email protected]>, Beeznest Team
944 944
      */
945
-    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0,  $date_from, $date_to)
945
+    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0, $date_from, $date_to)
946 946
     {
947 947
         //The order is important you need to check the the $column variable in the model.ajax.php file
948 948
         $columns = array(
@@ -992,55 +992,55 @@  discard block
 block discarded – undo
992 992
         );
993 993
 
994 994
         //Column config
995
-        $column_model   = array(
996
-            array('name'=>'lastname',   'index'=>'lastname',     'align'=>'left'),
997
-            array('name'=>'firstname',  'index'=>'firstname',    'align'=>'left'),
998
-            array('name'=>'username',   'index'=>'username',     'align'=>'left'),
995
+        $column_model = array(
996
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left'),
997
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left'),
998
+            array('name'=>'username', 'index'=>'username', 'align'=>'left'),
999 999
             #array('name'=>'profile',   'index'=>'username',     'align'=>'left'),
1000
-            array('name'=>'total',      'index'=>'total',        'align'=>'left'),
1001
-            array('name'=>'courses',    'index'=>'courses',      'align'=>'left', 'sortable' => 'false'),
1002
-            array('name'=>'lessons',    'index'=>'lessons',      'align'=>'left', 'sortable' => 'false'),
1003
-            array('name'=>'exercises',  'index'=>'exercises',    'align'=>'left', 'sortable' => 'false'),
1004
-            array('name'=>'forums',     'index'=>'forums',       'align'=>'left', 'sortable' => 'false'),
1005
-            array('name'=>'homeworks',  'index'=>'homeworks',    'align'=>'left', 'sortable' => 'false'),
1006
-            array('name'=>'wikis',      'index'=>'wikis',        'align'=>'left', 'sortable' => 'false'),
1007
-            array('name'=>'surveys',    'index'=>'surveys',      'align'=>'left', 'sortable' => 'false'),
1000
+            array('name'=>'total', 'index'=>'total', 'align'=>'left'),
1001
+            array('name'=>'courses', 'index'=>'courses', 'align'=>'left', 'sortable' => 'false'),
1002
+            array('name'=>'lessons', 'index'=>'lessons', 'align'=>'left', 'sortable' => 'false'),
1003
+            array('name'=>'exercises', 'index'=>'exercises', 'align'=>'left', 'sortable' => 'false'),
1004
+            array('name'=>'forums', 'index'=>'forums', 'align'=>'left', 'sortable' => 'false'),
1005
+            array('name'=>'homeworks', 'index'=>'homeworks', 'align'=>'left', 'sortable' => 'false'),
1006
+            array('name'=>'wikis', 'index'=>'wikis', 'align'=>'left', 'sortable' => 'false'),
1007
+            array('name'=>'surveys', 'index'=>'surveys', 'align'=>'left', 'sortable' => 'false'),
1008 1008
             //Lessons
1009
-            array('name'=>'lessons_total',    'index'=>'lessons_total',      'align'=>'center', 'sortable' => 'false'),
1010
-            array('name'=>'lessons_done',     'index'=>'lessons_done',       'align'=>'center', 'sortable' => 'false'),
1011
-            array('name'=>'lessons_left',     'index'=>'lessons_left',       'align'=>'center', 'sortable' => 'false'),
1012
-            array('name'=>'lessons_progress', 'index'=>'lessons_progress',   'align'=>'center', 'sortable' => 'false'),
1009
+            array('name'=>'lessons_total', 'index'=>'lessons_total', 'align'=>'center', 'sortable' => 'false'),
1010
+            array('name'=>'lessons_done', 'index'=>'lessons_done', 'align'=>'center', 'sortable' => 'false'),
1011
+            array('name'=>'lessons_left', 'index'=>'lessons_left', 'align'=>'center', 'sortable' => 'false'),
1012
+            array('name'=>'lessons_progress', 'index'=>'lessons_progress', 'align'=>'center', 'sortable' => 'false'),
1013 1013
             //Exercises
1014
-            array('name'=>'exercises_total',    'index'=>'exercises_total',      'align'=>'center', 'sortable' => 'false'),
1015
-            array('name'=>'exercises_done',     'index'=>'exercises_done',       'align'=>'center', 'sortable' => 'false'),
1016
-            array('name'=>'exercises_left',     'index'=>'exercises_left',       'align'=>'center', 'sortable' => 'false'),
1017
-            array('name'=>'exercises_progress', 'index'=>'exercises_progress',   'align'=>'center', 'sortable' => 'false'),
1014
+            array('name'=>'exercises_total', 'index'=>'exercises_total', 'align'=>'center', 'sortable' => 'false'),
1015
+            array('name'=>'exercises_done', 'index'=>'exercises_done', 'align'=>'center', 'sortable' => 'false'),
1016
+            array('name'=>'exercises_left', 'index'=>'exercises_left', 'align'=>'center', 'sortable' => 'false'),
1017
+            array('name'=>'exercises_progress', 'index'=>'exercises_progress', 'align'=>'center', 'sortable' => 'false'),
1018 1018
             //Assignments
1019
-            array('name'=>'forums_total',    'index'=>'forums_total',        'align'=>'center', 'sortable' => 'false'),
1020
-            array('name'=>'forums_done',     'index'=>'forums_done',         'align'=>'center', 'sortable' => 'false'),
1021
-            array('name'=>'forums_left',     'index'=>'forums_left',         'align'=>'center', 'sortable' => 'false'),
1022
-            array('name'=>'forums_progress', 'index'=>'forums_progress',     'align'=>'center', 'sortable' => 'false'),
1019
+            array('name'=>'forums_total', 'index'=>'forums_total', 'align'=>'center', 'sortable' => 'false'),
1020
+            array('name'=>'forums_done', 'index'=>'forums_done', 'align'=>'center', 'sortable' => 'false'),
1021
+            array('name'=>'forums_left', 'index'=>'forums_left', 'align'=>'center', 'sortable' => 'false'),
1022
+            array('name'=>'forums_progress', 'index'=>'forums_progress', 'align'=>'center', 'sortable' => 'false'),
1023 1023
             //Assignments
1024
-            array('name'=>'assigments_total',    'index'=>'assigments_total',        'align'=>'center', 'sortable' => 'false'),
1025
-            array('name'=>'assigments_done',     'index'=>'assigments_done',         'align'=>'center', 'sortable' => 'false'),
1026
-            array('name'=>'assigments_left',     'index'=>'assigments_left',         'align'=>'center', 'sortable' => 'false'),
1027
-            array('name'=>'assigments_progress', 'index'=>'assigments_progress',     'align'=>'center', 'sortable' => 'false'),
1024
+            array('name'=>'assigments_total', 'index'=>'assigments_total', 'align'=>'center', 'sortable' => 'false'),
1025
+            array('name'=>'assigments_done', 'index'=>'assigments_done', 'align'=>'center', 'sortable' => 'false'),
1026
+            array('name'=>'assigments_left', 'index'=>'assigments_left', 'align'=>'center', 'sortable' => 'false'),
1027
+            array('name'=>'assigments_progress', 'index'=>'assigments_progress', 'align'=>'center', 'sortable' => 'false'),
1028 1028
             //Assignments
1029
-            array('name'=>'wiki_total',         'index'=>'wiki_total',       'align'=>'center', 'sortable' => 'false'),
1030
-            array('name'=>'wiki_revisions',     'index'=>'wiki_revisions',   'align'=>'center', 'sortable' => 'false'),
1031
-            array('name'=>'wiki_read',          'index'=>'wiki_read',        'align'=>'center', 'sortable' => 'false'),
1032
-            array('name'=>'wiki_unread',        'index'=>'wiki_unread',      'align'=>'center', 'sortable' => 'false'),
1033
-            array('name'=>'wiki_progress',      'index'=>'wiki_progress',    'align'=>'center', 'sortable' => 'false'),
1029
+            array('name'=>'wiki_total', 'index'=>'wiki_total', 'align'=>'center', 'sortable' => 'false'),
1030
+            array('name'=>'wiki_revisions', 'index'=>'wiki_revisions', 'align'=>'center', 'sortable' => 'false'),
1031
+            array('name'=>'wiki_read', 'index'=>'wiki_read', 'align'=>'center', 'sortable' => 'false'),
1032
+            array('name'=>'wiki_unread', 'index'=>'wiki_unread', 'align'=>'center', 'sortable' => 'false'),
1033
+            array('name'=>'wiki_progress', 'index'=>'wiki_progress', 'align'=>'center', 'sortable' => 'false'),
1034 1034
             //Surveys
1035
-            array('name'=>'surveys_total',    'index'=>'surveys_total',      'align'=>'center', 'sortable' => 'false'),
1036
-            array('name'=>'surveys_done',     'index'=>'surveys_done',       'align'=>'center', 'sortable' => 'false'),
1037
-            array('name'=>'surveys_left',     'index'=>'surveys_left',       'align'=>'center', 'sortable' => 'false'),
1038
-            array('name'=>'surveys_progress', 'index'=>'surveys_progress',   'align'=>'center', 'sortable' => 'false'),
1035
+            array('name'=>'surveys_total', 'index'=>'surveys_total', 'align'=>'center', 'sortable' => 'false'),
1036
+            array('name'=>'surveys_done', 'index'=>'surveys_done', 'align'=>'center', 'sortable' => 'false'),
1037
+            array('name'=>'surveys_left', 'index'=>'surveys_left', 'align'=>'center', 'sortable' => 'false'),
1038
+            array('name'=>'surveys_progress', 'index'=>'surveys_progress', 'align'=>'center', 'sortable' => 'false'),
1039 1039
         );
1040 1040
 
1041 1041
         $action_links = '';
1042 1042
         // jqgrid will use this URL to do the selects
1043
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
1043
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
1044 1044
 
1045 1045
         //Table Id
1046 1046
         $tableId = 'progressOverview';
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
             true
1101 1101
         );
1102 1102
 
1103
-        $return = '<script>$(function() {'. $table .
1103
+        $return = '<script>$(function() {'.$table.
1104 1104
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
1105 1105
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
1106 1106
                        caption:"",
1107
-                       title:"' . get_lang('ExportExcel') . '",
1107
+                       title:"' . get_lang('ExportExcel').'",
1108 1108
                        onClickButton : function () {
1109 1109
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
1110 1110
                        }
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                 // adding the fields that are checked to the session
1165 1165
                 $message = '';
1166 1166
                 foreach ($values as $field_ids => $value) {
1167
-                    if ($value == 1 && strstr($field_ids,'extra_export_field')) {
1167
+                    if ($value == 1 && strstr($field_ids, 'extra_export_field')) {
1168 1168
                         $_SESSION['additional_export_fields'][] = str_replace('extra_export_field', '', $field_ids);
1169 1169
                     }
1170 1170
                 }
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
                 // Displaying a feedback message
1180 1180
                 if (!empty($_SESSION['additional_export_fields'])) {
1181 1181
                     Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>', false);
1182
-                } else  {
1182
+                } else {
1183 1183
                     Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'), false);
1184 1184
                 }
1185 1185
             } else {
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
     {
1208 1208
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1209 1209
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1210
-        $t_head .=      '<tr>';
1210
+        $t_head .= '<tr>';
1211 1211
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1212 1212
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
1213 1213
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgCourseScore'), 6, true).'</span></th>';
@@ -1224,13 +1224,13 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
         $addparams = array('view' => 'admin', 'display' => 'courseoverview');
1226 1226
 
1227
-        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace','get_course_data_tracking_overview'), 1);
1227
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace', 'get_course_data_tracking_overview'), 1);
1228 1228
         $table->additional_parameters = $addparams;
1229 1229
 
1230 1230
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
1231 1231
         $table->set_header(1, get_lang('Course'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
1232 1232
         $table->set_header(2, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
1233
-        $table->set_column_filter(2, array('MySpace','course_tracking_filter'));
1233
+        $table->set_column_filter(2, array('MySpace', 'course_tracking_filter'));
1234 1234
         $table->display();
1235 1235
     }
1236 1236
 
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
         $sql .= " ORDER BY col$column $direction ";
1267 1267
         $sql .= " LIMIT $from,$number_of_items";
1268 1268
         $result = Database::query($sql);
1269
-        $return = array ();
1269
+        $return = array();
1270 1270
         while ($course = Database::fetch_row($result)) {
1271 1271
             $return[] = $course;
1272 1272
         }
@@ -1319,18 +1319,18 @@  discard block
 block discarded – undo
1319 1319
             $progress += $progress_tmp[0];
1320 1320
             $nb_progress_lp += $progress_tmp[1];
1321 1321
             $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1322
-            if(is_array($score_tmp)) {
1322
+            if (is_array($score_tmp)) {
1323 1323
                 $score += $score_tmp[0];
1324 1324
                 $nb_score_lp += $score_tmp[1];
1325 1325
             }
1326 1326
             $nb_messages += Tracking::count_student_messages($row->user_id, $course_code);
1327 1327
             $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1328 1328
             $last_login_date_tmp = Tracking :: get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1329
-            if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1329
+            if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1330 1330
                 $last_login_date = $last_login_date_tmp;
1331
-            } else if($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1331
+            } else if ($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1332 1332
                 // Find the max and assign it to first_login_date
1333
-                if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1333
+                if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1334 1334
                     $last_login_date = $last_login_date_tmp;
1335 1335
                 }
1336 1336
             }
@@ -1340,27 +1340,27 @@  discard block
 block discarded – undo
1340 1340
             $total_score_possible += $exercise_results_tmp['score_possible'];
1341 1341
             $total_questions_answered += $exercise_results_tmp['questions_answered'];
1342 1342
         }
1343
-        if($nb_progress_lp > 0) {
1343
+        if ($nb_progress_lp > 0) {
1344 1344
             $avg_progress = round($progress / $nb_progress_lp, 2);
1345 1345
         } else {
1346 1346
             $avg_progress = 0;
1347 1347
         }
1348
-        if($nb_score_lp > 0) {
1348
+        if ($nb_score_lp > 0) {
1349 1349
             $avg_score = round($score / $nb_score_lp, 2);
1350 1350
         } else {
1351 1351
             $avg_score = '-';
1352 1352
         }
1353
-        if($last_login_date) {
1353
+        if ($last_login_date) {
1354 1354
             $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1355 1355
         } else {
1356 1356
             $last_login_date = '-';
1357 1357
         }
1358
-        if($total_score_possible > 0) {
1358
+        if ($total_score_possible > 0) {
1359 1359
             $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1360 1360
         } else {
1361 1361
             $total_score_percentage = 0;
1362 1362
         }
1363
-        if($total_score_percentage > 0) {
1363
+        if ($total_score_percentage > 0) {
1364 1364
             $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1365 1365
         } else {
1366 1366
             $total_score = '-';
@@ -1468,7 +1468,7 @@  discard block
 block discarded – undo
1468 1468
                 $progress += $progress_tmp[0];
1469 1469
                 $nb_progress_lp += $progress_tmp[1];
1470 1470
                 $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1471
-                if(is_array($score_tmp)) {
1471
+                if (is_array($score_tmp)) {
1472 1472
                     $score += $score_tmp[0];
1473 1473
                     $nb_score_lp += $score_tmp[1];
1474 1474
                 }
@@ -1476,11 +1476,11 @@  discard block
 block discarded – undo
1476 1476
                 $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1477 1477
 
1478 1478
                 $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1479
-                if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1479
+                if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1480 1480
                     $last_login_date = $last_login_date_tmp;
1481
-                } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1481
+                } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1482 1482
                     // Find the max and assign it to first_login_date
1483
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1483
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1484 1484
                         $last_login_date = $last_login_date_tmp;
1485 1485
                     }
1486 1486
                 }
@@ -1490,22 +1490,22 @@  discard block
 block discarded – undo
1490 1490
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1491 1491
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1492 1492
             }
1493
-            if($nb_progress_lp > 0) {
1493
+            if ($nb_progress_lp > 0) {
1494 1494
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1495 1495
             } else {
1496 1496
                 $avg_progress = 0;
1497 1497
             }
1498
-            if($nb_score_lp > 0) {
1498
+            if ($nb_score_lp > 0) {
1499 1499
                 $avg_score = round($score / $nb_score_lp, 2);
1500 1500
             } else {
1501 1501
                 $avg_score = '-';
1502 1502
             }
1503
-            if($last_login_date) {
1503
+            if ($last_login_date) {
1504 1504
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1505 1505
             } else {
1506 1506
                 $last_login_date = '-';
1507 1507
             }
1508
-            if($total_score_possible > 0) {
1508
+            if ($total_score_possible > 0) {
1509 1509
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1510 1510
             } else {
1511 1511
                 $total_score_percentage = 0;
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
     {
1542 1542
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1543 1543
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1544
-        $t_head .=      '<tr>';
1544
+        $t_head .= '<tr>';
1545 1545
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
1546 1546
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1547 1547
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
         $addparams = array('view' => 'admin', 'display' => 'sessionoverview');
1561 1561
 
1562
-        $table = new SortableTable('tracking_session_overview', array('MySpace','get_total_number_sessions'), array('MySpace','get_session_data_tracking_overview'), 1);
1562
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_sessions'), array('MySpace', 'get_session_data_tracking_overview'), 1);
1563 1563
         $table->additional_parameters = $addparams;
1564 1564
 
1565 1565
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
         $sql .= " ORDER BY col$column $direction ";
1599 1599
         $sql .= " LIMIT $from,$number_of_items";
1600 1600
         $result = Database::query($sql);
1601
-        $return = array ();
1601
+        $return = array();
1602 1602
         while ($session = Database::fetch_row($result)) {
1603 1603
             $return[] = $session;
1604 1604
         }
@@ -1687,10 +1687,10 @@  discard block
 block discarded – undo
1687 1687
                 if ($last_login_date_tmp != false && $last_login_date == false) {
1688 1688
                     // TODO: To be cleaned.
1689 1689
                     $last_login_date = $last_login_date_tmp;
1690
-                } else if($last_login_date_tmp != false && $last_login_date != false) {
1690
+                } else if ($last_login_date_tmp != false && $last_login_date != false) {
1691 1691
                     // TODO: Repeated previous condition! To be cleaned.
1692 1692
                     // Find the max and assign it to first_login_date
1693
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1693
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1694 1694
                         $last_login_date = $last_login_date_tmp;
1695 1695
                     }
1696 1696
                 }
@@ -1700,27 +1700,27 @@  discard block
 block discarded – undo
1700 1700
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1701 1701
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1702 1702
             }
1703
-            if($nb_progress_lp > 0) {
1703
+            if ($nb_progress_lp > 0) {
1704 1704
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1705 1705
             } else {
1706 1706
                 $avg_progress = 0;
1707 1707
             }
1708
-            if($nb_score_lp > 0) {
1708
+            if ($nb_score_lp > 0) {
1709 1709
                 $avg_score = round($score / $nb_score_lp, 2);
1710 1710
             } else {
1711 1711
                 $avg_score = '-';
1712 1712
             }
1713
-            if($last_login_date) {
1713
+            if ($last_login_date) {
1714 1714
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1715 1715
             } else {
1716 1716
                 $last_login_date = '-';
1717 1717
             }
1718
-            if($total_score_possible > 0) {
1718
+            if ($total_score_possible > 0) {
1719 1719
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1720 1720
             } else {
1721 1721
                 $total_score_percentage = 0;
1722 1722
             }
1723
-            if($total_score_percentage > 0) {
1723
+            if ($total_score_percentage > 0) {
1724 1724
                 $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1725 1725
             } else {
1726 1726
                 $total_score = '-';
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
                 $total_score_obtained = 0;
1832 1832
                 $total_score_possible = 0;
1833 1833
                 $total_questions_answered = 0;
1834
-                while($row_user = Database::fetch_object($result_users)) {
1834
+                while ($row_user = Database::fetch_object($result_users)) {
1835 1835
                     // get time spent in the course and session
1836 1836
                     $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id);
1837 1837
                     $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true);
@@ -1860,11 +1860,11 @@  discard block
 block discarded – undo
1860 1860
                         $session_id,
1861 1861
                         false
1862 1862
                     );
1863
-                    if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1863
+                    if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1864 1864
                         $last_login_date = $last_login_date_tmp;
1865
-                    } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1865
+                    } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1866 1866
                         // Find the max and assign it to first_login_date
1867
-                        if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1867
+                        if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1868 1868
                             $last_login_date = $last_login_date_tmp;
1869 1869
                         }
1870 1870
                     }
@@ -1874,27 +1874,27 @@  discard block
 block discarded – undo
1874 1874
                     $total_score_possible += $exercise_results_tmp['score_possible'];
1875 1875
                     $total_questions_answered += $exercise_results_tmp['questions_answered'];
1876 1876
                 }
1877
-                if($nb_progress_lp > 0) {
1877
+                if ($nb_progress_lp > 0) {
1878 1878
                     $avg_progress = round($progress / $nb_progress_lp, 2);
1879 1879
                 } else {
1880 1880
                     $avg_progress = 0;
1881 1881
                 }
1882
-                if($nb_score_lp > 0) {
1882
+                if ($nb_score_lp > 0) {
1883 1883
                     $avg_score = round($score / $nb_score_lp, 2);
1884 1884
                 } else {
1885 1885
                     $avg_score = '-';
1886 1886
                 }
1887
-                if($last_login_date) {
1887
+                if ($last_login_date) {
1888 1888
                     $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1889 1889
                 } else {
1890 1890
                     $last_login_date = '-';
1891 1891
                 }
1892
-                if($total_score_possible > 0) {
1892
+                if ($total_score_possible > 0) {
1893 1893
                     $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1894 1894
                 } else {
1895 1895
                     $total_score_percentage = 0;
1896 1896
                 }
1897
-                if($total_score_percentage > 0) {
1897
+                if ($total_score_percentage > 0) {
1898 1898
                     $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1899 1899
                 } else {
1900 1900
                     $total_score = '-';
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
             FROM '.Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES)."
1945 1945
             WHERE c_id = ' . $courseId . '
1946 1946
             AND exe_user_id = '".intval($user_id)."'";
1947
-        if($session_id !== false) {
1947
+        if ($session_id !== false) {
1948 1948
             $sql .= " AND session_id = '".$session_id."' ";
1949 1949
         }
1950 1950
         $result = Database::query($sql);
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
         while ($row = Database::fetch_array($result)) {
1955 1955
             $score_obtained += $row['exe_result'];
1956 1956
             $score_possible += $row['exe_weighting'];
1957
-            $questions_answered ++;
1957
+            $questions_answered++;
1958 1958
         }
1959 1959
 
1960 1960
         if ($score_possible != 0) {
@@ -2075,9 +2075,9 @@  discard block
 block discarded – undo
2075 2075
                     }
2076 2076
                 }
2077 2077
                 // time spent in the course
2078
-                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course ($user[4], $courseId));
2078
+                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId));
2079 2079
                 // student progress in course
2080
-                $csv_row[] = round(Tracking::get_avg_student_progress ($user[4], $row[0]), 2);
2080
+                $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
2081 2081
                 // student score
2082 2082
                 $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
2083 2083
                 // student tes score
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
                 // student messages
2086 2086
                 $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
2087 2087
                 // student assignments
2088
-                $csv_row[] = Tracking::count_student_assignments ($user[4], $row[0]);
2088
+                $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
2089 2089
                 // student exercises results
2090 2090
                 $exercises_results = MySpace::exercises_results($user[4], $row[0]);
2091 2091
                 $csv_row[] = $exercises_results['score_obtained'];
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
                 $csv_row[] = $exercises_results['questions_answered'];
2094 2094
                 $csv_row[] = $exercises_results['percentage'];
2095 2095
                 // first connection
2096
-                $csv_row[] = Tracking::get_first_connection_date_on_the_course ($user[4], $courseId);
2096
+                $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId);
2097 2097
                 // last connection
2098 2098
                 $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo));
2099 2099
 
@@ -2127,9 +2127,9 @@  discard block
 block discarded – undo
2127 2127
         // get all courses with limit
2128 2128
         $sql = "SELECT course.code as col1, course.title as col2
2129 2129
                 FROM $tbl_course course
2130
-                WHERE course.code IN (".implode(',',$courses_code).")";
2130
+                WHERE course.code IN (".implode(',', $courses_code).")";
2131 2131
 
2132
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2132
+        if (!in_array($direction, array('ASC', 'DESC'))) $direction = 'ASC';
2133 2133
 
2134 2134
         $column = intval($column);
2135 2135
         $from = intval($from);
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
             $table_row[] = $avg_assignments_in_course;
2199 2199
 
2200 2200
             //set the "from" value to know if I access the Reporting by the chamilo tab or the course link
2201
-            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq=' .$course_code.'&from=myspace&id_session='.$session_id.'">
2201
+            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'">
2202 2202
                              '.Display::return_icon('2rightarrow.png').'
2203 2203
                              </a>
2204 2204
                             </center>';
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
                 $nb_students_in_course,
2208 2208
                 $avg_time_spent_in_course,
2209 2209
                 is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%',
2210
-                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course ,
2210
+                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course,
2211 2211
                 is_null($avg_score_in_exercise) ? null : $avg_score_in_exercise.'%',
2212 2212
                 $avg_messages_in_course,
2213 2213
                 $avg_assignments_in_course,
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
         $sql .= " ORDER BY col$column $direction ";
2276 2276
         $sql .= " LIMIT $from,$number_of_items";
2277 2277
         $result = Database::query($sql);
2278
-        $return = array ();
2278
+        $return = array();
2279 2279
         while ($user = Database::fetch_row($result)) {
2280 2280
             $return[] = $user;
2281 2281
         }
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
                     $i++;
2331 2331
                 }
2332 2332
             }
2333
-            $username_array = array('username' => $desired_username , 'sufix' => $sufix);
2333
+            $username_array = array('username' => $desired_username, 'sufix' => $sufix);
2334 2334
             return $username_array;
2335 2335
         } else {
2336 2336
             $username_array = array('username' => $username, 'sufix' => '');
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
         foreach ($users as $index => $user) {
2606 2606
             $userid = $user['id'];
2607 2607
             $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
2608
-                           VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')";
2608
+                           VALUES ('$id_session','$userid', '".api_get_utc_datetime()."')";
2609 2609
             Database::query($sql_insert);
2610 2610
             $user['added_at_session'] = 1;
2611 2611
             $new_users[] = $user;
@@ -2639,10 +2639,10 @@  discard block
 block discarded – undo
2639 2639
                 );
2640 2640
                 $userInfo = api_get_user_info($user['id']);
2641 2641
 
2642
-                if (($user['added_at_platform'] == 1  && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2642
+                if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2643 2643
                     if ($user['added_at_platform'] == 1) {
2644 2644
                         $addedto = get_lang('UserCreatedPlatform');
2645
-                    } else  {
2645
+                    } else {
2646 2646
                         $addedto = '          ';
2647 2647
                     }
2648 2648
 
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
         global $current_tag;
2706 2706
         switch ($data) {
2707 2707
             case 'Contact' :
2708
-                $user = array ();
2708
+                $user = array();
2709 2709
                 break;
2710 2710
             default :
2711 2711
                 $current_tag = $data;
@@ -2752,9 +2752,9 @@  discard block
 block discarded – undo
2752 2752
         global $current_value;
2753 2753
         global $user;
2754 2754
         global $users;
2755
-        $users = array ();
2755
+        $users = array();
2756 2756
         $parser = xml_parser_create('UTF-8');
2757
-        xml_set_element_handler($parser, array('MySpace','element_start'), array('MySpace','element_end'));
2757
+        xml_set_element_handler($parser, array('MySpace', 'element_start'), array('MySpace', 'element_end'));
2758 2758
         xml_set_character_data_handler($parser, "character_data");
2759 2759
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
2760 2760
         xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
             get_lang('SearchCourse'),
2801 2801
             $courseList,
2802 2802
             [
2803
-                'url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query([
2803
+                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?'.http_build_query([
2804 2804
                     'a' => 'search_course_by_session_all',
2805 2805
                     'session_id' => $sessionId
2806 2806
                 ])
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
                             course_id: $('#course_id').val() || 0
2820 2820
                         });
2821 2821
 
2822
-                        return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;
2822
+                        return '" . api_get_path(WEB_AJAX_PATH)."session.ajax.php?' + params;
2823 2823
                     }
2824 2824
                 "
2825 2825
             ]
@@ -2850,7 +2850,7 @@  discard block
 block discarded – undo
2850 2850
                             course_id: $('#course_id').val()
2851 2851
                         });
2852 2852
 
2853
-                        return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;
2853
+                        return '" . api_get_path(WEB_AJAX_PATH)."course.ajax.php?' + params;
2854 2854
                     }
2855 2855
                 "
2856 2856
             ]
@@ -2876,8 +2876,8 @@  discard block
 block discarded – undo
2876 2876
         if ($form->validate()) {
2877 2877
             $table = new SortableTable(
2878 2878
                 'tracking_access_overview',
2879
-                ['MySpace','getNumberOfRrackingAccessOverview'],
2880
-                ['MySpace','getUserDataAccessTrackingOverview'],
2879
+                ['MySpace', 'getNumberOfRrackingAccessOverview'],
2880
+                ['MySpace', 'getUserDataAccessTrackingOverview'],
2881 2881
                 0
2882 2882
             );
2883 2883
             $table->additional_parameters = $form->exportValues();
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
                     " : "
2939 2939
                         u.lastname AS col2,
2940 2940
                         u.firstname AS col3,
2941
-                " ) . "
2941
+                " )."
2942 2942
                 a.logout_course_date,
2943 2943
                 c.title,
2944 2944
                 c.code,
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
 
2950 2950
         if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
2951 2951
             $sessionId = intval($_GET['session_id']);
2952
-            $sql .= " WHERE a.session_id = " . $sessionId;
2952
+            $sql .= " WHERE a.session_id = ".$sessionId;
2953 2953
         }
2954 2954
 
2955 2955
         $sql .= " ORDER BY col$column $orderDirection ";
@@ -3010,14 +3010,14 @@  discard block
 block discarded – undo
3010 3010
 function get_stats($user_id, $courseId, $start_date = null, $end_date = null)
3011 3011
 {
3012 3012
     // Database table definitions
3013
-    $tbl_track_course   = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
3013
+    $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
3014 3014
 
3015 3015
     $course_info = api_get_course_info_by_id($courseId);
3016 3016
     if (!empty($course_info)) {
3017 3017
         $strg_sd    = "";
3018 3018
         $strg_ed    = "";
3019
-        if ($start_date != null && $end_date != null){
3020
-            $end_date = add_day_to( $end_date );
3019
+        if ($start_date != null && $end_date != null) {
3020
+            $end_date = add_day_to($end_date);
3021 3021
             $strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
3022 3022
             $strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
3023 3023
         }
@@ -3025,10 +3025,10 @@  discard block
 block discarded – undo
3025 3025
                 SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
3026 3026
                 SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
3027 3027
                 count(user_id) as times
3028
-                FROM ' . $tbl_track_course . '
3028
+                FROM ' . $tbl_track_course.'
3029 3029
                 WHERE
3030
-                    user_id = ' . intval($user_id) . ' AND
3031
-                    c_id = ' . intval($courseId) . ' '.$strg_sd.' '.$strg_ed.' '.'
3030
+                    user_id = ' . intval($user_id).' AND
3031
+                    c_id = ' . intval($courseId).' '.$strg_sd.' '.$strg_ed.' '.'
3032 3032
                 ORDER BY login_course_date ASC';
3033 3033
 
3034 3034
         $rs = Database::query($sql);
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
 }
3047 3047
 
3048 3048
 function add_day_to($end_date) {
3049
-    $foo_date = strtotime( $end_date );
3049
+    $foo_date = strtotime($end_date);
3050 3050
     $foo_date = strtotime(" +1 day", $foo_date);
3051 3051
     $foo_date = date("Y-m-d", $foo_date);
3052 3052
     return $foo_date;
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
  * @version OCT-22- 2010
3107 3107
  * @return array
3108 3108
  */
3109
-function convert_to_array($sql_result){
3109
+function convert_to_array($sql_result) {
3110 3110
     $result_to_print = '<table>';
3111 3111
     foreach ($sql_result as $key => $data) {
3112 3112
         $result_to_print .= '<tr><td>'.date('d-m-Y (H:i:s)', $data['login']).'</td><td>'.api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n";
@@ -3125,7 +3125,7 @@  discard block
 block discarded – undo
3125 3125
  * @version OCT-22- 2010
3126 3126
  * @return string
3127 3127
  */
3128
-function convert_to_string($sql_result){
3128
+function convert_to_string($sql_result) {
3129 3129
     $result_to_print = '<table>';
3130 3130
     if (!empty($sql_result)) {
3131 3131
         foreach ($sql_result as $key => $data) {
@@ -3150,18 +3150,18 @@  discard block
 block discarded – undo
3150 3150
  */
3151 3151
 function grapher($sql_result, $start_date, $end_date, $type = "")
3152 3152
 {
3153
-    if (empty($start_date)) { $start_date =""; }
3154
-    if (empty($end_date)) { $end_date =""; }
3155
-    if ($type == ""){ $type = 'day'; }
3156
-    $main_year  = $main_month_year = $main_day = array();
3153
+    if (empty($start_date)) { $start_date = ""; }
3154
+    if (empty($end_date)) { $end_date = ""; }
3155
+    if ($type == "") { $type = 'day'; }
3156
+    $main_year = $main_month_year = $main_day = array();
3157 3157
     // get last 8 days/months
3158 3158
     $last_days      = 5;
3159 3159
     $last_months    = 3;
3160 3160
     for ($i = $last_days; $i >= 0; $i--) {
3161
-        $main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)] = 0;
3161
+        $main_day[date('d-m-Y', mktime() - $i * 3600 * 24)] = 0;
3162 3162
     }
3163 3163
     for ($i = $last_months; $i >= 0; $i--) {
3164
-        $main_month_year[date ('m-Y', mktime () - $i * 30 * 3600 * 24)] = 0;
3164
+        $main_month_year[date('m-Y', mktime() - $i * 30 * 3600 * 24)] = 0;
3165 3165
     }
3166 3166
 
3167 3167
     $i = 0;
@@ -3197,7 +3197,7 @@  discard block
 block discarded – undo
3197 3197
         /* Create and populate the pData object */
3198 3198
         $myData = new pData();
3199 3199
         $myData->addPoints($main_date, 'Serie1');
3200
-        if (count($main_date)!= 1) {
3200
+        if (count($main_date) != 1) {
3201 3201
             $myData->addPoints($labels, 'Labels');
3202 3202
             $myData->setSerieDescription('Labels', 'Months');
3203 3203
             $myData->setAbscissa('Labels');
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
         $myData->setSerieWeight('Serie1', 1);
3206 3206
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
3207 3207
         $myData->setAxisName(0, get_lang('Minutes'));
3208
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
3208
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
3209 3209
 
3210 3210
         // Cache definition
3211 3211
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -3214,9 +3214,9 @@  discard block
 block discarded – undo
3214 3214
 
3215 3215
         if ($myCache->isInCache($chartHash)) {
3216 3216
             //if we already created the img
3217
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3217
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3218 3218
             $myCache->saveFromCache($chartHash, $imgPath);
3219
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3219
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3220 3220
         } else {
3221 3221
             /* Define width, height and angle */
3222 3222
             $mainWidth = 760;
@@ -3245,7 +3245,7 @@  discard block
 block discarded – undo
3245 3245
             /* Set the default font */
3246 3246
             $myPicture->setFontProperties(
3247 3247
                 array(
3248
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3248
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3249 3249
                     "FontSize" => 10)
3250 3250
             );
3251 3251
             /* Write the chart title */
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             /* Set the default font */
3263 3263
             $myPicture->setFontProperties(
3264 3264
                 array(
3265
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3265
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3266 3266
                     "FontSize" => 8
3267 3267
                 )
3268 3268
             );
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
             /* Draw the line chart */
3305 3305
             $myPicture->setFontProperties(
3306 3306
                 array(
3307
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3307
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3308 3308
                     "FontSize" => 10
3309 3309
                 )
3310 3310
             );
@@ -3323,15 +3323,15 @@  discard block
 block discarded – undo
3323 3323
 
3324 3324
             /* Write and save into cache */
3325 3325
             $myCache->writeToCache($chartHash, $myPicture);
3326
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3326
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3327 3327
             $myCache->saveFromCache($chartHash, $imgPath);
3328
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3328
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3329 3329
         }
3330
-        $html = '<img src="' . $imgPath . '">';
3330
+        $html = '<img src="'.$imgPath.'">';
3331 3331
 
3332 3332
         return $html;
3333 3333
     } else {
3334
-        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8');
3334
+        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>', 'UTF-8');
3335 3335
 
3336 3336
         return $foo_img;
3337 3337
     }
Please login to merge, or discard this patch.
main/inc/lib/notification.lib.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@
 block discarded – undo
219 219
      * @param array	    $user_list recipients: user list of ids
220 220
      * @param string	$title
221 221
      * @param string	$content
222
-     * @param array	    $sender_info
222
+     * @param array	    $senderInfo
223 223
      * result of api_get_user_info() or GroupPortalManager:get_group_data()
224 224
      */
225 225
     public function save_notification(
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                 $newMessageText = '';
356 356
                 $linkToNewMessage = Display::url(
357 357
                     get_lang('SeeMessage'),
358
-                    api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'
358
+                    api_get_path(WEB_CODE_PATH).'messages/inbox.php'
359 359
                 );
360 360
                 break;
361 361
             case self::NOTIFICATION_TYPE_MESSAGE:
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 }
371 371
                 $linkToNewMessage = Display::url(
372 372
                     get_lang('SeeMessage'),
373
-                    api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'
373
+                    api_get_path(WEB_CODE_PATH).'messages/inbox.php'
374 374
                 );
375 375
                 break;
376 376
             case self::NOTIFICATION_TYPE_INVITATION:
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                 }
386 386
                 $linkToNewMessage = Display::url(
387 387
                     get_lang('SeeInvitation'),
388
-                    api_get_path(WEB_CODE_PATH) . 'social/invitations.php'
388
+                    api_get_path(WEB_CODE_PATH).'social/invitations.php'
389 389
                 );
390 390
                 break;
391 391
             case self::NOTIFICATION_TYPE_GROUP:
Please login to merge, or discard this patch.