/wp-content/plugins/wassup/wassup.php
PHP | 2990 lines | 2137 code | 177 blank | 676 comment | 628 complexity | 5fff4a73495c4af5560905cd16522219 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
- /*
- Plugin Name: WassUp
- Plugin URI: http://www.wpwp.org
- Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
- Version: 1.6.2
- Author: Michele Marcucci, Helene D.
- Author URI: http://www.michelem.org/
- Copyright (c) 2007 Michele Marcucci
- Released under the GNU General Public License (GPL)
- http://www.gnu.org/licenses/gpl.txt
- */
- //# Stop any attempt to call wassup.php directly. -Helene D. 1/27/08.
- if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
- die('Permission Denied! You are not allowed to call this page directly.');
- }
- $version = "1.6.2";
- define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
- require_once(dirname(__FILE__).'/lib/wassup.class.php');
- require_once(dirname(__FILE__).'/lib/main.php');
- $wpurl = get_bloginfo('wpurl'); //global
- if (isset($_GET['export'])) {
- export_wassup();
- }
- global $wp_version;
- //#This works only in WP2.2 or higher
- if (version_compare($wp_version, '2.2', '<')) {
- wp_die( '<strong style="color:#c00;background-color:#dff;padding:5px;">'.__("Sorry, Wassup requires WordPress 2.2 or higher to work","wassup").'.</strong>');
- } elseif (function_exists('wp_cache_flush')) {
- //clear the WP cache
- wp_cache_flush(); //to prevent "cannot redeclare" errors???
- }
- //#add initial options and create table when Wassup activated
- // -Helene D. 2/26/08.
- function wassup_install() {
- global $wpdb;
- $table_name = $wpdb->prefix . "wassup";
- $table_tmp_name = $wpdb->prefix . "wassup_tmp";
- //### Add/update wassup settings in Wordpress options table
- $wassup_options = new wassupOptions; //#settings initialized here
- //# set hash
- $whash = $wassup_options->get_wp_hash();
- if (!empty($whash)) {
- $wassup_options->whash = $whash;
- }
- //# Add timestamp to optimize table once a day
- $wassup_options->wassup_optimize = wassup_get_time();
- //# set wmark and wip to null
- $wassup_options->wmark = 0; //#no preservation of delete/mark
- $wassup_options->wip = null;
- //### For upgrade of Wassup, manually initialize new settings
- //# initialize settings for 'spamcheck', 'refspam', and 'spam'
- if (!isset($wassup_options->wassup_spamcheck)) {
- $wassup_options->wassup_spamcheck = "0";
- //#set wassup_spamcheck=0 if wassup_refspam=0 and wassup_spam=0
- if (!isset($wassup_options->wassup_spam) && !isset($wassup_options->wassup_refspam)) {
- $wassup_options->wassup_spam = "1";
- $wassup_options->wassup_refspam = "1";
- } elseif ( $wassup_options->wassup_spam == "0" && $wassup_options->wassup_refspam == "0" ) {
- $wassup_options->wassup_spamcheck = "0";
- }
- }
-
- //# update wassup settings for 'savepath' (default is null)
- //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug
- if (!isset($wassup_options->wassup_savepath)) {
- $wassup_options->wassup_savepath = null;
- }
- //# display google chart by default for upgrades from 1.4.4
- if (!isset($wassup_options->wassup_chart)) {
- $wassup_options->wassup_chart = 1;
- }
- //# assign top ten items for upgrades from 1.4.9 or less
- if (empty($wassup_options->wassup_top10)) {
- $wassup_options->wassup_top10 = serialize(array("topsearch"=>"1",
- "topreferrer"=>"1",
- "toprequest"=>"1",
- "topbrowser"=>"1",
- "topos"=>"1",
- "toplocale"=>"0",
- "topfeed"=>"0",
- "topcrawler"=>"0",
- "topvisitor"=>"0",
- "topreferrer_exclude"=>""));
- }
- //#upgrade from 1.6: new options wassup_time_format and wassup_hack
- if (!isset($wassup_options->wassup_time_format)) {
- $wassup_options->wassup_time_format = 24;
- }
- if (!isset($wassup_options->wassup_hack)) {
- $wassup_options->wassup_hack = 1;
- }
- $wassup_options->saveSettings();
- //### Detect problems with WassUp install and show warning
- //#
- //#Check for problems with 'session_savepath' and disable
- //# recording, if found. -Helene D. 2/24/08
- /*
- $sessionpath = $wassup_options->wassup_savepath;
- if (empty($sessionpath)) { $sessionpath = getSessionpath(); }
- //default to "/tmp" if no sessionpath value
- if (empty($sessionpath)) {
- $sessionpath = "/tmp";
- $wassup_options->wassup_savepath = $sessionpath;
- }
- if ($wassup_options->isWritableFolder($sessionpath) == false) {
- if ($wassup_options->wassup_active == "1") {
- $wassup_options->wassup_active = "0";
- $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup');
- } else {
- $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup');
- }
- }
- $wassup_options->saveSettings();
- unset($sessionpath); //because "install" works in global scope
- */
- //# TODO:
- //###Detect known incompatible plugins like "wp_cache" and disable
- //# recordings and show warning message...
- //### Create/upgrade wassup MAIN table
- if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
- CreateTable($table_name);
- CreateTable($table_tmp_name);
- } else {
- UpdateTable(); //<== wassup_tmp is added here, if missing
- }
- } //#end function wassup_install
- //set global variables that are dependent on Wassup's wp_options values
- $wassup_settings = get_option('wassup_settings'); //temp only..
- $wassup_options = new wassupOptions;
- //$wassup_options->loadSettings(); //done automatically
- $whash = $wassup_options->whash; //global...
- //#Completely remove all wassup tables and options from Wordpress when
- //# the 'wassup_uninstall' option is set and plugin is deactivated.
- //# -Helene D. 2/26/08
- function wassup_uninstall() {
- global $wassup_options, $wpdb;
- if ($wassup_options->wassup_uninstall == "1") {
- $table_name = $wpdb->prefix . "wassup";
- $table_tmp_name = $wpdb->prefix . "wassup_tmp";
- //$wpdb->query("DROP TABLE IF EXISTS $table_name"); //incorrectly causes an activation error in Wordpress
- //$wpdb->query("DROP TABLE IF EXISTS $table_tmp_name"); //incorrectly causes an activation error in Wordpress
- mysql_query("DROP TABLE IF EXISTS $table_tmp_name");
- mysql_query("DROP TABLE IF EXISTS $table_name");
- $wassup_options->deleteSettings();
- }
- } //#end function wassup_uninstall
- function add_wassup_meta_info() {
- global $version;
- print '<meta name="wassup-version" content="'.$version.'" />';
- }
- //# Wassup init hook actions performed before headers are sent:
- //# -Load jquery AJAX library and dependent javascripts for admin menus
- //# -Load language/localization files for admin menus and widget
- //# -Set 'wassup' cookie for new visitor hits
- function wassup_init() {
- global $wpurl;
- //### Add wassup scripts to Wassup Admin pages...
- if (stristr($_GET['page'],'wassup') !== FALSE) {
- if ( function_exists('wp_deregister_script')) {
- //removes old jquery vers.
- wp_deregister_script('jquery');
- }
- // the safe way to load jquery into WP
- wp_register_script('jquery', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/jquery.js',FALSE,'1.2.6');
- if ($_GET['page'] == "wassup-spy") {
- //the safe way to load a jquery dependent script
- wp_enqueue_script('spy', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/spy.js', array('jquery'), '1.4');
- } elseif($_GET['page'] == "wassup-options") {
- wp_enqueue_script('ui.base', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/ui.base.js', array('jquery'), '3');
- wp_enqueue_script('ui.tabs', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/ui.tabs.js', array('jquery'), '3');
- } else {
- //the safe way to load a jquery dependent script
- wp_enqueue_script('thickbox', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.js', array('jquery'), '3');
- }
- }
- //Loading language file...
- //Doesn't work if the plugin file has its own directory.
- //Let's make it our way... load_plugin_textdomain() searches only in the wp-content/plugins dir.
- $currentLocale = get_locale();
- if(!empty($currentLocale)) {
- $moFile = dirname(__FILE__) . "/language/" . $currentLocale . ".mo";
- if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wassup', $moFile);
- }
- //Set Wassup cookie for visitor hits before headers are sent
- //add_action('init', 'wassupPrepend');
- if (!is_admin()) { //exclude wordpress admin page visits
- wassupPrepend();
- }
- } // end function wassup_init
- //Add the wassup stylesheet and other javascripts...
- function add_wassup_css() {
- global $wpurl, $wassup_options, $whash;
- //assign a value to whash, if none
- if ($whash == "") {
- $whash = $wassup_options->get_wp_hash();
- $wassup_options->whash = $whash; //save new hash
- $wassup_options->saveSettings();
- }
- $plugin_page = attribute_escape($_GET['page']);
- if (stristr($plugin_page,'wassup') !== FALSE) { $plugin_page="wassup"; }
- //Add css and javascript to wassup menu pages only...
- if ($plugin_page == "wassup") {
- //$wassup_settings = get_option('wassup_settings');
- echo "\n".'<script type="text/javascript">var tb_pathToImage = "'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/loadingAnimation.gif";</script>';
- echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.css'.'" type="text/css" />';
- echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/ui.tabs.css'.'" type="text/css" />';
- echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/wassup.css'.'" type="text/css" />'."\n";
- if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
- <script type='text/javascript'>
- //<![CDATA[
- function selfRefresh(){
- location.href='?<?php print $_SERVER['QUERY_STRING']; ?>';
- }
- setTimeout('selfRefresh()', <?php print ($wassup_options->wassup_refresh * 60000); ?>);
- //]]>
- </script>
- <script type='text/javascript'>
- //<![CDATA[
- var _countDowncontainer="0";
- var _currentSeconds="0";
- function ActivateCountDown(strContainerID, initialValue) {
- _countDowncontainer = document.getElementById(strContainerID);
- SetCountdownText(initialValue);
- window.setTimeout("CountDownTick()", 1000);
- }
- function CountDownTick() {
- SetCountdownText(_currentSeconds-1);
- window.setTimeout("CountDownTick()", 1000);
- }
- function SetCountdownText(seconds) {
- //store:
- _currentSeconds = seconds;
- //build text:
- var strText = AddZero(seconds);
- //apply:
- if (_countDowncontainer) { //prevents error in "Options" submenu
- _countDowncontainer.innerHTML = strText;
- }
- }
- function AddZero(num) {
- return ((num >= "0")&&(num < 10))?"0"+num:num+"";
- }
- //]]>
- </script>
- <script type="text/javascript">
- //<![CDATA[
- window.onload=WindowLoad;
- function WindowLoad(event) {
- ActivateCountDown("CountDownPanel", <?php print ($wassup_options->wassup_refresh * 60); ?>);
- }
- //]]>
- </script>
- <script type="text/javascript">
- //<![CDATA[
- jQuery(document).ready(function($){
- $("a.showhide").click(function(){
- var id = $(this).attr('id');
- $("div.navi" + id).toggle("slow");
- return false;
- });
- $("a.toggleagent").click(function(){
- var id = $(this).attr('id');
- $("div.naviagent" + id).slideToggle("slow");
- return false;
- });
- $("a.deleteID").click(function(){
- var id = $(this).attr('id');
- $.ajax({
- url: "<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/lib/action.php?action=delete&whash='.$whash; ?>&id=" + id,
- async: false
- })
- $("div.delID" + id).fadeOut("slow");
- return false;
- });
- $("a.show-search").toggle(function(){
- $("div.search-ip").slideDown("slow");
- $("a.show-search").html("<a href='#' class='show-search'><?php _e("Hide Search", "wassup") ?></a>");
- },function() {
- $("div.search-ip").slideUp("slow");
- $("a.show-search").html("<a href='#' class='show-search'><?php _e("Search", "wassup") ?></a>");
- return false;
- });
- $("a.show-topten").toggle(function(){
- $("div.topten").slideDown("slow");
- $("a.show-topten").html("<a href='#' class='show-topten'><?php _e("Hide TopTen", "wassup") ?></a>");
- },function() {
- $("div.topten").slideUp("slow");
- $("a.show-topten").html("<a href='#' class='show-topten'><?php _e("Show TopTen", "wassup") ?></a>");
- return false;
- });
- $("a.toggle-all").toggle(function() {
- $("div.togglenavi").slideDown("slow");
- $("a.toggle-all").html("<a href='#' class='toggle-all'><?php _e("Collapse All", "wassup") ?></a>");
- },function() {
- $("div.togglenavi").slideUp("slow");
- $("a.toggle-all").html("<a href='#' class='toggle-all'><?php _e("Expand All", "wassup") ?></a>");
- return false;
- });
- $("a.toggle-allcrono").toggle(function() {
- $("div.togglecrono").slideUp("slow");
- $("a.toggle-allcrono").html("<a href='#' class='toggle-allcrono'><?php _e("Expand Cronology", "wassup") ?></a>");
- },function() {
- $("div.togglecrono").slideDown("slow");
- $("a.toggle-allcrono").html("<a href='#' class='toggle-allcrono'><?php _e("Collapse Cronology", "wassup") ?></a>");
- return false;
- });
- }); //end jQuery(document).ready
- //]]>
- </script>
- <?php } //end if page != wassup-options ?>
- <script type='text/javascript'>
- //<![CDATA[
- function go()
- {
- box = document.forms["0"].navi;
- destination = box.options[box.selectedindex].value;
- if (destination) location.href = destination;
- }
- function go2()
- {
- box2 = document.forms["0"].type;
- destination2 = box2.options[box2.selectedindex].value;
- if (destination2) location.href = destination2;
- }
- //]]>
- </script>
- <?php
- if ($_GET['page'] == "wassup-options") {
- //#Current active tabs are indentified after page reload with
- //# either $_GET['tab']=N or $_POST['submit-optionsN'] where
- //# N=tab number. The tab is then activated directly in
- //# "settings.php" with <li class="ui-tabs-selected">
- ?>
- <script type="text/javascript">
- //<![CDATA[
- jQuery(document).ready(function($) {
- $('#tabcontainer > ul').tabs({ fx: { opacity: 'toggle' } });
- });
- //]]>
- </script>
- <?php
- } elseif ($_GET['page'] == "wassup-spy") {
- //## Filter detail lists by visitor type...
- if (isset($_GET['spytype'])) {
- $spytype = htmlentities(attribute_escape($_GET['spytype']));
- $wassup_options->wassup_default_spy_type = $spytype;
- } elseif ($wassup_options->wassup_default_spy_type != '') {
- $spytype = $wassup_options->wassup_default_spy_type;
- }
- $wassup_options->saveSettings();
- ?>
- <script type="text/javascript">
- //<![CDATA[
- jQuery(document).ready(function($){
- $('#spyContainer > div:gt(4)').fadeEachDown(); // initial fade
- $('#spyContainer').spy({
- limit: 10,
- fadeLast: 5,
- ajax: '<?php echo $wpurl."/wp-content/plugins/".WASSUPFOLDER."/lib/action.php?action=spy&whash=$whash&spytype=$spytype"; ?>',
- timeout: 2000,
- 'timestamp': myTimestamp,
- fadeInSpeed: 1100 });
- });
-
- function myTimestamp() {
- var d = new Date();
- var timestamp = d.getFullYear() + '-' + pad(d.getMonth()) + '-' + pad(d.getDate());
- timestamp += ' ';
- timestamp += pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds());
- return timestamp;
- }
- // pad ensures the date looks like 2006-09-13 rather than 2006-9-13
- function pad(n) {
- n = n.toString();
- return (n.length == 1 ? '0' + n : n);
- }
- //]]>
- </script>
- <?php } //end if page == "wassup-spy"
- } //end if plugin_page == "wassup"
- } //end function add_wassup_css()
- //put WassUp in the top-level admin menu and add submenus....
- function wassup_add_pages() {
- global $wassup_options;
- $userlevel = $wassup_options->wassup_userlevel;
- if (empty($userlevel)) { $userlevel = 8; }
- // add the default submenu first (important!)...
- add_submenu_page(WASSUPFOLDER, __('Visitor Details', 'wassup'), __('Visitor Details', 'wassup'), $userlevel, WASSUPFOLDER, 'WassUp'); //<-- WASSUPFOLDER needed here for directory names that include a version number...
- // then add top menu and other submenus...
- add_menu_page('Wassup', 'WassUp', $userlevel, WASSUPFOLDER, 'Wassup');
- add_submenu_page(WASSUPFOLDER, __('Spy Visitors', 'wassup'), __('SPY Visitors', 'wassup'), $userlevel, 'wassup-spy', 'WassUp');
- add_submenu_page(WASSUPFOLDER, __('Current Visitors Online', 'wassup'), __('Current Visitors Online', 'wassup'), $userlevel, 'wassup-online', 'WassUp');
- add_submenu_page(WASSUPFOLDER, __('Options', 'wassup'), __('Options', 'wassup'), $userlevel, 'wassup-options', 'WassUp');
- }
- 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"> </span> '.__("Logged-in Users", "wassup").' <span class="box-aut"> </span> '.__("Comments Authors", "wassup").' <span class="box-spider"> </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;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 = '<li class="users"><span class="indent-li-agent">'.__("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"> </span> '.__("Logged-in Users", "wassup").' <span class="box-aut"> </span> '.__("Comments Authors", "wassup").' <span class="box-spider"> </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 /> <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&v=2&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> </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> ';
- 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='".$r…
Large files files are truncated, but you can click here to view the full file