Advertisement
Guest User

Siki Guard対応。self::NG_IDをself::ABORNに変えるとあぼーんになる

a guest
Aug 16th, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. --- lib/ShowThread.php.org
  2. +++ lib/ShowThread.php
  3. @@ -360,6 +360,31 @@
  4. $this->_quote_res_nums = array();
  5. $this->_quote_res_nums_checked = array();
  6. $this->_quote_res_nums_done = array();
  7. +
  8. + if (P2HostMgr::isHost2chs ($this->thread->host) || P2HostMgr::isHostBbsPink ($this->thread->host)) {
  9. + $cache = new Cache_Lite([
  10. + 'cacheDir' => $_conf['cache_dir'].DIRECTORY_SEPARATOR.'sikiguard'.DIRECTORY_SEPARATOR,
  11. + 'lifeTime' => 600,
  12. + 'fileNameProtection' => false,
  13. + 'automaticSerialization' => false,
  14. + ]);
  15. + preg_match('/5ch\.net|bbspink\.com/', $this->thread->host, $m);
  16. + $host_short = $m[0];
  17. + if (!$sikiguard_tx = $cache->get($host_short.'_'.$this->thread->bbs)) {
  18. + $ch = curl_init();
  19. + curl_setopt($ch, CURLOPT_URL, 'https://sikiguard.net/'.$host_short.'/'.$this->thread->bbs.'/id.txt?t='.microtime(true).'00');
  20. + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  21. + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  22. + curl_setopt($ch, CURLOPT_HTTPHEADER, ['User-Agent: Monazilla/1.00']);
  23. + $sikiguard_tx = curl_exec($ch);
  24. + curl_close($ch);
  25. + if (!file_exists($_conf['cache_dir'] . DIRECTORY_SEPARATOR . 'sikiguard')) {
  26. + mkdir($_conf['cache_dir'].DIRECTORY_SEPARATOR.'sikiguard');
  27. + }
  28. + $cache->save($sikiguard_tx, $host_short.'_'.$this->thread->bbs);
  29. + }
  30. + $this->sikiguard_ids = explode(PHP_EOL, $sikiguard_tx);
  31. + }
  32. }
  33.  
  34. // }}}
  35. @@ -791,6 +816,11 @@
  36. $ngaborns_hits['aborn_msg']++;
  37. return $this->_markNgAborn($i, self::ABORN, true);
  38. }
  39. +
  40. + preg_match('/20(\d\d)\/(\d\d)\/(\d\d).+ID:(.+)/', $date_id, $m);
  41. + if ($m && in_array($m[4].' '.$m[1].$m[2].$m[3], $this->sikiguard_ids)) {
  42. + return $this->_markNgAborn($i, self::NG_ID, false);
  43. + }
  44.  
  45. // }}}
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement