Fix usage of markdown
This commit is contained in:
parent
7b4bc4ad7f
commit
3ef40417b2
@ -30,7 +30,7 @@ class Utils {
|
|||||||
$dirname = str_replace('/admin', '', $dirname);
|
$dirname = str_replace('/admin', '', $dirname);
|
||||||
$server_name = $_SERVER['SERVER_NAME'] . $port . $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) {
|
public static function is_error($cerr) {
|
||||||
@ -103,15 +103,15 @@ class Utils {
|
|||||||
* @param string $vote_id (optional) The vote's unique id
|
* @param string $vote_id (optional) The vote's unique id
|
||||||
* @return string The poll's URL.
|
* @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 (URL_PROPRE) {
|
||||||
if ($admin === true) {
|
if ($admin === true) {
|
||||||
$url = self::get_server_name() . $id . '/admin';
|
$url = self::get_server_name() . $id . '/admin';
|
||||||
} else {
|
} else {
|
||||||
$url = self::get_server_name() . $id;
|
$url = self::get_server_name() . $id;
|
||||||
}
|
}
|
||||||
if ($vote_id != '') {
|
if ($vote_id != '') {
|
||||||
$url .= '/vote/'.$vote_id."#edit";
|
$url .= '/vote/' . $vote_id . "#edit";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($admin === true) {
|
if ($admin === true) {
|
||||||
@ -120,7 +120,7 @@ class Utils {
|
|||||||
$url = self::get_server_name() . 'studs.php?poll=' . $id;
|
$url = self::get_server_name() . 'studs.php?poll=' . $id;
|
||||||
}
|
}
|
||||||
if ($vote_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)
|
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)
|
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]);
|
$text = self::htmlEscape($md_a_img[1][0]);
|
||||||
$html = '<a href="' . $md_a_img[3][0] . '"><img src="' . $md_a_img[2][0] . '" class="img-responsive" alt="' . $text . '" title="' . $text . '" /></a>';
|
$html = '<a href="' . self::htmlEscape($md_a_img[3][0]) . '"><img src="' . self::htmlEscape($md_a_img[2][0]) . '" class="img-responsive" alt="' . $text . '" title="' . $text . '" /></a>';
|
||||||
|
|
||||||
} elseif (isset($md_img[2][0]) && $md_img[2][0] != '') { // ![alt](src)
|
} elseif (isset($md_img[2][0]) && $md_img[2][0] != '') { // ![alt](src)
|
||||||
|
|
||||||
$text = stripslashes($md_img[1][0]);
|
$text = self::htmlEscape($md_img[1][0]);
|
||||||
$html = '<img src="' . $md_img[2][0] . '" class="img-responsive" alt="' . $text . '" title="' . $text . '" />';
|
$html = '<img src="' . self::htmlEscape($md_img[2][0]) . '" class="img-responsive" alt="' . $text . '" title="' . $text . '" />';
|
||||||
|
|
||||||
} elseif (isset($md_a[2][0]) && $md_a[2][0] != '') { // [text](href)
|
} 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 = '<a href="' . $md_a[2][0] . '">' . $text . '</a>';
|
$html = '<a href="' . $md_a[2][0] . '">' . $text . '</a>';
|
||||||
|
|
||||||
} else { // text only
|
} else { // text only
|
||||||
|
|
||||||
$text = stripslashes($md);
|
$text = self::htmlEscape($md);
|
||||||
$html = $text;
|
$html = $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th role="presentation"></th>
|
<th role="presentation"></th>
|
||||||
{foreach $slots as $id=>$slot}
|
{foreach $slots as $id=>$slot}
|
||||||
<th class="bg-info" id="C{$id}">{$slot->title|html|markdown}</th>
|
<th class="bg-info" id="C{$id}">{$slot->title|markdown}</th>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -188,7 +188,7 @@
|
|||||||
<ul style="list-style:none">
|
<ul style="list-style:none">
|
||||||
{foreach $slots as $slot}
|
{foreach $slots as $slot}
|
||||||
{if $best_choices[$i] == $max}
|
{if $best_choices[$i] == $max}
|
||||||
<li><strong>{$slot->title|html|markdown:true}</strong></li>
|
<li><strong>{$slot->title|markdown:true}</strong></li>
|
||||||
{/if}
|
{/if}
|
||||||
{$i = $i+1}
|
{$i = $i+1}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
Loading…
Reference in New Issue
Block a user