diff --git a/README.txt b/README.txt index 8e34ebf..980a204 100644 --- a/README.txt +++ b/README.txt @@ -12,8 +12,6 @@ limitations, namely: Browscap automates maintenance by storing browser data in a database and automatically retrieving the latest data on a configurable schedule. -Browscap also provides statistics on visiting browsers. - Requirements ------------ diff --git a/browscap.admin.inc b/browscap.admin.inc index bb09037..e2d3517 100644 --- a/browscap.admin.inc +++ b/browscap.admin.inc @@ -36,16 +36,6 @@ function browscap_settings_form(&$form_state) { '#options' => drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'), '#description' => t('Newer user agent detection information will be automatically downloaded and installed. (Requires a correctly configured cron maintenance task.)', array('@cron' => url('http://drupal.org/cron'))), ); - $form['user_agent_log'] = array( - '#type' => 'fieldset', - '#title' => t('User agent log settings'), - ); - $form['user_agent_log']['browscap_enable_user_agent_log'] = array( - '#type' => 'checkbox', - '#title' => t('Enable user agent log'), - '#default_value' => variable_get('browscap_enable_user_agent_log', FALSE), - '#description' => t('Increment a counter each time content is viewed by a user agent.'), - ); $form['buttons']['browscap_refresh'] = array( '#type' => 'submit', '#value' => t('Refresh browscap data'), diff --git a/browscap.info b/browscap.info index 40c7048..c60b102 100644 --- a/browscap.info +++ b/browscap.info @@ -1,3 +1,3 @@ name = Browscap -description = Provides a replacement for PHPs get_browser() function and collects visitor browser statistics. +description = Provides a replacement for PHPs get_browser() function. core = 6.x diff --git a/browscap.install b/browscap.install index 692460a..876da96 100644 --- a/browscap.install +++ b/browscap.install @@ -40,27 +40,6 @@ function browscap_schema() { ), 'primary key' => array('useragent'), ); - $schema['browscap_statistics'] = array( - 'fields' => array( - 'parent' => array( - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), - 'counter' => array( - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'is_crawler' => array( - 'type' => 'int', - 'size' => 'tiny', - 'not null' => TRUE, - ), - ), - 'primary key' => array('parent'), - ); $schema['cache_browscap'] = array( 'fields' => array( 'cid' => array( @@ -111,7 +90,6 @@ function browscap_uninstall() { variable_del('browscap_version'); variable_del('browscap_enable_automatic_updates'); variable_del('browscap_automatic_updates_timer'); - variable_del('browscap_enable_user_agent_log'); } /** diff --git a/browscap.module b/browscap.module index 389de5e..88e1d46 100644 --- a/browscap.module +++ b/browscap.module @@ -6,7 +6,6 @@ // Include browscap data import and user agent recording functions include_once('import.inc'); -include_once('record.inc'); /** * Implementation of hook_perm(). @@ -14,8 +13,6 @@ include_once('record.inc'); function browscap_perm() { return array( 'administer browscap', - 'view browscap reports', - 'bypass browscap monitoring', ); } @@ -31,46 +28,6 @@ function browscap_menu() { 'access arguments' => array('administer browscap'), 'file' => 'browscap.admin.inc', ); - $items['admin/reports/browscap'] = array( - 'title' => 'Browscap', - 'description' => 'Browser-specific site statistics.', - 'page callback' => 'browscap_top_useragents', - 'page arguments' => array('all'), - 'access arguments' => array('view browscap reports'), - 'file' => 'browscap.reports.inc', - 'weight' => 5, - ); - $items['admin/reports/browscap/useragents'] = array( - 'title' => 'All', - 'access arguments' => array('view browscap reports'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => 1, - ); - $items['admin/reports/browscap/browsers'] = array( - 'title' => 'Browsers', - 'page callback' => 'browscap_top_useragents', - 'page arguments' => array('browsers'), - 'access arguments' => array('view browscap reports'), - 'file' => 'browscap.reports.inc', - 'type' => MENU_LOCAL_TASK, - 'weight' => 2, - ); - $items['admin/reports/browscap/crawlers'] = array( - 'title' => 'Crawlers', - 'page callback' => 'browscap_top_useragents', - 'page arguments' => array('crawlers'), - 'access arguments' => array('view browscap reports'), - 'file' => 'browscap.reports.inc', - 'type' => MENU_LOCAL_TASK, - 'weight' => 3, - ); - $items['admin/reports/browscap/useragent/%'] = array( - 'title' => 'Useragent details', - 'page callback' => 'browscap_useragent_properties', - 'page arguments' => array(4), - 'access arguments' => array('view browscap reports'), - 'file' => 'browscap.user_agent.inc', - ); return $items; } @@ -82,32 +39,9 @@ function browscap_help($path, $arg) { switch ($path) { case 'admin/settings/browscap': return '

' . t('Settings for user agent detection and the log that Browscap will keep about user agents that visit the site. See user agent statistics for the actual information.', array('@statistics' => url('admin/reports/browscap'))) . '

'; - case 'admin/reports/browscap': - return '

' . t('This page displays the most popular visiting user agents.') . '

'; - case 'admin/reports/browscap/browsers': - return '

' . t('This page displays the most popular visiting user agents which have been classified as browsers.') . '

'; - case 'admin/reports/browscap/crawlers': - return '

' . t('This page displays the most popular visiting user agents which have been classified as crawlers.') . '

'; } } - /** - * Implements hook_init(). - */ -function browscap_init() { - // Record the user agent and set a flag to denote that the user agent was - // recorded during init() so it does not need to be recorded during exit() - _record_user_agent(TRUE, user_access('bypass browscap monitoring')); -} - -/** - * Implementation of hook_exit(). - */ -function browscap_exit() { - // Record the user agent - _record_user_agent(); -} - /** * Implementation of hook_cron(). */ diff --git a/browscap.reports.inc b/browscap.reports.inc deleted file mode 100644 index 5c98a52..0000000 --- a/browscap.reports.inc +++ /dev/null @@ -1,95 +0,0 @@ - t('User agent'), 'field' => 'parent'), - array('data' => t('Count'), 'field' => 'counter', 'sort' => 'desc'), - array('data' => t('Percent'), 'field' => 'percent'), - array('data' => t('Crawler?'), 'field' => 'is_crawler') - ); - } - elseif ($view == 'browsers') { - $result = db_query('SELECT SUM(counter) FROM {browscap_statistics} WHERE is_crawler=0'); - $total = db_result($result); - if (!$total) $total = 1; - $query = "SELECT parent,counter,(100*counter)/$total as percent FROM {browscap_statistics} WHERE is_crawler=0"; - $query_cnt = 'SELECT COUNT(parent) FROM {browscap_statistics} WHERE is_crawler=0'; - $title = t('Top browsers'); - $header = array( - array('data' => t('Browser'), 'field' => 'parent'), - array('data' => t('Count'), 'field' => 'counter', 'sort' => 'desc'), - array('data' => t('Percent'), 'field' => 'percent') - ); - } - else { - $result = db_query('SELECT SUM(counter) FROM {browscap_statistics} WHERE is_crawler=1'); - $total = db_result($result); - if (!$total) $total = 1; - $query = "SELECT parent,counter,(100*counter)/$total as percent FROM {browscap_statistics} WHERE is_crawler=1"; - $query_cnt = 'SELECT COUNT(parent) FROM {browscap_statistics} WHERE is_crawler=1'; - $title = t('Top crawlers'); - $header = array( - array('data' => t('Crawler'), 'field' => 'parent'), - array('data' => t('Count'), 'field' => 'counter', 'sort' => 'desc'), - array('data' => t('Percent'), 'field' => 'percent') - ); - } - - drupal_set_title($title); - - $query .= tablesort_sql($header); - - $result = pager_query($query, 50, 0, $query_cnt); - $rows = array(); - - while ($useragent = db_fetch_object($result)) { - if (db_result(db_query_range("SELECT useragent FROM {browscap} WHERE useragent = '%s'", $useragent->parent, 0, 1))) { - $parent = l($useragent->parent, 'admin/reports/browscap/useragent/'. urlencode($useragent->parent)); - } - else { - $parent = check_plain($useragent->parent); - } - if ($view == 'all') { - if ($useragent->is_crawler) { - $is_crawler = t('Yes'); - } - else { - $is_crawler = t('No'); - } - $rows[] = array($parent, $useragent->counter, $useragent->percent, $is_crawler); - } - else { - $rows[] = array($parent, $useragent->counter, $useragent->percent); - } - } - if ($pager = theme('pager', NULL, 50, 0)) { - $rows[] = array(array('data' => $pager, 'colspan' => 2)); - } - - $output = ''; - if (empty($rows)) { - $output .= t('It appears that your site has not recorded any visits. If you want to record the visitors to your site you can enable "Monitor browsers" on the Browscap settings screen.', array('!settings_uri' => url('admin/settings/browscap'))); - } - $output .= theme('table', $header, $rows); - - print theme('page', $output, $title); -} diff --git a/browscap.user_agent.inc b/browscap.user_agent.inc deleted file mode 100644 index 02903e4..0000000 --- a/browscap.user_agent.inc +++ /dev/null @@ -1,43 +0,0 @@ -data); - - // Find all of the user agent properties and values - foreach ($user_agent_properties as $property => $value) { - $rows[] = array(check_plain($property), check_plain($value)); - } - } - - // Create an array of table headers - $header = array( - t('Property'), - t('Value'), - ); - - // Build the table of user agent properties - $build = theme('table', $header, $rows); - - return $build; -} diff --git a/record.inc b/record.inc deleted file mode 100644 index 2af9ab4..0000000 --- a/record.inc +++ /dev/null @@ -1,62 +0,0 @@ -