Passed
Pull Request — master (#5926)
by
unknown
10:49 queued 42s
created
html/ops/dbinfo.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 // returns formatted data size
44
-function size_format($size){
44
+function size_format($size) {
45 45
 	$retval = 0;
46 46
 
47 47
 	$KB = 1024;
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
     if ($size < $KB) {
53 53
 	    $retval = $size;
54 54
     } elseif (($size > $KB) && ($size < $MB)) {
55
-		$retval = sprintf("%.0fK", ($size / $KB));
56
-    } elseif ( ($size >= $MB) && ($size < $GB)) {
57
-		$retval = sprintf("%.2fMB", ($size / $MB));
58
-    } elseif ( ($size >= $GB) && ($size < $TB)) {
59
-		$retval = sprintf("%.2fGB", ($size / $GB));
60
-	} elseif ( $size >= $TB ) {
61
-		$retval = sprintf("%.2fTB", ($size / $TB));
55
+		$retval = sprintf("%.0fK", ($size/$KB));
56
+    } elseif (($size >= $MB) && ($size < $GB)) {
57
+		$retval = sprintf("%.2fMB", ($size/$MB));
58
+    } elseif (($size >= $GB) && ($size < $TB)) {
59
+		$retval = sprintf("%.2fGB", ($size/$GB));
60
+	} elseif ($size >= $TB) {
61
+		$retval = sprintf("%.2fTB", ($size/$TB));
62 62
 	}
63 63
 	return $retval;
64 64
 }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
         if ($myarr['Comment'] == 'VIEW') continue;
90 90
 
91 91
 		// sum grand totals
92
-		$total  =  $myarr["Data_length"] + $myarr["Index_length"];
92
+		$total = $myarr["Data_length"] + $myarr["Index_length"];
93 93
 		$gindex += $myarr["Index_length"];
94
-        $gdata  += $myarr["Data_length"];
94
+        $gdata += $myarr["Data_length"];
95 95
 		$grows  += $myarr["Rows"];
96 96
 		$gtotal += $total;
97 97
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         );
106 106
 		$i++;
107 107
 	}
108
-    $db_rec[$i] = new DB_REC ("Total", $gdata, $gindex, $gtotal, $grows, "" );
108
+    $db_rec[$i] = new DB_REC("Total", $gdata, $gindex, $gtotal, $grows, "");
109 109
 	return $db_rec;
110 110
 }
111 111
 
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
 	echo "<th>Avg. Size per Row</th>";
127 127
 	echo "</tr>";
128 128
 
129
-	for ($i = 0; $i < sizeof($db_rec)-1; $i++){
129
+	for ($i = 0; $i < sizeof($db_rec) - 1; $i++) {
130 130
 		echo "<tr>";
131
-		echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>";
132
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size)  . "</td>";
133
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->index_size) . "</td>";
134
-		echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->total_size) . "</td>";
135
-        echo "<td align=left valign=top class=fieldname>" . number_format($db_rec[$i]->rows)     . "</td>";
136
-        echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->size_per_row) . "</td>";
131
+		echo "<td align=left valign=top class=fieldname>".$db_rec[$i]->name."</td>";
132
+		echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->data_size)."</td>";
133
+		echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->index_size)."</td>";
134
+		echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->total_size)."</td>";
135
+        echo "<td align=left valign=top class=fieldname>".number_format($db_rec[$i]->rows)."</td>";
136
+        echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->size_per_row)."</td>";
137 137
 		echo "</tr>";
138 138
 	}
139 139
 
140 140
 	// Last record is just a summary
141
-	$i = sizeof($db_rec)-1;
141
+	$i = sizeof($db_rec) - 1;
142 142
 	echo "<tr>";
143
-    echo "<th align=left>" . $db_rec[$i]->name . "</th>";
144
-    echo "<th align=left>" . size_format($db_rec[$i]->data_size)  . "</th>";
145
-    echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>";
146
-    echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>";
147
-    echo "<th align=left>" . number_format($db_rec[$i]->rows)     . "</th>";
143
+    echo "<th align=left>".$db_rec[$i]->name."</th>";
144
+    echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>";
145
+    echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>";
146
+    echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>";
147
+    echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>";
148 148
     echo "<th align=left></th>";
149 149
 	echo "</tr>";
150 150
     echo "</table>";
@@ -156,28 +156,28 @@  discard block
 block discarded – undo
156 156
 	$file_list = array();
157 157
     $file_sort = array();
158 158
 
159
-	$sort =  get_str("sort", true);
159
+	$sort = get_str("sort", true);
160 160
 	$r = get_str("r", true);
161 161
 
162 162
 	if (empty($sort)) $sort = "name";
163 163
 	// check for allowed keys
164
-	if ((strcmp($sort, "name")!=0) &&
165
-		(strcmp($sort, "data_size")!=0) &&
166
-		(strcmp($sort, "index_size")!=0) &&
167
-		(strcmp($sort, "total_size")!=0)  &&
168
-		(strcmp($sort, "rows")!=0) &&
169
-		(strcmp($sort, "size_per_row")!=0)
164
+	if ((strcmp($sort, "name") != 0) &&
165
+		(strcmp($sort, "data_size") != 0) &&
166
+		(strcmp($sort, "index_size") != 0) &&
167
+		(strcmp($sort, "total_size") != 0) &&
168
+		(strcmp($sort, "rows") != 0) &&
169
+		(strcmp($sort, "size_per_row") != 0)
170 170
     ) {
171 171
 		$sort = "name";
172 172
     }
173
-	if (empty($r)) $r=0;
173
+	if (empty($r)) $r = 0;
174 174
 
175
-	for ($i=0; $i < sizeof($db_rec)-1; $i++){
175
+	for ($i = 0; $i < sizeof($db_rec) - 1; $i++) {
176 176
 		$file_details["name"]         = $db_rec[$i]->name;
177 177
 		$file_details["data_size"]    = $db_rec[$i]->data_size;
178 178
 		$file_details["index_size"]   = $db_rec[$i]->index_size;
179 179
 		$file_details["total_size"]   = $db_rec[$i]->total_size;
180
-	    $file_details["rows"]         = $db_rec[$i]->rows;
180
+	    $file_details["rows"] = $db_rec[$i]->rows;
181 181
 		$file_details["size_per_row"] = $db_rec[$i]->size_per_row;
182 182
 
183 183
 		$file_list[$i] = $file_details;
@@ -197,35 +197,35 @@  discard block
 block discarded – undo
197 197
 	echo "</tr>";
198 198
 
199 199
 	echo "<tr>";
200
-	echo "<th><a href='dbinfo.php?sort=name&r=" . (!$r) . "'>Table </a></th>";
201
-	echo "<th><a href='dbinfo.php?sort=data_size&r=" . (!$r) . "'>Data Size</a></th>";
202
-	echo "<th><a href='dbinfo.php?sort=index_size&r=" . (!$r) . "'>Index Size</a></th>";
203
-	echo "<th><a href='dbinfo.php?sort=total_size&r=" . (!$r) . "'>Total Size</a></th>";
204
-	echo "<th><a href='dbinfo.php?sort=rows&r=" . (!$r) . "'>Total Rows</a></th>";
205
-	echo "<th><a href='dbinfo.php?sort=size_per_row&r=" . (!$r) . "'>Avg. Size per Row</a></th>";
200
+	echo "<th><a href='dbinfo.php?sort=name&r=".(!$r)."'>Table </a></th>";
201
+	echo "<th><a href='dbinfo.php?sort=data_size&r=".(!$r)."'>Data Size</a></th>";
202
+	echo "<th><a href='dbinfo.php?sort=index_size&r=".(!$r)."'>Index Size</a></th>";
203
+	echo "<th><a href='dbinfo.php?sort=total_size&r=".(!$r)."'>Total Size</a></th>";
204
+	echo "<th><a href='dbinfo.php?sort=rows&r=".(!$r)."'>Total Rows</a></th>";
205
+	echo "<th><a href='dbinfo.php?sort=size_per_row&r=".(!$r)."'>Avg. Size per Row</a></th>";
206 206
 	echo "</tr>";
207 207
 
208 208
     foreach ($file_sort as $key=>$value) {
209 209
 		$value = $file_list[$key];
210 210
 
211 211
 		echo "<tr>";
212
-		echo "<td align=left valign=top class=fieldname>" . $value["name"] . "</td>";
213
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["data_size"])  . "</td>";
214
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["index_size"]) . "</td>";
215
-		echo "<td align=left valign=top class=fieldname>" . size_format($value["total_size"]) . "</td>";
216
-        echo "<td align=left valign=top class=fieldname>" . number_format($value["rows"])     . "</td>";
217
-        echo "<td align=left valign=top class=fieldname>" . size_format($value["size_per_row"]) . "</td>";
212
+		echo "<td align=left valign=top class=fieldname>".$value["name"]."</td>";
213
+		echo "<td align=left valign=top class=fieldname>".size_format($value["data_size"])."</td>";
214
+		echo "<td align=left valign=top class=fieldname>".size_format($value["index_size"])."</td>";
215
+		echo "<td align=left valign=top class=fieldname>".size_format($value["total_size"])."</td>";
216
+        echo "<td align=left valign=top class=fieldname>".number_format($value["rows"])."</td>";
217
+        echo "<td align=left valign=top class=fieldname>".size_format($value["size_per_row"])."</td>";
218 218
 		echo "</tr>";
219 219
 	}
220 220
 
221 221
 	// Last record is a summary
222
-	$i = sizeof($db_rec)-1;
222
+	$i = sizeof($db_rec) - 1;
223 223
 	echo "<tr>";
224
-    echo "<th align=left>" . $db_rec[$i]->name . "</th>";
225
-    echo "<th align=left>" . size_format($db_rec[$i]->data_size)  . "</th>";
226
-    echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>";
227
-    echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>";
228
-    echo "<th align=left>" . number_format($db_rec[$i]->rows)     . "</th>";
224
+    echo "<th align=left>".$db_rec[$i]->name."</th>";
225
+    echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>";
226
+    echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>";
227
+    echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>";
228
+    echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>";
229 229
     echo "<th align=left></th>";
230 230
 	echo "</tr>";
231 231
 
Please login to merge, or discard this patch.
html/user/lammps.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 display_errors();
19 19
 
20
-$debug=0;
20
+$debug = 0;
21 21
 
22 22
 // test a LAMMPS job
23 23
 //
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
 // output: success flag, CPU time per step, est. disk usage per job
31 31
 //
32 32
 function terminate_job($p) {
33
-    $pstatus=proc_get_status($p);
34
-    $ppid=$pstatus['pid'];
35
-    $ret=`ps -o pid --no-heading --ppid $ppid`;
33
+    $pstatus = proc_get_status($p);
34
+    $ppid = $pstatus['pid'];
35
+    $ret = `ps -o pid --no-heading --ppid $ppid`;
36 36
     //echo "parent pid is $ppid\nterninate it\n";
37 37
      proc_terminate($p);
38 38
     // echo "child process is $ret\n";
39
-    $pids=preg_split('/\s+/',$ret);
40
-    foreach($pids as $pid){
41
-        if(is_numeric($pid)){
42
-            if($GLOBALS["debug"])echo "killing child process $pid\n";
43
-            posix_kill($pid,9);
39
+    $pids = preg_split('/\s+/', $ret);
40
+    foreach ($pids as $pid) {
41
+        if (is_numeric($pid)) {
42
+            if ($GLOBALS["debug"])echo "killing child process $pid\n";
43
+            posix_kill($pid, 9);
44 44
         }
45 45
     }
46 46
 }
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
     $descs = array();
52 52
     $pipes = array();
53 53
     $options = file("cmd_variables");
54
-    $options[0] = chop($options[0],"\n");
54
+    $options[0] = chop($options[0], "\n");
55 55
     $cmd = "../lmp_linux ".$options[0]."&>output";
56 56
     if ($GLOBALS["debug"]) echo $cmd."<br>";
57 57
     system("unzip pot_files >/dev/null");
58 58
     $stime = time();
59 59
     $p = proc_open("$cmd", $descs, $pipes);
60 60
     while (1) {
61
-        $ctime=time();
62
-        if($ctime-$stime >=2 and ! file_exists("log.1")){
63
-           if($GLOBALS["debug"]) echo "time out "."<br>";
61
+        $ctime = time();
62
+        if ($ctime - $stime >= 2 and !file_exists("log.1")) {
63
+           if ($GLOBALS["debug"]) echo "time out "."<br>";
64 64
            terminate_job($p);
65 65
            break;
66 66
         }
67 67
         if (file_exists("log.1")) {
68 68
             list($avg_cpu, $test_steps) = calc_step_cpu("log.1");
69 69
             if ($avg_cpu != 0) {
70
-                if($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>";
70
+                if ($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>";
71 71
                 terminate_job($p);
72 72
                 $test_result = 1;
73 73
                 break;
@@ -86,32 +86,32 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 function get_total_steps($cmd_file) {
89
-    $fd = fopen($cmd_file,"r");
89
+    $fd = fopen($cmd_file, "r");
90 90
     if (!$fd) {
91 91
         echo "can not open file $cmd_file\n";
92 92
         exit(-1);
93 93
     }
94 94
     $this_loopno = 1;
95 95
     $this_looprun = 1;
96
-    $total_steps=1;
96
+    $total_steps = 1;
97 97
     while (!feof($fd)) {
98
-        $line = fgets($fd,4096);
98
+        $line = fgets($fd, 4096);
99 99
         if (preg_match("/loopnumber\s+\d+/", $line, $matches)
100 100
             && preg_match("/\d+/", $matches[0], $no)
101 101
         ) {
102
-            $this_loopno=$no[0];
102
+            $this_loopno = $no[0];
103 103
         }
104 104
         if (preg_match("/looprun\s+\d+/", $line, $matches)
105 105
             and preg_match("/\d+/", $matches[0], $no)
106 106
         ) {
107
-            $this_looprun=$no[0];
108
-            if($this_loopno*$this_looprun>$total_steps)$total_steps=$this_loopno*$this_looprun;
107
+            $this_looprun = $no[0];
108
+            if ($this_loopno*$this_looprun > $total_steps)$total_steps = $this_loopno*$this_looprun;
109 109
         }
110 110
 
111 111
     }
112 112
     fclose($fd);
113 113
     //$total_steps = $loopno*$looprun;
114
-     if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>";
114
+     if ($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>";
115 115
     return $total_steps;
116 116
 }
117 117
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
     }
130 130
     $count = 0;
131 131
     while (!feof($fd)) {
132
-        $line = fgets($fd,4096);
133
-        if (preg_match('/^Step\s+CPU/',$line)) {
132
+        $line = fgets($fd, 4096);
133
+        if (preg_match('/^Step\s+CPU/', $line)) {
134 134
             //echo $line."\n";
135 135
             $start = 1;
136 136
             continue;
@@ -139,24 +139,24 @@  discard block
 block discarded – undo
139 139
         $arr = preg_split("/\s+/", $line);
140 140
         //print_r($arr);
141 141
 
142
-        if (count($arr) <=6 || !is_numeric($arr[1])) {
142
+        if (count($arr) <= 6 || !is_numeric($arr[1])) {
143 143
             continue;
144 144
         }
145 145
         $step = (int)$arr[1];
146 146
         $cpu = (float)$arr[2];
147 147
         //echo "step=".$step." cpu=".$cpu."\n";
148
-        if ($cpu==0) {
149
-           $count=0;
148
+        if ($cpu == 0) {
149
+           $count = 0;
150 150
            $start_step = $step;
151 151
         } else {
152
-            $count+=1;
153
-            if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>";
154
-           if($count >= 10) {
152
+            $count += 1;
153
+            if ($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>";
154
+           if ($count >= 10) {
155 155
                 $end_step = $step;
156
-                $steps = $end_step-$start_step;
156
+                $steps = $end_step - $start_step;
157 157
                 $avg_cpu = $cpu/$steps;
158 158
                 #$avg_cpu = $cpu/$count;
159
-                if ($GLOBALS["debug"]){
159
+                if ($GLOBALS["debug"]) {
160 160
                     echo "test steps is ".$steps."<br>";
161 161
                     echo "avg_cpu is ".$avg_cpu."<br>";
162 162
                 }
@@ -165,56 +165,56 @@  discard block
 block discarded – undo
165 165
             }
166 166
         }
167 167
     }
168
-    return array($avg_cpu,$test_steps);
168
+    return array($avg_cpu, $test_steps);
169 169
 }
170 170
 
171
-function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){
171
+function calc_est_size($lammps_script, $structure_file, $cmd_file, $test_steps) {
172 172
     $dump_types = 0;
173
-    $fd = fopen($lammps_script,"r");
174
-    if (!$fd){
173
+    $fd = fopen($lammps_script, "r");
174
+    if (!$fd) {
175 175
         echo "can not open file $lammps_script\n";
176 176
         exit(-1);
177 177
     }
178
-    while (!feof($fd)){
178
+    while (!feof($fd)) {
179 179
         $line = fgets($fd, 4096);
180 180
         //if (preg_match("/^\s*dump/", $line)
181 181
         //    and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER))
182 182
 
183
-        if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches))
183
+        if (preg_match("/^\s*dump\s+(\d)\s+/", $line, $matches))
184 184
         {
185
-             if($GLOBALS["debug"]){print "matches=";print_r($matches);}
185
+             if ($GLOBALS["debug"]) {print "matches="; print_r($matches); }
186 186
 
187
-            $dump_types=(int)$matches[1];
187
+            $dump_types = (int)$matches[1];
188 188
             break;
189 189
         }
190 190
     }
191 191
     fclose($fd);
192
-    if($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>";
192
+    if ($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>";
193 193
 
194 194
     $structure_file_size = filesize($structure_file);
195
-    $fd = fopen($cmd_file,"r");
196
-    if (!$fd){
195
+    $fd = fopen($cmd_file, "r");
196
+    if (!$fd) {
197 197
         echo "can not open file $cmd_file\n";
198 198
         exit(-1);
199 199
     }
200
-     if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>";
201
-
202
-    $loopno=1;
203
-    $looprun=1;
204
-    while (!feof($fd)){
205
-        $line = fgets($fd,4096);
206
-        if(preg_match("/loopnumber\s+\d+/", $line, $matches)){
207
-            if(preg_match("/\d+/", $matches[0], $no)){
200
+     if ($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>";
201
+
202
+    $loopno = 1;
203
+    $looprun = 1;
204
+    while (!feof($fd)) {
205
+        $line = fgets($fd, 4096);
206
+        if (preg_match("/loopnumber\s+\d+/", $line, $matches)) {
207
+            if (preg_match("/\d+/", $matches[0], $no)) {
208 208
                 //$loopno=$no[0];
209
-                if($no[0]>$loopno)$loopno=$no[0];
209
+                if ($no[0] > $loopno)$loopno = $no[0];
210 210
             }
211 211
         }
212 212
         if (preg_match("/looprun\s+\d+/", $line, $matches) and preg_match("/\d+/", $matches[0], $no)) {
213
-            if($no[0]>$looprun)$looprun=$no[0];
213
+            if ($no[0] > $looprun)$looprun = $no[0];
214 214
         }
215 215
     }
216 216
     fclose($fd);
217
-    if($GLOBALS["debug"]){
217
+    if ($GLOBALS["debug"]) {
218 218
          print "max loopno(number of loops to run)=".$loopno."<br>";
219 219
          print "max looprun(steps for each loop)=".$looprun."<br>";
220 220
     }
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
     $dump_files = glob("dump1*");
226 226
     $test_dump_file = $dump_files[0];
227 227
     $test_dump_size = filesize($test_dump_file);
228
-    $dump_size1 = $test_dump_size+0.5*$test_dump_size*ceil(($looprun-$test_steps)/$test_steps);
228
+    $dump_size1 = $test_dump_size + 0.5*$test_dump_size*ceil(($looprun - $test_steps)/$test_steps);
229 229
     $dump_size = $loopno*$dump_size1*$dump_types;
230 230
     $app_fixed_size = 5e7;
231
-    $est_size = $log_size+$dump_size+$app_fixed_size;
231
+    $est_size = $log_size + $dump_size + $app_fixed_size;
232 232
 
233
-    if($GLOBALS["debug"]){
233
+    if ($GLOBALS["debug"]) {
234 234
         print "test_steps=".$test_steps."<br>";
235 235
         print "test_log_size=".$test_log_size."<br>";
236 236
         print "log_size1=".$log_size1."<br>";
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     if ($njobs < $nhosts) {
322 322
         return $flops_per_job/$median_flops;
323 323
     } else {
324
-        $k = (int)(($njobs+$nhosts-1)/$nhosts);
324
+        $k = (int)(($njobs + $nhosts - 1)/$nhosts);
325 325
         return $k*$flops_per_job/$median_flops;
326 326
     }
327 327
 }
@@ -361,27 +361,27 @@  discard block
 block discarded – undo
361 361
     if ($GLOBALS["debug"]) {
362 362
         print "est_cpu_time is ".$est_cpu_time."<br>";
363 363
     }
364
-    if ($error==0) {
365
-        $err_msgs=file("output");
366
-        $err="Your test job <strong>failed</strong>
364
+    if ($error == 0) {
365
+        $err_msgs = file("output");
366
+        $err = "Your test job <strong>failed</strong>
367 367
             <br>Please refer to the following Error Message:<br><p>
368 368
         ";
369
-        foreach($err_msgs as $line){
370
-             $err=$err.$line."<br>";
369
+        foreach ($err_msgs as $line) {
370
+             $err = $err.$line."<br>";
371 371
         }
372
-        $err=$err." <p>
372
+        $err = $err." <p>
373 373
             <a href=sandbox.php><strong> File_Sandbox </strong></a>
374 374
         ";
375 375
         error_page($err);
376 376
     }
377 377
 
378 378
     system("rm *");
379
-    $info->rsc_fpops_est = $est_cpu_time * 1.5e9;
380
-    $info->rsc_fpops_bound = $info->rsc_fpops_est * 20;
379
+    $info->rsc_fpops_est = $est_cpu_time*1.5e9;
380
+    $info->rsc_fpops_bound = $info->rsc_fpops_est*20;
381 381
 
382
-    if ($disk==0){
383
-        $info->rsc_disk_bound=1000000;
384
-    } else{
382
+    if ($disk == 0) {
383
+        $info->rsc_disk_bound = 1000000;
384
+    } else {
385 385
         $info->rsc_disk_bound = $disk;
386 386
     }
387 387
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     //
393 393
     $njobs = count(file($cmdline_file_path));
394 394
     $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est);
395
-     if($GLOBALS["debug"])echo "secs_est is $secs_est\n";
395
+     if ($GLOBALS["debug"])echo "secs_est is $secs_est\n";
396 396
     //assume the server's flops is 1.5G and the average client's flops is 1G
397 397
     $hrs_est = number_format($secs_est*1.5/60, 2);
398 398
     //$hrs_est = number_format($secs_est, 2);
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 }
417 417
 
418 418
 function submit_job($app, $batch_id, $info, $cmdline, $i) {
419
-    $client_disk=$info->rsc_disk_bound*2;
420
-    if($client_disk<500000000) $client_disk=500000000;
419
+    $client_disk = $info->rsc_disk_bound*2;
420
+    if ($client_disk < 500000000) $client_disk = 500000000;
421 421
     $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $info->rsc_fpops_est --rsc_fpops_bound $info->rsc_fpops_bound --rsc_disk_bound $client_disk";
422 422
     if ($cmdline) {
423 423
         $cmd .= " --command_line \"$cmdline\"";
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
     $x = file_get_contents("$tmpfile");
442 442
     $info = unserialize($x);
443 443
 
444
-    $njobs=0;
444
+    $njobs = 0;
445 445
     $cmdlines = file($info->cmdline_file_path);
446
-    foreach ($cmdlines as $cmdline){
446
+    foreach ($cmdlines as $cmdline) {
447 447
         if (preg_match("/^\s*-var/", $cmdline)) {
448 448
             $njobs++;
449 449
         }
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 
460 460
     $i = 0;
461 461
     foreach ($cmdlines as $cmdline) {
462
-        if (preg_match("/^\s*-var/", $cmdline)){
462
+        if (preg_match("/^\s*-var/", $cmdline)) {
463 463
             submit_job($app, $batch_id, $info, $cmdline, $i);
464 464
             $i++;
465 465
         }
Please login to merge, or discard this patch.
html/user/tree_threader.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 display_errors();
19 19
 
20 20
 $app_name = "treeThreader";
21
-$log = fopen("/tmp/tt_job.log","a+");
21
+$log = fopen("/tmp/tt_job.log", "a+");
22 22
 
23 23
 function error($s) {
24 24
     echo "<error>\n<message>$s</message>\n</error>\n";
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 }
27 27
 
28 28
 function handle_submit($r, $user, $app) {
29
-    global $app_name,$log;
29
+    global $app_name, $log;
30 30
 
31
-    $timestamp = date("Y-m-d H:i",time());
31
+    $timestamp = date("Y-m-d H:i", time());
32 32
 	// read the list of template filenames
33 33
 	//
34 34
 	$files = file("../../tree_threader_template_files");
35 35
 	if ($files === false) {
36
-        fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n");
36
+        fwrite($log, "$timestamp\ttemplate file tree_threader_template_files\n");
37 37
         error("no templates file");
38 38
 
39 39
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 //
91 91
 function handle_get_output($r, $batch) {
92 92
     global $log;
93
-    $timestamp = date("Y-m-d H:i",time());
93
+    $timestamp = date("Y-m-d H:i", time());
94 94
 	$wus = BoincWorkUnit::enum("batch=$batch->id");
95 95
 	$outdir = "/tmp/treeThreader_result_".$batch->id;
96 96
     @mkdir($outdir);
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 		error("can't zip output files");
130 130
 	}
131 131
 	$fname = "treeThreader_result_".$batch->id.".zip";
132
-    $treeThreader_dir="treeThreaderResult";
133
-    if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir");
132
+    $treeThreader_dir = "treeThreaderResult";
133
+    if (!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir");
134 134
 	@symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname");
135 135
     system("rm -fr $outdir");
136 136
     $config = simplexml_load_string(file_get_contents("../../config.xml"));
137 137
     $download_url = trim((string)$config->config->download_url);
138 138
 	echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n";
139
-    $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n";
139
+    $log_msg = "$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n";
140 140
     fwrite($log, $log_msg);
141 141
 }
142 142
 
Please login to merge, or discard this patch.
html/inc/prefs_project.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 if ($app_types->cpu) {
72
-    $project_pref_descs[] = new PREF_BOOL (
72
+    $project_pref_descs[] = new PREF_BOOL(
73 73
         tra("Use CPU"),
74 74
         "Request CPU-only tasks from this project.",
75 75
         "no_cpu",
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     );
79 79
 }
80 80
 if ($app_types->ati) {
81
-    $project_pref_descs[] = new PREF_BOOL (
81
+    $project_pref_descs[] = new PREF_BOOL(
82 82
         tra("Use AMD GPU"),
83 83
         "Request AMD GPU tasks from this project.",
84 84
         "no_ati",
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     );
88 88
 }
89 89
 if ($app_types->cuda) {
90
-    $project_pref_descs[] = new PREF_BOOL (
90
+    $project_pref_descs[] = new PREF_BOOL(
91 91
         tra("Use NVIDIA GPU"),
92 92
         "Request NVIDIA GPU tasks from this project.",
93 93
         "no_cuda",
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     );
97 97
 }
98 98
 if ($app_types->intel_gpu) {
99
-    $project_pref_descs[] = new PREF_BOOL (
99
+    $project_pref_descs[] = new PREF_BOOL(
100 100
         tra("Use Intel GPU"),
101 101
         "Request Intel GPU tasks from this project.",
102 102
         "no_intel_gpu",
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     );
106 106
 }
107 107
 if ($app_types->apple_gpu) {
108
-    $project_pref_descs[] = new PREF_BOOL (
108
+    $project_pref_descs[] = new PREF_BOOL(
109 109
         tra("Use Apple GPU"),
110 110
         "Request Apple GPU tasks from this project.",
111 111
         "no_apple_gpu",
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     $x = "";
131 131
 }
132 132
 
133
-$privacy_pref_descs = array (
133
+$privacy_pref_descs = array(
134 134
     new PREF_BOOL(
135 135
         tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x,
136 136
         "",
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     global $in_project_specific;
179 179
     global $venue_name;
180 180
 
181
-    switch($name) {
181
+    switch ($name) {
182 182
     case "venue":
183 183
         $venue_name = $attrs["name"];
184 184
         $top_parse_result = $parse_result;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         break;
191 191
     default:
192 192
         if ($in_project_specific) {
193
-            $text= $text."<$name>";
193
+            $text = $text."<$name>";
194 194
         } else {
195 195
             $text = "";
196 196
         }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
     global $venue_name;
206 206
     global $project_pref_descs;
207 207
 
208
-    foreach($project_pref_descs as $p) {
208
+    foreach ($project_pref_descs as $p) {
209 209
         if ($p->xml_parse($parse_result, $name, $text)) {
210 210
             return;
211 211
         }
212 212
     }
213
-    switch($name) {
213
+    switch ($name) {
214 214
     case "venue":
215 215
         $top_parse_result->$venue_name = $parse_result;
216 216
         $parse_result = $top_parse_result;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     return $parse_result;
255 255
 }
256 256
 
257
-function prefs_show_project($prefs, $columns=false) {
257
+function prefs_show_project($prefs, $columns = false) {
258 258
     global $project_pref_descs;
259 259
     if ($columns) {
260 260
         foreach ($project_pref_descs as $p) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-function prefs_show_project_specific($prefs, $columns=false) {
296
+function prefs_show_project_specific($prefs, $columns = false) {
297 297
     if ($columns) {
298 298
         $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific);
299 299
         $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : "";
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
     project_specific_prefs_show($project_specific_prefs, $columns);
306 306
 }
307 307
 
308
-function print_prefs_display_project($user, $columns=false) {
308
+function print_prefs_display_project($user, $columns = false) {
309 309
     $project_prefs = prefs_parse_project($user->project_prefs);
310 310
 
311
-    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
311
+    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>";
312 312
     if ($columns) {
313 313
         start_table();
314 314
         row_heading(tra("Combined preferences").$switch_link);
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
     }
360 360
 }
361 361
 
362
-function prefs_form_project($prefs, $error=false) {
362
+function prefs_form_project($prefs, $error = false) {
363 363
     global $project_pref_descs;
364 364
     foreach ($project_pref_descs as $p) {
365 365
         $p->show_form_row($prefs, $error);
366 366
     }
367 367
 }
368 368
 
369
-function prefs_form_project_specific($prefs_xml, $error=false) {
369
+function prefs_form_project_specific($prefs_xml, $error = false) {
370 370
     $prefs = project_specific_prefs_parse($prefs_xml);
371 371
     project_specific_prefs_edit($prefs, $error);
372 372
 }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 // given a prefs structure, return the corresponding XML string
416 416
 //
417
-function project_prefs_make_xml($prefs, $primary=true) {
417
+function project_prefs_make_xml($prefs, $primary = true) {
418 418
     global $project_pref_descs;
419 419
     $xml = "";
420 420
     if ($primary) {
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 //
450 450
 function project_prefs_update(&$user, $prefs) {
451 451
     $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs));
452
-    $send_email = $user->send_email?1:0;
453
-    $show_hosts = $user->show_hosts?1:0;
452
+    $send_email = $user->send_email ? 1 : 0;
453
+    $show_hosts = $user->show_hosts ? 1 : 0;
454 454
     $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts");
455 455
     if (!$retval) {
456 456
         return 1;
Please login to merge, or discard this patch.
html/inc/common_defs.inc 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -27,74 +27,74 @@
 block discarded – undo
27 27
 define('BATCH_STATE_RETIRED', 4);
28 28
 
29 29
 define('ANON_PLATFORM_UNKNOWN', -1);
30
-define('ANON_PLATFORM_CPU',     -2);
31
-define('ANON_PLATFORM_NVIDIA',  -3);
32
-define('ANON_PLATFORM_ATI',     -4);
33
-define('ANON_PLATFORM_INTEL_GPU',   -5);
34
-define('ANON_PLATFORM_APPLE_GPU',   -6);
30
+define('ANON_PLATFORM_CPU', -2);
31
+define('ANON_PLATFORM_NVIDIA', -3);
32
+define('ANON_PLATFORM_ATI', -4);
33
+define('ANON_PLATFORM_INTEL_GPU', -5);
34
+define('ANON_PLATFORM_APPLE_GPU', -6);
35 35
 
36
-define('RESULT_SERVER_STATE_INACTIVE',       1);
37
-define('RESULT_SERVER_STATE_UNSENT',         2);
38
-define('RESULT_SERVER_STATE_IN_PROGRESS',    4);
39
-define('RESULT_SERVER_STATE_OVER',           5);
36
+define('RESULT_SERVER_STATE_INACTIVE', 1);
37
+define('RESULT_SERVER_STATE_UNSENT', 2);
38
+define('RESULT_SERVER_STATE_IN_PROGRESS', 4);
39
+define('RESULT_SERVER_STATE_OVER', 5);
40 40
 
41
-define('RESULT_OUTCOME_INIT',             0);
42
-define('RESULT_OUTCOME_SUCCESS',          1);
43
-define('RESULT_OUTCOME_COULDNT_SEND',     2);
44
-define('RESULT_OUTCOME_CLIENT_ERROR',     3);
45
-define('RESULT_OUTCOME_NO_REPLY',         4);
46
-define('RESULT_OUTCOME_DIDNT_NEED',       5);
47
-define('RESULT_OUTCOME_VALIDATE_ERROR',   6);
48
-define('RESULT_OUTCOME_CLIENT_DETACHED',  7);
41
+define('RESULT_OUTCOME_INIT', 0);
42
+define('RESULT_OUTCOME_SUCCESS', 1);
43
+define('RESULT_OUTCOME_COULDNT_SEND', 2);
44
+define('RESULT_OUTCOME_CLIENT_ERROR', 3);
45
+define('RESULT_OUTCOME_NO_REPLY', 4);
46
+define('RESULT_OUTCOME_DIDNT_NEED', 5);
47
+define('RESULT_OUTCOME_VALIDATE_ERROR', 6);
48
+define('RESULT_OUTCOME_CLIENT_DETACHED', 7);
49 49
 
50
-define('VALIDATE_STATE_INIT',        0);
51
-define('VALIDATE_STATE_VALID',       1);
52
-define('VALIDATE_STATE_INVALID',     2);
53
-define('VALIDATE_STATE_NO_CHECK',    3);
54
-define('VALIDATE_STATE_INCONCLUSIVE',4);
55
-define('VALIDATE_STATE_TOO_LATE',    5);
50
+define('VALIDATE_STATE_INIT', 0);
51
+define('VALIDATE_STATE_VALID', 1);
52
+define('VALIDATE_STATE_INVALID', 2);
53
+define('VALIDATE_STATE_NO_CHECK', 3);
54
+define('VALIDATE_STATE_INCONCLUSIVE', 4);
55
+define('VALIDATE_STATE_TOO_LATE', 5);
56 56
 
57
-define('WU_ERROR_COULDNT_SEND_RESULT',           1);
58
-define('WU_ERROR_TOO_MANY_ERROR_RESULTS',        2);
59
-define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS',      4);
60
-define('WU_ERROR_TOO_MANY_TOTAL_RESULTS',        8);
61
-define('WU_ERROR_CANCELLED',                     16);
62
-define('WU_ERROR_NO_CANONICAL_RESULT',           32);
57
+define('WU_ERROR_COULDNT_SEND_RESULT', 1);
58
+define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2);
59
+define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4);
60
+define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8);
61
+define('WU_ERROR_CANCELLED', 16);
62
+define('WU_ERROR_NO_CANONICAL_RESULT', 32);
63 63
 
64
-define('FILE_DELETE_INIT',       0);
65
-define('FILE_DELETE_READY',      1);
66
-define('FILE_DELETE_DONE',       2);
67
-define('FILE_DELETE_ERROR',      3);
64
+define('FILE_DELETE_INIT', 0);
65
+define('FILE_DELETE_READY', 1);
66
+define('FILE_DELETE_DONE', 2);
67
+define('FILE_DELETE_ERROR', 3);
68 68
 
69
-define('ASSIMILATE_INIT',       0);
70
-define('ASSIMILATE_READY',      1);
71
-define('ASSIMILATE_DONE',       2);
69
+define('ASSIMILATE_INIT', 0);
70
+define('ASSIMILATE_READY', 1);
71
+define('ASSIMILATE_DONE', 2);
72 72
 
73 73
 // from lib/common_defs.h
74 74
 //
75
-define('RESULT_NEW',                 0);
76
-define('RESULT_FILES_DOWNLOADING',   1);
77
-define('RESULT_FILES_DOWNLOADED',    2);
78
-define('RESULT_COMPUTE_ERROR',       3);
79
-define('RESULT_FILES_UPLOADING',     4);
80
-define('RESULT_FILES_UPLOADED',      5);
81
-define('RESULT_ABORTED',             6);
82
-define('RESULT_UPLOAD_FAILED',       7);
75
+define('RESULT_NEW', 0);
76
+define('RESULT_FILES_DOWNLOADING', 1);
77
+define('RESULT_FILES_DOWNLOADED', 2);
78
+define('RESULT_COMPUTE_ERROR', 3);
79
+define('RESULT_FILES_UPLOADING', 4);
80
+define('RESULT_FILES_UPLOADED', 5);
81
+define('RESULT_ABORTED', 6);
82
+define('RESULT_UPLOAD_FAILED', 7);
83 83
 
84 84
 // from lib/error_numbers.h
85 85
 // returned by some web RPCs
86 86
 //
87
-define('ERR_XML_PARSE',               -112);
88
-define('ERR_DB_NOT_FOUND',            -136);
89
-define('ERR_DB_NOT_UNIQUE',           -137);
90
-define('ERR_DB_CANT_CONNECT',         -138);
91
-define('ERR_PROJECT_DOWN',            -183);
92
-define('ERR_BAD_USER_NAME',           -188);
93
-define('ERR_NO_OPTION',               -191);
94
-define('ERR_BAD_EMAIL_ADDR',          -205);
95
-define('ERR_BAD_PASSWD',              -206);
96
-define('ERR_ACCT_CREATION_DISABLED',  -208);
97
-define('ERR_ATTACH_FAIL_INIT',        -209);
98
-define('ERR_ATTACH_FAIL_DOWNLOAD',    -210);
99
-define('ERR_ACCT_REQUIRE_CONSENT',    -242);
87
+define('ERR_XML_PARSE', -112);
88
+define('ERR_DB_NOT_FOUND', -136);
89
+define('ERR_DB_NOT_UNIQUE', -137);
90
+define('ERR_DB_CANT_CONNECT', -138);
91
+define('ERR_PROJECT_DOWN', -183);
92
+define('ERR_BAD_USER_NAME', -188);
93
+define('ERR_NO_OPTION', -191);
94
+define('ERR_BAD_EMAIL_ADDR', -205);
95
+define('ERR_BAD_PASSWD', -206);
96
+define('ERR_ACCT_CREATION_DISABLED', -208);
97
+define('ERR_ATTACH_FAIL_INIT', -209);
98
+define('ERR_ATTACH_FAIL_DOWNLOAD', -210);
99
+define('ERR_ACCT_REQUIRE_CONSENT', -242);
100 100
 ?>
Please login to merge, or discard this patch.
html/user/gpu_ratios.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,26 +34,26 @@
 block discarded – undo
34 34
 $intel_gpu_credit_sum = 0;
35 35
 $apple_gpu_scale_sum = 0;
36 36
 $apple_gpu_credit_sum = 0;
37
-$total_credit_sum= 0;
37
+$total_credit_sum = 0;
38 38
 
39 39
 $apps = BoincApp::enum("deprecated=0");
40 40
 foreach ($apps as $app) {
41 41
     $avs = BoincAppVersion::enum("appid=$app->id and deprecated=0");
42 42
     foreach ($avs as $av) {
43 43
         if (strstr($av->plan_class, "ati")) {
44
-            $ati_scale_sum += $av->pfc_scale * $av->expavg_credit;
44
+            $ati_scale_sum += $av->pfc_scale*$av->expavg_credit;
45 45
             $ati_credit_sum += $av->expavg_credit;
46 46
         } else if (strstr($av->plan_class, "nvidia") || strstr($av->plan_class, "cuda")) {
47
-            $nvidia_scale_sum += $av->pfc_scale * $av->expavg_credit;
47
+            $nvidia_scale_sum += $av->pfc_scale*$av->expavg_credit;
48 48
             $nvidia_credit_sum += $av->expavg_credit;
49 49
         } else if (strstr($av->plan_class, "intel_gpu")) {
50
-            $intel_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
50
+            $intel_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
51 51
             $intel_gpu_credit_sum += $av->expavg_credit;
52 52
         } else if (strstr($av->plan_class, "apple_gpu")) {
53
-            $apple_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
53
+            $apple_gpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
54 54
             $apple_gpu_credit_sum += $av->expavg_credit;
55 55
         } else {
56
-            $cpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
56
+            $cpu_scale_sum += $av->pfc_scale*$av->expavg_credit;
57 57
             $cpu_credit_sum += $av->expavg_credit;
58 58
         }
59 59
         $total_credit_sum += $av->expavg_credit;
Please login to merge, or discard this patch.
html/inc/team.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
41 41
     row2(
42 42
         tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
43
-        '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
43
+        '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">');
44 44
     row2_init(tra('Country'));
45 45
     echo '<select class="form-control" name="country"><option value="" selected>---</option>';
46 46
     $country = $params->country;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     echo country_select_options($country);
49 49
     echo "</select></td></tr>\n";
50 50
     row2(tra('Type of team'), team_type_select($params->type, true));
51
-    $checked = $params->active?"checked":"";
51
+    $checked = $params->active ? "checked" : "";
52 52
     row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>");
53 53
     row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">");
54 54
     end_table();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     row2("Created", date_str($team->create_time));
97 97
     if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
         $founder = $team->founder;
99
-        row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)");
99
+        row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)");
100 100
     }
101 101
     if (strlen($team->url)) {;
102 102
         if (strstr($team->url, "http://")) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
     row1(tra('Members'));
171 171
     row2(tra('Founder'),
172
-        $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---"
172
+        $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---"
173 173
     );
174 174
     if (count($team->admins)) {
175 175
         $first = true;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     foreach ($deltas as $delta) {
357 357
         $u = BoincUser::lookup_id($delta->userid);
358 358
         if ($u->teamid == $teamid) {
359
-            $new_members[] = $u->id;  // they might have later quit
359
+            $new_members[] = $u->id; // they might have later quit
360 360
         }
361 361
     }
362 362
     return array_unique($new_members);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
     if (!$user->teamid) return;
440 440
     $user->update("teamid=0");
441 441
     $team = BoincTeam::lookup_id($user->teamid);
442
-    if ($team && $team->ping_user==$user->id) {
442
+    if ($team && $team->ping_user == $user->id) {
443 443
         $team->update("ping_user=-ping_user");
444 444
     }
445 445
     BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id");
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
     start_table();
479 479
     row2(tra('Team name, text version').'
480 480
         <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>',
481
-        '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">'
481
+        '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">'
482 482
     );
483 483
     row2(tra('Team name, HTML version').'
484 484
         <br><p class=\"text-muted\">
485 485
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
486 486
         '.tra('If you don\'t know HTML, leave this box blank.').'</p>',
487
-        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">'
487
+        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">'
488 488
     );
489 489
     row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').')
490 490
         '.tra('This URL will be linked to from the team\'s page on this site.'),
491
-        '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">'
491
+        '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">'
492 492
     );
493 493
     row2(tra('Description of team').':
494 494
         <br><p class=\"text-muted\">
495 495
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
496 496
         </p>',
497
-        '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>'
497
+        '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>'
498 498
     );
499 499
 
500
-    row2(tra('Type of team').':', team_type_select($team?$team->type:null));
500
+    row2(tra('Type of team').':', team_type_select($team ? $team->type : null));
501 501
 
502 502
     row2_init(tra('Country'));
503 503
     echo '<select class="form-control" name="country">';
504
-    echo country_select_options($team?$team->country:null);
504
+    echo country_select_options($team ? $team->country : null);
505 505
     echo "</select></td></tr>\n";
506 506
 
507
-    $x = (!$team || $team->joinable)?"checked":"";
507
+    $x = (!$team || $team->joinable) ? "checked" : "";
508 508
     row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
509 509
     // Check if we're using reCaptcha to prevent spam accounts
510 510
     //
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
 //
569 569
 function new_transfer_request_ok($team, $now) {
570 570
     if ($team->ping_user <= 0) {
571
-        if ($team->ping_time < $now - 60 * 86400) {
571
+        if ($team->ping_time < $now - 60*86400) {
572 572
             return true;
573 573
         }
574 574
         return false;
575 575
     }
576
-    if ($team->ping_time < $now - 90 * 86400) {
576
+    if ($team->ping_time < $now - 90*86400) {
577 577
         return true;
578 578
     }
579 579
     return false;
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     if (!is_valid_country($country)) {
609 609
         $country = tra('None');
610 610
     }
611
-    $country = BoincDb::escape_string($country);  // for Cote d'Ivoire
611
+    $country = BoincDb::escape_string($country); // for Cote d'Ivoire
612 612
 
613 613
     $clause = sprintf(
614 614
         "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
@@ -631,6 +631,6 @@  discard block
 block discarded – undo
631 631
     }
632 632
 }
633 633
 
634
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
634
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
635 635
 
636 636
 ?>
Please login to merge, or discard this patch.
html/user/edit_forum_preferences_action.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 }
30 30
 BoincForumPrefs::lookup($user);
31 31
 
32
-if (post_str("action", true)=="reset_confirm"){
32
+if (post_str("action", true) == "reset_confirm") {
33 33
     page_head(tra("Confirm reset"));
34 34
     echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")."
35 35
         <p>
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 // If the user has requested a reset of preferences;
46 46
 // preserve a few fields.
47 47
 //
48
-if (post_str("action", true)=="reset"){
48
+if (post_str("action", true) == "reset") {
49 49
     $posts = $user->prefs->posts;
50 50
     $last_post = $user->prefs->last_post;
51 51
     $rated_posts = $user->prefs->rated_posts;
@@ -67,30 +67,30 @@  discard block
 block discarded – undo
67 67
 if (!DISABLE_FORUMS) {
68 68
 
69 69
 $avatar_type = post_int("avatar_select");
70
-$newfile=IMAGE_PATH.$user->id."_avatar.jpg";
70
+$newfile = IMAGE_PATH.$user->id."_avatar.jpg";
71 71
 
72 72
 // Update the user avatar
73
-if ($avatar_type<0 or $avatar_type>3) $avatar_type=0;
74
-if ($avatar_type==0){
75
-    if (file_exists($newfile)){
73
+if ($avatar_type < 0 or $avatar_type > 3) $avatar_type = 0;
74
+if ($avatar_type == 0) {
75
+    if (file_exists($newfile)) {
76 76
         // Delete the file on the server if the user
77 77
         // decides not to use an avatar
78 78
         //
79 79
         unlink($newfile);
80 80
     }
81
-    $avatar_url="";
81
+    $avatar_url = "";
82 82
 } elseif ($avatar_type == 1) {
83 83
     $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&amp;d=identicon";
84
-} elseif ($avatar_type==2){
85
-    if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) {
86
-        if ($_FILES['picture']['tmp_name']!="") {
84
+} elseif ($avatar_type == 2) {
85
+    if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name'] != "")) {
86
+        if ($_FILES['picture']['tmp_name'] != "") {
87 87
             $file = $_FILES['picture']['tmp_name'];
88 88
         } else {
89 89
             // Remote image. Download and store locally
90 90
             $file = post_str("avatar_url");
91 91
         }
92 92
         $size = getImageSize($file);
93
-        if ($size[2]!=2 and $size[2]!=3){
93
+        if ($size[2] != 2 and $size[2] != 3) {
94 94
             //Not the right kind of file
95 95
             error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported."));
96 96
         }
@@ -99,30 +99,30 @@  discard block
 block discarded – undo
99 99
         $image2 = intelligently_scale_image($file, 100, 100);
100 100
         ImageJPEG($image2, $newfile);
101 101
     }
102
-    if (file_exists($newfile)){
103
-        $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile;
102
+    if (file_exists($newfile)) {
103
+        $avatar_url = IMAGE_URL.$user->id."_avatar.jpg"; //$newfile;
104 104
     } else {
105 105
         //User didn't upload a compatible file or it went lost on the server
106
-        $avatar_url="";
106
+        $avatar_url = "";
107 107
     }
108 108
 }
109 109
 
110
-$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"]!="")?1:0;
111
-$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"]!="")?1:0;
112
-$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"]!="")?1:0;
113
-$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"]!="")?1:0;
114
-$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"]!="")?1:0;
115
-$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"]!="")?1:0;
116
-$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"]!="")?1:0;
117
-$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"]!="")?0:1;
110
+$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"] != "") ? 1 : 0;
111
+$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"] != "") ? 1 : 0;
112
+$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"] != "") ? 1 : 0;
113
+$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"] != "") ? 1 : 0;
114
+$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"] != "") ? 1 : 0;
115
+$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"] != "") ? 1 : 0;
116
+$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"] != "") ? 1 : 0;
117
+$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"] != "") ? 0 : 1;
118 118
 $signature = post_str("signature", true);
119
-if (strlen($signature)>250) {
119
+if (strlen($signature) > 250) {
120 120
     error_page(tra("Your signature was too long, please keep it less than 250 characters."));
121 121
 }
122 122
 $forum_sort = post_int("forum_sort");
123 123
 $thread_sort = post_int("thread_sort");
124 124
 $display_wrap_postcount = post_int("forum_display_wrap_postcount");
125
-if ($display_wrap_postcount<1) $display_wrap_postcount=1;
125
+if ($display_wrap_postcount < 1) $display_wrap_postcount = 1;
126 126
 
127 127
 $signature = BoincDb::escape_string($signature);
128 128
 
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
     }
142 142
 } else {
143 143
     // todo: clean up the following
144
-    $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!="");
145
-    if ($add_user_to_filter){
144
+    $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"] != "");
145
+    if ($add_user_to_filter) {
146 146
         $user_to_add = trim($_POST["forum_filter_user"]);
147
-        if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){
147
+        if ($user_to_add != "" and $user_to_add == strval(intval($user_to_add))) {
148 148
             $other_user = BoincUser::lookup_id($user_to_add);
149 149
             if (!$other_user) {
150 150
                 echo tra("No such user:")." ".$user_to_add;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 //
160 160
 $ignored_users = get_ignored_list($user);
161 161
 // todo: use foreach
162
-for ($i=0;$i<sizeof($ignored_users);$i++){
162
+for ($i = 0; $i < sizeof($ignored_users); $i++) {
163 163
     $remove = "remove".trim($ignored_users[$i]);
164
-    if (isset($_POST[$remove]) && $_POST[$remove]!=""){
164
+    if (isset($_POST[$remove]) && $_POST[$remove] != "") {
165 165
         $other_user = BoincUser::lookup_id($ignored_users[$i]);
166 166
         if (!$other_user) {
167 167
             echo tra("No such user:")." ".$ignored_users[$j];
Please login to merge, or discard this patch.
html/user/user_search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     $y = [];
27 27
     $x[] = sprintf('%s%s',
28 28
         user_links($user, BADGE_HEIGHT_MEDIUM),
29
-        UNIQUE_USER_NAME?'':" (ID $user->id)"
29
+        UNIQUE_USER_NAME ? '' : " (ID $user->id)"
30 30
     );
31 31
     $y[] = null;
32 32
     if (!DISABLE_TEAMS) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     $where = "true";
105 105
     $search_string = get_str('search_string');
106 106
     if (strlen($search_string)) {
107
-        if (strlen($search_string)<3) {
107
+        if (strlen($search_string) < 3) {
108 108
             error_page(tra("search string must be at least 3 characters"));
109 109
         }
110 110
         $s = BoincDb::escape_string($search_string);
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
     $search_type = get_str('search_type', true);
137 137
     $order_clause = "id desc";
138 138
     if ($search_type == 'rac') {
139
-        $order_clause ="expavg_credit desc";
139
+        $order_clause = "expavg_credit desc";
140 140
     } else if ($search_type == 'total') {
141
-        $order_clause ="total_credit desc";
141
+        $order_clause = "total_credit desc";
142 142
     }
143 143
 
144 144
     $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
145 145
     $users = BoincUser::enum_fields($fields, $where, "order by $order_clause limit 100");
146 146
     page_head(tra("User search results"));
147
-    $n=0;
147
+    $n = 0;
148 148
     foreach ($users as $user) {
149
-        if ($n==0) {
149
+        if ($n == 0) {
150 150
             start_table('table-striped');
151 151
             $x = ['Name'];
152 152
             $y = [null];
@@ -183,5 +183,5 @@  discard block
 block discarded – undo
183 183
     user_search_form();
184 184
 }
185 185
 
186
-$cvs_version_tracker[]="\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $";  //Generated automatically - do not edit
186
+$cvs_version_tracker[] = "\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit
187 187
 ?>
Please login to merge, or discard this patch.