@@ -4,19 +4,19 @@ |
||
4 | 4 | * Implementation of hook_menu_default_menu_custom(). |
5 | 5 | */ |
6 | 6 | function boinc_standard_menu_default_menu_custom() { |
7 | - $menus = array(); |
|
7 | + $menus = array(); |
|
8 | 8 | |
9 | - // Exported menu: menu-footer-links |
|
10 | - $menus['menu-footer-links'] = array( |
|
9 | + // Exported menu: menu-footer-links |
|
10 | + $menus['menu-footer-links'] = array( |
|
11 | 11 | 'menu_name' => 'menu-footer-links', |
12 | 12 | 'title' => 'Footer links', |
13 | 13 | 'description' => 'Auxiliary menu, typically at the bottom of the page in the footer, that includes links to content such as "about us" or "privacy policy" etc.', |
14 | - ); |
|
15 | - // Translatables |
|
16 | - // Title and description for footer menu appears in admin menu: Admin> Site Building> Menus |
|
17 | - t('Auxiliary menu, typically at the bottom of the page in the footer, that includes links to content such as "about us" or "privacy policy" etc.'); |
|
18 | - t('Footer links'); |
|
14 | + ); |
|
15 | + // Translatables |
|
16 | + // Title and description for footer menu appears in admin menu: Admin> Site Building> Menus |
|
17 | + t('Auxiliary menu, typically at the bottom of the page in the footer, that includes links to content such as "about us" or "privacy policy" etc.'); |
|
18 | + t('Footer links'); |
|
19 | 19 | |
20 | 20 | |
21 | - return $menus; |
|
21 | + return $menus; |
|
22 | 22 | } |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | * Implementation of hook_menu_default_menu_links(). |
5 | 5 | */ |
6 | 6 | function user_profiles_menu_default_menu_links() { |
7 | - $menu_links = array(); |
|
7 | + $menu_links = array(); |
|
8 | 8 | |
9 | - // Exported menu link: primary-links:account/profile |
|
10 | - $menu_links['primary-links:account/profile'] = array( |
|
9 | + // Exported menu link: primary-links:account/profile |
|
10 | + $menu_links['primary-links:account/profile'] = array( |
|
11 | 11 | 'menu_name' => 'primary-links', |
12 | 12 | 'link_path' => 'account/profile', |
13 | 13 | 'router_path' => 'account/profile', |
14 | 14 | 'link_title' => 'Profile', |
15 | 15 | 'options' => array( |
16 | - 'attributes' => array( |
|
16 | + 'attributes' => array( |
|
17 | 17 | 'title' => '', |
18 | - ), |
|
18 | + ), |
|
19 | 19 | ), |
20 | 20 | 'module' => 'menu', |
21 | 21 | 'hidden' => '0', |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | 'expanded' => '0', |
25 | 25 | 'weight' => '-49', |
26 | 26 | 'parent_path' => 'dashboard', |
27 | - ); |
|
28 | - // Exported menu link: primary-links:moderate/profiles |
|
29 | - $menu_links['primary-links:moderate/profiles'] = array( |
|
27 | + ); |
|
28 | + // Exported menu link: primary-links:moderate/profiles |
|
29 | + $menu_links['primary-links:moderate/profiles'] = array( |
|
30 | 30 | 'menu_name' => 'primary-links', |
31 | 31 | 'link_path' => 'moderate/profiles', |
32 | 32 | 'router_path' => 'moderate/profiles', |
33 | 33 | 'link_title' => 'Queue', |
34 | 34 | 'options' => array( |
35 | - 'attributes' => array( |
|
35 | + 'attributes' => array( |
|
36 | 36 | 'title' => '', |
37 | - ), |
|
37 | + ), |
|
38 | 38 | ), |
39 | 39 | 'module' => 'menu', |
40 | 40 | 'hidden' => '0', |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | 'expanded' => '0', |
44 | 44 | 'weight' => '-50', |
45 | 45 | 'parent_path' => 'moderate', |
46 | - ); |
|
47 | - // Translatables |
|
48 | - // Use bts() function to translate additional strings. |
|
49 | - bts('Queue', array(), NULL, 'boinc:menu-link'); |
|
50 | - bts('Profile', array(), NULL, 'boinc:menu-link'); |
|
46 | + ); |
|
47 | + // Translatables |
|
48 | + // Use bts() function to translate additional strings. |
|
49 | + bts('Queue', array(), NULL, 'boinc:menu-link'); |
|
50 | + bts('Profile', array(), NULL, 'boinc:menu-link'); |
|
51 | 51 | |
52 | - return $menu_links; |
|
52 | + return $menu_links; |
|
53 | 53 | } |
@@ -46,8 +46,8 @@ |
||
46 | 46 | ); |
47 | 47 | // Translatables |
48 | 48 | // Use bts() function to translate additional strings. |
49 | - bts('Queue', array(), NULL, 'boinc:menu-link'); |
|
50 | - bts('Profile', array(), NULL, 'boinc:menu-link'); |
|
49 | + bts('Queue', array(), null, 'boinc:menu-link'); |
|
50 | + bts('Profile', array(), null, 'boinc:menu-link'); |
|
51 | 51 | |
52 | 52 | return $menu_links; |
53 | 53 | } |
@@ -4,19 +4,19 @@ discard block |
||
4 | 4 | * Implementation of hook_menu_default_menu_links(). |
5 | 5 | */ |
6 | 6 | function news_menu_default_menu_links() { |
7 | - $menu_links = array(); |
|
7 | + $menu_links = array(); |
|
8 | 8 | |
9 | - // Exported menu link: primary-links:news |
|
10 | - $menu_links['primary-links:news'] = array( |
|
9 | + // Exported menu link: primary-links:news |
|
10 | + $menu_links['primary-links:news'] = array( |
|
11 | 11 | 'menu_name' => 'primary-links', |
12 | 12 | 'link_path' => 'news', |
13 | 13 | 'router_path' => 'news', |
14 | 14 | 'link_title' => 'News', |
15 | 15 | 'options' => array( |
16 | - 'attributes' => array( |
|
16 | + 'attributes' => array( |
|
17 | 17 | 'title' => '', |
18 | - ), |
|
19 | - 'alter' => TRUE, |
|
18 | + ), |
|
19 | + 'alter' => TRUE, |
|
20 | 20 | ), |
21 | 21 | 'module' => 'menu', |
22 | 22 | 'hidden' => '0', |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | 'has_children' => '0', |
25 | 25 | 'expanded' => '1', |
26 | 26 | 'weight' => '-48', |
27 | - ); |
|
28 | - // Translatables |
|
29 | - // Use bts() function to translate additional strings. |
|
30 | - bts('News', array(), NULL, 'boinc:menu-link'); |
|
27 | + ); |
|
28 | + // Translatables |
|
29 | + // Use bts() function to translate additional strings. |
|
30 | + bts('News', array(), NULL, 'boinc:menu-link'); |
|
31 | 31 | |
32 | 32 | |
33 | - return $menu_links; |
|
33 | + return $menu_links; |
|
34 | 34 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | 'attributes' => array( |
17 | 17 | 'title' => '', |
18 | 18 | ), |
19 | - 'alter' => TRUE, |
|
19 | + 'alter' => true, |
|
20 | 20 | ), |
21 | 21 | 'module' => 'menu', |
22 | 22 | 'hidden' => '0', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | ); |
28 | 28 | // Translatables |
29 | 29 | // Use bts() function to translate additional strings. |
30 | - bts('News', array(), NULL, 'boinc:menu-link'); |
|
30 | + bts('News', array(), null, 'boinc:menu-link'); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | return $menu_links; |
@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if ($myCache->isInCache($cache_name)) { |
106 | 106 | $myCache->strokeFromCache($cache_name); |
107 | - } |
|
108 | - else { |
|
107 | + } else { |
|
109 | 108 | // Initialize dataset |
110 | 109 | $dataset = array(); |
111 | 110 | $stats_xml = boincstats_get_project_stats('daily', $cpid); |
@@ -114,9 +113,10 @@ discard block |
||
114 | 113 | for ($j = 30; $j < 90; $j++) { |
115 | 114 | $dataset[] = (int) $stats_xml->records->record[$j]; |
116 | 115 | } |
117 | - } |
|
118 | - else { |
|
119 | - for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
116 | + } else { |
|
117 | + for ($i = 0; $i <= $dataset_size; $i++) { |
|
118 | + $dataset[] = 0; |
|
119 | + } |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Get color configuration |
@@ -226,8 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | if ($myCache->isInCache($cache_name)) { |
228 | 228 | $myCache->strokeFromCache($cache_name); |
229 | - } |
|
230 | - else { |
|
229 | + } else { |
|
231 | 230 | // Initialize dataset |
232 | 231 | $dataset = array(); |
233 | 232 | $stats_xml = boincstats_get_project_stats('daily'); |
@@ -236,9 +235,10 @@ discard block |
||
236 | 235 | for ($j = 30; $j < 90; $j++) { |
237 | 236 | $dataset[] = (int) $stats_xml->records->record[$j]; |
238 | 237 | } |
239 | - } |
|
240 | - else { |
|
241 | - for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
238 | + } else { |
|
239 | + for ($i = 0; $i <= 30; $i++) { |
|
240 | + $dataset[] = 0; |
|
241 | + } |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | // Create and populate the pData object |
@@ -316,8 +316,7 @@ discard block |
||
316 | 316 | directory must be writeable by the web server.', |
317 | 317 | array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
318 | 318 | return FALSE; |
319 | - } |
|
320 | - else { |
|
319 | + } else { |
|
321 | 320 | // Create the cache dir |
322 | 321 | if (!mkdir($cache_dir, 0775)) { |
323 | 322 | watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
@@ -326,8 +325,7 @@ discard block |
||
326 | 325 | return FALSE; |
327 | 326 | } |
328 | 327 | } |
329 | - } |
|
330 | - else { |
|
328 | + } else { |
|
331 | 329 | watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
332 | 330 | Please allow webserver write access.', |
333 | 331 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
@@ -370,8 +368,7 @@ discard block |
||
370 | 368 | foreach ($get as $arg => $value) { |
371 | 369 | if ($value !== NULL) { |
372 | 370 | $args[] = "{$arg}=" . rawurlencode($value); |
373 | - } |
|
374 | - else { |
|
371 | + } else { |
|
375 | 372 | $args[] = $arg; |
376 | 373 | } |
377 | 374 | } |
@@ -467,8 +464,7 @@ discard block |
||
467 | 464 | drupal_set_message(t('The BOINC stats system is not configured. Please |
468 | 465 | !configure_it', array('!configure_it' => l(t('configure it now'), |
469 | 466 | 'admin/boinc/stats'))), 'error', FALSE); |
470 | - } |
|
471 | - else { |
|
467 | + } else { |
|
472 | 468 | drupal_set_message(t('There is a problem with the site. Please contact |
473 | 469 | the system administrator.'), 'error', FALSE); |
474 | 470 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $stats_xml = NULL; |
75 | 75 | |
76 | - switch($chart_size) { |
|
76 | + switch ($chart_size) { |
|
77 | 77 | case 'small': |
78 | 78 | $cache_name .= "{$cpid}_small"; |
79 | 79 | $dataset_size = 30; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Initialize the cache object and flush stale images |
102 | - $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache')); |
|
102 | + $myCache = new pCache(array('CacheFolder' => realpath('.').'/'.conf_path().'/files/cache')); |
|
103 | 103 | $myCache->removeOlderThan(60*60*24); |
104 | 104 | |
105 | 105 | if ($myCache->isInCache($cache_name)) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if ($stats_xml) { |
113 | 113 | // Get the last 60 days of stats for the chart |
114 | 114 | for ($j = 30; $j < 90; $j++) { |
115 | - $dataset[] = (int) $stats_xml->records->record[$j]; |
|
115 | + $dataset[] = (int)$stats_xml->records->record[$j]; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | else { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $MyData->addPoints($dataset, 'series1'); |
133 | 133 | $MyData->setPalette('series1', $palette_color); |
134 | - $MyData->setAxisPosition(0,AXIS_POSITION_RIGHT); |
|
134 | + $MyData->setAxisPosition(0, AXIS_POSITION_RIGHT); |
|
135 | 135 | |
136 | 136 | // Create the pChart object |
137 | 137 | $myPicture = new pImage($chart_width, $chart_height, $MyData); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($label_x_axis) { |
177 | 177 | for ($i = 5; $i >= 0; $i--) { |
178 | 178 | $label = ($i) ? -10*$i : 'Today'; |
179 | - $myPicture->drawText(589-587*($i/6)-5, 2, $label, array('Align' => TEXT_ALIGN_TOPRIGHT)); |
|
179 | + $myPicture->drawText(589 - 587*($i/6) - 5, 2, $label, array('Align' => TEXT_ALIGN_TOPRIGHT)); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | // Initialize the cache object and flush stale images |
224 | - $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache')); |
|
224 | + $myCache = new pCache(array('CacheFolder' => realpath('.').'/'.conf_path().'/files/cache')); |
|
225 | 225 | $myCache->removeOlderThan(60*60*24); |
226 | 226 | |
227 | 227 | if ($myCache->isInCache($cache_name)) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | if ($stats_xml) { |
235 | 235 | // Get the last 60 days of stats for the chart |
236 | 236 | for ($j = 30; $j < 90; $j++) { |
237 | - $dataset[] = (int) $stats_xml->records->record[$j]; |
|
237 | + $dataset[] = (int)$stats_xml->records->record[$j]; |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | else { |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | |
247 | 247 | $MyData->addPoints($dataset, 'series1'); |
248 | 248 | $MyData->setPalette('series1', $palette_color); |
249 | - $MyData->setAxisPosition(0,AXIS_POSITION_RIGHT); |
|
249 | + $MyData->setAxisPosition(0, AXIS_POSITION_RIGHT); |
|
250 | 250 | |
251 | 251 | // Create the pChart object |
252 | - $myPicture = new pImage(266,80,$MyData); |
|
252 | + $myPicture = new pImage(266, 80, $MyData); |
|
253 | 253 | |
254 | 254 | // Turn on Antialiasing |
255 | 255 | $myPicture->Antialias = true; |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | //$myPicture->setFontProperties(array('FontName' => '../fonts/pf_arma_five.ttf','FontSize' => 6)); |
259 | 259 | |
260 | 260 | // Define the chart area |
261 | - $myPicture->setGraphArea(0,0,266,80); |
|
262 | - $myPicture->drawFilledRectangle(0,0,266,80,$backdrop_color); |
|
261 | + $myPicture->setGraphArea(0, 0, 266, 80); |
|
262 | + $myPicture->drawFilledRectangle(0, 0, 266, 80, $backdrop_color); |
|
263 | 263 | |
264 | 264 | // Draw the scale |
265 | 265 | $scaleSettings = array( |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * |
308 | 308 | */ |
309 | 309 | function boincstats_check_cache_dir($cache_path = 'files/cache') { |
310 | - $cache_dir = realpath('.') . '/' . conf_path() . '/' . $cache_path; |
|
310 | + $cache_dir = realpath('.').'/'.conf_path().'/'.$cache_path; |
|
311 | 311 | if (!is_writeable($cache_dir)) { |
312 | 312 | if (!is_dir($cache_dir)) { |
313 | 313 | if (!is_writeable(dirname($cache_dir))) { |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | $args = array(); |
370 | 370 | foreach ($get as $arg => $value) { |
371 | 371 | if ($value !== NULL) { |
372 | - $args[] = "{$arg}=" . rawurlencode($value); |
|
372 | + $args[] = "{$arg}=".rawurlencode($value); |
|
373 | 373 | } |
374 | 374 | else { |
375 | 375 | $args[] = $arg; |
376 | 376 | } |
377 | 377 | } |
378 | - $query = '?' . implode('&', $args); |
|
378 | + $query = '?'.implode('&', $args); |
|
379 | 379 | |
380 | 380 | // Load XML from RPC |
381 | 381 | $stats_xml = NULL; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | function boincstats_get_project_total_credit() { |
395 | 395 | $stats_xml = boincstats_get_project_stats(); |
396 | 396 | $last_record = end($stats_xml->records->record); |
397 | - return ($last_record) ? (int) $last_record : 0; |
|
397 | + return ($last_record) ? (int)$last_record : 0; |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /* |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * |
410 | 410 | */ |
411 | 411 | function boincstats_credit_to_ghours($credit) { |
412 | - return $credit / (100 * 365); |
|
412 | + return $credit/(100*365); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /* |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | 't' => 6, |
423 | 423 | 'p' => 9 |
424 | 424 | ); |
425 | - return $credit / (pow(10, (int) $factor[$prefix]) / 10); |
|
425 | + return $credit/(pow(10, (int)$factor[$prefix])/10); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | $output = ''; |
436 | 436 | switch ($type) { |
437 | 437 | case 'basic': |
438 | - $output .= '<div class="overlay"><span>(' . bts('Credits per day', array(), NULL, 'boinc:front-page') . ')</span></div>' . "\n"; |
|
439 | - $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n"; |
|
438 | + $output .= '<div class="overlay"><span>('.bts('Credits per day', array(), NULL, 'boinc:front-page').')</span></div>'."\n"; |
|
439 | + $output .= '<div class="chart"><img src="'.$base_path.'charts/project" /></div>'."\n"; |
|
440 | 440 | break; |
441 | 441 | case 'detailed': |
442 | - $output .= '<div class="stats"><label>' . bts('Total G-hours', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())) . '</span></div>' . "\n"; |
|
443 | - $output .= '<div class="stats"><label>' . bts('Avg TFlops', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')) . '</span></div>' . "\n"; |
|
442 | + $output .= '<div class="stats"><label>'.bts('Total G-hours', array(), NULL, 'boinc:front-page').': </label><span>'.number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())).'</span></div>'."\n"; |
|
443 | + $output .= '<div class="stats"><label>'.bts('Avg TFlops', array(), NULL, 'boinc:front-page').': </label><span>'.number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')).'</span></div>'."\n"; |
|
444 | 444 | //$output .= '<div class="stats"><a href="#">' . bts('Pending credits', array(), NULL, 'boinc:front-page') . '</a></div>' . "\n"; |
445 | - $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n"; |
|
445 | + $output .= '<div class="chart"><img src="'.$base_path.'charts/project" /></div>'."\n"; |
|
446 | 446 | break; |
447 | 447 | default: |
448 | 448 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | $dataset_size = 0; |
69 | 69 | $chart_height = 0; |
70 | 70 | $chart_width = 0; |
71 | - $draw_x_lines = FALSE; |
|
72 | - $label_x_axis = FALSE; |
|
71 | + $draw_x_lines = false; |
|
72 | + $label_x_axis = false; |
|
73 | 73 | |
74 | - $stats_xml = NULL; |
|
74 | + $stats_xml = null; |
|
75 | 75 | |
76 | 76 | switch($chart_size) { |
77 | 77 | case 'small': |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | $chart_height = 80; |
81 | 81 | $chart_width = 266; |
82 | 82 | //$backdrop_color = array('R'=>238,'G'=>238,'B'=>238); |
83 | - $draw_x_lines = FALSE; |
|
84 | - $label_x_axis = FALSE; |
|
83 | + $draw_x_lines = false; |
|
84 | + $label_x_axis = false; |
|
85 | 85 | break; |
86 | 86 | case 'medium': |
87 | 87 | default: |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $dataset_size = 60; |
90 | 90 | $chart_height = 155; |
91 | 91 | $chart_width = 589; |
92 | - $draw_x_lines = TRUE; |
|
93 | - $label_x_axis = TRUE; |
|
92 | + $draw_x_lines = true; |
|
93 | + $label_x_axis = true; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // Sanity check for cache directory |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'OuterTickWidth' => 0, |
164 | 164 | 'XMargin' => 1, |
165 | 165 | 'YMargin' => 0, |
166 | - 'Floating' => TRUE, |
|
166 | + 'Floating' => true, |
|
167 | 167 | 'GridR' => 200, |
168 | 168 | 'GridG' => 200, |
169 | 169 | 'GridB' => 200, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'OuterTickWidth' => 0, |
277 | 277 | 'XMargin' => 1, |
278 | 278 | 'YMargin' => 0, |
279 | - 'Floating' => TRUE, |
|
279 | + 'Floating' => true, |
|
280 | 280 | 'GridR' => 200, |
281 | 281 | 'GridG' => 200, |
282 | 282 | 'GridB' => 200, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | watchdog('boincstats', '@parent_dir directory is not writeable. This |
316 | 316 | directory must be writeable by the web server.', |
317 | 317 | array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
318 | - return FALSE; |
|
318 | + return false; |
|
319 | 319 | } |
320 | 320 | else { |
321 | 321 | // Create the cache dir |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
324 | 324 | filesystem permissions...?', |
325 | 325 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
326 | - return FALSE; |
|
326 | + return false; |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | } |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
332 | 332 | Please allow webserver write access.', |
333 | 333 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
334 | - return FALSE; |
|
334 | + return false; |
|
335 | 335 | } |
336 | 336 | } |
337 | - return TRUE; |
|
337 | + return true; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /* |
341 | 341 | * |
342 | 342 | */ |
343 | -function boincstats_get_project_stats($type = 'total', $cpid = NULL) { |
|
343 | +function boincstats_get_project_stats($type = 'total', $cpid = null) { |
|
344 | 344 | |
345 | 345 | // Determine the stats environment |
346 | 346 | boincstats_check_configuration(); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | ); |
354 | 354 | switch ($type) { |
355 | 355 | case 'daily': |
356 | - $get['daily'] = NULL; |
|
356 | + $get['daily'] = null; |
|
357 | 357 | break; |
358 | 358 | case 'total': |
359 | 359 | default: |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | // Construct query string |
369 | 369 | $args = array(); |
370 | 370 | foreach ($get as $arg => $value) { |
371 | - if ($value !== NULL) { |
|
371 | + if ($value !== null) { |
|
372 | 372 | $args[] = "{$arg}=" . rawurlencode($value); |
373 | 373 | } |
374 | 374 | else { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $query = '?' . implode('&', $args); |
379 | 379 | |
380 | 380 | // Load XML from RPC |
381 | - $stats_xml = NULL; |
|
381 | + $stats_xml = null; |
|
382 | 382 | $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
383 | 383 | $result = drupal_http_request($target_url); |
384 | 384 | if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { |
@@ -435,12 +435,12 @@ discard block |
||
435 | 435 | $output = ''; |
436 | 436 | switch ($type) { |
437 | 437 | case 'basic': |
438 | - $output .= '<div class="overlay"><span>(' . bts('Credits per day', array(), NULL, 'boinc:front-page') . ')</span></div>' . "\n"; |
|
438 | + $output .= '<div class="overlay"><span>(' . bts('Credits per day', array(), null, 'boinc:front-page') . ')</span></div>' . "\n"; |
|
439 | 439 | $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n"; |
440 | 440 | break; |
441 | 441 | case 'detailed': |
442 | - $output .= '<div class="stats"><label>' . bts('Total G-hours', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())) . '</span></div>' . "\n"; |
|
443 | - $output .= '<div class="stats"><label>' . bts('Avg TFlops', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')) . '</span></div>' . "\n"; |
|
442 | + $output .= '<div class="stats"><label>' . bts('Total G-hours', array(), null, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())) . '</span></div>' . "\n"; |
|
443 | + $output .= '<div class="stats"><label>' . bts('Avg TFlops', array(), null, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')) . '</span></div>' . "\n"; |
|
444 | 444 | //$output .= '<div class="stats"><a href="#">' . bts('Pending credits', array(), NULL, 'boinc:front-page') . '</a></div>' . "\n"; |
445 | 445 | $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n"; |
446 | 446 | break; |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | if (user_access('administer site configuration')) { |
467 | 467 | drupal_set_message(t('The BOINC stats system is not configured. Please |
468 | 468 | !configure_it', array('!configure_it' => l(t('configure it now'), |
469 | - 'admin/boinc/stats'))), 'error', FALSE); |
|
469 | + 'admin/boinc/stats'))), 'error', false); |
|
470 | 470 | } |
471 | 471 | else { |
472 | 472 | drupal_set_message(t('There is a problem with the site. Please contact |
473 | - the system administrator.'), 'error', FALSE); |
|
473 | + the system administrator.'), 'error', false); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | } |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | // $Id$ |
3 | 3 | |
4 | 4 | /** |
5 | - * @file |
|
6 | - * Enable BOINC charting features for statistics |
|
7 | - */ |
|
5 | + * @file |
|
6 | + * Enable BOINC charting features for statistics |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | |
10 | 10 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
19 | 19 | |
20 | 20 | /** |
21 | - * Implementation of hook_menu(). |
|
22 | - */ |
|
21 | + * Implementation of hook_menu(). |
|
22 | + */ |
|
23 | 23 | function boincstats_menu() { |
24 | - $items['admin/boinc/stats'] = array( |
|
24 | + $items['admin/boinc/stats'] = array( |
|
25 | 25 | 'title' => 'Environment: Statistics setup', |
26 | 26 | 'description' => 'Configure the stats system for generating charts and |
27 | 27 | providing cross project data.', |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | 'access arguments' => array('administer site configuration'), |
31 | 31 | 'type' => MENU_NORMAL_ITEM, |
32 | 32 | 'file' => 'boincstats.admin.inc' |
33 | - ); |
|
34 | - $items['charts/user'] = array( |
|
33 | + ); |
|
34 | + $items['charts/user'] = array( |
|
35 | 35 | 'page callback' => 'boincstats_get_user_stats_chart', |
36 | 36 | 'access arguments' => array('access content'), |
37 | 37 | 'type' => MENU_CALLBACK |
38 | - ); |
|
39 | - $items['charts/project'] = array( |
|
38 | + ); |
|
39 | + $items['charts/project'] = array( |
|
40 | 40 | 'page callback' => 'boincstats_get_project_stats_chart', |
41 | 41 | 'access arguments' => array('access content'), |
42 | 42 | 'type' => MENU_CALLBACK |
43 | - ); |
|
44 | - return $items; |
|
43 | + ); |
|
44 | + return $items; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -50,31 +50,31 @@ discard block |
||
50 | 50 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
51 | 51 | |
52 | 52 | /** |
53 | - * User stats chart menu callback |
|
54 | - * Called to generate the daily credit status chart for a user (dashboard) |
|
55 | - */ |
|
53 | + * User stats chart menu callback |
|
54 | + * Called to generate the daily credit status chart for a user (dashboard) |
|
55 | + */ |
|
56 | 56 | function boincstats_get_user_stats_chart($cpid = null, $chart_size = 'medium') { |
57 | 57 | |
58 | - // pChart library inclusions |
|
59 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class'); |
|
60 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class'); |
|
61 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class'); |
|
62 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class'); |
|
58 | + // pChart library inclusions |
|
59 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class'); |
|
60 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class'); |
|
61 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class'); |
|
62 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class'); |
|
63 | 63 | |
64 | - init_theme(); |
|
65 | - global $theme_key; |
|
66 | - $cache_name = "{$theme_key}_"; |
|
64 | + init_theme(); |
|
65 | + global $theme_key; |
|
66 | + $cache_name = "{$theme_key}_"; |
|
67 | 67 | |
68 | - $dataset_size = 0; |
|
69 | - $chart_height = 0; |
|
70 | - $chart_width = 0; |
|
71 | - $draw_x_lines = FALSE; |
|
72 | - $label_x_axis = FALSE; |
|
68 | + $dataset_size = 0; |
|
69 | + $chart_height = 0; |
|
70 | + $chart_width = 0; |
|
71 | + $draw_x_lines = FALSE; |
|
72 | + $label_x_axis = FALSE; |
|
73 | 73 | |
74 | - $stats_xml = NULL; |
|
74 | + $stats_xml = NULL; |
|
75 | 75 | |
76 | - switch($chart_size) { |
|
77 | - case 'small': |
|
76 | + switch($chart_size) { |
|
77 | + case 'small': |
|
78 | 78 | $cache_name .= "{$cpid}_small"; |
79 | 79 | $dataset_size = 30; |
80 | 80 | $chart_height = 80; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $draw_x_lines = FALSE; |
84 | 84 | $label_x_axis = FALSE; |
85 | 85 | break; |
86 | - case 'medium': |
|
86 | + case 'medium': |
|
87 | 87 | default: |
88 | 88 | $cache_name .= $cpid; |
89 | 89 | $dataset_size = 60; |
@@ -91,32 +91,32 @@ discard block |
||
91 | 91 | $chart_width = 589; |
92 | 92 | $draw_x_lines = TRUE; |
93 | 93 | $label_x_axis = TRUE; |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - // Sanity check for cache directory |
|
97 | - if (!boincstats_check_cache_dir()) { |
|
96 | + // Sanity check for cache directory |
|
97 | + if (!boincstats_check_cache_dir()) { |
|
98 | 98 | return; |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - // Initialize the cache object and flush stale images |
|
102 | - $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache')); |
|
103 | - $myCache->removeOlderThan(60*60*24); |
|
101 | + // Initialize the cache object and flush stale images |
|
102 | + $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache')); |
|
103 | + $myCache->removeOlderThan(60*60*24); |
|
104 | 104 | |
105 | - if ($myCache->isInCache($cache_name)) { |
|
105 | + if ($myCache->isInCache($cache_name)) { |
|
106 | 106 | $myCache->strokeFromCache($cache_name); |
107 | - } |
|
108 | - else { |
|
107 | + } |
|
108 | + else { |
|
109 | 109 | // Initialize dataset |
110 | 110 | $dataset = array(); |
111 | 111 | $stats_xml = boincstats_get_project_stats('daily', $cpid); |
112 | 112 | if ($stats_xml) { |
113 | - // Get the last 60 days of stats for the chart |
|
114 | - for ($j = 30; $j < 90; $j++) { |
|
113 | + // Get the last 60 days of stats for the chart |
|
114 | + for ($j = 30; $j < 90; $j++) { |
|
115 | 115 | $dataset[] = (int) $stats_xml->records->record[$j]; |
116 | - } |
|
116 | + } |
|
117 | 117 | } |
118 | 118 | else { |
119 | - for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
119 | + for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Get color configuration |
@@ -145,39 +145,39 @@ discard block |
||
145 | 145 | // Define the chart area |
146 | 146 | $myPicture->setGraphArea(0, 3, $chart_width, $chart_height); |
147 | 147 | if ($backdrop_color) { |
148 | - $myPicture->drawFilledRectangle(0, 0, $chart_width, $chart_height, $backdrop_color); |
|
148 | + $myPicture->drawFilledRectangle(0, 0, $chart_width, $chart_height, $backdrop_color); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Draw the scale |
152 | 152 | $scaleSettings = array( |
153 | - 'Mode' => SCALE_MODE_START0, |
|
154 | - 'DrawYLines' => false, |
|
155 | - 'DrawXLines' => $draw_x_lines, |
|
156 | - 'GridTicks' => 2, |
|
157 | - 'LabelSkip' => 9, |
|
158 | - 'SkippedAxisAlpha' => 0, |
|
159 | - 'SkippedInnerTickWidth' => 0, |
|
160 | - 'SkippedOuterTickWidth' => 0, |
|
161 | - 'AxisAlpha' => 0, |
|
162 | - 'InnerTickWidth' => 0, |
|
163 | - 'OuterTickWidth' => 0, |
|
164 | - 'XMargin' => 1, |
|
165 | - 'YMargin' => 0, |
|
166 | - 'Floating' => TRUE, |
|
167 | - 'GridR' => 200, |
|
168 | - 'GridG' => 200, |
|
169 | - 'GridB' => 200, |
|
170 | - 'DrawSubTicks' => false, |
|
171 | - 'CycleBackground' => false |
|
153 | + 'Mode' => SCALE_MODE_START0, |
|
154 | + 'DrawYLines' => false, |
|
155 | + 'DrawXLines' => $draw_x_lines, |
|
156 | + 'GridTicks' => 2, |
|
157 | + 'LabelSkip' => 9, |
|
158 | + 'SkippedAxisAlpha' => 0, |
|
159 | + 'SkippedInnerTickWidth' => 0, |
|
160 | + 'SkippedOuterTickWidth' => 0, |
|
161 | + 'AxisAlpha' => 0, |
|
162 | + 'InnerTickWidth' => 0, |
|
163 | + 'OuterTickWidth' => 0, |
|
164 | + 'XMargin' => 1, |
|
165 | + 'YMargin' => 0, |
|
166 | + 'Floating' => TRUE, |
|
167 | + 'GridR' => 200, |
|
168 | + 'GridG' => 200, |
|
169 | + 'GridB' => 200, |
|
170 | + 'DrawSubTicks' => false, |
|
171 | + 'CycleBackground' => false |
|
172 | 172 | ); |
173 | 173 | $myPicture->setFontProperties(array('FontSize' => 10)); |
174 | 174 | $myPicture->drawScale($scaleSettings); |
175 | 175 | |
176 | 176 | if ($label_x_axis) { |
177 | - for ($i = 5; $i >= 0; $i--) { |
|
177 | + for ($i = 5; $i >= 0; $i--) { |
|
178 | 178 | $label = ($i) ? -10*$i : 'Today'; |
179 | 179 | $myPicture->drawText(589-587*($i/6)-5, 2, $label, array('Align' => TEXT_ALIGN_TOPRIGHT)); |
180 | - } |
|
180 | + } |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Draw the area chart |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // Render the picture (choose the best way) |
190 | 190 | //$myPicture->autoOutput('pictures/example.drawAreaChart.simple.png'); |
191 | 191 | $myPicture->stroke(); |
192 | - } |
|
192 | + } |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -197,48 +197,48 @@ discard block |
||
197 | 197 | * Called to generate the daily credit status chart for the whole project |
198 | 198 | */ |
199 | 199 | function boincstats_get_project_stats_chart() { |
200 | - // pChart library inclusions |
|
201 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class'); |
|
202 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class'); |
|
203 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class'); |
|
204 | - module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class'); |
|
205 | - |
|
206 | - init_theme(); |
|
207 | - global $theme_key; |
|
208 | - $cache_name = "{$theme_key}_project_chart"; |
|
209 | - |
|
210 | - $color_keys = array('R', 'G', 'B'); |
|
211 | - |
|
212 | - // Get color configuration |
|
213 | - $palette_color_hex = theme_get_setting('boinc_stats_chart_color'); |
|
214 | - $palette_color = array_combine($color_keys, sscanf($palette_color_hex, "#%02x%02x%02x")); |
|
215 | - $backdrop_color_hex = theme_get_setting('boinc_stats_chart_bcolor'); |
|
216 | - $backdrop_color = array_combine($color_keys, sscanf($backdrop_color_hex, "#%02x%02x%02x")); |
|
217 | - |
|
218 | - // Sanity check for cache directory |
|
219 | - if (!boincstats_check_cache_dir()) { |
|
200 | + // pChart library inclusions |
|
201 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class'); |
|
202 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class'); |
|
203 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class'); |
|
204 | + module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class'); |
|
205 | + |
|
206 | + init_theme(); |
|
207 | + global $theme_key; |
|
208 | + $cache_name = "{$theme_key}_project_chart"; |
|
209 | + |
|
210 | + $color_keys = array('R', 'G', 'B'); |
|
211 | + |
|
212 | + // Get color configuration |
|
213 | + $palette_color_hex = theme_get_setting('boinc_stats_chart_color'); |
|
214 | + $palette_color = array_combine($color_keys, sscanf($palette_color_hex, "#%02x%02x%02x")); |
|
215 | + $backdrop_color_hex = theme_get_setting('boinc_stats_chart_bcolor'); |
|
216 | + $backdrop_color = array_combine($color_keys, sscanf($backdrop_color_hex, "#%02x%02x%02x")); |
|
217 | + |
|
218 | + // Sanity check for cache directory |
|
219 | + if (!boincstats_check_cache_dir()) { |
|
220 | 220 | return; |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | - // Initialize the cache object and flush stale images |
|
224 | - $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache')); |
|
225 | - $myCache->removeOlderThan(60*60*24); |
|
223 | + // Initialize the cache object and flush stale images |
|
224 | + $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache')); |
|
225 | + $myCache->removeOlderThan(60*60*24); |
|
226 | 226 | |
227 | - if ($myCache->isInCache($cache_name)) { |
|
227 | + if ($myCache->isInCache($cache_name)) { |
|
228 | 228 | $myCache->strokeFromCache($cache_name); |
229 | - } |
|
230 | - else { |
|
229 | + } |
|
230 | + else { |
|
231 | 231 | // Initialize dataset |
232 | 232 | $dataset = array(); |
233 | 233 | $stats_xml = boincstats_get_project_stats('daily'); |
234 | 234 | if ($stats_xml) { |
235 | - // Get the last 60 days of stats for the chart |
|
236 | - for ($j = 30; $j < 90; $j++) { |
|
235 | + // Get the last 60 days of stats for the chart |
|
236 | + for ($j = 30; $j < 90; $j++) { |
|
237 | 237 | $dataset[] = (int) $stats_xml->records->record[$j]; |
238 | - } |
|
238 | + } |
|
239 | 239 | } |
240 | 240 | else { |
241 | - for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
241 | + for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | // Create and populate the pData object |
@@ -263,25 +263,25 @@ discard block |
||
263 | 263 | |
264 | 264 | // Draw the scale |
265 | 265 | $scaleSettings = array( |
266 | - 'Mode' => SCALE_MODE_START0, |
|
267 | - 'DrawYLines' => false, |
|
268 | - 'DrawXLines' => false, |
|
269 | - 'GridTicks' => 2, |
|
270 | - 'LabelSkip' => 9, |
|
271 | - 'SkippedAxisAlpha' => 0, |
|
272 | - 'SkippedInnerTickWidth' => 0, |
|
273 | - 'SkippedOuterTickWidth' => 0, |
|
274 | - 'AxisAlpha' => 0, |
|
275 | - 'InnerTickWidth' => 0, |
|
276 | - 'OuterTickWidth' => 0, |
|
277 | - 'XMargin' => 1, |
|
278 | - 'YMargin' => 0, |
|
279 | - 'Floating' => TRUE, |
|
280 | - 'GridR' => 200, |
|
281 | - 'GridG' => 200, |
|
282 | - 'GridB' => 200, |
|
283 | - 'DrawSubTicks' => false, |
|
284 | - 'CycleBackground' => false |
|
266 | + 'Mode' => SCALE_MODE_START0, |
|
267 | + 'DrawYLines' => false, |
|
268 | + 'DrawXLines' => false, |
|
269 | + 'GridTicks' => 2, |
|
270 | + 'LabelSkip' => 9, |
|
271 | + 'SkippedAxisAlpha' => 0, |
|
272 | + 'SkippedInnerTickWidth' => 0, |
|
273 | + 'SkippedOuterTickWidth' => 0, |
|
274 | + 'AxisAlpha' => 0, |
|
275 | + 'InnerTickWidth' => 0, |
|
276 | + 'OuterTickWidth' => 0, |
|
277 | + 'XMargin' => 1, |
|
278 | + 'YMargin' => 0, |
|
279 | + 'Floating' => TRUE, |
|
280 | + 'GridR' => 200, |
|
281 | + 'GridG' => 200, |
|
282 | + 'GridB' => 200, |
|
283 | + 'DrawSubTicks' => false, |
|
284 | + 'CycleBackground' => false |
|
285 | 285 | ); |
286 | 286 | $myPicture->setFontProperties(array('FontSize' => 10)); |
287 | 287 | $myPicture->drawScale($scaleSettings); |
@@ -300,41 +300,41 @@ discard block |
||
300 | 300 | // Render the picture (choose the best way) |
301 | 301 | //$myPicture->autoOutput('pictures/example.drawAreaChart.simple.png'); |
302 | 302 | $myPicture->stroke(); |
303 | - } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /* |
307 | 307 | * |
308 | 308 | */ |
309 | 309 | function boincstats_check_cache_dir($cache_path = 'files/cache') { |
310 | - $cache_dir = realpath('.') . '/' . conf_path() . '/' . $cache_path; |
|
311 | - if (!is_writeable($cache_dir)) { |
|
310 | + $cache_dir = realpath('.') . '/' . conf_path() . '/' . $cache_path; |
|
311 | + if (!is_writeable($cache_dir)) { |
|
312 | 312 | if (!is_dir($cache_dir)) { |
313 | - if (!is_writeable(dirname($cache_dir))) { |
|
313 | + if (!is_writeable(dirname($cache_dir))) { |
|
314 | 314 | // If the parent "files" dir isn't even writeable... |
315 | 315 | watchdog('boincstats', '@parent_dir directory is not writeable. This |
316 | 316 | directory must be writeable by the web server.', |
317 | - array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
|
317 | + array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
|
318 | 318 | return FALSE; |
319 | - } |
|
320 | - else { |
|
319 | + } |
|
320 | + else { |
|
321 | 321 | // Create the cache dir |
322 | 322 | if (!mkdir($cache_dir, 0775)) { |
323 | - watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
|
323 | + watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
|
324 | 324 | filesystem permissions...?', |
325 | 325 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
326 | - return FALSE; |
|
326 | + return FALSE; |
|
327 | + } |
|
327 | 328 | } |
328 | - } |
|
329 | 329 | } |
330 | 330 | else { |
331 | - watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
|
331 | + watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
|
332 | 332 | Please allow webserver write access.', |
333 | 333 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
334 | - return FALSE; |
|
334 | + return FALSE; |
|
335 | 335 | } |
336 | - } |
|
337 | - return TRUE; |
|
336 | + } |
|
337 | + return TRUE; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /* |
@@ -342,87 +342,87 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function boincstats_get_project_stats($type = 'total', $cpid = NULL) { |
344 | 344 | |
345 | - // Determine the stats environment |
|
346 | - boincstats_check_configuration(); |
|
347 | - $stats_server = variable_get('boinc_stats_server', ''); |
|
348 | - $stats_rpc = variable_get('boinc_stats_project_credit_history_rpc', ''); |
|
349 | - $project_id = variable_get('boinc_stats_remote_project_id', ''); |
|
345 | + // Determine the stats environment |
|
346 | + boincstats_check_configuration(); |
|
347 | + $stats_server = variable_get('boinc_stats_server', ''); |
|
348 | + $stats_rpc = variable_get('boinc_stats_project_credit_history_rpc', ''); |
|
349 | + $project_id = variable_get('boinc_stats_remote_project_id', ''); |
|
350 | 350 | |
351 | - $get = array( |
|
351 | + $get = array( |
|
352 | 352 | 'id' => $project_id |
353 | - ); |
|
354 | - switch ($type) { |
|
355 | - case 'daily': |
|
353 | + ); |
|
354 | + switch ($type) { |
|
355 | + case 'daily': |
|
356 | 356 | $get['daily'] = NULL; |
357 | 357 | break; |
358 | - case 'total': |
|
358 | + case 'total': |
|
359 | 359 | default: |
360 | 360 | } |
361 | 361 | |
362 | - if ($cpid) { |
|
362 | + if ($cpid) { |
|
363 | 363 | // If a user CPID has been provided, limit scope to that user |
364 | 364 | $stats_rpc = variable_get('boinc_stats_user_credit_history_rpc', ''); |
365 | 365 | $get['cpid'] = $cpid; |
366 | - } |
|
366 | + } |
|
367 | 367 | |
368 | - // Construct query string |
|
369 | - $args = array(); |
|
370 | - foreach ($get as $arg => $value) { |
|
368 | + // Construct query string |
|
369 | + $args = array(); |
|
370 | + foreach ($get as $arg => $value) { |
|
371 | 371 | if ($value !== NULL) { |
372 | - $args[] = "{$arg}=" . rawurlencode($value); |
|
372 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
373 | 373 | } |
374 | 374 | else { |
375 | - $args[] = $arg; |
|
375 | + $args[] = $arg; |
|
376 | 376 | } |
377 | - } |
|
378 | - $query = '?' . implode('&', $args); |
|
377 | + } |
|
378 | + $query = '?' . implode('&', $args); |
|
379 | 379 | |
380 | - // Load XML from RPC |
|
381 | - $stats_xml = NULL; |
|
382 | - $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
|
383 | - $result = drupal_http_request($target_url); |
|
384 | - if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { |
|
380 | + // Load XML from RPC |
|
381 | + $stats_xml = NULL; |
|
382 | + $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
|
383 | + $result = drupal_http_request($target_url); |
|
384 | + if (in_array($result->code, array(200, 304)) || in_array($result->redirect_code, array(200, 304))) { |
|
385 | 385 | $stats_xml = simplexml_load_string($result->data); |
386 | - } |
|
387 | - watchdog('boincstats', $target_url); |
|
388 | - return $stats_xml; |
|
386 | + } |
|
387 | + watchdog('boincstats', $target_url); |
|
388 | + return $stats_xml; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /* |
392 | 392 | * |
393 | 393 | */ |
394 | 394 | function boincstats_get_project_total_credit() { |
395 | - $stats_xml = boincstats_get_project_stats(); |
|
396 | - $last_record = end($stats_xml->records->record); |
|
397 | - return ($last_record) ? (int) $last_record : 0; |
|
395 | + $stats_xml = boincstats_get_project_stats(); |
|
396 | + $last_record = end($stats_xml->records->record); |
|
397 | + return ($last_record) ? (int) $last_record : 0; |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /* |
401 | 401 | * |
402 | 402 | */ |
403 | 403 | function boincstats_get_project_avg_credit() { |
404 | - $stats_xml = boincstats_get_project_stats(); |
|
405 | - return (isset($stats_xml->recent_avg)) ? $stats_xml->recent_avg : 0; |
|
404 | + $stats_xml = boincstats_get_project_stats(); |
|
405 | + return (isset($stats_xml->recent_avg)) ? $stats_xml->recent_avg : 0; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /* |
409 | 409 | * |
410 | 410 | */ |
411 | 411 | function boincstats_credit_to_ghours($credit) { |
412 | - return $credit / (100 * 365); |
|
412 | + return $credit / (100 * 365); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /* |
416 | 416 | * |
417 | 417 | */ |
418 | 418 | function boincstats_credit_to_flops($credit, $prefix = 0) { |
419 | - $factor = array( |
|
419 | + $factor = array( |
|
420 | 420 | '0' => 0, |
421 | 421 | 'g' => 3, |
422 | 422 | 't' => 6, |
423 | 423 | 'p' => 9 |
424 | - ); |
|
425 | - return $credit / (pow(10, (int) $factor[$prefix]) / 10); |
|
424 | + ); |
|
425 | + return $credit / (pow(10, (int) $factor[$prefix]) / 10); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -431,22 +431,22 @@ discard block |
||
431 | 431 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
432 | 432 | |
433 | 433 | function boincstats_get_project_stats_overview($type = 'basic') { |
434 | - global $base_path; |
|
435 | - $output = ''; |
|
436 | - switch ($type) { |
|
437 | - case 'basic': |
|
434 | + global $base_path; |
|
435 | + $output = ''; |
|
436 | + switch ($type) { |
|
437 | + case 'basic': |
|
438 | 438 | $output .= '<div class="overlay"><span>(' . bts('Credits per day', array(), NULL, 'boinc:front-page') . ')</span></div>' . "\n"; |
439 | 439 | $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n"; |
440 | 440 | break; |
441 | - case 'detailed': |
|
441 | + case 'detailed': |
|
442 | 442 | $output .= '<div class="stats"><label>' . bts('Total G-hours', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())) . '</span></div>' . "\n"; |
443 | 443 | $output .= '<div class="stats"><label>' . bts('Avg TFlops', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')) . '</span></div>' . "\n"; |
444 | 444 | //$output .= '<div class="stats"><a href="#">' . bts('Pending credits', array(), NULL, 'boinc:front-page') . '</a></div>' . "\n"; |
445 | 445 | $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n"; |
446 | 446 | break; |
447 | - default: |
|
447 | + default: |
|
448 | 448 | } |
449 | - return $output; |
|
449 | + return $output; |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | |
@@ -458,19 +458,19 @@ discard block |
||
458 | 458 | * Check that the stats system is configured, report if it isn't |
459 | 459 | */ |
460 | 460 | function boincstats_check_configuration() { |
461 | - $project_id = variable_get('boinc_stats_remote_project_id', ''); |
|
462 | - if (!$project_id) { |
|
461 | + $project_id = variable_get('boinc_stats_remote_project_id', ''); |
|
462 | + if (!$project_id) { |
|
463 | 463 | watchdog('boincstats', 'The BOINC stats system is not configured. Please |
464 | 464 | !configure_it', array('!configure_it' => l(t('configure it now'), |
465 | - 'admin/boinc/stats')), WATCHDOG_ERROR); |
|
465 | + 'admin/boinc/stats')), WATCHDOG_ERROR); |
|
466 | 466 | if (user_access('administer site configuration')) { |
467 | - drupal_set_message(t('The BOINC stats system is not configured. Please |
|
467 | + drupal_set_message(t('The BOINC stats system is not configured. Please |
|
468 | 468 | !configure_it', array('!configure_it' => l(t('configure it now'), |
469 | - 'admin/boinc/stats'))), 'error', FALSE); |
|
469 | + 'admin/boinc/stats'))), 'error', FALSE); |
|
470 | 470 | } |
471 | 471 | else { |
472 | - drupal_set_message(t('There is a problem with the site. Please contact |
|
472 | + drupal_set_message(t('There is a problem with the site. Please contact |
|
473 | 473 | the system administrator.'), 'error', FALSE); |
474 | 474 | } |
475 | - } |
|
475 | + } |
|
476 | 476 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | echo "</tr>"; |
59 | 59 | |
60 | 60 | echo "<tr>"; |
61 | - echo "<th>" . tra("Rank") . "</th><th>" . tra("Name") . "</th>\n"; |
|
61 | + echo "<th>".tra("Rank")."</th><th>".tra("Name")."</th>\n"; |
|
62 | 62 | foreach ($apps as $app) { |
63 | 63 | for ($i = 0; $i < 2; $i++) { |
64 | 64 | $x = col_title($is_team, $app, $appid, $is_total, $i); |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | echo "<tr>"; |
79 | 79 | echo "<td>$i</td>"; |
80 | 80 | |
81 | - echo "<td>" . $item[0][$x] . "</td>"; |
|
81 | + echo "<td>".$item[0][$x]."</td>"; |
|
82 | 82 | $y = 1; |
83 | 83 | foreach ($apps as $app) { |
84 | 84 | $z = 0; |
85 | - echo "<td>" . format_credit($item[$y][$x][$z]) . "</td>"; |
|
85 | + echo "<td>".format_credit($item[$y][$x][$z])."</td>"; |
|
86 | 86 | $z++; |
87 | - echo "<td>" . format_credit_large($item[$y][$x][$z]) . "</td>"; |
|
87 | + echo "<td>".format_credit_large($item[$y][$x][$z])."</td>"; |
|
88 | 88 | $y++; |
89 | 89 | } |
90 | 90 | echo "</tr>"; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | |
180 | 180 | if ($is_team) { |
181 | 181 | |
182 | - $data = BoincCreditTeam::get_list("appid=$appid", $x, $offset . ", " . $items_per_page); |
|
182 | + $data = BoincCreditTeam::get_list("appid=$appid", $x, $offset.", ".$items_per_page); |
|
183 | 183 | $store = retrieve_credit_team($data); |
184 | 184 | } else { |
185 | - $data = BoincCreditUser::get_list("appid=$appid", $x, $offset . ", " . $items_per_page); |
|
185 | + $data = BoincCreditUser::get_list("appid=$appid", $x, $offset.", ".$items_per_page); |
|
186 | 186 | $store = retrieve_credit_user($data); |
187 | 187 | } |
188 | 188 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | if (!$offset) |
199 | 199 | $offset = 0; |
200 | -if ($offset % $items_per_page) |
|
200 | +if ($offset%$items_per_page) |
|
201 | 201 | $offset = 0; |
202 | 202 | |
203 | 203 | $x = $is_team ? tra("Top teams by application") : tra("Top participants by application"); |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | |
246 | 246 | if ($offset > 0) { |
247 | 247 | $new_offset = $offset - $items_per_page; |
248 | - echo "<a href=per_app_list.php?appid=$appid&is_team=$is_team&is_total=$is_total&offset=$new_offset>" . tra("Previous %1", $items_per_page) . "</a> · "; |
|
248 | + echo "<a href=per_app_list.php?appid=$appid&is_team=$is_team&is_total=$is_total&offset=$new_offset>".tra("Previous %1", $items_per_page)."</a> · "; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | if (sizeof($data[0]) == $items_per_page) { |
252 | 252 | $new_offset = $offset + $items_per_page; |
253 | - echo "<a href=per_app_list.php?appid=$appid&is_team=$is_team&is_total=$is_total&offset=$new_offset>" . tra("Next %1", $items_per_page) . "</a>"; |
|
253 | + echo "<a href=per_app_list.php?appid=$appid&is_team=$is_team&is_total=$is_total&offset=$new_offset>".tra("Next %1", $items_per_page)."</a>"; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | page_tail(); |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | * Implementation of hook_menu_default_menu_links(). |
5 | 5 | */ |
6 | 6 | function boinc_standard_menu_default_menu_links() { |
7 | - $menu_links = array(); |
|
7 | + $menu_links = array(); |
|
8 | 8 | |
9 | - // Exported menu link: menu-footer-links:https://boinc.berkeley.edu/ |
|
10 | - $menu_links['menu-footer-links:https://boinc.berkeley.edu/'] = array( |
|
9 | + // Exported menu link: menu-footer-links:https://boinc.berkeley.edu/ |
|
10 | + $menu_links['menu-footer-links:https://boinc.berkeley.edu/'] = array( |
|
11 | 11 | 'menu_name' => 'menu-footer-links', |
12 | 12 | 'link_path' => 'https://boinc.berkeley.edu/', |
13 | 13 | 'router_path' => '', |
14 | 14 | 'link_title' => 'BOINC', |
15 | 15 | 'options' => array( |
16 | - 'attributes' => array( |
|
16 | + 'attributes' => array( |
|
17 | 17 | 'title' => '', |
18 | - ), |
|
18 | + ), |
|
19 | 19 | ), |
20 | 20 | 'module' => 'menu', |
21 | 21 | 'hidden' => '0', |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | 'has_children' => '0', |
24 | 24 | 'expanded' => '0', |
25 | 25 | 'weight' => '10', |
26 | - ); |
|
27 | - // Exported menu link: primary-links:<front> |
|
28 | - $menu_links['primary-links:<front>'] = array( |
|
26 | + ); |
|
27 | + // Exported menu link: primary-links:<front> |
|
28 | + $menu_links['primary-links:<front>'] = array( |
|
29 | 29 | 'menu_name' => 'primary-links', |
30 | 30 | 'link_path' => '<front>', |
31 | 31 | 'router_path' => '', |
32 | 32 | 'link_title' => 'Home', |
33 | 33 | 'options' => array( |
34 | - 'attributes' => array( |
|
34 | + 'attributes' => array( |
|
35 | 35 | 'title' => '', |
36 | - ), |
|
36 | + ), |
|
37 | 37 | ), |
38 | 38 | 'module' => 'menu', |
39 | 39 | 'hidden' => '0', |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | 'has_children' => '0', |
42 | 42 | 'expanded' => '0', |
43 | 43 | 'weight' => '-50', |
44 | - ); |
|
45 | - // Exported menu link: primary-links:dashboard |
|
46 | - $menu_links['primary-links:dashboard'] = array( |
|
44 | + ); |
|
45 | + // Exported menu link: primary-links:dashboard |
|
46 | + $menu_links['primary-links:dashboard'] = array( |
|
47 | 47 | 'menu_name' => 'primary-links', |
48 | 48 | 'link_path' => 'dashboard', |
49 | 49 | 'router_path' => 'dashboard', |
50 | 50 | 'link_title' => 'Dashboard', |
51 | 51 | 'options' => array( |
52 | - 'attributes' => array( |
|
52 | + 'attributes' => array( |
|
53 | 53 | 'title' => '', |
54 | - ), |
|
54 | + ), |
|
55 | 55 | ), |
56 | 56 | 'module' => 'menu', |
57 | 57 | 'hidden' => '0', |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | 'expanded' => '0', |
61 | 61 | 'weight' => '-50', |
62 | 62 | 'parent_path' => 'dashboard', |
63 | - ); |
|
64 | - // Exported menu link: primary-links:user/me/edit |
|
65 | - $menu_links['primary-links:user/me/edit'] = array( |
|
63 | + ); |
|
64 | + // Exported menu link: primary-links:user/me/edit |
|
65 | + $menu_links['primary-links:user/me/edit'] = array( |
|
66 | 66 | 'menu_name' => 'primary-links', |
67 | 67 | 'link_path' => 'user/me/edit', |
68 | 68 | 'router_path' => 'user/%/edit', |
69 | 69 | 'link_title' => 'Credentials', |
70 | 70 | 'options' => array( |
71 | - 'attributes' => array( |
|
71 | + 'attributes' => array( |
|
72 | 72 | 'title' => '', |
73 | - ), |
|
73 | + ), |
|
74 | 74 | ), |
75 | 75 | 'module' => 'menu', |
76 | 76 | 'hidden' => '0', |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | 'expanded' => '0', |
80 | 80 | 'weight' => '-48', |
81 | 81 | 'parent_path' => 'dashboard', |
82 | - ); |
|
83 | - // Translatables |
|
84 | - // Use bts() function to translate additional strings. |
|
85 | - bts('Home', array(), NULL, 'boinc:menu-link'); |
|
86 | - bts('Credentials', array(), NULL, 'boinc:menu-link'); |
|
87 | - bts('Dashboard', array(), NULL, 'boinc:menu-link'); |
|
82 | + ); |
|
83 | + // Translatables |
|
84 | + // Use bts() function to translate additional strings. |
|
85 | + bts('Home', array(), NULL, 'boinc:menu-link'); |
|
86 | + bts('Credentials', array(), NULL, 'boinc:menu-link'); |
|
87 | + bts('Dashboard', array(), NULL, 'boinc:menu-link'); |
|
88 | 88 | |
89 | - return $menu_links; |
|
89 | + return $menu_links; |
|
90 | 90 | } |
@@ -82,9 +82,9 @@ |
||
82 | 82 | ); |
83 | 83 | // Translatables |
84 | 84 | // Use bts() function to translate additional strings. |
85 | - bts('Home', array(), NULL, 'boinc:menu-link'); |
|
86 | - bts('Credentials', array(), NULL, 'boinc:menu-link'); |
|
87 | - bts('Dashboard', array(), NULL, 'boinc:menu-link'); |
|
85 | + bts('Home', array(), null, 'boinc:menu-link'); |
|
86 | + bts('Credentials', array(), null, 'boinc:menu-link'); |
|
87 | + bts('Dashboard', array(), null, 'boinc:menu-link'); |
|
88 | 88 | |
89 | 89 | return $menu_links; |
90 | 90 | } |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | * Implementation of hook_menu_default_menu_links(). |
5 | 5 | */ |
6 | 6 | function user_preferences_menu_default_menu_links() { |
7 | - $menu_links = array(); |
|
7 | + $menu_links = array(); |
|
8 | 8 | |
9 | - // Exported menu link: primary-links:account/prefs |
|
10 | - $menu_links['primary-links:account/prefs'] = array( |
|
9 | + // Exported menu link: primary-links:account/prefs |
|
10 | + $menu_links['primary-links:account/prefs'] = array( |
|
11 | 11 | 'menu_name' => 'primary-links', |
12 | 12 | 'link_path' => 'account/prefs', |
13 | 13 | 'router_path' => 'account/prefs', |
14 | 14 | 'link_title' => 'Preferences', |
15 | 15 | 'options' => array( |
16 | - 'attributes' => array( |
|
16 | + 'attributes' => array( |
|
17 | 17 | 'title' => '', |
18 | - ), |
|
18 | + ), |
|
19 | 19 | ), |
20 | 20 | 'module' => 'menu', |
21 | 21 | 'hidden' => '0', |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | 'expanded' => '0', |
25 | 25 | 'weight' => '-47', |
26 | 26 | 'parent_path' => 'dashboard', |
27 | - ); |
|
28 | - // Translatables |
|
29 | - // Use bts() function to translate additional strings. |
|
30 | - bts('Preferences', array(), NULL, 'boinc:menu-link'); |
|
31 | - bts('Community', array(), NULL, 'boinc:menu-link'); |
|
32 | - bts('Privacy', array(), NULL, 'boinc:menu-link'); |
|
33 | - bts('Subscriptions', array(), NULL, 'boinc:menu-link:-1:ignoreoverwrite'); |
|
27 | + ); |
|
28 | + // Translatables |
|
29 | + // Use bts() function to translate additional strings. |
|
30 | + bts('Preferences', array(), NULL, 'boinc:menu-link'); |
|
31 | + bts('Community', array(), NULL, 'boinc:menu-link'); |
|
32 | + bts('Privacy', array(), NULL, 'boinc:menu-link'); |
|
33 | + bts('Subscriptions', array(), NULL, 'boinc:menu-link:-1:ignoreoverwrite'); |
|
34 | 34 | |
35 | - return $menu_links; |
|
35 | + return $menu_links; |
|
36 | 36 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | ); |
28 | 28 | // Translatables |
29 | 29 | // Use bts() function to translate additional strings. |
30 | - bts('Preferences', array(), NULL, 'boinc:menu-link'); |
|
31 | - bts('Community', array(), NULL, 'boinc:menu-link'); |
|
32 | - bts('Privacy', array(), NULL, 'boinc:menu-link'); |
|
33 | - bts('Subscriptions', array(), NULL, 'boinc:menu-link:-1:ignoreoverwrite'); |
|
30 | + bts('Preferences', array(), null, 'boinc:menu-link'); |
|
31 | + bts('Community', array(), null, 'boinc:menu-link'); |
|
32 | + bts('Privacy', array(), null, 'boinc:menu-link'); |
|
33 | + bts('Subscriptions', array(), null, 'boinc:menu-link:-1:ignoreoverwrite'); |
|
34 | 34 | |
35 | 35 | return $menu_links; |
36 | 36 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $view->base_table = 'node'; |
15 | 15 | $view->core = 6; |
16 | 16 | $view->api_version = '2'; |
17 | - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
17 | + $view->disabled = false; /* Edit this to true to make a default view disabled initially */ |
|
18 | 18 | $handler = $view->new_display('default', 'Defaults', 'default'); |
19 | 19 | $handler->override_option('fields', array( |
20 | 20 | 'title' => array( |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | 'operator' => '=', |
159 | 159 | 'value' => '1', |
160 | 160 | 'group' => '0', |
161 | - 'exposed' => FALSE, |
|
161 | + 'exposed' => false, |
|
162 | 162 | 'expose' => array( |
163 | - 'operator' => FALSE, |
|
163 | + 'operator' => false, |
|
164 | 164 | 'label' => '', |
165 | 165 | ), |
166 | 166 | 'id' => 'moderate', |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $handler->override_option('cache', array( |
179 | 179 | 'type' => 'none', |
180 | 180 | )); |
181 | - $handler->override_option('empty', bts('No content is in the queue for moderation.', array(), NULL, 'boinc:moderate-user-page')); |
|
181 | + $handler->override_option('empty', bts('No content is in the queue for moderation.', array(), null, 'boinc:moderate-user-page')); |
|
182 | 182 | $handler->override_option('empty_format', '4'); |
183 | 183 | $handler->override_option('use_pager', '1'); |
184 | 184 | $handler->override_option('style_plugin', 'table'); |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | 'operator' => '=', |
325 | 325 | 'value' => '1', |
326 | 326 | 'group' => '0', |
327 | - 'exposed' => FALSE, |
|
327 | + 'exposed' => false, |
|
328 | 328 | 'expose' => array( |
329 | - 'operator' => FALSE, |
|
329 | + 'operator' => false, |
|
330 | 330 | 'label' => '', |
331 | 331 | ), |
332 | 332 | 'id' => 'moderate', |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | 'profile' => 'profile', |
344 | 344 | ), |
345 | 345 | 'group' => '0', |
346 | - 'exposed' => FALSE, |
|
346 | + 'exposed' => false, |
|
347 | 347 | 'expose' => array( |
348 | - 'operator' => FALSE, |
|
348 | + 'operator' => false, |
|
349 | 349 | 'label' => '', |
350 | 350 | ), |
351 | 351 | 'id' => 'type', |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | 'relationship' => 'none', |
358 | 358 | ), |
359 | 359 | )); |
360 | - $handler->override_option('title', bts('User profile moderation queue', array(), NULL, 'boinc:moderate-user-page')); |
|
360 | + $handler->override_option('title', bts('User profile moderation queue', array(), null, 'boinc:moderate-user-page')); |
|
361 | 361 | $handler->override_option('path', 'moderate/profiles'); |
362 | 362 | $handler->override_option('menu', array( |
363 | 363 | 'type' => 'default tab', |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $view->base_table = 'node_revisions'; |
385 | 385 | $view->core = 6; |
386 | 386 | $view->api_version = '2'; |
387 | - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
387 | + $view->disabled = false; /* Edit this to true to make a default view disabled initially */ |
|
388 | 388 | $handler = $view->new_display('default', 'Defaults', 'default'); |
389 | 389 | $handler->override_option('relationships', array( |
390 | 390 | 'uid' => array( |
@@ -4,22 +4,22 @@ discard block |
||
4 | 4 | * Implementation of hook_views_default_views(). |
5 | 5 | */ |
6 | 6 | function user_profiles_views_default_views() { |
7 | - $views = array(); |
|
7 | + $views = array(); |
|
8 | 8 | |
9 | - // Exported view: moderation_queue |
|
10 | - $view = new view; |
|
11 | - $view->name = 'moderation_queue'; |
|
12 | - $view->description = ''; |
|
13 | - $view->tag = ''; |
|
14 | - $view->base_table = 'node'; |
|
15 | - $view->core = 6; |
|
16 | - $view->api_version = '2'; |
|
17 | - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
18 | - $handler = $view->new_display('default', 'Defaults', 'default'); |
|
19 | - $handler->override_option('fields', array( |
|
9 | + // Exported view: moderation_queue |
|
10 | + $view = new view; |
|
11 | + $view->name = 'moderation_queue'; |
|
12 | + $view->description = ''; |
|
13 | + $view->tag = ''; |
|
14 | + $view->base_table = 'node'; |
|
15 | + $view->core = 6; |
|
16 | + $view->api_version = '2'; |
|
17 | + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
18 | + $handler = $view->new_display('default', 'Defaults', 'default'); |
|
19 | + $handler->override_option('fields', array( |
|
20 | 20 | 'title' => array( |
21 | - 'label' => 'Title', |
|
22 | - 'alter' => array( |
|
21 | + 'label' => 'Title', |
|
22 | + 'alter' => array( |
|
23 | 23 | 'alter_text' => 0, |
24 | 24 | 'text' => '', |
25 | 25 | 'make_link' => 0, |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | 'ellipsis' => 1, |
39 | 39 | 'html' => 0, |
40 | 40 | 'strip_tags' => 0, |
41 | - ), |
|
42 | - 'empty' => '', |
|
43 | - 'hide_empty' => 0, |
|
44 | - 'empty_zero' => 0, |
|
45 | - 'hide_alter_empty' => 1, |
|
46 | - 'link_to_node' => 1, |
|
47 | - 'exclude' => 0, |
|
48 | - 'id' => 'title', |
|
49 | - 'table' => 'node', |
|
50 | - 'field' => 'title', |
|
51 | - 'relationship' => 'none', |
|
41 | + ), |
|
42 | + 'empty' => '', |
|
43 | + 'hide_empty' => 0, |
|
44 | + 'empty_zero' => 0, |
|
45 | + 'hide_alter_empty' => 1, |
|
46 | + 'link_to_node' => 1, |
|
47 | + 'exclude' => 0, |
|
48 | + 'id' => 'title', |
|
49 | + 'table' => 'node', |
|
50 | + 'field' => 'title', |
|
51 | + 'relationship' => 'none', |
|
52 | 52 | ), |
53 | 53 | 'changed' => array( |
54 | - 'label' => 'Updated date', |
|
55 | - 'alter' => array( |
|
54 | + 'label' => 'Updated date', |
|
55 | + 'alter' => array( |
|
56 | 56 | 'alter_text' => 0, |
57 | 57 | 'text' => '', |
58 | 58 | 'make_link' => 0, |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | 'ellipsis' => 1, |
72 | 72 | 'html' => 0, |
73 | 73 | 'strip_tags' => 0, |
74 | - ), |
|
75 | - 'empty' => '', |
|
76 | - 'hide_empty' => 0, |
|
77 | - 'empty_zero' => 0, |
|
78 | - 'hide_alter_empty' => 1, |
|
79 | - 'date_format' => 'time ago', |
|
80 | - 'custom_date_format' => '', |
|
81 | - 'exclude' => 0, |
|
82 | - 'id' => 'changed', |
|
83 | - 'table' => 'node', |
|
84 | - 'field' => 'changed', |
|
85 | - 'relationship' => 'none', |
|
74 | + ), |
|
75 | + 'empty' => '', |
|
76 | + 'hide_empty' => 0, |
|
77 | + 'empty_zero' => 0, |
|
78 | + 'hide_alter_empty' => 1, |
|
79 | + 'date_format' => 'time ago', |
|
80 | + 'custom_date_format' => '', |
|
81 | + 'exclude' => 0, |
|
82 | + 'id' => 'changed', |
|
83 | + 'table' => 'node', |
|
84 | + 'field' => 'changed', |
|
85 | + 'relationship' => 'none', |
|
86 | 86 | ), |
87 | 87 | 'uid' => array( |
88 | - 'label' => 'Uid', |
|
89 | - 'alter' => array( |
|
88 | + 'label' => 'Uid', |
|
89 | + 'alter' => array( |
|
90 | 90 | 'alter_text' => 0, |
91 | 91 | 'text' => '', |
92 | 92 | 'make_link' => 0, |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | 'ellipsis' => 1, |
106 | 106 | 'html' => 0, |
107 | 107 | 'strip_tags' => 0, |
108 | - ), |
|
109 | - 'empty' => '', |
|
110 | - 'hide_empty' => 0, |
|
111 | - 'empty_zero' => 0, |
|
112 | - 'hide_alter_empty' => 1, |
|
113 | - 'link_to_user' => 1, |
|
114 | - 'exclude' => 1, |
|
115 | - 'id' => 'uid', |
|
116 | - 'table' => 'users', |
|
117 | - 'field' => 'uid', |
|
118 | - 'relationship' => 'none', |
|
108 | + ), |
|
109 | + 'empty' => '', |
|
110 | + 'hide_empty' => 0, |
|
111 | + 'empty_zero' => 0, |
|
112 | + 'hide_alter_empty' => 1, |
|
113 | + 'link_to_user' => 1, |
|
114 | + 'exclude' => 1, |
|
115 | + 'id' => 'uid', |
|
116 | + 'table' => 'users', |
|
117 | + 'field' => 'uid', |
|
118 | + 'relationship' => 'none', |
|
119 | 119 | ), |
120 | 120 | 'name' => array( |
121 | - 'label' => 'Author', |
|
122 | - 'alter' => array( |
|
121 | + 'label' => 'Author', |
|
122 | + 'alter' => array( |
|
123 | 123 | 'alter_text' => 0, |
124 | 124 | 'text' => '', |
125 | 125 | 'make_link' => 1, |
@@ -138,81 +138,81 @@ discard block |
||
138 | 138 | 'ellipsis' => 1, |
139 | 139 | 'html' => 0, |
140 | 140 | 'strip_tags' => 0, |
141 | - ), |
|
142 | - 'empty' => '', |
|
143 | - 'hide_empty' => 0, |
|
144 | - 'empty_zero' => 0, |
|
145 | - 'hide_alter_empty' => 0, |
|
146 | - 'link_to_user' => 0, |
|
147 | - 'overwrite_anonymous' => 1, |
|
148 | - 'anonymous_text' => 'Anonymous', |
|
149 | - 'exclude' => 0, |
|
150 | - 'id' => 'name', |
|
151 | - 'table' => 'users', |
|
152 | - 'field' => 'name', |
|
153 | - 'relationship' => 'none', |
|
141 | + ), |
|
142 | + 'empty' => '', |
|
143 | + 'hide_empty' => 0, |
|
144 | + 'empty_zero' => 0, |
|
145 | + 'hide_alter_empty' => 0, |
|
146 | + 'link_to_user' => 0, |
|
147 | + 'overwrite_anonymous' => 1, |
|
148 | + 'anonymous_text' => 'Anonymous', |
|
149 | + 'exclude' => 0, |
|
150 | + 'id' => 'name', |
|
151 | + 'table' => 'users', |
|
152 | + 'field' => 'name', |
|
153 | + 'relationship' => 'none', |
|
154 | 154 | ), |
155 | - )); |
|
156 | - $handler->override_option('filters', array( |
|
155 | + )); |
|
156 | + $handler->override_option('filters', array( |
|
157 | 157 | 'moderate' => array( |
158 | - 'operator' => '=', |
|
159 | - 'value' => '1', |
|
160 | - 'group' => '0', |
|
161 | - 'exposed' => FALSE, |
|
162 | - 'expose' => array( |
|
158 | + 'operator' => '=', |
|
159 | + 'value' => '1', |
|
160 | + 'group' => '0', |
|
161 | + 'exposed' => FALSE, |
|
162 | + 'expose' => array( |
|
163 | 163 | 'operator' => FALSE, |
164 | 164 | 'label' => '', |
165 | - ), |
|
166 | - 'id' => 'moderate', |
|
167 | - 'table' => 'node', |
|
168 | - 'field' => 'moderate', |
|
169 | - 'relationship' => 'none', |
|
165 | + ), |
|
166 | + 'id' => 'moderate', |
|
167 | + 'table' => 'node', |
|
168 | + 'field' => 'moderate', |
|
169 | + 'relationship' => 'none', |
|
170 | 170 | ), |
171 | - )); |
|
172 | - $handler->override_option('access', array( |
|
171 | + )); |
|
172 | + $handler->override_option('access', array( |
|
173 | 173 | 'type' => 'role', |
174 | 174 | 'role' => array( |
175 | - 1271379760 => 1271379760, |
|
175 | + 1271379760 => 1271379760, |
|
176 | 176 | ), |
177 | - )); |
|
178 | - $handler->override_option('cache', array( |
|
177 | + )); |
|
178 | + $handler->override_option('cache', array( |
|
179 | 179 | 'type' => 'none', |
180 | - )); |
|
181 | - $handler->override_option('empty', bts('No content is in the queue for moderation.', array(), NULL, 'boinc:moderate-user-page')); |
|
182 | - $handler->override_option('empty_format', '4'); |
|
183 | - $handler->override_option('use_pager', '1'); |
|
184 | - $handler->override_option('style_plugin', 'table'); |
|
185 | - $handler->override_option('style_options', array( |
|
180 | + )); |
|
181 | + $handler->override_option('empty', bts('No content is in the queue for moderation.', array(), NULL, 'boinc:moderate-user-page')); |
|
182 | + $handler->override_option('empty_format', '4'); |
|
183 | + $handler->override_option('use_pager', '1'); |
|
184 | + $handler->override_option('style_plugin', 'table'); |
|
185 | + $handler->override_option('style_options', array( |
|
186 | 186 | 'grouping' => '', |
187 | 187 | 'override' => 1, |
188 | 188 | 'sticky' => 0, |
189 | 189 | 'order' => 'desc', |
190 | 190 | 'summary' => '', |
191 | 191 | 'columns' => array( |
192 | - 'view_node' => 'view_node', |
|
193 | - 'title' => 'title', |
|
194 | - 'changed' => 'changed', |
|
192 | + 'view_node' => 'view_node', |
|
193 | + 'title' => 'title', |
|
194 | + 'changed' => 'changed', |
|
195 | 195 | ), |
196 | 196 | 'info' => array( |
197 | - 'view_node' => array( |
|
197 | + 'view_node' => array( |
|
198 | 198 | 'separator' => '', |
199 | - ), |
|
200 | - 'title' => array( |
|
199 | + ), |
|
200 | + 'title' => array( |
|
201 | 201 | 'sortable' => 0, |
202 | 202 | 'separator' => '', |
203 | - ), |
|
204 | - 'changed' => array( |
|
203 | + ), |
|
204 | + 'changed' => array( |
|
205 | 205 | 'sortable' => 0, |
206 | 206 | 'separator' => '', |
207 | - ), |
|
207 | + ), |
|
208 | 208 | ), |
209 | 209 | 'default' => 'changed', |
210 | - )); |
|
211 | - $handler = $view->new_display('page', 'User profiles', 'page_1'); |
|
212 | - $handler->override_option('fields', array( |
|
210 | + )); |
|
211 | + $handler = $view->new_display('page', 'User profiles', 'page_1'); |
|
212 | + $handler->override_option('fields', array( |
|
213 | 213 | 'uid' => array( |
214 | - 'label' => 'Uid', |
|
215 | - 'alter' => array( |
|
214 | + 'label' => 'Uid', |
|
215 | + 'alter' => array( |
|
216 | 216 | 'alter_text' => 0, |
217 | 217 | 'text' => '', |
218 | 218 | 'make_link' => 0, |
@@ -231,24 +231,24 @@ discard block |
||
231 | 231 | 'ellipsis' => 1, |
232 | 232 | 'html' => 0, |
233 | 233 | 'strip_tags' => 0, |
234 | - ), |
|
235 | - 'empty' => '', |
|
236 | - 'hide_empty' => 0, |
|
237 | - 'empty_zero' => 0, |
|
238 | - 'hide_alter_empty' => 1, |
|
239 | - 'link_to_user' => 1, |
|
240 | - 'exclude' => 1, |
|
241 | - 'id' => 'uid', |
|
242 | - 'table' => 'users', |
|
243 | - 'field' => 'uid', |
|
244 | - 'override' => array( |
|
234 | + ), |
|
235 | + 'empty' => '', |
|
236 | + 'hide_empty' => 0, |
|
237 | + 'empty_zero' => 0, |
|
238 | + 'hide_alter_empty' => 1, |
|
239 | + 'link_to_user' => 1, |
|
240 | + 'exclude' => 1, |
|
241 | + 'id' => 'uid', |
|
242 | + 'table' => 'users', |
|
243 | + 'field' => 'uid', |
|
244 | + 'override' => array( |
|
245 | 245 | 'button' => 'Use default', |
246 | - ), |
|
247 | - 'relationship' => 'none', |
|
246 | + ), |
|
247 | + 'relationship' => 'none', |
|
248 | 248 | ), |
249 | 249 | 'name' => array( |
250 | - 'label' => 'User', |
|
251 | - 'alter' => array( |
|
250 | + 'label' => 'User', |
|
251 | + 'alter' => array( |
|
252 | 252 | 'alter_text' => 0, |
253 | 253 | 'text' => '', |
254 | 254 | 'make_link' => 1, |
@@ -267,26 +267,26 @@ discard block |
||
267 | 267 | 'ellipsis' => 1, |
268 | 268 | 'html' => 0, |
269 | 269 | 'strip_tags' => 0, |
270 | - ), |
|
271 | - 'empty' => '', |
|
272 | - 'hide_empty' => 0, |
|
273 | - 'empty_zero' => 0, |
|
274 | - 'hide_alter_empty' => 1, |
|
275 | - 'link_to_user' => 1, |
|
276 | - 'overwrite_anonymous' => 0, |
|
277 | - 'anonymous_text' => '', |
|
278 | - 'exclude' => 0, |
|
279 | - 'id' => 'name', |
|
280 | - 'table' => 'users', |
|
281 | - 'field' => 'name', |
|
282 | - 'override' => array( |
|
270 | + ), |
|
271 | + 'empty' => '', |
|
272 | + 'hide_empty' => 0, |
|
273 | + 'empty_zero' => 0, |
|
274 | + 'hide_alter_empty' => 1, |
|
275 | + 'link_to_user' => 1, |
|
276 | + 'overwrite_anonymous' => 0, |
|
277 | + 'anonymous_text' => '', |
|
278 | + 'exclude' => 0, |
|
279 | + 'id' => 'name', |
|
280 | + 'table' => 'users', |
|
281 | + 'field' => 'name', |
|
282 | + 'override' => array( |
|
283 | 283 | 'button' => 'Use default', |
284 | - ), |
|
285 | - 'relationship' => 'none', |
|
284 | + ), |
|
285 | + 'relationship' => 'none', |
|
286 | 286 | ), |
287 | 287 | 'changed' => array( |
288 | - 'label' => 'Updated date', |
|
289 | - 'alter' => array( |
|
288 | + 'label' => 'Updated date', |
|
289 | + 'alter' => array( |
|
290 | 290 | 'alter_text' => 0, |
291 | 291 | 'text' => '', |
292 | 292 | 'make_link' => 0, |
@@ -305,22 +305,22 @@ discard block |
||
305 | 305 | 'ellipsis' => 1, |
306 | 306 | 'html' => 0, |
307 | 307 | 'strip_tags' => 0, |
308 | - ), |
|
309 | - 'empty' => '', |
|
310 | - 'hide_empty' => 0, |
|
311 | - 'empty_zero' => 0, |
|
312 | - 'hide_alter_empty' => 1, |
|
313 | - 'date_format' => 'time ago', |
|
314 | - 'custom_date_format' => '', |
|
315 | - 'exclude' => 0, |
|
316 | - 'id' => 'changed', |
|
317 | - 'table' => 'node', |
|
318 | - 'field' => 'changed', |
|
319 | - 'relationship' => 'none', |
|
308 | + ), |
|
309 | + 'empty' => '', |
|
310 | + 'hide_empty' => 0, |
|
311 | + 'empty_zero' => 0, |
|
312 | + 'hide_alter_empty' => 1, |
|
313 | + 'date_format' => 'time ago', |
|
314 | + 'custom_date_format' => '', |
|
315 | + 'exclude' => 0, |
|
316 | + 'id' => 'changed', |
|
317 | + 'table' => 'node', |
|
318 | + 'field' => 'changed', |
|
319 | + 'relationship' => 'none', |
|
320 | 320 | ), |
321 | 321 | 'phpcode' => array( |
322 | - 'label' => 'Edit Profile', |
|
323 | - 'alter' => array( |
|
322 | + 'label' => 'Edit Profile', |
|
323 | + 'alter' => array( |
|
324 | 324 | 'alter_text' => 0, |
325 | 325 | 'text' => '', |
326 | 326 | 'make_link' => 0, |
@@ -339,108 +339,108 @@ discard block |
||
339 | 339 | 'ellipsis' => 1, |
340 | 340 | 'html' => 0, |
341 | 341 | 'strip_tags' => 0, |
342 | - ), |
|
343 | - 'empty' => '', |
|
344 | - 'hide_empty' => 0, |
|
345 | - 'empty_zero' => 0, |
|
346 | - 'hide_alter_empty' => 1, |
|
347 | - 'value' => '<?php |
|
342 | + ), |
|
343 | + 'empty' => '', |
|
344 | + 'hide_empty' => 0, |
|
345 | + 'empty_zero' => 0, |
|
346 | + 'hide_alter_empty' => 1, |
|
347 | + 'value' => '<?php |
|
348 | 348 | $uid = $data->users_uid; |
349 | 349 | return l( |
350 | 350 | bts(\'edit\', array(), NULL, \'boinc:edit-profile\'), |
351 | 351 | "/moderate/profile/$uid/edit"); |
352 | 352 | ?>', |
353 | - 'exclude' => 0, |
|
354 | - 'id' => 'phpcode', |
|
355 | - 'table' => 'customfield', |
|
356 | - 'field' => 'phpcode', |
|
357 | - 'override' => array( |
|
353 | + 'exclude' => 0, |
|
354 | + 'id' => 'phpcode', |
|
355 | + 'table' => 'customfield', |
|
356 | + 'field' => 'phpcode', |
|
357 | + 'override' => array( |
|
358 | 358 | 'button' => 'Use default', |
359 | - ), |
|
360 | - 'relationship' => 'none', |
|
359 | + ), |
|
360 | + 'relationship' => 'none', |
|
361 | 361 | ), |
362 | - )); |
|
363 | - $handler->override_option('filters', array( |
|
362 | + )); |
|
363 | + $handler->override_option('filters', array( |
|
364 | 364 | 'moderate' => array( |
365 | - 'operator' => '=', |
|
366 | - 'value' => '1', |
|
367 | - 'group' => '0', |
|
368 | - 'exposed' => FALSE, |
|
369 | - 'expose' => array( |
|
365 | + 'operator' => '=', |
|
366 | + 'value' => '1', |
|
367 | + 'group' => '0', |
|
368 | + 'exposed' => FALSE, |
|
369 | + 'expose' => array( |
|
370 | 370 | 'operator' => FALSE, |
371 | 371 | 'label' => '', |
372 | - ), |
|
373 | - 'id' => 'moderate', |
|
374 | - 'table' => 'node', |
|
375 | - 'field' => 'moderate', |
|
376 | - 'override' => array( |
|
372 | + ), |
|
373 | + 'id' => 'moderate', |
|
374 | + 'table' => 'node', |
|
375 | + 'field' => 'moderate', |
|
376 | + 'override' => array( |
|
377 | 377 | 'button' => 'Use default', |
378 | - ), |
|
379 | - 'relationship' => 'none', |
|
378 | + ), |
|
379 | + 'relationship' => 'none', |
|
380 | 380 | ), |
381 | 381 | 'type' => array( |
382 | - 'operator' => 'in', |
|
383 | - 'value' => array( |
|
382 | + 'operator' => 'in', |
|
383 | + 'value' => array( |
|
384 | 384 | 'profile' => 'profile', |
385 | - ), |
|
386 | - 'group' => '0', |
|
387 | - 'exposed' => FALSE, |
|
388 | - 'expose' => array( |
|
385 | + ), |
|
386 | + 'group' => '0', |
|
387 | + 'exposed' => FALSE, |
|
388 | + 'expose' => array( |
|
389 | 389 | 'operator' => FALSE, |
390 | 390 | 'label' => '', |
391 | - ), |
|
392 | - 'id' => 'type', |
|
393 | - 'table' => 'node', |
|
394 | - 'field' => 'type', |
|
395 | - 'override' => array( |
|
391 | + ), |
|
392 | + 'id' => 'type', |
|
393 | + 'table' => 'node', |
|
394 | + 'field' => 'type', |
|
395 | + 'override' => array( |
|
396 | 396 | 'button' => 'Use default', |
397 | - ), |
|
398 | - 'relationship' => 'none', |
|
397 | + ), |
|
398 | + 'relationship' => 'none', |
|
399 | 399 | ), |
400 | - )); |
|
401 | - $handler->override_option('title', bts('User profile moderation queue', array(), NULL, 'boinc:moderate-user-page')); |
|
402 | - $handler->override_option('path', 'moderate/profiles'); |
|
403 | - $handler->override_option('menu', array( |
|
400 | + )); |
|
401 | + $handler->override_option('title', bts('User profile moderation queue', array(), NULL, 'boinc:moderate-user-page')); |
|
402 | + $handler->override_option('path', 'moderate/profiles'); |
|
403 | + $handler->override_option('menu', array( |
|
404 | 404 | 'type' => 'default tab', |
405 | 405 | 'title' => 'Queue', |
406 | 406 | 'description' => '', |
407 | 407 | 'weight' => '-50', |
408 | 408 | 'name' => 'primary-links', |
409 | - )); |
|
410 | - $handler->override_option('tab_options', array( |
|
409 | + )); |
|
410 | + $handler->override_option('tab_options', array( |
|
411 | 411 | 'type' => 'normal', |
412 | 412 | 'title' => 'Moderation', |
413 | 413 | 'description' => '', |
414 | 414 | 'weight' => '0', |
415 | 415 | 'name' => 'primary-links', |
416 | - )); |
|
416 | + )); |
|
417 | 417 | |
418 | - $views[$view->name] = $view; |
|
418 | + $views[$view->name] = $view; |
|
419 | 419 | |
420 | - // Exported view: user_activity |
|
421 | - $view = new view; |
|
422 | - $view->name = 'user_activity'; |
|
423 | - $view->description = 'A feed of a user\'s activity on the site'; |
|
424 | - $view->tag = ''; |
|
425 | - $view->base_table = 'node_revisions'; |
|
426 | - $view->core = 6; |
|
427 | - $view->api_version = '2'; |
|
428 | - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
429 | - $handler = $view->new_display('default', 'Defaults', 'default'); |
|
430 | - $handler->override_option('relationships', array( |
|
420 | + // Exported view: user_activity |
|
421 | + $view = new view; |
|
422 | + $view->name = 'user_activity'; |
|
423 | + $view->description = 'A feed of a user\'s activity on the site'; |
|
424 | + $view->tag = ''; |
|
425 | + $view->base_table = 'node_revisions'; |
|
426 | + $view->core = 6; |
|
427 | + $view->api_version = '2'; |
|
428 | + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
429 | + $handler = $view->new_display('default', 'Defaults', 'default'); |
|
430 | + $handler->override_option('relationships', array( |
|
431 | 431 | 'uid' => array( |
432 | - 'label' => 'user', |
|
433 | - 'required' => 1, |
|
434 | - 'id' => 'uid', |
|
435 | - 'table' => 'node_revisions', |
|
436 | - 'field' => 'uid', |
|
437 | - 'relationship' => 'none', |
|
432 | + 'label' => 'user', |
|
433 | + 'required' => 1, |
|
434 | + 'id' => 'uid', |
|
435 | + 'table' => 'node_revisions', |
|
436 | + 'field' => 'uid', |
|
437 | + 'relationship' => 'none', |
|
438 | 438 | ), |
439 | - )); |
|
440 | - $handler->override_option('fields', array( |
|
439 | + )); |
|
440 | + $handler->override_option('fields', array( |
|
441 | 441 | 'nid' => array( |
442 | - 'label' => 'Nid', |
|
443 | - 'alter' => array( |
|
442 | + 'label' => 'Nid', |
|
443 | + 'alter' => array( |
|
444 | 444 | 'alter_text' => 0, |
445 | 445 | 'text' => '', |
446 | 446 | 'make_link' => 0, |
@@ -459,21 +459,21 @@ discard block |
||
459 | 459 | 'ellipsis' => 1, |
460 | 460 | 'html' => 0, |
461 | 461 | 'strip_tags' => 0, |
462 | - ), |
|
463 | - 'empty' => '', |
|
464 | - 'hide_empty' => 0, |
|
465 | - 'empty_zero' => 0, |
|
466 | - 'hide_alter_empty' => 1, |
|
467 | - 'link_to_node' => 0, |
|
468 | - 'exclude' => 1, |
|
469 | - 'id' => 'nid', |
|
470 | - 'table' => 'node', |
|
471 | - 'field' => 'nid', |
|
472 | - 'relationship' => 'none', |
|
462 | + ), |
|
463 | + 'empty' => '', |
|
464 | + 'hide_empty' => 0, |
|
465 | + 'empty_zero' => 0, |
|
466 | + 'hide_alter_empty' => 1, |
|
467 | + 'link_to_node' => 0, |
|
468 | + 'exclude' => 1, |
|
469 | + 'id' => 'nid', |
|
470 | + 'table' => 'node', |
|
471 | + 'field' => 'nid', |
|
472 | + 'relationship' => 'none', |
|
473 | 473 | ), |
474 | 474 | 'title' => array( |
475 | - 'label' => 'Title', |
|
476 | - 'alter' => array( |
|
475 | + 'label' => 'Title', |
|
476 | + 'alter' => array( |
|
477 | 477 | 'alter_text' => 0, |
478 | 478 | 'text' => '', |
479 | 479 | 'make_link' => 0, |
@@ -492,21 +492,21 @@ discard block |
||
492 | 492 | 'ellipsis' => 1, |
493 | 493 | 'html' => 0, |
494 | 494 | 'strip_tags' => 0, |
495 | - ), |
|
496 | - 'empty' => '', |
|
497 | - 'hide_empty' => 0, |
|
498 | - 'empty_zero' => 0, |
|
499 | - 'hide_alter_empty' => 1, |
|
500 | - 'link_to_node' => 0, |
|
501 | - 'exclude' => 1, |
|
502 | - 'id' => 'title', |
|
503 | - 'table' => 'node', |
|
504 | - 'field' => 'title', |
|
505 | - 'relationship' => 'none', |
|
495 | + ), |
|
496 | + 'empty' => '', |
|
497 | + 'hide_empty' => 0, |
|
498 | + 'empty_zero' => 0, |
|
499 | + 'hide_alter_empty' => 1, |
|
500 | + 'link_to_node' => 0, |
|
501 | + 'exclude' => 1, |
|
502 | + 'id' => 'title', |
|
503 | + 'table' => 'node', |
|
504 | + 'field' => 'title', |
|
505 | + 'relationship' => 'none', |
|
506 | 506 | ), |
507 | 507 | 'type' => array( |
508 | - 'label' => 'Type', |
|
509 | - 'alter' => array( |
|
508 | + 'label' => 'Type', |
|
509 | + 'alter' => array( |
|
510 | 510 | 'alter_text' => 0, |
511 | 511 | 'text' => '', |
512 | 512 | 'make_link' => 0, |
@@ -525,22 +525,22 @@ discard block |
||
525 | 525 | 'ellipsis' => 1, |
526 | 526 | 'html' => 0, |
527 | 527 | 'strip_tags' => 0, |
528 | - ), |
|
529 | - 'empty' => '', |
|
530 | - 'hide_empty' => 0, |
|
531 | - 'empty_zero' => 0, |
|
532 | - 'hide_alter_empty' => 1, |
|
533 | - 'link_to_node' => 0, |
|
534 | - 'machine_name' => 0, |
|
535 | - 'exclude' => 1, |
|
536 | - 'id' => 'type', |
|
537 | - 'table' => 'node', |
|
538 | - 'field' => 'type', |
|
539 | - 'relationship' => 'none', |
|
528 | + ), |
|
529 | + 'empty' => '', |
|
530 | + 'hide_empty' => 0, |
|
531 | + 'empty_zero' => 0, |
|
532 | + 'hide_alter_empty' => 1, |
|
533 | + 'link_to_node' => 0, |
|
534 | + 'machine_name' => 0, |
|
535 | + 'exclude' => 1, |
|
536 | + 'id' => 'type', |
|
537 | + 'table' => 'node', |
|
538 | + 'field' => 'type', |
|
539 | + 'relationship' => 'none', |
|
540 | 540 | ), |
541 | 541 | 'uid' => array( |
542 | - 'label' => 'Uid', |
|
543 | - 'alter' => array( |
|
542 | + 'label' => 'Uid', |
|
543 | + 'alter' => array( |
|
544 | 544 | 'alter_text' => 0, |
545 | 545 | 'text' => '', |
546 | 546 | 'make_link' => 0, |
@@ -559,21 +559,21 @@ discard block |
||
559 | 559 | 'ellipsis' => 1, |
560 | 560 | 'html' => 0, |
561 | 561 | 'strip_tags' => 0, |
562 | - ), |
|
563 | - 'empty' => '', |
|
564 | - 'hide_empty' => 0, |
|
565 | - 'empty_zero' => 0, |
|
566 | - 'hide_alter_empty' => 1, |
|
567 | - 'link_to_user' => 0, |
|
568 | - 'exclude' => 1, |
|
569 | - 'id' => 'uid', |
|
570 | - 'table' => 'users', |
|
571 | - 'field' => 'uid', |
|
572 | - 'relationship' => 'uid', |
|
562 | + ), |
|
563 | + 'empty' => '', |
|
564 | + 'hide_empty' => 0, |
|
565 | + 'empty_zero' => 0, |
|
566 | + 'hide_alter_empty' => 1, |
|
567 | + 'link_to_user' => 0, |
|
568 | + 'exclude' => 1, |
|
569 | + 'id' => 'uid', |
|
570 | + 'table' => 'users', |
|
571 | + 'field' => 'uid', |
|
572 | + 'relationship' => 'uid', |
|
573 | 573 | ), |
574 | 574 | 'nothing' => array( |
575 | - 'label' => '', |
|
576 | - 'alter' => array( |
|
575 | + 'label' => '', |
|
576 | + 'alter' => array( |
|
577 | 577 | 'text' => '<div class="gray-divider"></div>', |
578 | 578 | 'make_link' => 0, |
579 | 579 | 'path' => '', |
@@ -591,20 +591,20 @@ discard block |
||
591 | 591 | 'ellipsis' => 1, |
592 | 592 | 'html' => 0, |
593 | 593 | 'strip_tags' => 0, |
594 | - ), |
|
595 | - 'empty' => '', |
|
596 | - 'hide_empty' => 0, |
|
597 | - 'empty_zero' => 0, |
|
598 | - 'hide_alter_empty' => 1, |
|
599 | - 'exclude' => 0, |
|
600 | - 'id' => 'nothing', |
|
601 | - 'table' => 'views', |
|
602 | - 'field' => 'nothing', |
|
603 | - 'relationship' => 'none', |
|
594 | + ), |
|
595 | + 'empty' => '', |
|
596 | + 'hide_empty' => 0, |
|
597 | + 'empty_zero' => 0, |
|
598 | + 'hide_alter_empty' => 1, |
|
599 | + 'exclude' => 0, |
|
600 | + 'id' => 'nothing', |
|
601 | + 'table' => 'views', |
|
602 | + 'field' => 'nothing', |
|
603 | + 'relationship' => 'none', |
|
604 | 604 | ), |
605 | 605 | 'phpcode_1' => array( |
606 | - 'label' => '', |
|
607 | - 'alter' => array( |
|
606 | + 'label' => '', |
|
607 | + 'alter' => array( |
|
608 | 608 | 'alter_text' => 0, |
609 | 609 | 'text' => '', |
610 | 610 | 'make_link' => 0, |
@@ -623,12 +623,12 @@ discard block |
||
623 | 623 | 'ellipsis' => 1, |
624 | 624 | 'html' => 0, |
625 | 625 | 'strip_tags' => 0, |
626 | - ), |
|
627 | - 'empty' => '', |
|
628 | - 'hide_empty' => 0, |
|
629 | - 'empty_zero' => 0, |
|
630 | - 'hide_alter_empty' => 1, |
|
631 | - 'value' => '<?php |
|
626 | + ), |
|
627 | + 'empty' => '', |
|
628 | + 'hide_empty' => 0, |
|
629 | + 'empty_zero' => 0, |
|
630 | + 'hide_alter_empty' => 1, |
|
631 | + 'value' => '<?php |
|
632 | 632 | |
633 | 633 | switch($data->node_type) { |
634 | 634 | case \'forum\': |
@@ -657,18 +657,18 @@ discard block |
||
657 | 657 | $account = user_load($uid); |
658 | 658 | echo l($account->boincuser_name, "account/{$uid}") . " {$action} " . l($data->node_title, $url, array(\'fragment\' => $fragment)); |
659 | 659 | ?>', |
660 | - 'exclude' => 0, |
|
661 | - 'id' => 'phpcode_1', |
|
662 | - 'table' => 'customfield', |
|
663 | - 'field' => 'phpcode', |
|
664 | - 'relationship' => 'none', |
|
665 | - 'override' => array( |
|
660 | + 'exclude' => 0, |
|
661 | + 'id' => 'phpcode_1', |
|
662 | + 'table' => 'customfield', |
|
663 | + 'field' => 'phpcode', |
|
664 | + 'relationship' => 'none', |
|
665 | + 'override' => array( |
|
666 | 666 | 'button' => 'Override', |
667 | - ), |
|
667 | + ), |
|
668 | 668 | ), |
669 | 669 | 'body' => array( |
670 | - 'label' => '', |
|
671 | - 'alter' => array( |
|
670 | + 'label' => '', |
|
671 | + 'alter' => array( |
|
672 | 672 | 'alter_text' => 0, |
673 | 673 | 'text' => '', |
674 | 674 | 'make_link' => 0, |
@@ -687,20 +687,20 @@ discard block |
||
687 | 687 | 'ellipsis' => 1, |
688 | 688 | 'html' => 0, |
689 | 689 | 'strip_tags' => 1, |
690 | - ), |
|
691 | - 'empty' => '', |
|
692 | - 'hide_empty' => 0, |
|
693 | - 'empty_zero' => 0, |
|
694 | - 'hide_alter_empty' => 1, |
|
695 | - 'exclude' => 0, |
|
696 | - 'id' => 'body', |
|
697 | - 'table' => 'node_revisions', |
|
698 | - 'field' => 'body', |
|
699 | - 'relationship' => 'none', |
|
690 | + ), |
|
691 | + 'empty' => '', |
|
692 | + 'hide_empty' => 0, |
|
693 | + 'empty_zero' => 0, |
|
694 | + 'hide_alter_empty' => 1, |
|
695 | + 'exclude' => 0, |
|
696 | + 'id' => 'body', |
|
697 | + 'table' => 'node_revisions', |
|
698 | + 'field' => 'body', |
|
699 | + 'relationship' => 'none', |
|
700 | 700 | ), |
701 | 701 | 'timestamp' => array( |
702 | - 'label' => '', |
|
703 | - 'alter' => array( |
|
702 | + 'label' => '', |
|
703 | + 'alter' => array( |
|
704 | 704 | 'alter_text' => 0, |
705 | 705 | 'text' => '', |
706 | 706 | 'make_link' => 0, |
@@ -719,40 +719,40 @@ discard block |
||
719 | 719 | 'ellipsis' => 1, |
720 | 720 | 'html' => 0, |
721 | 721 | 'strip_tags' => 0, |
722 | - ), |
|
723 | - 'empty' => '', |
|
724 | - 'hide_empty' => 0, |
|
725 | - 'empty_zero' => 0, |
|
726 | - 'hide_alter_empty' => 1, |
|
727 | - 'date_format' => 'custom', |
|
728 | - 'custom_date_format' => 'jS F Y', |
|
729 | - 'exclude' => 0, |
|
730 | - 'id' => 'timestamp', |
|
731 | - 'table' => 'node_revisions', |
|
732 | - 'field' => 'timestamp', |
|
733 | - 'relationship' => 'none', |
|
722 | + ), |
|
723 | + 'empty' => '', |
|
724 | + 'hide_empty' => 0, |
|
725 | + 'empty_zero' => 0, |
|
726 | + 'hide_alter_empty' => 1, |
|
727 | + 'date_format' => 'custom', |
|
728 | + 'custom_date_format' => 'jS F Y', |
|
729 | + 'exclude' => 0, |
|
730 | + 'id' => 'timestamp', |
|
731 | + 'table' => 'node_revisions', |
|
732 | + 'field' => 'timestamp', |
|
733 | + 'relationship' => 'none', |
|
734 | 734 | ), |
735 | - )); |
|
736 | - $handler->override_option('arguments', array( |
|
735 | + )); |
|
736 | + $handler->override_option('arguments', array( |
|
737 | 737 | 'uid' => array( |
738 | - 'default_action' => 'default', |
|
739 | - 'style_plugin' => 'default_summary', |
|
740 | - 'style_options' => array(), |
|
741 | - 'wildcard' => 'all', |
|
742 | - 'wildcard_substitution' => 'All', |
|
743 | - 'title' => '', |
|
744 | - 'breadcrumb' => '', |
|
745 | - 'default_argument_type' => 'user', |
|
746 | - 'default_argument' => '', |
|
747 | - 'validate_type' => 'user', |
|
748 | - 'validate_fail' => 'empty', |
|
749 | - 'break_phrase' => 0, |
|
750 | - 'not' => 0, |
|
751 | - 'id' => 'uid', |
|
752 | - 'table' => 'users', |
|
753 | - 'field' => 'uid', |
|
754 | - 'validate_user_argument_type' => 'uid', |
|
755 | - 'validate_user_roles' => array( |
|
738 | + 'default_action' => 'default', |
|
739 | + 'style_plugin' => 'default_summary', |
|
740 | + 'style_options' => array(), |
|
741 | + 'wildcard' => 'all', |
|
742 | + 'wildcard_substitution' => 'All', |
|
743 | + 'title' => '', |
|
744 | + 'breadcrumb' => '', |
|
745 | + 'default_argument_type' => 'user', |
|
746 | + 'default_argument' => '', |
|
747 | + 'validate_type' => 'user', |
|
748 | + 'validate_fail' => 'empty', |
|
749 | + 'break_phrase' => 0, |
|
750 | + 'not' => 0, |
|
751 | + 'id' => 'uid', |
|
752 | + 'table' => 'users', |
|
753 | + 'field' => 'uid', |
|
754 | + 'validate_user_argument_type' => 'uid', |
|
755 | + 'validate_user_roles' => array( |
|
756 | 756 | 2 => 0, |
757 | 757 | 3519698132 => 0, |
758 | 758 | 1110965548 => 0, |
@@ -761,20 +761,20 @@ discard block |
||
761 | 761 | 268174006 => 0, |
762 | 762 | 1271379760 => 0, |
763 | 763 | 933038561 => 0, |
764 | - ), |
|
765 | - 'relationship' => 'uid', |
|
766 | - 'default_options_div_prefix' => '', |
|
767 | - 'default_taxonomy_tid_term_page' => 0, |
|
768 | - 'default_taxonomy_tid_node' => 0, |
|
769 | - 'default_taxonomy_tid_limit' => 0, |
|
770 | - 'default_taxonomy_tid_vids' => array( |
|
764 | + ), |
|
765 | + 'relationship' => 'uid', |
|
766 | + 'default_options_div_prefix' => '', |
|
767 | + 'default_taxonomy_tid_term_page' => 0, |
|
768 | + 'default_taxonomy_tid_node' => 0, |
|
769 | + 'default_taxonomy_tid_limit' => 0, |
|
770 | + 'default_taxonomy_tid_vids' => array( |
|
771 | 771 | 1 => 0, |
772 | 772 | 2 => 0, |
773 | - ), |
|
774 | - 'default_argument_user' => 0, |
|
775 | - 'default_argument_fixed' => '', |
|
776 | - 'default_argument_php' => '', |
|
777 | - 'validate_argument_node_type' => array( |
|
773 | + ), |
|
774 | + 'default_argument_user' => 0, |
|
775 | + 'default_argument_fixed' => '', |
|
776 | + 'default_argument_php' => '', |
|
777 | + 'validate_argument_node_type' => array( |
|
778 | 778 | 'page' => 0, |
779 | 779 | 'news' => 0, |
780 | 780 | 'team' => 0, |
@@ -783,20 +783,20 @@ discard block |
||
783 | 783 | 'forum' => 0, |
784 | 784 | 'panel' => 0, |
785 | 785 | 'story' => 0, |
786 | - ), |
|
787 | - 'validate_argument_node_access' => 0, |
|
788 | - 'validate_argument_nid_type' => 'nid', |
|
789 | - 'validate_argument_vocabulary' => array( |
|
786 | + ), |
|
787 | + 'validate_argument_node_access' => 0, |
|
788 | + 'validate_argument_nid_type' => 'nid', |
|
789 | + 'validate_argument_vocabulary' => array( |
|
790 | 790 | 1 => 0, |
791 | 791 | 2 => 0, |
792 | - ), |
|
793 | - 'validate_argument_type' => 'tid', |
|
794 | - 'validate_argument_transform' => 0, |
|
795 | - 'validate_user_restrict_roles' => 0, |
|
796 | - 'validate_argument_php' => '', |
|
797 | - 'me_redirect' => 0, |
|
798 | - 'me_validate_user_argument_type' => 'uid', |
|
799 | - 'me_validate_user_roles' => array( |
|
792 | + ), |
|
793 | + 'validate_argument_type' => 'tid', |
|
794 | + 'validate_argument_transform' => 0, |
|
795 | + 'validate_user_restrict_roles' => 0, |
|
796 | + 'validate_argument_php' => '', |
|
797 | + 'me_redirect' => 0, |
|
798 | + 'me_validate_user_argument_type' => 'uid', |
|
799 | + 'me_validate_user_roles' => array( |
|
800 | 800 | 2 => 0, |
801 | 801 | 3519698132 => 0, |
802 | 802 | 1110965548 => 0, |
@@ -805,67 +805,67 @@ discard block |
||
805 | 805 | 268174006 => 0, |
806 | 806 | 1271379760 => 0, |
807 | 807 | 933038561 => 0, |
808 | - ), |
|
809 | - 'validate_argument_node_flag_name' => '*relationship*', |
|
810 | - 'validate_argument_node_flag_test' => 'flaggable', |
|
811 | - 'validate_argument_node_flag_id_type' => 'id', |
|
812 | - 'validate_argument_user_flag_name' => '*relationship*', |
|
813 | - 'validate_argument_user_flag_test' => 'flaggable', |
|
814 | - 'validate_argument_user_flag_id_type' => 'id', |
|
815 | - 'me_validate_user_restrict_roles' => 0, |
|
808 | + ), |
|
809 | + 'validate_argument_node_flag_name' => '*relationship*', |
|
810 | + 'validate_argument_node_flag_test' => 'flaggable', |
|
811 | + 'validate_argument_node_flag_id_type' => 'id', |
|
812 | + 'validate_argument_user_flag_name' => '*relationship*', |
|
813 | + 'validate_argument_user_flag_test' => 'flaggable', |
|
814 | + 'validate_argument_user_flag_id_type' => 'id', |
|
815 | + 'me_validate_user_restrict_roles' => 0, |
|
816 | 816 | ), |
817 | - )); |
|
818 | - $handler->override_option('access', array( |
|
817 | + )); |
|
818 | + $handler->override_option('access', array( |
|
819 | 819 | 'type' => 'none', |
820 | - )); |
|
821 | - $handler->override_option('cache', array( |
|
820 | + )); |
|
821 | + $handler->override_option('cache', array( |
|
822 | 822 | 'type' => 'none', |
823 | - )); |
|
824 | - $handler->override_option('items_per_page', 5); |
|
825 | - $handler->override_option('use_pager', '1'); |
|
826 | - $handler->override_option('row_options', array( |
|
823 | + )); |
|
824 | + $handler->override_option('items_per_page', 5); |
|
825 | + $handler->override_option('use_pager', '1'); |
|
826 | + $handler->override_option('row_options', array( |
|
827 | 827 | 'inline' => array( |
828 | - 'value' => 'value', |
|
829 | - 'phpcode_1' => 'phpcode_1', |
|
828 | + 'value' => 'value', |
|
829 | + 'phpcode_1' => 'phpcode_1', |
|
830 | 830 | ), |
831 | 831 | 'separator' => ' ', |
832 | 832 | 'hide_empty' => 0, |
833 | - )); |
|
834 | - $handler = $view->new_display('block', 'Block', 'block_1'); |
|
835 | - $handler->override_option('block_description', ''); |
|
836 | - $handler->override_option('block_caching', -1); |
|
837 | - $handler = $view->new_display('page', 'Page', 'page_1'); |
|
838 | - $handler->override_option('title', 'Recent posts'); |
|
839 | - $handler->override_option('style_plugin', 'grid'); |
|
840 | - $handler->override_option('style_options', array( |
|
833 | + )); |
|
834 | + $handler = $view->new_display('block', 'Block', 'block_1'); |
|
835 | + $handler->override_option('block_description', ''); |
|
836 | + $handler->override_option('block_caching', -1); |
|
837 | + $handler = $view->new_display('page', 'Page', 'page_1'); |
|
838 | + $handler->override_option('title', 'Recent posts'); |
|
839 | + $handler->override_option('style_plugin', 'grid'); |
|
840 | + $handler->override_option('style_options', array( |
|
841 | 841 | 'grouping' => '', |
842 | 842 | 'columns' => '1', |
843 | 843 | 'alignment' => 'vertical', |
844 | 844 | 'fill_single_line' => 1, |
845 | 845 | 'summary' => '', |
846 | - )); |
|
847 | - $handler->override_option('row_options', array( |
|
846 | + )); |
|
847 | + $handler->override_option('row_options', array( |
|
848 | 848 | 'inline' => array(), |
849 | 849 | 'separator' => '', |
850 | 850 | 'hide_empty' => 0, |
851 | - )); |
|
852 | - $handler->override_option('path', 'account/%/posts'); |
|
853 | - $handler->override_option('menu', array( |
|
851 | + )); |
|
852 | + $handler->override_option('path', 'account/%/posts'); |
|
853 | + $handler->override_option('menu', array( |
|
854 | 854 | 'type' => 'none', |
855 | 855 | 'title' => '', |
856 | 856 | 'description' => '', |
857 | 857 | 'weight' => '0', |
858 | 858 | 'name' => 'primary-links', |
859 | - )); |
|
860 | - $handler->override_option('tab_options', array( |
|
859 | + )); |
|
860 | + $handler->override_option('tab_options', array( |
|
861 | 861 | 'type' => 'none', |
862 | 862 | 'title' => '', |
863 | 863 | 'description' => '', |
864 | 864 | 'weight' => 0, |
865 | 865 | 'name' => 'navigation', |
866 | - )); |
|
866 | + )); |
|
867 | 867 | |
868 | - $views[$view->name] = $view; |
|
868 | + $views[$view->name] = $view; |
|
869 | 869 | |
870 | - return $views; |
|
870 | + return $views; |
|
871 | 871 | } |
@@ -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' => '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' => '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 | |
@@ -1885,19 +1885,19 @@ discard block |
||
1885 | 1885 | // Transform arguments before inserting them. |
1886 | 1886 | foreach ($args as $key => $value) { |
1887 | 1887 | switch ($key [0]) { |
1888 | - case '@': |
|
1889 | - // Escaped only. |
|
1890 | - $args [$key] = check_plain($value); |
|
1891 | - break; |
|
1892 | - |
|
1893 | - case '%': |
|
1894 | - default: |
|
1895 | - // Escaped and placeholder. |
|
1896 | - $args [$key] = theme('placeholder', $value); |
|
1897 | - break; |
|
1898 | - |
|
1899 | - case '!': |
|
1900 | - // Pass-through. |
|
1888 | + case '@': |
|
1889 | + // Escaped only. |
|
1890 | + $args [$key] = check_plain($value); |
|
1891 | + break; |
|
1892 | + |
|
1893 | + case '%': |
|
1894 | + default: |
|
1895 | + // Escaped and placeholder. |
|
1896 | + $args [$key] = theme('placeholder', $value); |
|
1897 | + break; |
|
1898 | + |
|
1899 | + case '!': |
|
1900 | + // Pass-through. |
|
1901 | 1901 | } |
1902 | 1902 | } |
1903 | 1903 | return strtr($string, $args); |
@@ -430,8 +430,7 @@ discard block |
||
430 | 430 | $user_info .= ' <div class="picture">'; |
431 | 431 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
432 | 432 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
433 | - } |
|
434 | - elseif (is_string($user_image)) { |
|
433 | + } elseif (is_string($user_image)) { |
|
435 | 434 | $user_info .= '<img src="' . $user_image . '"/>'; |
436 | 435 | } |
437 | 436 | $user_info .= ' </div>'; |
@@ -473,8 +472,7 @@ discard block |
||
473 | 472 | // If a specific comment is being referenced, go back to it on cancel |
474 | 473 | if ($comment_ref = $form['pid']['#value']) { |
475 | 474 | $cancel_url = "goto/comment/{$comment_ref}"; |
476 | - } |
|
477 | - else { |
|
475 | + } else { |
|
478 | 476 | $cancel_url = "node/{$form['nid']['#value']}"; |
479 | 477 | } |
480 | 478 | |
@@ -528,8 +526,7 @@ discard block |
||
528 | 526 | '#weight' => 1000, |
529 | 527 | ); |
530 | 528 | } |
531 | - } |
|
532 | - else { |
|
529 | + } else { |
|
533 | 530 | $form = NULL; |
534 | 531 | $form['from'] = array( |
535 | 532 | '#type' => 'item', |
@@ -626,8 +623,7 @@ discard block |
||
626 | 623 | 'title' => bts('Reply to this topic with a quote', array(), NULL, 'boinc:forum-reply-to-comment') |
627 | 624 | ); |
628 | 625 | } |
629 | - } |
|
630 | - else { |
|
626 | + } else { |
|
631 | 627 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
632 | 628 | if (isset($links['comment_delete'])) { |
633 | 629 | $links['comment_delete']['attributes'] = array( |
@@ -681,8 +677,7 @@ discard block |
||
681 | 677 | 'title' => bts('Remove sticky status from this topic', array(), NULL, 'boinc:forum-unsticky-comment') |
682 | 678 | ) |
683 | 679 | ); |
684 | - } |
|
685 | - else { |
|
680 | + } else { |
|
686 | 681 | $links['make_sticky'] = array( |
687 | 682 | 'title' => bts('Make sticky', array(), NULL, 'boinc:forum-sticky-comment'), |
688 | 683 | 'href' => "{$node_control}/sticky", |
@@ -699,8 +694,7 @@ discard block |
||
699 | 694 | 'title' => bts('Lock this thread for comments', array(), NULL, 'boinc:forum-lock-comment') |
700 | 695 | ) |
701 | 696 | ); |
702 | - } |
|
703 | - else { |
|
697 | + } else { |
|
704 | 698 | $links['unlock'] = array( |
705 | 699 | 'title' => bts('Unlock', array(), NULL, 'boinc:forum-unlock-comment'), |
706 | 700 | 'href' => "{$node_control}/unlock", |
@@ -717,8 +711,7 @@ discard block |
||
717 | 711 | 'title' => bts('Hide this topic', array(), NULL, 'boinc:forum-hide-comment') |
718 | 712 | ) |
719 | 713 | ); |
720 | - } |
|
721 | - else { |
|
714 | + } else { |
|
722 | 715 | $links['unhide'] = array( |
723 | 716 | 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
724 | 717 | 'href' => "{$node_control}/unhide", |
@@ -729,8 +722,7 @@ discard block |
||
729 | 722 | } |
730 | 723 | }// if user_access('edit any forum topic') |
731 | 724 | } |
732 | - } |
|
733 | - else if ($type=='comment') { |
|
725 | + } else if ($type=='comment') { |
|
734 | 726 | $node = node_load($object->nid); |
735 | 727 | $nid = $object->nid; |
736 | 728 | $cid = $object->cid; |
@@ -771,8 +763,7 @@ discard block |
||
771 | 763 | 'title' => bts('Hide this comment', array(), NULL, 'boinc:forum-hide-comment') |
772 | 764 | ) |
773 | 765 | ); |
774 | - } |
|
775 | - else { |
|
766 | + } else { |
|
776 | 767 | $links['unhide'] = array( |
777 | 768 | 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
778 | 769 | 'href' => "{$comment_control}/unhide", |
@@ -958,8 +949,7 @@ discard block |
||
958 | 949 | watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
959 | 950 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
960 | 951 | } |
961 | - } |
|
962 | - elseif ($project_prefs) { |
|
952 | + } elseif ($project_prefs) { |
|
963 | 953 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
964 | 954 | if ($errors = libxml_get_errors($xml)) { |
965 | 955 | $lines = explode("\r", $project_prefs); |
@@ -1002,8 +992,7 @@ discard block |
||
1002 | 992 | node_save($content_profile); |
1003 | 993 | } |
1004 | 994 | } |
1005 | - } |
|
1006 | - else { |
|
995 | + } else { |
|
1007 | 996 | $xml = array( |
1008 | 997 | 'error' => array( |
1009 | 998 | 'error_num' => -112, |
@@ -1138,8 +1127,7 @@ discard block |
||
1138 | 1127 | node_save($node); |
1139 | 1128 | // Save the team IDs to a BOINC <--> Drupal reference table. |
1140 | 1129 | db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
1141 | - } |
|
1142 | - else { |
|
1130 | + } else { |
|
1143 | 1131 | $xml['create_team_reply']['warning'] = t( |
1144 | 1132 | 'There was a problem integrating this team into Drupal. Please |
1145 | 1133 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1154,8 +1142,7 @@ discard block |
||
1154 | 1142 | // Delete from the BOINC DB if we can't sync with Drupal |
1155 | 1143 | $boincteam::delete(); |
1156 | 1144 | } |
1157 | - } |
|
1158 | - else { |
|
1145 | + } else { |
|
1159 | 1146 | $xml['create_team_reply']['warning'] = t( |
1160 | 1147 | 'There was a problem integrating this team into Drupal. Please |
1161 | 1148 | contact @project administrators!', array('@project' => PROJECT) |
@@ -1169,8 +1156,7 @@ discard block |
||
1169 | 1156 | ); |
1170 | 1157 | } |
1171 | 1158 | } |
1172 | - } |
|
1173 | - else { |
|
1159 | + } else { |
|
1174 | 1160 | $xml = array( |
1175 | 1161 | 'error' => array( |
1176 | 1162 | 'error_num' => -1, |
@@ -1239,8 +1225,7 @@ discard block |
||
1239 | 1225 | ); |
1240 | 1226 | $xml['users']['user'][] = $team_member; |
1241 | 1227 | } |
1242 | - } |
|
1243 | - else { |
|
1228 | + } else { |
|
1244 | 1229 | // Query BOINC database user table |
1245 | 1230 | db_set_active('boinc_rw'); |
1246 | 1231 | $result = db_query(" |
@@ -1293,8 +1278,7 @@ discard block |
||
1293 | 1278 | $xml['users']['user'][] = $team_members[$member->boinc_id]; |
1294 | 1279 | } |
1295 | 1280 | } // end if credit_only |
1296 | - } |
|
1297 | - else { |
|
1281 | + } else { |
|
1298 | 1282 | $xml = array( |
1299 | 1283 | 'error' => array( |
1300 | 1284 | 'error_num' => -136, |
@@ -1343,24 +1327,19 @@ discard block |
||
1343 | 1327 | if ($avatar_image) { |
1344 | 1328 | $profile_node->field_image[0] = $avatar_image; |
1345 | 1329 | node_save($profile_node); |
1346 | - } |
|
1347 | - else { |
|
1330 | + } else { |
|
1348 | 1331 | $error = 'Error saving avatar to profile'; |
1349 | 1332 | } |
1350 | - } |
|
1351 | - else { |
|
1333 | + } else { |
|
1352 | 1334 | $error = 'Unable to load user profile'; |
1353 | 1335 | } |
1354 | - } |
|
1355 | - else { |
|
1336 | + } else { |
|
1356 | 1337 | $error = 'User has no profile, so avatar could not be added'; |
1357 | 1338 | } |
1358 | - } |
|
1359 | - else { |
|
1339 | + } else { |
|
1360 | 1340 | $error = 'Unable to save remote image'; |
1361 | 1341 | } |
1362 | - } |
|
1363 | - else { |
|
1342 | + } else { |
|
1364 | 1343 | $error = 'Could not find avatar image at URL'; |
1365 | 1344 | } |
1366 | 1345 | } |
@@ -1387,8 +1366,7 @@ discard block |
||
1387 | 1366 | 'success' => NULL, |
1388 | 1367 | ), |
1389 | 1368 | ); |
1390 | - } |
|
1391 | - else { |
|
1369 | + } else { |
|
1392 | 1370 | // Failure |
1393 | 1371 | $xml = array( |
1394 | 1372 | 'error' => array( |
@@ -1397,8 +1375,7 @@ discard block |
||
1397 | 1375 | ), |
1398 | 1376 | ); |
1399 | 1377 | } |
1400 | - } |
|
1401 | - else { |
|
1378 | + } else { |
|
1402 | 1379 | // Drupal user not found |
1403 | 1380 | $xml = array( |
1404 | 1381 | 'error' => array( |
@@ -1407,8 +1384,7 @@ discard block |
||
1407 | 1384 | ), |
1408 | 1385 | ); |
1409 | 1386 | } |
1410 | - } |
|
1411 | - else { |
|
1387 | + } else { |
|
1412 | 1388 | // BOINC user not found |
1413 | 1389 | $xml = array( |
1414 | 1390 | 'error' => array( |
@@ -1526,8 +1502,7 @@ discard block |
||
1526 | 1502 | ), |
1527 | 1503 | ); |
1528 | 1504 | } |
1529 | - } |
|
1530 | - else { |
|
1505 | + } else { |
|
1531 | 1506 | $xml = array( |
1532 | 1507 | 'error' => array( |
1533 | 1508 | 'error_num' => -136, |
@@ -1651,8 +1626,7 @@ discard block |
||
1651 | 1626 | // Get the number of comments per page |
1652 | 1627 | if ($user->comments_per_page) { |
1653 | 1628 | $comments_per_page = $user->comments_per_page; |
1654 | - } |
|
1655 | - else { |
|
1629 | + } else { |
|
1656 | 1630 | $node = node_load($object->nid); |
1657 | 1631 | $comments_per_page = variable_get( |
1658 | 1632 | "comment_default_per_page_{$node->type}", 50 |
@@ -1673,8 +1647,7 @@ discard block |
||
1673 | 1647 | // Check for a login, then redirect to the user's friend requests page |
1674 | 1648 | if ($user->uid) { |
1675 | 1649 | drupal_goto("account/{$user->uid}/friends/pending"); |
1676 | - } |
|
1677 | - else { |
|
1650 | + } else { |
|
1678 | 1651 | drupal_goto('user/login', array( |
1679 | 1652 | 'destination' => 'goto/friend-requests' |
1680 | 1653 | )); |
@@ -1950,8 +1923,7 @@ discard block |
||
1950 | 1923 | if ($moderator_rid !== FALSE) { |
1951 | 1924 | $settings['recipients'] = array($moderator_rid); |
1952 | 1925 | rules_action_mail_to_users_of_role($settings); |
1953 | - } |
|
1954 | - else { |
|
1926 | + } else { |
|
1955 | 1927 | watchdog( |
1956 | 1928 | 'boinccore', |
1957 | 1929 | 'Unable to identify members of the moderator role to send moderator notifications!', |
@@ -1982,8 +1954,7 @@ discard block |
||
1982 | 1954 | } |
1983 | 1955 | if (empty($args)) { |
1984 | 1956 | return $string; |
1985 | - } |
|
1986 | - else { |
|
1957 | + } else { |
|
1987 | 1958 | // Transform arguments before inserting them. |
1988 | 1959 | foreach ($args as $key => $value) { |
1989 | 1960 | switch ($key [0]) { |
@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | * with defined URL paths |
30 | 30 | */ |
31 | 31 | function boinccore_menu() { |
32 | - $items['node_control'] = array( |
|
32 | + $items['node_control'] = array( |
|
33 | 33 | 'page callback' => 'boinccore_node_control', |
34 | 34 | 'access arguments' => array('access content'), |
35 | 35 | 'type' => MENU_CALLBACK |
36 | - ); |
|
37 | - $items['comment_control'] = array( |
|
36 | + ); |
|
37 | + $items['comment_control'] = array( |
|
38 | 38 | 'page callback' => 'boinccore_comment_control', |
39 | 39 | 'access arguments' => array('administer comments'), |
40 | 40 | 'type' => MENU_CALLBACK |
41 | - ); |
|
42 | - $items['goto'] = array( |
|
41 | + ); |
|
42 | + $items['goto'] = array( |
|
43 | 43 | 'page callback' => 'boinccore_url_pagination_handler', |
44 | 44 | 'access arguments' => array('access content'), |
45 | 45 | 'type' => MENU_CALLBACK |
46 | - ); |
|
47 | - $items['admin/boinc/community'] = array( |
|
46 | + ); |
|
47 | + $items['admin/boinc/community'] = array( |
|
48 | 48 | 'title' => 'Community', |
49 | 49 | 'description' => 'Global settings for community interaction.', |
50 | 50 | 'page callback' => 'drupal_get_form', |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | 'access arguments' => array('administer site configuration'), |
53 | 53 | 'type' => MENU_NORMAL_ITEM, |
54 | 54 | 'file' => 'boinccore.admin.inc' |
55 | - ); |
|
56 | - $items['admin/boinc/standard-content-generator'] = array( |
|
55 | + ); |
|
56 | + $items['admin/boinc/standard-content-generator'] = array( |
|
57 | 57 | 'title' => 'Standard page generator', |
58 | 58 | 'description' => 'Regenerate standard site content (e.g. Help and About Us |
59 | 59 | pages).', |
@@ -62,172 +62,172 @@ discard block |
||
62 | 62 | 'access arguments' => array('administer site configuration'), |
63 | 63 | 'type' => MENU_NORMAL_ITEM, |
64 | 64 | 'file' => 'boinccore.admin.inc' |
65 | - ); |
|
65 | + ); |
|
66 | 66 | |
67 | - // BOINC RPC wrappers |
|
68 | - $items['lookup_account.php'] = array( |
|
67 | + // BOINC RPC wrappers |
|
68 | + $items['lookup_account.php'] = array( |
|
69 | 69 | 'title' => 'Look up account RPC', |
70 | 70 | 'description' => 'RPC for getting the authenticator for a user account.', |
71 | 71 | 'page callback' => 'boinccore_lookup_account', |
72 | 72 | 'access callback' => TRUE, |
73 | 73 | 'type' => MENU_CALLBACK |
74 | - ); |
|
75 | - $items['am_get_info.php'] = array( |
|
74 | + ); |
|
75 | + $items['am_get_info.php'] = array( |
|
76 | 76 | 'title' => 'Account manager get info RPC', |
77 | 77 | 'description' => 'RPC for getting assorted details of a user account.', |
78 | 78 | 'page callback' => 'boinccore_am_get_info', |
79 | 79 | 'access callback' => TRUE, |
80 | 80 | 'type' => MENU_CALLBACK |
81 | - ); |
|
82 | - $items['am_set_info.php'] = array( |
|
81 | + ); |
|
82 | + $items['am_set_info.php'] = array( |
|
83 | 83 | 'title' => 'Account manager set info RPC', |
84 | 84 | 'description' => 'RPC for updating assorted details of a user account.', |
85 | 85 | 'page callback' => 'boinccore_am_set_info', |
86 | 86 | 'access callback' => TRUE, |
87 | 87 | 'type' => MENU_CALLBACK |
88 | - ); |
|
89 | - $items['am_set_host_info.php'] = array( |
|
88 | + ); |
|
89 | + $items['am_set_host_info.php'] = array( |
|
90 | 90 | 'title' => 'Account manager set host info RPC', |
91 | 91 | 'description' => 'RPC for updating the venue for a given host.', |
92 | 92 | 'page callback' => 'boinccore_am_set_host_info', |
93 | 93 | 'access callback' => TRUE, |
94 | 94 | 'type' => MENU_CALLBACK |
95 | - ); |
|
96 | - $items['show_user.php'] = array( |
|
95 | + ); |
|
96 | + $items['show_user.php'] = array( |
|
97 | 97 | 'title' => 'Show user RPC', |
98 | 98 | 'description' => 'RPC for getting assorted details of a user account.', |
99 | 99 | 'page callback' => 'boinccore_show_user', |
100 | 100 | 'access callback' => TRUE, |
101 | 101 | 'type' => MENU_CALLBACK |
102 | - ); |
|
103 | - $items['pending.php'] = array( |
|
102 | + ); |
|
103 | + $items['pending.php'] = array( |
|
104 | 104 | 'title' => 'Pending credit RPC', |
105 | 105 | 'description' => 'RPC for getting pending credit for a given account.', |
106 | 106 | 'page callback' => 'boinccore_pending_credit', |
107 | 107 | 'access callback' => TRUE, |
108 | 108 | 'type' => MENU_CALLBACK |
109 | - ); |
|
110 | - $items['create_team.php'] = array( |
|
109 | + ); |
|
110 | + $items['create_team.php'] = array( |
|
111 | 111 | 'title' => 'Create team RPC', |
112 | 112 | 'description' => 'RPC for creating a new team.', |
113 | 113 | 'page callback' => 'boinccore_create_team', |
114 | 114 | 'access callback' => TRUE, |
115 | 115 | 'type' => MENU_CALLBACK |
116 | - ); |
|
117 | - $items['team_lookup.php'] = array( |
|
116 | + ); |
|
117 | + $items['team_lookup.php'] = array( |
|
118 | 118 | 'title' => 'Team lookup RPC', |
119 | 119 | 'description' => 'RPC for getting info on a team or matching teams.', |
120 | 120 | 'page callback' => 'boinccore_team_lookup', |
121 | 121 | 'access callback' => TRUE, |
122 | 122 | 'type' => MENU_CALLBACK |
123 | - ); |
|
124 | - $items['team_email_list.php'] = array( |
|
123 | + ); |
|
124 | + $items['team_email_list.php'] = array( |
|
125 | 125 | 'title' => 'Get team member list RPC', |
126 | 126 | 'description' => 'RPC for getting a list of members of a given team.', |
127 | 127 | 'page callback' => 'boinccore_team_email_list', |
128 | 128 | 'access callback' => TRUE, |
129 | 129 | 'type' => MENU_CALLBACK |
130 | - ); |
|
131 | - $items['edit_forum_preferences_action.php'] = array( |
|
130 | + ); |
|
131 | + $items['edit_forum_preferences_action.php'] = array( |
|
132 | 132 | 'title' => 'Forum preferences RPC', |
133 | 133 | 'description' => 'RPC for setting forum preferences for a given user.', |
134 | 134 | 'page callback' => 'boinccore_edit_forum_preferences', |
135 | 135 | 'access callback' => TRUE, |
136 | 136 | 'type' => MENU_CALLBACK |
137 | - ); |
|
138 | - $items['forum_get_data.php'] = array( |
|
137 | + ); |
|
138 | + $items['forum_get_data.php'] = array( |
|
139 | 139 | 'title' => 'Forum get data RPC', |
140 | 140 | 'description' => 'RPC for getting recent forum activity for a given user.', |
141 | 141 | 'page callback' => 'boinccore_forum_get_data', |
142 | 142 | 'access callback' => TRUE, |
143 | 143 | 'type' => MENU_CALLBACK |
144 | - ); |
|
145 | - $items['apps.php'] = array( |
|
144 | + ); |
|
145 | + $items['apps.php'] = array( |
|
146 | 146 | 'title' => 'Apps RPC', |
147 | 147 | 'description' => 'RPC for getting the applications in the system.', |
148 | 148 | 'page callback' => 'boinccore_apps', |
149 | 149 | 'access callback' => TRUE, |
150 | 150 | 'type' => MENU_CALLBACK |
151 | - ); |
|
151 | + ); |
|
152 | 152 | |
153 | - return $items; |
|
153 | + return $items; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Implementation of hook_menu_alter() |
158 | 158 | */ |
159 | 159 | function boinccore_menu_alter(&$items) { |
160 | - // If using Solr search and not core Drupal search, disable core search! |
|
161 | - if (module_exists('global_search_solr') AND !module_exists('global_search')) { |
|
160 | + // If using Solr search and not core Drupal search, disable core search! |
|
161 | + if (module_exists('global_search_solr') AND !module_exists('global_search')) { |
|
162 | 162 | // Add permission to user search. |
163 | 163 | $check = array( |
164 | - 'search/node/%menu_tail', |
|
165 | - 'search/user/%menu_tail', |
|
166 | - 'user/autocomplete' |
|
164 | + 'search/node/%menu_tail', |
|
165 | + 'search/user/%menu_tail', |
|
166 | + 'user/autocomplete' |
|
167 | 167 | ); |
168 | 168 | foreach ($check as $path) { |
169 | - if (isset($items[$path])) { |
|
169 | + if (isset($items[$path])) { |
|
170 | 170 | $items[$path]['access callback'] = FALSE; |
171 | - } |
|
171 | + } |
|
172 | 172 | } |
173 | - } |
|
174 | - // If using content profile module (for user profiles) setup special |
|
175 | - // delete page. |
|
176 | - if (module_exists('content_profile')) { |
|
173 | + } |
|
174 | + // If using content profile module (for user profiles) setup special |
|
175 | + // delete page. |
|
176 | + if (module_exists('content_profile')) { |
|
177 | 177 | $items['node/%node/delete'] = array( |
178 | - 'title' => 'Delete', |
|
179 | - 'page callback' => 'drupal_get_form', |
|
180 | - 'page arguments' => array('boinccore_delete_confirm', 1), |
|
181 | - 'access callback' => 'node_access', |
|
182 | - 'access arguments' => array('delete', 1), |
|
183 | - 'module' => 'boinccore', |
|
184 | - 'file' => 'includes/boinccore.forms.inc', |
|
185 | - 'weight' => 1, |
|
186 | - 'type' => MENU_CALLBACK, |
|
178 | + 'title' => 'Delete', |
|
179 | + 'page callback' => 'drupal_get_form', |
|
180 | + 'page arguments' => array('boinccore_delete_confirm', 1), |
|
181 | + 'access callback' => 'node_access', |
|
182 | + 'access arguments' => array('delete', 1), |
|
183 | + 'module' => 'boinccore', |
|
184 | + 'file' => 'includes/boinccore.forms.inc', |
|
185 | + 'weight' => 1, |
|
186 | + 'type' => MENU_CALLBACK, |
|
187 | 187 | ); |
188 | - } |
|
188 | + } |
|
189 | 189 | |
190 | - // 'Remove' menu paths for ignore_user and privatemsg |
|
191 | - // (pm_block_user) module which we have 'overridden' with |
|
192 | - // boincwork's own functions. |
|
193 | - if (module_exists('ignore_user')) { |
|
190 | + // 'Remove' menu paths for ignore_user and privatemsg |
|
191 | + // (pm_block_user) module which we have 'overridden' with |
|
192 | + // boincwork's own functions. |
|
193 | + if (module_exists('ignore_user')) { |
|
194 | 194 | $check = array( |
195 | - 'ignore_user/add', |
|
196 | - 'ignore_user/remove', |
|
195 | + 'ignore_user/add', |
|
196 | + 'ignore_user/remove', |
|
197 | 197 | ); |
198 | 198 | foreach ($check as $path) { |
199 | - if (isset($items[$path])) { |
|
199 | + if (isset($items[$path])) { |
|
200 | 200 | $items[$path]['access callback'] = FALSE; |
201 | - } |
|
201 | + } |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // Redirect user to privacy prefs page. |
205 | 205 | $path1 = 'ignore_user/list'; |
206 | 206 | if (isset($items[$path1])) { |
207 | - $items[$path1]['page callback'] = 'drupal_goto'; |
|
208 | - $items[$path1]['page arguments'] = array('account/prefs/privacy'); |
|
207 | + $items[$path1]['page callback'] = 'drupal_goto'; |
|
208 | + $items[$path1]['page arguments'] = array('account/prefs/privacy'); |
|
209 | + } |
|
209 | 210 | } |
210 | - } |
|
211 | 211 | |
212 | - if (module_exists('pm_block_user')) { |
|
212 | + if (module_exists('pm_block_user')) { |
|
213 | 213 | $check = array( |
214 | - 'messages/block/%user', |
|
214 | + 'messages/block/%user', |
|
215 | 215 | ); |
216 | 216 | foreach ($check as $path) { |
217 | - if (isset($items[$path])) { |
|
217 | + if (isset($items[$path])) { |
|
218 | 218 | $items[$path]['access callback'] = FALSE; |
219 | - } |
|
219 | + } |
|
220 | + } |
|
220 | 221 | } |
221 | - } |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Implementation of hook_enable() |
226 | 226 | */ |
227 | 227 | function boinccore_enable() { |
228 | - // Automatically try to establish standard site content when this module is |
|
229 | - // enabled (e.g. Help and About Us pages) |
|
230 | - boinccore_admin_default_content_generate(); |
|
228 | + // Automatically try to establish standard site content when this module is |
|
229 | + // enabled (e.g. Help and About Us pages) |
|
230 | + boinccore_admin_default_content_generate(); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | * See: https://www.drupal.org/node/339958#comment-3012662 |
241 | 241 | */ |
242 | 242 | function boinccore_boot() { |
243 | - global $user, $language; |
|
244 | - $cache = variable_get('cache', CACHE_DISABLED); |
|
245 | - $language_negotiation = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); |
|
246 | - |
|
247 | - // If we have an anonymous user, page cache is enabled, the URL has no prefix |
|
248 | - // and browser language negotiation is set, we perform a redirect to the |
|
249 | - // prefixed URL. |
|
250 | - if (empty($user->uid) && $cache != CACHE_DISABLED && $language_negotiation == LANGUAGE_NEGOTIATION_PATH) { |
|
243 | + global $user, $language; |
|
244 | + $cache = variable_get('cache', CACHE_DISABLED); |
|
245 | + $language_negotiation = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); |
|
246 | + |
|
247 | + // If we have an anonymous user, page cache is enabled, the URL has no prefix |
|
248 | + // and browser language negotiation is set, we perform a redirect to the |
|
249 | + // prefixed URL. |
|
250 | + if (empty($user->uid) && $cache != CACHE_DISABLED && $language_negotiation == LANGUAGE_NEGOTIATION_PATH) { |
|
251 | 251 | $args = isset($_GET['q']) ? explode('/', $_GET['q']) : array(); |
252 | 252 | $prefix = array_shift($args); |
253 | 253 | |
@@ -259,24 +259,24 @@ discard block |
||
259 | 259 | // so call this backported Drupal 7 language negotation function, which |
260 | 260 | // does both case insensitive and longest prefix matching |
261 | 261 | if (function_exists('locale_language_from_browser')) { |
262 | - $language = locale_language_from_browser(); |
|
262 | + $language = locale_language_from_browser(); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | if (!empty($language->prefix) && $prefix != $language->prefix) { |
266 | - // We need full path support to perform the redirect. |
|
267 | - drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); |
|
268 | - |
|
269 | - require_once './includes/common.inc'; |
|
270 | - $url = url($_GET['q'], array('query' => drupal_query_string_encode($_GET, array('q')))); |
|
271 | - $code = variable_get('locale_redirect_http_code', 302); |
|
272 | - |
|
273 | - // Since we are in a hook_boot() implementation cache mode is normal, so |
|
274 | - // we can safely call hook_exit(). |
|
275 | - bootstrap_invoke_all('exit'); |
|
276 | - header("Location: $url", TRUE, $code); |
|
277 | - exit; |
|
266 | + // We need full path support to perform the redirect. |
|
267 | + drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); |
|
268 | + |
|
269 | + require_once './includes/common.inc'; |
|
270 | + $url = url($_GET['q'], array('query' => drupal_query_string_encode($_GET, array('q')))); |
|
271 | + $code = variable_get('locale_redirect_http_code', 302); |
|
272 | + |
|
273 | + // Since we are in a hook_boot() implementation cache mode is normal, so |
|
274 | + // we can safely call hook_exit(). |
|
275 | + bootstrap_invoke_all('exit'); |
|
276 | + header("Location: $url", TRUE, $code); |
|
277 | + exit; |
|
278 | + } |
|
278 | 279 | } |
279 | - } |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | * |
290 | 290 | * Obsolete in Drupal 7... |
291 | 291 | */ |
292 | - function locale_language_from_browser() { |
|
292 | + function locale_language_from_browser() { |
|
293 | 293 | if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
294 | - return FALSE; |
|
294 | + return FALSE; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $languages = language_list('enabled'); |
@@ -306,14 +306,14 @@ discard block |
||
306 | 306 | // Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5" |
307 | 307 | $browser_langcodes = array(); |
308 | 308 | if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches, PREG_SET_ORDER)) { |
309 | - foreach ($matches as $match) { |
|
309 | + foreach ($matches as $match) { |
|
310 | 310 | // We can safely use strtolower() here, tags are ASCII. |
311 | 311 | // RFC2616 mandates that the decimal part is no more than three digits, |
312 | 312 | // so we multiply the qvalue by 1000 to avoid floating point comparisons. |
313 | 313 | $langcode = strtolower($match[1]); |
314 | 314 | $qvalue = isset($match[2]) ? (float) $match[2] : 1; |
315 | 315 | $browser_langcodes[$langcode] = (int) ($qvalue * 1000); |
316 | - } |
|
316 | + } |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // We should take pristine values from the HTTP headers, but Internet Explorer |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | // http://blogs.msdn.com/b/ie/archive/2006/10/17/accept-language-header-for-internet-explorer-7.aspx |
326 | 326 | asort($browser_langcodes); |
327 | 327 | foreach ($browser_langcodes as $langcode => $qvalue) { |
328 | - $generic_tag = strtok($langcode, '-'); |
|
329 | - if (!isset($browser_langcodes[$generic_tag])) { |
|
328 | + $generic_tag = strtok($langcode, '-'); |
|
329 | + if (!isset($browser_langcodes[$generic_tag])) { |
|
330 | 330 | $browser_langcodes[$generic_tag] = $qvalue; |
331 | - } |
|
331 | + } |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | // Find the enabled language with the greatest qvalue, following the rules |
@@ -337,156 +337,156 @@ discard block |
||
337 | 337 | $best_match_language = FALSE; |
338 | 338 | $max_qvalue = 0; |
339 | 339 | foreach ($languages as $langcode => $language) { |
340 | - // Language tags are case insensitive (RFC2616, sec 3.10). |
|
341 | - $langcode = strtolower($langcode); |
|
340 | + // Language tags are case insensitive (RFC2616, sec 3.10). |
|
341 | + $langcode = strtolower($langcode); |
|
342 | 342 | |
343 | - // If nothing matches below, the default qvalue is the one of the wildcard |
|
344 | - // language, if set, or is 0 (which will never match). |
|
345 | - $qvalue = isset($browser_langcodes['*']) ? $browser_langcodes['*'] : 0; |
|
343 | + // If nothing matches below, the default qvalue is the one of the wildcard |
|
344 | + // language, if set, or is 0 (which will never match). |
|
345 | + $qvalue = isset($browser_langcodes['*']) ? $browser_langcodes['*'] : 0; |
|
346 | 346 | |
347 | - // Find the longest possible prefix of the browser-supplied language |
|
348 | - // ('the language-range') that matches this site language ('the language tag'). |
|
349 | - $prefix = $langcode; |
|
350 | - do { |
|
347 | + // Find the longest possible prefix of the browser-supplied language |
|
348 | + // ('the language-range') that matches this site language ('the language tag'). |
|
349 | + $prefix = $langcode; |
|
350 | + do { |
|
351 | 351 | if (isset($browser_langcodes[$prefix])) { |
352 | - $qvalue = $browser_langcodes[$prefix]; |
|
353 | - break; |
|
352 | + $qvalue = $browser_langcodes[$prefix]; |
|
353 | + break; |
|
354 | 354 | } |
355 | - } |
|
356 | - while ($prefix = substr($prefix, 0, strrpos($prefix, '-'))); |
|
355 | + } |
|
356 | + while ($prefix = substr($prefix, 0, strrpos($prefix, '-'))); |
|
357 | 357 | |
358 | - // Find the best match. |
|
359 | - if ($qvalue > $max_qvalue) { |
|
358 | + // Find the best match. |
|
359 | + if ($qvalue > $max_qvalue) { |
|
360 | 360 | $best_match_language = $language; |
361 | 361 | $max_qvalue = $qvalue; |
362 | - } |
|
362 | + } |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | return $best_match_language; |
366 | - } |
|
366 | + } |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | 370 | * Implementation of hook_cron() |
371 | 371 | */ |
372 | 372 | function boinccore_cron() { |
373 | - // Notify moderators if there is site content that requires moderator action |
|
374 | - $items_in_queue = boincuser_moderation_queue_count('cron'); |
|
375 | - $last_notification = variable_get('boinccore_last_content_moderation_reminder', 0); |
|
376 | - if ($items_in_queue AND $last_notification < time() - 24*60*60) { |
|
373 | + // Notify moderators if there is site content that requires moderator action |
|
374 | + $items_in_queue = boincuser_moderation_queue_count('cron'); |
|
375 | + $last_notification = variable_get('boinccore_last_content_moderation_reminder', 0); |
|
376 | + if ($items_in_queue AND $last_notification < time() - 24*60*60) { |
|
377 | 377 | global $base_url; |
378 | 378 | global $base_path; |
379 | 379 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
380 | 380 | $site_url = $base_url . $base_path; |
381 | 381 | $settings = array( |
382 | - 'from' => '', |
|
383 | - 'subject' => "Content at {$site_name} is awaiting moderation", |
|
384 | - 'message' => '' |
|
385 | - . "Please visit the moderation queue page to review content that " |
|
386 | - . "requires moderator action: \n" |
|
387 | - . "\n" |
|
388 | - . "{$site_url}moderate", |
|
382 | + 'from' => '', |
|
383 | + 'subject' => "Content at {$site_name} is awaiting moderation", |
|
384 | + 'message' => '' |
|
385 | + . "Please visit the moderation queue page to review content that " |
|
386 | + . "requires moderator action: \n" |
|
387 | + . "\n" |
|
388 | + . "{$site_url}moderate", |
|
389 | 389 | ); |
390 | 390 | boinccore_rules_action_mail_to_moderators($settings); |
391 | 391 | variable_set('boinccore_last_content_moderation_reminder', time()); |
392 | - } |
|
392 | + } |
|
393 | 393 | |
394 | - // Delete expired tokens in BOINC DB |
|
395 | - _boinccore_delete_expired_tokens(); |
|
394 | + // Delete expired tokens in BOINC DB |
|
395 | + _boinccore_delete_expired_tokens(); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
399 | 399 | * Implementation of hook_rules_action_info(). |
400 | 400 | */ |
401 | 401 | function boinccore_rules_action_info() { |
402 | - return array( |
|
402 | + return array( |
|
403 | 403 | 'boinccore_rules_action_mail_to_moderators' => array( |
404 | - 'label' => t('Notify moderators via email'), |
|
405 | - 'module' => 'BOINC core', |
|
406 | - 'eval input' => array('subject', 'message', 'from'), |
|
404 | + 'label' => t('Notify moderators via email'), |
|
405 | + 'module' => 'BOINC core', |
|
406 | + 'eval input' => array('subject', 'message', 'from'), |
|
407 | 407 | ), |
408 | 408 | 'boinccore_rules_action_mark_content_for_moderation' => array( |
409 | - 'label' => t('Mark content for moderation'), |
|
410 | - 'arguments' => array( |
|
409 | + 'label' => t('Mark content for moderation'), |
|
410 | + 'arguments' => array( |
|
411 | 411 | 'node' => array('type' => 'node', 'label' => t('Content')), |
412 | - ), |
|
413 | - 'module' => 'BOINC core', |
|
412 | + ), |
|
413 | + 'module' => 'BOINC core', |
|
414 | 414 | ), |
415 | 415 | 'boinccore_rules_action_mail_to_admins' => array( |
416 | - 'label' => t('Notify admins via email'), |
|
417 | - 'module' => 'BOINC core', |
|
418 | - 'eval input' => array('subject', 'message', 'from'), |
|
416 | + 'label' => t('Notify admins via email'), |
|
417 | + 'module' => 'BOINC core', |
|
418 | + 'eval input' => array('subject', 'message', 'from'), |
|
419 | 419 | ), |
420 | - ); |
|
420 | + ); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Implementation of hook_form_alter() |
425 | 425 | */ |
426 | 426 | function boinccore_form_alter(&$form, $form_state, $form_id) { |
427 | - global $user; |
|
428 | - $account = user_load($user->uid); |
|
429 | - switch ($form_id) { |
|
430 | - // Comment form |
|
431 | - case 'comment_form': |
|
427 | + global $user; |
|
428 | + $account = user_load($user->uid); |
|
429 | + switch ($form_id) { |
|
430 | + // Comment form |
|
431 | + case 'comment_form': |
|
432 | 432 | $user_image = boincuser_get_user_profile_image($user->uid); |
433 | 433 | $user_info = '<div class="user">'; |
434 | 434 | if ($user_image) { |
435 | - $user_info .= ' <div class="picture">'; |
|
436 | - if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
435 | + $user_info .= ' <div class="picture">'; |
|
436 | + if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
437 | 437 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
438 | - } |
|
439 | - elseif (is_string($user_image)) { |
|
438 | + } |
|
439 | + elseif (is_string($user_image)) { |
|
440 | 440 | $user_info .= '<img src="' . $user_image . '"/>'; |
441 | - } |
|
442 | - $user_info .= ' </div>'; |
|
441 | + } |
|
442 | + $user_info .= ' </div>'; |
|
443 | 443 | } |
444 | 444 | $user_info .= ' <div class="name">' . theme('username', $account) . '</div>'; |
445 | 445 | if ($account->uid) { |
446 | - //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
|
447 | - //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
|
448 | - //$user_info .= ' <div class="credit">Credit: ' . $account->boincuser_total_credit . '</div>'; |
|
449 | - //$user_info .= ' <div class="rac">RAC: ' . $account->boincuser_expavg_credit . '</div>'; |
|
446 | + //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
|
447 | + //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
|
448 | + //$user_info .= ' <div class="credit">Credit: ' . $account->boincuser_total_credit . '</div>'; |
|
449 | + //$user_info .= ' <div class="rac">RAC: ' . $account->boincuser_expavg_credit . '</div>'; |
|
450 | 450 | } |
451 | 451 | $user_info .= '</div>'; |
452 | 452 | array_unshift($form, array( |
453 | - 'user_info' => array( |
|
453 | + 'user_info' => array( |
|
454 | 454 | '#value' => $user_info, |
455 | - ), |
|
456 | - 'comment_form_prefix' => array( |
|
455 | + ), |
|
456 | + 'comment_form_prefix' => array( |
|
457 | 457 | '#value' => '<div class="form-body">', |
458 | - ), |
|
458 | + ), |
|
459 | 459 | )); |
460 | 460 | $form['comment_form_suffix'] = array( |
461 | - '#value' => '</div>', |
|
461 | + '#value' => '</div>', |
|
462 | 462 | ); |
463 | 463 | |
464 | 464 | module_load_include('inc', 'bbcode', 'bbcode-help'); |
465 | 465 | $form['bbcode_help'] = array( |
466 | - '#title' => bts('BBcode help', array(), NULL, 'boinc:help-with-user-input-with-BBCode'), |
|
467 | - '#type' => 'fieldset', |
|
468 | - '#attributes' => array( |
|
466 | + '#title' => bts('BBcode help', array(), NULL, 'boinc:help-with-user-input-with-BBCode'), |
|
467 | + '#type' => 'fieldset', |
|
468 | + '#attributes' => array( |
|
469 | 469 | 'class' => 'bbcode_help', |
470 | - ), |
|
471 | - '#collapsible' => TRUE, |
|
472 | - '#collapsed' => TRUE, |
|
473 | - 'content' => array( |
|
470 | + ), |
|
471 | + '#collapsible' => TRUE, |
|
472 | + '#collapsed' => TRUE, |
|
473 | + 'content' => array( |
|
474 | 474 | '#value' => _bbcode_filter_tip(), |
475 | - ), |
|
475 | + ), |
|
476 | 476 | ); |
477 | 477 | |
478 | 478 | // If a specific comment is being referenced, go back to it on cancel |
479 | 479 | if ($comment_ref = $form['pid']['#value']) { |
480 | - $cancel_url = "goto/comment/{$comment_ref}"; |
|
480 | + $cancel_url = "goto/comment/{$comment_ref}"; |
|
481 | 481 | } |
482 | 482 | else { |
483 | - $cancel_url = "node/{$form['nid']['#value']}"; |
|
483 | + $cancel_url = "node/{$form['nid']['#value']}"; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | // Wrap action buttons for styling consistency |
487 | 487 | $form['buttons']['form control tabs prefix'] = array( |
488 | - '#value' => '<ul class="form-control tab-list">', |
|
489 | - '#weight' => 1001, |
|
488 | + '#value' => '<ul class="form-control tab-list">', |
|
489 | + '#weight' => 1001, |
|
490 | 490 | ); |
491 | 491 | $form['buttons']['submit'] = $form['submit']; |
492 | 492 | unset($form['submit']); |
@@ -505,12 +505,12 @@ discard block |
||
505 | 505 | $form['buttons']['preview']['#suffix'] = '</li>'; |
506 | 506 | $form['buttons']['preview']['#weight'] = 1003; |
507 | 507 | $form['buttons']['cancel'] = array( |
508 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url) . '</li>', |
|
509 | - '#weight' => 1004, |
|
508 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url) . '</li>', |
|
509 | + '#weight' => 1004, |
|
510 | 510 | ); |
511 | 511 | $form['buttons']['form control tabs suffix'] = array( |
512 | - '#value' => '</ul>', |
|
513 | - '#weight' => 1010, |
|
512 | + '#value' => '</ul>', |
|
513 | + '#weight' => 1010, |
|
514 | 514 | ); |
515 | 515 | |
516 | 516 | // Remove redundant name field |
@@ -526,38 +526,38 @@ discard block |
||
526 | 526 | $community_role = array_search('community member', user_roles(true)); |
527 | 527 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
528 | 528 | if ( (isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role])) ) { |
529 | - if ($node->type == 'forum') { |
|
529 | + if ($node->type == 'forum') { |
|
530 | 530 | if (module_exists('captcha')) { |
531 | - $form['comment_captcha'] = array( |
|
531 | + $form['comment_captcha'] = array( |
|
532 | 532 | '#type' => 'captcha', |
533 | 533 | '#weight' => 1000, |
534 | - ); |
|
534 | + ); |
|
535 | 535 | } |
536 | - } |
|
537 | - else { |
|
536 | + } |
|
537 | + else { |
|
538 | 538 | $form = NULL; |
539 | 539 | $form['from'] = array( |
540 | - '#type' => 'item', |
|
541 | - '#value' => 'You do not have permission to post comments in this forum.', |
|
540 | + '#type' => 'item', |
|
541 | + '#value' => 'You do not have permission to post comments in this forum.', |
|
542 | 542 | ); |
543 | - } |
|
543 | + } |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | break; |
547 | 547 | |
548 | - // Forum node form |
|
549 | - case 'forum_node_form': |
|
548 | + // Forum node form |
|
549 | + case 'forum_node_form': |
|
550 | 550 | case 'team_forum_node_form': |
551 | 551 | $forum_id = key($form['#node']->taxonomy); |
552 | 552 | $form['buttons']['separator_bottom'] = array( |
553 | - '#value' => '<div class="separator buttons"></div>', |
|
554 | - '#weight' => 999, |
|
553 | + '#value' => '<div class="separator buttons"></div>', |
|
554 | + '#weight' => 999, |
|
555 | 555 | ); |
556 | 556 | |
557 | 557 | // Wrap action buttons for styling consistency |
558 | 558 | $form['buttons']['form control tabs prefix'] = array( |
559 | - '#value' => '<ul class="form-control tab-list">', |
|
560 | - '#weight' => 1001, |
|
559 | + '#value' => '<ul class="form-control tab-list">', |
|
560 | + '#weight' => 1001, |
|
561 | 561 | ); |
562 | 562 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
563 | 563 | $form['buttons']['submit']['#value'] = bts('Post topic', array(), NULL, 'boinc:post-forum-comment'); |
@@ -570,28 +570,28 @@ discard block |
||
570 | 570 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
571 | 571 | $form['buttons']['preview_changes']['#weight'] = 1004; |
572 | 572 | $form['buttons']['cancel'] = array( |
573 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}") . '</li>', |
|
574 | - '#weight' => 1005, |
|
573 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}") . '</li>', |
|
574 | + '#weight' => 1005, |
|
575 | 575 | ); |
576 | 576 | $form['buttons']['form control tabs suffix'] = array( |
577 | - '#value' => '</ul>', |
|
578 | - '#weight' => 1010, |
|
577 | + '#value' => '</ul>', |
|
578 | + '#weight' => 1010, |
|
579 | 579 | ); |
580 | 580 | |
581 | 581 | // Add captcha for role='community member' |
582 | 582 | $community_role = array_search('community member', user_roles(true)); |
583 | 583 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
584 | 584 | if ( (isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role])) ) { |
585 | - if (module_exists('captcha')) { |
|
585 | + if (module_exists('captcha')) { |
|
586 | 586 | $form['comment_captcha'] = array( |
587 | - '#type' => 'captcha', |
|
588 | - '#weight' => 1000, |
|
587 | + '#type' => 'captcha', |
|
588 | + '#weight' => 1000, |
|
589 | 589 | ); |
590 | - } |
|
590 | + } |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | break; |
594 | - case 'boinccore_delete_confirm': |
|
594 | + case 'boinccore_delete_confirm': |
|
595 | 595 | // Wrap action buttons for styling consistency |
596 | 596 | $form['actions']['#prefix'] = '<ul class="form-control tab-list">'; |
597 | 597 | $form['actions']['#suffix'] = '</ul>'; |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
602 | 602 | $form['actions']['cancel']['#suffix'] = '</li>'; |
603 | 603 | break; |
604 | - default: |
|
604 | + default: |
|
605 | 605 | } |
606 | 606 | } |
607 | 607 | |
@@ -609,61 +609,61 @@ discard block |
||
609 | 609 | * Implementation of hook_link_alter() |
610 | 610 | */ |
611 | 611 | function boinccore_link_alter(&$links, $node, $comment = NULL) { |
612 | - //echo '<pre>' . print_r($links, true) . '</pre>'; |
|
613 | - foreach ($links as $module => $link) { |
|
612 | + //echo '<pre>' . print_r($links, true) . '</pre>'; |
|
613 | + foreach ($links as $module => $link) { |
|
614 | 614 | // Remove the ignore user link |
615 | 615 | if (strstr($module, 'ignore_user')) { |
616 | - unset($links[$module]); |
|
616 | + unset($links[$module]); |
|
617 | 617 | } |
618 | - } |
|
619 | - // Node first, then comment: to be consistent with boinccore_link() function |
|
620 | - if (!($comment)) { |
|
618 | + } |
|
619 | + // Node first, then comment: to be consistent with boinccore_link() function |
|
620 | + if (!($comment)) { |
|
621 | 621 | // modify the comment_add link |
622 | 622 | if (isset($links['comment_add'])) { |
623 | - $links['comment_add']['title'] = bts('reply', array(), NULL, 'boinc:forum-reply-to-comment'); |
|
624 | - $links['comment_add']['attributes'] = array( |
|
625 | - 'title' => bts('Reply to this comment', array(), NULL, 'boinc:forum-reply-to-comment') |
|
626 | - ); |
|
623 | + $links['comment_add']['title'] = bts('reply', array(), NULL, 'boinc:forum-reply-to-comment'); |
|
624 | + $links['comment_add']['attributes'] = array( |
|
625 | + 'title' => bts('Reply to this comment', array(), NULL, 'boinc:forum-reply-to-comment') |
|
626 | + ); |
|
627 | 627 | } |
628 | 628 | // modify quote link |
629 | 629 | if (isset($links['quote'])) { |
630 | - $links['quote']['attributes'] = array( |
|
631 | - 'title' => bts('Reply to this topic with a quote', array(), NULL, 'boinc:forum-reply-to-comment') |
|
632 | - ); |
|
630 | + $links['quote']['attributes'] = array( |
|
631 | + 'title' => bts('Reply to this topic with a quote', array(), NULL, 'boinc:forum-reply-to-comment') |
|
632 | + ); |
|
633 | 633 | } |
634 | - } |
|
635 | - else { |
|
634 | + } |
|
635 | + else { |
|
636 | 636 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
637 | 637 | if (isset($links['comment_delete'])) { |
638 | - $links['comment_delete']['attributes'] = array( |
|
639 | - 'title' => bts('Delete this comment', array(), NULL, 'boinc:forum-delete-comment') |
|
640 | - ); |
|
638 | + $links['comment_delete']['attributes'] = array( |
|
639 | + 'title' => bts('Delete this comment', array(), NULL, 'boinc:forum-delete-comment') |
|
640 | + ); |
|
641 | 641 | } |
642 | 642 | if (isset($links['comment_edit'])) { |
643 | - $links['comment_edit']['attributes'] = array( |
|
644 | - 'title' => bts('Edit this comment', array(), NULL, 'boinc:forum-edit-comment') |
|
645 | - ); |
|
643 | + $links['comment_edit']['attributes'] = array( |
|
644 | + 'title' => bts('Edit this comment', array(), NULL, 'boinc:forum-edit-comment') |
|
645 | + ); |
|
646 | 646 | } |
647 | 647 | if (isset($links['comment_reply'])) { |
648 | - $links['comment_reply']['attributes'] = array( |
|
649 | - 'title' => bts('Reply to this comment', array(), NULL, 'boinc:forum-reply-to-comment') |
|
650 | - ); |
|
648 | + $links['comment_reply']['attributes'] = array( |
|
649 | + 'title' => bts('Reply to this comment', array(), NULL, 'boinc:forum-reply-to-comment') |
|
650 | + ); |
|
651 | 651 | } |
652 | - }// if !$comment |
|
652 | + }// if !$comment |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |
656 | 656 | * Implementation of hook_locale(). |
657 | 657 | */ |
658 | 658 | function boinccore_locale($op = 'groups', $group = NULL) { |
659 | - switch ($op) { |
|
659 | + switch ($op) { |
|
660 | 660 | case 'groups': |
661 | 661 | return array('boinc' => 'BOINC'); |
662 | 662 | case 'info': |
663 | 663 | //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
664 | 664 | $info['boinc']['format'] = FALSE; |
665 | - return $info; |
|
666 | - } |
|
665 | + return $info; |
|
666 | + } |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | |
@@ -671,71 +671,71 @@ discard block |
||
671 | 671 | * Implementation of hook_link() |
672 | 672 | */ |
673 | 673 | function boinccore_link($type, $object, $teaser = FALSE) { |
674 | - // Add custom links with this hook |
|
674 | + // Add custom links with this hook |
|
675 | 675 | |
676 | - if ($type=='node') { |
|
676 | + if ($type=='node') { |
|
677 | 677 | if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
678 | - // Add topic moderator controls |
|
679 | - if (user_access('edit any forum topic')) { |
|
678 | + // Add topic moderator controls |
|
679 | + if (user_access('edit any forum topic')) { |
|
680 | 680 | $node_control = "node_control/{$object->nid}"; |
681 | 681 | if ($object->sticky) { |
682 | - $links['make_unsticky'] = array( |
|
683 | - 'title' => bts('Make unsticky', array(), NULL, 'boinc:forum-unsticky-comment'), |
|
684 | - 'href' => "{$node_control}/unsticky", |
|
685 | - 'attributes' => array( |
|
686 | - 'title' => bts('Remove sticky status from this topic', array(), NULL, 'boinc:forum-unsticky-comment') |
|
687 | - ) |
|
688 | - ); |
|
682 | + $links['make_unsticky'] = array( |
|
683 | + 'title' => bts('Make unsticky', array(), NULL, 'boinc:forum-unsticky-comment'), |
|
684 | + 'href' => "{$node_control}/unsticky", |
|
685 | + 'attributes' => array( |
|
686 | + 'title' => bts('Remove sticky status from this topic', array(), NULL, 'boinc:forum-unsticky-comment') |
|
687 | + ) |
|
688 | + ); |
|
689 | 689 | } |
690 | 690 | else { |
691 | - $links['make_sticky'] = array( |
|
692 | - 'title' => bts('Make sticky', array(), NULL, 'boinc:forum-sticky-comment'), |
|
693 | - 'href' => "{$node_control}/sticky", |
|
694 | - 'attributes' => array( |
|
695 | - 'title' => bts('Make this topic sticky', array(), NULL, 'boinc:forum-sticky-comment') |
|
696 | - ) |
|
697 | - ); |
|
691 | + $links['make_sticky'] = array( |
|
692 | + 'title' => bts('Make sticky', array(), NULL, 'boinc:forum-sticky-comment'), |
|
693 | + 'href' => "{$node_control}/sticky", |
|
694 | + 'attributes' => array( |
|
695 | + 'title' => bts('Make this topic sticky', array(), NULL, 'boinc:forum-sticky-comment') |
|
696 | + ) |
|
697 | + ); |
|
698 | 698 | } |
699 | 699 | if ($object->comment == COMMENT_NODE_READ_WRITE) { |
700 | - $links['lock'] = array( |
|
701 | - 'title' => bts('Lock', array(), NULL, 'boinc:forum-lock-comment'), |
|
702 | - 'href' => "{$node_control}/lock", |
|
703 | - 'attributes' => array( |
|
704 | - 'title' => bts('Lock this thread for comments', array(), NULL, 'boinc:forum-lock-comment') |
|
705 | - ) |
|
706 | - ); |
|
700 | + $links['lock'] = array( |
|
701 | + 'title' => bts('Lock', array(), NULL, 'boinc:forum-lock-comment'), |
|
702 | + 'href' => "{$node_control}/lock", |
|
703 | + 'attributes' => array( |
|
704 | + 'title' => bts('Lock this thread for comments', array(), NULL, 'boinc:forum-lock-comment') |
|
705 | + ) |
|
706 | + ); |
|
707 | 707 | } |
708 | 708 | else { |
709 | - $links['unlock'] = array( |
|
710 | - 'title' => bts('Unlock', array(), NULL, 'boinc:forum-unlock-comment'), |
|
711 | - 'href' => "{$node_control}/unlock", |
|
712 | - 'attributes' => array( |
|
713 | - 'title' => bts('Unlock this thread for comments', array(), NULL, 'boinc:forum-unlock-comment') |
|
714 | - ) |
|
715 | - ); |
|
709 | + $links['unlock'] = array( |
|
710 | + 'title' => bts('Unlock', array(), NULL, 'boinc:forum-unlock-comment'), |
|
711 | + 'href' => "{$node_control}/unlock", |
|
712 | + 'attributes' => array( |
|
713 | + 'title' => bts('Unlock this thread for comments', array(), NULL, 'boinc:forum-unlock-comment') |
|
714 | + ) |
|
715 | + ); |
|
716 | 716 | } |
717 | 717 | if ($object->status) { |
718 | - $links['hide'] = array( |
|
719 | - 'title' => bts('Hide', array(), NULL, 'boinc:forum-hide-comment'), |
|
720 | - 'href' => "{$node_control}/hide", |
|
721 | - 'attributes' => array( |
|
722 | - 'title' => bts('Hide this topic', array(), NULL, 'boinc:forum-hide-comment') |
|
723 | - ) |
|
724 | - ); |
|
718 | + $links['hide'] = array( |
|
719 | + 'title' => bts('Hide', array(), NULL, 'boinc:forum-hide-comment'), |
|
720 | + 'href' => "{$node_control}/hide", |
|
721 | + 'attributes' => array( |
|
722 | + 'title' => bts('Hide this topic', array(), NULL, 'boinc:forum-hide-comment') |
|
723 | + ) |
|
724 | + ); |
|
725 | 725 | } |
726 | 726 | else { |
727 | - $links['unhide'] = array( |
|
728 | - 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
|
729 | - 'href' => "{$node_control}/unhide", |
|
730 | - 'attributes' => array( |
|
731 | - 'title' => bts('Unhide this topic', array(), NULL, 'boinc:forum-unhide-comment') |
|
732 | - ) |
|
733 | - ); |
|
727 | + $links['unhide'] = array( |
|
728 | + 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
|
729 | + 'href' => "{$node_control}/unhide", |
|
730 | + 'attributes' => array( |
|
731 | + 'title' => bts('Unhide this topic', array(), NULL, 'boinc:forum-unhide-comment') |
|
732 | + ) |
|
733 | + ); |
|
734 | 734 | } |
735 | - }// if user_access('edit any forum topic') |
|
735 | + }// if user_access('edit any forum topic') |
|
736 | 736 | } |
737 | - } |
|
738 | - else if ($type=='comment') { |
|
737 | + } |
|
738 | + else if ($type=='comment') { |
|
739 | 739 | $node = node_load($object->nid); |
740 | 740 | $nid = $object->nid; |
741 | 741 | $cid = $object->cid; |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | // HIDE and COVERT comment |
756 | 756 | // The following are moderator only links |
757 | 757 | if (user_access('administer comments')) { |
758 | - $comment_control = "comment_control/{$cid}"; |
|
759 | - // Add link to convert comment into a new topic |
|
760 | - $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
761 | - if ($reply_count == 0) { |
|
758 | + $comment_control = "comment_control/{$cid}"; |
|
759 | + // Add link to convert comment into a new topic |
|
760 | + $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
761 | + if ($reply_count == 0) { |
|
762 | 762 | $links['convert'] = array( |
763 | 763 | 'title' => bts('Convert', array(), NULL, 'boinc:forum-convert-comment-to-topic'), |
764 | 764 | 'href' => "{$comment_control}/convert", |
@@ -766,9 +766,9 @@ discard block |
||
766 | 766 | 'title' => bts('Convert this comment to a new topic', array(), NULL, 'boinc:forum-convert-comment-to-topic') |
767 | 767 | ) |
768 | 768 | ); |
769 | - } |
|
770 | - // Add hide link |
|
771 | - if ($object->status == 0) { |
|
769 | + } |
|
770 | + // Add hide link |
|
771 | + if ($object->status == 0) { |
|
772 | 772 | $links['hide'] = array( |
773 | 773 | 'title' => bts('Hide', array(), NULL, 'boinc:forum-hide-comment'), |
774 | 774 | 'href' => "{$comment_control}/hide", |
@@ -776,8 +776,8 @@ discard block |
||
776 | 776 | 'title' => bts('Hide this comment', array(), NULL, 'boinc:forum-hide-comment') |
777 | 777 | ) |
778 | 778 | ); |
779 | - } |
|
780 | - else { |
|
779 | + } |
|
780 | + else { |
|
781 | 781 | $links['unhide'] = array( |
782 | 782 | 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
783 | 783 | 'href' => "{$comment_control}/unhide", |
@@ -785,27 +785,27 @@ discard block |
||
785 | 785 | 'title' => bts('Unhide this comment', array(), NULL, 'boinc:forum-unhide-comment') |
786 | 786 | ) |
787 | 787 | ); |
788 | - } |
|
788 | + } |
|
789 | 789 | }// if user_access('administer comments') |
790 | - }//if $type |
|
790 | + }//if $type |
|
791 | 791 | |
792 | - return $links; |
|
792 | + return $links; |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | /** |
796 | 796 | * Implementation of hook_mail_alter() |
797 | 797 | */ |
798 | 798 | function boinccore_mail_alter(&$message) { |
799 | - /* This code alters the headers for all emails sent by the Drupal Web site to use |
|
799 | + /* This code alters the headers for all emails sent by the Drupal Web site to use |
|
800 | 800 | 'Quote-Printable' as the encoding, both altering the header and modifies the body to the |
801 | 801 | new encoding. |
802 | 802 | */ |
803 | - $message['headers']['Content-Transfer-Encoding'] = 'Quoted-Printable'; |
|
804 | - if (is_array($message['body'])) { |
|
803 | + $message['headers']['Content-Transfer-Encoding'] = 'Quoted-Printable'; |
|
804 | + if (is_array($message['body'])) { |
|
805 | 805 | $message['body'] = array_map( "quoted_printable_encode", $message['body'] ); |
806 | - } else { |
|
806 | + } else { |
|
807 | 807 | $message['body'] = quoted_printable_encode($message['body']); |
808 | - } |
|
808 | + } |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -818,45 +818,45 @@ discard block |
||
818 | 818 | * link rather than through the node form. |
819 | 819 | */ |
820 | 820 | function boinccore_node_control($nid = NULL, $action = NULL) { |
821 | - if ((!$nid OR !$node = node_load($nid)) OR |
|
821 | + if ((!$nid OR !$node = node_load($nid)) OR |
|
822 | 822 | ($node->type == 'forum' AND !user_access('edit any forum topic')) OR |
823 | 823 | ($node->type != 'forum' AND !user_access('administer nodes'))) { |
824 | 824 | // What are you even doing here... |
825 | 825 | return FALSE; |
826 | - } |
|
827 | - switch ($action) { |
|
828 | - case 'unhide': |
|
826 | + } |
|
827 | + switch ($action) { |
|
828 | + case 'unhide': |
|
829 | 829 | node_publish_action($node); |
830 | 830 | break; |
831 | - case 'hide': |
|
831 | + case 'hide': |
|
832 | 832 | node_unpublish_action($node); |
833 | 833 | break; |
834 | - case 'sticky': |
|
834 | + case 'sticky': |
|
835 | 835 | node_make_sticky_action($node); |
836 | 836 | break; |
837 | - case 'unsticky': |
|
837 | + case 'unsticky': |
|
838 | 838 | node_make_unsticky_action($node); |
839 | 839 | break; |
840 | - case 'lock': |
|
840 | + case 'lock': |
|
841 | 841 | $node->comment = 1; |
842 | 842 | watchdog('action', 'Locked comments on @type %title.', array( |
843 | - '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
843 | + '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
844 | 844 | break; |
845 | - case 'unlock': |
|
845 | + case 'unlock': |
|
846 | 846 | $node->comment = 2; |
847 | 847 | watchdog('action', 'Unlocked comments on @type %title.', array( |
848 | - '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
848 | + '@type' => node_get_types('name', $node), '%title' => $node->title)); |
|
849 | 849 | break; |
850 | - default: |
|
850 | + default: |
|
851 | 851 | } |
852 | - node_save($node); |
|
853 | - // If hiding a forum topic (node) and not an administrator, go to |
|
854 | - // the forum page. Otherwise the user will reach an access-denied |
|
855 | - // page. |
|
856 | - if (($action=="hide") and (!user_access('administer forums'))) { |
|
852 | + node_save($node); |
|
853 | + // If hiding a forum topic (node) and not an administrator, go to |
|
854 | + // the forum page. Otherwise the user will reach an access-denied |
|
855 | + // page. |
|
856 | + if (($action=="hide") and (!user_access('administer forums'))) { |
|
857 | 857 | drupal_goto("community/forum/{$node->tid}"); |
858 | - } |
|
859 | - drupal_goto("node/{$nid}"); |
|
858 | + } |
|
859 | + drupal_goto("node/{$nid}"); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | /** |
@@ -865,28 +865,28 @@ discard block |
||
865 | 865 | * through the comment edit form. |
866 | 866 | */ |
867 | 867 | function boinccore_comment_control($cid = NULL, $action = NULL) { |
868 | - if (!$cid OR !$comment = _comment_load($cid)) { |
|
868 | + if (!$cid OR !$comment = _comment_load($cid)) { |
|
869 | 869 | // What are you even doing here... |
870 | 870 | return FALSE; |
871 | - } |
|
872 | - $return_path = "node/{$comment->nid}"; |
|
873 | - $return_anchor = "comment-{$cid}"; |
|
874 | - switch ($action) { |
|
875 | - case 'unhide': |
|
871 | + } |
|
872 | + $return_path = "node/{$comment->nid}"; |
|
873 | + $return_anchor = "comment-{$cid}"; |
|
874 | + switch ($action) { |
|
875 | + case 'unhide': |
|
876 | 876 | comment_publish_action($comment); |
877 | 877 | rules_invoke_event('boinccore_comment_unhidden', $comment); |
878 | 878 | if (module_exists("boinc_solr_comments")) { |
879 | - boinc_solr_comments_publish($comment); |
|
879 | + boinc_solr_comments_publish($comment); |
|
880 | 880 | } |
881 | 881 | break; |
882 | - case 'hide': |
|
882 | + case 'hide': |
|
883 | 883 | comment_unpublish_action($comment); |
884 | 884 | rules_invoke_event('comment_unpublish', $comment); |
885 | 885 | if (module_exists("boinc_solr_comments")) { |
886 | - boinc_solr_comments_unpublish($comment); |
|
886 | + boinc_solr_comments_unpublish($comment); |
|
887 | 887 | } |
888 | 888 | break; |
889 | - case 'convert': |
|
889 | + case 'convert': |
|
890 | 890 | $node = new stdClass(); |
891 | 891 | $node->name = $comment->subject; |
892 | 892 | $node->title = $node->name; |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | $node->tid = $parent_node->tid; |
907 | 907 | |
908 | 908 | if (filter_access($comment->format)) { |
909 | - $node->format = $comment->format; |
|
909 | + $node->format = $comment->format; |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | // Save the new node |
@@ -922,9 +922,9 @@ discard block |
||
922 | 922 | $return_path = "node/{$node->nid}"; |
923 | 923 | $return_anchor = NULL; |
924 | 924 | break; |
925 | - default: |
|
925 | + default: |
|
926 | 926 | } |
927 | - drupal_goto($return_path, NULL, $return_anchor); |
|
927 | + drupal_goto($return_path, NULL, $return_anchor); |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | /** |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * Get the authenticator for a given account |
933 | 933 | */ |
934 | 934 | function boinccore_lookup_account() { |
935 | - include_boinc('user/lookup_account.php'); |
|
935 | + include_boinc('user/lookup_account.php'); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | /** |
@@ -940,29 +940,29 @@ discard block |
||
940 | 940 | * Get assorted details for a given account |
941 | 941 | */ |
942 | 942 | function boinccore_am_get_info() { |
943 | - // Remove q from the GET request or BOINC will panic |
|
944 | - unset($_GET['q']); |
|
945 | - // Capture the XML output of the RPC so we can override things |
|
946 | - ob_start(); |
|
947 | - include_boinc('user/am_get_info.php'); |
|
948 | - $xml = ob_get_clean(); |
|
949 | - $xml = load_configuration($xml); |
|
950 | - // See if the account has an approved profile in Drupal |
|
951 | - $uid = !empty($xml['am_get_info_reply']['id']) ? boincuser_lookup_uid($xml['am_get_info_reply']['id']) : 0; |
|
952 | - if ($uid) { |
|
943 | + // Remove q from the GET request or BOINC will panic |
|
944 | + unset($_GET['q']); |
|
945 | + // Capture the XML output of the RPC so we can override things |
|
946 | + ob_start(); |
|
947 | + include_boinc('user/am_get_info.php'); |
|
948 | + $xml = ob_get_clean(); |
|
949 | + $xml = load_configuration($xml); |
|
950 | + // See if the account has an approved profile in Drupal |
|
951 | + $uid = !empty($xml['am_get_info_reply']['id']) ? boincuser_lookup_uid($xml['am_get_info_reply']['id']) : 0; |
|
952 | + if ($uid) { |
|
953 | 953 | $content_profile = content_profile_load('profile', $uid); |
954 | 954 | $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
955 | 955 | $country = check_plain($content_profile->field_country[0]['value']); |
956 | 956 | $website = ''; |
957 | 957 | if ($profile_is_approved) { |
958 | - $website = check_plain($content_profile->field_url[0]['value']); |
|
958 | + $website = check_plain($content_profile->field_url[0]['value']); |
|
959 | 959 | } |
960 | 960 | // Override BOINC values with Drupal values as needed |
961 | 961 | $xml['am_get_info_reply']['has_profile']['@value'] = ($profile_is_approved) ? 1 : 0; |
962 | 962 | $xml['am_get_info_reply']['country']['@value'] = $country; |
963 | 963 | $xml['am_get_info_reply']['url']['@value'] = $website; |
964 | - } |
|
965 | - print save_configuration($xml); |
|
964 | + } |
|
965 | + print save_configuration($xml); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /** |
@@ -970,75 +970,75 @@ discard block |
||
970 | 970 | * Update assorted details for a given account |
971 | 971 | */ |
972 | 972 | function boinccore_am_set_info() { |
973 | - // Remove q from the GET request or BOINC will panic |
|
974 | - unset($_GET['q']); |
|
975 | - // Validate the XML prefs (in case BOINC does not) |
|
976 | - $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : NULL); |
|
977 | - $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : NULL); |
|
978 | - libxml_use_internal_errors(true); |
|
979 | - $xml = new DomDocument(); |
|
980 | - if ($global_prefs) { |
|
973 | + // Remove q from the GET request or BOINC will panic |
|
974 | + unset($_GET['q']); |
|
975 | + // Validate the XML prefs (in case BOINC does not) |
|
976 | + $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : NULL); |
|
977 | + $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : NULL); |
|
978 | + libxml_use_internal_errors(true); |
|
979 | + $xml = new DomDocument(); |
|
980 | + if ($global_prefs) { |
|
981 | 981 | $xml->loadXML($global_prefs, LIBXML_NOBLANKS); |
982 | 982 | if ($errors = libxml_get_errors($xml)) { |
983 | - $lines = explode("\r", $global_prefs); |
|
984 | - watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
983 | + $lines = explode("\r", $global_prefs); |
|
984 | + watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
985 | 985 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
986 | 986 | } |
987 | - } |
|
988 | - elseif ($project_prefs) { |
|
987 | + } |
|
988 | + elseif ($project_prefs) { |
|
989 | 989 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
990 | 990 | if ($errors = libxml_get_errors($xml)) { |
991 | - $lines = explode("\r", $project_prefs); |
|
992 | - watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
991 | + $lines = explode("\r", $project_prefs); |
|
992 | + watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
993 | 993 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
994 | 994 | } |
995 | - } |
|
996 | - if (!$errors) { |
|
995 | + } |
|
996 | + if (!$errors) { |
|
997 | 997 | // Capture the XML output of the RPC so we can override things |
998 | 998 | ob_start(); |
999 | 999 | include_boinc('user/am_set_info.php'); |
1000 | 1000 | $xml = ob_get_clean(); |
1001 | 1001 | $xml = load_configuration($xml); |
1002 | 1002 | if (isset($xml['am_set_info_reply']['success'])) { |
1003 | - // Find the account in Drupal |
|
1004 | - $boinc_auth = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
|
1005 | - db_set_active('boinc_rw'); |
|
1006 | - $boinc_id = db_result(db_query(" |
|
1003 | + // Find the account in Drupal |
|
1004 | + $boinc_auth = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key']; |
|
1005 | + db_set_active('boinc_rw'); |
|
1006 | + $boinc_id = db_result(db_query(" |
|
1007 | 1007 | SELECT id |
1008 | 1008 | FROM {user} |
1009 | 1009 | WHERE authenticator = '%s'", |
1010 | 1010 | $boinc_auth |
1011 | - )); |
|
1012 | - db_set_active('default'); |
|
1013 | - $uid = boincuser_lookup_uid($boinc_id); |
|
1011 | + )); |
|
1012 | + db_set_active('default'); |
|
1013 | + $uid = boincuser_lookup_uid($boinc_id); |
|
1014 | 1014 | |
1015 | - // Apply any relevant updates to the Drupal account, also |
|
1016 | - $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : NULL); |
|
1017 | - $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : NULL); |
|
1018 | - $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : NULL); |
|
1015 | + // Apply any relevant updates to the Drupal account, also |
|
1016 | + $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : NULL); |
|
1017 | + $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : NULL); |
|
1018 | + $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : NULL); |
|
1019 | 1019 | |
1020 | - if ($email_addr) { |
|
1020 | + if ($email_addr) { |
|
1021 | 1021 | $account = user_load($uid); |
1022 | 1022 | user_save($account, array('mail' => $email_addr)); |
1023 | - } |
|
1024 | - if ($country OR $url) { |
|
1023 | + } |
|
1024 | + if ($country OR $url) { |
|
1025 | 1025 | $content_profile = content_profile_load('profile', $uid); |
1026 | 1026 | if ($country) $content_profile->field_country[0]['value'] = $country; |
1027 | 1027 | if ($url) $content_profile->field_url[0]['value'] = $url; |
1028 | 1028 | node_save($content_profile); |
1029 | - } |
|
1029 | + } |
|
1030 | 1030 | } |
1031 | - } |
|
1032 | - else { |
|
1031 | + } |
|
1032 | + else { |
|
1033 | 1033 | $xml = array( |
1034 | - 'error' => array( |
|
1034 | + 'error' => array( |
|
1035 | 1035 | 'error_num' => -112, |
1036 | 1036 | 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}" . |
1037 | 1037 | ': <br/>' . htmlentities($lines[$errors[0]->line - 1]) |
1038 | - ), |
|
1038 | + ), |
|
1039 | 1039 | ); |
1040 | - } |
|
1041 | - print save_configuration($xml); |
|
1040 | + } |
|
1041 | + print save_configuration($xml); |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | /** |
@@ -1046,17 +1046,17 @@ discard block |
||
1046 | 1046 | * Update the venue for the given host |
1047 | 1047 | */ |
1048 | 1048 | function boinccore_am_set_host_info() { |
1049 | - // Remove q from the GET request or BOINC will panic |
|
1050 | - unset($_GET['q']); |
|
1051 | - // Capture the XML output of the RPC so we can override things |
|
1052 | - ob_start(); |
|
1053 | - include_boinc('user/am_set_host_info.php'); |
|
1054 | - $xml = ob_get_clean(); |
|
1055 | - $xml = load_configuration($xml); |
|
1056 | - if (isset($xml['am_set_host_info_reply']['success'])) { |
|
1049 | + // Remove q from the GET request or BOINC will panic |
|
1050 | + unset($_GET['q']); |
|
1051 | + // Capture the XML output of the RPC so we can override things |
|
1052 | + ob_start(); |
|
1053 | + include_boinc('user/am_set_host_info.php'); |
|
1054 | + $xml = ob_get_clean(); |
|
1055 | + $xml = load_configuration($xml); |
|
1056 | + if (isset($xml['am_set_host_info_reply']['success'])) { |
|
1057 | 1057 | // Override anything that needs overriding |
1058 | - } |
|
1059 | - print save_configuration($xml); |
|
1058 | + } |
|
1059 | + print save_configuration($xml); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | /** |
@@ -1064,29 +1064,29 @@ discard block |
||
1064 | 1064 | * Get assorted details for a given account |
1065 | 1065 | */ |
1066 | 1066 | function boinccore_show_user() { |
1067 | - // Remove q from the GET request or BOINC will panic |
|
1068 | - unset($_GET['q']); |
|
1069 | - // Capture the XML output of the RPC so we can override things |
|
1070 | - ob_start(); |
|
1071 | - include_boinc('user/show_user.php'); |
|
1072 | - $xml = ob_get_clean(); |
|
1073 | - $xml = load_configuration($xml); |
|
1074 | - // See if the account has an approved profile in Drupal |
|
1075 | - $uid = !empty($xml['user']['id']) ? boincuser_lookup_uid($xml['user']['id']) : 0; |
|
1076 | - if ($uid) { |
|
1067 | + // Remove q from the GET request or BOINC will panic |
|
1068 | + unset($_GET['q']); |
|
1069 | + // Capture the XML output of the RPC so we can override things |
|
1070 | + ob_start(); |
|
1071 | + include_boinc('user/show_user.php'); |
|
1072 | + $xml = ob_get_clean(); |
|
1073 | + $xml = load_configuration($xml); |
|
1074 | + // See if the account has an approved profile in Drupal |
|
1075 | + $uid = !empty($xml['user']['id']) ? boincuser_lookup_uid($xml['user']['id']) : 0; |
|
1076 | + if ($uid) { |
|
1077 | 1077 | $content_profile = content_profile_load('profile', $uid); |
1078 | 1078 | $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
1079 | 1079 | $country = check_plain($content_profile->field_country[0]['value']); |
1080 | 1080 | $website = ''; |
1081 | 1081 | if ($profile_is_approved) { |
1082 | - $website = check_plain($content_profile->field_url[0]['value']); |
|
1082 | + $website = check_plain($content_profile->field_url[0]['value']); |
|
1083 | 1083 | } |
1084 | 1084 | // Override BOINC values with Drupal values as needed |
1085 | 1085 | $xml['user']['has_profile']['@value'] = ($profile_is_approved) ? 1 : 0; |
1086 | 1086 | $xml['user']['country']['@value'] = $country; |
1087 | 1087 | $xml['user']['url']['@value'] = $website; |
1088 | - } |
|
1089 | - print save_configuration($xml); |
|
1088 | + } |
|
1089 | + print save_configuration($xml); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | /** |
@@ -1094,9 +1094,9 @@ discard block |
||
1094 | 1094 | * Get pending credit information for a given account |
1095 | 1095 | */ |
1096 | 1096 | function boinccore_pending_credit() { |
1097 | - // Remove q from the GET request or BOINC will panic |
|
1098 | - unset($_GET['q']); |
|
1099 | - include_boinc('user/pending.php'); |
|
1097 | + // Remove q from the GET request or BOINC will panic |
|
1098 | + unset($_GET['q']); |
|
1099 | + include_boinc('user/pending.php'); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | /** |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | */ |
1106 | 1106 | function boinccore_create_team() { |
1107 | 1107 | |
1108 | - if (module_exists('boincteam')) { |
|
1108 | + if (module_exists('boincteam')) { |
|
1109 | 1109 | module_load_include('module', 'boincteam', 'boincteam'); |
1110 | 1110 | |
1111 | 1111 | $input_format = !empty($values['format']) ? $values['format'] : 4; |
@@ -1118,9 +1118,9 @@ discard block |
||
1118 | 1118 | $xml = load_configuration($xml); |
1119 | 1119 | |
1120 | 1120 | if (isset($xml['create_team_reply']['success'])) { |
1121 | - $boincteam_id = isset($xml['create_team_reply']['team_id']['@value']) ? $xml['create_team_reply']['team_id']['@value'] : 0; |
|
1121 | + $boincteam_id = isset($xml['create_team_reply']['team_id']['@value']) ? $xml['create_team_reply']['team_id']['@value'] : 0; |
|
1122 | 1122 | |
1123 | - if ($boincteam_id) { |
|
1123 | + if ($boincteam_id) { |
|
1124 | 1124 | |
1125 | 1125 | $boincteam = boincteam_load($boincteam_id); |
1126 | 1126 | $team_owner_uid = boincuser_lookup_uid($boincteam->userid); |
@@ -1128,92 +1128,92 @@ discard block |
||
1128 | 1128 | // Create the team node in Drupal |
1129 | 1129 | |
1130 | 1130 | $values = array( |
1131 | - 'name' => isset($_GET['name']) ? $_GET['name'] : '', |
|
1132 | - 'description' => isset($_GET['description']) ? $_GET['description'] : '', |
|
1133 | - 'type' => isset($_GET['type']) ? $_GET['type'] : '', |
|
1131 | + 'name' => isset($_GET['name']) ? $_GET['name'] : '', |
|
1132 | + 'description' => isset($_GET['description']) ? $_GET['description'] : '', |
|
1133 | + 'type' => isset($_GET['type']) ? $_GET['type'] : '', |
|
1134 | 1134 | ); |
1135 | 1135 | $teaser = node_teaser($values['description']); |
1136 | 1136 | $created_time = time(); |
1137 | 1137 | |
1138 | 1138 | $node = array( |
1139 | - 'type' => 'team', |
|
1140 | - 'title' => $values['name'], |
|
1141 | - 'body' => $values['description'], |
|
1142 | - 'teaser' => $teaser, |
|
1143 | - 'uid' => $team_owner_uid, |
|
1144 | - 'path' => null, |
|
1145 | - 'status' => 1, // published or not - always publish |
|
1146 | - 'promote' => 0, |
|
1147 | - 'created' => $created_time, |
|
1148 | - 'comment' => 0, // comments disabled |
|
1149 | - 'moderate' => 0, |
|
1150 | - 'sticky' => 0, |
|
1151 | - 'format' => $input_format |
|
1139 | + 'type' => 'team', |
|
1140 | + 'title' => $values['name'], |
|
1141 | + 'body' => $values['description'], |
|
1142 | + 'teaser' => $teaser, |
|
1143 | + 'uid' => $team_owner_uid, |
|
1144 | + 'path' => null, |
|
1145 | + 'status' => 1, // published or not - always publish |
|
1146 | + 'promote' => 0, |
|
1147 | + 'created' => $created_time, |
|
1148 | + 'comment' => 0, // comments disabled |
|
1149 | + 'moderate' => 0, |
|
1150 | + 'sticky' => 0, |
|
1151 | + 'format' => $input_format |
|
1152 | 1152 | ); |
1153 | 1153 | |
1154 | 1154 | // Use pathauto function, if available, to clean up the path |
1155 | 1155 | if (module_exists('pathauto')) { |
1156 | - module_load_include('inc', 'pathauto', 'pathauto'); |
|
1157 | - $node['path'] = pathauto_cleanstring($values['name']); |
|
1156 | + module_load_include('inc', 'pathauto', 'pathauto'); |
|
1157 | + $node['path'] = pathauto_cleanstring($values['name']); |
|
1158 | 1158 | |
1159 | - $node = (object) $node; // node_save requires an object form |
|
1160 | - $team_categories = taxonomy_get_term_by_name($values['type']); |
|
1161 | - $node->taxonomy[] = $team_categories[0]; |
|
1159 | + $node = (object) $node; // node_save requires an object form |
|
1160 | + $team_categories = taxonomy_get_term_by_name($values['type']); |
|
1161 | + $node->taxonomy[] = $team_categories[0]; |
|
1162 | 1162 | |
1163 | - // Save the team node |
|
1164 | - node_save($node); |
|
1165 | - // Save the team IDs to a BOINC <--> Drupal reference table. |
|
1166 | - db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
|
1163 | + // Save the team node |
|
1164 | + node_save($node); |
|
1165 | + // Save the team IDs to a BOINC <--> Drupal reference table. |
|
1166 | + db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam_id, $node->nid); |
|
1167 | 1167 | } |
1168 | 1168 | else { |
1169 | - $xml['create_team_reply']['warning'] = t( |
|
1169 | + $xml['create_team_reply']['warning'] = t( |
|
1170 | 1170 | 'There was a problem integrating this team into Drupal. Please |
1171 | 1171 | contact @project administrators!', array('@project' => PROJECT) |
1172 | - ); |
|
1173 | - watchdog( |
|
1172 | + ); |
|
1173 | + watchdog( |
|
1174 | 1174 | 'BOINC team', |
1175 | 1175 | 'BOINC teams require the Pathauto module. Team cannot be created in |
1176 | 1176 | Drupal via create_team.php RPC.', |
1177 | 1177 | array(), |
1178 | 1178 | WATCHDOG_ERROR |
1179 | - ); |
|
1180 | - // Delete from the BOINC DB if we can't sync with Drupal |
|
1181 | - $boincteam::delete(); |
|
1179 | + ); |
|
1180 | + // Delete from the BOINC DB if we can't sync with Drupal |
|
1181 | + $boincteam::delete(); |
|
1182 | 1182 | } |
1183 | - } |
|
1184 | - else { |
|
1183 | + } |
|
1184 | + else { |
|
1185 | 1185 | $xml['create_team_reply']['warning'] = t( |
1186 | - 'There was a problem integrating this team into Drupal. Please |
|
1186 | + 'There was a problem integrating this team into Drupal. Please |
|
1187 | 1187 | contact @project administrators!', array('@project' => PROJECT) |
1188 | 1188 | ); |
1189 | 1189 | watchdog( |
1190 | - 'BOINC team', |
|
1191 | - 'Team cannot be created in Drupal via create_team.php RPC because no |
|
1190 | + 'BOINC team', |
|
1191 | + 'Team cannot be created in Drupal via create_team.php RPC because no |
|
1192 | 1192 | BOINC team ID was returned in the XML.', |
1193 | - array(), |
|
1194 | - WATCHDOG_ERROR |
|
1193 | + array(), |
|
1194 | + WATCHDOG_ERROR |
|
1195 | 1195 | ); |
1196 | - } |
|
1196 | + } |
|
1197 | 1197 | } |
1198 | - } |
|
1199 | - else { |
|
1198 | + } |
|
1199 | + else { |
|
1200 | 1200 | $xml = array( |
1201 | - 'error' => array( |
|
1201 | + 'error' => array( |
|
1202 | 1202 | 'error_num' => -1, |
1203 | 1203 | 'error_msg' => t( |
1204 | - 'Teams are not enabled for this project' |
|
1204 | + 'Teams are not enabled for this project' |
|
1205 | + ), |
|
1205 | 1206 | ), |
1206 | - ), |
|
1207 | 1207 | ); |
1208 | 1208 | watchdog( |
1209 | - 'BOINC team', |
|
1210 | - 'Team cannot be created in Drupal via create_team.php RPC because the |
|
1209 | + 'BOINC team', |
|
1210 | + 'Team cannot be created in Drupal via create_team.php RPC because the |
|
1211 | 1211 | BOINC team module is not enabled.', |
1212 | - array(), |
|
1213 | - WATCHDOG_ERROR |
|
1212 | + array(), |
|
1213 | + WATCHDOG_ERROR |
|
1214 | 1214 | ); |
1215 | - } |
|
1216 | - print save_configuration($xml); |
|
1215 | + } |
|
1216 | + print save_configuration($xml); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | /** |
@@ -1221,9 +1221,9 @@ discard block |
||
1221 | 1221 | * Get info on a team by ID or a list of teams that match a given name |
1222 | 1222 | */ |
1223 | 1223 | function boinccore_team_lookup() { |
1224 | - // Remove q from the GET request or BOINC will panic |
|
1225 | - unset($_GET['q']); |
|
1226 | - include_boinc('user/team_lookup.php'); |
|
1224 | + // Remove q from the GET request or BOINC will panic |
|
1225 | + unset($_GET['q']); |
|
1226 | + include_boinc('user/team_lookup.php'); |
|
1227 | 1227 | } |
1228 | 1228 | |
1229 | 1229 | /** |
@@ -1231,72 +1231,72 @@ discard block |
||
1231 | 1231 | * Get members of a given team |
1232 | 1232 | */ |
1233 | 1233 | function boinccore_team_email_list() { |
1234 | - // See if the account has an approved profile in Drupal |
|
1235 | - $boincteam_id = !empty($_POST['teamid']) ? $_POST['teamid'] : $_GET['teamid']; |
|
1236 | - $credit_only = !empty($_POST['creditonly']) ? $_POST['creditonly'] : $_GET['creditonly']; |
|
1237 | - $show_xml = !empty($_POST['xml']) ? $_POST['xml'] : $_GET['xml']; |
|
1238 | - if (!$show_xml) { |
|
1239 | - // creditonly does not affect non xml output in BOINC |
|
1240 | - $credit_only = FALSE; |
|
1241 | - } |
|
1242 | - $xml = array(); |
|
1234 | + // See if the account has an approved profile in Drupal |
|
1235 | + $boincteam_id = !empty($_POST['teamid']) ? $_POST['teamid'] : $_GET['teamid']; |
|
1236 | + $credit_only = !empty($_POST['creditonly']) ? $_POST['creditonly'] : $_GET['creditonly']; |
|
1237 | + $show_xml = !empty($_POST['xml']) ? $_POST['xml'] : $_GET['xml']; |
|
1238 | + if (!$show_xml) { |
|
1239 | + // creditonly does not affect non xml output in BOINC |
|
1240 | + $credit_only = FALSE; |
|
1241 | + } |
|
1242 | + $xml = array(); |
|
1243 | 1243 | |
1244 | - if ($boincteam_id && is_numeric($boincteam_id)) { |
|
1244 | + if ($boincteam_id && is_numeric($boincteam_id)) { |
|
1245 | 1245 | if ($credit_only) { |
1246 | - db_set_active('boinc_rw'); |
|
1247 | - $result = db_query(" |
|
1246 | + db_set_active('boinc_rw'); |
|
1247 | + $result = db_query(" |
|
1248 | 1248 | SELECT |
1249 | 1249 | u.id, u.name, u.cross_project_id, u.email_addr, u.total_credit, u.expavg_credit, u.expavg_time |
1250 | 1250 | FROM {user} u |
1251 | 1251 | WHERE u.teamid = %d and u.total_credit > 0", |
1252 | 1252 | $boincteam_id |
1253 | - ); |
|
1254 | - db_set_active('default'); |
|
1253 | + ); |
|
1254 | + db_set_active('default'); |
|
1255 | 1255 | |
1256 | - $xml = array('users' => array()); |
|
1257 | - while ($member = db_fetch_object($result)) { |
|
1256 | + $xml = array('users' => array()); |
|
1257 | + while ($member = db_fetch_object($result)) { |
|
1258 | 1258 | $team_member = array( |
1259 | - 'id' => $member->id, |
|
1260 | - 'cpid' => md5($member->cross_project_id.$member->email_addr), |
|
1261 | - 'name' => htmlspecialchars($member->name), |
|
1262 | - 'total_credit' => round($member->total_credit), |
|
1263 | - 'expavg_credit' => round($member->expavg_credit), |
|
1264 | - 'expavg_time' => round($member->expavg_time), |
|
1259 | + 'id' => $member->id, |
|
1260 | + 'cpid' => md5($member->cross_project_id.$member->email_addr), |
|
1261 | + 'name' => htmlspecialchars($member->name), |
|
1262 | + 'total_credit' => round($member->total_credit), |
|
1263 | + 'expavg_credit' => round($member->expavg_credit), |
|
1264 | + 'expavg_time' => round($member->expavg_time), |
|
1265 | 1265 | ); |
1266 | 1266 | $xml['users']['user'][] = $team_member; |
1267 | - } |
|
1267 | + } |
|
1268 | 1268 | } |
1269 | 1269 | else { |
1270 | - // Query BOINC database user table |
|
1271 | - db_set_active('boinc_rw'); |
|
1272 | - $result = db_query(" |
|
1270 | + // Query BOINC database user table |
|
1271 | + db_set_active('boinc_rw'); |
|
1272 | + $result = db_query(" |
|
1273 | 1273 | SELECT |
1274 | 1274 | u.id, u.name, u.cross_project_id, u.create_time, u.email_addr, u.total_credit, u.expavg_credit, u.expavg_time |
1275 | 1275 | FROM {user} u |
1276 | 1276 | WHERE u.teamid = %d ORDER BY u.email_addr ASC", |
1277 | 1277 | $boincteam_id |
1278 | - ); |
|
1279 | - db_set_active('default'); |
|
1278 | + ); |
|
1279 | + db_set_active('default'); |
|
1280 | 1280 | |
1281 | - // Extract information from BOINC database for team members. |
|
1282 | - $team_members = array(); |
|
1283 | - while ($member = db_fetch_object($result)) { |
|
1281 | + // Extract information from BOINC database for team members. |
|
1282 | + $team_members = array(); |
|
1283 | + while ($member = db_fetch_object($result)) { |
|
1284 | 1284 | $team_members[$member->id] = array( |
1285 | - 'id' => $member->id, |
|
1286 | - 'cpid' => md5($member->cross_project_id.$member->email_addr), |
|
1287 | - 'create_time' => $member->create_time, |
|
1288 | - 'name' => htmlspecialchars($member->name), |
|
1289 | - 'country' => NULL, |
|
1290 | - 'total_credit' => round($member->total_credit), |
|
1291 | - 'expavg_credit' => round($member->expavg_credit), |
|
1292 | - 'expavg_time' => round($member->expavg_time), |
|
1293 | - 'url' => NULL, |
|
1294 | - 'has_profile' => 0, |
|
1285 | + 'id' => $member->id, |
|
1286 | + 'cpid' => md5($member->cross_project_id.$member->email_addr), |
|
1287 | + 'create_time' => $member->create_time, |
|
1288 | + 'name' => htmlspecialchars($member->name), |
|
1289 | + 'country' => NULL, |
|
1290 | + 'total_credit' => round($member->total_credit), |
|
1291 | + 'expavg_credit' => round($member->expavg_credit), |
|
1292 | + 'expavg_time' => round($member->expavg_time), |
|
1293 | + 'url' => NULL, |
|
1294 | + 'has_profile' => 0, |
|
1295 | 1295 | ); |
1296 | - } |
|
1296 | + } |
|
1297 | 1297 | |
1298 | - // Query Drupal database, multiple tables |
|
1299 | - $sql1 = " |
|
1298 | + // Query Drupal database, multiple tables |
|
1299 | + $sql1 = " |
|
1300 | 1300 | SELECT |
1301 | 1301 | bu.boinc_id, du.uid, du.name, n.nid, n.type, n.field_country_value, n.field_url_value |
1302 | 1302 | FROM {boincuser} AS bu |
@@ -1307,28 +1307,28 @@ discard block |
||
1307 | 1307 | INNER JOIN {content_type_profile} AS p ON node.nid=p.nid |
1308 | 1308 | WHERE node.type='profile' ) n ON du.uid=n.uid |
1309 | 1309 | WHERE bu.boinc_id IN (%s)"; |
1310 | - $member_id_list = implode(',', array_keys($team_members)); |
|
1311 | - if (!$member_id_list) { |
|
1310 | + $member_id_list = implode(',', array_keys($team_members)); |
|
1311 | + if (!$member_id_list) { |
|
1312 | 1312 | $member_id_list = '-1'; |
1313 | - } |
|
1314 | - $result = db_query($sql1, $member_id_list); |
|
1315 | - while ($member = db_fetch_object($result)) { |
|
1313 | + } |
|
1314 | + $result = db_query($sql1, $member_id_list); |
|
1315 | + while ($member = db_fetch_object($result)) { |
|
1316 | 1316 | $team_members[$member->boinc_id]['country'] = $member->field_country_value; |
1317 | 1317 | $team_members[$member->boinc_id]['url'] = $member->field_url_value; |
1318 | 1318 | $team_members[$member->boinc_id]['has_profile'] = isset($member->nid) ? 1: 0; |
1319 | 1319 | $xml['users']['user'][] = $team_members[$member->boinc_id]; |
1320 | - } |
|
1320 | + } |
|
1321 | 1321 | } // end if credit_only |
1322 | - } |
|
1323 | - else { |
|
1322 | + } |
|
1323 | + else { |
|
1324 | 1324 | $xml = array( |
1325 | - 'error' => array( |
|
1325 | + 'error' => array( |
|
1326 | 1326 | 'error_num' => -136, |
1327 | 1327 | 'error_msg' => 'Not found', |
1328 | - ), |
|
1328 | + ), |
|
1329 | 1329 | ); |
1330 | - } // end if boincteam_id |
|
1331 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1330 | + } // end if boincteam_id |
|
1331 | + print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | /** |
@@ -1336,114 +1336,114 @@ discard block |
||
1336 | 1336 | * Edit the forum preferences for a given user |
1337 | 1337 | */ |
1338 | 1338 | function boinccore_edit_forum_preferences() { |
1339 | - // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1340 | - // relevant -- use Drupal data only |
|
1339 | + // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1340 | + // relevant -- use Drupal data only |
|
1341 | 1341 | |
1342 | - $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : NULL); |
|
1342 | + $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : NULL); |
|
1343 | 1343 | |
1344 | - require_boinc('boinc_db'); |
|
1345 | - $boincuser = BoincUser::lookup_auth($account_key); |
|
1346 | - if ($boincuser) { |
|
1344 | + require_boinc('boinc_db'); |
|
1345 | + $boincuser = BoincUser::lookup_auth($account_key); |
|
1346 | + if ($boincuser) { |
|
1347 | 1347 | $uid = boincuser_lookup_uid($boincuser->id); |
1348 | 1348 | if ($uid AND $account = user_load($uid)) { |
1349 | - // Currently supported preferences |
|
1350 | - $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : NULL); |
|
1351 | - $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : NULL); |
|
1352 | - $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : NULL); |
|
1353 | - $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : NULL); |
|
1354 | - // Update preferences as needed |
|
1355 | - if ($avatar_url) { |
|
1349 | + // Currently supported preferences |
|
1350 | + $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : NULL); |
|
1351 | + $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : NULL); |
|
1352 | + $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : NULL); |
|
1353 | + $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : NULL); |
|
1354 | + // Update preferences as needed |
|
1355 | + if ($avatar_url) { |
|
1356 | 1356 | $avatar_image = file_get_contents($avatar_url); |
1357 | 1357 | if ($avatar_image) { |
1358 | - $image_dir = 'profiles'; |
|
1359 | - $image_path = "{$image_dir}/{$boincuser->id}_avatar.jpg"; |
|
1360 | - $file = file_save_data($avatar_image, $image_path, FILE_EXISTS_REPLACE); |
|
1361 | - if ($file) { |
|
1358 | + $image_dir = 'profiles'; |
|
1359 | + $image_path = "{$image_dir}/{$boincuser->id}_avatar.jpg"; |
|
1360 | + $file = file_save_data($avatar_image, $image_path, FILE_EXISTS_REPLACE); |
|
1361 | + if ($file) { |
|
1362 | 1362 | $profile = new stdClass(); |
1363 | 1363 | $profile->type = 'profile'; |
1364 | 1364 | $profile->language = NULL; |
1365 | 1365 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1366 | - $profile_node = node_load($profile_nid); |
|
1367 | - if ($profile_node) { |
|
1366 | + $profile_node = node_load($profile_nid); |
|
1367 | + if ($profile_node) { |
|
1368 | 1368 | $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
1369 | 1369 | if ($avatar_image) { |
1370 | - $profile_node->field_image[0] = $avatar_image; |
|
1371 | - node_save($profile_node); |
|
1370 | + $profile_node->field_image[0] = $avatar_image; |
|
1371 | + node_save($profile_node); |
|
1372 | 1372 | } |
1373 | 1373 | else { |
1374 | - $error = 'Error saving avatar to profile'; |
|
1374 | + $error = 'Error saving avatar to profile'; |
|
1375 | 1375 | } |
1376 | - } |
|
1377 | - else { |
|
1376 | + } |
|
1377 | + else { |
|
1378 | 1378 | $error = 'Unable to load user profile'; |
1379 | - } |
|
1379 | + } |
|
1380 | 1380 | } |
1381 | 1381 | else { |
1382 | - $error = 'User has no profile, so avatar could not be added'; |
|
1382 | + $error = 'User has no profile, so avatar could not be added'; |
|
1383 | + } |
|
1383 | 1384 | } |
1384 | - } |
|
1385 | - else { |
|
1385 | + else { |
|
1386 | 1386 | $error = 'Unable to save remote image'; |
1387 | - } |
|
1387 | + } |
|
1388 | 1388 | } |
1389 | 1389 | else { |
1390 | - $error = 'Could not find avatar image at URL'; |
|
1390 | + $error = 'Could not find avatar image at URL'; |
|
1391 | 1391 | } |
1392 | - } |
|
1393 | - if ($hide_signatures !== NULL) { |
|
1392 | + } |
|
1393 | + if ($hide_signatures !== NULL) { |
|
1394 | 1394 | user_save($account, array('hide_signatures' => ($hide_signatures ? 1 : 0))); |
1395 | - } |
|
1396 | - if ($signature !== NULL) { |
|
1395 | + } |
|
1396 | + if ($signature !== NULL) { |
|
1397 | 1397 | $signature = check_markup($signature); |
1398 | 1398 | user_save($account, array('signature' => $signature)); |
1399 | - } |
|
1400 | - if ($post_order) { |
|
1399 | + } |
|
1400 | + if ($post_order) { |
|
1401 | 1401 | require_boinc('forum'); |
1402 | 1402 | $post_order_map = array( |
1403 | - CREATE_TIME_OLD => 2, |
|
1404 | - CREATE_TIME_NEW => 1, |
|
1403 | + CREATE_TIME_OLD => 2, |
|
1404 | + CREATE_TIME_NEW => 1, |
|
1405 | 1405 | ); |
1406 | 1406 | $drupal_post_order = isset($post_order_map[$post_order]) ? $post_order_map[$post_order] : 2; |
1407 | 1407 | user_save($account, array('sort' => $drupal_post_order)); |
1408 | - } |
|
1409 | - if (!$error) { |
|
1408 | + } |
|
1409 | + if (!$error) { |
|
1410 | 1410 | // Success |
1411 | 1411 | $xml = array( |
1412 | - 'edit_forum_preferences' => array( |
|
1412 | + 'edit_forum_preferences' => array( |
|
1413 | 1413 | 'success' => NULL, |
1414 | - ), |
|
1414 | + ), |
|
1415 | 1415 | ); |
1416 | - } |
|
1417 | - else { |
|
1416 | + } |
|
1417 | + else { |
|
1418 | 1418 | // Failure |
1419 | 1419 | $xml = array( |
1420 | - 'error' => array( |
|
1420 | + 'error' => array( |
|
1421 | 1421 | 'error_num' => -1, |
1422 | 1422 | 'error_msg' => $error, |
1423 | - ), |
|
1423 | + ), |
|
1424 | 1424 | ); |
1425 | - } |
|
1425 | + } |
|
1426 | 1426 | } |
1427 | 1427 | else { |
1428 | - // Drupal user not found |
|
1429 | - $xml = array( |
|
1428 | + // Drupal user not found |
|
1429 | + $xml = array( |
|
1430 | 1430 | 'error' => array( |
1431 | - 'error_num' => -1, |
|
1432 | - 'error_msg' => 'Unknown error', |
|
1431 | + 'error_num' => -1, |
|
1432 | + 'error_msg' => 'Unknown error', |
|
1433 | 1433 | ), |
1434 | - ); |
|
1434 | + ); |
|
1435 | 1435 | } |
1436 | - } |
|
1437 | - else { |
|
1436 | + } |
|
1437 | + else { |
|
1438 | 1438 | // BOINC user not found |
1439 | 1439 | $xml = array( |
1440 | - 'error' => array( |
|
1440 | + 'error' => array( |
|
1441 | 1441 | 'error_num' => -136, |
1442 | 1442 | 'error_msg' => 'Not found', |
1443 | - ), |
|
1443 | + ), |
|
1444 | 1444 | ); |
1445 | - } |
|
1446 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1445 | + } |
|
1446 | + print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | /** |
@@ -1451,14 +1451,14 @@ discard block |
||
1451 | 1451 | * Get the last comments OR threads made by a given user |
1452 | 1452 | */ |
1453 | 1453 | function boinccore_forum_get_data() { |
1454 | - // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1455 | - // relevant -- use Drupal data only |
|
1454 | + // Do not pass through to BOINC in this case as BOINC forums are no longer |
|
1455 | + // relevant -- use Drupal data only |
|
1456 | 1456 | |
1457 | - $xml = array(); |
|
1458 | - $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : NULL); |
|
1459 | - $uid = boincuser_lookup_uid($boinc_id); |
|
1457 | + $xml = array(); |
|
1458 | + $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : NULL); |
|
1459 | + $uid = boincuser_lookup_uid($boinc_id); |
|
1460 | 1460 | |
1461 | - if ($uid) { |
|
1461 | + if ($uid) { |
|
1462 | 1462 | $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : NULL); |
1463 | 1463 | $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : NULL); |
1464 | 1464 | if (!$count) $count = 10; |
@@ -1466,7 +1466,7 @@ discard block |
||
1466 | 1466 | switch ($method) { |
1467 | 1467 | case 'user_posts': |
1468 | 1468 | $content_length = !empty($_POST['content_length']) ? $_POST['content_length'] : (!empty($_GET['content_length']) ? $_GET['content_length'] : NULL); |
1469 | - $posts = db_query(" |
|
1469 | + $posts = db_query(" |
|
1470 | 1470 | SELECT |
1471 | 1471 | c.cid, |
1472 | 1472 | n.nid, |
@@ -1480,26 +1480,26 @@ discard block |
||
1480 | 1480 | ORDER BY timestamp DESC |
1481 | 1481 | LIMIT %d", |
1482 | 1482 | $uid, (int) $count |
1483 | - ); |
|
1484 | - $xml = array( |
|
1483 | + ); |
|
1484 | + $xml = array( |
|
1485 | 1485 | 'rpc_response' => array( |
1486 | - 'count' => 0, |
|
1487 | - 'posts' => array(), |
|
1486 | + 'count' => 0, |
|
1487 | + 'posts' => array(), |
|
1488 | 1488 | ), |
1489 | - ); |
|
1490 | - $post_count = 0; |
|
1491 | - while ($post = db_fetch_object($posts)) { |
|
1489 | + ); |
|
1490 | + $post_count = 0; |
|
1491 | + while ($post = db_fetch_object($posts)) { |
|
1492 | 1492 | $xml['rpc_response']['posts']['post'][] = array( |
1493 | - 'id' => $post->cid, |
|
1494 | - 'threadid' => $post->nid, |
|
1495 | - 'threadtitle' => $post->title, |
|
1496 | - 'timestamp' => $post->timestamp, |
|
1497 | - 'content' => ($content_length ? substr($post->comment, 0, $content_length) : $post->comment), |
|
1493 | + 'id' => $post->cid, |
|
1494 | + 'threadid' => $post->nid, |
|
1495 | + 'threadtitle' => $post->title, |
|
1496 | + 'timestamp' => $post->timestamp, |
|
1497 | + 'content' => ($content_length ? substr($post->comment, 0, $content_length) : $post->comment), |
|
1498 | 1498 | ); |
1499 | 1499 | $post_count++; |
1500 | - } |
|
1501 | - $xml['rpc_response']['count'] = $post_count; |
|
1502 | - break; |
|
1500 | + } |
|
1501 | + $xml['rpc_response']['count'] = $post_count; |
|
1502 | + break; |
|
1503 | 1503 | |
1504 | 1504 | case 'user_threads': |
1505 | 1505 | $threads = db_query(" |
@@ -1523,45 +1523,45 @@ discard block |
||
1523 | 1523 | ORDER BY changed DESC |
1524 | 1524 | LIMIT %d", |
1525 | 1525 | $uid, (int) $count |
1526 | - ); |
|
1527 | - $xml = array( |
|
1526 | + ); |
|
1527 | + $xml = array( |
|
1528 | 1528 | 'rpc_response' => array( |
1529 | - 'count' => 0, |
|
1530 | - 'threads' => array(), |
|
1529 | + 'count' => 0, |
|
1530 | + 'threads' => array(), |
|
1531 | 1531 | ), |
1532 | - ); |
|
1533 | - $thread_count = 0; |
|
1534 | - while ($thread = db_fetch_object($threads)) { |
|
1532 | + ); |
|
1533 | + $thread_count = 0; |
|
1534 | + while ($thread = db_fetch_object($threads)) { |
|
1535 | 1535 | $xml['rpc_response']['threads']['thread'][] = array( |
1536 | - 'id' => $thread->nid, |
|
1537 | - 'forumid' => $thread->tid, |
|
1538 | - 'replies' => $thread->replies, |
|
1539 | - 'views' => $thread->views, |
|
1540 | - 'timestamp' => $thread->changed, |
|
1541 | - 'title' => $thread->title, |
|
1536 | + 'id' => $thread->nid, |
|
1537 | + 'forumid' => $thread->tid, |
|
1538 | + 'replies' => $thread->replies, |
|
1539 | + 'views' => $thread->views, |
|
1540 | + 'timestamp' => $thread->changed, |
|
1541 | + 'title' => $thread->title, |
|
1542 | 1542 | ); |
1543 | 1543 | $thread_count++; |
1544 | - } |
|
1545 | - $xml['rpc_response']['count'] = $thread_count; |
|
1546 | - break; |
|
1544 | + } |
|
1545 | + $xml['rpc_response']['count'] = $thread_count; |
|
1546 | + break; |
|
1547 | 1547 | default: |
1548 | 1548 | $xml = array( |
1549 | 1549 | 'error' => array( |
1550 | - 'error_num' => -1, |
|
1551 | - 'error_msg' => 'Unknown error', |
|
1550 | + 'error_num' => -1, |
|
1551 | + 'error_msg' => 'Unknown error', |
|
1552 | 1552 | ), |
1553 | - ); |
|
1553 | + ); |
|
1554 | 1554 | } |
1555 | - } |
|
1556 | - else { |
|
1555 | + } |
|
1556 | + else { |
|
1557 | 1557 | $xml = array( |
1558 | - 'error' => array( |
|
1558 | + 'error' => array( |
|
1559 | 1559 | 'error_num' => -136, |
1560 | 1560 | 'error_msg' => 'Not found', |
1561 | - ), |
|
1561 | + ), |
|
1562 | 1562 | ); |
1563 | - } |
|
1564 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1563 | + } |
|
1564 | + print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1565 | 1565 | } |
1566 | 1566 | |
1567 | 1567 | /** |
@@ -1569,9 +1569,9 @@ discard block |
||
1569 | 1569 | * Get information on applications in the system |
1570 | 1570 | */ |
1571 | 1571 | function boinccore_apps() { |
1572 | - // Remove q from the GET request or BOINC will panic |
|
1573 | - unset($_GET['q']); |
|
1574 | - include_boinc('user/apps.php'); |
|
1572 | + // Remove q from the GET request or BOINC will panic |
|
1573 | + unset($_GET['q']); |
|
1574 | + include_boinc('user/apps.php'); |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | 1577 | /** |
@@ -1581,147 +1581,147 @@ discard block |
||
1581 | 1581 | * controller function, which can compute the page based on the user's settings |
1582 | 1582 | */ |
1583 | 1583 | function boinccore_url_pagination_handler($type, $object_id = NULL) { |
1584 | - global $user; |
|
1585 | - $path = NULL; |
|
1586 | - $params = array(); |
|
1587 | - switch ($type) { |
|
1588 | - case 'boinc-forum': |
|
1584 | + global $user; |
|
1585 | + $path = NULL; |
|
1586 | + $params = array(); |
|
1587 | + switch ($type) { |
|
1588 | + case 'boinc-forum': |
|
1589 | 1589 | // Redirect requests to a BOINC forum to the Drupal forum |
1590 | 1590 | $forum_id = db_result(db_query(' |
1591 | 1591 | SELECT tid |
1592 | 1592 | FROM {boincimport_temp_forum} |
1593 | 1593 | WHERE forum_id = %d', |
1594 | - $object_id |
|
1594 | + $object_id |
|
1595 | 1595 | )); |
1596 | 1596 | if ($forum_id) { |
1597 | - drupal_goto("community/forum/{$forum_id}"); |
|
1597 | + drupal_goto("community/forum/{$forum_id}"); |
|
1598 | 1598 | } |
1599 | 1599 | break; |
1600 | - case 'boinc-forum-index': |
|
1600 | + case 'boinc-forum-index': |
|
1601 | 1601 | // Redirect requests to the top level BOINC forum to Drupal forums |
1602 | 1602 | drupal_goto("community/forum"); |
1603 | 1603 | break; |
1604 | - case 'boinc-forum-post': |
|
1604 | + case 'boinc-forum-post': |
|
1605 | 1605 | // Redirect requests to a BOINC forum post to the Drupal comment |
1606 | 1606 | $cid = db_result(db_query(' |
1607 | 1607 | SELECT cid |
1608 | 1608 | FROM {boincimport_temp_post} |
1609 | 1609 | WHERE post_id = %d', |
1610 | - $object_id |
|
1610 | + $object_id |
|
1611 | 1611 | )); |
1612 | 1612 | if ($cid) { |
1613 | - drupal_goto("goto/comment/{$cid}"); |
|
1613 | + drupal_goto("goto/comment/{$cid}"); |
|
1614 | 1614 | } |
1615 | 1615 | break; |
1616 | - case 'boinc-forum-topic': |
|
1616 | + case 'boinc-forum-topic': |
|
1617 | 1617 | // Redirect requests to a BOINC forum topic to the Drupal node |
1618 | 1618 | $nid = db_result(db_query(' |
1619 | 1619 | SELECT nid |
1620 | 1620 | FROM {boincimport_temp_topic} |
1621 | 1621 | WHERE topic_id = %d', |
1622 | - $object_id |
|
1622 | + $object_id |
|
1623 | 1623 | )); |
1624 | 1624 | if ($nid) { |
1625 | - drupal_goto("node/{$nid}"); |
|
1625 | + drupal_goto("node/{$nid}"); |
|
1626 | 1626 | } |
1627 | 1627 | break; |
1628 | - case 'boinc-host': |
|
1628 | + case 'boinc-host': |
|
1629 | 1629 | // Redirect requests to BOINC host details to the host page in Drupal |
1630 | 1630 | drupal_goto("host/{$object_id}"); |
1631 | 1631 | break; |
1632 | - case 'boinc-hosts-user': |
|
1632 | + case 'boinc-hosts-user': |
|
1633 | 1633 | // Redirect requests to a BOINC user host list to the host list in Drupal |
1634 | 1634 | $uid = boincuser_lookup_uid($object_id); |
1635 | 1635 | if ($uid) { |
1636 | - drupal_goto("account/{$uid}/computers"); |
|
1636 | + drupal_goto("account/{$uid}/computers"); |
|
1637 | 1637 | } |
1638 | 1638 | break; |
1639 | - case 'boinc-result': |
|
1639 | + case 'boinc-result': |
|
1640 | 1640 | // Redirect requests to BOINC task details to the task page in Drupal |
1641 | 1641 | drupal_goto("task/{$object_id}"); |
1642 | - case 'boinc-results-host': |
|
1642 | + case 'boinc-results-host': |
|
1643 | 1643 | // Redirect requests to BOINC tasks by host to the host task page in Drupal |
1644 | 1644 | drupal_goto("host/{$object_id}/tasks"); |
1645 | 1645 | break; |
1646 | - case 'boinc-results-user': |
|
1646 | + case 'boinc-results-user': |
|
1647 | 1647 | // Redirect requests to a BOINC user's tasks to the Drupal account tasks |
1648 | 1648 | drupal_goto("account/tasks"); |
1649 | 1649 | break; |
1650 | - case 'boinc-user': |
|
1650 | + case 'boinc-user': |
|
1651 | 1651 | // Redirect requests to a BOINC user ID to the Drupal profile |
1652 | 1652 | $uid = boincuser_lookup_uid($object_id); |
1653 | 1653 | if ($uid) { |
1654 | - drupal_goto("account/{$uid}"); |
|
1654 | + drupal_goto("account/{$uid}"); |
|
1655 | 1655 | } |
1656 | 1656 | break; |
1657 | - case 'boinc-workunit': |
|
1657 | + case 'boinc-workunit': |
|
1658 | 1658 | // Redirect requests to BOINC workunits to the workunit page in Drupal |
1659 | 1659 | drupal_goto("workunit/{$object_id}"); |
1660 | 1660 | break; |
1661 | - case 'comment': |
|
1661 | + case 'comment': |
|
1662 | 1662 | $object = _comment_load($object_id); |
1663 | 1663 | if ($object) { |
1664 | - $path = "node/{$object->nid}"; |
|
1665 | - // Get the sort order |
|
1666 | - $gt_lt = '<'; |
|
1667 | - $comment_order = (isset($user->sort)) ? $user->sort : variable_get('comment_default_order_forum', 2); |
|
1668 | - if ($comment_order == COMMENT_ORDER_NEWEST_FIRST) { |
|
1664 | + $path = "node/{$object->nid}"; |
|
1665 | + // Get the sort order |
|
1666 | + $gt_lt = '<'; |
|
1667 | + $comment_order = (isset($user->sort)) ? $user->sort : variable_get('comment_default_order_forum', 2); |
|
1668 | + if ($comment_order == COMMENT_ORDER_NEWEST_FIRST) { |
|
1669 | 1669 | $gt_lt = '>'; |
1670 | - } |
|
1671 | - // don't filter hidden comments for admins/mods |
|
1672 | - $include_hidden = ''; |
|
1673 | - if (in_array('administrator', array_values($user->roles)) || |
|
1670 | + } |
|
1671 | + // don't filter hidden comments for admins/mods |
|
1672 | + $include_hidden = ''; |
|
1673 | + if (in_array('administrator', array_values($user->roles)) || |
|
1674 | 1674 | in_array('moderator', array_values($user->roles))) { |
1675 | 1675 | $include_hidden = 'OR status = 1'; |
1676 | - } |
|
1677 | - // See how many comments there are before (or after) this comment... |
|
1678 | - $comment_offset = db_result(db_query(' |
|
1676 | + } |
|
1677 | + // See how many comments there are before (or after) this comment... |
|
1678 | + $comment_offset = db_result(db_query(' |
|
1679 | 1679 | SELECT COUNT(*) FROM {comments} |
1680 | 1680 | WHERE nid = %d AND (status = 0 %s) AND timestamp %s %d', |
1681 | 1681 | $object->nid, $include_hidden, $gt_lt, $object->timestamp)); |
1682 | - if ($comment_offset) { |
|
1682 | + if ($comment_offset) { |
|
1683 | 1683 | // Get the number of comments per page |
1684 | 1684 | if ($user->comments_per_page) { |
1685 | - $comments_per_page = $user->comments_per_page; |
|
1685 | + $comments_per_page = $user->comments_per_page; |
|
1686 | 1686 | } |
1687 | 1687 | else { |
1688 | - $node = node_load($object->nid); |
|
1689 | - $comments_per_page = variable_get( |
|
1688 | + $node = node_load($object->nid); |
|
1689 | + $comments_per_page = variable_get( |
|
1690 | 1690 | "comment_default_per_page_{$node->type}", 50 |
1691 | - ); |
|
1691 | + ); |
|
1692 | 1692 | } |
1693 | 1693 | // Determine which page to display in order to show the given comment |
1694 | 1694 | $page = floor($comment_offset / $comments_per_page); |
1695 | 1695 | if ($page) { |
1696 | - $params = array('page' => $page); |
|
1696 | + $params = array('page' => $page); |
|
1697 | + } |
|
1697 | 1698 | } |
1698 | - } |
|
1699 | 1699 | } |
1700 | 1700 | if ($path) { |
1701 | - drupal_goto($path, $params, "comment-{$object->cid}"); |
|
1701 | + drupal_goto($path, $params, "comment-{$object->cid}"); |
|
1702 | 1702 | } |
1703 | 1703 | break; |
1704 | - case 'friend-requests': |
|
1704 | + case 'friend-requests': |
|
1705 | 1705 | // Check for a login, then redirect to the user's friend requests page |
1706 | 1706 | if ($user->uid) { |
1707 | - drupal_goto("account/{$user->uid}/friends/pending"); |
|
1707 | + drupal_goto("account/{$user->uid}/friends/pending"); |
|
1708 | 1708 | } |
1709 | 1709 | else { |
1710 | - drupal_goto('user/login', array( |
|
1710 | + drupal_goto('user/login', array( |
|
1711 | 1711 | 'destination' => 'goto/friend-requests' |
1712 | - )); |
|
1712 | + )); |
|
1713 | 1713 | } |
1714 | 1714 | break; |
1715 | - default: |
|
1715 | + default: |
|
1716 | 1716 | } |
1717 | - drupal_not_found(); |
|
1717 | + drupal_not_found(); |
|
1718 | 1718 | } |
1719 | 1719 | |
1720 | 1720 | /* |
1721 | 1721 | * Fetch an array of all countries |
1722 | 1722 | */ |
1723 | 1723 | function boinccore_get_country_list() { |
1724 | - return array( |
|
1724 | + return array( |
|
1725 | 1725 | 'None' => 'None', |
1726 | 1726 | 'International' => 'International', |
1727 | 1727 | 'Afghanistan' => 'Afghanistan', |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | 'Yemen' => 'Yemen', |
1956 | 1956 | 'Zambia' => 'Zambia', |
1957 | 1957 | 'Zimbabwe' => 'Zimbabwe', |
1958 | - ); |
|
1958 | + ); |
|
1959 | 1959 | } |
1960 | 1960 | |
1961 | 1961 | |
@@ -1967,46 +1967,46 @@ discard block |
||
1967 | 1967 | * Action: Mark node for moderation |
1968 | 1968 | */ |
1969 | 1969 | function boinccore_rules_action_mark_content_for_moderation($node) { |
1970 | - $node->moderate = 1; |
|
1971 | - return array('node' => $node); |
|
1970 | + $node->moderate = 1; |
|
1971 | + return array('node' => $node); |
|
1972 | 1972 | } |
1973 | 1973 | |
1974 | 1974 | /** |
1975 | 1975 | * Action: Send mail to moderators. |
1976 | 1976 | */ |
1977 | 1977 | function boinccore_rules_action_mail_to_moderators($settings) { |
1978 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
1979 | - $mailing_list = variable_get('boinc_moderator_mailing_list', ''); |
|
1980 | - $force_individual_notifications = variable_get('boinc_moderator_force_individual_notifications', 0); |
|
1978 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
1979 | + $mailing_list = variable_get('boinc_moderator_mailing_list', ''); |
|
1980 | + $force_individual_notifications = variable_get('boinc_moderator_force_individual_notifications', 0); |
|
1981 | 1981 | |
1982 | - if (!$mailing_list OR $force_individual_notifications) { |
|
1982 | + if (!$mailing_list OR $force_individual_notifications) { |
|
1983 | 1983 | // Send individual emails to all moderators |
1984 | 1984 | $roles = user_roles(); |
1985 | 1985 | $moderator_rid = array_search('moderator', $roles); |
1986 | 1986 | if ($moderator_rid !== FALSE) { |
1987 | - $settings['recipients'] = array($moderator_rid); |
|
1988 | - rules_action_mail_to_users_of_role($settings); |
|
1987 | + $settings['recipients'] = array($moderator_rid); |
|
1988 | + rules_action_mail_to_users_of_role($settings); |
|
1989 | 1989 | } |
1990 | 1990 | else { |
1991 | - watchdog( |
|
1991 | + watchdog( |
|
1992 | 1992 | 'boinccore', |
1993 | 1993 | 'Unable to identify members of the moderator role to send moderator notifications!', |
1994 | 1994 | array(), |
1995 | 1995 | WATCHDOG_ERROR |
1996 | - ); |
|
1996 | + ); |
|
1997 | 1997 | } |
1998 | - } |
|
1999 | - if ($mailing_list) { |
|
1998 | + } |
|
1999 | + if ($mailing_list) { |
|
2000 | 2000 | $settings['to'] = $mailing_list; |
2001 | 2001 | rules_action_mail($settings); |
2002 | - } |
|
2002 | + } |
|
2003 | 2003 | } |
2004 | 2004 | /** |
2005 | 2005 | * Action "Send mail to moderators" configuration form |
2006 | 2006 | */ |
2007 | 2007 | function boinccore_rules_action_mail_to_moderators_form($settings = array(), &$form) { |
2008 | - // Select only non-anonymous user roles because anonymous users won't have emails. |
|
2009 | - rules_action_mail_to_user_form($settings, $form); |
|
2008 | + // Select only non-anonymous user roles because anonymous users won't have emails. |
|
2009 | + rules_action_mail_to_user_form($settings, $form); |
|
2010 | 2010 | } |
2011 | 2011 | |
2012 | 2012 | |
@@ -2014,27 +2014,27 @@ discard block |
||
2014 | 2014 | * Action: Send mail to admins. |
2015 | 2015 | */ |
2016 | 2016 | function boinccore_rules_action_mail_to_admins($settings) { |
2017 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
2018 | - $mailing_list = variable_get('boinc_admin_mailing_list', ''); |
|
2019 | - if (empty($mailing_list)) { |
|
2017 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
2018 | + $mailing_list = variable_get('boinc_admin_mailing_list', ''); |
|
2019 | + if (empty($mailing_list)) { |
|
2020 | 2020 | $mailing_list = variable_get('site_mail', ''); |
2021 | 2021 | if (empty($mailing_list)) { |
2022 | - watchdog('boinccore', |
|
2022 | + watchdog('boinccore', |
|
2023 | 2023 | 'Attempting to email administrators, but there is no admin email list or site email to send to.', array(), |
2024 | 2024 | WATCHDOG_ERROR |
2025 | - ); |
|
2026 | - return FALSE; |
|
2025 | + ); |
|
2026 | + return FALSE; |
|
2027 | 2027 | } |
2028 | - } |
|
2029 | - $settings['to'] = $mailing_list; |
|
2030 | - rules_action_mail($settings); |
|
2028 | + } |
|
2029 | + $settings['to'] = $mailing_list; |
|
2030 | + rules_action_mail($settings); |
|
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | /** |
2034 | 2034 | * Action "Send mail to admins" configuration form |
2035 | 2035 | */ |
2036 | 2036 | function boinccore_rules_action_mail_to_admins_form($settings = array(), &$form) { |
2037 | - rules_action_mail_to_user_form($settings, $form); |
|
2037 | + rules_action_mail_to_user_form($settings, $form); |
|
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -2045,33 +2045,33 @@ discard block |
||
2045 | 2045 | * BOINC wrapper for string translation |
2046 | 2046 | */ |
2047 | 2047 | function bts($string, $args = array(), $langcode = NULL, $context = 'boinc: ', $update = TRUE) { |
2048 | - if (function_exists('i18nstrings_ts')) { |
|
2048 | + if (function_exists('i18nstrings_ts')) { |
|
2049 | 2049 | $string = i18nstrings_ts($context, $string, $langcode, $update); |
2050 | - } |
|
2051 | - if (empty($args)) { |
|
2050 | + } |
|
2051 | + if (empty($args)) { |
|
2052 | 2052 | return $string; |
2053 | - } |
|
2054 | - else { |
|
2053 | + } |
|
2054 | + else { |
|
2055 | 2055 | // Transform arguments before inserting them. |
2056 | 2056 | foreach ($args as $key => $value) { |
2057 | - switch ($key [0]) { |
|
2057 | + switch ($key [0]) { |
|
2058 | 2058 | case '@': |
2059 | 2059 | // Escaped only. |
2060 | 2060 | $args [$key] = check_plain($value); |
2061 | - break; |
|
2061 | + break; |
|
2062 | 2062 | |
2063 | 2063 | case '%': |
2064 | 2064 | default: |
2065 | 2065 | // Escaped and placeholder. |
2066 | 2066 | $args [$key] = theme('placeholder', $value); |
2067 | - break; |
|
2067 | + break; |
|
2068 | 2068 | |
2069 | 2069 | case '!': |
2070 | 2070 | // Pass-through. |
2071 | 2071 | } |
2072 | 2072 | } |
2073 | 2073 | return strtr($string, $args); |
2074 | - } |
|
2074 | + } |
|
2075 | 2075 | } |
2076 | 2076 | |
2077 | 2077 | |
@@ -2083,9 +2083,9 @@ discard block |
||
2083 | 2083 | * Overview of moderation queues |
2084 | 2084 | */ |
2085 | 2085 | function boinccore_moderation_overview_panel() { |
2086 | - $output = '<h2 class="pane-title">' . bts('Moderation', array(), NULL, 'boinc:moderate-profiles') . '</h2>'; |
|
2087 | - $output .= '<ul class="tab-list action-list">'; |
|
2088 | - if (module_exists('user_profiles')) { |
|
2086 | + $output = '<h2 class="pane-title">' . bts('Moderation', array(), NULL, 'boinc:moderate-profiles') . '</h2>'; |
|
2087 | + $output .= '<ul class="tab-list action-list">'; |
|
2088 | + if (module_exists('user_profiles')) { |
|
2089 | 2089 | $profile_count = db_result(db_query(" |
2090 | 2090 | SELECT COUNT(DISTINCT(n.nid)) |
2091 | 2091 | FROM {node} n |
@@ -2097,9 +2097,9 @@ discard block |
||
2097 | 2097 | $output .= '<span class="item-count">' . $profile_count . '</span>'; |
2098 | 2098 | $output .= '</div>'; |
2099 | 2099 | $output .= '</li>'; |
2100 | - } |
|
2101 | - $output .= '</ul>'; |
|
2102 | - return $output; |
|
2100 | + } |
|
2101 | + $output .= '</ul>'; |
|
2102 | + return $output; |
|
2103 | 2103 | } |
2104 | 2104 | |
2105 | 2105 | |
@@ -2109,10 +2109,10 @@ discard block |
||
2109 | 2109 | * |
2110 | 2110 | */ |
2111 | 2111 | function _boinccore_delete_expired_tokens() { |
2112 | - require_boinc('boinc_db'); |
|
2112 | + require_boinc('boinc_db'); |
|
2113 | 2113 | |
2114 | - $num_deleted = BoincToken::delete_expired(); |
|
2115 | - if ($num_deleted>0) { |
|
2114 | + $num_deleted = BoincToken::delete_expired(); |
|
2115 | + if ($num_deleted>0) { |
|
2116 | 2116 | watchdog('boinccore', "Deleted ${num_deleted} tokens from table token", WATCHDOG_NOTICE); |
2117 | - } |
|
2117 | + } |
|
2118 | 2118 | } |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | // RFC2616 mandates that the decimal part is no more than three digits, |
312 | 312 | // so we multiply the qvalue by 1000 to avoid floating point comparisons. |
313 | 313 | $langcode = strtolower($match[1]); |
314 | - $qvalue = isset($match[2]) ? (float) $match[2] : 1; |
|
315 | - $browser_langcodes[$langcode] = (int) ($qvalue * 1000); |
|
314 | + $qvalue = isset($match[2]) ? (float)$match[2] : 1; |
|
315 | + $browser_langcodes[$langcode] = (int)($qvalue*1000); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | global $base_url; |
378 | 378 | global $base_path; |
379 | 379 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
380 | - $site_url = $base_url . $base_path; |
|
380 | + $site_url = $base_url.$base_path; |
|
381 | 381 | $settings = array( |
382 | 382 | 'from' => '', |
383 | 383 | 'subject' => "Content at {$site_name} is awaiting moderation", |
@@ -437,11 +437,11 @@ discard block |
||
437 | 437 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
438 | 438 | } |
439 | 439 | elseif (is_string($user_image)) { |
440 | - $user_info .= '<img src="' . $user_image . '"/>'; |
|
440 | + $user_info .= '<img src="'.$user_image.'"/>'; |
|
441 | 441 | } |
442 | 442 | $user_info .= ' </div>'; |
443 | 443 | } |
444 | - $user_info .= ' <div class="name">' . theme('username', $account) . '</div>'; |
|
444 | + $user_info .= ' <div class="name">'.theme('username', $account).'</div>'; |
|
445 | 445 | if ($account->uid) { |
446 | 446 | //$user_info .= ' <div class="join-date">Joined: ' . date('j M y', $account->created) . '</div>'; |
447 | 447 | //$user_info .= ' <div class="post-count">Posts: ' . $account->post_count . '</div>'; |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $form['buttons']['preview']['#suffix'] = '</li>'; |
506 | 506 | $form['buttons']['preview']['#weight'] = 1003; |
507 | 507 | $form['buttons']['cancel'] = array( |
508 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url) . '</li>', |
|
508 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url).'</li>', |
|
509 | 509 | '#weight' => 1004, |
510 | 510 | ); |
511 | 511 | $form['buttons']['form control tabs suffix'] = array( |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $node = node_load($form['nid']['#value']); |
526 | 526 | $community_role = array_search('community member', user_roles(true)); |
527 | 527 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
528 | - if ( (isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role])) ) { |
|
528 | + if ((isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role]))) { |
|
529 | 529 | if ($node->type == 'forum') { |
530 | 530 | if (module_exists('captcha')) { |
531 | 531 | $form['comment_captcha'] = array( |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
571 | 571 | $form['buttons']['preview_changes']['#weight'] = 1004; |
572 | 572 | $form['buttons']['cancel'] = array( |
573 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}") . '</li>', |
|
573 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}").'</li>', |
|
574 | 574 | '#weight' => 1005, |
575 | 575 | ); |
576 | 576 | $form['buttons']['form control tabs suffix'] = array( |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | // Add captcha for role='community member' |
582 | 582 | $community_role = array_search('community member', user_roles(true)); |
583 | 583 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
584 | - if ( (isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role])) ) { |
|
584 | + if ((isset($account->roles[$community_role])) and (!isset($account->roles[$unrestricted_role]))) { |
|
585 | 585 | if (module_exists('captcha')) { |
586 | 586 | $form['comment_captcha'] = array( |
587 | 587 | '#type' => 'captcha', |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | function boinccore_link($type, $object, $teaser = FALSE) { |
674 | 674 | // Add custom links with this hook |
675 | 675 | |
676 | - if ($type=='node') { |
|
677 | - if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
|
676 | + if ($type == 'node') { |
|
677 | + if (($object->type == 'forum') OR ($object->type == 'team_forum')) { |
|
678 | 678 | // Add topic moderator controls |
679 | 679 | if (user_access('edit any forum topic')) { |
680 | 680 | $node_control = "node_control/{$object->nid}"; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | }// if user_access('edit any forum topic') |
736 | 736 | } |
737 | 737 | } |
738 | - else if ($type=='comment') { |
|
738 | + else if ($type == 'comment') { |
|
739 | 739 | $node = node_load($object->nid); |
740 | 740 | $nid = $object->nid; |
741 | 741 | $cid = $object->cid; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | if (user_access('administer comments')) { |
758 | 758 | $comment_control = "comment_control/{$cid}"; |
759 | 759 | // Add link to convert comment into a new topic |
760 | - $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
|
760 | + $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid)); |
|
761 | 761 | if ($reply_count == 0) { |
762 | 762 | $links['convert'] = array( |
763 | 763 | 'title' => bts('Convert', array(), NULL, 'boinc:forum-convert-comment-to-topic'), |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | */ |
803 | 803 | $message['headers']['Content-Transfer-Encoding'] = 'Quoted-Printable'; |
804 | 804 | if (is_array($message['body'])) { |
805 | - $message['body'] = array_map( "quoted_printable_encode", $message['body'] ); |
|
805 | + $message['body'] = array_map("quoted_printable_encode", $message['body']); |
|
806 | 806 | } else { |
807 | 807 | $message['body'] = quoted_printable_encode($message['body']); |
808 | 808 | } |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | // If hiding a forum topic (node) and not an administrator, go to |
854 | 854 | // the forum page. Otherwise the user will reach an access-denied |
855 | 855 | // page. |
856 | - if (($action=="hide") and (!user_access('administer forums'))) { |
|
856 | + if (($action == "hide") and (!user_access('administer forums'))) { |
|
857 | 857 | drupal_goto("community/forum/{$node->tid}"); |
858 | 858 | } |
859 | 859 | drupal_goto("node/{$nid}"); |
@@ -895,8 +895,8 @@ discard block |
||
895 | 895 | $node->created = $comment->timestamp; |
896 | 896 | $node->changed = $node->created; |
897 | 897 | $node->promote = 0; // Display on front page? |
898 | - $node->sticky = 0; // Display top of page? |
|
899 | - $node->status = 1; // Published? |
|
898 | + $node->sticky = 0; // Display top of page? |
|
899 | + $node->status = 1; // Published? |
|
900 | 900 | $node->comment = 2; |
901 | 901 | //$node->language = 'en'; |
902 | 902 | $node->uid = $comment->uid; |
@@ -981,16 +981,16 @@ discard block |
||
981 | 981 | $xml->loadXML($global_prefs, LIBXML_NOBLANKS); |
982 | 982 | if ($errors = libxml_get_errors($xml)) { |
983 | 983 | $lines = explode("\r", $global_prefs); |
984 | - watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
985 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
984 | + watchdog('am_set_info', "XML validation error in global_prefs: {$errors[0]->message} at line {$errors[0]->line}". |
|
985 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
986 | 986 | } |
987 | 987 | } |
988 | 988 | elseif ($project_prefs) { |
989 | 989 | $xml->loadXML($project_prefs, LIBXML_NOBLANKS); |
990 | 990 | if ($errors = libxml_get_errors($xml)) { |
991 | 991 | $lines = explode("\r", $project_prefs); |
992 | - watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}" . |
|
993 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
992 | + watchdog('am_set_info', "XML validation error in project_prefs: {$errors[0]->message} at line {$errors[0]->line}". |
|
993 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), array(), WATCHDOG_ERROR); |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | if (!$errors) { |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | $xml = array( |
1034 | 1034 | 'error' => array( |
1035 | 1035 | 'error_num' => -112, |
1036 | - 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}" . |
|
1037 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]) |
|
1036 | + 'error_msg' => "{$errors[0]->message} at line {$errors[0]->line}". |
|
1037 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]) |
|
1038 | 1038 | ), |
1039 | 1039 | ); |
1040 | 1040 | } |
@@ -1142,10 +1142,10 @@ discard block |
||
1142 | 1142 | 'teaser' => $teaser, |
1143 | 1143 | 'uid' => $team_owner_uid, |
1144 | 1144 | 'path' => null, |
1145 | - 'status' => 1, // published or not - always publish |
|
1145 | + 'status' => 1, // published or not - always publish |
|
1146 | 1146 | 'promote' => 0, |
1147 | 1147 | 'created' => $created_time, |
1148 | - 'comment' => 0, // comments disabled |
|
1148 | + 'comment' => 0, // comments disabled |
|
1149 | 1149 | 'moderate' => 0, |
1150 | 1150 | 'sticky' => 0, |
1151 | 1151 | 'format' => $input_format |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | module_load_include('inc', 'pathauto', 'pathauto'); |
1157 | 1157 | $node['path'] = pathauto_cleanstring($values['name']); |
1158 | 1158 | |
1159 | - $node = (object) $node; // node_save requires an object form |
|
1159 | + $node = (object)$node; // node_save requires an object form |
|
1160 | 1160 | $team_categories = taxonomy_get_term_by_name($values['type']); |
1161 | 1161 | $node->taxonomy[] = $team_categories[0]; |
1162 | 1162 | |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | while ($member = db_fetch_object($result)) { |
1316 | 1316 | $team_members[$member->boinc_id]['country'] = $member->field_country_value; |
1317 | 1317 | $team_members[$member->boinc_id]['url'] = $member->field_url_value; |
1318 | - $team_members[$member->boinc_id]['has_profile'] = isset($member->nid) ? 1: 0; |
|
1318 | + $team_members[$member->boinc_id]['has_profile'] = isset($member->nid) ? 1 : 0; |
|
1319 | 1319 | $xml['users']['user'][] = $team_members[$member->boinc_id]; |
1320 | 1320 | } |
1321 | 1321 | } // end if credit_only |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1366 | 1366 | $profile_node = node_load($profile_nid); |
1367 | 1367 | if ($profile_node) { |
1368 | - $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
|
1368 | + $avatar_image = get_cck_image_object(file_directory_path().'/'.$image_path, 'field_image', 'profile', TRUE); |
|
1369 | 1369 | if ($avatar_image) { |
1370 | 1370 | $profile_node->field_image[0] = $avatar_image; |
1371 | 1371 | node_save($profile_node); |
@@ -1479,7 +1479,7 @@ discard block |
||
1479 | 1479 | WHERE (n.status = 1) AND (c.uid = '%d') |
1480 | 1480 | ORDER BY timestamp DESC |
1481 | 1481 | LIMIT %d", |
1482 | - $uid, (int) $count |
|
1482 | + $uid, (int)$count |
|
1483 | 1483 | ); |
1484 | 1484 | $xml = array( |
1485 | 1485 | 'rpc_response' => array( |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | WHERE (n.status = 1) AND (n.uid = '%d') |
1523 | 1523 | ORDER BY changed DESC |
1524 | 1524 | LIMIT %d", |
1525 | - $uid, (int) $count |
|
1525 | + $uid, (int)$count |
|
1526 | 1526 | ); |
1527 | 1527 | $xml = array( |
1528 | 1528 | 'rpc_response' => array( |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | ); |
1692 | 1692 | } |
1693 | 1693 | // Determine which page to display in order to show the given comment |
1694 | - $page = floor($comment_offset / $comments_per_page); |
|
1694 | + $page = floor($comment_offset/$comments_per_page); |
|
1695 | 1695 | if ($page) { |
1696 | 1696 | $params = array('page' => $page); |
1697 | 1697 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | * Overview of moderation queues |
2084 | 2084 | */ |
2085 | 2085 | function boinccore_moderation_overview_panel() { |
2086 | - $output = '<h2 class="pane-title">' . bts('Moderation', array(), NULL, 'boinc:moderate-profiles') . '</h2>'; |
|
2086 | + $output = '<h2 class="pane-title">'.bts('Moderation', array(), NULL, 'boinc:moderate-profiles').'</h2>'; |
|
2087 | 2087 | $output .= '<ul class="tab-list action-list">'; |
2088 | 2088 | if (module_exists('user_profiles')) { |
2089 | 2089 | $profile_count = db_result(db_query(" |
@@ -2094,7 +2094,7 @@ discard block |
||
2094 | 2094 | $output .= '<li class="tab primary">'; |
2095 | 2095 | $output .= l(bts('Unvetted profiles', array(), NULL, 'boinc:moderate-profiles'), 'moderate/profiles'); |
2096 | 2096 | $output .= '<div class="item-count-wrapper">'; |
2097 | - $output .= '<span class="item-count">' . $profile_count . '</span>'; |
|
2097 | + $output .= '<span class="item-count">'.$profile_count.'</span>'; |
|
2098 | 2098 | $output .= '</div>'; |
2099 | 2099 | $output .= '</li>'; |
2100 | 2100 | } |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | require_boinc('boinc_db'); |
2113 | 2113 | |
2114 | 2114 | $num_deleted = BoincToken::delete_expired(); |
2115 | - if ($num_deleted>0) { |
|
2115 | + if ($num_deleted > 0) { |
|
2116 | 2116 | watchdog('boinccore', "Deleted ${num_deleted} tokens from table token", WATCHDOG_NOTICE); |
2117 | 2117 | } |
2118 | 2118 | } |
@@ -69,84 +69,84 @@ discard block |
||
69 | 69 | 'title' => 'Look up account RPC', |
70 | 70 | 'description' => 'RPC for getting the authenticator for a user account.', |
71 | 71 | 'page callback' => 'boinccore_lookup_account', |
72 | - 'access callback' => TRUE, |
|
72 | + 'access callback' => true, |
|
73 | 73 | 'type' => MENU_CALLBACK |
74 | 74 | ); |
75 | 75 | $items['am_get_info.php'] = array( |
76 | 76 | 'title' => 'Account manager get info RPC', |
77 | 77 | 'description' => 'RPC for getting assorted details of a user account.', |
78 | 78 | 'page callback' => 'boinccore_am_get_info', |
79 | - 'access callback' => TRUE, |
|
79 | + 'access callback' => true, |
|
80 | 80 | 'type' => MENU_CALLBACK |
81 | 81 | ); |
82 | 82 | $items['am_set_info.php'] = array( |
83 | 83 | 'title' => 'Account manager set info RPC', |
84 | 84 | 'description' => 'RPC for updating assorted details of a user account.', |
85 | 85 | 'page callback' => 'boinccore_am_set_info', |
86 | - 'access callback' => TRUE, |
|
86 | + 'access callback' => true, |
|
87 | 87 | 'type' => MENU_CALLBACK |
88 | 88 | ); |
89 | 89 | $items['am_set_host_info.php'] = array( |
90 | 90 | 'title' => 'Account manager set host info RPC', |
91 | 91 | 'description' => 'RPC for updating the venue for a given host.', |
92 | 92 | 'page callback' => 'boinccore_am_set_host_info', |
93 | - 'access callback' => TRUE, |
|
93 | + 'access callback' => true, |
|
94 | 94 | 'type' => MENU_CALLBACK |
95 | 95 | ); |
96 | 96 | $items['show_user.php'] = array( |
97 | 97 | 'title' => 'Show user RPC', |
98 | 98 | 'description' => 'RPC for getting assorted details of a user account.', |
99 | 99 | 'page callback' => 'boinccore_show_user', |
100 | - 'access callback' => TRUE, |
|
100 | + 'access callback' => true, |
|
101 | 101 | 'type' => MENU_CALLBACK |
102 | 102 | ); |
103 | 103 | $items['pending.php'] = array( |
104 | 104 | 'title' => 'Pending credit RPC', |
105 | 105 | 'description' => 'RPC for getting pending credit for a given account.', |
106 | 106 | 'page callback' => 'boinccore_pending_credit', |
107 | - 'access callback' => TRUE, |
|
107 | + 'access callback' => true, |
|
108 | 108 | 'type' => MENU_CALLBACK |
109 | 109 | ); |
110 | 110 | $items['create_team.php'] = array( |
111 | 111 | 'title' => 'Create team RPC', |
112 | 112 | 'description' => 'RPC for creating a new team.', |
113 | 113 | 'page callback' => 'boinccore_create_team', |
114 | - 'access callback' => TRUE, |
|
114 | + 'access callback' => true, |
|
115 | 115 | 'type' => MENU_CALLBACK |
116 | 116 | ); |
117 | 117 | $items['team_lookup.php'] = array( |
118 | 118 | 'title' => 'Team lookup RPC', |
119 | 119 | 'description' => 'RPC for getting info on a team or matching teams.', |
120 | 120 | 'page callback' => 'boinccore_team_lookup', |
121 | - 'access callback' => TRUE, |
|
121 | + 'access callback' => true, |
|
122 | 122 | 'type' => MENU_CALLBACK |
123 | 123 | ); |
124 | 124 | $items['team_email_list.php'] = array( |
125 | 125 | 'title' => 'Get team member list RPC', |
126 | 126 | 'description' => 'RPC for getting a list of members of a given team.', |
127 | 127 | 'page callback' => 'boinccore_team_email_list', |
128 | - 'access callback' => TRUE, |
|
128 | + 'access callback' => true, |
|
129 | 129 | 'type' => MENU_CALLBACK |
130 | 130 | ); |
131 | 131 | $items['edit_forum_preferences_action.php'] = array( |
132 | 132 | 'title' => 'Forum preferences RPC', |
133 | 133 | 'description' => 'RPC for setting forum preferences for a given user.', |
134 | 134 | 'page callback' => 'boinccore_edit_forum_preferences', |
135 | - 'access callback' => TRUE, |
|
135 | + 'access callback' => true, |
|
136 | 136 | 'type' => MENU_CALLBACK |
137 | 137 | ); |
138 | 138 | $items['forum_get_data.php'] = array( |
139 | 139 | 'title' => 'Forum get data RPC', |
140 | 140 | 'description' => 'RPC for getting recent forum activity for a given user.', |
141 | 141 | 'page callback' => 'boinccore_forum_get_data', |
142 | - 'access callback' => TRUE, |
|
142 | + 'access callback' => true, |
|
143 | 143 | 'type' => MENU_CALLBACK |
144 | 144 | ); |
145 | 145 | $items['apps.php'] = array( |
146 | 146 | 'title' => 'Apps RPC', |
147 | 147 | 'description' => 'RPC for getting the applications in the system.', |
148 | 148 | 'page callback' => 'boinccore_apps', |
149 | - 'access callback' => TRUE, |
|
149 | + 'access callback' => true, |
|
150 | 150 | 'type' => MENU_CALLBACK |
151 | 151 | ); |
152 | 152 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | function boinccore_menu_alter(&$items) { |
160 | 160 | // If using Solr search and not core Drupal search, disable core search! |
161 | - if (module_exists('global_search_solr') AND !module_exists('global_search')) { |
|
161 | + if (module_exists('global_search_solr') and !module_exists('global_search')) { |
|
162 | 162 | // Add permission to user search. |
163 | 163 | $check = array( |
164 | 164 | 'search/node/%menu_tail', |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ); |
168 | 168 | foreach ($check as $path) { |
169 | 169 | if (isset($items[$path])) { |
170 | - $items[$path]['access callback'] = FALSE; |
|
170 | + $items[$path]['access callback'] = false; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ); |
198 | 198 | foreach ($check as $path) { |
199 | 199 | if (isset($items[$path])) { |
200 | - $items[$path]['access callback'] = FALSE; |
|
200 | + $items[$path]['access callback'] = false; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ); |
216 | 216 | foreach ($check as $path) { |
217 | 217 | if (isset($items[$path])) { |
218 | - $items[$path]['access callback'] = FALSE; |
|
218 | + $items[$path]['access callback'] = false; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | // Since we are in a hook_boot() implementation cache mode is normal, so |
274 | 274 | // we can safely call hook_exit(). |
275 | 275 | bootstrap_invoke_all('exit'); |
276 | - header("Location: $url", TRUE, $code); |
|
276 | + header("Location: $url", true, $code); |
|
277 | 277 | exit; |
278 | 278 | } |
279 | 279 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | function locale_language_from_browser() { |
293 | 293 | if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
294 | - return FALSE; |
|
294 | + return false; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $languages = language_list('enabled'); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | // Find the enabled language with the greatest qvalue, following the rules |
335 | 335 | // of RFC 2616 (section 14.4). If several languages have the same qvalue, |
336 | 336 | // prefer the one with the greatest weight. |
337 | - $best_match_language = FALSE; |
|
337 | + $best_match_language = false; |
|
338 | 338 | $max_qvalue = 0; |
339 | 339 | foreach ($languages as $langcode => $language) { |
340 | 340 | // Language tags are case insensitive (RFC2616, sec 3.10). |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | // Notify moderators if there is site content that requires moderator action |
374 | 374 | $items_in_queue = boincuser_moderation_queue_count('cron'); |
375 | 375 | $last_notification = variable_get('boinccore_last_content_moderation_reminder', 0); |
376 | - if ($items_in_queue AND $last_notification < time() - 24*60*60) { |
|
376 | + if ($items_in_queue and $last_notification < time() - 24*60*60) { |
|
377 | 377 | global $base_url; |
378 | 378 | global $base_path; |
379 | 379 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $user_info = '<div class="user">'; |
434 | 434 | if ($user_image) { |
435 | 435 | $user_info .= ' <div class="picture">'; |
436 | - if (is_array($user_image) AND $user_image['image']['filepath']) { |
|
436 | + if (is_array($user_image) and $user_image['image']['filepath']) { |
|
437 | 437 | $user_info .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
438 | 438 | } |
439 | 439 | elseif (is_string($user_image)) { |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | |
464 | 464 | module_load_include('inc', 'bbcode', 'bbcode-help'); |
465 | 465 | $form['bbcode_help'] = array( |
466 | - '#title' => bts('BBcode help', array(), NULL, 'boinc:help-with-user-input-with-BBCode'), |
|
466 | + '#title' => bts('BBcode help', array(), null, 'boinc:help-with-user-input-with-BBCode'), |
|
467 | 467 | '#type' => 'fieldset', |
468 | 468 | '#attributes' => array( |
469 | 469 | 'class' => 'bbcode_help', |
470 | 470 | ), |
471 | - '#collapsible' => TRUE, |
|
472 | - '#collapsed' => TRUE, |
|
471 | + '#collapsible' => true, |
|
472 | + '#collapsed' => true, |
|
473 | 473 | 'content' => array( |
474 | 474 | '#value' => _bbcode_filter_tip(), |
475 | 475 | ), |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $form['buttons']['submit'] = $form['submit']; |
492 | 492 | unset($form['submit']); |
493 | 493 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
494 | - $form['buttons']['submit']['#value'] = bts('Post comment', array(), NULL, 'boinc:post-forum-comment'); |
|
494 | + $form['buttons']['submit']['#value'] = bts('Post comment', array(), null, 'boinc:post-forum-comment'); |
|
495 | 495 | $form['buttons']['submit']['#suffix'] = '</li>'; |
496 | 496 | $form['buttons']['submit']['#weight'] = 1002; |
497 | 497 | // We want all these buttons together under the "buttons" array, but the |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $form['buttons']['preview']['#suffix'] = '</li>'; |
506 | 506 | $form['buttons']['preview']['#weight'] = 1003; |
507 | 507 | $form['buttons']['cancel'] = array( |
508 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_url) . '</li>', |
|
508 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $cancel_url) . '</li>', |
|
509 | 509 | '#weight' => 1004, |
510 | 510 | ); |
511 | 511 | $form['buttons']['form control tabs suffix'] = array( |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | } |
536 | 536 | } |
537 | 537 | else { |
538 | - $form = NULL; |
|
538 | + $form = null; |
|
539 | 539 | $form['from'] = array( |
540 | 540 | '#type' => 'item', |
541 | 541 | '#value' => 'You do not have permission to post comments in this forum.', |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | '#weight' => 1001, |
561 | 561 | ); |
562 | 562 | $form['buttons']['submit']['#prefix'] = '<li class="first tab">'; |
563 | - $form['buttons']['submit']['#value'] = bts('Post topic', array(), NULL, 'boinc:post-forum-comment'); |
|
563 | + $form['buttons']['submit']['#value'] = bts('Post topic', array(), null, 'boinc:post-forum-comment'); |
|
564 | 564 | $form['buttons']['submit']['#suffix'] = '</li>'; |
565 | 565 | $form['buttons']['submit']['#weight'] = 1002; |
566 | 566 | $form['buttons']['preview']['#prefix'] = '<li class="tab">'; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
571 | 571 | $form['buttons']['preview_changes']['#weight'] = 1004; |
572 | 572 | $form['buttons']['cancel'] = array( |
573 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "community/forum/{$forum_id}") . '</li>', |
|
573 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "community/forum/{$forum_id}") . '</li>', |
|
574 | 574 | '#weight' => 1005, |
575 | 575 | ); |
576 | 576 | $form['buttons']['form control tabs suffix'] = array( |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | /** |
609 | 609 | * Implementation of hook_link_alter() |
610 | 610 | */ |
611 | -function boinccore_link_alter(&$links, $node, $comment = NULL) { |
|
611 | +function boinccore_link_alter(&$links, $node, $comment = null) { |
|
612 | 612 | //echo '<pre>' . print_r($links, true) . '</pre>'; |
613 | 613 | foreach ($links as $module => $link) { |
614 | 614 | // Remove the ignore user link |
@@ -620,15 +620,15 @@ discard block |
||
620 | 620 | if (!($comment)) { |
621 | 621 | // modify the comment_add link |
622 | 622 | if (isset($links['comment_add'])) { |
623 | - $links['comment_add']['title'] = bts('reply', array(), NULL, 'boinc:forum-reply-to-comment'); |
|
623 | + $links['comment_add']['title'] = bts('reply', array(), null, 'boinc:forum-reply-to-comment'); |
|
624 | 624 | $links['comment_add']['attributes'] = array( |
625 | - 'title' => bts('Reply to this comment', array(), NULL, 'boinc:forum-reply-to-comment') |
|
625 | + 'title' => bts('Reply to this comment', array(), null, 'boinc:forum-reply-to-comment') |
|
626 | 626 | ); |
627 | 627 | } |
628 | 628 | // modify quote link |
629 | 629 | if (isset($links['quote'])) { |
630 | 630 | $links['quote']['attributes'] = array( |
631 | - 'title' => bts('Reply to this topic with a quote', array(), NULL, 'boinc:forum-reply-to-comment') |
|
631 | + 'title' => bts('Reply to this topic with a quote', array(), null, 'boinc:forum-reply-to-comment') |
|
632 | 632 | ); |
633 | 633 | } |
634 | 634 | } |
@@ -636,17 +636,17 @@ discard block |
||
636 | 636 | // Standard EDIT, DELETE, and REPLY links are created by Drupal, but we want to alter them |
637 | 637 | if (isset($links['comment_delete'])) { |
638 | 638 | $links['comment_delete']['attributes'] = array( |
639 | - 'title' => bts('Delete this comment', array(), NULL, 'boinc:forum-delete-comment') |
|
639 | + 'title' => bts('Delete this comment', array(), null, 'boinc:forum-delete-comment') |
|
640 | 640 | ); |
641 | 641 | } |
642 | 642 | if (isset($links['comment_edit'])) { |
643 | 643 | $links['comment_edit']['attributes'] = array( |
644 | - 'title' => bts('Edit this comment', array(), NULL, 'boinc:forum-edit-comment') |
|
644 | + 'title' => bts('Edit this comment', array(), null, 'boinc:forum-edit-comment') |
|
645 | 645 | ); |
646 | 646 | } |
647 | 647 | if (isset($links['comment_reply'])) { |
648 | 648 | $links['comment_reply']['attributes'] = array( |
649 | - 'title' => bts('Reply to this comment', array(), NULL, 'boinc:forum-reply-to-comment') |
|
649 | + 'title' => bts('Reply to this comment', array(), null, 'boinc:forum-reply-to-comment') |
|
650 | 650 | ); |
651 | 651 | } |
652 | 652 | }// if !$comment |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | /** |
656 | 656 | * Implementation of hook_locale(). |
657 | 657 | */ |
658 | -function boinccore_locale($op = 'groups', $group = NULL) { |
|
658 | +function boinccore_locale($op = 'groups', $group = null) { |
|
659 | 659 | switch ($op) { |
660 | 660 | case 'groups': |
661 | 661 | return array('boinc' => 'BOINC'); |
662 | 662 | case 'info': |
663 | 663 | //$info['boinc']['refresh callback'] = 'boinccore_locale_refresh'; |
664 | - $info['boinc']['format'] = FALSE; |
|
664 | + $info['boinc']['format'] = false; |
|
665 | 665 | return $info; |
666 | 666 | } |
667 | 667 | } |
@@ -670,65 +670,65 @@ discard block |
||
670 | 670 | /** |
671 | 671 | * Implementation of hook_link() |
672 | 672 | */ |
673 | -function boinccore_link($type, $object, $teaser = FALSE) { |
|
673 | +function boinccore_link($type, $object, $teaser = false) { |
|
674 | 674 | // Add custom links with this hook |
675 | 675 | |
676 | 676 | if ($type=='node') { |
677 | - if ( ($object->type=='forum') OR ($object->type=='team_forum') ) { |
|
677 | + if ( ($object->type=='forum') or ($object->type=='team_forum') ) { |
|
678 | 678 | // Add topic moderator controls |
679 | 679 | if (user_access('edit any forum topic')) { |
680 | 680 | $node_control = "node_control/{$object->nid}"; |
681 | 681 | if ($object->sticky) { |
682 | 682 | $links['make_unsticky'] = array( |
683 | - 'title' => bts('Make unsticky', array(), NULL, 'boinc:forum-unsticky-comment'), |
|
683 | + 'title' => bts('Make unsticky', array(), null, 'boinc:forum-unsticky-comment'), |
|
684 | 684 | 'href' => "{$node_control}/unsticky", |
685 | 685 | 'attributes' => array( |
686 | - 'title' => bts('Remove sticky status from this topic', array(), NULL, 'boinc:forum-unsticky-comment') |
|
686 | + 'title' => bts('Remove sticky status from this topic', array(), null, 'boinc:forum-unsticky-comment') |
|
687 | 687 | ) |
688 | 688 | ); |
689 | 689 | } |
690 | 690 | else { |
691 | 691 | $links['make_sticky'] = array( |
692 | - 'title' => bts('Make sticky', array(), NULL, 'boinc:forum-sticky-comment'), |
|
692 | + 'title' => bts('Make sticky', array(), null, 'boinc:forum-sticky-comment'), |
|
693 | 693 | 'href' => "{$node_control}/sticky", |
694 | 694 | 'attributes' => array( |
695 | - 'title' => bts('Make this topic sticky', array(), NULL, 'boinc:forum-sticky-comment') |
|
695 | + 'title' => bts('Make this topic sticky', array(), null, 'boinc:forum-sticky-comment') |
|
696 | 696 | ) |
697 | 697 | ); |
698 | 698 | } |
699 | 699 | if ($object->comment == COMMENT_NODE_READ_WRITE) { |
700 | 700 | $links['lock'] = array( |
701 | - 'title' => bts('Lock', array(), NULL, 'boinc:forum-lock-comment'), |
|
701 | + 'title' => bts('Lock', array(), null, 'boinc:forum-lock-comment'), |
|
702 | 702 | 'href' => "{$node_control}/lock", |
703 | 703 | 'attributes' => array( |
704 | - 'title' => bts('Lock this thread for comments', array(), NULL, 'boinc:forum-lock-comment') |
|
704 | + 'title' => bts('Lock this thread for comments', array(), null, 'boinc:forum-lock-comment') |
|
705 | 705 | ) |
706 | 706 | ); |
707 | 707 | } |
708 | 708 | else { |
709 | 709 | $links['unlock'] = array( |
710 | - 'title' => bts('Unlock', array(), NULL, 'boinc:forum-unlock-comment'), |
|
710 | + 'title' => bts('Unlock', array(), null, 'boinc:forum-unlock-comment'), |
|
711 | 711 | 'href' => "{$node_control}/unlock", |
712 | 712 | 'attributes' => array( |
713 | - 'title' => bts('Unlock this thread for comments', array(), NULL, 'boinc:forum-unlock-comment') |
|
713 | + 'title' => bts('Unlock this thread for comments', array(), null, 'boinc:forum-unlock-comment') |
|
714 | 714 | ) |
715 | 715 | ); |
716 | 716 | } |
717 | 717 | if ($object->status) { |
718 | 718 | $links['hide'] = array( |
719 | - 'title' => bts('Hide', array(), NULL, 'boinc:forum-hide-comment'), |
|
719 | + 'title' => bts('Hide', array(), null, 'boinc:forum-hide-comment'), |
|
720 | 720 | 'href' => "{$node_control}/hide", |
721 | 721 | 'attributes' => array( |
722 | - 'title' => bts('Hide this topic', array(), NULL, 'boinc:forum-hide-comment') |
|
722 | + 'title' => bts('Hide this topic', array(), null, 'boinc:forum-hide-comment') |
|
723 | 723 | ) |
724 | 724 | ); |
725 | 725 | } |
726 | 726 | else { |
727 | 727 | $links['unhide'] = array( |
728 | - 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
|
728 | + 'title' => bts('Unhide', array(), null, 'boinc:forum-unhide-comment'), |
|
729 | 729 | 'href' => "{$node_control}/unhide", |
730 | 730 | 'attributes' => array( |
731 | - 'title' => bts('Unhide this topic', array(), NULL, 'boinc:forum-unhide-comment') |
|
731 | + 'title' => bts('Unhide this topic', array(), null, 'boinc:forum-unhide-comment') |
|
732 | 732 | ) |
733 | 733 | ); |
734 | 734 | } |
@@ -743,10 +743,10 @@ discard block |
||
743 | 743 | // QUOTE |
744 | 744 | if ($node->comment == COMMENT_NODE_READ_WRITE) { |
745 | 745 | $links['quote'] = array( |
746 | - 'title' => bts('Quote', array(), NULL, 'boinc:forum-reply-to-comment-with-quote'), |
|
746 | + 'title' => bts('Quote', array(), null, 'boinc:forum-reply-to-comment-with-quote'), |
|
747 | 747 | 'href' => "comment/reply/{$nid}/{$cid}", |
748 | 748 | 'attributes' => array( |
749 | - 'title' => bts('Reply to this comment with a quote', array(), NULL, 'boinc:forum-reply-to-comment') |
|
749 | + 'title' => bts('Reply to this comment with a quote', array(), null, 'boinc:forum-reply-to-comment') |
|
750 | 750 | ), |
751 | 751 | 'fragment' => 'comment-form', |
752 | 752 | 'query' => 'quote=1', |
@@ -760,29 +760,29 @@ discard block |
||
760 | 760 | $reply_count = db_result(db_query(' SELECT COUNT(*) FROM comments WHERE pid = %d', $cid )); |
761 | 761 | if ($reply_count == 0) { |
762 | 762 | $links['convert'] = array( |
763 | - 'title' => bts('Convert', array(), NULL, 'boinc:forum-convert-comment-to-topic'), |
|
763 | + 'title' => bts('Convert', array(), null, 'boinc:forum-convert-comment-to-topic'), |
|
764 | 764 | 'href' => "{$comment_control}/convert", |
765 | 765 | 'attributes' => array( |
766 | - 'title' => bts('Convert this comment to a new topic', array(), NULL, 'boinc:forum-convert-comment-to-topic') |
|
766 | + 'title' => bts('Convert this comment to a new topic', array(), null, 'boinc:forum-convert-comment-to-topic') |
|
767 | 767 | ) |
768 | 768 | ); |
769 | 769 | } |
770 | 770 | // Add hide link |
771 | 771 | if ($object->status == 0) { |
772 | 772 | $links['hide'] = array( |
773 | - 'title' => bts('Hide', array(), NULL, 'boinc:forum-hide-comment'), |
|
773 | + 'title' => bts('Hide', array(), null, 'boinc:forum-hide-comment'), |
|
774 | 774 | 'href' => "{$comment_control}/hide", |
775 | 775 | 'attributes' => array( |
776 | - 'title' => bts('Hide this comment', array(), NULL, 'boinc:forum-hide-comment') |
|
776 | + 'title' => bts('Hide this comment', array(), null, 'boinc:forum-hide-comment') |
|
777 | 777 | ) |
778 | 778 | ); |
779 | 779 | } |
780 | 780 | else { |
781 | 781 | $links['unhide'] = array( |
782 | - 'title' => bts('Unhide', array(), NULL, 'boinc:forum-unhide-comment'), |
|
782 | + 'title' => bts('Unhide', array(), null, 'boinc:forum-unhide-comment'), |
|
783 | 783 | 'href' => "{$comment_control}/unhide", |
784 | 784 | 'attributes' => array( |
785 | - 'title' => bts('Unhide this comment', array(), NULL, 'boinc:forum-unhide-comment') |
|
785 | + 'title' => bts('Unhide this comment', array(), null, 'boinc:forum-unhide-comment') |
|
786 | 786 | ) |
787 | 787 | ); |
788 | 788 | } |
@@ -817,12 +817,12 @@ discard block |
||
817 | 817 | * Allow published, sticky, and comment status to be set on nodes by direct |
818 | 818 | * link rather than through the node form. |
819 | 819 | */ |
820 | -function boinccore_node_control($nid = NULL, $action = NULL) { |
|
821 | - if ((!$nid OR !$node = node_load($nid)) OR |
|
822 | - ($node->type == 'forum' AND !user_access('edit any forum topic')) OR |
|
823 | - ($node->type != 'forum' AND !user_access('administer nodes'))) { |
|
820 | +function boinccore_node_control($nid = null, $action = null) { |
|
821 | + if ((!$nid or !$node = node_load($nid)) or |
|
822 | + ($node->type == 'forum' and !user_access('edit any forum topic')) or |
|
823 | + ($node->type != 'forum' and !user_access('administer nodes'))) { |
|
824 | 824 | // What are you even doing here... |
825 | - return FALSE; |
|
825 | + return false; |
|
826 | 826 | } |
827 | 827 | switch ($action) { |
828 | 828 | case 'unhide': |
@@ -864,10 +864,10 @@ discard block |
||
864 | 864 | * Allow published status to be set on comments by direct link rather than |
865 | 865 | * through the comment edit form. |
866 | 866 | */ |
867 | -function boinccore_comment_control($cid = NULL, $action = NULL) { |
|
868 | - if (!$cid OR !$comment = _comment_load($cid)) { |
|
867 | +function boinccore_comment_control($cid = null, $action = null) { |
|
868 | + if (!$cid or !$comment = _comment_load($cid)) { |
|
869 | 869 | // What are you even doing here... |
870 | - return FALSE; |
|
870 | + return false; |
|
871 | 871 | } |
872 | 872 | $return_path = "node/{$comment->nid}"; |
873 | 873 | $return_anchor = "comment-{$cid}"; |
@@ -920,11 +920,11 @@ discard block |
||
920 | 920 | rules_invoke_event('boinccore_comment_convert', $comment); |
921 | 921 | |
922 | 922 | $return_path = "node/{$node->nid}"; |
923 | - $return_anchor = NULL; |
|
923 | + $return_anchor = null; |
|
924 | 924 | break; |
925 | 925 | default: |
926 | 926 | } |
927 | - drupal_goto($return_path, NULL, $return_anchor); |
|
927 | + drupal_goto($return_path, null, $return_anchor); |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | /** |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $uid = !empty($xml['am_get_info_reply']['id']) ? boincuser_lookup_uid($xml['am_get_info_reply']['id']) : 0; |
952 | 952 | if ($uid) { |
953 | 953 | $content_profile = content_profile_load('profile', $uid); |
954 | - $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
|
954 | + $profile_is_approved = ($content_profile->status and !$content_profile->moderate); |
|
955 | 955 | $country = check_plain($content_profile->field_country[0]['value']); |
956 | 956 | $website = ''; |
957 | 957 | if ($profile_is_approved) { |
@@ -973,8 +973,8 @@ discard block |
||
973 | 973 | // Remove q from the GET request or BOINC will panic |
974 | 974 | unset($_GET['q']); |
975 | 975 | // Validate the XML prefs (in case BOINC does not) |
976 | - $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : NULL); |
|
977 | - $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : NULL); |
|
976 | + $global_prefs = !empty($_POST['global_prefs']) ? $_POST['global_prefs'] : (!empty($_GET['global_prefs']) ? $_GET['global_prefs'] : null); |
|
977 | + $project_prefs = !empty($_POST['project_prefs']) ? $_POST['project_prefs'] : (!empty($_GET['project_prefs']) ? $_GET['project_prefs'] : null); |
|
978 | 978 | libxml_use_internal_errors(true); |
979 | 979 | $xml = new DomDocument(); |
980 | 980 | if ($global_prefs) { |
@@ -1013,15 +1013,15 @@ discard block |
||
1013 | 1013 | $uid = boincuser_lookup_uid($boinc_id); |
1014 | 1014 | |
1015 | 1015 | // Apply any relevant updates to the Drupal account, also |
1016 | - $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : NULL); |
|
1017 | - $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : NULL); |
|
1018 | - $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : NULL); |
|
1016 | + $country = !empty($_POST['country']) ? $_POST['country'] : (!empty($_GET['country']) ? $_GET['country'] : null); |
|
1017 | + $url = !empty($_POST['url']) ? $_POST['url'] : (!empty($_GET['url']) ? $_GET['url'] : null); |
|
1018 | + $email_addr = !empty($_POST['email_addr']) ? $_POST['email_addr'] : (!empty($_GET['email_addr']) ? $_GET['email_addr'] : null); |
|
1019 | 1019 | |
1020 | 1020 | if ($email_addr) { |
1021 | 1021 | $account = user_load($uid); |
1022 | 1022 | user_save($account, array('mail' => $email_addr)); |
1023 | 1023 | } |
1024 | - if ($country OR $url) { |
|
1024 | + if ($country or $url) { |
|
1025 | 1025 | $content_profile = content_profile_load('profile', $uid); |
1026 | 1026 | if ($country) $content_profile->field_country[0]['value'] = $country; |
1027 | 1027 | if ($url) $content_profile->field_url[0]['value'] = $url; |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | $uid = !empty($xml['user']['id']) ? boincuser_lookup_uid($xml['user']['id']) : 0; |
1076 | 1076 | if ($uid) { |
1077 | 1077 | $content_profile = content_profile_load('profile', $uid); |
1078 | - $profile_is_approved = ($content_profile->status AND !$content_profile->moderate); |
|
1078 | + $profile_is_approved = ($content_profile->status and !$content_profile->moderate); |
|
1079 | 1079 | $country = check_plain($content_profile->field_country[0]['value']); |
1080 | 1080 | $website = ''; |
1081 | 1081 | if ($profile_is_approved) { |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | $show_xml = !empty($_POST['xml']) ? $_POST['xml'] : $_GET['xml']; |
1238 | 1238 | if (!$show_xml) { |
1239 | 1239 | // creditonly does not affect non xml output in BOINC |
1240 | - $credit_only = FALSE; |
|
1240 | + $credit_only = false; |
|
1241 | 1241 | } |
1242 | 1242 | $xml = array(); |
1243 | 1243 | |
@@ -1286,11 +1286,11 @@ discard block |
||
1286 | 1286 | 'cpid' => md5($member->cross_project_id.$member->email_addr), |
1287 | 1287 | 'create_time' => $member->create_time, |
1288 | 1288 | 'name' => htmlspecialchars($member->name), |
1289 | - 'country' => NULL, |
|
1289 | + 'country' => null, |
|
1290 | 1290 | 'total_credit' => round($member->total_credit), |
1291 | 1291 | 'expavg_credit' => round($member->expavg_credit), |
1292 | 1292 | 'expavg_time' => round($member->expavg_time), |
1293 | - 'url' => NULL, |
|
1293 | + 'url' => null, |
|
1294 | 1294 | 'has_profile' => 0, |
1295 | 1295 | ); |
1296 | 1296 | } |
@@ -1328,7 +1328,7 @@ discard block |
||
1328 | 1328 | ), |
1329 | 1329 | ); |
1330 | 1330 | } // end if boincteam_id |
1331 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1331 | + print xml_to_text(array_to_xml($xml), true, true); |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | /** |
@@ -1339,18 +1339,18 @@ discard block |
||
1339 | 1339 | // Do not pass through to BOINC in this case as BOINC forums are no longer |
1340 | 1340 | // relevant -- use Drupal data only |
1341 | 1341 | |
1342 | - $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : NULL); |
|
1342 | + $account_key = !empty($_POST['account_key']) ? $_POST['account_key'] : (!empty($_GET['account_key']) ? $_GET['account_key'] : null); |
|
1343 | 1343 | |
1344 | 1344 | require_boinc('boinc_db'); |
1345 | 1345 | $boincuser = BoincUser::lookup_auth($account_key); |
1346 | 1346 | if ($boincuser) { |
1347 | 1347 | $uid = boincuser_lookup_uid($boincuser->id); |
1348 | - if ($uid AND $account = user_load($uid)) { |
|
1348 | + if ($uid and $account = user_load($uid)) { |
|
1349 | 1349 | // Currently supported preferences |
1350 | - $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : NULL); |
|
1351 | - $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : NULL); |
|
1352 | - $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : NULL); |
|
1353 | - $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : NULL); |
|
1350 | + $avatar_url = isset($_POST['avatar_url']) ? $_POST['avatar_url'] : (isset($_GET['avatar_url']) ? $_GET['avatar_url'] : null); |
|
1351 | + $hide_signatures = isset($_POST['forum_hide_signatures']) ? $_POST['forum_hide_signatures'] : (isset($_GET['forum_hide_signatures']) ? $_GET['forum_hide_signatures'] : null); |
|
1352 | + $signature = isset($_POST['signature']) ? $_POST['signature'] : (isset($_GET['signature']) ? $_GET['signature'] : null); |
|
1353 | + $post_order = isset($_POST['thread_sort']) ? $_POST['thread_sort'] : (isset($_GET['thread_sort']) ? $_GET['thread_sort'] : null); |
|
1354 | 1354 | // Update preferences as needed |
1355 | 1355 | if ($avatar_url) { |
1356 | 1356 | $avatar_image = file_get_contents($avatar_url); |
@@ -1361,11 +1361,11 @@ discard block |
||
1361 | 1361 | if ($file) { |
1362 | 1362 | $profile = new stdClass(); |
1363 | 1363 | $profile->type = 'profile'; |
1364 | - $profile->language = NULL; |
|
1364 | + $profile->language = null; |
|
1365 | 1365 | if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
1366 | 1366 | $profile_node = node_load($profile_nid); |
1367 | 1367 | if ($profile_node) { |
1368 | - $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', TRUE); |
|
1368 | + $avatar_image = get_cck_image_object(file_directory_path() . '/' . $image_path, 'field_image', 'profile', true); |
|
1369 | 1369 | if ($avatar_image) { |
1370 | 1370 | $profile_node->field_image[0] = $avatar_image; |
1371 | 1371 | node_save($profile_node); |
@@ -1390,10 +1390,10 @@ discard block |
||
1390 | 1390 | $error = 'Could not find avatar image at URL'; |
1391 | 1391 | } |
1392 | 1392 | } |
1393 | - if ($hide_signatures !== NULL) { |
|
1393 | + if ($hide_signatures !== null) { |
|
1394 | 1394 | user_save($account, array('hide_signatures' => ($hide_signatures ? 1 : 0))); |
1395 | 1395 | } |
1396 | - if ($signature !== NULL) { |
|
1396 | + if ($signature !== null) { |
|
1397 | 1397 | $signature = check_markup($signature); |
1398 | 1398 | user_save($account, array('signature' => $signature)); |
1399 | 1399 | } |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | // Success |
1411 | 1411 | $xml = array( |
1412 | 1412 | 'edit_forum_preferences' => array( |
1413 | - 'success' => NULL, |
|
1413 | + 'success' => null, |
|
1414 | 1414 | ), |
1415 | 1415 | ); |
1416 | 1416 | } |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | ), |
1444 | 1444 | ); |
1445 | 1445 | } |
1446 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1446 | + print xml_to_text(array_to_xml($xml), true, true); |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | /** |
@@ -1455,17 +1455,17 @@ discard block |
||
1455 | 1455 | // relevant -- use Drupal data only |
1456 | 1456 | |
1457 | 1457 | $xml = array(); |
1458 | - $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : NULL); |
|
1458 | + $boinc_id = !empty($_POST['userid']) ? $_POST['userid'] : (!empty($_GET['userid']) ? $_GET['userid'] : null); |
|
1459 | 1459 | $uid = boincuser_lookup_uid($boinc_id); |
1460 | 1460 | |
1461 | 1461 | if ($uid) { |
1462 | - $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : NULL); |
|
1463 | - $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : NULL); |
|
1462 | + $method = !empty($_POST['method']) ? $_POST['method'] : (!empty($_GET['method']) ? $_GET['method'] : null); |
|
1463 | + $count = !empty($_POST['count']) ? $_POST['count'] : (!empty($_GET['count']) ? $_GET['count'] : null); |
|
1464 | 1464 | if (!$count) $count = 10; |
1465 | 1465 | |
1466 | 1466 | switch ($method) { |
1467 | 1467 | case 'user_posts': |
1468 | - $content_length = !empty($_POST['content_length']) ? $_POST['content_length'] : (!empty($_GET['content_length']) ? $_GET['content_length'] : NULL); |
|
1468 | + $content_length = !empty($_POST['content_length']) ? $_POST['content_length'] : (!empty($_GET['content_length']) ? $_GET['content_length'] : null); |
|
1469 | 1469 | $posts = db_query(" |
1470 | 1470 | SELECT |
1471 | 1471 | c.cid, |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | ), |
1562 | 1562 | ); |
1563 | 1563 | } |
1564 | - print xml_to_text(array_to_xml($xml), TRUE, TRUE); |
|
1564 | + print xml_to_text(array_to_xml($xml), true, true); |
|
1565 | 1565 | } |
1566 | 1566 | |
1567 | 1567 | /** |
@@ -1580,9 +1580,9 @@ discard block |
||
1580 | 1580 | * in advance on which page a given comment will appear. Link instead to this |
1581 | 1581 | * controller function, which can compute the page based on the user's settings |
1582 | 1582 | */ |
1583 | -function boinccore_url_pagination_handler($type, $object_id = NULL) { |
|
1583 | +function boinccore_url_pagination_handler($type, $object_id = null) { |
|
1584 | 1584 | global $user; |
1585 | - $path = NULL; |
|
1585 | + $path = null; |
|
1586 | 1586 | $params = array(); |
1587 | 1587 | switch ($type) { |
1588 | 1588 | case 'boinc-forum': |
@@ -1979,11 +1979,11 @@ discard block |
||
1979 | 1979 | $mailing_list = variable_get('boinc_moderator_mailing_list', ''); |
1980 | 1980 | $force_individual_notifications = variable_get('boinc_moderator_force_individual_notifications', 0); |
1981 | 1981 | |
1982 | - if (!$mailing_list OR $force_individual_notifications) { |
|
1982 | + if (!$mailing_list or $force_individual_notifications) { |
|
1983 | 1983 | // Send individual emails to all moderators |
1984 | 1984 | $roles = user_roles(); |
1985 | 1985 | $moderator_rid = array_search('moderator', $roles); |
1986 | - if ($moderator_rid !== FALSE) { |
|
1986 | + if ($moderator_rid !== false) { |
|
1987 | 1987 | $settings['recipients'] = array($moderator_rid); |
1988 | 1988 | rules_action_mail_to_users_of_role($settings); |
1989 | 1989 | } |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | 'Attempting to email administrators, but there is no admin email list or site email to send to.', array(), |
2024 | 2024 | WATCHDOG_ERROR |
2025 | 2025 | ); |
2026 | - return FALSE; |
|
2026 | + return false; |
|
2027 | 2027 | } |
2028 | 2028 | } |
2029 | 2029 | $settings['to'] = $mailing_list; |
@@ -2044,7 +2044,7 @@ discard block |
||
2044 | 2044 | /* |
2045 | 2045 | * BOINC wrapper for string translation |
2046 | 2046 | */ |
2047 | -function bts($string, $args = array(), $langcode = NULL, $context = 'boinc: ', $update = TRUE) { |
|
2047 | +function bts($string, $args = array(), $langcode = null, $context = 'boinc: ', $update = true) { |
|
2048 | 2048 | if (function_exists('i18nstrings_ts')) { |
2049 | 2049 | $string = i18nstrings_ts($context, $string, $langcode, $update); |
2050 | 2050 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | * Overview of moderation queues |
2084 | 2084 | */ |
2085 | 2085 | function boinccore_moderation_overview_panel() { |
2086 | - $output = '<h2 class="pane-title">' . bts('Moderation', array(), NULL, 'boinc:moderate-profiles') . '</h2>'; |
|
2086 | + $output = '<h2 class="pane-title">' . bts('Moderation', array(), null, 'boinc:moderate-profiles') . '</h2>'; |
|
2087 | 2087 | $output .= '<ul class="tab-list action-list">'; |
2088 | 2088 | if (module_exists('user_profiles')) { |
2089 | 2089 | $profile_count = db_result(db_query(" |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | WHERE n.type = 'profile' AND n.moderate = 1" |
2093 | 2093 | )); |
2094 | 2094 | $output .= '<li class="tab primary">'; |
2095 | - $output .= l(bts('Unvetted profiles', array(), NULL, 'boinc:moderate-profiles'), 'moderate/profiles'); |
|
2095 | + $output .= l(bts('Unvetted profiles', array(), null, 'boinc:moderate-profiles'), 'moderate/profiles'); |
|
2096 | 2096 | $output .= '<div class="item-count-wrapper">'; |
2097 | 2097 | $output .= '<span class="item-count">' . $profile_count . '</span>'; |
2098 | 2098 | $output .= '</div>'; |
@@ -2113,6 +2113,6 @@ discard block |
||
2113 | 2113 | |
2114 | 2114 | $num_deleted = BoincToken::delete_expired(); |
2115 | 2115 | if ($num_deleted>0) { |
2116 | - watchdog('boinccore', "Deleted ${num_deleted} tokens from table token", WATCHDOG_NOTICE); |
|
2116 | + watchdog('boinccore', "deleted ${num_deleted} tokens from table token", WATCHDOG_NOTICE); |
|
2117 | 2117 | } |
2118 | 2118 | } |