add &mood& pseudo-tag. seems to work, mostly. closes #17

This commit is contained in:
Xkeeper 2020-11-18 12:36:32 -08:00
parent 496d4d905c
commit e92f39eb8c
No known key found for this signature in database
GPG Key ID: 397C04773ABE4045
4 changed files with 31 additions and 20 deletions

View File

@ -134,6 +134,7 @@
$ppost['signtext']=$sign;
$ppost['text']=$message;
$ppost['options']=$poptions;
$ppost['moodid']=$_POST['moodid'];
// Edited notice
$ppost['edited'] = $edited;
@ -152,7 +153,7 @@
$tblend<br>$tblstart
$tccellh width=150>&nbsp</td>$tccellh colspan=2>&nbsp<tr>
$tccell1><b>Header:</td> $tccell2l width=800px valign=top>$txta=head ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($head) ."</textarea>
$tccell2l width=* rowspan=3>".moodlist($moodid)."</td><tr>
$tccell2l width=* rowspan=3>".moodlist($ppost['moodid'])."</td><tr>
$tccell1><b>Post:</td> $tccell2l width=800px valign=top>$txta=message ROWS=12 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($message) ."</textarea><tr>
$tccell1><b>Signature:</td> $tccell2l width=800px valign=top>$txta=sign ROWS=8 COLS=$numcols style=\"width: 100%; max-width: 800px; resize:vertical;\">". htmlspecialchars($sign) ."</textarea><tr>
$tccell1>&nbsp</td>$tccell2l colspan=2>

View File

@ -45,7 +45,7 @@
<li><strong>Don't be a jerk.</strong> If you don't have something constructive to say, <em>don't say it!</em>
<li><strong>No slurs, hate speech, or homo-/trans-phobia.</strong> If you can't respect your fellow posters, you aren't welcome here.
<li><strong>Post legibly</strong>. Keep it readable &mdash; you don't have to be perfect, but be understandable and don't post like this is an AOL chatroom.
<li><strong>Don't spam.</strong> Posting over and over without adding to a conversation is annoying.
<li><strong>Don't spam.</strong> Posting over and over without adding to a conversation is annoying.
<li><strong>Don't get in fights.</strong> If you're having trouble with another user, contact an administrator.
<li><strong>No illegal content.</strong> Don't post stuff that would get you (or us) in legal trouble.
</ol>
@ -171,6 +171,10 @@
<td class='tbl tdbg2'>&amp;lvllen&amp;</td>
<td class='tbl tdbg1'>EXP needed to go through your current level.</td>
</tr>
<tr>
<td class='tbl tdbg2'>&amp;mood&amp;</td>
<td class='tbl tdbg1'>Selected mood number for this post (default: 0)</td>
</tr>
</table>
For an explanation of how the Level and EXP tags work, hover over the highlighted parts below. (The percentages are useful when creating 'EXP bars', as you can use them as a width value.)
<br>

View File

@ -500,7 +500,9 @@ function escape_codeblock($text) {
return "<blockquote class='code'><hr><pre><code>". str_replace($list, $list2, $text[0]) ."</code></pre><hr></blockquote>";
}
function doreplace2($msg, $options='0|0'){
function doreplace2($msg, $options = null, $mood = 0) {
// @TODO php7.4 or w/e null coalescing
if ($options === null) $options = '0|0';
// options will contain smiliesoff|htmloff
$options = explode("|", $options);
$smiliesoff = $options[0];
@ -526,15 +528,19 @@ function doreplace2($msg, $options='0|0'){
}
}
$msg=str_replace('[red]', '<font color=FFC0C0>',$msg);
$msg=str_replace('[green]', '<font color=C0FFC0>',$msg);
$msg=str_replace('[blue]', '<font color=C0C0FF>',$msg);
$msg=str_replace('[orange]','<font color=FFC080>',$msg);
$msg=str_replace('[yellow]','<font color=FFEE20>',$msg);
$msg=str_replace('[pink]', '<font color=FFC0FF>',$msg);
$msg=str_replace('[white]', '<font color=white>',$msg);
$msg=str_replace('[black]', '<font color=0>' ,$msg);
$msg=str_replace('[/color]','</font>',$msg);
// &mood& pseudo-tag
$msg=str_replace('&mood&', $mood, $msg);
$msg=str_replace('[red]', '<span style="color: #ffc0c0;">', $msg);
$msg=str_replace('[green]', '<span style="color: #c0ffc0;">', $msg);
$msg=str_replace('[blue]', '<span style="color: #c0c0ff;">', $msg);
$msg=str_replace('[orange]','<span style="color: #ffc080;">', $msg);
$msg=str_replace('[yellow]','<span style="color: #ffee20;">', $msg);
$msg=str_replace('[pink]', '<span style="color: #ffc0ff;">', $msg);
$msg=str_replace('[white]', '<span style="color: white;">', $msg);
$msg=str_replace('[black]', '<span style="color: black;">', $msg);
$msg=str_replace('[/color]','</span>', $msg);
$msg=preg_replace("'\[quote=(.*?)\]'si", '<blockquote><font class=fonts><i>Originally posted by \\1</i></font><hr>', $msg);
$msg=str_replace('[quote]','<blockquote><hr>',$msg);
$msg=str_replace('[/quote]','<hr></blockquote>',$msg);
@ -1114,7 +1120,7 @@ function boardmessage($text, $title = "Message") {
function moodlist($sel = 0, $return = false) {
global $loguserid, $log, $loguser;
//$sel = $sel;
$sel = intval($sel);
$moodlist = array(
"(default)",
@ -1141,7 +1147,7 @@ function moodlist($sel = 0, $return = false) {
$ret = "<select name='moodid'>\n";
foreach($moodlist as $num => $name) {
$ret .= "\t<option value='$num'". ($sel === $num ? " selected" : "") .">$name</option>\n";
$ret .= "\t<option value='$num'". ($sel === $num ? " selected" : "") .">$name ($num)</option>\n";
}
$ret .= "</select>\n";

View File

@ -7,9 +7,9 @@
$set['bg'] = ${"tablebg$bg"};
$set['tdbg'] = "<td class='tbl font tdbg$bg' valign=top";
$linkclass = "url".$post['uid'];
$userlink = getuserlink($post, array('id'=>'uid'), $linkclass);
unset($postuser);
$linkclass = "url".$post['uid'];
$userlink = getuserlink($post, array('id'=>'uid'), $linkclass);
unset($postuser);
$set['userrank'] = getrank($post['useranks'],str_replace("<div", "<<z>idiot", $post['title']),$post['posts'],$post['powerlevel']);
$set['userlink'] = "<a name={$p}></a>{$userlink}";
@ -37,7 +37,7 @@
$set['threadlink'] = "<a href=thread.php?id={$pthread['id']}>{$pthread['title']}</a>";
}
$post['text']=doreplace2($post['text'], $post['options']);
$post['text']=doreplace2($post['text'], $post['options'], $post['moodid']);
if (filter_int($post['editdate'])) {
$post['edited'] = " (last edited by {$post['edited']} at ".date($dateformat,$post['editdate']+$tzoff).")";
@ -98,8 +98,8 @@
$post['headtext']=doreplace($post['headtext'],$post['num'],($post['date']-$post['regdate'])/86400,$post['name']);
$post['signtext']=doreplace($post['signtext'],$post['num'],($post['date']-$post['regdate'])/86400,$post['name']);
}
$post['headtext']=doreplace2($post['headtext']);
$post['signtext']=doreplace2($post['signtext']);
$post['headtext']=doreplace2($post['headtext'], null, $post['moodid']);
$post['signtext']=doreplace2($post['signtext'], null, $post['moodid']);
// $post['text']=doreplace2($post['text'], $post['options']);
return $post;
}