ソースを参照

文章の修正

pull/18/head
コミット
0bf71f6537
  1. 23
      app/Http/Controllers/Home/Contact.php

23
app/Http/Controllers/Home/Contact.php

@ -87,19 +87,25 @@ class Contact {
// 文章
if (!isset($this->field['bunsyo']) || is_null($this->field['bunsyo']) || $this->field['bunsyo'] == '') $err[] = '文章をご入力下さい。';
if (str_contains($this->field['bunsyo'], 'http://') || str_contains($this->field['bunsyo'], 'https://')) $err[] = '文章でURLを入らないで下さい。';
if (isset($this->field['gpg'])) $this->field['bunsyo'] = $gpg->encrypt(trim("メール: ".$this->field['adr']."\n\n".$this->field['bunsyo']));
if (isset($this->field['gpg']) && !is_null($this->field['gpg']) && $this->field['gpg'] != '') $this->field['bunsyo'] = $gpg->encrypt(trim("メール: ".$this->field['adr']."\n\n".$this->field['bunsyo']));
// 連絡ルール
if (!$this->field['ruleapply']) $err[] = 'ルールを同意して下さい。';
if (!empty($err)) {
if (isset($this->field['gpg']) && !is_null($this->field['gpg']) && $this->field['gpg'] != '') Storage::disk('public')->delete($this->field['filename']);
if (isset($this->field['gpg']) && !is_null($this->field['gpg']) && $this->field['gpg'] != '') {
Storage::disk('public')->delete($this->field['filename']);
$this->field['bunsyo'] = $r->bunsyo;
}
return view('pages.site.contact', ['field' => $this->field, 'err' => $err]);
}
// カテゴリはDMCA報告、営業、税金、法律、又は無駄な話を選択したら、いつでも送信せず失敗します。
if (str_contains($this->field['cat'], 'scam')) {
Storage::disk('public')->delete($this->field['filename']);
if (isset($this->field['gpg']) && !is_null($this->field['gpg']) && $this->field['gpg'] != '') {
Storage::disk('public')->delete($this->field['filename']);
$this->field['bunsyo'] = $r->bunsyo;
}
return view('pages.site.contact', ['field' => $this->field, 'err' => ['送信に失敗しました。数時間後もう一回送信してみて下さい。']]);
}
@ -111,12 +117,17 @@ class Contact {
try {
$mail = new MailerController();
if (!$mail->compose($this->field, true)) {
Storage::disk('public')->delete($this->field['filename']);
if (isset($this->field['gpg']) && !is_null($this->field['gpg']) && $this->field['gpg'] != '') {
Storage::disk('public')->delete($this->field['filename']);
$this->field['bunsyo'] = $r->bunsyo;
}
return view('pages.site.contact', ['field' => $this->field, 'err' => ['送信に失敗しました。数時間後もう一回送信してみて下さい。']]);
}
} catch (\Throwable $e) {
Storage::disk('public')->delete($this->field['filename']);
$this->field['bunsyo'] = $r->bunsyo;
if (isset($this->field['gpg']) && !is_null($this->field['gpg']) && $this->field['gpg'] != '') {
Storage::disk('public')->delete($this->field['filename']);
$this->field['bunsyo'] = $r->bunsyo;
}
Log::critical($e);
return view('pages.site.contact', ['field' => $this->field, 'err' => ['送信に失敗しました。数時間後もう一回送信してみて下さい。']]);
}

読み込み中…
キャンセル
保存