From 3ef40417b239d74191bc2f01d9ef8710b6289197 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 13 Apr 2015 14:52:43 +0200 Subject: [PATCH] Fix usage of markdown --- app/classes/Framadate/Utils.php | 22 +++++++++++----------- tpl/part/vote_table_classic.tpl | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/classes/Framadate/Utils.php b/app/classes/Framadate/Utils.php index fe13530..37f67a7 100644 --- a/app/classes/Framadate/Utils.php +++ b/app/classes/Framadate/Utils.php @@ -30,7 +30,7 @@ class Utils { $dirname = str_replace('/admin', '', $dirname); $server_name = $_SERVER['SERVER_NAME'] . $port . $dirname; - return $scheme . '://' . preg_replace('#//+#', '/', $server_name); + return $scheme . '://' . preg_replace('#//+#', '/', $server_name); } public static function is_error($cerr) { @@ -103,15 +103,15 @@ class Utils { * @param string $vote_id (optional) The vote's unique id * @return string The poll's URL. */ - public static function getUrlSondage($id, $admin = false, $vote_id='') { + public static function getUrlSondage($id, $admin = false, $vote_id = '') { if (URL_PROPRE) { if ($admin === true) { $url = self::get_server_name() . $id . '/admin'; } else { - $url = self::get_server_name() . $id; + $url = self::get_server_name() . $id; } if ($vote_id != '') { - $url .= '/vote/'.$vote_id."#edit"; + $url .= '/vote/' . $vote_id . "#edit"; } } else { if ($admin === true) { @@ -120,7 +120,7 @@ class Utils { $url = self::get_server_name() . 'studs.php?poll=' . $id; } if ($vote_id != '') { - $url .= '&vote='.$vote_id."#edit"; + $url .= '&vote=' . $vote_id . "#edit"; } } @@ -148,22 +148,22 @@ class Utils { preg_match_all('/\[(.*?)\]\((.*?)\)/', $md, $md_a); // Markdown [text](href) if (isset($md_a_img[2][0]) && $md_a_img[2][0] != '' && isset($md_a_img[3][0]) && $md_a_img[3][0] != '') { // [![alt](src)](href) - $text = stripslashes($md_a_img[1][0]); - $html = '' . $text . ''; + $text = self::htmlEscape($md_a_img[1][0]); + $html = '' . $text . ''; } elseif (isset($md_img[2][0]) && $md_img[2][0] != '') { // ![alt](src) - $text = stripslashes($md_img[1][0]); - $html = '' . $text . ''; + $text = self::htmlEscape($md_img[1][0]); + $html = '' . $text . ''; } elseif (isset($md_a[2][0]) && $md_a[2][0] != '') { // [text](href) - $text = stripslashes($md_a[1][0]); + $text = self::htmlEscape($md_a[1][0]); $html = '' . $text . ''; } else { // text only - $text = stripslashes($md); + $text = self::htmlEscape($md); $html = $text; } diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index cc48236..9c4f5bb 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -25,7 +25,7 @@ {foreach $slots as $id=>$slot} - {$slot->title|html|markdown} + {$slot->title|markdown} {/foreach} @@ -188,7 +188,7 @@