diff --git a/README.md b/README.md index 0a421ab..fd6fd1d 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ Contributors: michelem, helened Donate link: [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=michele%40befree%2eit&item_name=WassUp&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=IT&bn=PP%2dDonationsBF&charset=UTF%2d8) Tags: analytics, counter, online, seo, statistics, stats, tracker, traffic, trends, user, visitor, web Requires at least: WordPress 2.2 -Tested up to: 4.8 -Stable tag: 1.9.4.2 +Tested up to: 4.8 +Stable tag: 1.9.4.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -154,14 +154,21 @@ When you activate this plugin (as described in "Installation"), it works "as is" * WassUp is incompatible with the following static page caching plugins: WP Super Cache, WP Cache, WP Fastest Cache, and WP Hyper Cache. ## Upgrade Notice -### 1.9.4.2: Security bugfix -* Important security bugfix. +### 1.9.4.3 +* Important PHP7 compatibility upgrade. * DO NOT UPGRADE when your site busy! * Read [installation instructions](http://wordpress.org/plugins/wassup/installation/) for safe upgrade instructions. ## Changelog -### 1.9.4.1 -* Important feature & bugfix upgrade. +### v1.9.4.3 +* merged PHP7 compatibility update (from v1.9.4.1) into master +* minor text changes + +### v1.9.4.2 +* Important security bugfix. Thanks to Dimopoulos Elias for finding this bug. + +### v1.9.4.1 +* updated classes for PHP7-compatible class constructors (not released) ### v1.9.4: Important feature & bugfix upgrade * new option to whitelist referrers that are mislabeled as spam in WassUp (ex: Rx or sexy words in domain name) @@ -177,7 +184,7 @@ When you activate this plugin (as described in "Installation"), it works "as is" * fixed a bug in "stringShortener" function that caused empty results * fixed a bug in Top Stats widget that caused blank lines to display * fixed some Top Stats widget translations -* removed Google!maps API key from Wassup source due to Google TOS limitations +* removed Google!maps API key from Wassup source due to Google's TOS limitations * miscellaneous minor bugfixes ### v1.9.3.1: Important bugfix upgrade @@ -303,4 +310,3 @@ When you activate this plugin (as described in "Installation"), it works "as is" * [Jquery](http://www.jquery.com) for the amazing Ajax framework * [FAMFAMFAM](http://www.famfamfam.com/) for the flags icons * Thanks to [@AlexandreFiori](http://twitter.com/alexandrefiori) for access to his GeoIP API at [freegeoip.net](http://freegeoip.net) -* A big thanks to [Helene D.](http://helenesit.com/) for her help to improve WassUp! diff --git a/lib/akismet.class.php b/lib/akismet.class.php index d4b817e..a0415a7 100644 --- a/lib/akismet.class.php +++ b/lib/akismet.class.php @@ -88,12 +88,16 @@ class wassup_AkismetHttpClient extends wassup_AkismetObject { var $errors=array(); /** Constructor */ - function wassup_AkismetHttpClient($host,$blogUrl,$apiKey,$port=80){ + function __construct($host,$blogUrl,$apiKey,$port=80){ $this->host=$host; $this->port=$port; $this->blogUrl=$blogUrl; $this->apiKey=$apiKey; } + /** PHP4 constructor for backward compatibility */ + function wassup_AkismetHttpClient($host,$blogUrl,$apiKey,$port=80){ + $this->__construct($host,$blogUrl,$apiKey,$port); + } /** Use the connection active in $con to get a response from the server and return that response */ function getResponse($request,$path,$type="post",$responseLength=1160){ $this->_connect(); @@ -173,7 +177,7 @@ class wassup_Akismet extends wassup_AkismetObject { * @param String[] $comment - A formatted comment array to be examined by the Akismet service * @return Akismet */ - function wassup_Akismet($blogUrl,$apiKey,$comment=array()) { + function __construct($blogUrl,$apiKey,$comment=array()) { $this->blogUrl=$blogUrl; $this->apiKey =$apiKey; $this->setComment($comment); @@ -187,6 +191,10 @@ function wassup_Akismet($blogUrl,$apiKey,$comment=array()) { $this->setError(WASSUP_AKISMET_INVALID_KEY,__("Your Akismet API key is not valid.","wassup")); } } + /** PHP4 constructor for backward compatibility */ + function wassup_Akismet($blogUrl,$apiKey,$comment=array()) { + $this->__construct($blogUrl,$apiKey,$comment); + } /** Query Akismet server to check if comment is spam or not */ function isSpam() { $response=$this->http->getResponse($this->_getQueryString(), 'comment-check'); diff --git a/lib/compat-lib/compat_wassup.class.php b/lib/compat-lib/compat_wassup.class.php index 8abbe25..e1735e4 100644 --- a/lib/compat-lib/compat_wassup.class.php +++ b/lib/compat-lib/compat_wassup.class.php @@ -65,7 +65,7 @@ class wassupOptions { var $wassup_refspam = "1"; var $wassup_attack = "1"; var $wassup_hack = "1"; - var $refspam_whitelist=""; //new in v1.9.4: for incorrectly labeled referrer spam + var $refspam_whitelist=""; //for incorrectly labeled referrer spam @since v1.9.4 /* table/file management settings */ var $wassup_table; @@ -94,17 +94,18 @@ class wassupOptions { var $wassup_upgraded = 0; //upgrade timestamp @since v1.9 /** - * PHP4 constructor. - * + * constructor. * optional argument to set default values for new/empty class vars @since v1.9 * @param boolean $add_defaults - * @return void - * */ - function wassupoptions($add_defaults=false){ + function __construct($add_defaults=false){ if($add_defaults)$this->_initSettings(); else $this->loadSettings(); } + /** PHP4 constructor. */ + function wassupoptions($add_defaults=false){ + $this->__construct($add_defaults); + } /** loads current settings/initializes empty class vars. */ function _initSettings(){ $settings=$this->getSettings(true); @@ -641,7 +642,7 @@ function cleanFormText($input){ else $text=strip_tags(html_entity_decode(wp_kses($input,array()))); //only alphanumeric chars allowed with few exceptions //since v1.9.3 allow '@' char for email searches - //v1.9.4 bugfix: allow '/?&=' chars for url searches + //since v1.9.4 allow '/?&=' chars for url searches $cleantext=preg_replace('#([^0-9a-z\-_\.,\:\*\#/&\?=@\'" ]+)#i','',$text); return $cleantext; } @@ -2083,11 +2084,11 @@ function export_records($table,$start_id,$wherecondition,$dtype="sql"){ if(empty($result[0][1]) || is_wp_error($result)){ $err_msg=sprintf(__('Error with "SHOW CREATE TABLE" for %s.','wassup'), esc_attr($table)); wassup_log_message($err_msg); - break; + } else { + $table_create=$result[0][1]; + $sql_header="#\n# " . sprintf(__('Table structure of table %s','wassup'),esc_attr($table))."\n#\n"; + $sql_header .= preg_replace(array('/^CREATE\sTABLE\s(IF\sNOT\sEXISTS\s)?/i', '/AUTO_INCREMENT\=\d+\s/i'),array('CREATE TABLE IF NOT EXISTS ',''),$table_create).' ;'; } - $table_create=$result[0][1]; - $sql_header="#\n# " . sprintf(__('Table structure of table %s','wassup'),esc_attr($table))."\n#\n"; - $sql_header .= preg_replace(array('/^CREATE\sTABLE\s(IF\sNOT\sEXISTS\s)?/i', '/AUTO_INCREMENT\=\d+\s/i'),array('CREATE TABLE IF NOT EXISTS ',''),$table_create).' ;'; $sql_header .= "\n#\n# ".sprintf(__('Data contents of table %s','wassup'),esc_attr($table))."\n#\n"; } //set starting rec id of export query @@ -2162,7 +2163,7 @@ function export_records($table,$start_id,$wherecondition,$dtype="sql"){ //write sql header fwrite($output,$sql_header); $i=0; - //field list for sql-insert + //make a field list for sql-insert statement in output below $sql_fields="INSERT INTO `".esc_attr($table).'` ('; foreach($fields AS $col){ if(empty($wassup_options->export_omit_recid) || $col != 'id'){ @@ -2535,7 +2536,7 @@ function get_menu_arg(){ if(isset($_GET['page'])) $menuarg=$_GET['page']; if(stristr($menuarg,"wassup")!==false){ if(isset($_GET['ml'])){ - $menuarg=$_GET['ml']; + $menuarg=htmlspecialchars($_GET['ml']); //security fix @since v1.9.4.2 - thanks to Dimopoulos Elias for finding this bug }else{ $wassupfolder=basename(WASSUPDIR); if($menuarg=="wassup-stats"){ diff --git a/lib/compat-lib/compat_widget.php b/lib/compat-lib/compat_widget.php index 09b3c25..5c285c2 100644 --- a/lib/compat-lib/compat_widget.php +++ b/lib/compat-lib/compat_widget.php @@ -1,6 +1,7 @@ =')){ +if(version_compare($GLOBALS['wp_version'],'2.8','>=') && version_compare($php_vers,'5.2','>=')){ return; } -if(!class_exists('Wassup_Widget')){ +if(version_compare($GLOBALS['wp_version'],'2.8','<')){ /** * Base class for building Wassup aside widgets for Wordpress 2.2 - 2.7 * - based on 'WP_Widget' class in Wordpress 2.8 @@ -55,8 +57,8 @@ class Wassup_Widget{ var $id; var $updated = false; var $number = false; - /** PHP4 constructor */ - function wassup_widget($id_base="wassup_widget",$name="Wassup Widget",$widget_opts=array(),$control_opts=array()){ + /** constructor */ + function __construct($id_base="wassup_widget",$name="Wassup Widget",$widget_opts=array(),$control_opts=array()){ if(empty($id_base)) $this->id_base=preg_replace( '/(Widget$)/','',strtolower(get_class($this))); else $this->id_base=strtolower($id_base); $this->name=$name; @@ -85,6 +87,10 @@ function wassup_widget($id_base="wassup_widget",$name="Wassup Widget",$widget_op $this->number=1; $this->wassup_add_css(); } + /** PHP4 constructor */ + function wassup_widget($id_base="wassup_widget",$name="Wassup Widget",$widget_opts=array(),$control_opts=array()){ + $this->__construct($id_base,$name,$widget_opts,$control_opts); + } /** Widget control form - for widget options */ function form($old_instance=array()){ $defaults=array( @@ -255,5 +261,425 @@ function wassup_compat_register_widget($widget_class){ wp_register_widget_control($wassup_widgets[$widget_class]->id,$wassup_widgets[$widget_class]->name,array(&$wassup_widgets[$widget_class],'form'),$wassup_widgets[$widget_class]->control_options); } } -} //end if Wassup_Widget +} //end if wpversion < 2.8 +if(version_compare($php_vers,'5.2','<')){ +/** + * Current Visitors Online widget + * - Show counts of visitors currently browsing your site. + */ +class wassup_onlineWidget extends Wassup_Widget{ + function __construct(){ + $widget_id="wassup_online"; + $widget_name='WassUp '.__("Online","wassup"); + $widget_description= __("Show counts of your site's visitors who are currently online.","wassup"); + $widget_opts=array('description'=>$widget_description,'classname'=>"wassup-widget"); + $control_opts=array('description'=>$widget_description); + //instantiate parent + parent::__construct($widget_id,$widget_name,$widget_opts,$control_opts); + } + /** PHP4-compatible constructor */ + function wassup_onlinewidget(){ + $this->__construct(); + } + /** Widget control form - for widget options */ + function form($old_instance=array()){ + $defaults=array( + 'online_title'=>__("Online Now","wassup"), + 'online_total'=>1, + 'online_loggedin'=>0, + 'online_comauth'=>0, + 'online_anonymous'=>0, + 'online_other'=>0, + 'show_usernames'=>0, + 'show_flags'=>0, + 'refresh'=>60, + ); + $instance=$this->wassup_parse_args($old_instance,$defaults); + $checked='checked="checked"'; + $disabled='disabled="disabled"'; + echo "\n";?> +
+ + + +
cleanFormText($new_instance['online_title']):""); + $instance['online_total']=(isset($new_instance['online_total'])?(int)$new_instance['online_total']:"0"); + $instance['online_loggedin']=(isset($new_instance['online_loggedin'])?(int)$new_instance['online_loggedin']:"0"); + $instance['online_comauth']=(isset($new_instance['online_comauth'])?(int)$new_instance['online_comauth']:"0"); + $instance['online_anonymous']=(isset($new_instance['online_anonymous'])?(int)$new_instance['online_anonymous']:"0"); + $instance['online_others']=(isset($new_instance['online_others'])?(int)$new_instance['online_others']:"0"); + $instance['show_usernames']=(isset($new_instance['show_usernames'])?(int)$new_instance['show_usernames']:0); + $instance['show_flags']=(isset($new_instance['show_flags'])?(int)$new_instance['show_flags']:0); + $instance['chars']=(int)$new_instance['chars']; + $instance['ulclass']=$wassup_options->cleanFormText($new_instance['ulclass']); + $instance['wassup_widget_id']=$new_instance['wassup_widget_id']; + //purge widget cache to apply new settings + wassup_widget_clear_cache($instance['wassup_widget_id']); + } + return $instance; + } //end update + + /** displays widget content on web site */ + function widget($wargs,$instance=array()){ + global $wp_version,$wassup_options,$wdebug_mode; + $widget_opt=$wargs; + if(empty($instance['wassup_widget_id'])) $instance=$this->wassup_get_widget_id($instance); + $wassup_widget_id=$instance['wassup_widget_id']; + //get widget head and foot content + $title=((!empty($instance['online_title']))?trim($instance['online_title']):""); + $ulclass=""; + $widget_title=""; + if(!empty($title)) $widget_title=$widget_opt['before_title'].esc_attr($title).$widget_opt['after_title']; + if(!empty($instance['ulclass'])) $ulclass=' class="'.$instance['ulclass'].'"'; + $widget_head=' + '.$widget_title; + $widget_foot=wassup_widget_foot_meta(); + $html=""; + //get widget main content + //...1st check for cached widget content + if(!empty($instance['show_usernames']) && is_user_logged_in()){ + $cache_key="_online_users"; + }else{ + //don't show usernames to regular visitors + $cache_key="_online"; + $instance['show_usernames']=0; + } + if($wdebug_mode){ + echo "\n"; + echo "\n"; + } + $refresh=(isset($instance['refresh']) && is_numeric($instance['refresh'])?(int)$instance['refresh']:60); + if($refresh >0) $html=wassup_widget_get_cache($wassup_widget_id,$cache_key); + //...get new widget content + if(empty($html)){ + if($wassup_options->is_recording_active()){ + $html=wassup_widget_get_online_counts($instance); + //cache the new widget content + if($refresh >0){ + $cacheid=wassup_widget_save_cache($html,$wassup_widget_id,$cache_key,$refresh); + } + }else{ + $html=' +
  • '.__("No Data","wassup").'
  • '; + } + } + //display widget + if(!empty($html)){ + echo "\n".$widget_opt['before_widget']; + echo $widget_head.$html.$widget_foot; + echo "\n".$widget_opt['after_widget']; + } + if($wdebug_mode){ + //display sample widget for format debuging + $sample_html=""; + if(function_exists('wassup_sample_widget')){ + $sample_html=wassup_sample_widget("online"); + } + if(!empty($sample_html)){ + echo "\n".$widget_opt['before_widget']; + echo $sample_html; + echo $widget_foot; + echo "\n".$widget_opt['after_widget']; + } + } + } //end widget +} //end class wassup_onlineWidget + +/** + * Top Stats widget + * + * - Lists top stats or trending stats on your site, depending on statistics timeframe used. + */ +class wassup_topstatsWidget extends Wassup_Widget{ + function __construct(){ + global $wp_version; + $widget_id="wassup_topstats"; + $widget_name='WassUp '.__("Top Stats","wassup"); + $widget_description= __("List your site's most popular or trending items from Wassup's latest stats data.","wassup"); + $widget_opts=array('description'=>$widget_description); + $control_opts=array('height'=>700,'description'=>$widget_description); + //instantiate parent + parent::__construct($widget_id,$widget_name,$widget_opts,$control_opts); //parent::__construct() + } + /** PHP4-compatible constructor */ + function wassup_topstatswidget(){ + $this->__construct(); + } + /** Widget control form - for widget options */ + function form($old_instance=array()){ + global $wp_version,$wassup_options; + $defaults=array( + 'title'=>"", + 'top_articles'=>5, + 'top_searches'=>0, + 'top_referrers'=>0, + 'top_requests'=>0, + 'top_browsers'=>0, + 'top_os'=>0, + 'top_locale'=>0, + 'stat_counts'=>0, + 'stat_timeframe'=>"1", //1 day default + 'stat_refresh'=>10, //10min default cache + ); + $instance=$this->wassup_parse_args($old_instance,$defaults); + $title=$instance['title']; + $checked='checked="checked"'; + $disabled='disabled="disabled"'; + $i=0; + echo "\n";?> +
    + + +
    cleanFormText($new_instance['title']); + if(!empty($new_instance['show_top_articles'])) $instance['top_articles']=(empty($new_instance['top_articles'])?$default_limit:(int)$new_instance['top_articles']); + else $instance['top_articles']=0; + if(!empty($new_instance['show_top_searches'])) $instance['top_searches']=(empty($new_instance['top_searches'])?$default_limit:(int)$new_instance['top_searches']); + else $instance['top_searches']=0; + if(!empty($new_instance['show_top_referrers'])) $instance['top_referrers']=(empty($new_instance['top_referrers'])?$default_limit:(int)$new_instance['top_referrers']); + else $instance['top_referrers']=0; + if(!empty($new_instance['show_top_requests'])) $instance['top_requests']=(empty($new_instance['top_requests'])?$default_limit:(int)$new_instance['top_requests']); + else $instance['top_requests']=0; + if(!empty($new_instance['show_top_browsers'])) $instance['top_browsers']=(empty($new_instance['top_browsers'])?$default_limit:(int)$new_instance['top_browsers']); + else $instance['top_browsers']=0; + if(!empty($new_instance['show_top_os'])) $instance['top_os']=(empty($new_instance['top_os'])?$default_limit:(int)$new_instance['top_os']); + else $instance['top_os']=0; + if(!empty($new_instance['show_top_locale'])) $instance['top_locale']=(empty($new_instance['top_locale'])?$default_limit:(int)$new_instance['top_locale']); + else $instance['top_locale']=0; + $instance['stat_counts']=((!empty($new_instance['stat_counts']))?(int)$new_instance['stat_counts']:"0"); + if(is_numeric($new_instance['stat_timeframe'])) $instance['stat_timeframe']=$new_instance['stat_timeframe']; + else $instance['stat_timeframe']="1"; + $instance['stat_refresh']=(int)$new_instance['stat_refresh']; + $instance['refresh']=$instance['stat_refresh']*60; + $instance['chars']=(int)$new_instance['chars']; + $instance['ulclass']=(!empty($new_instance['ulclass'])?$wassup_options->cleanFormText($new_instance['ulclass']):''); + $instance['wassup_widget_id']=$new_instance['wassup_widget_id']; + //purge widget cache to apply new settings + wassup_widget_clear_cache($instance['wassup_widget_id']); + } + return $instance; + } //end update + + /** displays widget content on web site */ + function widget($wargs,$instance=array()){ + global $wp_version,$wassup_options,$wdebug_mode; + $widget_opt=$wargs; + if(empty($instance['wassup_widget_id'])) $instance=$this->wassup_get_widget_id($instance); + $wassup_widget_id=$instance['wassup_widget_id']; + if($wdebug_mode){ + echo "\n"; + } + //get widget head and foot content + $ulclass=' class="topstats"'; + $widget_head=""; + $widget_foot=''; + if(!empty($instance['title'])){ + $widget_head=$widget_opt['before_title'].esc_attr($instance['title']).$widget_opt['after_title']; + } + if(!empty($instance['ulclass'])){ + $ulclass=' class="topstats '.$instance['ulclass'].'"'; + } + //get widget main content + $widget_html=""; + $cache_key="_topstats"; + $refresh=(is_numeric($instance['stat_refresh'])?(int)$instance['stat_refresh']*60:600); + if($refresh >0) $widget_html=wassup_widget_get_cache($wassup_widget_id,$cache_key); + if(!empty($widget_html)){ + if($wdebug_mode) echo "\n".''; + echo $widget_html; + }elseif(!$wassup_options->is_recording_active()){ + if(!empty($widget_head)){ + //display "no data" for inactive wassup + $widget_html=' + '.$widget_head.' +
  • '.__("No Data","wassup").'
  • + '.wassup_widget_foot_meta(); + echo "\n".$widget_opt['before_widget']; + echo $widget_html; + echo "\n".$widget_opt['after_widget']; + }elseif($wdebug_mode){ + echo "\n"; + } + }elseif(!empty($instance['top_articles'])|| !empty($instance['top_searches'])|| !empty($instance['top_referrers'])|| !empty($instance['top_requests'])|| !empty($instance['top_browsers'])|| !empty($instance['top_os'])|| !empty($instance['top_locale'])){ + $html=""; + $chars=0; + if(!empty($instance['chars']))$chars=(int)$instance['chars']; + $to_date=current_time('timestamp'); + if(!is_numeric($instance['stat_timeframe'])) $instance['stat_timeframe']=1; + if($instance['stat_timeframe']>0) $from_date=$to_date - $instance['stat_timeframe']*24*60*60; + else $from_date=0; //all time + $top_items=array("articles","searches","referrers","requests","browsers","os","locale"); + $i=0; + foreach($top_items AS $item){ + $html=""; + $limit=(!empty($instance['top_'.$item])?(int)$instance['top_'.$item]:"0"); + if($limit >0) + $html=wassup_widget_get_topstat($item,$limit,$chars,$from_date,$instance['stat_counts']); + //top item html + if(!empty($html)){ + $title=""; + if(empty($widget_head)){ + if($instance['stat_timeframe']>0 && $instance['stat_timeframe']<1) $item_heading = __("Latest","wassup"); + else $item_heading = __("Top","wassup"); + $title=$widget_opt['before_title'].wassup_widget_stat_gettext($item,$item_heading).$widget_opt['after_title']; + }else{ + $title=$widget_head; + } + if($i>0)$widget_html.="\n".$widget_opt['after_widget']; + $widget_html.="\n".str_replace('wassup_topstats','wassup_top'.$item,$widget_opt['before_widget']); + $widget_html.=' + '.$title.' + '.$html.' + '; + $i++; + } + } + //display widget html + if(!empty($widget_html)){ + //append footer meta to end of widget + $widget_html.=wassup_widget_foot_meta().$widget_opt['after_widget']; + echo $widget_html; + //cache widget html for next go round + if($refresh>0){ + $cacheid=wassup_widget_save_cache($widget_html,$wassup_widget_id,$cache_key,$refresh); + } + } + }elseif($wdebug_mode){ + echo "\n"; + } //end elseif top_articles ... + } //end widget +} //end class wassup_topstatsWidget +} //end if php_vers < 5.2 + ?> diff --git a/lib/compatibility.php b/lib/compatibility.php index 2f8af26..5a8aab8 100644 --- a/lib/compatibility.php +++ b/lib/compatibility.php @@ -81,6 +81,9 @@ function wassup_load_compat_modules(){ if(!class_exists('wassupOptions')){ include_once($wassup_compatlib.'/compat_wassup.class.php'); } + if(!class_exists('Wassup_Widget')){ + include_once($wassup_compatlib.'/compat_widget.php'); + } } } return $is_compatible; diff --git a/lib/faq.php b/lib/faq.php index 441ef1d..9a50ce8 100644 --- a/lib/faq.php +++ b/lib/faq.php @@ -79,7 +79,7 @@ function wassup_faq(){
  • Q:
    A: WassUp >>'.__("Options","wassup").' >>['.__("General Setup","wassup").']');?>
  • Q:
    - A:
  • + A:
  • Q:
    A #1:
    A #2:
    diff --git a/lib/main.php b/lib/main.php index a13bba2..6a3071a 100644 --- a/lib/main.php +++ b/lib/main.php @@ -42,8 +42,7 @@ class wassup_pagination{ var $urlF; var $calculate; var $pagination; - //PHP4 constructor - function wassup_pagination(){ + function __construct(){ $this->total_pages=null; $this->limit=null; $this->target=""; @@ -61,6 +60,8 @@ function wassup_pagination(){ $this->calculate=false; $this->pagination=""; } + //PHP4 constructor + function wassup_pagination(){$this->__construct();} function items($value){$this->total_pages=intval($value);} function limit($value){$this->limit=intval($value);} function target($value){$this->target=$value;} @@ -182,11 +183,13 @@ class wDetector{ var $os_version; var $os; var $useragent; - function wdetector($ip="",$ua=""){ + function __construct($ip="",$ua=""){ $this->useragent=$ua; $this->check_os($ua); $this->check_browser($ua); } + //PHP4 constructor + function wdetector($ip="",$ua=""){$this->__construct($ip,$ua);} function check_os($useragent){ $os=""; $version=""; @@ -1490,7 +1493,7 @@ class WassupItems { var $Last; var $WpUrl; var $totrecords=0; - function wassupitems($table_name,$date_from,$date_to,$whereis=null,$limit=null) { + function __construct($table_name,$date_from,$date_to,$whereis=null,$limit=null) { global $wpdb,$wassup_options,$wdebug_mode; if (empty($wassup_options->wassup_table)) $wassup_options = new wassupOptions; $wassup_table = $wassup_options->wassup_table; @@ -1582,10 +1585,14 @@ function wassupitems($table_name,$date_from,$date_to,$whereis=null,$limit=null) echo "\n -->"; } } + // PHP4 constructor + function wassupitems($table_name,$date_from,$date_to,$whereis=null,$limit=null) { + $this->__construct($table_name,$date_from,$date_to,$whereis,$limit); + } // Function to show main query and count items function calc_tot($Type,$Search="",$specific_where_clause=null,$distinct_type=null){ global $wpdb,$current_user,$wdebug_mode; - //get/set user-specific wassup_settings + // get/set user-specific wassup_settings if(!is_object($current_user) || empty($current_user->ID)) wp_get_current_user(); $wassup_user_settings=get_user_option('_wassup_settings',$current_user->ID); $this->ItemsType=$Type; @@ -1607,7 +1614,7 @@ function calc_tot($Type,$Search="",$specific_where_clause=null,$distinct_type=nu switch ($Type) { // This is the MAIN query to show the chronology case "main": - //New in v1.9.4: use temporary table to help speed up retrieval of large datasets + //use temporary table to help speed up retrieval of large datasets @since v1.9.4 $bigdata=false; $totrecords=$wpdb->get_var("SELECT COUNT(*) FROM $this->tableName"); if($totrecords >50000) $bigdata=true; @@ -1706,7 +1713,7 @@ function buildSearch($Search,$specific_where_clause=null) { if(!empty($wip)&& $Search==$wip){ //for IP-only search $ss=sprintf(" AND `ip`='%s'",$searchParam); - //New in v1.9.4: separate url searches + //separate url searches @since v1.9.4 }elseif(strpos($Search,'/')!==FALSE){ $ss = sprintf(" AND (`urlrequested` LIKE '%%%s%%' OR `agent` LIKE '%%%s%%' OR `referrer` LIKE '%%%s%%')", $searchParam, diff --git a/lib/settings.php b/lib/settings.php index 801a6d2..5822064 100644 --- a/lib/settings.php +++ b/lib/settings.php @@ -164,7 +164,14 @@ function wassup_optionsView($tab=0) {

    -

    +

    network_activated_plugin()){ + echo __("Enables visitor tracking on all subsites in network.","wassup"); + }else{ + echo __("Enables visitor tracking on the network subsites where plugin is activated.","wassup"); + } + echo " ".__("Do NOT disable unless upgrading plugin.","wassup"); + ?>

    />

    diff --git a/lib/uadetector.class.php b/lib/uadetector.class.php index e419809..b3f4929 100644 --- a/lib/uadetector.class.php +++ b/lib/uadetector.class.php @@ -1,12 +1,12 @@ is_browser=false; $this->is_mobile=false; $this->is_robot=false; @@ -116,6 +116,8 @@ function uadetector($ua=""){ unset($this->_done_browsers,$this->_done_spiders,$this->is_active_agent); return; } //end function __construct +/** PHP4-compatible constructor */ +function uadetector($ua=""){$this->__construct($ua);} /** * Check user agent against a known list of top user agents diff --git a/lib/upgrade.php b/lib/upgrade.php index ac39cf1..3b83597 100644 --- a/lib/upgrade.php +++ b/lib/upgrade.php @@ -697,7 +697,7 @@ function wassup_updateTable($wtable=""){ } //end if 1.9 //For all upgrades: - // New in v1.9.4: get a new api key + // get a new api key @since v1.9.4 if(empty($wassup_options->wassup_googlemaps_key)){ if(!empty($low_priority)){ wp_schedule_single_event(time()+600,'wassup_scheduled_api_upg'); diff --git a/lib/wassup.class.php b/lib/wassup.class.php index fbd6391..54ce007 100644 --- a/lib/wassup.class.php +++ b/lib/wassup.class.php @@ -63,7 +63,7 @@ class wassupOptions { var $wassup_refspam = "1"; var $wassup_attack = "1"; var $wassup_hack = "1"; - var $refspam_whitelist=""; //new in v1.9.4: for incorrectly labeled referrer spam + var $refspam_whitelist=""; //for incorrectly labeled referrer spam @since v1.9.4 /* table/file management settings */ var $wassup_table; @@ -92,17 +92,17 @@ class wassupOptions { var $wassup_upgraded = 0; //upgrade timestamp @since v1.9 /** - * PHP4 constructor. - * + * constructor. * optional argument to set default values for new/empty class vars @since v1.9 * @param boolean $add_defaults - * @return void - * */ - public function wassupoptions($add_defaults=false){ + public function __construct($add_defaults=false){ if($add_defaults)$this->_initSettings(); else $this->loadSettings(); } + public function wassupoptions($add_defaults=false){ + self::__construct($add_defaults); + } /** loads current settings/initializes empty class vars. */ private function _initSettings(){ $settings=$this->getSettings(true); @@ -639,7 +639,7 @@ public function cleanFormText($input){ else $text=strip_tags(html_entity_decode(wp_kses($input,array()))); //only alphanumeric chars allowed with few exceptions //since v1.9.3 allow '@' char for email searches - //v1.9.4 bugfix: allow '/?&=' chars for url searches + //since v1.9.4 allow '/?&=' chars for url searches $cleantext=preg_replace('#([^0-9a-z\-_\.,\:\*\#/&\?=@\'" ]+)#i','',$text); return $cleantext; } @@ -2088,8 +2088,8 @@ static function export_records($table,$start_id,$wherecondition,$dtype="sql"){ $table_create=$result[0][1]; $sql_header="#\n# " . sprintf(__('Table structure of table %s','wassup'),esc_attr($table))."\n#\n"; $sql_header .= preg_replace(array('/^CREATE\sTABLE\s(IF\sNOT\sEXISTS\s)?/i', '/AUTO_INCREMENT\=\d+\s/i'),array('CREATE TABLE IF NOT EXISTS ',''),$table_create).' ;'; - $sql_header .= "\n#\n# ".sprintf(__('Data contents of table %s','wassup'),esc_attr($table))."\n#\n"; } + $sql_header .= "\n#\n# ".sprintf(__('Data contents of table %s','wassup'),esc_attr($table))."\n#\n"; } //set starting rec id of export query if(empty($start_id) || !is_numeric($start_id)){ @@ -2163,7 +2163,7 @@ static function export_records($table,$start_id,$wherecondition,$dtype="sql"){ //write sql header fwrite($output,$sql_header); $i=0; - //field list for sql-insert + //make a field list for sql-insert statement in output below $sql_fields="INSERT INTO `".esc_attr($table).'` ('; foreach($fields AS $col){ if(empty($wassup_options->export_omit_recid) || $col != 'id'){ diff --git a/lib/wassupadmin.php b/lib/wassupadmin.php index a9850ce..373252d 100644 --- a/lib/wassupadmin.php +++ b/lib/wassupadmin.php @@ -259,7 +259,7 @@ function wSelfRefresh(){location.reload(true)}