[fixes #13] &tags& now use new format

This commit is contained in:
Xkeeper 2015-08-13 23:10:29 -07:00
parent 514552fc54
commit 5d8d4e8b3a
2 changed files with 15 additions and 11 deletions

View File

@ -396,7 +396,8 @@ function generatenumbergfx($num,$minlen=0,$double=false){
function dotags($msg, &$tags) { function dotags($msg, $user, &$tags = array()) {
global $sql, $dateformat, $tzoff;
if (is_string($tags)) { if (is_string($tags)) {
$tags = json_decode($tags, true); $tags = json_decode($tags, true);
} }
@ -446,23 +447,26 @@ function doreplace($msg, $posts, $days, $username, &$tags = null) {
// This should probably go off of user ID but welp // This should probably go off of user ID but welp
$user = $sql->fetchq("SELECT * FROM `users` WHERE `name` = '".addslashes($username)."'", MYSQL_BOTH, true); $user = $sql->fetchq("SELECT * FROM `users` WHERE `name` = '".addslashes($username)."'", MYSQL_BOTH, true);
$userdata = array( $userdata = array(
'id' => $user['id'], 'id' => $user['id'],
'username' => $username, 'username' => $username,
'posts' => $posts, 'posts' => $posts,
'days' => $days, 'days' => $days,
'useranks' => $user['useranks'], 'useranks' => $user['useranks'],
'exp' => calcexp($posts,$days), 'exp' => calcexp($posts,$days)
'expdone' => $v['exp']-calclvlexp($v['level']),
'expnext' => calcexpleft($v['exp']),
'level' => calclvl($v['exp']),
'lvllen' => totallvlexp($v['level']),
); );
$userdata['level'] = calclvl($userdata['exp']);
$userdata['expdone'] = $userdata['exp'] - calclvlexp($userdata['level']);
$userdata['expnext'] = calcexpleft($userdata['exp']);
$userdata['lvllen'] = totallvlexp($userdata['level']);
if (!$tags) { if (!$tags) {
$tags = array(); $tags = array();
} }
$msg = dotags($msg, $tags); $msg = dotags($msg, $userdata, $tags);
return $msg; return $msg;
} }
@ -541,7 +545,7 @@ function settags($text, $tags) {
if (!$tags) { if (!$tags) {
return $text; return $text;
} else { } else {
$text = dotags($text, $tags); $text = dotags($text, array(), $tags);
} }
return $text; return $text;
@ -623,7 +627,7 @@ function getrank($rankset,$title,$posts,$powl){
if($title) if($title)
$rank .= $title; $rank .= $title;
elseif (in_array($powl, $powerranks)) elseif (in_array($powl, $powerranks))
$rank .= $powerranks[$powl]; $rank .= filter_string($powerranks[$powl]);
return $rank; return $rank;
} }

View File

@ -92,8 +92,8 @@
} }
} }
$post['headtext']=settags($post['headtext'],$post['tagval']); $post['headtext']=settags($post['headtext'],filter_string($post['tagval']));
$post['signtext']=settags($post['signtext'],$post['tagval']); $post['signtext']=settags($post['signtext'],filter_string($post['tagval']));
if($loguser['viewsig']==2){ if($loguser['viewsig']==2){
$post['headtext']=doreplace($post['headtext'],$post['num'],($post['date']-$post['regdate'])/86400,$post['name']); $post['headtext']=doreplace($post['headtext'],$post['num'],($post['date']-$post['regdate'])/86400,$post['name']);