@@ -130,8 +130,7 @@ discard block |
||
| 130 | 130 | AND strpos($link, 'Edit Panel')) { |
| 131 | 131 | // Remove Edit Panel tab |
| 132 | 132 | return ''; |
| 133 | - } |
|
| 134 | - else { |
|
| 133 | + } else { |
|
| 135 | 134 | return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
| 136 | 135 | } |
| 137 | 136 | } |
@@ -218,17 +217,13 @@ discard block |
||
| 218 | 217 | // See: https://dev.gridrepublic.org/browse/DBOINC-65 |
| 219 | 218 | if (arg(0) == 'search') { |
| 220 | 219 | unset($vars['title']); |
| 221 | - } |
|
| 222 | - else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 220 | + } else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 223 | 221 | unset($vars['title']); |
| 224 | - } |
|
| 225 | - else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 222 | + } else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 226 | 223 | unset($vars['title']); |
| 227 | - } |
|
| 228 | - else if ( (arg(0)=='dashboard') ) { |
|
| 224 | + } else if ( (arg(0)=='dashboard') ) { |
|
| 229 | 225 | unset($vars['title']); |
| 230 | - } |
|
| 231 | - else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 226 | + } else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 232 | 227 | unset($vars['title']); |
| 233 | 228 | } |
| 234 | 229 | |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | if ($key == $last_key) { |
| 247 | 242 | $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
| 248 | 243 | } |
| 249 | - } |
|
| 250 | - elseif (strpos($tab, 'li ')) { |
|
| 244 | + } elseif (strpos($tab, 'li ')) { |
|
| 251 | 245 | if ($key == 0) { |
| 252 | 246 | $tab = str_replace('li ', 'li class="first" ', $tab); |
| 253 | 247 | } |
@@ -400,8 +394,7 @@ discard block |
||
| 400 | 394 | $cid = boincuser_get_first_unread_comment_id($topic->nid); |
| 401 | 395 | if ($cid) { |
| 402 | 396 | $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
| 403 | - } |
|
| 404 | - else { |
|
| 397 | + } else { |
|
| 405 | 398 | // User hasn't visited this topic before, so all replies are new... |
| 406 | 399 | $topic->new_replies = NULL; |
| 407 | 400 | } |
@@ -458,8 +451,7 @@ discard block |
||
| 458 | 451 | case 'boinc_host_list': |
| 459 | 452 | if ($vars['display_id'] == 'page_2') { |
| 460 | 453 | $vars['empty'] = boincwork_views_host_list_empty_text(); |
| 461 | - } |
|
| 462 | - elseif ($vars['display_id'] == 'page_1') { |
|
| 454 | + } elseif ($vars['display_id'] == 'page_1') { |
|
| 463 | 455 | $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
| 464 | 456 | } |
| 465 | 457 | break; |
@@ -515,8 +507,7 @@ discard block |
||
| 515 | 507 | if ($user_image) { |
| 516 | 508 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
| 517 | 509 | $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
| 518 | - } |
|
| 519 | - elseif (is_string($user_image)) { |
|
| 510 | + } elseif (is_string($user_image)) { |
|
| 520 | 511 | $author_picture .= '<img src="' . $user_image . '"/>'; |
| 521 | 512 | } |
| 522 | 513 | } |
@@ -620,26 +611,22 @@ discard block |
||
| 620 | 611 | |
| 621 | 612 | if (user_access('access user profiles')) { |
| 622 | 613 | $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
| 623 | - } |
|
| 624 | - else { |
|
| 614 | + } else { |
|
| 625 | 615 | $output = check_plain($name); |
| 626 | 616 | } |
| 627 | - } |
|
| 628 | - else if ($object->name) { |
|
| 617 | + } else if ($object->name) { |
|
| 629 | 618 | // Sometimes modules display content composed by people who are |
| 630 | 619 | // not registered members of the site (e.g. mailing list or news |
| 631 | 620 | // aggregator modules). This clause enables modules to display |
| 632 | 621 | // the true author of the content. |
| 633 | 622 | if (!empty($object->homepage)) { |
| 634 | 623 | $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
| 635 | - } |
|
| 636 | - else { |
|
| 624 | + } else { |
|
| 637 | 625 | $output = check_plain($object->name); |
| 638 | 626 | } |
| 639 | 627 | |
| 640 | 628 | $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')'; |
| 641 | - } |
|
| 642 | - else { |
|
| 629 | + } else { |
|
| 643 | 630 | $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user'))); |
| 644 | 631 | } |
| 645 | 632 | |
@@ -724,7 +711,7 @@ discard block |
||
| 724 | 711 | * Edit action links |
| 725 | 712 | */ |
| 726 | 713 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
| 727 | - if ($links){ |
|
| 714 | + if ($links) { |
|
| 728 | 715 | // Remove flag-subscriptions link. It will be placed elsewhere. |
| 729 | 716 | if (isset($links['flag-subscriptions'])) { |
| 730 | 717 | unset($links['flag-subscriptions']); |
@@ -913,8 +900,7 @@ discard block |
||
| 913 | 900 | ), |
| 914 | 901 | ); |
| 915 | 902 | } |
| 916 | - } |
|
| 917 | - else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 903 | + } else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 918 | 904 | if (!isset($ignored[$object->uid])) { |
| 919 | 905 | $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
| 920 | 906 | } |
@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | // returns formatted data size |
| 44 | -function size_format($size){ |
|
| 44 | +function size_format($size) { |
|
| 45 | 45 | $retval = 0; |
| 46 | 46 | |
| 47 | 47 | $KB = 1024; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | echo "<th>Avg. Size per Row</th>"; |
| 127 | 127 | echo "</tr>"; |
| 128 | 128 | |
| 129 | - for ($i = 0; $i < sizeof($db_rec)-1; $i++){ |
|
| 129 | + for ($i = 0; $i < sizeof($db_rec)-1; $i++) { |
|
| 130 | 130 | echo "<tr>"; |
| 131 | 131 | echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>"; |
| 132 | 132 | echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size) . "</td>"; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | if (empty($r)) $r=0; |
| 174 | 174 | |
| 175 | - for ($i=0; $i < sizeof($db_rec)-1; $i++){ |
|
| 175 | + for ($i=0; $i < sizeof($db_rec)-1; $i++) { |
|
| 176 | 176 | $file_details["name"] = $db_rec[$i]->name; |
| 177 | 177 | $file_details["data_size"] = $db_rec[$i]->data_size; |
| 178 | 178 | $file_details["index_size"] = $db_rec[$i]->index_size; |
@@ -242,7 +242,7 @@ |
||
| 242 | 242 | $users = BoincUser::enum( |
| 243 | 243 | sprintf("name like '%s%%'", $new_name) |
| 244 | 244 | ); |
| 245 | - foreach ($users as $u){ |
|
| 245 | + foreach ($users as $u) { |
|
| 246 | 246 | echo "<p>$u->name\n"; |
| 247 | 247 | } |
| 248 | 248 | page_tail(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | BoincForumPrefs::lookup($user); |
| 31 | 31 | |
| 32 | -if (post_str("action", true)=="reset_confirm"){ |
|
| 32 | +if (post_str("action", true)=="reset_confirm") { |
|
| 33 | 33 | page_head(tra("Confirm reset")); |
| 34 | 34 | echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")." |
| 35 | 35 | <p> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // If the user has requested a reset of preferences; |
| 46 | 46 | // preserve a few fields. |
| 47 | 47 | // |
| 48 | -if (post_str("action", true)=="reset"){ |
|
| 48 | +if (post_str("action", true)=="reset") { |
|
| 49 | 49 | $posts = $user->prefs->posts; |
| 50 | 50 | $last_post = $user->prefs->last_post; |
| 51 | 51 | $rated_posts = $user->prefs->rated_posts; |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // Update the user avatar |
| 73 | 73 | if ($avatar_type<0 or $avatar_type>3) $avatar_type=0; |
| 74 | -if ($avatar_type==0){ |
|
| 75 | - if (file_exists($newfile)){ |
|
| 74 | +if ($avatar_type==0) { |
|
| 75 | + if (file_exists($newfile)) { |
|
| 76 | 76 | // Delete the file on the server if the user |
| 77 | 77 | // decides not to use an avatar |
| 78 | 78 | // |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $avatar_url=""; |
| 82 | 82 | } elseif ($avatar_type == 1) { |
| 83 | 83 | $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&d=identicon"; |
| 84 | -} elseif ($avatar_type==2){ |
|
| 84 | +} elseif ($avatar_type==2) { |
|
| 85 | 85 | if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) { |
| 86 | 86 | if ($_FILES['picture']['tmp_name']!="") { |
| 87 | 87 | $file = $_FILES['picture']['tmp_name']; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $file = post_str("avatar_url"); |
| 91 | 91 | } |
| 92 | 92 | $size = getImageSize($file); |
| 93 | - if ($size[2]!=2 and $size[2]!=3){ |
|
| 93 | + if ($size[2]!=2 and $size[2]!=3) { |
|
| 94 | 94 | //Not the right kind of file |
| 95 | 95 | error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported.")); |
| 96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $image2 = intelligently_scale_image($file, 100, 100); |
| 100 | 100 | ImageJPEG($image2, $newfile); |
| 101 | 101 | } |
| 102 | - if (file_exists($newfile)){ |
|
| 102 | + if (file_exists($newfile)) { |
|
| 103 | 103 | $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile; |
| 104 | 104 | } else { |
| 105 | 105 | //User didn't upload a compatible file or it went lost on the server |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | } else { |
| 143 | 143 | // todo: clean up the following |
| 144 | 144 | $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!=""); |
| 145 | - if ($add_user_to_filter){ |
|
| 145 | + if ($add_user_to_filter) { |
|
| 146 | 146 | $user_to_add = trim($_POST["forum_filter_user"]); |
| 147 | - if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){ |
|
| 147 | + if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))) { |
|
| 148 | 148 | $other_user = BoincUser::lookup_id($user_to_add); |
| 149 | 149 | if (!$other_user) { |
| 150 | 150 | echo tra("No such user:")." ".$user_to_add; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | // |
| 160 | 160 | $ignored_users = get_ignored_list($user); |
| 161 | 161 | // todo: use foreach |
| 162 | -for ($i=0;$i<sizeof($ignored_users);$i++){ |
|
| 162 | +for ($i=0;$i<sizeof($ignored_users);$i++) { |
|
| 163 | 163 | $remove = "remove".trim($ignored_users[$i]); |
| 164 | - if (isset($_POST[$remove]) && $_POST[$remove]!=""){ |
|
| 164 | + if (isset($_POST[$remove]) && $_POST[$remove]!="") { |
|
| 165 | 165 | $other_user = BoincUser::lookup_id($ignored_users[$i]); |
| 166 | 166 | if (!$other_user) { |
| 167 | 167 | echo tra("No such user:")." ".$ignored_users[$j]; |
@@ -53,8 +53,9 @@ discard block |
||
| 53 | 53 | // ------------ Forum identity ----------- |
| 54 | 54 | |
| 55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
| 56 | -if (strlen($user->prefs->avatar)){ |
|
| 57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
| 56 | +if (strlen($user->prefs->avatar)) { |
|
| 57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { |
|
| 58 | +// Gravatar |
|
| 58 | 59 | $select_1 = "checked=\"true\""; |
| 59 | 60 | } else { |
| 60 | 61 | $select_2 = "checked=\"true\""; |
@@ -73,7 +74,7 @@ discard block |
||
| 73 | 74 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
| 74 | 75 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
| 75 | 76 | ); |
| 76 | -if (strlen($user->prefs->avatar)){ |
|
| 77 | +if (strlen($user->prefs->avatar)) { |
|
| 77 | 78 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
| 78 | 79 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
| 79 | 80 | } |
@@ -103,7 +104,7 @@ discard block |
||
| 103 | 104 | tra("Attach signature by default") |
| 104 | 105 | ) |
| 105 | 106 | ); |
| 106 | -if ($user->prefs->signature!=""){ |
|
| 107 | +if ($user->prefs->signature!="") { |
|
| 107 | 108 | row2(tra("Signature preview"). |
| 108 | 109 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
| 109 | 110 | output_transform($user->prefs->signature) |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $user->id, |
| 408 | 408 | $name |
| 409 | 409 | ); |
| 410 | - if (function_exists("project_user_links")){ |
|
| 410 | + if (function_exists("project_user_links")) { |
|
| 411 | 411 | $x .= project_user_links($user); |
| 412 | 412 | } |
| 413 | 413 | if ($badge_height) { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | // return an object with data to show the user's community links |
| 532 | 532 | // |
| 533 | -function get_community_links_object($user){ |
|
| 533 | +function get_community_links_object($user) { |
|
| 534 | 534 | $cache_object = new StdClass; |
| 535 | 535 | $cache_object->post_count = total_posts($user); |
| 536 | 536 | $cache_object->user = $user; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | |
| 549 | 549 | // show community links of another user (described by $clo) |
| 550 | 550 | // |
| 551 | -function community_links($clo, $logged_in_user){ |
|
| 551 | +function community_links($clo, $logged_in_user) { |
|
| 552 | 552 | $user = $clo->user; |
| 553 | 553 | if (!$user) { |
| 554 | 554 | error_log("community_links(): null user\n"); |
@@ -285,7 +285,8 @@ discard block |
||
| 285 | 285 | // (PM reply fills in the latter) |
| 286 | 286 | // |
| 287 | 287 | $x = explode(' ', $username); |
| 288 | - if (is_numeric($x[0])) { // user ID |
|
| 288 | + if (is_numeric($x[0])) { |
|
| 289 | +// user ID |
|
| 289 | 290 | $userid = (int)$x[0]; |
| 290 | 291 | $user = BoincUser::lookup_id($userid); |
| 291 | 292 | if ($user == null) { |
@@ -303,7 +304,8 @@ discard block |
||
| 303 | 304 | tra("Could not find user with username %1", $username) |
| 304 | 305 | ); |
| 305 | 306 | return; |
| 306 | - } elseif (count($users) > 1) { // Non-unique username |
|
| 307 | + } elseif (count($users) > 1) { |
|
| 308 | +// Non-unique username |
|
| 307 | 309 | pm_form_page( |
| 308 | 310 | $replyto, $userid, |
| 309 | 311 | tra("%1 is not a unique username; you will have to use user ID", $username) |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // There's a new post in the thread, which the user is subscribed to. |
| 127 | 127 | // send them an email notifying them. |
| 128 | 128 | // |
| 129 | -function send_thread_notification_email($thread, $user){ |
|
| 129 | +function send_thread_notification_email($thread, $user) { |
|
| 130 | 130 | $title = PROJECT . ": there is a new post in '". $thread->title ."'"; |
| 131 | 131 | $link = secure_url_base() . "forum_thread.php?id=" . $thread->id; |
| 132 | 132 | $body = "A " . PROJECT . " user has posted to the thread |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // There's a new thread in the forum, which the user is subscribed to. |
| 145 | 145 | // send them an email notifying them. |
| 146 | 146 | // |
| 147 | -function send_forum_notification_email($forum, $user){ |
|
| 147 | +function send_forum_notification_email($forum, $user) { |
|
| 148 | 148 | $title = PROJECT . ": there is a new thread in '". $forum->title ."'"; |
| 149 | 149 | $link = secure_url_base() . "forum_forum.php?id=" . $forum->id; |
| 150 | 150 | $body = "A " . PROJECT . " user has added a thread to the forum |