また登録と意味がある

このコミットが含まれているのは:
テクニカル諏訪子 2020-10-04 01:51:46 +09:00
コミット f649901167
6個のファイルの変更94行の追加18行の削除

ファイルの表示

@ -57,6 +57,14 @@ class SiteController extends Controller {
$get->display_name = $p->display_name;
foreach ($get->comments as $k => $c) {
if (count(userDetail($c->user_id)) > 0) {
$det = userDetail($c->user_id);
$c->user_id = $det['user_id'];
$c->showname = $det['showname'];
$c->showcol = $det['showcol'];
$c->avatar = $det['avatar'];
}
if ($c->isShadow == 0) {
if (getIp() != $c->ipaddress) unset($get->comments[$k]);
}
@ -82,6 +90,7 @@ class SiteController extends Controller {
}
}
$get->user = userDetail(null, $kero);
$get->post_date = strftime('%Y/%m/%d(%a) %H:%M:%S %Z', $get->post_date);
$get->publish_date = strftime('%Y/%m/%d(%a) %H:%M:%S %Z', $get->publish_date);
@ -96,6 +105,7 @@ class SiteController extends Controller {
$add = DB::table('blg_comments')
->insertGetId([
'user_id' => ($r->user_id != 0 ?: null),
'post_id' => ($r->isvideo == 'f' ? $id : 0),
'video_id' => ($r->isvideo == 't' ? $r->slug : ''),
'name' => $com['name'],
@ -110,6 +120,15 @@ class SiteController extends Controller {
$res = DB::table('blg_comments')->select('id', 'name', 'created', 'message')->where('id', $add)->first();
$res->created = date('Y年m月d日 H:i:s', $res->created);
if (count(userDetail($r->user_id)) > 0) {
$det = userDetail($r->user_id);
$res->user_id = $det['user_id'];
$res->showname = $det['showname'];
$res->showcol = $det['showcol'];
$res->avatar = $det['avatar'];
}
return array('status' => '010100', 'message' => 'OK', 'result' => $res);
}

ファイルの表示

@ -66,16 +66,25 @@ class VideoController extends Controller {
$res->mgametitle = $game->name;
$slugger = $res->vid;
$res->slug = $game->slug;
$res->pageslug = $vid;
if ($res->gametitle == '') $res->gametitle = '初代';
$comments = DB::table('blg_comments')->where('video_id', $slugger)->orderBy('id', 'asc')->get()->toArray();
$comments = DB::table('blg_comments')->where('video_id', $vid)->orderBy('id', 'asc')->get()->toArray();
$ytslug = explode('?v=', $res->youtube);
$res->ytcomment = $this->getYouTubeCome($ytslug[1]);
$res->nicocomment = array();
$res->bccomment = array();
foreach ($comments as $k => $c) {
if (count(userDetail($c->user_id)) > 0) {
$det = userDetail($c->user_id);
$c->user_id = $det['user_id'];
$c->showname = $det['showname'];
$c->showcol = $det['showcol'];
$c->avatar = $det['avatar'];
}
if ($c->isShadow == 0) {
if (getIp() != $c->ipaddress) unset($comments[$k]);
}
@ -87,6 +96,7 @@ class VideoController extends Controller {
}
}
$res->user = userDetail(null, $this->cook);
$res->comments = $comments;
return view('pages.site.video.prayer', ['res' => $res, 'menu' => $this->menu, 'user' => $this->user]);

ファイルの表示

@ -23,4 +23,37 @@ function getIp () {
return $ip;
}
function userDetail ($id, $kero=null) {
if ($kero || $id) {
$log_username = null;
if (!is_null($id)) $log_username = DB::table('users')->select('id', 'username')->where('id', $id)->first();
else $log_username = DB::table('users')->select('id', 'username')->where('kero_token', $kero)->first();
$perm_id = DB::table('usr_perm_id')->select('perm_id')->where('user_id', $log_username->id)->first()->perm_id;
$p3 = DB::table('usr_profile')->select('gender', 'avatar', 'name_style', 'display_name')->where('user_id', $log_username->id)->first();
$user_id = $log_username->id;
$log_username = $log_username->username;
$showname = '';
$showcol = '';
if (!empty($p3->display_name)) $showname = $p3->display_name;
else $showname = $log_username;
if (!empty($p3->name_style)) $showcol = $p3->name_style;
else {
foreach ($ucol as $j3) {
if ($j3->id == $perm_id) {
if ($p3->gender == 1) $showcol = $j3->colour_m;
else if ($p3->gender == 2) $showcol = $j3->colour_f;
else $showcol = $j3->colour_u;
}
}
}
$p3->avatar = ($p3->avatar ? '/'.$p3->avatar : '/img/noicon.webp');
return array('user_id' => $user_id, 'showname' => $showname, 'showcol' => $showcol, 'avatar' => $p3->avatar);
}
return array();
}
?>

ファイルの表示

@ -13,7 +13,10 @@
<img style="height: 24px;" :src="c.icon" :alt="`${c.name}さんのアイコン`">
<a :href="c.channel">{{ (c.name || '名無しのテクニシャン') }}</a>
</span>
<span v-else>{{ (c.name || '名無しのテクニシャン') }}</span>
<span v-else>
<span v-if="c.user_id"><a :href="`/profile/${c.user_id}`" :style="c.showcol"><img style="width: 24px; height: 24px;" :src="c.avatar" :alt="`${c.showname}さんのアイコン`"> {{ c.showname }}</a></span>
<span v-else>{{ (c.name || '名無しのテクニシャン') }}</span>
</span>
</cite> <span class="says">より:</span>
<span class="comment-meta commentmetadata"> <a :href="`/blog/${slug}#comment-${c.id}`">{{ c.created }}</a></span>
</div>
@ -26,18 +29,28 @@
<span v-if="isvideo !== 'n'">
<hr />
<div v-if="err" class="alert alert-danger">{{ err }}</div>
<div class="form-group row">
<div class="col-md-4 col-lg-3">名前</div>
<div class="input-group col-md col-lg">
<input type="text" id="new-name" class="form-control" v-model="newComment.name" placeholder="ご入力しない場合、名前は「名無しのテクニシャン」になります。" />
<span v-if="user.length === 0">
<div class="form-group row">
<div class="col-md-4 col-lg-3">名前</div>
<div class="input-group col-md col-lg">
<input type="text" id="new-name" class="form-control" v-model="newComment.name" placeholder="ご入力しない場合、名前は「名無しのテクニシャン」になります。" />
</div>
</div>
</div>
<div class="form-group row">
<div class="col-md-4 col-lg-3">メールアドレス</div>
<div class="input-group col-md col-lg">
<input type="text" id="new-mail" class="form-control" v-model="newComment.mail" placeholder="返信される場合、メールに通知を送ります。" />
<div class="form-group row">
<div class="col-md-4 col-lg-3">メールアドレス</div>
<div class="input-group col-md col-lg">
<input type="text" id="new-mail" class="form-control" v-model="newComment.mail" placeholder="返信される場合、メールに通知を送ります。" />
</div>
</div>
</div>
</span>
<span v-else>
<div class="form-group row">
<div class="col-md-4 col-lg-3">名前</div>
<div class="input-group col-md col-lg">
<a :href="`/profile/${user.user_id}`" :style="user.showcol"><img style="width: 24px; height: 24px;" :src="user.avatar" :alt="`${user.showname}さんのアイコン`"> {{ user.showname }}</a>
</div>
</div>
</span>
<div class="row">
<div class="col-md-4 col-lg-3">本文</div>
<div class="col-md col-lg">
@ -55,7 +68,7 @@
<script>
export default {
props: { slug: '', isvideo: '', comments: Array },
props: { user: Array, slug: '', isvideo: '', comments: Array },
data: function () { return { comment: this.comments, newComment: {}, err: '', loading: true, sending: false } },
computed: {
total: function () {
@ -76,6 +89,7 @@
this.sending = true;
axios.post('/api/comment/new', {
user_id: this.user.user_id,
comment: this.newComment,
isvideo: this.isvideo,
slug: this.slug

ファイルの表示

@ -18,7 +18,7 @@
<div class="container-fluid">
<div class="row">
<div class="col">
<comments slug="{{$res->slug}}" isvideo="f" :comments="{{json_encode($res->comments)}}" />
<comments slug="{{$res->slug}}" isvideo="f" :comments="{{json_encode($res->comments)}}" :user="{{json_encode($res->user)}}" />
</div>
</div>
</div>

ファイルの表示

@ -33,21 +33,21 @@
<div class="tab-content">
<div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">
<comments slug="{{$res->slug}}" isvideo="t" :comments="{{json_encode($res->comments)}}" />
<comments slug="{{$res->pageslug}}" isvideo="t" :comments="{{json_encode($res->comments)}}" :user="{{json_encode($res->user)}}" />
</div>
@if ($res->ytcomment)
<div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<comments slug="{{$res->slug}}" isvideo="n" :comments="{{json_encode($res->ytcomment)}}" />
<comments slug="{{$res->pageslug}}" isvideo="n" :comments="{{json_encode($res->ytcomment)}}" :user="{{json_encode($res->user)}}" />
</div>
@endif
@if ($res->nicocomment)
<div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">
<comments slug="{{$res->slug}}" isvideo="n" :comments="{{json_encode($res->nicocomment)}}" />
<comments slug="{{$res->pageslug}}" isvideo="n" :comments="{{json_encode($res->nicocomment)}}" :user="{{json_encode($res->user)}}" />
</div>
@endif
@if ($res->bccomment)
<div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">
<comments slug="{{$res->slug}}" isvideo="n" :comments="{{json_encode($res->bccomment)}}" />
<comments slug="{{$res->pageslug}}" isvideo="n" :comments="{{json_encode($res->bccomment)}}" :user="{{json_encode($res->user)}}" />
</div>
@endif
</div>