@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | // return a string for navigating pages |
226 | 226 | // |
227 | -function page_links($url, $nitems, $items_per_page, $start){ |
|
227 | +function page_links($url, $nitems, $items_per_page, $start) { |
|
228 | 228 | // How many pages to potentially show before and after this one: |
229 | 229 | $preshow = 3; |
230 | 230 | $postshow = 3; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | // If this is not the first page, display "previous" |
239 | 239 | // |
240 | - if ($curpage > 0){ |
|
240 | + if ($curpage > 0) { |
|
241 | 241 | $x .= page_link( |
242 | 242 | $url, $curpage-1, $items_per_page, |
243 | 243 | tra("Previous")." · " |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | // Display a list of pages surrounding this one |
256 | 256 | // |
257 | - for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){ |
|
257 | + for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++) { |
|
258 | 258 | $page_str = (string)($i+1); |
259 | 259 | if ($i < 0) continue; |
260 | 260 | if ($i >= $npages) break; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | // If there is a next page |
277 | 277 | // |
278 | - if ($curpage < $npages-1){ |
|
278 | + if ($curpage < $npages-1) { |
|
279 | 279 | $x .= page_link( |
280 | 280 | $url, $curpage+1, $items_per_page, |
281 | 281 | " · ".tra("Next") |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | // If the user no longer exists, skip the post |
504 | 504 | // |
505 | - if (!$user){ |
|
505 | + if (!$user) { |
|
506 | 506 | return; |
507 | 507 | } |
508 | 508 | |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | // check whether the poster is on the list of people to ignore |
519 | 519 | // |
520 | 520 | $ignore_poster = false; |
521 | - if ($logged_in_user){ |
|
521 | + if ($logged_in_user) { |
|
522 | 522 | $tokens = url_tokens($logged_in_user->authenticator); |
523 | - if (is_ignoring($logged_in_user, $user)){ |
|
523 | + if (is_ignoring($logged_in_user, $user)) { |
|
524 | 524 | $ignore_poster = true; |
525 | 525 | } |
526 | 526 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | // Highlight special users if set in prefs; |
559 | 559 | // |
560 | - if ($logged_in_user && $logged_in_user->prefs){ |
|
560 | + if ($logged_in_user && $logged_in_user->prefs) { |
|
561 | 561 | $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special; |
562 | 562 | } else { |
563 | 563 | $highlight = $is_posted_by_special; |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | echo "<span class=\"small\">"; |
579 | 579 | if ($fstatus) echo "$fstatus"; |
580 | 580 | |
581 | - if (!$filter || !$ignore_poster){ |
|
581 | + if (!$filter || !$ignore_poster) { |
|
582 | 582 | if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) { |
583 | 583 | echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>"; |
584 | 584 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $user->nposts = BoincPost::count("user=$user->id"); |
595 | 595 | } |
596 | 596 | |
597 | - if (function_exists('project_forum_user_info')){ |
|
597 | + if (function_exists('project_forum_user_info')) { |
|
598 | 598 | project_forum_user_info($user); |
599 | 599 | } else { |
600 | 600 | echo tra("Posts: %1", $user->nposts)."<br>"; |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">"; |
634 | 634 | } |
635 | 635 | |
636 | - if ($logged_in_user && $post->timestamp > $latest_viewed){ |
|
636 | + if ($logged_in_user && $post->timestamp > $latest_viewed) { |
|
637 | 637 | show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT); |
638 | 638 | } |
639 | 639 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | if ($post->modified) { |
654 | 654 | echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified)); |
655 | 655 | } |
656 | - if ($ignore_poster && $filter){ |
|
656 | + if ($ignore_poster && $filter) { |
|
657 | 657 | echo "<br>" .tra( |
658 | 658 | "This post is hidden because the sender is on your 'ignore' list. Click %1 here %2 to view hidden posts", |
659 | 659 | "<a href=\"?id=".$thread->id."&filter=false&start=$start#".$post->id."\">", |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | <p> |
668 | 668 | "; |
669 | 669 | |
670 | - if (!$filter || !$ignore_poster){ |
|
670 | + if (!$filter || !$ignore_poster) { |
|
671 | 671 | $posttext = $post->content; |
672 | 672 | |
673 | 673 | // If the creator of this post has a signature and |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | // user has signatures enabled: show it |
676 | 676 | // |
677 | 677 | $posttext = output_transform($posttext, $options); |
678 | - if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){ |
|
678 | + if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) { |
|
679 | 679 | $sig = output_transform($user->prefs->signature, $options); |
680 | 680 | $posttext .= "<hr>$sig\n"; |
681 | 681 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | $sql = 'forum = ' . $forumID ; |
1037 | 1037 | $stickysql = ""; |
1038 | - if ($sticky){ |
|
1038 | + if ($sticky) { |
|
1039 | 1039 | $stickysql = "sticky DESC, "; |
1040 | 1040 | } |
1041 | 1041 | if (!$show_hidden) { |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | // |
1117 | 1117 | function show_post_moderation_links( |
1118 | 1118 | $config, $logged_in_user, $post, $forum, $tokens |
1119 | -){ |
|
1119 | +) { |
|
1120 | 1120 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1121 | 1121 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1122 | 1122 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | function search_thread_titles( |
34 | 34 | $keyword_list, $forum="", $user="", $time="", $limit=200, |
35 | 35 | $sort_style=CREATE_TIME_NEW, $show_hidden = false |
36 | -){ |
|
36 | +) { |
|
37 | 37 | $search_string="%"; |
38 | 38 | foreach ($keyword_list as $key => $word) { |
39 | 39 | $search_string .= BoincDb::escape_string($word)."%"; |
@@ -84,11 +84,11 @@ discard block |
||
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 | 90 | $search_string="%"; |
91 | - foreach ($keyword_list as $key => $word){ |
|
91 | + foreach ($keyword_list as $key => $word) { |
|
92 | 92 | $search_string .= BoincDb::escape_string($word)."%"; |
93 | 93 | } |
94 | 94 | $optional_join = ""; |
@@ -134,7 +134,7 @@ discard block |
||
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; |
@@ -156,7 +156,7 @@ discard block |
||
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,10 +173,10 @@ discard block |
||
173 | 173 | |
174 | 174 | // Display the threads while we search for posts |
175 | 175 | // |
176 | -if (count($threads)){ |
|
176 | +if (count($threads)) { |
|
177 | 177 | echo "<h3>" . tra("Thread titles matching your query:") . "</h3>"; |
178 | 178 | show_thread_and_context_header(); |
179 | - foreach ($threads as $thread){ |
|
179 | + foreach ($threads as $thread) { |
|
180 | 180 | if ($thread->hidden) continue; |
181 | 181 | show_thread_and_context($thread, $logged_in_user); |
182 | 182 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $show_hidden_posts |
193 | 193 | ); |
194 | 194 | |
195 | -if (count($posts)){ |
|
195 | +if (count($posts)) { |
|
196 | 196 | echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
197 | 197 | start_table(); |
198 | 198 | $n = 1; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | end_table(); |
216 | 216 | } |
217 | 217 | |
218 | -if (!count($threads) && !count($posts)){ |
|
218 | +if (!count($threads) && !count($posts)) { |
|
219 | 219 | 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> |
220 | 220 | <p>" |
221 | 221 | .tra("You can also %1 try the same search on Google. %2", |
@@ -387,8 +387,7 @@ |
||
387 | 387 | $team = node_load($nid); |
388 | 388 | $output .= '<p>' . bts('You may create a message board for use by @team', |
389 | 389 | array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>'; |
390 | - } |
|
391 | - else { |
|
390 | + } else { |
|
392 | 391 | $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>'; |
393 | 392 | } |
394 | 393 | $output .= '<ul>'; |
@@ -136,8 +136,7 @@ discard block |
||
136 | 136 | $lidkey = array_search($chunk['hash'], $nodehashtable); |
137 | 137 | if ($lidkey) { |
138 | 138 | unset($nodehashtable[$lidkey]); |
139 | - } |
|
140 | - else { |
|
139 | + } else { |
|
141 | 140 | |
142 | 141 | $result = db_query(" |
143 | 142 | INSERT INTO {locales_source} |
@@ -150,8 +149,7 @@ discard block |
||
150 | 149 | 'Added translation source strings for node @nid chunk @chunk.', |
151 | 150 | array('@nid' => $node->nid, '@chunk' => $idx) |
152 | 151 | ); |
153 | - } |
|
154 | - else { |
|
152 | + } else { |
|
155 | 153 | drupal_set_message( |
156 | 154 | t('ERROR: Unable to add translation source strings.'), 'error' |
157 | 155 | ); |
@@ -248,12 +246,10 @@ discard block |
||
248 | 246 | $mess = 'DEBUG ' . l('BOINC translate', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.'; |
249 | 247 | drupal_set_message($mess, 'warning'); |
250 | 248 | return $ret; |
251 | - } |
|
252 | - else { |
|
249 | + } else { |
|
253 | 250 | return _boinctranslate_filter_process($text, $format, $mynid); |
254 | 251 | }// if debug |
255 | - } |
|
256 | - else { |
|
252 | + } else { |
|
257 | 253 | return $text; |
258 | 254 | }// if type |
259 | 255 | break; |
@@ -309,8 +305,7 @@ discard block |
||
309 | 305 | foreach ($parts as $key => $value) { |
310 | 306 | if (preg_match('/(#SPLIT_TOKEN#)/', $value)) { |
311 | 307 | $chunks[] = array ('delimiter' => $value,); |
312 | - } |
|
313 | - else { |
|
308 | + } else { |
|
314 | 309 | $cleaned = preg_replace('/\s|\n/', '', $value); |
315 | 310 | if (!empty($cleaned)) { |
316 | 311 | $chunks[] = array( |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | ) |
37 | 37 | ), 'warning' |
38 | 38 | ); |
39 | - } |
|
40 | - elseif ($response) { |
|
39 | + } elseif ($response) { |
|
41 | 40 | if (is_array($response)) { |
42 | 41 | |
43 | 42 | $installed_languages = language_list(); |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | 'Added predefined language: '.$available_languages[$rfc_code][0] |
68 | 67 | ); |
69 | 68 | db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code); |
70 | - } |
|
71 | - else { |
|
69 | + } else { |
|
72 | 70 | // Retrieve language details from Transifex |
73 | 71 | $path = "language/{$posix_code}"; |
74 | 72 | $response = boinctranslate_transifex_request($path); |
@@ -81,8 +79,7 @@ discard block |
||
81 | 79 | ) |
82 | 80 | ), 'warning' |
83 | 81 | ); |
84 | - } |
|
85 | - elseif ($response) { |
|
82 | + } elseif ($response) { |
|
86 | 83 | if (!empty($response['name'])) { |
87 | 84 | // Add a custom language to Drupal and enable |
88 | 85 | locale_add_language( |
@@ -97,8 +94,7 @@ discard block |
||
97 | 94 | drupal_set_message( |
98 | 95 | 'Added new language: '.$response['name'] |
99 | 96 | ); |
100 | - } |
|
101 | - else { |
|
97 | + } else { |
|
102 | 98 | $variables = array( |
103 | 99 | '%code' => $posix_code, |
104 | 100 | ); |
@@ -113,8 +109,7 @@ discard block |
||
113 | 109 | WATCHDOG_ERROR |
114 | 110 | ); |
115 | 111 | } |
116 | - } |
|
117 | - else { |
|
112 | + } else { |
|
118 | 113 | $variables = array( |
119 | 114 | '%code' => $posix_code, |
120 | 115 | ); |
@@ -155,8 +150,7 @@ discard block |
||
155 | 150 | batch_set($batch); |
156 | 151 | batch_process('admin/boinc/translation'); |
157 | 152 | } |
158 | - } |
|
159 | - else { |
|
153 | + } else { |
|
160 | 154 | $variables = array( |
161 | 155 | '%project' => $project_name, |
162 | 156 | ); |
@@ -171,8 +165,7 @@ discard block |
||
171 | 165 | WATCHDOG_ERROR |
172 | 166 | ); |
173 | 167 | } |
174 | - } |
|
175 | - else { |
|
168 | + } else { |
|
176 | 169 | $variables = array( |
177 | 170 | '%project' => $project_name, |
178 | 171 | ); |
@@ -229,8 +222,7 @@ discard block |
||
229 | 222 | 'content' => boinctranslate_get_po('en', 'project'), |
230 | 223 | ); |
231 | 224 | $result = boinctranslate_transifex_request($path, $post); |
232 | - } |
|
233 | - else { |
|
225 | + } else { |
|
234 | 226 | // Update the source |
235 | 227 | $path = "project/{$project_name}/resource/{$primary_resource}/content"; |
236 | 228 | $post = array( |
@@ -244,8 +236,7 @@ discard block |
||
244 | 236 | $enabled_languages = locale_language_list(); |
245 | 237 | if ($source_exists) { |
246 | 238 | drupal_set_message('Updated source translation strings at Transifex'); |
247 | - } |
|
248 | - else { |
|
239 | + } else { |
|
249 | 240 | drupal_set_message('Established new translation resource at Transifex'); |
250 | 241 | } |
251 | 242 | // Try to export translations for all enabled languages |
@@ -266,25 +257,21 @@ discard block |
||
266 | 257 | "Unable to update {$language_name} translations: {$result}", |
267 | 258 | 'warning' |
268 | 259 | ); |
269 | - } |
|
270 | - else { |
|
260 | + } else { |
|
271 | 261 | drupal_set_message("Updated {$language_name} translations"); |
272 | 262 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
273 | 263 | } |
274 | - } |
|
275 | - else { |
|
264 | + } else { |
|
276 | 265 | drupal_set_message("No translations to export for {$language_name}"); |
277 | 266 | } |
278 | 267 | } |
279 | - } |
|
280 | - else { |
|
268 | + } else { |
|
281 | 269 | drupal_set_message( |
282 | 270 | "Unable to update the translation source: {$result}", |
283 | 271 | 'warning' |
284 | 272 | ); |
285 | 273 | } |
286 | - } |
|
287 | - else { |
|
274 | + } else { |
|
288 | 275 | drupal_set_message( |
289 | 276 | 'Failed to export translations: Transifex settings are not intiailized.', |
290 | 277 | 'error' |
@@ -340,42 +327,35 @@ discard block |
||
340 | 327 | "Unable to update {$language_name} official BOINC translations: {$result}", |
341 | 328 | 'warning' |
342 | 329 | ); |
343 | - } |
|
344 | - elseif ($result == '401 UNAUTHORIZED') { |
|
330 | + } elseif ($result == '401 UNAUTHORIZED') { |
|
345 | 331 | drupal_set_message( |
346 | 332 | 'Not authorized to update official BOINC translations', |
347 | 333 | 'warning' |
348 | 334 | ); |
349 | 335 | break; |
350 | - } |
|
351 | - elseif ($result == 'success') { |
|
336 | + } elseif ($result == 'success') { |
|
352 | 337 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
353 | - } |
|
354 | - else { |
|
338 | + } else { |
|
355 | 339 | drupal_set_message( |
356 | 340 | "Unexpected response for {$language_name}: {$result}", |
357 | 341 | 'warning' |
358 | 342 | ); |
359 | 343 | } |
360 | - } |
|
361 | - else { |
|
344 | + } else { |
|
362 | 345 | drupal_set_message("Updated {$language_name} official BOINC translations"); |
363 | 346 | //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>'); |
364 | 347 | } |
365 | - } |
|
366 | - else { |
|
348 | + } else { |
|
367 | 349 | drupal_set_message("No official BOINC translations to export for {$language_name}"); |
368 | 350 | } |
369 | 351 | } |
370 | - } |
|
371 | - else { |
|
352 | + } else { |
|
372 | 353 | drupal_set_message( |
373 | 354 | "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex", |
374 | 355 | 'warning' |
375 | 356 | ); |
376 | 357 | } |
377 | - } |
|
378 | - else { |
|
358 | + } else { |
|
379 | 359 | drupal_set_message( |
380 | 360 | 'Failed to export official BOINC translations: Transifex settings are not intiailized.', |
381 | 361 | 'error' |
@@ -413,13 +393,11 @@ discard block |
||
413 | 393 | if ($json) { |
414 | 394 | $headers['Content-Type'] = 'application/json'; |
415 | 395 | $data = json_encode($post); |
416 | - } |
|
417 | - else { |
|
396 | + } else { |
|
418 | 397 | $data = drupal_query_string_encode($post); |
419 | 398 | } |
420 | 399 | $method = ($use_put) ? 'PUT' : 'POST'; |
421 | - } |
|
422 | - else { |
|
400 | + } else { |
|
423 | 401 | $method = 'GET'; |
424 | 402 | } |
425 | 403 | |
@@ -431,8 +409,7 @@ discard block |
||
431 | 409 | if ($json) { |
432 | 410 | // Process as JSON |
433 | 411 | return json_decode($response->data, TRUE); |
434 | - } |
|
435 | - else { |
|
412 | + } else { |
|
436 | 413 | return (string) $response->data; |
437 | 414 | } |
438 | 415 | break; |
@@ -582,18 +559,15 @@ discard block |
||
582 | 559 | if ($plural) { |
583 | 560 | $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
584 | 561 | $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
585 | - } |
|
586 | - else { |
|
562 | + } else { |
|
587 | 563 | $translation = ''; |
588 | 564 | } |
589 | 565 | } |
590 | - } |
|
591 | - else { |
|
566 | + } else { |
|
592 | 567 | $output .= 'msgstr[0] ""' . "\n"; |
593 | 568 | $output .= 'msgstr[1] ""' . "\n"; |
594 | 569 | } |
595 | - } |
|
596 | - else { |
|
570 | + } else { |
|
597 | 571 | $output .= 'msgstr ' . _locale_export_string($string['translation']); |
598 | 572 | } |
599 | 573 | $output .= "\n"; |
@@ -671,8 +645,7 @@ discard block |
||
671 | 645 | if ($tl0) { |
672 | 646 | bts($tl0); |
673 | 647 | } |
674 | - } |
|
675 | - elseif (count($line)>1) { |
|
648 | + } elseif (count($line)>1) { |
|
676 | 649 | $tl0 = trim($line[0]); |
677 | 650 | $tl1 = trim($line[1]); |
678 | 651 | if ($tl0 and $tl1) { |
@@ -761,8 +734,7 @@ discard block |
||
761 | 734 | |
762 | 735 | if ($response == '404 NOT FOUND') { |
763 | 736 | $message = "Project resource {$project}:{$resource} not found in {$language}."; |
764 | - } |
|
765 | - elseif ($response) { |
|
737 | + } elseif ($response) { |
|
766 | 738 | if (!empty($response['content'])) { |
767 | 739 | $po_text = $response['content']; |
768 | 740 | |
@@ -783,23 +755,19 @@ discard block |
||
783 | 755 | . " {$project}:{$resource} failed."; |
784 | 756 | $success = FALSE; |
785 | 757 | break; |
786 | - } |
|
787 | - else { |
|
758 | + } else { |
|
788 | 759 | $success = TRUE; |
789 | 760 | } |
790 | 761 | } |
791 | - } |
|
792 | - else { |
|
762 | + } else { |
|
793 | 763 | $message = "Unable to read response for {$language} translation import" |
794 | 764 | . " of {$project}:{$resource}."; |
795 | 765 | } |
796 | - } |
|
797 | - else { |
|
766 | + } else { |
|
798 | 767 | $message = "Translation data not found in response for {$language}" |
799 | 768 | . " translation import of {$project}:{$resource}."; |
800 | 769 | } |
801 | - } |
|
802 | - else { |
|
770 | + } else { |
|
803 | 771 | // If project isn't specified, import as a local Drupal resource |
804 | 772 | $project = 'drupal.local'; |
805 | 773 | $file = new stdClass(); |
@@ -809,8 +777,7 @@ discard block |
||
809 | 777 | $message = "The {$language} translation import of" |
810 | 778 | . " local file {$resource} failed."; |
811 | 779 | $success = FALSE; |
812 | - } |
|
813 | - else { |
|
780 | + } else { |
|
814 | 781 | $success = TRUE; |
815 | 782 | } |
816 | 783 | } |
@@ -828,8 +795,7 @@ discard block |
||
828 | 795 | WATCHDOG_INFO |
829 | 796 | ); |
830 | 797 | } |
831 | - } |
|
832 | - else { |
|
798 | + } else { |
|
833 | 799 | $context['results']['failure'][] = "{$langcode}:{$textgroup}"; |
834 | 800 | watchdog( |
835 | 801 | 'boinctranslate', |
@@ -847,8 +813,7 @@ discard block |
||
847 | 813 | // Update the progress for the batch engine |
848 | 814 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
849 | 815 | $context['finished'] = 1; |
850 | - } |
|
851 | - else { |
|
816 | + } else { |
|
852 | 817 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
853 | 818 | } |
854 | 819 | } |
@@ -867,8 +832,7 @@ discard block |
||
867 | 832 | array('@count' => $count), |
868 | 833 | WATCHDOG_INFO |
869 | 834 | ); |
870 | - } |
|
871 | - else { |
|
835 | + } else { |
|
872 | 836 | // An error occurred. |
873 | 837 | // $operations contains the operations that remained unprocessed. |
874 | 838 | $error_operation = reset($operations); |
@@ -963,17 +927,19 @@ discard block |
||
963 | 927 | $lineno++; |
964 | 928 | $line = trim(strtr($line, array("\\\n" => ""))); |
965 | 929 | |
966 | - if (!strncmp("#", $line, 1)) { // A comment |
|
967 | - if ($context == "COMMENT") { // Already in comment context: add |
|
930 | + if (!strncmp("#", $line, 1)) { |
|
931 | +// A comment |
|
932 | + if ($context == "COMMENT") { |
|
933 | +// Already in comment context: add |
|
968 | 934 | $current["#"][] = substr($line, 1); |
969 | - } |
|
970 | - elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
935 | + } elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
936 | +// End current entry, start a new one |
|
971 | 937 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
972 | 938 | $current = array(); |
973 | 939 | $current["#"][] = substr($line, 1); |
974 | 940 | $context = "COMMENT"; |
975 | - } |
|
976 | - else { // Parse error |
|
941 | + } else { |
|
942 | +// Parse error |
|
977 | 943 | watchdog( |
978 | 944 | 'boinctranslate', |
979 | 945 | 'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.', |
@@ -983,13 +949,13 @@ discard block |
||
983 | 949 | _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno); |
984 | 950 | return FALSE; |
985 | 951 | } |
986 | - } |
|
987 | - elseif (!strncmp("msgctxt", $line, 7)) { |
|
988 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
952 | + } elseif (!strncmp("msgctxt", $line, 7)) { |
|
953 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
954 | +// End current entry, start a new one |
|
989 | 955 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
990 | 956 | $current = array(); |
991 | - } |
|
992 | - elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error |
|
957 | + } elseif (($context == "MSGID") || ($context == "MSGCTXT")) { |
|
958 | +// Already in this context? Parse error |
|
993 | 959 | watchdog( |
994 | 960 | 'boinctranslate', |
995 | 961 | 'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.', |
@@ -1013,9 +979,9 @@ discard block |
||
1013 | 979 | } |
1014 | 980 | $current["msgctxt"] = $quoted; |
1015 | 981 | $context = "MSGCTXT"; |
1016 | - } |
|
1017 | - elseif (!strncmp("msgid_plural", $line, 12)) { |
|
1018 | - if ($context != "MSGID") { // Must be plural form for current entry |
|
982 | + } elseif (!strncmp("msgid_plural", $line, 12)) { |
|
983 | + if ($context != "MSGID") { |
|
984 | +// Must be plural form for current entry |
|
1019 | 985 | watchdog( |
1020 | 986 | 'boinctranslate', |
1021 | 987 | 'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.', |
@@ -1039,13 +1005,13 @@ discard block |
||
1039 | 1005 | } |
1040 | 1006 | $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
1041 | 1007 | $context = "MSGID_PLURAL"; |
1042 | - } |
|
1043 | - elseif (!strncmp("msgid", $line, 5)) { |
|
1044 | - if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one |
|
1008 | + } elseif (!strncmp("msgid", $line, 5)) { |
|
1009 | + if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
|
1010 | +// End current entry, start a new one |
|
1045 | 1011 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1046 | 1012 | $current = array(); |
1047 | - } |
|
1048 | - elseif ($context == "MSGID") { // Already in this context? Parse error |
|
1013 | + } elseif ($context == "MSGID") { |
|
1014 | +// Already in this context? Parse error |
|
1049 | 1015 | watchdog( |
1050 | 1016 | 'boinctranslate', |
1051 | 1017 | 'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.', |
@@ -1069,9 +1035,9 @@ discard block |
||
1069 | 1035 | } |
1070 | 1036 | $current["msgid"] = $quoted; |
1071 | 1037 | $context = "MSGID"; |
1072 | - } |
|
1073 | - elseif (!strncmp("msgstr[", $line, 7)) { |
|
1074 | - if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[] |
|
1038 | + } elseif (!strncmp("msgstr[", $line, 7)) { |
|
1039 | + if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { |
|
1040 | +// Must come after msgid, msgid_plural, or msgstr[] |
|
1075 | 1041 | watchdog( |
1076 | 1042 | 'boinctranslate', |
1077 | 1043 | 'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.', |
@@ -1107,9 +1073,9 @@ discard block |
||
1107 | 1073 | } |
1108 | 1074 | $current["msgstr"][$plural] = $quoted; |
1109 | 1075 | $context = "MSGSTR_ARR"; |
1110 | - } |
|
1111 | - elseif (!strncmp("msgstr", $line, 6)) { |
|
1112 | - if ($context != "MSGID") { // Should come just after a msgid block |
|
1076 | + } elseif (!strncmp("msgstr", $line, 6)) { |
|
1077 | + if ($context != "MSGID") { |
|
1078 | +// Should come just after a msgid block |
|
1113 | 1079 | watchdog( |
1114 | 1080 | 'boinctranslate', |
1115 | 1081 | 'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.', |
@@ -1133,8 +1099,7 @@ discard block |
||
1133 | 1099 | } |
1134 | 1100 | $current["msgstr"] = $quoted; |
1135 | 1101 | $context = "MSGSTR"; |
1136 | - } |
|
1137 | - elseif ($line != "") { |
|
1102 | + } elseif ($line != "") { |
|
1138 | 1103 | $quoted = _locale_import_parse_quoted($line); |
1139 | 1104 | if ($quoted === FALSE) { |
1140 | 1105 | watchdog( |
@@ -1148,14 +1113,11 @@ discard block |
||
1148 | 1113 | } |
1149 | 1114 | if (($context == "MSGID") || ($context == "MSGID_PLURAL")) { |
1150 | 1115 | $current["msgid"] .= $quoted; |
1151 | - } |
|
1152 | - elseif ($context == "MSGSTR") { |
|
1116 | + } elseif ($context == "MSGSTR") { |
|
1153 | 1117 | $current["msgstr"] .= $quoted; |
1154 | - } |
|
1155 | - elseif ($context == "MSGSTR_ARR") { |
|
1118 | + } elseif ($context == "MSGSTR_ARR") { |
|
1156 | 1119 | $current["msgstr"][$plural] .= $quoted; |
1157 | - } |
|
1158 | - else { |
|
1120 | + } else { |
|
1159 | 1121 | watchdog( |
1160 | 1122 | 'boinctranslate', |
1161 | 1123 | 'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.', |
@@ -1171,8 +1133,7 @@ discard block |
||
1171 | 1133 | // End of PO file, flush last entry |
1172 | 1134 | if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { |
1173 | 1135 | _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group); |
1174 | - } |
|
1175 | - elseif ($context != "COMMENT") { |
|
1136 | + } elseif ($context != "COMMENT") { |
|
1176 | 1137 | watchdog( |
1177 | 1138 | 'boinctranslate', |
1178 | 1139 | 'The translation file %filename for %lang ended unexpectedly at line %line.', |
@@ -1239,9 +1200,7 @@ discard block |
||
1239 | 1200 | } |
1240 | 1201 | } |
1241 | 1202 | $headerdone = TRUE; |
1242 | - } |
|
1243 | - |
|
1244 | - else { |
|
1203 | + } else { |
|
1245 | 1204 | // Some real string to import. |
1246 | 1205 | $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']); |
1247 | 1206 | |
@@ -1260,9 +1219,7 @@ discard block |
||
1260 | 1219 | } |
1261 | 1220 | $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key); |
1262 | 1221 | } |
1263 | - } |
|
1264 | - |
|
1265 | - else { |
|
1222 | + } else { |
|
1266 | 1223 | // A simple string to import. |
1267 | 1224 | $english = $value['msgid']; |
1268 | 1225 | $translation = $value['msgstr']; |
@@ -1293,8 +1250,7 @@ discard block |
||
1293 | 1250 | $uselocation = array("boinc", "project"); |
1294 | 1251 | if (in_array($textgroup, $uselocation)) { |
1295 | 1252 | $resource = db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup); |
1296 | - } |
|
1297 | - else { |
|
1253 | + } else { |
|
1298 | 1254 | $resource = db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup); |
1299 | 1255 | |
1300 | 1256 | // Parse the location string for the string ignoreoverwrite, which |
@@ -1316,8 +1272,7 @@ discard block |
||
1316 | 1272 | if ($textgroup == "default" && !locale_string_is_safe($translation)) { |
1317 | 1273 | $report['skips']++; |
1318 | 1274 | $lid = 0; |
1319 | - } |
|
1320 | - elseif ($resource) { |
|
1275 | + } elseif ($resource) { |
|
1321 | 1276 | // We have this source string saved already. Loop over the db results from locales_source table. |
1322 | 1277 | while ($row = db_fetch_array($resource)) { |
1323 | 1278 | |
@@ -1328,20 +1283,17 @@ discard block |
||
1328 | 1283 | // No translation in this language, insert translation into locales_target table. |
1329 | 1284 | db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
1330 | 1285 | $report['additions']++; |
1331 | - } |
|
1332 | - else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
|
1286 | + } else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
|
1333 | 1287 | // Translation exists, only overwrite if instructed. |
1334 | 1288 | db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
1335 | 1289 | $report['updates']++; |
1336 | - } |
|
1337 | - else { |
|
1290 | + } else { |
|
1338 | 1291 | $report['skips']++; |
1339 | 1292 | }// end if !$exists |
1340 | 1293 | |
1341 | 1294 | }// while |
1342 | 1295 | } |
1343 | - } |
|
1344 | - elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) { |
|
1296 | + } elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) { |
|
1345 | 1297 | // Loop over db results from locales_source table. |
1346 | 1298 | while ($row = db_fetch_array($resource)) { |
1347 | 1299 | $lid = $row['lid']; |
@@ -1352,8 +1304,7 @@ discard block |
||
1352 | 1304 | $report['deletes']++; |
1353 | 1305 | }// if $exists |
1354 | 1306 | }// while |
1355 | - } |
|
1356 | - else { |
|
1307 | + } else { |
|
1357 | 1308 | $report['skips']++; |
1358 | 1309 | } |
1359 | 1310 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $postid = get_int('postid', true); |
31 | 31 | $filter = get_str('filter', true); |
32 | 32 | |
33 | -if ($filter != "false"){ |
|
33 | +if ($filter != "false") { |
|
34 | 34 | $filter = true; |
35 | 35 | } else { |
36 | 36 | $filter = false; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $sort_style = $temp_sort_style; |
81 | 81 | } else if ($sort_style) { |
82 | 82 | $forum_style = 0; // this is deprecated |
83 | - if ($logged_in_user){ |
|
83 | + if ($logged_in_user) { |
|
84 | 84 | $logged_in_user->prefs->thread_sorting = $sort_style; |
85 | 85 | $logged_in_user->prefs->update("thread_sorting=$sort_style"); |
86 | 86 | } else { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } else { |
94 | 94 | // get the sorting style from the user or a cookie |
95 | - if ($logged_in_user){ |
|
95 | + if ($logged_in_user) { |
|
96 | 96 | $sort_style = $logged_in_user->prefs->thread_sorting; |
97 | 97 | } else { |
98 | 98 | list($forum_style, $sort_style) = parse_forum_cookie(); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | |
121 | 121 | if (false) { |
122 | 122 | if ($forum->parent_type == 0) { |
123 | - if ($category->is_helpdesk && !$thread->status){ |
|
124 | - if ($logged_in_user){ |
|
125 | - if ($thread->owner == $logged_in_user->id){ |
|
123 | + if ($category->is_helpdesk && !$thread->status) { |
|
124 | + if ($logged_in_user) { |
|
125 | + if ($thread->owner == $logged_in_user->id) { |
|
126 | 126 | if ($thread->replies !=0) { |
127 | 127 | // Show a "this question has been answered" to the author |
128 | 128 | echo "<p>"; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // If logged in user is moderator, enable some extra features |
190 | 190 | // |
191 | 191 | if (is_moderator($logged_in_user, $forum)) { |
192 | - if ($thread->hidden){ |
|
192 | + if ($thread->hidden) { |
|
193 | 193 | show_button_small( |
194 | 194 | "forum_moderate_thread_action.php?action=unhide&thread=".$thread->id."$tokens", |
195 | 195 | tra("Unhide"), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | tra("Hide this thread") |
203 | 203 | ); |
204 | 204 | } |
205 | - if ($thread->sticky){ |
|
205 | + if ($thread->sticky) { |
|
206 | 206 | show_button_small( |
207 | 207 | "forum_moderate_thread_action.php?action=desticky&thread=".$thread->id."$tokens", |
208 | 208 | tra("Make unsticky"), |
@@ -7,8 +7,7 @@ |
||
7 | 7 | list($module, $api) = func_get_args(); |
8 | 8 | if ($module == "panels_mini" && $api == "panels_default") { |
9 | 9 | return array("version" => 1); |
10 | - } |
|
11 | - else if ($module == "strongarm" && $api == "strongarm") { |
|
10 | + } else if ($module == "strongarm" && $api == "strongarm") { |
|
12 | 11 | return array("version" => 1); |
13 | 12 | } |
14 | 13 | } |
@@ -147,13 +147,11 @@ discard block |
||
147 | 147 | '@pages' => format_plural($pages_generated, 'page', 'pages'), |
148 | 148 | ) |
149 | 149 | )); |
150 | - } |
|
151 | - else { |
|
150 | + } else { |
|
152 | 151 | if ($option) { |
153 | 152 | drupal_set_message(t('The @specified page already exists.', |
154 | 153 | array('@specified' => $option)), 'warning'); |
155 | - } |
|
156 | - else { |
|
154 | + } else { |
|
157 | 155 | drupal_set_message(t('All pages already exist, so none can be recreated |
158 | 156 | automatically.'), 'warning'); |
159 | 157 | } |
@@ -174,8 +172,7 @@ discard block |
||
174 | 172 | 'rules', |
175 | 173 | 'moderation', |
176 | 174 | ); |
177 | - } |
|
178 | - elseif (!is_array($pages)) { |
|
175 | + } elseif (!is_array($pages)) { |
|
179 | 176 | $pages = array($pages); |
180 | 177 | } |
181 | 178 |
@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | $nid = $existing_teams[$boinc_team->id]; |
45 | 45 | $success = boincteam_import($boinc_team, $nid); |
46 | 46 | } |
47 | - } |
|
48 | - else { |
|
47 | + } else { |
|
49 | 48 | // Import new teams created by RPC or ops/team_import.php |
50 | 49 | $success = boincteam_import($boinc_team); |
51 | 50 | } |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | $node->body = $boincteam->description; |
78 | 77 | $node->teaser = $teaser; |
79 | 78 | $node->uid = boincuser_lookup_uid($boincteam->userid); |
80 | - } |
|
81 | - else { |
|
79 | + } else { |
|
82 | 80 | // Construct the team as a new node |
83 | 81 | $node = array( |
84 | 82 | 'type' => 'team', |
@@ -132,8 +130,7 @@ discard block |
||
132 | 130 | } |
133 | 131 | if ($boincid) { |
134 | 132 | return $ids; |
135 | - } |
|
136 | - else { |
|
133 | + } else { |
|
137 | 134 | return array_map('boincuser_lookup_uid', $ids); |
138 | 135 | } |
139 | 136 | } |