Passed
Pull Request — master (#5850)
by
unknown
16:24 queued 07:40
created
html/inc/text_transform.inc 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 require_once('../inc/sanitize_html.inc');
27 27
 
28 28
 class output_options {
29
-    var $bb2html;            // BBCode as HTML? (on)
30
-    var $images_as_links;    // Images as hyperlinks? (off)
31
-    var $link_popup;        // Links in new windows? (off)
32
-    var $nl2br;                // Convert newlines to <br>'s? (on)
33
-    var $htmlitems;            // Convert special chars to HTML entities? (on)
34
-    var $htmlscrub;            // Scrub "bad" HTML tags? (off)
35
-    var $highlight_terms;// Array of terms to be highlighted (off)
29
+    var $bb2html; // BBCode as HTML? (on)
30
+    var $images_as_links; // Images as hyperlinks? (off)
31
+    var $link_popup; // Links in new windows? (off)
32
+    var $nl2br; // Convert newlines to <br>'s? (on)
33
+    var $htmlitems; // Convert special chars to HTML entities? (on)
34
+    var $htmlscrub; // Scrub "bad" HTML tags? (off)
35
+    var $highlight_terms; // Array of terms to be highlighted (off)
36 36
 
37 37
     // Constructor - set the defaults.
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $options = new output_options; // Defaults in the class definition
69 69
     }
70 70
     if ($options->htmlitems) {
71
-        $text = htmlspecialchars($text, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE);
71
+        $text = htmlspecialchars($text, ENT_COMPAT|ENT_HTML401|ENT_SUBSTITUTE);
72 72
     }
73 73
     if (is_array($options->highlight_terms)) {
74 74
         $text = highlight_terms($text, $options->highlight_terms);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 // If $export is true, don't use BOINC CSS
105 105
 
106 106
 function substr2($s, $n1, $n2) {
107
-    return substr($s, $n1, $n2-$n1);
107
+    return substr($s, $n1, $n2 - $n1);
108 108
 }
109 109
 
110 110
 // process non-nestable constructs: [pre] and [code]
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)";
179 179
     // List of allowable tags
180
-    $bbtags = array (
180
+    $bbtags = array(
181 181
         "@\[b\](.*?)\[/b\]@is",
182 182
         "@\[i\](.*?)\[/i\]@is",
183 183
         "@\[u\](.*?)\[/u\]@is",
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
     // What the above tags are turned in to
208 208
     if ($export) {
209
-        $htmltags = array (
209
+        $htmltags = array(
210 210
             "<b>\\1</b>",
211 211
             "<i>\\1</i>",
212 212
             "<u>\\1</u>",
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>",
234 234
         );
235 235
     } else {
236
-        $htmltags = array (
236
+        $htmltags = array(
237 237
             "<b>\\1</b>",
238 238
             "<i>\\1</i>",
239 239
             "<u>\\1</u>",
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     $lasttext = "";
266 266
     $i = 0;
267 267
     // $i<1000 to prevent DoS
268
-    while ($text != $lasttext && $i<1000) {
268
+    while ($text != $lasttext && $i < 1000) {
269 269
         $lasttext = $text;
270 270
         $text = preg_replace($bbtags, $htmltags, $text);
271 271
         $i = $i + 1;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     return $text;
276 276
 }
277 277
 
278
-function bb2html($text, $export=false) {
278
+function bb2html($text, $export = false) {
279 279
     $text = replace_pre_code($text, $export);
280 280
     return bb2html_aux($text, $export);
281 281
 }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 // for example inside <pre> containers
285 285
 // The original \n was retained after the br when it was added
286 286
 //
287
-function remove_br($text){
287
+function remove_br($text) {
288 288
     return str_replace("<br />", "", $text);
289 289
 }
290 290
 
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
 //
293 293
 function externalize_links($text) {
294 294
     // TODO:  Convert this to PCRE
295
-    $i=0;
296
-    $linkpos=true;
295
+    $i = 0;
296
+    $linkpos = true;
297 297
     $out = "";
298
-    while (true){
298
+    while (true) {
299 299
         // Find a link
300 300
         //
301
-        $linkpos=strpos($text, "<a ", $i);
302
-        if ($linkpos===false) break;
301
+        $linkpos = strpos($text, "<a ", $i);
302
+        if ($linkpos === false) break;
303 303
 
304 304
         // Replace with target='_new'
305 305
         //
306
-        $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" ";
307
-        $i = $linkpos+3;
306
+        $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" ";
307
+        $i = $linkpos + 3;
308 308
     }
309 309
     $out .= substr($text, $i);
310 310
     return $out;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 // Converts image tags to links to the images.
314 314
 //
315
-function image_as_link($text){
315
+function image_as_link($text) {
316 316
     $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si';
317 317
     $replacement = '<a href=${2}>[Image link]</a>';
318 318
     return preg_replace($pattern, $replacement, $text);
@@ -330,5 +330,5 @@  discard block
 block discarded – undo
330 330
     return str_ireplace($search, $replace, $text);
331 331
 }
332 332
 
333
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
333
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
334 334
 ?>
Please login to merge, or discard this patch.
html/user/forum_edit.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 $post_owner = BoincUser::lookup_id($post->user);
44 44
 if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) {
45
-    error_page (tra("You are not authorized to edit this post."));
45
+    error_page(tra("You are not authorized to edit this post."));
46 46
 }
47 47
 
48 48
 $thread_owner = BoincUser::lookup_id($thread->owner);
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 // (ie. not a response to another post)
52 52
 // allow the user to modify the thread title
53 53
 //
54
-$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user));
54
+$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user));
55 55
 
56 56
 $content = post_str("content", true);
57 57
 $title = post_str("title", true);
58 58
 $preview = post_str("preview", true);
59 59
 
60
-if (post_str('submit',true) && (!$preview)) {
60
+if (post_str('submit', true) && (!$preview)) {
61 61
     if (POST_MAX_LINKS
62 62
         && link_count($content) > POST_MAX_LINKS
63 63
         && !is_moderator($logged_in_user, $forum)
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
     check_tokens($logged_in_user->authenticator);
68 68
 
69
-    $add_signature = (post_str('add_signature', true) == "1")?1:0;
69
+    $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0;
70 70
     $content = substr($content, 0, 64000);
71 71
     $content = trim($content);
72 72
     if (strlen($content)) {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $now = time();
75 75
         $post->update("signature=$add_signature, content='$content', modified=$now");
76 76
 
77
-        if ($can_edit_title){
77
+        if ($can_edit_title) {
78 78
             $title = trim($title);
79 79
             $title = sanitize_tags($title);
80 80
             $title = BoincDb::escape_string($title);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 }
89 89
 
90
-page_head(tra("Edit post"),'','','', $bbcode_js);
90
+page_head(tra("Edit post"), '', '', '', $bbcode_js);
91 91
 
92 92
 switch ($forum->parent_type) {
93 93
 case 0:
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         sprintf(
123 123
             '<input type="text" size=%d name="title" value="%s">',
124 124
             80,
125
-            htmlspecialchars($preview?$title:$thread->title)
125
+            htmlspecialchars($preview ? $title : $thread->title)
126 126
         ),
127 127
         null, FORUM_LH_PCT
128 128
     );
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $bbcode_html,
140 140
         12,
141 141
         80,
142
-        htmlspecialchars($preview?$content:$post->content)
142
+        htmlspecialchars($preview ? $content : $post->content)
143 143
     ),
144 144
     null, FORUM_LH_PCT
145 145
 );
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         '<input id="add_signature" name="add_signature" value="1" type="checkbox" %s>
150 150
         <label for="add_signature">%s</label>
151 151
         ',
152
-        $post->signature?'checked="true"':'',
152
+        $post->signature ? 'checked="true"' : '',
153 153
         tra("Add my signature to this post")
154 154
     ),
155 155
     null, FORUM_LH_PCT
@@ -170,5 +170,5 @@  discard block
 block discarded – undo
170 170
 
171 171
 page_tail();
172 172
 
173
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
173
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
174 174
 ?>
Please login to merge, or discard this patch.
html/user/forum_reply.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     $parent_post_id = 0;
57 57
 }
58 58
 
59
-if ($filter != "false"){
59
+if ($filter != "false") {
60 60
     $filter = true;
61 61
 } else {
62 62
     $filter = false;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 }
72 72
 
73 73
 $warning = null;
74
-if ($content && (!$preview)){
74
+if ($content && (!$preview)) {
75 75
     check_tokens($logged_in_user->authenticator);
76 76
     if (!akismet_check($logged_in_user, $content)) {
77 77
         $warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again.");
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 }
95 95
 
96
-page_head(tra("Post to thread")." '$thread->title'",'','','', $bbcode_js);
96
+page_head(tra("Post to thread")." '$thread->title'", '', '', '', $bbcode_js);
97 97
 
98 98
 if ($parent_post) {
99 99
     echo sprintf(
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n";
162 162
     $x2 .= form_tokens($logged_in_user->authenticator);
163 163
     $x2 .= $bbcode_html."<textarea class=\"form-control\" name=\"content\" rows=\"18\">";
164
-    $no_quote = get_int("no_quote", true)==1;
164
+    $no_quote = get_int("no_quote", true) == 1;
165 165
     if ($preview) {
166 166
         $x2 .= htmlspecialchars($content);
167 167
     } else if (!$no_quote) {
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
         }
171 171
     }
172 172
     if (!$logged_in_user->prefs->no_signature_by_default) {
173
-        $enable_signature='checked="true"';
173
+        $enable_signature = 'checked="true"';
174 174
     } else {
175
-        $enable_signature="";
175
+        $enable_signature = "";
176 176
     }
177 177
     $x2 .= sprintf('</textarea><p> </p>
178 178
         <input class="btn btn-sm" %s type="submit" name="preview" value="%s">
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
     return sprintf(
201 201
         'In reply to %s\'s message of %s:
202 202
         [quote]%s[/quote]',
203
-        $user?$user->name:'unknown user',
203
+        $user ? $user->name : 'unknown user',
204 204
         date_str($post->timestamp),
205 205
         htmlspecialchars($post->content)
206 206
     );
207 207
 }
208 208
 
209
-$cvs_version_tracker[]="\$Id$";
209
+$cvs_version_tracker[] = "\$Id$";
210 210
 ?>
Please login to merge, or discard this patch.
html/user/forum_search_action.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 // Optionally filters by forum, user, time, or hidden if specified.
32 32
 //
33 33
 function search_thread_titles(
34
-    $keyword_list, $forum="", $user="", $time="", $limit=200,
35
-    $sort_style=CREATE_TIME_NEW, $show_hidden = false
36
-){
37
-    $search_string="%";
34
+    $keyword_list, $forum = "", $user = "", $time = "", $limit = 200,
35
+    $sort_style = CREATE_TIME_NEW, $show_hidden = false
36
+) {
37
+    $search_string = "%";
38 38
     foreach ($keyword_list as $key => $word) {
39 39
         $search_string .= BoincDb::escape_string($word)."%";
40 40
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     if (!$show_hidden) {
52 52
         $query .= " and thread.hidden = 0";
53 53
     }
54
-    switch($sort_style) {
54
+    switch ($sort_style) {
55 55
     case MODIFIED_NEW:
56 56
         $query .= ' ORDER BY timestamp DESC';
57 57
         break;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 //
85 85
 function search_post_content(
86 86
     $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden
87
-){
87
+) {
88 88
     $db = BoincDb::get();
89 89
 
90
-    $search_string="%";
91
-    foreach ($keyword_list as $key => $word){
90
+    $search_string = "%";
91
+    foreach ($keyword_list as $key => $word) {
92 92
         $search_string .= BoincDb::escape_string($word)."%";
93 93
     }
94 94
     $optional_join = "";
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
     }
101 101
     $query = "select post.* from ".$db->db_name.".post".$optional_join." where content like '".$search_string."'";
102 102
     if ($forum) {
103
-        $query.=" and forum = $forum->id";
103
+        $query .= " and forum = $forum->id";
104 104
     }
105 105
     if ($user) {
106
-        $query.=" and post.user = $user->id ";
106
+        $query .= " and post.user = $user->id ";
107 107
     }
108 108
     if ($time) {
109
-        $query.=" and post.timestamp > $time";
109
+        $query .= " and post.timestamp > $time";
110 110
     }
111 111
     if (!$show_hidden) {
112 112
         $query .= " AND post.hidden = 0";
113 113
     }
114
-    switch($sort_style) {
114
+    switch ($sort_style) {
115 115
     case VIEWS_MOST:
116
-        $query.= ' ORDER BY views DESC';
116
+        $query .= ' ORDER BY views DESC';
117 117
         break;
118 118
     case CREATE_TIME_NEW:
119 119
         $query .= ' ORDER by post.timestamp desc';
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
         $query .= ' ORDER BY post.timestamp DESC';
129 129
         break;
130 130
     }
131
-    $query.= " limit $limit";
131
+    $query .= " limit $limit";
132 132
     return BoincPost::enum_general($query);
133 133
 }
134 134
 
135 135
 $logged_in_user = get_logged_in_user(false);
136 136
 BoincForumPrefs::lookup($logged_in_user);
137
-if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){
137
+if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) {
138 138
     $show_hidden_posts = true;
139 139
 } else {
140 140
     $show_hidden_posts = false;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 $search_max_time = post_int("search_max_time");
148 148
 $search_forum = post_int("search_forum");
149 149
 $search_sort = post_int("search_sort");
150
-$search_list = explode(" ",$search_keywords);
150
+$search_list = explode(" ", $search_keywords);
151 151
 if ($search_max_time) {
152 152
     $min_timestamp = time() - ($search_max_time*3600*24);
153 153
 } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 $limit = 100;
158 158
 
159
-if ($search_forum==-1){
159
+if ($search_forum == -1) {
160 160
     $forum = null;
161 161
 } else if ($search_forum) {
162 162
     $forum = BoincForum::lookup_id($search_forum);
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 
174 174
 // Display the threads while we search for posts
175 175
 //
176
-if (count($threads)){
177
-    echo "<h3>" . tra("Thread titles matching your query:") . "</h3>";
176
+if (count($threads)) {
177
+    echo "<h3>".tra("Thread titles matching your query:")."</h3>";
178 178
     start_table('table-striped');
179 179
     thread_list_header();
180
-    foreach ($threads as $thread){
180
+    foreach ($threads as $thread) {
181 181
         if ($thread->hidden) continue;
182 182
         thread_list_item($thread, $logged_in_user);
183 183
     }
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
     $show_hidden_posts
194 194
 );
195 195
 
196
-if (count($posts)){
197
-    echo "<h3>" . tra("Messages matching your query:") . "</h3>";
196
+if (count($posts)) {
197
+    echo "<h3>".tra("Messages matching your query:")."</h3>";
198 198
     start_table('table-striped');
199 199
     row_heading_array(['Info', 'Post'], ['', 'width=70%']);
200 200
     $n = 1;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     end_table();
218 218
 }
219 219
 
220
-if (!count($threads) && !count($posts)){
220
+if (!count($threads) && !count($posts)) {
221 221
     echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p>
222 222
     <p>"
223 223
     .tra("You can also %1 try the same search on Google. %2",
@@ -228,5 +228,5 @@  discard block
 block discarded – undo
228 228
 echo "<p><a href=\"forum_search.php\">".tra("Perform another search")."</a></p>";
229 229
 page_tail();
230 230
 
231
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
231
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
232 232
 ?>
Please login to merge, or discard this patch.
html/user/forum_post.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 $preview = post_str("preview", true);
57 57
 $warning = null;
58 58
 
59
-if ($content && $title && (!$preview)){
59
+if ($content && $title && (!$preview)) {
60 60
     if (post_str('add_signature', true)) {
61
-        $add_signature = true;    // set a flag and concatenate later
62
-    }  else {
61
+        $add_signature = true; // set a flag and concatenate later
62
+    } else {
63 63
         $add_signature = false;
64 64
     }
65 65
     check_tokens($logged_in_user->authenticator);
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
             if (post_str('subscribe', true)) {
75 75
                 BoincSubscription::replace($logged_in_user->id, $thread->id);
76 76
             }
77
-            header('Location: forum_thread.php?id=' . $thread->id);
77
+            header('Location: forum_thread.php?id='.$thread->id);
78 78
         } else {
79 79
             error_page("Can't create thread.  $forum_error");
80 80
         }
81 81
     }
82 82
 }
83 83
 
84
-page_head(tra("Create new thread"),'','','', $bbcode_js);
84
+page_head(tra("Create new thread"), '', '', '', $bbcode_js);
85 85
 show_forum_header($logged_in_user);
86 86
 
87 87
 if ($warning) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>";
123 123
 }
124 124
 
125
-if ($force_title && $title){
125
+if ($force_title && $title) {
126 126
     row2(
127 127
         tra("Title"),
128 128
         sprintf(
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     row2(
137 137
         tra("Title").$submit_help,
138 138
         sprintf('<input type="text" class="form-control" name="title" value="%s">',
139
-            $title?htmlspecialchars($title):''
139
+            $title ?htmlspecialchars($title) : ''
140 140
         ),
141 141
         null, FORUM_LH_PCT
142 142
     );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     sprintf(
148 148
         '%s <textarea class="form-control" name="content" rows="12" cols="80">%s</textarea>',
149 149
         $bbcode_html,
150
-        $content?htmlspecialchars($content):''
150
+        $content ?htmlspecialchars($content) : ''
151 151
     ),
152 152
     null, FORUM_LH_PCT
153 153
 );
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 if (!$logged_in_user->prefs->no_signature_by_default) {
156 156
     $enable_signature = 'checked="true"';
157 157
 } else {
158
-    $enable_signature='';
158
+    $enable_signature = '';
159 159
 }
160 160
 
161 161
 if (is_news_forum($forum)) {
@@ -195,5 +195,5 @@  discard block
 block discarded – undo
195 195
 
196 196
 page_tail();
197 197
 
198
-$cvs_version_tracker[]="\$Id$";
198
+$cvs_version_tracker[] = "\$Id$";
199 199
 ?>
Please login to merge, or discard this patch.
html/user/forum_index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         project_forum_index_intro();
70 70
     }
71 71
 
72
-    if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE){
72
+    if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE) {
73 73
         $categories = BoincCategory::enum("true order by orderID");
74 74
     } else {
75 75
         echo "<p>"
@@ -210,5 +210,5 @@  discard block
 block discarded – undo
210 210
 } else {
211 211
     main($user);
212 212
 }
213
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
213
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
214 214
 ?>
Please login to merge, or discard this patch.
html/inc/db_conn.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 // Intended to be subclassed (e.g., BoincDb, BossaDb)
23 23
 //
24 24
 class DbConn {
25
-    var $db_conn;       // a mysqli object
26
-    var $db_name;       // the DB name
25
+    var $db_conn; // a mysqli object
26
+    var $db_name; // the DB name
27 27
 
28 28
     function init_conn($user, $passwd, $host, $name) {
29 29
         $x = explode(":", $host);
30
-        if (sizeof($x)>1) {
30
+        if (sizeof($x) > 1) {
31 31
             $host = $x[0];
32 32
             $port = $x[1];
33 33
         } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         }
36 36
         try {
37 37
             $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port);
38
-        } catch(Exception $e) {
38
+        } catch (Exception $e) {
39 39
             return false;
40 40
         }
41 41
         if (mysqli_connect_error()) {
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
             $where_clause = "where $where_clause";
134 134
         }
135 135
         $query = "select $fields from DBNAME.$table $where_clause $order_clause";
136
-        return $this->enum_general($classname,$query);
136
+        return $this->enum_general($classname, $query);
137 137
     }
138 138
 
139
-    function enum($table, $classname, $where_clause=null, $order_clause=null) {
139
+    function enum($table, $classname, $where_clause = null, $order_clause = null) {
140 140
         return self::enum_fields(
141 141
             $table, $classname, '*', $where_clause, $order_clause
142 142
         );
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
         if ($x) return (double)$x->$field;
182 182
         return false;
183 183
     }
184
-    function count($table, $clause="TRUE") {
184
+    function count($table, $clause = "TRUE") {
185 185
         $query = "select count(*) as total from DBNAME.$table where $clause";
186 186
         return $this->get_int($query, 'total');
187 187
     }
188
-    function sum($table, $field, $clause="") {
188
+    function sum($table, $field, $clause = "") {
189 189
         $query = "select sum($field) as total from DBNAME.$table $clause";
190 190
         return $this->get_double($query, 'total');
191 191
     }
192
-    function max($table, $field, $clause="") {
192
+    function max($table, $field, $clause = "") {
193 193
         $query = "select max($field) as total from DBNAME.$table $clause";
194 194
         return $this->get_double($query, 'total');
195 195
     }
Please login to merge, or discard this patch.
html/user/forum_forum.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 // show a forum.
27 27
 // $user is null if not logged in
28 28
 //
29
-function forum_page($forum, $user, $msg=null) {
29
+function forum_page($forum, $user, $msg = null) {
30 30
     global $forum_sort_styles;
31 31
 
32 32
     if (DISABLE_FORUMS) {
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 
54 54
     if (!$sort_style) {
55 55
         // get the sort style either from the logged in user or a cookie
56
-        if ($user){
56
+        if ($user) {
57 57
             $sort_style = $user->prefs->forum_sorting;
58 58
         } else {
59 59
             list($sort_style, $thread_style) = parse_forum_cookie();
60 60
         }
61 61
     } else {
62 62
         // set the sort style
63
-        if ($user){
63
+        if ($user) {
64 64
             $user->prefs->forum_sorting = $sort_style;
65 65
             $user->prefs->update("forum_sorting=$sort_style");
66 66
         } else {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         echo "<td><a href=\"forum_thread.php?id=$thread->id\">$title</a><br></td>";
249 249
 
250 250
         echo '
251
-            <td>'.($thread->replies+1).'</td>
251
+            <td>'.($thread->replies + 1).'</td>
252 252
             <td>'.user_links($owner, BADGE_HEIGHT_SMALL).'</td>
253 253
             <td>'.$thread->views.'</td>
254 254
             <td>'.time_diff_str($thread->timestamp, time()).'</td>
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         flush();
258 258
     }
259 259
     end_table();
260
-    echo "<br>$page_nav";    // show page links
260
+    echo "<br>$page_nav"; // show page links
261 261
 }
262 262
 
263 263
 $id = get_int("id");
Please login to merge, or discard this patch.