また反スパム…

このコミットが含まれているのは:
テクニカル諏訪子 2021-07-22 21:08:43 +09:00
コミット c6b63e0e5d
3個のファイルの変更8行の追加7行の削除

ファイルの表示

@ -9,7 +9,7 @@ class Comment {
public function add (Request $r) {
if (!isset($r->submit)) return '';
if ($r->isvideo == 'f') $id = DB::table('blg_content')->select('id')->where('slug', $r->slug)->first()->id;
$banned = DB::table('blg_blacklist')->get();
$banned = DB::table('blg_blacklist')->where('isShadow', 0)->get();
foreach ($banned as $b) {
$ip = explode('.', getIp());
$ban = explode('.', $b->ipaddress);
@ -19,8 +19,9 @@ class Comment {
($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == '*' && $ban[3] == '*')
) return redirect('/bot-trap/');
}
$shadow = DB::table('blg_blacklist')->where('ipaddress', getIp())->first();
if ($shadow && !$shadow->isShadow) return array('status' => '0101FF', 'message' => '失礼しますが、あなたはBANされていましたので、コメントを保存できません。');
if ($r->user_id == 0 && (str_contains($r->newmessage, 'http://') || str_contains($r->newmessage, 'https://'))) return redirect('/');
$shadow = DB::table('blg_blacklist')->where('isShadow', 1)->where('ipaddress', getIp())->first();
$add = DB::table('blg_comments')->insertGetId([
'user_id' => ($r->user_id != 0 ?: null),

ファイルの表示

@ -37,7 +37,7 @@ class CommentList extends Engine {
$g->showcol = $det['showcol'];
$g->avatar = $det['avatar'];
}
if ($g->isShadow == 0) {
if (getIp() != $g->ipaddress) unset($get->comments[$k]);
}
@ -49,7 +49,7 @@ class CommentList extends Engine {
if (!empty($g->display_name)) $g->showname = $g->display_name;
else $g->showname = $g->username;
if (!empty($g->name_style)) $g->showcol = $g->name_style;
else {
foreach (getGroupColours() as $j) {
@ -60,7 +60,7 @@ class CommentList extends Engine {
}
}
}
$g->user = userDetail(null, DB::table('users')->select('kero_token')->where('id', $g->user_id)->first()->kero_token);
}
else {

ファイルの表示

@ -58,7 +58,7 @@ class Content extends Engine {
if (count($incomplete) > 0) $err = implode('、', $incomplete).'をご入力下さい。';
// スラッグが既に存在したら、エラーを出て
if (empty($err)) {
if (empty($err)) {
$sl = DB::table('blg_content')->select('slug')->where('slug', $r->slug)->first();
if ($sl && $sl->slug == $r->slug) $err = 'このスラッグがもう存在しています。';
}