Changeset 527 for trunk/admin/stats.php


Ignore:
Timestamp:
Sep 20, 2004, 12:26:41 AM (20 years ago)
Author:
gweltas
Message:
  • dispatch of configuration
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/stats.php

    r362 r527  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
    27 include_once( './admin/include/isadmin.inc.php' );
     27if( !defined("PHPWG_ROOT_PATH") )
     28{
     29        die ("Hacking attempt!");
     30}
     31include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    2832$max_pixels = 500;
    2933//------------------------------------------------------------ comment deletion
    3034if ( isset( $_GET['del'] ) and is_numeric( $_GET['del'] ) )
    3135{
    32   $query = 'DELETE FROM '.PREFIX_TABLE.'comments';
     36  $query = 'DELETE FROM '.COMMENTS_TABLE;
    3337  $query.= ' WHERE id = '.$_GET['del'];
    3438  $query.= ';';
     
    3842if ( isset( $_GET['act'] ) and $_GET['act'] == 'empty' )
    3943{
    40   $query = 'DELETE FROM '.PREFIX_TABLE.'history';
    41   $query.= ';';
     44  $query = 'DELETE FROM '.HISTORY_TABLE.';';
    4245  mysql_query( $query );
    4346}
     47
     48// empty link
     49$url_empty = PHPWG_ROOT_PATH.'admin.php?page=stats';
     50if (isset($_GET['last_days']))
     51        $url_empty .='&last_days='.$_GET['last_days'];
     52$url_empty.= '&act=empty';
    4453//----------------------------------------------------- template initialization
    45 $sub = $vtp->Open( './template/'.$user['template'].'/admin/stats.vtp' );
    46 $tpl = array( 'stats_last_days','date','login',
    47               'IP','file','picture','category','stats_pages_seen',
    48               'stats_visitors','stats_empty', 'stats_pages_seen_graph_title',
    49               'stats_visitors_graph_title');
    50 templatize_array( $tpl, 'lang', $sub );
    51 $vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
    52 //--------------------------------------------------- number of days to display
     54$template->set_filenames( array('stats'=>'admin/stats.tpl') );
     55
    5356if ( isset( $_GET['last_days'] ) ) define( 'MAX_DAYS', $_GET['last_days'] );
    5457else                               define( 'MAX_DAYS', 0 );
    5558
    5659foreach ( $conf['last_days'] as $option ) {
    57   $vtp->addSession( $sub, 'last_day_option' );
    58   $vtp->setVar( $sub, 'last_day_option.option', $option );
    59   $url = './admin.php?page=stats';
    60   if (isset($_GET['expand']))
    61           $url .='&expand='.$_GET['expand'];
    62   $url.= '&last_days='.($option - 1);
    63   $vtp->setVar( $sub, 'last_day_option.link', add_session_id( $url ) );
    64   if ( $option == MAX_DAYS + 1 )
    65   {
    66     $vtp->setVar( $sub, 'last_day_option.style', 'font-weight:bold;');
    67   }
    68   $vtp->closeSession( $sub, 'last_day_option' );
    69 }
    70 //---------------------------------------------------------------- log  history
    71 // empty link
    72 $url = './admin.php?page=stats';
    73 if (isset($_GET['last_days']))
    74         $url .='&last_days='.$_GET['last_days'];
    75 // expand array management
    76 $expand_days = array();
    77 if (isset($_GET['expand']))
    78 {
    79         $url.= '&expand='.$_GET['expand'];
    80         $expand_days = explode( ',', $_GET['expand'] );
    81 }
    82 $url.= '&act=empty';
    83 $vtp->setVar( $sub, 'emply_url', add_session_id( $url ) );
    84 $page['expand_days'] = array();
    85 foreach ( $expand_days as $expand_day ) {
    86   if ( is_numeric( $expand_day ) )
    87   {
    88     array_push( $page['expand_days'], $expand_day );
    89   }
     60  $url = $_SERVER['PHP_SELF'].'?last_days='.($option - 1);
     61  $url.= '&page=stats';
     62  $template->assign_block_vars(
     63    'last_day_option',
     64    array(
     65      'OPTION'=>$option,
     66      'T_STYLE'=>(( $option == MAX_DAYS + 1 )?'text-decoration:underline;':''),
     67      'U_OPTION'=>add_session_id( $url )
     68      )
     69    );
    9070}
    9171
     72$template->assign_vars(array(
     73  'L_STAT_LASTDAYS'=>$lang['stats_last_days'],
     74  'L_STAT_DATE'=>$lang['date'],
     75  'L_STAT_LOGIN'=>$lang['login'],
     76  'L_STAT_IP'=>$lang['IP'],
     77  'L_STAT_FILE'=>$lang['file'],
     78  'L_STAT_CATEGORY'=>$lang['category'],
     79  'L_STAT_PICTURE'=>$lang['picture'],
     80  'L_STAT_EMPTY'=>$lang['stats_empty'],
     81  'L_STAT_SEEN'=>$lang['stats_pages_seen'],
     82  'L_STAT_VISITOR'=>$lang['stats_visitors'],
     83 
     84  'STAT_EMPTY_URL'=>$url_empty
     85  ));
     86
     87$tpl = array( 'stats_pages_seen_graph_title', 'stats_visitors_graph_title');
     88
     89//---------------------------------------------------------------- log  history
    9290$days = array();
    9391$max_nb_visitors = 0;
     
    9997{
    10098  $day = array();
    101   $vtp->addSession( $sub, 'day' );
     99  $template->assign_block_vars('day',array(
     100    ));
     101 
    102102  // link to open the day to see details
    103103  $local_expand = $page['expand_days'];
     
    169169  $endtime  -= 24*60*60;
    170170  $vtp->closeSession( $sub, 'day' );
    171   array_push( $days, $day );
     171  array_push( $days, $day );*/
    172172}
    173173//------------------------------------------------------------ pages seen graph
    174174foreach ( $days as $day ) {
    175   $vtp->addSession( $sub, 'pages_day' );
     175  /*$vtp->addSession( $sub, 'pages_day' );
    176176  if ( $max_pages_seen > 0 )
    177177    $width = floor( ( $day['nb_pages_seen']*$max_pixels ) / $max_pages_seen );
     
    180180  $vtp->setVar( $sub, 'pages_day.width', $width );
    181181  $vtp->setVar( $sub, 'pages_day.nb_pages', $day['nb_pages_seen'] );
    182   $vtp->closeSession( $sub, 'pages_day' );
     182  $vtp->closeSession( $sub, 'pages_day' );*/
    183183}
    184184//-------------------------------------------------------------- visitors grpah
    185185foreach ( $days as $day ) {
    186   $vtp->addSession( $sub, 'visitors_day' );
     186  /*$vtp->addSession( $sub, 'visitors_day' );
    187187  if ( $max_nb_visitors > 0 )
    188188    $width = floor( ( $day['nb_visitors'] * $max_pixels ) / $max_nb_visitors );
     
    191191  $vtp->setVar( $sub, 'visitors_day.width', $width );
    192192  $vtp->setVar( $sub, 'visitors_day.nb_visitors', $day['nb_visitors'] );
    193   $vtp->closeSession( $sub, 'visitors_day' );
     193  $vtp->closeSession( $sub, 'visitors_day' );*/
    194194}
    195195//----------------------------------------------------------- sending html code
    196 $vtp->Parse( $handle , 'sub', $sub );
     196$template->assign_var_from_handle('ADMIN_CONTENT', 'stats');
    197197?>
Note: See TracChangeset for help on using the changeset viewer.