Changeset 527 for trunk/admin/stats.php
- Timestamp:
- Sep 20, 2004, 12:26:41 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/stats.php
r362 r527 25 25 // | USA. | 26 26 // +-----------------------------------------------------------------------+ 27 include_once( './admin/include/isadmin.inc.php' ); 27 if( !defined("PHPWG_ROOT_PATH") ) 28 { 29 die ("Hacking attempt!"); 30 } 31 include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' ); 28 32 $max_pixels = 500; 29 33 //------------------------------------------------------------ comment deletion 30 34 if ( isset( $_GET['del'] ) and is_numeric( $_GET['del'] ) ) 31 35 { 32 $query = 'DELETE FROM '. PREFIX_TABLE.'comments';36 $query = 'DELETE FROM '.COMMENTS_TABLE; 33 37 $query.= ' WHERE id = '.$_GET['del']; 34 38 $query.= ';'; … … 38 42 if ( isset( $_GET['act'] ) and $_GET['act'] == 'empty' ) 39 43 { 40 $query = 'DELETE FROM '.PREFIX_TABLE.'history'; 41 $query.= ';'; 44 $query = 'DELETE FROM '.HISTORY_TABLE.';'; 42 45 mysql_query( $query ); 43 46 } 47 48 // empty link 49 $url_empty = PHPWG_ROOT_PATH.'admin.php?page=stats'; 50 if (isset($_GET['last_days'])) 51 $url_empty .='&last_days='.$_GET['last_days']; 52 $url_empty.= '&act=empty'; 44 53 //----------------------------------------------------- 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 53 56 if ( isset( $_GET['last_days'] ) ) define( 'MAX_DAYS', $_GET['last_days'] ); 54 57 else define( 'MAX_DAYS', 0 ); 55 58 56 59 foreach ( $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 ); 90 70 } 91 71 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 92 90 $days = array(); 93 91 $max_nb_visitors = 0; … … 99 97 { 100 98 $day = array(); 101 $vtp->addSession( $sub, 'day' ); 99 $template->assign_block_vars('day',array( 100 )); 101 102 102 // link to open the day to see details 103 103 $local_expand = $page['expand_days']; … … 169 169 $endtime -= 24*60*60; 170 170 $vtp->closeSession( $sub, 'day' ); 171 array_push( $days, $day ); 171 array_push( $days, $day );*/ 172 172 } 173 173 //------------------------------------------------------------ pages seen graph 174 174 foreach ( $days as $day ) { 175 $vtp->addSession( $sub, 'pages_day' );175 /*$vtp->addSession( $sub, 'pages_day' ); 176 176 if ( $max_pages_seen > 0 ) 177 177 $width = floor( ( $day['nb_pages_seen']*$max_pixels ) / $max_pages_seen ); … … 180 180 $vtp->setVar( $sub, 'pages_day.width', $width ); 181 181 $vtp->setVar( $sub, 'pages_day.nb_pages', $day['nb_pages_seen'] ); 182 $vtp->closeSession( $sub, 'pages_day' ); 182 $vtp->closeSession( $sub, 'pages_day' );*/ 183 183 } 184 184 //-------------------------------------------------------------- visitors grpah 185 185 foreach ( $days as $day ) { 186 $vtp->addSession( $sub, 'visitors_day' );186 /*$vtp->addSession( $sub, 'visitors_day' ); 187 187 if ( $max_nb_visitors > 0 ) 188 188 $width = floor( ( $day['nb_visitors'] * $max_pixels ) / $max_nb_visitors ); … … 191 191 $vtp->setVar( $sub, 'visitors_day.width', $width ); 192 192 $vtp->setVar( $sub, 'visitors_day.nb_visitors', $day['nb_visitors'] ); 193 $vtp->closeSession( $sub, 'visitors_day' ); 193 $vtp->closeSession( $sub, 'visitors_day' );*/ 194 194 } 195 195 //----------------------------------------------------------- sending html code 196 $ vtp->Parse( $handle , 'sub', $sub);196 $template->assign_var_from_handle('ADMIN_CONTENT', 'stats'); 197 197 ?>
Note: See TracChangeset
for help on using the changeset viewer.