コミットを比較
2 コミット
作成者 | SHA1 | 日付 |
---|---|---|
守矢諏訪子 | 72b9b3dc67 | |
守矢諏訪子 | f48049f5e4 |
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Search;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Http\Controllers\Engine;
|
||||||
|
// use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class Index extends Engine {
|
||||||
|
private $engine;
|
||||||
|
|
||||||
|
public function __construct () {
|
||||||
|
$this->engine = new Engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run () {
|
||||||
|
return view('pages.search.index');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Search;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Engine;
|
||||||
|
// use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class Result extends Engine {
|
||||||
|
private $engine;
|
||||||
|
|
||||||
|
public function __construct () {
|
||||||
|
$this->engine = new Engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run (Request $r) {
|
||||||
|
$res = $r->all();
|
||||||
|
if (!isset($res['query'])) return redirect('/search');
|
||||||
|
|
||||||
|
$can_category = ['general', 'files', 'images', 'it', 'map', 'music', 'videos'];
|
||||||
|
$can_timerange = ['None', 'day', 'week', 'month', 'year'];
|
||||||
|
|
||||||
|
if (!isset($res['pageno']) || $res['pageno'] < 1) $res['pageno'] = 1;
|
||||||
|
if (!isset($res['timerange']) || !in_array($res['timerange'], $can_timerange)) $res['timerange'] = 'None';
|
||||||
|
if (!isset($res['category']) || !in_array($res['category'], $can_category)) $res['category'] = 'general';
|
||||||
|
// dd($res);
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, 'https://search.076.ne.jp/searx/search?category_'.$res['category'].'=1&q='.$res['query'].'&pageno='.$res['pageno'].'&time_range='.$res['timerange'].'$language=ja-JP&format=json');
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
|
||||||
|
$get = curl_exec($ch);
|
||||||
|
dd($get);
|
||||||
|
$err = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if (!$get) return $err;
|
||||||
|
$get = json_decode($get);
|
||||||
|
|
||||||
|
return $get;
|
||||||
|
// https://search.076.ne.jp/searx/search?q=searx%20api&categories=general&language=ja-JP
|
||||||
|
// https://search.076.ne.jp/searx/search?category_general=1&q=searx+api&pageno=1&time_range=None&language=ja-JP&format=json
|
||||||
|
// category_general=1&
|
||||||
|
return view('pages.search.index');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
@extends('theme.'.env('THEME').'.search')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="within">
|
||||||
|
<div class="bar">ウェブ検索</div>
|
||||||
|
<div class="back">
|
||||||
|
<form method="get" action="/search/result">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">検索の結果は<a href="https://search.076.ne.jp">076検索</a>と同じです。</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col"><input type="text" name="query" class="form-control" style="margin-top: 20px;" placeholder="ほげほげほげ" value="" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col"><input type="submit" name="submit" class="btn btn-block btn-primary" style="margin-top: 20px;" value="検索" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@endsection
|
|
@ -0,0 +1,17 @@
|
||||||
|
@extends('theme.'.env('THEME').'.search')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="within">
|
||||||
|
<div class="bar">ウェブ検索</div>
|
||||||
|
<div class="back">
|
||||||
|
<form method="get" action="/result">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col"><input type="text" class="form-control" style="margin-top: 20px;" placeholder="ほげほげほげ" value="" /></div>
|
||||||
|
<div class="col"><input type="submit" class="btn btn-block btn-primary" style="margin-top: 20px;" value="検索" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
ささ
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
$user = getUser();
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{{ app()->getLocale() }}">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- CSRF Token -->
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
<title>テクニカル諏訪子</title>
|
||||||
|
<!-- Styles -->
|
||||||
|
@include('theme.'.env('THEME').'.component.favicon')
|
||||||
|
@include('theme.'.env('THEME').'.component.colors')
|
||||||
|
<style>
|
||||||
|
#page { background: green; }
|
||||||
|
#post { background: deeppink; }
|
||||||
|
#typepost:checked + #page { background: cyan; }
|
||||||
|
#typepost:checked ~ #post { background: blue; }
|
||||||
|
#typepost:checked + #post { background: purple; }
|
||||||
|
#typepost:checked ~ #page { background: brown; }
|
||||||
|
|
||||||
|
#typepost:checked + #page { display: none; }
|
||||||
|
#typepost:checked ~ #post { display: block; }
|
||||||
|
#typepage:checked + #post { display: none; }
|
||||||
|
#typepage:checked ~ #page { display: block; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@include('theme.'.env('THEME').'.component.navbar')
|
||||||
|
<main id="app">
|
||||||
|
<section>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md">
|
||||||
|
<a href="/" style="margin: 40px auto;" class="btn btn-primary">トップページに戻る</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md">
|
||||||
|
@include('theme.'.env('THEME').'.component.contentedit')
|
||||||
|
@yield('content')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@include('theme.'.env('THEME').'.component.footer')
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'search'], function () {
|
||||||
|
Route::get('/', 'Search\Index@run');
|
||||||
|
Route::get('/result', 'Search\Result@run');
|
||||||
|
});
|
|
@ -25,4 +25,5 @@ require(__DIR__.'/api/user.php');
|
||||||
Route::get('/logout', 'User\Logout@index');
|
Route::get('/logout', 'User\Logout@index');
|
||||||
|
|
||||||
require(__DIR__.'/view/bash.php');
|
require(__DIR__.'/view/bash.php');
|
||||||
|
require(__DIR__.'/view/search.php');
|
||||||
require(__DIR__.'/view/site.php');
|
require(__DIR__.'/view/site.php');
|
||||||
|
|
新しいイシューから参照