Passed
Push — dpa_warnings3 ( 480a88...07faf2 )
by David
08:55
created
html/user/download_software.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 //
65 65
 function get_platform($user_agent) {
66 66
     if (strstr($user_agent, 'Windows')) {
67
-        if (strstr($user_agent, 'Win64')||strstr($user_agent, 'WOW64')) {
67
+        if (strstr($user_agent, 'Win64') || strstr($user_agent, 'WOW64')) {
68 68
             return 'windows_x86_64';
69 69
         } else {
70 70
             return 'windows_intelx86';
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $token,
139 139
         $user->id,
140 140
         (string)$v->filename,
141
-        $green?"btn-success":"btn-info",
141
+        $green ? "btn-success" : "btn-info",
142 142
         (string)$v->platform,
143 143
         (string)$v->size_mb,
144 144
         (string)$v->version_num
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 function download_button_vbox($v, $project_id, $token, $user) {
149 149
     // if no vbox version exists for platform, don't show vbox button
150
-    if(!$v->vbox_filename) {
150
+    if (!$v->vbox_filename) {
151 151
         return;
152 152
     }
153 153
     return sprintf(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     handle_get_info();
437 437
 } else {
438 438
     $dev = get_str("dev", true);
439
-    $user_agent = get_str("user_agent", true);      // for debugging
439
+    $user_agent = get_str("user_agent", true); // for debugging
440 440
     if (!$user_agent) {
441 441
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
442 442
     }
Please login to merge, or discard this patch.
html/inc/web_rpc_api.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     // Adapt to your web site. The following assumes Bootstrap.
137 137
     //
138 138
     function show_download_button($info, $is_vbox) {
139
-        $desc = $is_vbox?$info->boinc_vbox:$info->boinc;
139
+        $desc = $is_vbox ? $info->boinc_vbox : $info->boinc;
140 140
         echo sprintf('
141 141
 <form action="https://boinc.berkeley.edu/concierge.php" method="post">
142 142
     <input type=hidden name=project_id value="%d">
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             (string)$info->token,
151 151
             (int)$info->user_id,
152 152
             (string)$desc->filename,
153
-            $is_vbox?" + VirtualBox":"",
153
+            $is_vbox ? " + VirtualBox" : "",
154 154
             (string)$info->platform,
155 155
             (string)$desc->size_mb
156 156
         );
Please login to merge, or discard this patch.
html/inc/rss.inc 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 // You can pass a function $filter;
56 56
 // if $filter(item) returns true, don't show it.
57 57
 //
58
-function show_rss_items($items, $n=0, $filter=null) {
58
+function show_rss_items($items, $n = 0, $filter = null) {
59 59
     $i = 0;
60 60
     foreach ($items as $item) {
61 61
         if ($filter && $filter($item)) {
Please login to merge, or discard this patch.
html/inc/keywords.inc 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -24,72 +24,72 @@
 block discarded – undo
24 24
 define('KW_CATEGORY_SCIENCE', 0);
25 25
 define('KW_CATEGORY_LOC', 1);
26 26
 
27
-define('KW_ASTRONOMY',      1);
28
-define('KW_SETI',           2);
29
-define('KW_PULSARS',        3);
30
-define('KW_GW',             4);
31
-define('KW_COSMOLOGY',      5);
32
-define('KW_PHYSICS',        6);
27
+define('KW_ASTRONOMY', 1);
28
+define('KW_SETI', 2);
29
+define('KW_PULSARS', 3);
30
+define('KW_GW', 4);
31
+define('KW_COSMOLOGY', 5);
32
+define('KW_PHYSICS', 6);
33 33
 define('KW_PARTICLE_PHYSICS', 7);
34
-define('KW_NANOSCIENCE',    8);
35
-define('KW_BIOMED',         9);
34
+define('KW_NANOSCIENCE', 8);
35
+define('KW_BIOMED', 9);
36 36
 define('KW_DRUG_DISCOVERY', 10);
37
-define('KW_PROTEINS',       11);
38
-define('KW_GENETICS',       12);
39
-define('KW_DISEASE',        13);
40
-define('KW_CANCER',         14);
41
-define('KW_MATH_CS',        15);
42
-define('KW_AI',             16);
43
-define('KW_OCEANIA',        17);
44
-define('KW_AUSTRALIA',      18);
37
+define('KW_PROTEINS', 11);
38
+define('KW_GENETICS', 12);
39
+define('KW_DISEASE', 13);
40
+define('KW_CANCER', 14);
41
+define('KW_MATH_CS', 15);
42
+define('KW_AI', 16);
43
+define('KW_OCEANIA', 17);
44
+define('KW_AUSTRALIA', 18);
45 45
 
46
-define('KW_EUROPE',         20);
47
-define('KW_GERMANY',        21);
48
-define('KW_ASIA',           22);
49
-define('KW_AMERICAS',       23);
50
-define('KW_US',             24);
51
-define('KW_UCB',            25);
52
-define('KW_AEI',            26);
53
-define('KW_CERN',           27);
54
-define('KW_UW',             28);
55
-define('KW_EARTH_SCI',      29);
56
-define('KW_SPAIN',          30);
57
-define('KW_SAN_JORGE',      31);
58
-define('KW_NUMBER_THEORY',  32);
59
-define('KW_CRYPTO',         33);
60
-define('KW_ENV_RESEARCH',   34);
61
-define('KW_CLIMATE',        35);
62
-define('KW_CZECH',          36);
46
+define('KW_EUROPE', 20);
47
+define('KW_GERMANY', 21);
48
+define('KW_ASIA', 22);
49
+define('KW_AMERICAS', 23);
50
+define('KW_US', 24);
51
+define('KW_UCB', 25);
52
+define('KW_AEI', 26);
53
+define('KW_CERN', 27);
54
+define('KW_UW', 28);
55
+define('KW_EARTH_SCI', 29);
56
+define('KW_SPAIN', 30);
57
+define('KW_SAN_JORGE', 31);
58
+define('KW_NUMBER_THEORY', 32);
59
+define('KW_CRYPTO', 33);
60
+define('KW_ENV_RESEARCH', 34);
61
+define('KW_CLIMATE', 35);
62
+define('KW_CZECH', 36);
63 63
 define('KW_CHARLES_PRAGUE', 37);
64
-define('KW_RECHENKRAFT',    38);
65
-define('KW_RHEINMAIN',      39);
66
-define('KW_HUNGARY',        40);
67
-define('KW_IRELAND',        41);
68
-define('KW_UC_DUBLIN',      42);
69
-define('KW_POLAND',         43);
70
-define('KW_RUSSIA',         44);
64
+define('KW_RECHENKRAFT', 38);
65
+define('KW_RHEINMAIN', 39);
66
+define('KW_HUNGARY', 40);
67
+define('KW_IRELAND', 41);
68
+define('KW_UC_DUBLIN', 42);
69
+define('KW_POLAND', 43);
70
+define('KW_RUSSIA', 44);
71 71
 define('KW_SW_STATE_RUSSIA', 45);
72
-define('KW_RAS',            46);
73
-define('KW_PRBB',           47);
74
-define('KW_UK',             48);
75
-define('KW_OXFORD',         49);
76
-define('KW_CHINA',          50);
77
-define('KW_U_DAYTON',       51);
78
-define('KW_WRIGHT_STATE',   52);
79
-define('KW_USC',            53);
80
-define('KW_FULLERTON',      54);
81
-define('KW_ARIZONA_STATE',  55);
82
-define('KW_U_ILLINOIS',     56);
83
-define('KW_U_WARSAW',       57);
84
-define('KW_RPI',            58);
85
-define('KW_INTERNATIONAL',  59);
86
-define('KW_UND',            60);
87
-define('KW_HOLLAND',        61);
88
-define('KW_CHEMISTRY',      62);
89
-define('KW_GAMES',          63);
90
-define('KW_VIRUS',          64);
91
-define('KW_FRANCE',         65);
92
-define('KW_CANADA',         66);
72
+define('KW_RAS', 46);
73
+define('KW_PRBB', 47);
74
+define('KW_UK', 48);
75
+define('KW_OXFORD', 49);
76
+define('KW_CHINA', 50);
77
+define('KW_U_DAYTON', 51);
78
+define('KW_WRIGHT_STATE', 52);
79
+define('KW_USC', 53);
80
+define('KW_FULLERTON', 54);
81
+define('KW_ARIZONA_STATE', 55);
82
+define('KW_U_ILLINOIS', 56);
83
+define('KW_U_WARSAW', 57);
84
+define('KW_RPI', 58);
85
+define('KW_INTERNATIONAL', 59);
86
+define('KW_UND', 60);
87
+define('KW_HOLLAND', 61);
88
+define('KW_CHEMISTRY', 62);
89
+define('KW_GAMES', 63);
90
+define('KW_VIRUS', 64);
91
+define('KW_FRANCE', 65);
92
+define('KW_CANADA', 66);
93 93
 
94 94
 $job_keywords = array();
95 95
 
Please login to merge, or discard this patch.
html/user/team_members.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 }
33 33
 
34 34
 $offset = get_int("offset", true);
35
-if (!$offset) $offset=0;
35
+if (!$offset) $offset = 0;
36 36
 
37 37
 if ($offset > 1000) {
38 38
     error_page(tra("Limit exceeded:  Can only display the first 1000 members."));
Please login to merge, or discard this patch.
html/inc/forum_rss.inc 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 }
31 31
 
32 32
 function show_forum_rss_item($thread, $userid, $threads_only, $no_images) {
33
-    $unique_url=secure_url_base()."forum_thread.php?id=".$thread->id;
33
+    $unique_url = secure_url_base()."forum_thread.php?id=".$thread->id;
34 34
 
35 35
     $clause2 = " and hidden=0 ";
36 36
     if ($userid) $clause2 .= "and user=$userid";
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
     if (!count($posts)) return;
43 43
     $post = $posts[0];
44
-    $post_date = gmdate('D, d M Y H:i:s',$post->timestamp).' GMT';
44
+    $post_date = gmdate('D, d M Y H:i:s', $post->timestamp).' GMT';
45 45
     $post_user = BOincUser::lookup_id($post->user);
46 46
     BoincForumPrefs::lookup($post_user);
47 47
     $options = new output_options();
@@ -84,25 +84,25 @@  discard block
 block discarded – undo
84 84
 
85 85
     // Now construct header
86 86
     //
87
-    header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT");
87
+    header("Expires: ".gmdate('D, d M Y H:i:s', time() + 86400)." GMT");
88 88
     if (sizeof($threads)) {
89 89
         $t = $threads[0];
90
-        $last_mod_time = $threads_only?$t->create_time:$t->timestamp;
91
-        $create_date  = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT';
92
-        header ("Last-Modified: " . $create_date);
90
+        $last_mod_time = $threads_only ? $t->create_time : $t->timestamp;
91
+        $create_date  = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT';
92
+        header("Last-Modified: ".$create_date);
93 93
     } else {
94
-        $create_date  = gmdate('D, d M Y H:i:s') . ' GMT';
94
+        $create_date  = gmdate('D, d M Y H:i:s').' GMT';
95 95
     }
96
-    header ("Content-Type: application/xml");
96
+    header("Content-Type: application/xml");
97 97
 
98
-    $forum=BoincForum::lookup_id($forumid);
98
+    $forum = BoincForum::lookup_id($forumid);
99 99
     // Create channel header and open XML content
100 100
     //
101 101
     $description = PROJECT.": $forum->title";
102 102
     if ($userid) {
103 103
         $description .= " (posts by $user->name)";
104 104
     }
105
-    $channel_image = secure_url_base() . "rss_image.gif";
105
+    $channel_image = secure_url_base()."rss_image.gif";
106 106
     $language = "en-us";
107 107
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
108 108
         <rss version=\"2.0\">
Please login to merge, or discard this patch.
html/inc/translation.inc 2 patches
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file,-3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101 101
                 fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
     $parsing_text = false;
122 122
     $size = sizeof($translation_file);
123 123
     $output = array();
124
-    for ($i=0; $i<$size; $i++){
124
+    for ($i=0; $i<$size; $i++) {
125 125
         $entry = trim($translation_file[$i]);
126 126
         //echo "line $i: $entry\n";
127 127
         if (substr($entry, 0, 1)=="#") {
128 128
             continue;
129 129
         } elseif (strpos($entry, "msgid") !== false) {
130
-            if (!$first_entry){
130
+            if (!$first_entry) {
131 131
                 //If this is not the first, save the previous entry
132 132
                 $output[$current_token]=$current_token_text;
133 133
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     // Get the last token
151 151
     //
152
-    if ($current_token && $current_token_text){
152
+    if ($current_token && $current_token_text) {
153 153
         $output[$current_token] = $current_token_text;
154 154
     }
155 155
     return $output;
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 
181 181
     // Find the string in the user's language
182 182
     //
183
-    foreach ($languages_in_use as $language){
183
+    foreach ($languages_in_use as $language) {
184 184
         if (isset($language_lookup_array[$language][$text])) {
185 185
             $text = $language_lookup_array[$language][$text];
186 186
             break;
187
-        } else if ($language=="en"){
187
+        } else if ($language=="en") {
188 188
             // This language is defined in the code and is always available
189 189
             break;
190 190
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Replace relevant substrings with given arguments.
194 194
     // Use strtr to avoid problems if an argument contains %n.
195 195
     $replacements = array();
196
-    for ($i=1; $i<func_num_args(); $i++){
196
+    for ($i=1; $i<func_num_args(); $i++) {
197 197
         $replacements["%".$i] = func_get_arg($i);
198 198
     }
199 199
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     if ($loglevel==1) $msg = "[ Warning  ]";
218 218
     if ($loglevel==2) $msg = "[ CRITICAL ]";
219 219
 
220
-    if ($loglevel >= $lang_log_level){
220
+    if ($loglevel >= $lang_log_level) {
221 221
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
222 222
     }
223 223
 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 // (by looking at cookies and browser settings)
227 227
 // cookies have highest priority.
228 228
 
229
-if (isset($_COOKIE['lang'])){
229
+if (isset($_COOKIE['lang'])) {
230 230
     $language_string = $_COOKIE['lang'].",";
231 231
 } else {
232 232
     $language_string = '';
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 for ($i=0; $i<$size; $i++) {
261 261
     if ((strlen($client_languages[$i])>2)
262 262
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
263
-    ){
263
+    ) {
264 264
         // If this is defined as primary-secondary, represent it as xx_YY
265 265
         //
266 266
         $language = substr(
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     //
288 288
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
289 289
     if (file_exists($file_name)) {
290
-        if (!in_array($language, $languages_in_use)){
290
+        if (!in_array($language, $languages_in_use)) {
291 291
             require_once($file_name);
292 292
             $languages_in_use[] = $language;
293 293
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     if ($language2) {
296 296
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
297 297
         if (file_exists($file_name)) {
298
-            if (!in_array($language2, $languages_in_use)){
298
+            if (!in_array($language2, $languages_in_use)) {
299 299
                 require_once($file_name);
300 300
                 $languages_in_use[] = $language2;
301 301
             }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     $dh = opendir($langdir.$transdir);
65 65
     if (!$dh) die("can't open translation dir");
66 66
     while (($file = readdir($dh)) !== false) {
67
-        if ($file==".." || $file==".") {
67
+        if ($file == ".." || $file == ".") {
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file, -3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101
-                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
101
+                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n");
102 102
             }
103 103
         }
104 104
         // don't write \?\> - may append
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 function parse_po_file($file) {
116 116
     $translation_file = file($file);
117 117
     $first_entry = true;
118
-    $current_token_text="";
119
-    $current_token ="";
118
+    $current_token_text = "";
119
+    $current_token = "";
120 120
     $parsing_token = false;
121 121
     $parsing_text = false;
122 122
     $size = sizeof($translation_file);
123 123
     $output = array();
124
-    for ($i=0; $i<$size; $i++){
124
+    for ($i = 0; $i < $size; $i++) {
125 125
         $entry = trim($translation_file[$i]);
126 126
         //echo "line $i: $entry\n";
127
-        if (substr($entry, 0, 1)=="#") {
127
+        if (substr($entry, 0, 1) == "#") {
128 128
             continue;
129 129
         } elseif (strpos($entry, "msgid") !== false) {
130
-            if (!$first_entry){
130
+            if (!$first_entry) {
131 131
                 //If this is not the first, save the previous entry
132
-                $output[$current_token]=$current_token_text;
132
+                $output[$current_token] = $current_token_text;
133 133
             }
134 134
             $current_token = get_po_line($entry, $file);
135
-            $current_token_text="";
135
+            $current_token_text = "";
136 136
             $parsing_token = true;
137 137
             $parsing_text = false;
138
-            $first_entry=false;
138
+            $first_entry = false;
139 139
         } elseif (strpos($entry, "msgstr") !== false) {
140 140
             $current_token_text = get_po_line($entry, $file);
141 141
             $parsing_token = false;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     // Get the last token
151 151
     //
152
-    if ($current_token && $current_token_text){
152
+    if ($current_token && $current_token_text) {
153 153
         $output[$current_token] = $current_token_text;
154 154
     }
155 155
     return $output;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 // Returns the contents of a line (ie removes "" from start and end)
160 160
 //
161 161
 function get_po_line($line, $file) {
162
-    $start = strpos($line, '"')+1;
162
+    $start = strpos($line, '"') + 1;
163 163
     $stop = strrpos($line, '"');
164
-    $x = substr($line, $start, $stop-$start);
164
+    $x = substr($line, $start, $stop - $start);
165 165
     $n = preg_match("/[^\\\\]\"/", $x);
166 166
     if ($n) {
167 167
         echo "ERROR - MISMATCHED QUOTES IN $file: $line\n";
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 
181 181
     // Find the string in the user's language
182 182
     //
183
-    foreach ($languages_in_use as $language){
183
+    foreach ($languages_in_use as $language) {
184 184
         if (isset($language_lookup_array[$language][$text])) {
185 185
             $text = $language_lookup_array[$language][$text];
186 186
             break;
187
-        } else if ($language=="en"){
187
+        } else if ($language == "en") {
188 188
             // This language is defined in the code and is always available
189 189
             break;
190 190
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Replace relevant substrings with given arguments.
194 194
     // Use strtr to avoid problems if an argument contains %n.
195 195
     $replacements = array();
196
-    for ($i=1; $i<func_num_args(); $i++){
196
+    for ($i = 1; $i < func_num_args(); $i++) {
197 197
         $replacements["%".$i] = func_get_arg($i);
198 198
     }
199 199
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
     return $text;
211 211
 }
212 212
 
213
-function language_log($message, $loglevel=0) {
213
+function language_log($message, $loglevel = 0) {
214 214
     global $lang_log_level;
215 215
     $msg = "";
216
-    if ($loglevel==0) $msg = "[ Debug    ]";
217
-    if ($loglevel==1) $msg = "[ Warning  ]";
218
-    if ($loglevel==2) $msg = "[ CRITICAL ]";
216
+    if ($loglevel == 0) $msg = "[ Debug    ]";
217
+    if ($loglevel == 1) $msg = "[ Warning  ]";
218
+    if ($loglevel == 2) $msg = "[ CRITICAL ]";
219 219
 
220
-    if ($loglevel >= $lang_log_level){
220
+    if ($loglevel >= $lang_log_level) {
221 221
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
222 222
     }
223 223
 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 // (by looking at cookies and browser settings)
227 227
 // cookies have highest priority.
228 228
 
229
-if (isset($_COOKIE['lang'])){
229
+if (isset($_COOKIE['lang'])) {
230 230
     $language_string = $_COOKIE['lang'].",";
231 231
 } else {
232 232
     $language_string = '';
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 // Loop over languages that the client requests
258 258
 //
259 259
 $size = sizeof($client_languages);
260
-for ($i=0; $i<$size; $i++) {
261
-    if ((strlen($client_languages[$i])>2)
260
+for ($i = 0; $i < $size; $i++) {
261
+    if ((strlen($client_languages[$i]) > 2)
262 262
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
263
-    ){
263
+    ) {
264 264
         // If this is defined as primary-secondary, represent it as xx_YY
265 265
         //
266 266
         $language = substr(
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     // if main language is english, look no further
281 281
     //
282
-    if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) {
282
+    if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) {
283 283
         break;
284 284
     }
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     //
288 288
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
289 289
     if (file_exists($file_name)) {
290
-        if (!in_array($language, $languages_in_use)){
290
+        if (!in_array($language, $languages_in_use)) {
291 291
             require_once($file_name);
292 292
             $languages_in_use[] = $language;
293 293
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     if ($language2) {
296 296
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
297 297
         if (file_exists($file_name)) {
298
-            if (!in_array($language2, $languages_in_use)){
298
+            if (!in_array($language2, $languages_in_use)) {
299 299
                 require_once($file_name);
300 300
                 $languages_in_use[] = $language2;
301 301
             }
@@ -303,6 +303,6 @@  discard block
 block discarded – undo
303 303
     }
304 304
 }
305 305
 
306
-$GLOBALS['languages_in_use'] = $languages_in_use;   // for Drupal
306
+$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal
307 307
 
308 308
 ?>
Please login to merge, or discard this patch.
html/inc/forum_banishment_vote.inc 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 db_init();
27 27
 
28 28
 function current_tally($voteid) {
29
-    $query="select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid;
29
+    $query = "select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid;
30 30
     $result = _mysql_query($query);
31 31
     $foobar = _mysql_fetch_object($result);
32 32
     echo "<b>Current Tally</b>    Ayes: ".$foobar->ayes." Nays: ".$foobar->nays."<p>";
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 
36 36
 function vote_is_in_progress($userid) {
37 37
     // check whether a vote is already ongoing
38
-    $now=time();
39
-    $query="select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now;
38
+    $now = time();
39
+    $query = "select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now;
40 40
     $result = _mysql_query($query);
41 41
     if (!$result) {
42 42
         echo "Database error attempting to read banishment_vote table 1.<p>";
@@ -51,56 +51,56 @@  discard block
 block discarded – undo
51 51
     return $foobar->count;
52 52
 }
53 53
 
54
-function start_vote($config,$logged_in_user,$user,$category,$reason) {
55
-    $now=time();
56
-    $fin=$now+21600;
54
+function start_vote($config, $logged_in_user, $user, $category, $reason) {
55
+    $now = time();
56
+    $fin = $now + 21600;
57 57
 
58 58
 
59
-    if ( vote_is_in_progress($user->id) !=0 ) {
59
+    if (vote_is_in_progress($user->id) != 0) {
60 60
         echo "A banishment vote is already underway for this user.<p>";
61 61
         return 0;
62 62
     }
63
-    $query="insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")";
63
+    $query = "insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")";
64 64
     $result = _mysql_query($query);
65 65
     if (!$result) {
66 66
         echo "Database error attempting to insert to banishment_vote table.<p>";
67 67
         return 0;
68 68
     }
69 69
 
70
-    $voteid=_mysql_insert_id();
71
-    $query="insert into banishment_votes (voteid,modid,time,yes) values (". $voteid .",". $logged_in_user->id .",". $now .",1)";
70
+    $voteid = _mysql_insert_id();
71
+    $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)";
72 72
     $result = _mysql_query($query);
73 73
     if (!$result) {
74 74
         echo "Database error attempting to insert to banishment_votes table.<p>";
75 75
         return 0;
76 76
     }
77 77
 
78
-    $query="update forum_preferences set banished_until=".$fin." where userid=".$user->id;
78
+    $query = "update forum_preferences set banished_until=".$fin." where userid=".$user->id;
79 79
     $result = _mysql_query($query);
80 80
 
81 81
     echo "Banishment vote started.<p><p>";
82 82
     current_tally($voteid);
83
-    return send_banish_vote_email($user, 86400*14, $reason, $now+21600);
83
+    return send_banish_vote_email($user, 86400*14, $reason, $now + 21600);
84 84
 }
85 85
 
86
-function vote_yes($config,$logged_in_user,$user) {
87
-    $now=time();
86
+function vote_yes($config, $logged_in_user, $user) {
87
+    $now = time();
88 88
     // Check that a vote is underway.
89
-    if (vote_is_in_progress($user->id)<1) {
89
+    if (vote_is_in_progress($user->id) < 1) {
90 90
         echo "No banishment vote is underway for this user.<p><p>";
91 91
         return 0;
92 92
     }
93 93
     // Find the voteid
94
-    $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
94
+    $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
95 95
     $result = _mysql_query($query);
96 96
     $foobar = _mysql_fetch_object($result);
97 97
     if (!$foobar) {
98 98
         echo "Database error attempting to read banishment_vote table.<p>";
99 99
         return 0;
100 100
     }
101
-    $voteid=$foobar->voteid;
101
+    $voteid = $foobar->voteid;
102 102
     // Check whether mod has voted already.
103
-    $query="select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id;
103
+    $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id;
104 104
     $result = _mysql_query($query);
105 105
     $foobar = _mysql_fetch_object($result);
106 106
     if (!$foobar) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         return 0;
114 114
     }
115 115
     // insert the vote
116
-    $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",1)";
116
+    $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)";
117 117
     $result = _mysql_query($query);
118 118
     if (!$result) {
119 119
         echo "Database error attempting to insert to banishment_votes table.<p>";
@@ -124,24 +124,24 @@  discard block
 block discarded – undo
124 124
     return 1;
125 125
 }
126 126
 
127
-function vote_no($config,$logged_in_user,$user) {
127
+function vote_no($config, $logged_in_user, $user) {
128 128
     // Check that a vote is underway.
129
-    $now=time();
130
-    if (vote_is_in_progress($user->id)<1) {
129
+    $now = time();
130
+    if (vote_is_in_progress($user->id) < 1) {
131 131
         echo "No banishment vote is underway for this user.<p>";
132 132
         return 0;
133 133
     }
134 134
     // Find the voteid
135
-    $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
135
+    $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
136 136
     $result = _mysql_query($query);
137 137
     $foobar = _mysql_fetch_object($result);
138 138
     if (!$foobar) {
139 139
         echo "Database error attempting to read banishment_vote table.<p>";
140 140
         return 0;
141 141
     }
142
-    $voteid=$foobar->voteid;
142
+    $voteid = $foobar->voteid;
143 143
     // Check whether mod has voted already.
144
-    $query="select count(id) as count from banishment_votes where voteid=".$voteid ." and modid=".$logged_in_user->id;
144
+    $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id;
145 145
     $result = _mysql_query($query);
146 146
     $foobar = _mysql_fetch_object($result);
147 147
     if (!$foobar) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         return 0;
155 155
     }
156 156
     // insert the vote
157
-    $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",0)";
157
+    $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",0)";
158 158
     $result = _mysql_query($query);
159 159
     if (!$result) {
160 160
         echo "Database error attempting to insert to banishment_votes table.<p>";
Please login to merge, or discard this patch.
html/user/tree_threader.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
     global $app_name,$log;
32 32
 
33 33
     $timestamp = date("Y-m-d H:i",time());
34
-	// read the list of template filenames
35
-	//
36
-	$files = file("../../tree_threader_template_files");
37
-	if ($files === false) {
34
+    // read the list of template filenames
35
+    //
36
+    $files = file("../../tree_threader_template_files");
37
+    if ($files === false) {
38 38
         fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n");
39 39
         error("no templates file");
40 40
 
41 41
     }
42
-	$njobs = sizeof($files);
43
-	$now = time();
42
+    $njobs = sizeof($files);
43
+    $now = time();
44 44
     $batch_id = BoincBatch::insert(
45
-		"(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")"
45
+        "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")"
46 46
     );
47 47
     if (!$batch_id) {
48 48
         $log_msg = "$timestamp\tfailed to create batch for user $user->id\n";
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     $i = 1;
71
-	foreach ($files as $file) {
71
+    foreach ($files as $file) {
72 72
         $file = trim($file);
73 73
         $wu_name = "ICT_".$batch_id."_$i";
74 74
 
75
-		$cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $seq_fname $file";
75
+        $cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $seq_fname $file";
76 76
         fwrite($log, "$timestamp\t$cmd\n");
77 77
         system($cmd, $ret);
78
-		if ($ret != 0) {
78
+        if ($ret != 0) {
79 79
             fwrite($log, "can not creat job $wu_name\n");
80
-			error("can't create job");
80
+            error("can't create job");
81 81
         }
82 82
         $i++;
83
-	}
84
-	echo "<tt_reply>\n<batch_id>$batch_id</batch_id>\n</tt_reply>\n";
83
+    }
84
+    echo "<tt_reply>\n<batch_id>$batch_id</batch_id>\n</tt_reply>\n";
85 85
 }
86 86
 
87 87
 // Enumerate all the successfully completed WUs for this batch.
@@ -93,51 +93,51 @@  discard block
 block discarded – undo
93 93
 function handle_get_output($r, $batch) {
94 94
     global $log;
95 95
     $timestamp = date("Y-m-d H:i",time());
96
-	$wus = BoincWorkUnit::enum("batch=$batch->id");
97
-	$outdir = "/tmp/treeThreader_result_".$batch->id;
96
+    $wus = BoincWorkUnit::enum("batch=$batch->id");
97
+    $outdir = "/tmp/treeThreader_result_".$batch->id;
98 98
     @mkdir($outdir);
99
-	foreach ($wus as $wu) {
100
-		if (!$wu->canonical_resultid) continue;
101
-		$result = BoincResult::lookup_id($wu->canonical_resultid);
102
-		if (!$result) continue;
103
-		$paths = get_outfile_paths($result);
104
-		if (sizeof($paths) < 1) continue;
105
-
106
-		// there's only one output file
107
-		//
108
-		$path = $paths[0];
109
-
110
-		// unzip it into a directory in /tmp
111
-		//
112
-		$dir = "/tmp/$wu->name";
99
+    foreach ($wus as $wu) {
100
+        if (!$wu->canonical_resultid) continue;
101
+        $result = BoincResult::lookup_id($wu->canonical_resultid);
102
+        if (!$result) continue;
103
+        $paths = get_outfile_paths($result);
104
+        if (sizeof($paths) < 1) continue;
105
+
106
+        // there's only one output file
107
+        //
108
+        $path = $paths[0];
109
+
110
+        // unzip it into a directory in /tmp
111
+        //
112
+        $dir = "/tmp/$wu->name";
113 113
         @mkdir($dir);
114
-		$cmd = "cd $dir; unzip -q $path";
115
-		system($cmd, $ret);
116
-		if ($ret != 0) {
117
-			error("can't unzip output file");
118
-		}
119
-		$cmd = "cp $dir/Aln/* $outdir";
120
-		system($cmd, $ret);
121
-		if ($ret != 0) {
122
-			error("can't copy output files");
123
-		}
114
+        $cmd = "cd $dir; unzip -q $path";
115
+        system($cmd, $ret);
116
+        if ($ret != 0) {
117
+            error("can't unzip output file");
118
+        }
119
+        $cmd = "cp $dir/Aln/* $outdir";
120
+        system($cmd, $ret);
121
+        if ($ret != 0) {
122
+            error("can't copy output files");
123
+        }
124 124
 
125 125
         system("rm -rf $dir");
126
-	}
127
-
128
-	$cmd = "zip -r -q $outdir $outdir";
129
-	system($cmd, $ret);
130
-	if ($ret != $ret) {
131
-		error("can't zip output files");
132
-	}
133
-	$fname = "treeThreader_result_".$batch->id.".zip";
126
+    }
127
+
128
+    $cmd = "zip -r -q $outdir $outdir";
129
+    system($cmd, $ret);
130
+    if ($ret != $ret) {
131
+        error("can't zip output files");
132
+    }
133
+    $fname = "treeThreader_result_".$batch->id.".zip";
134 134
     $treeThreader_dir="treeThreaderResult";
135 135
     if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir");
136
-	@symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname");
136
+    @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname");
137 137
     system("rm -fr $outdir");
138 138
     $config = simplexml_load_string(file_get_contents("../../config.xml"));
139 139
     $download_url = trim((string)$config->config->download_url);
140
-	echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n";
140
+    echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n";
141 141
     $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n";
142 142
     fwrite($log, $log_msg);
143 143
 }
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
         handle_submit($r, $user, $app);
178 178
         break;
179 179
     case 'get_output':
180
-		$batch_id = (int)$r->batch_id;
181
-		$batch = BoincBatch::lookup_id($batch_id);
182
-		if (!$batch) error("no such batch");
183
-		if ($batch->user_id != $user->id) error("not owner of batch");
184
-		handle_get_output($r, $batch);
185
-		break;
180
+        $batch_id = (int)$r->batch_id;
181
+        $batch = BoincBatch::lookup_id($batch_id);
182
+        if (!$batch) error("no such batch");
183
+        if ($batch->user_id != $user->id) error("not owner of batch");
184
+        handle_get_output($r, $batch);
185
+        break;
186 186
     default: error("bad command");
187 187
 }
188 188
 
Please login to merge, or discard this 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.