コード例 #1
0
function relativedate(string $indate) : string
{
    $lastOn = round((strtotime('now') - strtotime($indate)) / 86400, 0) . 'days';
    tlschema('datetime');
    if (substr($lastOn, 0, 2) == '1 ') {
        $lastOn = translate_inline('1 day');
    } else {
        if (date('Y-m-d', strtotime($lastOn)) == date('Y-m-d')) {
            $lastOn = translate_inline('Today');
        } else {
            if (date('Y-m-d', strtotime($lastOn)) == date('Y-m-d', strtotime('-1 day'))) {
                $lastOn = translate_inline('Yesterday');
            } else {
                if (strpos($indate, '0000-00-00') !== false) {
                    $lastOn = translate_inline('Never');
                } else {
                    $lastOn = sprintf_translate('%s days', round((strtotime('now') - strtotime($indate)) / 86400, 0));
                    rawoutput(tlbutton_clear());
                }
            }
        }
    }
    tlschema();
    return $lastOn;
}
function commentarylocs()
{
    global $comsecs, $session;
    if (is_array($comsecs) && count($comsecs)) {
        return $comsecs;
    }
    $vname = getsetting("villagename", LOCATION_FIELDS);
    $iname = getsetting("innname", LOCATION_INN);
    tlschema("commentary");
    $comsecs['village'] = sprintf_translate("%s Square", $vname);
    if ($session['user']['superuser'] & ~SU_DOESNT_GIVE_GROTTO) {
        $comsecs['superuser'] = translate_inline("Grotto");
    }
    $comsecs['shade'] = translate_inline("Land of the Shades");
    $comsecs['grassyfield'] = translate_inline("Grassy Field");
    $comsecs['inn'] = "{$iname}";
    $comsecs['motd'] = translate_inline("MotD");
    $comsecs['veterans'] = translate_inline("Veterans Club");
    $comsecs['hunterlodge'] = translate_inline("Hunter's Lodge");
    $comsecs['gardens'] = translate_inline("Gardens");
    $comsecs['waiting'] = translate_inline("Clan Hall Waiting Area");
    if (getsetting("betaperplayer", 1) == 1 && @file_exists("pavilion.php")) {
        $comsecs['beta'] = translate_inline("Pavilion");
    }
    tlschema();
    // All of the ones after this will be translated in the modules.
    $comsecs = modulehook("moderate", $comsecs);
    rawoutput(tlbutton_clear());
    return $comsecs;
}
コード例 #3
0
function tl($in)
{
    $out = translate($in);
    return tlbutton_clear() . $out;
}
 $odate = "";
 tlschema("news");
 while ($row = db_fetch_assoc($result)) {
     tlschema($row['tlschema']);
     if ($row['arguments'] > "") {
         $arguments = array();
         $base_arguments = unserialize($row['arguments']);
         array_push($arguments, $row['newstext']);
         while (list($key, $val) = each($base_arguments)) {
             array_push($arguments, $val);
         }
         $news = call_user_func_array("sprintf_translate", $arguments);
         rawoutput(tlbutton_clear());
     } else {
         $news = translate_inline($row['newstext']);
         rawoutput(tlbutton_clear());
     }
     tlschema();
     if ($odate != $row['newsdate']) {
         output_notl("`n`b`@%s`0`b`n", date("D, M d", strtotime($row['newsdate'])));
         $odate = $row['newsdate'];
     }
     output_notl("`@{$news}`0`n");
 }
 tlschema();
 debug($return);
 if ($ret == "") {
     if (strpos($return, "/") === 0) {
         $return = substr($return, strrpos($return, "/") + 1);
     }
     tlschema("nav");
function extbio_run()
{
    $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']));
        modulehook("biotop", $target);
        output("`^Biography for %s`^.", $target['name']);
        if ($target['clanname'] > "" && getsetting("allowclans", false)) {
            $ranks = array(CLAN_APPLICANT => "`!Applicant`0", CLAN_MEMBER => "`3Member`0", CLAN_OFFICER => "`^Officer`0", CLAN_LEADER => "`&Leader`0", CLAN_FOUNDER => "`\$Founder");
            $ranks = modulehook("clanranks", array("ranks" => $ranks, "clanid" => $target['clanid']));
            tlschema("clans");
            //just to be in the right schema
            array_push($ranks['ranks'], "`\$Founder");
            $ranks = translate_inline($ranks['ranks']);
            tlschema();
            output("`@%s`2 is a %s`2 to `%%s`2`n", $target['name'], $ranks[$target['clanrank']], $target['clanname']);
        }
        output("`^Title: `@%s`n", $target['title']);
        output("`^Level: `@%s`n", $target['level']);
        $loggedin = false;
        if ($target['loggedin'] && date("U") - strtotime($target['laston']) < getsetting("LOGINTIMEOUT", 900)) {
            $loggedin = true;
        }
        $status = translate_inline($loggedin ? "`3Online`0" : "`\$Offline`0");
        output("`^Status: %s`n", $status);
        output("`^Resurrections: `@%s`n", $target['resurrections']);
        $race = $target['race'];
        if (!$race) {
            $race = RACE_UNKNOWN;
        }
        tlschema("race");
        $race = translate_inline($race);
        tlschema();
        output("`^Race: `@%s`n", $race);
        $genders = array("Male", "Female");
        $genders = translate_inline($genders);
        output("`^Gender: `@%s`n", $genders[$target['sex']]);
        $specialties = modulehook("specialtynames", array("" => translate_inline("Unspecified")));
        if (isset($specialties[$target['specialty']])) {
            output("`^Specialty: `@%s`n", $specialties[$target['specialty']]);
        }
        $sql = "SELECT * FROM " . db_prefix("mounts") . " WHERE mountid='{$target['hashorse']}'";
        $result = db_query_cached($sql, "mountdata-{$target['hashorse']}", 3600);
        $mount = db_fetch_assoc($result);
        $mount['acctid'] = $target['acctid'];
        $mount = modulehook("bio-mount", $mount);
        $none = translate_inline("`iNone`i");
        if (!isset($mount['mountname']) || $mount['mountname'] == "") {
            $mount['mountname'] = $none;
        }
        output("`^Creature: `@%s`0`n", $mount['mountname']);
        modulehook("biostat", $target);
        if ($target['dragonkills'] > 0) {
            output("`^Dragon Kills: `@%s`n", $target['dragonkills']);
        }
        if ($target['bio'] > "") {
            output("`^Bio: `@`n%s`n", soap($target['bio']));
        }
        modulehook("bioinfo", $target);
        output("`n`^Recent accomplishments (and defeats) of %s`^", $target['name']);
        $result = db_query("SELECT * FROM " . db_prefix("news") . " WHERE accountid={$target['acctid']} ORDER BY newsdate DESC,newsid ASC LIMIT 100");
        $odate = "";
        tlschema("news");
        while ($row = db_fetch_assoc($result)) {
            tlschema($row['tlschema']);
            if ($row['arguments'] > "") {
                $arguments = array();
                $base_arguments = unserialize($row['arguments']);
                array_push($arguments, $row['newstext']);
                while (list($key, $val) = each($base_arguments)) {
                    array_push($arguments, $val);
                }
                $news = call_user_func_array("sprintf_translate", $arguments);
                rawoutput(tlbutton_clear());
            } else {
                $news = translate_inline($row['newstext']);
                rawoutput(tlbutton_clear());
            }
            tlschema();
            if ($odate != $row['newsdate']) {
                output_notl("`n`b`@%s`0`b`n", date("D, M d", strtotime($row['newsdate'])));
                $odate = $row['newsdate'];
            }
            output_notl("`@{$news}`0`n");
        }
        tlschema();
        modulehook("bioend", $target);
    }
    page_footer();
}
function tutor_talk()
{
    rawoutput("<style type='text/css'>\r\n\t\t.tutor {\r\n\t\t\tbackground-color: #444444;\r\n\t\t\tborder-color: #0099ff;\r\n\t\t\tborder-style: double;\r\n\t\t\tborder-width: medium;\r\n\t\t\tcolor: #CCCCCC;\r\n\t\t}\r\n\t\t.tutor .colDkBlue\t{ color: #0000B0; }\r\n\t\t.tutor .colDkGreen   { color: #00B000; }\r\n\t\t.tutor .colDkCyan\t{ color: #00B0B0; }\r\n\t\t.tutor .colDkRed\t { color: #B00000; }\r\n\t\t.tutor .colDkMagenta { color: #B000CC; }\r\n\t\t.tutor .colDkYellow  { color: #B0B000; }\r\n\t\t.tutor .colDkWhite   { color: #B0B0B0; }\r\n\t\t.tutor .colLtBlue\t{ color: #0000FF; }\r\n\t\t.tutor .colLtGreen   { color: #00FF00; }\r\n\t\t.tutor .colLtCyan\t{ color: #00FFFF; }\r\n\t\t.tutor .colLtRed\t { color: #FF0000; }\r\n\t\t.tutor .colLtMagenta { color: #FF00FF; }\r\n\t\t.tutor .colLtYellow  { color: #FFFF00; }\r\n\t\t.tutor .colLtWhite   { color: #FFFFFF; }\r\n\t\t.tutor .colLtBlack   { color: #999999; }\r\n\t\t.tutor .colDkOrange  { color: #994400; }\r\n\t\t.tutor .colLtOrange  { color: #FF9900; }\r\n\t\t</style>");
    $args = func_get_args();
    $args[0] = translate($args[0]);
    $text = call_user_func_array("sprintf", $args);
    rawoutput("<div class='tutor'>");
    rawoutput(tlbutton_clear() . appoencode($text));
    rawoutput("</div>");
}
function relativedate($indate)
{
    $laston = round((strtotime("now") - strtotime($indate)) / 86400, 0) . " days";
    tlschema("datetime");
    if (substr($laston, 0, 2) == "1 ") {
        $laston = translate_inline("1 day");
    } elseif (date("Y-m-d", strtotime($laston)) == date("Y-m-d")) {
        $laston = translate_inline("Today");
    } elseif (date("Y-m-d", strtotime($laston)) == date("Y-m-d", strtotime("-1 day"))) {
        $laston = translate_inline("Yesterday");
    } elseif (strpos($indate, "0000-00-00") !== false) {
        $laston = translate_inline("Never");
    } else {
        $laston = sprintf_translate("%s days", round((strtotime("now") - strtotime($indate)) / 86400, 0));
        rawoutput(tlbutton_clear());
    }
    tlschema();
    return $laston;
}
コード例 #8
0
        } else {
            pollitem($row['motditem'], $row['motdtitle'], $row['motdbody'], $row['motdauthorname'], $row['motddate'], $row['motditem']);
        }
    }
    /*
    motditem("Beta!","For those who might be unaware, this website is still in beta mode.  I'm working on it when I have time, which generally means a couple of changes a week.  Feel free to drop suggestions, I'm open to anything :-)","","", "");
    */
    $result = db_query("SELECT mid(motddate,1,7) AS d, count(*) AS c FROM " . db_prefix("motd") . " GROUP BY d ORDER BY d DESC");
    $row = db_fetch_assoc($result);
    rawoutput("<form action='motd.php' method='GET'>");
    output("MoTD Archives:");
    rawoutput("<select name='month' onChange='this.form.submit();' >");
    rawoutput("<option value=''>--Current--</option>");
    while ($row = db_fetch_assoc($result)) {
        $time = strtotime("{$row['d']}-01");
        $m = translate_inline(date("M", $time));
        rawoutput("<option value='{$row['d']}'" . (httpget("month") == $row['d'] ? " selected" : "") . ">{$m}" . date(", Y", $time) . " ({$row['c']})</option>");
    }
    rawoutput("</select>" . tlbutton_clear());
    rawoutput("<input type='hidden' name='newcount' value='" . ($count + $newcount) . "'>");
    rawoutput("<input type='submit' value='&gt;' name='proceed'  class='button'>");
    rawoutput(" <input type='submit' value='" . translate_inline("Submit") . "' class='button'>");
    rawoutput("</form>");
    commentdisplay("`n`@Commentary:`0`n", "motd");
}
$session['needtoviewmotd'] = false;
$sql = "SELECT motddate FROM " . db_prefix("motd") . " ORDER BY motditem DESC LIMIT 1";
$result = db_query_cached($sql, "motddate");
$row = db_fetch_assoc($result);
$session['user']['lastmotd'] = $row['motddate'];
popup_footer();
function dag_pvpwin($args)
{
    global $badguy, $session;
    // ***ADDED***
    // By Andrew Senger
    // Added for Bounty Code
    // Bounty Check - Andrew Senger
    // Check for Bounty
    $sql = "SELECT bountyid,amount,setter FROM " . db_prefix("bounty") . " WHERE status=0 AND setdate<='" . date("Y-m-d H:i:s") . "' AND target=" . $badguy['acctid'];
    $result = db_query($sql);
    if (db_num_rows($result) > 0) {
        $totgoodamt = 0;
        $totbadamt = 0;
        for ($i = 0; $i < db_num_rows($result); $i++) {
            $row = db_fetch_assoc($result);
            if ($row['setter'] == $session['user']['acctid']) {
                $totbadamt += $row['amount'];
            } else {
                $totgoodamt += $row['amount'];
                $windate = date("Y-m-d H:i:s");
                $sql = "UPDATE " . db_prefix("bounty") . " SET status=1,winner=" . $session['user']['acctid'] . ",windate=\"{$windate}\" WHERE bountyid=" . $row['bountyid'];
                db_query($sql);
            }
        }
        if ($totgoodamt > 0) {
            output("`@When you turn around, Dag Durnick is standing there.");
            output("\"%s`# had a bounty of `^%s`# on th' head`@\", he says as he tosses you a leather purse which clinks with the sounds of your new fortune.`n`n", $badguy['creaturename'], $totgoodamt);
        }
        if ($totbadamt > 0) {
            output("\"`#I'm keeping `^%s`# of the total bounty on this soul's head, as ye' be the one that set it.`@\"", $totbadamt);
        }
    }
    // End Check for Bounty
    // Add Bounty Gold
    if ($totgoodamt > 0) {
        $session['user']['gold'] += $totgoodamt;
        debuglog("gained " . $totgoodamt . " gold bounty for killing ", $badguy['acctid']);
    }
    // End Add Bounty Gold
    // Add Bounty Kill to News
    if ($totgoodamt > 0) {
        addnews("`4%s`3 collected `4%s`3 gold bounty by turning in `4%s`3's head!", $session['user']['name'], $totgoodamt, $badguy['creaturename']);
    }
    // End Add Bounty Kill to News
    // End Bounty Check - Andrew
    // ***END ADD***
    if ($totgoodamt > 0) {
        $args['pvpmessageadd'] .= sprintf_translate("`nThey also received `^%s`2 in bounty gold.`n", $totgoodamt);
        rawoutput(tlbutton_clear());
    }
    return $args;
}