Changeset 404
- Timestamp:
- 08/15/08 07:28:40 (5 months ago)
- Location:
- wp-slimstat-ex/branches/pins
- Files:
-
- 1 added
- 6 modified
-
BBSpamStats/pin.php (modified) (7 diffs)
-
GeoSlimStat/markers/shadow50.png (added)
-
GeoSlimStat/pin.php (modified) (39 diffs)
-
SSComment_Flag/pin.php (modified) (1 diff)
-
SSDL_MgrN/pin.php (modified) (6 diffs)
-
SSReaders_Count/pin.php (modified) (1 diff)
-
SS_ETC/pin.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-slimstat-ex/branches/pins/BBSpamStats/pin.php
r377 r404 18 18 'url' => 'http://082net.com', 19 19 'text' => 'Show Bad Behavior Stats(http://www.homelandstupidity.us/software/bad-behavior/).', 20 'version' => '0. 7',20 'version' => '0.8', 21 21 'type' => 0, 22 22 ); … … 51 51 function pin_compatible() { 52 52 global $SlimCfg; 53 if($SlimCfg->version < ' 1.6') {54 return array ('compatible' => false, 'message' => 'BBSpamStats is only compatible with SlimStat-Ex 1.6and above.');53 if($SlimCfg->version < '2.001') { 54 return array ('compatible' => false, 'message' => 'BBSpamStats is only compatible with SlimStat-Ex 2.001 and above.'); 55 55 } else { 56 56 return array('compatible' => true); … … 71 71 return $this->table_error; 72 72 $filter_clause = $this->_replaceFilterClause($filter_clause); 73 $offset = $ _GET['offset'];74 $ offset = (isset($offset) && !empty($offset))?$offset:0;75 $ offset = ($offset * $this->rows);73 $offset = $SlimCfg->get_db_offset($this->rows); 74 $pinid =& $this->getPinID(); 75 $moid =& $this->getMoID(0); 76 76 77 77 $str = ""; … … 79 79 $query = "SELECT ts.id, ts.ip, UNIX_TIMESTAMP(ts.date) AS dt, ts.request_uri AS uri, "; 80 80 $query .= " ts.server_protocol AS ptc, ts.request_method AS method, ts.user_agent AS ua, ts.key "; 81 $query .= " FROM ".$table_prefix."bad_behavior ts";82 $query .= " WHERE ".$filter_clause."";83 $query .= ($this->show_unblocked)?"":" AND ts.key <> '00000000' ";81 $query .= " FROM {$table_prefix}bad_behavior ts"; 82 $query .= " WHERE {$filter_clause} "; 83 $query .= $this->show_unblocked ? "" : " AND ts.key <> '00000000' "; 84 84 $query .= " ORDER BY dt DESC, ts.ip"; 85 $query .= " LIMIT ".$offset.",".$this->rows."";86 87 if ( $result = mysql_query( $query) ) {85 $query .= " LIMIT {$offset},{$this->rows}"; 86 $result = mysql_query( $query ); 87 if ( $result && 0 < mysql_num_rows($result) ) { 88 88 $prev_visit = 0; 89 89 $visits = array(); … … 101 101 $visits[] = $visit; 102 102 } 103 $pinid =& $this->getPinID();104 $moid =& $this->getMoID(0);105 103 $str .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; 106 104 $str .= "<tr><th class=\"first\">".__('Visitor', 'wp-slimstat-ex').($use_ajax?" — <a href=\"#\" onclick=\"SlimStat.toggleAllSubs($moid, this, ".count($visits).");return false;\">expand</a> (all)":"")."</th>"; … … 164 162 } 165 163 $str .= "</table>\n"; 166 return SSFunction::get_module_custom($moid, $str, 'full'); 167 } 164 } else { 165 $str = '<div class="noresults-msg"> '.__('No results found', 'wp-slimstat-ex').'</div>'; 166 } 167 return SSFunction::get_module_custom($moid, $str, 'full', '', array(), true); 168 168 } 169 169 … … 228 228 // If a filter by keyword was set, add it to the SQL WHERE clause 229 229 $_filter = SSFunction::filter_switch(); 230 $filter_new = $this->_replaceFilterClause($_filter);231 232 $query = "SELECT COUNT(*) AS counts FROM ".$table_prefix."bad_behavior ts WHERE $filter_new";230 /*$filter_new = $this->_replaceFilterClause($_filter); 231 232 $query = "SELECT COUNT(*) AS counts FROM {$table_prefix}bad_behavior ts WHERE $filter_new"; 233 233 $query .= ($this->show_unblocked)?"":" AND `key` <> '00000000' "; 234 $_html .= SSFunction::print_pages($query, $this->rows, $this->getPinID()); 234 $_html .= SSFunction::print_pages($query, $this->rows, $this->getPinID());*/ 235 235 236 236 $pinid =& $this->getPinID(); -
wp-slimstat-ex/branches/pins/GeoSlimStat/pin.php
r386 r404 52 52 'wheelZoom' => 0, 53 53 'purge_interval' => 120, // about 4 month 54 'pre_connection' => 50 // limit per connection (curl_mul it)54 'pre_connection' => 50 // limit per connection (curl_multi) 55 55 ); 56 56 … … 101 101 } 102 102 $cur_opt = $this->get_option('geo_slimstat'); 103 if ($cur_opt) {103 if ($cur_opt) { 104 104 $this->prefs = array_merge($this->prefs, $cur_opt); 105 105 } 106 if (!empty($this->prefs['googleAPI'])) {106 if (!empty($this->prefs['googleAPI'])) { 107 107 $this->api_defined = true; 108 108 } 109 109 $this->last_purge = get_option('geo_slimstat_lastpurge'); 110 if (!$this->last_purge) {110 if (!$this->last_purge) { 111 111 $this->last_purge = time(); 112 112 update_option('geo_slimstat_lastpurge', $this->last_purge); … … 117 117 function pin_compatible() { 118 118 global $SlimCfg; 119 if ($SlimCfg->version < '1.61') {119 if ($SlimCfg->version < '1.61') { 120 120 return array ('compatible' => false, 'message' => 'GeoSlimStat 0.3 is only compatible with SlimStat-Ex 1.61 and above.'); 121 121 } else { … … 141 141 142 142 function pin_update_options() { 143 if (!isset($_POST['geo_slimstat']))143 if (!isset($_POST['geo_slimstat'])) 144 144 return; 145 145 $int = array('plotNum', 'plotZoom', 'daysDisplay', 'mapCenter', 'purge_interval'); 146 146 $ops = $_POST['geo_slimstat']; 147 147 foreach($ops as $k=>$v) { 148 if (in_array($k, $int))148 if (in_array($k, $int)) 149 149 $ops[$k] = (int)$v; 150 150 else … … 157 157 function pin_options() { 158 158 $op = $this->get_option('geo_slimstat'); 159 if (!$op)159 if (!$op) 160 160 $op = $this->prefs; 161 161 ?> 162 <table width="100%" cellspacing="2" cellpadding="5" class="editform ">162 <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table"> 163 163 <tr valign="top"> 164 164 <th width="20%" scope="row"><?php _e('Google Map API Key:', 'wp-slimstat-ex') ?></th> … … 183 183 <td><?php _e('Use mouse wheel to zoom map. You can use double click zoom without wheel zoom.', 'wp-slimstat-ex'); ?><br /> 184 184 <select name="geo_slimstat[wheelZoom]"> 185 <option value="0"<?php if (!$op['wheelZoom']) { ?> selected="selected"<?php } ?>>NO</option>186 <option value="1"<?php if ($op['wheelZoom']) { ?> selected="selected"<?php } ?>>YES</option>185 <option value="0"<?php if (!$op['wheelZoom']) { ?> selected="selected"<?php } ?>>NO</option> 186 <option value="1"<?php if ($op['wheelZoom']) { ?> selected="selected"<?php } ?>>YES</option> 187 187 </select></td> 188 188 </tr> … … 190 190 <th width="20%" scope="row"><?php _e('Center Type:', 'wp-slimstat-ex') ?></th> 191 191 <td><?php _e('Average point of visitors or custom point you set below (Latitude and Longitude).', 'wp-slimstat-ex'); ?><br /> 192 <select name="geo_slimstat[mapCenter]">193 <option value="0"<?php if(!$op['mapCenter']) { ?> selected="selected"<?php } ?>><?php _e('Average point of visitors', 'wp-slimstat-ex') ?></option>194 <option value="1"<?php if($op['mapCenter']) { ?> selected="selected"<?php } ?>><?php _e('Point I set below', 'wp-slimstat-ex') ?></option>195 </select> —192 <select name="geo_slimstat[mapCenter]"> 193 <option value="0"<?php if (!$op['mapCenter']) { ?> selected="selected"<?php } ?>><?php _e('Average point of visitors', 'wp-slimstat-ex') ?></option> 194 <option value="1"<?php if ($op['mapCenter']) { ?> selected="selected"<?php } ?>><?php _e('Point I set below', 'wp-slimstat-ex') ?></option> 195 </select> — 196 196 <?php _e('Zoom:', 'wp-slimstat-ex') ?> <input type="text" name="geo_slimstat[plotZoom]" value="<?php echo $op['plotZoom']; ?>" size="2" /></td> 197 197 </tr> 198 198 <tr valign="top"> 199 199 <th width="20%" scope="row"><?php _e('Starting Center:', 'wp-slimstat-ex') ?></th> 200 <td> <?php _e('Select a type for define starting center.', 'wp-slimstat-ex'); ?><br />200 <td> 201 201 <?php _e('Latitude:', 'wp-slimstat-ex') ?> <input type="text" name="geo_slimstat[plotLatitude]" value="<?php echo $op['plotLatitude']; ?>" size="6" /> — 202 202 <?php _e('Longitude:', 'wp-slimstat-ex') ?> <input type="text" name="geo_slimstat[plotLongitude]" value="<?php echo $op['plotLongitude']; ?>" size="6" /> … … 261 261 $city = $country = $lat = $long = null; 262 262 $result = explode("if (GBrowserIsCompatible()) {", $result); 263 if (!$result[1])263 if (!$result[1]) 264 264 return array(); 265 265 … … 267 267 $geo = $result[1]; 268 268 269 if (!empty($geo) && preg_match('#map\.setCenter\(new\s+GLatLng\(([^\)]*)\)#i', $geo, $m)) {269 if (!empty($geo) && preg_match('#map\.setCenter\(new\s+GLatLng\(([^\)]*)\)#i', $geo, $m)) { 270 270 $geocode = explode(',', $m[1]); 271 271 $lat = trim($geocode[0]); 272 272 $long = trim($geocode[1]); 273 if (!empty($location)) {273 if (!empty($location)) { 274 274 $location = explode("\n", trim($location)); 275 if (count($location) <= 2) {275 if (count($location) <= 2) { 276 276 $location[0] = trim($location[0]); 277 if ($location[0] != '-' && !preg_match('#^-,#', $location[0])) {277 if ($location[0] != '-' && !preg_match('#^-,#', $location[0])) { 278 278 $_city = explode(',', $location[0]); 279 279 $_city[0] = trim($_city[0]); $_city[1] = trim($_city[1]); 280 if (!empty($_city[1]) && $_city[0] == $_city[1]) {280 if (!empty($_city[1]) && $_city[0] == $_city[1]) { 281 281 $location[0] = $_city[0]; 282 282 } … … 307 307 $city = $country = $lat = $long = null; 308 308 $result = explode("if (GBrowserIsCompatible()) {", $result); 309 if (!$result[1]) {309 if (!$result[1]) { 310 310 continue; 311 311 } … … 314 314 $geo = $result[1]; 315 315 316 if (!empty($geo) && preg_match('#map\.setCenter\(new\s+GLatLng\(([^,]*),([^\)]*)\)#isU', $geo, $m)) {316 if (!empty($geo) && preg_match('#map\.setCenter\(new\s+GLatLng\(([^,]*),([^\)]*)\)#isU', $geo, $m)) { 317 317 $lat = trim($m[1]); 318 318 $long = trim($m[2]); 319 if (!empty($location)) {319 if (!empty($location)) { 320 320 $location = explode("\n", trim($location)); 321 if (count($location) <= 2) {321 if (count($location) <= 2) { 322 322 $location[0] = trim($location[0]); 323 if ($location[0] != '-' && !preg_match('#^-,#', $location[0])) {323 if ($location[0] != '-' && !preg_match('#^-,#', $location[0])) { 324 324 $_city = explode(',', $location[0]); 325 325 $_city[0] = trim($_city[0]); $_city[1] = trim($_city[1]); 326 if (!empty($_city[1]) && $_city[0] == $_city[1]) {326 if (!empty($_city[1]) && $_city[0] == $_city[1]) { 327 327 $location[0] = $_city[0]; 328 328 } … … 381 381 global $SlimCfg; 382 382 $now = time(); 383 if ($now > $this->last_purge + (60*60*24*$this->purge_interval)) {// Purge neg ip list every "purge_interval" days383 if ($now > $this->last_purge + (60*60*24*$this->purge_interval)) {// Purge neg ip list every "purge_interval" days 384 384 update_option('geo_slimstat_negip', array()); 385 385 update_option('geo_slimstat_lastpurge', time()); 386 386 } 387 387 $_neg = (array)get_option('geo_slimstat_negip'); 388 if (in_array($ip, $_neg))388 if (in_array($ip, $_neg)) 389 389 return; 390 390 $_ip = long2ip($ip); … … 409 409 global $wpdb; 410 410 $now = time(); 411 if ($now > $this->last_purge + (60*60*24*$this->purge_interval)) {// Purge neg ip list every "purge_interval" days411 if ($now > $this->last_purge + (60*60*24*$this->purge_interval)) {// Purge neg ip list every "purge_interval" days 412 412 update_option('geo_slimstat_negip', array()); 413 413 update_option('geo_slimstat_lastpurge', time()); … … 433 433 $lat = round(trim($info['lat']), 4); 434 434 $long = round(trim($info['long']), 4); 435 if (!$lat && !$long) {435 if (!$lat && !$long) { 436 436 $_neg[] = $ip; 437 437 update_option('geo_slimstat_negip', $_neg); … … 471 471 472 472 $now = time(); 473 if ($now > $this->last_purge + (60*60*24*$this->purge_interval)) {// Purge neg ip list every "purge_interval" days473 if ($now > $this->last_purge + (60*60*24*$this->purge_interval)) {// Purge neg ip list every "purge_interval" days 474 474 update_option('geo_slimstat_negip', array()); 475 475 update_option('geo_slimstat_lastpurge', time()); 476 476 } 477 477 $_neg = get_option('geo_slimstat_negip'); 478 if (!is_array($_neg))478 if (!is_array($_neg)) 479 479 $_neg = array(); 480 if (in_array($ip_adr, $_neg))480 if (in_array($ip_adr, $_neg)) 481 481 return; 482 482 483 483 $ip_adr_ip = long2ip($ip_adr); 484 484 $ip_info = $this->ip_lookup_extra($ip_adr_ip); 485 if (!empty($ip_info) && !is_null($ip_info['lat']) && !is_null($ip_info['long'])) {485 if (!empty($ip_info) && !is_null($ip_info['lat']) && !is_null($ip_info['long'])) { 486 486 $lat = round(trim($ip_info['lat']), 4); 487 487 $long = round(trim($ip_info['long']), 4); … … 492 492 $ip_lookup_uri = "http://api.hostip.info/get_html.php?ip={$ip_adr_ip}&position=true"; 493 493 $data = $SlimCfg->remote_fopen($ip_lookup_uri); 494 if (!$data || '' == $data)494 if (!$data || '' == $data) 495 495 return; 496 496 … … 520 520 } 521 521 522 if (!$lat && !$long) {522 if (!$lat && !$long) { 523 523 $_neg[] = $ip_adr; 524 524 update_option('geo_slimstat_negip', $_neg); … … 534 534 $zoom = $this->prefs['plotZoom']; 535 535 // if country filter is set and user defined zoom level is smaller than 5 536 if ($zoom < 5 && isset($SlimCfg->get['ff']) && $SlimCfg->get['ff'] == 6)536 if ($zoom < 5 && isset($SlimCfg->get['ff']) && $SlimCfg->get['ff'] == 6) 537 537 $zoom = 5; 538 if (empty($positions) || $this->prefs['mapCenter'] == 1)538 if (empty($positions) || $this->prefs['mapCenter'] == 1) 539 539 return array($this->prefs['plotLatitude'], $this->prefs['plotLongitude'], $zoom); 540 540 $lat = $positions['lat']; … … 550 550 function plotMap($filter_clause) { 551 551 global $SlimCfg, $wpdb; 552 if (!$this->api_defined) {552 if (!$this->api_defined) { 553 553 return $this->api_error; 554 554 } … … 562 562 563 563 $prefs = $this->prefs; 564 $offset = $SlimCfg->get_db_offset($prefs['plotNum']); 564 565 // The most important part, the sql-query. Gets the latest, DISTINCT IPs by date dt. Main Mint db 565 566 $query = "SELECT ts.remote_ip, ts.dt … … 568 569 GROUP BY ts.remote_ip 569 570 ORDER BY ts.dt DESC 570 LIMIT 0, {$prefs['plotNum']}";571 572 if ($result = $wpdb->get_results($query, ARRAY_A)) {571 LIMIT {$offset}, {$prefs['plotNum']}"; 572 573 if ($result = $wpdb->get_results($query, ARRAY_A)) { 573 574 if ($this->serverUnavailable == false) { 574 575 $ips = array(); … … 576 577 foreach($result as $r) { 577 578 $_neg = get_option('geo_slimstat_negip'); 578 if (!is_array($_neg))579 if (!is_array($_neg)) 579 580 $_neg = array(); 580 if (in_array($r['remote_ip'], $_neg))581 if (in_array($r['remote_ip'], $_neg)) 581 582 continue; 582 583 $query = "SELECT * FROM {$this->tbGeo} tg 583 584 WHERE tg.ip = '{$r['remote_ip']}' 584 585 LIMIT 1"; 585 if (!$wpdb->get_row($query)) {586 if (!$wpdb->get_row($query)) { 586 587 // timer_start(); 587 588 if ( $SlimCfg->geoip == 'city' ) { … … 623 624 {$daysDisplay_query} 624 625 ORDER BY dt_max DESC 625 LIMIT 0, {$prefs['plotNum']}";626 LIMIT {$offset}, {$prefs['plotNum']}"; 626 627 627 628 $local_q_ip = array(); 628 if ($result_geo = $wpdb->get_results($query, ARRAY_A)) {629 if ($result_geo = $wpdb->get_results($query, ARRAY_A)) { 629 630 foreach($result_geo as $row) { 630 631 $_city = ('' == $row['city']) ? __('Unknown City', 'wp-slimstat-ex') : str_replace("'", "\\'", $row['city']); … … 635 636 $_long = $row['longitude']; 636 637 $_dtmax = $row['dt_max']; 637 if ($_lat == 0 || $_long == 0) {638 if (!isset($this->country2geocode[$_country]))638 if ($_lat == 0 || $_long == 0) { 639 if (!isset($this->country2geocode[$_country])) 639 640 continue; 640 641 $c2geo = $this->country2geocode[$_country]; … … 675 676 GROUP BY ts.remote_ip 676 677 ORDER BY dt_max DESC 677 LIMIT 0, {$local_query_limit}";678 LIMIT {$offset}, {$local_query_limit}"; 678 679 $lat_long = array(); 679 680 // timer_start(); 680 if ($result_stats = $wpdb->get_results($query, ARRAY_A)) {681 if ($result_stats = $wpdb->get_results($query, ARRAY_A)) { 681 682 foreach($result_stats as $row) { 682 if (in_array($row['remote_ip'], $local_q_ip))683 if (in_array($row['remote_ip'], $local_q_ip)) 683 684 continue; 684 685 $_country = strtolower($row['country']); … … 686 687 $_ip = "<a href=\'http://private.dnsstuff.com/tools/ipall.ch?ip={$_ip}#map\' title=\'Who is?\' target=\'_blank\'>{$_ip}</a>"; 687 688 $_dtmax = $row['dt_max']; 688 if (!isset($this->country2geocode[$_country]))689 if (!isset($this->country2geocode[$_country])) 689 690 continue; 690 691 $c2geo = $this->country2geocode[$_country]; … … 736 737 737 738 // Disable sweetTitles events. 738 if (typeof(sweetTitles) != 'undefined') {739 if (typeof(sweetTitles) != 'undefined') { 739 740 sweetTitles.tipOut = function() {}; 740 741 sweetTitles.tipOver = function() {}; … … 757 758 JAVASCRIPT; 758 759 759 if ($prefs['wheelZoom']) {760 if ($prefs['wheelZoom']) { 760 761 $html_js_header .= <<<JAVASCRIPT 761 762 … … 790 791 {$html_js} 791 792 var _interval = setInterval(function(){ 792 if (document.getElementById('geo_map')){793 if (document.getElementById('geo_map')){ 793 794 clearInterval(_interval); 794 795 do_load_map(); … … 807 808 808 809 $moid =& $this->getMoID(0); 809 return SSFunction::get_module_custom($moid, $html_geo, 'wide', '', array('height'=>'404px', 'width'=>'98%') );810 return SSFunction::get_module_custom($moid, $html_geo, 'wide', '', array('height'=>'404px', 'width'=>'98%'), true); 810 811 } 811 812 } … … 814 815 global $SlimCfg; 815 816 $op = SSPins::get_option('geo_slimstat'); 816 if (!$op || empty($op['googleAPI']))817 if ( !$op || '' == $op['googleAPI'] ) 817 818 return; 818 if (wp_slimstat_ex::is_slimstat_page()) {819 $icon_url = $SlimCfg->pluginURL.'/pins/GeoSlimStat/markers /marker';819 if (wp_slimstat_ex::is_slimstat_page()) { 820 $icon_url = $SlimCfg->pluginURL.'/pins/GeoSlimStat/markers'; 820 821 ?> 821 822 <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $op['googleAPI']; ?>" charset="utf-8"></script> 822 823 <script type='text/javascript' charset='utf-8'>//<