function translator_uri($in)
{
    $uri = comscroll_sanitize($in);
    $uri = cmd_sanitize($uri);
    if (substr($uri, -1) == "?") {
        $uri = substr($uri, 0, -1);
    }
    return $uri;
}
function addcommentary()
{
    global $session, $emptypost;
    $section = httppost('section');
    $talkline = httppost('talkline');
    $schema = httppost('schema');
    $comment = trim(httppost('insertcommentary'));
    $counter = httppost('counter');
    $remove = URLDecode(httpget('removecomment'));
    if ($remove > 0) {
        $return = '/' . httpget('returnpath');
        $section = httpget('section');
        $sql = "SELECT " . db_prefix("commentary") . ".*," . db_prefix("accounts") . ".name," . db_prefix("accounts") . ".acctid, " . db_prefix("accounts") . ".clanrank," . db_prefix("clans") . ".clanshort FROM " . db_prefix("commentary") . " INNER JOIN " . db_prefix("accounts") . " ON " . db_prefix("accounts") . ".acctid = " . db_prefix("commentary") . ".author LEFT JOIN " . db_prefix("clans") . " ON " . db_prefix("clans") . ".clanid=" . db_prefix("accounts") . ".clanid WHERE commentid={$remove}";
        $row = db_fetch_assoc(db_query($sql));
        $sql = "INSERT LOW_PRIORITY INTO " . db_prefix("moderatedcomments") . " (moderator,moddate,comment) VALUES ('{$session['user']['acctid']}','" . date("Y-m-d H:i:s") . "','" . addslashes(serialize($row)) . "')";
        db_query($sql);
        $sql = "DELETE FROM " . db_prefix("commentary") . " WHERE commentid='{$remove}';";
        db_query($sql);
        invalidatedatacache("comments-{$section}");
        // *** DRAGONBG.COM CORE PATCH START ***
        invalidatedatacache("comments-");
        // *** DRAGONBG.COM CORE PATCH END ***
        $session['user']['specialinc'] == '';
        //just to make sure he was not in a special
        $return = cmd_sanitize($return);
        $return = substr($return, strrpos($return, "/") + 1);
        if (strpos($return, "?") === false && strpos($return, "&") !== false) {
            $x = strpos($return, "&");
            $return = substr($return, 0, $x - 1) . "?" . substr($return, $x + 1);
        }
        debug($return);
        redirect($return);
    }
    if (array_key_exists('commentcounter', $session) && $session['commentcounter'] == $counter) {
        if ($section || $talkline || $comment) {
            $tcom = color_sanitize($comment);
            if ($tcom == "" || $tcom == ":" || $tcom == "::" || $tcom == "/me") {
                $emptypost = 1;
            } else {
                injectcommentary($section, $talkline, $comment, $schema);
            }
        }
    }
}
         $gain = translate_inline("gain");
     } else {
         $gain = translate_inline("lose");
     }
     $sff = abs($resurrectionturns);
     output("`2As a result, you `^%s %s forest %s`2 for today!`n", $gain, $sff, translate_inline($sff == 1 ? "fight" : "fights"));
 }
 $rp = $session['user']['restorepage'];
 $x = max(strrpos("&", $rp), strrpos("?", $rp));
 if ($x > 0) {
     $rp = substr($rp, 0, $x);
 }
 if (substr($rp, 0, 10) == "badnav.php") {
     addnav("Continue", "news.php");
 } else {
     addnav("Continue", cmd_sanitize($rp));
 }
 $session['user']['laston'] = date("Y-m-d H:i:s");
 $bgold = $session['user']['goldinbank'];
 $session['user']['goldinbank'] *= $interestrate;
 $nbgold = $session['user']['goldinbank'] - $bgold;
 if ($nbgold != 0) {
     debuglog(($nbgold >= 0 ? "earned " : "paid ") . abs($nbgold) . " gold in interest");
 }
 $turnstoday .= ", Spirits: {$resurrectionturns}, DK: {$dkff}";
 $session['user']['turns'] = $turnsperday + $resurrectionturns + $dkff;
 $session['user']['hitpoints'] = $session['user']['maxhitpoints'];
 $session['user']['spirits'] = $spirits;
 if ($resurrection != "true") {
     $session['user']['playerfights'] = $dailypvpfights;
 }
function tlbutton_push($indata, $hot = false, $namespace = FALSE)
{
    global $translatorbuttons;
    global $translation_is_enabled, $seentlbuttons, $session;
    if (!$translation_is_enabled) {
        return;
    }
    if (!$namespace) {
        $namespace = "unknown";
    }
    if ($session['user']['superuser'] & SU_IS_TRANSLATOR) {
        if (preg_replace("/[ \t\n\r]|`./", '', $indata) > "") {
            if (isset($seentlbuttons[$namespace][$indata])) {
                $link = "";
            } else {
                $seentlbuttons[$namespace][$indata] = true;
                require_once "lib/sanitize.php";
                $uri = cmd_sanitize($namespace);
                $uri = comscroll_sanitize($uri);
                $link = "translatortool.php?u=" . rawurlencode($uri) . "&t=" . rawurlencode($indata);
                $link = "<a href='{$link}' target='_blank' onClick=\"" . popup($link) . ";return false;\" class='t" . ($hot ? "hot" : "") . "'>T</a>";
            }
            array_push($translatorbuttons, $link);
        }
        return true;
    } else {
        //when user is not a translator, return false.
        return false;
    }
}
<?php

// addnews ready
// translator ready
// mail ready
require_once "common.php";
require_once "lib/sanitize.php";
tlschema("bio");
checkday();
$ret = httpget('ret');
if ($ret == "") {
    $return = "/list.php";
} else {
    $return = cmd_sanitize($ret);
}
$char = httpget('char');
//Legacy support
if (is_numeric($char)) {
    $where = "acctid = {$char}";
} else {
    $where = "login = '******'";
}
$sql = "SELECT login, name, level, sex, title, specialty, hashorse, acctid, resurrections, bio, dragonkills, race, clanname, clanshort, clanrank, " . db_prefix("accounts") . ".clanid, laston, loggedin FROM " . db_prefix("accounts") . " LEFT JOIN " . db_prefix("clans") . " ON " . db_prefix("accounts") . ".clanid = " . db_prefix("clans") . ".clanid WHERE {$where}";
$result = db_query($sql);
if ($target = db_fetch_assoc($result)) {
    $target['login'] = rawurlencode($target['login']);
    $id = $target['acctid'];
    $target['return_link'] = $return;
    page_header("Character Biography: %s", full_sanitize($target['name']));
    tlschema("nav");
    addnav("Return");
            rawoutput("<input name='testtext' id='input'>");
            rawoutput("<input type='submit' class='button' value='{$try}'>");
            rawoutput("</form>");
            rawoutput("<script language='javascript'>document.getElementById('input').focus();</script>");
            output("`0`n`nThese colors can be used in your name, and in any conversations you have.");
            addnav("", $REQUEST_URI);
        } else {
            if ($act == "specialty") {
                $specialty = httpget('specialty');
                if ($specialty == "") {
                    output("\"`2I want to change my specialty,`0\" you announce to %s`0.`n`n", $barkeep);
                    output("With out a word, %s`0 grabs you by the shirt, pulls you over the counter, and behind the barrels behind him.", $barkeep);
                    output("There, he rotates the tap on a small keg labeled \"Fine Swill XXX\"`n`n");
                    output("You look around for the secret door that you know must be opening nearby when %s`0 rotates the tap back, and lifts up a freshly filled foamy mug of what is apparently his fine swill, blue-green tint and all.`n`n", $barkeep);
                    output("\"`3What?  Were you expecting a secret room?`0\" he asks.  \"`3Now then, you must be more careful about how loudly you say that you want to change your specialty, not everyone looks favorably on that sort of thing.`n`n");
                    output("`0\"`3What new specialty did you have in mind?`0\"");
                    $specialities = modulehook("specialtynames");
                    foreach ($specialities as $key => $name) {
                        addnav($name, cmd_sanitize($REQUEST_URI) . "&specialty={$key}");
                    }
                } else {
                    output("\"`3Ok then,`0\" %s`0 says, \"`3You're all set.`0\"`n`n\"`2That's it?`0\" you ask him.`n`n", $barkeep);
                    output("\"`3Yep.  What'd you expect, some sort of fancy arcane ritual???`0\"  %s`0 begins laughing loudly.", $barkeep);
                    output("\"`3You're all right, kid... just don't ever play poker, eh?`0`n`n");
                    output("\"`3Oh, one more thing.  Your old use points and skill level still apply to that skill, you'll have to build up some points in this one to be very good at it.`0\"");
                    $session['user']['specialty'] = $specialty;
                }
            }
        }
    }
}