当前位置: 首页>>代码示例>>PHP>>正文


PHP appoencode函数代码示例

本文整理汇总了PHP中appoencode函数的典型用法代码示例。如果您正苦于以下问题:PHP appoencode函数的具体用法?PHP appoencode怎么用?PHP appoencode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了appoencode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hunterslodge_avatar_run

function hunterslodge_avatar_run()
{
    require_once "lib/sanitize.php";
    require_once "lib/names.php";
    global $session;
    $op = httpget("op");
    $free = httpget("free");
    $context = httpget("context");
    switch ($context) {
        case "village":
            $backlink = "village.php";
            break;
        case "forest":
            $backlink = "forest.php";
            break;
        case "worldmap":
            $backlink = "runmodule.php?module=worldmapen&op=continue";
            break;
        case "lodge":
            $backlink = "runmodule.php?module=iitems_hunterslodge&op=start";
            break;
    }
    page_header("Choose your Avatar");
    switch ($op) {
        case "change":
            output("Want to change your Avatar?  No problem.  Upload your avatar via the box below.  Please note that NSFW images, stolen artwork or otherwise dodgy avatars will be erased without refund.  Upload files in .jpg or .png format.  Your limits are 100 pixels wide, 100 pixels tall, with a maximum filesize of 100k.  100px * 100px * 100k, simple!`n`n");
            output("Upload your avatar:`n");
            rawoutput("<form method='POST' enctype='multipart/form-data' name='upload' action='runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}'><input type='file' name='file'><br><br><input type='submit' class='button' name='Upload' value='Upload!'></form>");
            addnav("", "runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}");
            addnav("Cancel");
            addnav("Don't set an Avatar, just go back to where I came from", $backlink);
            break;
        case "confirm":
            if (httppost("Upload")) {
                $allowed_types = "(jpg|png)";
                debug(httpallpost());
                debug($_FILES);
                $file = $_FILES["file"];
                debug($file);
                $errors = array(0 => "File Received!", 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini.", 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.", 3 => "The uploaded file was only partially uploaded.", 4 => "No file was uploaded.", 6 => "Missing a temporary folder.");
                output_notl("`\$" . $errors[$error] . "`n");
                if (is_uploaded_file($file["tmp_name"])) {
                    if (preg_match("/\\." . $allowed_types . "\$/i", $file["name"])) {
                        if ($file["size"] <= 102400) {
                            $extension = substr($file['name'], strlen($file['name']) - 4, 4);
                            $loginname = str_replace(" ", "", $session['user']['login']);
                            $filename = "images/avatars/" . date("YmdHs") . $loginname . $extension;
                            if (move_uploaded_file($file["tmp_name"], $filename)) {
                                $pic_size = @getimagesize($filename);
                                // GD2 required here - else size always is recognized as 0
                                $pic_width = $pic_size[0];
                                $pic_height = $pic_size[1];
                                if ($pic_height <= 100 && $pic_width <= 100) {
                                    output("So, this is what you want to look like?  Click \"Set Avatar\" to confirm.`n`n");
                                    addnav("Confirm");
                                    addnav("Set Avatar", "runmodule.php?module=hunterslodge_avatar&op=set&free={$free}&context={$context}&avatar=" . rawurlencode($filename));
                                    $image = "<img align='left' src='" . $filename . "'>";
                                    rawoutput("<table><tr><td valign='top'>");
                                    $terms = appoencode(translate_inline("Your Avatar"));
                                    rawoutput("</td><td valign='top'>{$image}</td></tr><td></td><td>{$terms}</td></table>");
                                } else {
                                    output("That picture's too big!  The limit is 100 pixels by 100 pixels.`n`n");
                                }
                            } else {
                                output("The file could not be uploaded.`n`n");
                            }
                        } else {
                            output("You may only have a filesize up to 100 kilobytes!`n`n");
                        }
                    } else {
                        output("That file extension is not supported!`n`n");
                    }
                } else {
                    output("You did not specify a file to upload.`n`n");
                }
            }
            output("`0To try again with a different picture, use the form below.`n`n");
            rawoutput("<form method='POST' enctype='multipart/form-data' name='upload' action='runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}'><input type='file' name='file'><br><br><input type='submit' class='button' name='Upload' value='Upload!'></form>");
            addnav("", "runmodule.php?module=hunterslodge_avatar&op=confirm&free={$free}&context={$context}");
            addnav("Cancel");
            addnav("Don't set an Avatar, just go back to where I came from", $backlink);
            break;
        case "set":
            $av = httpget("avatar");
            set_module_pref("avatar", $av);
            output("Your Avatar has been changed!`n`n");
            if (!$free) {
                $id = has_item("hunterslodge_avatar");
                delete_item($id);
            }
            addnav("Return");
            addnav("Go back to where I came from", $backlink);
            break;
    }
    page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:96,代码来源:hunterslodge_avatar.php

示例2: funddrive_dohook

function funddrive_dohook($hook, $args)
{
    switch ($hook) {
        case 'donation_adjustments':
            global $session;
            if ($args['amount'] > 0) {
                increment_module_setting('base', $args['amount']);
            }
            break;
        case 'everyfooter':
            $settings = get_all_module_settings();
            if (!is_array($args['paypal'])) {
                $args['paypal'] = [];
            }
            $percent = round($settings['base'] / $settings['goal'], 2) * 100;
            if ($percent > 100) {
                $percent = 100;
            }
            $fillWidth = round(1.5 * $percent, 0);
            $unfilled = 150 - $fillWidth;
            //You may want to modify the bar to fit your site's needs. - Stephen
            $bar = appoencode("{$settings['message']}`n\n                <div class='fund-drive' align='center'>\n                    <table class='fund-drive-bar' style='border: solid 1px black; background-color: black; border-collapse: collapse; width: 150px; height: 10px;'>\n                        <tr>\n                            <td class='fund-drive-filled' width='{$fillWidth}px' style='background-color: #00FF00;'>\n                            </td>\n                            <td class='fund-drive-unfilled' width='{$unfilled}px'>\n                            </td>\n                        </tr>\n                    </table>\n                </div>", true);
            array_push($args['paypal'], $bar);
            break;
    }
    return $args;
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:27,代码来源:funddrive.php

示例3: switch_dohook

function switch_dohook($hook, $args)
{
    switch ($hook) {
        case 'charstats':
            global $SCRIPT_NAME, $session;
            if ($SCRIPT_NAME == 'village.php' && $session['user']['specialinc'] == '') {
                addcharstat("Vital Info");
                addcharstat(sprintf_translate("<a href='login.php?op=logout'>%s</a>", "`%Log Out"), sprintf_translate("<a href='runmodule.php?module=switch' style='font-weight: bold;'>%s</a>", appoencode('`%Switch')));
                addnav('', 'login.php?op=logout');
                addnav('', 'runmodule.php?module=switch');
            }
            break;
    }
    return $args;
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:15,代码来源:switch.php

示例4: mementos_feelgood_run

function mementos_feelgood_run()
{
    global $session;
    page_header("Memento Attributes");
    $mould = httpget('mould');
    $itemname = get_item_pref("verbosename", $mould);
    require_once "modules/mementos_feelgood/attributes.php";
    $attributes = mementos_feelgood_getattributes();
    switch (httpget('op')) {
        case "choosestat":
            output("`bWhat are Memento Attributes for?`b`nLet someone know how you feel about them by giving them a special Memento with a stat enhancement.  Like Mementos in themselves, these stat enhancements don't do anything to your character's abilities - they're intended only as trifles to flatter and delight.`n`nSee someone engage in a particularly special bit of rhyming roleplay?  Give them a Red Music Box of +1 Musical Mastery.  If someone else gives the player another Memento with the Musical Mastery stat attached, then their Bio will show that they have two points in Musical Mastery.  You get the idea, I'm sure - it's a tool for showing your appreciation or admiration in a playful way.`n`n`bNo really, what are Memento Attributes `ifor?`i  What do they `ido?`i`b`nThey make people feel good.  That's it!`n`n`bHow much do they cost?`b`nNothing!  They're free!  You can only apply one Attribute to any given Memento type, mind - and you can't change your mind afterwards, so choose carefully.`n`n`bHow to use them`b`nFigure out what you want your Memento to mean, and look for something in the list below that's a good match.  When you click, that Attribute will be applied to all the Mementos that came out of this Mould, and all the Mementos that will ever come out of it in the future.`n`n");
            foreach ($attributes as $key => $vals) {
                rawoutput("<strong><a href='runmodule.php?module=mementos_feelgood&op=confirm&assignstat=" . $key . "&mould=" . $mould . "'></strong>" . stripslashes(appoencode($vals['name'])) . "</a>: " . stripslashes(appoencode($vals['description'])) . "<br />");
                addnav("", "runmodule.php?module=mementos_feelgood&op=confirm&assignstat=" . $key . "&mould=" . $mould);
            }
            break;
        case "confirm":
            $assignstat = httpget('assignstat');
            $statname = $attributes[$assignstat]['name'];
            output("You're about to assign the Attribute \"%s\" to the Memento mould \"%s\".  Are you sure you want to do that?", $statname, $itemname);
            addnav("Yes!");
            addnav("Do it!", "runmodule.php?module=mementos_feelgood&op=confirmfinal&assignstat=" . $assignstat . "&mould=" . $mould);
            addnav("No wait hang on");
            addnav("That's not what I want to do AT ALL.", "runmodule.php?module=mementos_feelgood&op=choosestat&mould=" . $mould);
            break;
        case "confirmfinal":
            $assignstat = httpget('assignstat');
            output("Attribute applied!");
            //get all the items like this and apply the pref to all of them
            $sql = "SELECT * FROM " . db_prefix("items_prefs") . " WHERE setting='memento_originalitem' AND value='" . $mould . "'";
            $result = db_query($sql);
            while ($row = db_fetch_assoc($result)) {
                debug("Setting pref for itemid " . $row['id']);
                set_item_pref("memento_feelgood_attribute", $assignstat, $row['id']);
            }
            set_item_pref("memento_feelgood_attribute", $assignstat, $mould);
            break;
    }
    addnav("Return");
    addnav("Memento Forge", "runmodule.php?module=mementos&op=start");
    page_footer();
    return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:43,代码来源:mementos_feelgood.php

示例5: addnav

function addnav($text, $link = false, $priv = false, $pop = false)
{
    global $nav, $session, $accesskeys, $REQUEST_URI, $quickkeys;
    $text = translate($text);
    if (date("m-d") == "04-01") {
        $text = borkalize($text);
    }
    if ($link === false) {
        $nav .= templatereplace("navhead", array("title" => appoencode($text, $priv)));
    } elseif ($link === "") {
        $nav .= templatereplace("navhelp", array("text" => appoencode($text, $priv)));
    } else {
        if ($text != "") {
            $extra = "";
            if (1) {
                if (strpos($link, "?")) {
                    $extra = "&c={$session['counter']}";
                } else {
                    $extra = "?c={$session['counter']}";
                }
            }
            $extra .= "-" . date("His");
            //$link = str_replace(" ","%20",$link);
            //hotkey for the link.
            $key = "";
            if (substr($text, 1, 1) == "?") {
                // check to see if a key was specified up front.
                if ($accesskeys[strtolower(substr($text, 0, 1))] == 1) {
                    // output ("key ".substr($text,0,1)." already taken`n");
                    $text = substr($text, 2);
                } else {
                    $key = substr($text, 0, 1);
                    $text = substr($text, 2);
                    //output("key set to $key`n");
                    $found = false;
                    for ($i = 0; $i < strlen($text); $i++) {
                        $char = substr($text, $i, 1);
                        if ($ignoreuntil == $char) {
                            $ignoreuntil = "";
                        } else {
                            if ($ignoreuntil != "") {
                                if ($char == "<") {
                                    $ignoreuntil = ">";
                                }
                                if ($char == "&") {
                                    $ignoreuntil = ";";
                                }
                                if ($char == "`") {
                                    $ignoreuntil = substr($text, $i + 1, 1);
                                }
                            } else {
                                if ($char == $key) {
                                    $found = true;
                                    break;
                                }
                            }
                        }
                    }
                    if ($found == false) {
                        if (strpos($text, "__") !== false) {
                            $text = str_replace("__", "(" . $key . ") ", $text);
                        } else {
                            $text = "(" . strtoupper($key) . ") " . $text;
                        }
                        $i = strpos($text, $key);
                        // output("Not found`n");
                    }
                }
                //
            }
            if ($key == "") {
                for ($i = 0; $i < strlen($text); $i++) {
                    $char = substr($text, $i, 1);
                    if ($ignoreuntil == $char) {
                        $ignoreuntil = "";
                    } else {
                        if ($accesskeys[strtolower($char)] == 1 || strpos("abcdefghijklmnopqrstuvwxyz0123456789", strtolower($char)) === false || $ignoreuntil != "") {
                            if ($char == "<") {
                                $ignoreuntil = ">";
                            }
                            if ($char == "&") {
                                $ignoreuntil = ";";
                            }
                            if ($char == "`") {
                                $ignoreuntil = substr($text, $i + 1, 1);
                            }
                        } else {
                            break;
                        }
                    }
                }
            }
            if ($i < strlen($text)) {
                $key = substr($text, $i, 1);
                $accesskeys[strtolower($key)] = 1;
                $keyrep = " accesskey=\"{$key}\" ";
            } else {
                $key = "";
                $keyrep = "";
            }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dragonsaga-svn,代码行数:101,代码来源:common.php

示例6: charstats

/**
 * Returns the current character stats or (if the character isn't logged in) the currently online players
 * Hooks provided:
 *		charstats
 *
 * @return array The current stats for this character or the list of online players
 */
function charstats()
{
    global $session, $playermount, $companions;
    wipe_charstats();
    $u =& $session['user'];
    if ($session['loggedin']) {
        $u['hitpoints'] = round($u['hitpoints'], 0);
        $u['experience'] = round($u['experience'], 0);
        $u['maxhitpoints'] = round($u['maxhitpoints'], 0);
        // $spirits=array(-6=>"Resurrected",-2=>"Very Low",-1=>"Low","0"=>"Normal",1=>"High",2=>"Very High");
        // if ($u['alive']){ }else{ $spirits[(int)$u['spirits']] = "DEAD"; }
        //calculate_buff_fields();
        reset($session['bufflist']);
        $atk = $u['attack'];
        $def = $u['defense'];
        $buffcount = 0;
        $buffs = "";
        while (list($key, $val) = each($session['bufflist'])) {
            if (isset($val['suspended']) && $val['suspended']) {
                continue;
            }
            if (isset($val['atkmod'])) {
                $atk *= $val['atkmod'];
            }
            if (isset($val['defmod'])) {
                $def *= $val['defmod'];
            }
            // Short circuit if the name is blank
            if ($val['name'] > "" || $session['user']['superuser'] & SU_DEBUG_OUTPUT) {
                tlschema($val['schema']);
                if ($val['name'] == "") {
                    $val['name'] = "DEBUG: {$key}";
                }
                if (is_array($val['name'])) {
                    $val['name'][0] = str_replace("`%", "`%%", $val['name'][0]);
                    $val['name'] = call_user_func_array("sprintf_translate", $val['name']);
                } else {
                    //in case it's a string
                    $val['name'] = translate_inline($val['name']);
                }
                if ($val['rounds'] >= 0) {
                    // We're about to sprintf, so, let's makes sure that
                    // `% is handled.
                    //$n = translate_inline(str_replace("`%","`%%",$val['name']));
                    $b = translate_inline("`#%s `7(%s rounds left)`n", "buffs");
                    $b = sprintf($b, $val['name'], $val['rounds']);
                    $buffs .= appoencode($b, true);
                } else {
                    $buffs .= appoencode("`#{$val['name']}`n", true);
                }
                tlschema();
                $buffcount++;
            }
        }
        if ($buffcount == 0) {
            $buffs .= appoencode(translate_inline("`^None`0"), true);
        }
        $atk = round($atk, 2);
        $def = round($def, 2);
        if ($atk < $u['attack']) {
            $atk = round($u['attack'], 1) . "`\$" . round($atk - $u['attack'], 1);
        } else {
            if ($atk > $u['attack']) {
                $atk = round($u['attack'], 1) . "`@+" . round($atk - $u['attack'], 1);
            } else {
                // They are equal, display in the 1 signifigant digit format.
                $atk = round($atk, 1);
            }
        }
        if ($def < $u['defense']) {
            $def = round($u['defense'], 1) . "`\$" . round($def - $u['defense'], 1);
        } else {
            if ($def > $u['defense']) {
                $def = round($u['defense'], 1) . "`@+" . round($def - $u['defense'], 1);
            } else {
                // They are equal, display in the 1 signifigant digit format.
                $def = round($def, 1);
            }
        }
        addcharstat("Vital Info");
        //health bar
        if ($u['alive']) {
            $cur = $u['hitpoints'];
            $realmax = $u['maxhitpoints'];
            $cur_adjustment = check_temp_stat("hitpoints", 1);
            $max_adjustment = check_temp_stat("maxhitpoints", 1);
        } else {
            $cur = $u['soulpoints'];
            $realmax = $u['level'] * 5 + 50;
            $cur_adjustment = check_temp_stat("soulpoints", 1);
            $max_adjustment = "";
        }
        if ($pct > 60) {
//.........这里部分代码省略.........
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:pageparts.php

示例7: rawoutput

    }
    rawoutput("<script language='JavaScript'>\r\n\tvar superusers = new Array();");
    while (list($key, $val) = each($superusers)) {
        rawoutput("\tsuperusers['" . addslashes($val) . "'] = true;");
    }
    rawoutput("</script>");
    output("`2Subject:");
    rawoutput("<input name='subject' value=\"" . HTMLEntities($subject) . HTMLEntities(stripslashes(httpget('subject'))) . "\"><br>");
    rawoutput("<div id='warning' style='visibility: hidden; display: none;'>");
    output("`2Notice: `^{$superusermessage}`n");
    rawoutput("</div>");
    output("`2Body:`n");
    rawoutput("<textarea name='body' id='textarea' class='input' cols='60' rows='9' onKeyUp='sizeCount(this);'>" . HTMLEntities($body) . HTMLEntities(stripslashes(httpget('body'))) . "</textarea><br>");
    $send = translate_inline("Send");
    rawoutput("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td><input type='submit' class='button' value='{$send}'></td><td align='right'><div id='sizemsg'></div></td></tr></table>");
    output_notl("</form>", true);
    $sizemsg = "`3Max message size is `@%s`3, you have `^XX`3 characters left.";
    $sizemsg = translate_inline($sizemsg);
    $sizemsg = sprintf($sizemsg, getsetting("mailsizelimit", 1024));
    $sizemsgover = "`\$Max message size is `@%s`\$, you are over by `^XX`\$ characters!";
    $sizemsgover = translate_inline($sizemsgover);
    $sizemsgover = sprintf($sizemsgover, getsetting("mailsizelimit", 1024));
    $sizemsg = explode("XX", $sizemsg);
    $sizemsgover = explode("XX", $sizemsgover);
    $usize1 = addslashes("<span>" . appoencode($sizemsg[0]) . "</span>");
    $usize2 = addslashes("<span>" . appoencode($sizemsg[1]) . "</span>");
    $osize1 = addslashes("<span>" . appoencode($sizemsgover[0]) . "</span>");
    $osize2 = addslashes("<span>" . appoencode($sizemsgover[1]) . "</span>");
    rawoutput("\r\n\t<script language='JavaScript'>\r\n\t\tvar maxlen = " . getsetting("mailsizelimit", 1024) . ";\r\n\t\tfunction sizeCount(box){\r\n\t\t\tvar len = box.value.length;\r\n\t\t\tvar msg = '';\r\n\t\t\tif (len <= maxlen){\r\n\t\t\t\tmsg = '{$usize1}'+(maxlen-len)+'{$usize2}';\r\n\t\t\t}else{\r\n\t\t\t\tmsg = '{$osize1}'+(len-maxlen)+'{$osize2}';\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('sizemsg').innerHTML = msg;\r\n\t\t}\r\n\t\tsizeCount(document.getElementById('textarea'));\r\n\r\n\t\tfunction check_su_warning(){\r\n\t\t\tvar to = document.getElementById('to');\r\n\t\t\tvar warning = document.getElementById('warning');\r\n\t\t\tif (superusers[to.value]){\r\n\t\t\t\twarning.style.visibility = 'visible';\r\n\t\t\t\twarning.style.display = 'inline';\r\n\t\t\t}else{\r\n\t\t\t\twarning.style.visibility = 'hidden';\r\n\t\t\t\twarning.style.display = 'none';\r\n\t\t\t}\r\n\t\t}\r\n\t\tcheck_su_warning();\r\n\r\n\t</script>");
}
popup_footer();
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:mail.php

示例8: db_prefix

 }
 $sql = "SELECT * FROM " . db_prefix("accounts") . " WHERE login = '{$name}' AND password='{$password}' AND locked=0";
 $result = db_query($sql);
 if (db_num_rows($result) == 1) {
     $session['user'] = db_fetch_assoc($result);
     $companions = @unserialize($session['user']['companions']);
     if (!is_array($companions)) {
         $companions = array();
     }
     $baseaccount = $session['user'];
     checkban($session['user']['login'], true);
     modulehook("check-login");
     if ($session['user']['emailvalidation'] != "" && substr($session['user']['emailvalidation'], 0, 1) != "x") {
         $session['user'] = array();
         $session['message'] = translate_inline("`4Error, you must validate your email address before you can log in.");
         echo appoencode($session['message']);
         exit;
     } else {
         $session['loggedin'] = true;
         $session['laston'] = date("Y-m-d H:i:s");
         $session['sentnotice'] = 0;
         $session['user']['dragonpoints'] = unserialize($session['user']['dragonpoints']);
         $session['user']['prefs'] = unserialize($session['user']['prefs']);
         $session['bufflist'] = unserialize($session['user']['bufflist']);
         if (!is_array($session['bufflist'])) {
             $session['bufflist'] = array();
         }
         if (!is_array($session['user']['dragonpoints'])) {
             $session['user']['dragonpoints'] = array();
         }
         invalidatedatacache("charlisthomepage");
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:login.php

示例9: private_addnav

/**
 * Private functions (Undocumented)
 *
 * @param string $text
 * @param string $link
 * @param bool $priv
 * @param bool $pop
 * @param bool $popsize
 * @return mixed
 */
function private_addnav($text, $link = false, $priv = false, $pop = false, $popsize = "500x300")
{
    //don't call this directly please.  I'll break your thumbs if you do.
    global $nav, $session, $accesskeys, $REQUEST_URI, $quickkeys, $navschema, $notranslate;
    if (is_blocked($link)) {
        return false;
    }
    $thisnav = "";
    $unschema = 0;
    $translate = true;
    if (isset($notranslate)) {
        if (in_array(array($text, $link), $notranslate)) {
            $translate = false;
        }
    }
    if (is_array($text)) {
        if ($text[0] && $session['loggedin']) {
            if ($link === false) {
                $schema = "!array!" . serialize($text);
            } else {
                $schema = $text[0];
            }
            if ($translate) {
                tlschema($navschema[$schema]);
                $unschema = 1;
            }
        }
        if ($link != "!!!addraw!!!") {
            if ($translate) {
                $text[0] = translate($text[0]);
            }
            $text = call_user_func_array("sprintf", $text);
        } else {
            $text = call_user_func_array("sprintf", $text);
        }
    } else {
        if ($text && $session['loggedin'] && $translate) {
            tlschema($navschema[$text]);
            $unschema = 1;
        }
        if ($link != "!!!addraw!!!" && $text > "" && $translate) {
            $text = translate($text);
        }
        //leave the hack in here for now, use addnav_notl please
    }
    $extra = "";
    $ignoreuntil = "";
    if ($link === false) {
        //$text = holidayize($text,'nav');
        $thisnav .= tlbutton_pop() . templatereplace("navhead", array("title" => appoencode($text, $priv)));
    } elseif ($link === "") {
        //$text = holidayize($text,'nav');
        $thisnav .= tlbutton_pop() . templatereplace("navhelp", array("text" => appoencode($text, $priv)));
    } elseif ($link == "!!!addraw!!!") {
        $thisnav .= $text;
    } else {
        if ($text != "") {
            $extra = "";
            if (strpos($link, "?")) {
                $extra = "&c={$session['counter']}";
            } else {
                $extra = "?c={$session['counter']}";
            }
            $extra .= "-" . date("His");
            //hotkey for the link.
            $key = "";
            if ($text[1] == "?") {
                // check to see if a key was specified up front.
                $hchar = strtolower($text[0]);
                if ($hchar == ' ' || array_key_exists($hchar, $accesskeys) && $accesskeys[$hchar] == 1) {
                    $text = substr($text, 2);
                    //$text = holidayize($text,'nav');
                    if ($hchar == ' ') {
                        $key = " ";
                    }
                } else {
                    $key = $text[0];
                    $text = substr($text, 2);
                    //$text = holidayize($text,'nav');
                    $found = false;
                    $text_len = strlen($text);
                    for ($i = 0; $i < $text_len; ++$i) {
                        $char = $text[$i];
                        if ($ignoreuntil == $char) {
                            $ignoreuntil = "";
                        } else {
                            if ($ignoreuntil != "") {
                                if ($char == "<") {
                                    $ignoreuntil = ">";
                                }
//.........这里部分代码省略.........
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:output.php

示例10: substr

    //erase old entries once per ten seconds
    $lastdigit = substr($now, -1);
    if ($lastdigit == "0") {
        $delsql = "DELETE FROM " . db_prefix("whostyping") . " WHERE time < {$old}";
        db_query($delsql);
    }
    invalidatedatacache("whostyping/whostyping_" . $section);
}
//retrieve, deleting as appropriate
$sql = "SELECT * FROM " . db_prefix("whostyping") . " WHERE section='{$section}'";
$result = db_query_cached($sql, "whostyping/whostyping_" . $section, 60);
$disp = array();
while ($row = db_fetch_assoc($result)) {
    if ($row['time'] > $old) {
        $disp[] = $row['name'];
    }
}
//db_free_result($result);
//display
foreach ($disp as $name) {
    $encodedname = appoencode($name . "`0 takes a breath...`n");
    echo $encodedname;
}
unset($disp);
// $end = getmicrotime(true);
// $total = $end - $start;
//echo("CavemanJoe is debugging in the middle of the night, and this cycle of whostyping.php took this long: ");
//echo($total);
//echo("test!");
//echo($session['iterations']);
exit;
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:whostyping.php

示例11: appoencode

            case 2:
                $type = "`%Gem";
                break;
            case 3:
                $type = "`4HP";
                break;
            case 4:
                $type = "`\$maxHP";
                break;
            case 5:
                $type = "`qFavor";
                break;
            case 6:
                $type = "`@Turns";
                break;
            case 7:
                $type = "`TScript";
        }
        $type = appoencode(translate_inline($type));
        $edit = "<a href='runmodule.php?module=dwitems&op=edit-item&id={$itemid}'>{$tedit}</a>";
        $delete = "<a href='runmodule.php?module=dwitems&op=delete-items&id={$itemid}'>{$tdelete}</a>";
        rawoutput("<tr class='" . ($i % 2 ? "trlight" : "trdark") . "'><td align=center>{$itemid}</td><td>{$name}</td><td>{$type}</td><td align=center>[ {$edit} ]</td><td align=center>[ {$delete} ]</td></tr>");
        addnav("", "runmodule.php?module=dwitems&op=delete-items&id={$itemid}");
        addnav("", "runmodule.php?module=dwitems&op=edit-item&id={$itemid}");
    }
    rawoutput("</table>");
} else {
    output("No Items were found in your database.");
}
addnav("Return to the Grotto", "superuser.php");
addnav("Back to the Editor", "runmodule.php?module=dwitems&op=editor");
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:delete-items.php

示例12: charstats

/**
 * Returns the current character stats or (if the character isn't logged in) the currently online players
 * Hooks provided:
 *		charstats
 *
 * @return array The current stats for this character or the list of online players
 */
function charstats()
{
    global $session, $playermount, $companions;
    wipe_charstats();
    $u =& $session['user'];
    if ($session['loggedin']) {
        $u['hitpoints'] = round($u['hitpoints'], 0);
        $u['experience'] = round($u['experience'], 0);
        $u['maxhitpoints'] = round($u['maxhitpoints'], 0);
        $spirits = array(-6 => "Resurrected", -2 => "Very Low", -1 => "Low", "0" => "Normal", 1 => "High", 2 => "Very High");
        if ($u['alive']) {
        } else {
            $spirits[(int) $u['spirits']] = "DEAD";
        }
        //calculate_buff_fields();
        reset($session['bufflist']);
        $atk = $u['attack'];
        $def = $u['defense'];
        $buffcount = 0;
        $buffs = "";
        while (list($key, $val) = each($session['bufflist'])) {
            if (isset($val['suspended']) && $val['suspended']) {
                continue;
            }
            if (isset($val['atkmod'])) {
                $atk *= $val['atkmod'];
            }
            if (isset($val['defmod'])) {
                $def *= $val['defmod'];
            }
            // Short circuit if the name is blank
            if ($val['name'] > "" || $session['user']['superuser'] & SU_DEBUG_OUTPUT) {
                tlschema($val['schema']);
                if ($val['name'] == "") {
                    $val['name'] = "DEBUG: {$key}";
                }
                if (is_array($val['name'])) {
                    $val['name'][0] = str_replace("`%", "`%%", $val['name'][0]);
                    $val['name'] = call_user_func_array("sprintf_translate", $val['name']);
                } else {
                    //in case it's a string
                    $val['name'] = translate_inline($val['name']);
                }
                if ($val['rounds'] >= 0) {
                    // We're about to sprintf, so, let's makes sure that
                    // `% is handled.
                    //$n = translate_inline(str_replace("`%","`%%",$val['name']));
                    $b = translate_inline("`#%s `7(%s rounds left)`n", "buffs");
                    $b = sprintf($b, $val['name'], $val['rounds']);
                    $buffs .= appoencode($b, true);
                } else {
                    $buffs .= appoencode("`#{$val['name']}`n", true);
                }
                tlschema();
                $buffcount++;
            }
        }
        if ($buffcount == 0) {
            $buffs .= appoencode(translate_inline("`^None`0"), true);
        }
        $atk = round($atk, 2);
        $def = round($def, 2);
        if ($atk < $u['attack']) {
            $atk = round($u['attack'], 1) . "`\$" . round($atk - $u['attack'], 1);
        } else {
            if ($atk > $u['attack']) {
                $atk = round($u['attack'], 1) . "`@+" . round($atk - $u['attack'], 1);
            } else {
                // They are equal, display in the 1 signifigant digit format.
                $atk = round($atk, 1);
            }
        }
        if ($def < $u['defense']) {
            $def = round($u['defense'], 1) . "`\$" . round($def - $u['defense'], 1);
        } else {
            if ($def > $u['defense']) {
                $def = round($u['defense'], 1) . "`@+" . round($def - $u['defense'], 1);
            } else {
                // They are equal, display in the 1 signifigant digit format.
                $def = round($def, 1);
            }
        }
        addcharstat("Vital Info");
        addcharstat("Name", $u['name']);
        addcharstat("Level", "`b" . $u['level'] . check_temp_stat("level", 1) . "`b");
        if ($u['alive']) {
            addcharstat("Hitpoints", $u['hitpoints'] . check_temp_stat("hitpoints", 1) . "`0/" . $u['maxhitpoints'] . check_temp_stat("maxhitpoints", 1));
            addcharstat("Turns", $u['turns'] . check_temp_stat("turns", 1));
            addcharstat("Attack", $atk . check_temp_stat("attack", 1));
            addcharstat("Defense", $def . check_temp_stat("defense", 1));
        } else {
            $maxsoul = $u['level'] * 5 + 50;
            addcharstat("Soulpoints", $u['soulpoints'] . check_temp_stat("soulpoints", 1) . "`0/" . $maxsoul);
//.........这里部分代码省略.........
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:101,代码来源:pageparts.php

示例13: previewfield

function previewfield($name, $startdiv = false, $talkline = "says", $showcharsleft = true, $info = false, $default = false)
{
    global $schema, $session;
    $talkline = translate_inline($talkline, $schema);
    $youhave = translate_inline("You have ");
    $charsleft = translate_inline(" characters left.");
    if ($startdiv === false) {
        $startdiv = "";
    }
    rawoutput("<script language='JavaScript'>\n\t\t\t\tfunction previewtext{$name}(t,l){\n\t\t\t\t\tvar out = \"<span class=\\'colLtWhite\\'>" . addslashes(appoencode($startdiv)) . " \";\n\t\t\t\t\tvar end = '</span>';\n\t\t\t\t\tvar x=0;\n\t\t\t\t\tvar y='';\n\t\t\t\t\tvar z='';\n\t\t\t\t\tvar max=document.getElementById('input{$name}');\n\t\t\t\t\tvar charsleft='';");
    if ($talkline !== false) {
        rawoutput("\tif (t.substr(0,2)=='::'){\n\t\t\t\t\t\tx=2;\n\t\t\t\t\t\tout += '</span><span class=\\'colLtWhite\\'>';\n\t\t\t\t\t}else if (t.substr(0,1)==':'){\n\t\t\t\t\t\tx=1;\n\t\t\t\t\t\tout += '</span><span class=\\'colLtWhite\\'>';\n\t\t\t\t\t}else if (t.substr(0,3)=='/me'){\n\t\t\t\t\t\tx=3;\n\t\t\t\t\t\tout += '</span><span class=\\'colLtWhite\\'>';");
        if ($session['user']['superuser'] & SU_IS_GAMEMASTER) {
            rawoutput("\n\t\t\t\t\t}else if (t.substr(0,5)=='/game'){\n\t\t\t\t\t\tx=5;\n\t\t\t\t\t\tout = '<span class=\\'colLtWhite\\'>';");
        }
        rawoutput("\t}else{\n\t\t\t\t\t\tout += '</span><span class=\\'colDkCyan\\'>" . addslashes(appoencode($talkline)) . ", \"</span><span class=\\'colLtCyan\\'>';\n\t\t\t\t\t\tend += '</span><span class=\\'colDkCyan\\'>\"';\n\t\t\t\t\t}");
    }
    if ($showcharsleft == true) {
        /*		if (translate_inline($talkline,$schema)!="says")
        		$tll = strlen(translate_inline($talkline,$schema))+11;
        		else $tll=0;  // Don't know why needed
        		rawoutput("	if (x!=0) {
        						if (max.maxlength!=200-$tll) max.maxlength=200-$tll;
        						l=200-$tll; */
        // Don't know why needed
        rawoutput("\tif (x!=0) {\n\t\t\t\t\t\tif (max.maxLength!=200) max.maxLength=200;\n\t\t\t\t\t\tl=200;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmax.maxLength=l;\n\t\t\t\t\t}\n\t\t\t\t\tif (l-t.length<0) charsleft +='<span class=\\'colLtRed\\'>';\n\t\t\t\t\tcharsleft += '" . $youhave . "'+(l-t.length)+'" . $charsleft . "<br>';\n\t\t\t\t\tif (l-t.length<0) charsleft +='</span>';\n\t\t\t\t\tdocument.getElementById('charsleft{$name}').innerHTML=charsleft+'<br/>';");
    }
    rawoutput("\t\tfor (; x < t.length; x++){\n\t\t\t\t\t\ty = t.substr(x,1);\n\t\t\t\t\t\tif (y=='<'){\n\t\t\t\t\t\t\tout += '&lt;';\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}else if(y=='>'){\n\t\t\t\t\t\t\tout += '&gt;';\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}else if(y=='\\n'){\n\t\t\t\t\t\t\tout += '<br />';\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}else if (y=='`'){\n\t\t\t\t\t\t\tif (x < t.length-1){\n\t\t\t\t\t\t\t\tz = t.substr(x+1,1);\n\t\t\t\t\t\t\t\tif (z=='0'){\n\t\t\t\t\t\t\t\t\tout += '</span>';\n\t\t\t\t\t\t\t\t}else if (z=='1'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkBlue\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='2'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkGreen\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='3'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkCyan\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='4'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkRed\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='5'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkMagenta\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='6'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkYellow\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='7'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkWhite\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='q'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkOrange\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='!'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtBlue\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='@'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtGreen\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='#'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtCyan\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='\$'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtRed\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='%'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtMagenta\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='^'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtYellow\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='&'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtWhite\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='Q'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtOrange\\'>';\n\t\t\t\t\t\t\t\t}else if (z==')'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtBlack\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='r'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colRose\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='R'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colRose\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='v'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'coliceviolet\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='V'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colBlueViolet\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='g'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colXLtGreen\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='G'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colXLtGreen\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='T'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkBrown\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='t'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtBrown\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='~'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colBlack\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='j'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colMdGrey\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='J'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colMdBlue\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='e'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkRust\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='E'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtRust\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='l'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colDkLinkBlue\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='L'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colLtLinkBlue\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='x'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colburlywood\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='X'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colbeige\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='y'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colkhaki\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='Y'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'coldarkkhaki\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='k'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colaquamarine\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='K'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'coldarkseagreen\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='p'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'collightsalmon\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='P'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colsalmon\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='m'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'colwheat\\'>';\n\t\t\t\t\t\t\t\t}else if (z=='M'){\n\t\t\t\t\t\t\t\t\tout += '</span><span class=\\'coltan\\'>';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tout += y;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById(\"previewtext{$name}\").innerHTML=out+end+'<br/>';\n\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t\t");
    if ($charsleft == true) {
        rawoutput("<span id='charsleft{$name}'></span>");
    }
    if (!is_array($info)) {
        if ($default) {
            rawoutput("<input name='{$name}' id='input{$name}' maxlength='255' onKeyUp='previewtext{$name}(document.getElementById(\"input{$name}\").value,200);' value='{$default}'>");
        } else {
            rawoutput("<input name='{$name}' id='input{$name}' maxlength='255' onKeyUp='previewtext{$name}(document.getElementById(\"input{$name}\").value,200);'>");
        }
    } else {
        if (isset($info['maxlength'])) {
            $l = $info['maxlength'];
        } else {
            $l = 200;
        }
        if (isset($info['type']) && $info['type'] == 'textarea') {
            rawoutput("<textarea name='{$name}' id='input{$name}' onKeyUp='previewtext{$name}(document.getElementById(\"input{$name}\").value,{$l});' ");
        } else {
            rawoutput("<input name='{$name}' id='input{$name}' onKeyUp='previewtext{$name}(document.getElementById(\"input{$name}\").value,{$l});' ");
        }
        foreach ($info as $key => $val) {
            rawoutput("{$key}='{$val}'");
        }
        if (isset($info['type']) && $info['type'] == 'textarea') {
            rawoutput(">");
            if ($default) {
                rawoutput($default);
            }
            rawoutput("</textarea>");
        } else {
            if ($default) {
                rawoutput(" value='{$default}'>");
            } else {
                rawoutput(">");
            }
        }
    }
    rawoutput("<div id='previewtext{$name}'></div>");
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:67,代码来源:forms.php

示例14: donationextend_dohook

function donationextend_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "donation":
            require_once "lib/gamelog.php";
            gamelog("Donation registered by donationextend");
            $amt = $args['amt'];
            $id = $args['id'];
            $kitty = get_module_setting("kitty");
            $newkitty = $kitty + $amt;
            set_module_setting("kitty", $newkitty);
            //set last player
            if (!get_module_pref("user_shy", "donationextend", $id)) {
                $sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid='{$id}'";
                $result = db_query_cached($sql, "donationextend_lastdonator", 300);
                $row = db_fetch_assoc($result);
                $name = $row['name'] . "`0";
                set_module_setting("lastdonator", $name);
            } else {
                set_module_setting("lastdonator", "Anonymous");
            }
            break;
        case "everyfooter":
            //debug($args,true);
            // Set up and decrement the kitty
            require_once "lib/bars.php";
            $last = get_module_setting("lasttick");
            $ext1 = get_module_setting("extend1cost");
            $player = get_module_setting("lastdonator");
            $player = appoencode(stripslashes($player));
            $elapsed = time() - $last;
            $dropped = 0;
            $droppertenseconds = get_module_setting("extend1cost") / 8640;
            if ($elapsed > 10) {
                $dropped = $droppertenseconds;
            }
            $oldkitty = get_module_setting("kitty");
            $newkitty = $oldkitty - $dropped;
            if ($newkitty < 0) {
                $newkitty = 0;
            }
            //set up display output
            $out = "";
            $sql = "SELECT count(acctid) AS c FROM " . db_prefix("accounts") . " WHERE locked=0";
            $result = db_query_cached($sql, "donationextend_totalplayers", 1800);
            $row = db_fetch_assoc($result);
            $totalplayers = $row['c'];
            if ($newkitty > $ext1) {
                $ext2 = get_module_setting("extend2cost");
                if ($newkitty > $ext2) {
                    $over = $newkitty - $ext2;
                    $bar = simplebar($over, $ext2, 70, 5, "AA00AA", "FFFFFF");
                    $overdisp = number_format($over / 100, 2);
                    //represent as time left to end of Special Extend period
                    $droppersec = get_module_setting("extend1cost") / 86400;
                    $secsleft = round($over / $droppersec);
                    $expirationtime = time() + $secsleft;
                    require_once "lib/datetime.php";
                    $expirein = reltime($expirationtime, false);
                    $out .= "<span style='font-size:smaller'><strong>Special Extend active!</strong><br />" . $bar . "Thank you for your support!  Special Extend expires in " . $expirein . "<br /><a href='runmodule.php?module=donationextend' target='_blank' onclick=\"" . popup("runmodule.php?module=donationextend") . ";return false;\">(what's a Special Extend?)</span></a>";
                } else {
                    $moreneeded = $ext2 - $newkitty;
                    $bar = simplebar($newkitty - $ext1, $ext2 - $ext1, 70, 5, "00FF00", "AA00AA");
                    $moredisp = number_format($moreneeded / 100, 2);
                    $out .= "<span style='font-size:smaller'><strong>Extended Play active!</strong><br />" . $bar . "\$" . $moredisp . " more for <a href='runmodule.php?module=donationextend' target='_blank' onclick=\"" . popup("runmodule.php?module=donationextend") . ";return false;\">Special Extend</a>!</span>";
                }
            } else {
                $moreneeded = $ext1 - $newkitty;
                $moredisp = number_format($moreneeded / 100, 2);
                $bar = fadebar($newkitty, $ext1, 57);
                $perplayer = $moreneeded / 100 / $totalplayers;
                if ($perplayer > 1) {
                    $perplayerdisp = "about " . round($moreneeded / $totalplayers, 4) . " cents per player";
                } else {
                    $perplayerdisp = "about \$" . number_format($moreneeded / 100 / $totalplayers, 2) . " per player";
                }
                $out .= $bar;
                if ($newkitty > 0) {
                    $out .= "<span style='font-size:smaller'>\$" . $moredisp . " more (" . $perplayerdisp . ") for <a href='runmodule.php?module=donationextend' target='_blank' onclick=\"" . popup("runmodule.php?module=donationextend") . ";return false;\">Extended Play</a>!</span>";
                } else {
                    if ($session['user']['loggedin']) {
                        $out .= "<span class='colDkRed'><strong>The kitty is empty!</strong></span>  Improbable Island is entirely dependant on your donations to survive.  When the meter is empty, the Island and its creators are in trouble!  Someone please chuck a couple of bucks in the hat!";
                    }
                }
            }
            global $template;
            //debug($template);
            if (strpos($template['footer'], "{paypal_extras}")) {
                //if (isset($template['{paypal_extras}'])){
                //debug("Yes!");
                $rep = "paypal_extras";
            } else {
                //debug("No!");
                $rep = "paypal";
            }
            //$rep = "paypal_extras";
            //insert display output into page
            if (!array_key_exists($rep, $args) || !is_array($args[$rep])) {
                $args[$rep] = array();
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:donationextend.php

示例15: jquerycommentary_run

function jquerycommentary_run()
{
    global $_SERVER, $output, $session;
    require_once 'lib/commentary.php';
    $section = httpget('section');
    $commentary = db_prefix('commentary');
    $accounts = db_prefix('accounts');
    if (($commid = httpget('rmvcmmnt')) != "") {
        $prefix = db_prefix('commentary');
        check_su_access(SU_EDIT_COMMENTS);
        if ($session['user']['superuser'] & SU_EDIT_COMMENTS) {
            db_query("DELETE FROM {$prefix} WHERE commentid = '{$commid}'");
        }
        db_query("INSERT INTO {$commentary} (section, author, comment, postdate) VALUES ('blackhole', '{$session['user']['acctid']}', 'I fucked up', '" . date('Y-m-d H:i:s') . "')");
        invalidatedatacache("comments-{$section}");
        invalidatedatacache("comments-blackhole");
    }
    if (httpget('section') == get_module_pref('current_section') && httpget('section') != '') {
        //echo 'x';
        //var_dump(get_all_module_settings());
        $output = "";
        $_SERVER['REQUEST_URI'] = httpget('r');
        $session['counter'] = httpget('c');
        viewcommentary(get_module_pref('current_section'), get_module_setting('message'), get_module_setting('limit'), get_module_setting('talkline'));
        $output = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $output);
        $output = substr($output, 0, strpos($output, "<jquerycommentaryend>"));
        db_query("UPDATE accounts SET laston = '" . date('Y-m-d H:i:s') . "' WHERE acctid = '{$session['user']['acctid']}'");
        echo trim("{$output}");
        invalidatedatacache("comments-{$section}");
        /*$sql = db_query(
              "SELECT a.name, a.acctid
              FROM accounts AS a
              LEFT JOIN module_userprefs AS m
              ON m.userid = a.acctid
              LEFT JOIN module_userprefs AS u
              ON u.userid = m.userid
              WHERE m.modulename = 'jquerycommentary'
              AND m.setting = 'is_typing'
              AND m.value = '1'
              AND u.modulename = 'jquerycommentary'
              AND u.setting = 'current_section'
              and u.value = '" . get_module_pref('current_section') ."'"
          );
          $typing = [];
          while ($row = db_fetch_assoc($sql)) {
              array_push($typing, [$row['acctid'], $row['name']]);
          }
          $isTyping = appoencode('`@');
          $i = 0;
          echo appoencode('`@Who\'s typing: `n');
          if (count($typing) != 0) {
              foreach ($typing as $key => $val) {
                  $i++;
                  if ($i == 1) {
                      $isTyping .= appoencode($val[1]);
                  }
                  else if ($i > 1 && count($typing) > $i) {
                      $isTyping .= appoencode("`@, {$val[1]}");
                  }
                  else if ($i == count($typing)) {
                      $isTyping .= appoencode("`@ and {$val[1]}");
                  }
              }
              echo $isTyping;
          }
          else {
              echo appoencode('`@No one');
          }*/
    }
    switch (httpget('op')) {
        case 'get_json':
            $sql = db_query("SELECT commentid, author, comment FROM commentary WHERE section = '{$session['current_commentary_area']}' AND deleted = '0' ORDER BY commentid+0 DESC LIMIT 0, 25");
            $json = [];
            while ($row = db_fetch_assoc($sql)) {
                array_push($json, $row);
            }
            echo "<pre>";
            echo json_encode($json, JSON_PRETTY_PRINT);
            echo "</pre>";
            break;
        case 'post':
            $post = httpallpost();
            $post = modulehook('jquery-post-commentary', $post);
            $commentary = db_prefix('commentary');
            if ($post['method'] == 'insertcommentary') {
                require_once 'lib/commentary.php';
                injectcommentary(get_module_pref('current_section'), get_module_setting('talkline'), $post['comment']);
            } else {
                $commentid = explode('_', $post['method']);
                require_once 'lib/systemmail.php';
                require_once 'lib/sanitize.php';
                $post['comment'] = htmlent($post['comment']);
                db_query("UPDATE {$commentary} SET comment = '{$post['comment']}' WHERE commentid = '{$commentid[1]}'");
                db_query("INSERT INTO {$commentary} (section, author, comment, postdate) VALUES ('blackhole', '{$session['user']['acctid']}', 'I fucked up', '" . date('Y-m-d H:i:s') . "')");
                invalidatedatacache("comments-{$session['current_commentary_section']}");
                invalidatedatacache("comments-blackhole");
            }
            break;
        case 'last_comment':
            require_once 'lib/sanitize.php';
//.........这里部分代码省略.........
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:101,代码来源:jquerycommentary.php


注:本文中的appoencode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。