function dotags($msg, $user, &$tags = array()) { global $sql, $dateformat, $tzoff; if (is_string($tags)) { $tags = json_decode($tags, true); } if (empty($tags) && empty($user)) { // settags sent us here and we have nothing to go off of. // Shrug our shoulders, and move on. return $msg; } if (empty($tags)) { $tags = array('/me ' => "*<b>" . $user['username'] . "</b> ", '&date&' => date($dateformat, ctime() + $tzoff), '&numdays&' => floor($user['days']), '&numposts&' => $user['posts'], '&rank&' => getrank($user['useranks'], '', $user['posts'], 0), '&postrank&' => $sql->resultq("SELECT count(*) FROM `users` WHERE posts>{$user['posts']}") + 1, '&5000&' => 5000 - $user['posts'], '&10000&' => 10000 - $user['posts'], '&20000&' => 20000 - $user['posts'], '&30000&' => 30000 - $user['posts'], '&exp&' => $user['exp'], '&expgain&' => calcexpgainpost($user['posts'], $user['days']), '&expgaintime&' => calcexpgaintime($user['posts'], $user['days']), '&expdone&' => $user['expdone'], '&expdone1k&' => floor($user['expdone'] / 1000), '&expdone10k&' => floor($user['expdone'] / 10000), '&expnext&' => $user['expnext'], '&expnext1k&' => floor($user['expnext'] / 1000), '&expnext10k&' => floor($user['expnext'] / 10000), '&exppct&' => sprintf('%01.1f', ($user['lvllen'] ? 1 - $user['expnext'] / $user['lvllen'] : 0) * 100), '&exppct2&' => sprintf('%01.1f', ($user['lvllen'] ? $user['expnext'] / $user['lvllen'] : 0) * 100), '&level&' => $user['level'], '&lvlexp&' => calclvlexp($user['level'] + 1), '&lvllen&' => $user['lvllen']); } $msg = strtr($msg, $tags); return $msg; }
$rsex = $birthday ? 255 : $user['sex']; $namecolor = getnamecolor($rsex, $user['powerlevel'], false); $tzoffset = $user['timezone']; $tzoffrel = $tzoffset - $loguser['timezone']; $tzdate = date($dateformat, ctime() + $tzoffset * 3600); if ($user[birthday]) { $birthday = date("l, F j, Y", $user[birthday]); $age = "(" . floor((ctime() - $user[birthday]) / 86400 / 365.2425) . " years old)"; } // RPG fun shit $exp = calcexp($user['posts'], (ctime() - $user['regdate']) / 86400); $lvl = calclvl($exp); $expleft = calcexpleft($exp); $expstatus = "Level: {$lvl}<br>EXP: {$exp} (for next level: {$expleft})"; if ($user['posts'] > 0) { $expstatus .= "<br>Gain: " . calcexpgainpost($user['posts'], (ctime() - $user['regdate']) / 86400) . " EXP per post, " . calcexpgaintime($user[posts], (ctime() - $user[regdate]) / 86400) . " seconds to gain 1 EXP when idle"; } $postavg = sprintf("%01.2f", $user[posts] / (ctime() - $user[regdate]) * 86400); $totalwidth = 116; $barwidth = @floor($user[posts] / $maxposts * $totalwidth); if ($barwidth < 0) { $barwidth = 0; } if ($barwidth) { $baron = "<img src=images/{$numdir}" . "bar-on.gif width={$barwidth} height=8>"; } if ($barwidth < $totalwidth) { $baroff = "<img src=images/{$numdir}" . "bar-off.gif width=" . ($totalwidth - $barwidth) . " height=8>"; } $bar = "<img src=images/{$numdir}" . "barleft.gif>{$baron}{$baroff}<img src=images/{$numdir}" . "barright.gif><br>"; if (!$topposts) {