Completed
Pull Request — master (#2135)
by Christian
10:38
created
default/boinc/modules/boincstats/includes/pchart/class/pCache.class.php 1 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.
default/boinc/modules/boincstats/includes/pchart/class/pSurface.class.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  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 24
  /* pStock class definition */
25 25
  class pSurface
@@ -38,159 +38,159 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
    /* Define the grid size and initialise the 2D matrix */
41
-   function setGrid($XSize=10,$YSize=10)
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 45
      $this->GridSizeX = $XSize;
46 46
      $this->GridSizeY = $YSize;
47 47
     }
48 48
 
49 49
    /* Add a point on the grid */
50
-   function addPoint($X,$Y,$Value,$Force=TRUE)
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); }
52
+     if ($X < 0 || $X > $this->GridSizeX) { return(0); }
53
+     if ($Y < 0 || $Y > $this->GridSizeY) { return(0); }
54 54
 
55
-     if ( $this->Points[$X][$Y] == UNKNOWN || $Force )
55
+     if ($this->Points[$X][$Y] == UNKNOWN || $Force)
56 56
       $this->Points[$X][$Y] = $Value;
57
-     elseif ( $this->Points[$X][$Y] == UNKNOWN )
57
+     elseif ($this->Points[$X][$Y] == UNKNOWN)
58 58
       $this->Points[$X][$Y] = $Value;
59 59
      else
60 60
       $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2;
61 61
     }
62 62
 
63 63
    /* Write the X labels */
64
-   function writeXLabels($Format="")
64
+   function writeXLabels($Format = "")
65 65
     {
66 66
      $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
67 67
      $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
68 68
      $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
69 69
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
70 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;
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 75
 
76
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
76
+     if ($Labels != NULL && !is_array($Labels)) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
77 77
 
78 78
      $X0    = $this->pChartObject->GraphAreaX1;
79
-     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX+1);
79
+     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/($this->GridSizeX + 1);
80 80
 
81
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
82
-     if ( $Position == LABEL_POSITION_TOP )
81
+     $Settings = array("Angle"=>$Angle, "R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
82
+     if ($Position == LABEL_POSITION_TOP)
83 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; }
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 87
       }
88
-     elseif ( $Position == LABEL_POSITION_BOTTOM )
88
+     elseif ($Position == LABEL_POSITION_BOTTOM)
89 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; }
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 93
       }
94 94
      else
95 95
       return(-1);
96 96
 
97
-     for($X=0;$X<=$this->GridSizeX;$X++)
97
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
98 98
       {
99
-       $XPos = floor($X0+$X*$XSize + $XSize/2);
99
+       $XPos = floor($X0 + $X*$XSize + $XSize/2);
100 100
 
101
-       if( $Labels == NULL || !isset($Labels[$X]) )
102
-        $Value = $X+$CountOffset;
101
+       if ($Labels == NULL || !isset($Labels[$X]))
102
+        $Value = $X + $CountOffset;
103 103
        else
104 104
         $Value = $Labels[$X];
105 105
 
106
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
106
+       $this->pChartObject->drawText($XPos, $YPos, $Value, $Settings);
107 107
       }
108 108
     }
109 109
 
110 110
    /* Write the Y labels */
111
-   function writeYLabels($Format="")
111
+   function writeYLabels($Format = "")
112 112
     {
113 113
      $R			= isset($Format["R"]) ? $Format["R"] : $this->pChartObject->FontColorR;
114 114
      $G			= isset($Format["G"]) ? $Format["G"] : $this->pChartObject->FontColorG;
115 115
      $B			= isset($Format["B"]) ? $Format["B"] : $this->pChartObject->FontColorB;
116 116
      $Alpha		= isset($Format["Alpha"]) ? $Format["Alpha"] : $this->pChartObject->FontColorA;
117 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;
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 122
 
123
-     if ( $Labels != NULL && !is_array($Labels) ) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
123
+     if ($Labels != NULL && !is_array($Labels)) { $Label = $Labels; $Labels = ""; $Labels[] = $Label; }
124 124
 
125 125
      $Y0    = $this->pChartObject->GraphAreaY1;
126
-     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY+1);
126
+     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/($this->GridSizeY + 1);
127 127
 
128
-     $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha);
129
-     if ( $Position == LABEL_POSITION_LEFT )
128
+     $Settings = array("Angle"=>$Angle, "R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha);
129
+     if ($Position == LABEL_POSITION_LEFT)
130 130
       { $XPos  = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; }
131
-     elseif ( $Position == LABEL_POSITION_RIGHT )
131
+     elseif ($Position == LABEL_POSITION_RIGHT)
132 132
       { $XPos  = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; }
133 133
      else
134 134
       return(-1);
135 135
 
136
-     for($Y=0;$Y<=$this->GridSizeY;$Y++)
136
+     for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
137 137
       {
138
-       $YPos = floor($Y0+$Y*$YSize + $YSize/2);
138
+       $YPos = floor($Y0 + $Y*$YSize + $YSize/2);
139 139
 
140
-       if( $Labels == NULL || !isset($Labels[$Y]) )
141
-        $Value = $Y+$CountOffset;
140
+       if ($Labels == NULL || !isset($Labels[$Y]))
141
+        $Value = $Y + $CountOffset;
142 142
        else
143 143
         $Value = $Labels[$Y];
144 144
 
145
-       $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings);
145
+       $this->pChartObject->drawText($XPos, $YPos, $Value, $Settings);
146 146
       }
147 147
     }
148 148
 
149 149
    /* Draw the area arround the specified Threshold */
150
-   function drawContour($Threshold,$Format="")
150
+   function drawContour($Threshold, $Format = "")
151 151
     {
152 152
      $R		= isset($Format["R"]) ? $Format["R"] : 0;
153 153
      $G		= isset($Format["G"]) ? $Format["G"] : 0;
154 154
      $B		= isset($Format["B"]) ? $Format["B"] : 0;
155 155
      $Alpha	= isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
156 156
      $Ticks	= isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
157
-     $Padding	= isset($Format["Padding"]) ? $Format["Padding"] : 0;
157
+     $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 0;
158 158
 
159 159
      $X0    = $this->pChartObject->GraphAreaX1;
160 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);
161
+     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/($this->GridSizeX + 1);
162
+     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/($this->GridSizeY + 1);
163 163
 
164
-     $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks);
164
+     $Color = array("R"=>$R, "G"=>$G, "B"=>$B, "Alpha"=>$Alpha, "Ticks"=>$Ticks);
165 165
 
166
-     for($X=0;$X<=$this->GridSizeX;$X++)
166
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
167 167
       {
168
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
168
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
169 169
         {
170 170
          $Value = $this->Points[$X][$Y];
171 171
 
172
-         if ( $Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
172
+         if ($Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold)
173 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
-
179
-           if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold)
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)
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)
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)
186
-            $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color);
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
+
179
+           if ($X > 0 && $this->Points[$X - 1][$Y] != UNKNOWN && $this->Points[$X - 1][$Y] != IGNORED && $this->Points[$X - 1][$Y] < $Threshold)
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)
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)
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)
186
+            $this->pChartObject->drawLine($X1, $Y2, $X2, $Y2, $Color);
187 187
           }
188 188
         }
189 189
       }
190 190
     }
191 191
 
192 192
    /* Draw the surface chart */
193
-   function drawSurface($Format="")
193
+   function drawSurface($Format = "")
194 194
     {
195 195
      $Palette		= isset($Format["Palette"]) ? $Format["Palette"] : NULL;
196 196
      $ShadeR1		= isset($Format["ShadeR1"]) ? $Format["ShadeR1"] : 77;
@@ -201,51 +201,51 @@  discard block
 block discarded – undo
201 201
      $ShadeG2		= isset($Format["ShadeG2"]) ? $Format["ShadeG2"] : 135;
202 202
      $ShadeB2		= isset($Format["ShadeB2"]) ? $Format["ShadeB2"] : 61;
203 203
      $ShadeA2		= isset($Format["ShadeA2"]) ? $Format["ShadeA2"] : 100;
204
-     $Border		= isset($Format["Border"]) ? $Format["Border"] : FALSE;
204
+     $Border = isset($Format["Border"]) ? $Format["Border"] : FALSE;
205 205
      $BorderR		= isset($Format["BorderR"]) ? $Format["BorderR"] : 0;
206 206
      $BorderG		= isset($Format["BorderG"]) ? $Format["BorderG"] : 0;
207 207
      $BorderB		= isset($Format["BorderB"]) ? $Format["BorderB"] : 0;
208
-     $Surrounding	= isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
208
+     $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : -1;
209 209
      $Padding		= isset($Format["Padding"]) ? $Format["Padding"] : 1;
210 210
 
211 211
      $X0    = $this->pChartObject->GraphAreaX1;
212 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);
213
+     $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1)/($this->GridSizeX + 1);
214
+     $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1)/($this->GridSizeY + 1);
215 215
 
216
-     for($X=0;$X<=$this->GridSizeX;$X++)
216
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
217 217
       {
218
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
218
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
219 219
         {
220 220
          $Value = $this->Points[$X][$Y];
221 221
 
222
-         if ( $Value != UNKNOWN && $Value != IGNORED )
222
+         if ($Value != UNKNOWN && $Value != IGNORED)
223 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);
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 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);
248
+           $this->pChartObject->drawFilledRectangle($X1, $Y1, $X2 - 1, $Y2 - 1, $Settings);
249 249
           }
250 250
         }
251 251
       }
@@ -255,57 +255,57 @@  discard block
 block discarded – undo
255 255
    function computeMissing()
256 256
     {
257 257
      $Missing = "";
258
-     for($X=0;$X<=$this->GridSizeX;$X++)
258
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
259 259
       {
260
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
260
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
261 261
         {
262
-         if ( $this->Points[$X][$Y] == UNKNOWN )
262
+         if ($this->Points[$X][$Y] == UNKNOWN)
263 263
           $Missing[] = $X.",".$Y;
264 264
         }
265 265
       }
266 266
      shuffle($Missing);
267 267
      
268
-     foreach($Missing as $Key => $Pos)
268
+     foreach ($Missing as $Key => $Pos)
269 269
       {
270
-       $Pos = preg_split("/,/",$Pos);
270
+       $Pos = preg_split("/,/", $Pos);
271 271
        $X   = $Pos[0];
272 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 278
          $Value = 0; $Points = 0;
279
-         for($Xi=$X-$NearestNeighbor;$Xi<=$X+$NearestNeighbor;$Xi++)
279
+         for ($Xi = $X - $NearestNeighbor; $Xi <= $X + $NearestNeighbor; $Xi++)
280 280
           {
281
-           for($Yi=$Y-$NearestNeighbor;$Yi<=$Y+$NearestNeighbor;$Yi++)
281
+           for ($Yi = $Y - $NearestNeighbor; $Yi <= $Y + $NearestNeighbor; $Yi++)
282 282
             {
283
-             if ($Xi >=0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
283
+             if ($Xi >= 0 && $Yi >= 0 && $Xi <= $this->GridSizeX && $Yi <= $this->GridSizeY && $this->Points[$Xi][$Yi] != UNKNOWN && $this->Points[$Xi][$Yi] != IGNORED)
284 284
               {
285 285
                $Value = $Value + $this->Points[$Xi][$Yi]; $Points++;
286 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 295
    /* Return the nearest Neighbor distance of a point */
296
-   function getNearestNeighbor($Xp,$Yp)
296
+   function getNearestNeighbor($Xp, $Yp)
297 297
     {
298 298
      $Nearest = UNKNOWN;
299
-     for($X=0;$X<=$this->GridSizeX;$X++)
299
+     for ($X = 0; $X <= $this->GridSizeX; $X++)
300 300
       {
301
-       for($Y=0;$Y<=$this->GridSizeY;$Y++)
301
+       for ($Y = 0; $Y <= $this->GridSizeY; $Y++)
302 302
         {
303
-         if ( $this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED )
303
+         if ($this->Points[$X][$Y] != UNKNOWN && $this->Points[$X][$Y] != IGNORED)
304 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; }
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 309
           }
310 310
         }
311 311
       }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam.views.inc 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -444,7 +444,7 @@
 block discarded – undo
444 444
 function boincteam_views_handlers() {
445 445
   return array(
446 446
     'info' => array(
447
-      'path' => drupal_get_path('module', 'boincteam') . '/views',
447
+      'path' => drupal_get_path('module', 'boincteam').'/views',
448 448
     ),
449 449
     'handlers' => array(
450 450
       'views_handler_argument_boincteam_id' => array(
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.admin.inc 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
   */
66 66
 function boincwork_admin_prefs_upload_form_validate($form, &$form_state) {
67 67
   
68
-  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
68
+  $xsd = './'.drupal_get_path('module', 'boincwork').'/includes/projectprefs.xsd';
69 69
   libxml_use_internal_errors(true);
70 70
   $xml = new DomDocument();
71 71
   $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS);
72 72
   if (!$xml->schemaValidate($xsd)) {
73 73
     $errors = libxml_get_errors();
74 74
     $lines = explode("\r", $form_state['values']['prefs_xml']);
75
-    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
76
-      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
75
+    drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}".
76
+      ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), 'error');
77 77
     form_set_error('upload', t('XML file failed validation'));
78 78
   }
79 79
 }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
       "{$path}/minimum" => t('Minimum')
102 102
     );
103 103
     variable_set('jump_use_js_presets-Array', 1);
104
-    drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
104
+    drupal_add_js(drupal_get_path('module', 'jump').'/jump.js');
105 105
     $output .= '<div class="simple-form-controls"><div class="form-item venue">';
106 106
     $output .= '<label>Preset:</label>';
107 107
     $output .= jump_quickly($preset_options, 'presets');
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     '#type' => 'submit',
151 151
     '#value' => t('Save configuration')
152 152
   );
153
-  $form['saveuseconfigxml'] = array (
153
+  $form['saveuseconfigxml'] = array(
154 154
       '#type' => 'submit',
155 155
       '#value' => t('Save configuration with disk usage settings from config.xml'),
156 156
       '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'),
@@ -175,33 +175,33 @@  discard block
 block discarded – undo
175 175
   // Verify all non-boolean user input values and notify form API of failures
176 176
   
177 177
   // Processing preferences
178
-  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
-  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
-  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
-  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
-  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
-  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
-  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
-  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
178
+  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for')." \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
+  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for')." \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
+  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for')." \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
+  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for')." \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
+  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for')." \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
+  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for')." \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
+  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for')." \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
+  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for')." \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
186 186
 
187 187
   // Storage preferences
188
-  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
-  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
-  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
-  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
-  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
-  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
-  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
188
+  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for')." \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
+  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for')." \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
+  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for')." \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
+  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for')." \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
+  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for')." \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
+  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for')." \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
+  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for')." \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
195 195
 
196 196
   // Network preferences
197
-  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
-  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
-  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
-  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
-  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
-  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
-  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
-  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
197
+  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for')." \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
+  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for')." \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
+  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for')." \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
+  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for')." \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
+  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for')." \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
+  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for')." \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
+  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for')." \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
+  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for')." \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
205 205
 }
206 206
 
207 207
 /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
   // Processing preferences
218 218
   $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1;
219 219
   $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1;
220
-  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1;
220
+  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1;
221 221
   $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run'];
222 222
   $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input'];
223 223
   $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage'];
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
   
268 268
   // Get the full configuration
269 269
   $all_presets = boincwork_get_preset_prefs();
270
-  $all_presets = (array) $all_presets['general_preferences'];
270
+  $all_presets = (array)$all_presets['general_preferences'];
271 271
   
272 272
   // Check for sane config
273 273
   if (isset($all_presets['preset'])) {
Please login to merge, or discard this patch.
modules/boincwork/views/views_handler_field_boincwork_host_app_et_avg.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 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
-    return round($gflops, 2) . ' GFLOPS';
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
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
   }
12 12
 
13 13
   function render($values) {
14
-    $time_in_days = $values->host_app_version_turnaround_avg / (24*60*60);
15
-    return round($time_in_days, 2) . ' ' . t('days');
14
+    $time_in_days = $values->host_app_version_turnaround_avg/(24*60*60);
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
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
   }
12 12
 
13 13
   function render($values) {
14
-    return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100);
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.
drupal/sites/default/boinc/modules/boincwork/boincwork.views.inc 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1637,7 +1637,7 @@
 block discarded – undo
1637 1637
   
1638 1638
   return array(
1639 1639
     'info' => array(
1640
-      'path' => drupal_get_path('module', 'boincwork') . '/views',
1640
+      'path' => drupal_get_path('module', 'boincwork').'/views',
1641 1641
     ),
1642 1642
     'handlers' => array(
1643 1643
       'views_handler_argument_boincuser_id' => array(
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/includes/import_team.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
   db_set_active('boinc');
27 27
   $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
28 28
   $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
29
-  $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
29
+  $boincteam_admin = (int)db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
30 30
   db_set_active('default');
31 31
   
32 32
   $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
       'teaser' => $teaser,
45 45
       'uid' => boincuser_lookup_uid($boincteam->userid),
46 46
       'path' => null,
47
-      'status' => 1,  // published or not - always publish
47
+      'status' => 1, // published or not - always publish
48 48
       'promote' => 0,
49 49
       'created' => $boincteam->create_time,
50
-      'comment' => 0,  // comments disabled
50
+      'comment' => 0, // comments disabled
51 51
       'moderate' => 0,
52 52
       'sticky' => 0,
53 53
       'format' => $input_format
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
       exit;
64 64
     }
65 65
     
66
-    $node = (object) $node; // node_save requires an object form
66
+    $node = (object)$node; // node_save requires an object form
67 67
     
68 68
     $node->taxonomy[] = taxonomy_get_term($team_type_tid);
69 69
     
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
   db_set_active('default');
82 82
   if ($boincteam_member_ids) {
83 83
     $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
84
-    $team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
84
+    $team_admin = (int)db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
85 85
     
86 86
     while ($drupal_user = db_fetch_object($team_members)) {
87 87
       // Add action to take on member accounts?
Please login to merge, or discard this patch.