Commit 1d9d6d40 by Triyah Fatmawati

Allow strip tags tabel

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