Commit 1d9d6d40 by Triyah Fatmawati

Allow strip tags tabel

parent 23cf8977
...@@ -49,7 +49,6 @@ class AgendaController extends Controller ...@@ -49,7 +49,6 @@ class AgendaController extends Controller
{ {
if ($request->ajax()) { if ($request->ajax()) {
$data = $this->repo->get(['rEn']); $data = $this->repo->get(['rEn']);
return $this->repo->datatable($data); return $this->repo->datatable($data);
} }
...@@ -79,7 +78,7 @@ class AgendaController extends Controller ...@@ -79,7 +78,7 @@ class AgendaController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img']); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['title'] = strip_tags($request->title); $request['title'] = strip_tags($request->title);
$request->validate([ $request->validate([
'title' => 'required', 'title' => 'required',
...@@ -88,12 +87,9 @@ class AgendaController extends Controller ...@@ -88,12 +87,9 @@ class AgendaController extends Controller
'keys' => 'max:100' 'keys' => 'max:100'
], [ ], [
'title.required' => 'Judul wajib diisi', 'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
'event_date.required' => 'Tanggal posting wajib diisi', 'event_date.required' => 'Tanggal posting wajib diisi',
// 'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf',
'keys.max' => 'Keyword terlalu panjang' 'keys.max' => 'Keyword terlalu panjang'
]); ]);
...@@ -125,7 +121,7 @@ class AgendaController extends Controller ...@@ -125,7 +121,7 @@ class AgendaController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataEn['agenda_id'] = $agenda->id; $dataEn['agenda_id'] = $agenda->id;
$dataEn['title'] = $title; $dataEn['title'] = $title;
...@@ -143,7 +139,7 @@ class AgendaController extends Controller ...@@ -143,7 +139,7 @@ class AgendaController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataDe['agenda_id'] = $agenda->id; $dataDe['agenda_id'] = $agenda->id;
$dataDe['title'] = $title; $dataDe['title'] = $title;
...@@ -161,7 +157,7 @@ class AgendaController extends Controller ...@@ -161,7 +157,7 @@ class AgendaController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataSa['agenda_id'] = $agenda->id; $dataSa['agenda_id'] = $agenda->id;
$dataSa['title'] = $title; $dataSa['title'] = $title;
...@@ -179,7 +175,7 @@ class AgendaController extends Controller ...@@ -179,7 +175,7 @@ class AgendaController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataZh['agenda_id'] = $agenda->id; $dataZh['agenda_id'] = $agenda->id;
$dataZh['title'] = $title; $dataZh['title'] = $title;
...@@ -249,11 +245,11 @@ class AgendaController extends Controller ...@@ -249,11 +245,11 @@ class AgendaController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_en'] = strip_tags($request->content_en, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_en'] = strip_tags($request->content_en, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_de'] = strip_tags($request->content_de, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_de'] = strip_tags($request->content_de, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_sa'] = strip_tags($request->content_sa, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_sa'] = strip_tags($request->content_sa, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_zh'] = strip_tags($request->content_zh, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_zh'] = strip_tags($request->content_zh, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['title'] = strip_tags($request->title); $request['title'] = strip_tags($request->title);
$request['title_en'] = strip_tags($request->title_en); $request['title_en'] = strip_tags($request->title_en);
$request['title_de'] = strip_tags($request->title_de); $request['title_de'] = strip_tags($request->title_de);
...@@ -261,18 +257,13 @@ class AgendaController extends Controller ...@@ -261,18 +257,13 @@ class AgendaController extends Controller
$request['title_zh'] = strip_tags($request->title_zh); $request['title_zh'] = strip_tags($request->title_zh);
$request->validate([ $request->validate([
// 'title' => 'required',
'content' => 'required|min:3', 'content' => 'required|min:3',
'event_date' => 'required', 'event_date' => 'required',
'keys' => 'max:100' 'keys' => 'max:100'
], [ ], [
'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
'event_date.required' => 'Tanggal posting wajib diisi', 'event_date.required' => 'Tanggal posting wajib diisi',
// 'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf',
'keys.max' => 'Keyword terlalu panjang' 'keys.max' => 'Keyword terlalu panjang'
]); ]);
...@@ -310,8 +301,8 @@ class AgendaController extends Controller ...@@ -310,8 +301,8 @@ class AgendaController extends Controller
public function updateEn($data, $agenda, $manual) public function updateEn($data, $agenda, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataEn['title'] = $data['title_en']; $dataEn['title'] = strip_tags($data['title_en']);
$dataEn['content'] = $data['content_en']; $dataEn['content'] = strip_tags($data['content_en'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
if ($data['content'] == null) { if ($data['content'] == null) {
...@@ -320,7 +311,7 @@ class AgendaController extends Controller ...@@ -320,7 +311,7 @@ class AgendaController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataEn['title'] = $title; $dataEn['title'] = $title;
$dataEn['content'] = $content; $dataEn['content'] = $content;
...@@ -332,8 +323,8 @@ class AgendaController extends Controller ...@@ -332,8 +323,8 @@ class AgendaController extends Controller
public function updateDe($data, $agenda, $manual) public function updateDe($data, $agenda, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataDe['title'] = $data['title_de']; $dataDe['title'] = strip_tags($data['title_de']);
$dataDe['content'] = $data['content_de']; $dataDe['content'] = strip_tags($data['content_de'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -343,7 +334,7 @@ class AgendaController extends Controller ...@@ -343,7 +334,7 @@ class AgendaController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataDe['title'] = $title; $dataDe['title'] = $title;
$dataDe['content'] = $content; $dataDe['content'] = $content;
...@@ -354,8 +345,8 @@ class AgendaController extends Controller ...@@ -354,8 +345,8 @@ class AgendaController extends Controller
public function updateSa($data, $agenda, $manual) public function updateSa($data, $agenda, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataSa['title'] = $data['title_sa']; $dataSa['title'] = strip_tags($data['title_sa']);
$dataSa['content'] = $data['content_sa']; $dataSa['content'] = strip_tags($data['content_sa'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -365,7 +356,7 @@ class AgendaController extends Controller ...@@ -365,7 +356,7 @@ class AgendaController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataSa['title'] = $title; $dataSa['title'] = $title;
$dataSa['content'] = $content; $dataSa['content'] = $content;
...@@ -377,8 +368,8 @@ class AgendaController extends Controller ...@@ -377,8 +368,8 @@ class AgendaController extends Controller
public function updateZh($data, $agenda, $manual) public function updateZh($data, $agenda, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataZh['title'] = $data['title_zh']; $dataZh['title'] = strip_tags($data['title_zh']);
$dataZh['content'] = $data['content_zh']; $dataZh['content'] = strip_tags($data['content_zh'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -388,7 +379,7 @@ class AgendaController extends Controller ...@@ -388,7 +379,7 @@ class AgendaController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataZh['title'] = $title; $dataZh['title'] = $title;
$dataZh['content'] = $content; $dataZh['content'] = $content;
......
...@@ -72,13 +72,11 @@ class CategoryController extends Controller ...@@ -72,13 +72,11 @@ class CategoryController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
// dd($request); $request['name'] = strip_tags($request->name);
$request->validate([ $request->validate([
'name' => 'required' 'name' => 'required'
], [ ], [
'name.required' => 'Kategori wajib diisi', 'name.required' => 'Kategori wajib diisi',
// 'name.regex' => 'Kategori tidak valid! Kategori hanya berupa angka dan huruf',
// 'name.max' => 'Kategori terlalu panjang'
]); ]);
$data = $request->except('_token'); $data = $request->except('_token');
...@@ -98,7 +96,7 @@ class CategoryController extends Controller ...@@ -98,7 +96,7 @@ class CategoryController extends Controller
private function createEn($data, $category) private function createEn($data, $category)
{ {
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGET, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['name']));
$dataEn['category_id'] = $category->id; $dataEn['category_id'] = $category->id;
$dataEn['name'] = $name; $dataEn['name'] = $name;
...@@ -109,7 +107,7 @@ class CategoryController extends Controller ...@@ -109,7 +107,7 @@ class CategoryController extends Controller
private function createDe($data, $category) private function createDe($data, $category)
{ {
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETDE, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['name']));
$dataDe['category_id'] = $category->id; $dataDe['category_id'] = $category->id;
$dataDe['name'] = $name; $dataDe['name'] = $name;
...@@ -120,7 +118,7 @@ class CategoryController extends Controller ...@@ -120,7 +118,7 @@ class CategoryController extends Controller
private function createSa($data, $category) private function createSa($data, $category)
{ {
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETSA, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['name']));
$dataSa['category_id'] = $category->id; $dataSa['category_id'] = $category->id;
$dataSa['name'] = $name; $dataSa['name'] = $name;
...@@ -131,7 +129,7 @@ class CategoryController extends Controller ...@@ -131,7 +129,7 @@ class CategoryController extends Controller
private function createZh($data, $category) private function createZh($data, $category)
{ {
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETZH, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['name']));
$dataZh['category_id'] = $category->id; $dataZh['category_id'] = $category->id;
$dataZh['name'] = $name; $dataZh['name'] = $name;
...@@ -179,7 +177,6 @@ class CategoryController extends Controller ...@@ -179,7 +177,6 @@ class CategoryController extends Controller
'data' => $data, 'data' => $data,
'manual' => $manual, 'manual' => $manual,
]; ];
// dd($data);
return view('webprofile.backend.categories.edit_per_bahasa', $data)->withTitle(trans('feature.edit_category')); return view('webprofile.backend.categories.edit_per_bahasa', $data)->withTitle(trans('feature.edit_category'));
} }
...@@ -193,15 +190,13 @@ class CategoryController extends Controller ...@@ -193,15 +190,13 @@ class CategoryController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
// dd($request); $request['name'] = strip_tags($request->name);
$request->validate([ $request->validate([
'name' => 'required', 'name' => 'required',
], [ ], [
'name.required' => 'Kategori wajib diisi', 'name.required' => 'Kategori wajib diisi',
// 'name.regex' => 'Kategori tidak valid! Kategori hanya berupa angka dan huruf',
// 'name.max' => 'Kategori terlalu panjang',
]); ]);
// dd($request);
$data = $request->except(['_token', 'manual', 'id', 'name_en', 'name_de', 'name_sa', 'name_zh']); $data = $request->except(['_token', 'manual', 'id', 'name_en', 'name_de', 'name_sa', 'name_zh']);
// // $dataEn = $request->except(['_token', 'id', 'name_de']); // // $dataEn = $request->except(['_token', 'id', 'name_de']);
$dataEn = $request->except(['_token','id', 'manual']); $dataEn = $request->except(['_token','id', 'manual']);
...@@ -211,12 +206,11 @@ class CategoryController extends Controller ...@@ -211,12 +206,11 @@ class CategoryController extends Controller
// $dataEn['name_sa'] = htmlspecialchars($request->name_sa); // $dataEn['name_sa'] = htmlspecialchars($request->name_sa);
// $dataEn['name_zh'] = htmlspecialchars($request->name_zh); // $dataEn['name_zh'] = htmlspecialchars($request->name_zh);
// // $dataDe = $request->except(['_token', 'id', 'name', 'name_en']); // // $dataDe = $request->except(['_token', 'id', 'name', 'name_en']);
// // dd($request, $dataEn);
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0; array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
$category = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']); $category = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
// $edit = $this->repo->update($data, $category); // $edit = $this->repo->update($data, $category);
// dd($dataEn, $category, $request->manual);
$this->updateEn($dataEn, $category, $request->manual); $this->updateEn($dataEn, $category, $request->manual);
...@@ -224,7 +218,7 @@ class CategoryController extends Controller ...@@ -224,7 +218,7 @@ class CategoryController extends Controller
$this->updateSa($dataEn, $category, $request->manual); $this->updateSa($dataEn, $category, $request->manual);
$this->updateZh($dataEn, $category, $request->manual); $this->updateZh($dataEn, $category, $request->manual);
$this->repo->update($data, $category); $this->repo->update($data, $category);
// dd($data, $category, $request->manual);
return redirect()->route('category.index'); return redirect()->route('category.index');
} }
...@@ -240,24 +234,20 @@ class CategoryController extends Controller ...@@ -240,24 +234,20 @@ class CategoryController extends Controller
// $this->repoEn->store($dataEn); // $this->repoEn->store($dataEn);
// } // }
// dd($data, $category, $manual);
// dd($data, $category, $manual);
if($manual==1){ if($manual==1){
$dataEn['name'] = $data['name_en']; $dataEn['name'] = strip_tags($data['name_en']);
} }
else{ else{
if (strip_tags($data['name']) == null) { if ($data['name'] == null) {
$data['name'] = 'kosong'; $data['name'] = 'kosong';
} }
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGET, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['name']));
$dataEn['name'] = $name; $dataEn['name'] = $name;
// dd($dataEn);
} }
// dd($category);
$this->repoEn->update($dataEn, $category); $this->repoEn->update($dataEn, $category);
} }
...@@ -275,15 +265,15 @@ class CategoryController extends Controller ...@@ -275,15 +265,15 @@ class CategoryController extends Controller
// } // }
if($manual==1){ if($manual==1){
$dataDe['name'] = $data['name_de']; $dataDe['name'] = strip_tags($data['name_de']);
} }
else{ else{
if (strip_tags($data['name']) == null) { if ($data['name'] == null) {
$data['name'] = 'kosong'; $data['name'] = 'kosong';
} }
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETDE, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['name']));
$dataDe['name'] = $name; $dataDe['name'] = $name;
} }
$this->repoDe->update($dataDe, $category); $this->repoDe->update($dataDe, $category);
...@@ -303,15 +293,15 @@ class CategoryController extends Controller ...@@ -303,15 +293,15 @@ class CategoryController extends Controller
// } // }
if($manual==1){ if($manual==1){
$dataSa['name'] = $data['name_sa']; $dataSa['name'] = strip_tags($data['name_sa']);
} }
else{ else{
if (strip_tags($data['name']) == null) { if ($data['name'] == null) {
$data['name'] = 'kosong'; $data['name'] = 'kosong';
} }
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETSA, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['name']));
$dataSa['name'] = $name; $dataSa['name'] = $name;
} }
$this->repoSa->update($dataSa, $category); $this->repoSa->update($dataSa, $category);
...@@ -331,15 +321,15 @@ class CategoryController extends Controller ...@@ -331,15 +321,15 @@ class CategoryController extends Controller
// } // }
if($manual==1){ if($manual==1){
$dataZh['name'] = $data['name_zh']; $dataZh['name'] = strip_tags($data['name_zh']);
} }
else{ else{
if (strip_tags($data['name']) == null) { if ($data['name'] == null) {
$data['name'] = 'kosong'; $data['name'] = 'kosong';
} }
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETZH, $data['name']); $name = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['name']));
$dataZh['name'] = $name; $dataZh['name'] = $name;
} }
$this->repoZh->update($dataZh, $category); $this->repoZh->update($dataZh, $category);
......
...@@ -79,7 +79,7 @@ class InformationController extends Controller ...@@ -79,7 +79,7 @@ class InformationController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['title'] = strip_tags($request->title); $request['title'] = strip_tags($request->title);
$request->validate([ $request->validate([
'title' => 'required', 'title' => 'required',
...@@ -88,13 +88,10 @@ class InformationController extends Controller ...@@ -88,13 +88,10 @@ class InformationController extends Controller
'keys' => 'max:100' 'keys' => 'max:100'
], [ ], [
'title.required' => 'Judul wajib diisi', 'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
'event_date.required' => 'Tanggal posting wajib diisi', 'event_date.required' => 'Tanggal posting wajib diisi',
'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf', 'keys.max' => 'Keyword terlalu panjang'
// 'keys.max' => 'Keyword terlalu panjang'
]); ]);
$data = $request->except('_token'); $data = $request->except('_token');
...@@ -102,7 +99,7 @@ class InformationController extends Controller ...@@ -102,7 +99,7 @@ class InformationController extends Controller
array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0; array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0;
$data['slug'] = str_slug($request->input('title')); $data['slug'] = str_slug($request->input('title'));
// dd($request);
$save = $this->repo->store($data); $save = $this->repo->store($data);
if (webprofilesetting()['auto_translate'] == 1) { if (webprofilesetting()['auto_translate'] == 1) {
...@@ -125,7 +122,7 @@ class InformationController extends Controller ...@@ -125,7 +122,7 @@ class InformationController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataEn['information_id'] = $information->id; $dataEn['information_id'] = $information->id;
$dataEn['title'] = $title; $dataEn['title'] = $title;
...@@ -143,7 +140,7 @@ class InformationController extends Controller ...@@ -143,7 +140,7 @@ class InformationController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataDe['information_id'] = $information->id; $dataDe['information_id'] = $information->id;
$dataDe['title'] = $title; $dataDe['title'] = $title;
...@@ -161,7 +158,7 @@ class InformationController extends Controller ...@@ -161,7 +158,7 @@ class InformationController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataSa['information_id'] = $information->id; $dataSa['information_id'] = $information->id;
$dataSa['title'] = $title; $dataSa['title'] = $title;
...@@ -179,7 +176,7 @@ class InformationController extends Controller ...@@ -179,7 +176,7 @@ class InformationController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataZh['information_id'] = $information->id; $dataZh['information_id'] = $information->id;
$dataZh['title'] = $title; $dataZh['title'] = $title;
...@@ -259,19 +256,14 @@ class InformationController extends Controller ...@@ -259,19 +256,14 @@ class InformationController extends Controller
$request['title_zh'] = strip_tags($request->title_zh); $request['title_zh'] = strip_tags($request->title_zh);
$request->validate([ $request->validate([
// 'title' => 'required',
'content' => 'required|min:3', 'content' => 'required|min:3',
'event_date' => 'required', 'event_date' => 'required',
'keys' => 'max:100' 'keys' => 'max:100'
], [ ], [
'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
'event_date.required' => 'Tanggal posting wajib diisi', 'event_date.required' => 'Tanggal posting wajib diisi',
'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf', 'keys.max' => 'Keyword terlalu panjang'
// 'keys.max' => 'Keyword terlalu panjang'
]); ]);
$data = $request->except(['_token', 'manual', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa', 'title_zh', 'content_zh']); $data = $request->except(['_token', 'manual', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa', 'title_zh', 'content_zh']);
...@@ -293,7 +285,7 @@ class InformationController extends Controller ...@@ -293,7 +285,7 @@ class InformationController extends Controller
array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0; array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0;
$data['slug'] = str_slug($request->input('title')); $data['slug'] = str_slug($request->input('title'));
// dd($request, $dataEn);
$information = $this->repo->findId($id, ['rEn', 'rDe', 'rSa','rZh']); $information = $this->repo->findId($id, ['rEn', 'rDe', 'rSa','rZh']);
$this->updateEn($dataEn, $information, $request->manual); $this->updateEn($dataEn, $information, $request->manual);
...@@ -308,8 +300,8 @@ class InformationController extends Controller ...@@ -308,8 +300,8 @@ class InformationController extends Controller
public function updateEn($data, $information, $manual) public function updateEn($data, $information, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataEn['title'] = $data['title_en']; $dataEn['title'] = strip_tags($data['title_en']);
$dataEn['content'] = $data['content_en']; $dataEn['content'] = strip_tags($data['content_en'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
if ($data['content'] == null) { if ($data['content'] == null) {
...@@ -318,7 +310,7 @@ class InformationController extends Controller ...@@ -318,7 +310,7 @@ class InformationController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataEn['title'] = $title; $dataEn['title'] = $title;
$dataEn['content'] = $content; $dataEn['content'] = $content;
...@@ -330,8 +322,8 @@ class InformationController extends Controller ...@@ -330,8 +322,8 @@ class InformationController extends Controller
public function updateDe($data, $information, $manual) public function updateDe($data, $information, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataDe['title'] = $data['title_de']; $dataDe['title'] = strip_tags($data['title_de']);
$dataDe['content'] = $data['content_de']; $dataDe['content'] = strip_tags($data['content_de'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
if ($data['content'] == null) { if ($data['content'] == null) {
...@@ -340,7 +332,7 @@ class InformationController extends Controller ...@@ -340,7 +332,7 @@ class InformationController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataDe['title'] = $title; $dataDe['title'] = $title;
$dataDe['content'] = $content; $dataDe['content'] = $content;
...@@ -351,8 +343,8 @@ class InformationController extends Controller ...@@ -351,8 +343,8 @@ class InformationController extends Controller
public function updateSa($data, $information, $manual) public function updateSa($data, $information, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataSa['title'] = $data['title_sa']; $dataSa['title'] = strip_tags($data['title_sa']);
$dataSa['content'] = $data['content_sa']; $dataSa['content'] = strip_tags($data['content_sa'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -362,7 +354,7 @@ class InformationController extends Controller ...@@ -362,7 +354,7 @@ class InformationController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataSa['title'] = $title; $dataSa['title'] = $title;
$dataSa['content'] = $content; $dataSa['content'] = $content;
...@@ -374,8 +366,8 @@ class InformationController extends Controller ...@@ -374,8 +366,8 @@ class InformationController extends Controller
public function updateZh($data, $information, $manual) public function updateZh($data, $information, $manual)
{ {
if($manual==1) { if($manual==1) {
$dataZh['title'] = $data['title_zh']; $dataZh['title'] = strip_tags($data['title_zh']);
$dataZh['content'] = $data['content_zh']; $dataZh['content'] = strip_tags($data['content_zh'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -385,7 +377,7 @@ class InformationController extends Controller ...@@ -385,7 +377,7 @@ class InformationController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataZh['title'] = $title; $dataZh['title'] = $title;
$dataZh['content'] = $content; $dataZh['content'] = $content;
......
...@@ -79,7 +79,6 @@ class PageController extends Controller ...@@ -79,7 +79,6 @@ class PageController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
// dd($request);
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
$request['title'] = strip_tags($request->title); $request['title'] = strip_tags($request->title);
$request->validate([ $request->validate([
...@@ -88,11 +87,8 @@ class PageController extends Controller ...@@ -88,11 +87,8 @@ class PageController extends Controller
'keys' => 'max:100' 'keys' => 'max:100'
], [ ], [
'title.required' => 'Judul wajib diisi', 'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
// 'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf',
'keys.max' => 'Keyword terlalu panjang' 'keys.max' => 'Keyword terlalu panjang'
]); ]);
...@@ -245,7 +241,6 @@ class PageController extends Controller ...@@ -245,7 +241,6 @@ class PageController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
// dd($request);
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
$request['content_en'] = strip_tags($request->content_en, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']); $request['content_en'] = strip_tags($request->content_en, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
$request['content_de'] = strip_tags($request->content_de, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']); $request['content_de'] = strip_tags($request->content_de, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
...@@ -258,16 +253,11 @@ class PageController extends Controller ...@@ -258,16 +253,11 @@ class PageController extends Controller
$request['title_zh'] = strip_tags($request->title_zh); $request['title_zh'] = strip_tags($request->title_zh);
$request->validate([ $request->validate([
// 'title' => 'required',
'content' => 'required|min:3', 'content' => 'required|min:3',
'keys' => 'max:100' 'keys' => 'max:100'
], [ ], [
'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
// 'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf',
'keys.max' => 'Keyword terlalu panjang' 'keys.max' => 'Keyword terlalu panjang'
]); ]);
...@@ -303,8 +293,8 @@ class PageController extends Controller ...@@ -303,8 +293,8 @@ class PageController extends Controller
public function updateEn($data, $page, $manual) public function updateEn($data, $page, $manual)
{ {
if ($manual==1){ if ($manual==1){
$dataEn['title'] = $data['title_en']; $dataEn['title'] = strip_tags($data['title_en']);
$dataEn['content'] = $data['content_en']; $dataEn['content'] = strip_tags($data['content_en'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
} }
else{ else{
if ($data['content'] == null) { if ($data['content'] == null) {
...@@ -325,8 +315,8 @@ class PageController extends Controller ...@@ -325,8 +315,8 @@ class PageController extends Controller
public function updateDe($data, $page, $manual) public function updateDe($data, $page, $manual)
{ {
if($manual==1){ if($manual==1){
$dataDe['title'] = $data['title_de']; $dataDe['title'] = strip_tags($data['title_de']);
$dataDe['content'] = $data['content_de']; $dataDe['content'] = strip_tags($data['content_de'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
} }
else{ else{
if($data['content']==null){ if($data['content']==null){
...@@ -346,8 +336,8 @@ class PageController extends Controller ...@@ -346,8 +336,8 @@ class PageController extends Controller
public function updateSa($data, $page, $manual) public function updateSa($data, $page, $manual)
{ {
if($manual==1){ if($manual==1){
$dataSa['title'] = $data['title_sa']; $dataSa['title'] = strip_tags($data['title_sa']);
$dataSa['content'] = $data['content_sa']; $dataSa['content'] = strip_tags($data['content_sa'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
} }
else{ else{
if($data['content']==null){ if($data['content']==null){
...@@ -368,8 +358,8 @@ class PageController extends Controller ...@@ -368,8 +358,8 @@ class PageController extends Controller
public function updateZh($data, $page, $manual) public function updateZh($data, $page, $manual)
{ {
if($manual==1){ if($manual==1){
$dataZh['title'] = $data['title_zh']; $dataZh['title'] = strip_tags($data['title_zh']);
$dataZh['content'] = $data['content_zh']; $dataZh['content'] = strip_tags($data['content_zh'],['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe']);
} }
else{ else{
if($data['content']==null){ if($data['content']==null){
......
...@@ -88,8 +88,7 @@ class PostController extends Controller ...@@ -88,8 +88,7 @@ class PostController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
// dd($request); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']);
$request['title'] = strip_tags($request->title); $request['title'] = strip_tags($request->title);
$request->validate([ $request->validate([
'title' => 'required', 'title' => 'required',
...@@ -97,17 +96,14 @@ class PostController extends Controller ...@@ -97,17 +96,14 @@ class PostController extends Controller
'content' => 'required|min:3', 'content' => 'required|min:3',
'post_date' => 'required', 'post_date' => 'required',
'keys' => 'max:100', 'keys' => 'max:100',
'thumbnail' => 'required|mimes:jpg,jpeg,png|max : 3072' 'thumbnail' => 'mimes:jpg,jpeg,png|max : 3072'
], [ ], [
'title.required' => 'Judul wajib diisi', 'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'categories.required' => 'Kategori wajib diisi', 'categories.required' => 'Kategori wajib diisi',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
'post_date.required' => 'Tanggal posting wajib diisi', 'post_date.required' => 'Tanggal posting wajib diisi',
// 'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf',
'keys.max' => 'Keyword terlalu panjang' 'keys.max' => 'Keyword terlalu panjang'
]); ]);
...@@ -215,12 +211,6 @@ class PostController extends Controller ...@@ -215,12 +211,6 @@ class PostController extends Controller
// $this->socialRepo->sendTweetWithMedia($setting['header_admin'].'-'.$title."\n\n".$url."\n\n".$hashtag, [$img]); // $this->socialRepo->sendTweetWithMedia($setting['header_admin'].'-'.$title."\n\n".$url."\n\n".$hashtag, [$img]);
// } // }
// } // }
// } // }
} }
...@@ -233,7 +223,7 @@ class PostController extends Controller ...@@ -233,7 +223,7 @@ class PostController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataEn['post_id'] = $post->id; $dataEn['post_id'] = $post->id;
$dataEn['title'] = $title; $dataEn['title'] = $title;
...@@ -251,7 +241,7 @@ class PostController extends Controller ...@@ -251,7 +241,7 @@ class PostController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataDe['post_id'] = $post->id; $dataDe['post_id'] = $post->id;
$dataDe['title'] = $title; $dataDe['title'] = $title;
...@@ -269,7 +259,7 @@ class PostController extends Controller ...@@ -269,7 +259,7 @@ class PostController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataSa['post_id'] = $post->id; $dataSa['post_id'] = $post->id;
$dataSa['title'] = $title; $dataSa['title'] = $title;
...@@ -287,7 +277,7 @@ class PostController extends Controller ...@@ -287,7 +277,7 @@ class PostController extends Controller
$data['content'] = 'kosong'; $data['content'] = 'kosong';
} }
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataZh['post_id'] = $post->id; $dataZh['post_id'] = $post->id;
$dataZh['title'] = $title; $dataZh['title'] = $title;
...@@ -356,11 +346,11 @@ class PostController extends Controller ...@@ -356,11 +346,11 @@ class PostController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_en'] = strip_tags($request->content_en, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_en'] = strip_tags($request->content_en, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_de'] = strip_tags($request->content_de, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_de'] = strip_tags($request->content_de, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_sa'] = strip_tags($request->content_sa, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_sa'] = strip_tags($request->content_sa, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['content_zh'] = strip_tags($request->content_zh, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']); $request['content_zh'] = strip_tags($request->content_zh, ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
$request['title'] = strip_tags($request->title); $request['title'] = strip_tags($request->title);
$request['title_en'] = strip_tags($request->title_en); $request['title_en'] = strip_tags($request->title_en);
$request['title_de'] = strip_tags($request->title_de); $request['title_de'] = strip_tags($request->title_de);
...@@ -368,21 +358,16 @@ class PostController extends Controller ...@@ -368,21 +358,16 @@ class PostController extends Controller
$request['title_zh'] = strip_tags($request->title_zh); $request['title_zh'] = strip_tags($request->title_zh);
$request->validate([ $request->validate([
// 'title' => 'required',
'categories' => 'required', 'categories' => 'required',
'content' => 'required|min:3', 'content' => 'required|min:3',
'post_date' => 'required', 'post_date' => 'required',
'keys' => 'max:100', 'keys' => 'max:100',
'thumbnail' => 'mimes:jpg,jpeg,png|max : 3072' 'thumbnail' => 'mimes:jpg,jpeg,png|max : 3072'
], [ ], [
'title.required' => 'Judul wajib diisi',
// 'title.regex' => 'Judul tidak valid! Judul hanya berupa angka dan huruf',
// 'title.max' => 'Judul terlalu panjang',
'categories.required' => 'Kategori wajib diisi', 'categories.required' => 'Kategori wajib diisi',
'content.required' => 'Konten wajib diisi', 'content.required' => 'Konten wajib diisi',
'content.min' => 'Konten terlalu singkat', 'content.min' => 'Konten terlalu singkat',
'post_date.required' => 'Tanggal posting wajib diisi', 'post_date.required' => 'Tanggal posting wajib diisi',
// 'keys.regex' => 'Keyword tidak valid! Keyword hanya berupa angka dan huruf',
'keys.max' => 'Keyword terlalu panjang' 'keys.max' => 'Keyword terlalu panjang'
]); ]);
...@@ -407,10 +392,10 @@ class PostController extends Controller ...@@ -407,10 +392,10 @@ class PostController extends Controller
array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0; array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0;
array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0; array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0;
$data['slug'] = Str::slug($request->input('title')); $data['slug'] = Str::slug($request->input('title'));
// dd($dataEn);
$post = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']); $post = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$edit = $this->repo->update($data, $post); $edit = $this->repo->update($data, $post);
// dd($post);
$tipe = 'thumbnail'; $tipe = 'thumbnail';
if ($request->hasFile($tipe)) { if ($request->hasFile($tipe)) {
$img[$tipe] = $post->id.'.'.$request->file($tipe)->guessClientExtension(); $img[$tipe] = $post->id.'.'.$request->file($tipe)->guessClientExtension();
...@@ -418,7 +403,7 @@ class PostController extends Controller ...@@ -418,7 +403,7 @@ class PostController extends Controller
$this->repo->upload($img[$tipe], $request, $tipe); $this->repo->upload($img[$tipe], $request, $tipe);
$this->repo->update($img, $post); $this->repo->update($img, $post);
} }
// dd($dataEn);
$this->updateEn($dataEn, $post, $request->manual); $this->updateEn($dataEn, $post, $request->manual);
$this->updateDe($dataEn, $post, $request->manual); $this->updateDe($dataEn, $post, $request->manual);
$this->updateSa($dataEn, $post, $request->manual); $this->updateSa($dataEn, $post, $request->manual);
...@@ -429,11 +414,9 @@ class PostController extends Controller ...@@ -429,11 +414,9 @@ class PostController extends Controller
public function updateEn($data, $post, $manual) public function updateEn($data, $post, $manual)
{ {
// dd($manual);
if($manual==1){ if($manual==1){
$dataEn['title'] = $data['title_en']; $dataEn['title'] = strip_tags($data['title_en']);
$dataEn['content'] = $data['content_en']; $dataEn['content'] = strip_tags($data['content_en'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -443,11 +426,10 @@ class PostController extends Controller ...@@ -443,11 +426,10 @@ class PostController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
// dd($title);
$dataEn['title'] = $title; $dataEn['title'] = $title;
$dataEn['content'] = $content; $dataEn['content'] = $content;
// dd($dataEn['title']);
} }
$this->repoEn->update($dataEn, $post); $this->repoEn->update($dataEn, $post);
} }
...@@ -455,8 +437,8 @@ class PostController extends Controller ...@@ -455,8 +437,8 @@ class PostController extends Controller
public function updateDe($data, $post, $manual) public function updateDe($data, $post, $manual)
{ {
if($manual==1){ if($manual==1){
$dataDe['title'] = $data['title_de']; $dataDe['title'] = strip_tags($data['title_de']);
$dataDe['content'] = $data['content_de']; $dataDe['content'] = strip_tags($data['content_de'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -466,7 +448,7 @@ class PostController extends Controller ...@@ -466,7 +448,7 @@ class PostController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataDe['title'] = $title; $dataDe['title'] = $title;
$dataDe['content'] = $content; $dataDe['content'] = $content;
} }
...@@ -476,8 +458,8 @@ class PostController extends Controller ...@@ -476,8 +458,8 @@ class PostController extends Controller
public function updateSa($data, $post, $manual) public function updateSa($data, $post, $manual)
{ {
if($manual==1){ if($manual==1){
$dataSa['title'] = $data['title_sa']; $dataSa['title'] = strip_tags($data['title_sa']);
$dataSa['content'] = $data['content_sa']; $dataSa['content'] = strip_tags($data['content_sa'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
...@@ -487,7 +469,7 @@ class PostController extends Controller ...@@ -487,7 +469,7 @@ class PostController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataSa['title'] = $title; $dataSa['title'] = $title;
$dataSa['content'] = $content; $dataSa['content'] = $content;
} }
...@@ -497,8 +479,8 @@ class PostController extends Controller ...@@ -497,8 +479,8 @@ class PostController extends Controller
public function updateZh($data, $post, $manual) public function updateZh($data, $post, $manual)
{ {
if($manual==1){ if($manual==1){
$dataZh['title'] = $data['title_zh']; $dataZh['title'] = strip_tags($data['title_zh']);
$dataZh['content'] = $data['content_zh']; $dataZh['content'] = strip_tags($data['content_zh'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']);
} }
else{ else{
if ($data['content'] == null) { if ($data['content'] == null) {
...@@ -507,7 +489,7 @@ class PostController extends Controller ...@@ -507,7 +489,7 @@ class PostController extends Controller
$trans = new GoogleTranslate(); $trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title'])); $title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title']));
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img'])); $content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th']));
$dataZh['title'] = $title; $dataZh['title'] = $title;
$dataZh['content'] = $content; $dataZh['content'] = $content;
} }
......
...@@ -60,7 +60,6 @@ class UserController extends Controller ...@@ -60,7 +60,6 @@ class UserController extends Controller
*/ */
public function store(UserRequest $request) public function store(UserRequest $request)
{ {
// dd($request);
$request->validate([ $request->validate([
'password' => 'required|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/|min:8|confirmed', 'password' => 'required|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/|min:8|confirmed',
], [ ], [
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
@section('breadcrumbs') @section('breadcrumbs')
<li><a href="{{ url('home') }}">@lang('label.dashboard')</a></li> <li><a href="{{ url('home') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_post')</li> <li class="active">@lang('feature.edit_post')</li>
@stop @stop
@section('content') @section('content')
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
@section('breadcrumbs') @section('breadcrumbs')
<li><a href="{{ url('home') }}">@lang('label.dashboard')</a></li> <li><a href="{{ url('home') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_post')</li> <li class="active">@lang('feature.edit_post')</li>
@stop @stop
@section('content') @section('content')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment