Passed
Push — master ( 0f8b85...1af5ec )
by Kevin
15:29 queued 03:24
created
default/boinc/modules/boincstats/includes/pchart/class/pStock.class.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pStock - class to draw stock charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,204 +13,204 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("STOCK_MISSING_SERIE"	, 180001);
16
+    define("STOCK_MISSING_SERIE"	, 180001);
17 17
 
18
- /* pStock class definition */
19
- class pStock
20
-  {
21
-   var $pChartObject;
22
-   var $pDataObject;
18
+    /* pStock class definition */
19
+    class pStock
20
+    {
21
+    var $pChartObject;
22
+    var $pDataObject;
23 23
 
24
-   /* Class creator */
25
-   function pStock($pChartObject,$pDataObject)
24
+    /* Class creator */
25
+    function pStock($pChartObject,$pDataObject)
26 26
     {
27
-     $this->pChartObject = $pChartObject;
28
-     $this->pDataObject  = $pDataObject;
27
+        $this->pChartObject = $pChartObject;
28
+        $this->pDataObject  = $pDataObject;
29 29
     }
30 30
 
31
-   /* Draw a stock chart */
32
-   function drawStockChart($Format="")
31
+    /* Draw a stock chart */
32
+    function drawStockChart($Format="")
33 33
     {
34
-     $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35
-     $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36
-     $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37
-     $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
-     $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
-     $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40
-     $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41
-     $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42
-     $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43
-     $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
-     $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
-     $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46
-     $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47
-     $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48
-     $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
-     $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
-     $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51
-     $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52
-     $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53
-     $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
-     $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
-     $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
-     $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
-     $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
-     $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
-     $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60
-     $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61
-     $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62
-     $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
-     $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
-     $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
-     $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
-     $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
-     $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
-     $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
-     $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70
-     $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71
-     $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72
-     $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
-     $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
-     $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
-     $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76
-
77
-
78
-     /* Data Processing */
79
-     $Data    = $this->pDataObject->getData();
80
-     $Palette = $this->pDataObject->getPalette();
81
-
82
-     if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
-     if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84
-
85
-     if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
-     $BoxOffset = $BoxWidth / 2;
87
-
88
-     $Data = $this->pChartObject->DataSet->getData();
89
-     list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
90
-
91
-     if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
92
-      return(STOCK_MISSING_SERIE);
93
-
94
-     $Plots = "";
95
-     foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
-      {
97
-       $Point = "";
98
-       if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
34
+        $SerieOpen		= isset($Format["SerieOpen"]) ? $Format["SerieOpen"] : "Open";
35
+        $SerieClose	= isset($Format["SerieClose"]) ? $Format["SerieClose"] : "Close";
36
+        $SerieMin		= isset($Format["SerieMin"]) ? $Format["SerieMin"] : "Min";
37
+        $SerieMax		= isset($Format["SerieMax"]) ? $Format["SerieMax"] : "Max";
38
+        $SerieMedian	= isset($Format["SerieMedian"]) ? $Format["SerieMedian"] : NULL;
39
+        $LineWidth		= isset($Format["LineWidth"]) ? $Format["LineWidth"] : 1;
40
+        $LineR		= isset($Format["LineR"]) ? $Format["LineR"] : 0;
41
+        $LineG		= isset($Format["LineG"]) ? $Format["LineG"] : 0;
42
+        $LineB		= isset($Format["LineB"]) ? $Format["LineB"] : 0;
43
+        $LineAlpha		= isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100;
44
+        $ExtremityWidth	= isset($Format["ExtremityWidth"]) ? $Format["ExtremityWidth"] : 1;
45
+        $ExtremityLength	= isset($Format["ExtremityLength"]) ? $Format["ExtremityLength"] : 3;
46
+        $ExtremityR	= isset($Format["ExtremityR"]) ? $Format["ExtremityR"] : 0;
47
+        $ExtremityG	= isset($Format["ExtremityG"]) ? $Format["ExtremityG"] : 0;
48
+        $ExtremityB	= isset($Format["ExtremityB"]) ? $Format["ExtremityB"] : 0;
49
+        $ExtremityAlpha	= isset($Format["ExtremityAlpha"]) ? $Format["ExtremityAlpha"] : 100;
50
+        $BoxWidth		= isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 8;
51
+        $BoxUpR		= isset($Format["BoxUpR"]) ? $Format["BoxUpR"] : 188;
52
+        $BoxUpG		= isset($Format["BoxUpG"]) ? $Format["BoxUpG"] : 224;
53
+        $BoxUpB		= isset($Format["BoxUpB"]) ? $Format["BoxUpB"] : 46;
54
+        $BoxUpAlpha	= isset($Format["BoxUpAlpha"]) ? $Format["BoxUpAlpha"] : 100;
55
+        $BoxUpSurrounding	= isset($Format["BoxUpSurrounding"]) ? $Format["BoxUpSurrounding"] : NULL;
56
+        $BoxUpBorderR	= isset($Format["BoxUpBorderR"]) ? $Format["BoxUpBorderR"] : $BoxUpR-20;
57
+        $BoxUpBorderG	= isset($Format["BoxUpBorderG"]) ? $Format["BoxUpBorderG"] : $BoxUpG-20;
58
+        $BoxUpBorderB	= isset($Format["BoxUpBorderB"]) ? $Format["BoxUpBorderB"] : $BoxUpB-20;
59
+        $BoxUpBorderAlpha	= isset($Format["BoxUpBorderAlpha"]) ? $Format["BoxUpBorderAlpha"] : 100;
60
+        $BoxDownR		= isset($Format["BoxDownR"]) ? $Format["BoxDownR"] : 224;
61
+        $BoxDownG		= isset($Format["BoxDownG"]) ? $Format["BoxDownG"] : 100;
62
+        $BoxDownB		= isset($Format["BoxDownB"]) ? $Format["BoxDownB"] : 46;
63
+        $BoxDownAlpha	= isset($Format["BoxDownAlpha"]) ? $Format["BoxDownAlpha"] : 100;
64
+        $BoxDownSurrounding= isset($Format["BoxDownSurrounding"]) ? $Format["BoxDownSurrounding"] : NULL;
65
+        $BoxDownBorderR	= isset($Format["BoxDownBorderR"]) ? $Format["BoxDownBorderR"] : $BoxDownR-20;
66
+        $BoxDownBorderG	= isset($Format["BoxDownBorderG"]) ? $Format["BoxDownBorderG"] : $BoxDownG-20;
67
+        $BoxDownBorderB	= isset($Format["BoxDownBorderB"]) ? $Format["BoxDownBorderB"] : $BoxDownB-20;
68
+        $BoxDownBorderAlpha= isset($Format["BoxDownBorderAlpha"]) ? $Format["BoxDownBorderAlpha"] : 100;
69
+        $ShadowOnBoxesOnly	= isset($Format["ShadowOnBoxesOnly"]) ? $Format["ShadowOnBoxesOnly"] : TRUE;
70
+        $MedianR		= isset($Format["MedianR"]) ? $Format["MedianR"] : 255;
71
+        $MedianG		= isset($Format["MedianG"]) ? $Format["MedianG"] : 0;
72
+        $MedianB		= isset($Format["MedianB"]) ? $Format["MedianB"] : 0;
73
+        $MedianAlpha	= isset($Format["MedianAlpha"]) ? $Format["MedianAlpha"] : 100;
74
+        $RecordImageMap	= isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE;
75
+        $ImageMapTitle	= isset($Format["ImageMapTitle"]) ? $Format["ImageMapTitle"] : "Stock Chart";
76
+
77
+
78
+        /* Data Processing */
79
+        $Data    = $this->pDataObject->getData();
80
+        $Palette = $this->pDataObject->getPalette();
81
+
82
+        if ( $BoxUpSurrounding != NULL )	{ $BoxUpBorderR = $BoxUpR + $BoxUpSurrounding; $BoxUpBorderG = $BoxUpG + $BoxUpSurrounding; $BoxUpBorderB = $BoxUpB + $BoxUpSurrounding; }
83
+        if ( $BoxDownSurrounding != NULL )	{ $BoxDownBorderR = $BoxDownR + $BoxDownSurrounding; $BoxDownBorderG = $BoxDownG + $BoxDownSurrounding; $BoxDownBorderB = $BoxDownB + $BoxDownSurrounding; }
84
+
85
+        if ( $LineWidth != 1 ) { $LineOffset = $LineWidth / 2; }
86
+        $BoxOffset = $BoxWidth / 2;
87
+
88
+        $Data = $this->pChartObject->DataSet->getData();
89
+        list($XMargin,$XDivs) = $this->pChartObject->scaleGetXSettings();
90
+
91
+        if ( !isset($Data["Series"][$SerieOpen]) || !isset($Data["Series"][$SerieClose]) || !isset($Data["Series"][$SerieMin]) || !isset($Data["Series"][$SerieMax]) )
92
+        return(STOCK_MISSING_SERIE);
93
+
94
+        $Plots = "";
95
+        foreach($Data["Series"][$SerieOpen]["Data"] as $Key => $Value)
96
+        {
97
+        $Point = "";
98
+        if ( isset($Data["Series"][$SerieClose]["Data"][$Key]) || isset($Data["Series"][$SerieMin]["Data"][$Key]) || isset($Data["Series"][$SerieMax]["Data"][$Key]) )
99 99
         $Point = array($Value,$Data["Series"][$SerieClose]["Data"][$Key],$Data["Series"][$SerieMin]["Data"][$Key],$Data["Series"][$SerieMax]["Data"][$Key]);
100
-       if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
100
+        if ( $SerieMedian != NULL && isset($Data["Series"][$SerieMedian]["Data"][$Key]) )
101 101
         $Point[] = $Data["Series"][$SerieMedian]["Data"][$Key];
102 102
 
103
-       $Plots[] = $Point;
104
-      }
103
+        $Plots[] = $Point;
104
+        }
105 105
 
106
-     $AxisID	= $Data["Series"][$SerieOpen]["Axis"];
107
-     $Mode	= $Data["Axis"][$AxisID]["Display"];
108
-     $Format	= $Data["Axis"][$AxisID]["Format"];
109
-     $Unit	= $Data["Axis"][$AxisID]["Unit"];
106
+        $AxisID	= $Data["Series"][$SerieOpen]["Axis"];
107
+        $Mode	= $Data["Axis"][$AxisID]["Display"];
108
+        $Format	= $Data["Axis"][$AxisID]["Format"];
109
+        $Unit	= $Data["Axis"][$AxisID]["Unit"];
110 110
 
111
-     $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
-     $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
111
+        $YZero	= $this->pChartObject->scaleComputeY(0,array("AxisID"=>$AxisID));
112
+        $XStep	= ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs;
113 113
 
114
-     $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115
-     $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
114
+        $X = $this->pChartObject->GraphAreaX1 + $XMargin;
115
+        $Y = $this->pChartObject->GraphAreaY1 + $XMargin;
116 116
 
117
-     $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
-     $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
-     $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
-     $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
-     $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
117
+        $LineSettings	= array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha);
118
+        $ExtremitySettings	= array("R"=>$ExtremityR,"G"=>$ExtremityG,"B"=>$ExtremityB,"Alpha"=>$ExtremityAlpha);
119
+        $BoxUpSettings	= array("R"=>$BoxUpR,"G"=>$BoxUpG,"B"=>$BoxUpB,"Alpha"=>$BoxUpAlpha,"BorderR"=>$BoxUpBorderR,"BorderG"=>$BoxUpBorderG,"BorderB"=>$BoxUpBorderB,"BorderAlpha"=>$BoxUpBorderAlpha);
120
+        $BoxDownSettings	= array("R"=>$BoxDownR,"G"=>$BoxDownG,"B"=>$BoxDownB,"Alpha"=>$BoxDownAlpha,"BorderR"=>$BoxDownBorderR,"BorderG"=>$BoxDownBorderG,"BorderB"=>$BoxDownBorderB,"BorderAlpha"=>$BoxDownBorderAlpha);
121
+        $MedianSettings	= array("R"=>$MedianR,"G"=>$MedianG,"B"=>$MedianB,"Alpha"=>$MedianAlpha);
122 122
 
123
-     foreach($Plots as $Key =>$Points)
124
-      {
125
-       $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
123
+        foreach($Plots as $Key =>$Points)
124
+        {
125
+        $PosArray = $this->pChartObject->scaleComputeY($Points,array("AxisID"=>$AxisID));
126 126
 
127
-       $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
-       if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
-       if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
127
+        $Values = "Open :".$Data["Series"][$SerieOpen]["Data"][$Key]."<BR>Close : ".$Data["Series"][$SerieClose]["Data"][$Key]."<BR>Min : ".$Data["Series"][$SerieMin]["Data"][$Key]."<BR>Max : ".$Data["Series"][$SerieMax]["Data"][$Key]."<BR>";
128
+        if ( $SerieMedian != NULL ) { $Values = $Values."Median : ".$Data["Series"][$SerieMedian]["Data"][$Key]."<BR>"; }
129
+        if ( $PosArray[0] > $PosArray[1] ) { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxUpR,$BoxUpG,$BoxUpB); } else { $ImageMapColor = $this->pChartObject->toHTMLColor($BoxDownR,$BoxDownG,$BoxDownB); } 
130 130
 
131
-       if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
131
+        if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
132 132
         {
133
-         if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
-         if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
133
+            if ( $YZero > $this->pChartObject->GraphAreaY2-1 ) { $YZero = $this->pChartObject->GraphAreaY2-1; }
134
+            if ( $YZero < $this->pChartObject->GraphAreaY1+1 ) { $YZero = $this->pChartObject->GraphAreaY1+1; }
135 135
 
136
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
136
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaX2-$this->pChartObject->GraphAreaX1-$XMargin*2)/$XDivs; }
137 137
 
138
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
138
+            if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
139 139
 
140
-         if ( $LineWidth == 1 )
141
-          $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
142
-         else
143
-          $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
140
+            if ( $LineWidth == 1 )
141
+            $this->pChartObject->drawLine($X,$PosArray[2],$X,$PosArray[3],$LineSettings);
142
+            else
143
+            $this->pChartObject->drawFilledRectangle($X-$LineOffset,$PosArray[2],$X+$LineOffset,$PosArray[3],$LineSettings);
144 144
 
145
-         if ( $ExtremityWidth == 1 )
146
-          {
147
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
-           $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
145
+            if ( $ExtremityWidth == 1 )
146
+            {
147
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2],$ExtremitySettings);
148
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3],$ExtremitySettings);
149 149
 
150
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
-          }
152
-         else
153
-          {
154
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
-           $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
150
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]).",".floor($X+$ExtremityLength).",".floor($PosArray[3]),$ImageMapColor,$ImageMapTitle,$Values); }
151
+            }
152
+            else
153
+            {
154
+            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[2],$X+$ExtremityLength,$PosArray[2]-$ExtremityWidth,$ExtremitySettings);
155
+            $this->pChartObject->drawFilledRectangle($X-$ExtremityLength,$PosArray[3],$X+$ExtremityLength,$PosArray[3]+$ExtremityWidth,$ExtremitySettings);
156 156
 
157
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
158
-          }
157
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($X-$ExtremityLength).",".floor($PosArray[2]-$ExtremityWidth).",".floor($X+$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth),$ImageMapColor,$ImageMapTitle,$Values); }
158
+            }
159 159
 
160
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
160
+            if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
161 161
 
162
-         if ( $PosArray[0] > $PosArray[1] )
163
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
164
-         else
165
-          $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
162
+            if ( $PosArray[0] > $PosArray[1] )
163
+            $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxUpSettings);
164
+            else
165
+            $this->pChartObject->drawFilledRectangle($X-$BoxOffset,$PosArray[0],$X+$BoxOffset,$PosArray[1],$BoxDownSettings);
166 166
 
167
-         if ( isset($PosArray[4]) )
168
-          $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
167
+            if ( isset($PosArray[4]) )
168
+            $this->pChartObject->drawLine($X-$ExtremityLength,$PosArray[4],$X+$ExtremityLength,$PosArray[4],$MedianSettings);
169 169
 
170
-         $X = $X + $XStep;
170
+            $X = $X + $XStep;
171 171
         }
172
-       elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
172
+        elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM )
173 173
         {
174
-         if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
-         if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
174
+            if ( $YZero > $this->pChartObject->GraphAreaX2-1 ) { $YZero = $this->pChartObject->GraphAreaX2-1; }
175
+            if ( $YZero < $this->pChartObject->GraphAreaX1+1 ) { $YZero = $this->pChartObject->GraphAreaX1+1; }
176 176
 
177
-         if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
177
+            if ( $XDivs == 0 ) { $XStep = 0; } else { $XStep = ($this->pChartObject->GraphAreaY2-$this->pChartObject->GraphAreaY1-$XMargin*2)/$XDivs; }
178 178
 
179
-         if ( $LineWidth == 1 )
180
-          $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
181
-         else
182
-          $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
179
+            if ( $LineWidth == 1 )
180
+            $this->pChartObject->drawLine($PosArray[2],$Y,$PosArray[3],$Y,$LineSettings);
181
+            else
182
+            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$LineOffset,$PosArray[3],$Y+$LineOffset,$LineSettings);
183 183
 
184
-         if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
184
+            if ( $ShadowOnBoxesOnly ) { $RestoreShadow = $this->pChartObject->Shadow; $this->pChartObject->Shadow = FALSE; }
185 185
 
186
-         if ( $ExtremityWidth == 1 )
187
-          {
188
-           $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
-           $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
186
+            if ( $ExtremityWidth == 1 )
187
+            {
188
+            $this->pChartObject->drawLine($PosArray[2],$Y-$ExtremityLength,$PosArray[2],$Y+$ExtremityLength,$ExtremitySettings);
189
+            $this->pChartObject->drawLine($PosArray[3],$Y-$ExtremityLength,$PosArray[3],$Y+$ExtremityLength,$ExtremitySettings);
190 190
 
191
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
-          }
193
-         else
194
-          {
195
-           $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
-           $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
191
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
192
+            }
193
+            else
194
+            {
195
+            $this->pChartObject->drawFilledRectangle($PosArray[2],$Y-$ExtremityLength,$PosArray[2]-$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
196
+            $this->pChartObject->drawFilledRectangle($PosArray[3],$Y-$ExtremityLength,$PosArray[3]+$ExtremityWidth,$Y+$ExtremityLength,$ExtremitySettings);
197 197
 
198
-           if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
199
-          }
198
+            if ( $RecordImageMap ) { $this->pChartObject->addToImageMap("RECT",floor($PosArray[2]-$ExtremityWidth).",".floor($Y-$ExtremityLength).",".floor($PosArray[3]+$ExtremityWidth).",".floor($Y+$ExtremityLength),$ImageMapColor,$ImageMapTitle,$Values); }
199
+            }
200 200
 
201
-         if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
201
+            if ( $ShadowOnBoxesOnly ) { $this->pChartObject->Shadow = $RestoreShadow; }
202 202
 
203
-         if ( $PosArray[0] < $PosArray[1] )
204
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
205
-         else
206
-          $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
203
+            if ( $PosArray[0] < $PosArray[1] )
204
+            $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxUpSettings);
205
+            else
206
+            $this->pChartObject->drawFilledRectangle($PosArray[0],$Y-$BoxOffset,$PosArray[1],$Y+$BoxOffset,$BoxDownSettings);
207 207
 
208
-         if ( isset($PosArray[4]) )
209
-          $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
208
+            if ( isset($PosArray[4]) )
209
+            $this->pChartObject->drawLine($PosArray[4],$Y-$ExtremityLength,$PosArray[4],$Y+$ExtremityLength,$MedianSettings);
210 210
 
211
-         $Y = $Y + $XStep;
211
+            $Y = $Y + $XStep;
212
+        }
212 213
         }
213
-      }
214 214
     }
215
-  }
215
+    }
216 216
 ?>
217 217
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pCache.class.php 1 patch
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pCache - speed up the rendering by caching up the pictures
4 4
 
5 5
      Version     : 2.1.3
@@ -13,268 +13,268 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- /* pData class definition */
17
- class pCache
18
-  {
19
-   var $CacheFolder;
20
-   var $CacheIndex;
21
-   var $CacheDB;
16
+    /* pData class definition */
17
+    class pCache
18
+    {
19
+    var $CacheFolder;
20
+    var $CacheIndex;
21
+    var $CacheDB;
22 22
 
23
-   /* Class creator */
24
-   function pCache($Settings="")
23
+    /* Class creator */
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
-     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); }
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); }
36 36
     }
37 37
 
38
-   /* Flush the cache contents */
39
-   function flush()
38
+    /* Flush the cache contents */
39
+    function flush()
40 40
     {
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); }
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); }
43 43
     }
44 44
 
45
-   /* Return the MD5 of the data array to clearly identify the chart */
46
-   function getHash($Data,$Marker="")
45
+    /* Return the MD5 of the data array to clearly identify the chart */
46
+    function getHash($Data,$Marker="")
47 47
     { return(md5($Marker.serialize($Data->Data))); }
48 48
 
49
-   /* Write the generated picture to the cache */
50
-   function writeToCache($ID,$pChartObject)
49
+    /* Write the generated picture to the cache */
50
+    function writeToCache($ID,$pChartObject)
51 51
     {
52
-     /* Compute the paths */
53
-     $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
54
-     $Database      = $this->CacheFolder."/".$this->CacheDB;
55
-     $Index         = $this->CacheFolder."/".$this->CacheIndex;
56
-
57
-     /* Flush the picture to a temporary file */
58
-     imagepng($pChartObject->Picture ,$TemporaryFile);
59
-
60
-     /* Retrieve the files size */
61
-     $PictureSize = filesize($TemporaryFile);
62
-     $DBSize      = filesize($Database);
63
-
64
-     /* Save the index */
65
-     $Handle = fopen($Index,"a");
66
-     fwrite($Handle, $ID.",".$DBSize.",".$PictureSize.",".time().",0      \r\n");
67
-     fclose($Handle);
68
-
69
-     /* Get the picture raw contents */
70
-     $Handle = fopen($TemporaryFile,"r");
71
-     $Raw    = fread($Handle,$PictureSize);
72
-     fclose($Handle);
73
-
74
-     /* Save the picture in the solid database file */
75
-     $Handle = fopen($Database,"a");
76
-     fwrite($Handle, $Raw);
77
-     fclose($Handle);
78
-
79
-     /* Remove temporary file */
80
-     unlink($TemporaryFile);
52
+        /* Compute the paths */
53
+        $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png";
54
+        $Database      = $this->CacheFolder."/".$this->CacheDB;
55
+        $Index         = $this->CacheFolder."/".$this->CacheIndex;
56
+
57
+        /* Flush the picture to a temporary file */
58
+        imagepng($pChartObject->Picture ,$TemporaryFile);
59
+
60
+        /* Retrieve the files size */
61
+        $PictureSize = filesize($TemporaryFile);
62
+        $DBSize      = filesize($Database);
63
+
64
+        /* Save the index */
65
+        $Handle = fopen($Index,"a");
66
+        fwrite($Handle, $ID.",".$DBSize.",".$PictureSize.",".time().",0      \r\n");
67
+        fclose($Handle);
68
+
69
+        /* Get the picture raw contents */
70
+        $Handle = fopen($TemporaryFile,"r");
71
+        $Raw    = fread($Handle,$PictureSize);
72
+        fclose($Handle);
73
+
74
+        /* Save the picture in the solid database file */
75
+        $Handle = fopen($Database,"a");
76
+        fwrite($Handle, $Raw);
77
+        fclose($Handle);
78
+
79
+        /* Remove temporary file */
80
+        unlink($TemporaryFile);
81 81
     }
82 82
 
83
-   /* Remove object older than the specified TS */
84
-   function removeOlderThan($Expiry)
83
+    /* Remove object older than the specified TS */
84
+    function removeOlderThan($Expiry)
85 85
     { $this->dbRemoval(array("Expiry"=>$Expiry)); }
86 86
 
87
-   /* Remove an object from the cache */
88
-   function remove($ID)
87
+    /* Remove an object from the cache */
88
+    function remove($ID)
89 89
     { $this->dbRemoval(array("Name"=>$ID)); }
90 90
 
91
-   /* Remove with specified criterias */
92
-   function dbRemoval($Settings)
91
+    /* Remove with specified criterias */
92
+    function dbRemoval($Settings)
93 93
     {
94
-     $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95
-     $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96
-     $TS     = time()-$Expiry;
97
-
98
-     /* Compute the paths */
99
-     $Database     = $this->CacheFolder."/".$this->CacheDB;
100
-     $Index        = $this->CacheFolder."/".$this->CacheIndex;
101
-     $DatabaseTemp = $this->CacheFolder."/".$this->CacheDB.".tmp";
102
-     $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103
-
104
-     /* Single file removal */
105
-     if ( $ID != NULL )
106
-      {
107
-       /* Retrieve object informations */
108
-       $Object = $this->isInCache($ID,TRUE);
109
-
110
-       /* If it's not in the cache DB, go away */
111
-       if ( !$Object ) { return(0); }
112
-      }
113
-
114
-     /* Create the temporary files */
115
-     if (!file_exists($DatabaseTemp)) { touch($DatabaseTemp); }
116
-     if (!file_exists($IndexTemp))    { touch($IndexTemp); }
117
-
118
-     /* Open the file handles */
119
-     $IndexHandle     = @fopen($Index, "r");
120
-     $IndexTempHandle = @fopen($IndexTemp, "w");
121
-     $DBHandle        = @fopen($Database, "r");
122
-     $DBTempHandle    = @fopen($DatabaseTemp, "w");
123
-
124
-     /* Remove the selected ID from the database */
125
-     while (!feof($IndexHandle))
126
-      {
127
-       $Entry    = fgets($IndexHandle, 4096);
128
-       $Entry    = str_replace("\r","",$Entry);
129
-       $Entry    = str_replace("\n","",$Entry);
130
-       $Settings = preg_split("/,/",$Entry);
131
-
132
-       if ( $Entry != "" )
94
+        $ID     = isset($Settings["Name"]) ? $Settings["Name"] : NULL;
95
+        $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60);
96
+        $TS     = time()-$Expiry;
97
+
98
+        /* Compute the paths */
99
+        $Database     = $this->CacheFolder."/".$this->CacheDB;
100
+        $Index        = $this->CacheFolder."/".$this->CacheIndex;
101
+        $DatabaseTemp = $this->CacheFolder."/".$this->CacheDB.".tmp";
102
+        $IndexTemp    = $this->CacheFolder."/".$this->CacheIndex.".tmp";
103
+
104
+        /* Single file removal */
105
+        if ( $ID != NULL )
133 106
         {
134
-         $PicID       = $Settings[0];
135
-         $DBPos       = $Settings[1];
136
-         $PicSize     = $Settings[2];
137
-         $GeneratedTS = $Settings[3];
138
-         $Hits        = $Settings[4];
139
-
140
-         if ( $Settings[0] != $ID && $GeneratedTS > $TS)
141
-          {
142
-           $CurrentPos  = ftell($DBTempHandle);
143
-           fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144
-
145
-           fseek($DBHandle,$DBPos);
146
-           $Picture = fread($DBHandle,$PicSize);
147
-           fwrite($DBTempHandle,$Picture);
148
-          }
107
+        /* Retrieve object informations */
108
+        $Object = $this->isInCache($ID,TRUE);
109
+
110
+        /* If it's not in the cache DB, go away */
111
+        if ( !$Object ) { return(0); }
112
+        }
113
+
114
+        /* Create the temporary files */
115
+        if (!file_exists($DatabaseTemp)) { touch($DatabaseTemp); }
116
+        if (!file_exists($IndexTemp))    { touch($IndexTemp); }
117
+
118
+        /* Open the file handles */
119
+        $IndexHandle     = @fopen($Index, "r");
120
+        $IndexTempHandle = @fopen($IndexTemp, "w");
121
+        $DBHandle        = @fopen($Database, "r");
122
+        $DBTempHandle    = @fopen($DatabaseTemp, "w");
123
+
124
+        /* Remove the selected ID from the database */
125
+        while (!feof($IndexHandle))
126
+        {
127
+        $Entry    = fgets($IndexHandle, 4096);
128
+        $Entry    = str_replace("\r","",$Entry);
129
+        $Entry    = str_replace("\n","",$Entry);
130
+        $Settings = preg_split("/,/",$Entry);
131
+
132
+        if ( $Entry != "" )
133
+        {
134
+            $PicID       = $Settings[0];
135
+            $DBPos       = $Settings[1];
136
+            $PicSize     = $Settings[2];
137
+            $GeneratedTS = $Settings[3];
138
+            $Hits        = $Settings[4];
139
+
140
+            if ( $Settings[0] != $ID && $GeneratedTS > $TS)
141
+            {
142
+            $CurrentPos  = ftell($DBTempHandle);
143
+            fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
144
+
145
+            fseek($DBHandle,$DBPos);
146
+            $Picture = fread($DBHandle,$PicSize);
147
+            fwrite($DBTempHandle,$Picture);
148
+            }
149
+        }
149 150
         }
150
-      }
151 151
 
152
-     /* Close the handles */
153
-     fclose($IndexHandle);
154
-     fclose($IndexTempHandle);
155
-     fclose($DBHandle);
156
-     fclose($DBTempHandle);
152
+        /* Close the handles */
153
+        fclose($IndexHandle);
154
+        fclose($IndexTempHandle);
155
+        fclose($DBHandle);
156
+        fclose($DBTempHandle);
157 157
 
158
-     /* Remove the prod files */
159
-     unlink($Database);
160
-     unlink($Index);
158
+        /* Remove the prod files */
159
+        unlink($Database);
160
+        unlink($Index);
161 161
 
162
-     /* Swap the temp & prod DB */
163
-     rename($DatabaseTemp,$Database);
164
-     rename($IndexTemp,$Index);
162
+        /* Swap the temp & prod DB */
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
-     /* Compute the paths */
170
-     $Index = $this->CacheFolder."/".$this->CacheIndex;
171
-
172
-     /* Search the picture in the index file */
173
-     $Handle = @fopen($Index, "r");
174
-     while (!feof($Handle))
175
-      {
176
-       $IndexPos = ftell($Handle);
177
-       $Entry = fgets($Handle, 4096);
178
-       if ( $Entry != "" )
169
+        /* Compute the paths */
170
+        $Index = $this->CacheFolder."/".$this->CacheIndex;
171
+
172
+        /* Search the picture in the index file */
173
+        $Handle = @fopen($Index, "r");
174
+        while (!feof($Handle))
175
+        {
176
+        $IndexPos = ftell($Handle);
177
+        $Entry = fgets($Handle, 4096);
178
+        if ( $Entry != "" )
179 179
         {
180
-         $Settings = preg_split("/,/",$Entry);
181
-         $PicID    = $Settings[0];
182
-         if ( $PicID == $ID )
183
-          {
184
-           fclose($Handle);
185
-
186
-           $DBPos       = $Settings[1];
187
-           $PicSize     = $Settings[2];
188
-           $GeneratedTS = $Settings[3];
189
-           $Hits        = intval($Settings[4]);
190
-
191
-           if ( $UpdateHitsCount )
180
+            $Settings = preg_split("/,/",$Entry);
181
+            $PicID    = $Settings[0];
182
+            if ( $PicID == $ID )
192 183
             {
193
-             $Hits++;
194
-             if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
184
+            fclose($Handle);
185
+
186
+            $DBPos       = $Settings[1];
187
+            $PicSize     = $Settings[2];
188
+            $GeneratedTS = $Settings[3];
189
+            $Hits        = intval($Settings[4]);
195 190
 
196
-             $Handle = @fopen($Index, "r+");
197
-             fseek($Handle,$IndexPos);
198
-             fwrite($Handle, $PicID.",".$DBPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
199
-             fclose($Handle);
191
+            if ( $UpdateHitsCount )
192
+            {
193
+                $Hits++;
194
+                if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); }
195
+
196
+                $Handle = @fopen($Index, "r+");
197
+                fseek($Handle,$IndexPos);
198
+                fwrite($Handle, $PicID.",".$DBPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n");
199
+                fclose($Handle);
200 200
             }
201 201
 
202
-           if ($Verbose)
202
+            if ($Verbose)
203 203
             { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); }
204
-           else
204
+            else
205 205
             { return(TRUE); }
206
-          }
206
+            }
207 207
         }
208
-      }
209
-     fclose($Handle);
208
+        }
209
+        fclose($Handle);
210 210
 
211
-     /* Picture isn't in the cache */
212
-     return(FALSE);
211
+        /* Picture isn't in the cache */
212
+        return(FALSE);
213 213
     }
214 214
 
215
-   /* Automatic output method based on the calling interface */
216
-   function autoOutput($ID,$Destination="output.png")
215
+    /* Automatic output method based on the calling interface */
216
+    function autoOutput($ID,$Destination="output.png")
217 217
     {
218
-     if (php_sapi_name() == "cli")
219
-      $this->saveFromCache($ID,$Destination);
220
-     else
221
-      $this->strokeFromCache($ID);
218
+        if (php_sapi_name() == "cli")
219
+        $this->saveFromCache($ID,$Destination);
220
+        else
221
+        $this->strokeFromCache($ID);
222 222
     }
223 223
 
224
-   function strokeFromCache($ID)
224
+    function strokeFromCache($ID)
225 225
     {
226
-     /* Get the raw picture from the cache */
227
-     $Picture = $this->getFromCache($ID);
226
+        /* Get the raw picture from the cache */
227
+        $Picture = $this->getFromCache($ID);
228 228
 
229
-     /* Do we have a hit? */
230
-     if ( $Picture == NULL ) { return(FALSE); }
229
+        /* Do we have a hit? */
230
+        if ( $Picture == NULL ) { return(FALSE); }
231 231
 
232
-     header('Content-type: image/png');
233
-     echo $Picture;
232
+        header('Content-type: image/png');
233
+        echo $Picture;
234 234
 
235
-     return(TRUE);
235
+        return(TRUE);
236 236
     }
237 237
 
238
-   function saveFromCache($ID,$Destination)
238
+    function saveFromCache($ID,$Destination)
239 239
     {
240
-     /* Get the raw picture from the cache */
241
-     $Picture = $this->getFromCache($ID);
240
+        /* Get the raw picture from the cache */
241
+        $Picture = $this->getFromCache($ID);
242 242
 
243
-     /* Do we have a hit? */
244
-     if ( $Picture == NULL ) { return(FALSE); }
243
+        /* Do we have a hit? */
244
+        if ( $Picture == NULL ) { return(FALSE); }
245 245
 
246
-     /* Flush the picture to a file */
247
-     $Handle = fopen($Destination,"w");
248
-     fwrite($Handle,$Picture);
249
-     fclose($Handle);
246
+        /* Flush the picture to a file */
247
+        $Handle = fopen($Destination,"w");
248
+        fwrite($Handle,$Picture);
249
+        fclose($Handle);
250 250
 
251
-     /* All went fine */
252
-     return(TRUE);
251
+        /* All went fine */
252
+        return(TRUE);
253 253
     }
254 254
 
255
-   function getFromCache($ID)
255
+    function getFromCache($ID)
256 256
     {
257
-     /* Compute the path */
258
-     $Database = $this->CacheFolder."/".$this->CacheDB;
257
+        /* Compute the path */
258
+        $Database = $this->CacheFolder."/".$this->CacheDB;
259 259
 
260
-     /* Lookup for the picture in the cache */
261
-     $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
260
+        /* Lookup for the picture in the cache */
261
+        $CacheInfo = $this->isInCache($ID,TRUE,TRUE);
262 262
 
263
-     /* Not in the cache */
264
-     if (!$CacheInfo) { return(NULL); }
263
+        /* Not in the cache */
264
+        if (!$CacheInfo) { return(NULL); }
265 265
 
266
-     /* Get the database extended information */     
267
-     $DBPos   = $CacheInfo["DBPos"];
268
-     $PicSize = $CacheInfo["PicSize"];
266
+        /* Get the database extended information */     
267
+        $DBPos   = $CacheInfo["DBPos"];
268
+        $PicSize = $CacheInfo["PicSize"];
269 269
 
270
-     /* Extract the picture from the solid cache file */
271
-     $Handle = @fopen($Database, "r");
272
-     fseek($Handle,$DBPos);
273
-     $Picture = fread($Handle,$PicSize);
274
-     fclose($Handle);
270
+        /* Extract the picture from the solid cache file */
271
+        $Handle = @fopen($Database, "r");
272
+        fseek($Handle,$DBPos);
273
+        $Picture = fread($Handle,$PicSize);
274
+        fclose($Handle);
275 275
 
276
-     /* Return back the raw picture data */
277
-     return($Picture);
276
+        /* Return back the raw picture data */
277
+        return($Picture);
278
+    }
278 279
     }
279
-  }
280 280
 ?>
281 281
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boincstats/includes/pchart/class/pSurface.class.php 1 patch
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
- /*
2
+    /*
3 3
      pSurface - class to draw surface charts
4 4
 
5 5
      Version     : 2.1.3
@@ -13,303 +13,303 @@  discard block
 block discarded – undo
13 13
      You can find the whole class documentation on the pChart web site.
14 14
  */
15 15
 
16
- define("UNKNOWN"		, 0.123456789);
17
- define("IGNORED"		, -1);
16
+    define("UNKNOWN"		, 0.123456789);
17
+    define("IGNORED"		, -1);
18 18
 
19
- define("LABEL_POSITION_LEFT"	, 880001);
20
- define("LABEL_POSITION_RIGHT"	, 880002);
21
- define("LABEL_POSITION_TOP"	, 880003);
22
- define("LABEL_POSITION_BOTTOM"	, 880004);
19
+    define("LABEL_POSITION_LEFT"	, 880001);
20
+    define("LABEL_POSITION_RIGHT"	, 880002);
21
+    define("LABEL_POSITION_TOP"	, 880003);
22
+    define("LABEL_POSITION_BOTTOM"	, 880004);
23 23
 
24
- /* pStock class definition */
25
- class pSurface
26
-  {
27
-   var $pChartObject;
28
-   var $GridSizeX;
29
-   var $GridSizeY;
30
-   var $Points;
24
+    /* pStock class definition */
25
+    class pSurface
26
+    {
27
+    var $pChartObject;
28
+    var $GridSizeX;
29
+    var $GridSizeY;
30
+    var $Points;
31 31
 
32
-   /* Class creator */
33
-   function pSurface($pChartObject)
32
+    /* Class creator */
33
+    function pSurface($pChartObject)
34 34
     {
35
-     $this->pChartObject = $pChartObject;
36
-     $this->GridSize     = 10;
37
-     $this->Points       = "";
35
+        $this->pChartObject = $pChartObject;
36
+        $this->GridSize     = 10;
37
+        $this->Points       = "";
38 38
     }
39 39
 
40
-   /* Define the grid size and initialise the 2D matrix */
41
-   function setGrid($XSize=10,$YSize=10)
40
+    /* Define the grid size and initialise the 2D matrix */
41
+    function setGrid($XSize=10,$YSize=10)
42 42
     {
43
-     for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
43
+        for($X=0; $X<=$XSize; $X++) { for($Y=0; $Y<=$YSize; $Y++) { $this->Points[$X][$Y]=UNKNOWN; } } 
44 44
 
45
-     $this->GridSizeX = $XSize;
46
-     $this->GridSizeY = $YSize;
45
+        $this->GridSizeX = $XSize;
46
+        $this->GridSizeY = $YSize;
47 47
     }
48 48
 
49
-   /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
49
+    /* Add a point on the grid */
50
+    function addPoint($X,$Y,$Value,$Force=TRUE)
51 51
     {
52
-     if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
-     if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54
-
55
-     if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
56
-      $this->Points[$X][$Y] = $Value;
57
-     elseif ( $this->Points[$X][$Y] == UNKNOWN )
58
-      $this->Points[$X][$Y] = $Value;
59
-     else
60
-      $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
52
+        if ( $X < 0 || $X >$this->GridSizeX ) { return(0); }
53
+        if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); }
54
+
55
+        if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
56
+        $this->Points[$X][$Y] = $Value;
57
+        elseif ( $this->Points[$X][$Y] == UNKNOWN )
58
+        $this->Points[$X][$Y] = $Value;
59
+        else
60
+        $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
61 61
     }
62 62
 
63
-   /* Write the X labels */
64
-   function writeXLabels($Format="")
63
+    /* Write the X labels */
64
+    function writeXLabels($Format="")
65 65
     {
66
-     $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67
-     $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68
-     $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75
-
76
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77
-
78
-     $X0    = $this->pChartObject->GraphAreaX1;
79
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80
-
81
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
-     if ( $Position == LABEL_POSITION_TOP )
83
-      {
84
-       $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
-      }
88
-     elseif ( $Position == LABEL_POSITION_BOTTOM )
89
-      {
90
-       $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
-       if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
-       if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
-      }
94
-     else
95
-      return(-1);
96
-
97
-     for($X=0;$X<=$this->GridSizeX;$X++)
98
-      {
99
-       $XPos = floor($X0+$X*$XSize + $XSize/2);
100
-
101
-       if( $Labels == NULL || !isset($Labels[$X]) )
66
+        $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67
+        $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68
+        $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
71
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
72
+        $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_TOP;
73
+        $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
74
+        $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
75
+
76
+        if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77
+
78
+        $X0    = $this->pChartObject->GraphAreaX1;
79
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
80
+
81
+        $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
+        if ( $Position == LABEL_POSITION_TOP )
83
+        {
84
+        $YPos  = $this->pChartObject->GraphAreaY1 - $Padding;
85
+        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; }
86
+        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
87
+        }
88
+        elseif ( $Position == LABEL_POSITION_BOTTOM )
89
+        {
90
+        $YPos  = $this->pChartObject->GraphAreaY2 + $Padding;
91
+        if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; }
92
+        if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
93
+        }
94
+        else
95
+        return(-1);
96
+
97
+        for($X=0;$X<=$this->GridSizeX;$X++)
98
+        {
99
+        $XPos = floor($X0+$X*$XSize + $XSize/2);
100
+
101
+        if( $Labels == NULL || !isset($Labels[$X]) )
102 102
         $Value = $X+$CountOffset;
103
-       else
103
+        else
104 104
         $Value = $Labels[$X];
105 105
 
106
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
107
-      }
106
+        $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
107
+        }
108 108
     }
109 109
 
110
-   /* Write the Y labels */
111
-   function writeYLabels($Format="")
110
+    /* Write the Y labels */
111
+    function writeYLabels($Format="")
112 112
     {
113
-     $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114
-     $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115
-     $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116
-     $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117
-     $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
-     $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
-     $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
-     $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122
-
123
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124
-
125
-     $Y0    = $this->pChartObject->GraphAreaY1;
126
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
127
-
128
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
-     if ( $Position == LABEL_POSITION_LEFT )
130
-      { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
-     elseif ( $Position == LABEL_POSITION_RIGHT )
132
-      { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
-     else
134
-      return(-1);
135
-
136
-     for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
-      {
138
-       $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139
-
140
-       if( $Labels == NULL || !isset($Labels[$Y]) )
113
+        $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114
+        $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115
+        $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116
+        $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117
+        $Angle		= isset($Format["Angle"]) ? $Format["Angle"] : 0;
118
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 5;
119
+        $Position		= isset($Format["Position"]) ? $Format["Position"] : LABEL_POSITION_LEFT;
120
+        $Labels		= isset($Format["Labels"]) ? $Format["Labels"] : NULL;
121
+        $CountOffset	= isset($Format["CountOffset"]) ? $Format["CountOffset"] : 0;
122
+
123
+        if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124
+
125
+        $Y0    = $this->pChartObject->GraphAreaY1;
126
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
127
+
128
+        $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
+        if ( $Position == LABEL_POSITION_LEFT )
130
+        { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
+        elseif ( $Position == LABEL_POSITION_RIGHT )
132
+        { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133
+        else
134
+        return(-1);
135
+
136
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
137
+        {
138
+        $YPos = floor($Y0+$Y*$YSize + $YSize/2);
139
+
140
+        if( $Labels == NULL || !isset($Labels[$Y]) )
141 141
         $Value = $Y+$CountOffset;
142
-       else
142
+        else
143 143
         $Value = $Labels[$Y];
144 144
 
145
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
146
-      }
145
+        $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
146
+        }
147 147
     }
148 148
 
149
-   /* Draw the area arround the specified Threshold */
150
-   function drawContour($Threshold,$Format="")
149
+    /* Draw the area arround the specified Threshold */
150
+    function drawContour($Threshold,$Format="")
151 151
     {
152
-     $R		= isset($Format["R"]) ? $Format["R"] : 0;
153
-     $G		= isset($Format["G"]) ? $Format["G"] : 0;
154
-     $B		= isset($Format["B"]) ? $Format["B"] : 0;
155
-     $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156
-     $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
-     $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
158
-
159
-     $X0    = $this->pChartObject->GraphAreaX1;
160
-     $Y0    = $this->pChartObject->GraphAreaY1;
161
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
163
-
164
-     $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165
-
166
-     for($X=0;$X<=$this->GridSizeX;$X++)
167
-      {
168
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
152
+        $R		= isset($Format["R"]) ? $Format["R"] : 0;
153
+        $G		= isset($Format["G"]) ? $Format["G"] : 0;
154
+        $B		= isset($Format["B"]) ? $Format["B"] : 0;
155
+        $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156
+        $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
+        $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
158
+
159
+        $X0    = $this->pChartObject->GraphAreaX1;
160
+        $Y0    = $this->pChartObject->GraphAreaY1;
161
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
162
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
163
+
164
+        $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
165
+
166
+        for($X=0;$X<=$this->GridSizeX;$X++)
169 167
         {
170
-         $Value = $this->Points[$X][$Y];
168
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
169
+        {
170
+            $Value = $this->Points[$X][$Y];
171 171
 
172
-         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
-          {
174
-           $X1 = floor($X0+$X*$XSize)+$Padding;
175
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
-           $X2 = floor($X0+$X*$XSize+$XSize);
177
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
172
+            if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173
+            {
174
+            $X1 = floor($X0+$X*$XSize)+$Padding;
175
+            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
176
+            $X2 = floor($X0+$X*$XSize+$XSize);
177
+            $Y2 = floor($Y0+$Y*$YSize+$YSize);
178 178
 
179
-           if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
179
+            if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
180 180
             $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,$Color);
181
-           if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
181
+            if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold)
182 182
             $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,$Color);
183
-           if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
183
+            if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold)
184 184
             $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,$Color);
185
-           if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
185
+            if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold)
186 186
             $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color);
187
-          }
187
+            }
188
+        }
188 189
         }
189
-      }
190 190
     }
191 191
 
192
-   /* Draw the surface chart */
193
-   function drawSurface($Format="")
192
+    /* Draw the surface chart */
193
+    function drawSurface($Format="")
194 194
     {
195
-     $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196
-     $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197
-     $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198
-     $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
199
-     $ShadeA1		= isset($Format["ShadeA1"]) ? $Format["ShadeA1"] : 40;
200
-     $ShadeR2		= isset($Format["ShadeR2"]) ? $Format["ShadeR2"] : 227;
201
-     $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202
-     $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203
-     $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
205
-     $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206
-     $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207
-     $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209
-     $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210
-
211
-     $X0    = $this->pChartObject->GraphAreaX1;
212
-     $Y0    = $this->pChartObject->GraphAreaY1;
213
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215
-
216
-     for($X=0;$X<=$this->GridSizeX;$X++)
217
-      {
218
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
195
+        $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196
+        $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
197
+        $ShadeG1		= isset($Format["ShadeG1"]) ? $Format["ShadeG1"] : 205;
198
+        $ShadeB1		= isset($Format["ShadeB1"]) ? $Format["ShadeB1"] : 21;
199
+        $ShadeA1		= isset($Format["ShadeA1"]) ? $Format["ShadeA1"] : 40;
200
+        $ShadeR2		= isset($Format["ShadeR2"]) ? $Format["ShadeR2"] : 227;
201
+        $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202
+        $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203
+        $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
+        $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
205
+        $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206
+        $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207
+        $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
+        $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209
+        $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210
+
211
+        $X0    = $this->pChartObject->GraphAreaX1;
212
+        $Y0    = $this->pChartObject->GraphAreaY1;
213
+        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
214
+        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
215
+
216
+        for($X=0;$X<=$this->GridSizeX;$X++)
217
+        {
218
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
219 219
         {
220
-         $Value = $this->Points[$X][$Y];
220
+            $Value = $this->Points[$X][$Y];
221 221
 
222
-         if ( $Value != UNKNOWN && $Value != IGNORED )
223
-          {
224
-           $X1 = floor($X0+$X*$XSize)+$Padding;
225
-           $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
-           $X2 = floor($X0+$X*$XSize+$XSize);
227
-           $Y2 = floor($Y0+$Y*$YSize+$YSize);
222
+            if ( $Value != UNKNOWN && $Value != IGNORED )
223
+            {
224
+            $X1 = floor($X0+$X*$XSize)+$Padding;
225
+            $Y1 = floor($Y0+$Y*$YSize)+$Padding;
226
+            $X2 = floor($X0+$X*$XSize+$XSize);
227
+            $Y2 = floor($Y0+$Y*$YSize+$YSize);
228 228
 
229
-           if ( $Palette != NULL )
229
+            if ( $Palette != NULL )
230 230
             {
231
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
-             if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
231
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["R"]) ) { $R = $Palette[$Value]["R"]; } else { $R = 0; }
232
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; }
233
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; }
234
+                if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; }
235 235
             }
236
-           else
236
+            else
237 237
             {
238
-             $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
-             $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
-             $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
-             $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
238
+                $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1;
239
+                $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1;
240
+                $B = (($ShadeB2-$ShadeB1)/100)*$Value + $ShadeB1;
241
+                $Alpha = (($ShadeA2-$ShadeA1)/100)*$Value + $ShadeA1;
242 242
             }
243 243
 
244
-           $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
-           if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
-           if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
244
+            $Settings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
245
+            if ( $Border ) { $Settings["BorderR"] = $BorderR; $Settings["BorderG"] = $BorderG; $Settings["BorderB"] = $BorderB; }
246
+            if ( $Surrounding != -1 ) { $Settings["BorderR"] = $R+$Surrounding; $Settings["BorderG"] = $G+$Surrounding; $Settings["BorderB"] = $B+$Surrounding; }
247 247
 
248
-           $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
249
-          }
248
+            $this->pChartObject->drawFilledRectangle($X1,$Y1,$X2-1,$Y2-1,$Settings);
249
+            }
250
+        }
250 251
         }
251
-      }
252 252
     }
253 253
 
254
-   /* Compute the missing points */
255
-   function computeMissing()
254
+    /* Compute the missing points */
255
+    function computeMissing()
256 256
     {
257
-     $Missing = "";
258
-     for($X=0;$X<=$this->GridSizeX;$X++)
259
-      {
260
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
257
+        $Missing = "";
258
+        for($X=0;$X<=$this->GridSizeX;$X++)
259
+        {
260
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
261 261
         {
262
-         if ( $this->Points[$X][$Y] == UNKNOWN )
263
-          $Missing[] = $X.",".$Y;
262
+            if ( $this->Points[$X][$Y] == UNKNOWN )
263
+            $Missing[] = $X.",".$Y;
264 264
         }
265
-      }
266
-     shuffle($Missing);
265
+        }
266
+        shuffle($Missing);
267 267
      
268
-     foreach($Missing as $Key => $Pos)
269
-      {
270
-       $Pos = preg_split("/,/",$Pos);
271
-       $X   = $Pos[0];
272
-       $Y   = $Pos[1];
268
+        foreach($Missing as $Key => $Pos)
269
+        {
270
+        $Pos = preg_split("/,/",$Pos);
271
+        $X   = $Pos[0];
272
+        $Y   = $Pos[1];
273 273
 
274
-       if ( $this->Points[$X][$Y] == UNKNOWN )
274
+        if ( $this->Points[$X][$Y] == UNKNOWN )
275 275
         {
276
-         $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
276
+            $NearestNeighbor = $this->getNearestNeighbor($X,$Y);
277 277
 
278
-         $Value = 0; $Points = 0;
279
-         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
280
-          {
281
-           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
278
+            $Value = 0; $Points = 0;
279
+            for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
282 280
             {
283
-             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
-              {
285
-               $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286
-              }
281
+            for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
282
+            {
283
+                if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284
+                {
285
+                $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286
+                }
287
+            }
287 288
             }
288
-          }
289 289
 
290
-         if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
290
+            if ( $Points != 0 ) { $this->Points[$X][$Y] = $Value / $Points; }
291
+        }
291 292
         }
292
-      }
293 293
     }
294 294
 
295
-   /* Return the nearest Neighbor distance of a point */
296
-   function getNearestNeighbor($Xp,$Yp)
295
+    /* Return the nearest Neighbor distance of a point */
296
+    function getNearestNeighbor($Xp,$Yp)
297 297
     {
298
-     $Nearest = UNKNOWN;
299
-     for($X=0;$X<=$this->GridSizeX;$X++)
300
-      {
301
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
298
+        $Nearest = UNKNOWN;
299
+        for($X=0;$X<=$this->GridSizeX;$X++)
300
+        {
301
+        for($Y=0;$Y<=$this->GridSizeY;$Y++)
302 302
         {
303
-         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
-          {
305
-           $DistanceX = max($Xp,$X)-min($Xp,$X);
306
-           $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
-           $Distance  = max($DistanceX,$DistanceY);
308
-           if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
309
-          }
303
+            if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
304
+            {
305
+            $DistanceX = max($Xp,$X)-min($Xp,$X);
306
+            $DistanceY = max($Yp,$Y)-min($Yp,$Y);
307
+            $Distance  = max($DistanceX,$DistanceY);
308
+            if ( $Distance < $Nearest || $Nearest == UNKNOWN ) { $Nearest = $Distance; }
309
+            }
310 310
         }
311
-      }
312
-     return($Nearest);
311
+        }
312
+        return($Nearest);
313
+    }
313 314
     }
314
-  }
315 315
 ?>
316 316
\ No newline at end of file
Please login to merge, or discard this patch.
boinc/modules/boincteam/includes/views_handler_argument_boincteam_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincteam_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam_forum.views.inc 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,80 +13,80 @@
 block discarded – undo
13 13
  */
14 14
 function boincteam_forum_views_data() {
15 15
   
16
-  // -----------------------------------------------------------------------------------------------
17
-  // Definition for team table
18
-  // -----------------------------------------------------------------------------------------------
16
+    // -----------------------------------------------------------------------------------------------
17
+    // Definition for team table
18
+    // -----------------------------------------------------------------------------------------------
19 19
   
20
-  $data['boincteam_forum_node']['table']['group'] = t('BOINC');
20
+    $data['boincteam_forum_node']['table']['group'] = t('BOINC');
21 21
   
22
-  $data['boincteam_forum_node']['table']['base'] = array(
23
-      'field' => 'nid',
24
-      'title' => t('BOINC team forum topic'),
25
-      'help' => t('Forum topics for a team'),
26
-  );
22
+    $data['boincteam_forum_node']['table']['base'] = array(
23
+        'field' => 'nid',
24
+        'title' => t('BOINC team forum topic'),
25
+        'help' => t('Forum topics for a team'),
26
+    );
27 27
 
28
-  // Describe each of the individual fields in this table to Views. For
29
-  // each field, you may define what field, sort, argument, and/or filter
30
-  // handlers it supports. This will determine where in the Views interface you
31
-  // may use the field.
28
+    // Describe each of the individual fields in this table to Views. For
29
+    // each field, you may define what field, sort, argument, and/or filter
30
+    // handlers it supports. This will determine where in the Views interface you
31
+    // may use the field.
32 32
   
33
-  // Primary keys allowed as arguments
33
+    // Primary keys allowed as arguments
34 34
   
35
-  $data['boincteam_forum_node']['tfid'] = array(
35
+    $data['boincteam_forum_node']['tfid'] = array(
36 36
     'title' => t('Team forum ID'),
37 37
     'help' => t('The ID of the team forum containing this topic.'),
38 38
     'field' => array(
39
-      'handler' => 'views_handler_field_numeric',
40
-      'click sortable' => TRUE
39
+        'handler' => 'views_handler_field_numeric',
40
+        'click sortable' => TRUE
41 41
     ),
42 42
     'argument' => array(
43
-      'handler' => 'views_handler_argument_numeric',
44
-      'name field' => 'title', // the field to display in the summary.
45
-      'numeric' => TRUE,
46
-      'validate type' => 'id'
43
+        'handler' => 'views_handler_argument_numeric',
44
+        'name field' => 'title', // the field to display in the summary.
45
+        'numeric' => TRUE,
46
+        'validate type' => 'id'
47 47
     ),
48 48
     'relationship' => array(
49
-      'base' => 'boincteam_forum',
50
-      'field' => 'tfid',
51
-      'handler' => 'views_handler_relationship',
52
-      'label' => t('Team Forum')
49
+        'base' => 'boincteam_forum',
50
+        'field' => 'tfid',
51
+        'handler' => 'views_handler_relationship',
52
+        'label' => t('Team Forum')
53 53
     ),
54 54
     'filter' => array(
55
-      'handler' => 'views_handler_filter_numeric'
55
+        'handler' => 'views_handler_filter_numeric'
56 56
     ),
57 57
     'sort' => array(
58
-      'handler' => 'views_handler_sort_numeric'
58
+        'handler' => 'views_handler_sort_numeric'
59 59
     )
60
-  );
60
+    );
61 61
   
62
-  // Foreign key fields
62
+    // Foreign key fields
63 63
   
64
-  $data['boincteam_forum_node']['nid'] = array(
64
+    $data['boincteam_forum_node']['nid'] = array(
65 65
     'title' => t('Team forum node'),
66 66
     'help' => t('The node containing the content of this team forum topic.'),
67 67
     // This is a foreign key to the {node} table. When the view is configured
68 68
     // with this relationship, all the fields for the related user node will be 
69 69
     // available.
70 70
     'relationship' => array(
71
-      'base' => 'node',
72
-      'field' => 'nid',
73
-      'handler' => 'views_handler_relationship',
74
-      'label' => t('Team Forum Topic Node')
71
+        'base' => 'node',
72
+        'field' => 'nid',
73
+        'handler' => 'views_handler_relationship',
74
+        'label' => t('Team Forum Topic Node')
75 75
     ),
76 76
     'field' => array(
77
-      'handler' => 'views_handler_field_numeric',
78
-      'click sortable' => TRUE
77
+        'handler' => 'views_handler_field_numeric',
78
+        'click sortable' => TRUE
79 79
     ),
80 80
     'filter' => array(
81
-      'handler' => 'views_handler_filter_numeric'
81
+        'handler' => 'views_handler_filter_numeric'
82 82
     ),
83 83
     'sort' => array(
84
-      'handler' => 'views_handler_sort_numeric'
84
+        'handler' => 'views_handler_sort_numeric'
85 85
     )
86
-  );
86
+    );
87 87
   
88
-  // Descriptions of general fields (alphabetized)
89
-  // ...
88
+    // Descriptions of general fields (alphabetized)
89
+    // ...
90 90
   
91
-  return $data;
91
+    return $data;
92 92
 }
Please login to merge, or discard this patch.
boinc/modules/boincwork/views/views_handler_argument_boincuser_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincuser_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
modules/boincwork/views/views_handler_field_boincwork_host_app_et_avg.inc 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_host_app_et_avg extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     $gflops = 0;
15 15
     if ($values->host_app_version_et_avg) {
16
-      $gflops = 1e-9 / $values->host_app_version_et_avg;
16
+        $gflops = 1e-9 / $values->host_app_version_et_avg;
17 17
     }
18 18
     return round($gflops, 2) . ' GFLOPS';
19
-  }
19
+    }
20 20
 }
Please login to merge, or discard this patch.
boincwork/views/views_handler_field_boincwork_host_app_turnaround_avg.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_host_app_turnaround_avg extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     $time_in_days = $values->host_app_version_turnaround_avg / (24*60*60);
15 15
     return round($time_in_days, 2) . ' ' . t('days');
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
boincwork/views/views_handler_field_boincwork_app_version_number.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_app_version_number extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100);
15
-  }
15
+    }
16 16
 }
Please login to merge, or discard this patch.