Commit 1d9d6d40 by Triyah Fatmawati

Allow strip tags tabel

parent 23cf8977
......@@ -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){
......
......@@ -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