Completed
Pull Request — master (#1795)
by Christian
16:22 queued 04:43
created
drupal/sites/all/libraries/phpmailer/class.pop3.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
      * Connect to a POP3 server.
201 201
      * @access public
202 202
      * @param string $host
203
-     * @param integer|boolean $port
203
+     * @param integer $port
204 204
      * @param integer $tval
205 205
      * @return boolean
206 206
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -276,11 +276,11 @@
 block discarded – undo
276 276
         }
277 277
 
278 278
         // Send the Username
279
-        $this->sendString("USER $username" . self::CRLF);
279
+        $this->sendString("USER $username".self::CRLF);
280 280
         $pop3_response = $this->getResponse();
281 281
         if ($this->checkResponse($pop3_response)) {
282 282
             // Send the Password
283
-            $this->sendString("PASS $password" . self::CRLF);
283
+            $this->sendString("PASS $password".self::CRLF);
284 284
             $pop3_response = $this->getResponse();
285 285
             if ($this->checkResponse($pop3_response)) {
286 286
                 return true;
Please login to merge, or discard this patch.
drupal/sites/all/libraries/phpmailer/extras/htmlfilter.php 2 patches
Doc Comments   +11 added lines, -2 removed lines patch added patch discarded remove patch
@@ -663,6 +663,12 @@  discard block
 block discarded – undo
663 663
     }
664 664
 }
665 665
 
666
+/**
667
+ * @param string $body
668
+ * @param integer $pos
669
+ * @param string $trans_image_path
670
+ * @param boolean $block_external_images
671
+ */
666 672
 function tln_fixstyle($body, $pos, $trans_image_path, $block_external_images)
667 673
 {
668 674
     // workaround for </style> in between comments
@@ -788,6 +794,9 @@  discard block
 block discarded – undo
788 794
     return array($content, $newpos);
789 795
 }
790 796
 
797
+/**
798
+ * @param string $trans_image_path
799
+ */
791 800
 function tln_body2div($attary, $trans_image_path)
792 801
 {
793 802
     $divattary = array('class' => "'bodyclass'");
@@ -828,8 +837,8 @@  discard block
 block discarded – undo
828 837
  *
829 838
  * @param string $body                    The HTML you wish to filter
830 839
  * @param array $tag_list                see description above
831
- * @param array $rm_tags_with_content see description above
832
- * @param array $self_closing_tags    see description above
840
+ * @param string[] $rm_tags_with_content see description above
841
+ * @param string[] $self_closing_tags    see description above
833 842
  * @param boolean $force_tag_closing    see description above
834 843
  * @param array $rm_attnames            see description above
835 844
  * @param array $bad_attvals            see description above
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 function tln_tagprint($tagname, $attary, $tagtype)
42 42
 {
43 43
     if ($tagtype == 2) {
44
-        $fulltag = '</' . $tagname . '>';
44
+        $fulltag = '</'.$tagname.'>';
45 45
     } else {
46
-        $fulltag = '<' . $tagname;
46
+        $fulltag = '<'.$tagname;
47 47
         if (is_array($attary) && sizeof($attary)) {
48 48
             $atts = array();
49 49
             while (list($attname, $attvalue) = each($attary)) {
50 50
                 array_push($atts, "$attname=$attvalue");
51 51
             }
52
-            $fulltag .= ' ' . join(' ', $atts);
52
+            $fulltag .= ' '.join(' ', $atts);
53 53
         }
54 54
         if ($tagtype == 3) {
55 55
             $fulltag .= ' /';
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 {
129 129
     $matches = array();
130 130
     $retarr = array();
131
-    $preg_rule = '%^(.*?)(' . $reg . ')%s';
131
+    $preg_rule = '%^(.*?)('.$reg.')%s';
132 132
     preg_match($preg_rule, substr($body, $offset), $matches);
133 133
     if (!isset($matches[0]) || !$matches[0]) {
134 134
         $retarr = false;
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                     }
383 383
                     list($pos, $attval, $match) = $regary;
384 384
                     $pos++;
385
-                    $attary{$attname} = '\'' . $attval . '\'';
385
+                    $attary{$attname} = '\''.$attval.'\'';
386 386
                 } elseif ($quot == '"') {
387 387
                     $regary = tln_findnxreg($body, $pos + 1, '\"');
388 388
                     if ($regary == false) {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     }
391 391
                     list($pos, $attval, $match) = $regary;
392 392
                     $pos++;
393
-                            $attary{$attname} = '"' . $attval . '"';
393
+                            $attary{$attname} = '"'.$attval.'"';
394 394
                 } else {
395 395
                     /**
396 396
                      * These are hateful. Look for \s, or >.
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
                      * If it's ">" it will be caught at the top.
405 405
                      */
406 406
                     $attval = preg_replace('/\"/s', '&quot;', $attval);
407
-                    $attary{$attname} = '"' . $attval . '"';
407
+                    $attary{$attname} = '"'.$attval.'"';
408 408
                 }
409 409
             } elseif (preg_match('|[\w/>]|', $char)) {
410 410
                 /**
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
             }
577 577
             preg_match_all("/url\s*\((.+)\)/si", $attvalue, $aMatch);
578 578
             if (count($aMatch)) {
579
-                foreach($aMatch[1] as $sMatch) {
579
+                foreach ($aMatch[1] as $sMatch) {
580 580
                     $urlvalue = $sMatch;
581 581
                     tln_fixurl($attname, $urlvalue, $trans_image_path, $block_external_images);
582 582
                     $attary{$attname} = str_replace($sMatch, $urlvalue, $attvalue);
@@ -599,10 +599,10 @@  discard block
 block discarded – undo
599 599
 {
600 600
     $sQuote = '"';
601 601
     $attvalue = trim($attvalue);
602
-    if ($attvalue && ($attvalue[0] =='"'|| $attvalue[0] == "'")) {
602
+    if ($attvalue && ($attvalue[0] == '"' || $attvalue[0] == "'")) {
603 603
         // remove the double quotes
604 604
         $sQuote = $attvalue[0];
605
-        $attvalue = trim(substr($attvalue,1,-1));
605
+        $attvalue = trim(substr($attvalue, 1, -1));
606 606
     }
607 607
 
608 608
     /**
@@ -612,51 +612,51 @@  discard block
 block discarded – undo
612 612
      * IE from being kicked off when src for img tags are not set
613 613
      */
614 614
     if ($attvalue == '') {
615
-        $attvalue = $sQuote . $trans_image_path . $sQuote;
615
+        $attvalue = $sQuote.$trans_image_path.$sQuote;
616 616
     } else {
617 617
         // first, disallow 8 bit characters and control characters
618
-        if (preg_match('/[\0-\37\200-\377]+/',$attvalue)) {
618
+        if (preg_match('/[\0-\37\200-\377]+/', $attvalue)) {
619 619
             switch ($attname) {
620 620
                 case 'href':
621
-                    $attvalue = $sQuote . 'http://invalid-stuff-detected.example.com' . $sQuote;
621
+                    $attvalue = $sQuote.'http://invalid-stuff-detected.example.com'.$sQuote;
622 622
                     break;
623 623
                 default:
624
-                    $attvalue = $sQuote . $trans_image_path . $sQuote;
624
+                    $attvalue = $sQuote.$trans_image_path.$sQuote;
625 625
                     break;
626 626
             }
627 627
         } else {
628 628
             $aUrl = parse_url($attvalue);
629 629
             if (isset($aUrl['scheme'])) {
630
-                switch(strtolower($aUrl['scheme'])) {
630
+                switch (strtolower($aUrl['scheme'])) {
631 631
                     case 'mailto':
632 632
                     case 'http':
633 633
                     case 'https':
634 634
                     case 'ftp':
635 635
                         if ($attname != 'href') {
636 636
                             if ($block_external_images == true) {
637
-                                $attvalue = $sQuote . $trans_image_path . $sQuote;
637
+                                $attvalue = $sQuote.$trans_image_path.$sQuote;
638 638
                             } else {
639 639
                                 if (!isset($aUrl['path'])) {
640
-                                    $attvalue = $sQuote . $trans_image_path . $sQuote;
640
+                                    $attvalue = $sQuote.$trans_image_path.$sQuote;
641 641
                                 }
642 642
                             }
643 643
                         } else {
644
-                            $attvalue = $sQuote . $attvalue . $sQuote;
644
+                            $attvalue = $sQuote.$attvalue.$sQuote;
645 645
                         }
646 646
                         break;
647 647
                     case 'outbind':
648
-                        $attvalue = $sQuote . $attvalue . $sQuote;
648
+                        $attvalue = $sQuote.$attvalue.$sQuote;
649 649
                         break;
650 650
                     case 'cid':
651
-                        $attvalue = $sQuote . $attvalue . $sQuote;
651
+                        $attvalue = $sQuote.$attvalue.$sQuote;
652 652
                         break;
653 653
                     default:
654
-                        $attvalue = $sQuote . $trans_image_path . $sQuote;
654
+                        $attvalue = $sQuote.$trans_image_path.$sQuote;
655 655
                         break;
656 656
                 }
657 657
             } else {
658 658
                 if (!isset($aUrl['path']) || $aUrl['path'] != $trans_image_path) {
659
-                    $$attvalue = $sQuote . $trans_image_path . $sQuote;
659
+                    $$attvalue = $sQuote.$trans_image_path.$sQuote;
660 660
                 }
661 661
             }
662 662
         }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
     $sToken = '';
671 671
     $bSucces = false;
672 672
     $bEndTag = false;
673
-    for ($i=$pos,$iCount=strlen($body);$i<$iCount;++$i) {
673
+    for ($i = $pos, $iCount = strlen($body); $i < $iCount; ++$i) {
674 674
         $char = $body{$i};
675 675
         switch ($char) {
676 676
             case '<':
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
             case '>':
688 688
                  if ($bEndTag) {
689 689
                     $sToken .= $char;
690
-                    if (preg_match('/\<\/\s*style\s*\>/i',$sToken,$aMatch)) {
690
+                    if (preg_match('/\<\/\s*style\s*\>/i', $sToken, $aMatch)) {
691 691
                         $newpos = $i + 1;
692 692
                         $bSucces = true;
693 693
                         break 2;
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
             case '!':
703 703
                 if ($sToken == '<') {
704 704
                     // possible comment
705
-                    if (isset($body{$i+2}) && substr($body,$i,3) == '!--') {
706
-                        $i = strpos($body,'-->',$i+3);
705
+                    if (isset($body{$i + 2}) && substr($body, $i, 3) == '!--') {
706
+                        $i = strpos($body, '-->', $i + 3);
707 707
                         if ($i === false) { // no end comment
708 708
                             $i = strlen($body);
709 709
                         }
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
                 break;
723 723
         }
724 724
     }
725
-    if ($bSucces == FALSE){
725
+    if ($bSucces == FALSE) {
726 726
         return array(FALSE, strlen($body));
727 727
     }
728 728
 
@@ -743,26 +743,26 @@  discard block
 block discarded – undo
743 743
     //                           "url(\\1$trans_image_path\\2)", $content);
744 744
 
745 745
     // first check for 8bit sequences and disallowed control characters
746
-    if (preg_match('/[\16-\37\200-\377]+/',$content)) {
746
+    if (preg_match('/[\16-\37\200-\377]+/', $content)) {
747 747
         $content = '<!-- style block removed by html filter due to presence of 8bit characters -->';
748 748
         return array($content, $newpos);
749 749
     }
750 750
 
751 751
     // remove @import line
752
-    $content = preg_replace("/^\s*(@import.*)$/mi","\n<!-- @import rules forbidden -->\n",$content);
752
+    $content = preg_replace("/^\s*(@import.*)$/mi", "\n<!-- @import rules forbidden -->\n", $content);
753 753
 
754 754
     $content = preg_replace("/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i", 'url', $content);
755
-    preg_match_all("/url\s*\((.+)\)/si",$content,$aMatch);
755
+    preg_match_all("/url\s*\((.+)\)/si", $content, $aMatch);
756 756
     if (count($aMatch)) {
757 757
         $aValue = $aReplace = array();
758
-        foreach($aMatch[1] as $sMatch) {
758
+        foreach ($aMatch[1] as $sMatch) {
759 759
             // url value
760 760
             $urlvalue = $sMatch;
761
-            tln_fixurl('style',$urlvalue, $trans_image_path, $block_external_images);
761
+            tln_fixurl('style', $urlvalue, $trans_image_path, $block_external_images);
762 762
             $aValue[] = $sMatch;
763 763
             $aReplace[] = $urlvalue;
764 764
         }
765
-        $content = str_replace($aValue,$aReplace,$content);
765
+        $content = str_replace($aValue, $aReplace, $content);
766 766
     }
767 767
 
768 768
     /**
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
     tln_defang($contentTemp);
773 773
     tln_unspace($contentTemp);
774 774
 
775
-    $match   = Array('/\/\*.*\*\//',
775
+    $match = Array('/\/\*.*\*\//',
776 776
                     '/expression/i',
777 777
                     '/behaviou*r/i',
778 778
                     '/binding/i',
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
                     '/javascript/i',
781 781
                     '/script/i',
782 782
                     '/position/i');
783
-    $replace = Array('','idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', '');
783
+    $replace = Array('', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', 'idiocy', '');
784 784
     $contentNew = preg_replace($match, $replace, $contentTemp);
785 785
     if ($contentNew !== $contentTemp) {
786 786
         $content = $contentNew;
@@ -794,11 +794,11 @@  discard block
 block discarded – undo
794 794
     $text = '#000000';
795 795
     $has_bgc_stl = $has_txt_stl = false;
796 796
     $styledef = '';
797
-    if (is_array($attary) && sizeof($attary) > 0){
798
-        foreach ($attary as $attname=>$attvalue){
797
+    if (is_array($attary) && sizeof($attary) > 0) {
798
+        foreach ($attary as $attname=>$attvalue) {
799 799
             $quotchar = substr($attvalue, 0, 1);
800 800
             $attvalue = str_replace($quotchar, "", $attvalue);
801
-            switch ($attname){
801
+            switch ($attname) {
802 802
                 case 'background':
803 803
                     $styledef .= "background-image: url('$trans_image_path'); ";
804 804
                     break;
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
         if ($has_bgc_stl && !$has_txt_stl) {
818 818
             $styledef .= "color: $text; ";
819 819
         }
820
-        if (strlen($styledef) > 0){
820
+        if (strlen($styledef) > 0) {
821 821
             $divattary{"style"} = "\"$styledef\"";
822 822
         }
823 823
     }
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
     $body = preg_replace('/&(\{.*?\};)/si', '&amp;\\1', $body);
875 875
     while (($curtag = tln_getnxtag($body, $curpos)) != false) {
876 876
         list($tagname, $attary, $tagtype, $lt, $gt) = $curtag;
877
-        $free_content = substr($body, $curpos, $lt-$curpos);
877
+        $free_content = substr($body, $curpos, $lt - $curpos);
878 878
         /**
879 879
          * Take care of <style>
880 880
          */
881
-        if ($tagname == "style" && $tagtype == 1){
881
+        if ($tagname == "style" && $tagtype == 1) {
882 882
             list($free_content, $curpos) =
883
-                tln_fixstyle($body, $gt+1, $trans_image_path, $block_external_images);
884
-            if ($free_content != FALSE){
885
-                if ( !empty($attary) ) {
883
+                tln_fixstyle($body, $gt + 1, $trans_image_path, $block_external_images);
884
+            if ($free_content != FALSE) {
885
+                if (!empty($attary)) {
886 886
                     $attary = tln_fixatts($tagname,
887 887
                                          $attary,
888 888
                                          $rm_attnames,
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
             }
899 899
             continue;
900 900
         }
901
-        if ($skip_content == false){
901
+        if ($skip_content == false) {
902 902
             $trusted .= $free_content;
903 903
         }
904 904
         if ($tagname != false) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
                             /**
957 957
                              * Convert body into div.
958 958
                              */
959
-                            if ($tagname == "body"){
959
+                            if ($tagname == "body") {
960 960
                                 $tagname = "div";
961 961
                                 $attary = tln_body2div($attary, $trans_image_path);
962 962
                             }
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
     if ($force_tag_closing == true) {
996 996
         foreach ($open_tags as $tagname => $opentimes) {
997 997
             while ($opentimes > 0) {
998
-                $trusted .= '</' . $tagname . '>';
998
+                $trusted .= '</'.$tagname.'>';
999 999
                 $opentimes--;
1000 1000
             }
1001 1001
         }
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
         "xml"
1038 1038
     );
1039 1039
 
1040
-    $self_closing_tags =  array(
1040
+    $self_closing_tags = array(
1041 1041
         "img",
1042 1042
         "br",
1043 1043
         "hr",
Please login to merge, or discard this patch.
drupal/sites/all/libraries/phpmailer/extras/ntlm_sasl_client.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -18,6 +18,9 @@  discard block
 block discarded – undo
18 18
     public $credentials = array();
19 19
     public $state = SASL_NTLM_STATE_START;
20 20
 
21
+    /**
22
+     * @param stdClass $client
23
+     */
21 24
     public function initialize(&$client)
22 25
     {
23 26
         if (!function_exists($function = "mcrypt_encrypt")
@@ -63,6 +66,9 @@  discard block
 block discarded – undo
63 66
         );
64 67
     }
65 68
 
69
+    /**
70
+     * @param string $challenge
71
+     */
66 72
     public function NTLMResponse($challenge, $password)
67 73
     {
68 74
         $unicode = $this->ASCIIToUnicode($password);
@@ -85,6 +91,9 @@  discard block
 block discarded – undo
85 91
         return $response;
86 92
     }
87 93
 
94
+    /**
95
+     * @param string $ntlm_response
96
+     */
88 97
     public function typeMsg3($ntlm_response, $user, $domain, $workstation)
89 98
     {
90 99
         $domain_unicode = $this->ASCIIToUnicode($domain);
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                 "mcrypt_encrypt" => "mcrypt",
28 28
                 "mhash" => "mhash"
29 29
             );
30
-            $client->error = "the extension " . $extensions[$function] .
30
+            $client->error = "the extension ".$extensions[$function].
31 31
                 " required by the NTLM SASL client class is not available in this PHP configuration";
32 32
             return (0);
33 33
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function ASCIIToUnicode($ascii)
38 38
     {
39 39
         for ($unicode = "", $a = 0; $a < strlen($ascii); $a++) {
40
-            $unicode .= substr($ascii, $a, 1) . chr(0);
40
+            $unicode .= substr($ascii, $a, 1).chr(0);
41 41
         }
42 42
         return ($unicode);
43 43
     }
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
         $workstation_offset = 32;
50 50
         $domain_offset = $workstation_offset + $workstation_length;
51 51
         return (
52
-            "NTLMSSP\0" .
53
-            "\x01\x00\x00\x00" .
54
-            "\x07\x32\x00\x00" .
55
-            pack("v", $domain_length) .
56
-            pack("v", $domain_length) .
57
-            pack("V", $domain_offset) .
58
-            pack("v", $workstation_length) .
59
-            pack("v", $workstation_length) .
60
-            pack("V", $workstation_offset) .
61
-            $workstation .
52
+            "NTLMSSP\0".
53
+            "\x01\x00\x00\x00".
54
+            "\x07\x32\x00\x00".
55
+            pack("v", $domain_length).
56
+            pack("v", $domain_length).
57
+            pack("V", $domain_offset).
58
+            pack("v", $workstation_length).
59
+            pack("v", $workstation_length).
60
+            pack("V", $workstation_offset).
61
+            $workstation.
62 62
             $domain
63 63
         );
64 64
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $unicode = $this->ASCIIToUnicode($password);
69 69
         $md4 = mhash(MHASH_MD4, $unicode);
70
-        $padded = $md4 . str_repeat(chr(0), 21 - strlen($md4));
70
+        $padded = $md4.str_repeat(chr(0), 21 - strlen($md4));
71 71
         $iv_size = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB);
72 72
         $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
73 73
         for ($response = "", $third = 0; $third < 21; $third += 7) {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             }
77 77
             for ($key = "", $p = 0; $p < strlen($packed); $p += 7) {
78 78
                 $s = substr($packed, $p, 7);
79
-                $b = $s . ((substr_count($s, "1") % 2) ? "0" : "1");
79
+                $b = $s.((substr_count($s, "1")%2) ? "0" : "1");
80 80
                 $key .= chr(bindec($b));
81 81
             }
82 82
             $ciphertext = mcrypt_encrypt(MCRYPT_DES, $key, $challenge, MCRYPT_MODE_ECB, $iv);
@@ -106,31 +106,31 @@  discard block
 block discarded – undo
106 106
         $session_length = strlen($session);
107 107
         $session_offset = $ntlm_offset + $ntlm_length;
108 108
         return (
109
-            "NTLMSSP\0" .
110
-            "\x03\x00\x00\x00" .
111
-            pack("v", $lm_length) .
112
-            pack("v", $lm_length) .
113
-            pack("V", $lm_offset) .
114
-            pack("v", $ntlm_length) .
115
-            pack("v", $ntlm_length) .
116
-            pack("V", $ntlm_offset) .
117
-            pack("v", $domain_length) .
118
-            pack("v", $domain_length) .
119
-            pack("V", $domain_offset) .
120
-            pack("v", $user_length) .
121
-            pack("v", $user_length) .
122
-            pack("V", $user_offset) .
123
-            pack("v", $workstation_length) .
124
-            pack("v", $workstation_length) .
125
-            pack("V", $workstation_offset) .
126
-            pack("v", $session_length) .
127
-            pack("v", $session_length) .
128
-            pack("V", $session_offset) .
129
-            "\x01\x02\x00\x00" .
130
-            $domain_unicode .
131
-            $user_unicode .
132
-            $workstation_unicode .
133
-            $lm .
109
+            "NTLMSSP\0".
110
+            "\x03\x00\x00\x00".
111
+            pack("v", $lm_length).
112
+            pack("v", $lm_length).
113
+            pack("V", $lm_offset).
114
+            pack("v", $ntlm_length).
115
+            pack("v", $ntlm_length).
116
+            pack("V", $ntlm_offset).
117
+            pack("v", $domain_length).
118
+            pack("v", $domain_length).
119
+            pack("V", $domain_offset).
120
+            pack("v", $user_length).
121
+            pack("v", $user_length).
122
+            pack("V", $user_offset).
123
+            pack("v", $workstation_length).
124
+            pack("v", $workstation_length).
125
+            pack("V", $workstation_offset).
126
+            pack("v", $session_length).
127
+            pack("v", $session_length).
128
+            pack("V", $session_offset).
129
+            "\x01\x02\x00\x00".
130
+            $domain_unicode.
131
+            $user_unicode.
132
+            $workstation_unicode.
133
+            $lm.
134 134
             $ntlm
135 135
         );
136 136
     }
Please login to merge, or discard this patch.
drupal/sites/all/themes/zen/template.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * @param $breadcrumb
33 33
  *   An array containing the breadcrumb links.
34 34
  * @return
35
- *   A string containing the breadcrumb output.
35
+ string   A string containing the breadcrumb output.
36 36
  */
37 37
 function zen_breadcrumb($breadcrumb) {
38 38
   // Determine if we are to display the breadcrumb.
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  *   See http://juicystudio.com/article/screen-readers-display-none.php
88 88
  *   and http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
89 89
  * @return
90
- *   A string containing an unordered list of links.
90
+ string   A string containing an unordered list of links.
91 91
  */
92 92
 function zen_links($links, $attributes = array('class' => 'links'), $heading = '') {
93 93
   global $language;
@@ -600,10 +600,10 @@  discard block
 block discarded – undo
600 600
    * Do not pass one string containing multiple classes as they will be
601 601
    * incorrectly concatenated with dashes, i.e. "one two" will become "one-two".
602 602
    *
603
-   * @param $class
603
+   * @param string $class
604 604
    *   The class name to clean.
605 605
    * @return
606
-   *   The cleaned class name.
606
+   string   The cleaned class name.
607 607
    */
608 608
   function drupal_html_class($class) {
609 609
     // By default, we filter using Drupal's coding standards.
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
    * @param $id
634 634
    *   The ID to clean.
635 635
    * @return
636
-   *   The cleaned ID.
636
+   string   The cleaned ID.
637 637
    */
638 638
   function drupal_html_id($id) {
639 639
     $id = strtr(drupal_strtolower($id), array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function zen_theme(&$existing, $type, $theme, $path) {
24 24
   // When #341140 is fixed, replace _zen_path() with drupal_get_path().
25
-  include_once './' . _zen_path() . '/zen-internals/template.theme-registry.inc';
25
+  include_once './'._zen_path().'/zen-internals/template.theme-registry.inc';
26 26
   return _zen_theme($existing, $type, $theme, $path);
27 27
 }
28 28
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
       elseif (theme_get_setting('zen_breadcrumb_trailing')) {
58 58
         $trailing_separator = $breadcrumb_separator;
59 59
       }
60
-      return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>";
60
+      return '<div class="breadcrumb">'.implode($breadcrumb_separator, $breadcrumb)."$trailing_separator$title</div>";
61 61
     }
62 62
   }
63 63
   // Otherwise, return an empty string.
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
           'level' => 'h2',
107 107
         );
108 108
       }
109
-      $output .= '<' . $heading['level'];
109
+      $output .= '<'.$heading['level'];
110 110
       if (!empty($heading['class'])) {
111 111
         $output .= drupal_attributes(array('class' => $heading['class']));
112 112
       }
113
-      $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
113
+      $output .= '>'.check_plain($heading['text']).'</'.$heading['level'].'>';
114 114
     }
115 115
 
116
-    $output .= '<ul'. drupal_attributes($attributes) .'>';
116
+    $output .= '<ul'.drupal_attributes($attributes).'>';
117 117
 
118 118
     $num_links = count($links);
119 119
     $i = 1;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
           && (empty($link['language']) || $link['language']->language == $language->language)) {
133 133
         $class .= ' active';
134 134
       }
135
-      $output .= '<li'. drupal_attributes(array('class' => $class)) .'>';
135
+      $output .= '<li'.drupal_attributes(array('class' => $class)).'>';
136 136
 
137 137
       if (isset($link['href'])) {
138 138
         // Pass in $link as $options, they share the same keys.
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         if (isset($link['attributes'])) {
148 148
           $span_attributes = drupal_attributes($link['attributes']);
149 149
         }
150
-        $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
150
+        $output .= '<span'.$span_attributes.'>'.$link['title'].'</span>';
151 151
       }
152 152
 
153 153
       $i++;
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
   }
170 170
 
171 171
   // If an item is a LOCAL TASK, render it as a tab
172
-  if ($link['type'] & MENU_IS_LOCAL_TASK) {
173
-    $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>';
172
+  if ($link['type']&MENU_IS_LOCAL_TASK) {
173
+    $link['title'] = '<span class="tab">'.check_plain($link['title']).'</span>';
174 174
     $link['localized_options']['html'] = TRUE;
175 175
   }
176 176
 
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
   }
196 196
 
197 197
   if ($primary) {
198
-    $output .= '<ul class="tabs primary clearfix">' . $primary . '</ul>';
198
+    $output .= '<ul class="tabs primary clearfix">'.$primary.'</ul>';
199 199
   }
200 200
   if ($secondary) {
201
-    $output .= '<ul class="tabs secondary clearfix">' . $secondary . '</ul>';
201
+    $output .= '<ul class="tabs secondary clearfix">'.$secondary.'</ul>';
202 202
   }
203 203
 
204 204
   return $output;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     $elements['#region'] = $region;
254 254
 
255 255
     // Set the theme hook suggestions.
256
-    $hook = array('region_' . $region);
256
+    $hook = array('region_'.$region);
257 257
     if (strpos($region, 'sidebar_') === 0) {
258 258
       $hook[] = 'region_sidebar';
259 259
     }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     // Views (and possibly other modules) have templates with a $classes
296 296
     // variable that isn't a string, so we leave those variables alone.
297 297
     if (is_string($vars[$key])) {
298
-      $vars['classes_array'] = explode(' ', $hook . ' ' . $vars[$key]);
298
+      $vars['classes_array'] = explode(' ', $hook.' '.$vars[$key]);
299 299
       unset($vars[$key]);
300 300
     }
301 301
   }
@@ -319,37 +319,37 @@  discard block
 block discarded – undo
319 319
 function zen_preprocess_page(&$vars, $hook) {
320 320
   // If the user is silly and enables Zen as the theme, add some styles.
321 321
   if ($GLOBALS['theme'] == 'zen') {
322
-    include_once './' . _zen_path() . '/zen-internals/template.zen.inc';
322
+    include_once './'._zen_path().'/zen-internals/template.zen.inc';
323 323
     _zen_preprocess_page($vars, $hook);
324 324
   }
325 325
   // Add conditional stylesheets.
326 326
   elseif (!module_exists('conditional_styles')) {
327 327
     $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : '';
328
-    $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, '');
328
+    $vars['conditional_styles'] = variable_get('conditional_styles_'.$GLOBALS['theme'].$language, '');
329 329
     $vars['styles'] .= $vars['conditional_styles'];
330 330
   }
331 331
 
332 332
   // Classes for body element. Allows advanced theming based on context
333 333
   // (home page, node of certain type, etc.)
334 334
   // Remove the mostly useless page-ARG0 class.
335
-  if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. drupal_strtolower(arg(0))), $vars['classes_array'])) {
335
+  if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'.drupal_strtolower(arg(0))), $vars['classes_array'])) {
336 336
     unset($vars['classes_array'][$index]);
337 337
   }
338 338
   if (!$vars['is_front']) {
339 339
     // Add unique class for each page.
340 340
     $path = drupal_get_path_alias($_GET['q']);
341
-    $vars['classes_array'][] = drupal_html_class('page-' . $path);
341
+    $vars['classes_array'][] = drupal_html_class('page-'.$path);
342 342
     // Add unique class for each website section.
343
-    list($section, ) = explode('/', $path, 2);
343
+    list($section,) = explode('/', $path, 2);
344 344
     if (arg(0) == 'node') {
345 345
       if (arg(1) == 'add') {
346 346
         $section = 'node-add';
347 347
       }
348 348
       elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
349
-        $section = 'node-' . arg(2);
349
+        $section = 'node-'.arg(2);
350 350
       }
351 351
     }
352
-    $vars['classes_array'][] = drupal_html_class('section-' . $section);
352
+    $vars['classes_array'][] = drupal_html_class('section-'.$section);
353 353
   }
354 354
   if (theme_get_setting('zen_wireframes')) {
355 355
     $vars['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style.
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
     }
377 377
     else {
378 378
       $vars['classes_array'][] = 'one-sidebar';
379
-      $vars['classes_array'][] = 'sidebar-' . $vars['layout'];
379
+      $vars['classes_array'][] = 'sidebar-'.$vars['layout'];
380 380
     }
381 381
   }
382 382
   // Store the menu item since it has some useful information.
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
 function zen_preprocess_maintenance_page(&$vars, $hook) {
407 407
   // If Zen is the maintenance theme, add some styles.
408 408
   if ($GLOBALS['theme'] == 'zen') {
409
-    include_once './' . _zen_path() . '/zen-internals/template.zen.inc';
409
+    include_once './'._zen_path().'/zen-internals/template.zen.inc';
410 410
     _zen_preprocess_page($vars, $hook);
411 411
   }
412 412
   // Add conditional stylesheets.
413 413
   elseif (!module_exists('conditional_styles')) {
414 414
     $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : '';
415
-    $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, '');
415
+    $vars['conditional_styles'] = variable_get('conditional_styles_'.$GLOBALS['theme'].$language, '');
416 416
     $vars['styles'] .= $vars['conditional_styles'];
417 417
   }
418 418
 }
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
   $vars['user_picture'] = $vars['picture'];
460 460
 
461 461
   // Create the Drupal 7 $display_submitted variable.
462
-  $vars['display_submitted'] = theme_get_setting('toggle_node_info_' . $vars['node']->type);
462
+  $vars['display_submitted'] = theme_get_setting('toggle_node_info_'.$vars['node']->type);
463 463
 
464 464
   // Special classes for nodes.
465 465
   // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc.
466
-  $vars['classes_array'][] = drupal_html_class('node-type-' . $vars['type']);
466
+  $vars['classes_array'][] = drupal_html_class('node-type-'.$vars['type']);
467 467
   if ($vars['promote']) {
468 468
     $vars['classes_array'][] = 'node-promoted';
469 469
   }
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
   if (isset($vars['preview'])) {
487 487
     $vars['classes_array'][] = 'node-preview';
488 488
   }
489
-  $vars['classes_array'][] = 'build-mode-' . $vars['build_mode'] ;
489
+  $vars['classes_array'][] = 'build-mode-'.$vars['build_mode'];
490 490
 }
491 491
 
492 492
 /**
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
  *   The name of the template being rendered ("comment" in this case.)
499 499
  */
500 500
 function zen_preprocess_comment(&$vars, $hook) {
501
-  include_once './' . _zen_path() . '/zen-internals/template.comment.inc';
501
+  include_once './'._zen_path().'/zen-internals/template.comment.inc';
502 502
   _zen_preprocess_comment($vars, $hook);
503 503
 }
504 504
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
   $vars['region'] = $vars['elements']['#region'];
517 517
 
518 518
   // Setup the default classes.
519
-  $vars['classes_array'] = array('region', 'region-' . str_replace('_', '-', $vars['region']));
519
+  $vars['classes_array'] = array('region', 'region-'.str_replace('_', '-', $vars['region']));
520 520
 
521 521
   // Sidebar regions get a couple extra classes.
522 522
   if (strpos($vars['region'], 'sidebar_') === 0) {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
   $vars['title'] = $block->subject;
543 543
 
544 544
   // Special classes for blocks.
545
-  $vars['classes_array'][] = 'block-' . $block->module;
545
+  $vars['classes_array'][] = 'block-'.$block->module;
546 546
   // Classes describing the position of the block within the region.
547 547
   if ($vars['block_id'] == 1) {
548 548
     $vars['classes_array'][] = 'first';
@@ -550,17 +550,17 @@  discard block
 block discarded – undo
550 550
   if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) {
551 551
     $vars['classes_array'][] = 'last';
552 552
   }
553
-  $vars['classes_array'][] = 'region-' . $vars['block_zebra'];
553
+  $vars['classes_array'][] = 'region-'.$vars['block_zebra'];
554 554
   $vars['classes_array'][] = $vars['zebra'];
555
-  $vars['classes_array'][] = 'region-count-' . $vars['block_id'];
556
-  $vars['classes_array'][] = 'count-' . $vars['id'];
555
+  $vars['classes_array'][] = 'region-count-'.$vars['block_id'];
556
+  $vars['classes_array'][] = 'count-'.$vars['id'];
557 557
 
558 558
   // Create the block ID.
559
-  $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta;
559
+  $vars['block_html_id'] = 'block-'.$block->module.'-'.$block->delta;
560 560
 
561 561
   $vars['edit_links_array'] = array();
562 562
   if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) {
563
-    include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc';
563
+    include_once './'._zen_path().'/zen-internals/template.block-editing.inc';
564 564
     zen_preprocess_block_editing($vars, $hook);
565 565
     $vars['classes_array'][] = 'with-block-editing';
566 566
   }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
  *   The name of the template being rendered ("block" in this case.)
591 591
  */
592 592
 function zen_process_block(&$vars, $hook) {
593
-  $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">' . implode(' ', $vars['edit_links_array']) . '</div>' : '';
593
+  $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">'.implode(' ', $vars['edit_links_array']).'</div>' : '';
594 594
 }
595 595
 
596 596
 if (!function_exists('drupal_html_class')) {
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/boincimport.module 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
  * Set database connection for boincimport
133 133
  *
134 134
  * @return
135
- *   1 if can connect to BOINC database.
135
+ integer   1 if can connect to BOINC database.
136 136
  *
137 137
  * BEWARE: if you test using db_connect and the connection
138 138
  * fails, the process will die() which is a bit too much since we only
@@ -162,6 +162,7 @@  discard block
 block discarded – undo
162 162
 /**
163 163
  * Check if the module is enabled.
164 164
  * 
165
+ * @param string $module
165 166
  * @return array
166 167
  *    $out['html'] = formatted html.
167 168
  *    $out['result'] = boolean.
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
   $boinc_db_url = (is_array($db_url)) ? (isset($db_url['boinc']) ? $db_url['boinc'] : $db_url['default']) : $db_url;
106 106
   variable_set('boincimport_db_url', $boinc_db_url);
107 107
   variable_set('boincimport_ready', 0);
108
-  return '<p>'. t('The BOINC database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.',
109
-      array('@configlink' => url('admin/boinc/import/settings'))) .'</p>';
108
+  return '<p>'.t('The BOINC database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.',
109
+      array('@configlink' => url('admin/boinc/import/settings'))).'</p>';
110 110
 }
111 111
 
112 112
 /**
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function boincimport_unlock() {
116 116
   variable_del('boincimport_process_locked');
117
-  return '<p>'. t('The BOINC data import process has been unlocked. You may
117
+  return '<p>'.t('The BOINC data import process has been unlocked. You may
118 118
     now !proceed_with_import.', array(
119 119
       '!proceed_with_import' => l(t('proceed with the import'),
120 120
         'admin/boinc/import/process')
121
-    )) .'</p>';
121
+    )).'</p>';
122 122
 }
123 123
 
124 124
 /**
125 125
  * Callback admin/boinc/import/cleanup
126 126
  */
127 127
 function boincimport_cleanup() {
128
-  return boincimport_process_cleanup() .'<p>'. t('Drupal database cleaned.') .'</p>';
128
+  return boincimport_process_cleanup().'<p>'.t('Drupal database cleaned.').'</p>';
129 129
 }
130 130
 
131 131
 /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
  * fails, the process will die() which is a bit too much since we only
139 139
  * want to test. Therefore, the test part of the code is not used, now.
140 140
  */
141
-function _boincimport_db_connect($test= 0) {
141
+function _boincimport_db_connect($test = 0) {
142 142
   global $db_url;
143 143
   $db_ready = variable_get('boincimport_db_configured', 1);
144 144
   if (!$db_ready) {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
       $db_url2['default'] = $db_url;
149 149
     }
150 150
     $db_url2['boinc'] = variable_get('boincimport_db_url', $db_url);
151
-    $GLOBALS['db_url'] =& $db_url2;
151
+    $GLOBALS['db_url'] = & $db_url2;
152 152
     if ($test) {
153 153
       if (!db_connect($db_url2['boinc'])) {
154 154
         return 0;
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
   $result = module_exists($module);
172 172
   $out['result'] = $result;
173 173
   if ($result == 1) {
174
-    $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>';
174
+    $out['html'] .= '<li>'.t('Module %module is enabled. OK!', array('%module' => $module)).'</li>';
175 175
   }
176 176
   else {
177
-    $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>';
177
+    $out['html'] .= '<li><span class="marker">'.t('Module %module is disabled.', array('%module' => $module)).'</span></li>';
178 178
   }
179 179
   $out['html'] .= '</ul>';
180 180
   return $out;
@@ -187,32 +187,32 @@  discard block
 block discarded – undo
187 187
  *   $out['html'] = formatted html.
188 188
  *   $out['result'] = boolean.
189 189
  */
190
-function _boincimport_check_tables($tables = array(), $db = 'default' , $prefix = 1) {
190
+function _boincimport_check_tables($tables = array(), $db = 'default', $prefix = 1) {
191 191
   _boincimport_db_connect();
192 192
 
193 193
   $out['html'] = '<ul>';
194
-  $out['result']= 1;
194
+  $out['result'] = 1;
195 195
   foreach ($tables as $table) {
196 196
     if ($prefix) {
197
-      $table = db_prefix_tables('{'. $table .'}');
197
+      $table = db_prefix_tables('{'.$table.'}');
198 198
     }  
199 199
 
200 200
     db_set_active($db);
201 201
     if ($GLOBALS['db_type'] == 'pgsql') {
202 202
       // adapt from db_table_exists in database.pgsql.inc
203
-      $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table));
203
+      $result = (bool)db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table));
204 204
     }
205 205
     else {
206 206
       // adapt from db_table_exists in database.mysql.inc
207
-      $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table));
207
+      $result = (bool)db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table));
208 208
     }
209 209
     db_set_active('default');
210 210
     if ($result) {
211
-      $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>';
211
+      $out['html'] .= '<li>'.t('Table %table: OK!', array('%table' => $table)).'</li>';
212 212
     }
213 213
     else {
214
-      $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>';
215
-      $out['result']= 0;
214
+      $out['html'] .= '<li><span class="marker">'.t('Table <strong>%table</strong> does not exist!', array('%table' => $table)).'</span></li>';
215
+      $out['result'] = 0;
216 216
     }
217 217
   }
218 218
   $out['html'] .= '</ul>';
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
   boinc_get_path();
227 227
   
228 228
   if (!variable_get('boincimport_ready', 0)) {
229
-    return '<p>'. t('You cannot import the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/boinc/import/settings'))) .'</p>';
229
+    return '<p>'.t('You cannot import the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/boinc/import/settings'))).'</p>';
230 230
   }
231 231
 
232 232
   $output = 'BOINC import process form';
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 function boincimport_process_form() {
238 238
   $form = array();
239
-  _boincimport_db_connect() ;
239
+  _boincimport_db_connect();
240 240
   // Causes problems with form api redirect
241 241
   //ini_set('display_errors', TRUE);
242 242
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
       }
412 412
       else {
413 413
         drupal_set_message('Congratulations.  Import Finished');
414
-        drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page');
414
+        drupal_set_message('Please visit the '.l('Post migration configuration', 'admin/boinc/import/post_configuration').' page');
415 415
         watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); 
416 416
         unset($_SESSION['boincimport_stage_selected']);
417 417
       }
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
     $context['finished'] = 1;
633 633
   }
634 634
   else {
635
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
635
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
636 636
   }
637 637
 }
638 638
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
     // An error occurred.
662 662
     // $operations contains the operations that remained unprocessed.
663 663
     $error_operation = reset($operations);
664
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
664
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
665 665
   }
666 666
   drupal_set_message($message);
667 667
   
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
     $context['finished'] = 1;
846 846
   }
847 847
   else {
848
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
848
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
849 849
   }
850 850
 }
851 851
 
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
     // An error occurred.
873 873
     // $operations contains the operations that remained unprocessed.
874 874
     $error_operation = reset($operations);
875
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
875
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
876 876
   }
877 877
   drupal_set_message($message);
878 878
   
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
     $context['finished'] = 1;
1019 1019
   }
1020 1020
   else {
1021
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1021
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
1022 1022
   }
1023 1023
 }
1024 1024
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
     // An error occurred.
1047 1047
     // $operations contains the operations that remained unprocessed.
1048 1048
     $error_operation = reset($operations);
1049
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
1049
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
1050 1050
   }
1051 1051
   drupal_set_message($message);
1052 1052
   
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
     $context['finished'] = 1;
1203 1203
   }
1204 1204
   else {
1205
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1205
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
1206 1206
   }
1207 1207
 }
1208 1208
 
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
     // An error occurred.
1232 1232
     // $operations contains the operations that remained unprocessed.
1233 1233
     $error_operation = reset($operations);
1234
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
1234
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
1235 1235
   }
1236 1236
   drupal_set_message($message);
1237 1237
   
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
     $context['finished'] = 1;
1382 1382
   }
1383 1383
   else {
1384
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1384
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
1385 1385
   }
1386 1386
 }
1387 1387
 
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
     // An error occurred.
1409 1409
     // $operations contains the operations that remained unprocessed.
1410 1410
     $error_operation = reset($operations);
1411
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
1411
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
1412 1412
   }
1413 1413
   drupal_set_message($message);
1414 1414
   
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
     $context['finished'] = 1;
1710 1710
   }
1711 1711
   else {
1712
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1712
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
1713 1713
   }
1714 1714
 }
1715 1715
 
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
     $context['finished'] = 1;
1788 1788
   }
1789 1789
   else {
1790
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
1790
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
1791 1791
   }
1792 1792
 }
1793 1793
 
@@ -1800,34 +1800,34 @@  discard block
 block discarded – undo
1800 1800
   $forum_perms = array();
1801 1801
   $role_map = array_flip(user_roles());
1802 1802
   $forum_perms[$role_map['anonymous user']] = array(
1803
-    'view' => (int) !$hidden,
1803
+    'view' => (int)!$hidden,
1804 1804
     'update' => 0,
1805 1805
     'delete' => 0,
1806 1806
     'create' => 0,
1807 1807
   );
1808 1808
   $forum_perms[$role_map['authenticated user']] = array(
1809
-    'view' => (int) !$hidden,
1809
+    'view' => (int)!$hidden,
1810 1810
     'update' => 0,
1811 1811
     'delete' => 0,
1812 1812
     'create' => 0,
1813 1813
   );
1814 1814
   $forum_perms[$role_map['community member']] = array(
1815
-    'view' => (int) !$hidden,
1815
+    'view' => (int)!$hidden,
1816 1816
     'update' => 0,
1817 1817
     'delete' => 0,
1818
-    'create' => (int) $open,
1818
+    'create' => (int)$open,
1819 1819
   );
1820 1820
   $forum_perms[$role_map['verified contributor']] = array(
1821
-    'view' => (int) !$hidden,
1821
+    'view' => (int)!$hidden,
1822 1822
     'update' => 0,
1823 1823
     'delete' => 0,
1824
-    'create' => (int) !$hidden,
1824
+    'create' => (int)!$hidden,
1825 1825
   );
1826 1826
   $forum_perms[$role_map['moderator']] = array(
1827
-    'view' => (int) !$hidden,
1828
-    'update' => (int) !$hidden,
1827
+    'view' => (int)!$hidden,
1828
+    'update' => (int)!$hidden,
1829 1829
     'delete' => 0,
1830
-    'create' => (int) !$hidden,
1830
+    'create' => (int)!$hidden,
1831 1831
   );
1832 1832
   $forum_perms[$role_map['administrator']] = array(
1833 1833
     'view' => 1,
@@ -1892,7 +1892,7 @@  discard block
 block discarded – undo
1892 1892
     // An error occurred.
1893 1893
     // $operations contains the operations that remained unprocessed.
1894 1894
     $error_operation = reset($operations);
1895
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
1895
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
1896 1896
   }
1897 1897
   drupal_set_message($message);
1898 1898
   
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
   $batch_size = 100;
1963 1963
   
1964 1964
   // Create batches to process
1965
-  for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) {
1965
+  for ($offset = 0; $offset < $topic_count; $offset += $batch_size) {
1966 1966
     $topics_per_batch = $batch_size;
1967 1967
     if ($offset + $batch_size > $topic_count) {
1968 1968
       $topics_per_batch = $topic_count - $offset;
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
         'type' => $node_type,
2080 2080
         'title' => $topic->title,
2081 2081
         'uid' => $uid,
2082
-        'status' => ($topic->hidden) ? 0 : 1,  // published or not
2082
+        'status' => ($topic->hidden) ? 0 : 1, // published or not
2083 2083
         'promote' => $promote,
2084 2084
         'created' => $topic->create_time,
2085 2085
         'changed' => $topic->timestamp,
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
       $node['tid'] = $tid;
2094 2094
       
2095 2095
       // Save the topic node
2096
-      $node = (object) $node; // node_save requires an object form
2096
+      $node = (object)$node; // node_save requires an object form
2097 2097
       node_save($node);
2098 2098
       taxonomy_node_save($node, array($tid));
2099 2099
       $success = ($node->nid) ? TRUE : FALSE;
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
       $context['finished'] = 1;
2157 2157
     }
2158 2158
     else {
2159
-      $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2159
+      $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
2160 2160
     }
2161 2161
   }
2162 2162
 }
@@ -2194,7 +2194,7 @@  discard block
 block discarded – undo
2194 2194
     // An error occurred.
2195 2195
     // $operations contains the operations that remained unprocessed.
2196 2196
     $error_operation = reset($operations);
2197
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
2197
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
2198 2198
   }
2199 2199
   drupal_set_message($message);
2200 2200
   
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
   $batch_size = 100;
2271 2271
   
2272 2272
   // Create batches to process
2273
-  for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) {
2273
+  for ($offset = 0; $offset < $topic_count; $offset += $batch_size) {
2274 2274
     $topics_per_batch = $batch_size;
2275 2275
     if ($offset + $batch_size > $topic_count) {
2276 2276
       $topics_per_batch = $topic_count - $offset;
@@ -2484,7 +2484,7 @@  discard block
 block discarded – undo
2484 2484
       $context['finished'] = 1;
2485 2485
     }
2486 2486
     else {
2487
-      $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2487
+      $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
2488 2488
     }
2489 2489
   }
2490 2490
 }
@@ -2502,10 +2502,10 @@  discard block
 block discarded – undo
2502 2502
     $empty_posts = count($results['posts']['empty']);
2503 2503
     $failed_posts = count($results['posts']['failure']);
2504 2504
     $message = t(
2505
-      'Successfully imported @post_count posts in @topic_count topics ' .
2506
-      '(@skipped topics either had no replies or all replies were already imported, ' .
2507
-      '@duplicates posts were skipped as already imported, ' .
2508
-      '@empty_posts had no content, ' .
2505
+      'Successfully imported @post_count posts in @topic_count topics '.
2506
+      '(@skipped topics either had no replies or all replies were already imported, '.
2507
+      '@duplicates posts were skipped as already imported, '.
2508
+      '@empty_posts had no content, '.
2509 2509
       'and @error_posts encountered errors during import)',
2510 2510
       array(
2511 2511
         '@post_count' => $posts_imported,
@@ -2528,7 +2528,7 @@  discard block
 block discarded – undo
2528 2528
     // An error occurred.
2529 2529
     // $operations contains the operations that remained unprocessed.
2530 2530
     $error_operation = reset($operations);
2531
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
2531
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
2532 2532
   }
2533 2533
   drupal_set_message($message);
2534 2534
   
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
     $context['finished'] = 1;
2699 2699
   }
2700 2700
   else {
2701
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2701
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
2702 2702
   }
2703 2703
 }
2704 2704
 
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
     // An error occurred.
2726 2726
     // $operations contains the operations that remained unprocessed.
2727 2727
     $error_operation = reset($operations);
2728
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
2728
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
2729 2729
   }
2730 2730
   drupal_set_message($message);
2731 2731
   
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
         'type' => $node_type,
2908 2908
         'title' => $topic->title,
2909 2909
         'uid' => $uid,
2910
-        'status' => ($topic->hidden) ? 0 : 1,  // published or not
2910
+        'status' => ($topic->hidden) ? 0 : 1, // published or not
2911 2911
         'promote' => $promote,
2912 2912
         'created' => $topic->create_time,
2913 2913
         'changed' => $topic->timestamp,
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
       );
2922 2922
       
2923 2923
       // Save the team topic node
2924
-      $node = (object) $node; // node_save requires an object form
2924
+      $node = (object)$node; // node_save requires an object form
2925 2925
       node_save($node);
2926 2926
 
2927 2927
       if ($node->nid) {
@@ -2967,7 +2967,7 @@  discard block
 block discarded – undo
2967 2967
     $context['finished'] = 1;
2968 2968
   }
2969 2969
   else {
2970
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
2970
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
2971 2971
   }
2972 2972
 }
2973 2973
 
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
     // An error occurred.
2995 2995
     // $operations contains the operations that remained unprocessed.
2996 2996
     $error_operation = reset($operations);
2997
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
2997
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
2998 2998
   }
2999 2999
   drupal_set_message($message);
3000 3000
   
@@ -3249,7 +3249,7 @@  discard block
 block discarded – undo
3249 3249
     $context['finished'] = 1;
3250 3250
   }
3251 3251
   else {
3252
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3252
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
3253 3253
   }
3254 3254
 }
3255 3255
 
@@ -3276,7 +3276,7 @@  discard block
 block discarded – undo
3276 3276
     // An error occurred.
3277 3277
     // $operations contains the operations that remained unprocessed.
3278 3278
     $error_operation = reset($operations);
3279
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
3279
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
3280 3280
   }
3281 3281
   drupal_set_message($message);
3282 3282
   
@@ -3398,7 +3398,7 @@  discard block
 block discarded – undo
3398 3398
     $context['finished'] = 1;
3399 3399
   }
3400 3400
   else {
3401
-    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3401
+    $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
3402 3402
   }
3403 3403
 }
3404 3404
 
@@ -3427,7 +3427,7 @@  discard block
 block discarded – undo
3427 3427
     // An error occurred.
3428 3428
     // $operations contains the operations that remained unprocessed.
3429 3429
     $error_operation = reset($operations);
3430
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
3430
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
3431 3431
   }
3432 3432
   drupal_set_message($message);
3433 3433
   
@@ -3503,7 +3503,7 @@  discard block
 block discarded – undo
3503 3503
   $batch_size = 100;
3504 3504
   
3505 3505
   // Create node batches to process
3506
-  for ($offset = 0; $offset < $node_count; $offset+=$batch_size) {
3506
+  for ($offset = 0; $offset < $node_count; $offset += $batch_size) {
3507 3507
     $nodes_per_batch = $batch_size;
3508 3508
     if ($offset + $batch_size > $node_count) {
3509 3509
       $nodes_per_batch = $node_count - $offset;
@@ -3515,7 +3515,7 @@  discard block
 block discarded – undo
3515 3515
     );
3516 3516
   }
3517 3517
   // Add comment batches
3518
-  for ($offset = 0; $offset < $comment_count; $offset+=$batch_size) {
3518
+  for ($offset = 0; $offset < $comment_count; $offset += $batch_size) {
3519 3519
     $comments_per_batch = $batch_size;
3520 3520
     if ($offset + $batch_size > $comment_count) {
3521 3521
       $comments_per_batch = $comment_count - $offset;
@@ -3527,7 +3527,7 @@  discard block
 block discarded – undo
3527 3527
     );
3528 3528
   }
3529 3529
   // And don't forget to process private messages
3530
-  for ($offset = 0; $offset < $pm_count; $offset+=$batch_size) {
3530
+  for ($offset = 0; $offset < $pm_count; $offset += $batch_size) {
3531 3531
     $messages_per_batch = $batch_size;
3532 3532
     if ($offset + $batch_size > $pm_count) {
3533 3533
       $messages_per_batch = $pm_count - $offset;
@@ -3616,7 +3616,7 @@  discard block
 block discarded – undo
3616 3616
       $context['finished'] = 1;
3617 3617
     }
3618 3618
     else {
3619
-      $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3619
+      $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
3620 3620
     }
3621 3621
   }
3622 3622
 }
@@ -3680,7 +3680,7 @@  discard block
 block discarded – undo
3680 3680
       $context['finished'] = 1;
3681 3681
     }
3682 3682
     else {
3683
-      $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3683
+      $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
3684 3684
     }
3685 3685
   }
3686 3686
 }
@@ -3743,7 +3743,7 @@  discard block
 block discarded – undo
3743 3743
       $context['finished'] = 1;
3744 3744
     }
3745 3745
     else {
3746
-      $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
3746
+      $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max'];
3747 3747
     }
3748 3748
   }
3749 3749
 }
@@ -3812,7 +3812,7 @@  discard block
 block discarded – undo
3812 3812
     // An error occurred.
3813 3813
     // $operations contains the operations that remained unprocessed.
3814 3814
     $error_operation = reset($operations);
3815
-    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
3815
+    $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE);
3816 3816
   }
3817 3817
   drupal_set_message($message);
3818 3818
   
@@ -3881,18 +3881,18 @@  discard block
 block discarded – undo
3881 3881
     $max = db_result(db_query('SELECT MAX(thread) FROM {comments} WHERE nid = %d', $edit['nid']));
3882 3882
     // Strip the "/" from the end of the thread.
3883 3883
     $max = rtrim($max, '/');
3884
-    $thread = int2vancode(vancode2int($max)+1) .'/';
3884
+    $thread = int2vancode(vancode2int($max) + 1).'/';
3885 3885
   } else {
3886 3886
     // This is comment with a parent comment: we increase the part of the thread
3887 3887
     // value at the proper depth.
3888 3888
     $parent = db_fetch_object(db_query('SELECT * FROM {comments} WHERE cid = %d', $edit['pid']));
3889 3889
     // Strip the "/" from the end of the parent thread.
3890
-    $parent->thread = (string) rtrim((string) $parent->thread, '/');
3890
+    $parent->thread = (string)rtrim((string)$parent->thread, '/');
3891 3891
     // Get the max value in _this_ thread.
3892 3892
     $max = db_result(db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE '%s.%%' AND nid = %d", $parent->thread, $edit['nid']));
3893 3893
     if ($max == '') {
3894 3894
       // First child of this parent.
3895
-      $thread = $parent->thread .'.'. int2vancode(1) .'/';
3895
+      $thread = $parent->thread.'.'.int2vancode(1).'/';
3896 3896
     } else {
3897 3897
       // Strip the "/" at the end of the thread.
3898 3898
       $max = rtrim($max, '/');
@@ -3901,14 +3901,14 @@  discard block
 block discarded – undo
3901 3901
       $parent_depth = count(explode('.', $parent->thread));
3902 3902
       $last = $parts[$parent_depth];
3903 3903
       // Finally, build the thread field for this new comment.
3904
-      $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/';
3904
+      $thread = $parent->thread.'.'.int2vancode(vancode2int($last) + 1).'/';
3905 3905
     }
3906 3906
   }
3907 3907
 
3908 3908
   $status = 0; // 1 - not published, 0 - published
3909 3909
   $format = variable_get('boincimport_input_format', 0);
3910 3910
   $score = 0; // 0 default value, comments get higher score depending on the author's roles
3911
-  $users = serialize(array(0 => 1));  // default value for everybody!!
3911
+  $users = serialize(array(0 => 1)); // default value for everybody!!
3912 3912
   
3913 3913
   if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too
3914 3914
     $edit['name'] = $user->name;
@@ -3942,7 +3942,7 @@  discard block
 block discarded – undo
3942 3942
   // BBcode to normal html
3943 3943
   if (variable_get('boincimport_bbcode', 0)) {
3944 3944
     $input_format = variable_get('boincimport_input_format', 0);
3945
-    $text = bbcode_filter('process', 0 , $input_format, $text);
3945
+    $text = bbcode_filter('process', 0, $input_format, $text);
3946 3946
   }
3947 3947
   return $text;
3948 3948
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincstats/boincstats.module 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -422,6 +422,9 @@
 block discarded – undo
422 422
 /*
423 423
  *
424 424
  */
425
+/**
426
+ * @param integer $credit
427
+ */
425 428
 function boincstats_credit_to_ghours($credit) {
426 429
   return $credit / (100 * 365);
427 430
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   $backdrop_color_hex = theme_get_setting('boinc_stats_chart_bcolor');
87 87
   $backdrop_color = array_combine($color_keys, sscanf($backdrop_color_hex, "#%02x%02x%02x"));
88 88
   
89
-  switch($chart_size) {
89
+  switch ($chart_size) {
90 90
   case 'small':
91 91
     $cache_name .= "{$cpid}_small";
92 92
     $dataset_size = 30;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
   }
113 113
   
114 114
   // Initialize the cache object and flush stale images
115
-  $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache'));
115
+  $myCache = new pCache(array('CacheFolder' => realpath('.').'/'.conf_path().'/files/cache'));
116 116
   $myCache->removeOlderThan(60*60*24);
117 117
   
118 118
   if ($myCache->isInCache($cache_name)) {
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
       'projectid' => $project_id
126 126
     );
127 127
     $args = array();
128
-    foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
129
-    $query = '?' . implode('&', $args);
128
+    foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value);
129
+    $query = '?'.implode('&', $args);
130 130
     
131 131
     // Load XML from RPC
132 132
     $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
       $credit = null;
145 145
       for ($i = 0, $j = 31; $j <= 91; $i++, $j++) {
146 146
         $day = "day_{$j}";
147
-        $credit[$i] = isset($stats_xml->total_credit_history_last_91_days->$day) ? (int) $stats_xml->total_credit_history_last_91_days->$day : 0;
148
-        $dataset[$i] = ($i) ? ($credit[$i] - $credit[$i-1]) : 0;
147
+        $credit[$i] = isset($stats_xml->total_credit_history_last_91_days->$day) ? (int)$stats_xml->total_credit_history_last_91_days->$day : 0;
148
+        $dataset[$i] = ($i) ? ($credit[$i] - $credit[$i - 1]) : 0;
149 149
       }
150 150
     }
151 151
     else {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     
155 155
     $MyData->addPoints($dataset, 'series1');
156 156
     $MyData->setPalette('series1', $palette_color);
157
-    $MyData->setAxisPosition(0,AXIS_POSITION_RIGHT);
157
+    $MyData->setAxisPosition(0, AXIS_POSITION_RIGHT);
158 158
     
159 159
     // Create the pChart object
160 160
     $myPicture = new pImage($chart_width, $chart_height, $MyData);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     if ($label_x_axis) {
200 200
       for ($i = 5; $i >= 0; $i--) {
201 201
         $label = ($i) ? -10*$i : 'Today';
202
-        $myPicture->drawText(589-587*($i/6)-5, 2, $label, array('Align' => TEXT_ALIGN_TOPRIGHT));
202
+        $myPicture->drawText(589 - 587*($i/6) - 5, 2, $label, array('Align' => TEXT_ALIGN_TOPRIGHT));
203 203
       }
204 204
     }
205 205
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
   }
249 249
   
250 250
   // Initialize the cache object and flush stale images
251
-  $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path(). '/files/cache'));
251
+  $myCache = new pCache(array('CacheFolder' => realpath('.').'/'.conf_path().'/files/cache'));
252 252
   $myCache->removeOlderThan(60*60*24);
253 253
   
254 254
   if ($myCache->isInCache($cache_name)) {
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
       $credit = null;
262 262
       for ($i = 0, $j = 31; $j <= 91; $i++, $j++) {
263 263
         $day = "day_{$j}";
264
-        $credit[$i] = isset($stats_xml->$day) ? (int) $stats_xml->$day : 0;
265
-        $dataset[$i] = ($i) ? ($credit[$i] - $credit[$i-1]) : 0;
264
+        $credit[$i] = isset($stats_xml->$day) ? (int)$stats_xml->$day : 0;
265
+        $dataset[$i] = ($i) ? ($credit[$i] - $credit[$i - 1]) : 0;
266 266
       }
267 267
     }
268 268
     else {
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
     
272 272
     $MyData->addPoints($dataset, 'series1');
273 273
     $MyData->setPalette('series1', $palette_color);
274
-    $MyData->setAxisPosition(0,AXIS_POSITION_RIGHT);
274
+    $MyData->setAxisPosition(0, AXIS_POSITION_RIGHT);
275 275
 
276 276
     // Create the pChart object
277
-    $myPicture = new pImage(266,80,$MyData);
277
+    $myPicture = new pImage(266, 80, $MyData);
278 278
 
279 279
     // Turn on Antialiasing
280 280
     $myPicture->Antialias = true;
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
     //$myPicture->setFontProperties(array('FontName' => '../fonts/pf_arma_five.ttf','FontSize' => 6));
284 284
 
285 285
     // Define the chart area
286
-    $myPicture->setGraphArea(0,0,266,80);
287
-    $myPicture->drawFilledRectangle(0,0,266,80,$backdrop_color);
286
+    $myPicture->setGraphArea(0, 0, 266, 80);
287
+    $myPicture->drawFilledRectangle(0, 0, 266, 80, $backdrop_color);
288 288
 
289 289
     // Draw the scale
290 290
     $scaleSettings = array(
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
  *
333 333
  */
334 334
 function boincstats_check_cache_dir($cache_path = 'files/cache') {
335
-  $cache_dir = realpath('.') . '/' . conf_path() . '/' . $cache_path;
335
+  $cache_dir = realpath('.').'/'.conf_path().'/'.$cache_path;
336 336
   if (!is_writeable($cache_dir)) {
337 337
     if (!is_dir($cache_dir)) {
338 338
       if (!is_writeable(dirname($cache_dir))) {
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
     'projectid' => $project_id
379 379
   );
380 380
   $args = array();
381
-  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
382
-  $query = '?' . implode('&', $args);
381
+  foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value);
382
+  $query = '?'.implode('&', $args);
383 383
   
384 384
   // Load XML from RPC
385 385
   $stats_xml = NULL;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
  */
398 398
 function boincstats_get_project_total_credit() {
399 399
   $stats_xml = boincstats_get_project_stats();
400
-  return isset($stats_xml->day_91) ? (int) $stats_xml->day_91 : 0;
400
+  return isset($stats_xml->day_91) ? (int)$stats_xml->day_91 : 0;
401 401
 }
402 402
 
403 403
 /*
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
     $dail_totals = null;
412 412
     for ($i = 61; $i <= 91; $i++) {
413 413
       $day = "day_{$i}";
414
-      $daily_totals[$i] = isset($stats_xml->$day) ? (int) $stats_xml->$day : 0;
414
+      $daily_totals[$i] = isset($stats_xml->$day) ? (int)$stats_xml->$day : 0;
415 415
       if ($i == 61) continue;
416
-      $daily_values[$i] = ($i) ? ($daily_totals[$i] - $daily_totals[$i-1]) : 0;
416
+      $daily_values[$i] = ($i) ? ($daily_totals[$i] - $daily_totals[$i - 1]) : 0;
417 417
     }
418 418
   }
419
-  return (count($daily_values)) ? array_sum($daily_values) / count($daily_values) : 0;
419
+  return (count($daily_values)) ? array_sum($daily_values)/count($daily_values) : 0;
420 420
 }
421 421
 
422 422
 /*
423 423
  *
424 424
  */
425 425
 function boincstats_credit_to_ghours($credit) {
426
-  return $credit / (100 * 365);
426
+  return $credit/(100*365);
427 427
 }
428 428
 
429 429
 /*
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     't' => 6,
437 437
     'p' => 9
438 438
   );
439
-  return $credit / (pow(10, (int) $factor[$prefix]) / 10);
439
+  return $credit/(pow(10, (int)$factor[$prefix])/10);
440 440
 }
441 441
 
442 442
 
@@ -449,14 +449,14 @@  discard block
 block discarded – undo
449 449
   $output = '';
450 450
   switch ($type) {
451 451
   case 'basic':
452
-    $output .= '<div class="overlay"><span>(' . bts('Credits per day') . ')</span></div>' . "\n";
453
-    $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n";
452
+    $output .= '<div class="overlay"><span>('.bts('Credits per day').')</span></div>'."\n";
453
+    $output .= '<div class="chart"><img src="'.$base_path.'charts/project" /></div>'."\n";
454 454
     break;
455 455
   case 'detailed':
456
-    $output .= '<div class="stats"><label>' . bts('Total G-hours') . ': </label><span>' . number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())) . '</span></div>' . "\n";
457
-    $output .= '<div class="stats"><label>' . bts('Avg TFlops') . ': </label><span>' . number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')) . '</span></div>' . "\n";
456
+    $output .= '<div class="stats"><label>'.bts('Total G-hours').': </label><span>'.number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())).'</span></div>'."\n";
457
+    $output .= '<div class="stats"><label>'.bts('Avg TFlops').': </label><span>'.number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')).'</span></div>'."\n";
458 458
     //$output .= '<div class="stats"><a href="#">' . bts('Pending credits') . '</a></div>' . "\n";
459
-    $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n";
459
+    $output .= '<div class="chart"><img src="'.$base_path.'charts/project" /></div>'."\n";
460 460
     break;
461 461
   default:
462 462
   }
Please login to merge, or discard this patch.
boinc/modules/boincstats/includes/pchart/class/pBarcode128.class.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -179,6 +179,10 @@
 block discarded – undo
179 179
 
180 180
    function left($value,$NbChar) { return substr($value,0,$NbChar); }  
181 181
    function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
182
+
183
+   /**
184
+    * @param integer $NbChar
185
+    */
182 186
    function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
183 187
   }
184 188
 ?>
185 189
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
    var $CRC;
24 24
 
25 25
    /* Class creator */
26
-   function pBarcode128($BasePath="")
26
+   function pBarcode128($BasePath = "")
27 27
     {
28 28
      $this->Codes   = "";
29 29
      $this->Reverse = "";
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 
35 35
      while (!feof($FileHandle))
36 36
       {
37
-       $Buffer = fgets($FileHandle,4096);
38
-       $Buffer = str_replace(chr(10),"",$Buffer);
39
-       $Buffer = str_replace(chr(13),"",$Buffer);
40
-       $Values = preg_split("/;/",$Buffer);
37
+       $Buffer = fgets($FileHandle, 4096);
38
+       $Buffer = str_replace(chr(10), "", $Buffer);
39
+       $Buffer = str_replace(chr(13), "", $Buffer);
40
+       $Values = preg_split("/;/", $Buffer);
41 41
 
42 42
        $this->Codes[$Values[1]]["ID"]     = $Values[0];
43 43
        $this->Codes[$Values[1]]["Code"]   = $Values[2];
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
     }
49 49
 
50 50
    /* Return the projected size of a barcode */
51
-   function getSize($TextString,$Format="")
51
+   function getSize($TextString, $Format = "")
52 52
     {
53
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
53
+     $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
54
+     $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
55
+     $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
56 56
      $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
57 57
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
58
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
58
+     $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
59 59
 
60 60
      $TextString    = $this->encode128($TextString);
61 61
      $BarcodeLength = strlen($this->Result);
62 62
 
63
-     if ( $DrawArea )   { $WOffset = 20; } else { $WOffset = 0; }
64
-     if ( $ShowLegend ) { $HOffset = $FontSize+$LegendOffset+$WOffset; } else { $HOffset = 0; }
63
+     if ($DrawArea) { $WOffset = 20; } else { $WOffset = 0; }
64
+     if ($ShowLegend) { $HOffset = $FontSize + $LegendOffset + $WOffset; } else { $HOffset = 0; }
65 65
 
66
-     $X1 = cos($Angle * PI / 180) * ($WOffset+$BarcodeLength);
67
-     $Y1 = sin($Angle * PI / 180) * ($WOffset+$BarcodeLength);
66
+     $X1 = cos($Angle*PI/180)*($WOffset + $BarcodeLength);
67
+     $Y1 = sin($Angle*PI/180)*($WOffset + $BarcodeLength);
68 68
 
69
-     $X2 = $X1 + cos(($Angle+90) * PI / 180) * ($HOffset+$Height);
70
-     $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * ($HOffset+$Height);
69
+     $X2 = $X1 + cos(($Angle + 90)*PI/180)*($HOffset + $Height);
70
+     $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*($HOffset + $Height);
71 71
 
72 72
 
73
-     $AreaWidth  = max(abs($X1),abs($X2));
74
-     $AreaHeight = max(abs($Y1),abs($Y2));
73
+     $AreaWidth  = max(abs($X1), abs($X2));
74
+     $AreaHeight = max(abs($Y1), abs($Y2));
75 75
 
76
-     return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight));
76
+     return(array("Width"=>$AreaWidth, "Height"=>$AreaHeight));
77 77
     }
78 78
 
79
-   function encode128($Value,$Format="")
79
+   function encode128($Value, $Format = "")
80 80
     {
81 81
      $this->Result  = "11010010000";
82 82
      $this->CRC     = 104;
83 83
      $TextString    = "";
84 84
 
85
-     for($i=1;$i<=strlen($Value);$i++)
85
+     for ($i = 1; $i <= strlen($Value); $i++)
86 86
       {
87
-       $CharCode = ord($this->mid($Value,$i,1));
88
-       if ( isset($this->Codes[$CharCode]) )
87
+       $CharCode = ord($this->mid($Value, $i, 1));
88
+       if (isset($this->Codes[$CharCode]))
89 89
         {
90 90
          $this->Result = $this->Result.$this->Codes[$CharCode]["Code"];
91 91
          $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"];
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     }
102 102
 
103 103
    /* Create the encoded string */
104
-   function draw($Object,$Value,$X,$Y,$Format="")
104
+   function draw($Object, $Value, $X, $Y, $Format = "")
105 105
     {
106 106
      $this->pChartObject = $Object;
107 107
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
110 110
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
111 111
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
112
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
112
+     $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
113 113
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
114
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
115
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
114
+     $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
115
+     $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
116
+     $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
117 117
      $AreaR		= isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
118 118
      $AreaG		= isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
119 119
      $AreaB		= isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
@@ -123,62 +123,62 @@  discard block
 block discarded – undo
123 123
 
124 124
      $TextString = $this->encode128($Value);
125 125
 
126
-     if ( $DrawArea )
126
+     if ($DrawArea)
127 127
       {
128
-       $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
129
-       $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
128
+       $X1 = $X + cos(($Angle - 135)*PI/180)*10;
129
+       $Y1 = $Y + sin(($Angle - 135)*PI/180)*10;
130 130
 
131
-       $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
132
-       $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
131
+       $X2 = $X1 + cos($Angle*PI/180)*(strlen($this->Result) + 20);
132
+       $Y2 = $Y1 + sin($Angle*PI/180)*(strlen($this->Result) + 20);
133 133
 
134
-       if ( $ShowLegend )
134
+       if ($ShowLegend)
135 135
         {
136
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
137
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
136
+         $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10);
137
+         $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10);
138 138
         }
139 139
        else
140 140
         {
141
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
142
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
141
+         $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + 20);
142
+         $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + 20);
143 143
         }
144 144
 
145
-       $X4 = $X3 + cos(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
146
-       $Y4 = $Y3 + sin(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
145
+       $X4 = $X3 + cos(($Angle + 180)*PI/180)*(strlen($this->Result) + 20);
146
+       $Y4 = $Y3 + sin(($Angle + 180)*PI/180)*(strlen($this->Result) + 20);
147 147
 
148
-       $Polygon  = array($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4);
149
-       $Settings = array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"BorderR"=>$AreaBorderR,"BorderG"=>$AreaBorderG,"BorderB"=>$AreaBorderB);
150
-       $this->pChartObject->drawPolygon($Polygon,$Settings);
148
+       $Polygon  = array($X1, $Y1, $X2, $Y2, $X3, $Y3, $X4, $Y4);
149
+       $Settings = array("R"=>$AreaR, "G"=>$AreaG, "B"=>$AreaB, "BorderR"=>$AreaBorderR, "BorderG"=>$AreaBorderG, "BorderB"=>$AreaBorderB);
150
+       $this->pChartObject->drawPolygon($Polygon, $Settings);
151 151
       }
152 152
 
153
-     for($i=1;$i<=strlen($this->Result);$i++)
153
+     for ($i = 1; $i <= strlen($this->Result); $i++)
154 154
       {
155
-       if ( $this->mid($this->Result,$i,1) == 1 )
155
+       if ($this->mid($this->Result, $i, 1) == 1)
156 156
         {
157
-         $X1 = $X + cos($Angle * PI / 180) * $i;
158
-         $Y1 = $Y + sin($Angle * PI / 180) * $i;
159
-         $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
160
-         $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * $Height;
157
+         $X1 = $X + cos($Angle*PI/180)*$i;
158
+         $Y1 = $Y + sin($Angle*PI/180)*$i;
159
+         $X2 = $X1 + cos(($Angle + 90)*PI/180)*$Height;
160
+         $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*$Height;
161 161
 
162
-         $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
163
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Settings);
162
+         $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
163
+         $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Settings);
164 164
         }
165 165
       }
166 166
 
167
-     if ( $ShowLegend )
167
+     if ($ShowLegend)
168 168
       {
169
-       $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
170
-       $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
169
+       $X1 = $X + cos($Angle*PI/180)*(strlen($this->Result)/2);
170
+       $Y1 = $Y + sin($Angle*PI/180)*(strlen($this->Result)/2);
171 171
 
172
-       $LegendX = $X1 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
173
-       $LegendY = $Y1 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
172
+       $LegendX = $X1 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset);
173
+       $LegendY = $Y1 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset);
174 174
 
175
-       $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Angle"=>-$Angle,"Align"=>TEXT_ALIGN_TOPMIDDLE);
176
-       $this->pChartObject->drawText($LegendX,$LegendY,$TextString,$Settings);
175
+       $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Angle"=>-$Angle, "Align"=>TEXT_ALIGN_TOPMIDDLE);
176
+       $this->pChartObject->drawText($LegendX, $LegendY, $TextString, $Settings);
177 177
       }
178 178
     }
179 179
 
180
-   function left($value,$NbChar) { return substr($value,0,$NbChar); }  
181
-   function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
182
-   function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
180
+   function left($value, $NbChar) { return substr($value, 0, $NbChar); }  
181
+   function right($value, $NbChar) { return substr($value, strlen($value) - $NbChar, $NbChar); }  
182
+   function mid($value, $Depart, $NbChar) { return substr($value, $Depart - 1, $NbChar); }  
183 183
   }
184 184
 ?>
185 185
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pBarcode39.class.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -181,6 +181,9 @@  discard block
 block discarded – undo
181 181
       }
182 182
     }
183 183
 
184
+   /**
185
+    * @param string $string
186
+    */
184 187
    function checksum( $string )
185 188
     {
186 189
      $checksum = 0;
@@ -195,6 +198,11 @@  discard block
 block discarded – undo
195 198
 
196 199
    function left($value,$NbChar) { return substr($value,0,$NbChar); }  
197 200
    function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
201
+
202
+   /**
203
+    * @param integer $Depart
204
+    * @param integer $NbChar
205
+    */
198 206
    function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
199 207
   }
200 208
 ?>
201 209
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
    var $MOD43;
25 25
 
26 26
    /* Class creator */
27
-   function pBarcode39($BasePath="",$EnableMOD43=FALSE)
27
+   function pBarcode39($BasePath = "", $EnableMOD43 = FALSE)
28 28
     {
29
-     $this->MOD43  = $EnableMOD43;
29
+     $this->MOD43 = $EnableMOD43;
30 30
      $this->Codes   = "";
31 31
      $this->Reverse = "";
32 32
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 
37 37
      while (!feof($FileHandle))
38 38
       {
39
-       $Buffer = fgets($FileHandle,4096);
40
-       $Buffer = str_replace(chr(10),"",$Buffer);
41
-       $Buffer = str_replace(chr(13),"",$Buffer);
42
-       $Values = preg_split("/;/",$Buffer);
39
+       $Buffer = fgets($FileHandle, 4096);
40
+       $Buffer = str_replace(chr(10), "", $Buffer);
41
+       $Buffer = str_replace(chr(13), "", $Buffer);
42
+       $Values = preg_split("/;/", $Buffer);
43 43
 
44 44
        $this->Codes[$Values[0]] = $Values[1];
45 45
       }
@@ -47,32 +47,32 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
    /* Return the projected size of a barcode */
50
-   function getSize($TextString,$Format="")
50
+   function getSize($TextString, $Format = "")
51 51
     {
52
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
53
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
54
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
52
+     $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
53
+     $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
54
+     $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
55 55
      $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
56 56
      $FontSize		= isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
57
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
57
+     $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
58 58
 
59 59
      $TextString    = $this->encode39($TextString);
60 60
      $BarcodeLength = strlen($this->Result);
61 61
 
62
-     if ( $DrawArea )   { $WOffset = 20; } else { $WOffset = 0; }
63
-     if ( $ShowLegend ) { $HOffset = $FontSize+$LegendOffset+$WOffset; } else { $HOffset = 0; }
62
+     if ($DrawArea) { $WOffset = 20; } else { $WOffset = 0; }
63
+     if ($ShowLegend) { $HOffset = $FontSize + $LegendOffset + $WOffset; } else { $HOffset = 0; }
64 64
 
65
-     $X1 = cos($Angle * PI / 180) * ($WOffset+$BarcodeLength);
66
-     $Y1 = sin($Angle * PI / 180) * ($WOffset+$BarcodeLength);
65
+     $X1 = cos($Angle*PI/180)*($WOffset + $BarcodeLength);
66
+     $Y1 = sin($Angle*PI/180)*($WOffset + $BarcodeLength);
67 67
 
68
-     $X2 = $X1 + cos(($Angle+90) * PI / 180) * ($HOffset+$Height);
69
-     $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * ($HOffset+$Height);
68
+     $X2 = $X1 + cos(($Angle + 90)*PI/180)*($HOffset + $Height);
69
+     $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*($HOffset + $Height);
70 70
 
71 71
 
72
-     $AreaWidth  = max(abs($X1),abs($X2));
73
-     $AreaHeight = max(abs($Y1),abs($Y2));
72
+     $AreaWidth  = max(abs($X1), abs($X2));
73
+     $AreaHeight = max(abs($Y1), abs($Y2));
74 74
 
75
-     return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight));
75
+     return(array("Width"=>$AreaWidth, "Height"=>$AreaHeight));
76 76
     }
77 77
 
78 78
    /* Create the encoded string */
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
     {
81 81
      $this->Result = "100101101101"."0";
82 82
      $TextString   = "";
83
-     for($i=1;$i<=strlen($Value);$i++)
83
+     for ($i = 1; $i <= strlen($Value); $i++)
84 84
       {
85
-       $CharCode = ord($this->mid($Value,$i,1));
86
-       if ( $CharCode >= 97 && $CharCode <= 122 ) { $CharCode = $CharCode - 32; }
85
+       $CharCode = ord($this->mid($Value, $i, 1));
86
+       if ($CharCode >= 97 && $CharCode <= 122) { $CharCode = $CharCode - 32; }
87 87
 
88
-       if ( isset($this->Codes[chr($CharCode)]) )
88
+       if (isset($this->Codes[chr($CharCode)]))
89 89
         {
90 90
          $this->Result = $this->Result.$this->Codes[chr($CharCode)]."0";
91 91
          $TextString = $TextString.chr($CharCode);
92 92
         }
93 93
       }
94 94
 
95
-     if ( $this->MOD43 )
95
+     if ($this->MOD43)
96 96
       {
97 97
        $Checksum = $this->checksum($TextString);
98 98
        $this->Result = $this->Result.$this->Codes[$Checksum]."0";
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
    /* Create the encoded string */
108
-   function draw($Object,$Value,$X,$Y,$Format="")
108
+   function draw($Object, $Value, $X, $Y, $Format = "")
109 109
     {
110 110
      $this->pChartObject = $Object;
111 111
 
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
      $G			= isset($Format["G"]) ? $Format["G"] : 0;
114 114
      $B			= isset($Format["B"]) ? $Format["B"] : 0;
115 115
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
116
-     $Height		= isset($Format["Height"]) ? $Format["Height"] : 30;
116
+     $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
117 117
      $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
-     $ShowLegend	= isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
119
-     $LegendOffset	= isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
120
-     $DrawArea		= isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
118
+     $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
119
+     $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
120
+     $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
121 121
      $AreaR		= isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
122 122
      $AreaG		= isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
123 123
      $AreaB		= isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
@@ -125,76 +125,76 @@  discard block
 block discarded – undo
125 125
      $AreaBorderG	= isset($Format["AreaBorderG"]) ? $Format["AreaBorderG"] : $AreaG;
126 126
      $AreaBorderB	= isset($Format["AreaBorderB"]) ? $Format["AreaBorderB"] : $AreaB;
127 127
 
128
-     $TextString   = $this->encode39($Value);
128
+     $TextString = $this->encode39($Value);
129 129
 
130
-     if ( $DrawArea )
130
+     if ($DrawArea)
131 131
       {
132
-       $X1 = $X + cos(($Angle-135) * PI / 180) * 10;
133
-       $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10;
132
+       $X1 = $X + cos(($Angle - 135)*PI/180)*10;
133
+       $Y1 = $Y + sin(($Angle - 135)*PI/180)*10;
134 134
 
135
-       $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20);
136
-       $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20);
135
+       $X2 = $X1 + cos($Angle*PI/180)*(strlen($this->Result) + 20);
136
+       $Y2 = $Y1 + sin($Angle*PI/180)*(strlen($this->Result) + 20);
137 137
 
138
-       if ( $ShowLegend )
138
+       if ($ShowLegend)
139 139
         {
140
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
141
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10);
140
+         $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10);
141
+         $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset + $this->pChartObject->FontSize + 10);
142 142
         }
143 143
        else
144 144
         {
145
-         $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20);
146
-         $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20);
145
+         $X3 = $X2 + cos(($Angle + 90)*PI/180)*($Height + 20);
146
+         $Y3 = $Y2 + sin(($Angle + 90)*PI/180)*($Height + 20);
147 147
         }
148 148
 
149
-       $X4 = $X3 + cos(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
150
-       $Y4 = $Y3 + sin(($Angle+180) * PI / 180) * (strlen($this->Result)+20);
149
+       $X4 = $X3 + cos(($Angle + 180)*PI/180)*(strlen($this->Result) + 20);
150
+       $Y4 = $Y3 + sin(($Angle + 180)*PI/180)*(strlen($this->Result) + 20);
151 151
 
152
-       $Polygon  = array($X1,$Y1,$X2,$Y2,$X3,$Y3,$X4,$Y4);
153
-       $Settings = array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"BorderR"=>$AreaBorderR,"BorderG"=>$AreaBorderG,"BorderB"=>$AreaBorderB);
154
-       $this->pChartObject->drawPolygon($Polygon,$Settings);
152
+       $Polygon  = array($X1, $Y1, $X2, $Y2, $X3, $Y3, $X4, $Y4);
153
+       $Settings = array("R"=>$AreaR, "G"=>$AreaG, "B"=>$AreaB, "BorderR"=>$AreaBorderR, "BorderG"=>$AreaBorderG, "BorderB"=>$AreaBorderB);
154
+       $this->pChartObject->drawPolygon($Polygon, $Settings);
155 155
       }
156 156
 
157
-     for($i=1;$i<=strlen($this->Result);$i++)
157
+     for ($i = 1; $i <= strlen($this->Result); $i++)
158 158
       {
159
-       if ( $this->mid($this->Result,$i,1) == 1 )
159
+       if ($this->mid($this->Result, $i, 1) == 1)
160 160
         {
161
-         $X1 = $X + cos($Angle * PI / 180) * $i;
162
-         $Y1 = $Y + sin($Angle * PI / 180) * $i;
163
-         $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height;
164
-         $Y2 = $Y1 + sin(($Angle+90) * PI / 180) * $Height;
161
+         $X1 = $X + cos($Angle*PI/180)*$i;
162
+         $Y1 = $Y + sin($Angle*PI/180)*$i;
163
+         $X2 = $X1 + cos(($Angle + 90)*PI/180)*$Height;
164
+         $Y2 = $Y1 + sin(($Angle + 90)*PI/180)*$Height;
165 165
 
166
-         $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
167
-         $this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Settings);
166
+         $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
167
+         $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Settings);
168 168
         }
169 169
       }
170 170
 
171
-     if ( $ShowLegend )
171
+     if ($ShowLegend)
172 172
       {
173
-       $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2);
174
-       $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2);
173
+       $X1 = $X + cos($Angle*PI/180)*(strlen($this->Result)/2);
174
+       $Y1 = $Y + sin($Angle*PI/180)*(strlen($this->Result)/2);
175 175
 
176
-       $LegendX = $X1 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
177
-       $LegendY = $Y1 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset);
176
+       $LegendX = $X1 + cos(($Angle + 90)*PI/180)*($Height + $LegendOffset);
177
+       $LegendY = $Y1 + sin(($Angle + 90)*PI/180)*($Height + $LegendOffset);
178 178
 
179
-       $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Angle"=>-$Angle,"Align"=>TEXT_ALIGN_TOPMIDDLE);
180
-       $this->pChartObject->drawText($LegendX,$LegendY,$TextString,$Settings);
179
+       $Settings = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Angle"=>-$Angle, "Align"=>TEXT_ALIGN_TOPMIDDLE);
180
+       $this->pChartObject->drawText($LegendX, $LegendY, $TextString, $Settings);
181 181
       }
182 182
     }
183 183
 
184
-   function checksum( $string )
184
+   function checksum($string)
185 185
     {
186 186
      $checksum = 0;
187
-     $length   = strlen( $string );
187
+     $length   = strlen($string);
188 188
      $charset  = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%';
189 189
 
190
-     for( $i=0; $i < $length; ++$i )
191
-      $checksum += strpos( $charset, $string[$i] );
190
+     for ($i = 0; $i < $length; ++$i)
191
+      $checksum += strpos($charset, $string[$i]);
192 192
  
193
-     return substr( $charset, ($checksum % 43), 1 );
193
+     return substr($charset, ($checksum%43), 1);
194 194
     }
195 195
 
196
-   function left($value,$NbChar) { return substr($value,0,$NbChar); }  
197
-   function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); }  
198
-   function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); }  
196
+   function left($value, $NbChar) { return substr($value, 0, $NbChar); }  
197
+   function right($value, $NbChar) { return substr($value, strlen($value) - $NbChar, $NbChar); }  
198
+   function mid($value, $Depart, $NbChar) { return substr($value, $Depart - 1, $NbChar); }  
199 199
   }
200 200
 ?>
201 201
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pCache.class.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -47,6 +47,10 @@  discard block
 block discarded – undo
47 47
     { return(md5($Marker.serialize($Data->Data))); }
48 48
 
49 49
    /* Write the generated picture to the cache */
50
+
51
+   /**
52
+    * @param pImage $pChartObject
53
+    */
50 54
    function writeToCache($ID,$pChartObject)
51 55
     {
52 56
      /* Compute the paths */
@@ -81,6 +85,10 @@  discard block
 block discarded – undo
81 85
     }
82 86
 
83 87
    /* Remove object older than the specified TS */
88
+
89
+   /**
90
+    * @param integer $Expiry
91
+    */
84 92
    function removeOlderThan($Expiry)
85 93
     { $this->dbRemoval(array("Expiry"=>$Expiry)); }
86 94
 
@@ -235,6 +243,9 @@  discard block
 block discarded – undo
235 243
      return(TRUE);
236 244
     }
237 245
 
246
+   /**
247
+    * @param string $Destination
248
+    */
238 249
    function saveFromCache($ID,$Destination)
239 250
     {
240 251
      /* Get the raw picture from the cache */
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -21,58 +21,58 @@  discard block
 block discarded – undo
21 21
    var $CacheDB;
22 22
 
23 23
    /* Class creator */
24
-   function pCache($Settings="")
24
+   function pCache($Settings = "")
25 25
     {
26
-     $CacheFolder	= isset($Settings["CacheFolder"]) ? $Settings["CacheFolder"] : "cache";
27
-     $CacheIndex	= isset($Settings["CacheIndex"]) ? $Settings["CacheIndex"] : "index.db";
28
-     $CacheDB		= isset($Settings["CacheDB"]) ? $Settings["CacheDB"] : "cache.db";
26
+     $CacheFolder = isset($Settings["CacheFolder"]) ? $Settings["CacheFolder"] : "cache";
27
+     $CacheIndex = isset($Settings["CacheIndex"]) ? $Settings["CacheIndex"] : "index.db";
28
+     $CacheDB = isset($Settings["CacheDB"]) ? $Settings["CacheDB"] : "cache.db";
29 29
 
30
-     $this->CacheFolder	= $CacheFolder;
31
-     $this->CacheIndex	= $CacheIndex;
32
-     $this->CacheDB	= $CacheDB;
30
+     $this->CacheFolder = $CacheFolder;
31
+     $this->CacheIndex = $CacheIndex;
32
+     $this->CacheDB = $CacheDB;
33 33
 
34 34
      if (!file_exists($this->CacheFolder."/".$this->CacheIndex)) { touch($this->CacheFolder."/".$this->CacheIndex); }
35
-     if (!file_exists($this->CacheFolder."/".$this->CacheDB))    { touch($this->CacheFolder."/".$this->CacheDB); }
35
+     if (!file_exists($this->CacheFolder."/".$this->CacheDB)) { touch($this->CacheFolder."/".$this->CacheDB); }
36 36
     }
37 37
 
38 38
    /* Flush the cache contents */
39 39
    function flush()
40 40
     {
41 41
      if (file_exists($this->CacheFolder."/".$this->CacheIndex)) { unlink($this->CacheFolder."/".$this->CacheIndex); touch($this->CacheFolder."/".$this->CacheIndex); }
42
-     if (file_exists($this->CacheFolder."/".$this->CacheDB))    { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); }
42
+     if (file_exists($this->CacheFolder."/".$this->CacheDB)) { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); }
43 43
     }
44 44
 
45 45
    /* Return the MD5 of the data array to clearly identify the chart */
46
-   function getHash($Data,$Marker="")
46
+   function getHash($Data, $Marker = "")
47 47
     { return(md5($Marker.serialize($Data->Data))); }
48 48
 
49 49
    /* Write the generated picture to the cache */
50
-   function writeToCache($ID,$pChartObject)
50
+   function writeToCache($ID, $pChartObject)
51 51
     {
52 52
      /* Compute the paths */
53
-     $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
53
+     $TemporaryFile = $this->CacheFolder."/tmp_".rand(0, 1000).".png";
54 54
      $Database      = $this->CacheFolder."/".$this->CacheDB;
55 55
      $Index         = $this->CacheFolder."/".$this->CacheIndex;
56 56
 
57 57
      /* Flush the picture to a temporary file */
58
-     imagepng($pChartObject->Picture ,$TemporaryFile);
58
+     imagepng($pChartObject->Picture, $TemporaryFile);
59 59
 
60 60
      /* Retrieve the files size */
61 61
      $PictureSize = filesize($TemporaryFile);
62 62
      $DBSize      = filesize($Database);
63 63
 
64 64
      /* Save the index */
65
-     $Handle = fopen($Index,"a");
65
+     $Handle = fopen($Index, "a");
66 66
      fwrite($Handle, $ID.",".$DBSize.",".$PictureSize.",".time().",0      \r\n");
67 67
      fclose($Handle);
68 68
 
69 69
      /* Get the picture raw contents */
70
-     $Handle = fopen($TemporaryFile,"r");
71
-     $Raw    = fread($Handle,$PictureSize);
70
+     $Handle = fopen($TemporaryFile, "r");
71
+     $Raw    = fread($Handle, $PictureSize);
72 72
      fclose($Handle);
73 73
 
74 74
      /* Save the picture in the solid database file */
75
-     $Handle = fopen($Database,"a");
75
+     $Handle = fopen($Database, "a");
76 76
      fwrite($Handle, $Raw);
77 77
      fclose($Handle);
78 78
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
      $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95 95
      $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96
-     $TS     = time()-$Expiry;
96
+     $TS     = time() - $Expiry;
97 97
 
98 98
      /* Compute the paths */
99 99
      $Database     = $this->CacheFolder."/".$this->CacheDB;
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
      $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103 103
 
104 104
      /* Single file removal */
105
-     if ( $ID != NULL )
105
+     if ($ID != NULL)
106 106
       {
107 107
        /* Retrieve object informations */
108
-       $Object = $this->isInCache($ID,TRUE);
108
+       $Object = $this->isInCache($ID, TRUE);
109 109
 
110 110
        /* If it's not in the cache DB, go away */
111
-       if ( !$Object ) { return(0); }
111
+       if (!$Object) { return(0); }
112 112
       }
113 113
 
114 114
      /* Create the temporary files */
115 115
      if (!file_exists($DatabaseTemp)) { touch($DatabaseTemp); }
116
-     if (!file_exists($IndexTemp))    { touch($IndexTemp); }
116
+     if (!file_exists($IndexTemp)) { touch($IndexTemp); }
117 117
 
118 118
      /* Open the file handles */
119 119
      $IndexHandle     = @fopen($Index, "r");
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
      while (!feof($IndexHandle))
126 126
       {
127 127
        $Entry    = fgets($IndexHandle, 4096);
128
-       $Entry    = str_replace("\r","",$Entry);
129
-       $Entry    = str_replace("\n","",$Entry);
130
-       $Settings = preg_split("/,/",$Entry);
128
+       $Entry    = str_replace("\r", "", $Entry);
129
+       $Entry    = str_replace("\n", "", $Entry);
130
+       $Settings = preg_split("/,/", $Entry);
131 131
 
132
-       if ( $Entry != "" )
132
+       if ($Entry != "")
133 133
         {
134 134
          $PicID       = $Settings[0];
135 135
          $DBPos       = $Settings[1];
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
          $GeneratedTS = $Settings[3];
138 138
          $Hits        = $Settings[4];
139 139
 
140
-         if ( $Settings[0] != $ID && $GeneratedTS > $TS)
140
+         if ($Settings[0] != $ID && $GeneratedTS > $TS)
141 141
           {
142
-           $CurrentPos  = ftell($DBTempHandle);
142
+           $CurrentPos = ftell($DBTempHandle);
143 143
            fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144 144
 
145
-           fseek($DBHandle,$DBPos);
146
-           $Picture = fread($DBHandle,$PicSize);
147
-           fwrite($DBTempHandle,$Picture);
145
+           fseek($DBHandle, $DBPos);
146
+           $Picture = fread($DBHandle, $PicSize);
147
+           fwrite($DBTempHandle, $Picture);
148 148
           }
149 149
         }
150 150
       }
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
      unlink($Index);
161 161
 
162 162
      /* Swap the temp & prod DB */
163
-     rename($DatabaseTemp,$Database);
164
-     rename($IndexTemp,$Index);
163
+     rename($DatabaseTemp, $Database);
164
+     rename($IndexTemp, $Index);
165 165
     }
166 166
 
167
-   function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE)
167
+   function isInCache($ID, $Verbose = FALSE, $UpdateHitsCount = FALSE)
168 168
     {
169 169
      /* Compute the paths */
170 170
      $Index = $this->CacheFolder."/".$this->CacheIndex;
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
       {
176 176
        $IndexPos = ftell($Handle);
177 177
        $Entry = fgets($Handle, 4096);
178
-       if ( $Entry != "" )
178
+       if ($Entry != "")
179 179
         {
180
-         $Settings = preg_split("/,/",$Entry);
180
+         $Settings = preg_split("/,/", $Entry);
181 181
          $PicID    = $Settings[0];
182
-         if ( $PicID == $ID )
182
+         if ($PicID == $ID)
183 183
           {
184 184
            fclose($Handle);
185 185
 
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
            $GeneratedTS = $Settings[3];
189 189
            $Hits        = intval($Settings[4]);
190 190
 
191
-           if ( $UpdateHitsCount )
191
+           if ($UpdateHitsCount)
192 192
             {
193 193
              $Hits++;
194
-             if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
194
+             if (strlen($Hits) < 7) { $Hits = $Hits.str_repeat(" ", 7 - strlen($Hits)); }
195 195
 
196 196
              $Handle = @fopen($Index, "r+");
197
-             fseek($Handle,$IndexPos);
197
+             fseek($Handle, $IndexPos);
198 198
              fwrite($Handle, $PicID.",".$DBPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
199 199
              fclose($Handle);
200 200
             }
201 201
 
202 202
            if ($Verbose)
203
-            { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); }
203
+            { return(array("DBPos"=>$DBPos, "PicSize"=>$PicSize, "GeneratedTS"=>$GeneratedTS, "Hits"=>$Hits)); }
204 204
            else
205 205
             { return(TRUE); }
206 206
           }
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
     }
214 214
 
215 215
    /* Automatic output method based on the calling interface */
216
-   function autoOutput($ID,$Destination="output.png")
216
+   function autoOutput($ID, $Destination = "output.png")
217 217
     {
218 218
      if (php_sapi_name() == "cli")
219
-      $this->saveFromCache($ID,$Destination);
219
+      $this->saveFromCache($ID, $Destination);
220 220
      else
221 221
       $this->strokeFromCache($ID);
222 222
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      $Picture = $this->getFromCache($ID);
228 228
 
229 229
      /* Do we have a hit? */
230
-     if ( $Picture == NULL ) { return(FALSE); }
230
+     if ($Picture == NULL) { return(FALSE); }
231 231
 
232 232
      header('Content-type: image/png');
233 233
      echo $Picture;
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
      return(TRUE);
236 236
     }
237 237
 
238
-   function saveFromCache($ID,$Destination)
238
+   function saveFromCache($ID, $Destination)
239 239
     {
240 240
      /* Get the raw picture from the cache */
241 241
      $Picture = $this->getFromCache($ID);
242 242
 
243 243
      /* Do we have a hit? */
244
-     if ( $Picture == NULL ) { return(FALSE); }
244
+     if ($Picture == NULL) { return(FALSE); }
245 245
 
246 246
      /* Flush the picture to a file */
247
-     $Handle = fopen($Destination,"w");
248
-     fwrite($Handle,$Picture);
247
+     $Handle = fopen($Destination, "w");
248
+     fwrite($Handle, $Picture);
249 249
      fclose($Handle);
250 250
 
251 251
      /* All went fine */
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      $Database = $this->CacheFolder."/".$this->CacheDB;
259 259
 
260 260
      /* Lookup for the picture in the cache */
261
-     $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
261
+     $CacheInfo = $this->isInCache($ID, TRUE, TRUE);
262 262
 
263 263
      /* Not in the cache */
264 264
      if (!$CacheInfo) { return(NULL); }
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 
270 270
      /* Extract the picture from the solid cache file */
271 271
      $Handle = @fopen($Database, "r");
272
-     fseek($Handle,$DBPos);
273
-     $Picture = fread($Handle,$PicSize);
272
+     fseek($Handle, $DBPos);
273
+     $Picture = fread($Handle, $PicSize);
274 274
      fclose($Handle);
275 275
 
276 276
      /* Return back the raw picture data */
Please login to merge, or discard this patch.