Commit 984bbd86 by Siti Aisah

add allowed tag for agenda

parent 97da0bda
......@@ -79,8 +79,8 @@ class AgendaController extends Controller
*/
public function store(Request $request)
{
$request['content'] = $request->content;
$request['title'] = $request->title;
$request['content'] = strip_tags($request->content, ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img']);
$request['title'] = strip_tags($request->title, ['b', 'i', 'u']);
$request->validate([
'title' => 'required',
'content' => 'required|min:3',
......@@ -119,13 +119,13 @@ class AgendaController extends Controller
private function createEn($data, $agenda)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, $data['title']);
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title'], ['b', 'i', 'u']));
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content']));
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img']));
$dataEn['agenda_id'] = $agenda->id;
$dataEn['title'] = $title;
......@@ -137,13 +137,13 @@ class AgendaController extends Controller
private function createDe($data, $agenda)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, $data['title']);
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title'], ['b', 'i', 'u']));
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content']));
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img']));
$dataDe['agenda_id'] = $agenda->id;
$dataDe['title'] = $title;
......@@ -155,13 +155,13 @@ class AgendaController extends Controller
private function createSa($data, $agenda)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, $data['title']);
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title'], ['b', 'i', 'u']));
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content']));
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img']));
$dataSa['agenda_id'] = $agenda->id;
$dataSa['title'] = $title;
......@@ -173,13 +173,13 @@ class AgendaController extends Controller
private function createZh($data, $agenda)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, $data['title']);
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title'], ['b', 'i', 'u']));
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content']));
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'tr', 'th', 'td', 'ul', 'li', 'ol', 'img']));
$dataZh['agenda_id'] = $agenda->id;
$dataZh['title'] = $title;
......@@ -249,16 +249,16 @@ class AgendaController extends Controller
*/
public function update(Request $request, $id)
{
$request['content'] = $request->content;
$request['content_en'] = $request->content_en;
$request['content_de'] = $request->content_de;
$request['content_sa'] = $request->content_sa;
$request['content_zh'] = $request->content_zh;
$request['title'] = $request->title;
$request['title_en'] = $request->title_en;
$request['title_de'] = $request->title_de;
$request['title_sa'] = $request->title_sa;
$request['title_zh'] = $request->title_zh;
$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['title'] = strip_tags($request->title, ['b', 'i', 'u']);
$request['title_en'] = strip_tags($request->title_en, ['b', 'i', 'u']);
$request['title_de'] = strip_tags($request->title_de, ['b', 'i', 'u']);
$request['title_sa'] = strip_tags($request->title_sa, ['b', 'i', 'u']);
$request['title_zh'] = strip_tags($request->title_zh, ['b', 'i', 'u']);
$request->validate([
// 'title' => 'required',
......@@ -319,8 +319,8 @@ class AgendaController extends Controller
}
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, $data['title']);
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content']));
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title'], ['b', 'i', 'u']));
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']));
$dataEn['title'] = $title;
$dataEn['content'] = $content;
......@@ -342,8 +342,8 @@ class AgendaController extends Controller
}
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, $data['title']);
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content']));
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title'], ['b', 'i', 'u']));
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']));
$dataDe['title'] = $title;
$dataDe['content'] = $content;
......@@ -364,8 +364,8 @@ class AgendaController extends Controller
}
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, $data['title']);
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content']));
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title'], ['b', 'i', 'u']));
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']));
$dataSa['title'] = $title;
$dataSa['content'] = $content;
......@@ -387,8 +387,8 @@ class AgendaController extends Controller
}
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, $data['title']);
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content']));
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title'], ['b', 'i', 'u']));
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img']));
$dataZh['title'] = $title;
$dataZh['content'] = $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