Changeset 1967
- Timestamp:
- 12/10/09 22:04:14 (13 years ago)
- Location:
- plugins/commentIpGeo
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/commentIpGeo/CHANGELOG
r1207 r1967 1 0.9 : 08/09/09 2 - Fix bugs 3 - Add {{tpl:commentIpGeoIsp}} to get the ISP of comment poster 4 1 5 0.8 : 06/06 2 6 - Add ipGeoCityLite database (installed on my own web server and requested by the plugins to get Country AND City). Wipmania is still available but is not the default setup (see about:config) -
plugins/commentIpGeo/_define.php
r1630 r1967 16 16 /* Description*/ "Add templates tags CommentIpGeo and CommentIpGeoFlag. It uses WIPmania.com or IpGeoCityLite, WorldIP - free geolocation databases", 17 17 /* Author */ "Frederic PLE <dotclear@frederic.ple.name>", 18 /* Version */ '0. 8',18 /* Version */ '0.9', 19 19 /* Permissions */ 'admin' 20 20 ); -
plugins/commentIpGeo/_install.php
r1630 r1967 13 13 if (!defined('DC_CONTEXT_ADMIN')) { return; } 14 14 15 $db_flush = array('0.3','0.7' );15 $db_flush = array('0.3','0.7','0.9'); 16 16 17 17 $m_version = $core->plugins->moduleInfo('commentIpGeo','version'); -
plugins/commentIpGeo/_public.php
r1630 r1967 15 15 $core->tpl->addValue('commentIpGeoFlag',array('tplCommentIpGeo','country_flag')); 16 16 $core->tpl->addValue('commentIpGeoCity',array('tplCommentIpGeo','country_city')); 17 $core->tpl->addValue('commentIpGeoISP',array('tplCommentIpGeo','isp')); 17 18 $core->tpl->addValue('commentDebug',array('tplCommentIpGeo','debug')); 18 19 $core->addBehavior('publicHeadContent',array('tplCommentIpGeo','publicHeadContent')); -
plugins/commentIpGeo/class.commentIpGeo.php
r1630 r1967 18 18 else 19 19 $ip_geo = netHttp::quickGet("http://frederic.ple.name/tools/inc_geoip.php?ip=" . $ip . "&from=" . urlencode(str_replace('http://','',$rs->core->blog->url))); 20 if ($ip_geo === false or $ip_geo === null )20 if ($ip_geo === false or $ip_geo === null or strpos($ip_geo,'<') !== false) 21 21 return false; 22 22 else -
plugins/commentIpGeo/class.public.commentIpGeo.php
r1630 r1967 30 30 $rs = $c_rs->core->con->select($strReq); 31 31 while($rs->fetch()) { 32 if ($rs->comment_ip_geo === false or $rs->comment_ip_geo === "" or $rs->comment_ip_geo === null or strstr($rs->comment_ip_geo,':') === false ) {32 if ($rs->comment_ip_geo === false or $rs->comment_ip_geo === "" or $rs->comment_ip_geo === null or strstr($rs->comment_ip_geo,':') === false or strstr($rs->comment_ip_geo,'<') === false) { 33 33 $ip_geo = commentIpGeo::ip2country($c_rs,$rs->comment_ip); 34 34 if ($ip_geo === false) { -
plugins/commentIpGeo/class.tpl.commentIpGeo.php
r1630 r1967 17 17 echo '<style type="text/css" media="all"> 18 18 /*-------------------------Flags and languages--------------------------------*/ 19 .flags {background: url("' . $core->blog->url . '?pf=commentIpGeo/default-templates/flags.png") no-repeat top left; width:18px; height:12px; vertical-align:middle;}19 .flags {background: url("' . $core->blog->url . ((substr($core->blog->url,-1) == '?') ? '' : '?') . 'pf=commentIpGeo/default-templates/flags.png") no-repeat top left; width:18px; height:12px; vertical-align:middle;} 20 20 </style> 21 <link rel="stylesheet" media="all" type="text/css" href="' . $core->blog->url . '?pf=commentIpGeo/default-templates/flags.css" /> 21 <link rel="stylesheet" media="all" type="text/css" href="' . $core->blog->url . ((substr($core->blog->url,-1) == '?') ? '' : '?') . 'pf=commentIpGeo/default-templates/flags.css" /> 22 <link rel="stylesheet" media="all" type="text/css" href="' . $core->blog->url . ((substr($core->blog->url,-1) == '?') ? '' : '?') . 'pf=commentIpGeo/default-templates/isp.css" /> 22 23 '; 23 24 } … … 38 39 static public function country_flag($attr) { 39 40 return self::__process('"<img src=\\"" . $core->blog->url' . 40 ' . "?pf=commentIpGeo/default-templates/_.gif\\" ' . 41 ' . ((substr($core->blog->url,-1) == \'?\') ? \'\' : \'?\')' . 42 ' . "pf=commentIpGeo/default-templates/_.gif\\" ' . 41 43 ' class=\\"flags flag-" . $_ctx->comments->getIpGeoCountryCode() . ' . 42 44 '"\\" alt=\\"" . $_ctx->comments->getIpGeoCountryCode() . "-flag\\" />"'); … … 47 49 } 48 50 51 static public function isp($attr) { 52 return self::__process('"<img src=\\"" . $core->blog->url' . 53 ' . ((substr($core->blog->url,-1) == \'?\') ? \'\' : \'?\')' . 54 ' . "pf=commentIpGeo/default-templates/_isp.png\\" ' . 55 ' class=\\"isp isp-" . $_ctx->comments->getIpGeoIsp() . ' . 56 '"\\" alt=\\"" . $_ctx->comments->getIpGeoIsp() . "-ISP\\" />"'); 57 } 58 49 59 static public function debug($attr) { 50 return '<!-- DEBUG :' . "\n" . '<?php echo $_ctx->comments->debug(); ?> -->'; 60 return '<?php 61 if ($core->blog->settings->commentIpGeo_debug) 62 echo "<!-- DEBUG :\n" . $_ctx->comments->debug() . " -->\n"; 63 ?>'; 51 64 } 52 65 } -
plugins/commentIpGeo/rs.extensions.php
r1630 r1967 12 12 13 13 class rsExtCommentIpGeo { 14 public static function __process(&$rs,$i) { 15 global $core; 16 $t = explode(':',publicCommentIpGeo::$c_info[$rs->comment_id]['comment_ip_geo'],3); 17 return $t[$i - 1]; 18 } 19 14 20 public static function getIpGeoCountryCode(&$rs) { 15 21 global $core; 16 list($country,$city) = explode(':',publicCommentIpGeo::$c_info[$rs->comment_id]['comment_ip_geo'],2); 17 return $country; 22 return rsExtCommentIpGeo::__process($rs,1); 18 23 } 19 24 20 25 public static function getIpGeoCountryCity(&$rs) { 21 26 global $core; 22 list($country,$city) = explode(':',publicCommentIpGeo::$c_info[$rs->comment_id]['comment_ip_geo'],2); 23 return $city; 27 return rsExtCommentIpGeo::__process($rs,2); 28 } 29 30 public static function getIpGeoIsp(&$rs) { 31 global $core; 32 return rsExtCommentIpGeo::__process($rs,3); 24 33 } 25 34
Note: See TracChangeset
for help on using the changeset viewer.