diff --git a/fetch_dat.sh b/fetch_dat.sh new file mode 100755 index 000000000..946a53af4 --- /dev/null +++ b/fetch_dat.sh @@ -0,0 +1,10 @@ +#!/bin/bash -x +DIR=$(cd $(dirname $0); pwd) +cd $DIR + +php scripts/fetch-dat.php --mode fav +php scripts/fetch-dat.php --mode recent +php scripts/fetch-dat.php --mode res_hist + + + diff --git a/fetch_subject.sh b/fetch_subject.sh new file mode 100755 index 000000000..7c55b588c --- /dev/null +++ b/fetch_subject.sh @@ -0,0 +1,10 @@ +#!/bin/bash -x +DIR=$(cd $(dirname $0); pwd) +cd $DIR + +php scripts/fetch-subject-txt.php --mode fav +php scripts/fetch-subject-txt.php --mode recent +php scripts/fetch-subject-txt.php --mode res_hist + + + diff --git a/rep2/refind2ch.php b/rep2/refind2ch.php new file mode 100644 index 000000000..d56445ca3 --- /dev/null +++ b/rep2/refind2ch.php @@ -0,0 +1,78 @@ +setHeader('Accept', 'application/json'); + $req->setHeader('Referer', $referer); + + $req->addPostParameter('q', $q); + $req->addPostParameter('p', 0); + $req->addPostParameter('pink', 0); + $req->addPostParameter('sort', 'false'); + $req->addPostParameter('alive', 'true'); + $req->addPostParameter('pl', 'false'); + $req->addPostParameter('b', 'false'); + + $response = P2Commun::getHTTPResponse($req); + + $code = $response->getStatus(); + if ($code != 200) { + p2die("HTTP Error - {$code}"); + } + + $body = $response->getBody(); + } catch (Exception $e) { + p2die($e->getMessage()); + } + + $threads = json_decode($body, true)['results']; + + $result = array(); + $boards = array(); + $hits = array(); + $names = array(); + + foreach ($threads as $n => $t) { + $host = parse_url($t['url'])['host']; + $bbs = explode('_', $t['board_key'])[1]; + + $result['threads'][$n] = new stdClass; + $result['threads'][$n]->title = $t['thread_title']; + $result['threads'][$n]->host = $host; + $result['threads'][$n]->bbs = $bbs; + $result['threads'][$n]->tkey = $t['created_at']; + $result['threads'][$n]->resnum = $t['res_num']; + $result['threads'][$n]->ita = $t['board_title']; + $result['threads'][$n]->dayres = $t['res_rate']; + + $bkey = md5($host.'-'.$bbs.'-'.$t['board_title']); + if (! isset($boards[$bkey])) { + $board = new stdClass; + $board->host = $host; + $board->bbs = $bbs; + $names[$bkey] = $board->name = $t['board_title']; + $hits[$bkey] = $board->hits = 1; + $boards[$bkey] = $board; + } else { + $hits[$bkey] = ++$boards[$bkey]->hits; + $names[$bkey] = $boards[$bkey]->name; + } + } + + $result['modified'] = $response->getHeader('Date'); + $result['profile']['regex'] = '/(' . $q .')/i'; + $result['profile']['hits'] = count($threads); + array_multisort($hits, SORT_DESC, $names, $boards); + $result['profile']['boards'] = $boards; + + return $result; +} diff --git a/rep2/tgrepc.php b/rep2/tgrepc.php old mode 100644 new mode 100755 index e1d4ac85b..3ab668323 --- a/rep2/tgrepc.php +++ b/rep2/tgrepc.php @@ -367,8 +367,10 @@ function tgrep_search($query) } return $result; } else { - require_once './dig2ch.php'; - return dig2chsearch($query); // �lj� +// require_once './dig2ch.php'; +// return dig2chsearch($query); // �lj� + require_once './refind2ch.php'; + return refind2ch_search($query); // �lj� } } diff --git a/setup.sh b/setup.sh new file mode 100755 index 000000000..f772f373f --- /dev/null +++ b/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash -x +DIR=$(cd $(dirname $0); pwd) +cd $DIR + +curl -O http://getcomposer.org/composer.phar || exit 1 +chmod +x composer.phar || exit 1 +mv composer.phar /usr/local/bin/composer || exit 1 + +/usr/local/bin/composer install || exit 1 + +chmod 0777 data/* rep2/ic || exit 1 + +php scripts/p2cmd.php check + + diff --git a/update.sh b/update.sh new file mode 100755 index 000000000..c00f124aa --- /dev/null +++ b/update.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x +DIR=$(cd $(dirname $0); pwd) +cd $DIR + +php scripts/p2cmd.php update || exit 1 + +