| 1 |
<?php |
<?php |
| 2 |
// $Id: search_keywords.module,v 1.16 2006/12/08 18:09:33 sugree Exp $ |
// $Id: search_keywords.module,v 1.17 2007/01/03 01:48:51 sugree Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 54 |
|
|
| 55 |
$access = user_access('access search keywords'); |
$access = user_access('access search keywords'); |
| 56 |
if ($may_cache) { |
if ($may_cache) { |
| 57 |
$items[] = array('path' => 'admin/logs/search_keywords', 'title' => t('recent keywords'), |
$items[] = array( |
| 58 |
'callback' => 'search_keywords_recent_keywords', 'access' => $access, |
'path' => 'admin/settings/search_keywords', |
| 59 |
|
'title' => t('Search keywords'), |
| 60 |
|
'description' => t('Administer search keywords.'), |
| 61 |
|
'callback' => 'drupal_get_form', |
| 62 |
|
'callback arguments' => array('search_keywords_admin_settings'), |
| 63 |
|
'access' => user_access('administer site configuration'), |
| 64 |
|
'type' => MENU_NORMAL_ITEM, |
| 65 |
|
); |
| 66 |
|
$items[] = array( |
| 67 |
|
'path' => 'admin/logs/search_keywords', |
| 68 |
|
'title' => t('Recent keywords'), |
| 69 |
|
'description' => t('View recent search keywords.'), |
| 70 |
|
'callback' => 'search_keywords_recent_keywords', |
| 71 |
|
'access' => $access, |
| 72 |
'weight' => 3); |
'weight' => 3); |
| 73 |
} |
} |
| 74 |
|
|
| 91 |
$result = pager_query($sql, 30); |
$result = pager_query($sql, 30); |
| 92 |
while ($log = db_fetch_object($result)) { |
while ($log = db_fetch_object($result)) { |
| 93 |
$title = (empty($log->title))?$log->path:$log->title; |
$title = (empty($log->title))?$log->path:$log->title; |
| 94 |
if (module_exist('ip2cc')) { |
if (module_exists('ip2cc')) { |
| 95 |
$flag = theme('ip2cc_ip_flag',$log->hostname); |
$flag = theme('ip2cc_ip_flag',$log->hostname); |
| 96 |
} else { |
} else { |
| 97 |
$flag = ''; |
$flag = ''; |
| 114 |
/** |
/** |
| 115 |
* Implementation of hook_settings(). |
* Implementation of hook_settings(). |
| 116 |
*/ |
*/ |
| 117 |
function search_keywords_settings() { |
function search_keywords_admin_settings() { |
| 118 |
// access log settings: |
// access log settings: |
| 119 |
$options = array('1' => t('Enabled'), '0' => t('Disabled')); |
$options = array('1' => t('Enabled'), '0' => t('Disabled')); |
| 120 |
$form['access'] = array('#type' => 'fieldset', '#title' => t('Access log settings')); |
$form['access'] = array( |
| 121 |
$form['access']['search_keywords_enable_access_log'] = array('#type' => 'radios', '#title' => t('Enable access log'), '#default_value' => variable_get('search_keywords_enable_access_log', 0), '#options' => $options, '#description' => t('Log each page access. Required for referrer search_keywords.')); |
'#type' => 'fieldset', |
| 122 |
|
'#title' => t('Access log settings')); |
| 123 |
|
$form['access']['search_keywords_enable_access_log'] = array( |
| 124 |
|
'#type' => 'radios', |
| 125 |
|
'#title' => t('Enable access log'), |
| 126 |
|
'#default_value' => variable_get('search_keywords_enable_access_log', 0), |
| 127 |
|
'#options' => $options, |
| 128 |
|
'#description' => t('Log each page access. Required for referrer search_keywords.')); |
| 129 |
|
|
| 130 |
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); |
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); |
| 131 |
$form['access']['search_keywords_flush_accesslog_timer'] = array('#type' => 'select', '#title' => t('Discard access logs older than'), '#default_value' => variable_get('search_keywords_flush_accesslog_timer', 259200), '#options' => $period, '#description' => t('Older access log entries (including referrer search_keywords) will be automatically discarded. Requires crontab.')); |
$form['access']['search_keywords_flush_accesslog_timer'] = array( |
| 132 |
|
'#type' => 'select', |
| 133 |
|
'#title' => t('Discard access logs older than'), |
| 134 |
|
'#default_value' => variable_get('search_keywords_flush_accesslog_timer', 259200), |
| 135 |
|
'#options' => $period, |
| 136 |
|
'#description' => t('Older access log entries (including referrer search_keywords) will be automatically discarded. Requires crontab.')); |
| 137 |
|
|
| 138 |
return $form; |
return system_settings_form($form); |
| 139 |
} |
} |
| 140 |
|
|
| 141 |
/** |
/** |