b2evolution PHP Cross Reference Blogging Systems

Source: /inc/sessions/views/_stats_syndication.view.php - 89 lines - 2916 bytes - Text - Print

Description: This file implements the UI view for the syndication stats.

   1  <?php
   2  /**
   3   * This file implements the UI view for the syndication stats.
   4   *
   5   * This file is part of the evoCore framework - {@link http://evocore.net/}
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   *
  10   * {@internal License choice
  11   * - If you have received this file as part of a package, please find the license.txt file in
  12   *   the same folder or the closest folder above for complete license terms.
  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  14   *   then you must choose one of the following licenses before using the file:
  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17   * }}
  18   *
  19   * {@internal Open Source relicensing agreement:
  20   * }}
  21   *
  22   * @package admin
  23   *
  24   * @version $Id: _stats_syndication.view.php 6136 2014-03-08 07:59:48Z manuel $
  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  global $blog, $admin_url, $rsc_url, $AdminUI, $agent_type_color;
  29  
  30  echo '<h2>'.T_('Hits from RSS/Atom feed readers - Summary').get_manual_link( 'feed-hits-summary' ).'</h2>';
  31  
  32  echo '<p class="notes">'.T_('Any user agent accessing the XML feeds will be flagged as an XML reader.').'</p>';
  33  
  34  $sql = "
  35      SELECT SQL_NO_CACHE COUNT(*) AS hits, EXTRACT(YEAR FROM hit_datetime) AS year,
  36                 EXTRACT(MONTH FROM hit_datetime) AS month, EXTRACT(DAY FROM hit_datetime) AS day
  37          FROM T_hitlog
  38       WHERE hit_type = 'rss'";
  39  if( $blog > 0 )
  40  {
  41      $sql .= ' AND hit_blog_ID = '.$blog;
  42  }
  43  $sql .= ' GROUP BY year, month, day
  44                      ORDER BY year DESC, month DESC, day DESC';
  45  $res_hits = $DB->get_results( $sql, ARRAY_A, 'Get rss summary' );
  46  
  47  
  48  /*
  49   * Chart
  50   */
  51  if( count($res_hits) )
  52  {
  53      $last_date = 0;
  54  
  55      $chart[ 'chart_data' ][ 0 ] = array();
  56      $chart[ 'chart_data' ][ 1 ] = array();
  57  
  58      $count = 0;
  59      foreach( $res_hits as $row_stats )
  60      {
  61          $this_date = mktime( 0, 0, 0, $row_stats['month'], $row_stats['day'], $row_stats['year'] );
  62          if( $last_date != $this_date )
  63          { // We just hit a new day, let's display the previous one:
  64                  $last_date = $this_date;    // that'll be the next one
  65                  $count ++;
  66                  array_unshift( $chart[ 'chart_data' ][ 0 ], date( locale_datefmt(), $last_date ) );
  67                  array_unshift( $chart[ 'chart_data' ][ 1 ], 0 );
  68          }
  69          $chart [ 'chart_data' ][1][0] = $row_stats['hits'];
  70      }
  71  
  72      array_unshift( $chart[ 'chart_data' ][ 0 ], '' );
  73      array_unshift( $chart[ 'chart_data' ][ 1 ], 'XML (RSS/Atom) hits' );    // Translations need to be UTF-8
  74  
  75      // Include common chart properties:
  76      require dirname(__FILE__).'/inc/_bar_chart.inc.php';
  77  
  78      $chart[ 'series_color' ] = array (
  79              $agent_type_color['rss'],
  80          );
  81  
  82      echo '<div class="center">';
  83      load_funcs('_ext/_swfcharts.php');
  84      DrawChart( $chart );
  85      echo '</div>';
  86  
  87  }
  88  
  89  ?>

title

Description

title

Description

title

Description

title

title

Body