]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - yourls-infos.php
Menu consistency. Fixes issue 212.
[Github/YOURLS.git] / yourls-infos.php
1 <?php\r
2 // TODO: make things cleaner. This file is an awful HTML/PHP soup.\r
3 \r
4 // Require Files\r
5 require_once( dirname(__FILE__).'/includes/load-yourls.php' );\r
6 require_once( dirname(__FILE__).'/includes/functions-infos.php' );\r
7 yourls_maybe_require_auth();\r
8 \r
9 if ( !isset( $_GET['id'] ) )\r
10         yourls_redirect( YOURLS_SITE, 307 );\r
11         \r
12 $aggregate = false;\r
13 if ( isset( $_GET['all'] ) && $_GET['all'] == 1 && yourls_allow_duplicate_longurls() )\r
14         $aggregate = true;\r
15 \r
16 // Get basic infos for this shortened URL\r
17 $keyword = yourls_sanitize_string( $_GET['id'] );\r
18 $longurl = yourls_get_keyword_longurl( $keyword );\r
19 $clicks = yourls_get_keyword_clicks( $keyword );\r
20 $timestamp = yourls_get_keyword_timestamp( $keyword );\r
21 \r
22 if ( $longurl === false )\r
23         yourls_redirect( YOURLS_SITE, 307 );\r
24 \r
25 if( yourls_do_log_redirect() ) {\r
26 \r
27         // Duplicate keywords, if applicable\r
28         $keyword_list = yourls_get_duplicate_keywords( $longurl );\r
29                 \r
30         // Fetch all information from the table log\r
31         $table = YOURLS_DB_TABLE_LOG;\r
32 \r
33         if( $aggregate ) {\r
34                 $keywords = join( "', '", $keyword_list );\r
35                 // Fetch information for all keywords pointing to $longurl\r
36                 $hits = $ydb->get_results( "SELECT `keyword`, `click_time`, `referrer`, `user_agent`, `country_code` FROM `$table` WHERE `keyword` IN ( '$keywords' );" );\r
37         } else {\r
38                 // Fetch information for current keyword only\r
39                 $hits = $ydb->get_results( "SELECT `click_time`, `referrer`, `user_agent`, `country_code` FROM `$table` WHERE `keyword` = '$keyword';" );\r
40         }\r
41         \r
42         $referrers = array();\r
43         $direct = $notdirect = 0;\r
44         $countries = array();\r
45         $dates = array();\r
46         $list_of_days = array();\r
47         $list_of_months = array();\r
48         $list_of_years = array();\r
49         $last_24h = array();\r
50 \r
51         // Loop through all results and build list of referrers, countries and hits per day\r
52         foreach( (array)$hits as $hit ) {\r
53                 extract( (array)$hit );\r
54 \r
55                 if ( isset( $country_code ) && $country_code ) {\r
56                         if( !array_key_exists( $country_code, $countries ) )\r
57                                 $countries[$country_code] = 0;\r
58                         $countries[$country_code]++;\r
59                 }\r
60                 \r
61                 if( isset( $referrer ) ) {\r
62                         if ( $referrer == 'direct' ) {\r
63                                 $direct++;\r
64                         } else {\r
65                                 $notdirect++;\r
66                                 $host = yourls_get_domain( $referrer );\r
67                                 if( !array_key_exists( $host, $referrers ) )\r
68                                         $referrers[$host] = array( );\r
69                                 if( !array_key_exists( $referrer, $referrers[$host] ) )\r
70                                         $referrers[$host][$referrer] = 0;\r
71                                 $referrers[$host][$referrer]++;\r
72                         }\r
73                 }\r
74                 \r
75                 if( isset( $click_time ) ) {\r
76                         $now = intval( date('U') );\r
77 \r
78                         preg_match('/(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/', $click_time, $matches);\r
79                         list( $temp, $year, $month, $day, $hour, $min, $sec ) = $matches;\r
80                         unset( $matches );\r
81                         \r
82                         // Build array of $dates[$year][$month][$day] = number of clicks\r
83                         if( !array_key_exists( $year, $dates ) )\r
84                                 $dates[$year] = array();\r
85                         if( !array_key_exists( $month, $dates[$year] ) )\r
86                                 $dates[$year][$month] = array();\r
87                         if( !array_key_exists( $day, $dates[$year][$month] ) )\r
88                                 $dates[$year][$month][$day] = 0;\r
89                         $dates[$year][$month][$day]++;\r
90                         \r
91                         // Build array of last 24 hours $last_24h[$hour] = number of click\r
92                         $then = strtotime( $click_time);\r
93                         if( ( $now >= $then ) && ( ( $now - $then ) < ( 24 * 60 * 60 ) ) ) {\r
94                                 $year = sprintf( "%02d", substr( $year, -1, 2 ) ); // 2009 -> 09\r
95                                 $diff = $now - strtotime( $click_time);\r
96                                 if( !array_key_exists( "$year-$month-$day-$hour", $last_24h ) )\r
97                                         $last_24h["$year-$month-$day-$hour"] = 0;\r
98                                 $last_24h["$year-$month-$day-$hour"]++;\r
99                         }\r
100                 }\r
101         }\r
102 \r
103 \r
104         // Sort dates, chronologically from [2007][12][24] to [2009][02][19]\r
105         ksort( $dates );\r
106         foreach( $dates as $year=>$months ) {\r
107                 ksort( $dates[$year] );\r
108                 foreach( $months as $month=>$day ) {\r
109                         ksort( $dates[$year][$month] );\r
110                 }\r
111         }\r
112 \r
113         // Get $list_of_days, $list_of_months, $list_of_years\r
114         if( $dates ) {\r
115                 extract( yourls_build_list_of_days( $dates ) );\r
116 \r
117                 // If the $last_24h doesn't have all the hours, insert missing hours with value 0\r
118                 for ($i = 23; $i >= 0; $i--) {\r
119                         $h = date('y-m-d-H', $now - ($i * 60 * 60) );\r
120                         if( !array_key_exists( $h, $last_24h ) ) {\r
121                                 $last_24h[$h] = 0;\r
122                         }\r
123                 }\r
124                 ksort( $last_24h );\r
125         }\r
126 \r
127         // Sort countries, most frequent first\r
128         if ( $countries )\r
129                 arsort( $countries );\r
130 \r
131         // Sort referrers. $referrer_sort is a array of most frequent domains\r
132         arsort( $referrers );\r
133         $referrer_sort = array();\r
134         $number_of_sites = count( array_keys( $referrers ) );\r
135         foreach( $referrers as $site => $urls ) {\r
136                 if( count($urls) > 1 || $number_of_sites == 1 )\r
137                         $referrer_sort[$site] = array_sum( $urls );\r
138         }\r
139         arsort($referrer_sort);\r
140 \r
141 \r
142         /**\r
143         echo "<pre>";\r
144         echo "referrers: "; print_r( $referrers );\r
145         echo "referrer sort: "; print_r( $referrer_sort );\r
146         echo "direct: $direct\n";\r
147         echo "notdirect: $notdirect\n";\r
148         echo "dates: "; print_r( $dates );\r
149         echo "list of days: "; print_r( $list_of_days );\r
150         echo "list_of_months: "; print_r( $list_of_months );\r
151         echo "list_of_years: "; print_r( $list_of_years );\r
152         echo "last_24h: "; print_r( $last_24h );\r
153         //echo "countries: "; print_r( $countries );\r
154 \r
155         die();\r
156         /**/\r
157 \r
158 }\r
159 \r
160 yourls_html_head( 'infos' );\r
161 yourls_html_logo();\r
162 yourls_html_menu();\r
163 ?>\r
164 \r
165 <h2 id="informations">Information</h2>\r
166 \r
167 <h3>Short URL: <img src="<?php echo YOURLS_SITE; ?>/images/favicon.gif"/>\r
168 <?php if( $aggregate ) {\r
169         $i = 0;\r
170         foreach( $keyword_list as $k ) {\r
171                 $i++;\r
172                 if ( $i == 1 ) {\r
173                         yourls_html_link( yourls_link($k) );\r
174                 } else {\r
175                         yourls_html_link( yourls_link($k), "/$k" );\r
176                 }\r
177                 if ( $i < count( $keyword_list ) )\r
178                         echo ' + ';\r
179         }\r
180 } else {\r
181         yourls_html_link( yourls_link($keyword) );\r
182         if( count( $keyword_list ) > 1 )\r
183                 echo ' <a href="'. yourls_link($keyword).'+all" title="Aggregate stats for duplicate short URLs"><img src="' . YOURLS_SITE . '/images/chart_bar_add.png" border="0" /></a>';\r
184 } ?></h3>\r
185 <h3 id="longurl">Long URL: <img class="fix_images" src="<?php echo yourls_get_domain( $longurl, true );?>/favicon.ico"/> <?php yourls_html_link( $longurl, '', 'longurl' ); ?></h3>\r
186 \r
187 <div id="tabs">\r
188         <div class="wrap_unfloat">\r
189         <ul id="headers" class="toggle_display stat_tab">\r
190                 <?php if( yourls_do_log_redirect() ) { ?>\r
191                 <li class="selected"><a href="#stat_tab_stats"><h2>Traffic statistics</h2></a></li>\r
192                 <li><a href="#stat_tab_location"><h2>Traffic location</h2></a></li>\r
193                 <li><a href="#stat_tab_sources"><h2>Traffic sources</h2></a></li>\r
194                 <?php } ?>\r
195                 <li><a href="#stat_tab_share"><h2>Share</h2></a></li>\r
196         </ul>\r
197         </div>\r
198 \r
199                         \r
200 <?php if( yourls_do_log_redirect() ) { ?>\r
201         <div id="stat_tab_stats" class="tab">\r
202                 <h2>Traffic statistics</h2>\r
203                 \r
204                 <?php if ( $list_of_days ) { ?>\r
205                 \r
206                         <?php\r
207                         $graphs = array(\r
208                                 '24' => 'Last 24 hours',\r
209                                 '7'  => 'Last 7 days',\r
210                                 '30' => 'Last 30 days',\r
211                                 'all'=> 'All time'\r
212                         );\r
213                         \r
214                         // Which graph to generate ?\r
215                         $do_all = $do_30 = $do_7 = $do_24 = false;\r
216                         $hits_all = array_sum( $list_of_days );\r
217                         $hits_30  = array_sum( array_slice( $list_of_days, -30 ) );\r
218                         $hits_7   = array_sum( array_slice( $list_of_days, -7 ) );\r
219                         $hits_24  = array_sum( $last_24h );\r
220                         if( $hits_all > 0 )\r
221                                 $do_all = true; // graph for all days range\r
222                         if( $hits_30 > 0 && count( array_slice( $list_of_days, -30 ) ) == 30 )\r
223                                 $do_30 = true; // graph for last 30 days\r
224                         if( $hits_7 > 0 && count( array_slice( $list_of_days, -7 ) ) == 7 )\r
225                                 $do_7 = true; // graph for last 7 days\r
226                         if( $hits_24 > 0 )\r
227                                 $do_24 = true; // graph for last 24 hours\r
228                         \r
229                         // Which graph to display ?\r
230                         $display_all = $display_30 = $display_7 = $display_24 = false;\r
231                         if( $do_24 ) {\r
232                                 $display_24 = true;\r
233                         } elseif ( $do_7 ) {\r
234                                 $display_7 = true;\r
235                         } elseif ( $do_30 ) {\r
236                                 $display_30 = true;\r
237                         } elseif ( $do_all ) {\r
238                                 $display_all = true;\r
239                         }                               \r
240                         ?>\r
241 \r
242                         <table border="0" cellspacing="2">\r
243                         <tr>\r
244                                 <td valign="top">\r
245                                 <ul id="stats_lines" class="toggle_display stat_line">\r
246                                 <?php\r
247                                 if( $do_24 == true )\r
248                                         echo "<li><a href='#stat_line_24'>Last 24 hours</a>";\r
249                                 if( $do_7 == true )\r
250                                         echo "<li><a href='#stat_line_7'>Last 7 days</a>";\r
251                                 if( $do_30 == true )\r
252                                         echo "<li><a href='#stat_line_30'>Last 30 days</a>";\r
253                                 if( $do_all == true )\r
254                                         echo "<li><a href='#stat_line_all'>All time</a>";\r
255                                 ?>                              \r
256                                 </ul>\r
257                                 <?php\r
258                                 // Generate, and display if applicable, each needed graph\r
259                                 foreach( $graphs as $graph => $title ) {\r
260                                         if( ${'do_'.$graph} == true ) {\r
261                                                 $display = ( ${'display_'.$graph} === true ? 'display:block' : 'display:none' );\r
262                                                 echo "<div id='stat_line_$graph' class='stats_line line' style='$display'>";\r
263                                                 $labels_1 = $labels_2 = array();\r
264                                                 switch( $graph ) {\r
265                                                         case '24':\r
266                                                                 // each key of $last_24h is of type "yy-mm-dd-hh"\r
267                                                                 $first_key = current( array_keys( $last_24h ) );\r
268                                                                 $last_key = end( array_keys( $last_24h ) );\r
269                                                                 // Get "dd/mm" of first and last key\r
270                                                                 $first_label = preg_replace( '/\d\d-(\d\d)-(\d\d)-\d\d/', '$2/$1', $first_key );\r
271                                                                 $last_label = preg_replace( '/\d\d-(\d\d)-(\d\d)-\d\d/', '$2/$1', $last_key );\r
272                                                                 $labels_2 = array( $first_label, $last_label);\r
273                                                                 // Get hh of each key\r
274                                                                 foreach( $last_24h as $k=>$v ) {\r
275                                                                         $labels_1[] = end( explode( '-', $k ) ); // 'hh'\r
276                                                                 }\r
277                                                                 \r
278                                                                 echo "<h3>Number of hits : $title</h3>";\r
279                                                                 yourls_stats_line( $last_24h, $labels_1, $labels_2 );\r
280                                                                 break;\r
281 \r
282                                                         case '7':\r
283                                                         case '30':\r
284                                                                 // each key of $list_of_days is of type "yyyy-mm-dd"\r
285                                                                 $slice = array_slice( $list_of_days, intval( $graph ) * -1 );\r
286                                                                 foreach( $slice as $k=>$v ) {\r
287                                                                         // get "dd"\r
288                                                                         $labels_1[] = preg_replace( '/\d\d\d\d-\d\d-(\d\d)/', '$1', $k );\r
289                                                                 }\r
290                                                                 $first_key = current( array_keys( $slice ) );\r
291                                                                 $last_key = end( array_keys( $slice ) );\r
292                                                                 // Get "dd/mm" of first and last key\r
293                                                                 $first_label = preg_replace( '/\d\d\d\d-(\d\d)-(\d\d)/', '$2/$1', $first_key );\r
294                                                                 $last_label = preg_replace( '/\d\d\d\d-(\d\d)-(\d\d)/', '$2/$1', $last_key );\r
295                                                                 $labels_2 = array( $first_label, $last_label);\r
296                                                                 \r
297                                                                 echo "<h3>Number of hits : $title</h3>";\r
298                                                                 yourls_stats_line( $slice, $labels_1, $labels_2 );\r
299                                                                 unset( $slice );\r
300                                                                 break;\r
301 \r
302                                                         case 'all':\r
303                                                                 // get "yy-mm"\r
304                                                                 foreach( $list_of_days as $k=>$v ) {\r
305                                                                         $labels_1[] = preg_replace( '/\d\d(\d\d)-(\d\d)-\d\d/', '$1-$2', $k );\r
306                                                                 }\r
307                                                                 // take out duplicates\r
308                                                                 $labels_1 = array_unique( $labels_1 );\r
309                                                                 // now get "mm" only so we have all different month\r
310                                                                 foreach( $labels_1 as $k=>$v ) {\r
311                                                                         $labels_1[$k] = preg_replace( '/\d\d-(\d\d)/', '$1', $v );\r
312                                                                 }\r
313                                                                 \r
314                                                                 echo "<h3>Number of hits : $title</h3>";\r
315                                                                 $labels_1 = yourls_array_granularity( $labels_1, 30, false );\r
316                                                                 $labels_2 = yourls_array_granularity( $list_of_years, 30, false );\r
317                                                                 yourls_stats_line( $list_of_days, $labels_1, $labels_2 );\r
318                                                                 break;\r
319                                                 }\r
320                                                 echo "</div>\n";\r
321                                         }                       \r
322                                 } ?>\r
323                                 \r
324                                 </td>\r
325                                 <td valign="top">\r
326                                 <h3>Historical click count</h3>\r
327                                 <?php\r
328                                 $ago = round( (date('U') - strtotime($timestamp)) / (24* 60 * 60 ) );\r
329                                 if( $ago <= 1 ) {\r
330                                         $daysago = '';\r
331                                 } else {\r
332                                         $daysago = '(about '.$ago .' '.yourls_plural( ' day', $ago ).' ago)';\r
333                                 }\r
334                                 ?>\r
335                                 <p>Short URL created on <?php echo date("F j, Y @ g:i a", strtotime($timestamp)); ?> <?php echo $daysago; ?></p>\r
336                                 <div class="wrap_unfloat">\r
337                                         <ul class="no_bullet toggle_display stat_line" id="historical_clicks">\r
338                                         <?php\r
339                                         foreach( $graphs as $graph => $title ) {\r
340                                                 if ( ${'do_'.$graph} ) {\r
341                                                         $link = "<a href='#stat_line_$graph'>$title</a>";\r
342                                                 } else {\r
343                                                         $link = $title;\r
344                                                 }\r
345                                                 $stat = '';\r
346                                                 if( ${'do_'.$graph} ) {\r
347                                                         switch( $graph ) {\r
348                                                                 case '7':\r
349                                                                 case '30':\r
350                                                                         $stat = round( ( ${'hits_'.$graph} / intval( $graph ) ) * 100 ) / 100 . ' per day';\r
351                                                                         break;\r
352                                                                 case '24':\r
353                                                                         $stat = round( ( ${'hits_'.$graph} / 24 ) * 100 ) / 100 . ' per hour';\r
354                                                                         break;\r
355                                                                 case 'all':\r
356                                                                         if( $ago > 0 )\r
357                                                                                 $stat = round( ( ${'hits_'.$graph} / $ago ) * 100 ) / 100 . ' per day';\r
358                                                         }\r
359                                                 }\r
360                                                 $hits = yourls_plural( 'hit', ${'hits_'.$graph} );\r
361                                                 echo "<li><span class='historical_link'>$link</span> <span class='historical_count'>${'hits_'.$graph} $hits</span> $stat</li>\n";\r
362                                         }\r
363                                         ?>\r
364                                         </ul>\r
365                                 </div>\r
366                 \r
367                                 <h3>Best day</h3>\r
368                                 <?php $best = yourls_stats_get_best_day( $list_of_days ); ?>\r
369                                 <p><strong><?php echo $best['max'];?></strong> <?php echo yourls_plural( 'hit', $best['max'] ); ?> on <?php echo date("F j, Y", strtotime($best['day'])); ?>. \r
370                                 <a href="" class='details' id="more_clicks">Click for more details</a></p>\r
371                                 <ul id="details_clicks" style="display:none">\r
372                                         <?php\r
373                                         foreach( $dates as $year=>$months ) {\r
374                                                 if( count( $list_of_years ) > 1 ) {\r
375                                                         $li = "<a href='' class='details' id='more_year$year'>Year $year</a>";\r
376                                                         $display = 'none';\r
377                                                 } else {\r
378                                                         $li = "Year $year";\r
379                                                         $display = 'block';\r
380                                                 }\r
381                                                 echo "<li>$li";\r
382                                                 echo "<ul style='display:$display' id='details_year$year'>";\r
383                                                 foreach( $months as $month=>$days ) {\r
384                                                         $monthname = date("F", mktime(0, 0, 0, $month,1));\r
385                                                         if( count( $list_of_months ) > 1 ) {\r
386                                                                 $li = "<a href='' class='details' id='more_month$year$month'>$monthname</a>";\r
387                                                                 $display = 'none';\r
388                                                         } else {\r
389                                                                 $li = "$monthname";\r
390                                                                 $display = 'block';\r
391                                                         }\r
392                                                         echo "<li>$li";\r
393                                                         echo "<ul style='display:$display' id='details_month$year$month'>";\r
394                                                                 foreach( $days as $day=>$hits ) {\r
395                                                                         $class = ( $hits == $best['max'] ? 'class="bestday"' : '' );\r
396                                                                         echo "<li $class>$day: $hits". yourls_plural( ' hit', $hits) ."</li>\n";\r
397                                                                 }\r
398                                                         echo "</ul>\n";\r
399                                                 }\r
400                                                 echo "</ul>\n";\r
401                                         }\r
402                                         ?>\r
403                                 </ul>\r
404                                 \r
405                                 </td>\r
406                                 \r
407                         </tr>\r
408                         </table>\r
409 \r
410 \r
411                 \r
412                 <?php } else {\r
413                         echo "<p>No traffic yet. Get some clicks first!</p>";\r
414                 } ?>\r
415         </div>\r
416 \r
417 \r
418         <div id="stat_tab_location" class="tab">\r
419                 <h2>Traffic location</h2>\r
420                 \r
421                 <?php if ( $countries ) { ?>\r
422                         \r
423                         <table border="0" cellspacing="2">\r
424                         <tr>\r
425                                 <td valign="top">\r
426                                         <h3>Top 5 countries</h3>\r
427                                         <?php yourls_stats_pie( $countries, 5 ); ?>\r
428                                         <p><a href="" class='details' id="more_countries">Click for more details</a></p>\r
429                                         <ul id="details_countries" style="display:none" class="no_bullet">\r
430                                         <?php\r
431                                         foreach( $countries as $code=>$count ) {\r
432                                                 echo "<li><img src='".yourls_geo_get_flag( $code )."' /> $code (".yourls_geo_countrycode_to_countryname( $code ).") : $count ".yourls_plural('hit', $count)."</li>\n";\r
433                                         }               \r
434                                         ?>\r
435                                         </ul>\r
436 \r
437                                 </td>\r
438                                 <td valign="top">\r
439                                         <h3>Overall traffic</h3>\r
440                                         <?php yourls_stats_countries_map( $countries ); ?>\r
441                                 </td>\r
442                         </tr>\r
443                         </table>\r
444                 \r
445                 <?php } else {\r
446                         echo "<p>No country data.</p>";\r
447                 } ?>\r
448         </div>\r
449                                 \r
450                                 \r
451         <div id="stat_tab_sources" class="tab">\r
452                 <h2>Traffic Sources</h2>\r
453                 \r
454                 <?php if ( $referrers ) { ?>\r
455                         \r
456                         <table border="0" cellspacing="2">\r
457                         <tr>\r
458                                 <td valign="top">\r
459                                         <h3>Referrer shares</h3>\r
460                                         <?php\r
461                                         if ( $number_of_sites > 1 )\r
462                                                 $referrer_sort['Others'] = count( $referrers );\r
463                                         yourls_stats_pie( $referrer_sort, 5, '440x220', '902020,FF6060' );\r
464                                         unset( $referrer_sort['Others'] );\r
465                                         ?>\r
466                                         <h3>Referrers</h3>\r
467                                         <ul class="no_bullet">\r
468                                                 <?php\r
469                                                 $i = 0;\r
470                                                 foreach( $referrer_sort as $site => $count ) {\r
471                                                         $i++;\r
472                                                         echo "<li class='sites_list'><img src='http://$site/favicon.ico' class='fix_images'/> $site: <strong>$count</strong> <a href='' class='details' id='more_url$i'>(details)</a></li>\n";\r
473                                                         echo "<ul id='details_url$i' style='display:none'>";\r
474                                                         foreach( $referrers[$site] as $url => $count ) {\r
475                                                                 echo "<li>"; yourls_html_link($url); echo ": <strong>$count</strong></li>\n";\r
476                                                         }\r
477                                                         echo "</ul>\n";\r
478                                                         unset( $referrers[$site] );\r
479                                                 }\r
480                                                 // Any referrer left? Group in "various"\r
481                                                 if ( $referrers ) {\r
482                                                         echo "<li id='sites_various'>Various: <strong>". count( $referrers ). "</strong> <a href='' class='details' id='more_various'>(details)</a></li>\n";\r
483                                                         echo "<ul id='details_various' style='display:none'>";\r
484                                                         foreach( $referrers as $url ) {\r
485                                                                 echo "<li>"; yourls_html_link(key($url)); echo ": 1</li>\n";    \r
486                                                         }\r
487                                                         echo "</ul>\n";\r
488                                                 }\r
489                                                 ?>\r
490                                                 \r
491                                         </ul>\r
492                                 \r
493                                 </td>\r
494                                 \r
495                                 <td valign="top">\r
496                                         <h3>Direct vs Referrer Traffic</h3>\r
497                                         <?php\r
498                                         yourls_stats_pie( array('Direct'=>$direct, 'Referrers'=> $notdirect), 5, '440x220', '902020,FF6060' );\r
499                                         ?>\r
500                                         <p>Direct traffic: <strong><?php echo $direct; ?></strong> <?php echo yourls_plural( 'hit', $direct ); ?> </p>\r
501                                         <p>Referrer traffic: <strong><?php echo $notdirect; ?></strong> <?php echo yourls_plural( 'hit', $notdirect ); ?> </p>\r
502 \r
503                                 </td>\r
504                         </tr>\r
505                         </table>\r
506 \r
507                 <?php } else {\r
508                         echo "<p>No referrer data.</p>";\r
509                 } ?>\r
510                         \r
511         </div>\r
512 \r
513 <?php } // endif do log redirect ?>\r
514 \r
515 \r
516         <div id="stat_tab_share" class="tab">\r
517                 <h2>Share</h2>\r
518                 \r
519                 <?php yourls_share_box( $longurl, yourls_link($keyword), '', '', '<h3>Short link</h3>', '<h3>Quick Share</h3>'); ?>\r
520 \r
521         </div>\r
522         \r
523 </div>\r
524 \r
525 \r
526 <?php yourls_html_footer(); ?>\r