Completed
Pull Request — master (#1862)
by Christian
09:13
created
drupal/sites/default/boinc/modules/boinccore/boinccore.admin.inc 4 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -7,185 +7,185 @@  discard block
 block discarded – undo
7 7
 */
8 8
 
9 9
 /**
10
-  * The BOINC community form allows the setting of requirements for interaction
11
-  * in the community sections of the site.
12
-  */
10
+ * The BOINC community form allows the setting of requirements for interaction
11
+ * in the community sections of the site.
12
+ */
13 13
 function boinccore_admin_community(&$form_state) {
14
-  $form = array();
15
-  $default = array(
14
+    $form = array();
15
+    $default = array(
16 16
     'min_credit_to_post' => variable_get('boinc_comment_min_credit', 0),
17 17
     'penalty_period' => variable_get('boinc_penalty_period', 7*24*60*60),
18 18
     'moderator_mailing_list' => variable_get('boinc_moderator_mailing_list', ''),
19 19
     'moderator_force_individual_notifications' => variable_get('boinc_moderator_force_individual_notifications', 0),
20
-  );
20
+    );
21 21
   
22
-  // Define the form
23
-  $form['boinc_comment_min_credit'] = array(
22
+    // Define the form
23
+    $form['boinc_comment_min_credit'] = array(
24 24
     '#type' => 'textfield',
25 25
     '#title' => t('Credit required for community participation'),
26 26
     '#default_value' => $default['min_credit_to_post'],
27 27
     '#description' => t('Set a minimum threshold of credit a user must have
28 28
       earned before being allowed to create a profile, post comments or participate in forums.'),
29
-  );
30
-  $form['boinc_penalty_period'] = array(
29
+    );
30
+    $form['boinc_penalty_period'] = array(
31 31
     '#type' => 'textfield',
32 32
     '#title' => t('Penalty period'),
33 33
     '#default_value' => $default['penalty_period'],
34 34
     '#description' => t('The amount of time (in seconds) that user privileges
35 35
       are revoked when a user is banned from community participation.'),
36
-  );
37
-  $form['boinc_moderator_mailing_list'] = array(
36
+    );
37
+    $form['boinc_moderator_mailing_list'] = array(
38 38
     '#type' => 'textfield',
39 39
     '#title' => t('Moderator mailing list'),
40 40
     '#default_value' => $default['moderator_mailing_list'],
41 41
     '#description' => t('As an alternative to sending moderator notifications
42 42
       to individual users with the moderator role, enter a mailing list address
43 43
       here to be the only target of the notification emails.'),
44
-  );
45
-  $form['boinc_moderator_force_individual_notifications'] = array(
44
+    );
45
+    $form['boinc_moderator_force_individual_notifications'] = array(
46 46
     '#type' => 'checkbox',
47 47
     '#title' => t('Always send individual notifications'),
48 48
     '#default_value' => $default['moderator_force_individual_notifications'],
49 49
     '#description' => t('Continue to send individual moderator notification
50 50
       emails even when a mailing list is provided.'),
51
-  );
51
+    );
52 52
   
53
-  $form['tools'] = array(
53
+    $form['tools'] = array(
54 54
     '#title' => t('Tools'),
55 55
     '#type' => 'fieldset',
56 56
     '#description' => '',
57 57
     '#collapsible' => TRUE,
58 58
     '#collapsed' => FALSE,
59 59
     '#attributes' => array('class' => '')
60
-  );
61
-  $form['tools']['reset_uotd'] = array(
60
+    );
61
+    $form['tools']['reset_uotd'] = array(
62 62
     '#type' => 'submit',
63 63
     '#value' => t('Force new UOTD'),
64 64
     '#submit' => array('boinccore_reset_user_of_the_day'),
65
-  );
65
+    );
66 66
   
67
-  return system_settings_form($form);
67
+    return system_settings_form($form);
68 68
 }
69 69
 
70 70
 /**
71
-  * Validate the BOINC community form.
72
-  */
71
+ * Validate the BOINC community form.
72
+ */
73 73
 function boinccore_admin_community_validate($form, &$form_state) {
74
-  $values = $form_state['values'];
75
-  if (!is_numeric($values['boinc_comment_min_credit'])) {
74
+    $values = $form_state['values'];
75
+    if (!is_numeric($values['boinc_comment_min_credit'])) {
76 76
     form_set_error('boinc_comment_min_credit', t('The minimum credit value must be a number.'));
77
-  }
77
+    }
78 78
 }
79 79
 
80 80
 /**
81
-  * Handle post-validation submission of BOINC community form.
82
-  */
81
+ * Handle post-validation submission of BOINC community form.
82
+ */
83 83
 function boinccore_admin_community_submit($form, &$form_state) {
84
-  drupal_set_message(t('BOINC community settings have been updated.'));
84
+    drupal_set_message(t('BOINC community settings have been updated.'));
85 85
 }
86 86
 
87 87
 /**
88 88
  * Force a reset of the user of the day
89 89
  */
90 90
 function boinccore_reset_user_of_the_day() {
91
-  if (boincuser_select_user_of_the_day()) {
91
+    if (boincuser_select_user_of_the_day()) {
92 92
     drupal_set_message(t('The user of the day has been reset.'));
93
-  }
93
+    }
94 94
 }
95 95
 
96 96
 /**
97
-  * The standard page generator form provides an interface to create standard
98
-  * pages, such as a Help or About page.
99
-  */
97
+ * The standard page generator form provides an interface to create standard
98
+ * pages, such as a Help or About page.
99
+ */
100 100
 function boinccore_admin_default_content(&$form_state) {
101
-  $form = array();
101
+    $form = array();
102 102
   
103
-  // Define the form
104
-  $form['page'] = array(
103
+    // Define the form
104
+    $form['page'] = array(
105 105
     '#type' => 'select',
106 106
     '#title' => t('Generate default content for'),
107 107
     '#options' => array(
108
-      0 => t('all standard pages'),
108
+        0 => t('all standard pages'),
109 109
 //      'about' => t('About page'),
110
-      'help' => t('Help page'),
110
+        'help' => t('Help page'),
111 111
     ),
112
-  );
113
-  $form['submit'] = array(
112
+    );
113
+    $form['submit'] = array(
114 114
     '#type' => 'submit',
115 115
     '#value' => 'Generate content',
116
-  );
116
+    );
117 117
   
118
-  return $form;
118
+    return $form;
119 119
 }
120 120
 
121 121
 /**
122
-  * Generate content based on the selection made on the form
123
-  */
122
+ * Generate content based on the selection made on the form
123
+ */
124 124
 function boinccore_admin_default_content_submit($form, &$form_state) {
125
-  $option = $form_state['values']['page'];
126
-  $page_list = boinccore_admin_default_content_generate($option);
127
-  $pages_generated = count($page_list);
128
-  if ($pages_generated > 0) {
125
+    $option = $form_state['values']['page'];
126
+    $page_list = boinccore_admin_default_content_generate($option);
127
+    $pages_generated = count($page_list);
128
+    if ($pages_generated > 0) {
129 129
     switch ($pages_generated) {
130 130
     case 1:
131 131
       $page_list = reset($page_list);
132
-      break;
132
+        break;
133 133
     case 2:
134 134
       $page_list = implode(' and ', $page_list);
135
-      break;
135
+        break;
136 136
     default:
137 137
       end($page_list);
138
-      $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)];
139
-      $page_list = implode(', ', $page_list);
138
+        $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)];
139
+        $page_list = implode(', ', $page_list);
140 140
     }
141 141
     drupal_set_message(t('Default content has been generated for the @listed
142 142
       @pages.', array(
143 143
         '@listed' => $page_list, 
144 144
         '@pages' => format_plural($pages_generated, 'page', 'pages'),
145
-      )
145
+        )
146 146
     ));
147
-  }
148
-  else {
147
+    }
148
+    else {
149 149
     if ($option) {
150
-      drupal_set_message(t('The @specified page already exists.',
150
+        drupal_set_message(t('The @specified page already exists.',
151 151
         array('@specified' => $option)), 'warning');
152 152
     }
153 153
     else {
154
-      drupal_set_message(t('All pages already exist, so none can be recreated
154
+        drupal_set_message(t('All pages already exist, so none can be recreated
155 155
         automatically.'), 'warning');
156 156
     }
157 157
     drupal_set_message(t('To recreate a page, first delete the existing page (or
158 158
       remove its URL alias), then try this function again.'), 'warning');
159
-  }
159
+    }
160 160
 }
161 161
 
162 162
 /**
163
-  * 
164
-  */
163
+ * 
164
+ */
165 165
 function boinccore_admin_default_content_generate($pages = array()) {
166
-  if (!$pages) {
166
+    if (!$pages) {
167 167
     // If not specified, attempt to generate all pages by default
168 168
     $pages = array(
169
-      'help',
169
+        'help',
170 170
 //      'about',
171 171
     );
172
-  }
173
-  elseif (!is_array($pages)) {
172
+    }
173
+    elseif (!is_array($pages)) {
174 174
     $pages = array($pages);
175
-  }
176
-  $pages_generated = array();
177
-  if (in_array('about', $pages)) {
175
+    }
176
+    $pages_generated = array();
177
+    if (in_array('about', $pages)) {
178 178
     // Create the default About page, if it doesn't exist
179 179
     // TODO: what is the default About page...?
180 180
     if (!drupal_lookup_path('source', 'about')) {
181
-      drupal_set_message('The about page doesn\'t yet have a definition...', 'warning');
182
-      //$pages_generated[] = 'about';
181
+        drupal_set_message('The about page doesn\'t yet have a definition...', 'warning');
182
+        //$pages_generated[] = 'about';
183
+    }
183 184
     }
184
-  }
185
-  if (in_array('help', $pages)) {
185
+    if (in_array('help', $pages)) {
186 186
     // Create the default Help page, if it doesn't exist
187 187
     if (!drupal_lookup_path('source', 'help')) {
188
-      $node = array(
188
+        $node = array(
189 189
         'type' => 'page',
190 190
         'title' => t('Help'),
191 191
         'uid' => 1,
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         'comment' => 0, // disable comments
199 199
         'moderate' => 0,
200 200
         'body' => preg_replace('/>\s+</', '><',
201
-          '<p>Use this page to provide help and support for your site\'s
201
+            '<p>Use this page to provide help and support for your site\'s
202 202
           visitors:</p>
203 203
           <ul>
204 204
             <li>Add a link to your primary forum for getting help</li>
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
         'sticky' => 0,
210 210
         'format' => 4,
211 211
         //'teaser' => $teaser,
212
-      );
213
-      $node = (object) $node; // node_save requires an object
214
-      node_save($node);
212
+        );
213
+        $node = (object) $node; // node_save requires an object
214
+        node_save($node);
215 215
       
216
-      $item = array(
216
+        $item = array(
217 217
         'link_path' => drupal_get_normal_path('help'),
218 218
         'link_title' => t('Help'),
219 219
         'menu_name' => 'primary-links',
220 220
         'weight' => 50,
221
-      );
222
-      menu_link_save($item);
223
-      $pages_generated[] = 'help';
221
+        );
222
+        menu_link_save($item);
223
+        $pages_generated[] = 'help';
224
+    }
224 225
     }
225
-  }
226
-  // Refresh the cache with these changes
227
-  menu_cache_clear_all();
228
-  return $pages_generated;
226
+    // Refresh the cache with these changes
227
+    menu_cache_clear_all();
228
+    return $pages_generated;
229 229
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
       break;
136 136
     default:
137 137
       end($page_list);
138
-      $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)];
138
+      $page_list[key($page_list)] = 'and '.$page_list[key($page_list)];
139 139
       $page_list = implode(', ', $page_list);
140 140
     }
141 141
     drupal_set_message(t('Default content has been generated for the @listed
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         'type' => 'page',
190 190
         'title' => t('Help'),
191 191
         'uid' => 1,
192
-        'status' => 1,  // published
192
+        'status' => 1, // published
193 193
         'promote' => 0, // not promoted to front page
194 194
         'path' => 'help',
195 195
         'pathauto_perform_alias' => FALSE,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         'format' => 4,
211 211
         //'teaser' => $teaser,
212 212
       );
213
-      $node = (object) $node; // node_save requires an object
213
+      $node = (object)$node; // node_save requires an object
214 214
       node_save($node);
215 215
       
216 216
       $item = array(
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,13 +144,11 @@  discard block
 block discarded – undo
144 144
         '@pages' => format_plural($pages_generated, 'page', 'pages'),
145 145
       )
146 146
     ));
147
-  }
148
-  else {
147
+  } else {
149 148
     if ($option) {
150 149
       drupal_set_message(t('The @specified page already exists.',
151 150
         array('@specified' => $option)), 'warning');
152
-    }
153
-    else {
151
+    } else {
154 152
       drupal_set_message(t('All pages already exist, so none can be recreated
155 153
         automatically.'), 'warning');
156 154
     }
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
       'help',
170 168
 //      'about',
171 169
     );
172
-  }
173
-  elseif (!is_array($pages)) {
170
+  } elseif (!is_array($pages)) {
174 171
     $pages = array($pages);
175 172
   }
176 173
   $pages_generated = array();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     '#title' => t('Tools'),
55 55
     '#type' => 'fieldset',
56 56
     '#description' => '',
57
-    '#collapsible' => TRUE,
58
-    '#collapsed' => FALSE,
57
+    '#collapsible' => true,
58
+    '#collapsed' => false,
59 59
     '#attributes' => array('class' => '')
60 60
   );
61 61
   $form['tools']['reset_uotd'] = array(
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         'status' => 1,  // published
193 193
         'promote' => 0, // not promoted to front page
194 194
         'path' => 'help',
195
-        'pathauto_perform_alias' => FALSE,
195
+        'pathauto_perform_alias' => false,
196 196
         'created' => time(),
197 197
         'changed' => time(),
198 198
         'comment' => 0, // disable comments
Please login to merge, or discard this patch.
sites/default/boinc/modules/comment_form_block/comment_form_block.module 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,40 +9,40 @@  discard block
 block discarded – undo
9 9
  * Implements hook_block() for Drupal 6 compatibility
10 10
  */
11 11
 function comment_form_block_block($op = 'list', $delta = 0, $edit = array()) {
12
-  switch ($op) {
13
-  case 'view':
12
+    switch ($op) {
13
+    case 'view':
14 14
     //$block = node_comment_block_block_view($delta);
15 15
     $block = array();
16 16
     if ($delta == 'comment_form') {
17
-      if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
17
+        if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
18 18
         global $user;
19 19
         $node = node_load($nid);
20 20
         if ($node->comment !== 0 AND user_access('post comments', $user)) {
21
-          $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
22
-          $block['content'] = '<h2>' . bts('Post new comment') . '</h2>';
23
-          $block['content'] .= drupal_get_form('comment_form', array('nid' => $nid)); 
21
+            $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
22
+            $block['content'] = '<h2>' . bts('Post new comment') . '</h2>';
23
+            $block['content'] .= drupal_get_form('comment_form', array('nid' => $nid)); 
24
+        }
24 25
         }
25
-      }
26 26
     }
27 27
     break;
28
-  case 'list':
28
+    case 'list':
29 29
     $blocks = comment_form_block_block_info();
30 30
     return $blocks;
31 31
     break;
32
-  default:
32
+    default:
33 33
   }
34
-  return $block;
34
+    return $block;
35 35
 }
36 36
 
37 37
 /**
38 38
  * Implements hook_block_info().
39 39
  */
40 40
 function comment_form_block_block_info() {
41
-  $blocks['comment_form'] = array(
41
+    $blocks['comment_form'] = array(
42 42
     'info' => bts('Comment form'),
43
-  );
43
+    );
44 44
 
45
-  return $blocks;
45
+    return $blocks;
46 46
 }
47 47
 
48 48
 /**
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
  * Implements hook_form_FORM_ID_alter() for block_admin_configure.
82 82
  */
83 83
 function comment_form_block_form_block_admin_configure_alter(&$form, &$form_state) {
84
-  if (isset($form['delta'])) {
84
+    if (isset($form['delta'])) {
85 85
     if ($form['delta']['#value'] == 'comment_form') {
86
-      $form['settings']['title']['#disabled'] = TRUE;
87
-      $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
86
+        $form['settings']['title']['#disabled'] = TRUE;
87
+        $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
88
+    }
88 89
     }
89
-  }
90 90
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         $node = node_load($nid);
20 20
         if ($node->comment !== 0 AND user_access('post comments', $user)) {
21 21
           $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
22
-          $block['content'] = '<h2>' . bts('Post new comment') . '</h2>';
22
+          $block['content'] = '<h2>'.bts('Post new comment').'</h2>';
23 23
           $block['content'] .= drupal_get_form('comment_form', array('nid' => $nid)); 
24 24
         }
25 25
       }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
       if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
18 18
         global $user;
19 19
         $node = node_load($nid);
20
-        if ($node->comment !== 0 AND user_access('post comments', $user)) {
21
-          $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
20
+        if ($node->comment !== 0 and user_access('post comments', $user)) {
21
+          $block['subject'] = null; // This should be NULL otherwise there will be duplicate h2 elements.
22 22
           $block['content'] = '<h2>' . bts('Post new comment') . '</h2>';
23 23
           $block['content'] .= drupal_get_form('comment_form', array('nid' => $nid)); 
24 24
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 function comment_form_block_form_block_admin_configure_alter(&$form, &$form_state) {
84 84
   if (isset($form['delta'])) {
85 85
     if ($form['delta']['#value'] == 'comment_form') {
86
-      $form['settings']['title']['#disabled'] = TRUE;
86
+      $form['settings']['title']['#disabled'] = true;
87 87
       $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
88 88
     }
89 89
   }
Please login to merge, or discard this patch.
sites/default/boinc/modules/flag_comment_notify/flag_comment_notify.module 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  * Implementation of hook_comment(); 
27 27
  */
28 28
 function flag_comment_notify_comment(&$a1, $op) {
29
-  switch ($op) {
30
-  case 'insert':
29
+    switch ($op) {
30
+    case 'insert':
31 31
     module_load_include('inc', 'drupal_queue', 'drupal_queue');
32 32
     $queue = DrupalQueue::get('flag_comment_notify');
33 33
     $subscribed_users = array_keys((array) flag_get_content_flags('node', $a1['nid'], 'subscriptions'));
34 34
     foreach ($subscribed_users as $uid) {
35
-      $queue->createItem(array('uid' => $uid, 'cid' => (int) $a1['cid']));
35
+        $queue->createItem(array('uid' => $uid, 'cid' => (int) $a1['cid']));
36 36
     }
37 37
     break;
38
-  default:
38
+    default:
39 39
   }
40 40
 }
41 41
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
  * Implementation of hook_cron_queue_info()
44 44
  */
45 45
 function flag_comment_notify_cron_queue_info() {
46
-  $queues = array();
47
-  $queues['flag_comment_notify'] = array(
46
+    $queues = array();
47
+    $queues['flag_comment_notify'] = array(
48 48
     'worker callback' => 'flag_comment_notify_send_notification',
49 49
     'time' => 60,
50
-  );
51
-  return $queues;
50
+    );
51
+    return $queues;
52 52
 }
53 53
 
54 54
 
@@ -57,44 +57,44 @@  discard block
 block discarded – undo
57 57
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
58 58
 
59 59
 function flag_comment_notify_send_notification($data) {
60
-  $account = user_load($data['uid']);
61
-  $comment = _comment_load($data['cid']);
62
-  $node = node_load($comment->nid);
63
-  $author = user_load($comment->uid);
64
-  if ($account->mail AND $node->nid) {
60
+    $account = user_load($data['uid']);
61
+    $comment = _comment_load($data['cid']);
62
+    $node = node_load($comment->nid);
63
+    $author = user_load($comment->uid);
64
+    if ($account->mail AND $node->nid) {
65 65
     // Don't send notifications to the author of the comment
66 66
     if ($account->uid != $author->uid) {
67
-      $params['account'] = $account;
68
-      $params['comment'] = $comment;
69
-      $params['node'] = $node;
70
-      $params['author'] = $author;
71
-      drupal_mail('flag_comment_notify', 'comment_posted', $account->mail,
67
+        $params['account'] = $account;
68
+        $params['comment'] = $comment;
69
+        $params['node'] = $node;
70
+        $params['author'] = $author;
71
+        drupal_mail('flag_comment_notify', 'comment_posted', $account->mail,
72 72
         user_preferred_language($account), $params);
73 73
     }
74
-  }
74
+    }
75 75
 }
76 76
 
77 77
 
78 78
 function flag_comment_notify_mail($key, &$message, $params) {
79
-  $language = $message['language'];
80
-  $variables = user_mail_tokens($params['account'], $language);
81
-  $variables['!comment_url'] = url(
79
+    $language = $message['language'];
80
+    $variables = user_mail_tokens($params['account'], $language);
81
+    $variables['!comment_url'] = url(
82 82
     "goto/comment/{$params['comment']->cid}",
83 83
     array(
84
-      'absolute' => TRUE,
84
+        'absolute' => TRUE,
85 85
     )
86
-  );
87
-  $variables['!topic_name'] = $params['node']->title;
88
-  $variables['!author'] = $params['author']->name;
89
-  switch($key) {
90
-  case 'comment_posted':
86
+    );
87
+    $variables['!topic_name'] = $params['node']->title;
88
+    $variables['!author'] = $params['author']->name;
89
+    switch($key) {
90
+    case 'comment_posted':
91 91
     $message['subject'] = bts('!site: comment posted to "!topic_name"', $variables,
92
-      $language->language);
92
+        $language->language);
93 93
     $message['body'][] = bts('!author has posted a reply to "!topic_name".',
94
-      $variables, $language->language);
94
+        $variables, $language->language);
95 95
     $message['body'][] = bts("To view this topic at !site, click here: \n!comment_url",
96
-      $variables, $language->language);
96
+        $variables, $language->language);
97 97
     break;
98
-  default:
98
+    default:
99 99
   }
100 100
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
   case 'insert':
31 31
     module_load_include('inc', 'drupal_queue', 'drupal_queue');
32 32
     $queue = DrupalQueue::get('flag_comment_notify');
33
-    $subscribed_users = array_keys((array) flag_get_content_flags('node', $a1['nid'], 'subscriptions'));
33
+    $subscribed_users = array_keys((array)flag_get_content_flags('node', $a1['nid'], 'subscriptions'));
34 34
     foreach ($subscribed_users as $uid) {
35
-      $queue->createItem(array('uid' => $uid, 'cid' => (int) $a1['cid']));
35
+      $queue->createItem(array('uid' => $uid, 'cid' => (int)$a1['cid']));
36 36
     }
37 37
     break;
38 38
   default:
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   );
87 87
   $variables['!topic_name'] = $params['node']->title;
88 88
   $variables['!author'] = $params['author']->name;
89
-  switch($key) {
89
+  switch ($key) {
90 90
   case 'comment_posted':
91 91
     $message['subject'] = bts('!site: comment posted to "!topic_name"', $variables,
92 92
       $language->language);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
   $comment = _comment_load($data['cid']);
62 62
   $node = node_load($comment->nid);
63 63
   $author = user_load($comment->uid);
64
-  if ($account->mail AND $node->nid) {
64
+  if ($account->mail and $node->nid) {
65 65
     // Don't send notifications to the author of the comment
66 66
     if ($account->uid != $author->uid) {
67 67
       $params['account'] = $account;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
   $variables['!comment_url'] = url(
82 82
     "goto/comment/{$params['comment']->cid}",
83 83
     array(
84
-      'absolute' => TRUE,
84
+      'absolute' => true,
85 85
     )
86 86
   );
87 87
   $variables['!topic_name'] = $params['node']->title;
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/includes/import_team.php 4 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@  discard block
 block discarded – undo
11 11
  * at a time and avoid exhausting memory.
12 12
  */
13 13
 
14
-  require_once('./includes/bootstrap.inc');
15
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
16
-  require_boinc('db');
14
+    require_once('./includes/bootstrap.inc');
15
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
16
+    require_boinc('db');
17 17
   
18
-  // Parse arguments
19
-  $team_id = isset($argv[1]) ? $argv[1] : null;
20
-  $team_type_tid = isset($argv[2]) ? $argv[2] : null;
21
-  $input_format = isset($argv[3]) ? $argv[3] : null;
18
+    // Parse arguments
19
+    $team_id = isset($argv[1]) ? $argv[1] : null;
20
+    $team_type_tid = isset($argv[2]) ? $argv[2] : null;
21
+    $input_format = isset($argv[3]) ? $argv[3] : null;
22 22
   
23
-  $count = 0;
23
+    $count = 0;
24 24
   
25
-  // Get teams from BOINC
26
-  db_set_active('boinc');
27
-  $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
28
-  $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
29
-  $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
30
-  db_set_active('default');
25
+    // Get teams from BOINC
26
+    db_set_active('boinc');
27
+    $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
28
+    $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
29
+    $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
30
+    db_set_active('default');
31 31
   
32
-  $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
33
-  // FIXME: $team_exists==FALSE should be handled as an error and return an error code!
32
+    $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
33
+    // FIXME: $team_exists==FALSE should be handled as an error and return an error code!
34 34
 
35
-  if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
35
+    if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
36 36
     $boincteam->description = _boincimport_text_sanitize($boincteam->description);
37 37
     $teaser = node_teaser($boincteam->description);
38 38
     
39 39
     // Construct the team as an organic group node
40 40
     $node = array(
41
-      'type' => 'team',
42
-      'title' => $boincteam->name,
43
-      'body' => $boincteam->description,
44
-      'teaser' => $teaser,
45
-      'uid' => boincuser_lookup_uid($boincteam->userid),
46
-      'path' => null,
47
-      'status' => 1,  // published or not - always publish
48
-      'promote' => 0,
49
-      'created' => $boincteam->create_time,
50
-      'comment' => 0,  // comments disabled
51
-      'moderate' => 0,
52
-      'sticky' => 0,
53
-      'format' => $input_format
41
+        'type' => 'team',
42
+        'title' => $boincteam->name,
43
+        'body' => $boincteam->description,
44
+        'teaser' => $teaser,
45
+        'uid' => boincuser_lookup_uid($boincteam->userid),
46
+        'path' => null,
47
+        'status' => 1,  // published or not - always publish
48
+        'promote' => 0,
49
+        'created' => $boincteam->create_time,
50
+        'comment' => 0,  // comments disabled
51
+        'moderate' => 0,
52
+        'sticky' => 0,
53
+        'format' => $input_format
54 54
     );
55 55
     
56 56
     // Use pathauto function, if available, to clean up the path
57 57
     if (module_exists('pathauto')) {
58
-      module_load_include('inc', 'pathauto', 'pathauto');
59
-      $node['path'] = pathauto_cleanstring($boincteam->name);
58
+        module_load_include('inc', 'pathauto', 'pathauto');
59
+        $node['path'] = pathauto_cleanstring($boincteam->name);
60 60
     }
61 61
     else {
62
-      echo 'Pathauto module is required!';
63
-      exit;
62
+        echo 'Pathauto module is required!';
63
+        exit;
64 64
     }
65 65
     
66 66
     $node = (object) $node; // node_save requires an object form
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
     
73 73
     // Save the team IDs to a BOINC <--> Drupal reference table.
74 74
     db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid);
75
-  }
75
+    }
76 76
   
77
-  // Determine team membership
78
-  db_set_active('boinc');
79
-  $boincteam_member_ids = array();
80
-  while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id;
81
-  db_set_active('default');
82
-  if ($boincteam_member_ids) {
77
+    // Determine team membership
78
+    db_set_active('boinc');
79
+    $boincteam_member_ids = array();
80
+    while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id;
81
+    db_set_active('default');
82
+    if ($boincteam_member_ids) {
83 83
     $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
84 84
     $team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
85 85
     
86 86
     while ($drupal_user = db_fetch_object($team_members)) {
87
-      // Add action to take on member accounts?
88
-      $count++;
87
+        // Add action to take on member accounts?
88
+        $count++;
89
+    }
89 90
     }
90
-  }
91 91
   
92
-  echo $count;
93
-  
94 92
\ No newline at end of file
93
+    echo $count;
94
+    
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
   db_set_active('boinc');
27 27
   $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
28 28
   $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
29
-  $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
29
+  $boincteam_admin = (int)db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
30 30
   db_set_active('default');
31 31
   
32 32
   $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
       'teaser' => $teaser,
45 45
       'uid' => boincuser_lookup_uid($boincteam->userid),
46 46
       'path' => null,
47
-      'status' => 1,  // published or not - always publish
47
+      'status' => 1, // published or not - always publish
48 48
       'promote' => 0,
49 49
       'created' => $boincteam->create_time,
50
-      'comment' => 0,  // comments disabled
50
+      'comment' => 0, // comments disabled
51 51
       'moderate' => 0,
52 52
       'sticky' => 0,
53 53
       'format' => $input_format
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
       exit;
64 64
     }
65 65
     
66
-    $node = (object) $node; // node_save requires an object form
66
+    $node = (object)$node; // node_save requires an object form
67 67
     
68 68
     $node->taxonomy[] = taxonomy_get_term($team_type_tid);
69 69
     
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
   db_set_active('default');
82 82
   if ($boincteam_member_ids) {
83 83
     $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
84
-    $team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
84
+    $team_admin = (int)db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
85 85
     
86 86
     while ($drupal_user = db_fetch_object($team_members)) {
87 87
       // Add action to take on member accounts?
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
     if (module_exists('pathauto')) {
58 58
       module_load_include('inc', 'pathauto', 'pathauto');
59 59
       $node['path'] = pathauto_cleanstring($boincteam->name);
60
-    }
61
-    else {
60
+    } else {
62 61
       echo 'Pathauto module is required!';
63 62
       exit;
64 63
     }
@@ -77,7 +76,9 @@  discard block
 block discarded – undo
77 76
   // Determine team membership
78 77
   db_set_active('boinc');
79 78
   $boincteam_member_ids = array();
80
-  while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id;
79
+  while ($boincuser = db_fetch_object($boincteam_members)) {
80
+      $boincteam_member_ids[] = $boincuser->id;
81
+  }
81 82
   db_set_active('default');
82 83
   if ($boincteam_member_ids) {
83 84
     $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
   $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
33 33
   // FIXME: $team_exists==FALSE should be handled as an error and return an error code!
34 34
 
35
-  if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
35
+  if ($team_exists != false && db_fetch_object($team_exists) == false) {
36 36
     $boincteam->description = _boincimport_text_sanitize($boincteam->description);
37 37
     $teaser = node_teaser($boincteam->description);
38 38
     
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincimport/includes/import_subscriptions.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,33 +12,33 @@
 block discarded – undo
12 12
  */
13 13
 
14 14
 
15
-  require_once('./includes/bootstrap.inc');
16
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
-  require_boinc('db');
15
+    require_once('./includes/bootstrap.inc');
16
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
+    require_boinc('db');
18 18
   
19
-  // Parse arguments
20
-  $record_offset = isset($argv[1]) ? $argv[1] : 0;
21
-  $chunk_size = isset($argv[2]) ? $argv[2] : 100;
19
+    // Parse arguments
20
+    $record_offset = isset($argv[1]) ? $argv[1] : 0;
21
+    $chunk_size = isset($argv[2]) ? $argv[2] : 100;
22 22
   
23
-  // Construct sql conditions
24
-  $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
23
+    // Construct sql conditions
24
+    $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
25 25
   
26
-  $total_count = 0;
26
+    $total_count = 0;
27 27
   
28
-  // Get the users with subscriptions to import
29
-  db_set_active('boinc');
30
-  $subscribed_boinc_users = db_query("
28
+    // Get the users with subscriptions to import
29
+    db_set_active('boinc');
30
+    $subscribed_boinc_users = db_query("
31 31
     SELECT DISTINCT userid FROM {subscriptions}
32 32
     ORDER BY userid ASC %s", $limit
33
-  );
34
-  db_set_active('default');
33
+    );
34
+    db_set_active('default');
35 35
   
36
-  // Import subscriptions
37
-  while ($boinc_subscription = db_fetch_object($subscribed_boinc_users)) {
36
+    // Import subscriptions
37
+    while ($boinc_subscription = db_fetch_object($subscribed_boinc_users)) {
38 38
     $uid = get_drupal_id($boinc_subscription->userid);
39 39
     $count = boincuser_pull_subscriptions($uid);
40 40
     $total_count += $count;
41 41
     echo "\nuser: {$uid}; boinc_id: {$boinc_subscription->userid}; {$count} subscriptions";
42
-  }
43
-  echo "\n";
44
-  echo $total_count;
45 42
\ No newline at end of file
43
+    }
44
+    echo "\n";
45
+    echo $total_count;
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/includes/import_users.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 
15
-  require_once('./includes/bootstrap.inc');
16
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
-  require_boinc('db');
15
+    require_once('./includes/bootstrap.inc');
16
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
+    require_boinc('db');
18 18
   
19
-  // Parse arguments
20
-  $import_lurkers = isset($argv[1]) ? $argv[1] : false;
21
-  $record_offset = isset($argv[2]) ? $argv[2] : 0;
22
-  $chunk_size = isset($argv[3]) ? $argv[3] : 100;
19
+    // Parse arguments
20
+    $import_lurkers = isset($argv[1]) ? $argv[1] : false;
21
+    $record_offset = isset($argv[2]) ? $argv[2] : 0;
22
+    $chunk_size = isset($argv[3]) ? $argv[3] : 100;
23 23
   
24
-  // Construct sql conditions
25
-  $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
24
+    // Construct sql conditions
25
+    $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
26 26
   
27
-  $count = 0;
27
+    $count = 0;
28 28
   
29
-  db_set_active('boinc');
30
-  if ($import_lurkers) {
29
+    db_set_active('boinc');
30
+    if ($import_lurkers) {
31 31
     $boinc_accounts = db_query('SELECT id FROM user ORDER BY id %s', $limit);
32
-  }
33
-  //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit);
34
-  else {
32
+    }
33
+    //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit);
34
+    else {
35 35
     // Need to import any user who is currently ignored in order to keep them
36 36
     // ignored... not particularly clean (ignored users are stored in a string)
37 37
     $ignored_user_list = array();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
       ORDER BY userid ASC"
43 43
     );
44 44
     while ($ignoring_user = db_fetch_object($ignoring_users)) {
45
-      $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1);
45
+        $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1);
46 46
     }
47 47
     $ignored_user_list = array_keys($ignored_user_list);
48 48
     $boinc_accounts = db_query("
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
         (SELECT DISTINCT senderid FROM {private_messages})
59 59
       ) AS usersToImport ORDER BY id ASC %s", implode(',', $ignored_user_list), $limit
60 60
     );
61
-  }
62
-  db_set_active('default');
61
+    }
62
+    db_set_active('default');
63 63
   
64
-  while ($boinc_account = db_fetch_object($boinc_accounts)) {
64
+    while ($boinc_account = db_fetch_object($boinc_accounts)) {
65 65
     // Grab the BOINC user object and create a Drupal user from it
66 66
     if (boincuser_register_make_drupal_user($boinc_account->id)) {
67
-      $count++;
67
+        $count++;
68
+    }
68 69
     }
69
-  }
70 70
   
71
-  echo $count;
72 71
\ No newline at end of file
72
+    echo $count;
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/boincimport.pages.inc 3 patches
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -5,45 +5,45 @@  discard block
 block discarded – undo
5 5
  * Callback admin/boinc/import/settings
6 6
  */
7 7
 function boincimport_admin_settings() {
8
-  global $conf ;
9
-  global $db_url;
10
-  global $base_url;
11
-  $stage = variable_get('boincimport_config_stage', 0); 
8
+    global $conf ;
9
+    global $db_url;
10
+    global $base_url;
11
+    $stage = variable_get('boincimport_config_stage', 0); 
12 12
   
13
-  // Start with a quick sanity check on the BOINC environment
14
-  boinc_get_path();
13
+    // Start with a quick sanity check on the BOINC environment
14
+    boinc_get_path();
15 15
   
16
-  //We'll be checking that the setup is complete.
17
-  //If it is not complete, the migration will not go ahead.
18
-  $ready_for_migration = 1;
16
+    //We'll be checking that the setup is complete.
17
+    //If it is not complete, the migration will not go ahead.
18
+    $ready_for_migration = 1;
19 19
 
20
-  // Checking that the migration has been tested on a copy first.
21
-  $form['test'] = array(
20
+    // Checking that the migration has been tested on a copy first.
21
+    $form['test'] = array(
22 22
     '#type' => 'fieldset',
23 23
     '#title' => t('Test on copy first'),
24 24
     '#collapsible' => TRUE,
25 25
     '#collapsed' => TRUE,
26
-  );
26
+    );
27 27
     
28
-  $output = '';
29
-  if (!variable_get('boincimport_tested', 0)) {
28
+    $output = '';
29
+    if (!variable_get('boincimport_tested', 0)) {
30 30
     $form['test']['#collapsed']= FALSE;
31 31
     $output = '<span class="marker">';
32 32
     $ready_for_migration = 0;
33
-  }
34
-  $output .= '<p>' . t('The migration will modify and even destroy some data. You
33
+    }
34
+    $output .= '<p>' . t('The migration will modify and even destroy some data. You
35 35
     must test this module on a copy of your data first, several times if necessary.
36 36
     Only use this module on your live data when you are familiar with the procedure
37 37
     and you\'re confident everything will run smoothly.') . '</p><p>' . t('Also, you
38 38
     should make a full backup of your database just prior to performing the
39 39
     migration on the live data. It is better to turn off both the BOINC site and the
40 40
     Drupal site during the migration.') . '</p>';
41
-  if (!variable_get('boincimport_tested', 0)) {
41
+    if (!variable_get('boincimport_tested', 0)) {
42 42
     $output .= '</span>';
43
-  }
44
-  $form['test']['intro'] = array('#value' => $output);
43
+    }
44
+    $form['test']['intro'] = array('#value' => $output);
45 45
 
46
-  $form['test']['boincimport_tested'] = array(
46
+    $form['test']['boincimport_tested'] = array(
47 47
     '#type' => 'checkbox',
48 48
     '#title' => t('I am running a trial migration on a disposable copy of the database
49 49
       OR I have already done so and I am running this on my live site, confident that
@@ -51,64 +51,64 @@  discard block
 block discarded – undo
51 51
     '#return_value' => 1,
52 52
     '#default_value' => variable_get('boincimport_tested', 0),
53 53
     '#description' => '',
54
-  );
54
+    );
55 55
   
56
-  // Where is BOINC data?
57
-  $pre = variable_get('boincimport_table_prefix', '');
58
-  $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user');
59
-  $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default';
60
-  $result = _boincimport_check_tables($tables, $db, 0);
56
+    // Where is BOINC data?
57
+    $pre = variable_get('boincimport_table_prefix', '');
58
+    $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user');
59
+    $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default';
60
+    $result = _boincimport_check_tables($tables, $db, 0);
61 61
   
62
-  $config_path = conf_path();
63
-  $form['boinc_data'] = array(
62
+    $config_path = conf_path();
63
+    $form['boinc_data'] = array(
64 64
     '#type' => 'fieldset',
65 65
     '#title' => t('Location of BOINC data'),
66 66
     '#collapsible' => TRUE,
67 67
     '#collapsed' => TRUE,
68
-  );
69
-  $form['boinc_data']['boincimport_db_configured'] = array(
68
+    );
69
+    $form['boinc_data']['boincimport_db_configured'] = array(
70 70
     '#type' => 'checkbox',
71 71
     '#title' => t('There is a \'boinc\' database connection string configured in %file',
72
-      array('%file' => "{$config_path}/settings.php")),
72
+        array('%file' => "{$config_path}/settings.php")),
73 73
     '#return_value' => 1,
74 74
     '#default_value' => variable_get('boincimport_db_configured', 1),
75 75
     '#description' => '',
76 76
     '#disabled' => ($result['result']) ? TRUE : FALSE
77
-  );
78
-  if (variable_get('boincimport_db_configured', 1) != 1) {
77
+    );
78
+    if (variable_get('boincimport_db_configured', 1) != 1) {
79 79
     $default_db_url = is_array($db_url) ? end($db_url) : $db_url;
80 80
     $url = variable_get('boincimport_db_url', $default_db_url);
81 81
     if (!preg_match('{(mysql|pgsql):\/\/(.+):(.*?)@(.+)/(\w+)}i', $url)) {
82
-      $output = '<p class="marker">'. t('Set the address of the BOINC database
82
+        $output = '<p class="marker">'. t('Set the address of the BOINC database
83 83
         according to the following format:') . '<br /><pre>
84 84
         mysql://boinc_username:boinc_password@localhost/boinc_database
85 85
         </pre></p>';
86
-      $ready_for_migration = 0;
87
-      $form['boinc_data']['#collapsed'] = FALSE;
88
-      $form['boinc_data']['db_connect_string_note'] = array('#value' => $output);
86
+        $ready_for_migration = 0;
87
+        $form['boinc_data']['#collapsed'] = FALSE;
88
+        $form['boinc_data']['db_connect_string_note'] = array('#value' => $output);
89 89
     }
90 90
 
91 91
     $form['boinc_data']['boincimport_db_url'] = array(
92
-      '#type' => 'textfield',
93
-      '#title' => t('BOINC database location'),
94
-      '#default_value' => variable_get('boincimport_db_url', $default_db_url),
95
-      '#size' => 80,
96
-      '#maxlength' => 255,
97
-      '#description' => '',
92
+        '#type' => 'textfield',
93
+        '#title' => t('BOINC database location'),
94
+        '#default_value' => variable_get('boincimport_db_url', $default_db_url),
95
+        '#size' => 80,
96
+        '#maxlength' => 255,
97
+        '#description' => '',
98 98
     );
99
-  }
99
+    }
100 100
 
101
-  $output = '<p>' . t('Note that due to a limitation within Drupal core, we cannot
101
+    $output = '<p>' . t('Note that due to a limitation within Drupal core, we cannot
102 102
     import messages from one database type to another database type. E.g, we
103 103
     cannot import BOINC from a myqsl DB, to a postgresql DB. You need to import
104 104
     the data into the same type of database first (import all the BOINC data, as is,
105 105
     from mysql to postgresql).') . '</p><p>' . t('If both BOINC and Drupal are on
106 106
     postgresql, see !this_issue.', array('!this_issue' => l(t('this issue'),
107 107
     'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))) . '</p>';
108
-  $form['boinc_data']['note'] = array('#value' => $output);
108
+    $form['boinc_data']['note'] = array('#value' => $output);
109 109
   
110
-  // BOINC table prefix
111
-  $form['boinc_data']['boincimport_table_prefix'] = array(
110
+    // BOINC table prefix
111
+    $form['boinc_data']['boincimport_table_prefix'] = array(
112 112
     '#type' => 'textfield',
113 113
     '#title' => t('BOINC table prefix'),
114 114
     '#default_value' => variable_get('boincimport_table_prefix', ''),
@@ -116,30 +116,30 @@  discard block
 block discarded – undo
116 116
     '#maxlength' => 255,
117 117
     '#description' => t('What prefix is used for your BOINC tables?'),
118 118
     '#disabled' => ($result['result']) ? TRUE : FALSE
119
-  );
119
+    );
120 120
   
121
-  $output = $result['html'];
122
-  if ($result['result'] != 1) {
121
+    $output = $result['html'];
122
+    if ($result['result'] != 1) {
123 123
     $ready_for_migration = 0;
124 124
     $form['boinc_data']['#collapsed']= FALSE;
125 125
     $output .= '<span class="marker">';
126 126
     $output .= t('Some tables couldn\'t be found. Are the database settings correct?
127 127
       Please correct the errors so that the BOINC tables can be accessed.');
128 128
     $output .= '</span>';
129
-  }
129
+    }
130 130
 
131
-  $form['boinc_data']['result'] = array('#value' => $output);
131
+    $form['boinc_data']['result'] = array('#value' => $output);
132 132
   
133
-  // USERS settings
134
-  $form['users'] = array(
133
+    // USERS settings
134
+    $form['users'] = array(
135 135
     '#type' => 'fieldset',
136 136
     '#title' => t('User import'),
137 137
     '#collapsible' => TRUE,
138 138
     '#collapsed' => TRUE,
139
-  );
139
+    );
140 140
 
141
-  // User import batch size
142
-  $form['users']['boincimport_user_batch_size'] = array(
141
+    // User import batch size
142
+    $form['users']['boincimport_user_batch_size'] = array(
143 143
     '#type' => 'textfield',
144 144
     '#title' => t('Number of accounts to process at a time'),
145 145
     '#default_value' => variable_get('boincimport_user_batch_size', 50),
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     '#description' => t('Due to memory intensive API calls, this value may have to
149 149
       be adjusted to avoid exhausting system resources. The default value is a
150 150
       balance between performance and reliability.')
151
-  );
151
+    );
152 152
 
153
-  // Import users who have never posted?
154
-  $form['users']['boincimport_import_lurkers'] = array(
153
+    // Import users who have never posted?
154
+    $form['users']['boincimport_import_lurkers'] = array(
155 155
     '#type' => 'checkbox',
156 156
     '#title' => t('Import users who have never posted?'),
157 157
     '#return_value' => 1,
@@ -160,199 +160,199 @@  discard block
 block discarded – undo
160 160
       involvement? This may not be desired, as it can take a very long time to
161 161
       import tens or hundreds of thousands of accounts. (note that users who
162 162
       are not imported now will still be imported on-the-fly upon login)'),
163
-  );
163
+    );
164 164
 
165
-  // Input format settings
166
-  $form['input'] = array(
165
+    // Input format settings
166
+    $form['input'] = array(
167 167
     '#type' => 'fieldset',
168 168
     '#title' => t('Input format settings'),
169 169
     '#collapsible' => TRUE,
170 170
     '#collapsed' => TRUE
171
-  );
172
-  $output = '<p>'. t('Select which !input_format should be used for the imported
171
+    );
172
+    $output = '<p>'. t('Select which !input_format should be used for the imported
173 173
     messages. It is highly-recommended that this value be left as it is, as the
174 174
     Full HTML and PHP code formats can be very dangerous!', 
175 175
     array('!input_format' => l(t('input format'), 'admin/settings/filters'))) .'</p>';
176
-  $form['input']['intro'] = array('#value' => $output);
176
+    $form['input']['intro'] = array('#value' => $output);
177 177
   
178
-  $formats = db_query('SELECT format, name FROM {filter_formats}');
179
-  while ($format = db_fetch_array($formats)) {
178
+    $formats = db_query('SELECT format, name FROM {filter_formats}');
179
+    while ($format = db_fetch_array($formats)) {
180 180
     $input_formats[$format['format']]= $format['name'];
181
-  }
181
+    }
182 182
   
183
-  // By default, use the format named "Rich text"; fall back to Filtered HTML
184
-  $default_input_format = db_result(db_query("
183
+    // By default, use the format named "Rich text"; fall back to Filtered HTML
184
+    $default_input_format = db_result(db_query("
185 185
     SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text'));
186
-  if (!$default_input_format) $default_input_format = 1;
186
+    if (!$default_input_format) $default_input_format = 1;
187 187
   
188
-  $input_format = variable_get('boincimport_input_format', $default_input_format);
189
-  $form['input']['boincimport_input_format'] = array(
188
+    $input_format = variable_get('boincimport_input_format', $default_input_format);
189
+    $form['input']['boincimport_input_format'] = array(
190 190
     '#type' => 'radios',
191 191
     '#title' => t('Input format'),
192 192
     '#default_value' => $input_format,
193 193
     '#options' => $input_formats
194
-  );
195
-  if (!$input_format) {
194
+    );
195
+    if (!$input_format) {
196 196
     $ready_for_migration = 0;
197 197
     $form['input']['#collapsed']= FALSE;
198
-  }
199
-  $output = '<p><em>'. t('This setting will be applied to all posts and private
198
+    }
199
+    $output = '<p><em>'. t('This setting will be applied to all posts and private
200 200
     messages.') .'</em></p>';
201
-  $form['input']['result'] = array('#value' => $output);
201
+    $form['input']['result'] = array('#value' => $output);
202 202
   
203
-  // BBcode settings
204
-  $form['bbcode'] = array(
203
+    // BBcode settings
204
+    $form['bbcode'] = array(
205 205
     '#type' => 'fieldset',
206 206
     '#title' => t('BBcode settings'),
207 207
     '#collapsible' => TRUE,
208 208
     '#collapsed' => TRUE,
209
-  );
209
+    );
210 210
   
211
-  $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the
211
+    $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the
212 212
     import process, BBcode can be handled in two diffent ways') . ':</p>';
213
-  $output .= '<ul><li>' . t('Leave the BBcode as is and use the !bbcode_module
213
+    $output .= '<ul><li>' . t('Leave the BBcode as is and use the !bbcode_module
214 214
     after the migration to filter the imported posts. In this case, the module
215 215
     is not required during the migration, but will need to be installed and
216 216
     configured later.',
217 217
     array('!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode',
218 218
     array('attributes' => array('target' => '_blank'))))) . '</li>';
219
-  $output .= '<li>' . t('Filter the BBcode now and replace it with plain HTML.
219
+    $output .= '<li>' . t('Filter the BBcode now and replace it with plain HTML.
220 220
     The BBcode module will be required during the migration process, but can
221 221
     be disabled afterwards.') . '</li></ul>';
222
-  $output .= '<p>' . t('An appropriate input filter should be chosen, as well,
222
+    $output .= '<p>' . t('An appropriate input filter should be chosen, as well,
223 223
     as it will affect how the post is displayed. For example, if BBcode is
224 224
     removed and replaced by HTML, some HTML tags will be stripped by the
225 225
     "Filtered HTML" input format unless they are first added to the list of
226 226
     allowed tags in that format. See the !input_formats page.',
227 227
     array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))) . '</p>';
228 228
     
229
-  $form['bbcode']['intro'] = array('#value' => $output);
230
-  $form['bbcode']['boincimport_bbcode'] = array(
229
+    $form['bbcode']['intro'] = array('#value' => $output);
230
+    $form['bbcode']['boincimport_bbcode'] = array(
231 231
     '#type' => 'radios',
232 232
     '#title' => t('BBcode handling'),
233 233
     '#default_value' => variable_get('boincimport_bbcode', 0),
234 234
     '#options' => array(t('Leave BBcode as is.'), t('Transform BBcode into HTML.')),
235 235
     '#description' => '',
236
-  );
236
+    );
237 237
   
238
-  $module_status = _boincimport_check_module('bbcode');
239
-  $bbcode_disabled = ($module_status['result'] == 0) ? true : false;
240
-  $output = $module_status['html'];
238
+    $module_status = _boincimport_check_module('bbcode');
239
+    $bbcode_disabled = ($module_status['result'] == 0) ? true : false;
240
+    $output = $module_status['html'];
241 241
   
242
-  if (variable_get('boincimport_bbcode', 0)) {
242
+    if (variable_get('boincimport_bbcode', 0)) {
243 243
     if ($bbcode_disabled) {
244
-      $ready_for_migration = 0;
245
-      $form['bbcode']['#collapsed'] = FALSE;
246
-      $output .= '<p><span class="marker">';
247
-      $output .= t('The !bbcode_module is required to transform BBcode into HTML.
244
+        $ready_for_migration = 0;
245
+        $form['bbcode']['#collapsed'] = FALSE;
246
+        $output .= '<p><span class="marker">';
247
+        $output .= t('The !bbcode_module is required to transform BBcode into HTML.
248 248
         You first need to !enable_bbcode', array(
249
-          '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))),
250
-          '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules')));
251
-      $output .= '</span></p>';
249
+            '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))),
250
+            '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules')));
251
+        $output .= '</span></p>';
252 252
     }
253 253
     $sql = "SELECT COUNT(*) FROM {filters} WHERE module = 'bbcode' AND format = %d";
254 254
     $result = db_query($sql, $input_format);
255 255
     if (!db_result($result)) {
256
-      $form['bbcode']['#collapsed'] = FALSE;
257
-      $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and
256
+        $form['bbcode']['#collapsed'] = FALSE;
257
+        $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and
258 258
         then !configure_bbcode_options', array(
259
-          '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
260
-          '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) .'</p>';
259
+            '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
260
+            '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) .'</p>';
261 261
     }
262 262
     $output .= '<p>'. t('For best results, !disable_all_options', 
263 263
     array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))) . '.</p>';
264
-  } else {
264
+    } else {
265 265
     if ($bbcode_disabled) {
266
-      $form['bbcode']['#collapsed'] = FALSE;
267
-      $output .= '<p>'. t('The !bbcode_module is recommended, but not required.
266
+        $form['bbcode']['#collapsed'] = FALSE;
267
+        $output .= '<p>'. t('The !bbcode_module is recommended, but not required.
268 268
         You may !enable_bbcode after having installed it.', array(
269
-          '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))),
270
-          '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))) .'</p>';
269
+            '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))),
270
+            '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))) .'</p>';
271 271
     }
272 272
     $output .= '<p>' . t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array(
273
-      '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
274
-      '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) . '</p>';
273
+        '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
274
+        '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) . '</p>';
275 275
     $output .= '<p>' . t('You may want to enable it for other input formats, too.') . '</p>';
276
-  }
277
-  $output .= '<p><em>'. t('This setting will be applied to all posts, private
276
+    }
277
+    $output .= '<p><em>'. t('This setting will be applied to all posts, private
278 278
     messages and the users\' signature.') .'</em></p>';
279 279
     
280
-  $form['bbcode']['result'] = array('#value' => $output);
280
+    $form['bbcode']['result'] = array('#value' => $output);
281 281
   
282
-  // URL transform settings
283
-  $form['url_transforms'] = array(
282
+    // URL transform settings
283
+    $form['url_transforms'] = array(
284 284
     '#type' => 'fieldset',
285 285
     '#title' => t('URL transforms'),
286 286
     '#collapsible' => TRUE,
287 287
     '#collapsed' => TRUE,
288
-  );
289
-  if (!variable_get('boincimport_base_url_boinc', 0)) {
288
+    );
289
+    if (!variable_get('boincimport_base_url_boinc', 0)) {
290 290
     $form['url_transforms']['#collapsed']= FALSE;
291 291
     $output = '<span class="marker">';
292 292
     $ready_for_migration = 0;
293
-  }
293
+    }
294 294
 
295
-  // List of BOINC domains possible in URLs to transform
296
-  $form['url_transforms']['boincimport_base_url_boinc'] = array(
295
+    // List of BOINC domains possible in URLs to transform
296
+    $form['url_transforms']['boincimport_base_url_boinc'] = array(
297 297
     '#type' => 'textarea',
298 298
     '#title' => t('BOINC base URLs to transform'),
299 299
     '#default_value' => variable_get('boincimport_base_url_boinc', ''),
300 300
     '#description' => t('List URL bases that should be transformed from
301 301
       BOINC format to Drupal format (enter one domain per line, including http://).'),
302
-  );
302
+    );
303 303
 
304
-  // The Drupal domain to use in URL transform results
305
-  $form['url_transforms']['boincimport_base_url_drupal'] = array(
304
+    // The Drupal domain to use in URL transform results
305
+    $form['url_transforms']['boincimport_base_url_drupal'] = array(
306 306
     '#type' => 'textfield',
307 307
     '#title' => t('Target Drupal base URL'),
308 308
     '#default_value' => variable_get('boincimport_base_url_drupal', ''),
309 309
     '#description' => t('Specify the URL base to use in transform results. If
310 310
       left blank, the base_url configured in this Drupal environment will be
311 311
       used (currently: %url)', array('%url' =>$base_url)),
312
-  );
312
+    );
313 313
   
314
-  // Are we ready for migration?
315
-  $form['migration'] = array(
314
+    // Are we ready for migration?
315
+    $form['migration'] = array(
316 316
     '#type' => 'fieldset',
317 317
     '#title' => 'Migration',
318 318
     '#collapsible' => TRUE,
319 319
     '#collapsed' => FALSE,
320
-  );
321
-  variable_set('boincimport_ready', $ready_for_migration);
322
-  if ($ready_for_migration) {
320
+    );
321
+    variable_set('boincimport_ready', $ready_for_migration);
322
+    if ($ready_for_migration) {
323 323
     $output = '<p>'. t('Check the settings above one more time. If everything
324 324
       is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))) .'</p>';
325
-  } else {
325
+    } else {
326 326
     $output = '<p class="marker">'. t('You are not ready for the migration yet.
327 327
       Please check the settings above.') .'</p>';
328
-  }
328
+    }
329 329
   
330
-  $form['migration']['info'] = array('#value' => $output);
331
-  return system_settings_form($form); 
330
+    $form['migration']['info'] = array('#value' => $output);
331
+    return system_settings_form($form); 
332 332
 }
333 333
 
334 334
 /**
335 335
  * Callback admin/boinc/import/post_configuration
336 336
  */
337 337
 function boincimport_post_configuration() {
338
-  $output = '<p>'. t('This page will help to tie up any loose ends following
338
+    $output = '<p>'. t('This page will help to tie up any loose ends following
339 339
     the BOINC data import process. Before continuing, it may be best to have
340 340
     already:') .'</p>';
341
-  $output .= '<ul>';
342
-  $output .= '<li>'. t('Imported users, teams, and forums using the BOINC
341
+    $output .= '<ul>';
342
+    $output .= '<li>'. t('Imported users, teams, and forums using the BOINC
343 343
     import module') .'</li>';
344
-  $output .= '<li>'. t('Imported any additional data using add on modules if
344
+    $output .= '<li>'. t('Imported any additional data using add on modules if
345 345
     available.') .'</li>';
346
-  $output .= '</ul>';
347
-  //User Set up
348
-  $output .= '<h2>'. t('User settings') .'</h2>';  
349
-  $output .= '<p>'. t('Make sure your !user_settings are correct. Specifically,
346
+    $output .= '</ul>';
347
+    //User Set up
348
+    $output .= '<h2>'. t('User settings') .'</h2>';  
349
+    $output .= '<p>'. t('Make sure your !user_settings are correct. Specifically,
350 350
     you can enable or disable signatures there. ', array(
351
-      '!user_settings' => l(t('user settings'), 'admin/user/settings')
351
+        '!user_settings' => l(t('user settings'), 'admin/user/settings')
352 352
     )) .'</p>'; 
353
-  $output .= '<p>' . t('Note that avatar/picture support is not tied to user
353
+    $output .= '<p>' . t('Note that avatar/picture support is not tied to user
354 354
     settings Picture support at this time.') . '</p>';
355
-  /*$output .= '<p>' . t('In order to activate avatar/picture support, you need to
355
+    /*$output .= '<p>' . t('In order to activate avatar/picture support, you need to
356 356
     enable pictures on this page and also:') . '</p>';
357 357
   $output .= '<ul>';
358 358
   $output .= '<li>'. t('Tick the checkboxes to allow "User pictures in posts" and/or
@@ -365,73 +365,73 @@  discard block
 block discarded – undo
365 365
     )) .'</li>';
366 366
   $output .= '</ul>'; */
367 367
   
368
-  // Forum Set up
369
-  $output .= '<h2>'. t('Forum settings') .'</h2>';
370
-  $output .= '<p>'. t('Check any additional changes to make on the
368
+    // Forum Set up
369
+    $output .= '<h2>'. t('Forum settings') .'</h2>';
370
+    $output .= '<p>'. t('Check any additional changes to make on the
371 371
     !forum_settings page.', array(
372
-      '!forum_settings' =>  l(t('forum settings'), 'admin/content/forum/settings')
372
+        '!forum_settings' =>  l(t('forum settings'), 'admin/content/forum/settings')
373 373
     )) .'</p>';
374
-  $output .= '<p>'. t('It also may be a good idea to look at the !forum_list to
374
+    $output .= '<p>'. t('It also may be a good idea to look at the !forum_list to
375 375
     verify that all necessary containers and forums are in place.', array(
376
-      '!forum_list' =>  l(t('forum list'), 'admin/content/forum')
376
+        '!forum_list' =>  l(t('forum list'), 'admin/content/forum')
377 377
     )) .'</p>';
378
-  /*$output .= '<p>'. t('If need be, set up the private forums as explained in the
378
+    /*$output .= '<p>'. t('If need be, set up the private forums as explained in the
379 379
     !documentation.', array(
380 380
       '!documentation' => l(t('documentation'), 'http://drupal.org/node/58969', array('attributes' => array('target' => '_blank')))
381 381
     )) .'</p>';
382 382
     */
383
-  /*
383
+    /*
384 384
   // Redirection from old URLs:
385 385
   $output .= '<h2>'. t('Redirection from BOINC forum URLs to new Drupal forum URLs') .'</h2>';
386 386
   $output .= '<p>'. t('Enable the boincforum_redirect.module. This way, users
387 387
     accessing URLs from your old BOINC installation will be redirected to your new
388 388
     Drupal forum.') .'</p>';
389 389
   */
390
-  // BBcode
391
-  $bbcode = variable_get('boincimport_bbcode', 0);
392
-  if ($bbcode) {
390
+    // BBcode
391
+    $bbcode = variable_get('boincimport_bbcode', 0);
392
+    if ($bbcode) {
393 393
     $output .= '<h2>'. t('Remove BBcode module') .'</h2>';
394 394
     $output .= '<p>'. t('The BBcode has been cleaned from the posts. You shouldn\'t
395 395
       need the bbcode module anymore. You can disable it.') .'</p>';
396
-  } else {
396
+    } else {
397 397
     $output .= '<h2>'. t('Configure BBcode module') .'</h2>';
398 398
     $output .= '<p>'. t('Most likely, there are many BOINC forum postings
399 399
       formatted in BBcode. It would be a good idea to verify that BBcode is
400 400
       being formatted correctly in the imported posts. Have a look around
401 401
       !the_forum.', array(
402 402
         '!the_forum' =>  l(t('the forum'), 'community')
403
-      )) . '</p>';
404
-  }
403
+        )) . '</p>';
404
+    }
405 405
 
406
-  return $output;
406
+    return $output;
407 407
 }
408 408
 
409 409
 /**
410 410
  * Callback admin/boinc/import
411 411
  */
412 412
 function boincimport_main() {
413
-  // Start with a quick sanity check on the BOINC environment
414
-  boinc_get_path();
415
-  // If that's ok, on with the show
416
-  $output .= t('You may want to !check_documentation before starting.', array(
413
+    // Start with a quick sanity check on the BOINC environment
414
+    boinc_get_path();
415
+    // If that's ok, on with the show
416
+    $output .= t('You may want to !check_documentation before starting.', array(
417 417
     '!check_documentation' => l(t('check the documentation'), 'http://boinc.berkeley.edu/trac/wiki/InstallDrupal', array('attributes' =>array('target' => '_blank')))
418
-  ));
419
-  $output = '<ol><li>';
420
-  $output .= l(t('Configure the migration'), 'admin/boinc/import/settings');
421
-  $output .= '</li>';
422
-  $output .= '<li>';
423
-  $output .= l(t('Execute the migration'), 'admin/boinc/import/process');
424
-  $output .= '</li>';
425
-  $output .= '<li>';
426
-  $output .= l(t('Post migration configuration'), 'admin/boinc/import/post_configuration');
427
-  $output .= '</li>';
428
-  $output .= '<li>';
429
-  $output .= t('!cleanup (Accessing this link will delete all the saved BOINC forum
418
+    ));
419
+    $output = '<ol><li>';
420
+    $output .= l(t('Configure the migration'), 'admin/boinc/import/settings');
421
+    $output .= '</li>';
422
+    $output .= '<li>';
423
+    $output .= l(t('Execute the migration'), 'admin/boinc/import/process');
424
+    $output .= '</li>';
425
+    $output .= '<li>';
426
+    $output .= l(t('Post migration configuration'), 'admin/boinc/import/post_configuration');
427
+    $output .= '</li>';
428
+    $output .= '<li>';
429
+    $output .= t('!cleanup (Accessing this link will delete all the saved BOINC forum
430 430
     conversion settings: click only when you\'re done with all the above.)', array(
431
-      '!cleanup' => l(t('Cleanup'), 'admin/boinc/import/cleanup')
431
+        '!cleanup' => l(t('Cleanup'), 'admin/boinc/import/cleanup')
432 432
     ));
433
-  $output .= '</li>';
434
-  /*$output .= '<li>';
433
+    $output .= '</li>';
434
+    /*$output .= '<li>';
435 435
   $output .= t('Enable the boincforum_redirect module for seamless redirection
436 436
     from the old forums to the new. This module requires !clean_urls to be active.', array(
437 437
       '!clean_urls' => l(t('Clean URLs'), 'admin/settings/clean-urls')
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
     uninstall BOINC forum - This will delete tables necessary for redirection. You can,
443 443
     however, deactivate the module safely.');
444 444
   $output .= '</li>';*/
445
-  $output .= '</ol>';
445
+    $output .= '</ol>';
446 446
 
447
-  // process will die() if the link to the BOINC database is wrong:
448
-  $output .= '<p>'. t('If the BOINC data is in another database, but you made a
447
+    // process will die() if the link to the BOINC database is wrong:
448
+    $output .= '<p>'. t('If the BOINC data is in another database, but you made a
449 449
     mistake while setting up the data base url, you may be unable to access the
450 450
     setting page due to some limitations of the core of Drupal. !reset_db_url.', array(
451
-      '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset')
451
+        '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset')
452 452
     )) .'</p>';
453 453
 
454
-  return $output;
454
+    return $output;
455 455
 }
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * Callback admin/boinc/import/settings
6 6
  */
7 7
 function boincimport_admin_settings() {
8
-  global $conf ;
8
+  global $conf;
9 9
   global $db_url;
10 10
   global $base_url;
11 11
   $stage = variable_get('boincimport_config_stage', 0); 
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
27 27
     
28 28
   $output = '';
29 29
   if (!variable_get('boincimport_tested', 0)) {
30
-    $form['test']['#collapsed']= FALSE;
30
+    $form['test']['#collapsed'] = FALSE;
31 31
     $output = '<span class="marker">';
32 32
     $ready_for_migration = 0;
33 33
   }
34
-  $output .= '<p>' . t('The migration will modify and even destroy some data. You
34
+  $output .= '<p>'.t('The migration will modify and even destroy some data. You
35 35
     must test this module on a copy of your data first, several times if necessary.
36 36
     Only use this module on your live data when you are familiar with the procedure
37
-    and you\'re confident everything will run smoothly.') . '</p><p>' . t('Also, you
37
+    and you\'re confident everything will run smoothly.').'</p><p>'.t('Also, you
38 38
     should make a full backup of your database just prior to performing the
39 39
     migration on the live data. It is better to turn off both the BOINC site and the
40
-    Drupal site during the migration.') . '</p>';
40
+    Drupal site during the migration.').'</p>';
41 41
   if (!variable_get('boincimport_tested', 0)) {
42 42
     $output .= '</span>';
43 43
   }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
   
56 56
   // Where is BOINC data?
57 57
   $pre = variable_get('boincimport_table_prefix', '');
58
-  $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user');
58
+  $tables = array($pre.'forum', $pre.'post', $pre.'thread', $pre.'user');
59 59
   $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default';
60 60
   $result = _boincimport_check_tables($tables, $db, 0);
61 61
   
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
     $default_db_url = is_array($db_url) ? end($db_url) : $db_url;
80 80
     $url = variable_get('boincimport_db_url', $default_db_url);
81 81
     if (!preg_match('{(mysql|pgsql):\/\/(.+):(.*?)@(.+)/(\w+)}i', $url)) {
82
-      $output = '<p class="marker">'. t('Set the address of the BOINC database
83
-        according to the following format:') . '<br /><pre>
82
+      $output = '<p class="marker">'.t('Set the address of the BOINC database
83
+        according to the following format:').'<br /><pre>
84 84
         mysql://boinc_username:boinc_password@localhost/boinc_database
85 85
         </pre></p>';
86 86
       $ready_for_migration = 0;
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
     );
99 99
   }
100 100
 
101
-  $output = '<p>' . t('Note that due to a limitation within Drupal core, we cannot
101
+  $output = '<p>'.t('Note that due to a limitation within Drupal core, we cannot
102 102
     import messages from one database type to another database type. E.g, we
103 103
     cannot import BOINC from a myqsl DB, to a postgresql DB. You need to import
104 104
     the data into the same type of database first (import all the BOINC data, as is,
105
-    from mysql to postgresql).') . '</p><p>' . t('If both BOINC and Drupal are on
105
+    from mysql to postgresql).').'</p><p>'.t('If both BOINC and Drupal are on
106 106
     postgresql, see !this_issue.', array('!this_issue' => l(t('this issue'),
107
-    'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))) . '</p>';
107
+    'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))).'</p>';
108 108
   $form['boinc_data']['note'] = array('#value' => $output);
109 109
   
110 110
   // BOINC table prefix
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
   $output = $result['html'];
122 122
   if ($result['result'] != 1) {
123 123
     $ready_for_migration = 0;
124
-    $form['boinc_data']['#collapsed']= FALSE;
124
+    $form['boinc_data']['#collapsed'] = FALSE;
125 125
     $output .= '<span class="marker">';
126 126
     $output .= t('Some tables couldn\'t be found. Are the database settings correct?
127 127
       Please correct the errors so that the BOINC tables can be accessed.');
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
     '#collapsible' => TRUE,
170 170
     '#collapsed' => TRUE
171 171
   );
172
-  $output = '<p>'. t('Select which !input_format should be used for the imported
172
+  $output = '<p>'.t('Select which !input_format should be used for the imported
173 173
     messages. It is highly-recommended that this value be left as it is, as the
174 174
     Full HTML and PHP code formats can be very dangerous!', 
175
-    array('!input_format' => l(t('input format'), 'admin/settings/filters'))) .'</p>';
175
+    array('!input_format' => l(t('input format'), 'admin/settings/filters'))).'</p>';
176 176
   $form['input']['intro'] = array('#value' => $output);
177 177
   
178 178
   $formats = db_query('SELECT format, name FROM {filter_formats}');
179 179
   while ($format = db_fetch_array($formats)) {
180
-    $input_formats[$format['format']]= $format['name'];
180
+    $input_formats[$format['format']] = $format['name'];
181 181
   }
182 182
   
183 183
   // By default, use the format named "Rich text"; fall back to Filtered HTML
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
   );
195 195
   if (!$input_format) {
196 196
     $ready_for_migration = 0;
197
-    $form['input']['#collapsed']= FALSE;
197
+    $form['input']['#collapsed'] = FALSE;
198 198
   }
199
-  $output = '<p><em>'. t('This setting will be applied to all posts and private
200
-    messages.') .'</em></p>';
199
+  $output = '<p><em>'.t('This setting will be applied to all posts and private
200
+    messages.').'</em></p>';
201 201
   $form['input']['result'] = array('#value' => $output);
202 202
   
203 203
   // BBcode settings
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
     '#collapsed' => TRUE,
209 209
   );
210 210
   
211
-  $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the
212
-    import process, BBcode can be handled in two diffent ways') . ':</p>';
213
-  $output .= '<ul><li>' . t('Leave the BBcode as is and use the !bbcode_module
211
+  $output = '<p>'.t('BOINC posts are often formatted in BBcode. During the
212
+    import process, BBcode can be handled in two diffent ways').':</p>';
213
+  $output .= '<ul><li>'.t('Leave the BBcode as is and use the !bbcode_module
214 214
     after the migration to filter the imported posts. In this case, the module
215 215
     is not required during the migration, but will need to be installed and
216 216
     configured later.',
217 217
     array('!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode',
218
-    array('attributes' => array('target' => '_blank'))))) . '</li>';
219
-  $output .= '<li>' . t('Filter the BBcode now and replace it with plain HTML.
218
+    array('attributes' => array('target' => '_blank'))))).'</li>';
219
+  $output .= '<li>'.t('Filter the BBcode now and replace it with plain HTML.
220 220
     The BBcode module will be required during the migration process, but can
221
-    be disabled afterwards.') . '</li></ul>';
222
-  $output .= '<p>' . t('An appropriate input filter should be chosen, as well,
221
+    be disabled afterwards.').'</li></ul>';
222
+  $output .= '<p>'.t('An appropriate input filter should be chosen, as well,
223 223
     as it will affect how the post is displayed. For example, if BBcode is
224 224
     removed and replaced by HTML, some HTML tags will be stripped by the
225 225
     "Filtered HTML" input format unless they are first added to the list of
226 226
     allowed tags in that format. See the !input_formats page.',
227
-    array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))) . '</p>';
227
+    array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))).'</p>';
228 228
     
229 229
   $form['bbcode']['intro'] = array('#value' => $output);
230 230
   $form['bbcode']['boincimport_bbcode'] = array(
@@ -254,28 +254,28 @@  discard block
 block discarded – undo
254 254
     $result = db_query($sql, $input_format);
255 255
     if (!db_result($result)) {
256 256
       $form['bbcode']['#collapsed'] = FALSE;
257
-      $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and
257
+      $output .= '<p class="marker">'.t('You need to !enable_bbcode_input and
258 258
         then !configure_bbcode_options', array(
259 259
           '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
260
-          '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) .'</p>';
260
+          '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))).'</p>';
261 261
     }
262
-    $output .= '<p>'. t('For best results, !disable_all_options', 
263
-    array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))) . '.</p>';
262
+    $output .= '<p>'.t('For best results, !disable_all_options', 
263
+    array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))).'.</p>';
264 264
   } else {
265 265
     if ($bbcode_disabled) {
266 266
       $form['bbcode']['#collapsed'] = FALSE;
267
-      $output .= '<p>'. t('The !bbcode_module is recommended, but not required.
267
+      $output .= '<p>'.t('The !bbcode_module is recommended, but not required.
268 268
         You may !enable_bbcode after having installed it.', array(
269 269
           '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))),
270
-          '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))) .'</p>';
270
+          '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))).'</p>';
271 271
     }
272
-    $output .= '<p>' . t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array(
272
+    $output .= '<p>'.t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array(
273 273
       '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
274
-      '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) . '</p>';
275
-    $output .= '<p>' . t('You may want to enable it for other input formats, too.') . '</p>';
274
+      '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))).'</p>';
275
+    $output .= '<p>'.t('You may want to enable it for other input formats, too.').'</p>';
276 276
   }
277
-  $output .= '<p><em>'. t('This setting will be applied to all posts, private
278
-    messages and the users\' signature.') .'</em></p>';
277
+  $output .= '<p><em>'.t('This setting will be applied to all posts, private
278
+    messages and the users\' signature.').'</em></p>';
279 279
     
280 280
   $form['bbcode']['result'] = array('#value' => $output);
281 281
   
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     '#collapsed' => TRUE,
288 288
   );
289 289
   if (!variable_get('boincimport_base_url_boinc', 0)) {
290
-    $form['url_transforms']['#collapsed']= FALSE;
290
+    $form['url_transforms']['#collapsed'] = FALSE;
291 291
     $output = '<span class="marker">';
292 292
     $ready_for_migration = 0;
293 293
   }
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
   );
321 321
   variable_set('boincimport_ready', $ready_for_migration);
322 322
   if ($ready_for_migration) {
323
-    $output = '<p>'. t('Check the settings above one more time. If everything
324
-      is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))) .'</p>';
323
+    $output = '<p>'.t('Check the settings above one more time. If everything
324
+      is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))).'</p>';
325 325
   } else {
326
-    $output = '<p class="marker">'. t('You are not ready for the migration yet.
327
-      Please check the settings above.') .'</p>';
326
+    $output = '<p class="marker">'.t('You are not ready for the migration yet.
327
+      Please check the settings above.').'</p>';
328 328
   }
329 329
   
330 330
   $form['migration']['info'] = array('#value' => $output);
@@ -335,23 +335,23 @@  discard block
 block discarded – undo
335 335
  * Callback admin/boinc/import/post_configuration
336 336
  */
337 337
 function boincimport_post_configuration() {
338
-  $output = '<p>'. t('This page will help to tie up any loose ends following
338
+  $output = '<p>'.t('This page will help to tie up any loose ends following
339 339
     the BOINC data import process. Before continuing, it may be best to have
340
-    already:') .'</p>';
340
+    already:').'</p>';
341 341
   $output .= '<ul>';
342
-  $output .= '<li>'. t('Imported users, teams, and forums using the BOINC
343
-    import module') .'</li>';
344
-  $output .= '<li>'. t('Imported any additional data using add on modules if
345
-    available.') .'</li>';
342
+  $output .= '<li>'.t('Imported users, teams, and forums using the BOINC
343
+    import module').'</li>';
344
+  $output .= '<li>'.t('Imported any additional data using add on modules if
345
+    available.').'</li>';
346 346
   $output .= '</ul>';
347 347
   //User Set up
348
-  $output .= '<h2>'. t('User settings') .'</h2>';  
349
-  $output .= '<p>'. t('Make sure your !user_settings are correct. Specifically,
348
+  $output .= '<h2>'.t('User settings').'</h2>';  
349
+  $output .= '<p>'.t('Make sure your !user_settings are correct. Specifically,
350 350
     you can enable or disable signatures there. ', array(
351 351
       '!user_settings' => l(t('user settings'), 'admin/user/settings')
352
-    )) .'</p>'; 
353
-  $output .= '<p>' . t('Note that avatar/picture support is not tied to user
354
-    settings Picture support at this time.') . '</p>';
352
+    )).'</p>'; 
353
+  $output .= '<p>'.t('Note that avatar/picture support is not tied to user
354
+    settings Picture support at this time.').'</p>';
355 355
   /*$output .= '<p>' . t('In order to activate avatar/picture support, you need to
356 356
     enable pictures on this page and also:') . '</p>';
357 357
   $output .= '<ul>';
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
   $output .= '</ul>'; */
367 367
   
368 368
   // Forum Set up
369
-  $output .= '<h2>'. t('Forum settings') .'</h2>';
370
-  $output .= '<p>'. t('Check any additional changes to make on the
369
+  $output .= '<h2>'.t('Forum settings').'</h2>';
370
+  $output .= '<p>'.t('Check any additional changes to make on the
371 371
     !forum_settings page.', array(
372 372
       '!forum_settings' =>  l(t('forum settings'), 'admin/content/forum/settings')
373
-    )) .'</p>';
374
-  $output .= '<p>'. t('It also may be a good idea to look at the !forum_list to
373
+    )).'</p>';
374
+  $output .= '<p>'.t('It also may be a good idea to look at the !forum_list to
375 375
     verify that all necessary containers and forums are in place.', array(
376 376
       '!forum_list' =>  l(t('forum list'), 'admin/content/forum')
377
-    )) .'</p>';
377
+    )).'</p>';
378 378
   /*$output .= '<p>'. t('If need be, set up the private forums as explained in the
379 379
     !documentation.', array(
380 380
       '!documentation' => l(t('documentation'), 'http://drupal.org/node/58969', array('attributes' => array('target' => '_blank')))
@@ -390,17 +390,17 @@  discard block
 block discarded – undo
390 390
   // BBcode
391 391
   $bbcode = variable_get('boincimport_bbcode', 0);
392 392
   if ($bbcode) {
393
-    $output .= '<h2>'. t('Remove BBcode module') .'</h2>';
394
-    $output .= '<p>'. t('The BBcode has been cleaned from the posts. You shouldn\'t
395
-      need the bbcode module anymore. You can disable it.') .'</p>';
393
+    $output .= '<h2>'.t('Remove BBcode module').'</h2>';
394
+    $output .= '<p>'.t('The BBcode has been cleaned from the posts. You shouldn\'t
395
+      need the bbcode module anymore. You can disable it.').'</p>';
396 396
   } else {
397
-    $output .= '<h2>'. t('Configure BBcode module') .'</h2>';
398
-    $output .= '<p>'. t('Most likely, there are many BOINC forum postings
397
+    $output .= '<h2>'.t('Configure BBcode module').'</h2>';
398
+    $output .= '<p>'.t('Most likely, there are many BOINC forum postings
399 399
       formatted in BBcode. It would be a good idea to verify that BBcode is
400 400
       being formatted correctly in the imported posts. Have a look around
401 401
       !the_forum.', array(
402 402
         '!the_forum' =>  l(t('the forum'), 'community')
403
-      )) . '</p>';
403
+      )).'</p>';
404 404
   }
405 405
 
406 406
   return $output;
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
   $output .= '</ol>';
446 446
 
447 447
   // process will die() if the link to the BOINC database is wrong:
448
-  $output .= '<p>'. t('If the BOINC data is in another database, but you made a
448
+  $output .= '<p>'.t('If the BOINC data is in another database, but you made a
449 449
     mistake while setting up the data base url, you may be unable to access the
450 450
     setting page due to some limitations of the core of Drupal. !reset_db_url.', array(
451 451
       '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset')
452
-    )) .'</p>';
452
+    )).'</p>';
453 453
 
454 454
   return $output;
455 455
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
   $form['test'] = array(
22 22
     '#type' => 'fieldset',
23 23
     '#title' => t('Test on copy first'),
24
-    '#collapsible' => TRUE,
25
-    '#collapsed' => TRUE,
24
+    '#collapsible' => true,
25
+    '#collapsed' => true,
26 26
   );
27 27
     
28 28
   $output = '';
29 29
   if (!variable_get('boincimport_tested', 0)) {
30
-    $form['test']['#collapsed']= FALSE;
30
+    $form['test']['#collapsed']= false;
31 31
     $output = '<span class="marker">';
32 32
     $ready_for_migration = 0;
33 33
   }
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
   // Where is BOINC data?
57 57
   $pre = variable_get('boincimport_table_prefix', '');
58 58
   $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user');
59
-  $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default';
59
+  $db = (is_array($db_url) and isset($db_url['boinc'])) ? 'boinc' : 'default';
60 60
   $result = _boincimport_check_tables($tables, $db, 0);
61 61
   
62 62
   $config_path = conf_path();
63 63
   $form['boinc_data'] = array(
64 64
     '#type' => 'fieldset',
65 65
     '#title' => t('Location of BOINC data'),
66
-    '#collapsible' => TRUE,
67
-    '#collapsed' => TRUE,
66
+    '#collapsible' => true,
67
+    '#collapsed' => true,
68 68
   );
69 69
   $form['boinc_data']['boincimport_db_configured'] = array(
70 70
     '#type' => 'checkbox',
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     '#return_value' => 1,
74 74
     '#default_value' => variable_get('boincimport_db_configured', 1),
75 75
     '#description' => '',
76
-    '#disabled' => ($result['result']) ? TRUE : FALSE
76
+    '#disabled' => ($result['result']) ? true : false
77 77
   );
78 78
   if (variable_get('boincimport_db_configured', 1) != 1) {
79 79
     $default_db_url = is_array($db_url) ? end($db_url) : $db_url;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         mysql://boinc_username:boinc_password@localhost/boinc_database
85 85
         </pre></p>';
86 86
       $ready_for_migration = 0;
87
-      $form['boinc_data']['#collapsed'] = FALSE;
87
+      $form['boinc_data']['#collapsed'] = false;
88 88
       $form['boinc_data']['db_connect_string_note'] = array('#value' => $output);
89 89
     }
90 90
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
     '#size' => 20,
116 116
     '#maxlength' => 255,
117 117
     '#description' => t('What prefix is used for your BOINC tables?'),
118
-    '#disabled' => ($result['result']) ? TRUE : FALSE
118
+    '#disabled' => ($result['result']) ? true : false
119 119
   );
120 120
   
121 121
   $output = $result['html'];
122 122
   if ($result['result'] != 1) {
123 123
     $ready_for_migration = 0;
124
-    $form['boinc_data']['#collapsed']= FALSE;
124
+    $form['boinc_data']['#collapsed']= false;
125 125
     $output .= '<span class="marker">';
126 126
     $output .= t('Some tables couldn\'t be found. Are the database settings correct?
127 127
       Please correct the errors so that the BOINC tables can be accessed.');
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
   $form['users'] = array(
135 135
     '#type' => 'fieldset',
136 136
     '#title' => t('User import'),
137
-    '#collapsible' => TRUE,
138
-    '#collapsed' => TRUE,
137
+    '#collapsible' => true,
138
+    '#collapsed' => true,
139 139
   );
140 140
 
141 141
   // User import batch size
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
   $form['input'] = array(
167 167
     '#type' => 'fieldset',
168 168
     '#title' => t('Input format settings'),
169
-    '#collapsible' => TRUE,
170
-    '#collapsed' => TRUE
169
+    '#collapsible' => true,
170
+    '#collapsed' => true
171 171
   );
172 172
   $output = '<p>'. t('Select which !input_format should be used for the imported
173 173
     messages. It is highly-recommended that this value be left as it is, as the
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
   );
195 195
   if (!$input_format) {
196 196
     $ready_for_migration = 0;
197
-    $form['input']['#collapsed']= FALSE;
197
+    $form['input']['#collapsed']= false;
198 198
   }
199 199
   $output = '<p><em>'. t('This setting will be applied to all posts and private
200 200
     messages.') .'</em></p>';
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
   $form['bbcode'] = array(
205 205
     '#type' => 'fieldset',
206 206
     '#title' => t('BBcode settings'),
207
-    '#collapsible' => TRUE,
208
-    '#collapsed' => TRUE,
207
+    '#collapsible' => true,
208
+    '#collapsed' => true,
209 209
   );
210 210
   
211 211
   $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
   if (variable_get('boincimport_bbcode', 0)) {
243 243
     if ($bbcode_disabled) {
244 244
       $ready_for_migration = 0;
245
-      $form['bbcode']['#collapsed'] = FALSE;
245
+      $form['bbcode']['#collapsed'] = false;
246 246
       $output .= '<p><span class="marker">';
247 247
       $output .= t('The !bbcode_module is required to transform BBcode into HTML.
248 248
         You first need to !enable_bbcode', array(
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     $sql = "SELECT COUNT(*) FROM {filters} WHERE module = 'bbcode' AND format = %d";
254 254
     $result = db_query($sql, $input_format);
255 255
     if (!db_result($result)) {
256
-      $form['bbcode']['#collapsed'] = FALSE;
256
+      $form['bbcode']['#collapsed'] = false;
257 257
       $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and
258 258
         then !configure_bbcode_options', array(
259 259
           '!enable_bbcode_input' =>  l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"),
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))) . '.</p>';
264 264
   } else {
265 265
     if ($bbcode_disabled) {
266
-      $form['bbcode']['#collapsed'] = FALSE;
266
+      $form['bbcode']['#collapsed'] = false;
267 267
       $output .= '<p>'. t('The !bbcode_module is recommended, but not required.
268 268
         You may !enable_bbcode after having installed it.', array(
269 269
           '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))),
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
   $form['url_transforms'] = array(
284 284
     '#type' => 'fieldset',
285 285
     '#title' => t('URL transforms'),
286
-    '#collapsible' => TRUE,
287
-    '#collapsed' => TRUE,
286
+    '#collapsible' => true,
287
+    '#collapsed' => true,
288 288
   );
289 289
   if (!variable_get('boincimport_base_url_boinc', 0)) {
290
-    $form['url_transforms']['#collapsed']= FALSE;
290
+    $form['url_transforms']['#collapsed']= false;
291 291
     $output = '<span class="marker">';
292 292
     $ready_for_migration = 0;
293 293
   }
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
   $form['migration'] = array(
316 316
     '#type' => 'fieldset',
317 317
     '#title' => 'Migration',
318
-    '#collapsible' => TRUE,
319
-    '#collapsed' => FALSE,
318
+    '#collapsible' => true,
319
+    '#collapsed' => false,
320 320
   );
321 321
   variable_set('boincimport_ready', $ready_for_migration);
322 322
   if ($ready_for_migration) {
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boinctranslate/boinctranslate.admin.inc 4 patches
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -7,85 +7,85 @@  discard block
 block discarded – undo
7 7
 */
8 8
 
9 9
 /**
10
-  * The BOINC translation settings form allows configuration of BTS integration
11
-  * (and other translation related settings)
12
-  */
10
+ * The BOINC translation settings form allows configuration of BTS integration
11
+ * (and other translation related settings)
12
+ */
13 13
 function boinctranslate_admin_settings(&$form_state) {
14
-  $form = array();
15
-  $initialized = FALSE;
16
-  $import_enabled = FALSE;
17
-  $default = array(
14
+    $form = array();
15
+    $initialized = FALSE;
16
+    $import_enabled = FALSE;
17
+    $default = array(
18 18
     'transifex_user' => variable_get('boinc_translate_transifex_user', ''),
19 19
     'transifex_pass' => variable_get('boinc_translate_transifex_pass', ''),
20 20
     'transifex_boinc_name' => variable_get(
21
-      'boinc_translate_transifex_standard_name', 'boinc'
21
+        'boinc_translate_transifex_standard_name', 'boinc'
22 22
     ),
23 23
     'transifex_boinc_resources' => variable_get(
24
-      'boinc_translate_transifex_standard_resources',
25
-      "project-generic\nweb"
24
+        'boinc_translate_transifex_standard_resources',
25
+        "project-generic\nweb"
26 26
     ),
27 27
     'transifex_boinc_drupal_resource' => variable_get(
28
-      'boinc_translate_transifex_boinc_drupal_resource',
29
-      'drupal'
28
+        'boinc_translate_transifex_boinc_drupal_resource',
29
+        'drupal'
30 30
     ), 
31 31
     'transifex_project_name' => variable_get(
32
-      'boinc_translate_transifex_project_name', ''
32
+        'boinc_translate_transifex_project_name', ''
33 33
     ),
34 34
     'transifex_project_resources' => variable_get(
35
-      'boinc_translate_transifex_project_resources', ''
35
+        'boinc_translate_transifex_project_resources', ''
36 36
     ), 
37
-  );
37
+    );
38 38
   
39
-  if ($default['transifex_user'] AND $default['transifex_pass']) {
39
+    if ($default['transifex_user'] AND $default['transifex_pass']) {
40 40
     if (trim($default['transifex_boinc_resources'])
41 41
     OR trim($default['transifex_project_resources'])) {
42
-      $import_enabled = TRUE;
42
+        $import_enabled = TRUE;
43 43
     }
44 44
     if ($default['transifex_boinc_name']
45 45
     AND $default['transifex_project_name']
46 46
     AND trim($default['transifex_boinc_resources'])
47 47
     AND trim($default['transifex_project_resources'])) {
48
-      $initialized = TRUE;
48
+        $initialized = TRUE;
49
+    }
49 50
     }
50
-  }
51 51
   
52
-  // Define the form
52
+    // Define the form
53 53
   
54
-  $form['transifex'] = array(
54
+    $form['transifex'] = array(
55 55
     '#title' => t('Transifex settings'),
56 56
     '#type' => 'fieldset',
57 57
     '#description' => '',
58 58
     '#collapsible' => TRUE,
59 59
     '#collapsed' => $initialized,
60 60
     '#attributes' => array('class' => '')
61
-  );
62
-  $form['transifex']['boinc_translate_transifex_user'] = array(
61
+    );
62
+    $form['transifex']['boinc_translate_transifex_user'] = array(
63 63
     '#type' => 'textfield',
64 64
     '#title' => t('User name'),
65 65
     '#default_value' => $default['transifex_user'],
66
-  );
67
-  $form['transifex']['boinc_translate_transifex_pass'] = array(
66
+    );
67
+    $form['transifex']['boinc_translate_transifex_pass'] = array(
68 68
     '#type' => 'password',
69 69
     '#title' => t('Password'),
70 70
     '#attributes' => array(
71
-      'placeholder' => $default['transifex_pass'] ? '********' : '',
71
+        'placeholder' => $default['transifex_pass'] ? '********' : '',
72 72
     ),
73
-  );
74
-  $form['transifex']['boinc_translate_transifex_standard_name'] = array(
73
+    );
74
+    $form['transifex']['boinc_translate_transifex_standard_name'] = array(
75 75
     '#type' => 'textfield',
76 76
     '#title' => t('BOINC Transifex project'),
77 77
     '#default_value' => $default['transifex_boinc_name'],
78 78
     '#description' => t('The portion of the Transifex URL that identifies BOINC.'),
79
-  );
80
-  $form['transifex']['boinc_translate_transifex_boinc_drupal_resource'] = array(
79
+    );
80
+    $form['transifex']['boinc_translate_transifex_boinc_drupal_resource'] = array(
81 81
     '#type' => 'textfield',
82 82
     '#title' => t('Official BOINC Drupal resource'),
83 83
     '#default_value' => $default['transifex_boinc_drupal_resource'],
84 84
     '#description' => t('The portion of the Transifex URL that identifies
85 85
       the standard BOINC resource to use for translation of the public
86 86
       content defined in the Drupal system.'),
87
-  );
88
-  $form['transifex']['boinc_translate_transifex_standard_resources'] = array(
87
+    );
88
+    $form['transifex']['boinc_translate_transifex_standard_resources'] = array(
89 89
     '#type' => 'textarea',
90 90
     '#title' => t('Additional BOINC resources'),
91 91
     '#default_value' => $default['transifex_boinc_resources'],
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
       by any matching translations found in resources further down the list.
97 97
       Note that strings from the Official BOINC Drupal resource will override
98 98
       any strings from these additional resources.'),
99
-  );
100
-  $form['transifex']['boinc_translate_transifex_project_name'] = array(
99
+    );
100
+    $form['transifex']['boinc_translate_transifex_project_name'] = array(
101 101
     '#type' => 'textfield',
102 102
     '#title' => t('Project-specific Transifex project'),
103 103
     '#default_value' => $default['transifex_project_name'],
104 104
     '#description' => t('The portion of the Transifex URL that identifies this project.'),
105
-  );
106
-  $form['transifex']['boinc_translate_transifex_project_resources'] = array(
105
+    );
106
+    $form['transifex']['boinc_translate_transifex_project_resources'] = array(
107 107
     '#type' => 'textarea',
108 108
     '#title' => t('Project-specific resources'),
109 109
     '#default_value' => $default['transifex_project_resources'],
@@ -116,211 +116,211 @@  discard block
 block discarded – undo
116 116
       NOTE: The first resource listed here is considered the primary resource
117 117
       for project-specific translations and will be updated by the "Update
118 118
       project-specific resources" button below!'),
119
-  );
120
-  $form['transifex']['buttons']['submit'] = array(
119
+    );
120
+    $form['transifex']['buttons']['submit'] = array(
121 121
     '#type' => 'submit',
122 122
     '#value' => t('Save configuration'),
123
-  );
123
+    );
124 124
   
125
-  $form['tools'] = array(
125
+    $form['tools'] = array(
126 126
     '#title' => t('Tools'),
127 127
     '#type' => 'fieldset',
128 128
     '#description' => '',
129 129
     '#collapsible' => TRUE,
130 130
     '#collapsed' => FALSE,
131 131
     '#attributes' => array('class' => '')
132
-  );
133
-  $form['tools']['initialize_languages'] = array(
132
+    );
133
+    $form['tools']['initialize_languages'] = array(
134 134
     '#type' => 'button',
135 135
     '#value' => t('Install official BOINC languages'),
136 136
     '#executes_submit_callback' => TRUE,
137 137
     '#submit' => array('boinctranslate_admin_settings_initialize_languages'),
138 138
     '#disabled' => !$initialized,
139
-  );
140
-  $form['tools']['export_now'] = array(
139
+    );
140
+    $form['tools']['export_now'] = array(
141 141
     '#type' => 'button',
142 142
     '#value' => t('Update project-specific resources'),
143 143
     '#executes_submit_callback' => TRUE,
144 144
     '#submit' => array('boinctranslate_admin_settings_export_now'),
145 145
     '#disabled' => !$import_enabled,
146
-  );
147
-  $form['tools']['import_now'] = array(
146
+    );
147
+    $form['tools']['import_now'] = array(
148 148
     '#type' => 'button',
149 149
     '#value' => t('Import all translations'),
150 150
     '#executes_submit_callback' => TRUE,
151 151
     '#submit' => array('boinctranslate_admin_settings_import_now'),
152 152
     '#disabled' => !$import_enabled,
153
-  );
154
-  if (user_access('update official BOINC translations')) {
153
+    );
154
+    if (user_access('update official BOINC translations')) {
155 155
     $form['tools']['update_official_boinc'] = array(
156
-      '#type' => 'button',
157
-      '#value' => t('Update official BOINC translations'),
158
-      '#executes_submit_callback' => TRUE,
159
-      '#submit' => array('boinctranslate_admin_settings_update_official_boinc'),
160
-      '#disabled' => !$import_enabled,
156
+        '#type' => 'button',
157
+        '#value' => t('Update official BOINC translations'),
158
+        '#executes_submit_callback' => TRUE,
159
+        '#submit' => array('boinctranslate_admin_settings_update_official_boinc'),
160
+        '#disabled' => !$import_enabled,
161 161
     );
162
-  }
163
-  $form['tools']['download_boinc_pot'] = array(
162
+    }
163
+    $form['tools']['download_boinc_pot'] = array(
164 164
     '#type' => 'button',
165 165
     '#value' => t('Download official BOINC .pot'),
166 166
     '#executes_submit_callback' => TRUE,
167 167
     '#submit' => array('boinctranslate_admin_settings_download_boinc_pot'),
168 168
     '#disabled' => !$import_enabled,
169
-  );
170
-  $form['tools']['download_project_pot'] = array(
169
+    );
170
+    $form['tools']['download_project_pot'] = array(
171 171
     '#type' => 'button',
172 172
     '#value' => t('Download project-specific .pot'),
173 173
     '#executes_submit_callback' => TRUE,
174 174
     '#submit' => array('boinctranslate_admin_settings_download_project_pot'),
175 175
     '#disabled' => !$import_enabled,
176
-  );
176
+    );
177 177
   
178
-  $form['#submit'][] = 'system_settings_form_submit';
179
-  $form['#theme'] = 'system_settings_form'; 
178
+    $form['#submit'][] = 'system_settings_form_submit';
179
+    $form['#theme'] = 'system_settings_form'; 
180 180
   
181
-  return $form;
181
+    return $form;
182 182
 }
183 183
 
184 184
 function boinctranslate_admin_settings_export_now() {
185
-  drupal_goto('admin/boinc/translation/export');
185
+    drupal_goto('admin/boinc/translation/export');
186 186
 }
187 187
 
188 188
 function boinctranslate_admin_settings_import_now() {
189
-  drupal_goto('admin/boinc/translation/import');
189
+    drupal_goto('admin/boinc/translation/import');
190 190
 }
191 191
 
192 192
 function boinctranslate_admin_settings_initialize_languages() {
193
-  drupal_goto('admin/boinc/translation/initialize-languages');
193
+    drupal_goto('admin/boinc/translation/initialize-languages');
194 194
 }
195 195
 
196 196
 function boinctranslate_admin_settings_update_official_boinc() {
197
-  drupal_goto('admin/boinc/translation/update-official-boinc');
197
+    drupal_goto('admin/boinc/translation/update-official-boinc');
198 198
 }
199 199
 
200 200
 function boinctranslate_admin_settings_download_boinc_pot() {
201
-  drupal_goto('admin/boinc/translation/download-pot/boinc');
201
+    drupal_goto('admin/boinc/translation/download-pot/boinc');
202 202
 }
203 203
 
204 204
 function boinctranslate_admin_settings_download_project_pot() {
205
-  drupal_goto('admin/boinc/translation/download-pot/project');
205
+    drupal_goto('admin/boinc/translation/download-pot/project');
206 206
 }
207 207
 
208 208
 
209 209
 /**
210
-  * Validate the BOINC translation settings form.
211
-  */
210
+ * Validate the BOINC translation settings form.
211
+ */
212 212
 function boinctranslate_admin_settings_validate($form, &$form_state) {
213
-  $values = $form_state['values'];
214
-  $errors = array();
215
-  $api_base_url = 'https://www.transifex.com/api/2';
213
+    $values = $form_state['values'];
214
+    $errors = array();
215
+    $api_base_url = 'https://www.transifex.com/api/2';
216 216
   
217
-  if (!$values['boinc_translate_transifex_user']) {
217
+    if (!$values['boinc_translate_transifex_user']) {
218 218
     form_set_error('boinc_translate_transifex_user', t('User name is required.'));
219
-  }
220
-  if (!$values['boinc_translate_transifex_pass']) {
219
+    }
220
+    if (!$values['boinc_translate_transifex_pass']) {
221 221
     if (!variable_get('boinc_translate_transifex_pass', '')) {
222
-      form_set_error('boinc_translate_transifex_pass', t('Password is required.'));
222
+        form_set_error('boinc_translate_transifex_pass', t('Password is required.'));
223 223
     }
224 224
     else {
225
-      unset($form_state['values']['boinc_translate_transifex_pass']);
225
+        unset($form_state['values']['boinc_translate_transifex_pass']);
226
+    }
226 227
     }
227
-  }
228
-  if (!$values['boinc_translate_transifex_standard_name']) {
228
+    if (!$values['boinc_translate_transifex_standard_name']) {
229 229
     form_set_error('boinc_translate_transifex_standard_name', 
230
-      t('BOINC Transifex project name is required.')
230
+        t('BOINC Transifex project name is required.')
231 231
     );
232
-  }
233
-  if (!$values['boinc_translate_transifex_standard_resources']) {
232
+    }
233
+    if (!$values['boinc_translate_transifex_standard_resources']) {
234 234
     form_set_error('boinc_translate_transifex_standard_resources',
235
-      t('At least one BOINC Transifex project resource is required.')
235
+        t('At least one BOINC Transifex project resource is required.')
236 236
     );
237
-  }
238
-  if (!$values['boinc_translate_transifex_project_resources']) {
237
+    }
238
+    if (!$values['boinc_translate_transifex_project_resources']) {
239 239
     form_set_error('boinc_translate_transifex_project_resources',
240
-      t('At least one project-specific Transifex resource is required.')
240
+        t('At least one project-specific Transifex resource is required.')
241 241
     );
242
-  }
242
+    }
243 243
   
244
-  $username = $values['boinc_translate_transifex_user'];
245
-  $password = ($values['boinc_translate_transifex_pass']) ? $values['boinc_translate_transifex_pass'] : variable_get('boinc_translate_transifex_pass', '');
246
-  $boinc_name = $values['boinc_translate_transifex_standard_name'];
247
-  $boinc_resources = boinctranslate_parse_resources(
244
+    $username = $values['boinc_translate_transifex_user'];
245
+    $password = ($values['boinc_translate_transifex_pass']) ? $values['boinc_translate_transifex_pass'] : variable_get('boinc_translate_transifex_pass', '');
246
+    $boinc_name = $values['boinc_translate_transifex_standard_name'];
247
+    $boinc_resources = boinctranslate_parse_resources(
248 248
     $values['boinc_translate_transifex_standard_resources']
249
-  );
249
+    );
250 250
   
251
-  if ($username AND $password AND $boinc_name AND $boinc_resources) {
251
+    if ($username AND $password AND $boinc_name AND $boinc_resources) {
252 252
     // Test authentication
253 253
     $authenticated = FALSE;
254 254
     $path = "project/{$boinc_name}/resource/{$boinc_resources[0]}/translation/en";
255 255
     $response = boinctranslate_transifex_request($path, NULL, TRUE, FALSE, $username, $password);
256 256
     
257 257
     if ($response) {
258
-      if ($response == '401 UNAUTHORIZED') {
258
+        if ($response == '401 UNAUTHORIZED') {
259 259
         form_set_error(
260
-          'boinc_translate_transifex_pass',
261
-          t('Transifex authentication failed.')
260
+            'boinc_translate_transifex_pass',
261
+            t('Transifex authentication failed.')
262 262
         );
263
-      }
264
-      else {
263
+        }
264
+        else {
265 265
         $authenticated = TRUE;
266
-      }
266
+        }
267 267
     }
268 268
     
269 269
     if ($authenticated) {
270
-      // Prepare list of resources to validate
271
-      $transifex_resources = array(
270
+        // Prepare list of resources to validate
271
+        $transifex_resources = array(
272 272
         'boinc' => $boinc_resources,
273
-      );
274
-      // Parse project-specific resources
275
-      $project_name = trim($values['boinc_translate_transifex_project_name']);
276
-      $project_resources = boinctranslate_parse_resources(
273
+        );
274
+        // Parse project-specific resources
275
+        $project_name = trim($values['boinc_translate_transifex_project_name']);
276
+        $project_resources = boinctranslate_parse_resources(
277 277
         $values['boinc_translate_transifex_project_resources']
278
-      );
279
-      if ($project_name AND $project_resources) {
278
+        );
279
+        if ($project_name AND $project_resources) {
280 280
         $transifex_resources[$project_name] = $project_resources;
281
-      }
282
-      elseif ($project_name AND !$project_resources) {
281
+        }
282
+        elseif ($project_name AND !$project_resources) {
283 283
         drupal_set_message(
284
-          t('No project-specific resources were provided'),
285
-          'warning'
284
+            t('No project-specific resources were provided'),
285
+            'warning'
286 286
         );
287
-      }
288
-      elseif ($project_resources AND !$project_name) {
287
+        }
288
+        elseif ($project_resources AND !$project_name) {
289 289
         drupal_set_message(
290
-          t('No project-specific Transifex project name was provided'),
291
-          'warning'
290
+            t('No project-specific Transifex project name was provided'),
291
+            'warning'
292 292
         );
293
-      }
293
+        }
294 294
       
295
-      // Try to access the given resources
296
-      foreach ($transifex_resources as $project => $resources) {
295
+        // Try to access the given resources
296
+        foreach ($transifex_resources as $project => $resources) {
297 297
         foreach ($resources as $resource) {
298 298
           
299
-          $path = "project/{$project}/resource/{$resource}/translation/en";
300
-          $response = boinctranslate_transifex_request($path);
299
+            $path = "project/{$project}/resource/{$resource}/translation/en";
300
+            $response = boinctranslate_transifex_request($path);
301 301
           
302
-          if ($response == '404 NOT FOUND') {
302
+            if ($response == '404 NOT FOUND') {
303 303
             form_set_error(
304
-              'boinc_translate_transifex_' . ($project == $boinc_name ? 'standard' : 'project') . '_resources',
305
-              t('Resource %name not found in %project.',
304
+                'boinc_translate_transifex_' . ($project == $boinc_name ? 'standard' : 'project') . '_resources',
305
+                t('Resource %name not found in %project.',
306 306
                 array(
307
-                  '%name' => $resource,
308
-                  '%project' => $project,
307
+                    '%name' => $resource,
308
+                    '%project' => $project,
309
+                )
309 310
                 )
310
-              )
311 311
             );
312
-          }
312
+            }
313 313
         }
314
-      }
314
+        }
315
+    }
315 316
     }
316
-  }
317 317
 }
318 318
 
319 319
 /**
320
-  * Handle post-validation submission of BOINC translation settings form.
321
-  */
320
+ * Handle post-validation submission of BOINC translation settings form.
321
+ */
322 322
 function boinctranslate_admin_settings_submit($form, &$form_state) {
323
-  drupal_set_message(t('BOINC translation settings have been updated.'));
323
+    drupal_set_message(t('BOINC translation settings have been updated.'));
324 324
 }
325 325
 
326 326
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@
 block discarded – undo
301 301
           
302 302
           if ($response == '404 NOT FOUND') {
303 303
             form_set_error(
304
-              'boinc_translate_transifex_' . ($project == $boinc_name ? 'standard' : 'project') . '_resources',
304
+              'boinc_translate_transifex_'.($project == $boinc_name ? 'standard' : 'project').'_resources',
305 305
               t('Resource %name not found in %project.',
306 306
                 array(
307 307
                   '%name' => $resource,
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -220,8 +220,7 @@  discard block
 block discarded – undo
220 220
   if (!$values['boinc_translate_transifex_pass']) {
221 221
     if (!variable_get('boinc_translate_transifex_pass', '')) {
222 222
       form_set_error('boinc_translate_transifex_pass', t('Password is required.'));
223
-    }
224
-    else {
223
+    } else {
225 224
       unset($form_state['values']['boinc_translate_transifex_pass']);
226 225
     }
227 226
   }
@@ -260,8 +259,7 @@  discard block
 block discarded – undo
260 259
           'boinc_translate_transifex_pass',
261 260
           t('Transifex authentication failed.')
262 261
         );
263
-      }
264
-      else {
262
+      } else {
265 263
         $authenticated = TRUE;
266 264
       }
267 265
     }
@@ -278,14 +276,12 @@  discard block
 block discarded – undo
278 276
       );
279 277
       if ($project_name AND $project_resources) {
280 278
         $transifex_resources[$project_name] = $project_resources;
281
-      }
282
-      elseif ($project_name AND !$project_resources) {
279
+      } elseif ($project_name AND !$project_resources) {
283 280
         drupal_set_message(
284 281
           t('No project-specific resources were provided'),
285 282
           'warning'
286 283
         );
287
-      }
288
-      elseif ($project_resources AND !$project_name) {
284
+      } elseif ($project_resources AND !$project_name) {
289 285
         drupal_set_message(
290 286
           t('No project-specific Transifex project name was provided'),
291 287
           'warning'
Please login to merge, or discard this patch.
Upper-Lower-Casing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
   */
13 13
 function boinctranslate_admin_settings(&$form_state) {
14 14
   $form = array();
15
-  $initialized = FALSE;
16
-  $import_enabled = FALSE;
15
+  $initialized = false;
16
+  $import_enabled = false;
17 17
   $default = array(
18 18
     'transifex_user' => variable_get('boinc_translate_transifex_user', ''),
19 19
     'transifex_pass' => variable_get('boinc_translate_transifex_pass', ''),
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
     ), 
37 37
   );
38 38
   
39
-  if ($default['transifex_user'] AND $default['transifex_pass']) {
39
+  if ($default['transifex_user'] and $default['transifex_pass']) {
40 40
     if (trim($default['transifex_boinc_resources'])
41
-    OR trim($default['transifex_project_resources'])) {
42
-      $import_enabled = TRUE;
41
+    or trim($default['transifex_project_resources'])) {
42
+      $import_enabled = true;
43 43
     }
44 44
     if ($default['transifex_boinc_name']
45
-    AND $default['transifex_project_name']
46
-    AND trim($default['transifex_boinc_resources'])
47
-    AND trim($default['transifex_project_resources'])) {
48
-      $initialized = TRUE;
45
+    and $default['transifex_project_name']
46
+    and trim($default['transifex_boinc_resources'])
47
+    and trim($default['transifex_project_resources'])) {
48
+      $initialized = true;
49 49
     }
50 50
   }
51 51
   
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     '#title' => t('Transifex settings'),
56 56
     '#type' => 'fieldset',
57 57
     '#description' => '',
58
-    '#collapsible' => TRUE,
58
+    '#collapsible' => true,
59 59
     '#collapsed' => $initialized,
60 60
     '#attributes' => array('class' => '')
61 61
   );
@@ -126,28 +126,28 @@  discard block
 block discarded – undo
126 126
     '#title' => t('Tools'),
127 127
     '#type' => 'fieldset',
128 128
     '#description' => '',
129
-    '#collapsible' => TRUE,
130
-    '#collapsed' => FALSE,
129
+    '#collapsible' => true,
130
+    '#collapsed' => false,
131 131
     '#attributes' => array('class' => '')
132 132
   );
133 133
   $form['tools']['initialize_languages'] = array(
134 134
     '#type' => 'button',
135 135
     '#value' => t('Install official BOINC languages'),
136
-    '#executes_submit_callback' => TRUE,
136
+    '#executes_submit_callback' => true,
137 137
     '#submit' => array('boinctranslate_admin_settings_initialize_languages'),
138 138
     '#disabled' => !$initialized,
139 139
   );
140 140
   $form['tools']['export_now'] = array(
141 141
     '#type' => 'button',
142 142
     '#value' => t('Update project-specific resources'),
143
-    '#executes_submit_callback' => TRUE,
143
+    '#executes_submit_callback' => true,
144 144
     '#submit' => array('boinctranslate_admin_settings_export_now'),
145 145
     '#disabled' => !$import_enabled,
146 146
   );
147 147
   $form['tools']['import_now'] = array(
148 148
     '#type' => 'button',
149 149
     '#value' => t('Import all translations'),
150
-    '#executes_submit_callback' => TRUE,
150
+    '#executes_submit_callback' => true,
151 151
     '#submit' => array('boinctranslate_admin_settings_import_now'),
152 152
     '#disabled' => !$import_enabled,
153 153
   );
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     $form['tools']['update_official_boinc'] = array(
156 156
       '#type' => 'button',
157 157
       '#value' => t('Update official BOINC translations'),
158
-      '#executes_submit_callback' => TRUE,
158
+      '#executes_submit_callback' => true,
159 159
       '#submit' => array('boinctranslate_admin_settings_update_official_boinc'),
160 160
       '#disabled' => !$import_enabled,
161 161
     );
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
   $form['tools']['download_boinc_pot'] = array(
164 164
     '#type' => 'button',
165 165
     '#value' => t('Download official BOINC .pot'),
166
-    '#executes_submit_callback' => TRUE,
166
+    '#executes_submit_callback' => true,
167 167
     '#submit' => array('boinctranslate_admin_settings_download_boinc_pot'),
168 168
     '#disabled' => !$import_enabled,
169 169
   );
170 170
   $form['tools']['download_project_pot'] = array(
171 171
     '#type' => 'button',
172 172
     '#value' => t('Download project-specific .pot'),
173
-    '#executes_submit_callback' => TRUE,
173
+    '#executes_submit_callback' => true,
174 174
     '#submit' => array('boinctranslate_admin_settings_download_project_pot'),
175 175
     '#disabled' => !$import_enabled,
176 176
   );
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
     $values['boinc_translate_transifex_standard_resources']
249 249
   );
250 250
   
251
-  if ($username AND $password AND $boinc_name AND $boinc_resources) {
251
+  if ($username and $password and $boinc_name and $boinc_resources) {
252 252
     // Test authentication
253
-    $authenticated = FALSE;
253
+    $authenticated = false;
254 254
     $path = "project/{$boinc_name}/resource/{$boinc_resources[0]}/translation/en";
255
-    $response = boinctranslate_transifex_request($path, NULL, TRUE, FALSE, $username, $password);
255
+    $response = boinctranslate_transifex_request($path, null, true, false, $username, $password);
256 256
     
257 257
     if ($response) {
258 258
       if ($response == '401 UNAUTHORIZED') {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         );
263 263
       }
264 264
       else {
265
-        $authenticated = TRUE;
265
+        $authenticated = true;
266 266
       }
267 267
     }
268 268
     
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
       $project_resources = boinctranslate_parse_resources(
277 277
         $values['boinc_translate_transifex_project_resources']
278 278
       );
279
-      if ($project_name AND $project_resources) {
279
+      if ($project_name and $project_resources) {
280 280
         $transifex_resources[$project_name] = $project_resources;
281 281
       }
282
-      elseif ($project_name AND !$project_resources) {
282
+      elseif ($project_name and !$project_resources) {
283 283
         drupal_set_message(
284 284
           t('No project-specific resources were provided'),
285 285
           'warning'
286 286
         );
287 287
       }
288
-      elseif ($project_resources AND !$project_name) {
288
+      elseif ($project_resources and !$project_name) {
289 289
         drupal_set_message(
290 290
           t('No project-specific Transifex project name was provided'),
291 291
           'warning'
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincuser/boincuser.module 4 patches
Indentation   +608 added lines, -608 removed lines patch added patch discarded remove patch
@@ -27,44 +27,44 @@  discard block
 block discarded – undo
27 27
  * with defined URL paths
28 28
  */
29 29
 function boincuser_menu() {
30
-  $items['account/posts'] = array(
30
+    $items['account/posts'] = array(
31 31
     'title' => 'Recent posts',
32 32
     'description' => '',
33 33
     'page callback' => 'boincuser_goto_recent_posts',
34 34
     'access callback' => 'user_is_logged_in',
35 35
     'type' => MENU_CALLBACK,
36
-  );
37
-  $items['account/profile'] = array(
36
+    );
37
+    $items['account/profile'] = array(
38 38
     'title' => '',
39 39
     'description' => '',
40 40
     'page callback' => 'boincuser_view_profile',
41 41
     'access arguments' => array('access content'),
42 42
     'type' => MENU_NORMAL_ITEM
43
-  );
44
-  $items['account/profile/view'] = array(
43
+    );
44
+    $items['account/profile/view'] = array(
45 45
     'title' => 'View',
46 46
     'description' => 'Show a user profile',
47 47
     'page callback' => 'boincuser_view_profile',
48 48
     'access arguments' => array('access content'),
49 49
     'type' => MENU_DEFAULT_LOCAL_TASK,
50 50
     'weight' => 0
51
-  );
52
-  $items['account/profile/edit'] = array(
51
+    );
52
+    $items['account/profile/edit'] = array(
53 53
     'title' => 'Edit',
54 54
     'description' => 'Edit a user profile',
55 55
     'page callback' => 'boincuser_edit_profile',
56 56
     'access arguments' => array('access content'),
57 57
     'type' => MENU_LOCAL_TASK,
58 58
     'weight' => 5
59
-  );
60
-  $items['account/team'] = array(
59
+    );
60
+    $items['account/team'] = array(
61 61
     'title' => 'User team',
62 62
     'description' => '',
63 63
     'page callback' => 'boincuser_goto_team',
64 64
     'access callback' => 'user_is_logged_in',
65 65
     'type' => MENU_CALLBACK,
66
-  );
67
-  $items['moderate/profile/%user/approve'] = array(
66
+    );
67
+    $items['moderate/profile/%user/approve'] = array(
68 68
     'title' => 'Profile approval',
69 69
     'description' => 'Approve profile content',
70 70
     'page callback' => 'boincuser_moderate_profile_approve',
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
     'access arguments' => array('edit any profile content'),
73 73
     'type' => MENU_CALLBACK,
74 74
     'weight' => 5
75
-  );
76
-  $items['moderate/profile/%user/edit'] = array(
75
+    );
76
+    $items['moderate/profile/%user/edit'] = array(
77 77
     'title' => 'Profile editor',
78 78
     'description' => 'Edit a user profile',
79 79
     'page callback' => 'boincuser_edit_profile',
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     'access arguments' => array('edit any profile content'),
82 82
     'type' => MENU_CALLBACK,
83 83
     'weight' => 5
84
-  );
85
-  $items['moderate/profile/%/reject'] = array(
84
+    );
85
+    $items['moderate/profile/%/reject'] = array(
86 86
     'title' => bts('Reject profile'),
87 87
     'description' => 'Reject profile content',
88 88
     'page callback' => 'drupal_get_form',
@@ -90,52 +90,52 @@  discard block
 block discarded – undo
90 90
     'access arguments' => array('edit any profile content'),
91 91
     'type' => MENU_CALLBACK,
92 92
     'weight' => 5
93
-  );
94
-  $items['moderate/user/%/ban'] = array(
93
+    );
94
+    $items['moderate/user/%/ban'] = array(
95 95
     'title' => bts('Ban user'),
96 96
     'description' => 'Ban a user from using community features',
97 97
     'page callback' => 'drupal_get_form',
98 98
     'page arguments' => array('boincuser_moderate_user_ban_form', 2),
99 99
     'access callback' => 'boincuser_moderate_community_access',
100 100
     'type' => MENU_CALLBACK,
101
-  );
102
-  $items['join'] = array(
101
+    );
102
+    $items['join'] = array(
103 103
     'title' => '',
104 104
     'description' => '',
105 105
     'page callback' => 'join_page',
106 106
     'access arguments' => array('access content'),
107 107
     'type' => MENU_NORMAL_ITEM
108
-  );
109
-  $items['join/new'] = array(
108
+    );
109
+    $items['join/new'] = array(
110 110
     'title' => bts("I'm new"),
111 111
     'page callback' => 'join_page',
112 112
     'page arguments' => array(1),
113 113
     'access arguments' => array('access content'),
114 114
     'type' => MENU_DEFAULT_LOCAL_TASK,
115 115
     'weight' => 0
116
-  );
117
-  $items['join/boinc'] = array(
116
+    );
117
+    $items['join/boinc'] = array(
118 118
     'title' => bts("I'm a BOINC user"),
119 119
     'page callback' => 'join_page',
120 120
     'page arguments' => array(1),
121 121
     'access arguments' => array('access content'),
122 122
     'type' => MENU_LOCAL_TASK,
123 123
     'weight' => 5
124
-  );
125
-  $items['user/login/auth'] = array(
124
+    );
125
+    $items['user/login/auth'] = array(
126 126
     'title' => bts('Authenticator login'),
127 127
     'description' => 'Log in using a user authenticator',
128 128
     'page callback' => 'drupal_get_form',
129 129
     'page arguments' => array('boincuser_authloginform'),
130 130
     'access arguments' => array('access content'),
131 131
     'type' => MENU_CALLBACK,
132
-  );
133
-  $items['user_control'] = array(
132
+    );
133
+    $items['user_control'] = array(
134 134
     'page callback' => 'boincuser_control',
135 135
     'access arguments' => array('access user profiles'),
136 136
     'type' => MENU_CALLBACK
137
-  );
138
-  $items['admin/boinc'] = array(
137
+    );
138
+    $items['admin/boinc'] = array(
139 139
     'title' => 'BOINC configuration',
140 140
     'position' => 'right',
141 141
     'weight' => -8,
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
     'access arguments' => array('administer site configuration'),
144 144
     'file' => 'system.admin.inc',
145 145
     'file path' => drupal_get_path('module', 'system'),
146
-  );
147
-  $items['admin/boinc/environment'] = array(
146
+    );
147
+    $items['admin/boinc/environment'] = array(
148 148
     'title' => 'Environment: General',
149 149
     'description' => 'Set paths to BOINC functions and any other necessary
150 150
       variables that establish a BOINC environment.',
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
     'access arguments' => array('administer site configuration'),
154 154
     'type' => MENU_NORMAL_ITEM,
155 155
     'file' => 'boincuser.admin.inc'
156
-  );
157
-  $items['admin/boinc/scheduler'] = array(
156
+    );
157
+    $items['admin/boinc/scheduler'] = array(
158 158
     'title' => 'Environment: Scheduling server URLs',
159 159
     'description' => 'Set BOINC scheduler options.',
160 160
     'page callback' => 'drupal_get_form',
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
     'access arguments' => array('administer site configuration'),
163 163
     'type' => MENU_NORMAL_ITEM,
164 164
     'file' => 'boincuser.admin.inc'
165
-  );
166
-  $items['admin/boinc/other'] = array(
165
+    );
166
+    $items['admin/boinc/other'] = array(
167 167
     'title' => 'Other Options',
168 168
     'description' => 'Set other BOINC options.',
169 169
     'page callback' => 'drupal_get_form',
@@ -171,42 +171,42 @@  discard block
 block discarded – undo
171 171
     'access arguments' => array('administer site configuration'),
172 172
     'type' => MENU_NORMAL_ITEM,
173 173
     'file' => 'boincuser.admin.inc'
174
-  );
174
+    );
175 175
   
176
-  $items['create_account.php'] = array(
176
+    $items['create_account.php'] = array(
177 177
     'title' => 'Create Account RPC',
178 178
     'description' => 'RPC for creating user accounts.',
179 179
     'page callback' => 'boincuser_create_account',
180 180
     'access callback' => TRUE,
181 181
     'type' => MENU_CALLBACK
182
-  );
183
-  return $items;
182
+    );
183
+    return $items;
184 184
 }
185 185
 
186 186
 /**
187 187
  *
188 188
  */
189 189
 function boincuser_init() {
190
-  // Skip this check for charts, which are loaded separately
191
-  // (may get duplicate or unexpected messages otherwise)
192
-  if (substr($_GET['q'], 0, 7) == 'charts/') {
190
+    // Skip this check for charts, which are loaded separately
191
+    // (may get duplicate or unexpected messages otherwise)
192
+    if (substr($_GET['q'], 0, 7) == 'charts/') {
193 193
     return;
194
-  }
194
+    }
195 195
 
196
-  // If admin user, do some basic site functionality checks
197
-  if (user_access('administer site configuration')) {
196
+    // If admin user, do some basic site functionality checks
197
+    if (user_access('administer site configuration')) {
198 198
     // Ensure we have a configured BOINC environment
199 199
     boinc_get_path();
200 200
     boinc_get_scheduler_tags();
201
-  }
201
+    }
202 202
   
203
-  // Check credits for the verified contributor role
204
-  boincuser_check_credit_requirements();
203
+    // Check credits for the verified contributor role
204
+    boincuser_check_credit_requirements();
205 205
   
206
-  if (module_exists('boincteam')) {
206
+    if (module_exists('boincteam')) {
207 207
     // Display any persistent team messages
208 208
     boincteam_show_messages();
209
-  }
209
+    }
210 210
 }
211 211
 
212 212
 /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  * Drupal user operations
215 215
  */
216 216
 function boincuser_user($op, &$edit, &$account, $category = NULL) {
217
-  // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
218
-  if ($account->uid > 1) {
217
+    // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
218
+    if ($account->uid > 1) {
219 219
     switch($op) {
220 220
     case 'load':
221 221
       // User loading; insert BOINC data into the user object
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
         SELECT boinc_id, penalty_expiration
224 224
         FROM {boincuser} WHERE uid = %d",
225 225
         $account->uid
226
-      ));
227
-      $account->boincuser_id = $drupal_user->boinc_id;
228
-      $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
229
-      db_set_active('boinc');
230
-      $boinc_user = db_fetch_object(db_query("
226
+        ));
227
+        $account->boincuser_id = $drupal_user->boinc_id;
228
+        $account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
229
+        db_set_active('boinc');
230
+        $boinc_user = db_fetch_object(db_query("
231 231
         SELECT
232 232
           name,
233 233
           authenticator,
@@ -241,27 +241,27 @@  discard block
 block discarded – undo
241 241
         FROM {user}
242 242
         WHERE id = %d",
243 243
         $account->boincuser_id
244
-      ));
245
-      $account->boincuser_name = $boinc_user->name;
246
-      $account->boincuser_account_key = $boinc_user->authenticator;
247
-      $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
248
-      $account->boincuser_total_credit = round($boinc_user->total_credit);
249
-      $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
250
-      $account->boincuser_expavg_time = round($boinc_user->expavg_time);
251
-      $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
252
-      $account->boincuser_default_pref_set = $boinc_user->venue;
253
-      $account->boincteam_id = $boinc_user->teamid;
254
-      db_set_active('default');
255
-      // Set Drupal team ID
256
-      $account->team = NULL;
257
-      if ($account->boincteam_id) {
244
+        ));
245
+        $account->boincuser_name = $boinc_user->name;
246
+        $account->boincuser_account_key = $boinc_user->authenticator;
247
+        $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
248
+        $account->boincuser_total_credit = round($boinc_user->total_credit);
249
+        $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
250
+        $account->boincuser_expavg_time = round($boinc_user->expavg_time);
251
+        $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
252
+        $account->boincuser_default_pref_set = $boinc_user->venue;
253
+        $account->boincteam_id = $boinc_user->teamid;
254
+        db_set_active('default');
255
+        // Set Drupal team ID
256
+        $account->team = NULL;
257
+        if ($account->boincteam_id) {
258 258
         $account->team = db_result(db_query("
259 259
           SELECT nid FROM {boincteam} WHERE team_id = %d",
260
-          $account->boincteam_id
260
+            $account->boincteam_id
261 261
         ));
262
-      }
263
-      // Set post count
264
-      $account->post_count = db_result(db_query("
262
+        }
263
+        // Set post count
264
+        $account->post_count = db_result(db_query("
265 265
         SELECT COUNT(*) +
266 266
         (
267 267
           SELECT COUNT(*) FROM {node}
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
         WHERE comments.uid = '%d'
275 275
         AND node.status = 1",
276 276
         $account->uid, $account->uid
277
-      ));
278
-      break;
277
+        ));
278
+        break;
279 279
       
280 280
     case 'view':
281 281
       // SAMPLE: Add BOINC data to the user profile
@@ -303,95 +303,95 @@  discard block
 block discarded – undo
303 303
           if (!boincuser_register_validate($edit)) {
304 304
             // BOINC user validation failed for registration; set an error accordingly
305 305
             form_set_error('mail', bts('An account already exists for @email. Log in or request password assistance to access your @project account.', array('@email' => $edit['mail'], '@project' => PROJECT)));
306
-          }
307
-          else {
306
+            }
307
+            else {
308 308
             // Save profile information for use during Insert
309 309
             $_SESSION['profileInfo'] = array(
310
-              'country' => $edit['field_country'][0]['value'],
311
-              'zip' => $edit['field_zip'][0]['value'],                  
312
-              'url' => $edit['field_url'][0]['value'],
313
-              'background' => $edit['field_background'][0]['value'],
314
-              'opinions' => $edit['field_opinions'][0]['value']
310
+                'country' => $edit['field_country'][0]['value'],
311
+                'zip' => $edit['field_zip'][0]['value'],                  
312
+                'url' => $edit['field_url'][0]['value'],
313
+                'background' => $edit['field_background'][0]['value'],
314
+                'opinions' => $edit['field_opinions'][0]['value']
315 315
             );
316 316
             // With BOINC validation passed, make sure name is unique
317 317
             $edit['name'] = find_unique_name($edit['boincuser_name']);
318
-          }
319
-          break;
318
+            }
319
+            break;
320 320
           
321 321
         case 'user_account':
322 322
           // Validate data before updating user account info
323 323
           boincuser_account_validate($edit, $account);
324
-          break;
324
+            break;
325 325
         
326 326
         default:
327 327
           
328 328
         }
329 329
         // We don't want to save validation source, so remove it
330 330
         $edit['validation_source'] = null;
331
-      }
332
-      break;
331
+        }
332
+        break;
333 333
       
334 334
     case 'insert':
335 335
       // New user being added to the system
336 336
       $profile_info = $_SESSION['profileInfo'];
337
-      $imported = $_SESSION['importedUser'];
338
-      unset($_SESSION['profileInfo']);
339
-      unset($_SESSION['importedUser']);
337
+        $imported = $_SESSION['importedUser'];
338
+        unset($_SESSION['profileInfo']);
339
+        unset($_SESSION['importedUser']);
340 340
       
341
-      watchdog(
341
+        watchdog(
342 342
         'boincuser',
343 343
         'Creating user account for %email_addr',
344 344
         array('%email_addr' => $edit['mail']),
345 345
         WATCHDOG_NOTICE
346
-      );
346
+        );
347 347
       
348
-      // NOTE: Registrations are normally handled via the create_account RPC,
349
-      // so the following will not run (kept in case form registration is used)
348
+        // NOTE: Registrations are normally handled via the create_account RPC,
349
+        // so the following will not run (kept in case form registration is used)
350 350
       
351
-      // If from the registration form, create a BOINC user and relationships
351
+        // If from the registration form, create a BOINC user and relationships
352 352
       
353
-      if ($profile_info and !$imported) {
353
+        if ($profile_info and !$imported) {
354 354
         // Create a BOINC account unless importing from BOINC
355 355
         $user_params = array(
356
-          'email_addr' => $edit['mail'],
357
-          'name' => $edit['boincuser_name'],
358
-          'passwd_hash' => md5($edit['pass'].$edit['mail']),
359
-          'country' => $profile_info['country'],
360
-          'postal_code' => $profile_info['zip']
356
+            'email_addr' => $edit['mail'],
357
+            'name' => $edit['boincuser_name'],
358
+            'passwd_hash' => md5($edit['pass'].$edit['mail']),
359
+            'country' => $profile_info['country'],
360
+            'postal_code' => $profile_info['zip']
361 361
         );
362 362
         $boinc_user = boincuser_register_make_user($user_params);
363 363
         if (!$boinc_user) {
364
-          // Account exists with this email addr
365
-          form_set_error('email', bts('Error creating BOINC account.'));
366
-          return;
364
+            // Account exists with this email addr
365
+            form_set_error('email', bts('Error creating BOINC account.'));
366
+            return;
367 367
         }
368 368
         // Add user to community role by default (not banned)
369 369
         $unrestricted_role = array_search('community member', user_roles(true)); 
370 370
         $edit['roles'] = array(
371
-          $unrestricted_role => ''
371
+            $unrestricted_role => ''
372 372
         );
373 373
         // Set profile data in BOINC db
374 374
         db_set_active('boinc');
375 375
         // TODO: add language, image support; error handling
376 376
         $reference = db_query("INSERT INTO {profile} SET userid='%d', response1='%s', response2='%s', verification=0", $boinc_user->id, $profile_info['background'], $profile_info['opinions']);
377 377
         if (!$reference) {
378
-          drupal_set_message(t('Error creating BOINC profile.'), 'error');
378
+            drupal_set_message(t('Error creating BOINC profile.'), 'error');
379 379
         }
380 380
         $reference = db_query("UPDATE {user} SET url='%s' WHERE id='%d'", $profile_info['url'], $boinc_user->id);
381 381
         if (!$reference) {
382
-          drupal_set_message(t('Error updating BOINC account.'), 'error');
382
+            drupal_set_message(t('Error updating BOINC account.'), 'error');
383 383
         }
384 384
         db_set_active('default');
385 385
         // Cross reference Drupal account with BOINC
386 386
         $reference = db_query("INSERT INTO {boincuser} SET uid='%d', boinc_id='%d'", $account->uid, $boinc_user->id);
387 387
         if (!$reference) {
388
-          drupal_set_message(t('Error connecting BOINC account.'), 'error');
389
-          return;
388
+            drupal_set_message(t('Error connecting BOINC account.'), 'error');
389
+            return;
390 390
         }
391 391
         // Don't save custom fields to the Drupal user object
392 392
         $edit['boincuser_name'] = null;
393
-      }
394
-      break;
393
+        }
394
+        break;
395 395
       
396 396
     case 'update':
397 397
       if (isset($edit['update_source'])) {
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
         case 'user_account':
402 402
           // Ensure that BOINC data is altered
403 403
           $boinc_user = BoincUser::lookup_id($account->boincuser_id);
404
-          $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;
405
-          $changing_pass = ($edit['pass']) ? true : false;
406
-          if ($changing_email OR $changing_pass) {
404
+            $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;
405
+            $changing_pass = ($edit['pass']) ? true : false;
406
+            if ($changing_email OR $changing_pass) {
407 407
             // Set password hash appropriately
408 408
             $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];
409 409
             $passwd_hash = md5($passwd.$edit['mail']);
@@ -412,29 +412,29 @@  discard block
 block discarded – undo
412 412
             $result = $boinc_user->update(
413 413
                 "email_addr='{$email_addr}', passwd_hash='{$passwd_hash}'"
414 414
             );
415
-          }
416
-          break;
415
+            }
416
+            break;
417 417
         case 'user_profile':
418 418
           if ($edit['boincuser_name'] != $boinc_user->name) {
419 419
             $boincuser_name = $edit['boincuser_name'];
420 420
             $result = $boinc_user->update(
421 421
                 "name='{$boincuser_name}'"
422 422
             );
423
-          }
424
-          break;
423
+            }
424
+            break;
425 425
         default:
426 426
         }
427 427
         // We don't want to save update source or duplicate custom fields, so
428 428
         // remove them before continuing to core Drupal routines
429 429
         $edit['update_source'] = null;
430 430
         $edit['boincuser_name'] = null;
431
-      }
432
-      break;
431
+        }
432
+        break;
433 433
       
434 434
     default:
435 435
       
436 436
     }
437
-  }
437
+    }
438 438
 }
439 439
 
440 440
 /**
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
  * Obsolete in Drupal 7...
443 443
  */
444 444
 function boincuser_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
445
-  // In Drupal 7, these operation cases will all exist as their own hooks,
446
-  // so let's approximate that here so that this function can simply be removed
447
-  // upon migration to 7
448
-  switch($op) {
449
-  case 'update':
445
+    // In Drupal 7, these operation cases will all exist as their own hooks,
446
+    // so let's approximate that here so that this function can simply be removed
447
+    // upon migration to 7
448
+    switch($op) {
449
+    case 'update':
450 450
     boincuser_node_update($node);
451
-  }
451
+    }
452 452
 }
453 453
 
454 454
 /**
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
  * is updated (forward compatible to Drupal 7)
457 457
  */
458 458
 function boincuser_node_update($node) {
459
-  switch($node->type) {
460
-  case 'profile':
459
+    switch($node->type) {
460
+    case 'profile':
461 461
     // Update the BOINC database directly
462 462
     $account = user_load($node->uid);
463 463
     // Save user account data
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
       UPDATE user
470 470
       SET country = '%s', postal_code = '%s', url = '%s', has_profile = 1
471 471
       WHERE id = %d",
472
-      $country, $postal_code, $url, $account->boincuser_id
472
+        $country, $postal_code, $url, $account->boincuser_id
473 473
     );
474 474
     db_set_active('default');
475 475
     if (!$account_updated) {
476
-      drupal_set_message(t('Error saving BOINC account info.'), 'error');
476
+        drupal_set_message(t('Error saving BOINC account info.'), 'error');
477 477
     }
478 478
     // Save profile data
479 479
     $response1 = $node->field_background[0]['value'];
@@ -484,16 +484,16 @@  discard block
 block discarded – undo
484 484
       SET userid = %d, response1 = '%s', response2 = '%s'
485 485
       ON DUPLICATE KEY UPDATE
486 486
         response1 = '%s', response2 = '%s'",
487
-      $account->boincuser_id, $response1, $response2,
488
-      $response1, $response2
487
+        $account->boincuser_id, $response1, $response2,
488
+        $response1, $response2
489 489
     );
490 490
     db_set_active('default');
491 491
     if (!$profile_updated) {
492
-      drupal_set_message(t('Error saving BOINC profile.'), 'error');
492
+        drupal_set_message(t('Error saving BOINC profile.'), 'error');
493 493
     }
494 494
     break;
495 495
     
496
-  default:
496
+    default:
497 497
     
498 498
   }
499 499
 }
@@ -502,19 +502,19 @@  discard block
 block discarded – undo
502 502
 * Implementation of hook_views_api()
503 503
 */
504 504
 function boincuser_views_api() {
505
-  return array(
505
+    return array(
506 506
     'api' => 2.0,
507 507
     'path' => drupal_get_path('module', 'boincuser')
508
-  );
508
+    );
509 509
 }
510 510
 
511 511
 /**
512 512
 * Implementation of hook_form_alter()
513 513
 */
514 514
 function boincuser_form_alter(&$form, $form_state, $form_id) {
515
-  global $user;
516
-  switch ($form_id) {
517
-  case 'flag_confirm':
515
+    global $user;
516
+    switch ($form_id) {
517
+    case 'flag_confirm':
518 518
     // The URL seems to be the only way to put any kind of context to this
519 519
     // request!
520 520
     $action = arg(2);
@@ -523,25 +523,25 @@  discard block
 block discarded – undo
523 523
     
524 524
     // Wrap action buttons for styling consistency
525 525
     $form['form control tabs prefix'] = array(
526
-      '#value' => '<ul class="form-control tab-list">',
527
-      '#weight' => 1001,
526
+        '#value' => '<ul class="form-control tab-list">',
527
+        '#weight' => 1001,
528 528
     );
529 529
     
530 530
     switch ($flag_type) {
531 531
     case 'friend':
532 532
       $friend_id = $form['content_id']['#value'];
533
-      $flag = flag_get_flag('friend');
534
-      $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid);
533
+        $flag = flag_get_flag('friend');
534
+        $friend_status = flag_friend_determine_friend_status($flag, $friend_id, $user->uid);
535 535
       
536
-      // General friend form overrides
537
-      $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';
538
-      $form['flag_friend_submit']['#value'] = bts('Send request');
539
-      $form['flag_friend_submit']['#type'] = 'submit';
540
-      $form['flag_friend_submit']['#suffix'] = '</li>';
541
-      $form['flag_friend_submit']['#weight'] = 1002;
536
+        // General friend form overrides
537
+        $form['flag_friend_submit']['#prefix'] = '<li class="first tab">';
538
+        $form['flag_friend_submit']['#value'] = bts('Send request');
539
+        $form['flag_friend_submit']['#type'] = 'submit';
540
+        $form['flag_friend_submit']['#suffix'] = '</li>';
541
+        $form['flag_friend_submit']['#weight'] = 1002;
542 542
       
543
-      switch ($friend_status) {
544
-      case FLAG_FRIEND_BOTH:
543
+        switch ($friend_status) {
544
+        case FLAG_FRIEND_BOTH:
545 545
       case FLAG_FRIEND_FLAGGED:
546 546
         unset($form['actions']);
547 547
         $form['flag_friend_submit']['#value'] = bts('Remove friend');
@@ -550,53 +550,53 @@  discard block
 block discarded – undo
550 550
         $form['#submit'][] = 'boincuser_fix_unfriend_form_submit';
551 551
         $form['#submit'][] = $final_handler;
552 552
         break;
553
-      case FLAG_FRIEND_PENDING:
553
+        case FLAG_FRIEND_PENDING:
554 554
         unset($form['actions']);
555 555
         $form['flag_friend_submit']['#value'] = bts('Remove request');
556 556
         break;
557
-      case FLAG_FRIEND_APPROVAL:
557
+        case FLAG_FRIEND_APPROVAL:
558 558
         if ($action == 'flag') {
559
-          $form['flag_friend_submit']['#value'] = bts('Approve request');
559
+            $form['flag_friend_submit']['#value'] = bts('Approve request');
560 560
         }
561 561
         elseif ($action == 'unflag') {
562
-          unset($form['actions']);
563
-          $form['flag_friend_submit']['#value'] = bts('Deny request');
562
+            unset($form['actions']);
563
+            $form['flag_friend_submit']['#value'] = bts('Deny request');
564 564
         }
565 565
         break;
566
-      case FLAG_FRIEND_UNFLAGGED:
566
+        case FLAG_FRIEND_UNFLAGGED:
567 567
       default:
568 568
         $user_links[] = array(
569
-          'title' => bts('Add as friend'),
570
-          'href' => "flag/confirm/flag/friend/{$account->uid}"
569
+            'title' => bts('Add as friend'),
570
+            'href' => "flag/confirm/flag/friend/{$account->uid}"
571 571
         );
572
-      }
573
-      break;
572
+        }
573
+        break;
574 574
       
575 575
     default:
576 576
     }
577 577
     
578 578
     $form['cancel'] = array(
579
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $cancel_dest) . '</li>',
580
-      '#weight' => 1004,
579
+        '#value' => '<li class="tab">' . l(bts('Cancel'), $cancel_dest) . '</li>',
580
+        '#weight' => 1004,
581 581
     );
582 582
     $form['form control tabs suffix'] = array(
583
-      '#value' => '</ul>',
584
-      '#weight' => 1010,
583
+        '#value' => '</ul>',
584
+        '#weight' => 1010,
585 585
     );
586 586
     
587 587
     break;
588 588
     
589
-  // General node edit form
590
-  case 'news_node_form':
589
+    // General node edit form
590
+    case 'news_node_form':
591 591
     $form['separator_bottom'] = array(
592
-      '#value' => '<div class="separator buttons"></div>',
593
-      '#weight' => 999,
592
+        '#value' => '<div class="separator buttons"></div>',
593
+        '#weight' => 999,
594 594
     );
595 595
     
596 596
     // Wrap action buttons for styling consistency
597 597
     $form['buttons']['form control tabs prefix'] = array(
598
-      '#value' => '<ul class="form-control tab-list">',
599
-      '#weight' => 1001,
598
+        '#value' => '<ul class="form-control tab-list">',
599
+        '#weight' => 1001,
600 600
     );
601 601
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
602 602
     $form['buttons']['submit']['#value'] = bts('Save changes');
@@ -609,15 +609,15 @@  discard block
 block discarded – undo
609 609
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
610 610
     $form['buttons']['preview_changes']['#weight'] = 1004;
611 611
     $form['buttons']['cancel'] = array(
612
-      '#value' => '<li class="tab">' . l(bts('Cancel'), "node/{$form['nid']['#value']}") . '</li>',
613
-      '#weight' => 1005,
612
+        '#value' => '<li class="tab">' . l(bts('Cancel'), "node/{$form['nid']['#value']}") . '</li>',
613
+        '#weight' => 1005,
614 614
     );
615 615
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
616 616
     $form['buttons']['delete']['#suffix'] = '</li>';
617 617
     $form['buttons']['delete']['#weight'] = 1006;
618 618
     $form['buttons']['form control tabs suffix'] = array(
619
-      '#value' => '</ul>',
620
-      '#weight' => 1010,
619
+        '#value' => '</ul>',
620
+        '#weight' => 1010,
621 621
     );
622 622
     
623 623
     // Preview is ugly, unset until it works
@@ -625,40 +625,40 @@  discard block
 block discarded – undo
625 625
 
626 626
     break;
627 627
   
628
-  case 'node_delete_confirm':
628
+    case 'node_delete_confirm':
629 629
     $form['separator_bottom'] = array(
630
-      '#value' => '<div class="separator buttons"></div>',
631
-      '#weight' => 999,
630
+        '#value' => '<div class="separator buttons"></div>',
631
+        '#weight' => 999,
632 632
     );
633 633
     
634 634
     // Wrap action buttons for styling consistency
635 635
     $form['actions']['form control tabs prefix'] = array(
636
-      '#value' => '<ul class="form-control tab-list">',
637
-      '#weight' => 1001,
636
+        '#value' => '<ul class="form-control tab-list">',
637
+        '#weight' => 1001,
638 638
     );
639 639
     $form['actions']['submit']['#prefix'] = '<li class="first tab">';
640 640
     $form['actions']['submit']['#value'] = bts('Delete');
641 641
     $form['actions']['submit']['#suffix'] = '</li>';
642 642
     $form['actions']['submit']['#weight'] = 1002;
643 643
     $form['actions']['cancel'] = array(
644
-      '#value' => '<li class="tab">' . l(bts('Cancel'), "node/{$form['nid']['#value']}") . '</li>',
645
-      '#weight' => 1005,
644
+        '#value' => '<li class="tab">' . l(bts('Cancel'), "node/{$form['nid']['#value']}") . '</li>',
645
+        '#weight' => 1005,
646 646
     );
647 647
     $form['actions']['form control tabs suffix'] = array(
648
-      '#value' => '</ul>',
649
-      '#weight' => 1010,
648
+        '#value' => '</ul>',
649
+        '#weight' => 1010,
650 650
     );
651 651
     $form['#redirect'] = 'account/profile';
652 652
     break;
653 653
     
654
-  case 'privatemsg_new':
654
+    case 'privatemsg_new':
655 655
     
656 656
     $form['privatemsg']['body']['#title'] = '';
657 657
     
658 658
     // Wrap action buttons for styling consistency
659 659
     $form['privatemsg']['form control tabs prefix'] = array(
660
-      '#value' => '<ul class="form-control tab-list">',
661
-      '#weight' => 1001,
660
+        '#value' => '<ul class="form-control tab-list">',
661
+        '#weight' => 1001,
662 662
     );
663 663
     $form['privatemsg']['submit']['#prefix'] = '<li class="first tab">';
664 664
     $form['privatemsg']['submit']['#value'] = bts('Send message');
@@ -668,26 +668,26 @@  discard block
 block discarded – undo
668 668
     $form['privatemsg']['preview']['#suffix'] = '</li>';
669 669
     $form['privatemsg']['preview']['#weight'] = 1003;
670 670
     $form['privatemsg']['cancel'] = array(
671
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
672
-      '#weight' => 1004,
671
+        '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
672
+        '#weight' => 1004,
673 673
     );
674 674
     $form['privatemsg']['form control tabs suffix'] = array(
675
-      '#value' => '</ul>',
676
-      '#weight' => 1010,
675
+        '#value' => '</ul>',
676
+        '#weight' => 1010,
677 677
     );
678 678
     
679 679
     unset($form['privatemsg']['recipient_display']);
680 680
     
681 681
     break;
682 682
     
683
-  // Login form
684
-  case 'user_login':
683
+    // Login form
684
+    case 'user_login':
685 685
   case 'user_login_block':
686 686
     drupal_set_title(bts('Login'));
687 687
     // Replace name with email in login form
688 688
     unset($form['name']);
689 689
     array_unshift($form, array(
690
-      'email' => array(
690
+        'email' => array(
691 691
         '#type' => 'textfield',
692 692
         '#title' => bts('Email address'),
693 693
         '#size' => ($form_id == 'user_login_block') ? 15 : 60,
@@ -695,18 +695,18 @@  discard block
 block discarded – undo
695 695
         '#required' => TRUE,
696 696
         '#attributes' => array('tabindex' => '1'),
697 697
         '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'BOINC')))
698
-      ),
699
-      'validation_source' => array(
698
+        ),
699
+        'validation_source' => array(
700 700
         '#type' => 'hidden',
701 701
         '#value' => 'user_login'
702
-      )
702
+        )
703 703
     ));
704 704
     $form['#redirect'] = 'home';
705 705
     
706 706
     // Wrap action buttons for styling consistency
707 707
     $form['buttons']['form control tabs prefix'] = array(
708
-      '#value' => '<ul class="form-control tab-list">',
709
-      '#weight' => 1001,
708
+        '#value' => '<ul class="form-control tab-list">',
709
+        '#weight' => 1001,
710 710
     );
711 711
     $form['buttons']['submit'] = $form['submit'];
712 712
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
     $form['buttons']['submit']['#suffix'] = '</li>';
715 715
     $form['buttons']['submit']['#weight'] = 1002;
716 716
     $form['buttons']['form control tabs suffix'] = array(
717
-      '#value' => '</ul>',
718
-      '#weight' => 1010,
717
+        '#value' => '</ul>',
718
+        '#weight' => 1010,
719 719
     );
720 720
     unset($form['submit']);
721 721
     
@@ -724,23 +724,23 @@  discard block
 block discarded – undo
724 724
     isset($form['buttons']['submit']['#attributes']) ? array_push($form['buttons']['submit']['#attributes'], array('tabindex' => '3')) : $form['buttons']['submit']['#attributes'] = array('tabindex' => '3');
725 725
     // If the user login form is being submitted, use BOINC validation handler.
726 726
     if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) {
727
-      // Find the local validation function's entry so we can replace it.
728
-      $array_key = array_search('user_login_authenticate_validate', $form['#validate']);
729
-      if ($array_key === FALSE) {
727
+        // Find the local validation function's entry so we can replace it.
728
+        $array_key = array_search('user_login_authenticate_validate', $form['#validate']);
729
+        if ($array_key === FALSE) {
730 730
         // Could not find it. Some other module must have run form_alter().
731 731
         // We will simply add our validation just before the final validator.
732 732
         $final_validator = array_pop($form['#validate']);
733 733
         $form['#validate'][] = 'boincuser_login_validate';
734 734
         $form['#validate'][] = $final_validator;
735
-      } else {
735
+        } else {
736 736
         // Replace the local validation function with BOINC validation
737 737
         $form['#validate'][$array_key] = 'boincuser_login_validate';
738
-      }
738
+        }
739 739
     }
740 740
     break;
741 741
     
742
-  // User credentials form
743
-  case 'user_profile_form':
742
+    // User credentials form
743
+    case 'user_profile_form':
744 744
     
745 745
     // Use the displaly name as the title, not the username
746 746
     $account = user_load($form['#uid']);
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
     // coming from the password reset function
751 751
     $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1;
752 752
     if ($reset_pass) {
753
-      $_SESSION['reset_pass'] = 1;
753
+        $_SESSION['reset_pass'] = 1;
754 754
     }
755 755
     
756 756
     $form['account']['name']['#size'] = 40;
@@ -759,50 +759,50 @@  discard block
 block discarded – undo
759 759
     $form['account']['pass']['#size'] = 17;
760 760
     
761 761
     if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) {
762
-      // Add a password authenticator, required to change email or pw
763
-      $form['account']['current_pass'] = array(
762
+        // Add a password authenticator, required to change email or pw
763
+        $form['account']['current_pass'] = array(
764 764
         '#type' => 'password',
765 765
         '#title' => bts('Enter your password to save changes'),
766 766
         '#description' => bts('Enter your current password if changing your email
767 767
           address or password.'),
768 768
         '#size' => 17,
769 769
         '#attributes' => array(
770
-          'autocomplete' => 'off',
770
+            'autocomplete' => 'off',
771 771
         ),
772
-      );
772
+        );
773 773
     }
774 774
     
775 775
     // Add account keys, CPID, etc
776 776
     $form['account']['boincuser_id'] = array(
777
-      '#value' => '
777
+        '#value' => '
778 778
         <div class="form-item">
779 779
           <label>' . bts('BOINC user ID') . '</label>
780 780
           <span>' . $account->boincuser_id . '</span>
781 781
         </div>',
782 782
     );
783 783
     $form['account']['user_id'] = array(
784
-      '#value' => '
784
+        '#value' => '
785 785
         <div class="form-item">
786 786
           <label>' . bts('Drupal user ID') . '</label>
787 787
           <span>' . $account->uid . '</span>
788 788
         </div>',
789 789
     );
790 790
     $form['account']['account_key'] = array(
791
-      '#value' => '
791
+        '#value' => '
792 792
         <div class="form-item">
793 793
           <label>' . bts('Account key') . '</label>
794 794
           <span>' . $account->boincuser_account_key . '</span>
795 795
         </div>',
796 796
     );
797 797
     $form['account']['weak_account_key'] = array(
798
-      '#value' => '
798
+        '#value' => '
799 799
         <div class="form-item">
800 800
           <label>' . bts('Weak account key') . '</label>
801 801
           <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span>
802 802
         </div>',
803 803
     );
804 804
     $form['account']['cpid'] = array(
805
-      '#value' => '
805
+        '#value' => '
806 806
         <div class="form-item">
807 807
           <label>' . bts('Cross-project ID') . '</label>
808 808
           <span>' . $account->boincuser_cpid . '</span>
@@ -810,30 +810,30 @@  discard block
 block discarded – undo
810 810
     );
811 811
     
812 812
     $form['account']['separator_bottom'] = array(
813
-      '#value' => '<div class="separator buttons"></div>'
813
+        '#value' => '<div class="separator buttons"></div>'
814 814
     );
815 815
     
816 816
     // Wrap action buttons for styling consistency
817 817
     $form['form control tabs prefix'] = array(
818
-      '#value' => '<ul class="form-control tab-list">',
819
-      '#weight' => 1001,
818
+        '#value' => '<ul class="form-control tab-list">',
819
+        '#weight' => 1001,
820 820
     );
821 821
     $form['submit']['#prefix'] = '<li class="first tab">';
822 822
     $form['submit']['#value'] = bts('Save changes');
823 823
     $form['submit']['#suffix'] = '</li>';
824 824
     $form['submit']['#weight'] = 1002;
825 825
     if (isset($form['delete']) AND is_array($form['delete'])) {
826
-      $form['delete']['#prefix'] = '<li class="tab">';
827
-      $form['delete']['#suffix'] = '</li>';
828
-      $form['delete']['#weight'] = 1003;
826
+        $form['delete']['#prefix'] = '<li class="tab">';
827
+        $form['delete']['#suffix'] = '</li>';
828
+        $form['delete']['#weight'] = 1003;
829 829
     }
830 830
     $form['cancel'] = array(
831
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
832
-      '#weight' => 1004,
831
+        '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
832
+        '#weight' => 1004,
833 833
     );
834 834
     $form['form control tabs suffix'] = array(
835
-      '#value' => '</ul>',
836
-      '#weight' => 1010,
835
+        '#value' => '</ul>',
836
+        '#weight' => 1010,
837 837
     );
838 838
     
839 839
     // Rearrange form elements
@@ -864,41 +864,41 @@  discard block
 block discarded – undo
864 864
     
865 865
     // Internal fields to indicate where these user changes are taking place
866 866
     array_unshift($form, array(
867
-      'validation_source' => array(
867
+        'validation_source' => array(
868 868
         '#type' => 'hidden',
869 869
         '#value' => 'user_account'
870
-      ),
871
-      'update_source' => array(
870
+        ),
871
+        'update_source' => array(
872 872
         '#type' => 'hidden',
873 873
         '#value' => 'user_account'
874
-      )
874
+        )
875 875
     ));
876 876
     
877 877
     break;
878 878
     
879
-  case 'profile_node_form':
879
+    case 'profile_node_form':
880 880
     
881 881
     // Use the display name as the title, not the username
882 882
     $account = user_load($form['uid']['#value']);
883 883
     drupal_set_title($account->boincuser_name);
884 884
     
885 885
     $form['separator_bottom'] = array(
886
-      '#value' => '<div class="separator buttons"></div>',
887
-      '#weight' => 999,
886
+        '#value' => '<div class="separator buttons"></div>',
887
+        '#weight' => 999,
888 888
     );
889 889
     
890 890
     if (module_exists('captcha')) {
891
-      // Add an optional captcha
892
-      $form['profile_captcha'] = array(
891
+        // Add an optional captcha
892
+        $form['profile_captcha'] = array(
893 893
         '#type' => 'captcha',
894 894
         '#weight' => 1000,
895
-      );
895
+        );
896 896
     }
897 897
     
898 898
     // Wrap action buttons for styling consistency
899 899
     $form['buttons']['form control tabs prefix'] = array(
900
-      '#value' => '<ul class="form-control tab-list">',
901
-      '#weight' => 1001,
900
+        '#value' => '<ul class="form-control tab-list">',
901
+        '#weight' => 1001,
902 902
     );
903 903
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
904 904
     $form['buttons']['submit']['#value'] = bts('Save changes');
@@ -911,15 +911,15 @@  discard block
 block discarded – undo
911 911
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
912 912
     $form['buttons']['preview_changes']['#weight'] = 1004;
913 913
     $form['buttons']['cancel'] = array(
914
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
915
-      '#weight' => 1005,
914
+        '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
915
+        '#weight' => 1005,
916 916
     );
917 917
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
918 918
     $form['buttons']['delete']['#suffix'] = '</li>';
919 919
     $form['buttons']['delete']['#weight'] = 1006;
920 920
     $form['buttons']['form control tabs suffix'] = array(
921
-      '#value' => '</ul>',
922
-      '#weight' => 1010,
921
+        '#value' => '</ul>',
922
+        '#weight' => 1010,
923 923
     );
924 924
     
925 925
     $form['#after_build'][] = 'boincuser_profile_node_form_after_build';
@@ -936,79 +936,79 @@  discard block
 block discarded – undo
936 936
     
937 937
     // Internal fields to indicate where these user changes are taking place
938 938
     array_unshift($form, array(
939
-      'validation_source' => array(
939
+        'validation_source' => array(
940 940
         '#type' => 'hidden',
941 941
         '#value' => 'user_profile'
942
-      ),
943
-      'update_source' => array(
942
+        ),
943
+        'update_source' => array(
944 944
         '#type' => 'hidden',
945 945
         '#value' => 'user_profile'
946
-      )
946
+        )
947 947
     ));
948 948
     break;
949 949
   
950
-  // Registration form
951
-  case 'user_register':
950
+    // Registration form
951
+    case 'user_register':
952 952
     array_unshift($form, array(
953
-      'boincuser_name' => array(
953
+        'boincuser_name' => array(
954 954
         '#type' => 'textfield', 
955 955
         '#title' => bts('Name'), 
956 956
         '#default_value' => $edit['boincuser_name'], 
957 957
         '#maxlength' => USERNAME_MAX_LENGTH, 
958 958
         '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), 
959 959
         '#required' => TRUE
960
-      ),
961
-      'validation_source' => array(
960
+        ),
961
+        'validation_source' => array(
962 962
         '#type' => 'hidden',
963 963
         '#value' => 'user_register'
964
-      )
964
+        )
965 965
     ));
966 966
     // Set name temporarily to dummy value to beat validation
967 967
     $form['name'] = array(
968
-      '#type' => 'hidden',
969
-      '#value' => rand() . '.' . time()
968
+        '#type' => 'hidden',
969
+        '#value' => rand() . '.' . time()
970 970
     );
971 971
     
972 972
     if (module_exists('captcha')) {
973
-      // Add an optional captcha
974
-      $form['register_captcha'] = array(
973
+        // Add an optional captcha
974
+        $form['register_captcha'] = array(
975 975
         '#type' => 'captcha',
976 976
         '#weight' => 1000,
977
-      );
977
+        );
978 978
     }
979 979
     
980 980
     $form['submit']['#weight'] = 1001;
981 981
     break;
982 982
     
983
-  // Request new password form
984
-  case 'user_pass':
983
+    // Request new password form
984
+    case 'user_pass':
985 985
     drupal_set_title(bts('Forgot password'));
986 986
     // Replace name/email text box with email only; retain "name" label
987 987
     // for compatibility with standard Drupal submit function
988 988
     unset($form['name']);
989 989
     array_unshift($form, array(
990
-      'name' => array(
990
+        'name' => array(
991 991
         '#type' => 'textfield',
992 992
         '#title' => bts('Email address'),
993 993
         '#size' => 60,
994 994
         '#maxlength' => EMAIL_MAX_LENGTH,
995 995
         '#required' => TRUE,
996 996
         '#description' => bts(
997
-          'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',
998
-          array(
997
+            'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',
998
+            array(
999 999
             '!authenticator_login' => l(
1000
-              bts('authenticator-based login'),
1001
-              'user/login/auth'
1000
+                bts('authenticator-based login'),
1001
+                'user/login/auth'
1002
+            )
1002 1003
             )
1003
-          )
1004 1004
         ),
1005
-      ),
1005
+        ),
1006 1006
     ));
1007 1007
     
1008 1008
     // Wrap action buttons for styling consistency
1009 1009
     $form['buttons']['form control tabs prefix'] = array(
1010
-      '#value' => '<ul class="form-control tab-list">',
1011
-      '#weight' => 1001,
1010
+        '#value' => '<ul class="form-control tab-list">',
1011
+        '#weight' => 1001,
1012 1012
     );
1013 1013
     $form['buttons']['submit'] = $form['submit'];
1014 1014
     $form['buttons']['submit']['#prefix'] = '<li class="first tab">';
@@ -1016,26 +1016,26 @@  discard block
 block discarded – undo
1016 1016
     $form['buttons']['submit']['#suffix'] = '</li>';
1017 1017
     $form['buttons']['submit']['#weight'] = 1002;
1018 1018
     $form['buttons']['cancel'] = array(
1019
-      '#value' => '<li class="tab">' . l(bts('Cancel'), 'user/login') . '</li>',
1020
-      '#weight' => 1005,
1019
+        '#value' => '<li class="tab">' . l(bts('Cancel'), 'user/login') . '</li>',
1020
+        '#weight' => 1005,
1021 1021
     );
1022 1022
     $form['buttons']['form control tabs suffix'] = array(
1023
-      '#value' => '</ul>',
1024
-      '#weight' => 1010,
1023
+        '#value' => '</ul>',
1024
+        '#weight' => 1010,
1025 1025
     );
1026 1026
     unset($form['submit']);
1027 1027
     
1028 1028
     // If the form is being submitted, use BOINC validation handler.
1029 1029
     if (isset($form_state['post']['name'])) {
1030
-      // Prepend the BOINC validation function to local validation
1031
-      array_unshift($form['#validate'], 'boincuser_request_pass_validate');
1030
+        // Prepend the BOINC validation function to local validation
1031
+        array_unshift($form['#validate'], 'boincuser_request_pass_validate');
1032 1032
     }
1033 1033
     break;
1034 1034
     
1035
-  case 'views_exposed_form':
1035
+    case 'views_exposed_form':
1036 1036
     $form['submit']['#value'] = bts('Search');
1037 1037
     break;
1038
-  }
1038
+    }
1039 1039
 }
1040 1040
 
1041 1041
 /**
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
  * built; this is called from boincuser_form_alter()
1044 1044
  */
1045 1045
 function boincuser_profile_node_form_after_build($form, &$form_state) {
1046
-  // Move to community prefs form
1047
-  $form_state['storage']['avatar'] = $form['field_image'];
1048
-  unset($form['field_image']);
1049
-  return $form;
1046
+    // Move to community prefs form
1047
+    $form_state['storage']['avatar'] = $form['field_image'];
1048
+    unset($form['field_image']);
1049
+    return $form;
1050 1050
 }
1051 1051
 
1052 1052
 /**
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
  * @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_elements/6
1055 1055
  */
1056 1056
 function boincuser_elements() {
1057
-  $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm';
1058
-  return $type;
1057
+    $type['password_confirm']['#process'][] = 'boincuser_process_password_confirm';
1058
+    return $type;
1059 1059
 }
1060 1060
 
1061 1061
 /**
@@ -1063,11 +1063,11 @@  discard block
 block discarded – undo
1063 1063
  * profile form
1064 1064
  */
1065 1065
 function boincuser_process_password_confirm($element) {
1066
-  // Check if parent element is "account".
1067
-  if ($element['#array_parents'][0] == 'account') {
1066
+    // Check if parent element is "account".
1067
+    if ($element['#array_parents'][0] == 'account') {
1068 1068
     $element['pass1']['#title'] = bts('Change password');
1069
-  }
1070
-  return $element;
1069
+    }
1070
+    return $element;
1071 1071
 }
1072 1072
 
1073 1073
 /**
@@ -1075,40 +1075,40 @@  discard block
 block discarded – undo
1075 1075
  * Register theme functions for use in this module.
1076 1076
  */
1077 1077
 function boincuser_theme($existing, $type, $theme, $path) {
1078
-  return array(
1078
+    return array(
1079 1079
     'boincuser_user_pass' => array(
1080
-      'arguments' => array()
1080
+        'arguments' => array()
1081 1081
     )
1082
-  );
1082
+    );
1083 1083
 }
1084 1084
 
1085 1085
 /**
1086 1086
  * Implementation of hook_token_values
1087 1087
  */
1088 1088
 function boincuser_token_values($type, $object = NULL, $options = array()) {
1089
-  if ($type == 'user') {
1089
+    if ($type == 'user') {
1090 1090
     $account = user_load($object->uid);
1091 1091
     $tokens['display-name'] = $account->boincuser_name;
1092 1092
     return $tokens;
1093
-  }
1093
+    }
1094 1094
 }
1095 1095
 
1096 1096
 /**
1097 1097
  * Implementation of hook_token_list
1098 1098
  */
1099 1099
 function boincuser_token_list($type = 'all') {
1100
-  if ($type == 'user' || $type == 'all') {
1100
+    if ($type == 'user' || $type == 'all') {
1101 1101
     $tokens['user']['display-name']      = t("The user's name that should be displayed");
1102 1102
     return $tokens;
1103
-  }
1103
+    }
1104 1104
 }
1105 1105
 
1106 1106
 /**
1107 1107
  * Implementation of hook_views_pre_execute()
1108 1108
  */
1109 1109
 function boincuser_views_pre_execute(&$view) {
1110
-  $account_id = $view->args[0];
1111
-  if ($view->name=="user_activity") {
1110
+    $account_id = $view->args[0];
1111
+    if ($view->name=="user_activity") {
1112 1112
     // Run the following custom query for the user_activity view
1113 1113
     $view->build_info['query']= "
1114 1114
       SELECT node_revisions.vid AS vid,
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
     
1141 1141
     // count_query determines the pager.  Do this so the right item count is returned.
1142 1142
     $view->build_info['count_query'] = $view->build_info['query'];
1143
-  }
1143
+    }
1144 1144
 }
1145 1145
 
1146 1146
 
@@ -1152,17 +1152,17 @@  discard block
 block discarded – undo
1152 1152
  * Page callback shortcut to recent posts for the logged in user
1153 1153
  */
1154 1154
 function boincuser_goto_recent_posts() {
1155
-  global $user;
1156
-  drupal_goto("account/{$user->uid}/posts");
1155
+    global $user;
1156
+    drupal_goto("account/{$user->uid}/posts");
1157 1157
 }
1158 1158
 
1159 1159
 /**
1160 1160
  * Page callback shortcut to the team of the logged in user
1161 1161
  */
1162 1162
 function boincuser_goto_team() {
1163
-  global $user;
1164
-  $account = user_load($user->uid);
1165
-  drupal_goto("community/teams/{$account->team}");
1163
+    global $user;
1164
+    $account = user_load($user->uid);
1165
+    drupal_goto("community/teams/{$account->team}");
1166 1166
 }
1167 1167
 
1168 1168
 /**
@@ -1171,58 +1171,58 @@  discard block
 block discarded – undo
1171 1171
  * user profile pages, so use a wrapper for display
1172 1172
  */
1173 1173
 function boincuser_view_profile($account = null) {
1174
-  // Create the user profile page
1175
-  if (!$account) {
1174
+    // Create the user profile page
1175
+    if (!$account) {
1176 1176
     global $user;
1177 1177
     $account = $user;
1178
-  }
1179
-  // For now, just call the user module profile view function
1180
-  user_build_content($account);
1181
-  return theme('user_profile', $account);
1178
+    }
1179
+    // For now, just call the user module profile view function
1180
+    user_build_content($account);
1181
+    return theme('user_profile', $account);
1182 1182
 }
1183 1183
 
1184 1184
 /**
1185 1185
  * Page callback for editing a user profile
1186 1186
  */
1187 1187
 function boincuser_edit_profile($account = null) {
1188
-  // Create the user profile form
1189
-  if (!$account) {
1188
+    // Create the user profile form
1189
+    if (!$account) {
1190 1190
     global $user;
1191 1191
     $account = $user;
1192
-  }
1193
-  // Render the form
1194
-  module_load_include('pages.inc', 'node', 'node');
1195
-  return content_profile_page_edit('profile', $account);
1192
+    }
1193
+    // Render the form
1194
+    module_load_include('pages.inc', 'node', 'node');
1195
+    return content_profile_page_edit('profile', $account);
1196 1196
 }
1197 1197
 
1198 1198
 /**
1199
-  * Join page menu callback.
1200
-  * Display instructions on joining for new or existing BOINC users
1201
-  */
1199
+ * Join page menu callback.
1200
+ * Display instructions on joining for new or existing BOINC users
1201
+ */
1202 1202
 function join_page($type = null) {
1203
-  global $base_url;
1204
-  $registration_enabled = variable_get('user_register', 0);
1205
-  $output = '<div class="join">';
1206
-  switch ($type) {
1207
-  case 'boinc':
1203
+    global $base_url;
1204
+    $registration_enabled = variable_get('user_register', 0);
1205
+    $output = '<div class="join">';
1206
+    switch ($type) {
1207
+    case 'boinc':
1208 1208
     $output .= '<p>' . bts("If you're already running BOINC, select <i>Add
1209 1209
       Project</i>.") . '</p>';
1210 1210
     if ($registration_enabled) {
1211
-      $output .= '<p>' . bts("If you're running a command-line or pre-5.0 version
1211
+        $output .= '<p>' . bts("If you're running a command-line or pre-5.0 version
1212 1212
         of BOINC, !create_an_account first.", array('!create_an_account' => 
1213
-          l(bts('create an account'), 'user/registration'))) . '</p>';
1213
+            l(bts('create an account'), 'user/registration'))) . '</p>';
1214 1214
     }
1215 1215
     else {
1216
-      $output .= '<p>' . bts("If you're running a command-line version of BOINC,
1216
+        $output .= '<p>' . bts("If you're running a command-line version of BOINC,
1217 1217
         first use the BOINC Manager software (elsewhere if necessary) to create an
1218 1218
         an account at this project, then use that account to connect with the
1219 1219
         command-line version.") . '</p>';
1220
-      $output .= '<p>' . bts("If you're running a pre-5.0 version of BOINC, please
1220
+        $output .= '<p>' . bts("If you're running a pre-5.0 version of BOINC, please
1221 1221
         upgrade to a more recent version to create an account
1222 1222
         at this project.") . '</p>';
1223 1223
     }
1224 1224
     break;
1225
-  case 'new':
1225
+    case 'new':
1226 1226
   default:
1227 1227
     $output .= '<ol>';
1228 1228
     $output .= '  <li>' . bts('Download the desktop software');
@@ -1237,71 +1237,71 @@  discard block
 block discarded – undo
1237 1237
     $output .= '  </li>';
1238 1238
     $output .= '  <li>' . bts('Run the installer') . '</li>';
1239 1239
     $output .= '  <li>' . bts('When prompted enter @siteurl', array(
1240
-      '@siteurl' => $base_url)) . '</li>';
1240
+        '@siteurl' => $base_url)) . '</li>';
1241 1241
     $output .=  '</ol>';
1242
-  }
1243
-  $output .= '</div>';
1244
-  return $output;
1242
+    }
1243
+    $output .= '</div>';
1244
+    return $output;
1245 1245
 }
1246 1246
 
1247 1247
 /**
1248
-  * Home page content for embedding in Panels page
1249
-  */
1248
+ * Home page content for embedding in Panels page
1249
+ */
1250 1250
 function boincuser_home_page() {
1251
-  global $user;
1252
-  $site_name = variable_get('site_name', '');
1253
-  // get the front page message from database; this is set in the admin interface under BOINC Other
1254
-  $site_message = variable_get('boinc_other_frontpage','');
1251
+    global $user;
1252
+    $site_name = variable_get('site_name', '');
1253
+    // get the front page message from database; this is set in the admin interface under BOINC Other
1254
+    $site_message = variable_get('boinc_other_frontpage','');
1255 1255
 
1256
-  // Determine the user of the day
1257
-  $current_uotd = db_fetch_object(db_query("
1256
+    // Determine the user of the day
1257
+    $current_uotd = db_fetch_object(db_query("
1258 1258
     SELECT
1259 1259
       uid,
1260 1260
       uotd_time
1261 1261
     FROM {boincuser}
1262 1262
     ORDER BY uotd_time DESC
1263 1263
     LIMIT 1"
1264
-  ));
1265
-  if ($current_uotd->uotd_time < strtotime('today midnight')) {
1264
+    ));
1265
+    if ($current_uotd->uotd_time < strtotime('today midnight')) {
1266 1266
     $uotd = boincuser_select_user_of_the_day();
1267
-  }
1268
-  else {
1267
+    }
1268
+    else {
1269 1269
     $uotd = user_load($current_uotd->uid);
1270
-  }
1271
-  $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);
1272
-  $output = '<h2 class="pane-title">';
1273
-  $output .= ($user->uid) ? bts('Welcome back!') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!'));
1274
-  $output .= '</h2>';
1275
-  $output .= '<div class="boinc-overview balance-height-front">';
1276
-  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>';
1277
-  if ($user->uid) {
1270
+    }
1271
+    $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);
1272
+    $output = '<h2 class="pane-title">';
1273
+    $output .= ($user->uid) ? bts('Welcome back!') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!'));
1274
+    $output .= '</h2>';
1275
+    $output .= '<div class="boinc-overview balance-height-front">';
1276
+    $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>';
1277
+    if ($user->uid) {
1278 1278
     $output .= '  <div>' . l(bts('View account'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>';
1279
-  }
1280
-  else {
1279
+    }
1280
+    else {
1281 1281
     $output .= '  <div>' . l(bts('Join now'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>';
1282
-  }
1283
-  $output .= '</div>';
1284
-  $output .= '<div class="boinc-overview-details">';
1285
-  $output .= '  <div class="detail-container">';
1286
-  $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1287
-  $output .= '      <div class="picture">';
1288
-  $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1282
+    }
1283
+    $output .= '</div>';
1284
+    $output .= '<div class="boinc-overview-details">';
1285
+    $output .= '  <div class="detail-container">';
1286
+    $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1287
+    $output .= '      <div class="picture">';
1288
+    $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1289 1289
     $uotd_image['alt'], array(), FALSE);
1290
-  $output .= '      </div>';
1291
-  $output .= '      <div class="text">' . bts('User of the day') . '</div>';
1292
-  $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
1293
-  $output .= '    </a>';
1294
-  $output .= '    <div class="volunteers">';
1295
-  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.') . '</div>';
1296
-  $output .= '      <div class="platforms">';
1297
-  $output .= '        <div class="detail platform windows">' . bts('Windows') . '</div>';
1298
-  $output .= '        <div class="detail platform mac">' .  bts('Mac') . '</div>';
1299
-  $output .= '        <div class="detail platform linux">' . bts('Linux') . '</div>';
1300
-  $output .= '      </div>';
1301
-  $output .= '    </div>';
1302
-  $output .= '  </div>';
1303
-  $output .= '</div>';
1304
-  return $output;
1290
+    $output .= '      </div>';
1291
+    $output .= '      <div class="text">' . bts('User of the day') . '</div>';
1292
+    $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
1293
+    $output .= '    </a>';
1294
+    $output .= '    <div class="volunteers">';
1295
+    $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.') . '</div>';
1296
+    $output .= '      <div class="platforms">';
1297
+    $output .= '        <div class="detail platform windows">' . bts('Windows') . '</div>';
1298
+    $output .= '        <div class="detail platform mac">' .  bts('Mac') . '</div>';
1299
+    $output .= '        <div class="detail platform linux">' . bts('Linux') . '</div>';
1300
+    $output .= '      </div>';
1301
+    $output .= '    </div>';
1302
+    $output .= '  </div>';
1303
+    $output .= '</div>';
1304
+    return $output;
1305 1305
 }
1306 1306
 
1307 1307
 /**
@@ -1309,106 +1309,106 @@  discard block
 block discarded – undo
1309 1309
  * Create a new user account based on supplied parameters.
1310 1310
  */
1311 1311
 function boincuser_create_account() {
1312
-  require_boinc('boinc_db');
1313
-  require_boinc('user');
1314
-  require_boinc('xml');
1315
-  $params = array(
1312
+    require_boinc('boinc_db');
1313
+    require_boinc('user');
1314
+    require_boinc('xml');
1315
+    $params = array(
1316 1316
     'email_addr' => isset($_GET['email_addr']) ? $_GET['email_addr'] : '',
1317 1317
     'user_name' => isset($_GET['user_name']) ? $_GET['user_name'] : '',
1318 1318
     'passwd_hash' => isset($_GET['passwd_hash']) ? $_GET['passwd_hash'] : ''
1319
-  );
1319
+    );
1320 1320
   
1321
-  // Begin output
1322
-  xml_header();
1321
+    // Begin output
1322
+    xml_header();
1323 1323
   
1324
-  // Account creation disabled
1324
+    // Account creation disabled
1325 1325
   
1326
-  // Invalid invite code
1326
+    // Invalid invite code
1327 1327
   
1328
-  // Validate input
1329
-  if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) {
1328
+    // Validate input
1329
+    if (user_validate_mail($params['email_addr']) or !is_valid_email_addr($params['email_addr'])) {
1330 1330
     xml_error(-205);
1331
-  }
1332
-  if ($error = user_validate_name($params['user_name'])) {
1331
+    }
1332
+    if ($error = user_validate_name($params['user_name'])) {
1333 1333
     xml_error(-205, $error);
1334
-  }
1335
-  if (strlen($params['passwd_hash']) != 32) {
1334
+    }
1335
+    if (strlen($params['passwd_hash']) != 32) {
1336 1336
     xml_error(-1, 'password hash length not 32');
1337
-  }
1337
+    }
1338 1338
   
1339
-  // Process input
1340
-  $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);
1341
-  if ($boinc_user) {
1339
+    // Process input
1340
+    $boinc_user = BoincUser::lookup_email_addr($params['email_addr']);
1341
+    if ($boinc_user) {
1342 1342
     // Return authenticator for existing users
1343 1343
     if ($params['passwd_hash'] == $boinc_user->passwd_hash) {
1344
-      $output = array('authenticator' => $boinc_user->authenticator);
1344
+        $output = array('authenticator' => $boinc_user->authenticator);
1345 1345
     } else {
1346
-      xml_error(-137);
1346
+        xml_error(-137);
1347 1347
     }
1348
-  } else {
1348
+    } else {
1349 1349
     // Verify that there isn't somehow a Drupal user already (not possible with proper function)
1350 1350
     if ($existing_user = user_load(array('mail' => $params['email_addr']))) {
1351
-      xml_error(-137, 'account error');
1351
+        xml_error(-137, 'account error');
1352 1352
     }
1353 1353
     // Create new account
1354 1354
     $unrestricted_role = array_search('community member', user_roles(true)); 
1355 1355
     $newUser = array(
1356
-      'name' => $params['user_name'],
1357
-      'pass' => null, // $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db
1358
-      'mail' => $params['email_addr'],
1359
-      'status' => 1,
1360
-      'init' => $params['email_addr'],
1361
-      'roles' => array($unrestricted_role => ''),
1356
+        'name' => $params['user_name'],
1357
+        'pass' => null, // $params['passwd_hash'], // note: passing a hash here requires ALL passwords to be hashed via hook prior to interacting with the hash stored in the db
1358
+        'mail' => $params['email_addr'],
1359
+        'status' => 1,
1360
+        'init' => $params['email_addr'],
1361
+        'roles' => array($unrestricted_role => ''),
1362 1362
     );
1363 1363
     $user = user_save(null, $newUser);
1364 1364
     $boinc_user = make_user($params['email_addr'], $params['user_name'], $params['passwd_hash'], 'International');
1365 1365
     if (!$boinc_user) {
1366
-      xml_error(-137);
1366
+        xml_error(-137);
1367 1367
     }
1368 1368
     // Cross reference Drupal account with BOINC
1369 1369
     $reference = db_query("INSERT INTO {boincuser} SET uid=%d, boinc_id=%d", $user->uid, $boinc_user->id);
1370 1370
     if (!$reference) {
1371
-      xml_error(-1, 'error connecting BOINC account to Drupal');
1371
+        xml_error(-1, 'error connecting BOINC account to Drupal');
1372 1372
     }
1373
-  }
1374
-  echo " <account_out>\n";
1375
-  echo "   <authenticator>{$boinc_user->authenticator}</authenticator>\n";
1376
-  echo "</account_out>\n";
1373
+    }
1374
+    echo " <account_out>\n";
1375
+    echo "   <authenticator>{$boinc_user->authenticator}</authenticator>\n";
1376
+    echo "</account_out>\n";
1377 1377
 }
1378 1378
 
1379 1379
 /**
1380 1380
  * Determine if the user has permission to control community access
1381 1381
  */
1382 1382
 function boincuser_moderate_community_access() {
1383
-  if (user_access('assign community member role')
1383
+    if (user_access('assign community member role')
1384 1384
   OR user_access('assign all roles')) {
1385 1385
     return TRUE;
1386
-  }
1387
-  return FALSE;
1386
+    }
1387
+    return FALSE;
1388 1388
 }
1389 1389
 
1390 1390
 /**
1391 1391
  * Get the count of items in the moderation queue
1392 1392
  */
1393 1393
 function boincuser_moderation_queue_count($caller = 'user') {
1394
-  $allowed = FALSE;
1395
-  switch ($caller) {
1396
-  case 'cron':
1394
+    $allowed = FALSE;
1395
+    switch ($caller) {
1396
+    case 'cron':
1397 1397
     $allowed = TRUE;
1398 1398
     break;
1399
-  case 'user':
1399
+    case 'user':
1400 1400
   default:
1401 1401
     $allowed = user_access('edit any profile content');
1402
-  }
1403
-  if ($allowed) {
1402
+    }
1403
+    if ($allowed) {
1404 1404
     return db_result(db_query("
1405 1405
       SELECT COUNT(*)
1406 1406
       FROM {node}
1407 1407
       WHERE type = 'profile'
1408 1408
       AND moderate = 1"
1409 1409
     ));
1410
-  }
1411
-  return NULL;
1410
+    }
1411
+    return NULL;
1412 1412
 }
1413 1413
 
1414 1414
 /**
@@ -1417,43 +1417,43 @@  discard block
 block discarded – undo
1417 1417
  * than through the user account info form.
1418 1418
  */
1419 1419
 function boincuser_control($uid = NULL, $action = NULL) {
1420
-  if (!$uid OR !$account = user_load($uid)) {
1420
+    if (!$uid OR !$account = user_load($uid)) {
1421 1421
     // What are you even doing here...
1422 1422
     return FALSE;
1423
-  }
1424
-  switch ($action) {
1425
-  case 'ban':
1423
+    }
1424
+    switch ($action) {
1425
+    case 'ban':
1426 1426
     if (boincuser_moderate_community_access()) {
1427
-      $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60);
1428
-      $boincuser_record = array(
1427
+        $penalty_period = variable_get('boinc_penalty_period', 7*24*60*60);
1428
+        $boincuser_record = array(
1429 1429
         'uid' => $uid,
1430 1430
         'penalty_expiration' => time() + $penalty_period,
1431
-      );
1432
-      drupal_write_record('boincuser', $boincuser_record, 'uid');
1433
-      $community_role = array_search('community member', user_roles(true));
1434
-      if (isset($account->roles[$community_role])) {
1431
+        );
1432
+        drupal_write_record('boincuser', $boincuser_record, 'uid');
1433
+        $community_role = array_search('community member', user_roles(true));
1434
+        if (isset($account->roles[$community_role])) {
1435 1435
         unset($account->roles[$community_role]);
1436 1436
         user_save($account, array('roles' => $account->roles));
1437
-      }
1437
+        }
1438 1438
     }
1439 1439
     break;
1440
-  case 'lift-ban':
1440
+    case 'lift-ban':
1441 1441
     if (boincuser_moderate_community_access()) {
1442
-      $boincuser_record = array(
1442
+        $boincuser_record = array(
1443 1443
         'uid' => $uid,
1444 1444
         'penalty_expiration' => 0,
1445
-      );
1446
-      drupal_write_record('boincuser', $boincuser_record, 'uid');
1447
-      $community_role = array_search('community member', user_roles(true));
1448
-      if (!isset($account->roles[$community_role])) {
1445
+        );
1446
+        drupal_write_record('boincuser', $boincuser_record, 'uid');
1447
+        $community_role = array_search('community member', user_roles(true));
1448
+        if (!isset($account->roles[$community_role])) {
1449 1449
         $account->roles[$community_role] = 'community member';
1450 1450
         user_save($account, array('roles' => $account->roles));
1451
-      }
1451
+        }
1452 1452
     }
1453 1453
     break;
1454
-  default:
1454
+    default:
1455 1455
   }
1456
-  drupal_goto("account/{$account->uid}");
1456
+    drupal_goto("account/{$account->uid}");
1457 1457
 }
1458 1458
 
1459 1459
 /**
@@ -1461,29 +1461,29 @@  discard block
 block discarded – undo
1461 1461
  * moderation flag.
1462 1462
  */
1463 1463
 function boincuser_moderate_profile_approve($account) {
1464
-  $node = new stdClass;
1465
-  $node->type = 'profile';
1466
-  $node->language = '';
1467
-  $nid = content_profile_profile_exists($node, $account->uid);
1468
-  $profile = node_load($nid);
1469
-  $profile->moderate = 0;
1470
-  $profile->status = 1;
1471
-  node_save($profile);
1472
-  drupal_set_message('This profile has been marked as approved.');
1473
-  drupal_goto();
1464
+    $node = new stdClass;
1465
+    $node->type = 'profile';
1466
+    $node->language = '';
1467
+    $nid = content_profile_profile_exists($node, $account->uid);
1468
+    $profile = node_load($nid);
1469
+    $profile->moderate = 0;
1470
+    $profile->status = 1;
1471
+    node_save($profile);
1472
+    drupal_set_message('This profile has been marked as approved.');
1473
+    drupal_goto();
1474 1474
 }
1475 1475
 
1476 1476
 /**
1477 1477
  * Mark a user profile as rejected and notify the user of the reason.
1478 1478
  */
1479 1479
 function boincuser_moderate_profile_reject($uid, $reason = '') {
1480
-  $account = user_load($uid);
1481
-  $node = new stdClass;
1482
-  $node->type = 'profile';
1483
-  $node->language = '';
1484
-  $nid = content_profile_profile_exists($node, $uid);
1485
-  $profile = node_load($nid);
1486
-  if ($profile->nid) {
1480
+    $account = user_load($uid);
1481
+    $node = new stdClass;
1482
+    $node->type = 'profile';
1483
+    $node->language = '';
1484
+    $nid = content_profile_profile_exists($node, $uid);
1485
+    $profile = node_load($nid);
1486
+    if ($profile->nid) {
1487 1487
     global $user;
1488 1488
     global $base_url;
1489 1489
     global $base_path;
@@ -1494,64 +1494,64 @@  discard block
 block discarded – undo
1494 1494
     $profile->status = 0;
1495 1495
     node_save($profile);
1496 1496
     $settings = array(
1497
-      'from' => '',
1498
-      'subject' => "Profile moderation at {$site_name}",
1499
-      'message' => ''
1500
-      . "{$account->boincuser_name},\n"
1501
-      . "\n"
1502
-      . "{$moderator->boincuser_name} has rejected your profile at"
1503
-      . " {$site_name} for the following reason: \n"
1504
-      . "\n"
1505
-      . "{$reason}\n"
1506
-      . "\n"
1507
-      . "\n"
1508
-      . "Since it has not been approved, your profile is not visible to other"
1509
-      . " {$site_name} users. Please make the needed changes here:\n"
1510
-      . "\n"
1511
-      . "{$site_url}account/profile \n"
1512
-      . "\n"
1513
-      . "Thanks, \n"
1514
-      . "\n"
1515
-      . "{$site_name} support team",
1497
+        'from' => '',
1498
+        'subject' => "Profile moderation at {$site_name}",
1499
+        'message' => ''
1500
+        . "{$account->boincuser_name},\n"
1501
+        . "\n"
1502
+        . "{$moderator->boincuser_name} has rejected your profile at"
1503
+        . " {$site_name} for the following reason: \n"
1504
+        . "\n"
1505
+        . "{$reason}\n"
1506
+        . "\n"
1507
+        . "\n"
1508
+        . "Since it has not been approved, your profile is not visible to other"
1509
+        . " {$site_name} users. Please make the needed changes here:\n"
1510
+        . "\n"
1511
+        . "{$site_url}account/profile \n"
1512
+        . "\n"
1513
+        . "Thanks, \n"
1514
+        . "\n"
1515
+        . "{$site_name} support team",
1516 1516
     );
1517 1517
     rules_action_mail_to_user($account, $settings);
1518 1518
     drupal_set_message('This profile has been marked as rejected.');
1519
-  }
1520
-  drupal_goto();
1519
+    }
1520
+    drupal_goto();
1521 1521
 }
1522 1522
 
1523 1523
 /**
1524 1524
  * Ban a user and send a notification of the reason.
1525 1525
  */
1526 1526
 function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') {
1527
-  if (user_access('assign community member role')
1527
+    if (user_access('assign community member role')
1528 1528
   OR user_access('assign all roles')) {
1529 1529
     $account = user_load($uid);
1530 1530
     if ($account->uid) {
1531
-      module_load_include('inc', 'rules', 'modules/system.rules');
1532
-      if ($duration === '') {
1531
+        module_load_include('inc', 'rules', 'modules/system.rules');
1532
+        if ($duration === '') {
1533 1533
         $duration = variable_get('boinc_penalty_period', 7*24*60*60);
1534
-      }
1535
-      $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295;
1536
-      $boincuser_record = array(
1534
+        }
1535
+        $penalty_expiration = ($duration > 0) ? time() + $duration : 4294967295;
1536
+        $boincuser_record = array(
1537 1537
         'uid' => $uid,
1538 1538
         'penalty_expiration' => $penalty_expiration,
1539
-      );
1540
-      drupal_write_record('boincuser', $boincuser_record, 'uid');
1539
+        );
1540
+        drupal_write_record('boincuser', $boincuser_record, 'uid');
1541 1541
       
1542
-      $community_role = array_search('community member', user_roles(true));
1543
-      if (isset($account->roles[$community_role])) {
1542
+        $community_role = array_search('community member', user_roles(true));
1543
+        if (isset($account->roles[$community_role])) {
1544 1544
         unset($account->roles[$community_role]);
1545 1545
         user_save($account, array('roles' => $account->roles));
1546
-      }
1546
+        }
1547 1547
       
1548
-      global $user;
1549
-      global $base_url;
1550
-      global $base_path;
1551
-      $site_name = variable_get('site_name', bts('project'));
1552
-      $site_url = $base_url . $base_path;
1553
-      $moderator = user_load($user->uid);
1554
-      $settings = array(
1548
+        global $user;
1549
+        global $base_url;
1550
+        global $base_path;
1551
+        $site_name = variable_get('site_name', bts('project'));
1552
+        $site_url = $base_url . $base_path;
1553
+        $moderator = user_load($user->uid);
1554
+        $settings = array(
1555 1555
         'from' => '',
1556 1556
         'subject' => "User moderation at {$site_name}",
1557 1557
         'message' => ''
@@ -1572,12 +1572,12 @@  discard block
 block discarded – undo
1572 1572
         . "Thanks, \n"
1573 1573
         . "\n"
1574 1574
         . "{$site_name} support team",
1575
-      );
1576
-      rules_action_mail_to_user($account, $settings);
1577
-      drupal_set_message('This user has been banned.');
1575
+        );
1576
+        rules_action_mail_to_user($account, $settings);
1577
+        drupal_set_message('This user has been banned.');
1578 1578
     }
1579
-  }
1580
-  drupal_goto();
1579
+    }
1580
+    drupal_goto();
1581 1581
 }
1582 1582
 
1583 1583
 
@@ -1589,15 +1589,15 @@  discard block
 block discarded – undo
1589 1589
  *
1590 1590
  */
1591 1591
 function boincuser_get_weak_auth($boinc_id = null) {
1592
-  if (!$boinc_id) {
1592
+    if (!$boinc_id) {
1593 1593
     global $user;
1594 1594
     $account = user_load($user->uid);
1595 1595
     $boinc_id = $account->boincuser_id;
1596
-  }
1596
+    }
1597 1597
   
1598
-  $boinc_user = boincuser_load($account->boincuser_id);
1598
+    $boinc_user = boincuser_load($account->boincuser_id);
1599 1599
   
1600
-  return weak_auth($boinc_user);
1600
+    return weak_auth($boinc_user);
1601 1601
 }
1602 1602
 
1603 1603
 /**
@@ -1606,74 +1606,74 @@  discard block
 block discarded – undo
1606 1606
  * Drupal User so must be inserted into comments, etc. (not so by default)
1607 1607
  */
1608 1608
 function boincuser_get_user_profile_image($uid, $avatar = TRUE) {
1609
-  // Though the function name implies otherwise, get the avatar by default
1610
-  $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';
1611
-  $image_fid = db_result(db_query("
1609
+    // Though the function name implies otherwise, get the avatar by default
1610
+    $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';
1611
+    $image_fid = db_result(db_query("
1612 1612
     SELECT ctp.%s
1613 1613
     FROM {content_type_profile} ctp
1614 1614
     INNER JOIN {node} n ON ctp.nid = n.nid
1615 1615
     WHERE n.uid = %d AND n.type = '%s'",
1616 1616
     $image_field, $uid, 'profile'));
1617
-  $user_image['image'] = field_file_load($image_fid);
1618
-  if (!$user_image['image']['filepath']) {
1617
+    $user_image['image'] = field_file_load($image_fid);
1618
+    if (!$user_image['image']['filepath']) {
1619 1619
     // Load the default image if one does not exist
1620 1620
     $account = user_load($uid);
1621 1621
     if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) {
1622
-      // Use a Gravatar rather than the system default image
1623
-      $options = array(
1622
+        // Use a Gravatar rather than the system default image
1623
+        $options = array(
1624 1624
         'size' => 100,
1625 1625
         'rating' => 'G',
1626
-      );
1627
-      // Get the Gravatar URL and see if the image exists
1628
-      $url = gravatar_get_gravatar($account->mail, $options);
1629
-      $headers = @get_headers($url);
1630
-      if (preg_match("|200|", $headers[0])) {
1626
+        );
1627
+        // Get the Gravatar URL and see if the image exists
1628
+        $url = gravatar_get_gravatar($account->mail, $options);
1629
+        $headers = @get_headers($url);
1630
+        if (preg_match("|200|", $headers[0])) {
1631 1631
         return $url;
1632
-      }
1632
+        }
1633 1633
     }
1634 1634
     // Get default image if nothing else works
1635 1635
     $content_node_widget_settings = db_result(db_query("SELECT widget_settings FROM {content_node_field_instance} WHERE field_name = '%s'", ($avatar ? 'field_image' : 'field_profile_image')));
1636 1636
     $content_node_widget_settings = unserialize($content_node_widget_settings);
1637 1637
     $user_image['image'] = $content_node_widget_settings['default_image'];
1638
-  }
1639
-  $user = user_load($uid);
1640
-  $user_image['alt'] = $user->name;
1641
-  return $user_image;
1638
+    }
1639
+    $user = user_load($uid);
1640
+    $user_image['alt'] = $user->name;
1641
+    return $user_image;
1642 1642
 }
1643 1643
 
1644 1644
 /**
1645 1645
  * Generate a table of a user's projects
1646 1646
  */
1647 1647
 function boincuser_get_projects_table($account = null) {
1648
-  if ($account AND is_numeric($account)) {
1648
+    if ($account AND is_numeric($account)) {
1649 1649
     $account = user_load($account);
1650
-  }
1651
-  $projects = boincuser_get_projects($account);
1652
-  if (!$projects) return bts('no projects...');
1650
+    }
1651
+    $projects = boincuser_get_projects($account);
1652
+    if (!$projects) return bts('no projects...');
1653 1653
   
1654
-  $output = '';
1655
-  $output .= '<table class="user-projects">' . "\n";
1656
-  $output .= '<thead>' . "\n";
1657
-  $output .= '  <tr>' . "\n";
1658
-  $output .= '    <th>' . bts('Name') . '</th>' . "\n";
1659
-  $output .= '    <th class="numeric">' . bts('Avg credit') . '</th>' . "\n";
1660
-  $output .= '    <th class="numeric">' . bts('Total credit') . '</th>' . "\n";
1661
-  $output .= '  </tr>' . "\n";
1662
-  $output .= '</thead>' . "\n";
1663
-  $output .= '<tbody>' . "\n";
1664
-  foreach ($projects AS $project) {
1654
+    $output = '';
1655
+    $output .= '<table class="user-projects">' . "\n";
1656
+    $output .= '<thead>' . "\n";
1657
+    $output .= '  <tr>' . "\n";
1658
+    $output .= '    <th>' . bts('Name') . '</th>' . "\n";
1659
+    $output .= '    <th class="numeric">' . bts('Avg credit') . '</th>' . "\n";
1660
+    $output .= '    <th class="numeric">' . bts('Total credit') . '</th>' . "\n";
1661
+    $output .= '  </tr>' . "\n";
1662
+    $output .= '</thead>' . "\n";
1663
+    $output .= '<tbody>' . "\n";
1664
+    foreach ($projects AS $project) {
1665 1665
     $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;
1666 1666
     $output .= '  <tr>' . "\n";
1667 1667
     $output .= '    <td>' . l($project->name, $url) . '</td>' . "\n";
1668 1668
     $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; 
1669 1669
     $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n";
1670 1670
     $output .= '  </tr>' . "\n";
1671
-  }
1672
-  $output .= '</tbody>' . "\n";
1673
-  $output .= '</table>' . "\n";
1674
-  $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats';
1675
-  //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n";
1676
-  return $output;
1671
+    }
1672
+    $output .= '</tbody>' . "\n";
1673
+    $output .= '</table>' . "\n";
1674
+    $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats';
1675
+    //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n";
1676
+    return $output;
1677 1677
 }
1678 1678
 
1679 1679
 /**
@@ -1681,25 +1681,25 @@  discard block
 block discarded – undo
1681 1681
  */
1682 1682
 function boincuser_get_stats_user_data($cpid = null) {
1683 1683
   
1684
-  // [TODO] Set this stuff in site config!
1685
-  $stats_server = 'stats.gridrepublic.org';
1686
-  $stats_rpc = 'rpc/get_user.php';
1684
+    // [TODO] Set this stuff in site config!
1685
+    $stats_server = 'stats.gridrepublic.org';
1686
+    $stats_rpc = 'rpc/get_user.php';
1687 1687
   
1688
-  // Construct query string
1689
-  $get = array(
1688
+    // Construct query string
1689
+    $get = array(
1690 1690
     'cpid' => $cpid
1691
-  );
1692
-  $args = array();
1693
-  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
1694
-  $query = '?' . implode('&', $args);
1691
+    );
1692
+    $args = array();
1693
+    foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
1694
+    $query = '?' . implode('&', $args);
1695 1695
   
1696
-  // Load XML from RPC
1697
-  $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
1698
-  $result = drupal_http_request($target_url);
1699
-  if (in_array($result->code, array(200, 304))) {
1696
+    // Load XML from RPC
1697
+    $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
1698
+    $result = drupal_http_request($target_url);
1699
+    if (in_array($result->code, array(200, 304))) {
1700 1700
     return simplexml_load_string($result->data);
1701
-  }
1702
-  return NULL;
1701
+    }
1702
+    return NULL;
1703 1703
 }
1704 1704
 
1705 1705
 /**
@@ -1707,15 +1707,15 @@  discard block
 block discarded – undo
1707 1707
  */
1708 1708
 function boincuser_get_projects($account = null) {
1709 1709
   
1710
-  // Use the current user by default
1711
-  if (!$account) {
1710
+    // Use the current user by default
1711
+    if (!$account) {
1712 1712
     global $user;
1713 1713
     $account = user_load($user->uid);
1714
-  }
1714
+    }
1715 1715
   
1716
-  $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);
1716
+    $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);
1717 1717
   
1718
-  return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;
1718
+    return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;
1719 1719
 }
1720 1720
 
1721 1721
 
@@ -1723,11 +1723,11 @@  discard block
 block discarded – undo
1723 1723
  * Get the links to display under the user profile
1724 1724
  */
1725 1725
 function boincuser_get_profile_links($uid) {
1726
-  global $user;
1727
-  $account = user_load($uid);
1728
-  $profile = content_profile_load('profile', $account->uid);
1729
-  $output = '';
1730
-  if ($profile) {
1726
+    global $user;
1727
+    $account = user_load($uid);
1728
+    $profile = content_profile_load('profile', $account->uid);
1729
+    $output = '';
1730
+    if ($profile) {
1731 1731
     $profile_is_approved = ($profile->status AND !$profile->moderate);
1732 1732
     $user_is_moderator = user_access('edit any profile content');
1733 1733
     $is_own_profile = ($user->uid == $account->uid);
@@ -1735,15 +1735,15 @@  discard block
 block discarded – undo
1735 1735
     $links = array();
1736 1736
     
1737 1737
     if ($profile->moderate AND $user_is_moderator) {
1738
-      $links['approve_profile'] = array(
1738
+        $links['approve_profile'] = array(
1739 1739
         'title' => bts('Approve profile'),
1740 1740
         'href' => "{$profile_moderation_path}/approve",
1741 1741
         'attributes' => array(
1742
-          'title' => bts('Approve this profile content'),
1743
-          'class' => 'first primary tab',
1742
+            'title' => bts('Approve this profile content'),
1743
+            'class' => 'first primary tab',
1744 1744
         )
1745
-      );
1746
-      /*$links['edit_profile'] = array(
1745
+        );
1746
+        /*$links['edit_profile'] = array(
1747 1747
         'title' => bts('Edit profile'),
1748 1748
         'href' => "{$profile_moderation_path}/edit",
1749 1749
         'attributes' => array(
@@ -1751,27 +1751,27 @@  discard block
 block discarded – undo
1751 1751
           'class' => 'tab',
1752 1752
         )
1753 1753
       );*/
1754
-      $links['reject_profile'] = array(
1754
+        $links['reject_profile'] = array(
1755 1755
         'title' => bts('Reject profile'),
1756 1756
         'href' => "{$profile_moderation_path}/reject",
1757 1757
         'attributes' => array(
1758
-          'title' => bts('Reject this profile content'),
1759
-          'class' => 'tab',
1758
+            'title' => bts('Reject this profile content'),
1759
+            'class' => 'tab',
1760 1760
         )
1761
-      );
1761
+        );
1762 1762
     }
1763 1763
     $output .= '<ul class="tab-list">';
1764 1764
     $count = 0;
1765 1765
     foreach ($links as $key => $link) {
1766
-      $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';
1767
-      $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination()));
1768
-      $output .= '</li>';
1769
-      $count++;
1766
+        $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';
1767
+        $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination()));
1768
+        $output .= '</li>';
1769
+        $count++;
1770 1770
     }
1771 1771
     $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user', $account->uid) . '</li>';
1772 1772
     $output .= '</ul>';
1773
-  }
1774
-  return $output;
1773
+    }
1774
+    return $output;
1775 1775
 /*
1776 1776
 <ul class="tab-list">
1777 1777
   <li class="primary first tab">
@@ -1808,35 +1808,35 @@  discard block
 block discarded – undo
1808 1808
  */
1809 1809
 function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
1810 1810
 
1811
-  foreach ($documents as $document) {
1811
+    foreach ($documents as $document) {
1812 1812
     if ( $document->entity_type=='node' AND $document->bundle=='profile' ) {
1813
-      // Node information.
1814
-      $nid = $document->entity_id;
1815
-      $node = node_load($nid);
1816
-      $account = user_load($node->uid);
1813
+        // Node information.
1814
+        $nid = $document->entity_id;
1815
+        $node = node_load($nid);
1816
+        $account = user_load($node->uid);
1817 1817
 
1818
-      // Use boincuser name and not drupal user name
1819
-      $document->label = apachesolr_clean_text($account->boincuser_name);
1820
-      // Author information
1821
-      if ($node->uid == 0 || strlen($node->name) == 0) {
1818
+        // Use boincuser name and not drupal user name
1819
+        $document->label = apachesolr_clean_text($account->boincuser_name);
1820
+        // Author information
1821
+        if ($node->uid == 0 || strlen($node->name) == 0) {
1822 1822
         // @see user_validate_name(). !'0' === TRUE.
1823 1823
         $document->ss_name = '0';
1824
-      }
1825
-      else {
1824
+        }
1825
+        else {
1826 1826
         $document->ss_name = $account->boincuser_name;
1827 1827
         // We want the name to be searchable for keywords.
1828 1828
         $document->tos_name = $account->boincuser_name;
1829
-      }
1829
+        }
1830 1830
 
1831
-      // Rename "Profle" to "User"
1832
-      $document->bundle = "User";
1833
-      $document->bundle_name = "User";
1831
+        // Rename "Profle" to "User"
1832
+        $document->bundle = "User";
1833
+        $document->bundle_name = "User";
1834 1834
 
1835
-      // Replace the Solr document's created field with the date the user 
1836
-      // account was created. This replaces the node creation date typically 
1837
-      // used for indexing nodes.
1838
-      $document->ds_created = apachesolr_date_iso($account->created);
1835
+        // Replace the Solr document's created field with the date the user 
1836
+        // account was created. This replaces the node creation date typically 
1837
+        // used for indexing nodes.
1838
+        $document->ds_created = apachesolr_date_iso($account->created);
1839
+    }
1839 1840
     }
1840
-  }
1841 1841
 
1842 1842
 }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 function boincuser_user($op, &$edit, &$account, $category = NULL) {
217 217
   // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
218 218
   if ($account->uid > 1) {
219
-    switch($op) {
219
+    switch ($op) {
220 220
     case 'load':
221 221
       // User loading; insert BOINC data into the user object
222 222
       $drupal_user = db_fetch_object(db_query("
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
       ));
245 245
       $account->boincuser_name = $boinc_user->name;
246 246
       $account->boincuser_account_key = $boinc_user->authenticator;
247
-      $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash);
247
+      $account->boincuser_weak_auth = md5($boinc_user->authenticator.$boinc_user->passwd_hash);
248 248
       $account->boincuser_total_credit = round($boinc_user->total_credit);
249 249
       $account->boincuser_expavg_credit = round($boinc_user->expavg_credit);
250 250
       $account->boincuser_expavg_time = round($boinc_user->expavg_time);
251
-      $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail);
251
+      $account->boincuser_cpid = md5($boinc_user->cross_project_id.$account->mail);
252 252
       $account->boincuser_default_pref_set = $boinc_user->venue;
253 253
       $account->boincteam_id = $boinc_user->teamid;
254 254
       db_set_active('default');
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
   // In Drupal 7, these operation cases will all exist as their own hooks,
446 446
   // so let's approximate that here so that this function can simply be removed
447 447
   // upon migration to 7
448
-  switch($op) {
448
+  switch ($op) {
449 449
   case 'update':
450 450
     boincuser_node_update($node);
451 451
   }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
  * is updated (forward compatible to Drupal 7)
457 457
  */
458 458
 function boincuser_node_update($node) {
459
-  switch($node->type) {
459
+  switch ($node->type) {
460 460
   case 'profile':
461 461
     // Update the BOINC database directly
462 462
     $account = user_load($node->uid);
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
     }
577 577
     
578 578
     $form['cancel'] = array(
579
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $cancel_dest) . '</li>',
579
+      '#value' => '<li class="tab">'.l(bts('Cancel'), $cancel_dest).'</li>',
580 580
       '#weight' => 1004,
581 581
     );
582 582
     $form['form control tabs suffix'] = array(
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
610 610
     $form['buttons']['preview_changes']['#weight'] = 1004;
611 611
     $form['buttons']['cancel'] = array(
612
-      '#value' => '<li class="tab">' . l(bts('Cancel'), "node/{$form['nid']['#value']}") . '</li>',
612
+      '#value' => '<li class="tab">'.l(bts('Cancel'), "node/{$form['nid']['#value']}").'</li>',
613 613
       '#weight' => 1005,
614 614
     );
615 615
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
     $form['actions']['submit']['#suffix'] = '</li>';
642 642
     $form['actions']['submit']['#weight'] = 1002;
643 643
     $form['actions']['cancel'] = array(
644
-      '#value' => '<li class="tab">' . l(bts('Cancel'), "node/{$form['nid']['#value']}") . '</li>',
644
+      '#value' => '<li class="tab">'.l(bts('Cancel'), "node/{$form['nid']['#value']}").'</li>',
645 645
       '#weight' => 1005,
646 646
     );
647 647
     $form['actions']['form control tabs suffix'] = array(
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
     $form['privatemsg']['preview']['#suffix'] = '</li>';
669 669
     $form['privatemsg']['preview']['#weight'] = 1003;
670 670
     $form['privatemsg']['cancel'] = array(
671
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
671
+      '#value' => '<li class="tab">'.l(bts('Cancel'), $_GET['q']).'</li>',
672 672
       '#weight' => 1004,
673 673
     );
674 674
     $form['privatemsg']['form control tabs suffix'] = array(
@@ -776,36 +776,36 @@  discard block
 block discarded – undo
776 776
     $form['account']['boincuser_id'] = array(
777 777
       '#value' => '
778 778
         <div class="form-item">
779
-          <label>' . bts('BOINC user ID') . '</label>
780
-          <span>' . $account->boincuser_id . '</span>
779
+          <label>' . bts('BOINC user ID').'</label>
780
+          <span>' . $account->boincuser_id.'</span>
781 781
         </div>',
782 782
     );
783 783
     $form['account']['user_id'] = array(
784 784
       '#value' => '
785 785
         <div class="form-item">
786
-          <label>' . bts('Drupal user ID') . '</label>
787
-          <span>' . $account->uid . '</span>
786
+          <label>' . bts('Drupal user ID').'</label>
787
+          <span>' . $account->uid.'</span>
788 788
         </div>',
789 789
     );
790 790
     $form['account']['account_key'] = array(
791 791
       '#value' => '
792 792
         <div class="form-item">
793
-          <label>' . bts('Account key') . '</label>
794
-          <span>' . $account->boincuser_account_key . '</span>
793
+          <label>' . bts('Account key').'</label>
794
+          <span>' . $account->boincuser_account_key.'</span>
795 795
         </div>',
796 796
     );
797 797
     $form['account']['weak_account_key'] = array(
798 798
       '#value' => '
799 799
         <div class="form-item">
800
-          <label>' . bts('Weak account key') . '</label>
801
-          <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span>
800
+          <label>' . bts('Weak account key').'</label>
801
+          <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}".'</span>
802 802
         </div>',
803 803
     );
804 804
     $form['account']['cpid'] = array(
805 805
       '#value' => '
806 806
         <div class="form-item">
807
-          <label>' . bts('Cross-project ID') . '</label>
808
-          <span>' . $account->boincuser_cpid . '</span>
807
+          <label>' . bts('Cross-project ID').'</label>
808
+          <span>' . $account->boincuser_cpid.'</span>
809 809
         </div>',
810 810
     );
811 811
     
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
       $form['delete']['#weight'] = 1003;
829 829
     }
830 830
     $form['cancel'] = array(
831
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
831
+      '#value' => '<li class="tab">'.l(bts('Cancel'), $_GET['q']).'</li>',
832 832
       '#weight' => 1004,
833 833
     );
834 834
     $form['form control tabs suffix'] = array(
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
     $form['buttons']['preview_changes']['#suffix'] = '</li>';
912 912
     $form['buttons']['preview_changes']['#weight'] = 1004;
913 913
     $form['buttons']['cancel'] = array(
914
-      '#value' => '<li class="tab">' . l(bts('Cancel'), $_GET['q']) . '</li>',
914
+      '#value' => '<li class="tab">'.l(bts('Cancel'), $_GET['q']).'</li>',
915 915
       '#weight' => 1005,
916 916
     );
917 917
     $form['buttons']['delete']['#prefix'] = '<li class="tab">';
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
     // Set name temporarily to dummy value to beat validation
967 967
     $form['name'] = array(
968 968
       '#type' => 'hidden',
969
-      '#value' => rand() . '.' . time()
969
+      '#value' => rand().'.'.time()
970 970
     );
971 971
     
972 972
     if (module_exists('captcha')) {
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
     $form['buttons']['submit']['#suffix'] = '</li>';
1017 1017
     $form['buttons']['submit']['#weight'] = 1002;
1018 1018
     $form['buttons']['cancel'] = array(
1019
-      '#value' => '<li class="tab">' . l(bts('Cancel'), 'user/login') . '</li>',
1019
+      '#value' => '<li class="tab">'.l(bts('Cancel'), 'user/login').'</li>',
1020 1020
       '#weight' => 1005,
1021 1021
     );
1022 1022
     $form['buttons']['form control tabs suffix'] = array(
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function boincuser_token_list($type = 'all') {
1100 1100
   if ($type == 'user' || $type == 'all') {
1101
-    $tokens['user']['display-name']      = t("The user's name that should be displayed");
1101
+    $tokens['user']['display-name'] = t("The user's name that should be displayed");
1102 1102
     return $tokens;
1103 1103
   }
1104 1104
 }
@@ -1108,9 +1108,9 @@  discard block
 block discarded – undo
1108 1108
  */
1109 1109
 function boincuser_views_pre_execute(&$view) {
1110 1110
   $account_id = $view->args[0];
1111
-  if ($view->name=="user_activity") {
1111
+  if ($view->name == "user_activity") {
1112 1112
     // Run the following custom query for the user_activity view
1113
-    $view->build_info['query']= "
1113
+    $view->build_info['query'] = "
1114 1114
       SELECT node_revisions.vid AS vid,
1115 1115
         node.nid AS node_nid,
1116 1116
         node.uid AS users_node_uid,
@@ -1205,27 +1205,27 @@  discard block
 block discarded – undo
1205 1205
   $output = '<div class="join">';
1206 1206
   switch ($type) {
1207 1207
   case 'boinc':
1208
-    $output .= '<p>' . bts("If you're already running BOINC, select <i>Add
1209
-      Project</i>.") . '</p>';
1208
+    $output .= '<p>'.bts("If you're already running BOINC, select <i>Add
1209
+      Project</i>.").'</p>';
1210 1210
     if ($registration_enabled) {
1211
-      $output .= '<p>' . bts("If you're running a command-line or pre-5.0 version
1211
+      $output .= '<p>'.bts("If you're running a command-line or pre-5.0 version
1212 1212
         of BOINC, !create_an_account first.", array('!create_an_account' => 
1213
-          l(bts('create an account'), 'user/registration'))) . '</p>';
1213
+          l(bts('create an account'), 'user/registration'))).'</p>';
1214 1214
     }
1215 1215
     else {
1216
-      $output .= '<p>' . bts("If you're running a command-line version of BOINC,
1216
+      $output .= '<p>'.bts("If you're running a command-line version of BOINC,
1217 1217
         first use the BOINC Manager software (elsewhere if necessary) to create an
1218 1218
         an account at this project, then use that account to connect with the
1219
-        command-line version.") . '</p>';
1220
-      $output .= '<p>' . bts("If you're running a pre-5.0 version of BOINC, please
1219
+        command-line version.").'</p>';
1220
+      $output .= '<p>'.bts("If you're running a pre-5.0 version of BOINC, please
1221 1221
         upgrade to a more recent version to create an account
1222
-        at this project.") . '</p>';
1222
+        at this project.").'</p>';
1223 1223
     }
1224 1224
     break;
1225 1225
   case 'new':
1226 1226
   default:
1227 1227
     $output .= '<ol>';
1228
-    $output .= '  <li>' . bts('Download the desktop software');
1228
+    $output .= '  <li>'.bts('Download the desktop software');
1229 1229
     $output .= '    <p>';
1230 1230
     $output .= '      <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>';
1231 1231
     $output .= '    </p>';
@@ -1235,10 +1235,10 @@  discard block
 block discarded – undo
1235 1235
     //$output .= '      <a href="files/boinc_i686-pc-linux-gnu.sh" class="platform linux">Linux</a>';
1236 1236
     //$output .= '    </p>';
1237 1237
     $output .= '  </li>';
1238
-    $output .= '  <li>' . bts('Run the installer') . '</li>';
1239
-    $output .= '  <li>' . bts('When prompted enter @siteurl', array(
1240
-      '@siteurl' => $base_url)) . '</li>';
1241
-    $output .=  '</ol>';
1238
+    $output .= '  <li>'.bts('Run the installer').'</li>';
1239
+    $output .= '  <li>'.bts('When prompted enter @siteurl', array(
1240
+      '@siteurl' => $base_url)).'</li>';
1241
+    $output .= '</ol>';
1242 1242
   }
1243 1243
   $output .= '</div>';
1244 1244
   return $output;
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
   global $user;
1252 1252
   $site_name = variable_get('site_name', '');
1253 1253
   // get the front page message from database; this is set in the admin interface under BOINC Other
1254
-  $site_message = variable_get('boinc_other_frontpage','');
1254
+  $site_message = variable_get('boinc_other_frontpage', '');
1255 1255
 
1256 1256
   // Determine the user of the day
1257 1257
   $current_uotd = db_fetch_object(db_query("
@@ -1273,30 +1273,30 @@  discard block
 block discarded – undo
1273 1273
   $output .= ($user->uid) ? bts('Welcome back!') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!'));
1274 1274
   $output .= '</h2>';
1275 1275
   $output .= '<div class="boinc-overview balance-height-front">';
1276
-  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>';
1276
+  $output .= '  <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more'), 'about').'</div>';
1277 1277
   if ($user->uid) {
1278
-    $output .= '  <div>' . l(bts('View account'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>';
1278
+    $output .= '  <div>'.l(bts('View account'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>';
1279 1279
   }
1280 1280
   else {
1281
-    $output .= '  <div>' . l(bts('Join now'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>';
1281
+    $output .= '  <div>'.l(bts('Join now'), 'join', array('attributes' => array('class' => 'join button'))).'</div>';
1282 1282
   }
1283 1283
   $output .= '</div>';
1284 1284
   $output .= '<div class="boinc-overview-details">';
1285 1285
   $output .= '  <div class="detail-container">';
1286
-  $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1286
+  $output .= '    <a class="user-of-the-day" href="account/'.$uotd->uid.'">';
1287 1287
   $output .= '      <div class="picture">';
1288 1288
   $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1289 1289
     $uotd_image['alt'], array(), FALSE);
1290 1290
   $output .= '      </div>';
1291
-  $output .= '      <div class="text">' . bts('User of the day') . '</div>';
1292
-  $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
1291
+  $output .= '      <div class="text">'.bts('User of the day').'</div>';
1292
+  $output .= '      <div class="detail">'.$uotd->boincuser_name.'</div>';
1293 1293
   $output .= '    </a>';
1294 1294
   $output .= '    <div class="volunteers">';
1295
-  $output .= '      <div class="text">' . bts('Over 500,000 volunteers and counting.') . '</div>';
1295
+  $output .= '      <div class="text">'.bts('Over 500,000 volunteers and counting.').'</div>';
1296 1296
   $output .= '      <div class="platforms">';
1297
-  $output .= '        <div class="detail platform windows">' . bts('Windows') . '</div>';
1298
-  $output .= '        <div class="detail platform mac">' .  bts('Mac') . '</div>';
1299
-  $output .= '        <div class="detail platform linux">' . bts('Linux') . '</div>';
1297
+  $output .= '        <div class="detail platform windows">'.bts('Windows').'</div>';
1298
+  $output .= '        <div class="detail platform mac">'.bts('Mac').'</div>';
1299
+  $output .= '        <div class="detail platform linux">'.bts('Linux').'</div>';
1300 1300
   $output .= '      </div>';
1301 1301
   $output .= '    </div>';
1302 1302
   $output .= '  </div>';
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
     global $base_url;
1489 1489
     global $base_path;
1490 1490
     $site_name = variable_get('site_name', bts('project'));
1491
-    $site_url = $base_url . $base_path;
1491
+    $site_url = $base_url.$base_path;
1492 1492
     $moderator = user_load($user->uid);
1493 1493
     $profile->moderate = 0;
1494 1494
     $profile->status = 0;
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
       global $base_url;
1550 1550
       global $base_path;
1551 1551
       $site_name = variable_get('site_name', bts('project'));
1552
-      $site_url = $base_url . $base_path;
1552
+      $site_url = $base_url.$base_path;
1553 1553
       $moderator = user_load($user->uid);
1554 1554
       $settings = array(
1555 1555
         'from' => '',
@@ -1652,25 +1652,25 @@  discard block
 block discarded – undo
1652 1652
   if (!$projects) return bts('no projects...');
1653 1653
   
1654 1654
   $output = '';
1655
-  $output .= '<table class="user-projects">' . "\n";
1656
-  $output .= '<thead>' . "\n";
1657
-  $output .= '  <tr>' . "\n";
1658
-  $output .= '    <th>' . bts('Name') . '</th>' . "\n";
1659
-  $output .= '    <th class="numeric">' . bts('Avg credit') . '</th>' . "\n";
1660
-  $output .= '    <th class="numeric">' . bts('Total credit') . '</th>' . "\n";
1661
-  $output .= '  </tr>' . "\n";
1662
-  $output .= '</thead>' . "\n";
1663
-  $output .= '<tbody>' . "\n";
1655
+  $output .= '<table class="user-projects">'."\n";
1656
+  $output .= '<thead>'."\n";
1657
+  $output .= '  <tr>'."\n";
1658
+  $output .= '    <th>'.bts('Name').'</th>'."\n";
1659
+  $output .= '    <th class="numeric">'.bts('Avg credit').'</th>'."\n";
1660
+  $output .= '    <th class="numeric">'.bts('Total credit').'</th>'."\n";
1661
+  $output .= '  </tr>'."\n";
1662
+  $output .= '</thead>'."\n";
1663
+  $output .= '<tbody>'."\n";
1664 1664
   foreach ($projects AS $project) {
1665
-    $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;
1666
-    $output .= '  <tr>' . "\n";
1667
-    $output .= '    <td>' . l($project->name, $url) . '</td>' . "\n";
1668
-    $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; 
1669
-    $output .= '    <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n";
1670
-    $output .= '  </tr>' . "\n";
1665
+    $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id;
1666
+    $output .= '  <tr>'."\n";
1667
+    $output .= '    <td>'.l($project->name, $url).'</td>'."\n";
1668
+    $output .= '    <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n"; 
1669
+    $output .= '    <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n";
1670
+    $output .= '  </tr>'."\n";
1671 1671
   }
1672
-  $output .= '</tbody>' . "\n";
1673
-  $output .= '</table>' . "\n";
1672
+  $output .= '</tbody>'."\n";
1673
+  $output .= '</table>'."\n";
1674 1674
   $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats';
1675 1675
   //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n";
1676 1676
   return $output;
@@ -1690,8 +1690,8 @@  discard block
 block discarded – undo
1690 1690
     'cpid' => $cpid
1691 1691
   );
1692 1692
   $args = array();
1693
-  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
1694
-  $query = '?' . implode('&', $args);
1693
+  foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value);
1694
+  $query = '?'.implode('&', $args);
1695 1695
   
1696 1696
   // Load XML from RPC
1697 1697
   $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
@@ -1763,12 +1763,12 @@  discard block
 block discarded – undo
1763 1763
     $output .= '<ul class="tab-list">';
1764 1764
     $count = 0;
1765 1765
     foreach ($links as $key => $link) {
1766
-      $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">';
1766
+      $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">';
1767 1767
       $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination()));
1768 1768
       $output .= '</li>';
1769 1769
       $count++;
1770 1770
     }
1771
-    $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user', $account->uid) . '</li>';
1771
+    $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user', $account->uid).'</li>';
1772 1772
     $output .= '</ul>';
1773 1773
   }
1774 1774
   return $output;
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
1810 1810
 
1811 1811
   foreach ($documents as $document) {
1812
-    if ( $document->entity_type=='node' AND $document->bundle=='profile' ) {
1812
+    if ($document->entity_type == 'node' AND $document->bundle == 'profile') {
1813 1813
       // Node information.
1814 1814
       $nid = $document->entity_id;
1815 1815
       $node = node_load($nid);
Please login to merge, or discard this patch.
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -303,8 +303,7 @@  discard block
 block discarded – undo
303 303
           if (!boincuser_register_validate($edit)) {
304 304
             // BOINC user validation failed for registration; set an error accordingly
305 305
             form_set_error('mail', bts('An account already exists for @email. Log in or request password assistance to access your @project account.', array('@email' => $edit['mail'], '@project' => PROJECT)));
306
-          }
307
-          else {
306
+          } else {
308 307
             // Save profile information for use during Insert
309 308
             $_SESSION['profileInfo'] = array(
310 309
               'country' => $edit['field_country'][0]['value'],
@@ -557,8 +556,7 @@  discard block
 block discarded – undo
557 556
       case FLAG_FRIEND_APPROVAL:
558 557
         if ($action == 'flag') {
559 558
           $form['flag_friend_submit']['#value'] = bts('Approve request');
560
-        }
561
-        elseif ($action == 'unflag') {
559
+        } elseif ($action == 'unflag') {
562 560
           unset($form['actions']);
563 561
           $form['flag_friend_submit']['#value'] = bts('Deny request');
564 562
         }
@@ -1211,8 +1209,7 @@  discard block
 block discarded – undo
1211 1209
       $output .= '<p>' . bts("If you're running a command-line or pre-5.0 version
1212 1210
         of BOINC, !create_an_account first.", array('!create_an_account' => 
1213 1211
           l(bts('create an account'), 'user/registration'))) . '</p>';
1214
-    }
1215
-    else {
1212
+    } else {
1216 1213
       $output .= '<p>' . bts("If you're running a command-line version of BOINC,
1217 1214
         first use the BOINC Manager software (elsewhere if necessary) to create an
1218 1215
         an account at this project, then use that account to connect with the
@@ -1264,8 +1261,7 @@  discard block
 block discarded – undo
1264 1261
   ));
1265 1262
   if ($current_uotd->uotd_time < strtotime('today midnight')) {
1266 1263
     $uotd = boincuser_select_user_of_the_day();
1267
-  }
1268
-  else {
1264
+  } else {
1269 1265
     $uotd = user_load($current_uotd->uid);
1270 1266
   }
1271 1267
   $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);
@@ -1276,8 +1272,7 @@  discard block
 block discarded – undo
1276 1272
   $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>';
1277 1273
   if ($user->uid) {
1278 1274
     $output .= '  <div>' . l(bts('View account'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>';
1279
-  }
1280
-  else {
1275
+  } else {
1281 1276
     $output .= '  <div>' . l(bts('Join now'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>';
1282 1277
   }
1283 1278
   $output .= '</div>';
@@ -1690,7 +1685,9 @@  discard block
 block discarded – undo
1690 1685
     'cpid' => $cpid
1691 1686
   );
1692 1687
   $args = array();
1693
-  foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value);
1688
+  foreach ($get as $arg => $value) {
1689
+      $args[] = "{$arg}=" . rawurlencode($value);
1690
+  }
1694 1691
   $query = '?' . implode('&', $args);
1695 1692
   
1696 1693
   // Load XML from RPC
@@ -1821,8 +1818,7 @@  discard block
 block discarded – undo
1821 1818
       if ($node->uid == 0 || strlen($node->name) == 0) {
1822 1819
         // @see user_validate_name(). !'0' === TRUE.
1823 1820
         $document->ss_name = '0';
1824
-      }
1825
-      else {
1821
+      } else {
1826 1822
         $document->ss_name = $account->boincuser_name;
1827 1823
         // We want the name to be searchable for keywords.
1828 1824
         $document->tos_name = $account->boincuser_name;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     'title' => 'Create Account RPC',
178 178
     'description' => 'RPC for creating user accounts.',
179 179
     'page callback' => 'boincuser_create_account',
180
-    'access callback' => TRUE,
180
+    'access callback' => true,
181 181
     'type' => MENU_CALLBACK
182 182
   );
183 183
   return $items;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
  * Implementation of hook_user(); add custom actions to standard
214 214
  * Drupal user operations
215 215
  */
216
-function boincuser_user($op, &$edit, &$account, $category = NULL) {
216
+function boincuser_user($op, &$edit, &$account, $category = null) {
217 217
   // Handle BOINC integration for users with UID > 1 (skip anonymous and admin)
218 218
   if ($account->uid > 1) {
219 219
     switch($op) {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
       $account->boincteam_id = $boinc_user->teamid;
254 254
       db_set_active('default');
255 255
       // Set Drupal team ID
256
-      $account->team = NULL;
256
+      $account->team = null;
257 257
       if ($account->boincteam_id) {
258 258
         $account->team = db_result(db_query("
259 259
           SELECT nid FROM {boincteam} WHERE team_id = %d",
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
         case 'user_account':
402 402
           // Ensure that BOINC data is altered
403 403
           $boinc_user = BoincUser::lookup_id($account->boincuser_id);
404
-          $changing_email = ($edit['mail'] AND $edit['mail'] != $boinc_user->email_addr) ? true : false;
404
+          $changing_email = ($edit['mail'] and $edit['mail'] != $boinc_user->email_addr) ? true : false;
405 405
           $changing_pass = ($edit['pass']) ? true : false;
406
-          if ($changing_email OR $changing_pass) {
406
+          if ($changing_email or $changing_pass) {
407 407
             // Set password hash appropriately
408 408
             $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass'];
409 409
             $passwd_hash = md5($passwd.$edit['mail']);
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
         '#title' => bts('Email address'),
693 693
         '#size' => ($form_id == 'user_login_block') ? 15 : 60,
694 694
         '#maxlength' => EMAIL_MAX_LENGTH,
695
-        '#required' => TRUE,
695
+        '#required' => true,
696 696
         '#attributes' => array('tabindex' => '1'),
697 697
         '#description' => bts('Enter your @s email address.', array('@s' => variable_get('site_name', 'BOINC')))
698 698
       ),
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     if (isset($form_state['post']['email']) and isset($form_state['post']['pass'])) {
727 727
       // Find the local validation function's entry so we can replace it.
728 728
       $array_key = array_search('user_login_authenticate_validate', $form['#validate']);
729
-      if ($array_key === FALSE) {
729
+      if ($array_key === false) {
730 730
         // Could not find it. Some other module must have run form_alter().
731 731
         // We will simply add our validation just before the final validator.
732 732
         $final_validator = array_pop($form['#validate']);
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     
749 749
     // A bit hackish... but don't require the user to enter his password if
750 750
     // coming from the password reset function
751
-    $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === FALSE) ? 0 : 1;
751
+    $reset_pass = (strpos($_SERVER['HTTP_REFERER'], "/user/reset/{$form['#uid']}") === false) ? 0 : 1;
752 752
     if ($reset_pass) {
753 753
       $_SESSION['reset_pass'] = 1;
754 754
     }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
     $form['account']['mail']['#size'] = 40;
759 759
     $form['account']['pass']['#size'] = 17;
760 760
     
761
-    if (!$reset_pass AND ($user->uid == $account->uid OR !user_access('administer users'))) {
761
+    if (!$reset_pass and ($user->uid == $account->uid or !user_access('administer users'))) {
762 762
       // Add a password authenticator, required to change email or pw
763 763
       $form['account']['current_pass'] = array(
764 764
         '#type' => 'password',
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
     $form['submit']['#value'] = bts('Save changes');
823 823
     $form['submit']['#suffix'] = '</li>';
824 824
     $form['submit']['#weight'] = 1002;
825
-    if (isset($form['delete']) AND is_array($form['delete'])) {
825
+    if (isset($form['delete']) and is_array($form['delete'])) {
826 826
       $form['delete']['#prefix'] = '<li class="tab">';
827 827
       $form['delete']['#suffix'] = '</li>';
828 828
       $form['delete']['#weight'] = 1003;
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
         '#default_value' => $edit['boincuser_name'], 
957 957
         '#maxlength' => USERNAME_MAX_LENGTH, 
958 958
         '#description' => bts('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), 
959
-        '#required' => TRUE
959
+        '#required' => true
960 960
       ),
961 961
       'validation_source' => array(
962 962
         '#type' => 'hidden',
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
         '#title' => bts('Email address'),
993 993
         '#size' => 60,
994 994
         '#maxlength' => EMAIL_MAX_LENGTH,
995
-        '#required' => TRUE,
995
+        '#required' => true,
996 996
         '#description' => bts(
997 997
           'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).',
998 998
           array(
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 /**
1086 1086
  * Implementation of hook_token_values
1087 1087
  */
1088
-function boincuser_token_values($type, $object = NULL, $options = array()) {
1088
+function boincuser_token_values($type, $object = null, $options = array()) {
1089 1089
   if ($type == 'user') {
1090 1090
     $account = user_load($object->uid);
1091 1091
     $tokens['display-name'] = $account->boincuser_name;
@@ -1268,12 +1268,12 @@  discard block
 block discarded – undo
1268 1268
   else {
1269 1269
     $uotd = user_load($current_uotd->uid);
1270 1270
   }
1271
-  $uotd_image = boincuser_get_user_profile_image($uotd->uid, FALSE);
1271
+  $uotd_image = boincuser_get_user_profile_image($uotd->uid, false);
1272 1272
   $output = '<h2 class="pane-title">';
1273 1273
   $output .= ($user->uid) ? bts('Welcome back!') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!'));
1274 1274
   $output .= '</h2>';
1275 1275
   $output .= '<div class="boinc-overview balance-height-front">';
1276
-  $output .= '  <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>';
1276
+  $output .= '  <div>' . bts($site_message, array(), null, "project:front page") . ' ' . l(bts('Learn more'), 'about') . '</div>';
1277 1277
   if ($user->uid) {
1278 1278
     $output .= '  <div>' . l(bts('View account'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>';
1279 1279
   }
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
   $output .= '    <a class="user-of-the-day" href="account/' . $uotd->uid . '">';
1287 1287
   $output .= '      <div class="picture">';
1288 1288
   $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'],
1289
-    $uotd_image['alt'], array(), FALSE);
1289
+    $uotd_image['alt'], array(), false);
1290 1290
   $output .= '      </div>';
1291 1291
   $output .= '      <div class="text">' . bts('User of the day') . '</div>';
1292 1292
   $output .= '      <div class="detail">' . $uotd->boincuser_name . '</div>';
@@ -1381,20 +1381,20 @@  discard block
 block discarded – undo
1381 1381
  */
1382 1382
 function boincuser_moderate_community_access() {
1383 1383
   if (user_access('assign community member role')
1384
-  OR user_access('assign all roles')) {
1385
-    return TRUE;
1384
+  or user_access('assign all roles')) {
1385
+    return true;
1386 1386
   }
1387
-  return FALSE;
1387
+  return false;
1388 1388
 }
1389 1389
 
1390 1390
 /**
1391 1391
  * Get the count of items in the moderation queue
1392 1392
  */
1393 1393
 function boincuser_moderation_queue_count($caller = 'user') {
1394
-  $allowed = FALSE;
1394
+  $allowed = false;
1395 1395
   switch ($caller) {
1396 1396
   case 'cron':
1397
-    $allowed = TRUE;
1397
+    $allowed = true;
1398 1398
     break;
1399 1399
   case 'user':
1400 1400
   default:
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
       AND moderate = 1"
1409 1409
     ));
1410 1410
   }
1411
-  return NULL;
1411
+  return null;
1412 1412
 }
1413 1413
 
1414 1414
 /**
@@ -1416,10 +1416,10 @@  discard block
 block discarded – undo
1416 1416
  * Allow community membership status to be set for users by direct link rather
1417 1417
  * than through the user account info form.
1418 1418
  */
1419
-function boincuser_control($uid = NULL, $action = NULL) {
1420
-  if (!$uid OR !$account = user_load($uid)) {
1419
+function boincuser_control($uid = null, $action = null) {
1420
+  if (!$uid or !$account = user_load($uid)) {
1421 1421
     // What are you even doing here...
1422
-    return FALSE;
1422
+    return false;
1423 1423
   }
1424 1424
   switch ($action) {
1425 1425
   case 'ban':
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
  */
1526 1526
 function boincuser_moderate_user_ban($uid, $reason = '', $duration = '') {
1527 1527
   if (user_access('assign community member role')
1528
-  OR user_access('assign all roles')) {
1528
+  or user_access('assign all roles')) {
1529 1529
     $account = user_load($uid);
1530 1530
     if ($account->uid) {
1531 1531
       module_load_include('inc', 'rules', 'modules/system.rules');
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
  * User profile image is managed by the content_profile module rather than core
1606 1606
  * Drupal User so must be inserted into comments, etc. (not so by default)
1607 1607
  */
1608
-function boincuser_get_user_profile_image($uid, $avatar = TRUE) {
1608
+function boincuser_get_user_profile_image($uid, $avatar = true) {
1609 1609
   // Though the function name implies otherwise, get the avatar by default
1610 1610
   $image_field = ($avatar) ? 'field_image_fid' : 'field_profile_image_fid';
1611 1611
   $image_fid = db_result(db_query("
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
   if (!$user_image['image']['filepath']) {
1619 1619
     // Load the default image if one does not exist
1620 1620
     $account = user_load($uid);
1621
-    if ($avatar AND module_exists('gravatar') AND user_access('use gravatar', $account) AND $account->gravatar) {
1621
+    if ($avatar and module_exists('gravatar') and user_access('use gravatar', $account) and $account->gravatar) {
1622 1622
       // Use a Gravatar rather than the system default image
1623 1623
       $options = array(
1624 1624
         'size' => 100,
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
  * Generate a table of a user's projects
1646 1646
  */
1647 1647
 function boincuser_get_projects_table($account = null) {
1648
-  if ($account AND is_numeric($account)) {
1648
+  if ($account and is_numeric($account)) {
1649 1649
     $account = user_load($account);
1650 1650
   }
1651 1651
   $projects = boincuser_get_projects($account);
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
   $output .= '  </tr>' . "\n";
1662 1662
   $output .= '</thead>' . "\n";
1663 1663
   $output .= '<tbody>' . "\n";
1664
-  foreach ($projects AS $project) {
1664
+  foreach ($projects as $project) {
1665 1665
     $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id;
1666 1666
     $output .= '  <tr>' . "\n";
1667 1667
     $output .= '    <td>' . l($project->name, $url) . '</td>' . "\n";
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
   if (in_array($result->code, array(200, 304))) {
1700 1700
     return simplexml_load_string($result->data);
1701 1701
   }
1702
-  return NULL;
1702
+  return null;
1703 1703
 }
1704 1704
 
1705 1705
 /**
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
   
1716 1716
   $account_stats = boincuser_get_stats_user_data($account->boincuser_cpid);
1717 1717
   
1718
-  return ($account_stats AND isset($account_stats->project)) ? $account_stats->project : null;
1718
+  return ($account_stats and isset($account_stats->project)) ? $account_stats->project : null;
1719 1719
 }
1720 1720
 
1721 1721
 
@@ -1728,13 +1728,13 @@  discard block
 block discarded – undo
1728 1728
   $profile = content_profile_load('profile', $account->uid);
1729 1729
   $output = '';
1730 1730
   if ($profile) {
1731
-    $profile_is_approved = ($profile->status AND !$profile->moderate);
1731
+    $profile_is_approved = ($profile->status and !$profile->moderate);
1732 1732
     $user_is_moderator = user_access('edit any profile content');
1733 1733
     $is_own_profile = ($user->uid == $account->uid);
1734 1734
     $profile_moderation_path = "moderate/profile/{$account->uid}";
1735 1735
     $links = array();
1736 1736
     
1737
-    if ($profile->moderate AND $user_is_moderator) {
1737
+    if ($profile->moderate and $user_is_moderator) {
1738 1738
       $links['approve_profile'] = array(
1739 1739
         'title' => bts('Approve profile'),
1740 1740
         'href' => "{$profile_moderation_path}/approve",
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
1810 1810
 
1811 1811
   foreach ($documents as $document) {
1812
-    if ( $document->entity_type=='node' AND $document->bundle=='profile' ) {
1812
+    if ( $document->entity_type=='node' and $document->bundle=='profile' ) {
1813 1813
       // Node information.
1814 1814
       $nid = $document->entity_id;
1815 1815
       $node = node_load($nid);
Please login to merge, or discard this patch.