Completed
Pull Request — master (#1976)
by Christian
10:47
created
html/user/forum_thread_status.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
 }
36 36
 
37 37
 $owner = BoincUser::lookup_id($thread->owner);
38
-if ($logged_in_user->id == $owner->id){ 
38
+if ($logged_in_user->id == $owner->id) {
39 39
     $action = get_str("action");
40 40
     if ($action == "set") {
41 41
         $ret = $thread->update("status=1");
42 42
     } else {
43 43
         $ret = $thread->update("status=0");
44 44
     }
45
-    if (!$ret){
45
+    if (!$ret) {
46 46
         error_page("Could not update the status of the thread: ".$thread->id);
47 47
     }
48 48
 } else {
Please login to merge, or discard this patch.
html/inc/forum_email.inc 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 // If a user is subscribed to a thread that is replied to,
124 124
 // send them an email notifying them of the reply.
125 125
 //
126
-function send_reply_notification_email($thread, $user){
126
+function send_reply_notification_email($thread, $user) {
127 127
     $title = PROJECT . ": A user has posted to '". $thread->title ."'";
128 128
     $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
129 129
     $body = "Another " . PROJECT . " user has posted to the thread
Please login to merge, or discard this patch.
html/inc/db_conn.inc 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@
 block discarded – undo
36 36
                 $port = null;
37 37
             }
38 38
             //if (version_compare(PHP_VERSION, '5.3.0') < 0) {
39
-            if (1) {        // don't use persistent connections for now
39
+            if (1) {
40
+// don't use persistent connections for now
40 41
                 $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port);
41 42
             } else {
42 43
                 $this->db_conn = @new mysqli("p:".$host, $user, $passwd, $name, $port);
Please login to merge, or discard this patch.
html/inc/page_translate.inc 1 patch
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 // Some of this should be merged with translation.inc
21 21
 
22 22
 function get_lang_list() {
23
-    if (isset($_COOKIE['lang'])){
23
+    if (isset($_COOKIE['lang'])) {
24 24
         $language_string = $_COOKIE['lang'].",";
25 25
     } else {
26 26
         $language_string = '';
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
     $lang_list = array();
34 34
     for ($i=0; $i<sizeof($client_languages); $i++) {
35 35
         if ((strlen($client_languages[$i])>2)
36
-            && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-"))
37
-        {
36
+            && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-")) {
38 37
             // If this is defined as primary-secondary, represent it as xx_YY
39 38
             //
40 39
             $language = substr(
Please login to merge, or discard this patch.
html/inc/credit.inc 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
 
32 32
         if ((1.0-$weight)>0.000001) {
33 33
             $avg += (1.0-$weight)*($work/$diff_days);
34
-        }
35
-        else {
34
+        } else {
36 35
             $avg += M_LN2*$work*86400/CREDIT_HALF_LIFE;
37 36
         }
38 37
     } else if ($work) {
Please login to merge, or discard this patch.
html/inc/bbcode_convert.inc 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 require_once('../inc/sanitize_html.inc');
21 21
 
22
-function image_as_bb($text){
22
+function image_as_bb($text) {
23 23
     // This function depends on sanitized HTML
24 24
 
25 25
     $pattern = '@<img(.*) src=\"([^>^"]+)\"([^>]*)>@si';
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     return $text;
34 34
 }
35 35
 
36
-function link_as_bb($text){
36
+function link_as_bb($text) {
37 37
         /* This function depends on sanitized HTML */
38 38
     // Build some regex (should be a *lot* faster)
39 39
     $pattern = '@<a href=\"([^>]+)\">@si'; // Gives us the URL in $1...
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     return $text;
50 50
 }
51 51
 
52
-function formatting_as_bb($text){
52
+function formatting_as_bb($text) {
53 53
         /* This function depends on sanitized HTML */
54 54
     $in[]="<b>";$out[]="[b]";
55 55
     $in[]="</b>";$out[]="[/b]";
Please login to merge, or discard this patch.
html/inc/db_ops.inc 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@  discard block
 block discarded – undo
96 96
     if (!isset($types)) {
97 97
         $types = array();
98 98
         $constants = get_defined_constants(true);
99
-        foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
99
+        foreach ($constants['mysqli'] as $c => $n) {
100
+            if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
101
+        }
100 102
     }
101 103
     return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown";
102 104
 }
@@ -376,13 +378,13 @@  discard block
 block discarded – undo
376 378
 
377 379
 
378 380
 function link_results($n, $mq, $query, $clauses) {
379
-    if ($n == '0') { // intentional compare by string
381
+    if ($n == '0') {
382
+// intentional compare by string
380 383
         return "0";
381 384
     } else {
382 385
         if(strlen($clauses)) {
383 386
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
384
-        }
385
-        else {
387
+        } else {
386 388
             return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>";
387 389
         }
388 390
         
@@ -392,7 +394,7 @@  discard block
 block discarded – undo
392 394
 // Determines if in stderr_out is an error reported and prints as human readable String
393 395
 // @return String A human readable string if error otherwise FALSE
394 396
 // @param String $stderr_out the stderr_out value to parse
395
-function stderr_error_string($stderr_out){
397
+function stderr_error_string($stderr_out) {
396 398
     $y = parse_element($stderr_out, "<error_code>");
397 399
     $x = 0;
398 400
     if ($y) {
@@ -1146,7 +1148,7 @@  discard block
 block discarded – undo
1146 1148
         // result has not been received yet, so show report deadline either
1147 1149
         // in green if in the future or in red if in the past.
1148 1150
         $timenow=time();
1149
-        if ($result->report_deadline==0)  {
1151
+        if ($result->report_deadline==0) {
1150 1152
             // not sent -- show create time in purple 
1151 1153
             $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1152 1154
         } else if ($result->report_deadline>=$timenow) {
Please login to merge, or discard this patch.
html/inc/cache.inc 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
110
+function cache_check_diskspace() {
111 111
     if ((rand() % CACHE_SIZE_CHECK_FREQ)) return;
112 112
     if (disk_usage("../cache") < MAX_CACHE_USAGE) return;
113 113
     $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     clean_cache($x, "../cache");
117 117
 }
118 118
 
119
-function cache_need_to_regenerate($path, $max_age){
119
+function cache_need_to_regenerate($path, $max_age) {
120 120
     $regenerate = false;
121 121
     $request = apache_request_headers();
122 122
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 // Returns cached data or false if nothing was found
142
-function get_cached_data($max_age, $params=""){
142
+function get_cached_data($max_age, $params="") {
143 143
     global $no_cache;
144 144
 
145 145
     if ($no_cache) return;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // DEPRECATED
168
-function start_cache($max_age, $params=""){
168
+function start_cache($max_age, $params="") {
169 169
     global $no_cache, $caching, $memcache;
170 170
 
171 171
     if ($no_cache) return;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $regenerate = cache_need_to_regenerate($path, $max_age);
189 189
         }
190 190
         //Is the stored version too old, do we need to regenerate it?
191
-        if ($regenerate){
191
+        if ($regenerate) {
192 192
             // If cached version is too old (or non-existent)
193 193
             // generate the page and write to cache
194 194
             //
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 // write output buffer both to client and to cache
230 230
 // DEPRECATED
231
-function end_cache($max_age,$params=""){
231
+function end_cache($max_age,$params="") {
232 232
     global $no_cache;
233 233
     if ($no_cache) return;
234 234
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     }
254 254
 }
255 255
 
256
-function set_cached_data($max_age, $data, $params=""){
256
+function set_cached_data($max_age, $data, $params="") {
257 257
     // for the benefit of hackers
258 258
     if (strstr($params, "..")) {
259 259
         return "bad params";
Please login to merge, or discard this patch.
html/inc/util.inc 1 patch
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 // with an existing web framework can more easily do so.
188 188
 // To do so, define page_head() in the project include file.
189 189
 //
190
-if (!function_exists("page_head")){
190
+if (!function_exists("page_head")) {
191 191
 function page_head(
192 192
     $title,
193 193
         // page title. Put in <title>, used as title for browser tab.
@@ -273,7 +273,8 @@  discard block
 block discarded – undo
273 273
     echo '<div class="container-fluid">
274 274
     ';
275 275
 
276
-    switch($title) {    //kludge
276
+    switch($title) {
277
+//kludge
277 278
     case tra("Log in"):
278 279
     case tra("Create an account"):
279 280
     case tra("Server status page"):
@@ -289,7 +290,7 @@  discard block
 block discarded – undo
289 290
 
290 291
 // See the comments for page_head()
291 292
 //
292
-if (!function_exists("page_tail")){
293
+if (!function_exists("page_tail")) {
293 294
 function page_tail(
294 295
     $show_date=false,
295 296
         // true for pages that are generated periodically rather than on the fly
@@ -309,7 +310,7 @@  discard block
 block discarded – undo
309 310
 }
310 311
 }
311 312
 
312
-function display_cvs_versions(){
313
+function display_cvs_versions() {
313 314
     global $cvs_version_tracker;
314 315
     echo "\n<!-- SVN VERSIONS -->\n";
315 316
     for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
@@ -797,7 +798,7 @@  discard block
 block discarded – undo
797 798
     return $str;
798 799
 }
799 800
 
800
-function strip_bbcode($string){
801
+function strip_bbcode($string) {
801 802
     return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
802 803
 }
803 804
 
@@ -846,7 +847,7 @@  discard block
 block discarded – undo
846 847
 // @param desc The title of the destination - typically used as a popup
847 848
 // @param class The optional CSS class of the button. Defaults to a standard button
848 849
 //
849
-function show_actionlist_button($url, $text, $desc, $class="btn btn-default"){
850
+function show_actionlist_button($url, $text, $desc, $class="btn btn-default") {
850 851
     echo "<li>";
851 852
     echo show_button($url, $text, $desc, $class);
852 853
     echo "</li>";
@@ -1036,7 +1037,7 @@  discard block
 block discarded – undo
1036 1037
 // Otherwise return 0.
1037 1038
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1038 1039
 //
1039
-function boinc_client_version(){
1040
+function boinc_client_version() {
1040 1041
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1041 1042
     $x = $_SERVER['HTTP_USER_AGENT'];
1042 1043
     $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
Please login to merge, or discard this patch.