@@ -28,22 +28,22 @@ discard block |
||
28 | 28 | * with defined URL paths |
29 | 29 | */ |
30 | 30 | function boinccore_menu() { |
31 | - $items['node_control'] = array( |
|
31 | + $items['node_control'] = array( |
|
32 | 32 | 'page callback' => 'boinccore_node_control', |
33 | 33 | 'access arguments' => array('access content'), |
34 | 34 | 'type' => MENU_CALLBACK |
35 | - ); |
|
36 | - $items['comment_control'] = array( |
|
35 | + ); |
|
36 | + $items['comment_control'] = array( |
|
37 | 37 | 'page callback' => 'boinccore_comment_control', |
38 | 38 | 'access arguments' => array('administer comments'), |
39 | 39 | 'type' => MENU_CALLBACK |
40 | - ); |
|
41 | - $items['goto'] = array( |
|
40 | + ); |
|
41 | + $items['goto'] = array( |
|
42 | 42 | 'page callback' => 'boinccore_url_pagination_handler', |
43 | 43 | 'access arguments' => array('access content'), |
44 | 44 | 'type' => MENU_CALLBACK |
45 | - ); |
|
46 | - $items['admin/boinc/community'] = array( |
|
45 | + ); |
|
46 | + $items['admin/boinc/community'] = array( |
|
47 | 47 | 'title' => 'Community', |
48 | 48 | 'description' => 'Global settings for community interaction.', |
49 | 49 | 'page callback' => 'drupal_get_form', |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'access arguments' => array('administer site configuration'), |
52 | 52 | 'type' => MENU_NORMAL_ITEM, |
53 | 53 | 'file' => 'boinccore.admin.inc' |
54 | - ); |
|
55 | - $items['admin/boinc/standard-content-generator'] = array( |
|
54 | + ); |
|
55 | + $items['admin/boinc/standard-content-generator'] = array( |
|
56 | 56 | 'title' => 'Standard page generator', |
57 | 57 | 'description' => 'Regenerate standard site content (e.g. Help and About Us |
58 | 58 | pages).', |
@@ -61,124 +61,124 @@ discard block |
||
61 | 61 | 'access arguments' => array('administer site configuration'), |
62 | 62 | 'type' => MENU_NORMAL_ITEM, |
63 | 63 | 'file' => 'boinccore.admin.inc' |
64 | - ); |
|
64 | + ); |
|
65 | 65 | |
66 | - // BOINC RPC wrappers |
|
67 | - $items['lookup_account.php'] = array( |
|
66 | + // BOINC RPC wrappers |
|
67 | + $items['lookup_account.php'] = array( |
|
68 | 68 | 'title' => 'Look up account RPC', |
69 | 69 | 'description' => 'RPC for getting the authenticator for a user account.', |
70 | 70 | 'page callback' => 'boinccore_lookup_account', |
71 | 71 | 'access callback' => TRUE, |
72 | 72 | 'type' => MENU_CALLBACK |
73 | - ); |
|
74 | - $items['am_get_info.php'] = array( |
|
73 | + ); |
|
74 | + $items['am_get_info.php'] = array( |
|
75 | 75 | 'title' => 'Account manager get info RPC', |
76 | 76 | 'description' => 'RPC for getting assorted details of a user account.', |
77 | 77 | 'page callback' => 'boinccore_am_get_info', |
78 | 78 | 'access callback' => TRUE, |
79 | 79 | 'type' => MENU_CALLBACK |
80 | - ); |
|
81 | - $items['am_set_info.php'] = array( |
|
80 | + ); |
|
81 | + $items['am_set_info.php'] = array( |
|
82 | 82 | 'title' => 'Account manager set info RPC', |
83 | 83 | 'description' => 'RPC for updating assorted details of a user account.', |
84 | 84 | 'page callback' => 'boinccore_am_set_info', |
85 | 85 | 'access callback' => TRUE, |
86 | 86 | 'type' => MENU_CALLBACK |
87 | - ); |
|
88 | - $items['am_set_host_info.php'] = array( |
|
87 | + ); |
|
88 | + $items['am_set_host_info.php'] = array( |
|
89 | 89 | 'title' => 'Account manager set host info RPC', |
90 | 90 | 'description' => 'RPC for updating the venue for a given host.', |
91 | 91 | 'page callback' => 'boinccore_am_set_host_info', |
92 | 92 | 'access callback' => TRUE, |
93 | 93 | 'type' => MENU_CALLBACK |
94 | - ); |
|
95 | - $items['show_user.php'] = array( |
|
94 | + ); |
|
95 | + $items['show_user.php'] = array( |
|
96 | 96 | 'title' => 'Show user RPC', |
97 | 97 | 'description' => 'RPC for getting assorted details of a user account.', |
98 | 98 | 'page callback' => 'boinccore_show_user', |
99 | 99 | 'access callback' => TRUE, |
100 | 100 | 'type' => MENU_CALLBACK |
101 | - ); |
|
102 | - $items['pending.php'] = array( |
|
101 | + ); |
|
102 | + $items['pending.php'] = array( |
|
103 | 103 | 'title' => 'Pending credit RPC', |
104 | 104 | 'description' => 'RPC for getting pending credit for a given account.', |
105 | 105 | 'page callback' => 'boinccore_pending_credit', |
106 | 106 | 'access callback' => TRUE, |
107 | 107 | 'type' => MENU_CALLBACK |
108 | - ); |
|
109 | - $items['create_team.php'] = array( |
|
108 | + ); |
|
109 | + $items['create_team.php'] = array( |
|
110 | 110 | 'title' => 'Create team RPC', |
111 | 111 | 'description' => 'RPC for creating a new team.', |
112 | 112 | 'page callback' => 'boinccore_create_team', |
113 | 113 | 'access callback' => TRUE, |
114 | 114 | 'type' => MENU_CALLBACK |
115 | - ); |
|
116 | - $items['team_lookup.php'] = array( |
|
115 | + ); |
|
116 | + $items['team_lookup.php'] = array( |
|
117 | 117 | 'title' => 'Team lookup RPC', |
118 | 118 | 'description' => 'RPC for getting info on a team or matching teams.', |
119 | 119 | 'page callback' => 'boinccore_team_lookup', |
120 | 120 | 'access callback' => TRUE, |
121 | 121 | 'type' => MENU_CALLBACK |
122 | - ); |
|
123 | - $items['team_email_list.php'] = array( |
|
122 | + ); |
|
123 | + $items['team_email_list.php'] = array( |
|
124 | 124 | 'title' => 'Get team member list RPC', |
125 | 125 | 'description' => 'RPC for getting a list of members of a given team.', |
126 | 126 | 'page callback' => 'boinccore_team_email_list', |
127 | 127 | 'access callback' => TRUE, |
128 | 128 | 'type' => MENU_CALLBACK |
129 | - ); |
|
130 | - $items['edit_forum_preferences_action.php'] = array( |
|
129 | + ); |
|
130 | + $items['edit_forum_preferences_action.php'] = array( |
|
131 | 131 | 'title' => 'Forum preferences RPC', |
132 | 132 | 'description' => 'RPC for setting forum preferences for a given user.', |
133 | 133 | 'page callback' => 'boinccore_edit_forum_preferences', |
134 | 134 | 'access callback' => TRUE, |
135 | 135 | 'type' => MENU_CALLBACK |
136 | - ); |
|
137 | - $items['forum_get_data.php'] = array( |
|
136 | + ); |
|
137 | + $items['forum_get_data.php'] = array( |
|
138 | 138 | 'title' => 'Forum get data RPC', |
139 | 139 | 'description' => 'RPC for getting recent forum activity for a given user.', |
140 | 140 | 'page callback' => 'boinccore_forum_get_data', |
141 | 141 | 'access callback' => TRUE, |
142 | 142 | 'type' => MENU_CALLBACK |
143 | - ); |
|
144 | - $items['apps.php'] = array( |
|
143 | + ); |
|
144 | + $items['apps.php'] = array( |
|
145 | 145 | 'title' => 'Apps RPC', |
146 | 146 | 'description' => 'RPC for getting the applications in the system.', |
147 | 147 | 'page callback' => 'boinccore_apps', |
148 | 148 | 'access callback' => TRUE, |
149 | 149 | 'type' => MENU_CALLBACK |
150 | - ); |
|
150 | + ); |
|
151 | 151 | |
152 | - return $items; |
|
152 | + return $items; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Implementation of hook_menu_alter() |
157 | 157 | */ |
158 | 158 | function boinccore_menu_alter(&$items) { |
159 | - // If using Solr search and not core Drupal search, disable core search! |
|
160 | - if (module_exists('global_search_solr') AND !module_exists('global_search')) { |
|
159 | + // If using Solr search and not core Drupal search, disable core search! |
|
160 | + if (module_exists('global_search_solr') AND !module_exists('global_search')) { |
|
161 | 161 | // Add permission to user search. |
162 | 162 | $check = array( |
163 | - 'search/node/%menu_tail', |
|
164 | - 'search/user/%menu_tail', |
|
165 | - 'user/autocomplete' |
|
163 | + 'search/node/%menu_tail', |
|
164 | + 'search/user/%menu_tail', |
|
165 | + 'user/autocomplete' |
|
166 | 166 | ); |
167 | 167 | foreach ($check as $path) { |
168 | - if (isset($items[$path])) { |
|
168 | + if (isset($items[$path])) { |
|
169 | 169 | $items[$path]['access callback'] = FALSE; |
170 | - } |
|
170 | + } |
|
171 | + } |
|
171 | 172 | } |
172 | - } |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Implementation of hook_enable() |
177 | 177 | */ |
178 | 178 | function boinccore_enable() { |
179 | - // Automatically try to establish standard site content when this module is |
|
180 | - // enabled (e.g. Help and About Us pages) |
|
181 | - boinccore_admin_default_content_generate(); |
|
179 | + // Automatically try to establish standard site content when this module is |
|
180 | + // enabled (e.g. Help and About Us pages) |
|
181 | + boinccore_admin_default_content_generate(); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | * See: https://www.drupal.org/node/339958#comment-3012662 |
192 | 192 | */ |
193 | 193 | function boinccore_boot() { |
194 | - global $user, $language; |
|
195 | - $cache = variable_get('cache', CACHE_DISABLED); |
|
196 | - $language_negotiation = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); |
|
194 | + global $user, $language; |
|
195 | + $cache = variable_get('cache', CACHE_DISABLED); |
|
196 | + $language_negotiation = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); |
|
197 | 197 | |
198 | - // If we have an anonymous user, page cache is enabled, the URL has no prefix |
|
199 | - // and browser language negotiation is set, we perform a redirect to the |
|
200 | - // prefixed URL. |
|
201 | - if (empty($user->uid) && $cache != CACHE_DISABLED && $language_negotiation == LANGUAGE_NEGOTIATION_PATH) { |
|
198 | + // If we have an anonymous user, page cache is enabled, the URL has no prefix |
|
199 | + // and browser language negotiation is set, we perform a redirect to the |
|
200 | + // prefixed URL. |
|
201 | + if (empty($user->uid) && $cache != CACHE_DISABLED && $language_negotiation == LANGUAGE_NEGOTIATION_PATH) { |
|
202 | 202 | $args = isset($_GET['q']) ? explode('/', $_GET['q']) : array(); |
203 | 203 | $prefix = array_shift($args); |
204 | 204 | |
@@ -210,24 +210,24 @@ discard block |
||
210 | 210 | // so call this backported Drupal 7 language negotation function, which |
211 | 211 | // does both case insensitive and longest prefix matching |
212 | 212 | if (function_exists('locale_language_from_browser')) { |
213 | - $language = locale_language_from_browser(); |
|
213 | + $language = locale_language_from_browser(); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | if (!empty($language->prefix) && $prefix != $language->prefix) { |
217 | - // We need full path support to perform the redirect. |
|
218 | - drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); |
|
217 | + // We need full path support to perform the redirect. |
|
218 | + drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); |
|
219 | 219 | |
220 | - require_once './includes/common.inc'; |
|
221 | - $url = url($_GET['q'], array('query' => drupal_query_string_encode($_GET, array('q')))); |
|
222 | - $code = variable_get('locale_redirect_http_code', 302); |
|
220 | + require_once './includes/common.inc'; |
|
221 | + $url = url($_GET['q'], array('query' => drupal_query_string_encode($_GET, array('q')))); |
|
222 | + $code = variable_get('locale_redirect_http_code', 302); |
|
223 | 223 | |
224 | - // Since we are in a hook_boot() implementation cache mode is normal, so |
|
225 | - // we can safely call hook_exit(). |
|
226 | - bootstrap_invoke_all('exit'); |
|
227 | - header("Location: $url", TRUE, $code); |
|
228 | - exit; |
|
224 | + // Since we are in a hook_boot() implementation cache mode is normal, so |
|
225 | + // we can safely call hook_exit(). |
|
226 | + bootstrap_invoke_all('exit'); |
|
227 | + header("Location: $url", TRUE, $code); |
|
228 | + exit; |
|
229 | + } |
|
229 | 230 | } |
230 | - } |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | * |
241 | 241 | * Obsolete in Drupal 7... |
242 | 242 | */ |
243 | - function locale_language_from_browser() { |
|
243 | + function locale_language_from_browser() { |
|
244 | 244 | if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
245 | - return FALSE; |
|
245 | + return FALSE; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $languages = language_list('enabled'); |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | // Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5" |
258 | 258 | $browser_langcodes = array(); |
259 | 259 | if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches, PREG_SET_ORDER)) { |
260 | - foreach ($matches as $match) { |
|
260 | + foreach ($matches as $match) { |
|
261 | 261 | // We can safely use strtolower() here, tags are ASCII. |
262 | 262 | // RFC2616 mandates that the decimal part is no more than three digits, |
263 | 263 | // so we multiply the qvalue by 1000 to avoid floating point comparisons. |
264 | 264 | $langcode = strtolower($match[1]); |
265 | 265 | $qvalue = isset($match[2]) ? (float) $match[2] : 1; |
266 | 266 | $browser_langcodes[$langcode] = (int) ($qvalue * 1000); |
267 | - } |
|
267 | + } |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | // We should take pristine values from the HTTP headers, but Internet Explorer |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | // http://blogs.msdn.com/b/ie/archive/2006/10/17/accept-language-header-for-internet-explorer-7.aspx |
277 | 277 | asort($browser_langcodes); |
278 | 278 | foreach ($browser_langcodes as $langcode => $qvalue) { |
279 | - $generic_tag = strtok($langcode, '-'); |
|
280 | - if (!isset($browser_langcodes[$generic_tag])) { |
|
279 | + $generic_tag = strtok($langcode, '-'); |
|
280 | + if (!isset($browser_langcodes[$generic_tag])) { |
|
281 | 281 | $browser_langcodes[$generic_tag] = $qvalue; |
282 | - } |
|
282 | + } |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | // Find the enabled language with the greatest qvalue, following the rules |
@@ -288,148 +288,148 @@ discard block |
||
288 | 288 | $best_match_language = FALSE; |
289 | 289 | $max_qvalue = 0; |
290 | 290 | foreach ($languages as $langcode => $language) { |
291 | - // Language tags are case insensitive (RFC2616, sec 3.10). |
|
292 | - $langcode = strtolower($langcode); |
|
291 | + // Language tags are case insensitive (RFC2616, sec 3.10). |
|
292 | + $langcode = strtolower($langcode); |
|
293 | 293 | |
294 | - // If nothing matches below, the default qvalue is the one of the wildcard |
|
295 | - // language, if set, or is 0 (which will never match). |
|
296 | - $qvalue = isset($browser_langcodes['*']) ? $browser_langcodes['*'] : 0; |
|
294 | + // If nothing matches below, the default qvalue is the one of the wildcard |
|
295 | + // language, if set, or is 0 (which will never match). |
|
296 | + $qvalue = isset($browser_langcodes['*']) ? $browser_langcodes['*'] : 0; |
|
297 | 297 | |
298 | - // Find the longest possible prefix of the browser-supplied language |
|
299 | - // ('the language-range') that matches this site language ('the language tag'). |
|
300 | - $prefix = $langcode; |
|
301 | - do { |
|
298 | + // Find the longest possible prefix of the browser-supplied language |
|
299 | + // ('the language-range') that matches this site language ('the language tag'). |
|
300 | + $prefix = $langcode; |
|
301 | + do { |
|
302 | 302 | if (isset($browser_langcodes[$prefix])) { |
303 | - $qvalue = $browser_langcodes[$prefix]; |
|
304 | - break; |
|
303 | + $qvalue = $browser_langcodes[$prefix]; |
|
304 | + break; |
|
305 | 305 | } |
306 | - } |
|
307 | - while ($prefix = substr($prefix, 0, strrpos($prefix, '-'))); |
|
306 | + } |
|
307 | + while ($prefix = substr($prefix, 0, strrpos($prefix, '-'))); |
|
308 | 308 | |
309 | - // Find the best match. |
|
310 | - if ($qvalue > $max_qvalue) { |
|
309 | + // Find the best match. |
|
310 | + if ($qvalue > $max_qvalue) { |
|
311 | 311 | $best_match_language = $language; |
312 | 312 | $max_qvalue = $qvalue; |
313 | - } |
|
313 | + } |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | return $best_match_language; |
317 | - } |
|
317 | + } |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Implementation of hook_cron() |
322 | 322 | */ |
323 | 323 | function boinccore_cron() { |
324 | - // Notify moderators if there is site content that requires moderator action |
|
325 | - $items_in_queue = boincuser_moderation_queue_count('cron'); |
|
326 | - $last_notification = variable_get('boinccore_last_content_moderation_reminder', 0); |
|
327 | - if ($items_in_queue AND $last_notification < time() - 24*60*60) { |
|
324 | + // Notify moderators if there is site content that requires moderator action |
|
325 | + $items_in_queue = boincuser_moderation_queue_count('cron'); |
|
326 | + $last_notification = variable_get('boinccore_last_content_moderation_reminder', 0); |
|
327 | + if ($items_in_queue AND $last_notification < time() - 24*60*60) { |
|
328 | 328 | global $base_url; |
329 | 329 | global $base_path; |
330 | 330 | $site_name = variable_get('site_name', bts('project')); |
331 | 331 | $site_url = $base_url . $base_path; |
332 | 332 | $settings = array( |
333 | - 'from' => '', |
|
334 | - 'subject' => "Content at {$site_name} is awaiting moderation", |
|
335 | - 'message' => '' |
|
336 | - . "Please visit the moderation queue page to review content that " |
|
337 | - . "requires moderator action: \n" |
|
338 | - . "\n" |
|
339 | - . "{$site_url}moderate", |
|
333 | + 'from' => '', |
|
334 | + 'subject' => "Content at {$site_name} is awaiting moderation", |
|
335 | + 'message' => '' |
|
336 | + . "Please visit the moderation queue page to review content that " |
|
337 | + . "requires moderator action: \n" |
|
338 | + . "\n" |
|
339 | + . "{$site_url}moderate", |
|
340 | 340 | ); |
341 | 341 | boinccore_rules_action_mail_to_moderators($settings); |
342 | 342 | variable_set('boinccore_last_content_moderation_reminder', time()); |
343 | - } |
|
343 | + } |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | 347 | * Implementation of hook_rules_action_info(). |
348 | 348 | */ |
349 | 349 | function boinccore_rules_action_info() { |
350 | - return array( |
|
350 | + return array( |
|
351 | 351 | 'boinccore_rules_action_mail_to_moderators' => array( |
352 | - 'label' => t('Notify moderators via email'), |
|
353 | - 'module' => 'BOINC core', |
|
354 | - 'eval input' => array('subject', 'message', 'from'), |
|
352 | + 'label' => t('Notify moderators via email'), |
|
353 | + 'module' => 'BOINC core', |
|
354 | + 'eval input' => array('subject', 'message', 'from'), |
|
355 | 355 | ), |
356 | 356 | 'boinccore_rules_action_mark_content_for_moderation' => array( |
357 | - 'label' => t('Mark content for moderation'), |
|
358 | - 'arguments' => array( |
|
357 | + 'label' => t('Mark content for moderation'), |
|
358 | + 'arguments' => array( |
|
359 | 359 | 'node' => array('type' => 'node', 'label' => t('Content')), |
360 | - ), |
|
361 | - 'module' => 'BOINC core', |
|
360 | + ), |
|
361 | + 'module' => 'BOINC core', |
|
362 | 362 | ), |
363 | - ); |
|
363 | + ); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
367 | 367 | * Implementation of hook_form_alter() |
368 | 368 | */ |
369 | 369 | function boinccore_form_alter(&$form, $form_state, $form_id) { |
370 | - global $user; |
|
371 | - $account = user_load($user->uid); |
|
372 | - switch ($form_id) { |
|
373 | - // Comment form |
|
374 | - case 'comment_form': |
|
370 | + global $user; |
|
371 | + $account = user_load($user->uid); |
|
372 | + switch ($form_id) { |
|
373 | + // Comment form |
|
374 | + case 'comment_form': |
|
375 | 375 | $user_image = boincuser_get_user_profile_image($user->uid); |
376 | 376 | $user_info = '<div class="user">'; |
377 | 377 | if ($user_image) { |
378 | - $user_info .= ' <div class="picture">'; |
|
379 | - if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
378 | + $user_info .= ' <div class="picture">'; |
|
379 | + if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
380 | 380 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
381 | - } |
|
382 | - elseif (is_string($user_image)) { |
|
381 | + } |
|
382 | + elseif (is_string($user_image)) { |
|
383 | 383 | $user_info .= '<img src="' . $user_image . '"/>'; |
384 | - } |
|
385 | - $user_info .= ' </div>'; |
|
384 | + } |
|
385 | + $user_info .= ' </div>'; |
|
386 | 386 | } |
387 | 387 | $user_info .= ' <div class="name">' . theme('username', $account) . '</div>'; |
388 | 388 | if ($account->uid) { |
389 | - //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
|
390 | - //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
|
391 | - //$user_info .= ' <div class="credit">Credit: ' . $account->boincuser_total_credit . '</div>'; |
|
392 | - //$user_info .= ' <div class="rac">RAC: ' . $account->boincuser_expavg_credit . '</div>'; |
|
389 | + //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
|
390 | + //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
|
391 | + //$user_info .= ' <div class="credit">Credit: ' . $account->boincuser_total_credit . '</div>'; |
|
392 | + //$user_info .= ' <div class="rac">RAC: ' . $account->boincuser_expavg_credit . '</div>'; |
|
393 | 393 | } |
394 | 394 | $user_info .= '</div>'; |
395 | 395 | array_unshift($form, array( |
396 | - 'user_info' => array( |
|
396 | + 'user_info' => array( |
|
397 | 397 | '#value' => $user_info, |
398 | - ), |
|
399 | - 'comment_form_prefix' => array( |
|
398 | + ), |
|
399 | + 'comment_form_prefix' => array( |
|
400 | 400 | '#value' => '<div class="form-body">', |
401 | - ), |
|
401 | + ), |
|
402 | 402 | )); |
403 | 403 | $form['comment_form_suffix'] = array( |
404 | - '#value' => '</div>', |
|
404 | + '#value' => '</div>', |
|
405 | 405 | ); |
406 | 406 | |
407 | 407 | module_load_include('inc', 'bbcode', 'bbcode-help'); |
408 | 408 | $form['bbcode_help'] = array( |
409 | - '#title' => bts('BBcode help'), |
|
410 | - '#type' => 'fieldset', |
|
411 | - '#attributes' => array( |
|
409 | + '#title' => bts('BBcode help'), |
|
410 | + '#type' => 'fieldset', |
|
411 | + '#attributes' => array( |
|
412 | 412 | 'class' => 'bbcode_help', |
413 | - ), |
|
414 | - '#collapsible' => TRUE, |
|
415 | - '#collapsed' => TRUE, |
|
416 | - 'content' => array( |
|
413 | + ), |
|
414 | + '#collapsible' => TRUE, |
|
415 | + '#collapsed' => TRUE, |
|
416 | + 'content' => array( |
|
417 | 417 | '#value' => _bbcode_filter_tip(), |
418 | - ), |
|
418 | + ), |
|
419 | 419 | ); |
420 | 420 | |
421 | 421 | // If a specific comment is being referenced, go back to it on cancel |
422 | 422 | if ($comment_ref = $form['pid']['#value']) { |
423 | - $cancel_url = "goto/comment/{$comment_ref}"; |
|
423 | + $cancel_url = "goto/comment/{$comment_ref}"; |
|
424 | 424 | } |
425 | 425 | else { |
426 | - $cancel_url = "node/{$form['nid']['#value']}"; |
|
426 | + $cancel_url = "node/{$form['nid']['#value']}"; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | // Wrap action buttons for styling consistency |
430 | 430 | $form['buttons']['form control tabs prefix'] = array( |
431 | - '#value' => '<ul class="form-control tab-list">', |
|
432 | - '#weight' => 1001, |
|
431 | + '#value' => '<ul class="form-control tab-list">', |
|
432 | + '#weight' => 1001, |
|
433 | 433 | ); |
434 | 434 | $form['buttons']['submit'] = $form['submit']; |
435 | 435 | unset($form['submit']); |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | $form['buttons']['preview']['#suffix'] = '</li>'; |
449 | 449 | $form['buttons']['preview']['#weight'] = 1003; |
450 | 450 | $form['buttons']['cancel'] = array( |
451 | - '#value' => '<li class="tab">' . l(bts('Cancel'), $cancel_url) . '</li>', |
|
452 | - '#weight' => 1004, |
|
451 | + '#value' => '<li class="tab">' . l(bts('Cancel'), $cancel_url) . '</li>', |
|
452 | + '#weight' => 1004, |
|
453 | 453 | ); |
454 | 454 | $form['buttons']['form control tabs suffix'] = array( |
455 | - '#value' => '</ul>', |
|
456 | - '#weight' => 1010, |
|
455 | + '#value' => '</ul>', |
|
456 | + '#weight' => 1010, |
|
457 | 457 | ); |
458 | 458 | |
459 | 459 | // Remove redundant name field |
@@ -461,19 +461,19 @@ discard block |
||
461 | 461 | |
462 | 462 | break; |
463 | 463 | |
464 | - // Forum node form |
|
465 | - case 'forum_node_form': |
|
464 | + // Forum node form |
|
465 | + case 'forum_node_form': |
|
466 | 466 | case 'team_forum_node_form': |
467 | 467 | $forum_id = key($form['#node']->taxonomy); |
468 | 468 | $form['buttons']['separator_bottom'] = array( |
469 | - '#value' => '<div class="separator buttons"></div>', |
|
470 | - '#weight' => 999, |
|
469 | + '#value' => '<div class="separator buttons"></div>', |
|
470 | + '#weight' => 999, |
|
471 | 471 | ); |
472 | 472 | |
473 | 473 | // Wrap action buttons for styling consistency |
474 | 474 | $form['buttons']['form control tabs prefix'] = array( |
475 | - '#value' => '<ul class="form-control tab-list">', |
|
476 | - '#weight' => 1001, |
|
475 | + '#value' => '<ul class="form-control tab-list">', |
|
476 | + '#weight' => 1001, |
|
477 | 477 | ); |
478 | 478 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
479 | 479 | $form['buttons']['submit']['#value'] = bts('Post topic'); |
@@ -486,16 +486,16 @@ discard block |
||
486 | 486 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
487 | 487 | $form['buttons']['preview_changes']['#weight'] = 1004; |
488 | 488 | $form['buttons']['cancel'] = array( |
489 | - '#value' => '<li class="tab">' . l(bts('Cancel'), "community/forum/{$forum_id}") . '</li>', |
|
490 | - '#weight' => 1005, |
|
489 | + '#value' => '<li class="tab">' . l(bts('Cancel'), "community/forum/{$forum_id}") . '</li>', |
|
490 | + '#weight' => 1005, |
|
491 | 491 | ); |
492 | 492 | $form['buttons']['form control tabs suffix'] = array( |
493 | - '#value' => '</ul>', |
|
494 | - '#weight' => 1010, |
|
493 | + '#value' => '</ul>', |
|
494 | + '#weight' => 1010, |
|
495 | 495 | ); |
496 | 496 | |
497 | 497 | break; |
498 | - default: |
|
498 | + default: |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
@@ -503,61 +503,61 @@ discard block |
||
503 | 503 | * Implementation of hook_link_alter() |
504 | 504 | */ |
505 | 505 | function boinccore_link_alter(&$links, $node, $comment = NULL) { |
506 | - //echo '<pre>' . print_r($links, true) . '</pre>'; |
|
507 | - foreach ($links as $module => $link) { |
|
506 | + //echo '<pre>' . print_r($links, true) . '</pre>'; |
|
507 | + foreach ($links as $module => $link) { |
|
508 | 508 | // Remove the ignore user link |
509 | 509 | if (strstr($module, 'ignore_user')) { |
510 | - unset($links[$module]); |
|
510 | + unset($links[$module]); |
|
511 | 511 | } |
512 | - } |
|
513 | - // Node first, then comment: to be consistent with boinccore_link() function |
|
514 | - if (!($comment)) { |
|
512 | + } |
|
513 | + // Node first, then comment: to be consistent with boinccore_link() function |
|
514 | + if (!($comment)) { |
|
515 | 515 | // modify the comment_add link |
516 | 516 | if (isset($links['comment_add'])) { |
517 | - $links['comment_add']['title'] = bts('reply'); |
|
518 | - $links['comment_add']['attributes'] = array( |
|
519 | - 'title' => bts('Reply to this comment') |
|
520 | - ); |
|
517 | + $links['comment_add']['title'] = bts('reply'); |
|
518 | + $links['comment_add']['attributes'] = array( |
|
519 | + 'title' => bts('Reply to this comment') |
|
520 | + ); |
|
521 | 521 | } |
522 | 522 | // modify quote link |
523 | 523 | if (isset($links['quote'])) { |
524 | - $links['quote']['attributes'] = array( |
|
525 | - 'title' => bts('Reply to this topic with a quote') |
|
526 | - ); |
|
524 | + $links['quote']['attributes'] = array( |
|
525 | + 'title' => bts('Reply to this topic with a quote') |
|
526 | + ); |
|
527 | 527 | } |
528 | - } |
|
529 | - else { |
|
528 | + } |
|
529 | + else { |
|
530 | 530 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
531 | 531 | if (isset($links['comment_delete'])) { |
532 | - $links['comment_delete']['attributes'] = array( |
|
533 | - 'title' => bts('Delete this comment') |
|
534 | - ); |
|
532 | + $links['comment_delete']['attributes'] = array( |
|
533 | + 'title' => bts('Delete this comment') |
|
534 | + ); |
|
535 | 535 | } |
536 | 536 | if (isset($links['comment_edit'])) { |
537 | - $links['comment_edit']['attributes'] = array( |
|
538 | - 'title' => bts('Edit this comment') |
|
539 | - ); |
|
537 | + $links['comment_edit']['attributes'] = array( |
|
538 | + 'title' => bts('Edit this comment') |
|
539 | + ); |
|
540 | 540 | } |
541 | 541 | if (isset($links['comment_reply'])) { |
542 | - $links['comment_reply']['attributes'] = array( |
|
543 | - 'title' => bts('Reply to this comment') |
|
544 | - ); |
|
542 | + $links['comment_reply']['attributes'] = array( |
|
543 | + 'title' => bts('Reply to this comment') |
|
544 | + ); |
|
545 | 545 | } |
546 | - }// if !$comment |
|
546 | + }// if !$comment |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
550 | 550 | * Implementation of hook_locale(). |
551 | 551 | */ |
552 | 552 | function boinccore_locale($op = 'groups', $group = NULL) { |
553 | - switch ($op) { |
|
553 | + switch ($op) { |
|
554 | 554 | case 'groups': |
555 | 555 | return array('boinc' => bts('BOINC')); |
556 | 556 | case 'info': |
557 | 557 | //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
558 | 558 | $info['boinc']['format'] = FALSE; |
559 | - return $info; |
|
560 | - } |
|
559 | + return $info; |
|
560 | + } |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -565,71 +565,71 @@ discard block |
||
565 | 565 | * Implementation of hook_link() |
566 | 566 | */ |
567 | 567 | function boinccore_link($type, $object, $teaser = FALSE) { |
568 | - // Add custom links with this hook |
|
568 | + // Add custom links with this hook |
|
569 | 569 | |
570 | - if ($type=='node') { |
|
570 | + if ($type=='node') { |
|
571 | 571 | if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
572 | - // Add topic moderator controls |
|
573 | - if (user_access('edit any forum topic')) { |
|
572 | + // Add topic moderator controls |
|
573 | + if (user_access('edit any forum topic')) { |
|
574 | 574 | $node_control = "node_control/{$object->nid}"; |
575 | 575 | if ($object->sticky) { |
576 | - $links['make_unsticky'] = array( |
|
577 | - 'title' => bts('Make unsticky'), |
|
578 | - 'href' => "{$node_control}/unsticky", |
|
579 | - 'attributes' => array( |
|
580 | - 'title' => bts('Remove sticky status from this topic') |
|
581 | - ) |
|
582 | - ); |
|
576 | + $links['make_unsticky'] = array( |
|
577 | + 'title' => bts('Make unsticky'), |
|
578 | + 'href' => "{$node_control}/unsticky", |
|
579 | + 'attributes' => array( |
|
580 | + 'title' => bts('Remove sticky status from this topic') |
|
581 | + ) |
|
582 | + ); |
|
583 | 583 | } |
584 | 584 | else { |
585 | - $links['make_sticky'] = array( |
|
586 | - 'title' => bts('Make sticky'), |
|
587 | - 'href' => "{$node_control}/sticky", |
|
588 | - 'attributes' => array( |
|
589 | - 'title' => bts('Make this topic sticky') |
|
590 | - ) |
|
591 | - ); |
|
585 | + $links['make_sticky'] = array( |
|
586 | + 'title' => bts('Make sticky'), |
|
587 | + 'href' => "{$node_control}/sticky", |
|
588 | + 'attributes' => array( |
|
589 | + 'title' => bts('Make this topic sticky') |
|
590 | + ) |
|
591 | + ); |
|
592 | 592 | } |
593 | 593 | if ($object->comment == COMMENT_NODE_READ_WRITE) { |
594 | - $links['lock'] = array( |
|
595 | - 'title' => bts('Lock'), |
|
596 | - 'href' => "{$node_control}/lock", |
|
597 | - 'attributes' => array( |
|
598 | - 'title' => bts('Lock this thread for comments') |
|
599 | - ) |
|
600 | - ); |
|
594 | + $links['lock'] = array( |
|
595 | + 'title' => bts('Lock'), |
|
596 | + 'href' => "{$node_control}/lock", |
|
597 | + 'attributes' => array( |
|
598 | + 'title' => bts('Lock this thread for comments') |
|
599 | + ) |
|
600 | + ); |
|
601 | 601 | } |
602 | 602 | else { |
603 | - $links['unlock'] = array( |
|
604 | - 'title' => bts('Unlock'), |
|
605 | - 'href' => "{$node_control}/unlock", |
|
606 | - 'attributes' => array( |
|
607 | - 'title' => bts('Unlock this thread for comments') |
|
608 | - ) |
|
609 | - ); |
|
603 | + $links['unlock'] = array( |
|
604 | + 'title' => bts('Unlock'), |
|
605 | + 'href' => "{$node_control}/unlock", |
|
606 | + 'attributes' => array( |
|
607 | + 'title' => bts('Unlock this thread for comments') |
|
608 | + ) |
|
609 | + ); |
|
610 | 610 | } |
611 | 611 | if ($object->status) { |
612 | - $links['hide'] = array( |
|
613 | - 'title' => bts('Hide'), |
|
614 | - 'href' => "{$node_control}/hide", |
|
615 | - 'attributes' => array( |
|
616 | - 'title' => bts('Hide this topic') |
|
617 | - ) |
|
618 | - ); |
|
612 | + $links['hide'] = array( |
|
613 | + 'title' => bts('Hide'), |
|
614 | + 'href' => "{$node_control}/hide", |
|
615 | + 'attributes' => array( |
|
616 | + 'title' => bts('Hide this topic') |
|
617 | + ) |
|
618 | + ); |
|
619 | 619 | } |
620 | 620 | else { |
621 | - $links['unhide'] = array( |
|
622 | - 'title' => bts('Unhide'), |
|
623 | - 'href' => "{$node_control}/unhide", |
|
624 | - 'attributes' => array( |
|
625 | - 'title' => bts('Unhide this topic') |
|
626 | - ) |
|
627 | - ); |
|
621 | + $links['unhide'] = array( |
|
622 | + 'title' => bts('Unhide'), |
|
623 | + 'href' => "{$node_control}/unhide", |
|
624 | + 'attributes' => array( |
|
625 | + 'title' => bts('Unhide this topic') |
|
626 | + ) |
|
627 | + ); |
|
628 | 628 | } |
629 | - }// if user_access('edit any forum topic') |
|
629 | + }// if user_access('edit any forum topic') |
|
630 | 630 | } |
631 | - } |
|
632 | - else if ($type=='comment') { |
|
631 | + } |
|
632 | + else if ($type=='comment') { |
|
633 | 633 | $node = node_load($object->nid); |
634 | 634 | $nid = $object->nid; |
635 | 635 | $cid = $object->cid; |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | // HIDE and COVERT comment |
650 | 650 | // The following are moderator only links |
651 | 651 | if (user_access('administer comments')) { |
652 | - $comment_control = "comment_control/{$cid}"; |
|
653 | - // Add link to convert comment into a new topic |
|
654 | - $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
655 | - if ($reply_count == 0) { |
|
652 | + $comment_control = "comment_control/{$cid}"; |
|
653 | + // Add link to convert comment into a new topic |
|
654 | + $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
655 | + if ($reply_count == 0) { |
|
656 | 656 | $links['convert'] = array( |
657 | 657 | 'title' => bts('Convert'), |
658 | 658 | 'href' => "{$comment_control}/convert", |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | 'title' => bts('Convert this comment to a new topic') |
661 | 661 | ) |
662 | 662 | ); |
663 | - } |
|
664 | - // Add hide link |
|
665 | - if ($object->status == 0) { |
|
663 | + } |
|
664 | + // Add hide link |
|
665 | + if ($object->status == 0) { |
|
666 | 666 | $links['hide'] = array( |
667 | 667 | 'title' => bts('Hide'), |
668 | 668 | 'href' => "{$comment_control}/hide", |
@@ -670,8 +670,8 @@ discard block |
||
670 | 670 | 'title' => bts('Hide this comment') |
671 | 671 | ) |
672 | 672 | ); |
673 | - } |
|
674 | - else { |
|
673 | + } |
|
674 | + else { |
|
675 | 675 | $links['unhide'] = array( |
676 | 676 | 'title' => bts('Unhide'), |
677 | 677 | 'href' => "{$comment_control}/unhide", |
@@ -679,11 +679,11 @@ discard block |
||
679 | 679 | 'title' => bts('Unhide this comment') |
680 | 680 | ) |
681 | 681 | ); |
682 | - } |
|
682 | + } |
|
683 | 683 | }// if user_access('administer comments') |
684 | - }//if $type |
|
684 | + }//if $type |
|
685 | 685 | |
686 | - return $links; |
|
686 | + return $links; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | |
@@ -697,39 +697,39 @@ discard block |
||
697 | 697 | * link rather than through the node form. |
698 | 698 | */ |
699 | 699 | function boinccore_node_control($nid = NULL, $action = NULL) { |
700 | - if ((!$nid OR !$node = node_load($nid)) OR |
|
700 | + if ((!$nid OR !$node = node_load($nid)) OR |
|
701 | 701 | ($node->type == 'forum' AND !user_access('edit any forum topic')) OR |
702 | 702 | ($node->type != 'forum' AND !user_access('administer nodes'))) { |
703 | 703 | // What are you even doing here... |
704 | 704 | return FALSE; |
705 | - } |
|
706 | - switch ($action) { |
|
707 | - case 'unhide': |
|
705 | + } |
|
706 | + switch ($action) { |
|
707 | + case 'unhide': |
|
708 | 708 | node_publish_action($node); |
709 | 709 | break; |
710 | - case 'hide': |
|
710 | + case 'hide': |
|
711 | 711 | node_unpublish_action($node); |
712 | 712 | break; |
713 | - case 'sticky': |
|
713 | + case 'sticky': |
|
714 | 714 | node_make_sticky_action($node); |
715 | 715 | break; |
716 | - case 'unsticky': |
|
716 | + case 'unsticky': |
|
717 | 717 | node_make_unsticky_action($node); |
718 | 718 | break; |
719 | - case 'lock': |
|
719 | + case 'lock': |
|
720 | 720 | $node->comment = 1; |
721 | 721 | watchdog('action', 'Locked comments on @type %title.', array( |
722 | - '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
722 | + '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
723 | 723 | break; |
724 | - case 'unlock': |
|
724 | + case 'unlock': |
|
725 | 725 | $node->comment = 2; |
726 | 726 | watchdog('action', 'Unlocked comments on @type %title.', array( |
727 | - '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
727 | + '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
728 | 728 | break; |
729 | - default: |
|
729 | + default: |
|
730 | 730 | } |
731 | - node_save($node); |
|
732 | - drupal_goto("node/{$nid}"); |
|
731 | + node_save($node); |
|
732 | + drupal_goto("node/{$nid}"); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | /** |
@@ -738,26 +738,26 @@ discard block |
||
738 | 738 | * through the comment edit form. |
739 | 739 | */ |
740 | 740 | function boinccore_comment_control($cid = NULL, $action = NULL) { |
741 | - if (!$cid OR !$comment = _comment_load($cid)) { |
|
741 | + if (!$cid OR !$comment = _comment_load($cid)) { |
|
742 | 742 | // What are you even doing here... |
743 | 743 | return FALSE; |
744 | - } |
|
745 | - $return_path = "node/{$comment->nid}"; |
|
746 | - $return_anchor = "comment-{$cid}"; |
|
747 | - switch ($action) { |
|
748 | - case 'unhide': |
|
744 | + } |
|
745 | + $return_path = "node/{$comment->nid}"; |
|
746 | + $return_anchor = "comment-{$cid}"; |
|
747 | + switch ($action) { |
|
748 | + case 'unhide': |
|
749 | 749 | comment_publish_action($comment); |
750 | 750 | if (module_exists("boinc_solr_comments")) { |
751 | - boinc_solr_comments_publish($comment); |
|
751 | + boinc_solr_comments_publish($comment); |
|
752 | 752 | } |
753 | 753 | break; |
754 | - case 'hide': |
|
754 | + case 'hide': |
|
755 | 755 | comment_unpublish_action($comment); |
756 | 756 | if (module_exists("boinc_solr_comments")) { |
757 | - boinc_solr_comments_unpublish($comment); |
|
757 | + boinc_solr_comments_unpublish($comment); |
|
758 | 758 | } |
759 | 759 | break; |
760 | - case 'convert': |
|
760 | + case 'convert': |
|
761 | 761 | $node = new stdClass(); |
762 | 762 | $node->name = $comment->subject; |
763 | 763 | $node->title = $node->name; |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | $node->tid = $parent_node->tid; |
778 | 778 | |
779 | 779 | if (filter_access($comment->format)) { |
780 | - $node->format = $comment->format; |
|
780 | + $node->format = $comment->format; |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | // Save the new node |
@@ -791,9 +791,9 @@ discard block |
||
791 | 791 | $return_path = "node/{$node->nid}"; |
792 | 792 | $return_anchor = NULL; |
793 | 793 | break; |
794 | - default: |
|
794 | + default: |
|
795 | 795 | } |
796 | - drupal_goto($return_path, NULL, $return_anchor); |
|
796 | + drupal_goto($return_path, NULL, $return_anchor); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | /** |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | * Get the authenticator for a given account |
802 | 802 | */ |
803 | 803 | function boinccore_lookup_account() { |
804 | - include_boinc('user/lookup_account.php'); |
|
804 | + include_boinc('user/lookup_account.php'); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -809,29 +809,29 @@ discard block |
||
809 | 809 | * Get assorted details for a given account |
810 | 810 | */ |
811 | 811 | function boinccore_am_get_info() { |
812 | - // Remove q from the GET request or BOINC will panic |
|
813 | - unset($_GET['q']); |
|
814 | - // Capture the XML output of the RPC so we can override things |
|
815 | - ob_start(); |
|
816 | - include_boinc('user/am_get_info.php'); |
|
817 | - $xml = ob_get_clean(); |
|
818 | - $xml = load_configuration($xml); |
|
819 | - // See if the account has an approved profile in Drupal |
|
820 | - $uid = !empty($xml['am_get_info_reply']['id']) ? boincuser_lookup_uid($xml['am_get_info_reply']['id']) : 0; |
|
821 | - if ($uid) { |
|
812 | + // Remove q from the GET request or BOINC will panic |
|
813 | + unset($_GET['q']); |
|
814 | + // Capture the XML output of the RPC so we can override things |
|
815 | + ob_start(); |
|
816 | + include_boinc('user/am_get_info.php'); |
|
817 | + $xml = ob_get_clean(); |
|
818 | + $xml = load_configuration($xml); |
|
819 | + // See if the account has an approved profile in Drupal |
|
820 | + $uid = !empty($xml['am_get_info_reply']['id']) ? boincuser_lookup_uid($xml['am_get_info_reply']['id']) : 0; |
|
821 | + if ($uid) { |
|
822 | 822 | $content_profile = content_profile_load('profile', $uid); |
823 | 823 | $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
824 | 824 | $country = check_plain($content_profile->field_country[0]['value']); |
825 | 825 | $website = ''; |
826 | 826 | if ($profile_is_approved) { |
827 | - $website = check_plain($content_profile->field_url[0]['value']); |
|
827 | + $website = check_plain($content_profile->field_url[0]['value']); |
|
828 | 828 | } |
829 | 829 | // Override BOINC values with Drupal values as needed |
830 | 830 | $xml['am_get_info_reply']['has_profile']['@value'] = ($profile_is_approved) ? 1 : 0; |
831 | 831 | $xml['am_get_info_reply']['country']['@value'] = $country; |
832 | 832 | $xml['am_get_info_reply']['url']['@value'] = $website; |
833 | - } |
|
834 | - print save_configuration($xml); |
|
833 | + } |
|
834 | + print save_configuration($xml); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
@@ -839,75 +839,75 @@ discard block |
||
839 | 839 | * Update assorted details for a given account |
840 | 840 | */ |
841 | 841 | function boinccore_am_set_info() { |
842 | - // Remove q from the GET request or BOINC will panic |
|
843 | - unset($_GET['q']); |
|
844 | - // Validate the XML prefs (in case BOINC does not) |
|
845 | - $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : NULL); |
|
846 | - $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : NULL); |
|
847 | - libxml_use_internal_errors(true); |
|
848 | - $xml = new DomDocument(); |
|
849 | - if ($global_prefs) { |
|
842 | + // Remove q from the GET request or BOINC will panic |
|
843 | + unset($_GET['q']); |
|
844 | + // Validate the XML prefs (in case BOINC does not) |
|
845 | + $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : NULL); |
|
846 | + $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : NULL); |
|
847 | + libxml_use_internal_errors(true); |
|
848 | + $xml = new DomDocument(); |
|
849 | + if ($global_prefs) { |
|
850 | 850 | $xml->loadXML($global_prefs, LIBXML_NOBLANKS); |
851 | 851 | if ($errors = libxml_get_errors($xml)) { |
852 | - $lines = explode("\r", $global_prefs); |
|
853 | - watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
852 | + $lines = explode("\r", $global_prefs); |
|
853 | + watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
854 | 854 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
855 | 855 | } |
856 | - } |
|
857 | - elseif ($project_prefs) { |
|
856 | + } |
|
857 | + elseif ($project_prefs) { |
|
858 | 858 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
859 | 859 | if ($errors = libxml_get_errors($xml)) { |
860 | - $lines = explode("\r", $project_prefs); |
|
861 | - watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
860 | + $lines = explode("\r", $project_prefs); |
|
861 | + watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
862 | 862 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
863 | 863 | } |
864 | - } |
|
865 | - if (!$errors) { |
|
864 | + } |
|
865 | + if (!$errors) { |
|
866 | 866 | // Capture the XML output of the RPC so we can override things |
867 | 867 | ob_start(); |
868 | 868 | include_boinc('user/am_set_info.php'); |
869 | 869 | $xml = ob_get_clean(); |
870 | 870 | $xml = load_configuration($xml); |
871 | 871 | if (isset($xml['am_set_info_reply']['success'])) { |
872 | - // Find the account in Drupal |
|
873 | - $boinc_auth = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
|
874 | - db_set_active('boinc'); |
|
875 | - $boinc_id = db_result(db_query(" |
|
872 | + // Find the account in Drupal |
|
873 | + $boinc_auth = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
|
874 | + db_set_active('boinc'); |
|
875 | + $boinc_id = db_result(db_query(" |
|
876 | 876 | SELECT id |
877 | 877 | FROM {user} |
878 | 878 | WHERE authenticator = '%s'", |
879 | 879 | $boinc_auth |
880 | - )); |
|
881 | - db_set_active('default'); |
|
882 | - $uid = boincuser_lookup_uid($boinc_id); |
|
880 | + )); |
|
881 | + db_set_active('default'); |
|
882 | + $uid = boincuser_lookup_uid($boinc_id); |
|
883 | 883 | |
884 | - // Apply any relevant updates to the Drupal account, also |
|
885 | - $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : NULL); |
|
886 | - $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : NULL); |
|
887 | - $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : NULL); |
|
884 | + // Apply any relevant updates to the Drupal account, also |
|
885 | + $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : NULL); |
|
886 | + $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : NULL); |
|
887 | + $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : NULL); |
|
888 | 888 | |
889 | - if ($email_addr) { |
|
889 | + if ($email_addr) { |
|
890 | 890 | $account = user_load($uid); |
891 | 891 | user_save($account, array('mail' => $email_addr)); |
892 | - } |
|
893 | - if ($country OR $url) { |
|
892 | + } |
|
893 | + if ($country OR $url) { |
|
894 | 894 | $content_profile = content_profile_load('profile', $uid); |
895 | 895 | if ($country) $content_profile->field_country[0]['value'] = $country; |
896 | 896 | if ($url) $content_profile->field_url[0]['value'] = $url; |
897 | 897 | node_save($content_profile); |
898 | - } |
|
898 | + } |
|
899 | 899 | } |
900 | - } |
|
901 | - else { |
|
900 | + } |
|
901 | + else { |
|
902 | 902 | $xml = array( |
903 | - 'error' => array( |
|
903 | + 'error' => array( |
|
904 | 904 | 'error_num' => -112, |
905 | 905 | 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}" . |
906 | 906 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]) |
907 | - ), |
|
907 | + ), |
|
908 | 908 | ); |
909 | - } |
|
910 | - print save_configuration($xml); |
|
909 | + } |
|
910 | + print save_configuration($xml); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -915,17 +915,17 @@ discard block |
||
915 | 915 | * Update the venue for the given host |
916 | 916 | */ |
917 | 917 | function boinccore_am_set_host_info() { |
918 | - // Remove q from the GET request or BOINC will panic |
|
919 | - unset($_GET['q']); |
|
920 | - // Capture the XML output of the RPC so we can override things |
|
921 | - ob_start(); |
|
922 | - include_boinc('user/am_set_host_info.php'); |
|
923 | - $xml = ob_get_clean(); |
|
924 | - $xml = load_configuration($xml); |
|
925 | - if (isset($xml['am_set_host_info_reply']['success'])) { |
|
918 | + // Remove q from the GET request or BOINC will panic |
|
919 | + unset($_GET['q']); |
|
920 | + // Capture the XML output of the RPC so we can override things |
|
921 | + ob_start(); |
|
922 | + include_boinc('user/am_set_host_info.php'); |
|
923 | + $xml = ob_get_clean(); |
|
924 | + $xml = load_configuration($xml); |
|
925 | + if (isset($xml['am_set_host_info_reply']['success'])) { |
|
926 | 926 | // Override anything that needs overriding |
927 | - } |
|
928 | - print save_configuration($xml); |
|
927 | + } |
|
928 | + print save_configuration($xml); |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | /** |
@@ -933,29 +933,29 @@ discard block |
||
933 | 933 | * Get assorted details for a given account |
934 | 934 | */ |
935 | 935 | function boinccore_show_user() { |
936 | - // Remove q from the GET request or BOINC will panic |
|
937 | - unset($_GET['q']); |
|
938 | - // Capture the XML output of the RPC so we can override things |
|
939 | - ob_start(); |
|
940 | - include_boinc('user/show_user.php'); |
|
941 | - $xml = ob_get_clean(); |
|
942 | - $xml = load_configuration($xml); |
|
943 | - // See if the account has an approved profile in Drupal |
|
944 | - $uid = !empty($xml['user']['id']) ? boincuser_lookup_uid($xml['user']['id']) : 0; |
|
945 | - if ($uid) { |
|
936 | + // Remove q from the GET request or BOINC will panic |
|
937 | + unset($_GET['q']); |
|
938 | + // Capture the XML output of the RPC so we can override things |
|
939 | + ob_start(); |
|
940 | + include_boinc('user/show_user.php'); |
|
941 | + $xml = ob_get_clean(); |
|
942 | + $xml = load_configuration($xml); |
|
943 | + // See if the account has an approved profile in Drupal |
|
944 | + $uid = !empty($xml['user']['id']) ? boincuser_lookup_uid($xml['user']['id']) : 0; |
|
945 | + if ($uid) { |
|
946 | 946 | $content_profile = content_profile_load('profile', $uid); |
947 | 947 | $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
948 | 948 | $country = check_plain($content_profile->field_country[0]['value']); |
949 | 949 | $website = ''; |
950 | 950 | if ($profile_is_approved) { |
951 | - $website = check_plain($content_profile->field_url[0]['value']); |
|
951 | + $website = check_plain($content_profile->field_url[0]['value']); |
|
952 | 952 | } |
953 | 953 | // Override BOINC values with Drupal values as needed |
954 | 954 | $xml['user']['has_profile']['@value'] = ($profile_is_approved) ? 1 : 0; |
955 | 955 | $xml['user']['country']['@value'] = $country; |
956 | 956 | $xml['user']['url']['@value'] = $website; |
957 | - } |
|
958 | - print save_configuration($xml); |
|
957 | + } |
|
958 | + print save_configuration($xml); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | /** |
@@ -963,9 +963,9 @@ discard block |
||
963 | 963 | * Get pending credit information for a given account |
964 | 964 | */ |
965 | 965 | function boinccore_pending_credit() { |
966 | - // Remove q from the GET request or BOINC will panic |
|
967 | - unset($_GET['q']); |
|
968 | - include_boinc('user/pending.php'); |
|
966 | + // Remove q from the GET request or BOINC will panic |
|
967 | + unset($_GET['q']); |
|
968 | + include_boinc('user/pending.php'); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | */ |
975 | 975 | function boinccore_create_team() { |
976 | 976 | |
977 | - if (module_exists('boincteam')) { |
|
977 | + if (module_exists('boincteam')) { |
|
978 | 978 | module_load_include('module', 'boincteam', 'boincteam'); |
979 | 979 | |
980 | 980 | $input_format = !empty($values['format']) ? $values['format'] : 4; |
@@ -987,9 +987,9 @@ discard block |
||
987 | 987 | $xml = load_configuration($xml); |
988 | 988 | |
989 | 989 | if (isset($xml['create_team_reply']['success'])) { |
990 | - $boincteam_id = isset($xml['create_team_reply']['team_id']['@value']) ? $xml['create_team_reply']['team_id']['@value'] : 0; |
|
990 | + $boincteam_id = isset($xml['create_team_reply']['team_id']['@value']) ? $xml['create_team_reply']['team_id']['@value'] : 0; |
|
991 | 991 | |
992 | - if ($boincteam_id) { |
|
992 | + if ($boincteam_id) { |
|
993 | 993 | |
994 | 994 | $boincteam = boincteam_load($boincteam_id); |
995 | 995 | $team_owner_uid = boincuser_lookup_uid($boincteam->userid); |
@@ -997,92 +997,92 @@ discard block |
||
997 | 997 | // Create the team node in Drupal |
998 | 998 | |
999 | 999 | $values = array( |
1000 | - 'name' => isset($_GET['name']) ? $_GET['name'] : '', |
|
1001 | - 'description' => isset($_GET['description']) ? $_GET['description'] : '', |
|
1002 | - 'type' => isset($_GET['type']) ? $_GET['type'] : '', |
|
1000 | + 'name' => isset($_GET['name']) ? $_GET['name'] : '', |
|
1001 | + 'description' => isset($_GET['description']) ? $_GET['description'] : '', |
|
1002 | + 'type' => isset($_GET['type']) ? $_GET['type'] : '', |
|
1003 | 1003 | ); |
1004 | 1004 | $teaser = node_teaser($values['description']); |
1005 | 1005 | $created_time = time(); |
1006 | 1006 | |
1007 | 1007 | $node = array( |
1008 | - 'type' => 'team', |
|
1009 | - 'title' => $values['name'], |
|
1010 | - 'body' => $values['description'], |
|
1011 | - 'teaser' => $teaser, |
|
1012 | - 'uid' => $team_owner_uid, |
|
1013 | - 'path' => null, |
|
1014 | - 'status' => 1, // published or not - always publish |
|
1015 | - 'promote' => 0, |
|
1016 | - 'created' => $created_time, |
|
1017 | - 'comment' => 0, // comments disabled |
|
1018 | - 'moderate' => 0, |
|
1019 | - 'sticky' => 0, |
|
1020 | - 'format' => $input_format |
|
1008 | + 'type' => 'team', |
|
1009 | + 'title' => $values['name'], |
|
1010 | + 'body' => $values['description'], |
|
1011 | + 'teaser' => $teaser, |
|
1012 | + 'uid' => $team_owner_uid, |
|
1013 | + 'path' => null, |
|
1014 | + 'status' => 1, // published or not - always publish |
|
1015 | + 'promote' => 0, |
|
1016 | + 'created' => $created_time, |
|
1017 | + 'comment' => 0, // comments disabled |
|
1018 | + 'moderate' => 0, |
|
1019 | + 'sticky' => 0, |
|
1020 | + 'format' => $input_format |
|
1021 | 1021 | ); |
1022 | 1022 | |
1023 | 1023 | // Use pathauto function, if available, to clean up the path |
1024 | 1024 | if (module_exists('pathauto')) { |
1025 | - module_load_include('inc', 'pathauto', 'pathauto'); |
|
1026 | - $node['path'] = pathauto_cleanstring($values['name']); |
|
1025 | + module_load_include('inc', 'pathauto', 'pathauto'); |
|
1026 | + $node['path'] = pathauto_cleanstring($values['name']); |
|
1027 | 1027 | |
1028 | - $node = (object) $node; // node_save requires an object form |
|
1029 | - $team_categories = taxonomy_get_term_by_name($values['type']); |
|
1030 | - $node->taxonomy[] = $team_categories[0]; |
|
1028 | + $node = (object) $node; // node_save requires an object form |
|
1029 | + $team_categories = taxonomy_get_term_by_name($values['type']); |
|
1030 | + $node->taxonomy[] = $team_categories[0]; |
|
1031 | 1031 | |
1032 | - // Save the team node |
|
1033 | - node_save($node); |
|
1034 | - // Save the team IDs to a BOINC <--> Drupal reference table. |
|
1035 | - db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
|
1032 | + // Save the team node |
|
1033 | + node_save($node); |
|
1034 | + // Save the team IDs to a BOINC <--> Drupal reference table. |
|
1035 | + db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
|
1036 | 1036 | } |
1037 | 1037 | else { |
1038 | - $xml['create_team_reply']['warning'] = t( |
|
1038 | + $xml['create_team_reply']['warning'] = t( |
|
1039 | 1039 | 'There was a problem integrating this team into Drupal. Please |
1040 | 1040 | contact @project administrators!', array('@project' => PROJECT) |
1041 | - ); |
|
1042 | - watchdog( |
|
1041 | + ); |
|
1042 | + watchdog( |
|
1043 | 1043 | 'BOINC team', |
1044 | 1044 | 'BOINC teams require the Pathauto module. Team cannot be created in |
1045 | 1045 | Drupal via create_team.php RPC.', |
1046 | 1046 | array(), |
1047 | 1047 | WATCHDOG_ERROR |
1048 | - ); |
|
1049 | - // Delete from the BOINC DB if we can't sync with Drupal |
|
1050 | - $boincteam::delete(); |
|
1048 | + ); |
|
1049 | + // Delete from the BOINC DB if we can't sync with Drupal |
|
1050 | + $boincteam::delete(); |
|
1051 | 1051 | } |
1052 | - } |
|
1053 | - else { |
|
1052 | + } |
|
1053 | + else { |
|
1054 | 1054 | $xml['create_team_reply']['warning'] = t( |
1055 | - 'There was a problem integrating this team into Drupal. Please |
|
1055 | + 'There was a problem integrating this team into Drupal. Please |
|
1056 | 1056 | contact @project administrators!', array('@project' => PROJECT) |
1057 | 1057 | ); |
1058 | 1058 | watchdog( |
1059 | - 'BOINC team', |
|
1060 | - 'Team cannot be created in Drupal via create_team.php RPC because no |
|
1059 | + 'BOINC team', |
|
1060 | + 'Team cannot be created in Drupal via create_team.php RPC because no |
|
1061 | 1061 | BOINC team ID was returned in the XML.', |
1062 | - array(), |
|
1063 | - WATCHDOG_ERROR |
|
1062 | + array(), |
|
1063 | + WATCHDOG_ERROR |
|
1064 | 1064 | ); |
1065 | - } |
|
1065 | + } |
|
1066 | 1066 | } |
1067 | - } |
|
1068 | - else { |
|
1067 | + } |
|
1068 | + else { |
|
1069 | 1069 | $xml = array( |
1070 | - 'error' => array( |
|
1070 | + 'error' => array( |
|
1071 | 1071 | 'error_num' => -1, |
1072 | 1072 | 'error_msg' => t( |
1073 | - 'Teams are not enabled for this project' |
|
1073 | + 'Teams are not enabled for this project' |
|
1074 | + ), |
|
1074 | 1075 | ), |
1075 | - ), |
|
1076 | 1076 | ); |
1077 | 1077 | watchdog( |
1078 | - 'BOINC team', |
|
1079 | - 'Team cannot be created in Drupal via create_team.php RPC because the |
|
1078 | + 'BOINC team', |
|
1079 | + 'Team cannot be created in Drupal via create_team.php RPC because the |
|
1080 | 1080 | BOINC team module is not enabled.', |
1081 | - array(), |
|
1082 | - WATCHDOG_ERROR |
|
1081 | + array(), |
|
1082 | + WATCHDOG_ERROR |
|
1083 | 1083 | ); |
1084 | - } |
|
1085 | - print save_configuration($xml); |
|
1084 | + } |
|
1085 | + print save_configuration($xml); |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | /** |
@@ -1090,9 +1090,9 @@ discard block |
||
1090 | 1090 | * Get info on a team by ID or a list of teams that match a given name |
1091 | 1091 | */ |
1092 | 1092 | function boinccore_team_lookup() { |
1093 | - // Remove q from the GET request or BOINC will panic |
|
1094 | - unset($_GET['q']); |
|
1095 | - include_boinc('user/team_lookup.php'); |
|
1093 | + // Remove q from the GET request or BOINC will panic |
|
1094 | + unset($_GET['q']); |
|
1095 | + include_boinc('user/team_lookup.php'); |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | /** |
@@ -1100,28 +1100,28 @@ discard block |
||
1100 | 1100 | * Get members of a given team |
1101 | 1101 | */ |
1102 | 1102 | function boinccore_team_email_list() { |
1103 | - // See if the account has an approved profile in Drupal |
|
1104 | - $boincteam_id = !empty($_POST['teamid']) ? $_POST['teamid'] : $_GET['teamid']; |
|
1105 | - $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
|
1106 | - $show_xml = !empty($_POST['xml']) ? $_POST['xml'] : $_GET['xml']; |
|
1107 | - $admin_request = FALSE; |
|
1108 | - if ($boincteam_id && is_numeric($boincteam_id)) { |
|
1103 | + // See if the account has an approved profile in Drupal |
|
1104 | + $boincteam_id = !empty($_POST['teamid']) ? $_POST['teamid'] : $_GET['teamid']; |
|
1105 | + $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
|
1106 | + $show_xml = !empty($_POST['xml']) ? $_POST['xml'] : $_GET['xml']; |
|
1107 | + $admin_request = FALSE; |
|
1108 | + if ($boincteam_id && is_numeric($boincteam_id)) { |
|
1109 | 1109 | if ($account_key) { |
1110 | - // See if this is a team admin |
|
1111 | - db_set_active('boinc'); |
|
1112 | - $boincuser_id = db_result(db_query(" |
|
1110 | + // See if this is a team admin |
|
1111 | + db_set_active('boinc'); |
|
1112 | + $boincuser_id = db_result(db_query(" |
|
1113 | 1113 | SELECT |
1114 | 1114 | u.id |
1115 | 1115 | FROM {user} u |
1116 | 1116 | WHERE u.authenticator = '%s' |
1117 | 1117 | LIMIT 1", |
1118 | 1118 | $account_key |
1119 | - )); |
|
1120 | - db_set_active('default'); |
|
1121 | - require_boinc('team'); |
|
1122 | - $boincuser = boincuser_load(boincuser_lookup_uid($boincuser_id), TRUE); |
|
1123 | - $boincteam = boincteam_load($boincteam_id); |
|
1124 | - $admin_request = is_team_admin($boincuser, $boincteam) OR is_team_founder($boincuser, $boincteam); |
|
1119 | + )); |
|
1120 | + db_set_active('default'); |
|
1121 | + require_boinc('team'); |
|
1122 | + $boincuser = boincuser_load(boincuser_lookup_uid($boincuser_id), TRUE); |
|
1123 | + $boincteam = boincteam_load($boincteam_id); |
|
1124 | + $admin_request = is_team_admin($boincuser, $boincteam) OR is_team_founder($boincuser, $boincteam); |
|
1125 | 1125 | } |
1126 | 1126 | $members = array(); |
1127 | 1127 | db_set_active('boinc'); |
@@ -1131,18 +1131,18 @@ discard block |
||
1131 | 1131 | FROM {user} u |
1132 | 1132 | WHERE u.teamid = %d |
1133 | 1133 | ORDER BY u.email_addr ASC", |
1134 | - $boincteam_id |
|
1134 | + $boincteam_id |
|
1135 | 1135 | ); |
1136 | 1136 | db_set_active('default'); |
1137 | 1137 | |
1138 | 1138 | while ($member = db_fetch_object($result)) { |
1139 | - $members[] = user_load(array('mail' => $member->email_addr)); |
|
1139 | + $members[] = user_load(array('mail' => $member->email_addr)); |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | $xml = array('users' => array()); |
1143 | 1143 | foreach ($members as $member) { |
1144 | - $content_profile = content_profile_load('profile', $member->uid); |
|
1145 | - $team_member = array( |
|
1144 | + $content_profile = content_profile_load('profile', $member->uid); |
|
1145 | + $team_member = array( |
|
1146 | 1146 | 'id' => $member->boincuser_id, |
1147 | 1147 | 'cpid' => $member->boincuser_cpid, |
1148 | 1148 | 'create_time' => $member->created, |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | 'expavg_time' => $member->boincuser_expavg_time, |
1154 | 1154 | 'url' => $content_profile->field_url[0]['value'], |
1155 | 1155 | 'has_profile' => ($content_profile->status AND !$content_profile->moderate) ? 1 : 0, |
1156 | - ); |
|
1157 | - if ($admin_request) { |
|
1156 | + ); |
|
1157 | + if ($admin_request) { |
|
1158 | 1158 | $team_member['email_addr'] = $member->mail; |
1159 | - } |
|
1160 | - $xml['users']['user'][] = $team_member; |
|
1159 | + } |
|
1160 | + $xml['users']['user'][] = $team_member; |
|
1161 | 1161 | } |
1162 | - } |
|
1163 | - else { |
|
1162 | + } |
|
1163 | + else { |
|
1164 | 1164 | $xml = array( |
1165 | - 'error' => array( |
|
1165 | + 'error' => array( |
|
1166 | 1166 | 'error_num' => -136, |
1167 | 1167 | 'error_msg' => 'Not found', |
1168 | - ), |
|
1168 | + ), |
|
1169 | 1169 | ); |
1170 | - } |
|
1171 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1170 | + } |
|
1171 | + print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | /** |
@@ -1176,114 +1176,114 @@ discard block |
||
1176 | 1176 | * Edit the forum preferences for a given user |
1177 | 1177 | */ |
1178 | 1178 | function boinccore_edit_forum_preferences() { |
1179 | - // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1180 | - // relevant -- use Drupal data only |
|
1179 | + // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1180 | + // relevant -- use Drupal data only |
|
1181 | 1181 | |
1182 | - $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : NULL); |
|
1182 | + $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : NULL); |
|
1183 | 1183 | |
1184 | - require_boinc('boinc_db'); |
|
1185 | - $boincuser = BoincUser::lookup_auth($account_key); |
|
1186 | - if ($boincuser) { |
|
1184 | + require_boinc('boinc_db'); |
|
1185 | + $boincuser = BoincUser::lookup_auth($account_key); |
|
1186 | + if ($boincuser) { |
|
1187 | 1187 | $uid = boincuser_lookup_uid($boincuser->id); |
1188 | 1188 | if ($uid AND $account = user_load($uid)) { |
1189 | - // Currently supported preferences |
|
1190 | - $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : NULL); |
|
1191 | - $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : NULL); |
|
1192 | - $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : NULL); |
|
1193 | - $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : NULL); |
|
1194 | - // Update preferences as needed |
|
1195 | - if ($avatar_url) { |
|
1189 | + // Currently supported preferences |
|
1190 | + $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : NULL); |
|
1191 | + $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : NULL); |
|
1192 | + $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : NULL); |
|
1193 | + $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : NULL); |
|
1194 | + // Update preferences as needed |
|
1195 | + if ($avatar_url) { |
|
1196 | 1196 | $avatar_image = file_get_contents($avatar_url); |
1197 | 1197 | if ($avatar_image) { |
1198 | - $image_dir = 'profiles'; |
|
1199 | - $image_path = "{$image_dir}/{$boincuser->id}_avatar.jpg"; |
|
1200 | - $file = file_save_data($avatar_image, $image_path, FILE_EXISTS_REPLACE); |
|
1201 | - if ($file) { |
|
1198 | + $image_dir = 'profiles'; |
|
1199 | + $image_path = "{$image_dir}/{$boincuser->id}_avatar.jpg"; |
|
1200 | + $file = file_save_data($avatar_image, $image_path, FILE_EXISTS_REPLACE); |
|
1201 | + if ($file) { |
|
1202 | 1202 | $profile = new stdClass(); |
1203 | 1203 | $profile->type = 'profile'; |
1204 | 1204 | $profile->language = NULL; |
1205 | 1205 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1206 | - $profile_node = node_load($profile_nid); |
|
1207 | - if ($profile_node) { |
|
1206 | + $profile_node = node_load($profile_nid); |
|
1207 | + if ($profile_node) { |
|
1208 | 1208 | $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
1209 | 1209 | if ($avatar_image) { |
1210 | - $profile_node->field_image[0] = $avatar_image; |
|
1211 | - node_save($profile_node); |
|
1210 | + $profile_node->field_image[0] = $avatar_image; |
|
1211 | + node_save($profile_node); |
|
1212 | 1212 | } |
1213 | 1213 | else { |
1214 | - $error = 'Error saving avatar to profile'; |
|
1214 | + $error = 'Error saving avatar to profile'; |
|
1215 | + } |
|
1215 | 1216 | } |
1216 | - } |
|
1217 | - else { |
|
1217 | + else { |
|
1218 | 1218 | $error = 'Unable to load user profile'; |
1219 | - } |
|
1219 | + } |
|
1220 | 1220 | } |
1221 | 1221 | else { |
1222 | - $error = 'User has no profile, so avatar could not be added'; |
|
1222 | + $error = 'User has no profile, so avatar could not be added'; |
|
1223 | + } |
|
1223 | 1224 | } |
1224 | - } |
|
1225 | - else { |
|
1225 | + else { |
|
1226 | 1226 | $error = 'Unable to save remote image'; |
1227 | - } |
|
1227 | + } |
|
1228 | 1228 | } |
1229 | 1229 | else { |
1230 | - $error = 'Could not find avatar image at URL'; |
|
1230 | + $error = 'Could not find avatar image at URL'; |
|
1231 | 1231 | } |
1232 | - } |
|
1233 | - if ($hide_signatures !== NULL) { |
|
1232 | + } |
|
1233 | + if ($hide_signatures !== NULL) { |
|
1234 | 1234 | user_save($account, array('hide_signatures' => ($hide_signatures ? 1 : 0))); |
1235 | - } |
|
1236 | - if ($signature !== NULL) { |
|
1235 | + } |
|
1236 | + if ($signature !== NULL) { |
|
1237 | 1237 | $signature = check_markup($signature); |
1238 | 1238 | user_save($account, array('signature' => $signature)); |
1239 | - } |
|
1240 | - if ($post_order) { |
|
1239 | + } |
|
1240 | + if ($post_order) { |
|
1241 | 1241 | require_boinc('forum'); |
1242 | 1242 | $post_order_map = array( |
1243 | - CREATE_TIME_OLD => 2, |
|
1244 | - CREATE_TIME_NEW => 1, |
|
1243 | + CREATE_TIME_OLD => 2, |
|
1244 | + CREATE_TIME_NEW => 1, |
|
1245 | 1245 | ); |
1246 | 1246 | $drupal_post_order = isset($post_order_map[$post_order]) ? $post_order_map[$post_order] : 2; |
1247 | 1247 | user_save($account, array('sort' => $drupal_post_order)); |
1248 | - } |
|
1249 | - if (!$error) { |
|
1248 | + } |
|
1249 | + if (!$error) { |
|
1250 | 1250 | // Success |
1251 | 1251 | $xml = array( |
1252 | - 'edit_forum_preferences' => array( |
|
1252 | + 'edit_forum_preferences' => array( |
|
1253 | 1253 | 'success' => NULL, |
1254 | - ), |
|
1254 | + ), |
|
1255 | 1255 | ); |
1256 | - } |
|
1257 | - else { |
|
1256 | + } |
|
1257 | + else { |
|
1258 | 1258 | // Failure |
1259 | 1259 | $xml = array( |
1260 | - 'error' => array( |
|
1260 | + 'error' => array( |
|
1261 | 1261 | 'error_num' => -1, |
1262 | 1262 | 'error_msg' => $error, |
1263 | - ), |
|
1263 | + ), |
|
1264 | 1264 | ); |
1265 | - } |
|
1265 | + } |
|
1266 | 1266 | } |
1267 | 1267 | else { |
1268 | - // Drupal user not found |
|
1269 | - $xml = array( |
|
1268 | + // Drupal user not found |
|
1269 | + $xml = array( |
|
1270 | 1270 | 'error' => array( |
1271 | - 'error_num' => -1, |
|
1272 | - 'error_msg' => 'Unknown error', |
|
1271 | + 'error_num' => -1, |
|
1272 | + 'error_msg' => 'Unknown error', |
|
1273 | 1273 | ), |
1274 | - ); |
|
1274 | + ); |
|
1275 | 1275 | } |
1276 | - } |
|
1277 | - else { |
|
1276 | + } |
|
1277 | + else { |
|
1278 | 1278 | // BOINC user not found |
1279 | 1279 | $xml = array( |
1280 | - 'error' => array( |
|
1280 | + 'error' => array( |
|
1281 | 1281 | 'error_num' => -136, |
1282 | 1282 | 'error_msg' => 'Not found', |
1283 | - ), |
|
1283 | + ), |
|
1284 | 1284 | ); |
1285 | - } |
|
1286 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1285 | + } |
|
1286 | + print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | /** |
@@ -1291,14 +1291,14 @@ discard block |
||
1291 | 1291 | * Get the last comments OR threads made by a given user |
1292 | 1292 | */ |
1293 | 1293 | function boinccore_forum_get_data() { |
1294 | - // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1295 | - // relevant -- use Drupal data only |
|
1294 | + // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1295 | + // relevant -- use Drupal data only |
|
1296 | 1296 | |
1297 | - $xml = array(); |
|
1298 | - $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : NULL); |
|
1299 | - $uid = boincuser_lookup_uid($boinc_id); |
|
1297 | + $xml = array(); |
|
1298 | + $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : NULL); |
|
1299 | + $uid = boincuser_lookup_uid($boinc_id); |
|
1300 | 1300 | |
1301 | - if ($uid) { |
|
1301 | + if ($uid) { |
|
1302 | 1302 | $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : NULL); |
1303 | 1303 | $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : NULL); |
1304 | 1304 | if (!$count) $count = 10; |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | switch ($method) { |
1307 | 1307 | case 'user_posts': |
1308 | 1308 | $content_length = !empty($_POST['content_length']) ? $_POST['content_length'] : (!empty($_GET['content_length']) ? $_GET['content_length'] : NULL); |
1309 | - $posts = db_query(" |
|
1309 | + $posts = db_query(" |
|
1310 | 1310 | SELECT |
1311 | 1311 | c.cid, |
1312 | 1312 | n.nid, |
@@ -1320,26 +1320,26 @@ discard block |
||
1320 | 1320 | ORDER BY timestamp DESC |
1321 | 1321 | LIMIT %d", |
1322 | 1322 | $uid, (int) $count |
1323 | - ); |
|
1324 | - $xml = array( |
|
1323 | + ); |
|
1324 | + $xml = array( |
|
1325 | 1325 | 'rpc_response' => array( |
1326 | - 'count' => 0, |
|
1327 | - 'posts' => array(), |
|
1326 | + 'count' => 0, |
|
1327 | + 'posts' => array(), |
|
1328 | 1328 | ), |
1329 | - ); |
|
1330 | - $post_count = 0; |
|
1331 | - while ($post = db_fetch_object($posts)) { |
|
1329 | + ); |
|
1330 | + $post_count = 0; |
|
1331 | + while ($post = db_fetch_object($posts)) { |
|
1332 | 1332 | $xml['rpc_response']['posts']['post'][] = array( |
1333 | - 'id' => $post->cid, |
|
1334 | - 'threadid' => $post->nid, |
|
1335 | - 'threadtitle' => $post->title, |
|
1336 | - 'timestamp' => $post->timestamp, |
|
1337 | - 'content' => ($content_length ? substr($post->comment, 0, $content_length) : $post->comment), |
|
1333 | + 'id' => $post->cid, |
|
1334 | + 'threadid' => $post->nid, |
|
1335 | + 'threadtitle' => $post->title, |
|
1336 | + 'timestamp' => $post->timestamp, |
|
1337 | + 'content' => ($content_length ? substr($post->comment, 0, $content_length) : $post->comment), |
|
1338 | 1338 | ); |
1339 | 1339 | $post_count++; |
1340 | - } |
|
1341 | - $xml['rpc_response']['count'] = $post_count; |
|
1342 | - break; |
|
1340 | + } |
|
1341 | + $xml['rpc_response']['count'] = $post_count; |
|
1342 | + break; |
|
1343 | 1343 | |
1344 | 1344 | case 'user_threads': |
1345 | 1345 | $threads = db_query(" |
@@ -1363,45 +1363,45 @@ discard block |
||
1363 | 1363 | ORDER BY changed DESC |
1364 | 1364 | LIMIT %d", |
1365 | 1365 | $uid, (int) $count |
1366 | - ); |
|
1367 | - $xml = array( |
|
1366 | + ); |
|
1367 | + $xml = array( |
|
1368 | 1368 | 'rpc_response' => array( |
1369 | - 'count' => 0, |
|
1370 | - 'threads' => array(), |
|
1369 | + 'count' => 0, |
|
1370 | + 'threads' => array(), |
|
1371 | 1371 | ), |
1372 | - ); |
|
1373 | - $thread_count = 0; |
|
1374 | - while ($thread = db_fetch_object($threads)) { |
|
1372 | + ); |
|
1373 | + $thread_count = 0; |
|
1374 | + while ($thread = db_fetch_object($threads)) { |
|
1375 | 1375 | $xml['rpc_response']['threads']['thread'][] = array( |
1376 | - 'id' => $thread->nid, |
|
1377 | - 'forumid' => $thread->tid, |
|
1378 | - 'replies' => $thread->replies, |
|
1379 | - 'views' => $thread->views, |
|
1380 | - 'timestamp' => $thread->changed, |
|
1381 | - 'title' => $thread->title, |
|
1376 | + 'id' => $thread->nid, |
|
1377 | + 'forumid' => $thread->tid, |
|
1378 | + 'replies' => $thread->replies, |
|
1379 | + 'views' => $thread->views, |
|
1380 | + 'timestamp' => $thread->changed, |
|
1381 | + 'title' => $thread->title, |
|
1382 | 1382 | ); |
1383 | 1383 | $thread_count++; |
1384 | - } |
|
1385 | - $xml['rpc_response']['count'] = $thread_count; |
|
1386 | - break; |
|
1384 | + } |
|
1385 | + $xml['rpc_response']['count'] = $thread_count; |
|
1386 | + break; |
|
1387 | 1387 | default: |
1388 | 1388 | $xml = array( |
1389 | 1389 | 'error' => array( |
1390 | - 'error_num' => -1, |
|
1391 | - 'error_msg' => 'Unknown error', |
|
1390 | + 'error_num' => -1, |
|
1391 | + 'error_msg' => 'Unknown error', |
|
1392 | 1392 | ), |
1393 | - ); |
|
1393 | + ); |
|
1394 | 1394 | } |
1395 | - } |
|
1396 | - else { |
|
1395 | + } |
|
1396 | + else { |
|
1397 | 1397 | $xml = array( |
1398 | - 'error' => array( |
|
1398 | + 'error' => array( |
|
1399 | 1399 | 'error_num' => -136, |
1400 | 1400 | 'error_msg' => 'Not found', |
1401 | - ), |
|
1401 | + ), |
|
1402 | 1402 | ); |
1403 | - } |
|
1404 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1403 | + } |
|
1404 | + print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | /** |
@@ -1409,9 +1409,9 @@ discard block |
||
1409 | 1409 | * Get information on applications in the system |
1410 | 1410 | */ |
1411 | 1411 | function boinccore_apps() { |
1412 | - // Remove q from the GET request or BOINC will panic |
|
1413 | - unset($_GET['q']); |
|
1414 | - include_boinc('user/apps.php'); |
|
1412 | + // Remove q from the GET request or BOINC will panic |
|
1413 | + unset($_GET['q']); |
|
1414 | + include_boinc('user/apps.php'); |
|
1415 | 1415 | } |
1416 | 1416 | |
1417 | 1417 | /** |
@@ -1421,141 +1421,141 @@ discard block |
||
1421 | 1421 | * controller function, which can compute the page based on the user's settings |
1422 | 1422 | */ |
1423 | 1423 | function boinccore_url_pagination_handler($type, $object_id = NULL) { |
1424 | - global $user; |
|
1425 | - $path = NULL; |
|
1426 | - $params = array(); |
|
1427 | - switch ($type) { |
|
1428 | - case 'boinc-forum': |
|
1424 | + global $user; |
|
1425 | + $path = NULL; |
|
1426 | + $params = array(); |
|
1427 | + switch ($type) { |
|
1428 | + case 'boinc-forum': |
|
1429 | 1429 | // Redirect requests to a BOINC forum to the Drupal forum |
1430 | 1430 | $forum_id = db_result(db_query(' |
1431 | 1431 | SELECT tid |
1432 | 1432 | FROM {boincimport_temp_forum} |
1433 | 1433 | WHERE forum_id = %d', |
1434 | - $object_id |
|
1434 | + $object_id |
|
1435 | 1435 | )); |
1436 | 1436 | if ($forum_id) { |
1437 | - drupal_goto("community/forum/{$forum_id}"); |
|
1437 | + drupal_goto("community/forum/{$forum_id}"); |
|
1438 | 1438 | } |
1439 | 1439 | break; |
1440 | - case 'boinc-forum-index': |
|
1440 | + case 'boinc-forum-index': |
|
1441 | 1441 | // Redirect requests to the top level BOINC forum to Drupal forums |
1442 | 1442 | drupal_goto("community/forum"); |
1443 | 1443 | break; |
1444 | - case 'boinc-forum-post': |
|
1444 | + case 'boinc-forum-post': |
|
1445 | 1445 | // Redirect requests to a BOINC forum post to the Drupal comment |
1446 | 1446 | $cid = db_result(db_query(' |
1447 | 1447 | SELECT cid |
1448 | 1448 | FROM {boincimport_temp_post} |
1449 | 1449 | WHERE post_id = %d', |
1450 | - $object_id |
|
1450 | + $object_id |
|
1451 | 1451 | )); |
1452 | 1452 | if ($cid) { |
1453 | - drupal_goto("goto/comment/{$cid}"); |
|
1453 | + drupal_goto("goto/comment/{$cid}"); |
|
1454 | 1454 | } |
1455 | 1455 | break; |
1456 | - case 'boinc-forum-topic': |
|
1456 | + case 'boinc-forum-topic': |
|
1457 | 1457 | // Redirect requests to a BOINC forum topic to the Drupal node |
1458 | 1458 | $nid = db_result(db_query(' |
1459 | 1459 | SELECT nid |
1460 | 1460 | FROM {boincimport_temp_topic} |
1461 | 1461 | WHERE topic_id = %d', |
1462 | - $object_id |
|
1462 | + $object_id |
|
1463 | 1463 | )); |
1464 | 1464 | if ($nid) { |
1465 | - drupal_goto("node/{$nid}"); |
|
1465 | + drupal_goto("node/{$nid}"); |
|
1466 | 1466 | } |
1467 | 1467 | break; |
1468 | - case 'boinc-host': |
|
1468 | + case 'boinc-host': |
|
1469 | 1469 | // Redirect requests to BOINC host details to the host page in Drupal |
1470 | 1470 | drupal_goto("host/{$object_id}"); |
1471 | 1471 | break; |
1472 | - case 'boinc-hosts-user': |
|
1472 | + case 'boinc-hosts-user': |
|
1473 | 1473 | // Redirect requests to a BOINC user host list to the host list in Drupal |
1474 | 1474 | $uid = boincuser_lookup_uid($object_id); |
1475 | 1475 | if ($uid) { |
1476 | - drupal_goto("account/{$uid}/computers"); |
|
1476 | + drupal_goto("account/{$uid}/computers"); |
|
1477 | 1477 | } |
1478 | 1478 | break; |
1479 | - case 'boinc-result': |
|
1479 | + case 'boinc-result': |
|
1480 | 1480 | // Redirect requests to BOINC task details to the task page in Drupal |
1481 | 1481 | drupal_goto("task/{$object_id}"); |
1482 | - case 'boinc-results-host': |
|
1482 | + case 'boinc-results-host': |
|
1483 | 1483 | // Redirect requests to BOINC tasks by host to the host task page in Drupal |
1484 | 1484 | drupal_goto("host/{$object_id}/tasks"); |
1485 | 1485 | break; |
1486 | - case 'boinc-results-user': |
|
1486 | + case 'boinc-results-user': |
|
1487 | 1487 | // Redirect requests to a BOINC user's tasks to the Drupal account tasks |
1488 | 1488 | drupal_goto("account/tasks"); |
1489 | 1489 | break; |
1490 | - case 'boinc-user': |
|
1490 | + case 'boinc-user': |
|
1491 | 1491 | // Redirect requests to a BOINC user ID to the Drupal profile |
1492 | 1492 | $uid = boincuser_lookup_uid($object_id); |
1493 | 1493 | if ($uid) { |
1494 | - drupal_goto("account/{$uid}"); |
|
1494 | + drupal_goto("account/{$uid}"); |
|
1495 | 1495 | } |
1496 | 1496 | break; |
1497 | - case 'boinc-workunit': |
|
1497 | + case 'boinc-workunit': |
|
1498 | 1498 | // Redirect requests to BOINC workunits to the workunit page in Drupal |
1499 | 1499 | drupal_goto("workunit/{$object_id}"); |
1500 | 1500 | break; |
1501 | - case 'comment': |
|
1501 | + case 'comment': |
|
1502 | 1502 | $object = _comment_load($object_id); |
1503 | 1503 | if ($object) { |
1504 | - $path = "node/{$object->nid}"; |
|
1505 | - // Get the sort order |
|
1506 | - $gt_lt = '<'; |
|
1507 | - $comment_order = (isset($user->sort)) ? $user->sort : variable_get('comment_default_order_forum', 2); |
|
1508 | - if ($comment_order == COMMENT_ORDER_NEWEST_FIRST) { |
|
1504 | + $path = "node/{$object->nid}"; |
|
1505 | + // Get the sort order |
|
1506 | + $gt_lt = '<'; |
|
1507 | + $comment_order = (isset($user->sort)) ? $user->sort : variable_get('comment_default_order_forum', 2); |
|
1508 | + if ($comment_order == COMMENT_ORDER_NEWEST_FIRST) { |
|
1509 | 1509 | $gt_lt = '>'; |
1510 | - } |
|
1511 | - // See how many comments there are before (or after) this comment... |
|
1512 | - $comment_offset = db_result(db_query(' |
|
1510 | + } |
|
1511 | + // See how many comments there are before (or after) this comment... |
|
1512 | + $comment_offset = db_result(db_query(' |
|
1513 | 1513 | SELECT COUNT(*) FROM {comments} |
1514 | 1514 | WHERE nid = %d AND status = 0 AND timestamp %s %d', |
1515 | 1515 | $object->nid, $gt_lt, $object->timestamp)); |
1516 | - if ($comment_offset) { |
|
1516 | + if ($comment_offset) { |
|
1517 | 1517 | // Get the number of comments per page |
1518 | 1518 | if ($user->comments_per_page) { |
1519 | - $comments_per_page = $user->comments_per_page; |
|
1519 | + $comments_per_page = $user->comments_per_page; |
|
1520 | 1520 | } |
1521 | 1521 | else { |
1522 | - $node = node_load($object->nid); |
|
1523 | - $comments_per_page = variable_get( |
|
1522 | + $node = node_load($object->nid); |
|
1523 | + $comments_per_page = variable_get( |
|
1524 | 1524 | "comment_default_per_page_{$node->type}", 50 |
1525 | - ); |
|
1525 | + ); |
|
1526 | 1526 | } |
1527 | 1527 | // Determine which page to display in order to show the given comment |
1528 | 1528 | $page = floor($comment_offset / $comments_per_page); |
1529 | 1529 | if ($page) { |
1530 | - $params = array('page' => $page); |
|
1530 | + $params = array('page' => $page); |
|
1531 | + } |
|
1531 | 1532 | } |
1532 | - } |
|
1533 | 1533 | } |
1534 | 1534 | if ($path) { |
1535 | - drupal_goto($path, $params, "comment-{$object->cid}"); |
|
1535 | + drupal_goto($path, $params, "comment-{$object->cid}"); |
|
1536 | 1536 | } |
1537 | 1537 | break; |
1538 | - case 'friend-requests': |
|
1538 | + case 'friend-requests': |
|
1539 | 1539 | // Check for a login, then redirect to the user's friend requests page |
1540 | 1540 | if ($user->uid) { |
1541 | - drupal_goto("account/{$user->uid}/friends/pending"); |
|
1541 | + drupal_goto("account/{$user->uid}/friends/pending"); |
|
1542 | 1542 | } |
1543 | 1543 | else { |
1544 | - drupal_goto('user/login', array( |
|
1544 | + drupal_goto('user/login', array( |
|
1545 | 1545 | 'destination' => 'goto/friend-requests' |
1546 | - )); |
|
1546 | + )); |
|
1547 | 1547 | } |
1548 | 1548 | break; |
1549 | - default: |
|
1549 | + default: |
|
1550 | 1550 | } |
1551 | - drupal_not_found(); |
|
1551 | + drupal_not_found(); |
|
1552 | 1552 | } |
1553 | 1553 | |
1554 | 1554 | /* |
1555 | 1555 | * Fetch an array of all countries |
1556 | 1556 | */ |
1557 | 1557 | function boinccore_get_country_list() { |
1558 | - return array( |
|
1558 | + return array( |
|
1559 | 1559 | 'None' => 'None', |
1560 | 1560 | 'International' => 'International', |
1561 | 1561 | 'Afghanistan' => 'Afghanistan', |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | 'Yemen' => 'Yemen', |
1790 | 1790 | 'Zambia' => 'Zambia', |
1791 | 1791 | 'Zimbabwe' => 'Zimbabwe', |
1792 | - ); |
|
1792 | + ); |
|
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | |
@@ -1797,79 +1797,79 @@ discard block |
||
1797 | 1797 | * Action: Mark node for moderation |
1798 | 1798 | */ |
1799 | 1799 | function boinccore_rules_action_mark_content_for_moderation($node) { |
1800 | - $node->moderate = 1; |
|
1801 | - return array('node' => $node); |
|
1800 | + $node->moderate = 1; |
|
1801 | + return array('node' => $node); |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | 1804 | /** |
1805 | 1805 | * Action: Send mail to moderators. |
1806 | 1806 | */ |
1807 | 1807 | function boinccore_rules_action_mail_to_moderators($settings) { |
1808 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
1809 | - $mailing_list = variable_get('boinc_moderator_mailing_list', ''); |
|
1810 | - $force_individual_notifications = variable_get('boinc_moderator_force_individual_notifications', 0); |
|
1808 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
1809 | + $mailing_list = variable_get('boinc_moderator_mailing_list', ''); |
|
1810 | + $force_individual_notifications = variable_get('boinc_moderator_force_individual_notifications', 0); |
|
1811 | 1811 | |
1812 | - if (!$mailing_list OR $force_individual_notifications) { |
|
1812 | + if (!$mailing_list OR $force_individual_notifications) { |
|
1813 | 1813 | // Send individual emails to all moderators |
1814 | 1814 | $roles = user_roles(); |
1815 | 1815 | $moderator_rid = array_search('moderator', $roles); |
1816 | 1816 | if ($moderator_rid !== FALSE) { |
1817 | - $settings['recipients'] = array($moderator_rid); |
|
1818 | - rules_action_mail_to_users_of_role($settings); |
|
1817 | + $settings['recipients'] = array($moderator_rid); |
|
1818 | + rules_action_mail_to_users_of_role($settings); |
|
1819 | 1819 | } |
1820 | 1820 | else { |
1821 | - watchdog( |
|
1821 | + watchdog( |
|
1822 | 1822 | 'boinccore', |
1823 | 1823 | 'Unable to identify members of the moderator role to send moderator notifications!', |
1824 | 1824 | array(), |
1825 | 1825 | WATCHDOG_ERROR |
1826 | - ); |
|
1826 | + ); |
|
1827 | 1827 | } |
1828 | - } |
|
1829 | - if ($mailing_list) { |
|
1828 | + } |
|
1829 | + if ($mailing_list) { |
|
1830 | 1830 | $settings['to'] = $mailing_list; |
1831 | 1831 | rules_action_mail($settings); |
1832 | - } |
|
1832 | + } |
|
1833 | 1833 | } |
1834 | 1834 | /** |
1835 | 1835 | * Action "Send mail to moderators" configuration form |
1836 | 1836 | */ |
1837 | 1837 | function boinccore_rules_action_mail_to_moderators_form($settings = array(), &$form) { |
1838 | - // Select only non-anonymous user roles because anonymous users won't have emails. |
|
1839 | - rules_action_mail_to_user_form($settings, $form); |
|
1838 | + // Select only non-anonymous user roles because anonymous users won't have emails. |
|
1839 | + rules_action_mail_to_user_form($settings, $form); |
|
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | /* |
1843 | 1843 | * BOINC wrapper for string translation |
1844 | 1844 | */ |
1845 | 1845 | function bts($string, $args = array(), $langcode = NULL, $context = 'boinc: ', $update = TRUE) { |
1846 | - if (function_exists('i18nstrings_ts')) { |
|
1846 | + if (function_exists('i18nstrings_ts')) { |
|
1847 | 1847 | $string = i18nstrings_ts($context, $string, $langcode, $update); |
1848 | - } |
|
1849 | - if (empty($args)) { |
|
1848 | + } |
|
1849 | + if (empty($args)) { |
|
1850 | 1850 | return $string; |
1851 | - } |
|
1852 | - else { |
|
1851 | + } |
|
1852 | + else { |
|
1853 | 1853 | // Transform arguments before inserting them. |
1854 | 1854 | foreach ($args as $key => $value) { |
1855 | - switch ($key [0]) { |
|
1855 | + switch ($key [0]) { |
|
1856 | 1856 | case '@': |
1857 | 1857 | // Escaped only. |
1858 | 1858 | $args [$key] = check_plain($value); |
1859 | - break; |
|
1859 | + break; |
|
1860 | 1860 | |
1861 | 1861 | case '%': |
1862 | 1862 | default: |
1863 | 1863 | // Escaped and placeholder. |
1864 | 1864 | $args [$key] = theme('placeholder', $value); |
1865 | - break; |
|
1865 | + break; |
|
1866 | 1866 | |
1867 | 1867 | case '!': |
1868 | 1868 | // Pass-through. |
1869 | 1869 | } |
1870 | 1870 | } |
1871 | 1871 | return strtr($string, $args); |
1872 | - } |
|
1872 | + } |
|
1873 | 1873 | } |
1874 | 1874 | |
1875 | 1875 | |
@@ -1881,9 +1881,9 @@ discard block |
||
1881 | 1881 | * Overview of moderation queues |
1882 | 1882 | */ |
1883 | 1883 | function boinccore_moderation_overview_panel() { |
1884 | - $output = '<h2 class="pane-title">' . bts('Moderation') . '</h2>'; |
|
1885 | - $output .= '<ul class="tab-list action-list">'; |
|
1886 | - if (module_exists('user_profiles')) { |
|
1884 | + $output = '<h2 class="pane-title">' . bts('Moderation') . '</h2>'; |
|
1885 | + $output .= '<ul class="tab-list action-list">'; |
|
1886 | + if (module_exists('user_profiles')) { |
|
1887 | 1887 | $profile_count = db_result(db_query(" |
1888 | 1888 | SELECT COUNT(DISTINCT(n.nid)) |
1889 | 1889 | FROM {node} n |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | $output .= '<span class="item-count">' . $profile_count . '</span>'; |
1896 | 1896 | $output .= '</div>'; |
1897 | 1897 | $output .= '</li>'; |
1898 | - } |
|
1899 | - $output .= '</ul>'; |
|
1900 | - return $output; |
|
1898 | + } |
|
1899 | + $output .= '</ul>'; |
|
1900 | + return $output; |
|
1901 | 1901 | } |
@@ -551,12 +551,12 @@ discard block |
||
551 | 551 | */ |
552 | 552 | function boinccore_locale($op = 'groups', $group = NULL) { |
553 | 553 | switch ($op) { |
554 | - case 'groups': |
|
555 | - return array('boinc' => bts('BOINC')); |
|
556 | - case 'info': |
|
557 | - //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
|
558 | - $info['boinc']['format'] = FALSE; |
|
559 | - return $info; |
|
554 | + case 'groups': |
|
555 | + return array('boinc' => bts('BOINC')); |
|
556 | + case 'info': |
|
557 | + //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
|
558 | + $info['boinc']['format'] = FALSE; |
|
559 | + return $info; |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
@@ -1853,19 +1853,19 @@ discard block |
||
1853 | 1853 | // Transform arguments before inserting them. |
1854 | 1854 | foreach ($args as $key => $value) { |
1855 | 1855 | switch ($key [0]) { |
1856 | - case '@': |
|
1857 | - // Escaped only. |
|
1858 | - $args [$key] = check_plain($value); |
|
1859 | - break; |
|
1856 | + case '@': |
|
1857 | + // Escaped only. |
|
1858 | + $args [$key] = check_plain($value); |
|
1859 | + break; |
|
1860 | 1860 | |
1861 | - case '%': |
|
1862 | - default: |
|
1863 | - // Escaped and placeholder. |
|
1864 | - $args [$key] = theme('placeholder', $value); |
|
1865 | - break; |
|
1861 | + case '%': |
|
1862 | + default: |
|
1863 | + // Escaped and placeholder. |
|
1864 | + $args [$key] = theme('placeholder', $value); |
|
1865 | + break; |
|
1866 | 1866 | |
1867 | - case '!': |
|
1868 | - // Pass-through. |
|
1867 | + case '!': |
|
1868 | + // Pass-through. |
|
1869 | 1869 | } |
1870 | 1870 | } |
1871 | 1871 | return strtr($string, $args); |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | // RFC2616 mandates that the decimal part is no more than three digits, |
263 | 263 | // so we multiply the qvalue by 1000 to avoid floating point comparisons. |
264 | 264 | $langcode = strtolower($match[1]); |
265 | - $qvalue = isset($match[2]) ? (float) $match[2] : 1; |
|
266 | - $browser_langcodes[$langcode] = (int) ($qvalue * 1000); |
|
265 | + $qvalue = isset($match[2]) ? (float)$match[2] : 1; |
|
266 | + $browser_langcodes[$langcode] = (int)($qvalue*1000); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | global $base_url; |
329 | 329 | global $base_path; |
330 | 330 | $site_name = variable_get('site_name', bts('project')); |
331 | - $site_url = $base_url . $base_path; |
|
331 | + $site_url = $base_url.$base_path; |
|
332 | 332 | $settings = array( |
333 | 333 | 'from' => '', |
334 | 334 | 'subject' => "Content at {$site_name} is awaiting moderation", |
@@ -380,11 +380,11 @@ discard block |
||
380 | 380 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
381 | 381 | } |
382 | 382 | elseif (is_string($user_image)) { |
383 | - $user_info .= '<img src="' . $user_image . '"/>'; |
|
383 | + $user_info .= '<img src="'.$user_image.'"/>'; |
|
384 | 384 | } |
385 | 385 | $user_info .= ' </div>'; |
386 | 386 | } |
387 | - $user_info .= ' <div class="name">' . theme('username', $account) . '</div>'; |
|
387 | + $user_info .= ' <div class="name">'.theme('username', $account).'</div>'; |
|
388 | 388 | if ($account->uid) { |
389 | 389 | //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
390 | 390 | //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $form['buttons']['preview']['#suffix'] = '</li>'; |
449 | 449 | $form['buttons']['preview']['#weight'] = 1003; |
450 | 450 | $form['buttons']['cancel'] = array( |
451 | - '#value' => '<li class="tab">' . l(bts('Cancel'), $cancel_url) . '</li>', |
|
451 | + '#value' => '<li class="tab">'.l(bts('Cancel'), $cancel_url).'</li>', |
|
452 | 452 | '#weight' => 1004, |
453 | 453 | ); |
454 | 454 | $form['buttons']['form control tabs suffix'] = array( |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
487 | 487 | $form['buttons']['preview_changes']['#weight'] = 1004; |
488 | 488 | $form['buttons']['cancel'] = array( |
489 | - '#value' => '<li class="tab">' . l(bts('Cancel'), "community/forum/{$forum_id}") . '</li>', |
|
489 | + '#value' => '<li class="tab">'.l(bts('Cancel'), "community/forum/{$forum_id}").'</li>', |
|
490 | 490 | '#weight' => 1005, |
491 | 491 | ); |
492 | 492 | $form['buttons']['form control tabs suffix'] = array( |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | function boinccore_link($type, $object, $teaser = FALSE) { |
568 | 568 | // Add custom links with this hook |
569 | 569 | |
570 | - if ($type=='node') { |
|
571 | - if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
|
570 | + if ($type == 'node') { |
|
571 | + if (($object->type == 'forum') OR ($object->type == 'team_forum')) { |
|
572 | 572 | // Add topic moderator controls |
573 | 573 | if (user_access('edit any forum topic')) { |
574 | 574 | $node_control = "node_control/{$object->nid}"; |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | }// if user_access('edit any forum topic') |
630 | 630 | } |
631 | 631 | } |
632 | - else if ($type=='comment') { |
|
632 | + else if ($type == 'comment') { |
|
633 | 633 | $node = node_load($object->nid); |
634 | 634 | $nid = $object->nid; |
635 | 635 | $cid = $object->cid; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | if (user_access('administer comments')) { |
652 | 652 | $comment_control = "comment_control/{$cid}"; |
653 | 653 | // Add link to convert comment into a new topic |
654 | - $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
654 | + $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid)); |
|
655 | 655 | if ($reply_count == 0) { |
656 | 656 | $links['convert'] = array( |
657 | 657 | 'title' => bts('Convert'), |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | $node->created = $comment->timestamp; |
767 | 767 | $node->changed = $node->created; |
768 | 768 | $node->promote = 0; // Display on front page? |
769 | - $node->sticky = 0; // Display top of page? |
|
770 | - $node->status = 1; // Published? |
|
769 | + $node->sticky = 0; // Display top of page? |
|
770 | + $node->status = 1; // Published? |
|
771 | 771 | $node->comment = 2; |
772 | 772 | //$node->language = 'en'; |
773 | 773 | $node->uid = $comment->uid; |
@@ -850,16 +850,16 @@ discard block |
||
850 | 850 | $xml->loadXML($global_prefs, LIBXML_NOBLANKS); |
851 | 851 | if ($errors = libxml_get_errors($xml)) { |
852 | 852 | $lines = explode("\r", $global_prefs); |
853 | - watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
854 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
853 | + watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}". |
|
854 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | elseif ($project_prefs) { |
858 | 858 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
859 | 859 | if ($errors = libxml_get_errors($xml)) { |
860 | 860 | $lines = explode("\r", $project_prefs); |
861 | - watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
862 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
861 | + watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}". |
|
862 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | if (!$errors) { |
@@ -902,8 +902,8 @@ discard block |
||
902 | 902 | $xml = array( |
903 | 903 | 'error' => array( |
904 | 904 | 'error_num' => -112, |
905 | - 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}" . |
|
906 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]) |
|
905 | + 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}". |
|
906 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]) |
|
907 | 907 | ), |
908 | 908 | ); |
909 | 909 | } |
@@ -1011,10 +1011,10 @@ discard block |
||
1011 | 1011 | 'teaser' => $teaser, |
1012 | 1012 | 'uid' => $team_owner_uid, |
1013 | 1013 | 'path' => null, |
1014 | - 'status' => 1, // published or not - always publish |
|
1014 | + 'status' => 1, // published or not - always publish |
|
1015 | 1015 | 'promote' => 0, |
1016 | 1016 | 'created' => $created_time, |
1017 | - 'comment' => 0, // comments disabled |
|
1017 | + 'comment' => 0, // comments disabled |
|
1018 | 1018 | 'moderate' => 0, |
1019 | 1019 | 'sticky' => 0, |
1020 | 1020 | 'format' => $input_format |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | module_load_include('inc', 'pathauto', 'pathauto'); |
1026 | 1026 | $node['path'] = pathauto_cleanstring($values['name']); |
1027 | 1027 | |
1028 | - $node = (object) $node; // node_save requires an object form |
|
1028 | + $node = (object)$node; // node_save requires an object form |
|
1029 | 1029 | $team_categories = taxonomy_get_term_by_name($values['type']); |
1030 | 1030 | $node->taxonomy[] = $team_categories[0]; |
1031 | 1031 | |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1206 | 1206 | $profile_node = node_load($profile_nid); |
1207 | 1207 | if ($profile_node) { |
1208 | - $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
|
1208 | + $avatar_image = get_cck_image_object(file_directory_path().'/'.$image_path, 'field_image', 'profile', TRUE); |
|
1209 | 1209 | if ($avatar_image) { |
1210 | 1210 | $profile_node->field_image[0] = $avatar_image; |
1211 | 1211 | node_save($profile_node); |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | WHERE (n.status = 1) AND (c.uid = '%d') |
1320 | 1320 | ORDER BY timestamp DESC |
1321 | 1321 | LIMIT %d", |
1322 | - $uid, (int) $count |
|
1322 | + $uid, (int)$count |
|
1323 | 1323 | ); |
1324 | 1324 | $xml = array( |
1325 | 1325 | 'rpc_response' => array( |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | WHERE (n.status = 1) AND (n.uid = '%d') |
1363 | 1363 | ORDER BY changed DESC |
1364 | 1364 | LIMIT %d", |
1365 | - $uid, (int) $count |
|
1365 | + $uid, (int)$count |
|
1366 | 1366 | ); |
1367 | 1367 | $xml = array( |
1368 | 1368 | 'rpc_response' => array( |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | ); |
1526 | 1526 | } |
1527 | 1527 | // Determine which page to display in order to show the given comment |
1528 | - $page = floor($comment_offset / $comments_per_page); |
|
1528 | + $page = floor($comment_offset/$comments_per_page); |
|
1529 | 1529 | if ($page) { |
1530 | 1530 | $params = array('page' => $page); |
1531 | 1531 | } |
@@ -1881,7 +1881,7 @@ discard block |
||
1881 | 1881 | * Overview of moderation queues |
1882 | 1882 | */ |
1883 | 1883 | function boinccore_moderation_overview_panel() { |
1884 | - $output = '<h2 class="pane-title">' . bts('Moderation') . '</h2>'; |
|
1884 | + $output = '<h2 class="pane-title">'.bts('Moderation').'</h2>'; |
|
1885 | 1885 | $output .= '<ul class="tab-list action-list">'; |
1886 | 1886 | if (module_exists('user_profiles')) { |
1887 | 1887 | $profile_count = db_result(db_query(" |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | $output .= '<li class="tab primary">'; |
1893 | 1893 | $output .= l(bts('Unvetted profiles'), 'moderate/profiles'); |
1894 | 1894 | $output .= '<div class="item-count-wrapper">'; |
1895 | - $output .= '<span class="item-count">' . $profile_count . '</span>'; |
|
1895 | + $output .= '<span class="item-count">'.$profile_count.'</span>'; |
|
1896 | 1896 | $output .= '</div>'; |
1897 | 1897 | $output .= '</li>'; |
1898 | 1898 | } |
@@ -378,8 +378,7 @@ discard block |
||
378 | 378 | $user_info .= ' <div class="picture">'; |
379 | 379 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
380 | 380 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
381 | - } |
|
382 | - elseif (is_string($user_image)) { |
|
381 | + } elseif (is_string($user_image)) { |
|
383 | 382 | $user_info .= '<img src="' . $user_image . '"/>'; |
384 | 383 | } |
385 | 384 | $user_info .= ' </div>'; |
@@ -421,8 +420,7 @@ discard block |
||
421 | 420 | // If a specific comment is being referenced, go back to it on cancel |
422 | 421 | if ($comment_ref = $form['pid']['#value']) { |
423 | 422 | $cancel_url = "goto/comment/{$comment_ref}"; |
424 | - } |
|
425 | - else { |
|
423 | + } else { |
|
426 | 424 | $cancel_url = "node/{$form['nid']['#value']}"; |
427 | 425 | } |
428 | 426 | |
@@ -525,8 +523,7 @@ discard block |
||
525 | 523 | 'title' => bts('Reply to this topic with a quote') |
526 | 524 | ); |
527 | 525 | } |
528 | - } |
|
529 | - else { |
|
526 | + } else { |
|
530 | 527 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
531 | 528 | if (isset($links['comment_delete'])) { |
532 | 529 | $links['comment_delete']['attributes'] = array( |
@@ -580,8 +577,7 @@ discard block |
||
580 | 577 | 'title' => bts('Remove sticky status from this topic') |
581 | 578 | ) |
582 | 579 | ); |
583 | - } |
|
584 | - else { |
|
580 | + } else { |
|
585 | 581 | $links['make_sticky'] = array( |
586 | 582 | 'title' => bts('Make sticky'), |
587 | 583 | 'href' => "{$node_control}/sticky", |
@@ -598,8 +594,7 @@ discard block |
||
598 | 594 | 'title' => bts('Lock this thread for comments') |
599 | 595 | ) |
600 | 596 | ); |
601 | - } |
|
602 | - else { |
|
597 | + } else { |
|
603 | 598 | $links['unlock'] = array( |
604 | 599 | 'title' => bts('Unlock'), |
605 | 600 | 'href' => "{$node_control}/unlock", |
@@ -616,8 +611,7 @@ discard block |
||
616 | 611 | 'title' => bts('Hide this topic') |
617 | 612 | ) |
618 | 613 | ); |
619 | - } |
|
620 | - else { |
|
614 | + } else { |
|
621 | 615 | $links['unhide'] = array( |
622 | 616 | 'title' => bts('Unhide'), |
623 | 617 | 'href' => "{$node_control}/unhide", |
@@ -628,8 +622,7 @@ discard block |
||
628 | 622 | } |
629 | 623 | }// if user_access('edit any forum topic') |
630 | 624 | } |
631 | - } |
|
632 | - else if ($type=='comment') { |
|
625 | + } else if ($type=='comment') { |
|
633 | 626 | $node = node_load($object->nid); |
634 | 627 | $nid = $object->nid; |
635 | 628 | $cid = $object->cid; |
@@ -670,8 +663,7 @@ discard block |
||
670 | 663 | 'title' => bts('Hide this comment') |
671 | 664 | ) |
672 | 665 | ); |
673 | - } |
|
674 | - else { |
|
666 | + } else { |
|
675 | 667 | $links['unhide'] = array( |
676 | 668 | 'title' => bts('Unhide'), |
677 | 669 | 'href' => "{$comment_control}/unhide", |
@@ -853,8 +845,7 @@ discard block |
||
853 | 845 | watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
854 | 846 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
855 | 847 | } |
856 | - } |
|
857 | - elseif ($project_prefs) { |
|
848 | + } elseif ($project_prefs) { |
|
858 | 849 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
859 | 850 | if ($errors = libxml_get_errors($xml)) { |
860 | 851 | $lines = explode("\r", $project_prefs); |
@@ -897,8 +888,7 @@ discard block |
||
897 | 888 | node_save($content_profile); |
898 | 889 | } |
899 | 890 | } |
900 | - } |
|
901 | - else { |
|
891 | + } else { |
|
902 | 892 | $xml = array( |
903 | 893 | 'error' => array( |
904 | 894 | 'error_num' => -112, |
@@ -1033,8 +1023,7 @@ discard block |
||
1033 | 1023 | node_save($node); |
1034 | 1024 | // Save the team IDs to a BOINC <--> Drupal reference table. |
1035 | 1025 | db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
1036 | - } |
|
1037 | - else { |
|
1026 | + } else { |
|
1038 | 1027 | $xml['create_team_reply']['warning'] = t( |
1039 | 1028 | 'There was a problem integrating this team into Drupal. Please |
1040 | 1029 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1049,8 +1038,7 @@ discard block |
||
1049 | 1038 | // Delete from the BOINC DB if we can't sync with Drupal |
1050 | 1039 | $boincteam::delete(); |
1051 | 1040 | } |
1052 | - } |
|
1053 | - else { |
|
1041 | + } else { |
|
1054 | 1042 | $xml['create_team_reply']['warning'] = t( |
1055 | 1043 | 'There was a problem integrating this team into Drupal. Please |
1056 | 1044 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1064,8 +1052,7 @@ discard block |
||
1064 | 1052 | ); |
1065 | 1053 | } |
1066 | 1054 | } |
1067 | - } |
|
1068 | - else { |
|
1055 | + } else { |
|
1069 | 1056 | $xml = array( |
1070 | 1057 | 'error' => array( |
1071 | 1058 | 'error_num' => -1, |
@@ -1159,8 +1146,7 @@ discard block |
||
1159 | 1146 | } |
1160 | 1147 | $xml['users']['user'][] = $team_member; |
1161 | 1148 | } |
1162 | - } |
|
1163 | - else { |
|
1149 | + } else { |
|
1164 | 1150 | $xml = array( |
1165 | 1151 | 'error' => array( |
1166 | 1152 | 'error_num' => -136, |
@@ -1209,24 +1195,19 @@ discard block |
||
1209 | 1195 | if ($avatar_image) { |
1210 | 1196 | $profile_node->field_image[0] = $avatar_image; |
1211 | 1197 | node_save($profile_node); |
1212 | - } |
|
1213 | - else { |
|
1198 | + } else { |
|
1214 | 1199 | $error = 'Error saving avatar to profile'; |
1215 | 1200 | } |
1216 | - } |
|
1217 | - else { |
|
1201 | + } else { |
|
1218 | 1202 | $error = 'Unable to load user profile'; |
1219 | 1203 | } |
1220 | - } |
|
1221 | - else { |
|
1204 | + } else { |
|
1222 | 1205 | $error = 'User has no profile, so avatar could not be added'; |
1223 | 1206 | } |
1224 | - } |
|
1225 | - else { |
|
1207 | + } else { |
|
1226 | 1208 | $error = 'Unable to save remote image'; |
1227 | 1209 | } |
1228 | - } |
|
1229 | - else { |
|
1210 | + } else { |
|
1230 | 1211 | $error = 'Could not find avatar image at URL'; |
1231 | 1212 | } |
1232 | 1213 | } |
@@ -1253,8 +1234,7 @@ discard block |
||
1253 | 1234 | 'success' => NULL, |
1254 | 1235 | ), |
1255 | 1236 | ); |
1256 | - } |
|
1257 | - else { |
|
1237 | + } else { |
|
1258 | 1238 | // Failure |
1259 | 1239 | $xml = array( |
1260 | 1240 | 'error' => array( |
@@ -1263,8 +1243,7 @@ discard block |
||
1263 | 1243 | ), |
1264 | 1244 | ); |
1265 | 1245 | } |
1266 | - } |
|
1267 | - else { |
|
1246 | + } else { |
|
1268 | 1247 | // Drupal user not found |
1269 | 1248 | $xml = array( |
1270 | 1249 | 'error' => array( |
@@ -1273,8 +1252,7 @@ discard block |
||
1273 | 1252 | ), |
1274 | 1253 | ); |
1275 | 1254 | } |
1276 | - } |
|
1277 | - else { |
|
1255 | + } else { |
|
1278 | 1256 | // BOINC user not found |
1279 | 1257 | $xml = array( |
1280 | 1258 | 'error' => array( |
@@ -1392,8 +1370,7 @@ discard block |
||
1392 | 1370 | ), |
1393 | 1371 | ); |
1394 | 1372 | } |
1395 | - } |
|
1396 | - else { |
|
1373 | + } else { |
|
1397 | 1374 | $xml = array( |
1398 | 1375 | 'error' => array( |
1399 | 1376 | 'error_num' => -136, |
@@ -1517,8 +1494,7 @@ discard block |
||
1517 | 1494 | // Get the number of comments per page |
1518 | 1495 | if ($user->comments_per_page) { |
1519 | 1496 | $comments_per_page = $user->comments_per_page; |
1520 | - } |
|
1521 | - else { |
|
1497 | + } else { |
|
1522 | 1498 | $node = node_load($object->nid); |
1523 | 1499 | $comments_per_page = variable_get( |
1524 | 1500 | "comment_default_per_page_{$node->type}", 50 |
@@ -1539,8 +1515,7 @@ discard block |
||
1539 | 1515 | // Check for a login, then redirect to the user's friend requests page |
1540 | 1516 | if ($user->uid) { |
1541 | 1517 | drupal_goto("account/{$user->uid}/friends/pending"); |
1542 | - } |
|
1543 | - else { |
|
1518 | + } else { |
|
1544 | 1519 | drupal_goto('user/login', array( |
1545 | 1520 | 'destination' => 'goto/friend-requests' |
1546 | 1521 | )); |
@@ -1816,8 +1791,7 @@ discard block |
||
1816 | 1791 | if ($moderator_rid !== FALSE) { |
1817 | 1792 | $settings['recipients'] = array($moderator_rid); |
1818 | 1793 | rules_action_mail_to_users_of_role($settings); |
1819 | - } |
|
1820 | - else { |
|
1794 | + } else { |
|
1821 | 1795 | watchdog( |
1822 | 1796 | 'boinccore', |
1823 | 1797 | 'Unable to identify members of the moderator role to send moderator notifications!', |
@@ -1848,8 +1822,7 @@ discard block |
||
1848 | 1822 | } |
1849 | 1823 | if (empty($args)) { |
1850 | 1824 | return $string; |
1851 | - } |
|
1852 | - else { |
|
1825 | + } else { |
|
1853 | 1826 | // Transform arguments before inserting them. |
1854 | 1827 | foreach ($args as $key => $value) { |
1855 | 1828 | switch ($key [0]) { |
@@ -68,84 +68,84 @@ discard block |
||
68 | 68 | 'title' => 'Look up account RPC', |
69 | 69 | 'description' => 'RPC for getting the authenticator for a user account.', |
70 | 70 | 'page callback' => 'boinccore_lookup_account', |
71 | - 'access callback' => TRUE, |
|
71 | + 'access callback' => true, |
|
72 | 72 | 'type' => MENU_CALLBACK |
73 | 73 | ); |
74 | 74 | $items['am_get_info.php'] = array( |
75 | 75 | 'title' => 'Account manager get info RPC', |
76 | 76 | 'description' => 'RPC for getting assorted details of a user account.', |
77 | 77 | 'page callback' => 'boinccore_am_get_info', |
78 | - 'access callback' => TRUE, |
|
78 | + 'access callback' => true, |
|
79 | 79 | 'type' => MENU_CALLBACK |
80 | 80 | ); |
81 | 81 | $items['am_set_info.php'] = array( |
82 | 82 | 'title' => 'Account manager set info RPC', |
83 | 83 | 'description' => 'RPC for updating assorted details of a user account.', |
84 | 84 | 'page callback' => 'boinccore_am_set_info', |
85 | - 'access callback' => TRUE, |
|
85 | + 'access callback' => true, |
|
86 | 86 | 'type' => MENU_CALLBACK |
87 | 87 | ); |
88 | 88 | $items['am_set_host_info.php'] = array( |
89 | 89 | 'title' => 'Account manager set host info RPC', |
90 | 90 | 'description' => 'RPC for updating the venue for a given host.', |
91 | 91 | 'page callback' => 'boinccore_am_set_host_info', |
92 | - 'access callback' => TRUE, |
|
92 | + 'access callback' => true, |
|
93 | 93 | 'type' => MENU_CALLBACK |
94 | 94 | ); |
95 | 95 | $items['show_user.php'] = array( |
96 | 96 | 'title' => 'Show user RPC', |
97 | 97 | 'description' => 'RPC for getting assorted details of a user account.', |
98 | 98 | 'page callback' => 'boinccore_show_user', |
99 | - 'access callback' => TRUE, |
|
99 | + 'access callback' => true, |
|
100 | 100 | 'type' => MENU_CALLBACK |
101 | 101 | ); |
102 | 102 | $items['pending.php'] = array( |
103 | 103 | 'title' => 'Pending credit RPC', |
104 | 104 | 'description' => 'RPC for getting pending credit for a given account.', |
105 | 105 | 'page callback' => 'boinccore_pending_credit', |
106 | - 'access callback' => TRUE, |
|
106 | + 'access callback' => true, |
|
107 | 107 | 'type' => MENU_CALLBACK |
108 | 108 | ); |
109 | 109 | $items['create_team.php'] = array( |
110 | 110 | 'title' => 'Create team RPC', |
111 | 111 | 'description' => 'RPC for creating a new team.', |
112 | 112 | 'page callback' => 'boinccore_create_team', |
113 | - 'access callback' => TRUE, |
|
113 | + 'access callback' => true, |
|
114 | 114 | 'type' => MENU_CALLBACK |
115 | 115 | ); |
116 | 116 | $items['team_lookup.php'] = array( |
117 | 117 | 'title' => 'Team lookup RPC', |
118 | 118 | 'description' => 'RPC for getting info on a team or matching teams.', |
119 | 119 | 'page callback' => 'boinccore_team_lookup', |
120 | - 'access callback' => TRUE, |
|
120 | + 'access callback' => true, |
|
121 | 121 | 'type' => MENU_CALLBACK |
122 | 122 | ); |
123 | 123 | $items['team_email_list.php'] = array( |
124 | 124 | 'title' => 'Get team member list RPC', |
125 | 125 | 'description' => 'RPC for getting a list of members of a given team.', |
126 | 126 | 'page callback' => 'boinccore_team_email_list', |
127 | - 'access callback' => TRUE, |
|
127 | + 'access callback' => true, |
|
128 | 128 | 'type' => MENU_CALLBACK |
129 | 129 | ); |
130 | 130 | $items['edit_forum_preferences_action.php'] = array( |
131 | 131 | 'title' => 'Forum preferences RPC', |
132 | 132 | 'description' => 'RPC for setting forum preferences for a given user.', |
133 | 133 | 'page callback' => 'boinccore_edit_forum_preferences', |
134 | - 'access callback' => TRUE, |
|
134 | + 'access callback' => true, |
|
135 | 135 | 'type' => MENU_CALLBACK |
136 | 136 | ); |
137 | 137 | $items['forum_get_data.php'] = array( |
138 | 138 | 'title' => 'Forum get data RPC', |
139 | 139 | 'description' => 'RPC for getting recent forum activity for a given user.', |
140 | 140 | 'page callback' => 'boinccore_forum_get_data', |
141 | - 'access callback' => TRUE, |
|
141 | + 'access callback' => true, |
|
142 | 142 | 'type' => MENU_CALLBACK |
143 | 143 | ); |
144 | 144 | $items['apps.php'] = array( |
145 | 145 | 'title' => 'Apps RPC', |
146 | 146 | 'description' => 'RPC for getting the applications in the system.', |
147 | 147 | 'page callback' => 'boinccore_apps', |
148 | - 'access callback' => TRUE, |
|
148 | + 'access callback' => true, |
|
149 | 149 | 'type' => MENU_CALLBACK |
150 | 150 | ); |
151 | 151 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | function boinccore_menu_alter(&$items) { |
159 | 159 | // If using Solr search and not core Drupal search, disable core search! |
160 | - if (module_exists('global_search_solr') AND !module_exists('global_search')) { |
|
160 | + if (module_exists('global_search_solr') and !module_exists('global_search')) { |
|
161 | 161 | // Add permission to user search. |
162 | 162 | $check = array( |
163 | 163 | 'search/node/%menu_tail', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | ); |
167 | 167 | foreach ($check as $path) { |
168 | 168 | if (isset($items[$path])) { |
169 | - $items[$path]['access callback'] = FALSE; |
|
169 | + $items[$path]['access callback'] = false; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // Since we are in a hook_boot() implementation cache mode is normal, so |
225 | 225 | // we can safely call hook_exit(). |
226 | 226 | bootstrap_invoke_all('exit'); |
227 | - header("Location: $url", TRUE, $code); |
|
227 | + header("Location: $url", true, $code); |
|
228 | 228 | exit; |
229 | 229 | } |
230 | 230 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function locale_language_from_browser() { |
244 | 244 | if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
245 | - return FALSE; |
|
245 | + return false; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $languages = language_list('enabled'); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // Find the enabled language with the greatest qvalue, following the rules |
286 | 286 | // of RFC 2616 (section 14.4). If several languages have the same qvalue, |
287 | 287 | // prefer the one with the greatest weight. |
288 | - $best_match_language = FALSE; |
|
288 | + $best_match_language = false; |
|
289 | 289 | $max_qvalue = 0; |
290 | 290 | foreach ($languages as $langcode => $language) { |
291 | 291 | // Language tags are case insensitive (RFC2616, sec 3.10). |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // Notify moderators if there is site content that requires moderator action |
325 | 325 | $items_in_queue = boincuser_moderation_queue_count('cron'); |
326 | 326 | $last_notification = variable_get('boinccore_last_content_moderation_reminder', 0); |
327 | - if ($items_in_queue AND $last_notification < time() - 24*60*60) { |
|
327 | + if ($items_in_queue and $last_notification < time() - 24*60*60) { |
|
328 | 328 | global $base_url; |
329 | 329 | global $base_path; |
330 | 330 | $site_name = variable_get('site_name', bts('project')); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $user_info = '<div class="user">'; |
377 | 377 | if ($user_image) { |
378 | 378 | $user_info .= ' <div class="picture">'; |
379 | - if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
379 | + if (is_array($user_image) and $user_image['image']['filepath']) { |
|
380 | 380 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
381 | 381 | } |
382 | 382 | elseif (is_string($user_image)) { |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | '#attributes' => array( |
412 | 412 | 'class' => 'bbcode_help', |
413 | 413 | ), |
414 | - '#collapsible' => TRUE, |
|
415 | - '#collapsed' => TRUE, |
|
414 | + '#collapsible' => true, |
|
415 | + '#collapsed' => true, |
|
416 | 416 | 'content' => array( |
417 | 417 | '#value' => _bbcode_filter_tip(), |
418 | 418 | ), |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | /** |
503 | 503 | * Implementation of hook_link_alter() |
504 | 504 | */ |
505 | -function boinccore_link_alter(&$links, $node, $comment = NULL) { |
|
505 | +function boinccore_link_alter(&$links, $node, $comment = null) { |
|
506 | 506 | //echo '<pre>' . print_r($links, true) . '</pre>'; |
507 | 507 | foreach ($links as $module => $link) { |
508 | 508 | // Remove the ignore user link |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | /** |
550 | 550 | * Implementation of hook_locale(). |
551 | 551 | */ |
552 | -function boinccore_locale($op = 'groups', $group = NULL) { |
|
552 | +function boinccore_locale($op = 'groups', $group = null) { |
|
553 | 553 | switch ($op) { |
554 | 554 | case 'groups': |
555 | 555 | return array('boinc' => bts('BOINC')); |
556 | 556 | case 'info': |
557 | 557 | //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
558 | - $info['boinc']['format'] = FALSE; |
|
558 | + $info['boinc']['format'] = false; |
|
559 | 559 | return $info; |
560 | 560 | } |
561 | 561 | } |
@@ -564,11 +564,11 @@ discard block |
||
564 | 564 | /** |
565 | 565 | * Implementation of hook_link() |
566 | 566 | */ |
567 | -function boinccore_link($type, $object, $teaser = FALSE) { |
|
567 | +function boinccore_link($type, $object, $teaser = false) { |
|
568 | 568 | // Add custom links with this hook |
569 | 569 | |
570 | 570 | if ($type=='node') { |
571 | - if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
|
571 | + if ( ($object->type=='forum') or ($object->type=='team_forum') ) { |
|
572 | 572 | // Add topic moderator controls |
573 | 573 | if (user_access('edit any forum topic')) { |
574 | 574 | $node_control = "node_control/{$object->nid}"; |
@@ -696,12 +696,12 @@ discard block |
||
696 | 696 | * Allow published, sticky, and comment status to be set on nodes by direct |
697 | 697 | * link rather than through the node form. |
698 | 698 | */ |
699 | -function boinccore_node_control($nid = NULL, $action = NULL) { |
|
700 | - if ((!$nid OR !$node = node_load($nid)) OR |
|
701 | - ($node->type == 'forum' AND !user_access('edit any forum topic')) OR |
|
702 | - ($node->type != 'forum' AND !user_access('administer nodes'))) { |
|
699 | +function boinccore_node_control($nid = null, $action = null) { |
|
700 | + if ((!$nid or !$node = node_load($nid)) or |
|
701 | + ($node->type == 'forum' and !user_access('edit any forum topic')) or |
|
702 | + ($node->type != 'forum' and !user_access('administer nodes'))) { |
|
703 | 703 | // What are you even doing here... |
704 | - return FALSE; |
|
704 | + return false; |
|
705 | 705 | } |
706 | 706 | switch ($action) { |
707 | 707 | case 'unhide': |
@@ -737,10 +737,10 @@ discard block |
||
737 | 737 | * Allow published status to be set on comments by direct link rather than |
738 | 738 | * through the comment edit form. |
739 | 739 | */ |
740 | -function boinccore_comment_control($cid = NULL, $action = NULL) { |
|
741 | - if (!$cid OR !$comment = _comment_load($cid)) { |
|
740 | +function boinccore_comment_control($cid = null, $action = null) { |
|
741 | + if (!$cid or !$comment = _comment_load($cid)) { |
|
742 | 742 | // What are you even doing here... |
743 | - return FALSE; |
|
743 | + return false; |
|
744 | 744 | } |
745 | 745 | $return_path = "node/{$comment->nid}"; |
746 | 746 | $return_anchor = "comment-{$cid}"; |
@@ -789,11 +789,11 @@ discard block |
||
789 | 789 | _comment_delete_thread($comment); |
790 | 790 | |
791 | 791 | $return_path = "node/{$node->nid}"; |
792 | - $return_anchor = NULL; |
|
792 | + $return_anchor = null; |
|
793 | 793 | break; |
794 | 794 | default: |
795 | 795 | } |
796 | - drupal_goto($return_path, NULL, $return_anchor); |
|
796 | + drupal_goto($return_path, null, $return_anchor); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | /** |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $uid = !empty($xml['am_get_info_reply']['id']) ? boincuser_lookup_uid($xml['am_get_info_reply']['id']) : 0; |
821 | 821 | if ($uid) { |
822 | 822 | $content_profile = content_profile_load('profile', $uid); |
823 | - $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
|
823 | + $profile_is_approved = ($content_profile->status and !$content_profile->moderate); |
|
824 | 824 | $country = check_plain($content_profile->field_country[0]['value']); |
825 | 825 | $website = ''; |
826 | 826 | if ($profile_is_approved) { |
@@ -842,8 +842,8 @@ discard block |
||
842 | 842 | // Remove q from the GET request or BOINC will panic |
843 | 843 | unset($_GET['q']); |
844 | 844 | // Validate the XML prefs (in case BOINC does not) |
845 | - $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : NULL); |
|
846 | - $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : NULL); |
|
845 | + $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : null); |
|
846 | + $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : null); |
|
847 | 847 | libxml_use_internal_errors(true); |
848 | 848 | $xml = new DomDocument(); |
849 | 849 | if ($global_prefs) { |
@@ -882,15 +882,15 @@ discard block |
||
882 | 882 | $uid = boincuser_lookup_uid($boinc_id); |
883 | 883 | |
884 | 884 | // Apply any relevant updates to the Drupal account, also |
885 | - $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : NULL); |
|
886 | - $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : NULL); |
|
887 | - $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : NULL); |
|
885 | + $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : null); |
|
886 | + $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : null); |
|
887 | + $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : null); |
|
888 | 888 | |
889 | 889 | if ($email_addr) { |
890 | 890 | $account = user_load($uid); |
891 | 891 | user_save($account, array('mail' => $email_addr)); |
892 | 892 | } |
893 | - if ($country OR $url) { |
|
893 | + if ($country or $url) { |
|
894 | 894 | $content_profile = content_profile_load('profile', $uid); |
895 | 895 | if ($country) $content_profile->field_country[0]['value'] = $country; |
896 | 896 | if ($url) $content_profile->field_url[0]['value'] = $url; |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | $uid = !empty($xml['user']['id']) ? boincuser_lookup_uid($xml['user']['id']) : 0; |
945 | 945 | if ($uid) { |
946 | 946 | $content_profile = content_profile_load('profile', $uid); |
947 | - $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
|
947 | + $profile_is_approved = ($content_profile->status and !$content_profile->moderate); |
|
948 | 948 | $country = check_plain($content_profile->field_country[0]['value']); |
949 | 949 | $website = ''; |
950 | 950 | if ($profile_is_approved) { |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | $boincteam_id = !empty($_POST['teamid']) ? $_POST['teamid'] : $_GET['teamid']; |
1105 | 1105 | $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
1106 | 1106 | $show_xml = !empty($_POST['xml']) ? $_POST['xml'] : $_GET['xml']; |
1107 | - $admin_request = FALSE; |
|
1107 | + $admin_request = false; |
|
1108 | 1108 | if ($boincteam_id && is_numeric($boincteam_id)) { |
1109 | 1109 | if ($account_key) { |
1110 | 1110 | // See if this is a team admin |
@@ -1119,9 +1119,9 @@ discard block |
||
1119 | 1119 | )); |
1120 | 1120 | db_set_active('default'); |
1121 | 1121 | require_boinc('team'); |
1122 | - $boincuser = boincuser_load(boincuser_lookup_uid($boincuser_id), TRUE); |
|
1122 | + $boincuser = boincuser_load(boincuser_lookup_uid($boincuser_id), true); |
|
1123 | 1123 | $boincteam = boincteam_load($boincteam_id); |
1124 | - $admin_request = is_team_admin($boincuser, $boincteam) OR is_team_founder($boincuser, $boincteam); |
|
1124 | + $admin_request = is_team_admin($boincuser, $boincteam) or is_team_founder($boincuser, $boincteam); |
|
1125 | 1125 | } |
1126 | 1126 | $members = array(); |
1127 | 1127 | db_set_active('boinc'); |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | 'expavg_credit' => $member->boincuser_expavg_credit, |
1153 | 1153 | 'expavg_time' => $member->boincuser_expavg_time, |
1154 | 1154 | 'url' => $content_profile->field_url[0]['value'], |
1155 | - 'has_profile' => ($content_profile->status AND !$content_profile->moderate) ? 1 : 0, |
|
1155 | + 'has_profile' => ($content_profile->status and !$content_profile->moderate) ? 1 : 0, |
|
1156 | 1156 | ); |
1157 | 1157 | if ($admin_request) { |
1158 | 1158 | $team_member['email_addr'] = $member->mail; |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | ), |
1169 | 1169 | ); |
1170 | 1170 | } |
1171 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1171 | + print xml_to_text(array_to_xml($xml), true, true); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | /** |
@@ -1179,18 +1179,18 @@ discard block |
||
1179 | 1179 | // Do not pass through to BOINC in this case as BOINC forums are no longer |
1180 | 1180 | // relevant -- use Drupal data only |
1181 | 1181 | |
1182 | - $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : NULL); |
|
1182 | + $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : null); |
|
1183 | 1183 | |
1184 | 1184 | require_boinc('boinc_db'); |
1185 | 1185 | $boincuser = BoincUser::lookup_auth($account_key); |
1186 | 1186 | if ($boincuser) { |
1187 | 1187 | $uid = boincuser_lookup_uid($boincuser->id); |
1188 | - if ($uid AND $account = user_load($uid)) { |
|
1188 | + if ($uid and $account = user_load($uid)) { |
|
1189 | 1189 | // Currently supported preferences |
1190 | - $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : NULL); |
|
1191 | - $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : NULL); |
|
1192 | - $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : NULL); |
|
1193 | - $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : NULL); |
|
1190 | + $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : null); |
|
1191 | + $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : null); |
|
1192 | + $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : null); |
|
1193 | + $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : null); |
|
1194 | 1194 | // Update preferences as needed |
1195 | 1195 | if ($avatar_url) { |
1196 | 1196 | $avatar_image = file_get_contents($avatar_url); |
@@ -1201,11 +1201,11 @@ discard block |
||
1201 | 1201 | if ($file) { |
1202 | 1202 | $profile = new stdClass(); |
1203 | 1203 | $profile->type = 'profile'; |
1204 | - $profile->language = NULL; |
|
1204 | + $profile->language = null; |
|
1205 | 1205 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1206 | 1206 | $profile_node = node_load($profile_nid); |
1207 | 1207 | if ($profile_node) { |
1208 | - $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
|
1208 | + $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', true); |
|
1209 | 1209 | if ($avatar_image) { |
1210 | 1210 | $profile_node->field_image[0] = $avatar_image; |
1211 | 1211 | node_save($profile_node); |
@@ -1230,10 +1230,10 @@ discard block |
||
1230 | 1230 | $error = 'Could not find avatar image at URL'; |
1231 | 1231 | } |
1232 | 1232 | } |
1233 | - if ($hide_signatures !== NULL) { |
|
1233 | + if ($hide_signatures !== null) { |
|
1234 | 1234 | user_save($account, array('hide_signatures' => ($hide_signatures ? 1 : 0))); |
1235 | 1235 | } |
1236 | - if ($signature !== NULL) { |
|
1236 | + if ($signature !== null) { |
|
1237 | 1237 | $signature = check_markup($signature); |
1238 | 1238 | user_save($account, array('signature' => $signature)); |
1239 | 1239 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | // Success |
1251 | 1251 | $xml = array( |
1252 | 1252 | 'edit_forum_preferences' => array( |
1253 | - 'success' => NULL, |
|
1253 | + 'success' => null, |
|
1254 | 1254 | ), |
1255 | 1255 | ); |
1256 | 1256 | } |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | ), |
1284 | 1284 | ); |
1285 | 1285 | } |
1286 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1286 | + print xml_to_text(array_to_xml($xml), true, true); |
|
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | /** |
@@ -1295,17 +1295,17 @@ discard block |
||
1295 | 1295 | // relevant -- use Drupal data only |
1296 | 1296 | |
1297 | 1297 | $xml = array(); |
1298 | - $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : NULL); |
|
1298 | + $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : null); |
|
1299 | 1299 | $uid = boincuser_lookup_uid($boinc_id); |
1300 | 1300 | |
1301 | 1301 | if ($uid) { |
1302 | - $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : NULL); |
|
1303 | - $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : NULL); |
|
1302 | + $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : null); |
|
1303 | + $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : null); |
|
1304 | 1304 | if (!$count) $count = 10; |
1305 | 1305 | |
1306 | 1306 | switch ($method) { |
1307 | 1307 | case 'user_posts': |
1308 | - $content_length = !empty($_POST['content_length']) ? $_POST['content_length'] : (!empty($_GET['content_length']) ? $_GET['content_length'] : NULL); |
|
1308 | + $content_length = !empty($_POST['content_length']) ? $_POST['content_length'] : (!empty($_GET['content_length']) ? $_GET['content_length'] : null); |
|
1309 | 1309 | $posts = db_query(" |
1310 | 1310 | SELECT |
1311 | 1311 | c.cid, |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | ), |
1402 | 1402 | ); |
1403 | 1403 | } |
1404 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1404 | + print xml_to_text(array_to_xml($xml), true, true); |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | /** |
@@ -1420,9 +1420,9 @@ discard block |
||
1420 | 1420 | * in advance on which page a given comment will appear. Link instead to this |
1421 | 1421 | * controller function, which can compute the page based on the user's settings |
1422 | 1422 | */ |
1423 | -function boinccore_url_pagination_handler($type, $object_id = NULL) { |
|
1423 | +function boinccore_url_pagination_handler($type, $object_id = null) { |
|
1424 | 1424 | global $user; |
1425 | - $path = NULL; |
|
1425 | + $path = null; |
|
1426 | 1426 | $params = array(); |
1427 | 1427 | switch ($type) { |
1428 | 1428 | case 'boinc-forum': |
@@ -1809,11 +1809,11 @@ discard block |
||
1809 | 1809 | $mailing_list = variable_get('boinc_moderator_mailing_list', ''); |
1810 | 1810 | $force_individual_notifications = variable_get('boinc_moderator_force_individual_notifications', 0); |
1811 | 1811 | |
1812 | - if (!$mailing_list OR $force_individual_notifications) { |
|
1812 | + if (!$mailing_list or $force_individual_notifications) { |
|
1813 | 1813 | // Send individual emails to all moderators |
1814 | 1814 | $roles = user_roles(); |
1815 | 1815 | $moderator_rid = array_search('moderator', $roles); |
1816 | - if ($moderator_rid !== FALSE) { |
|
1816 | + if ($moderator_rid !== false) { |
|
1817 | 1817 | $settings['recipients'] = array($moderator_rid); |
1818 | 1818 | rules_action_mail_to_users_of_role($settings); |
1819 | 1819 | } |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | /* |
1843 | 1843 | * BOINC wrapper for string translation |
1844 | 1844 | */ |
1845 | -function bts($string, $args = array(), $langcode = NULL, $context = 'boinc: ', $update = TRUE) { |
|
1845 | +function bts($string, $args = array(), $langcode = null, $context = 'boinc: ', $update = true) { |
|
1846 | 1846 | if (function_exists('i18nstrings_ts')) { |
1847 | 1847 | $string = i18nstrings_ts($context, $string, $langcode, $update); |
1848 | 1848 | } |
@@ -7,185 +7,185 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -135,7 +135,7 @@ discard block |
||
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 |
||
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 |
||
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( |
@@ -144,13 +144,11 @@ discard block |
||
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 |
||
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(); |
@@ -54,8 +54,8 @@ discard block |
||
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 |
||
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 |
@@ -9,40 +9,40 @@ discard block |
||
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 |
||
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 | } |
@@ -19,7 +19,7 @@ |
||
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 | } |
@@ -17,8 +17,8 @@ discard block |
||
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 |
||
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 | } |
@@ -26,16 +26,16 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -30,9 +30,9 @@ discard block |
||
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 |
||
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); |
@@ -61,7 +61,7 @@ discard block |
||
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 |
||
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; |
@@ -11,56 +11,56 @@ discard block |
||
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 |
||
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 |
@@ -26,7 +26,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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? |
@@ -57,8 +57,7 @@ discard block |
||
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 |
||
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)); |
@@ -32,7 +32,7 @@ |
||
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 |
@@ -12,33 +12,33 @@ |
||
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 |
@@ -12,26 +12,26 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -5,45 +5,45 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -5,7 +5,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -21,13 +21,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -7,85 +7,85 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -301,7 +301,7 @@ |
||
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, |
@@ -220,8 +220,7 @@ discard block |
||
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 |
||
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 |
||
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' |
@@ -12,8 +12,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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' |