| [ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI view for the referer 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-2007 by Francois PLANQUE - {@link http://fplanque.net/} 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_referers.view.php,v 1.1 2007/06/25 11:01:04 fplanque Exp $ 25 */ 26 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 27 28 /** 29 * View funcs 30 */ 31 require_once dirname(__FILE__).'/_stats_view.funcs.php'; 32 33 34 global $blog, $admin_url, $rsc_url; 35 36 ?> 37 <h2><?php echo T_('Refered browser hits') ?>:</h2> 38 <p><?php echo T_('These are browser hits from external web pages refering to this blog') ?>.</p> 39 <?php 40 // Create result set: 41 $Results = & new Results( " 42 SELECT hit_ID, hit_datetime, hit_referer, dom_name, hit_blog_ID, hit_uri, hit_remote_addr, blog_shortname 43 FROM T_hitlog INNER JOIN T_basedomains ON dom_ID = hit_referer_dom_ID 44 INNER JOIN T_sessions ON hit_sess_ID = sess_ID 45 INNER JOIN T_useragents ON hit_agnt_ID = agnt_ID 46 LEFT JOIN T_blogs ON hit_blog_ID = blog_ID 47 WHERE hit_referer_type = 'referer' 48 AND agnt_type = 'browser'" 49 .( empty($blog) ? '' : "AND hit_blog_ID = $blog "), 'lstref_', 'D' ); 50 51 $Results->title = T_('Refered browser hits'); 52 53 // datetime: 54 $Results->cols[0] = array( 55 'th' => T_('Date Time'), 56 'order' => 'hit_datetime', 57 'td_class' => 'timestamp', 58 'td' => '%mysql2localedatetime_spans( \'$hit_datetime$\' )%', 59 ); 60 61 // Referer: 62 $Results->cols[1] = array( 63 'th' => T_('Referer'), 64 'order' => 'dom_name', 65 ); 66 if( $current_User->check_perm( 'stats', 'edit' ) ) 67 { 68 $Results->cols[1]['td'] = '<a href="%regenerate_url( \'action\', \'action=delete&hit_ID=$hit_ID$\')%" title="' 69 .T_('Delete this hit!').'">'.get_icon( 'delete' ).'</a> ' 70 71 .'<a href="%regenerate_url( \'action\', \'action=changetype&new_hit_type=search&hit_ID=$hit_ID$\')%" title="' 72 .T_('Log as a search instead') 73 .'"><img src="'.$rsc_url.'icons/magnifier.png" width="14" height="13" class="middle" alt="' 74 ./* TRANS: Abbrev. for "move to searches" (stats) */ T_('->S') 75 .'" title="'.T_('Log as a search instead').'" /></a> ' 76 77 .'<a href="$hit_referer$">$dom_name$</a>'; 78 } 79 else 80 { 81 $Results->cols[1]['td'] = '<a href="$hit_referer$">$dom_name$</a>'; 82 } 83 84 // Antispam: 85 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) 86 { 87 /** 88 * @uses get_ban_domain() 89 * @param string URL 90 * @return string Link to ban the URL 91 */ 92 function referer_ban_link( $uri ) 93 { 94 return '<a href="?ctrl=antispam&action=ban&keyword='.rawurlencode( get_ban_domain( $uri ) ) 95 .'" title="'.T_('Ban this domain!').'">'.get_icon('ban').'</a>'; 96 } 97 $Results->cols[] = array( 98 'th' => /* TRANS: Abbrev. for Spam */ T_('S'), 99 'td' => '%referer_ban_link( #hit_referer# )%', // we use hit_referer, because unlike dom_name it includes more subdomains, especially "www." 100 ); 101 } 102 103 // Target Blog: 104 if( empty($blog) ) 105 { 106 $Results->cols[] = array( 107 'th' => T_('Target Blog'), 108 'order' => 'hit_blog_ID', 109 'td' => '$blog_shortname$', 110 ); 111 } 112 113 // Requested URI (linked to blog's baseurlroot+URI): 114 $Results->cols[] = array( 115 'th' => T_('Requested URI'), 116 'order' => 'hit_uri', 117 'td' => '%stats_format_req_URI( #hit_blog_ID#, #hit_uri# )%', 118 ); 119 120 // Remote address (IP): 121 $Results->cols[] = array( 122 'th' => '<span title="'.T_('Remote address').'">'.T_('IP').'</span>', 123 'order' => 'hit_remote_addr', 124 'td' => '% $GLOBALS[\'Plugins\']->get_trigger_event( \'FilterIpAddress\', $tmp_params = array(\'format\'=>\'htmlbody\', \'data\'=>\'$hit_remote_addr$\') ) %', 125 ); 126 127 128 // Display results: 129 $Results->display(); 130 131 ?> 132 <h3><?php echo T_('Top referers') ?>:</h3> 133 134 <?php 135 // TODO: re-use $Results from above 136 global $res_stats, $row_stats; 137 refererList( 30, 'global', 0, 0, "'referer'", 'dom_name', $blog, true ); 138 if( count( $res_stats ) ) 139 { 140 $chart [ 'chart_data' ][ 0 ][ 0 ] = ""; 141 $chart [ 'chart_data' ][ 1 ][ 0 ] = 'Top referers'; // Needs UTF-8 142 143 $count = 0; 144 foreach( $res_stats as $row_stats ) 145 { 146 if( $count < 8 ) 147 { 148 $count++; 149 $chart [ 'chart_data' ][ 0 ][ $count ] = stats_basedomain( false ); 150 } 151 else 152 { 153 $chart [ 'chart_data' ][ 0 ][ $count ] = 'Others'; // Needs UTF-8 154 } 155 $chart [ 'chart_data' ][ 1 ][ $count ] = stats_hit_count( false ); 156 } // End stat loop 157 158 $chart[ 'canvas_bg' ] = array ( 159 'width' => 780, 160 'height' => 350, 161 'color' => 'efede0' 162 ); 163 164 $chart[ 'chart_rect' ] = array ( 165 'x' => 60, 166 'y' => 50, 167 'width' => 250, 168 'height' => 250 169 ); 170 171 $chart[ 'legend_rect' ] = array ( 172 'x' => 400, 173 'y' => 70, 174 'width' => 340, 175 'height' => 230, 176 'margin' => 6 177 ); 178 179 $chart[ 'draw_text' ] = array ( 180 array ( 181 'color' => '9e9286', 182 'alpha' => 75, 183 'font' => "arial", 184 'rotation' => 0, 185 'bold' => true, 186 'size' => 42, 187 'x' => 50, 188 'y' => 6, 189 'width' => 700, 190 'height' => 50, 191 'text' => 'Top referers', 192 'h_align' => "right", 193 'v_align' => "bottom" ), 194 ); 195 196 $chart[ 'chart_bg' ] = array ( 197 'positive_color' => "ffffff", 198 // 'negative_color' => string, 199 'positive_alpha' => 20, 200 // 'negative_alpha' => int 201 ); 202 203 $chart [ 'legend_bg' ] = array ( 204 'bg_color' => "ffffff", 205 'bg_alpha' => 20, 206 // 'border_color' => "000000", 207 // 'border_alpha' => 100, 208 // 'border_thickness' => 1 209 ); 210 211 $chart [ 'legend_label' ] = array( 212 // 'layout' => "horizontal", 213 // 'font' => string, 214 // 'bold' => boolean, 215 'size' => 15, 216 // 'color' => string, 217 // 'alpha' => int 218 ); 219 220 /*$chart[ 'chart_border' ] = array ( 221 'color'=>"000000", 222 'top_thickness'=>1, 223 'bottom_thickness'=>1, 224 'left_thickness'=>1, 225 'right_thickness'=>1 226 );*/ 227 228 $chart[ 'chart_type' ] = 'pie'; 229 230 // $chart[ 'series_color' ] = array ( "4e627c", "c89341" ); 231 232 $chart [ 'series_explode' ] = array ( 15 ); 233 234 /*$chart[ 'axis_category' ] = array ( 235 'font' =>"arial", 236 'bold' =>true, 237 'size' =>11, 238 'color' =>'000000', 239 'alpha' =>75, 240 'orientation' => 'diagonal_up', 241 // 'skip'=>2 242 );*/ 243 244 /* $chart[ 'axis_value' ] = array ( // 'font' =>"arial", 245 // 'bold' =>true, 246 'size' => 11, 247 'color' => '000000', 248 'alpha' => 75, 249 'steps' => 4, 250 'prefix' => "", 251 'suffix' => "", 252 'decimals'=> 0, 253 'separator'=> "", 254 'show_min'=> false ); */ 255 256 $chart[ 'chart_value' ] = array ( 257 // 'prefix' => string, 258 // 'suffix' => " views", 259 // 'decimals' => int, 260 // 'separator' => string, 261 'position' => "outside", 262 'hide_zero' => true, 263 'as_percentage' => true, 264 'font' => "arial", 265 'bold' => true, 266 'size' => 20, 267 'color' => "000000", 268 'alpha' => 75 269 ); 270 271 //pre_dump( $chart ); 272 echo '<div class="center">'; 273 DrawChart( $chart ); 274 echo '</div>'; 275 276 ?> 277 <table class="grouped" cellspacing="0"> 278 <?php 279 $count = 0; 280 foreach( $res_stats as $row_stats ) 281 { 282 ?> 283 <tr <?php if( $count%2 == 1 ) echo 'class="odd"'; ?>> 284 <td class="firstcol"><a href="<?php stats_referer() ?>"><?php stats_basedomain() ?></a></td> 285 <?php 286 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) 287 { // user can ban: 288 echo '<td>'.action_icon( T_('Ban this domain!'), 'ban', regenerate_url( 'ctrl,action,keyword', 'ctrl=antispam&action=ban&keyword='.rawurlencode( get_ban_domain($row_stats['hit_referer']) ) ) ).'</td>'; // we use hit_referer, because unlike dom_name it includes subdomains (especially 'www.') 289 } 290 ?> 291 <td class="right"><?php stats_hit_count() ?></td> 292 <td class="right"><?php stats_hit_percent() ?></td> 293 </tr> 294 <?php 295 $count++; 296 } 297 ?> 298 </table> 299 <?php } ?> 300 <p><?php echo T_('Total referers') ?>: <?php stats_total_hit_count() ?></p> 301 302 <?php 303 304 /* 305 * $Log: _stats_referers.view.php,v $ 306 * Revision 1.1 2007/06/25 11:01:04 fplanque 307 * MODULES (refactored MVC) 308 * 309 * Revision 1.5 2007/04/26 00:11:13 fplanque 310 * (c) 2007 311 * 312 * Revision 1.4 2007/03/20 09:53:26 fplanque 313 * Letting boggers view their own stats. 314 * + Letthing admins view the aggregate by default. 315 * 316 * Revision 1.3 2006/11/24 18:27:26 blueyed 317 * Fixed link to b2evo CVS browsing interface in file docblocks 318 */ 319 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
|