@@ -37,7 +37,7 @@ |
||
37 | 37 | FROM forum_preferences as prefs, user |
38 | 38 | WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id" |
39 | 39 | ); |
40 | -for ($i=1; $i<=_mysql_num_rows($result); $i++){ |
|
40 | +for ($i=1; $i<=_mysql_num_rows($result); $i++) { |
|
41 | 41 | $foo = _mysql_fetch_object($result); |
42 | 42 | echo "<form action=\"manage_special_users_action.php\" method=\"POST\">\n"; |
43 | 43 | echo "<input type=\"hidden\" name=\"userid\" value=\"$foo->userid\" |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | start_table(); |
36 | 36 | |
37 | -switch($table){ |
|
37 | +switch($table) { |
|
38 | 38 | case "platform": |
39 | 39 | break; |
40 | 40 | case "app": |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | do_query("alter table host add max_results_day integer not null"); |
277 | 277 | } |
278 | 278 | |
279 | -function update_4_20_2005(){ |
|
279 | +function update_4_20_2005() { |
|
280 | 280 | do_query("ALTER TABLE `thread` ADD `sticky` TINYINT UNSIGNED DEFAULT '0' NOT NULL"); |
281 | 281 | do_query("ALTER TABLE `forum` ADD `post_min_total_credit` INT NOT NULL AFTER `posts`"); |
282 | 282 | do_query("ALTER TABLE `forum` ADD `post_min_expavg_credit` INT NOT NULL AFTER `posts`"); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | do_query("ALTER TABLE `forum_preferences` ADD `last_post` INT( 14 ) UNSIGNED NOT NULL AFTER `posts`"); |
287 | 287 | } |
288 | 288 | |
289 | -function update_4_30_2005(){ |
|
289 | +function update_4_30_2005() { |
|
290 | 290 | do_query("ALTER TABLE `forum_preferences` ADD `ignore_sticky_posts` TINYINT( 1 ) UNSIGNED NOT NULL"); |
291 | 291 | } |
292 | 292 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | do_query("update user set country='Macedonia' where country='Macedonia, The Former Yugoslav Republic of'"); |
314 | 314 | } |
315 | 315 | |
316 | -function update_11_24_2005(){ |
|
316 | +function update_11_24_2005() { |
|
317 | 317 | do_query("ALTER TABLE `forum_preferences` ADD `minimum_wrap_postcount` INT DEFAULT '100' NOT NULL AFTER `high_rating_threshold` , |
318 | 318 | ADD `display_wrap_postcount` INT DEFAULT '75' NOT NULL AFTER `minimum_wrap_postcount`"); |
319 | 319 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | "); |
619 | 619 | } |
620 | 620 | |
621 | -function update_10_05_2008(){ |
|
621 | +function update_10_05_2008() { |
|
622 | 622 | do_query("alter table forum_preferences add highlight_special tinyint default '1' not null"); |
623 | 623 | } |
624 | 624 |
@@ -43,14 +43,15 @@ |
||
43 | 43 | $profiles = _mysql_query("select * from profile where userid>$start_id order by userid"); |
44 | 44 | echo _mysql_error(); |
45 | 45 | $i=0; |
46 | - while ($profile = _mysql_fetch_object($profiles)){ |
|
46 | + while ($profile = _mysql_fetch_object($profiles)) { |
|
47 | 47 | $i++; |
48 | - if ($i%100 == 0) { //For every 100 profiles |
|
48 | + if ($i%100 == 0) { |
|
49 | +//For every 100 profiles |
|
49 | 50 | echo $profile->userid.". "; flush(); // print out where we are |
50 | 51 | //usleep(200000); |
51 | 52 | } |
52 | 53 | |
53 | - if ($profile->userid > $start_id){ |
|
54 | + if ($profile->userid > $start_id) { |
|
54 | 55 | fix_profile($profile); |
55 | 56 | } |
56 | 57 | } |
@@ -345,8 +345,7 @@ discard block |
||
345 | 345 | if (!$account) { |
346 | 346 | global $user; |
347 | 347 | $account = user_load($user->id); |
348 | - } |
|
349 | - elseif (is_numeric($account)) { |
|
348 | + } elseif (is_numeric($account)) { |
|
350 | 349 | $account = user_load($account); |
351 | 350 | } |
352 | 351 | |
@@ -422,13 +421,11 @@ discard block |
||
422 | 421 | // (except in cases where password is being reset) |
423 | 422 | if (isset($_SESSION['reset_pass'])) { |
424 | 423 | unset($_SESSION['reset_pass']); |
425 | - } |
|
426 | - else { |
|
424 | + } else { |
|
427 | 425 | $given_hash = md5($edit['current_pass'] . strtolower($account->mail)); |
428 | 426 | if (!$edit['current_pass']) { |
429 | 427 | form_set_error('current_pass', bts('Authentication is required when changing E-mail address or setting new password.', array(), NULL, 'boinc:account-credentials-change')); |
430 | - } |
|
431 | - elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
428 | + } elseif ( (!password_verify($given_hash, $boinc_user->passwd_hash)) and ($given_hash != $boinc_user->passwd_hash) ) { |
|
432 | 429 | form_set_error('current_pass', bts('Password entered is not valid. Please verify that it is correct.', array(), NULL, 'boinc:account-credentials-change')); |
433 | 430 | } |
434 | 431 |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | unset($account->roles[$unrestricted_role]); |
72 | 72 | } |
73 | 73 | user_save($account, array('roles' => $account->roles)); |
74 | - } |
|
75 | - else { |
|
74 | + } else { |
|
76 | 75 | if (!isset($account->roles[$community_role])) { |
77 | 76 | // The user should be a 'community member' role. If the user was |
78 | 77 | // previously banned, this will restore that role. |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | $account->roles[$unrestricted_role] = 'verified contributor'; |
89 | 88 | user_save($account, array('roles' => $account->roles)); |
90 | 89 | } |
91 | - } |
|
92 | - else { |
|
90 | + } else { |
|
93 | 91 | drupal_set_message(bts( |
94 | 92 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 93 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
@@ -175,12 +173,10 @@ discard block |
||
175 | 173 | if ($never_been_picked) { |
176 | 174 | // Allow users who have been previously selected |
177 | 175 | $never_been_picked = FALSE; |
178 | - } |
|
179 | - elseif ($active_users) { |
|
176 | + } elseif ($active_users) { |
|
180 | 177 | // Allow users who are not even active (getting desperate) |
181 | 178 | $active_users = FALSE; |
182 | - } |
|
183 | - else { |
|
179 | + } else { |
|
184 | 180 | // Process failed... |
185 | 181 | return FALSE; |
186 | 182 | } |
@@ -235,8 +231,7 @@ discard block |
||
235 | 231 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
236 | 232 | . "on {$changedate}. If you need to reverse this change, please look for " |
237 | 233 | . "an email send to the email address: {$prev_email}.\n"; |
238 | - } |
|
239 | - else { |
|
234 | + } else { |
|
240 | 235 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
241 | 236 | . "on {$changedate}. You will not be able to change your email address " |
242 | 237 | . "until {$newdate}. If you need to reverse this change, please look for " |
@@ -357,8 +352,7 @@ discard block |
||
357 | 352 | rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
358 | 353 | } |
359 | 354 | return $rc1; |
360 | - } |
|
361 | - else { |
|
355 | + } else { |
|
362 | 356 | drupal_set_message( |
363 | 357 | bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
364 | 358 | array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
@@ -399,8 +393,7 @@ discard block |
||
399 | 393 | // If boincid or token is not present, then go to the home page. |
400 | 394 | if (empty($params['boincid']) or empty($params['token'])) { |
401 | 395 | $redirect = ''; |
402 | - } |
|
403 | - else { |
|
396 | + } else { |
|
404 | 397 | $uid = boincuser_lookup_uid($params['boincid']); |
405 | 398 | $redirect = "/user/${uid}/recoveremail/${params['token']}"; |
406 | 399 | } |
@@ -451,8 +444,7 @@ discard block |
||
451 | 444 | $dir = "boinc_{$type}_dir"; |
452 | 445 | if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
453 | 446 | return $include_dir; |
454 | - } |
|
455 | - else { |
|
447 | + } else { |
|
456 | 448 | // Don't show errors on blacklisted pages |
457 | 449 | $page_blacklist = array( |
458 | 450 | 'admin/boinc/environment' |
@@ -465,8 +457,7 @@ discard block |
||
465 | 457 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 458 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | 459 | 'admin/boinc/environment'))), 'warning', FALSE); |
468 | - } |
|
469 | - else { |
|
460 | + } else { |
|
470 | 461 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | 462 | the system administrator.'), 'error', FALSE); |
472 | 463 | } |
@@ -481,8 +472,7 @@ discard block |
||
481 | 472 | if (!in_array($_GET['q'], $redirect_blacklist)) { |
482 | 473 | drupal_goto(''); |
483 | 474 | } |
484 | - } |
|
485 | - else { |
|
475 | + } else { |
|
486 | 476 | // Clear the messages on the environment config page |
487 | 477 | drupal_get_messages(); |
488 | 478 | } |
@@ -501,8 +491,7 @@ discard block |
||
501 | 491 | ); |
502 | 492 | if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
503 | 493 | return explode("\r\n", $url_config); |
504 | - } |
|
505 | - elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
494 | + } elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
506 | 495 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
507 | 496 | configured. Please !verify for the settings to become effective.', |
508 | 497 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
@@ -172,8 +172,7 @@ discard block |
||
172 | 172 | $out['result'] = $result; |
173 | 173 | if ($result == 1) { |
174 | 174 | $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
175 | - } |
|
176 | - else { |
|
175 | + } else { |
|
177 | 176 | $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
178 | 177 | } |
179 | 178 | $out['html'] .= '</ul>'; |
@@ -201,16 +200,14 @@ discard block |
||
201 | 200 | if ($GLOBALS['db_type'] == 'pgsql') { |
202 | 201 | // adapt from db_table_exists in database.pgsql.inc |
203 | 202 | $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
204 | - } |
|
205 | - else { |
|
203 | + } else { |
|
206 | 204 | // adapt from db_table_exists in database.mysql.inc |
207 | 205 | $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
208 | 206 | } |
209 | 207 | db_set_active('default'); |
210 | 208 | if ($result) { |
211 | 209 | $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
212 | - } |
|
213 | - else { |
|
210 | + } else { |
|
214 | 211 | $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
215 | 212 | $out['result']= 0; |
216 | 213 | } |
@@ -258,8 +255,7 @@ discard block |
||
258 | 255 | array('!unlock_it' => l(t('release the lock'), |
259 | 256 | 'admin/boinc/import/unlock') |
260 | 257 | ), WATCHDOG_WARNING); |
261 | - } |
|
262 | - else { |
|
258 | + } else { |
|
263 | 259 | $boincimport_functions = array( |
264 | 260 | 'users' => t('Import users'), |
265 | 261 | 'teams' => t('Import teams'), |
@@ -294,8 +290,7 @@ discard block |
||
294 | 290 | // Lock the import process |
295 | 291 | if (!variable_get('boincimport_process_locked', 0)) { |
296 | 292 | variable_set('boincimport_process_locked', 1); |
297 | - } |
|
298 | - else { |
|
293 | + } else { |
|
299 | 294 | watchdog('boincimport', 'The import process is locked, but another process |
300 | 295 | is trying to access it...', array(), WATCHDOG_WARNING); |
301 | 296 | } |
@@ -309,8 +304,7 @@ discard block |
||
309 | 304 | boincimport_teams(); |
310 | 305 | if (!variable_get('boincimport_import_team_successful', 0)) { |
311 | 306 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
312 | - } |
|
313 | - else { |
|
307 | + } else { |
|
314 | 308 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
315 | 309 | } |
316 | 310 | break; |
@@ -319,8 +313,7 @@ discard block |
||
319 | 313 | boincimport_friends(); |
320 | 314 | if (!variable_get('boincimport_import_friend_successful', 0)) { |
321 | 315 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
322 | - } |
|
323 | - else { |
|
316 | + } else { |
|
324 | 317 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
325 | 318 | } |
326 | 319 | break; |
@@ -329,8 +322,7 @@ discard block |
||
329 | 322 | boincimport_preferences(); |
330 | 323 | if (!variable_get('boincimport_import_preferences_successful', 0)) { |
331 | 324 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
332 | - } |
|
333 | - else { |
|
325 | + } else { |
|
334 | 326 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
335 | 327 | } |
336 | 328 | break; |
@@ -339,8 +331,7 @@ discard block |
||
339 | 331 | boincimport_private_msgs(); |
340 | 332 | if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
341 | 333 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
342 | - } |
|
343 | - else { |
|
334 | + } else { |
|
344 | 335 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
345 | 336 | } |
346 | 337 | break; |
@@ -349,8 +340,7 @@ discard block |
||
349 | 340 | boincimport_forum_categories(); |
350 | 341 | if (!variable_get('boincimport_import_category_successful', 0)) { |
351 | 342 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
352 | - } |
|
353 | - else { |
|
343 | + } else { |
|
354 | 344 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
355 | 345 | } |
356 | 346 | break; |
@@ -359,8 +349,7 @@ discard block |
||
359 | 349 | boincimport_forum_topics(); |
360 | 350 | if (!variable_get('boincimport_import_topic_successful', 0)) { |
361 | 351 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
362 | - } |
|
363 | - else { |
|
352 | + } else { |
|
364 | 353 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
365 | 354 | } |
366 | 355 | break; |
@@ -369,8 +358,7 @@ discard block |
||
369 | 358 | boincimport_forum_posts(); |
370 | 359 | if (!variable_get('boincimport_import_post_successful', 0)) { |
371 | 360 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
372 | - } |
|
373 | - else { |
|
361 | + } else { |
|
374 | 362 | $_SESSION['boincimport_stage_selected'] = 'url'; |
375 | 363 | } |
376 | 364 | break; |
@@ -379,8 +367,7 @@ discard block |
||
379 | 367 | boincimport_team_forums(); |
380 | 368 | if (!variable_get('boincimport_team_forum_successful', 0)) { |
381 | 369 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
382 | - } |
|
383 | - else { |
|
370 | + } else { |
|
384 | 371 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
385 | 372 | } |
386 | 373 | break; |
@@ -389,8 +376,7 @@ discard block |
||
389 | 376 | boincimport_team_forum_topics(); |
390 | 377 | if (!variable_get('boincimport_team_topic_successful', 0)) { |
391 | 378 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
392 | - } |
|
393 | - else { |
|
379 | + } else { |
|
394 | 380 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
395 | 381 | } |
396 | 382 | break; |
@@ -399,8 +385,7 @@ discard block |
||
399 | 385 | boincimport_team_forum_posts(); |
400 | 386 | if (!variable_get('boincimport_team_post_successful', 0)) { |
401 | 387 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
402 | - } |
|
403 | - else { |
|
388 | + } else { |
|
404 | 389 | $_SESSION['boincimport_stage_selected'] = 'url'; |
405 | 390 | } |
406 | 391 | break; |
@@ -409,8 +394,7 @@ discard block |
||
409 | 394 | boincimport_replace_urls(); |
410 | 395 | if (!variable_get('boincimport_replace_url_successful', 0)) { |
411 | 396 | $_SESSION['boincimport_stage_selected'] = 'url'; |
412 | - } |
|
413 | - else { |
|
397 | + } else { |
|
414 | 398 | drupal_set_message('Congratulations. Import Finished'); |
415 | 399 | drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
416 | 400 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
@@ -479,8 +463,7 @@ discard block |
||
479 | 463 | ORDER BY id ASC' |
480 | 464 | ); |
481 | 465 | $user_count = mysqli_num_rows($boinc_accounts); |
482 | - } |
|
483 | - else { |
|
466 | + } else { |
|
484 | 467 | // Need to import any user who is currently ignored in order to keep them |
485 | 468 | // ignored... not particularly clean (ignored users are stored in a string) |
486 | 469 | $ignored_user_list = array(0); |
@@ -556,8 +539,7 @@ discard block |
||
556 | 539 | if (isset($existing_users[$boinc_account->id])) { |
557 | 540 | // This user has already been imported |
558 | 541 | $duplicates[] = $boinc_account->id; |
559 | - } |
|
560 | - else { |
|
542 | + } else { |
|
561 | 543 | $operations[] = array( |
562 | 544 | 'boincimport_users_op', array( |
563 | 545 | $boinc_account->id |
@@ -613,8 +595,7 @@ discard block |
||
613 | 595 | // Store some result for post-processing in the finished callback. |
614 | 596 | $context['results']['success'][] = $boinc_id; |
615 | 597 | $message = "Successfully imported user {$boinc_id}"; |
616 | - } |
|
617 | - else { |
|
598 | + } else { |
|
618 | 599 | $context['results']['failure'][] = $boinc_id; |
619 | 600 | $message = "Failed to import user {$boinc_id}!"; |
620 | 601 | watchdog('boincimport', |
@@ -631,8 +612,7 @@ discard block |
||
631 | 612 | // Update the progress for the batch engine |
632 | 613 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
633 | 614 | $context['finished'] = 1; |
634 | - } |
|
635 | - else { |
|
615 | + } else { |
|
636 | 616 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
637 | 617 | } |
638 | 618 | } |
@@ -657,8 +637,7 @@ discard block |
||
657 | 637 | // Set the user import successful flag in the variable table |
658 | 638 | variable_set('boincimport_import_user_successful', '1'); |
659 | 639 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
660 | - } |
|
661 | - else { |
|
640 | + } else { |
|
662 | 641 | // An error occurred. |
663 | 642 | // $operations contains the operations that remained unprocessed. |
664 | 643 | $error_operation = reset($operations); |
@@ -720,8 +699,7 @@ discard block |
||
720 | 699 | $team_type = array( |
721 | 700 | 'tid' => $team_type_id |
722 | 701 | ); |
723 | - } |
|
724 | - else { |
|
702 | + } else { |
|
725 | 703 | if (!$name) continue; |
726 | 704 | $team_type = array( |
727 | 705 | 'name' => strip_tags($name), |
@@ -784,8 +762,7 @@ discard block |
||
784 | 762 | if (isset($existing_teams[$boinc_team->id])) { |
785 | 763 | // This team has already been imported |
786 | 764 | $duplicates[] = $boinc_team->id; |
787 | - } |
|
788 | - else { |
|
765 | + } else { |
|
789 | 766 | $operations[] = array( |
790 | 767 | 'boincimport_teams_op', array( |
791 | 768 | $boinc_team |
@@ -826,8 +803,7 @@ discard block |
||
826 | 803 | // Store some result for post-processing in the finished callback. |
827 | 804 | $context['results']['success'][] = $boincteam->id; |
828 | 805 | $message = "Successfully imported team {$boincteam->id}"; |
829 | - } |
|
830 | - else { |
|
806 | + } else { |
|
831 | 807 | $context['results']['failure'][] = $boincteam->id; |
832 | 808 | $message = "Failed to import team {$boincteam->id}!"; |
833 | 809 | watchdog('boincimport', |
@@ -844,8 +820,7 @@ discard block |
||
844 | 820 | // Update the progress for the batch engine |
845 | 821 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
846 | 822 | $context['finished'] = 1; |
847 | - } |
|
848 | - else { |
|
823 | + } else { |
|
849 | 824 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
850 | 825 | } |
851 | 826 | } |
@@ -868,8 +843,7 @@ discard block |
||
868 | 843 | // Set the team import successful flag in the variable table |
869 | 844 | variable_set('boincimport_import_team_successful', '1'); |
870 | 845 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
871 | - } |
|
872 | - else { |
|
846 | + } else { |
|
873 | 847 | // An error occurred. |
874 | 848 | // $operations contains the operations that remained unprocessed. |
875 | 849 | $error_operation = reset($operations); |
@@ -990,8 +964,7 @@ discard block |
||
990 | 964 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
991 | 965 | $uid, $friend_uid, $friendship->create_time |
992 | 966 | ); |
993 | - } |
|
994 | - else { |
|
967 | + } else { |
|
995 | 968 | $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src; |
996 | 969 | $message = "No Drupal account exists for BOINC user {$boinc_id}!"; |
997 | 970 | } |
@@ -1000,8 +973,7 @@ discard block |
||
1000 | 973 | // Store some result for post-processing in the finished callback. |
1001 | 974 | $context['results']['success'][] = $uid; |
1002 | 975 | $message = "Successfully made users {$uid} and {$friend_uid} friends"; |
1003 | - } |
|
1004 | - else { |
|
976 | + } else { |
|
1005 | 977 | $context['results']['failure'][] = $uid; |
1006 | 978 | if (!$message) { |
1007 | 979 | $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
@@ -1017,8 +989,7 @@ discard block |
||
1017 | 989 | // Update the progress for the batch engine |
1018 | 990 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1019 | 991 | $context['finished'] = 1; |
1020 | - } |
|
1021 | - else { |
|
992 | + } else { |
|
1022 | 993 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1023 | 994 | } |
1024 | 995 | } |
@@ -1042,8 +1013,7 @@ discard block |
||
1042 | 1013 | // Set the friend import successful flag in the variable table |
1043 | 1014 | variable_set('boincimport_import_friend_successful', '1'); |
1044 | 1015 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
1045 | - } |
|
1046 | - else { |
|
1016 | + } else { |
|
1047 | 1017 | // An error occurred. |
1048 | 1018 | // $operations contains the operations that remained unprocessed. |
1049 | 1019 | $error_operation = reset($operations); |
@@ -1167,8 +1137,7 @@ discard block |
||
1167 | 1137 | ); |
1168 | 1138 | if ($user_ignored) { |
1169 | 1139 | $success = TRUE; |
1170 | - } |
|
1171 | - else { |
|
1140 | + } else { |
|
1172 | 1141 | $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
1173 | 1142 | watchdog('boincimport', |
1174 | 1143 | 'Could not add user @ignored_uid to the ignore list of user @uid', |
@@ -1183,8 +1152,7 @@ discard block |
||
1183 | 1152 | // Store some result for post-processing in the finished callback. |
1184 | 1153 | $context['results']['success'][] = $uid; |
1185 | 1154 | $message = "Successfully imported ignored users for user {$uid}"; |
1186 | - } |
|
1187 | - else { |
|
1155 | + } else { |
|
1188 | 1156 | $context['results']['failure'][] = $uid; |
1189 | 1157 | $message = "Failed to import any user filter preferences for user {$uid}!"; |
1190 | 1158 | watchdog('boincimport', |
@@ -1201,8 +1169,7 @@ discard block |
||
1201 | 1169 | // Update the progress for the batch engine |
1202 | 1170 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1203 | 1171 | $context['finished'] = 1; |
1204 | - } |
|
1205 | - else { |
|
1172 | + } else { |
|
1206 | 1173 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1207 | 1174 | } |
1208 | 1175 | } |
@@ -1227,8 +1194,7 @@ discard block |
||
1227 | 1194 | // Set the preference import successful flag in the variable table |
1228 | 1195 | variable_set('boincimport_import_preferences_successful', '1'); |
1229 | 1196 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
1230 | - } |
|
1231 | - else { |
|
1197 | + } else { |
|
1232 | 1198 | // An error occurred. |
1233 | 1199 | // $operations contains the operations that remained unprocessed. |
1234 | 1200 | $error_operation = reset($operations); |
@@ -1362,8 +1328,7 @@ discard block |
||
1362 | 1328 | // Store some result for post-processing in the finished callback. |
1363 | 1329 | $context['results']['success'][] = $pm->id; |
1364 | 1330 | $message = "Successfully imported private message {$pm->id}"; |
1365 | - } |
|
1366 | - else { |
|
1331 | + } else { |
|
1367 | 1332 | $context['results']['failure'][] = $pm->id; |
1368 | 1333 | $message = "Failed to import private message {$pm->id}!"; |
1369 | 1334 | watchdog('boincimport', |
@@ -1380,8 +1345,7 @@ discard block |
||
1380 | 1345 | // Update the progress for the batch engine |
1381 | 1346 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1382 | 1347 | $context['finished'] = 1; |
1383 | - } |
|
1384 | - else { |
|
1348 | + } else { |
|
1385 | 1349 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1386 | 1350 | } |
1387 | 1351 | } |
@@ -1404,8 +1368,7 @@ discard block |
||
1404 | 1368 | // Set the private message import successful flag in the variable table |
1405 | 1369 | variable_set('boincimport_import_private_msg_successful', '1'); |
1406 | 1370 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
1407 | - } |
|
1408 | - else { |
|
1371 | + } else { |
|
1409 | 1372 | // An error occurred. |
1410 | 1373 | // $operations contains the operations that remained unprocessed. |
1411 | 1374 | $error_operation = reset($operations); |
@@ -1558,8 +1521,7 @@ discard block |
||
1558 | 1521 | if (in_array($boinc_forum_category->name, $existing_categories)) { |
1559 | 1522 | // This category has already been imported |
1560 | 1523 | $duplicate_categories[] = $boinc_forum_category->name; |
1561 | - } |
|
1562 | - else { |
|
1524 | + } else { |
|
1563 | 1525 | $operations[] = array( |
1564 | 1526 | 'boincimport_forum_categories_op', array( |
1565 | 1527 | $boinc_forum_category, $forum_vid, $pre, FALSE |
@@ -1573,8 +1535,7 @@ discard block |
||
1573 | 1535 | if (isset($existing_forums[$boinc_forum->id])) { |
1574 | 1536 | // This forum has already been imported |
1575 | 1537 | $duplicates[] = $boinc_forum->id; |
1576 | - } |
|
1577 | - else { |
|
1538 | + } else { |
|
1578 | 1539 | $operations[] = array( |
1579 | 1540 | 'boincimport_forums_op', array( |
1580 | 1541 | $boinc_forum, $forum_vid, $pre |
@@ -1641,8 +1602,7 @@ discard block |
||
1641 | 1602 | $category->name = 'Hidden'; |
1642 | 1603 | $category->id = 0; |
1643 | 1604 | $hidden = TRUE; |
1644 | - } |
|
1645 | - else { |
|
1605 | + } else { |
|
1646 | 1606 | // If this container is empty, put it into the hidden container |
1647 | 1607 | db_set_active('boinc_rw'); |
1648 | 1608 | $forums_contained = db_result(db_query(' |
@@ -1685,13 +1645,11 @@ discard block |
||
1685 | 1645 | // Store some result for post-processing in the finished callback. |
1686 | 1646 | if (!$category AND $create_hidden) { |
1687 | 1647 | $message = "Created special hidden container"; |
1688 | - } |
|
1689 | - else { |
|
1648 | + } else { |
|
1690 | 1649 | $context['results']['categories']['success'][] = $category->id; |
1691 | 1650 | $message = "Successfully imported container {$category->id}"; |
1692 | 1651 | } |
1693 | - } |
|
1694 | - else { |
|
1652 | + } else { |
|
1695 | 1653 | $context['results']['categories']['failure'][] = $category->id; |
1696 | 1654 | $message = "Failed to import container {$category->id}!"; |
1697 | 1655 | watchdog('boincimport', |
@@ -1708,8 +1666,7 @@ discard block |
||
1708 | 1666 | // Update the progress for the batch engine |
1709 | 1667 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1710 | 1668 | $context['finished'] = 1; |
1711 | - } |
|
1712 | - else { |
|
1669 | + } else { |
|
1713 | 1670 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1714 | 1671 | } |
1715 | 1672 | } |
@@ -1745,8 +1702,7 @@ discard block |
||
1745 | 1702 | // Save the ID of the News forum for later import |
1746 | 1703 | variable_set('boincimport_news_forum_id', $forum_id); |
1747 | 1704 | $success = TRUE; |
1748 | - } |
|
1749 | - else { |
|
1705 | + } else { |
|
1750 | 1706 | // Save all other forums as taxonomy terms |
1751 | 1707 | $forum = array( |
1752 | 1708 | 'name' => $name, |
@@ -1772,8 +1728,7 @@ discard block |
||
1772 | 1728 | // Store some result for post-processing in the finished callback. |
1773 | 1729 | $context['results']['forums']['success'][] = $forum_id; |
1774 | 1730 | $message = "Successfully imported forum {$forum_id}"; |
1775 | - } |
|
1776 | - else { |
|
1731 | + } else { |
|
1777 | 1732 | $context['results']['forums']['failure'][] = $forum_id; |
1778 | 1733 | $message = "Failed to import forum {$forum_id}!"; |
1779 | 1734 | } |
@@ -1786,8 +1741,7 @@ discard block |
||
1786 | 1741 | // Update the progress for the batch engine |
1787 | 1742 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
1788 | 1743 | $context['finished'] = 1; |
1789 | - } |
|
1790 | - else { |
|
1744 | + } else { |
|
1791 | 1745 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
1792 | 1746 | } |
1793 | 1747 | } |
@@ -1888,8 +1842,7 @@ discard block |
||
1888 | 1842 | // Set the forum import successful flag in the variable table |
1889 | 1843 | variable_set('boincimport_import_forum_successful', '1'); |
1890 | 1844 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
1891 | - } |
|
1892 | - else { |
|
1845 | + } else { |
|
1893 | 1846 | // An error occurred. |
1894 | 1847 | // $operations contains the operations that remained unprocessed. |
1895 | 1848 | $error_operation = reset($operations); |
@@ -2043,9 +1996,7 @@ discard block |
||
2043 | 1996 | |
2044 | 1997 | if ($duplicate OR !$post) { |
2045 | 1998 | $success = FALSE; |
2046 | - } |
|
2047 | - |
|
2048 | - else { |
|
1999 | + } else { |
|
2049 | 2000 | // Get the user and term IDs along with other data to define the topic |
2050 | 2001 | $uid = boincuser_lookup_uid($topic->owner); |
2051 | 2002 | $tid = db_result(db_query(' |
@@ -2109,12 +2060,10 @@ discard block |
||
2109 | 2060 | if (!$success) { |
2110 | 2061 | $error_detail = 'topic imported, but failed to set last comment timestamp'; |
2111 | 2062 | } |
2112 | - } |
|
2113 | - else { |
|
2063 | + } else { |
|
2114 | 2064 | $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
2115 | 2065 | } |
2116 | - } |
|
2117 | - else { |
|
2066 | + } else { |
|
2118 | 2067 | $error_detail = 'failed to save topic node to database'; |
2119 | 2068 | } |
2120 | 2069 | } |
@@ -2125,16 +2074,13 @@ discard block |
||
2125 | 2074 | // Store some result for post-processing in the finished callback. |
2126 | 2075 | $context['results']['success'][] = $topic->id; |
2127 | 2076 | $message = "Successfully imported topic {$topic->id}"; |
2128 | - } |
|
2129 | - elseif ($duplicate) { |
|
2077 | + } elseif ($duplicate) { |
|
2130 | 2078 | $context['results']['duplicate'][] = $topic->id; |
2131 | 2079 | $message = "Topic {$topic->id} was already imported"; |
2132 | - } |
|
2133 | - elseif (!$post) { |
|
2080 | + } elseif (!$post) { |
|
2134 | 2081 | $context['results']['empty'][] = $topic->id; |
2135 | 2082 | $message = "Skipping topic {$topic->id} as empty"; |
2136 | - } |
|
2137 | - else { |
|
2083 | + } else { |
|
2138 | 2084 | $context['results']['failure'][] = $topic->id; |
2139 | 2085 | $message = "Failed to import topic {$topic->id}!"; |
2140 | 2086 | watchdog('boincimport', |
@@ -2155,8 +2101,7 @@ discard block |
||
2155 | 2101 | // Update the progress for the batch engine |
2156 | 2102 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2157 | 2103 | $context['finished'] = 1; |
2158 | - } |
|
2159 | - else { |
|
2104 | + } else { |
|
2160 | 2105 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2161 | 2106 | } |
2162 | 2107 | } |
@@ -2190,8 +2135,7 @@ discard block |
||
2190 | 2135 | // Set the topic import successful flag in the variable table |
2191 | 2136 | variable_set('boincimport_import_topic_successful', '1'); |
2192 | 2137 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
2193 | - } |
|
2194 | - else { |
|
2138 | + } else { |
|
2195 | 2139 | // An error occurred. |
2196 | 2140 | // $operations contains the operations that remained unprocessed. |
2197 | 2141 | $error_operation = reset($operations); |
@@ -2439,18 +2383,15 @@ discard block |
||
2439 | 2383 | if ($success) { |
2440 | 2384 | $posts_imported++; |
2441 | 2385 | $context['results']['posts']['success'][] = $post->id; |
2442 | - } |
|
2443 | - else { |
|
2386 | + } else { |
|
2444 | 2387 | $context['results']['posts']['failure'][] = $post->id; |
2445 | 2388 | $error_posts++; |
2446 | 2389 | } |
2447 | - } |
|
2448 | - else { |
|
2390 | + } else { |
|
2449 | 2391 | $context['results']['posts']['failure'][] = $post->id; |
2450 | 2392 | $error_posts++; |
2451 | 2393 | } |
2452 | - } |
|
2453 | - else { |
|
2394 | + } else { |
|
2454 | 2395 | $context['results']['posts']['empty'][] = $post->id; |
2455 | 2396 | $empty_posts++; |
2456 | 2397 | } |
@@ -2461,8 +2402,7 @@ discard block |
||
2461 | 2402 | // Store some result for post-processing in the finished callback. |
2462 | 2403 | $context['results']['success'][] = $boinc_topic->id; |
2463 | 2404 | $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
2464 | - } |
|
2465 | - else { |
|
2405 | + } else { |
|
2466 | 2406 | $context['results']['failure'][] = $boinc_topic->id; |
2467 | 2407 | $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
2468 | 2408 | watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
@@ -2483,8 +2423,7 @@ discard block |
||
2483 | 2423 | // Update the progress for the batch engine |
2484 | 2424 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2485 | 2425 | $context['finished'] = 1; |
2486 | - } |
|
2487 | - else { |
|
2426 | + } else { |
|
2488 | 2427 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2489 | 2428 | } |
2490 | 2429 | } |
@@ -2524,8 +2463,7 @@ discard block |
||
2524 | 2463 | // Set the post import successful flag in the variable table |
2525 | 2464 | variable_set('boincimport_import_post_successful', '1'); |
2526 | 2465 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
2527 | - } |
|
2528 | - else { |
|
2466 | + } else { |
|
2529 | 2467 | // An error occurred. |
2530 | 2468 | // $operations contains the operations that remained unprocessed. |
2531 | 2469 | $error_operation = reset($operations); |
@@ -2612,8 +2550,7 @@ discard block |
||
2612 | 2550 | if (isset($existing_team_forums[$boincteam_forum->id])) { |
2613 | 2551 | // This team has already been imported |
2614 | 2552 | $duplicates[] = $boincteam_forum->id; |
2615 | - } |
|
2616 | - else { |
|
2553 | + } else { |
|
2617 | 2554 | $operations[] = array( |
2618 | 2555 | 'boincimport_team_forums_op', array( |
2619 | 2556 | $boincteam_forum |
@@ -2679,8 +2616,7 @@ discard block |
||
2679 | 2616 | // Store some result for post-processing in the finished callback. |
2680 | 2617 | $context['results']['success'][] = $forum_id; |
2681 | 2618 | $message = "Successfully imported team forum {$forum_id}"; |
2682 | - } |
|
2683 | - else { |
|
2619 | + } else { |
|
2684 | 2620 | $context['results']['failure'][] = $forum_id; |
2685 | 2621 | $message = "Failed to import team forum {$forum_id}!"; |
2686 | 2622 | watchdog('boincimport', |
@@ -2697,8 +2633,7 @@ discard block |
||
2697 | 2633 | // Update the progress for the batch engine |
2698 | 2634 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2699 | 2635 | $context['finished'] = 1; |
2700 | - } |
|
2701 | - else { |
|
2636 | + } else { |
|
2702 | 2637 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2703 | 2638 | } |
2704 | 2639 | } |
@@ -2721,8 +2656,7 @@ discard block |
||
2721 | 2656 | // Set the team forum import successful flag in the variable table |
2722 | 2657 | variable_set('boincimport_import_team_forum_successful', '1'); |
2723 | 2658 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
2724 | - } |
|
2725 | - else { |
|
2659 | + } else { |
|
2726 | 2660 | // An error occurred. |
2727 | 2661 | // $operations contains the operations that remained unprocessed. |
2728 | 2662 | $error_operation = reset($operations); |
@@ -2817,8 +2751,7 @@ discard block |
||
2817 | 2751 | if (isset($existing_team_topics[$boincteam_topic->id])) { |
2818 | 2752 | // This team topic has already been imported |
2819 | 2753 | $duplicates[] = $boincteam_topic->id; |
2820 | - } |
|
2821 | - else { |
|
2754 | + } else { |
|
2822 | 2755 | $operations[] = array( |
2823 | 2756 | 'boincimport_team_topics_op', array( |
2824 | 2757 | $boincteam_topic |
@@ -2865,8 +2798,7 @@ discard block |
||
2865 | 2798 | )); |
2866 | 2799 | if (!$team_forum_id) { |
2867 | 2800 | $missing_parent[] = $topic->id; |
2868 | - } |
|
2869 | - else { |
|
2801 | + } else { |
|
2870 | 2802 | // Get the content of the post that started the topic |
2871 | 2803 | db_set_active('boinc_rw'); |
2872 | 2804 | $query = db_query(' |
@@ -2883,8 +2815,7 @@ discard block |
||
2883 | 2815 | // Empty topics should have already been filtered out of the import, so |
2884 | 2816 | // consider this an error condition |
2885 | 2817 | $empty_topics[] = $topic->id; |
2886 | - } |
|
2887 | - else { |
|
2818 | + } else { |
|
2888 | 2819 | // Get the user ID along with other data to define the topic |
2889 | 2820 | $uid = boincuser_lookup_uid($topic->owner); |
2890 | 2821 | if (!$topic->owner) { |
@@ -2948,8 +2879,7 @@ discard block |
||
2948 | 2879 | // Store some result for post-processing in the finished callback. |
2949 | 2880 | $context['results']['success'][] = $topic->id; |
2950 | 2881 | $message = "Successfully imported team topic {$topic->id}"; |
2951 | - } |
|
2952 | - else { |
|
2882 | + } else { |
|
2953 | 2883 | $context['results']['failure'][] = $topic->id; |
2954 | 2884 | $message = "Failed to import team topic {$topic->id}!"; |
2955 | 2885 | watchdog('boincimport', |
@@ -2966,8 +2896,7 @@ discard block |
||
2966 | 2896 | // Update the progress for the batch engine |
2967 | 2897 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
2968 | 2898 | $context['finished'] = 1; |
2969 | - } |
|
2970 | - else { |
|
2899 | + } else { |
|
2971 | 2900 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
2972 | 2901 | } |
2973 | 2902 | } |
@@ -2990,8 +2919,7 @@ discard block |
||
2990 | 2919 | // Set the BLAH import successful flag in the variable table |
2991 | 2920 | variable_set('boincimport_import_team_topic_successful', '1'); |
2992 | 2921 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
2993 | - } |
|
2994 | - else { |
|
2922 | + } else { |
|
2995 | 2923 | // An error occurred. |
2996 | 2924 | // $operations contains the operations that remained unprocessed. |
2997 | 2925 | $error_operation = reset($operations); |
@@ -3113,8 +3041,7 @@ discard block |
||
3113 | 3041 | if (isset($existing_posts[$boincteam_post->id])) { |
3114 | 3042 | // This post has already been imported |
3115 | 3043 | $duplicates[] = $boincteam_post->id; |
3116 | - } |
|
3117 | - else { |
|
3044 | + } else { |
|
3118 | 3045 | $operations[] = array( |
3119 | 3046 | 'boincimport_team_posts_op', array( |
3120 | 3047 | $boincteam_post |
@@ -3230,8 +3157,7 @@ discard block |
||
3230 | 3157 | // Store some result for post-processing in the finished callback. |
3231 | 3158 | $context['results']['success'][] = $post->id; |
3232 | 3159 | $message = "Successfully imported team post {$post->id}"; |
3233 | - } |
|
3234 | - else { |
|
3160 | + } else { |
|
3235 | 3161 | $context['results']['failure'][] = $post->id; |
3236 | 3162 | $message = "Failed to import team post {$post->id}!"; |
3237 | 3163 | watchdog('boincimport', |
@@ -3248,8 +3174,7 @@ discard block |
||
3248 | 3174 | // Update the progress for the batch engine |
3249 | 3175 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3250 | 3176 | $context['finished'] = 1; |
3251 | - } |
|
3252 | - else { |
|
3177 | + } else { |
|
3253 | 3178 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3254 | 3179 | } |
3255 | 3180 | } |
@@ -3272,8 +3197,7 @@ discard block |
||
3272 | 3197 | // Set the team post import successful flag in the variable table |
3273 | 3198 | variable_set('boincimport_import_team_post_successful', '1'); |
3274 | 3199 | $_SESSION['boincimport_stage_selected'] = 'url'; |
3275 | - } |
|
3276 | - else { |
|
3200 | + } else { |
|
3277 | 3201 | // An error occurred. |
3278 | 3202 | // $operations contains the operations that remained unprocessed. |
3279 | 3203 | $error_operation = reset($operations); |
@@ -3379,8 +3303,7 @@ discard block |
||
3379 | 3303 | $context['results']['success'][] = $boincuser_id; |
3380 | 3304 | $context['results']['subscriptions'][$boincuser_id] = $count; |
3381 | 3305 | $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}"; |
3382 | - } |
|
3383 | - else { |
|
3306 | + } else { |
|
3384 | 3307 | $context['results']['failure'][] = $boincuser_id; |
3385 | 3308 | $message = "Failed to import subscriptions for user {$boincuser_id}!"; |
3386 | 3309 | watchdog('boincimport', |
@@ -3397,8 +3320,7 @@ discard block |
||
3397 | 3320 | // Update the progress for the batch engine |
3398 | 3321 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3399 | 3322 | $context['finished'] = 1; |
3400 | - } |
|
3401 | - else { |
|
3323 | + } else { |
|
3402 | 3324 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3403 | 3325 | } |
3404 | 3326 | } |
@@ -3423,8 +3345,7 @@ discard block |
||
3423 | 3345 | // Set the subscription import successful flag in the variable table |
3424 | 3346 | variable_set('boincimport_import_subscription_successful', '1'); |
3425 | 3347 | $_SESSION['boincimport_stage_selected'] = 'url'; |
3426 | - } |
|
3427 | - else { |
|
3348 | + } else { |
|
3428 | 3349 | // An error occurred. |
3429 | 3350 | // $operations contains the operations that remained unprocessed. |
3430 | 3351 | $error_operation = reset($operations); |
@@ -3602,8 +3523,7 @@ discard block |
||
3602 | 3523 | // Store some result for post-processing in the finished callback. |
3603 | 3524 | $context['results']['nodes']['updated'][] = $node->nid; |
3604 | 3525 | $message = "Successfully updated node {$node->nid}"; |
3605 | - } |
|
3606 | - else { |
|
3526 | + } else { |
|
3607 | 3527 | $message = "No changes made to node {$node->nid}!"; |
3608 | 3528 | } |
3609 | 3529 | |
@@ -3615,8 +3535,7 @@ discard block |
||
3615 | 3535 | // Update the progress for the batch engine |
3616 | 3536 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3617 | 3537 | $context['finished'] = 1; |
3618 | - } |
|
3619 | - else { |
|
3538 | + } else { |
|
3620 | 3539 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3621 | 3540 | } |
3622 | 3541 | } |
@@ -3666,8 +3585,7 @@ discard block |
||
3666 | 3585 | // Store some result for post-processing in the finished callback. |
3667 | 3586 | $context['results']['comments']['updated'][] = $comment->cid; |
3668 | 3587 | $message = "Successfully updated comment {$comment->cid}"; |
3669 | - } |
|
3670 | - else { |
|
3588 | + } else { |
|
3671 | 3589 | $message = "No changes made to comment {$comment->cid}!"; |
3672 | 3590 | } |
3673 | 3591 | |
@@ -3679,8 +3597,7 @@ discard block |
||
3679 | 3597 | // Update the progress for the batch engine |
3680 | 3598 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3681 | 3599 | $context['finished'] = 1; |
3682 | - } |
|
3683 | - else { |
|
3600 | + } else { |
|
3684 | 3601 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3685 | 3602 | } |
3686 | 3603 | } |
@@ -3729,8 +3646,7 @@ discard block |
||
3729 | 3646 | // Store some result for post-processing in the finished callback. |
3730 | 3647 | $context['results']['pm']['updated'][] = $pm->mid; |
3731 | 3648 | $message = "Successfully updated private message {$pm->mid}"; |
3732 | - } |
|
3733 | - else { |
|
3649 | + } else { |
|
3734 | 3650 | $message = "No changes made to private message {$pm->mid}!"; |
3735 | 3651 | } |
3736 | 3652 | |
@@ -3742,8 +3658,7 @@ discard block |
||
3742 | 3658 | // Update the progress for the batch engine |
3743 | 3659 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
3744 | 3660 | $context['finished'] = 1; |
3745 | - } |
|
3746 | - else { |
|
3661 | + } else { |
|
3747 | 3662 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
3748 | 3663 | } |
3749 | 3664 | } |
@@ -3808,8 +3723,7 @@ discard block |
||
3808 | 3723 | // Set the replace URLs successful flag in the variable table |
3809 | 3724 | variable_set('boincimport_replace_urls_successful', '1'); |
3810 | 3725 | $_SESSION['boincimport_stage_selected'] = 'users'; |
3811 | - } |
|
3812 | - else { |
|
3726 | + } else { |
|
3813 | 3727 | // An error occurred. |
3814 | 3728 | // $operations contains the operations that remained unprocessed. |
3815 | 3729 | $error_operation = reset($operations); |
@@ -3911,7 +3825,8 @@ discard block |
||
3911 | 3825 | $score = 0; // 0 default value, comments get higher score depending on the author's roles |
3912 | 3826 | $users = serialize(array(0 => 1)); // default value for everybody!! |
3913 | 3827 | |
3914 | - if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
|
3828 | + if ($edit['uid'] === $user->uid) { |
|
3829 | +// '===' because we want to modify anonymous users too |
|
3915 | 3830 | $edit['name'] = $user->name; |
3916 | 3831 | } |
3917 | 3832 | |
@@ -4034,13 +3949,11 @@ discard block |
||
4034 | 3949 | if (isset($this->boincDomains[$domain])) { |
4035 | 3950 | // This is a URL configured to be transformed |
4036 | 3951 | return "{$http}://{$this->drupalDomain}{$this->basePath}"; |
4037 | - } |
|
4038 | - else { |
|
3952 | + } else { |
|
4039 | 3953 | // This URL should not be transformed |
4040 | 3954 | return NULL; |
4041 | 3955 | } |
4042 | - } |
|
4043 | - else { |
|
3956 | + } else { |
|
4044 | 3957 | // This is a relative URL |
4045 | 3958 | return $this->basePath; |
4046 | 3959 | } |
@@ -4062,8 +3975,7 @@ discard block |
||
4062 | 3975 | )); |
4063 | 3976 | if ($id) { |
4064 | 3977 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
4065 | - } |
|
4066 | - else { |
|
3978 | + } else { |
|
4067 | 3979 | // This post is not in the post import table, so it's probably a topic |
4068 | 3980 | $link = $this->transformTopicLinks($matches); |
4069 | 3981 | } |
@@ -4087,8 +3999,7 @@ discard block |
||
4087 | 3999 | )); |
4088 | 4000 | if ($id) { |
4089 | 4001 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
4090 | - } |
|
4091 | - else { |
|
4002 | + } else { |
|
4092 | 4003 | // This post is not in the post import table, so it's probably a topic |
4093 | 4004 | $link = $this->transformTopicLinks($matches); |
4094 | 4005 | } |
@@ -280,8 +280,7 @@ discard block |
||
280 | 280 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
281 | 281 | 'query' => 'destination=messages/view/' . $thread_id, |
282 | 282 | ); |
283 | - } |
|
284 | - else { |
|
283 | + } else { |
|
285 | 284 | $vars['message_actions']['ignore_user'] = array( |
286 | 285 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
287 | 286 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
@@ -400,8 +399,7 @@ discard block |
||
400 | 399 | } |
401 | 400 | if (!$special) { |
402 | 401 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
403 | - } |
|
404 | - else { |
|
402 | + } else { |
|
405 | 403 | // The "very special" case where we merge two prefs |
406 | 404 | $second_pref = $special_map[$name]; |
407 | 405 | $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
@@ -409,8 +407,7 @@ discard block |
||
409 | 407 | $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
410 | 408 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
411 | 409 | } |
412 | - } |
|
413 | - else { |
|
410 | + } else { |
|
414 | 411 | $output .= '<td>---</td>'; |
415 | 412 | } |
416 | 413 | } |
@@ -936,22 +933,19 @@ discard block |
||
936 | 933 | drupal_set_message(t('Host @id has been removed from your account.', |
937 | 934 | array('@id' => $host_id))); |
938 | 935 | drupal_goto('account/computers'); |
939 | - } |
|
940 | - else { |
|
936 | + } else { |
|
941 | 937 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
942 | 938 | array('@id' => $host_id)), 'error' |
943 | 939 | ); |
944 | 940 | } |
945 | - } |
|
946 | - else { |
|
941 | + } else { |
|
947 | 942 | drupal_set_message(t('Host @id cannot be deleted because it still has |
948 | 943 | tasks associated with it. These tasks should be processed within the |
949 | 944 | next few days, after which the host can be deleted.', |
950 | 945 | array('@id' => $host_id)), 'warning' |
951 | 946 | ); |
952 | 947 | } |
953 | - } |
|
954 | - else { |
|
948 | + } else { |
|
955 | 949 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
956 | 950 | delete it.', |
957 | 951 | array('@id' => $host_id)), 'error' |
@@ -999,15 +993,13 @@ discard block |
||
999 | 993 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
1000 | 994 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
1001 | 995 | ); |
1002 | - } |
|
1003 | - else { |
|
996 | + } else { |
|
1004 | 997 | drupal_set_message( |
1005 | 998 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
1006 | 999 | 'error' |
1007 | 1000 | ); |
1008 | 1001 | } |
1009 | - } |
|
1010 | - else { |
|
1002 | + } else { |
|
1011 | 1003 | drupal_set_message( |
1012 | 1004 | bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
1013 | 1005 | 'warning' |
@@ -1164,8 +1156,7 @@ discard block |
||
1164 | 1156 | $venue = $active_venue; |
1165 | 1157 | //unset($_SESSION['prefs venue']); |
1166 | 1158 | } |
1167 | - } |
|
1168 | - else { |
|
1159 | + } else { |
|
1169 | 1160 | // Set the active venue to keep it selected between computing and project |
1170 | 1161 | // preference pages |
1171 | 1162 | $_SESSION['prefs venue'] = $venue; |
@@ -258,8 +258,7 @@ discard block |
||
258 | 258 | ), WATCHDOG_NOTICE |
259 | 259 | ); |
260 | 260 | } |
261 | - } |
|
262 | - else { |
|
261 | + } else { |
|
263 | 262 | drupal_set_message(t('You are not allowed to assume foundership of this |
264 | 263 | team.' |
265 | 264 | )); |
@@ -284,8 +283,7 @@ discard block |
||
284 | 283 | drupal_set_message(t('@team has been removed.', |
285 | 284 | array('@team' => $boincteam->name))); |
286 | 285 | drupal_goto('community/teams'); |
287 | - } |
|
288 | - else { |
|
286 | + } else { |
|
289 | 287 | drupal_set_message(t('All members must be removed from @team before the |
290 | 288 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
291 | 289 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
@@ -519,8 +517,7 @@ discard block |
||
519 | 517 | array('@team' => $boincteam->name))); |
520 | 518 | watchdog('boincteam', 'added user @uid to team @nid', |
521 | 519 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
522 | - } |
|
523 | - else { |
|
520 | + } else { |
|
524 | 521 | // @todo - consider another rule/error event here |
525 | 522 | drupal_set_message(t('There was a problem joining @team, please try again |
526 | 523 | later', array('@team' => $boincteam->name))); |
@@ -548,8 +545,7 @@ discard block |
||
548 | 545 | array('@team' => $boincteam->name))); |
549 | 546 | watchdog('boincteam', 'removed user @uid from team @nid', |
550 | 547 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
551 | - } |
|
552 | - else { |
|
548 | + } else { |
|
553 | 549 | drupal_set_message(t('You are not a member of @team, so you cannot revoke |
554 | 550 | your membership to it.', array('@team' => $boincteam->name))); |
555 | 551 | } |
@@ -618,8 +614,7 @@ discard block |
||
618 | 614 | '@uid' => $account->uid, |
619 | 615 | '@nid' => $team_id |
620 | 616 | ), WATCHDOG_NOTICE); |
621 | - } |
|
622 | - else { |
|
617 | + } else { |
|
623 | 618 | drupal_set_message(t('@user is not a member of @team, so you cannot |
624 | 619 | revoke the membership.', array( |
625 | 620 | '@user' => $account->boincuser_name, |
@@ -648,14 +643,12 @@ discard block |
||
648 | 643 | '@user' => $account->boincuser_name |
649 | 644 | ) |
650 | 645 | ), 'warning'); |
651 | - } |
|
652 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
646 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
653 | 647 | // It hasn't been long enough since the last transfer request |
654 | 648 | drupal_set_message(t('A foundership change was requested during the last 90 |
655 | 649 | days, so new requests are not allowed. Please try again later.' |
656 | 650 | ), 'warning'); |
657 | - } |
|
658 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
651 | + } elseif (boincteam_is_member($team_id, $account->uid)) { |
|
659 | 652 | // Log the transfer request |
660 | 653 | db_set_active('boinc_rw'); |
661 | 654 | db_query(" |
@@ -861,8 +854,7 @@ discard block |
||
861 | 854 | $output .= '['; |
862 | 855 | if ($credit_needed == 1) { |
863 | 856 | $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
864 | - } |
|
865 | - else { |
|
857 | + } else { |
|
866 | 858 | $output .= bts('You must earn @count more credits!', |
867 | 859 | array('@count' => $credit_needed), |
868 | 860 | NULL, 'boinc:create-team-panel' |
@@ -915,8 +907,7 @@ discard block |
||
915 | 907 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
916 | 908 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
917 | 909 | $output .= '</div>' . "\n"; |
918 | - } |
|
919 | - else if ($user->uid == $account->uid) { |
|
910 | + } else if ($user->uid == $account->uid) { |
|
920 | 911 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
921 | 912 | $output .= '<ul class="tab-list action-list">'; |
922 | 913 | $output .= '<li class="tab primary">'; |
@@ -1123,8 +1114,7 @@ discard block |
||
1123 | 1114 | if ($request_age == 1) { |
1124 | 1115 | $output .= bts('1 day has elapsed since your request and' |
1125 | 1116 | . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
1126 | - } |
|
1127 | - else { |
|
1117 | + } else { |
|
1128 | 1118 | $output .= bts('@count days have elapsed since your request and' |
1129 | 1119 | . ' the founder has not responded.', |
1130 | 1120 | array('@count' => $request_age), |
@@ -1134,8 +1124,7 @@ discard block |
||
1134 | 1124 | if ($days_to_respond == 1) { |
1135 | 1125 | $output .= bts('You now have 1 day to assume foundership before' |
1136 | 1126 | . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
1137 | - } |
|
1138 | - else { |
|
1127 | + } else { |
|
1139 | 1128 | $output .= bts('You now have @count days to assume foundership before' |
1140 | 1129 | . ' another team member may submit a request.', |
1141 | 1130 | array('@count' => $days_to_respond), |
@@ -1146,23 +1135,20 @@ discard block |
||
1146 | 1135 | $output .= ' <li class="first last tab">' . |
1147 | 1136 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1148 | 1137 | $output .= '</ul>'; |
1149 | - } |
|
1150 | - else { |
|
1138 | + } else { |
|
1151 | 1139 | $output .= '<p>'; |
1152 | 1140 | if ($days_to_deadline == 1) { |
1153 | 1141 | $output .= bts('The team founder has 1 day to respond to your' |
1154 | 1142 | . ' transfer request.', |
1155 | 1143 | NULL, 'boinc:team-request-foundership'); |
1156 | - } |
|
1157 | - else { |
|
1144 | + } else { |
|
1158 | 1145 | $output .= bts('The team founder has @count days to respond to your' |
1159 | 1146 | . ' transfer request.', array('@count' => $days_to_deadline), |
1160 | 1147 | NULL, 'boinc:team-request-foundership'); |
1161 | 1148 | } |
1162 | 1149 | $output .= '</p>'; |
1163 | 1150 | } |
1164 | - } |
|
1165 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1151 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1166 | 1152 | // If this user does not have a transfer request pending, but new requests |
1167 | 1153 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1168 | 1154 | // who made the request has 30 additional days to assume foundership if |
@@ -1175,15 +1161,13 @@ discard block |
||
1175 | 1161 | NULL, 'boinc:team-request-foundership'); |
1176 | 1162 | if ($days_to_deadline == 1) { |
1177 | 1163 | $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
1178 | - } |
|
1179 | - else { |
|
1164 | + } else { |
|
1180 | 1165 | $output .= ' (' . bts('@count days remaining', |
1181 | 1166 | array('@count' => $days_to_deadline), |
1182 | 1167 | NULL, 'boinc:team-request-foundership') . ')'; |
1183 | 1168 | } |
1184 | 1169 | $output .= '</p>'; |
1185 | - } |
|
1186 | - else { |
|
1170 | + } else { |
|
1187 | 1171 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1188 | 1172 | . ' assume the role of founder, click below to request foundership of' |
1189 | 1173 | . ' @this_team.', |
@@ -1229,8 +1213,7 @@ discard block |
||
1229 | 1213 | $boincteam_id |
1230 | 1214 | ); |
1231 | 1215 | db_set_active('default'); |
1232 | - } |
|
1233 | - else { |
|
1216 | + } else { |
|
1234 | 1217 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1235 | 1218 | $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
1236 | 1219 | . '</h2>'; |