Пример #1
0
function spyview($from_date = "", $to_date = "", $rows = "999", $spytype = "")
{
    global $wpdb;
    $whereis = "";
    if ($spytype == 'spider') {
        $whereis = " AND spider!=''";
    } elseif ($spytype == 'nospider') {
        $whereis = " AND spider=''";
    } elseif ($spytype == 'spam') {
        $whereis = " AND spam>0";
    } elseif ($spytype == 'nospam') {
        $whereis = " AND spam=0";
    } elseif ($spytype == 'nospamspider') {
        $whereis = " AND spam=0 AND spider=''";
    } elseif ($spytype == 'searchengine') {
        $whereis = " AND searchengine!='' AND search!=''";
    } elseif ($spytype == 'referrer') {
        $whereis = " AND referrer!='' AND referrer NOT LIKE '%{$wpurl}%' AND searchengine='' AND search=''";
    } elseif ($spytype == 'comauthor') {
        $whereis = " AND comment_author!=''";
    } elseif ($spytype == 'loggedin') {
        $whereis = " AND username!=''";
    }
    //check for arguments...
    if (empty($to_date)) {
        $to_date = wassup_get_time();
    }
    if (empty($from_date)) {
        $from_date = $to_date - 5;
    }
    $table_tmp_name = $wpdb->prefix . "wassup_tmp";
    if (function_exists('get_option')) {
        $wassup_settings = get_option('wassup_settings');
    }
    if (!empty($wassup_settings['wassup_screen_res'])) {
        $screen_res_size = (int) $wassup_settings['wassup_screen_res'];
    } else {
        $screen_res_size = 670;
    }
    $max_char_len = $screen_res_size / 10;
    if (function_exists('get_bloginfo')) {
        $wpurl = get_bloginfo('wpurl');
        $siteurl = get_bloginfo('siteurl');
    }
    $qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM {$table_tmp_name} WHERE timestamp BETWEEN {$from_date} AND {$to_date} {$whereis} GROUP BY id ORDER BY max_timestamp DESC");
    if (!empty($qryC)) {
        //restrict # of rows to display when needed...
        $row_count = 0;
        //display the rows...
        foreach ($qryC as $cv) {
            if ($row_count < (int) $rows) {
                $timestamp = $cv->max_timestamp;
                $ip = @explode(",", $cv->ip);
                if ($cv->referrer != '') {
                    if (!eregi($wpurl, $cv->referrer) or $cv->searchengine != "") {
                        if (!eregi($wpurl, $cv->referrer) and $cv->searchengine == "") {
                            $referrer = '<a href="' . $cv->referrer . '" target=_"BLANK"><span style="font-weight: bold;">' . stringShortener($cv->referrer, round($max_char_len * 0.8, 0)) . '</span></a>';
                        } else {
                            $referrer = '<a href="' . $cv->referrer . '" target=_"BLANK">' . stringShortener($cv->referrer, round($max_char_len * 0.9, 0)) . '</a>';
                        }
                    } else {
                        $referrer = __('From your blog', 'wassup');
                    }
                } else {
                    $referrer = __('Direct hit', 'wassup');
                }
                // User is logged in or is a comment's author
                if ($cv->username != "") {
                    $unclass = "-log";
                    $map_icon = "marker_loggedin.png";
                } elseif ($cv->comment_author != "" and $cv->username == "") {
                    $unclass = "-aut";
                    $map_icon = "marker_author.png";
                } elseif ($cv->spider != "") {
                    $unclass = "-spider";
                    $map_icon = "marker_bot.png";
                } else {
                    $map_icon = "marker_user.png";
                }
                // Start getting GEOIP info
                $geo_url = "http://api.hostip.info/get_html.php?ip=" . $ip[0] . "&position=true";
                $data = file($geo_url);
                if (eregi("unknown", $data[0])) {
                    $loc_country = eregi_replace("country: ", "", $data[0]);
                }
                if (eregi("unknown", $data[1])) {
                    $loc_city = eregi_replace("city: ", "", $data[1]);
                }
                $geoloc = $loc_country . " " . $loc_city;
                if ($wassup_settings['wassup_geoip_map'] == 1) {
                    $gkey = $wassup_settings['wassup_googlemaps_key'];
                    if ($geoloc != "") {
                        $geocode = geocode($geoloc, $gkey);
                        if ($geocode[0] != 200) {
                            $lat = explode(":", $data[2]);
                            $lat = $lat[1];
                            $lon = explode(":", $data[3]);
                            $lon = $lon[1];
                        } else {
                            $lat = $geocode[2];
                            $lon = $geocode[3];
                        }
                    } else {
                        $lat = 0;
                        $lon = 0;
                    }
                }
                $location = $data[0] . " - " . $data[1];
                ?>
		   <div class="sum-spy">
		   <span class="sum-box<?php 
                print $unclass;
                ?>
">
		   	<?php 
                print $ip[0];
                ?>
</span>
		   <div class="sum-det-spy"><span class="det1">
		   <?php 
                print '<a href="' . wAddSiteurl(htmlspecialchars(html_entity_decode($cv->urlrequested))) . '" target="_BLANK">';
                print stringShortener(html_entity_decode($cv->urlrequested), round($max_char_len * 0.9, 0));
                ?>
		   </a></span><br />
		   <span class="det2"><strong><?php 
                print gmdate("H:i:s", $timestamp);
                ?>
 - </strong>
		   <?php 
                print $referrer;
                ?>
		   <?php 
                print "<br />" . $location;
                //DEBUG ."$geocode[0]." / ".$lat." / ".$lon;
                ?>
		   </span>
		   </div></div>
<?php 
                // Print the JS code to add marker on the map
                if ($wassup_settings['wassup_geoip_map'] == 1) {
                    if ($lat != 0 && $lon != 0) {
                        $item_id = $cv->id;
                        $img_dir = $wpurl . '/wp-content/plugins/' . WASSUPFOLDER . '/img';
                        echo "\n                <script type=\"text/javascript\">\n                var icon{$item_id} = new GIcon();\n                icon{$item_id}.image = '" . $img_dir . "/" . $map_icon . "';\n                icon{$item_id}.shadow = '{$img_dir}/shadow.png';\n                icon{$item_id}.iconSize = new GSize(20.0, 34.0);\n                icon{$item_id}.shadowSize = new GSize(38.0, 34.0);\n                icon{$item_id}.iconAnchor = new GPoint(10.0, 17.0);\n                icon{$item_id}.infoWindowAnchor = new GPoint(10.0, 17.0);\n                var point = new GLatLng({$lat},{$lon});\n                var marker{$item_id} = new GMarker(point, icon{$item_id});\n                map.addOverlay(marker{$item_id});\n                GEvent.addListener(marker{$item_id}, 'click', function() {\n                marker{$item_id}.openInfoWindowHtml('<div style=\"white-space:nowrap\"><div class=\"bubble\">Ip: " . $ip[0] . "<br />Hour: " . gmdate('H:i:s', $timestamp) . "<br />Request: <a href=" . wAddSiteurl(htmlspecialchars(html_entity_decode($cv->urlrequested))) . " target=\"_BLANK\">" . stringShortener(html_entity_decode($cv->urlrequested), round($max_char_len * 0.9, 0)) . "</a><br />" . "</div></div>');\n                });\n                map.panTo(new GLatLng({$lat},{$lon}),3);\n                </script>";
                    }
                }
            }
            //end if row_count
            $row_count = $row_count + 1;
        }
        //end foreach
    } else {
        //display "no activity" periodically so we know spy is running...
        if ((int) $to_date % 7 == 0) {
            echo '<div class="sum-spy"><span class="det3">' . gmdate("H:i:s", $to_date) . ' - ' . __("No visitor activity", "wassup") . ' &nbsp; &nbsp; :-( &nbsp; </span></div>';
        }
    }
    //end if !empty($qryC)
}
Пример #2
0
function WassUp() {
        global $wpdb, $wp_version, $version, $wpurl, $wassup_options, $whash;
	
	// Start getting time of execution to debug SQL query
	$mtime = microtime();
	$mtime = explode(" ",$mtime);
	$mtime = $mtime[1] + $mtime[0];
	$starttime = $mtime;
	// This could be commented out

	//#debug...
	//error_reporting(E_ALL | E_STRICT);	//debug, E_STRICT=php5 only
	//ini_set('display_errors','On');	//debug
	//$wpdb->show_errors();	//debug

        $table_name = $wpdb->prefix . "wassup";
        $table_tmp_name = $wpdb->prefix . "wassup_tmp";
	$wassup_options->loadSettings();	//needed in case "update_option is run elsewhere in wassup (widget)

	// RUN THE SAVE/RESET OPTIONS
	$admin_message="";
	if (isset($_POST['submit-options']) || 
	    isset($_POST['submit-options2']) || 
	    isset($_POST['submit-options3'])) {
		if ($_POST['wassup_remind_flag'] == 1 AND $_POST['wassup_remind_mb'] == "") {
			$wassup_options->wassup_remind_flag = $_POST['wassup_remind_flag'];
			$wassup_options->wassup_remind_mb = 10;
		} else {
			$wassup_options->wassup_remind_flag = $_POST['wassup_remind_flag'];
			$wassup_options->wassup_remind_mb = $_POST['wassup_remind_mb'];
		}
		$wassup_options->wassup_active = $_POST['wassup_active'];
		$wassup_options->wassup_chart_type = $_POST['wassup_chart_type'];
		$wassup_options->wassup_loggedin = $_POST['wassup_loggedin'];
		$wassup_options->wassup_spider = $_POST['wassup_spider'];
		$wassup_options->wassup_attack = $_POST['wassup_attack'];
		$wassup_options->wassup_hack = $_POST['wassup_hack'];
		$wassup_options->wassup_spamcheck = $_POST['wassup_spamcheck'];
		$wassup_options->wassup_spam = $_POST['wassup_spam'];
		$wassup_options->wassup_refspam = $_POST['wassup_refspam'];
		$wassup_options->wassup_exclude = $_POST['wassup_exclude'];
		$wassup_options->wassup_exclude_url = $_POST['wassup_exclude_url'];
		$wassup_options->delete_auto = $_POST['delete_auto'];
		$wassup_options->delete_auto_size = $_POST['delete_auto_size'];
		$wassup_options->wassup_screen_res = $_POST['wassup_screen_res'];
		$wassup_options->wassup_refresh = $_POST['wassup_refresh'];
		$wassup_options->wassup_userlevel = $_POST['wassup_userlevel'];
		$wassup_options->wassup_dashboard_chart = $_POST['wassup_dashboard_chart'];
		$wassup_options->wassup_geoip_map = $_POST['wassup_geoip_map'];
		$wassup_options->wassup_googlemaps_key = $_POST['wassup_googlemaps_key'];
		$wassup_options->wassup_time_format = $_POST['wassup_time_format'];
		$wassup_options->wassup_default_type = $_POST['wassup_default_type'];
		$wassup_options->wassup_default_limit = $_POST['wassup_default_limit'];
                $top_ten = array("topsearch" => $_POST['topsearch'],
                                "topreferrer" => $_POST['topreferrer'],
                                "toprequest" => $_POST['toprequest'],
                                "topbrowser" => $_POST['topbrowser'],
                                "topos" => $_POST['topos'],
                                "toplocale" => $_POST['toplocale'],
				"topvisitor" => $_POST['topvisitor'],
                                "topfeed" => "0",
                                "topcrawler" => "0",
                                "topreferrer_exclude" => $_POST['topreferrer_exclude']);
                $wassup_options->wassup_top10 = serialize($top_ten);
		/* if ( $_POST['wassup_savepath'] != $wassup_options->wassup_savepath ) {
			if (empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == getSessionpath()) {
				$wassup_options->wassup_savepath = NULL;
			} else {
				$wassup_options->setSavepath($_POST['wassup_savepath']);
			}
		} */
		if ($wassup_options->saveSettings()) {
			$admin_message = __("Wassup options updated successfully","wassup")."." ;
		}
	} elseif (isset($_POST['submit-options4'])) {	//uninstall checkbox
		$wassup_options->wassup_uninstall = $_POST['wassup_uninstall'];
		if ($wassup_options->saveSettings()) {
			$admin_message = __("Wassup uninstall option updated successfully","wassup")."." ;
		}
	} elseif (isset($_POST['submit-spam'])) {
		$wassup_options->wassup_spamcheck = $_POST['wassup_spamcheck'];
		$wassup_options->wassup_spam = $_POST['wassup_spam'];
		$wassup_options->wassup_refspam = $_POST['wassup_refspam'];
		if ($wassup_options->saveSettings()) {
			$admin_message = __("Wassup spam options updated successfully","wassup")."." ;
		}
	} elseif (isset($_POST['reset-to-default'])) {
		$wassup_options->loadDefaults();
		if ($wassup_options->saveSettings()) {
			$admin_message = __("Wassup options updated successfully","wassup")."." ;
		}
	}

	//#sets current tab style for Wassup admin submenu?
	if ($_GET['page'] == "wassup-spy") {
		$class_spy="class='current'";
	} elseif ($_GET['page'] == "wassup-options") {
		$class_opt="class='current'";
	} elseif ($_GET['page'] == "wassup-online") {
		$class_ol="class='current'";
	} else {
		$class_sub="class='current'";
	}

	//for stringShortener calculated values and max-width...-Helene D. 11/27/07, 12/6/07
	if (!empty($wassup_options->wassup_screen_res)) {
		$screen_res_size = (int) $wassup_options->wassup_screen_res;
	} else { 
		$screen_res_size = 670;
	}
	$max_char_len = ($screen_res_size)/10;
	$screen_res_size = $screen_res_size+20; //for wrap margins...

	//for generating page link urls....
	//$wpurl =  get_bloginfo('wpurl');	//global
	$siteurl =  get_bloginfo('siteurl');

	//#display an admin message or an alert. This must be above "wrap"
	//# div. -Helene D. 2/26/08.
	if (!empty($admin_message)) {
		$wassup_options->showMessage($admin_message);
	} elseif (!empty($wassup_options->wassup_alert_message)) {
		$wassup_options->showMessage();
		//#show alert message only once, so remove it here...
		$wassup_options->wassup_alert_message = "";
		$wassup_options->saveSettings();
	}
	//#debug - display MySQL errors/warnings
	//$mysqlerror = $wpdb->print_error();	//debug
	//if (!empty($mysqlerror)) { $wassup_options->showMessage($mysqlerror); }	//debug

	//moved max-width to single "wrap" div and removed it from 
	//  the individual spans and divs in style.php... ?>
	<div class="wrap" style="max-width:<?php echo $screen_res_size; ?>px;" >

<?php	// HERE IS THE VISITORS ONLINE VIEW
	if ($_GET['page'] == "wassup-online") { ?>
		<h2><?php _e("Current Visitors Online", "wassup"); ?></h2>
		<p class="legend"><?php echo __("Legend", "wassup").': <span class="box-log">&nbsp;&nbsp;</span> '.__("Logged-in Users", "wassup").' <span class="box-aut">&nbsp;&nbsp;</span> '.__("Comments Authors", "wassup").' <span class="box-spider">&nbsp;&nbsp;</span> '.__("Spiders/bots", "wassup"); ?></p><br />
		<p class="legend"><a href="#" class="toggle-all"><?php _e("Expand All","wassup"); ?></a></p>
		<?php
		$to_date = wassup_get_time();
		$from_date = strtotime('-3 minutes', $to_date);
		$currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date");
		$currenttot = $currenttot+0;	//set to integer
		print "<p class='legend'>".__("Visitors online", "wassup").": <strong>".$currenttot."</strong></p><br />";
		if ($currenttot > 0) {
			$qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
		foreach ($qryC as $cv) {
		if ($wassup_options->wassup_time_format == 24) {
			$timed = gmdate("H:i:s", $cv->max_timestamp);
		} else {
			$timed = gmdate("h:i:s a", $cv->max_timestamp);
		}
		$ip_proxy = strpos($cv->ip,",");
		//if proxy, get 2nd ip...
		if ($ip_proxy !== false) {
			$ip = substr($cv->ip,(int)$ip_proxy+1);
		} else { 
			$ip = $cv->ip;
		}
		if ($cv->referrer != '') {
			if (!eregi($wpurl, $cv->referrer) OR $cv->searchengine != "") { 
				if (!eregi($wpurl, $cv->referrer) AND $cv->searchengine == "") {
				$referrer = '<a href="'.$cv->referrer.'" target=_"BLANK"><span style="font-weight: bold;">'.stringShortener($cv->referrer, round($max_char_len*.8,0)).'</span></a>';
				} else {
				$referrer = '<a href="'.$cv->referrer.'" target=_"BLANK">'.stringShortener($cv->referrer, round($max_char_len*.9,0)).'</a>';
				}
			} else { 
			$referrer = __("From your blog", "wassup"); 
			} 
		} else { 
			$referrer = __("Direct hit", "wassup"); 
		} 
		$numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."'");
	?>
			<div class="sum">
			<span class="sum-box"><?php if ($numurl >= 2) { ?><a  href="#" class="showhide" id="<?php echo $cv->id ?>"><?php print $ip; ?></a><?php } else { ?><?php print $ip; ?><?php } ?></span>
			<div class="sum-det"><span class="det1">
			<?php
			//# html_entity_decode() links that were already 
			//#  "htmlentities-encoded" in database to prevent wacky links
			//#  like "/imagegallery/?album=3&amp;amp;amp;gallery=13"
			print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode($cv->urlrequested))).'" target="_BLANK">';
			print stringShortener(urlencode(html_entity_decode($cv->urlrequested)), round($max_char_len*.9,0)); ?></a></span><br />
			<span class="det2"><strong><?php print $timed; ?> - </strong><?php print $referrer ?></span></div>
			</div>
			<?php // User is logged in or is a comment's author
			if ($cv->username != "" OR $cv->comment_author != "") {
				if ($cv->username != "") {
					$Ousername = '******'.__("LOGGED IN USER", "wassup").': <strong>'.$cv->username.'</strong></span></li>'; 
					$Ocomment_author = '<li class="users"><span class="indent-li-agent">'.__("COMMENT AUTHOR", "wassup").': <strong>'.$cv->comment_author.'</strong></span></li>'; 
					$unclass = "userslogged";
				} elseif ($cv->comment_author != "") {
					$Ocomment_author = '<li class="users"><span class="indent-li-agent">'.__("COMMENT AUTHOR", "wassup").': <strong>'.$cv->comment_author.'</strong></span></li>'; 
					$unclass = "users";
				}
			?>
			<ul class="<?php print $unclass; ?>">
				<?php print $Ousername; ?>
				<?php print $Ocomment_author; ?>
			</ul>
			<?php  } ?>
			<div style="display: none;" class="togglenavi navi<?php echo $cv->id ?>">
			<ul class="url">
	<?php 
			$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."' ORDER BY `timestamp` ASC");
			$i=0;
			foreach ($qryCD as $cd) {	
			$time2 = gmdate("H:i:s", $cd->timestamp);
			$num = ($i&1);
			$char_len = round($max_char_len*.9,0);
			if ($num == 0) $classodd = "urlodd"; else  $classodd = "url";
			if ($i >= 1) {
	?>
				<li class="<?php print $classodd; ?> navi<?php echo $cv->id ?>"><span class="indent-li"><?php print $time2; ?> - 
				<?php
				print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode($cd->urlrequested))).'" target="_BLANK">';
				print stringShortener(urlencode(html_entity_decode($cd->urlrequested)), $char_len).'</a></span></li>'."\n";
			}
			$i++;
			} //end foreach qryCD
			print '</ul>';
			print '</div>';
			print '<p class="sum-footer"></p>';
		} //end foreach qryC
		} //end if currenttot ?>
	<br /><p class="legend"><a href="#" class="toggle-all"><?php _e("Expand All", "wassup"); ?></a></p>
	
<?php	// HERE IS THE SPY MODE VIEW
	} elseif ($_GET['page'] == "wassup-spy") { 
	?>
		<h2><?php _e("SPY Visitors", "wassup"); ?></h2>
		<p class="legend"><?php echo __("Legend", "wassup").': <span class="box-log">&nbsp;&nbsp;</span> '.__("Logged-in Users", "wassup").' <span class="box-aut">&nbsp;&nbsp;</span> '.__("Comments Authors", "wassup").' <span class="box-spider">&nbsp;&nbsp;</span> '.__("Spiders/bots", "wassup"); ?></p><br />
		<div>
		<a href="#?" onclick="return pauseSpy();"><span id="spy-pause"><?php _e("Pause", "wassup"); ?></span></a>
		<a href="#?" onclick="return playSpy();"><span id="spy-play"><?php _e("Play", "wassup"); ?></span></a>
                - <span style="font-size: 11px;"><?php _e('Spy items by','wassup'); ?>: <select name="navi" style="font-size: 11px;" onChange="window.location.href=this.options[this.selectedIndex].value;">
                <?php
                //## selectable filter by type of record (wassup_default_spy_type)
		if (isset($_GET['spytype'])) {
			$spytype = htmlentities(attribute_escape($_GET['spytype']));
		} elseif ($wassup_options->wassup_default_spy_type != '') {
			$spytype = $wassup_options->wassup_default_spy_type;
		}
                $selected=$spytype;
                $optionargs="?page=wassup-spy&spytype=";
                $wassup_options->showFormOptions("wassup_default_spy_type","$selected","$optionargs");
                ?>
                </select>
                </span>
		<br />&nbsp;<br /></div>

	<?php // GEO IP Map
	if ($wassup_options->wassup_geoip_map == 1 AND $wassup_options->wassup_googlemaps_key != "") { ?>
		<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $wassup_options->wassup_googlemaps_key; ?>" type="text/javascript"></script>
		<div id="map" style="width: <?php echo ($screen_res_size*95/100); ?>px; height: 220px;border:2px solid #999;"></div>
		    <script type="text/javascript">
		    //<![CDATA[
		    if (GBrowserIsCompatible()) { 
		      // Display the map, with some controls and set the initial location 
		      var map = new GMap2(document.getElementById("map"));
		      map.addControl(new GSmallMapControl());
		      map.addControl(new GMapTypeControl());
		      //map.enableScrollWheelZoom();
		      map.setCenter(new GLatLng(0,0),3);
		    }
		    // display a warning if the browser was not compatible
		    else {
		      alert("Sorry, the Google Maps API is not compatible with this browser");
		    }
		    //]]>
		    </script>
		<p>&nbsp;</p>
	<? } //end if geoip_map 
	?>
		<div id="spyContainer">
		<?php 
		//display the last few hits here. The rest will be added by spy.js
		$to_date = (wassup_get_time()-2);
		$from_date = ($to_date - 12*(60*60)); //display last 10 visits in 12 hours...
		spyview($from_date,$to_date,10,$spytype); ?>
		</div><br />

<?php	// HERE IS THE OPTIONS VIEW
	} elseif($_GET['page'] == "wassup-options") {
		//#moved content to external include file, "settings.php"
		//#  to make "wassup" code easier to read and modify 
		//#  -Helene D. 1/15/08.
		include(dirname(__FILE__).'/lib/settings.php'); ?>

<?php	// HERE IS THE MAIN/DETAILS VIEW
	} else { ?>
		<h2><?php _e("Latest hits", "wassup"); ?></h2>
		<?php if ($wassup_options->wassup_active != 1) { ?>
			<p style="color:red; font-weight:bold;"><?php _e("WassUp recording is disabled", "wassup"); ?></p>
		<?php }

		$res = (int) $wassup_options->wassup_screen_res;
		if (empty($res)) $res=620;
		elseif ($res < 800) $res=620;
		elseif ($res < 1024) $res=740;
		elseif ($res < 1200) $res=1000;
		else $res=1000;

		//## GET parameters that change options settings
		if (isset($_GET['wchart']) || isset($_GET['wmark'])) { 
			if (isset($_GET['wchart'])) { 
			if ($_GET['wchart'] == 0) {
				$wassup_options->wassup_chart = 0;
			} else {
				$wassup_options->wassup_chart = 1;
			}
			}
			if (isset($_GET['wmark'])) {
			if ($_GET['wmark'] == 0) {
                		$wassup_options->wmark = "0";
				$wassup_options->wip = "";
			} else {
				$wassup_options->wmark = "1";
				$wassup_options->wip = attribute_escape($_GET['wip']);
			}
			}
			$wassup_options->saveSettings();
		}

		//## GET params that filter detail display 
		//
		//## Filter detail list by date range...
		$to_date = wassup_get_time();
		if (isset($_GET['last']) && $_GET['last'] != "") { 
			$last = htmlentities(attribute_escape($_GET['last']));
		} else {
			$last = 1; 
		}
		$from_date = strtotime('-'.$last.' day', $to_date);

		//## Filter detail lists by visitor type...
		if (isset($_GET['type'])) {
			$type = htmlentities(attribute_escape($_GET['type']));
		} elseif ($wassup_options->wassup_default_type != '') {
			$type = $wassup_options->wassup_default_type;
		}
		$whereis="";
		if ($type == 'spider') {
			$whereis = " AND spider!=''";
		} elseif ($type == 'nospider') {
			$whereis = " AND spider=''";
		} elseif ($type == 'spam') {
			$whereis = " AND spam>0";
		} elseif ($type == 'nospam') {
			$whereis = " AND spam=0";
		} elseif ($type == 'nospamspider') {
			$whereis = " AND spam=0 AND spider=''";
		} elseif ($type == 'searchengine') {
			$whereis = " AND searchengine!='' AND search!=''";
		} elseif ($type == 'referrer') {
			$whereis = " AND referrer!='' AND referrer NOT LIKE '%$wpurl%' AND searchengine='' AND search=''";
		} elseif ($type == 'comauthor') {
			$whereis = " AND comment_author!=''";
		} elseif ($type == 'loggedin') {
			$whereis = " AND username!=''";
		}

		//## Filter detail lists by a specific page and number
		//#  of items per page...
		$items = 10;	//default
		if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
			//$items = htmlentities(attribute_escape($_GET['limit'])); 
			$items = $_GET['limit']; 
		} elseif ($wassup_options->wassup_default_limit != '') {
			$items = $wassup_options->wassup_default_limit;
		}
		if ((int)$items < 1 ) { $items = 10; }
		//# current page selections
		if (isset($_GET['pages']) && is_numeric($_GET['pages'])) {
			$pages = (int)$_GET['pages'];
		} else {
			$pages = 1;
		}
		if ( $pages > 1 ) {
			$limit = " LIMIT ".(($pages-1)*$items).",$items";
		} else {
			$limit = " LIMIT $items";
		}

		//## Filter detail lists by a searched item
                if (!empty($_GET['search'])) { 
                        $search = attribute_escape($_GET['search']);
                } else {
                        $search = "";
                }

                // DELETE EVERY RECORD MARKED BY IP
                //#  Delete limited to selected date range only. -Helene D. 3/4/08.
                if (!empty($_GET['deleteMARKED']) && $wassup_options->wmark == "1" ) {
                        $rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND `timestamp` BETWEEN $from_date AND $to_date");
                        if (method_exists($wpdb,'prepare')) {
                                $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE ip='%s' AND `timestamp` BETWEEN %s AND %s", urlencode(attribute_escape($_GET['dip'])), $from_date, $to_date));
                        } else {
                                $wpdb->query("DELETE FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND `timestamp` BETWEEN $from_date AND $to_date");
                        }
                        echo '<p><strong>'.$rec_deleted.' '.__('records deleted','wassup').'</strong></p>';
                        //reset wmark/deleteMarked after delete and
                        //  clean up $_SERVER['QUERY_STRING'] as it is
                        //  used in filter selections below...
                        $remove_query= array("&dip=".$_GET['dip'],"&deleteMARKED=".$_GET['deleteMARKED'],"&wmark=1","&wip=".$_GET['wip']);
                        $new_query = str_replace($remove_query,"",$_SERVER['QUERY_STRING']);
                        $_SERVER['QUERY_STRING']=$new_query;
                        $wassup_options->wmark = "0";
                        $wassup_options->wip = null;
                        $wassup_options->saveSettings();
                }

		// Instantiate class to count items
		$Tot = New MainItems;
		$Tot->tableName = $table_name;
		$Tot->from_date = $from_date;
		$Tot->to_date = $to_date;
		$Tot->whereis = $whereis;
		$Tot->Limit = $limit;
		$Tot->WpUrl = $wpurl;

		$itemstot = $Tot->calc_tot("count", $search, null, "DISTINCT");
		$pagestot = $Tot->calc_tot("count", $search, null, null);
		$spamtot = $Tot->calc_tot("count", $search, "AND spam>0");
		// Check if some records was marked
		if ($wassup_options->wmark == "1") {
			$markedtot = $Tot->calc_tot("count", $search, "AND ip LIKE '%".$wassup_options->wip."%'", "DISTINCT");
		}
		// Check if some records was searched
		if (!empty($search)) {
			$searchtot = $Tot->calc_tot("count", $search, null, "DISTINCT");
		} ?>
                <form><table width="100%">
                <tr>
                <td>
                <p class="legend">
                <?php if ($wassup_options->wassup_chart == "1") { ?>
                        <a href="<?php echo '?page='.WASSUPFOLDER.'&wchart=0&last='.$last.'&limit='.$items.'&type='.$_GET['type'].'&search='.$search.'&pages='.$pages; ?>" style="text-decoration:none;">
                        <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/chart_delete.png" style="padding:0px 6px 0 0;" alt="'.__('hide chart','wassup').'" title="'.__('Hide the chart and site usage','wassup'); ?>" /></a>
                <?php } else { ?>
                        <a href="<?php echo '?page='.WASSUPFOLDER.'&wchart=1&last='.$last.'&limit='.$items.'&type='.$_GET['type'].'&search='.$search.'&pages='.$pages; ?>" style="text-decoration:none;">
                        <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/chart_add.png" style="padding:0px 6px 0 0;" alt="'.__('show chart','wassup').'" title="'.__('Show the chart and site usage','wassup'); ?>" /></a>
                <?php }

		//## Show selectable detail filters...
		if (isset($_GET['limit'])) {
			$new_limit = eregi_replace("\&limit=".$_GET['limit']."", "", $_SERVER['QUERY_STRING']);
		} else { 
			$new_limit = $_SERVER['QUERY_STRING'];
		}
		if (isset($_GET['last'])) {
			$new_last = eregi_replace("\&last=".$_GET['last']."", "", $_SERVER['QUERY_STRING']);
		} else {
			$new_last = $_SERVER['QUERY_STRING'];
		}
                _e('Summary for the last','wassup'); ?>
                <select style="font-size: 11px;" name="last" onChange="window.location.href=this.options[this.selectedIndex].value;">
                <?php
                //## selectable filter by date range
                echo "
                <option value='?$new_last&last=1'".($_GET['last'] == 1 ? " SELECTED" : "").">".__('24 hours','wassup')."</option>
                <option value='?$new_last&last=7'".($_GET['last'] == 7 ? " SELECTED" : "").">".__('7 days','wassup')."</option>
                <option value='?$new_last&last=30'".($_GET['last'] == 30 ? " SELECTED" : "").">".__('1 month','wassup')."</option>
                <option value='?$new_last&last=365'".($_GET['last'] == 365 ? " SELECTED" : "").">".__('1 year','wassup')."</option>"; ?>
                </select></p>
                </td>
                <td align="right"><p style="font-size: 11px;"><?php _e('Items per page','wassup'); ?>: <select name="navi" style="font-size: 11px;" onChange="window.location.href=this.options[this.selectedIndex].value;">
                <?php
                //## selectable filter by number of items on page (default_limit)
                $selected=$items;
                $optionargs="?$new_limit&limit=";
                $wassup_options->showFormOptions("wassup_default_limit","$selected","$optionargs");
                ?>
                </select> - <?php _e('Show items by','wassup'); ?>: <select style="font-size: 11px;" name="type" onChange="window.location.href=this.options[this.selectedIndex].value;">
                <?php
                //## selectable filter by type of record (wassup_default_type)
                $selected=$type;
                $optionargs="?page=".WASSUPFOLDER."&type=";
                $wassup_options->showFormOptions("wassup_default_type","$selected","$optionargs");
                ?>
                </select>
                </p>
                </td>
                </tr>
                </table>
                </form>

		<?php // Print Site Usage
                if ($wassup_options->wassup_chart == 1) { ?>
        <div class='main-tabs'>
                <div id='usage'>
                        <ul>
                        <li><span style="border-bottom:2px solid #0077CC;"><?php echo $itemstot; ?></span> <small><?php _e('Visits','wassup'); ?></small></li>
                        <li><span style="border-bottom:2px dashed #FF6D06;"><?php echo $pagestot; ?></span> <small><?php _e('Pageviews','wassup'); ?></small></li>
                        <li><span><?php echo @number_format(($pagestot/$itemstot), 2); ?></span> <small><?php _e('Pages/Visits','wassup'); ?></small></li>
                        <?php // Print spam usage only if enabled
			if ($wassup_options->wassup_spamcheck == 1) { ?>
			<li><span><a href="#TB_inline?height=180&width=300&inlineId=hiddenspam" class="thickbox"><?php echo $spamtot; ?></a></span> <span>(<?php echo @number_format(($spamtot*100/$pagestot), 2); ?>%)</span> <small><?php _e('Spams','wassup'); ?></small></li>
			<?php } ?>
                        </ul>
                <?php
                // Print the Google chart!
                if ($pagestot > 20) {
                        echo $Tot->TheChart($last, $res, "125", $search, $wassup_options->wassup_chart_type, "bg,s,ffffff")."";
                } else {
                        echo '<div id="placeholder" align="center"><p style="padding-top:50px;">'.__('Too few records to print chart','wassup').'...</p></div>';
                } ?>
                </div>
        </div>
        <?php   } //end if wassup_chart == 1
	
		if (!isset($_GET['limit']) OR $_GET['limit'] == 10 OR $_GET['limit'] == 20) { 
		
			$expcol = '
		<table width="100%"><tr>
		<td align="left" class="legend"><a href="#" class="toggle-all">'.__('Expand All','wassup').'</a></td>
		<td align="right" class="legend"><a href="#" class="toggle-allcrono">'.__('Collapse Chronology','wassup').'</a></td>
		</tr></table><br />';
		}
		
		// MAIN QUERY
		$main = $Tot->calc_tot("main", $search);

		if ($itemstot > 0) {
		$p=new pagination();
		$p->items($itemstot);
		$p->limit($items);
		$p->currentPage($pages);
		$p->target("admin.php?page=".WASSUPFOLDER."&limit=$items&type=$type&last=$last&search=$search");
		$p->calculate();
		$p->adjacents(5);
		}

		// hidden spam options
                ?>
                <div id="hiddenspam" style="display:none;">
        <h2><?php _e('Spam Options','wassup'); ?></h2>
        <form action="" method="post">
	<p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
        <p style="padding-left:30px;"><input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_options->wassup_spam == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?></p>
        <p style="padding-left:30px;"><input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_options->wassup_refspam == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?></p>
        <p style="padding-left:0;"><input type="submit" name="submit-spam" value="<?php _e('Save Settings','wassup'); ?>" /></p>
        </form>
                </div>
                <table width="100%">
                <tr>
                <td align="left" class="legend">
                <?php
		// Marked items - Refresh
                if ($wassup_options->wmark == 1) echo '<a href="?'.$_SERVER['QUERY_STRING'].'&search='.$wassup_options->wip.'" title="'.__('Filter by marked IP','wassup').'"><strong>'.$markedtot.'</strong> '.__('show marked items','wassup').'</a> - ';
                if (!empty($search)) print "<strong>$searchtot</strong> ".__('Searched for','wassup').": <strong>$search</strong> - ";
                echo __('Auto refresh in','wassup').' <span id="CountDownPanel"></span> '.__('seconds','wassup'); ?>
		</td>
		<td align="right" class="legend"><a href="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/lib/action.php?action=topten&whash='.$whash.'&from_date='.$from_date.'&to_date='.$to_date.'&width='.$res.'&height=400'; ?>" class="thickbox" title="Wassup <?php _e('Top Ten','wassup'); ?>"><?php _e('Show Top Ten','wassup'); ?></a> - <a href="#" class='show-search'><?php _e('Search','wassup'); ?></a></td>
                </tr>
                </table>
<div class="search-ip" style="display: none;">
	<table border=0 width="100%">
		<tr valign="top">
		<td align="right">
        	<form action="" method="get">
		<input type="hidden" name="page" value="<?php echo WASSUPFOLDER; ?>" />
			<input type="text" size="25" name="search" value="<?php if ($search != "") print $search; ?>" /><input type="submit" name="submit-search" value="search" />
		</form>
		</td>
		</tr>
	</table>
</div>
<?php
	//# Detailed List of Wassup Records...
	print $expcol;
        //# Show Page numbers/Links...
        if ($itemstot >= 10) {
                print "\n".'<div id="pag" align="center">'.$p->show().'</div><br />'."\n";
        }
	if ($itemstot > 0) {
	foreach ($main as $rk) {
		$timestampF = $rk->max_timestamp;
		$dateF = gmdate("d M Y", $timestampF);
		if ($wassup_options->wassup_time_format == 24) {
			$datetimeF = gmdate('Y-m-d H:i:s', $timestampF);
			$timeF = gmdate("H:i:s", $timestampF);
		} else {
			$datetimeF = gmdate('Y-m-d h:i:s a', $timestampF);
			$timeF = gmdate("h:i:s a", $timestampF);
		}
		//$ip = @explode(",", $rk->ip);
		$ip_proxy = strpos($rk->ip,",");
		//if proxy, get 2nd ip...
		if ($ip_proxy !== false) {
			$ip = substr($rk->ip,(int)$ip_proxy+1);
		} else { 
			$ip = $rk->ip;
		}

		// Visitor Record - raw data (hidden)
		$raw_div="raw-".substr($rk->wassup_id,0,25).rand(0,99);
		echo "\n"; ?>
                <div id="<?php echo $raw_div; ?>" style="display:none; padding-top:7px;" >
                <h2><?php _e("Raw data","wassup"); ?>:</h2>
                <style type="text/css">.raw { color: #542; padding-left:5px; }</style>
                <ul style="list-style-type:none;padding:20px 0 0 30px;">
		<li><?php echo __("Visit type","wassup").': <span class="raw">';
                if ($rk->username != "") { 
			echo __("Logged-in user","wassup").' - '.$rk->username;
		} elseif ($rk->spam == "1" || $rk->spam == "2" ) { 
                	_e("Spammer","wassup");
		} elseif ($rk->comment_author != "") { 
                	echo __("Comment author","wassup").' - '.$rk->comment_author;
		} elseif ($rk->feed != "") { 
                	echo __("Feed","wassup").' - '.$rk->feed;
		} elseif ($rk->spider != "") { 
			echo __("Spider","wassup").' - '.$rk->spider;
		} else {
			 _e("Regular visitor","wassup");
		}
		echo '</span>'; ?></li>
                <li><?php echo __("IP","wassup").': <span class="raw">'.$rk->ip.'</span>'; ?></li>
                <li><?php echo __("Hostname","wassup").': <span class="raw">'.$rk->hostname.'</span>'; ?></li>
                <li><?php echo __("Url Requested","wassup").': <span class="raw">'.htmlspecialchars(html_entity_decode(clean_url($rk->urlrequested))).'</span>'; ?></li>
                <li><?php echo __("User Agent","wassup").': <span class="raw">'.$rk->agent.'</span>'; ?></li>
                <li><?php echo __("Referrer","wassup").': <span class="raw">'.urldecode($rk->referrer).'</span>'; ?></li>
                <?php if ($rk->search != "") { ?>
                <li><?php echo __("Search Engine","wassup").': <span class="raw">'.$rk->searchengine.'</span> &nbsp; &nbsp; ';
		echo __("Search","wassup").': <span class="raw">'.$rk->search.'</span>'; ?></li>
                <?php }
                if ($rk->os != "") { ?>
                <li><?php echo __("OS","wassup").': <span class="raw">'.$rk->os.'</span>'; ?></li>
                <?php }
                if ($rk->browser != "") { ?>
                <li><?php echo __("Browser","wassup").': <span class="raw">'.$rk->browser.'</span>'; ?></li>
                <?php }
                if ($rk->language != "") { ?>
                <li><?php echo __("Locale/Language","wassup").': <span class="raw">'.$rk->language.'</span>'; ?></li>
                <?php } ?>
                <li><?php echo 'Wassup ID'.': <span class="raw">'.$rk->wassup_id.'</span>'; ?></li>
                <li><?php echo __("End timestamp","wassup").': <span class="raw">'.$datetimeF.' ( '.$rk->max_timestamp.' )</span>'; ?></li>
                </ul>
                </div> <!-- raw-wassup_id -->

                <?php //Visitor Record - detail listing
		if ($rk->referrer != '') {
			if (!eregi($wpurl, $rk->referrer) OR $rk->searchengine != "") { 
				if (!eregi($wpurl, $rk->referrer) AND $rk->searchengine == "") {
				$referrer = '<a href="'.$rk->referrer.'" target="_BLANK"><span style="font-weight: bold;">'.stringShortener($rk->referrer, round($max_char_len*.8,0)).'</span></a>';
				} else {
				$referrer = '<a href="'.$rk->referrer.'" target="_BLANK">'.stringShortener($rk->referrer, round($max_char_len*.9,0)).'</a>';
				}
			} else { 
                        $referrer = __('From your blog','wassup');
                        }
                } else { 
                        $referrer = __('Direct hit','wassup');
		} 
		$numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_name WHERE wassup_id='".$rk->wassup_id."'");
		if ($rk->hostname != "") $hostname = $rk->hostname; else $hostname = "unknown";
	?>

		<div class="delID<?php echo $rk->wassup_id ?>">
                <div class="<?php if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip) echo "sum-nav-mark"; else echo "sum-nav"; ?>">

                <p class="delbut">
                <?php // Mark/Unmark IP
                if ($wassup_options->wmark == 1 AND $wassup_options->wip ==  $ip) { ?>
                        <a  href="?<?php echo $_SERVER['QUERY_STRING']; ?>&deleteMARKED=1&dip=<?php print $ip; ?>" style="text-decoration:none;">
                        <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete ALL marked records with this IP','wassup'); ?>" /></a>
                        <a href="?page=<?php echo WASSUPFOLDER; ?>&wmark=0" style="text-decoration:none;">
                        <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_delete.png" alt="'.__('unmark','wassup').'" title="'.__('UnMark IP','wassup'); ?>" /></a>
                <?php } else { ?>
                        <a  href="#" class="deleteID" id="<?php echo $rk->wassup_id ?>" style="text-decoration:none;">
                        <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete this record','wassup'); ?>" /></a>
                        <a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&wmark=1&wip=<?php print $ip; ?>" style="text-decoration:none;">
                        <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_add.png" alt="'.__('mark','wassup').'" title="'.__('Mark IP','wassup'); ?>" /></a>
                <?php } ?>
                <a href="#TB_inline?height=400&width=<?php echo $res.'&inlineId='.$raw_div; ?>" class="thickbox">
                <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/database_table.png" alt="'.__('show raw table','wassup').'" title="'.__('Show the items as raw table','wassup'); ?>" /></a>
                </p>

			<span class="sum-box"><?php if ($numurl >= 2) { ?><a  href="#" class="showhide" id="<?php echo $rk->id ?>"><?php print $ip; ?></a><?php } else { ?><?php print $ip; ?><?php } ?></span>
			<span class="sum-date"><?php print $datetimeF; ?></span>
			<div class="sum-det"><span class="det1">
			<?php 
			print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode(clean_url($rk->urlrequested)))).'" target="_BLANK">';
			print stringShortener(urlencode(html_entity_decode(clean_url($rk->urlrequested))), round($max_char_len*.8,0)); ?></a>
                        </span><br />
                        <span class="det2"><strong><?php _e('Referrer','wassup'); ?>: </strong><?php print $referrer; ?><br /><strong><?php _e('Hostname','wassup'); ?>:</strong> <a  href="#" class="toggleagent" id="<?php echo $rk->id ?>"><?php print $hostname; ?></a></span></div>
                        </div>
			<div style="margin-left: auto; margin-right: auto;">
			<div style="display: none;" class="togglenavi naviagent<?php echo $rk->id ?>">
			<ul class="useragent">
				<li class="useragent"><span class="indent-li-agent"><?php _e('User Agent','wassup'); ?>: <strong><?php print $rk->agent; ?></strong></span></li>
			</ul>
			</div>
			<?php // Referer is search engine
			if ($rk->searchengine != "") {
				if (eregi("images", $rk->searchengine)) {
					$bg = 'style="background: #e5e3ec;"';
					$page = (number_format(($rk->searchpage / 19), 0) * 18); 
					$Apagenum = explode(".", number_format(($rk->searchpage / 19), 1));
					$pagenum = ($Apagenum[0] + 1);
					$url = parse_url($rk->referrer); 
					$ref = $url['scheme']."://".$url['host']."/images?q=".eregi_replace(" ", "+", $rk->search)."&start=".$page;
				} else {
					$bg = 'style="background: #e4ecf4;"';
					$pagenum = $rk->searchpage;
					$ref = $rk->referrer;
				}
			?>
			<ul class="searcheng" <?php print $bg; ?>>
                                <li class="searcheng"><span class="indent-li-agent"><?php _e('SEARCH ENGINE','wassup'); ?>: <strong><?php print $rk->searchengine." (".__("page","wassup").": $pagenum)"; ?></strong></span></li>
                                <li class="searcheng"><?php _e("KEYWORDS","wassup"); ?>: <strong><a href="<?php print $ref;  ?>" target="_BLANK"><?php print stringShortener($rk->search, round($max_char_len*.52,0)); ?></a></strong></li>
			</ul>
			<?php 
			} ?>
			<?php
			// User is logged in or is a comment's author
			if ($rk->username != "" OR $rk->comment_author != "") {
				if ($rk->username != "") {
					$Ocomment_author = '<li class="users"><span class="indent-li-agent">'.__("LOGGED IN USER","wassup").': <strong>'.$rk->username.'</strong></span></li>
				<li class="users"><span class="indent-li-agent">'.__("COMMENT AUTHOR","wassup").': <strong>'.$rk->comment_author.'</strong></span></li>';
					$unclass = "userslogged";
				} elseif ($rk->comment_author != "") {
					$Ocomment_author = '<li class="users"><span class="indent-li-agent">'.__("COMMENT AUTHOR","wassup").': <strong>'.utf8_decode($rk->comment_author).'</strong></span></li>';
					$unclass = "users";
				}
			?>
			<ul class="<?php print $unclass; ?>">
				<?php print $Ocomment_author; ?>
			</ul>
			<?php  } ?>
			<?php // Referer is a Spider or Bot
			if ($rk->spider != "") {
			if ($rk->feed != "") { ?>
			<ul style="background:#fdeec8;" class="spider">
                                <li class="feed"><span class="indent-li-agent"><?php _e('FEEDREADER','wassup'); ?>: <strong><?php print $rk->spider; ?></strong></span></li>
				<?php if (is_numeric($rk->feed)) { ?>
                                <li class="feed"><span class="indent-li-agent"><?php _e('SUBSCRIBER(S)','wassup'); ?>: <strong><?php print (int)$rk->feed; ?></strong></span></li>
				<?php  } ?>
                        </ul>
                        <?php  } else { ?>
                        <ul class="spider">
                                <li class="spider"><span class="indent-li-agent"><?php _e('SPIDER','wassup'); ?>: <strong><?php print $rk->spider; ?></strong></span></li>
			</ul>
			<?php  }
			} ?>
                        <?php // Referer is a SPAM
                        if ($rk->spam > 0 && $rk->spam < 3) { ?>
                        <ul class="spam">
			<li class="spam"><span class="indent-li-agent">
				<?php _e("Probably SPAM!","wassup"); 
				if ($rk->spam==2) { echo '('.__("Referer Spam","wassup").')'; }
				else { echo '(Akismet '.__("Spam","wassup").')'; }  ?>
				</span></li>
                        </ul>
                        <?php  } elseif ($rk->spam == 3) { ?>
                        <ul class="spam">
			<li class="spam"><span class="indent-li-agent">
				<?php _e("Probably hack attempt!","wassup"); ?>
                        </li></ul>
                        <?php  } ?>
			<?php // User os/browser/language
			if ($rk->spider == "" AND ($rk->os != "" OR $rk->browser != "")) {
			?>
			<ul class="agent">
			<li class="agent"><span class="indent-li-agent">
				<?php if ($rk->language != "") { ?>
				<img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/flags/'.strtolower($rk->language).'.png'.'" alt="'.strtolower($rk->language).'" title="'.__("Language","wassup").': '.strtolower($rk->language); ?>" />
				<?php }
				_e("OS","wassup"); ?>: <strong><?php print $rk->os; ?></strong></span></li>
			<li class="agent"><?php _e("BROWSER","wassup"); ?>: <strong><?php print $rk->browser; ?></strong></li>
			<?php if ($rk->screen_res != "") { ?>
				<li class="agent"><?php _e("RESOLUTION","wassup"); ?>: <strong><?php print $rk->screen_res; ?></strong></li>
			<?php } ?>
			</ul>
			<?php  } ?>
			
			<div style="display: visible;" class="togglecrono navi<?php echo $rk->id ?>">
			<ul class="url">
	<?php 
			$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp` ASC");
			$i=0;
			foreach ($qryCD as $cd) {	
			//$timestamp2 = $cd->timestamp; //redundant
			$time2 = gmdate("H:i:s", $cd->timestamp);
			$char_len = round($max_char_len*.92,0);
			$num = ($i&1);
			if ($num == 0) $classodd = "urlodd"; else  $classodd = "url";
			if ($i >= 1) {
				print '<li class="'.$classodd.' navi'.$rk->id.'"><span class="indent-li-nav">'.$time2.' ->';
				print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode($cd->urlrequested))).'" target="_BLANK">';
				print stringShortener(urlencode(html_entity_decode($cd->urlrequested)), $char_len).'</a></span></li>'."\n";
			}
			$i++;
			} //end foreach qryCD
			print "</ul>";
			?>
			</div>
			<p class="sum-footer"></p>
		</div>
	</div>
<?php	} //end foreach qry

	} //end if itemstot > 0
		print '<br />';
		if ($itemstot >= 10) $p->show();
		print '<br />';
		if (!isset($_GET['limit']) OR $_GET['limit'] == 10 OR $_GET['limit'] == 20) {
		        print $expcol;
		}
	if($con) mysql_close($con);
	} //end MAIN/DETAILS VIEW 

	// End calculating execution time of script
	$mtime = microtime();
	$mtime = explode(" ",$mtime);
	$mtime = $mtime[1] + $mtime[0];
	$endtime = $mtime;
	$totaltime = ($endtime - $starttime);

?>

	<p><small>WassUp ver: <?php echo $version.' - '.__("Check the official","wassup").' <a href="http://www.wpwp.org" target="_BLANK">WassUp</a> '.__("page for updates, bug reports and your hints to improve it","wassup").' - <a href="http://trac.wpwp.org/wiki/Documentation" title="Wassup '.__("User Guide documentation","wassup").'">Wassup '.__("User Guide documentation","wassup").'</a>'; ?> - Exec time: <?php echo $totaltime ?></small></p>

	</div>	<!-- end wrap -->
<?php 
} //end function Wassup
Пример #3
0
                ?>
		<td style="min-width:<?php 
                echo $char_len - 5;
                ?>
px;">
		<ul class="charts">
			<li class="chartsT"><?php 
                _e("TOP REQUEST", "wassup");
                ?>
</li>
		<?php 
                foreach ($top_results as $top10) {
                    ?>
			<li class="charts"><?php 
                    echo $top10->top_urlrequested . ': ';
                    print '<a href="' . wAddSiteurl(htmlspecialchars(html_entity_decode($top10->urlrequested))) . '" title="' . html_entity_decode($top10->urlrequested) . '" target="_BLANK">';
                    print stringShortener(urlencode(html_entity_decode($top10->urlrequested)), $char_len) . '</a>';
                    ?>
</li>
		<?php 
                }
                ?>
		</ul>
		</td>
		<?php 
            }
            //end if toprequest
            //#get top 10 browsers...
            if ($top_ten['topbrowser'] == 1) {
                $top_results = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM {$table_name} WHERE timestamp BETWEEN {$from_date} AND {$to_date} AND browser!='' AND browser NOT LIKE 'N/A%' {$spamselect} GROUP BY browser ORDER BY top_browser DESC LIMIT 10");
                $char_len = round($max_char_len * 0.17 + $widthoffset, 0);