From e28f233e3de6d471ab2ce9c178ba8d626bbeb563 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sun, 10 Aug 2014 15:14:11 +0000 Subject: [PATCH] Close #51: Prevent players from cheating the dice roller by using markup --- inc/functions.php | 3 +- static/d10.svg | 161 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 static/d10.svg diff --git a/inc/functions.php b/inc/functions.php index 24ec3863..a88e8fc8 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2333,6 +2333,7 @@ function shell_exec_error($command, $suppress_stdout = false) { * added on. The result is displayed at the top of the post. */ function diceRoller($post) { + global $config; if(strpos(strtolower($post->email), 'dice%20') === 0) { $dicestr = str_split(substr($post->email, strlen('dice%20'))); @@ -2380,7 +2381,7 @@ function diceRoller($post) { // Prepend the result to the post body $modifier = ($diceZ != 0) ? ((($diceZ < 0) ? ' - ' : ' + ') . abs($diceZ)) : ''; $dicesum = ($diceX > 1) ? ' = ' . $dicesum : ''; - $post->body = 'Rolled ' . implode(', ', $dicerolls) . $modifier . $dicesum . '
' . $post->body; + $post->body = '
Dice rollRolled ' . implode(', ', $dicerolls) . $modifier . $dicesum . '

' . $post->body; } } } diff --git a/static/d10.svg b/static/d10.svg new file mode 100644 index 00000000..4d608be7 --- /dev/null +++ b/static/d10.svg @@ -0,0 +1,161 @@ + + + + Ten Side Dice + + + + + + + + image/svg+xml + + + + + Openclipart + + + Ten Sided Dice + 2010-11-06T04:13:53 + A single-colour graphic of a 10-sided die (d10) as used in roleplaying and wargaming. + https://openclipart.org/detail/94495/ten-sided-dice-by-wirelizard + + + wirelizard + + + + + RPG + d10 + dice + die + game + gamer + gaming + roleplay + ten side + + + + + + + + + + +