| 1 |
<?php |
<?php |
| 2 |
/* |
/* |
| 3 |
* $Id: hof.module,v 1.15 2008/12/15 05:00:00 syscrusher Exp $ |
* $Id: hof.module,v 1.16 2008/12/19 02:43:40 syscrusher Exp $ |
| 4 |
* |
* |
| 5 |
* Hall-Of-Fame is a module that reports summary statistics for a Drupal |
* Hall-Of-Fame is a module that reports summary statistics for a Drupal |
| 6 |
* web site, with an emphasis on reports that are of interest to visitors |
* web site, with an emphasis on reports that are of interest to visitors |
| 55 |
$perms = array('access hof', 'administer hof'); |
$perms = array('access hof', 'administer hof'); |
| 56 |
foreach ($sections as $section=>$title) { |
foreach ($sections as $section=>$title) { |
| 57 |
if (array_search($section, $enabled) !== FALSE) { |
if (array_search($section, $enabled) !== FALSE) { |
| 58 |
$title = strtolower(preg_replace('/\W+/', ' ', $title)); |
$menu_title = strtolower(preg_replace('/\W+/', ' ', $title)); |
| 59 |
$perm = 'access hof '. $title; |
$perm = 'access hof '. $menu_title; |
| 60 |
$perms[] = $perm; |
$perms[$perm] = array('title'=>$title, 'description'=>t('View this page of the Hall of Fame')); |
| 61 |
} |
} |
| 62 |
} |
} |
| 63 |
return $perms; |
return $perms; |
| 331 |
if (function_exists($function)) { |
if (function_exists($function)) { |
| 332 |
if ($need_toc) { |
if ($need_toc) { |
| 333 |
$sections = hof_get_sections(); |
$sections = hof_get_sections(); |
| 334 |
drupal_set_title(t('Hall of Fame: '). $sections[$section]); |
if (isset($sections[$section])) { |
| 335 |
|
drupal_set_title(t('Hall of Fame: '). $sections[$section]); |
| 336 |
|
} else { |
| 337 |
|
drupal_set_title(t('Hall of Fame')); |
| 338 |
|
} |
| 339 |
if ($toc_position == 'top') { |
if ($toc_position == 'top') { |
| 340 |
$html .= _hof_embedded_toc(); |
$html .= _hof_embedded_toc(); |
| 341 |
} |
} |
| 344 |
if (is_array($args)) { |
if (is_array($args)) { |
| 345 |
$args = array_shift($args); |
$args = array_shift($args); |
| 346 |
} |
} |
| 347 |
$html .= "<p><strong>". t('Statistics for ') . variable_get('site_name', t('this site')) . t(' as of ') . format_date(time(), "long") ."</strong></p>\n"; |
$html .= "<p><strong>". t('Statistics for ') . variable_get('site_name', t('this site')) . t(' as of ') . format_date(REQUEST_TIME, "long") ."</strong></p>\n"; |
| 348 |
$html .= call_user_func_array($function, $args); |
$html .= call_user_func_array($function, $args); |
| 349 |
if ($need_toc) { |
if ($need_toc) { |
| 350 |
if ($toc_position == 'bottom') { |
if ($toc_position == 'bottom') { |
| 352 |
} |
} |
| 353 |
} |
} |
| 354 |
$html .= '</div>'; |
$html .= '</div>'; |
| 355 |
print(theme('page', $html)); |
return $html; |
| 356 |
} |
} |
| 357 |
else { |
else { |
| 358 |
drupal_not_found(); |
drupal_not_found(); |
| 444 |
$ymd = variable_get('hof_site_create_date', array()); |
$ymd = variable_get('hof_site_create_date', array()); |
| 445 |
$first_tstmp = gmmktime(0, 0, 0, $ymd['month'], $ymd['day'], $ymd['year'], FALSE) - variable_get('date_default_timezone', 0); |
$first_tstmp = gmmktime(0, 0, 0, $ymd['month'], $ymd['day'], $ymd['year'], FALSE) - variable_get('date_default_timezone', 0); |
| 446 |
} else { |
} else { |
| 447 |
$sql="SELECT MIN(created) FROM {node} WHERE status=1 AND moderate=0"; |
$sql="SELECT MIN(created) AS began FROM {node} WHERE status=1 AND moderate=0"; |
| 448 |
$first_tstmp = db_result(db_query($sql)); |
$first_tstmp = db_result(db_query($sql)); |
| 449 |
} |
} |
| 450 |
$founded = format_date($first_tstmp, "long"); |
$founded = format_date($first_tstmp, "long"); |
| 451 |
$duration = format_interval(time() - $first_tstmp, 3); |
$duration = format_interval(REQUEST_TIME - $first_tstmp, 3); |
| 452 |
$html = "<p><ul>\n"; |
$html = "<p><ul>\n"; |
| 453 |
$html .= "<li>" . t("This site's first publication was ") . $founded . ".</li>\n"; |
$html .= "<li>" . t("This site's first publication was ") . $founded . ".</li>\n"; |
| 454 |
$html .= "<li>" . t("We have been online for ") . $duration . ".</li>\n"; |
$html .= "<li>" . t("We have been online for ") . $duration . ".</li>\n"; |
| 574 |
* Comment statistics (most active) |
* Comment statistics (most active) |
| 575 |
*/ |
*/ |
| 576 |
function _hof_page_section_comment() { |
function _hof_page_section_comment() { |
| 577 |
$sql = "SELECT count(*) contribs, u.name, u.uid FROM {comments} c left join {users} u on c.uid=u.uid where u.uid is not null and c.uid>0 and c.timestamp>=%d"; |
$sql = "SELECT count(*) contribs, u.name, u.uid FROM {comment} c left join {users} u on c.uid=u.uid where u.uid is not null and c.uid>0 and c.timestamp>=%d"; |
| 578 |
return _hof_most_active($sql); |
return _hof_most_active($sql); |
| 579 |
} |
} |
| 580 |
|
|