Completed
Push — 1.11.x ( 64c594...7659e1 )
by José
55:41 queued 27:17
created
main/inc/lib/baker.lib.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
                 $data = substr($png,$ipos,$chunk['size']);
151 151
                 $sections = explode("\0", $data);
152 152
                 if ($sections[0] == $key) {
153
-                   return $sections;
153
+                    return $sections;
154 154
                 }
155 155
             }
156 156
             // Extract the data and the CRC
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             foreach (array_keys($this->_chunks[$type]) as $typekey) {
52 52
                 list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]);
53 53
                 if (strcmp($key, $check) == 0) {
54
-                    echo 'Key "' . $check . '" already exists in "' . $type . '" chunk.';
54
+                    echo 'Key "'.$check.'" already exists in "'.$type.'" chunk.';
55 55
                     return false;
56 56
                 }
57 57
             }
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function addChunk($chunkType, $key, $value) {
72 72
         
73
-        $chunkData = $key . "\0" . $value;
74
-        $crc = pack("N", crc32($chunkType . $chunkData));
73
+        $chunkData = $key."\0".$value;
74
+        $crc = pack("N", crc32($chunkType.$chunkData));
75 75
         $len = pack("N", strlen($chunkData));
76 76
         
77
-        $newChunk = $len . $chunkType . $chunkData . $crc;
77
+        $newChunk = $len.$chunkType.$chunkData.$crc;
78 78
         $result = substr($this->_contents, 0, $this->_size - 12)
79 79
                 . $newChunk
80 80
                 . substr($this->_contents, $this->_size - 12, 12);
@@ -92,30 +92,30 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function removeChunks($chunkType, $key, $png) {
94 94
         // Read the magic bytes and verify
95
-        $retval = substr($png,0,8);
95
+        $retval = substr($png, 0, 8);
96 96
         $ipos = 8;
97 97
         if ($retval != "\x89PNG\x0d\x0a\x1a\x0a")
98 98
             throw new Exception('Is not a valid PNG image');
99 99
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
100
-        $chunkHeader = substr($png,$ipos,8);
100
+        $chunkHeader = substr($png, $ipos, 8);
101 101
         $ipos = $ipos + 8;
102 102
         while ($chunkHeader) {
103 103
             // Extract length and type from binary data
104 104
             $chunk = @unpack('Nsize/a4type', $chunkHeader);
105 105
             $skip = false;
106
-            if ( $chunk['type'] == $chunkType ) {
107
-                $data = substr($png,$ipos,$chunk['size']);
106
+            if ($chunk['type'] == $chunkType) {
107
+                $data = substr($png, $ipos, $chunk['size']);
108 108
                 $sections = explode("\0", $data);
109 109
                 print_r($sections);
110
-                if ( $sections[0] == $key ) $skip = true;
110
+                if ($sections[0] == $key) $skip = true;
111 111
             }
112 112
             // Extract the data and the CRC
113
-            $data = substr($png,$ipos,$chunk['size']+4);
113
+            $data = substr($png, $ipos, $chunk['size'] + 4);
114 114
             $ipos = $ipos + $chunk['size'] + 4;
115 115
             // Add in the header, data, and CRC
116
-            if ( ! $skip ) $retval = $retval . $chunkHeader . $data;
116
+            if (!$skip) $retval = $retval.$chunkHeader.$data;
117 117
             // Read next chunk header
118
-            $chunkHeader = substr($png,$ipos,8);
118
+            $chunkHeader = substr($png, $ipos, 8);
119 119
             $ipos = $ipos + 8;
120 120
         }
121 121
         return $retval;
@@ -131,34 +131,34 @@  discard block
 block discarded – undo
131 131
      * If there is PNG information that matches the key an array is returned
132 132
      * 
133 133
      */
134
-    public function extractBadgeInfo($png, $key='openbadges') {
134
+    public function extractBadgeInfo($png, $key = 'openbadges') {
135 135
         // Read the magic bytes and verify
136
-        $retval = substr($png,0,8);
136
+        $retval = substr($png, 0, 8);
137 137
         $ipos = 8;
138 138
         if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") {
139 139
             return false;
140 140
         }
141 141
 
142 142
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
143
-        $chunkHeader = substr($png,$ipos,8);
143
+        $chunkHeader = substr($png, $ipos, 8);
144 144
         $ipos = $ipos + 8;
145 145
         while ($chunkHeader) {
146 146
             // Extract length and type from binary data
147 147
             $chunk = @unpack('Nsize/a4type', $chunkHeader);
148 148
             $skip = false;
149 149
             if ($chunk['type'] == 'tEXt') {
150
-                $data = substr($png,$ipos,$chunk['size']);
150
+                $data = substr($png, $ipos, $chunk['size']);
151 151
                 $sections = explode("\0", $data);
152 152
                 if ($sections[0] == $key) {
153 153
                    return $sections;
154 154
                 }
155 155
             }
156 156
             // Extract the data and the CRC
157
-            $data = substr($png,$ipos,$chunk['size']+4);
157
+            $data = substr($png, $ipos, $chunk['size'] + 4);
158 158
             $ipos = $ipos + $chunk['size'] + 4;
159 159
 
160 160
             // Read next chunk header
161
-            $chunkHeader = substr($png,$ipos,8);
161
+            $chunkHeader = substr($png, $ipos, 8);
162 162
             $ipos = $ipos + 8;
163 163
         }
164 164
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,9 @@  discard block
 block discarded – undo
94 94
         // Read the magic bytes and verify
95 95
         $retval = substr($png,0,8);
96 96
         $ipos = 8;
97
-        if ($retval != "\x89PNG\x0d\x0a\x1a\x0a")
98
-            throw new Exception('Is not a valid PNG image');
97
+        if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") {
98
+                    throw new Exception('Is not a valid PNG image');
99
+        }
99 100
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
100 101
         $chunkHeader = substr($png,$ipos,8);
101 102
         $ipos = $ipos + 8;
@@ -107,13 +108,17 @@  discard block
 block discarded – undo
107 108
                 $data = substr($png,$ipos,$chunk['size']);
108 109
                 $sections = explode("\0", $data);
109 110
                 print_r($sections);
110
-                if ( $sections[0] == $key ) $skip = true;
111
+                if ( $sections[0] == $key ) {
112
+                    $skip = true;
113
+                }
111 114
             }
112 115
             // Extract the data and the CRC
113 116
             $data = substr($png,$ipos,$chunk['size']+4);
114 117
             $ipos = $ipos + $chunk['size'] + 4;
115 118
             // Add in the header, data, and CRC
116
-            if ( ! $skip ) $retval = $retval . $chunkHeader . $data;
119
+            if ( ! $skip ) {
120
+                $retval = $retval . $chunkHeader . $data;
121
+            }
117 122
             // Read next chunk header
118 123
             $chunkHeader = substr($png,$ipos,8);
119 124
             $ipos = $ipos + 8;
Please login to merge, or discard this patch.
main/inc/lib/pdf.lib.php 4 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,6 @@
 block discarded – undo
73 73
      * Export the given HTML to PDF, using a global template
74 74
      *
75 75
      * @uses export/table_pdf.tpl
76
-
77 76
      * @param $content
78 77
      * @param bool|false $saveToFile
79 78
      * @param bool|false $returnHtml
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -536,8 +536,9 @@
 block discarded – undo
536 536
             }
537 537
         } else {
538 538
             $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';   // course path
539
-            if (file_exists($store_path))
540
-                $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
539
+            if (file_exists($store_path)) {
540
+                            $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
541
+            }
541 542
         }
542 543
         return $web_path;
543 544
     }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      * @param   string  pdf name
193 193
      * @param   string  course code (if you are using html that are located in the document tool you must provide this)
194 194
      * @param bool Whether to print the header, footer and watermark (true) or just the content (false)
195
-     * @return bool
195
+     * @return false|null
196 196
      */
197 197
     public function html_to_pdf(
198 198
         $html_file_array,
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
     }
767 767
 
768 768
     /**
769
-     * @param array $header html content
769
+     * @param string $header html content
770 770
      */
771 771
     public function set_custom_header($header)
772 772
     {
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
     }
775 775
 
776 776
     /**
777
-     * @param array $footer html content
777
+     * @param string $footer html content
778 778
      */
779 779
     public function set_custom_footer($footer)
780 780
     {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         /* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF
34 34
          * mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
35 35
          */
36
-        if (!in_array($orientation, array('P','L'))) {
36
+        if (!in_array($orientation, array('P', 'L'))) {
37 37
             $orientation = 'P';
38 38
         }
39 39
         //$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $visualTheme = api_get_visual_theme();
101 101
             $img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
102 102
             if (file_exists($img)) {
103
-                $img = api_get_path(WEB_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png';
103
+                $img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
104 104
                 $organization = "<img src='$img'>";
105 105
             }
106 106
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             // then print the title in the PDF
238 238
             if (is_array($file) && isset($file['title'])) {
239 239
                 $html_title = $file['title'];
240
-                $file  = $file['path'];
240
+                $file = $file['path'];
241 241
             } else {
242 242
                 //we suppose we've only been sent a file path
243 243
                 $html_title = basename($file);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             //it's not a chapter but the file exists, print its title
269 269
             if ($print_title) {
270 270
                 $this->pdf->WriteHTML(
271
-                    '<html><body><h3>' . $html_title . '</h3></body></html>'
271
+                    '<html><body><h3>'.$html_title.'</h3></body></html>'
272 272
                 );
273 273
             }
274 274
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
                 if ($extension === 'html') {
284 284
                     $filename = basename($filename, '.html');
285
-                } elseif($extension === 'htm'){
285
+                } elseif ($extension === 'htm') {
286 286
                     $filename = basename($filename, '.htm');
287 287
                 }
288 288
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                 $document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html);
295 295
 
296 296
                 if (!empty($course_data['path'])) {
297
-                    $document_html= str_replace('../', '', $document_html);
297
+                    $document_html = str_replace('../', '', $document_html);
298 298
                     $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/';
299 299
 
300 300
                     $doc = new DOMDocument();
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
                 if (!empty($document_html)) {
373 373
                     $this->pdf->WriteHTML($document_html.$page_break);
374 374
                 }
375
-            } elseif (in_array($extension, array('jpg','jpeg','png','gif'))) {
375
+            } elseif (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) {
376 376
                 //Images
377 377
                 $image = Display::img($file);
378 378
                 $this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
         //absolute path for frames.css //TODO: necessary?
437 437
         $absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css';
438
-        $document_html = str_replace('href="./css/frames.css"','href="'.$absolute_css_path.'"', $document_html);
438
+        $document_html = str_replace('href="./css/frames.css"', 'href="'.$absolute_css_path.'"', $document_html);
439 439
 
440 440
         $document_html = str_replace('../../', '', $document_html);
441 441
         $document_html = str_replace('../', '', $document_html);
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
                                 $old_src_fixed = str_replace(api_get_path(REL_COURSE_PATH).$course_data['path'].'/document/', '', $old_src);
464 464
                                 $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed);
465 465
                                 $new_path = $document_path.$old_src_fixed;
466
-                                $document_html= str_replace($old_src, $new_path, $document_html);
466
+                                $document_html = str_replace($old_src, $new_path, $document_html);
467 467
 
468 468
                             }
469 469
                         }
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates
483 483
 
484 484
         api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data.
485
-        $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8');  // TODO: Maybe it is better idea the title to be passed through
485
+        $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through
486 486
         // $_GET[] too, as it is done with file name.
487 487
         // At the moment the title is retrieved from the html document itself.
488 488
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         //$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file
505 505
 
506 506
         if ($outputMode == 'F') {
507
-            $output_file = api_get_path(SYS_ARCHIVE_PATH) . $output_file;
507
+            $output_file = api_get_path(SYS_ARCHIVE_PATH).$output_file;
508 508
         }
509 509
 
510 510
         if ($saveInFile) {
@@ -537,14 +537,14 @@  discard block
 block discarded – undo
537 537
         $web_path = false;
538 538
         if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
539 539
             $course_info = api_get_course_info($course_code);
540
-            $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png';   // course path
540
+            $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path
541 541
             if (file_exists($store_path)) {
542
-                $web_path   = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png';
542
+                $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png';
543 543
             }
544 544
         } else {
545
-            $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';   // course path
545
+            $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path
546 546
             if (file_exists($store_path))
547
-                $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
547
+                $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
548 548
         }
549 549
         return $web_path;
550 550
     }
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
     {
585 585
         if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
586 586
             $course_info = api_get_course_info($course_code);
587
-            $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'];   // course path
587
+            $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path
588 588
             $web_path   = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png';
589 589
         } else {
590
-            $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images';   // course path
590
+            $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path
591 591
             $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
592 592
         }
593 593
         $course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png';
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
      */
621 621
     public function set_footer()
622 622
     {
623
-        $this->pdf->defaultfooterfontsize = 12;   // in pts
624
-        $this->pdf->defaultfooterfontstyle = 'B';   // blank, B, I, or BI
625
-        $this->pdf->defaultfooterline = 1;        // 1 to include line below header/above footer
623
+        $this->pdf->defaultfooterfontsize = 12; // in pts
624
+        $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI
625
+        $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer
626 626
         $platform_name   = api_get_setting('Institution');
627 627
         $left_content    = $platform_name;
628 628
         $center_content  = '';
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
      */
690 690
     public function set_header($course_data)
691 691
     {
692
-        $this->pdf->defaultheaderfontsize   = 10;   // in pts
693
-        $this->pdf->defaultheaderfontstyle  = 'BI';   // blank, B, I, or BI
694
-        $this->pdf->defaultheaderline       = 1;    // 1 to include line below header/above footer
692
+        $this->pdf->defaultheaderfontsize   = 10; // in pts
693
+        $this->pdf->defaultheaderfontstyle  = 'BI'; // blank, B, I, or BI
694
+        $this->pdf->defaultheaderline       = 1; // 1 to include line below header/above footer
695 695
 
696 696
         if (!empty($course_data['code'])) {
697 697
             $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']);
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
             $teachers = '';
700 700
             if (!empty($teacher_list)) {
701 701
                 foreach ($teacher_list as $teacher) {
702
-                    $teachers[]= $teacher['firstname'].' '.$teacher['lastname'];
702
+                    $teachers[] = $teacher['firstname'].' '.$teacher['lastname'];
703 703
                 }
704 704
                 if (count($teachers) > 1) {
705 705
                     $teachers = get_lang('Teachers').': '.implode(', ', $teachers);
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                     'line' => 1,
767 767
                 ),
768 768
             );
769
-            $this->pdf->SetHeader($header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title);
769
+            $this->pdf->SetHeader($header); // ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title);
770 770
         }
771 771
     }
772 772
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
         $this->pdf->directionality = api_get_text_direction();
812 812
         $this->pdf->useOnlyCoreFonts = true;
813 813
         // Use different Odd/Even headers and footers and mirror margins
814
-        $this->pdf->mirrorMargins       = 1;
814
+        $this->pdf->mirrorMargins = 1;
815 815
 
816 816
         // Add decoration only if not stated otherwise
817 817
         if ($complete) {
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
                     $watermark_text = api_get_setting('pdf_export_watermark_text');
840 840
                 }
841 841
                 if (!empty($watermark_text)) {
842
-                    $this->pdf->SetWatermarkText(strcode2utf($watermark_text),0.1);
842
+                    $this->pdf->SetWatermarkText(strcode2utf($watermark_text), 0.1);
843 843
                     $this->pdf->showWatermarkText = true;
844 844
                 }
845 845
             }
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
             if (empty($this->custom_header)) {
848 848
                 self::set_header($course_data);
849 849
             } else {
850
-                $this->pdf->SetHTMLHeader($this->custom_header,'E');
851
-                $this->pdf->SetHTMLHeader($this->custom_header,'O');
850
+                $this->pdf->SetHTMLHeader($this->custom_header, 'E');
851
+                $this->pdf->SetHTMLHeader($this->custom_header, 'O');
852 852
             }
853 853
 
854 854
             if (empty($this->custom_footer)) {
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/receivers.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
 	 */
42 42
 	function _createElements()
43 43
 	{
44
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
44
+		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
45 45
 		$this->_elements[0]->setChecked(true);
46
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
46
+		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
47 47
 		$this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
48 48
 		$this->_elements[2]->setSelected($this->receivers_selected);
49 49
 	}
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -10,68 +10,68 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class HTML_QuickForm_receivers extends HTML_QuickForm_group
12 12
 {
13
-	/**
14
-	 * Array of all receivers
15
-	 */
16
-	var $receivers;
17
-	/**
18
-	 * Array of selected receivers
19
-	 */
20
-	var $receivers_selected;
13
+    /**
14
+     * Array of all receivers
15
+     */
16
+    var $receivers;
17
+    /**
18
+     * Array of selected receivers
19
+     */
20
+    var $receivers_selected;
21 21
 
22
-	/**
23
-	 * Constructor
24
-	 * @param string $elementName
25
-	 * @param string $elementLabel
26
-	 * @param array $attributes This should contain the keys 'receivers' and
27
-	 * 'receivers_selected'
28
-	 */
29
-	public function __construct($elementName = null, $elementLabel = null, $attributes = null)
30
-	{
31
-		$this->receivers = $attributes['receivers'];
32
-		$this->receivers_selected = $attributes['receivers_selected'];
33
-		unset($attributes['receivers']);
34
-		unset($attributes['receivers_selected']);
35
-		parent::__construct($elementName, $elementLabel, $attributes);
36
-		$this->_persistantFreeze = true;
37
-		$this->_appendName = true;
38
-		$this->_type = 'receivers';
39
-	}
22
+    /**
23
+     * Constructor
24
+     * @param string $elementName
25
+     * @param string $elementLabel
26
+     * @param array $attributes This should contain the keys 'receivers' and
27
+     * 'receivers_selected'
28
+     */
29
+    public function __construct($elementName = null, $elementLabel = null, $attributes = null)
30
+    {
31
+        $this->receivers = $attributes['receivers'];
32
+        $this->receivers_selected = $attributes['receivers_selected'];
33
+        unset($attributes['receivers']);
34
+        unset($attributes['receivers_selected']);
35
+        parent::__construct($elementName, $elementLabel, $attributes);
36
+        $this->_persistantFreeze = true;
37
+        $this->_appendName = true;
38
+        $this->_type = 'receivers';
39
+    }
40 40
 
41
-	/**
42
-	 * Create the form elements to build this element group
43
-	 */
44
-	function _createElements()
45
-	{
46
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
47
-		$this->_elements[0]->setChecked(true);
48
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
49
-		$this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
50
-		$this->_elements[2]->setSelected($this->receivers_selected);
51
-	}
41
+    /**
42
+     * Create the form elements to build this element group
43
+     */
44
+    function _createElements()
45
+    {
46
+        $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
47
+        $this->_elements[0]->setChecked(true);
48
+        $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
49
+        $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
50
+        $this->_elements[2]->setSelected($this->receivers_selected);
51
+    }
52 52
 
53
-	/**
54
-	 * HTML representation
55
-	 */
56
-	public function toHtml()
57
-	{
58
-		include_once ('HTML/QuickForm/Renderer/Default.php');
59
-		$this->_separator = '<br/>';
60
-		$renderer = & new HTML_QuickForm_Renderer_Default();
61
-		$renderer->setElementTemplate('{element}');
62
-		$select_boxes = $this->_elements[2];
63
-		$select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>');
64
-		parent :: accept($renderer);
65
-		$js = $this->getElementJS();
66
-		return $renderer->toHtml().$js;
67
-	}
53
+    /**
54
+     * HTML representation
55
+     */
56
+    public function toHtml()
57
+    {
58
+        include_once ('HTML/QuickForm/Renderer/Default.php');
59
+        $this->_separator = '<br/>';
60
+        $renderer = & new HTML_QuickForm_Renderer_Default();
61
+        $renderer->setElementTemplate('{element}');
62
+        $select_boxes = $this->_elements[2];
63
+        $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>');
64
+        parent :: accept($renderer);
65
+        $js = $this->getElementJS();
66
+        return $renderer->toHtml().$js;
67
+    }
68 68
 
69
-	/**
70
-	 * Get the necessary javascript
71
-	 */
69
+    /**
70
+     * Get the necessary javascript
71
+     */
72 72
     public function getElementJS()
73
-	{
74
-		$js = "<script type=\"text/javascript\">
73
+    {
74
+        $js = "<script type=\"text/javascript\">
75 75
 					/* <![CDATA[ */
76 76
 					receivers_hide('receivers_to');
77 77
 					function receivers_show(item) {
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 					}
85 85
 					/* ]]> */
86 86
 					</script>\n";
87
-		return $js;
88
-	}
89
-	/**
90
-	 * accept renderer
91
-	 */
92
-	function accept(& $renderer, $required = false, $error = null)
93
-	{
94
-		$renderer->renderElement($this, $required, $error);
95
-	}
87
+        return $js;
88
+    }
89
+    /**
90
+     * accept renderer
91
+     */
92
+    function accept(& $renderer, $required = false, $error = null)
93
+    {
94
+        $renderer->renderElement($this, $required, $error);
95
+    }
96 96
 }
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/DateRangePicker.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 class DateRangePicker extends HTML_QuickForm_text
8 8
 {
9 9
     /**
10
-    * Constructor
11
-    */
10
+     * Constructor
11
+     */
12 12
     public function __construct($elementName = null, $elementLabel = null, $attributes = null)
13 13
     {
14 14
         if (!isset($attributes['id'])) {
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
     /**
147
-    * @param array $dates result of parseDateRange()
148
-    *
149
-    * @return bool
150
-    */
147
+     * @param array $dates result of parseDateRange()
148
+     *
149
+     * @return bool
150
+     */
151 151
     public function validateDates($dates, $format = null)
152 152
     {
153 153
         if (empty($dates['start']) || empty($dates['end'])) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
         }
89 89
 
90 90
         $timePicker = 'true';
91
-        $timePickerValue =  $this->getAttribute('timePicker');
91
+        $timePickerValue = $this->getAttribute('timePicker');
92 92
         if (!empty($timePickerValue)) {
93 93
             $timePicker = $timePickerValue;
94 94
         }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/HtmlEditor.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@
 block discarded – undo
74 74
             $styleCss = $this->editor->getConfigAttribute('style');
75 75
 
76 76
             if ($styleCss) {
77
-               $style = true;
77
+                $style = true;
78 78
             } else {
79
-               $style = false;
79
+                $style = false;
80 80
             }
81 81
 
82 82
             return $this->buildEditor($style);
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/UsernameAvailable.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
  */
7 7
 class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule
8 8
 {
9
-	/**
10
-	 * Function to check if a username is available
11
-	 * @see HTML_QuickForm_Rule
12
-	 * @param string $username Wanted username
13
-	 * @param string $current_username
14
-	 * @return boolean True if username is available
15
-	 */
16
-	function validate($username, $current_username = null) {
17
-		$user_table = Database::get_main_table(TABLE_MAIN_USER);
9
+    /**
10
+     * Function to check if a username is available
11
+     * @see HTML_QuickForm_Rule
12
+     * @param string $username Wanted username
13
+     * @param string $current_username
14
+     * @return boolean True if username is available
15
+     */
16
+    function validate($username, $current_username = null) {
17
+        $user_table = Database::get_main_table(TABLE_MAIN_USER);
18 18
         $username = Database::escape_string($username);
19 19
         $current_username = Database::escape_string($current_username);
20 20
 
21
-		$sql = "SELECT * FROM $user_table WHERE username = '$username'";
22
-		if (!is_null($current_username)) {
23
-			$sql .= " AND username != '$current_username'";
24
-		}
25
-		$res = Database::query($sql);
26
-		$number = Database::num_rows($res);
27
-		return $number == 0;
28
-	}
21
+        $sql = "SELECT * FROM $user_table WHERE username = '$username'";
22
+        if (!is_null($current_username)) {
23
+            $sql .= " AND username != '$current_username'";
24
+        }
25
+        $res = Database::query($sql);
26
+        $number = Database::num_rows($res);
27
+        return $number == 0;
28
+    }
29 29
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/HTML.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     function validate($html, $mode = NO_HTML)
18 18
     {
19
-        $allowed_tags = self::get_allowed_tags ($mode, $fullpage);
19
+        $allowed_tags = self::get_allowed_tags($mode, $fullpage);
20 20
         $cleaned_html = kses($html, $allowed_tags);
21 21
         return $html == $cleaned_html;
22 22
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         // Include the allowed tags.
34 34
         //include(dirname(__FILE__).'/allowed_tags.inc.php');
35 35
         global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page;
36
-        switch($mode)
36
+        switch ($mode)
37 37
         {
38 38
             case NO_HTML:
39 39
                 return array();
Please login to merge, or discard this patch.
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,6 @@
 block discarded – undo
25 25
      * Get allowed tags
26 26
      * @param int $mode NO_HTML, STUDENT_HTML, TEACHER_HTML,
27 27
      * STUDENT_HTML_FULLPAGE or TEACHER_HTML_FULLPAGE
28
-     * @param boolean $fullpage If true, the allowed tags for full-page editing
29
-     * are returned.
30 28
      */
31 29
     static function get_allowed_tags($mode)
32 30
     {
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MultipleRequired.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
31
-    	{
32
-    		$value = implode(null,$value);
33
-    	}
30
+        if(is_array($value))
31
+        {
32
+            $value = implode(null,$value);
33
+        }
34 34
         if ((string)$value == '') {
35 35
             return false;
36 36
         }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
30
+    	if (is_array($value))
31 31
     	{
32
-    		$value = implode(null,$value);
32
+    		$value = implode(null, $value);
33 33
     	}
34
-        if ((string)$value == '') {
34
+        if ((string) $value == '') {
35 35
             return false;
36 36
         }
37 37
         return true;
Please login to merge, or discard this patch.
main/inc/lib/events_email.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
                 // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table
126 126
                 if ($event_config[$event_name]["sending_mail_once"]) {
127
-                    $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name)
127
+                    $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name)
128 128
                             VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'")
129 129
                     ';
130 130
                     Database::query($sql);
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
         // Second, we send to people linked to the event
136 136
         // So, we get everyone
137 137
         $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname
138
-                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
138
+                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue
139 139
                 INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id
140
-                WHERE event_type_name = "' . $event_name . '"';
140
+                WHERE event_type_name = "' . $event_name.'"';
141 141
         $result = Database::store_result(Database::query($sql), 'ASSOC');
142 142
         // for each of the linked users
143 143
         foreach ($result as $key => $value) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
             // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table
179 179
             if ($event_config[$event_name]["sending_mail_once"]) {
180
-                $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
180
+                $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).'
181 181
                     (user_from, user_to, event_type_name)
182 182
                     VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'");
183 183
                     ';
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
         $current_language = api_get_interface_language();
203 203
 
204 204
         $sql = 'SELECT COUNT(*) as total
205
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
206
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
205
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
206
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
207 207
                 ON em.language_id = l.id
208 208
                 WHERE
209
-                    em.event_type_name = "' . $event_name . '" and
209
+                    em.event_type_name = "' . $event_name.'" and
210 210
                     l.dokeos_folder = "'.$current_language.'" and
211 211
                     em.activated = 1';
212 212
 
213 213
         $exists = Database::store_result(Database::query($sql), 'ASSOC');
214
-        if ($exists[0]["total"])  {
214
+        if ($exists[0]["total"]) {
215 215
             return true;
216 216
         } else {
217 217
             return false;
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
     private static function getMessage($event_name, $language)
229 229
     {
230 230
         $sql = 'SELECT message, subject, l.dokeos_folder
231
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
232
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
231
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
232
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
233 233
                 ON em.language_id = l.id
234 234
                 WHERE
235
-                    em.event_type_name = "' . $event_name . '" AND
236
-                    (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND
235
+                    em.event_type_name = "' . $event_name.'" AND
236
+                    (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND
237 237
                     em.message <> ""
238 238
                 ';
239 239
         return Database::store_result(Database::query($sql), 'ASSOC');
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data)
275 275
     {
276 276
         foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) {
277
-            $message = str_replace('((' . $key . '))', $event_data[$word], $message);
278
-            $subject = str_replace('((' . $key . '))', $event_data[$word], $subject);
277
+            $message = str_replace('(('.$key.'))', $event_data[$word], $message);
278
+            $subject = str_replace('(('.$key.'))', $event_data[$word], $subject);
279 279
         }
280 280
     }
281 281
 }
Please login to merge, or discard this patch.