Changeset 2566:9bf417837888 for plugins/fairTrackbacks
- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- Location:
- plugins/fairTrackbacks
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/fairTrackbacks/_define.php
r2257 r2566 23 23 ) 24 24 ); 25 ?> -
plugins/fairTrackbacks/_public.php
r1179 r2566 16 16 $core->spamfilters[] = 'dcFilterFairTrackbacks'; 17 17 } 18 ?> -
plugins/fairTrackbacks/class.dc.filter.fairtrackbacks.php
r1179 r2566 18 18 public $active = true; 19 19 public $order = -10; 20 20 21 21 public function __construct($core) 22 22 { 23 23 parent::__construct($core); 24 24 } 25 25 26 26 protected function setInfo() 27 27 { 28 28 $this->description = __('Checks trackback source for a link to the post'); 29 29 } 30 31 30 31 32 32 public function isSpam($type,$author,$email,$site,$ip,$content,$post_id,&$status) 33 33 { … … 35 35 return; 36 36 } 37 37 38 38 try 39 39 { 40 40 $default_parse = array('scheme'=>'','host'=>'','path'=>'','query'=>''); 41 41 $S = array_merge($default_parse,parse_url($site)); 42 42 43 43 if ($S['scheme'] != 'http' || !$S['host'] || !$S['path']) { 44 44 throw new Exception('Invalid URL'); 45 45 } 46 46 47 47 # Check incomink link page 48 48 $post = $this->core->blog->getPosts(array('post_id' => $post_id)); 49 49 $post_url = $post->getURL(); 50 50 $P = array_merge($default_parse,parse_url($post_url)); 51 51 52 52 if ($post_url == $site) { 53 53 throw new Exception('Same source and destination'); 54 54 } 55 55 56 56 $o = netHttp::initClient($site,$path); 57 57 $o->setTimeout(3); 58 58 $o->get($path); 59 59 60 60 # Trackback source does not return 200 status code 61 61 if ($o->getStatus() != 200) { 62 62 throw new Exception('Invalid Status Code'); 63 63 } 64 64 65 65 $tb_page = $o->getContent(); 66 66 67 67 # Do we find a link to post in trackback source? 68 68 if ($S['host'] == $P['host']) { … … 72 72 } 73 73 $pattern = preg_quote($pattern,'/'); 74 74 75 75 if (!preg_match('/'.$pattern.'/',$tb_page)) { 76 76 throw new Exception('Unfair'); … … 83 83 } 84 84 } 85 ?>
Note: See TracChangeset
for help on using the changeset viewer.