<commit_before><?php
/**
 * rep2 - Xbh [h NX
 */

// +Wiki
require_once P2_LIB_DIR . '/wiki/DatPluginCtl.php';

// {{{ ThreadRead

/**
 * Xbh[hNX
 */
class ThreadRead extends Thread {
    // {{{ properties
    public $datlines; // datǂݍ񂾃Ci[z
    public $resrange; // array('start' => i, 'to' => i, 'nofirst' => bool)
    public $onbytes; // T[o擾datTCY
    public $diedat; // T[odat擾悤ƂĂłȂtrueZbg
    public $onthefly; // [JdatۑȂIUtCǂݍ݂Ȃtrue
    public $idp; // XԍL[AID̑O̕ ("ID:", " " ) lƂAzz
    public $ids; // XԍL[AIDlƂAzz
    public $idcount; // IDL[Ao񐔂lƂAzz
    public $getdat_error_msg_ht; // dat擾Ɏsɕ\郁bZ[WiHTMLj
    public $old_host; // zXgړ]oAړ]ÕzXgێ
    private $getdat_error_body; // dat擾Ɏs203Ŏ擾łBODY
    public $datochi_residuums; // dat擾Ɏs203Ŏ擾łdatline̔ziX=>datlinej

    // }}}
    // {{{ constructor

    /**
     * RXgN^
     */
    public function __construct() {
        parent::__construct ();
        $this->getdat_error_msg_ht = "";
    }

    // }}}
    // {{{ downloadDat()

    /**
     * DAT_E[h
     */
    public function downloadDat() {
        global $_conf;

        // ܂BBS
        if (P2Util::isHostMachiBbs ($this->host)) {
            return DownloadDatMachiBbs::invoke ($this);
            // JBBS@
        } elseif (P2Util::isHostJbbsShitaraba ($this->host)) {
            if (! function_exists ('shitarabaDownload')) {
                include P2_LIB_DIR . '/read_shitaraba.inc.php';
            }
            return shitarabaDownload ($this);

            // 2chn
        } else {
            $this->getDatBytesFromLocalDat (); // $aThread->length set
            $pinktest = "/\w+\.bbspink.com/";

            if (! empty ($_GET['kakolog']) && ! empty ($_GET['kakoget'])) {
                if ($_GET['kakoget'] == 1) {
                    $ext = '.dat.gz';
                } elseif ($_GET['kakoget'] == 2) {
                    $ext = '.dat';
                }
                return $this->_downloadDat2chKako ($_GET['kakolog'], $ext);

            // 2ch APIoRŗƂ
            } elseif (P2Util::isHost2chs ($this->host) && $_conf['2chapi_use'] && empty ($_GET['olddat'])) {

                // OCĂȂ or OCAݒ肵Ԍo߂Ă玩ăOC
                if (! file_exists ($_conf['sid2chapi_php']) || ! empty ($_REQUEST['relogin2chapi']) || (filemtime ($_conf['sid2chapi_php']) < time () - 60 * 60 * $_conf['2chapi_interval'])) {
                    if (! function_exists ('authenticate_2chapi')) {
                        include P2_LIB_DIR . '/auth2chapi.inc.php';<commit_msg>API 未使用でも見れる板があったので対応<commit_after><?php
/**
 * rep2 - Xbh [h NX
 */

// +Wiki
require_once P2_LIB_DIR . '/wiki/DatPluginCtl.php';

// {{{ ThreadRead

/**
 * Xbh[hNX
 */
class ThreadRead extends Thread {
    // {{{ properties
    public $datlines; // datǂݍ񂾃Ci[z
    public $resrange; // array('start' => i, 'to' => i, 'nofirst' => bool)
    public $onbytes; // T[o擾datTCY
    public $diedat; // T[odat擾悤ƂĂłȂtrueZbg
    public $onthefly; // [JdatۑȂIUtCǂݍ݂Ȃtrue
    public $idp; // XԍL[AID̑O̕ ("ID:", " " ) lƂAzz
    public $ids; // XԍL[AIDlƂAzz
    public $idcount; // IDL[Ao񐔂lƂAzz
    public $getdat_error_msg_ht; // dat擾Ɏsɕ\郁bZ[WiHTMLj
    public $old_host; // zXgړ]oAړ]ÕzXgێ
    private $getdat_error_body; // dat擾Ɏs203Ŏ擾łBODY
    public $datochi_residuums; // dat擾Ɏs203Ŏ擾łdatline̔ziX=>datlinej

    // }}}
    // {{{ constructor

    /**
     * RXgN^
     */
    public function __construct() {
        parent::__construct ();
        $this->getdat_error_msg_ht = "";
    }

    // }}}
    // {{{ downloadDat()

    /**
     * DAT_E[h
     */
    public function downloadDat() {
        global $_conf;

        // ܂BBS
        if (P2Util::isHostMachiBbs ($this->host)) {
            return DownloadDatMachiBbs::invoke ($this);
            // JBBS@
        } elseif (P2Util::isHostJbbsShitaraba ($this->host)) {
            if (! function_exists ('shitarabaDownload')) {
                include P2_LIB_DIR . '/read_shitaraba.inc.php';
            }
            return shitarabaDownload ($this);

            // 2chn
        } else {
            $this->getDatBytesFromLocalDat (); // $aThread->length set
            $pinktest = "/\w+\.bbspink.com/";

            if (! empty ($_GET['kakolog']) && ! empty ($_GET['kakoget'])) {
                if ($_GET['kakoget'] == 1) {
                    $ext = '.dat.gz';
                } elseif ($_GET['kakoget'] == 2) {
                    $ext = '.dat';
                }
                return $this->_downloadDat2chKako ($_GET['kakolog'], $ext);

            // 2ch APIoRŗƂ
            } elseif (P2Util::isHost2chs ($this->host) && !P2Util::isNotUse2chAPI ($this->host) && $_conf['2chapi_use'] && empty ($_GET['olddat'])) {

                // OCĂȂ or OCAݒ肵Ԍo߂Ă玩ăOC
                if (! file_exists ($_conf['sid2chapi_php']) || ! empty ($_REQUEST['relogin2chapi']) || (filemtime ($_conf['sid2chapi_php']) < time () - 60 * 60 * $_conf['2chapi_interval'])) {
                    if (! function_exists ('authenticate_2chapi')) {
                        include P2_LIB_DIR . '/auth2chapi.inc.php';
{'fraction_non_alphanumeric': 0.1720643751241804, 'fraction_numerical': 0.012716073912179614, 'mean_word_length': 1.9822274881516588, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3468467', 'n_tokens_mistral': 2006, 'n_tokens_neox': 1924, 'n_words': 296}