function sessioncheck()
{
    if (!isset($_SESSION['login']['user']) || !isset($_SESSION['login']['password'])) {
        showform();
        exit;
    }
}
function mechanicalturk_run()
{
    global $session;
    require_once "common.php";
    require_once "lib/http.php";
    page_header("Report a Monster Sighting");
    $points = get_module_setting("addpoints");
    switch (httpget("creatureaction")) {
        case "report":
            require_once "lib/showform.php";
            // $level = 1;
            output("You head into a little hut on the outskirts of the Outpost, close to where the clearing turns to jungle.`n`nAn excitable-looking man sits behind a desk, a pair of binoculars slung around his neck.`n`n\"`2Hello!`0\" he calls to you, practically bouncing with geeky excitement.  \"`2Have you come to report a sighting of a new monster?  I do so enjoy writing them up!`0\"  He opens a little ledger and whips out a pen, ready for your report.`n`nYou've heard rumours about this guy.  Billing himself as a monster expert, he listens to the reports of new monsters that players find, and writes them down in his book.  Sauntering into his hut and providing deadly serious reports of completely made-up monsters is a game that many contestants enjoy playing.  However, given the aura of Improbability surrounding his innocent-looking ledger, the rumours contain a dark side as well; sometimes, if a made-up monster is deemed to be Improbable enough by the standards of whatever strange powers control the Island, it takes on a physical form in the Jungle...`n`n");
            output("As you're thinking this, a splintering CRUNCH from your left causes you to jump three feet into the air.  `%Admin `4Caveman`\$Joe`0 is standing in the remains of the fourth wall of the hut, holding a large axe.  He strikes an attractive pose and says \"`4This is Improbable Island's monster submission hut.  Think of a new monster, and submit it here.  If your idea is accepted, you'll get %s Donator Points!`0\"`n`nHe turns to the little man sat behind the desk, who at this moment is picking bits of wood out of his tea, hair and person in general.  `%Admin `4Caveman`\$Joe`0 shows him a smile.  \"`4I'd say 'Sorry about your wall,' mate, but I'm not.  All part of the job, you see.`0\"`n`nWith that, he walks back out of the hole in the fourth wall, attaches his Admin Goggles, leaps into the sky and flies away.`n`n", $points);
            output("\"`2What a very, very strange man,`0\" says the little man behind the desk.  Quietly.`n`n");
            output("`4`b<a href=\"http://enquirer.improbableisland.com/dokuwiki/doku.php?id=terrible_monster_suggestions\">Here are the monster submission guidelines</a>.`b`0  You MUST read these first if you want any chance at all of your monster being accepted, I really can't stress this enough.`n`n", true);
            rawoutput("When writing descriptions, please use `n to go down one line, and `n`n to leave a blank line.  That's `n, not 'n.  The ` key is usually in the top left corner of your keyboard - it's the same key you use for colour codes.");
            $form = array("Creature Properties,title", "creatureid" => "Creature id,hidden", "creaturename" => "Creature Name", "creatureweapon" => "Weapon", "creaturewin" => "Win Message (Displayed when the `bcreature kills the player`b)", "creaturelose" => "Death Message (Displayed when the `bplayer kills the creature`b)", "creaturelevel" => "Level,range,1,17,1", "forest" => "Creature is in Jungle?,bool", "graveyard" => "Creature is on FailBoat?,bool", "description" => "A long description of the creature");
            $row = array("creatureid" => 0);
            addnav("I honestly don't have any ideas.  Back to the Jungle.", "forest.php");
            rawoutput("<form action='runmodule.php?module=mechanicalturk&creatureaction=save' method='POST'>");
            showform($form, $row);
            rawoutput("</form>");
            addnav("", "runmodule.php?module=mechanicalturk&creatureaction=save");
            break;
        case "save":
            $creatureid = httppost('creatureid');
            $creaturename = httppost('creaturename');
            $creatureweapon = httppost('creatureweapon');
            $creaturewin = httppost('creaturewin');
            $creaturelose = httppost('creaturelose');
            $creaturelevel = httppost('creaturelevel');
            $forest = httppost('forest');
            $graveyard = httppost('graveyard');
            $description = httppost('description');
            $submittedby = $session['user']['name'];
            $uid = $session['user']['acctid'];
            //			$creatureid = db_insert_id();
            //			$creatureid++;
            //			$sql = 'LOCK TABLES '.db_prefix( 'mechanicalturk' ).' WRITE;';
            //			db_query( $sql );
            //			$sql = "INSERT INTO ".db_prefix("mechanicalturk")."(creatureid,creaturename,creatureweapon,creaturewin,creaturelose,creaturelevel,forest,graveyard,submittedby)	VALUES ($creatureid,$creaturename,$creatureweapon,$creaturewin,$creaturelose,$creaturelevel,$forest,$graveyard,$submittedby)";
            $sql = "INSERT INTO " . db_prefix("mechanicalturk") . " (creaturename,creatureweapon,creaturewin,creaturelose,creaturelevel,forest,graveyard,description,submittedby,uid) VALUES ('" . mysql_real_escape_string($creaturename) . "','" . mysql_real_escape_string($creatureweapon) . "','" . mysql_real_escape_string($creaturewin) . "','" . mysql_real_escape_string($creaturelose) . "','" . (int) $creaturelevel . "','" . (int) $forest . "','" . (int) $graveyard . "','" . mysql_real_escape_string($description) . "','" . mysql_real_escape_string($submittedby) . "',{$uid})";
            //			$result = db_query($sql);
            db_query($sql);
            debug($sql);
            //			$sql = 'UNLOCK TABLES;';
            //			db_query( $sql );
            output("`4The monster \"`^%s`4\" has been submitted.`n`nDue to the high volume of monster submissions, it may take several days or even weeks before you hear back from us.  Please be patient!`0`n`nThe little man behind the desk looks around, confused.  \"Who said that?!\"`n`nYou decide it'd be best to get out of here.", $creaturename);
            addnav("Back to the Jungle", "forest.php");
            break;
        case "showsubmitted":
            $sql = "SELECT creatureid,creaturename,creatureweapon,creaturewin,creaturelose,creaturelevel,forest,graveyard,description,submittedby,uid FROM " . db_prefix("mechanicalturk");
            $result = db_query($sql);
            for ($i = 0; $i < db_num_rows($result); $i++) {
                $row = db_fetch_assoc($result);
                output("Monster submission by %s`n`n", $row['submittedby']);
                output("%s`n`n", stripslashes($row['description']));
                output("You have encountered %s which lunges at you with %s!`n`n", stripslashes($row['creaturename']), stripslashes($row['creatureweapon']));
                output("Creature win message: %s`n", stripslashes($row['creaturewin']));
                output("Creature lose message: %s`n", stripslashes($row['creaturelose']));
                output("Creature level: %s`n", $row['creaturelevel']);
                output("Jungle: %s - FailBoat: %s`n`n", $row['forest'], $row['graveyard']);
                rawoutput("<a href=\"runmodule.php?module=mechanicalturk&creatureaction=edit&id=" . $row['creatureid'] . "\">Edit</a> | <a href=\"runmodule.php?module=mechanicalturk&creatureaction=reject&op=1&id=" . $row['creatureid'] . "\">Reject nonspecifically</a> |  <a href=\"runmodule.php?module=mechanicalturk&creatureaction=reject&op=2&id=" . $row['creatureid'] . "\">Reject because of writing</a> | <a href=\"runmodule.php?module=mechanicalturk&creatureaction=reject&op=3&id=" . $row['creatureid'] . "\">Reject but ask for rewrite</a> | <a href=\"runmodule.php?module=mechanicalturk&creatureaction=reject&op=4&id=" . $row['creatureid'] . "\">Reject because of pop culture refs</a> | <a href=\"runmodule.php?module=mechanicalturk&creatureaction=accept&id=" . $row['creatureid'] . "\">Accept this monster</a>");
                addnav("", "runmodule.php?module=mechanicalturk&creatureaction=edit&id=" . $row['creatureid']);
                addnav("", "runmodule.php?module=mechanicalturk&creatureaction=reject&op=1&id=" . $row['creatureid']);
                addnav("", "runmodule.php?module=mechanicalturk&creatureaction=reject&op=2&id=" . $row['creatureid']);
                addnav("", "runmodule.php?module=mechanicalturk&creatureaction=reject&op=3&id=" . $row['creatureid']);
                addnav("", "runmodule.php?module=mechanicalturk&creatureaction=reject&op=4&id=" . $row['creatureid']);
                addnav("", "runmodule.php?module=mechanicalturk&creatureaction=accept&id=" . $row['creatureid']);
                output("`n`n====================`n`n");
            }
            addnav("Back to the Superuser grotto", "superuser.php");
            break;
        case "edit":
            $id = httpget("id");
            require_once "lib/showform.php";
            addnav("Back to the Jungle", "forest.php");
            $form = array("Creature Properties,title", "creatureid" => "Creature id,hidden", "creaturename" => "Creature Name", "creatureweapon" => "Weapon", "creaturewin" => "Win Message (Displayed when the creature kills the player)", "creaturelose" => "Death Message (Displayed when the creature is killed by the player)", "creaturelevel" => "Level,range,1,18,1", "forest" => "Creature is in Jungle?,bool", "graveyard" => "Creature is on FailBoat?,bool", "description" => "A long description of the creature");
            $sql = "SELECT creatureid,creaturename,creatureweapon,creaturewin,creaturelose,creaturelevel,forest,graveyard,description,submittedby,uid FROM " . db_prefix("mechanicalturk") . " WHERE creatureid = {$id}";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
            debug($row);
            $row['creaturename'] = stripslashes($row['creaturename']);
            $row['creatureweapon'] = stripslashes($row['creatureweapon']);
            $row['creaturewin'] = stripslashes($row['creaturewin']);
            $row['creaturelose'] = stripslashes($row['creaturelose']);
            $row['description'] = stripslashes($row['description']);
            rawoutput("<form action='runmodule.php?module=mechanicalturk&creatureaction=update' method='POST'>");
            showform($form, $row);
            rawoutput("</form>");
            addnav("", "runmodule.php?module=mechanicalturk&creatureaction=update");
            addnav("Back to the submission list", "runmodule.php?module=mechanicalturk&creatureaction=showsubmitted");
            addnav("Back to the Superuser grotto", "superuser.php");
            break;
        case "update":
            addnav("Back to the submission list", "runmodule.php?module=mechanicalturk&creatureaction=showsubmitted");
            addnav("Back to the Superuser grotto", "superuser.php");
            $creatureid = httppost('creatureid');
            $creaturename = httppost('creaturename');
            $creatureweapon = httppost('creatureweapon');
            $creaturewin = httppost('creaturewin');
            $creaturelose = httppost('creaturelose');
            $creaturelevel = httppost('creaturelevel');
            $forest = httppost('forest');
            $graveyard = httppost('graveyard');
            $description = httppost('description');
            $sql = "UPDATE " . db_prefix("mechanicalturk") . " SET creaturename = '{$creaturename}', creatureweapon = '{$creatureweapon}', creaturewin = '{$creaturewin}', creaturelose = '{$creaturelose}', creaturelevel = '{$creaturelevel}', forest = {$forest}, graveyard = {$graveyard}, description = '{$description}' WHERE creatureid = {$creatureid}";
            db_query($sql);
            debug($sql);
            output("All done!");
            break;
        case "reject":
            $id = httpget("id");
            $op = httpget("op");
            $sql = "SELECT creatureid,creaturename,creatureweapon,creaturewin,creaturelose,creaturelevel,forest,graveyard,description,submittedby,uid FROM " . db_prefix("mechanicalturk") . " WHERE creatureid = {$id}";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
            if ($op == 1) {
                $message = translate_mail(array('It\'s not good news to hear, but I\'m afraid your monster idea (the one named %s) just wasn\'t what we were looking for.  Please feel free to try again with a new idea, though!  Please don\'t feel too bad, because less than thirty per cent of submissions are accepted.  For your reference, the creature description is as follows: %s', $row['creaturename'], $row['description']));
            }
            if ($op == 2) {
                $message = translate_mail(array('It\'s not good news to hear, but I\'m afraid your monster idea (the one named %s) was rejected because of spelling, grammar and/or flow issues.  We heartily recommend taking a look at Elements of Style (Google it).  Spending the half an hour it takes to read it will permanently improve your writing skills, and it can also be read for free online, so we think it\'s a very good deal!  Please don\'t feel too bad, because less than thirty per cent of submissions are accepted.  For your reference, the creature description is as follows: %s', $row['creaturename'], $row['description']));
            }
            if ($op == 3) {
                $message = translate_mail(array('It\'s not good news to hear, but I\'m afraid your monster idea (the one named %s) was rejected.  But it\'s not all bad news - in this case, we thought your monster idea had potential, and would like to see it rewritten and expanded upon, perhaps with a longer or more detailed description.  So please feel free to edit it and resubmit!  Please don\'t feel too bad, because less than thirty per cent of submissions are accepted.  For your reference, the creature description is as follows: %s', $row['creaturename'], $row['description']));
            }
            if ($op == 4) {
                $message = translate_mail(array('It\'s not good news to hear, but I\'m afraid your monster idea (the one named %s) was rejected because it contained a pop culture reference that was either already done to death, too obscure or not funny enough.  Remember, although pop culture references aren\'t specifically disallowed, they must be approximately fifty per cent more awesome than other entries that do not contain pop culture references.  Please don\'t feel too bad, because less than thirty per cent of submissions are accepted.  For your reference, the creature description is as follows: %s', $row['creaturename'], $row['description']));
            }
            require_once "lib/systemmail.php";
            systemmail($row['uid'], "Your monster has been rejected!", $message);
            $sql = "DELETE FROM " . db_prefix("mechanicalturk") . " WHERE creatureid = '{$id}'";
            db_query($sql);
            output("The monster has been deleted, and the author notified.");
            addnav("Show list of submitted monsters", "runmodule.php?module=mechanicalturk&creatureaction=showsubmitted");
            break;
        case "accept":
            $id = httpget("id");
            $sql = "SELECT creaturename,creatureweapon,creaturewin,creaturelose,creaturelevel,forest,graveyard,description,submittedby,uid FROM " . db_prefix("mechanicalturk") . " WHERE creatureid = {$id}";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
            debug($row);
            $row['creaturename'] = stripslashes($row['creaturename']);
            $row['creatureweapon'] = stripslashes($row['creatureweapon']);
            $row['creaturewin'] = stripslashes($row['creaturewin']);
            $row['creaturelose'] = stripslashes($row['creaturelose']);
            $row['description'] = stripslashes($row['description']);
            output("Sending this to creatures.php.");
            require_once "lib/showform.php";
            $form = array("Creature Properties,title", "creatureid" => "Creature id,hidden", "creaturename" => "Creature Name", "creatureweapon" => "Weapon", "creaturewin" => "Win Message (Displayed when the creature kills the player)", "creaturelose" => "Death Message (Displayed when the creature is killed by the player)", "creaturelevel" => "Level,range,1,18,1", "forest" => "Creature is in forest?,bool", "graveyard" => "Creature is in graveyard?,bool", "creatureaiscript" => "Creature's A.I.,textarearesizeable");
            rawoutput("<form action='creatures.php?op=save' method='POST'>");
            showform($form, $row);
            rawoutput("</form>");
            output("Monster description:`n`n");
            rawoutput("" . $row['description'] . "");
            output("`n`n`bCOPY THIS TO YOUR CLIPBOARD NOW.`b  The Description is not automated and must be input manually.");
            $message = translate_mail(array('Congratulations!  Your monster idea (the one named %s) has been accepted!  Your Donator Points have also been applied to your account.  Enjoy them!', $row['creaturename']));
            require_once "lib/systemmail.php";
            systemmail($row['uid'], "Your monster idea has been accepted!", $message);
            addnav("", "creatures.php?op=save");
            $acctid = $row['uid'];
            addnav("Go back to the list of submitted monsters", "runmodule.php?module=mechanicalturk&creatureaction=showsubmitted");
            $sql = "UPDATE " . db_prefix("accounts") . " SET donation=donation+{$points} WHERE acctid={$acctid}";
            db_query($sql);
            $sql = "DELETE FROM " . db_prefix("mechanicalturk") . " WHERE creatureid = '{$id}'";
            db_query($sql);
            break;
    }
    page_footer();
}
示例#3
0
                output("`n`nThe original game code, developed by Eric Stevens and JT Traub, with a design by Chris Yarbrough, remains under their copyright.");
                output("`n`nYou may download the latest official version of LoGD at <a href=\"http://sourceforge.net/projects/lotgd\">http://sourceforge.net/projects/lotgd</a>", true);
                output("and you can play the version currently in development at http://lotgd.net.");
                output("`n`nLegend of the Green Dragon is a remake of and homage to the classic");
                output("BBS Door game, Legend of the Red Dragon (aka LoRD) by <a href=\"http://www.rtsoft.com/\">Seth Able Robinson</a>.  ", true);
                output("`n`n`@`2LoRD is now owned by Gameport (<a href='http://www.gameport.com/bbs/lord.html'>http://www.gameport.com/bbs/lord.html</a>), and ", true);
                output("they retain exclusive rights to the LoRD name and game.  That's why all content in ");
                output("Legend of the Green Dragon (and by extension, TDS) is new, with only a very few nods to the original game, such ");
                output("as the buxom barmaid, Violet, and the handsome bard, Seth.`n`n");
                output("`@`2Although serious effort was made to preserve the original feel of the game, ");
                output("numerous departures were taken from the original game to enhance playability, and ");
                output("to adapt it to the web.`n`n");
                output("`@`2We hope you enjoy the game!`@");
                break;
        }
    }
    addnav("Game Setup Info", "about.php?op=setup");
} elseif ($_GET['op'] == "setup") {
    addnav("About TDS", "about.php");
    $setup = array("Game Setup,title", "pvp" => "Enable Slay Other Players,viewonly", "pvpday" => "Player Fights per day,viewonly", "pvpimmunity" => "Days that new players are safe from PvP,viewonly", "pvpminexp" => "Amount of experience when players become killable in PvP,viewonly", "soap" => "Clean user posts (filters bad language and splits words over 45 chars long),viewonly", "newplayerstartgold" => "Amount of gold to start a new character with,viewonly", "New Days,title", "fightsforinterest" => "Player must have fewer than how many forest fights to earn interest?,viewonly", "maxinterest" => "Max Interest Rate (%),viewonly", "mininterest" => "Min Interest Rate (%),viewonly", "daysperday" => "Game days per calendar day,viewonly", "specialtybonus" => "Extra daily uses in specialty area,viewonly", "Bank settings,title", "borrowperlevel" => "Max amount player can borrow per level,viewonly", "transferperlevel" => "Max amount player can transfer per level of recipient,viewonly", "mintransferlev" => "Minimum level a player has to be before they can transfer gold,viewonly", "transferreceive" => "Total transfers a player can receive in one play day,viewonly", "maxtransferout" => "Max amount total a player can transfer to others per level,viewonly", "Bounty,title", "bountymin" => "Minimum amount per level of target for bounty,viewonly", "bountymax" => "Maximum amount per level of target for bounty,viewonly", "bountylevel" => "Minimum player level for being a bounty target,viewonly", "bountyfee" => "Percentage of bounty kept by Dag Durnick,viewonly", "maxbounties" => "How many bounties can a person set per day,viewonly", "Forest,title", "turns" => "Forest Fights per day,viewonly", "dropmingold" => "Forest Creatures always drop at least 1/4 of possible gold,viewonly", "lowslumlevel" => "Minimum level to allow slumming,viewonly", "Mail Settings,title", "mailsizelimit" => "Message size limit per message,viewonly", "inboxlimit" => "Limit # of messages in inbox,viewonly", "oldmail" => "Automatically delete old messages after (days),viewonly", "Content Expiration,title", "expirecontent" => "Days to keep comments and news?  (0 for infinite),viewonly", "expiretrashacct" => "Days to keep accounts that were never logged in to? (0 for infinite),viewonly", "expirenewacct" => "Days to keep level 1 accounts with no dragon kills? (0 for infinite),viewonly", "expireoldacct" => "Days to keep all other accounts? (0 for infinite),viewonly", "LOGINTIMEOUT" => "Seconds of inactivity before auto-logoff,viewonly", "Useful Information,title", "Day Duration: " . round($dayduration / 60 / 60, 0) . " hours,viewonly", "Current Server Time: " . date("Y-m-d h:i:s a") . ",viewonly", "Last new day: " . date("h:i:s a", strtotime("-{$realsecssofartoday} seconds")) . ",viewonly", "Current game time: " . getgametime() . ",viewonly", "Next new day: " . date("h:i:s a", strtotime("+{$realsecstotomorrow} seconds")) . " (" . date("H\\h i\\m s\\s", strtotime("1970-01-01 00:00:00 + {$realsecstotomorrow} seconds")) . "),viewonly");
    output("`@<h3>Settings for this game</h3>`n`n", true);
    //output("<table border=1>",true);
    showform($setup, $settings, true);
    //output("</table>",true);
}
if ($session['user']['loggedin']) {
    addnav("Return to the news", "news.php");
} else {
    addnav("Login Page", "index.php");
}
page_footer();
$weaponarray = array("Weapon,title", "weaponid" => "Weapon ID,hidden", "weaponname" => "Weapon Name", "damage" => "Damage,range,1,15,1");
$op = httpget('op');
$id = httpget('id');
if ($op == "edit" || $op == "add") {
    if ($op == "edit") {
        $sql = "SELECT * FROM " . db_prefix("weapons") . " WHERE weaponid='{$id}'";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
    } else {
        $sql = "SELECT max(damage+1) AS damage FROM " . db_prefix("weapons") . " WHERE level={$weaponlevel}";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
    }
    rawoutput("<form action='weaponeditor.php?op=save&level={$weaponlevel}' method='POST'>");
    addnav("", "weaponeditor.php?op=save&level={$weaponlevel}");
    showform($weaponarray, $row);
    rawoutput("</form>");
} else {
    if ($op == "del") {
        $sql = "DELETE FROM " . db_prefix("weapons") . " WHERE weaponid='{$id}'";
        db_query($sql);
        $op = "";
        httpset("op", $op);
    } else {
        if ($op == "save") {
            $weaponid = (int) httppost("weaponid");
            $damage = httppost("damage");
            $weaponname = httppost("weaponname");
            if ($weaponid > 0) {
                $sql = "UPDATE " . db_prefix("weapons") . " SET weaponname=\"{$weaponname}\",damage=\"{$damage}\",value=" . $values[$damage] . " WHERE weaponid='{$weaponid}'";
            } else {
$armorarray = array("Armor,title", "armorid" => "Armor ID,hidden", "armorname" => "Armor Name", "defense" => "Defense,range,1,15,1");
$op = httpget('op');
$id = httpget('id');
if ($op == "edit" || $op == "add") {
    if ($op == "edit") {
        $sql = "SELECT * FROM " . db_prefix("armor") . " WHERE armorid='{$id}'";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
    } else {
        $sql = "SELECT max(defense+1) AS defense FROM " . db_prefix("armor") . " WHERE level={$armorlevel}";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
    }
    rawoutput("<form action='armoreditor.php?op=save&level={$armorlevel}' method='POST'>");
    addnav("", "armoreditor.php?op=save&level={$armorlevel}");
    showform($armorarray, $row);
    rawoutput("</form>");
} else {
    if ($op == "del") {
        $sql = "DELETE FROM " . db_prefix("armor") . " WHERE armorid='{$id}'";
        db_query($sql);
        //output($sql);
        $op = "";
        httpset("op", $op);
    } else {
        if ($op == "save") {
            $armorid = httppost('armorid');
            $armorname = httppost('armorname');
            $defense = httppost('defense');
            if ($armorid > 0) {
                $sql = "UPDATE " . db_prefix("armor") . " SET armorname=\"{$armorname}\",defense=\"{$defense}\",value=" . $values[$defense] . " WHERE armorid='{$armorid}'";
示例#6
0
<?php

require "../../../config.php";
include_once "class.Sudoku.php";
require '../header.php';
$action = optional_param('action', PARAM_ALPHA);
// action
if ($action == 'create') {
    AppendSudokuB();
} else {
    showform();
}
function showform()
{
    $id = required_param('id', PARAM_NUMBER);
    // action
    ?>
<form name="form" method="post" action="create.php">
<center>
<table cellpadding="5">
<tr valign="top">
    <td align="right"><b><?php 
    echo get_string('sudoku_create_count', 'game');
    ?>
:</b></td>
    <td>
        <input type="text" name="count" size="6" value="2" /><br>
    </td>
</tr>	
<tr><td colspan=2><center><br><input type="submit" value="<?php 
    print_string('sudoku_create_start', 'game');
            if (is_array($val)) {
                $v = $val[0];
                $x = explode("|", $v);
                $val[0] = $x[0];
                $x[0] = $val;
            } else {
                $x = explode("|", $val);
            }
            $msettings[$key] = $x[0];
            // Set up the defaults as well.
            if (isset($x[1])) {
                $data[$key] = $x[1];
            }
        }
        $sql = "SELECT * FROM " . db_prefix("module_userprefs") . " WHERE modulename='{$module}' AND userid='{$userid}'";
        $result = db_query($sql);
        while ($row = db_fetch_assoc($result)) {
            $data[$row['setting']] = $row['value'];
        }
        rawoutput("<form action='user.php?op=savemodule&module={$module}&userid={$userid}{$returnpetition}' method='POST'>");
        addnav("", "user.php?op=savemodule&module={$module}&userid={$userid}{$returnpetition}");
        tlschema("module-{$module}");
        showform($msettings, $data);
        tlschema();
        rawoutput("</form>");
    } else {
        output("The {$module} module doesn't appear to define any user preferences.");
    }
}
module_editor_navs('prefs', "user.php?op=edit&subop=module&userid={$userid}{$returnpetition}&module=");
addnav("", "user.php?op=lasthit&userid={$userid}");
}
addnav("Game Settings");
addnav("Standard settings", "configuration.php");
addnav("", $REQUEST_URI);
module_editor_navs('settings', 'configuration.php?op=modulesettings&module=');
if ($op == "") {
    $enum = "enumpretrans";
    require_once "lib/datetime.php";
    $details = gametimedetails();
    $offset = getsetting("gameoffsetseconds", 0);
    for ($i = 0; $i <= 86400 / getsetting("daysperday", 4); $i += 300) {
        $off = $details['realsecstotomorrow'] - ($offset - $i);
        if ($off < 0) {
            $off += 86400;
        }
        $x = strtotime("+" . $off . " secs");
        $str = sprintf_translate("In %s at %s (+%s)", reltime($x), date("h:i a", $x), date("H:i", $i));
        $enum .= ",{$i},{$str}";
    }
    rawoutput(tlbutton_clear());
    $setup = array("Game Setup,title", "loginbanner" => "Login Banner (under login prompt: 255 chars)", "maxonline" => "Max # of players online (0 for unlimited), int", "allowcreation" => "Allow creation of new characters,bool", "gameadminemail" => "Admin Email", "emailpetitions" => "Should submitted petitions be emailed to Admin Email address?,bool", "Enter languages here like this: `i(shortname 2 chars) comma (readable name of the language)`i and continue as long as you wish,note", "serverlanguages" => "Languages available on this server", "defaultlanguage" => "Default Language,enum," . getsetting("serverlanguages", "en,English,fr,Français,dk,Danish,de,Deutsch,es,Español,it,Italian"), "edittitles" => "Should DK titles be editable in user editor,bool", "motditems" => "How many items should be shown on the motdlist,int", "Main Page Display,title", "homeskinselect" => "Should the skin selection widget be shown?,bool", "homecurtime" => "Should the current realm time be shown?,bool", "homenewdaytime" => "Should the time till newday be shown?,bool", "homenewestplayer" => "Should the newest player be shown?,bool", "defaultskin" => "What skin should be the default?,theme", "impressum" => "Tell the world something about the person running this server. (e.g. name and address),textarea", "Beta Setup,title", "beta" => "Enable beta features for all players?,bool", "betaperplayer" => "Enable beta features per player?,bool", "Account Creation,title", "defaultsuperuser" => "Flags automatically granted to new players,bitfield," . ($session['user']['superuser'] | SU_ANYONE_CAN_SET) . " ," . SU_INFINITE_DAYS . ",Infinite Days," . SU_VIEW_SOURCE . ",View Source Code," . SU_DEVELOPER . ",Developer Super Powers (special inc list; god mode; auto defeat master; etc)," . SU_DEBUG_OUTPUT . ",Debug Output", "newplayerstartgold" => "Amount of gold to start a new character with,int", "maxrestartgold" => "Maximum amount of gold a player will get after a dragonkill,int", "maxrestartgems" => "Maximum number of gems a player will get after a dragonkill,int", "requireemail" => "Require users to enter their email address,bool", "requirevalidemail" => "Require users to validate their email address,bool", "blockdupeemail" => "One account per email address,bool", "spaceinname" => "Allow spaces in user names,bool", "allowoddadminrenames" => "Allow admins to enter 'illegal' names in the user editor,bool", "selfdelete" => "Allow player to delete their character,bool", "Commentary/Chat,title", "soap" => "Clean user posts (filters bad language and splits words over 45 chars long),bool", "maxcolors" => "Max # of color changes usable in one comment,range,5,40,1", "postinglimit" => "Limit posts to let one user post only up to 50% of the last posts (else turn it off),bool", "Place names and People names,title", "villagename" => "Name for the main village", "innname" => "Name of the inn", "barkeep" => "Name of the barkeep", "barmaid" => "Name of the barmaid", "bard" => "Name of the bard", "clanregistrar" => "Name of the clan registrar", "deathoverlord" => "Name of the death overlord", "Referral Settings,title", "refereraward" => "How many points will be awarded for a referral?,int", "referminlevel" => "What level does the referral need to reach to credit the referer?,int", "Random events,title", "forestchance" => "Chance for Something Special in the Forest,range,0,100,1", "villagechance" => "Chance for Something Special in any village,range,0,100,1", "innchance" => "Chance for Something Special in the Inn,range,0,100,1", "gravechance" => "Chance for Something Special in the Graveyard,range,0,100,1", "gardenchance" => "Chance for Something Special in the Gardens,range,0,100,1", "Paypal,title", "paypalemail" => "Email address of Admin's paypal account", "paypalcurrency" => "Currency type", "paypalcountry-code" => "What country's predominant language do you wish to have displayed in your PayPal screen?,enum\n\t\t,US,United States,DE,Germany,AI,Anguilla,AR,Argentina,AU,Australia,AT,Austria,BE,Belgium,BR,Brazil,CA,Canada\n\t\t,CL,Chile,C2,China,CR,Costa Rica,CY,Cyprus,CZ,Czech Republic,DK,Denmark,DO,Dominican Republic\n\t\t,EC,Ecuador,EE,Estonia,FI,Finland,FR,France,GR,Greece,HK,Hong Kong,HU,Hungary,IS,Iceland,IN,India\n\t\t,IE,Ireland,IL,Israel,IT,Italy,JM,Jamaica,JP,Japan,LV,Latvia,LT,Lithuania,LU,Luxembourg,MY,Malaysia\n\t\t,MT,Malta,MX,Mexico,NL,Netherlands,NZ,New Zealand,NO,Norway,PL,Poland,PT,Portugal,SG,Singapore,SK,Slovakia\n\t\t,SI,Slovenia,ZA,South Africa,KR,South Korea,ES,Spain,SE,Sweden,CH,Switzerland,TW,Taiwan,TH,Thailand,TR,Turkey\n\t\t,GB,United Kingdom,UY,Uruguay,VE,Venezuela", "paypaltext" => "What text should be displayed as item name in the donations screen(player name will be added after it)?", "(standard: 'Legend of the Green Dragon Site Donation from',note", "General Combat,title", "autofight" => "Allow fighting multiple rounds automatically,bool", "autofightfull" => "Allow fighting until fight is over,enum,0,Never,1,Always,2,Only when not allowed to flee", "Training,title", "automaster" => "Masters hunt down truant students,bool", "multimaster" => "Can players gain multiple levels (challenge multiple masters) per game day?,bool", "displaymasternews" => "Display news if somebody fought his master?,bool", "Clans,title", "allowclans" => "Enable Clan System?,bool", "goldtostartclan" => "Gold to start a clan,int", "gemstostartclan" => "Gems to start a clan,int", "officermoderate" => "Can clan officers who are also moderators moderate their own clan even if they cannot moderate all clans?,bool", "New Days,title", "daysperday" => "Game days per calendar day,range,1,6,1", "specialtybonus" => "Extra daily uses in specialty area,range,0,5,1", "newdaycron" => "Let the newday-runonce run via a cronjob,bool", "The directory is necessary! Do not forget to set the correct one in cron.php in your main game folder!!! ONLY experienced admins should use cron jobbing here,note", "`bAlso make sure you setup a cronjob on your machine using confixx/plesk/cpanel or any other admin panel pointing to the cron.php file in your main folder`b,note", "If you do not know what a Cronjob is... leave it turned off. If you want to know more... check out: <a href='http://wiki.dragonprime.net/index.php?title=Cronjob'>http://wiki.dragonprime.net/index.php?title=Cronjob</a>,note", "resurrectionturns" => "Modify (+ or -) the number of turns deducted after a resurrection as an absolute (number) or relative (number followed by %),text", "Forest,title", "turns" => "Forest Fights per day,range,5,30,1", "dropmingold" => "Forest Creatures drop at least 1/4 of max gold,bool", "suicide" => "Allow players to Seek Suicidally?,bool", "suicidedk" => "Minimum DKs before players can Seek Suicidally?,int", "forestgemchance" => "Player will find a gem one in X times,range,10,100,1", "disablebonuses" => "Should monsters which get buffed with extra HP/Att/Def get a gold+exp bonus?,bool", "forestexploss" => "What percentage of experience should be lost?,range,10,100,1", "Multiple Enemies,title", "multifightdk" => "Multiple monsters will attack players above which amount of dragonkills?,range,8,50,1", "multichance" => "The chance for an attack from multiple enemies is,range,0,100,1", "addexp" => "Additional experience (%) per enemy during multifights?,range,0,15", "instantexp" => "During multi-fights hand out experience instantly?,bool", "maxattacks" => "How many enemies will attack per round (max. value),range,1,10", "allowpackofmonsters" => "Allow multiple monsters of the same type to appear in a battle?,bool", "Random values for type of seeking is added to random base.,note", "multibasemin" => "The base number of multiple enemies at minimum is,range,1,100,2", "multibasemax" => "The base number of multiple enemies at maximum is,range,1,100,3", "multislummin" => "The number of multiple enemies at minimum for slumming is,range,0,100,0", "multislummax" => "The number of multiple enemies at maximum for slumming is,range,0,100,1", "multithrillmin" => "The number of multiple enemies at minimum for thrill seeking is,range,0,100,1", "multithrillmax" => "The number of multiple enemies at maximum for thrill seeking is,range,0,100,2", "multisuimin" => "The number of multiple enemies at minimum for suicide is,range,0,100,2", "multisuimax" => "The number of multiple enemies at maximum for suicide is,range,0,100,4", "Stables,title", "allowfeed" => "Does Merick have feed onhand for creatures,bool", "Companions/Mercenaries,title", "enablecompanions" => "Enable the usage of companions,bool", "companionsallowed" => "How many companions are allowed per player,int", "Modules my alter this value on a per player basis!,note", "companionslevelup" => "Are companions allowed to level up?,bool", "Bank Settings,title", "fightsforinterest" => "Max forest fights remaining to earn interest?,range,0,10,1", "maxinterest" => "Max Interest Rate (%),range,5,10,1", "mininterest" => "Min Interest Rate (%),range,0,5,1", "maxgoldforinterest" => "Over what amount of gold does the bank cease paying interest? (0 for unlimited),int", "borrowperlevel" => "Max player can borrow per level (val * level for max),range5,200,5", "allowgoldtransfer" => "Allow players to transfer gold,bool", "transferperlevel" => "Max player can receive from a transfer (val * level),range,5,100,5", "mintransferlev" => "Min level a player (0 DK's) needs to transfer gold,range,1,5,1", "transferreceive" => "Total transfers a player can receive in one day,range,0,5,1", "maxtransferout" => "Amount player can transfer to others (val * level),range,5,100,5", "innfee" => "Fee for express inn payment (x or x%),int", "Mail Settings,title", "mailsizelimit" => "Message size limit per message,int", "inboxlimit" => "Limit # of messages in inbox,int", "oldmail" => "Automatically delete old messages after (days),int", "superuseryommessage" => "Warning to give when attempting to YoM an admin?", "onlyunreadmails" => "Only unread mail count towards the inbox limit?,bool", "PvP,title", "pvp" => "Enable Slay Other Players,bool", "pvpday" => "Player Fights per day,range,1,10,1", "pvpimmunity" => "Days that new players are safe from PvP,range,1,5,1", "pvpminexp" => "Experience below which player is safe from PvP,int", "pvpattgain" => "Percent of victim experience attacker gains on win,floatrange,.25,20,.25", "pvpattlose" => "Percent of experience attacker loses on loss,floatrange,.25,20,.25", "pvpdefgain" => "Percent of attacker experience defender gains on win,floatrange,.25,20,.25", "pvpdeflose" => "Percent of experience defender loses on loss,floatrange,.25,20,.25", "Content Expiration,title", "expirecontent" => "Days to keep comments and news?  (0 = infinite),int", "expiretrashacct" => "Days to keep never logged-in accounts? (0 = infinite),int", "expirenewacct" => "Days to keep 1 level (0 dragon) accounts? (0 =infinite),int", "expireoldacct" => "Days to keep all other accounts? (0 = infinite),int", "LOGINTIMEOUT" => "Seconds of inactivity before auto-logoff,int", "High Load Optimization,title", "This has been moved to the dbconnect.php,note", "LoGDnet Setup,title", "(LoGDnet requires your PHP configuration to have file wrappers enabled!!),note", "logdnet" => "Register with LoGDnet?,bool", "serverurl" => "Server URL", "serverdesc" => "Server Description (75 chars max)", "logdnetserver" => "Master LoGDnet Server (default http://logdnet.logd.com/)", "curltimeout" => "How long we wait for responses from logdnet.logd.com (in seconds),range,1,10,1|2", "Game day Setup,title", "dayduration" => "Day Duration,viewonly", "curgametime" => "Current game time,viewonly", "curservertime" => "Current Server Time,viewonly", "lastnewday" => "Last new day,viewonly", "nextnewday" => "Next new day,viewonly", "gameoffsetseconds" => "Real time to offset new day,{$enum}", "Translation Setup,title", "enabletranslation" => "Enable the use of the translation engine,bool", "It is strongly recommended to leave this feature turned on.,note", "cachetranslations" => "Cache the translations (datacache must be turned on)?,bool", "permacollect" => "Permanently collect untranslated texts (overrides the next settings!),bool", "collecttexts" => "Are we currently collecting untranslated texts?,viewonly", "tl_maxallowed" => "Collect untranslated texts if you have fewer player than this logged in. (0 never collects),int", "charset" => "Which charset should be used for htmlentities?", "Error Notification,title", "Note: you MUST have data caching turned on if you want to use this feature.  Also the first error within any 24 hour period will not generate a notice; I'm sorry: that's really just how it is for technical reasons.,note", "show_notices" => "Show PHP Notice output?,bool", "notify_on_warn" => "Send notification on site warnings?,bool", "notify_on_error" => "Send notification on site errors?,bool", "notify_address" => "Address to notify", "notify_every" => "Only notify every how many minutes for each distinct error?,int", "Miscellaneous Settings,title", "allowspecialswitch" => "The Barkeeper may help you to switch your specialty?,bool", "maxlistsize" => "Maximum number of items to be shown in the warrior list,int");
    $secstonewday = secondstonextgameday($details);
    $useful_vals = array("dayduration" => round($details['dayduration'] / 60 / 60, 0) . " hours", "curgametime" => getgametime(), "curservertime" => date("Y-m-d h:i:s a"), "lastnewday" => date("h:i:s a", strtotime("-{$details['realsecssofartoday']} seconds")), "nextnewday" => date("h:i:s a", strtotime("+{$details['realsecstotomorrow']} seconds")) . " (" . date("H\\h i\\m s\\s", $secstonewday) . ")");
    loadsettings();
    $vals = $settings + $useful_vals;
    rawoutput("<form action='configuration.php?op=save' method='POST'>");
    addnav("", "configuration.php?op=save");
    showform($setup, $vals);
    rawoutput("</form>");
}
page_footer();
// output("`\$`bServer full!`b`n`^Please wait until some users have logged out.`n`n`0");
// if ($op=="timeout"){
// $session['message'].= translate_inline(" Your session has timed out, you must log in again.`n");
// }
// if (!isset($_COOKIE['lgi'])){
// $session['message'].=translate_inline("It appears that you may be blocking cookies from this site. At least session cookies must be enabled in order to use this site.`n");
// $session['message'].=translate_inline("`b`#If you are not sure what cookies are, please <a href='http://en.wikipedia.org/wiki/WWW_browser_cookie'>read this article</a> about them, and how to enable them.`b`n");
// }
// if ($session['message']>"") output("`b`\$%s`b`n", $session['message'],true);
// rawoutput(templatereplace("loginfull",array()));
// output_notl("`c");
// }
// $msg = getsetting("loginbanner","*BETA* This is a BETA of this website, things are likely to change now and again, as it is under active development *BETA*");
// output_notl("`n`c`b`&%s`0`b`c`n", $msg);
// $session['message']="";
// output("`c`2Game server running version: `@%s`0`c", $logd_version);
if (getsetting("homeskinselect", 1)) {
    rawoutput("<form action='home.php' method='POST'>");
    rawoutput("<table align='center'><tr><td>");
    $form = array("template" => "Choose a different display skin:,theme");
    $prefs['template'] = $_COOKIE['template'];
    if ($prefs['template'] == "") {
        $prefs['template'] = getsetting("defaultskin", "jade.htm");
    }
    require_once "lib/showform.php";
    showform($form, $prefs, true);
    $submit = translate_inline("Choose");
    rawoutput("</td><td><br>&nbsp;<input type='submit' class='button' value='{$submit}'></td>");
    rawoutput("</tr></table></form>");
}
page_footer();
<?php

// Note that the sample code includes PHP 'require' and 'require_once'
// statements that reference files in the EventTools directory.  If you
// move the sample file to another directory, you'll have to update the file
// paths in these statements.
require_once 'access.php';
require 'utilities.php';
$message = "<span style=\"color:red;font-weight:bold\">";
if (!formcomplete()) {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $message .= "Please complete all values";
    }
    $message .= "</span>";
    showform($message);
    return;
}
$now = time();
// add to local log file.
$datastring = get_request_args(date("m/d/y g:i a T", $now), ";") . "\r\n";
if (!($fp = fopen("datafile.dtf", "a"))) {
    print "Cannot open \"datafile.dtf\"\n";
} else {
    fwrite($fp, $datastring);
    fclose($fp);
}
// send email with info
// If needed, change the email address on the next line
$to = $event_tools_registrar_email_address;
$subject = $event_tools_event_name . " Registration FYI " . $_REQUEST["fname"] . " " . $_REQUEST["lname"];
$headers = sprintf("From:  " . $event_tools_event_name . " Registration Form <" . $to . ">\r\n");
<?php

if (is_numeric($id)) {
    $sql = 'SELECT * FROM ' . db_prefix('magicitems') . ' WHERE id=' . $id . ' LIMIT 1';
    $result = db_query($sql);
    $row = array_merge(db_fetch_assoc($result), $itemarray_extra_vals);
    rawoutput('<form action="' . htmlentities($fromeditor . 'save&id=' . $id . '&cat=') . $cat . '" method="POST">');
    addnav('', $fromeditor . 'save&id=' . $id . '&cat=' . $cat);
    require_once 'lib/showform.php';
    showform($itemarray, $row);
    rawoutput('</form>');
} else {
    output('Nothing to edit.');
}
function drinks_editor()
{
    global $mostrecentmodule;
    if (!get_module_pref("canedit")) {
        check_su_access(SU_EDIT_USERS);
    }
    page_header("Drink Editor");
    require_once "lib/superusernav.php";
    superusernav();
    addnav("Drink Editor");
    addnav("Add a drink", "runmodule.php?module=drinks&act=editor&op=add&admin=true");
    $op = httpget('op');
    $drinkid = httpget('drinkid');
    $header = "";
    if ($op != "") {
        addnav("Drink Editor Main", "runmodule.php?module=drinks&act=editor&admin=true");
        if ($op == 'add') {
            $header = translate_inline("Adding a new drink");
        } else {
            if ($op == 'edit') {
                $header = translate_inline("Editing a drink");
            }
        }
    } else {
        $header = translate_inline("Current drinks");
    }
    output_notl("`&<h3>{$header}`0</h3>", true);
    $drinksarray = array("Drink,title", "drinkid" => "Drink ID,hidden", "name" => "Drink Name", "costperlevel" => "Cost per level,int", "hpchance" => "Chance of modifying HP (see below),range,0,10,1", "turnchance" => "Chance of modifying turns (see below),range,0,10,1", "alwayshp" => "Always modify hitpoints,bool", "alwaysturn" => "Always modify turns,bool", "drunkeness" => "Drunkeness,range,1,100,1", "harddrink" => "Is drink hard alchohol?,bool", "hpmin" => "Min HP to add (see below),range,-20,20,1", "hpmax" => "Max HP to add (see below),range,-20,20,1", "hppercent" => "Modify HP by some percent (see below),range,-25,25,5", "turnmin" => "Min turns to add (see below),range,-5,5,1", "turnmax" => "Max turns to add (see below),range,-5,5,1", "remarks" => "Remarks", "buffname" => "Name of the buff", "buffrounds" => "Rounds buff lasts,range,1,20,1", "buffroundmsg" => "Message each round of buff", "buffwearoff" => "Message when buff wears off", "buffatkmod" => "Attack modifier of buff", "buffdefmod" => "Defense modifier of buff", "buffdmgmod" => "Damage modifier of buff", "buffdmgshield" => "Damage shield modifier of buff", "buffeffectfailmsg" => "Effect failure message (see below)", "buffeffectnodmgmsg" => "No damage message (see below)", "buffeffectmsg" => "Effect message (see below)");
    if ($op == "del") {
        $sql = "DELETE FROM " . db_prefix("drinks") . " WHERE drinkid='{$drinkid}'";
        module_delete_objprefs('drinks', $drinkid);
        db_query($sql);
        $op = "";
        httpset('op', "");
    }
    if ($op == "save") {
        $subop = httpget("subop");
        if ($subop == "") {
            $drinkid = httppost("drinkid");
            list($sql, $keys, $vals) = postparse($drinksarray);
            if ($drinkid > 0) {
                $sql = "UPDATE " . db_prefix("drinks") . " SET {$sql} WHERE drinkid='{$drinkid}'";
            } else {
                $sql = "INSERT INTO " . db_prefix("drinks") . " ({$keys}) VALUES ({$vals})";
            }
            db_query($sql);
            if (db_affected_rows() > 0) {
                output("`^Drink saved!");
            } else {
                $str = db_error();
                if ($str == "") {
                    output("`^Drink not saved: no changes detected.");
                } else {
                    output("`^Drink not saved: `\$%s`0", $sql);
                }
            }
        } elseif ($subop == "module") {
            $drinkid = httpget("drinkid");
            // Save module settings
            $module = httpget("editmodule");
            // This should obey the same rules as the configuration editor
            // So disabling
            //$sql = "DELETE FROM " . db_prefix("module_objprefs") . " WHERE objtype='drinks' AND objid='$drinkid' AND modulename='$module'";
            //db_query($sql);
            $post = httpallpost();
            reset($post);
            while (list($key, $val) = each($post)) {
                set_module_objpref("drinks", $drinkid, $key, $val, $module);
            }
            output("`^Saved.");
        }
        if ($drinkid) {
            $op = "edit";
            httpset("drinkid", $drinkid, true);
        } else {
            $op = "";
        }
        httpset('op', $op);
    }
    if ($op == "activate") {
        $sql = "UPDATE " . db_prefix("drinks") . " SET active=1 WHERE drinkid='{$drinkid}'";
        db_query($sql);
        $op = "";
        httpset('op', "");
    }
    if ($op == "deactivate") {
        $sql = "UPDATE " . db_prefix("drinks") . " SET active=0 WHERE drinkid='{$drinkid}'";
        db_query($sql);
        $op = "";
        httpset('op', "");
    }
    if ($op == "") {
        $op = translate_inline("Ops");
        $id = translate_inline("Id");
        $nm = translate_inline("Name");
        $dkn = translate_inline("Drunkeness");
        $hard = translate_inline("Hard Alchohol?");
        $edit = translate_inline("Edit");
        $deac = translate_inline("Deactivate");
        $act = translate_inline("Activate");
        $conf = translate_inline("Are you sure you wish to delete this drink?");
        $del = translate_inline("Del");
        rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'>");
        rawoutput("<tr class='trhead'>");
        rawoutput("<td>{$op}</td><td>{$id}</td><td>{$nm}</td><td>{$dkn}</td><td>{$hard}</td>");
        rawoutput("</tr>");
        $sql = "SELECT drinkid,active,name,drunkeness,harddrink FROM " . db_prefix("drinks") . " ORDER BY drinkid";
        $result = db_query($sql);
        for ($i = 0; $i < db_num_rows($result); $i++) {
            $row = db_fetch_assoc($result);
            $id = $row['drinkid'];
            rawoutput("<tr class='" . ($i % 2 ? "trlight" : "trdark") . "'>");
            rawoutput("<td nowrap>[ <a href='runmodule.php?module=drinks&act=editor&op=edit&drinkid={$id}&admin=true'>{$edit}</a>");
            addnav("", "runmodule.php?module=drinks&act=editor&op=edit&drinkid={$id}&admin=true");
            if ($row['active']) {
                rawoutput(" | <a href='runmodule.php?module=drinks&act=editor&op=deactivate&drinkid={$id}&admin=true'>{$deac}</a>");
                addnav("", "runmodule.php?module=drinks&act=editor&op=deactivate&drinkid={$id}&admin=true");
            } else {
                rawoutput(" | <a href='runmodule.php?module=drinks&act=editor&op=activate&drinkid={$id}&admin=true'>{$act}</a>");
                addnav("", "runmodule.php?module=drinks&act=editor&op=activate&drinkid={$id}&admin=true");
            }
            rawoutput(" | <a href='runmodule.php?module=drinks&act=editor&op=del&drinkid={$id}&admin=true' onClick='return confirm(\"{$conf}\");'>{$del}</a> ]</td>");
            addnav("", "runmodule.php?module=drinks&act=editor&op=del&drinkid={$id}&admin=true");
            output_notl("<td>`^%s</td>`0", $id, true);
            output_notl("<td>`&%s`0</td>", $row['name'], true);
            output_notl("<td>`^%s`0</td>", $row['drunkeness'], true);
            $hard = translate_inline("`^No");
            if ($row['harddrink']) {
                $hard = translate_inline("`\$Yes");
            }
            output_notl("<td>%s`0</td>", $hard, true);
            rawoutput("</tr>");
        }
        rawoutput("</table>");
    }
    $subop = httpget("subop");
    if ($op == "edit") {
        addnav("Drink properties", "runmodule.php?module=drinks&act=editor&op=edit&drinkid={$drinkid}&admin=true");
        module_editor_navs("prefs-drinks", "runmodule.php?module=drinks&act=editor&drinkid={$drinkid}&op=edit&subop=module&editmodule=");
        if ($subop == "module") {
            $module = httpget("editmodule");
            $oldmodule = $mostrecentmodule;
            rawoutput("<form action='runmodule.php?module=drinks&act=editor&op=save&subop=module&editmodule={$module}&drinkid={$drinkid}&admin=true' method='POST'>");
            module_objpref_edit('drinks', $module, $drinkid);
            $mostrecentmodule = $oldmodule;
            rawoutput("</form>");
            addnav("", "runmodule.php?module=drinks&act=editor&op=save&subop=module&editmodule={$module}&drinkid={$drinkid}&admin=true");
        } elseif ($subop == "") {
            $sql = "SELECT * FROM " . db_prefix("drinks") . " WHERE drinkid='" . httpget('drinkid') . "'";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
        }
    } elseif ($op == "add") {
        /* We're adding a new drink, make an empty row */
        $row = array();
        $row['drinkid'] = 0;
    }
    if (($op == "edit" || $op == "add") && $subop == "") {
        rawoutput("<form action='runmodule.php?module=drinks&act=editor&op=save&admin=true' method='POST'>");
        addnav("", "runmodule.php?module=drinks&act=editor&op=save&admin=true");
        showform($drinksarray, $row);
        rawoutput("</form>");
        output("`\$NOTE:`7 Make sure that you know what you are doing when modifying or adding drinks.`n");
        output("Just because the drinks have a lot of options, doesn't mean you have to use all of them`n`n");
        output("`2Drink ID: `7This field is used internally and should be unique.`n");
        output("`2Name: `7The name of the drink the user will see.`n");
        output("`2Cost per level: `7This value times the users level is the drink cost.`n");
        output("`2Chance of modifying HP: `7If set, this is the number of chances out of the total of this and the turn chance for HP getting modified.`n");
        output("`2Chance of modifying turns: `7If set, this is the number of chances out of the total of this and the HP chance for turns getting modified.`n");
        output("`2Always modify HP: `7If set, hitpoints will be modified.  Should not be set alongside HP chance above.`n");
        output("`2Always modify turns: `7If set, turns will be modified.  Should not be set alongside turn chance above.`n");
        output("`2Drunkeness: `7How drunk will this make the player.`n");
        output("`2Hard Drink: `7Users are only allowed a certain number of hard drinks per day regardless of drunkeness.`n");
        output("`2Min HP to add: `7If we are modifying hitpoints, and if HP percent isn't set, use this and the HP max value to pick a random amount of HP to add.  Can be negative.`n");
        output("`2Max HP to add: `7If we are modifying hitpoints and if HP percent isn't set, use this and the HP min value to pick a random amount of HP to add.  Can be negative.`n");
        output("`2HP percent: `7If we are modifying hitpoints and if this is set, the users hitpoints are modified by this percentage.  Can be negative.`n");
        output("`2Min turns to add: `7If we are modifying turns, use this and the turn max value to pick a random amount of turns to add.  Can be negative.`n");
        output("`2Max turns to add: `7If we are modifying turns, use this and the turn min value to pick a random amount of turns to add.  Can be negative.`n");
        output("`2Remarks: `7Text displayed to the user when they order the drink.`n");
        output("`2Buff name: `7What is this buff called.`n");
        output("`2Buff rounds: `7How many rounds this buff lasts.`n");
        output("`2Buff round message: `7What message should show as each round occurs.`n");
        output("`2Buff wearoff: `7What message is shown when this buff wears off.`n");
        output("`2Buff attack modifier: `7Multiplier to modify attack points by? 1.0 is no modification, 2.0 doubles their attack points.`n");
        output("`2Buff defense modifier: `7Multiplier to modify defense points by? 1.0 is no modification, 2.0 doubles their defense points.`n");
        output("`2Buff damage modifier: `7Multiplier to modify damage by? 1.0 is no modification, 2.0 doubles their damage points. This is `\$VERY POTENT`7!`n");
        output("`2Buff damage shield modifier: `7When you are hit, deals damage to your opponent based on damage done to you. 1.0 deals identical damage, 2.0 deals double damage back to the opponent.`n");
        output("`2Effect failure message: Message if this buff fails. (Only used with damage shield)`n");
        output("`2Effect no damage message: Message if no damage is done. (Only used with damage shield)`n");
        output("`2Effect message: What shows when this buff has an effect. (Only used with damage shield)`n`n");
    }
    page_footer();
}
         $list[] = str_replace(",", " ", sanitize($baddie['creaturename']));
     }
     if (is_array($list) && count($list)) {
         $listjoin = join(",", $list);
     } else {
         $listjoin = "0,none,";
     }
     require_once "lib/showform.php";
     rawoutput("<form action='runmodule.php?module=aitest&opz=pre' method='post'>");
     addnav("", "runmodule.php?module=aitest&opz=pre");
     $format = array("id" => "Enemy, enum, " . $listjoin, "num" => "Number of enemies, range, 1, 20");
     if (get_module_setting("allowload")) {
         $format['loadscript'] = "-Optional- Filepath and name of manual encounter script (including enemies),text,60";
         $format['note'] = "Do not use this option unless you know what you are doing!,note";
     }
     showform($format, array());
     rawoutput("</form>");
     break;
 case "pre":
     restore_buff_fields();
     $loadscript = httppost("loadscript");
     debug($loadscript);
     if (!empty($loadscript) && file_exists($loadscript)) {
         global $session;
         require $loadscript;
         //it is up to the loaded file to setup and create badguys and options.
     } else {
         $id = httppost("id");
         $num = max(1, httppost("num"));
         $cr = db_prefix("creatures");
         $sql = "SELECT * FROM {$cr} WHERE creatureid = {$id} LIMIT 1";
$id = httpget("id");
$yes = translate_inline("Yes");
$no = translate_inline("No");
if ($id != "") {
    $sql = "SELECT * FROM " . db_prefix("magicitembuffs") . " WHERE buffid = {$id}";
    $result = db_query($sql);
    $buff2 = db_fetch_assoc($result);
    $buff = unserialize($buff2['itembuff']);
    $buff['buffname'] = $buff2['buffname'];
} else {
    $buff = array();
}
rawoutput("<form action='runmodule.php?module=mysticalshop_buffs&op=editor&what=newbuff2&id={$id}' method='post'>");
addnav("", "runmodule.php?module=mysticalshop_buffs&op=editor&what=newbuff2&id={$id}");
$format = array("General Settings,title", 'buffname' => "Buff name (shown in editor),string,250", 'name' => "Buff name (shown in charstats),string,250", 'rounds' => "Rounds,string,250", "Combat Modifiers,title", 'dmgmod' => "Damage Modifier (Goodguy),string,250", 'atkmod' => "Attack Modifier (Goodguy),string,250", 'defmod' => "Defense Modifier (Goodguy),string,250", 'badguydmgmod' => "Damage Modifier (Badguy),string,250", 'badguyatkmod' => "Attack Modifier (Badguy),string,250", 'badguydefmod' => "Defense Modifier (Badguy),string,250", "Misc Combat Modifiers,title", 'lifetap' => "Lifetap,string,250", 'damageshield' => "Damage Shield,string,250", 'regen' => "Regeneration,string,250", "Minion Count Settings,title", 'minioncount' => "Minion count,string,250", 'minbadguydamage' => "Min Badguy Damage,string,250", 'maxbadguydamage' => "Max Badguy Damage,string,250", 'mingoodguydamage' => "Max Goodguy Damage,string,250", 'maxgoodguydamage' => "Max Goodguy Damage,string,250", "Message Settings,title", 'startmsg' => "Start Message,string,250", 'roundmsg' => "Round Message,string,250", 'wearoff' => "Wear Off Message,string,250", 'effectmsg' => "Effect Message,string,250", 'effectfailmsg' => "Effect Fail Message,string,250", 'effectnodmgmsg' => "Effect No Damage Message,string,250", "Misc Settings,title", 'allowinpvp' => "Allow in PvP?,bool", 'allowintrain' => "Allow in Training?,bool", 'survivenewday' => "Survive New Day?,bool", 'invulnerable' => "Invulnerable?,bool", 'expireafterfight' => "Expires after fight?,bool");
showform($format, $buff);
output("`n`n`bOn Dynamic Buffs`b`n");
output("`@In the above, for most fields, you can choose to enter valid PHP code, substituting <fieldname> for fields in the user's account table.`n");
output("Examples of code you might enter:`n");
output("`^<charm>`n");
output("round(<maxhitpoints>/10)`n");
output("round(<level>/max(<gems>,1))`n");
output("`@Fields you might be interested in for this: `n");
output("`3name, sex `7(0=male 1=female)`3, specialty `7(DA=darkarts MP=mystical TS=thief)`3,`n");
output("experience, gold, weapon `7(name)`3, armor `7(name)`3, level,`n");
output("defense, attack, alive, goldinbank,`n");
output("spirits `7(-2 to +2 or -6 for resurrection)`3, hitpoints, maxhitpoints, gems,`n");
output("weaponvalue `7(gold value)`3, armorvalue `7(gold value)`3, turns, title, weapondmg, armordef,`n");
output("age `7(days since last DK)`3, charm, playerfights, dragonkills, resurrections `7(times died since last DK)`3,`n");
output("soulpoints, gravefights, deathpower `7(Ramius favor)`3,`n");
output("race, dragonage, bestdragonage`n`n");
page_header("Game Settings");
addnav("G?Return to the Grotto", "superuser.php");
addnav("M?Return to the Mundane", "village.php");
addnav("", $REQUEST_URI);
//$nextnewday = ((gametime()%86400))/4 ; //abs(((86400- gametime())/getsetting("daysperday",4))%86400 );
//echo date("h:i:s a",strtotime("-$nextnewday seconds"))." (".($nextnewday/60)." minutes) ".date("h:i:s a",gametime()).gametime();
$time = strtotime(date("1971-m-d H:i:s", strtotime("now -" . getsetting("gameoffsetseconds", 0) . " seconds"))) * getsetting("daysperday", 4) % strtotime("1971-01-01 00:00:00");
$time = gametime();
$tomorrow = strtotime(date("Y-m-d H:i:s", $time) . " + 1 day");
$tomorrow = strtotime(date("Y-m-d 00:00:00", $tomorrow));
$today = strtotime(date("Y-m-d 00:00:00", $time));
$dayduration = ($tomorrow - $today) / getsetting("daysperday", 4);
$secstotomorrow = $tomorrow - $time;
$secssofartoday = $time - $today;
$realsecstotomorrow = $secstotomorrow / getsetting("daysperday", 4);
$realsecssofartoday = $secssofartoday / getsetting("daysperday", 4);
//output("Current server time: ".date("Y-m-d H:i:s").", current game time: ".date("Y-m-d H:i:s",$time).", tomorrow is ".date("Y-m-d H:i:s",$tomorrow).", $secstotomorrow secs to tomorrow which is $realsecstotomorrow real secs.");
//output("Current server time: ".date("h:i:s a").", current game time: ".date("h:i:s a",$time).", next new day at ".date("h:i:s a",strtotime("+$realsecstotomorrow seconds")).".");
$enum = "enum";
for ($i = 0; $i <= 86400; $i += 900) {
    $enum .= ",{$i}," . (int) ($i / 60 / 60) . ":" . $i / 60 % 60 . "";
}
$setup = array("Game Setup,title", "loginbanner" => "Login Banner (under login prompt: 255 chars)", "soap" => "Clean user posts (filters bad language and splits words over 45 chars long),bool", "maxcolors" => "Max # of color changes usable in one comment,int", "gameadminemail" => "Admin Email", "paypalemail" => "Email address of Admin's paypal account", "defaultlanguage" => "Default Language,enum,en,English,dk,Danish,de,Deutsch,es,Español,fr,French", "automaster" => "Masters hunt down truant students,bool", "multimaster" => "Master can be challenged multiple times in a day?,bool", "topwebid" => "ID for Top Web Games (if you are registered),int", "beta" => "Enable beta features for all players?,bool", "Account Creation,title", "superuser" => "Default superuser level,enum,0,Standard play days per calendar day,1,Unlimited play days per calendar day,2,Admin creatures and taunts,3,Admin users", "newplayerstartgold" => "Amount of gold to start a new character with,int", "requireemail" => "Require users to enter their email address,bool", "requirevalidemail" => "Require users to validate their email address,bool", "blockdupeemail" => "One account per email address,bool", "spaceinname" => "Allow spaces in user names,bool", "selfdelete" => "Allow player to delete their character,bool", "New Days,title", "fightsforinterest" => "Max forest fights remaining to earn interest?,int", "maxinterest" => "Max Interest Rate (%),int", "mininterest" => "Min Interest Rate (%),int", "daysperday" => "Game days per calendar day,int", "specialtybonus" => "Extra daily uses in specialty area,int", "Forest,title", "turns" => "Forest Fights per day,int", "dropmingold" => "Forest Creatures drop at least 1/4 of max gold,bool", "lowslumlevel" => "Minimum level perfect fights give extra turn,int", "Bounty,title", "bountymin" => "Minimum amount per level of target for bounty,int", "bountymax" => "Maximum amount per level of target for bounty,int", "bountylevel" => "Minimum player level for being a bounty target,int", "bountyfee" => "Percentage of bounty kept by Dag Durnick,int", "maxbounties" => "How many bounties can a person set per day,int", "Bank Settings,title", "borrowperlevel" => "Max player can borrow per level (val * level for max),int", "allowgoldtransfer" => "Allow players to transfer gold,bool", "transferperlevel" => "Max player can receive from a transfer (val * level),int", "mintransferlev" => "Min level a player (0 DK's) needs to transfer gold,int", "transferreceive" => "Total transfers a player can receive in one day,int", "maxtransferout" => "Amount player can transfer to others (val * level),int", "innfee" => "Fee for express inn payment (x or x%),int", "Mail Settings,title", "mailsizelimit" => "Message size limit per message,int", "inboxlimit" => "Limit # of messages in inbox,int", "oldmail" => "Automatically delete old messages after (days),int", "PvP,title", "pvp" => "Enable Slay Other Players,bool", "pvpday" => "Player Fights per day,int", "pvpimmunity" => "Days that new players are safe from PvP,int", "pvpminexp" => "Experience below which player is safe from PvP,int", "pvpattgain" => "Percent of victim experience attacker gains on win,int", "pvpattlose" => "Percent of experience attacker loses on loss,int", "pvpdefgain" => "Percent of attacker experience defender gains on win,int", "pvpdeflose" => "Percent of experience defender loses on loss,int", "Content Expiration,title", "expirecontent" => "Days to keep comments and news?  (0 = infinite),int", "expiretrashacct" => "Days to keep never logged-in accounts? (0 = infinite),int", "expirenewacct" => "Days to keep 1 level (0 dragon) accounts? (0 =infinite),int", "expireoldacct" => "Days to keep all other accounts? (0 = infinite),int", "LOGINTIMEOUT" => "Seconds of inactivity before auto-logoff,int", "Useful Information,title", "Last new day: " . date("h:i:s a", strtotime("-{$realsecssofartoday} seconds")) . ",viewonly", "Next new day: " . date("h:i:s a", strtotime("+{$realsecstotomorrow} seconds")) . ",viewonly", "Current game time: " . getgametime() . ",viewonly", "Day Duration: " . $dayduration / 60 / 60 . " hours,viewonly", "Current Server Time: " . date("Y-m-d h:i:s a") . ",viewonly", "gameoffsetseconds" => "Real time to offset new day,{$enum}", "LoGDnet Setup (LoGDnet does require PHP to have file wrappers enabled!!),title", "logdnet" => "Register with LoGDnet?,bool", "serverurl" => "Server URL", "serverdesc" => "Server Description (255 chars)", "logdnetserver" => "Master LoGDnet Server (default http://lotgd.net/)", "End Game Setup,title");
if ($_GET['op'] == "") {
    loadsettings();
    output("<form action='configuration.php?op=save' method='POST'>", true);
    addnav("", "configuration.php?op=save");
    showform($setup, $settings);
    output("</form>", true);
}
page_footer();
<?php

if (httppost('save')) {
    set_module_pref("language", httppost("language"), "translationwizard");
    //coding set by the lotgd core now with 1.1.0
    //set_module_pref("coding", httppost("coding"),"translationwizard");
    output("Language set to `^%s`0.", httppost("language"));
    //output("Coding set to `^%s`0.",httppost("coding"));
} else {
    $settings = array("Scheme Settings for the Wizard,title", "language" => "What schema do you want to translate for?,enum," . getsetting("serverlanguages", "en,English,de,Deutsch,fr,Français,dk,Danish,es,Español,it,Italian"), "Server supported languages only (view your game settings or before 1.1.1 prefs.php or configuration.php),note");
    $lang = get_module_pref("language");
    if ($lang == "") {
        $set = array("language" => "en");
    } else {
        $set = array("language" => $lang);
    }
    //,"coding"=>$code);
    require_once "lib/showform.php";
    rawoutput("<form action='runmodule.php?module=translationwizard&op=changescheme' method='POST'>");
    //output("Note: If you change your coding table, your php version must support the version. Else you'll get error messages.");
    output_notl("`n`n");
    $info = showform($settings, $set);
    rawoutput("<input type='hidden' value='1' name='save'>");
    rawoutput("</form>");
    addnav("", "runmodule.php?module=translationwizard&op=changescheme");
}
示例#17
0
			while (list($key,$val)=each($skins)){
				output("<input type='radio' name='template' value='$val'".($_COOKIE['template']==""&&$val=="yarbrough.htm" || $_COOKIE['template']==$val?" checked":"").">".substr($val,0,strpos($val,".htm"))."<br>",true);
			}
		}
	}else{
		output("`c`b`\$ERROR!!!`b`c`&Unable to open the templates folder!  Please notify the administrator!!");
	}
	
	output("
	New Password: <input name='pass1' type='password'> (leave blank if you don't want to change it)`n
	Retype: <input name='pass2' type='password'>`n
	Email address: <input name='email' value=\"".HTMLEntities($session['user']['emailaddress'])."\">`n
	",true);
	$prefs = $session['user']['prefs'];
	$prefs['bio'] = $session['user']['bio'];
	showform($form,$prefs);
	output("
	</form>",true);
	addnav("","prefs.php?op=save");

	// Stop clueless lusers from deleting their character just because a
	// monster killed them.
	if ($session['user']['alive'] && getsetting("selfdelete",0)!=0) {
		output("<form action='prefs.php?op=suicide&userid={$session['user']['acctid']}' method='POST'>",true);
		output("<input type='submit' class='button' value='Delete Character' onClick='return confirm(\"Are you sure you wish to delete your character?\");'>", true);
		output("</form>",true);
		addnav("","prefs.php?op=suicide&userid={$session['user']['acctid']}");
	}
}
page_footer();
?>
示例#18
0
        installdb($sqlData, $_POST['deldb']);
        if ($error) {
            $contents = '<center><br><BR>TITLE<BR></center>';
            $title = '<b>' . $errorInfo . '</b><br><br>';
            $contents = str_replace('TITLE', $title, $contents);
            $finish = 'style="display:none" >&nbsp;&nbsp;<input type="submit" class="button" value="&nbsp;关	闭&nbsp;" ';
            showform('index.php?step=finish', '安装过程发生错误', '请根据信息检查错误。', $contents, '', $finish);
            exit;
        }
        $fp = fopen('install.lock', 'w+');
        fclose($fp);
        $contents = '&nbsp;&nbsp;<b>安装完成</b><br><br>';
        $contents .= '&nbsp;&nbsp;<b><font color="red">请检查 install 目录是否存在.<br>';
        $contents .= '&nbsp;&nbsp;如果存在请立即删除,以防别人利用此程序获得您的相关资料.</font></b><br></p>';
        $finish = 'style="display:none" >&nbsp;&nbsp;<input type="submit" class="button" value="&nbsp;关	闭&nbsp;" ';
        showform('index.php?step=finish', '安装完成', '请检查相关信息', $contents, '', $finish);
    } else {
        $contents = '<center><br><BR>TITLE<BR></center>';
        $title = '<b>' . $errorInfo . '</b><br><br>';
        $contents = str_replace('TITLE', $title, $contents);
        showform('index.php?step=installsetting', '安装过程发生错误', '请根据信息检查错误。', $contents, '', 'disabled');
    }
}
if ($_GET['step'] == 'finish') {
    header('location:../index.php');
    echo '<script language="javascript">';
    echo 'window.close();';
    echo '</script>';
}
echo '</body>
</html>';
function settings_run()
{
    global $session;
    $op = httpget('op');
    $category = stripslashes(rawurldecode(httpget('cat'))) ?: 'Account';
    page_header("Settings - {$category}");
    switch ($op) {
        case 'save':
            $accounts = db_prefix('accounts');
            $post = httpallpost();
            unset($post['showFormTabIndex']);
            foreach ($post as $key => $val) {
                $post[$key] = stripcslashes($val);
            }
            $post['oldvalues'] = json_decode($post['oldvalues'], true);
            foreach ($post['oldvalues'] as $key => $val) {
                $post['oldvalues'][$key] = stripslashes($val);
            }
            $post = modulehook('prefs-change', $post);
            if ($post['return'] != '') {
                $return = $post['return'];
                unset($post['return']);
            }
            //Fix template changes.
            if (md5(md5($post['oldpass'])) == $session['user']['password'] && $post['newpass'] != '') {
                require_once 'lib/systemmail.php';
                $newPass = md5(md5($post['newpass']));
                db_query("UPDATE {$accounts}\n                    SET password = '******'\n                    WHERE acctid = '{$session['user']['acctid']}'");
                systemmail($session['user']['acctid'], 'Account Settings', "`@Your password was changed successfully!");
            }
            unset($post['newpass']);
            unset($post['oldpass']);
            foreach ($post as $key => $val) {
                if ($key == 'bio' && $val != $post['oldvalues']['bio']) {
                    $session['user']['bio'] = $val;
                } else {
                    if (!is_array($val) && $val != $post['oldvalues'][$key]) {
                        if (strpos($key, '__user') || strpos($key, '__check')) {
                            $moduleKey = explode('__', $key);
                            set_module_pref($moduleKey[1], $val, $moduleKey[0]);
                            unset($moduleKey);
                        } else {
                            $session['user']['prefs'][$key] = $val;
                        }
                    }
                }
            }
            $prefs = @serialize($session['user']['prefs']);
            db_query("UPDATE {$accounts} SET prefs = '{$prefs}'\n                WHERE acctid = '{$session['user']['acctid']}'");
            redirect("runmodule.php?module=settings&cat={$return}&save=true");
            addnav('Go back', 'runmodule.php?module=settings');
            break;
        default:
            $modules = db_prefix('modules');
            $userprefs = db_prefix('module_userprefs');
            $rewrite = trim(get_module_setting('rewrite'));
            $rewrite = json_decode($rewrite, true);
            $languages = getsetting('serverlanguages', 'en, English');
            $prefs = $session['user']['prefs'];
            $prefs['bio'] = $session['user']['bio'];
            $prefs['template'] = $_COOKIE['template'] ?: getsetting('defaultskin', 'jade.htm');
            $prefs['email'] = $session['user']['emailaddress'];
            $prefsFormat = ['Account' => ['bio' => 'Short biography, textarea', 'newpass' => 'New password, password', 'oldpass' => 'If you are changing your password&comma; type your old one, password', 'email' => 'Email, text'], 'Display' => ['template' => 'Skin, theme', 'language' => 'Which language do you prefer?, enum, ' . $languages, 'timestamp' => 'Show timestamps in commentary?, enum, 0, None, 1, Real Time, 2, Relative Time'], 'Game Behavior' => ['emailonmail' => 'Receive emails when you receive a mail?, bool', 'systemmail' => 'Receive emails for system messages?, bool', 'Be sure to check your email\'s spam folder and add our email as a trusted sender!, note', 'dirtyemail' => 'Allow profanity in mail?, bool', 'timeoffset' => sprintf_translate('Hours to offset time (currently %s)?, int', date($prefs['timeformat'], strtotime('now') + $prefs['timeoffset'] * 3600)), 'ihavenocheer' => 'Disable holiday text?, bool', 'nojump' => 'Disable jumping to the commentary when posting or refreshing?, bool']];
            if (count(explode(',', $languages)) < 3) {
                unset($prefs['Display']['language']);
            }
            $prefsFormat = modulehook('prefs-format', $prefsFormat);
            $prefsTemp = [];
            $modulesFound = [];
            $sql = db_query("SELECT modulename, formalname FROM {$modules}\n                WHERE infokeys LIKE '%|prefs|%'\n                AND active = 1\n                ORDER BY modulename");
            while ($row = db_fetch_assoc($sql)) {
                $formal = $row['formalname'];
                $modulesFound[$row['modulename']] = true;
                if (module_status($row['modulename']) == MODULE_FILE_NOT_PRESENT) {
                    foreach ($rewrite as $key => $moduleName) {
                        if ($moduleName == $formal || strpos($key, $row['modulename']) !== false) {
                            unset($rewrite[$key]);
                        }
                    }
                    set_module_setting('rewrite', json_encode($rewrite));
                } else {
                    $prefsTemp[$formal] = get_module_info($row['modulename'])['prefs'];
                }
                unset($prefsTemp[$formal][0]);
                foreach ($prefsTemp[$formal] as $setting => $description) {
                    $description = explode('|', $description)[0];
                    if (strpos($setting, 'user_') === false) {
                        unset($prefsTemp[$formal][$setting]);
                    } else {
                        $structuredKey = "{$row['modulename']}__{$setting}";
                        if ($rewrite[$structuredKey] != $formal) {
                            $prefsTemp[$rewrite[$structuredKey]][$structuredKey] = $description;
                        } else {
                            $prefsTemp[$formal][$structuredKey] = $description;
                        }
                        unset($prefsTemp[$formal][$setting]);
                    }
                }
                if (count($prefsTemp[$formal]) == 0) {
                    unset($prefsTemp[$formal]);
                    unset($modulesFound[$row['modulename']]);
                }
            }
            foreach ($modulesFound as $name => $true) {
                $sql = db_query("SELECT modulename, setting, value FROM {$userprefs}\n                    WHERE modulename = '{$name}'\n                    AND (setting LIKE 'user_%' OR setting LIKE 'check_%')\n                    AND userid = '{$session['user']['acctid']}'\n                    ");
                while ($row = db_fetch_assoc($sql)) {
                    $prefs["{$row['modulename']}__{$row['setting']}"] = $row['value'];
                }
            }
            $prefsFormat = array_merge_recursive($prefsFormat, $prefsTemp);
            $prefsFormat = modulehook('prefs-format', $prefsFormat);
            require_once 'lib/villagenav.php';
            villagenav();
            addnav('Refresh', 'runmodule.php?module=settings');
            addnav('Categories');
            foreach (array_keys($prefsFormat) as $int => $name) {
                addnav($name, "runmodule.php?module=settings&cat=" . rawurlencode($name));
            }
            output("`c`b`i`Q{$category} Settings`b`i`c");
            if (httpget('save')) {
                output("`@`iYour Settings have been saved!`i`n");
            }
            rawoutput("<form action='runmodule.php?module=settings&op=save' method = 'POST'>");
            require_once 'lib/showform.php';
            showform($prefsFormat[$category], $prefs);
            rawoutput(sprintf("<input type='hidden' name='oldvalues' value='%s' />", json_encode($prefs)));
            rawoutput("<input type='hidden' name='return' value='{$category}' />");
            rawoutput("</form>");
            rawoutput("<script type='text/javascript'>\n                document.getElementsByName('template')[0].onchange = function () {\n                    var index = this.selectedIndex;\n                    var selection = this.children[index].value;\n                    document.cookie = 'template=' + selection + ';expires=86400';\n                }\n\n                </script>");
            addnav('', 'runmodule.php?module=settings&op=save');
            break;
    }
    page_footer();
}
示例#20
0
<head>
<title>Raw port network sender</title>
</head>
<body>
<h4>Raw port machine</h4>
<p>A quick and dirty application by Jon Dron. Treat this code as public domain -
you can do anything you like with it!</p>

<p>Note that it is a little delicate - if there are any errors in what you type,
it will either hang or give you an obscure error code. Feel free to improve on 
it if you like and, if it seems useful, post your changes to the course wiki</p>
<?php 
if ($location == "") {
    showform($action, $location, $port);
} else {
    showform($action, $location, $port);
    ?>
 <p> Port: <?php 
    echo $port;
    ?>
</p>
 <p> Location: <?php 
    echo $location;
    ?>
</p>
 <p> Last data sent: <?php 
    echo $action;
    ?>
 </p>
 <h4> Here are the results returned by the server: </h4> 
 <hr />
            addnav("", "creatures.php?op=save&subop=module&creatureid={$id}&module={$module}");
        } else {
            if ($op == "edit" && $id != "") {
                $sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creatureid={$id}";
                $result = db_query($sql);
                if (db_num_rows($result) != 1) {
                    output("`4Error`0, that creature was not found!");
                } else {
                    $row = db_fetch_assoc($result);
                }
                $level = $row['creaturelevel'];
            } else {
                $row = array("creatureid" => 0, "creaturelevel" => $level);
            }
            $form = array("Creature Properties,title", "creatureid" => "Creature id,hidden", "creaturename" => "Creature Name", "creatureweapon" => "Weapon", "creaturewin" => "Win Message (Displayed when the creature kills the player)", "creaturelose" => "Death Message (Displayed when the creature is killed by the player)", "creaturelevel" => "Level,range,1,18,1", "forest" => "Creature is in forest?,bool", "graveyard" => "Creature is in graveyard?,bool", "creatureaiscript" => "Creature's A.I.,textarearesizeable");
            rawoutput("<form action='creatures.php?op=save' method='POST'>");
            showform($form, $row);
            rawoutput("</form>");
            addnav("", "creatures.php?op=save");
        }
    } else {
        $module = httpget("module");
        rawoutput("<form action='mounts.php?op=save&subop=module&creatureid={$id}&module={$module}' method='POST'>");
        module_objpref_edit("creatures", $module, $id);
        rawoutput("</form>");
        addnav("", "creatures.php?op=save&subop=module&creatureid={$id}&module={$module}");
    }
    addnav("Navigation");
    addnav("Return to the creature editor", "creatures.php?level={$level}");
}
page_footer();
示例#22
0
if ($MyForm->formparams('dbconnection') == "Yes") {
    eval("?>" . $MyForm->formrow->dbclasses);
}
$posted = JRequest::get('post', JREQUEST_ALLOWRAW);
/**
 * Main switch statement
 */
switch ($task) {
    case 'send':
        uploadandmail($formname);
        break;
    case 'extra':
        doextratask($formname);
        break;
    default:
        showform($formname, $posted);
        break;
}
/**
 * End of main page
 *
 */
/**
 * Display the form for entry
 *
 */
function showform($formname, $posted)
{
    global $mainframe;
    $database =& JFactory::getDBO();
    $MyForm =& CFChronoForm::getInstance($formname);
     if ($everfound) {
         // Collect the values
         $foundmodules[] = $module;
     }
 }
 if ($foundmodules != array()) {
     $sql = "SELECT * FROM " . db_prefix("module_userprefs") . " WHERE modulename IN ('" . implode("','", $foundmodules) . "') AND (setting LIKE 'user_%' OR setting LIKE 'check_%') AND userid='" . $session['user']['acctid'] . "'";
     $result1 = db_query($sql);
     while ($row1 = db_fetch_assoc($result1)) {
         $mdata[$row1['modulename'] . "___" . $row1['setting']] = stripslashes($row1['value']);
     }
 }
 $form = array_merge($form, $msettings);
 $prefs = array_merge($prefs, $mdata);
 rawoutput("<form action='prefs.php?op=save' method='POST' onSubmit='return(md5pass)'>");
 $info = showform($form, $prefs);
 rawoutput("<input type='hidden' value=\"" . htmlentities(serialize($info), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\" name='oldvalues'>");
 rawoutput("</form><br />");
 addnav("", "prefs.php?op=save");
 // Stop clueless lusers from deleting their character just because a
 // monster killed them.
 if ($session['user']['alive'] && getsetting("selfdelete", 0) != 0) {
     rawoutput("<form action='prefs.php?op=suicide&userid={$session['user']['acctid']}' method='POST'>");
     $deltext = translate_inline("Delete Character");
     $conf = translate_inline("Are you sure you wish to delete your character?");
     rawoutput("<table class='noborder' width='100%'><tr><td width='100%'></td><td style='background-color:#FF00FF' align='right'>");
     rawoutput("<input type='submit' class='button' value='{$deltext}' onClick='return confirm(\"{$conf}\");'>");
     rawoutput("</td></tr></table>");
     rawoutput("</form>");
     addnav("", "prefs.php?op=suicide&userid={$session['user']['acctid']}");
 }
示例#24
0
    $user = isset($_POST['user']) ? $_POST['user'] : '';
    if ($user != $main_username) {
        showForm("Wrong Username");
        exit;
    }
    if ($pass != $main_password) {
        showForm("Wrong password");
        exit;
    }
    // all good so set the cookie
    setcookie("site_username", $user, time() + 3600 * 24, "/");
    setcookie("site_password", $pass, time() + 3600 * 24, "/");
    header("location:" . $_SERVER['PHP_SELF']);
}
// submit is not pushed, just check the cookied stuff
if (isset($_COOKIE['site_username']) and isset($_COOKIE['site_password'])) {
    // check the cookie if it exists
    if ($_COOKIE['site_username'] != $main_username) {
        showform("Wrong Username");
        exit;
    }
    if ($_COOKIE['site_password'] != $main_password) {
        showform("Wrong Password");
        exit;
    }
    // all good don't do anything else
} else {
    // show the form to login
    showForm();
    exit;
}
function oldchurch_run()
{
    global $session;
    page_header("Old Church");
    $op = httpget('op');
    $bloodgift = get_module_pref("bloodgift");
    if ($bloodgift == 1) {
        output("`7As you approach the old church, you are beset with troubling flashes of what happened last time you were here.");
        output("`n`nYou decide to come back another day.");
        villagenav();
    } elseif ($op == "") {
        output("`7An ancient church stands alone, apart from the other buildings, centuries-old scorchmarks marring the once grand walls and curling round the belltower.");
        output("`n`nA thin path winds its way up the hill between sinister-looking memorials covered in mist.");
        output("While the church has obviously been abandoned for a long time, the windows flicker with light from the inside and shadows can be seen dancing on the tall broken shards of glass which fill the windows.");
        addnav("Enter the Church", "runmodule.php?module=oldchurch&op=enter");
        addnav("Return to the Village", "village.php");
    } elseif ($op == "enter") {
        output("`3You make your way up the hill and edge through the sundered doors, taking in the wrecked interior.");
        output("A flickering torch inhabits an iron holder to one side, above a dusty font.");
        output("Beyond the shattered pews lies an altar which has fresh cloths on it and six candles burning dimly.`n`n");
        output("From out of a small door to one side of the altar walks a curiously hearty figure dressed in grey robes who, ignoring the desolate surroundings, opens his arms wide and bids you welcome to the church, \"`^Greetings, greetings, welcome to this little sanctuary. I am `5Capelthwaite`^, and it is good to see people once again visiting this holy place, feel free to look around. My apologies for the current... disarray... but the world is as the Gods decree it, and we must merely live with such things.`3\"");
        output("He casts an appraising eye over you and smiles even more broadly before continuing,");
        output("\"`^Naturally we are always in need of funds for various charitable projects, and if you wish to donate you will of course gain an appropriate reward.");
        output("For those as hardy an adventurer as you there are obviously other ways to earn a blessing if you are short of funds.`3\"");
        output("He smiles to himself and waits at the altar for your decision.");
        addnav("Climb to the Belfry", "runmodule.php?module=oldchurch&op=belfry");
        addnav("Examine the Font", "runmodule.php?module=oldchurch&op=font");
        addnav("Donate Gold", "runmodule.php?module=oldchurch&op=donate");
        addnav("Ask About \"Other Ways\"", "runmodule.php?module=oldchurch&op=ritual");
        addnav("Leave this Place", "village.php");
    } elseif ($op == "belfry") {
        output("`7You walk to the back of the church and climb the unsteady steps up to the belfry, where a large rusted bell hangs from rotting timbers.");
        output("Though you'd expect to get a great view from up here, even the nearby buildings seem shrouded in fog.");
        $random = e_rand(1, 3);
        if ($random >= 2) {
            output("`n`nAs you hurry down from the belfry, you accidentally knock into the bell, which makes an eerily resonant sound as it tolls.");
        }
        output("Spooked slightly, you hurry down the stairs and back into the church.");
        addnav("Examine the Font", "runmodule.php?module=oldchurch&op=font");
        addnav("Donate Gold", "runmodule.php?module=oldchurch&op=donate");
        addnav("Ask About \"Other Ways\"", "runmodule.php?module=oldchurch&op=ritual");
        addnav("Leave this Place", "village.php");
    } elseif ($op == "font") {
        output("`\$As you wander over to the alcove by the door and look inside, there seem to be dark stains inside the font, as though it was not usually used for water.");
        output("`n`n`^Slightly troubled by this, you return to the main part of the church.");
        addnav("Climb to the Belfry", "runmodule.php?module=oldchurch&op=belfry");
        addnav("Donate Gold", "runmodule.php?module=oldchurch&op=donate");
        addnav("Ask About \"Other Ways\"", "runmodule.php?module=oldchurch&op=ritual");
        addnav("Leave this Place", "village.php");
    } elseif ($op == "donate") {
        output("`5Capelthwaite `^grins as you walk over to the donation plate, waiting to see how much you will put in before making any preparations.");
        $donate = array("donation" => "Donation,int");
        require_once "lib/showform.php";
        rawoutput("<form action='runmodule.php?module=oldchurch&op=afterdonate' method='POST'>");
        showform($donate, array(), true);
        addnav("", "runmodule.php?module=oldchurch&op=afterdonate");
        $give = translate_inline("Give Money");
        rawoutput("<input type='submit' class='button' value='{$give}'>");
        rawoutput("</form><br>");
        addnav("Change your mind", "runmodule.php?module=oldchurch&op=enter");
        addnav("Leave this Place", "village.php");
    } elseif ($op == "afterdonate") {
        $donation = httppost('donation');
        if ($donation > $session['user']['gold'] || $donation < 0) {
            output("`5Capelthwaite `^looks somewhat grim as you try to persuade him that it is the spirit of giving which counts.`n`n");
            output("You are hastily ejected from the church.");
        } elseif ($donation >= $session['user']['level'] * 103) {
            output("`^As you put a hefty amount of gold in the bowl, `5Capelthwaite`^'s grin widens and he beckons you over to the altar for a blessing.");
            output("`n`nAfter muttering something a little too fast for you to catch, he places his hand on your head and blesses you.");
            output("`n`n`@You feel energy flowing through you!");
            $session['user']['gold'] -= $donation;
            debuglog("donated {$donation} gold at the old church");
            $donated = get_module_pref("donated");
            apply_buff('capelthwaite_blessing', array("name" => "`5Capelthwaite's Blessing", "rounds" => 15, "wearoff" => "The burst of energy passes.", "atkmod" => $donated ? 1.05 : 1.2, "defmod" => $donated ? 1.01 : 1.1, "roundmsg" => "Energy flows through you!", "schema" => "module-oldchurch"));
            output("Filled with energy you stumble out of the church.");
            set_module_pref("donated", 1);
        } else {
            output("`^As the few coins you decided to spare rattle into the bowl, `5Capelthwaite`^'s grin turns sickening as he beckons you over to the altar.`n`n");
            output("After muttering something too low for you to catch, he places his hand on your head and places the enchantment on you.`n`n");
            output("`4Dark energy flows through you!");
            apply_buff('capelthwaite_curse', array("name" => "`5Capelthwaite's \"Blessing\"", "rounds" => 10, "wearoff" => "The burst of energy passes.", "atkmod" => 0.8, "defmod" => 0.9, "roundmsg" => "Dark Energy flows through you!", "schema" => "module-oldchurch"));
            output("Filled with energy you stumble out of the church.");
            $session['user']['gold'] -= $donation;
            debuglog("donated {$donation} gold at the old church");
            set_module_pref("donated", 1);
        }
        villagenav();
    } elseif ($op == "ritual") {
        output("`3You nervously inquire about another way that you could earn a blessing as `5Capelthwaite`3 looks on you magnanimously.`n`n");
        output("\"`^No need to be so nervous my friend, simply a short rite to honour the master, you'll feel fine the next day. Just take this potion and I'll take care of everything.`3\".`n`n");
        output("He holds out a small black potion he produced from somewhere for you to drink and smiles encouragingly.");
        addnav("Take the Potion", "runmodule.php?module=oldchurch&op=darkritual");
        addnav("Leave this Place", "village.php");
    } elseif ($op == "darkritual") {
        output("`^Trusting in `5Capelthwaite`^'s friendly smile, you drink down the potion. You feel funny for a moment, then the world begins to swim before your eyes, and you black out.`n`n");
        $ritual = e_rand(1, 100);
        if ($ritual >= 100) {
            output("`7Though the potion sapped all will from your body, you remain conscious as you are dragged somewhere, hooded, by several people.");
            output("When the hood is removed you are in a cavern deep underground, trapped in what looks like some artist's rendition of the underworld.");
            output("You are dressed in a grey robe and placed on the edge of a smoke-filled circle with many others similarly outfitted.");
            output("For what seems like hours you are surrounded by chanting, smoke and the sensation of life being drained from your very soul.");
            output("Eventually you are dragged back up through some tunnels like a sack of grain before being dumped in front of the altar, where `5Capelthwaite`7 feeds you another potion.`n`n");
        } else {
            output("You dream of smoke and a glowing light.`n`n");
        }
        output("`^You regain your faculties with `5Capelthwaite`^ leaning over you, looking red-faced.");
        output("He quickly blesses you before helping you out of the church.`n`n");
        output("`@You feel energy flowing through you!`n`n");
        apply_buff('capelthwaite_blessing', array("name" => "`5Capelthwaite's Blessing", "rounds" => 15, "wearoff" => "The burst of energy passes.", "atkmod" => 1.2, "defmod" => 1.1, "roundmsg" => "Energy flows through you!", "schema" => "module-oldchurch"));
        output("You hurry away from this place as fast as your unsteady legs can take you.");
        $ritualenergy = get_module_setting("ritualenergy");
        $ritualenergy++;
        set_module_setting("ritualenergy", $ritualenergy);
        set_module_pref("bloodgift", 1);
        if ($session['user']['turns'] >= 5) {
            $session['user']['turns']--;
        }
        $session['user']['hitpoints'] *= 0.5;
        if ($session['user']['hitpoints'] < 1) {
            $sesson['user']['hitpoints'] = 1;
        }
        villagenav();
    }
    page_footer();
}
 * Page displays some of the game settings
 * 
 * This page is part of the about system
 * and displays some of the game settings
 * so that users know some details about
 * the server.
 * 
 * @copyright Copyright © 2002-2005, Eric Stevens & JT Traub, © 2006-2007, Dragonprime Development Team
 * @version Lotgd 1.1.1 DragonPrime Edition
 * @package Core
 * @subpackage Library
 * @license http://creativecommons.org/licenses/by-nc-sa/2.0/legalcode
 */
$r = httpget('r');
addnav("About LoGD");
addnav("About LoGD", "about.php?r=" . $r);
addnav("Module Info", "about.php?op=listmodules&r=" . $r);
addnav("License Info", "about.php?op=license&r=" . $r);
$setup = array("Game Setup,title", "pvp" => "Enable Slay Other Players,viewonly", "pvpday" => "Player Fights per day,viewonly", "pvpimmunity" => "Days that new players are safe from PvP,viewonly", "pvpminexp" => "Amount of experience when players become killable in PvP,viewonly", "soap" => "Clean user posts (filters bad language and splits words over 45 chars long),viewonly", "newplayerstartgold" => "Amount of gold to start a new character with,viewonly", "New Days,title", "fightsforinterest" => "Player must have fewer than how many forest fights to earn interest?,viewonly", "maxinterest" => "Max Interest Rate (%),viewonly", "mininterest" => "Min Interest Rate (%),viewonly", "daysperday" => "Game days per calendar day,viewonly", "specialtybonus" => "Extra daily uses in specialty area,viewonly", "Bank settings,title", "borrowperlevel" => "Max amount player can borrow per level,viewonly", "allowgoldtransfer" => "Are players allowed to transfer gold,viewonly", "transferperlevel" => "Max amount player can transfer per level of recipient (if transfers are enabled),viewonly", "mintransferlev" => "Minimum level a player has to be before they can transfer gold (if transfers are enabled),viewonly", "transferreceive" => "Total transfers a player can receive in one play day (if transfers are enabled),viewonly", "maxtransferout" => "Max amount total a player can transfer to others per level (if transfers are enabled),viewonly", "Forest,title", "turns" => "Forest Fights per day,viewonly", "dropmingold" => "Forest Creatures always drop at least 1/4 of possible gold,viewonly", "Mail Settings,title", "mailsizelimit" => "Message size limit per message,viewonly", "inboxlimit" => "Limit # of messages in inbox,viewonly", "oldmail" => "Automatically delete old messages after (days),viewonly", "Content Expiration,title", "expirecontent" => "Days to keep comments and news?  (0 for infinite),viewonly", "expiretrashacct" => "Days to keep accounts that were never logged in to? (0 for infinite),viewonly", "expirenewacct" => "Days to keep level 1 accounts with no dragon kills? (0 for infinite),viewonly", "expireoldacct" => "Days to keep all other accounts? (0 for infinite),viewonly", "LOGINTIMEOUT" => "Seconds of inactivity before auto-logoff,viewonly");
$useful = array("Useful Information,title", "dayduration" => "Day Duration,viewonly", "curgametime" => "Current game time,viewonly", "curservertime" => "Current Server Time,viewonly", "lastnewday" => "Last new day,viewonly", "nextnewday" => "Next new day,viewonly");
$secstonextday = secondstonextgameday($details);
$useful_vals = array("dayduration" => round($details['dayduration'] / 60 / 60, 0) . " hours", "curgametime" => getgametime(), "curservertime" => date("Y-m-d h:i:s a"), "lastnewday" => date("h:i:s a", strtotime("-{$details['realsecssofartoday']} seconds")), "nextnewday" => date("h:i:s a", strtotime("+{$details['realsecstotomorrow']} seconds")) . " (" . date("H\\h i\\m s\\s", $secstonextday) . ")");
output("`@<h3>Settings for this game</h3>`n`n", true);
$args = array('settings' => array(), 'values' => array());
$args = modulehook("showsettings", $args);
$form = array_merge($setup, $args['settings']);
$form = array_merge($form, $useful);
$vals = array_merge($settings, $args['values']);
$vals = array_merge($vals, $useful_vals);
showform($form, $vals, true);
示例#27
0
	output("<input type='submit' class='button' name='fixnavs' value='Fix Broken Navs'>",true);
	output("<input type='submit' class='button' name='clearvalidation' value='Mark Email As Valid'>",true);
	output("</form>",true);

	if ($_GET['returnpetition']!=""){
		addnav("Return to the petition","viewpetition.php?op=view&id={$_GET['returnpetition']}");
	}
	
	addnav("View last page hit","user.php?op=lasthit&userid={$_GET['userid']}",false,true);
	output("<form action='user.php?op=save&userid=$_GET[userid]".($_GET['returnpetition']!=""?"&returnpetition={$_GET['returnpetition']}":"")."' method='POST'>",true);
	addnav("","user.php?op=save&userid=$_GET[userid]".($_GET['returnpetition']!=""?"&returnpetition={$_GET['returnpetition']}":"")."");
	addnav("","user.php?op=edit&userid=$_GET[userid]".($_GET['returnpetition']!=""?"&returnpetition={$_GET['returnpetition']}":"")."");
	addnav("Set up ban","user.php?op=setupban&userid=$row[acctid]");
	addnav("Display debug log","user.php?op=debuglog&userid={$_GET['userid']}");
	output("<input type='submit' class='button' value='Save'>",true);
	showform($userinfo,$row);
	output("</form>",true);
	output("<iframe src='user.php?op=lasthit&userid={$_GET['userid']}' width='100%' height='400'>You need iframes to view the user's last hit here.  Use the link in the nav instead.</iframe>",true);
	addnav("","user.php?op=lasthit&userid={$_GET['userid']}");
}elseif ($_GET[op]=="special"){
	if ($_POST[newday]!=""){
		$sql = "UPDATE accounts SET lasthit='".date("Y-m-d H:i:s",strtotime("-".(86500/getsetting("daysperday",4))." seconds"))."' WHERE acctid='$_GET[userid]'";
	}elseif($_POST[fixnavs]!=""){
		$sql = "UPDATE accounts SET allowednavs='',output=\"\" WHERE acctid='$_GET[userid]'";
	}elseif($_POST[clearvalidation]!=""){
		$sql = "UPDATE accounts SET emailvalidation='' WHERE acctid='$_GET[userid]'";
	}

	db_query($sql);
	if ($_GET['returnpetition']==""){
		redirect("user.php?".db_affected_rows());
    addnav("Refresh List", "titleedit.php");
    addnav("Reset Users Titles", "titleedit.php?op=reset");
    title_help();
} elseif ($op == "edit" || $op == "add") {
    require_once "lib/showform.php";
    if ($op == "edit") {
        $sql = "SELECT * FROM " . db_prefix("titles") . " WHERE titleid='{$id}'";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
    } elseif ($op == "add") {
        $row = array('titleid' => 0, 'male' => '', 'female' => '', 'dk' => 0);
        $id = 0;
    }
    rawoutput("<form action='titleedit.php?op=save&id={$id}' method='POST'>");
    addnav("", "titleedit.php?op=save&id={$id}");
    showform($editarray, $row);
    rawoutput("</form>");
    addnav("Functions");
    addnav("Main Title Editor", "titleedit.php");
    title_help();
} elseif ($op == "reset") {
    require_once "lib/titles.php";
    require_once "lib/names.php";
    output("`^Rebuilding all titles.`0`n`n");
    $sql = "SELECT name,title,dragonkills,acctid,sex,ctitle FROM " . db_prefix("accounts");
    $result = db_query($sql);
    $number = db_num_rows($result);
    for ($i = 0; $i < $number; $i++) {
        $row = db_fetch_assoc($result);
        $oname = $row['name'];
        $dk = $row['dragonkills'];
function module_objpref_edit($type, $module, $id)
{
    $info = get_module_info($module);
    if (count($info['prefs-' . $type]) > 0) {
        $data = array();
        $msettings = array();
        while (list($key, $val) = each($info['prefs-' . $type])) {
            if (is_array($val)) {
                $v = $val[0];
                $x = explode("|", $v);
                $val[0] = $x[0];
                $x[0] = $val;
            } else {
                $x = explode("|", $val);
            }
            $msettings[$key] = $x[0];
            // Set up default
            if (isset($x[1])) {
                $data[$key] = $x[1];
            }
        }
        $sql = "SELECT setting, value FROM " . db_prefix("module_objprefs") . " WHERE modulename='{$module}' AND objtype='{$type}' AND objid='{$id}'";
        $result = db_query($sql);
        while ($row = db_fetch_assoc($result)) {
            $data[$row['setting']] = $row['value'];
        }
        tlschema("module-{$module}");
        showform($msettings, $data);
        tlschema();
    }
}
示例#30
0
function form_maker_front_end($id)
{
    $form_maker_front_end = "";
    $result = showform($id);
    if (!$result) {
        return;
    }
    $ok = savedata($result[0], $id);
    if (is_numeric($ok)) {
        remove($ok);
    }
    @session_start();
    global $wpdb;
    $row = $result[0];
    $label_id = $result[2];
    $label_type = $result[3];
    $form_theme = $result[4];
    if (isset($_SESSION['show_submit_text' . $id])) {
        if ($_SESSION['show_submit_text' . $id] == 1) {
            $_SESSION['show_submit_text' . $id] = 0;
            $form_maker_front_end .= $row->submit_text;
            return;
        }
    }
    $vives_form = $wpdb->get_var($wpdb->prepare("SELECT views FROM " . $wpdb->prefix . "formmaker_views WHERE form_id=%d", $id));
    $vives_form = $vives_form + 1;
    $wpdb->update($wpdb->prefix . "formmaker_views", array('views' => $vives_form), array('form_id' => $id), array('%d'), array('%d'));
    $article = $row->article_id;
    if ($row->form_front) {
        /////////if form is new version
        $form_maker_front_end .= '<div><script type="text/javascript">' . $row->javascript . '</script>';
        $new_form_theme = explode('{', $form_theme);
        $count_after_explod_theme = count($new_form_theme);
        for ($i = 0; $i < $count_after_explod_theme; $i++) {
            $body_or_classes[$i] = explode('}', $new_form_theme[$i]);
        }
        for ($i = 0; $i < $count_after_explod_theme; $i++) {
            if ($i == 0) {
                $body_or_classes[$i][0] = "#form" . $id . ' ' . str_replace(',', ", #form" . $id, $body_or_classes[$i][0]);
            } else {
                $body_or_classes[$i][1] = "#form" . $id . ' ' . str_replace(',', ", #form" . $id, $body_or_classes[$i][1]);
            }
        }
        for ($i = 0; $i < $count_after_explod_theme; $i++) {
            $body_or_classes_implode[$i] = implode('}', $body_or_classes[$i]);
        }
        $form_theme = implode('{', $body_or_classes_implode);
        $form_maker_front_end .= '<style>' . str_replace('[SITE_ROOT]', plugins_url("", __FILE__), $form_theme) . '</style>';
        $form_maker_front_end .= '<form name="form' . $id . '" action="' . $_SERVER['REQUEST_URI'] . '" method="post" id="form' . $id . '" enctype="multipart/form-data"  onsubmit="check_required(\'submit\', \'' . $id . '\'); return false;">
		<div id="' . $id . 'pages" class="wdform_page_navigation" show_title="' . $row->show_title . '" show_numbers="' . $row->show_numbers . '" type="' . $row->pagination . '"></div>
		<input type="hidden" id="counter' . $id . '" value="' . $row->counter . '" name="counter' . $id . '" />';
        //inch@ petq chi raplace minchev form@ tpi
        $captcha_url = 'components/com_formmaker/wd_captcha.php?digit=';
        $captcha_rep_url = 'components/com_formmaker/wd_captcha.php?r2=' . mt_rand(0, 1000) . '&digit=';
        $rep1 = array("<!--repstart-->Title<!--repend-->", "<!--repstart-->First<!--repend-->", "<!--repstart-->Last<!--repend-->", "<!--repstart-->Middle<!--repend-->", "<!--repstart-->January<!--repend-->", "<!--repstart-->February<!--repend-->", "<!--repstart-->March<!--repend-->", "<!--repstart-->April<!--repend-->", "<!--repstart-->May<!--repend-->", "<!--repstart-->June<!--repend-->", "<!--repstart-->July<!--repend-->", "<!--repstart-->August<!--repend-->", "<!--repstart-->September<!--repend-->", "<!--repstart-->October<!--repend-->", "<!--repstart-->November<!--repend-->", "<!--repstart-->December<!--repend-->", "<!--repstart-->Street Address<!--repend-->", "<!--repstart-->Street Address Line 2<!--repend-->", "<!--repstart-->City<!--repend-->", "<!--repstart-->State / Province / Region<!--repend-->", "<!--repstart-->Postal / Zip Code<!--repend-->", "<!--repstart-->Country<!--repend-->", "<!--repstart-->Area Code<!--repend-->", "<!--repstart-->Phone Number<!--repend-->", "<!--repstart-->From<!--repend-->", "<!--repstart-->To<!--repend-->", "<!--repstart-->\$300<!--repend-->", "<!--repstart-->product 1 \$100<!--repend-->", "<!--repstart-->product 2 \$200<!--repend-->", $captcha_url, 'class="captcha_img"', plugins_url("images/refresh.png", __FILE__), 'form_id_temp', 'style="padding-right:170px"');
        $rep2 = array(addslashes(__("Title", 'form_maker')), addslashes(__("First", 'form_maker')), addslashes(__("Last", 'form_maker')), addslashes(__("Middle", 'form_maker')), addslashes(__("January", 'form_maker')), addslashes(__("February", 'form_maker')), addslashes(__("March", 'form_maker')), addslashes(__("April", 'form_maker')), addslashes(__("May", 'form_maker')), addslashes(__("June", 'form_maker')), addslashes(__("July", 'form_maker')), addslashes(__("August", 'form_maker')), addslashes(__("September", 'form_maker')), addslashes(__("October", 'form_maker')), addslashes(__("November", 'form_maker')), addslashes(__("December", 'form_maker')), addslashes(__("Street Address", 'form_maker')), addslashes(__("Street Address Line 2", 'form_maker')), addslashes(__("City", 'form_maker')), addslashes(__("State / Province / Region", 'form_maker')), addslashes(__("Postal / Zip Code", 'form_maker')), addslashes(__("Country", 'form_maker')), addslashes(__("Area Code", 'form_maker')), addslashes(__("Phone Number", 'form_maker')), addslashes(__("From", 'form_maker')), addslashes(__("To", 'form_maker')), '', '', '', $captcha_rep_url, 'class="captcha_img" style="display:none"', plugins_url("images/refresh.png", __FILE__), $id, '');
        $untilupload = str_replace($rep1, $rep2, $row->form_front);
        while (strpos($untilupload, "***destinationskizb") > 0) {
            $pos1 = strpos($untilupload, "***destinationskizb");
            $pos2 = strpos($untilupload, "***destinationverj");
            $untilupload = str_replace(substr($untilupload, $pos1, $pos2 - $pos1 + 22), "", $untilupload);
        }
        $form_maker_front_end .= $untilupload;
        $is_recaptcha = FALSE;
        $form_maker_front_end .= '<script type="text/javascript">';
        $form_maker_front_end .= 'WDF_FILE_TYPE_ERROR = \'' . addslashes(__("Sorry, you are not allowed to upload this type of file.", 'form_maker')) . '\';';
        $form_maker_front_end .= 'WDF_GRADING_TEXT = \'' . addslashes(__("Your score should be less than", 'form_maker')) . '\';';
        $form_maker_front_end .= 'WDF_INVALID_GRADING 	= \'' . addslashes(sprintf(__("Your score should be less than", 'form_maker'), '`grading_label`', '`grading_total`')) . '\';';
        $form_maker_front_end .= 'WDF_INVALID_EMAIL = \'' . addslashes(__("This is not a valid email address.", 'form_maker')) . '\';';
        $form_maker_front_end .= 'REQUEST_URI	= "' . $_SERVER['REQUEST_URI'] . '";';
        $form_maker_front_end .= 'ReqFieldMsg	=\'`FIELDNAME` ' . addslashes(__('field is required.', 'form_maker')) . '\';';
        $form_maker_front_end .= 'FormCurrency = "";';
        $form_maker_front_end .= 'FormPaypalTax = "";';
        $form_maker_front_end .= 'function formOnload' . $id . '()
{
';
        //enable maps and refresh captcha
        foreach ($label_type as $key => $type) {
            switch ($type) {
                case 'type_map':
                    $form_maker_front_end .= 'if(document.getElementById("' . $label_id[$key] . '_element' . $id . '"))
		{
			if_gmap_init(' . $label_id[$key] . ',' . $id . ');
			for(q=0; q<20; q++)
				if(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("long"+q))
				{
				
					w_long=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("long"+q));
					w_lat=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("lat"+q));
					w_info=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("info"+q));
					add_marker_on_map(' . $label_id[$key] . ',q, w_long, w_lat, w_info,' . $id . ',false);
				}
		}';
                    break;
                case 'type_mark_map':
                    $form_maker_front_end .= 'if(document.getElementById("' . $label_id[$key] . '_element' . $id . '"))
	if(!document.getElementById("' . $label_id[$key] . '_long' . $id . '"))	
	{      	
	
		var longit = document.createElement(\'input\');
         	longit.setAttribute("type", \'hidden\');
         	longit.setAttribute("id", \'' . $label_id[$key] . '_long' . $id . '\');
         	longit.setAttribute("name", \'' . $label_id[$key] . '_long' . $id . '\');

		var latit = document.createElement(\'input\');
         	latit.setAttribute("type", \'hidden\');
         	latit.setAttribute("id", \'' . $label_id[$key] . '_lat' . $id . '\');
         	latit.setAttribute("name", \'' . $label_id[$key] . '_lat' . $id . '\');

		document.getElementById("' . $label_id[$key] . '_element_section' . $id . '").appendChild(longit);
		document.getElementById("' . $label_id[$key] . '_element_section' . $id . '").appendChild(latit);
	
		if_gmap_init(' . $label_id[$key] . ', ' . $id . ');
		
		w_long=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("long0"));
		w_lat=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("lat0"));
		w_info=parseFloat(document.getElementById(' . $label_id[$key] . '+"_element"+' . $id . ').getAttribute("info0"));
		
		
		longit.value=w_long;
		latit.value=w_lat;
		add_marker_on_map(' . $label_id[$key] . ',0, w_long, w_lat, w_info, ' . $id . ', true);		
	}';
                    break;
                case 'type_captcha':
                    $form_maker_front_end .= 'if(document.getElementById(\'_wd_captcha' . $id . '\'))
		captcha_refresh(\'_wd_captcha\', \'' . $id . '\');';
                    break;
                case 'type_recaptcha':
                    $is_recaptcha = TRUE;
                    break;
                case 'type_radio':
                case 'type_checkbox':
                    $form_maker_front_end .= 'if(document.getElementById(\'' . $label_id[$key] . '_randomize' . $id . '\'))
		if (document.getElementById(\'' . $label_id[$key] . '_randomize' . $id . '\').value == "yes") {
			choises_randomize(\'' . $label_id[$key] . '\', \'' . $id . '\');}';
                    break;
                case 'type_spinner':
                    $form_maker_front_end .= '
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\')) {
      var spinner_value = document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').getAttribute(\'aria-valuenow\');
    }
    if (document.getElementById(\'' . $label_id[$key] . '_min_value' . $id . '\'))
      var spinner_min_value = document.getElementById(\'' . $label_id[$key] . '_min_value' . $id . '\').value;
    if (document.getElementById(\'' . $label_id[$key] . '_max_value' . $id . '\'))
      var spinner_max_value = document.getElementById(\'' . $label_id[$key] . '_max_value' . $id . '\').value;
    if (document.getElementById(\'' . $label_id[$key] . '_step' . $id . '\'))
      var spinner_step = document.getElementById(\'' . $label_id[$key] . '_step' . $id . '\').value;
    jQuery( \'' . $label_id[$key] . '_element' . $id . '\' ).removeClass( \'ui-spinner-input\')
    .prop( \'disabled\', false )
    .removeAttr( \'autocomplete\' )
    .removeAttr( \'role\' )
    .removeAttr( \'aria-valuemin\' )
    .removeAttr( \'aria-valuemax\' )
    .removeAttr( \'aria-valuenow\' );
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\')) {
      span_ui= document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').parentNode;
      span_ui.parentNode.appendChild(document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\'));
      span_ui.parentNode.removeChild(span_ui);
      jQuery(\'#' . $label_id[$key] . '_element' . $id . '\')[0].spin = null;
    }
    spinner = jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner();
    spinner.spinner( \'value\', spinner_value );
		jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner({ min: spinner_min_value});
		jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner({ max: spinner_max_value});
		jQuery( \'#' . $label_id[$key] . '_element' . $id . '\' ).spinner({ step: spinner_step});';
                    break;
                case 'type_slider':
                    $form_maker_front_end .= '
    if (document.getElementById(\'' . $label_id[$key] . '_slider_value' . $id . '\'))
      var slider_value = document.getElementById(\'' . $label_id[$key] . '_slider_value' . $id . '\').value;
    if (document.getElementById(\'' . $label_id[$key] . '_slider_min_value' . $id . '\'))
      var slider_min_value = document.getElementById(\'' . $label_id[$key] . '_slider_min_value' . $id . '\').value;
    if (document.getElementById(\'' . $label_id[$key] . '_slider_max_value' . $id . '\'))
      var slider_max_value = document.getElementById(\'' . $label_id[$key] . '_slider_max_value' . $id . '\').value;
    if (document.getElementById(\'' . $label_id[$key] . '_element_value' . $id . '\'))
      var slider_element_value = document.getElementById(\'' . $label_id[$key] . '_element_value' . $id . '\' );
    if (document.getElementById(\'' . $label_id[$key] . '_slider_value' . $id . '\'))
      var slider_value_save = document.getElementById( \'' . $label_id[$key] . '_slider_value' . $id . '\' );
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\')) {
      document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').innerHTML = \'\';
      document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').removeAttribute( \'class\' );
      document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\').removeAttribute( \'aria-disabled\' );
    }
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '\'))
      jQuery(\'#' . $label_id[$key] . '_element' . $id . '\')[0].slide = null;
    jQuery( \'#' . $label_id[$key] . '_element' . $id . '\').slider({
      range: \'min\',
      value: eval(slider_value),
      min: eval(slider_min_value),
      max: eval(slider_max_value),	
      slide: function( event, ui ) {
        slider_element_value.innerHTML = \'\' + ui.value;
        slider_value_save.value = \'\' + ui.value;
      }
    });';
                    break;
                case 'type_range':
                    $form_maker_front_end .= '
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\'))
      var spinner_value0 = document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\').getAttribute( \'aria-valuenow\' );
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\'))
      var spinner_value1 = document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\').getAttribute( \'aria-valuenow\' );
    if (document.getElementById(\'' . $label_id[$key] . '_range_step' . $id . '\'))
      var spinner_step = document.getElementById(\'' . $label_id[$key] . '_range_step' . $id . '\').value;
    jQuery( \'#' . $label_id[$key] . '_element' . $id . '0\' ).removeClass( \'ui-spinner-input\' )
    .prop( \'disabled\', false )	
    .removeAttr( \'autocomplete\' )		
    .removeAttr( \'role\' )			
    .removeAttr( \'aria-valuenow\' );		
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\')) {
      span_ui= document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\').parentNode;
      span_ui.parentNode.appendChild(document.getElementById(\'' . $label_id[$key] . '_element' . $id . '0\'));
      span_ui.parentNode.removeChild(span_ui);
      jQuery(\'#' . $label_id[$key] . '_element' . $id . '0\')[0].spin = null;
    }
		spinner0 = jQuery( \'#' . $label_id[$key] . '_element' . $id . '0\' ).spinner();
		spinner0.spinner( \'value\', spinner_value0 );
    jQuery( \'#' . $label_id[$key] . '_element' . $id . '0\' ).spinner({ step: spinner_step});
    jQuery( \'#' . $label_id[$key] . '_element' . $id . '1\' ).removeClass( \'ui-spinner-input\' )
    .prop( \'disabled\', false )
    .removeAttr( \'autocomplete\' )
    .removeAttr( \'role\' )
    .removeAttr( \'aria-valuenow\' );
    if (document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\')) {
      span_ui1= document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\').parentNode;
      span_ui1.parentNode.appendChild(document.getElementById(\'' . $label_id[$key] . '_element' . $id . '1\'));
      span_ui1.parentNode.removeChild(span_ui1);
      jQuery(\'#' . $label_id[$key] . '_element' . $id . '1\')[0].spin = null;
    }
		spinner1 = jQuery( \'#' . $label_id[$key] . '_element' . $id . '1\' ).spinner();
		spinner1.spinner( \'value\', spinner_value1 );
		jQuery( \'#' . $label_id[$key] . '_element' . $id . '1\').spinner({ step: spinner_step});';
                    break;
                case 'type_paypal_total':
                    $form_maker_front_end .= '
    set_total_value(' . $label_id[$key] . ', ' . $id . ');';
                    break;
                default:
                    break;
            }
        }
        $form_maker_front_end .= '
     if (window.before_load) {
      before_load();
     }
  }';
        $form_maker_front_end .= '
      function formAddToOnload' . $id . '() {
        if (formOldFunctionOnLoad' . $id . ') {
          formOldFunctionOnLoad' . $id . '();
        }
        formOnload' . $id . '();
      }
      function formLoadBody' . $id . '() {
        formOldFunctionOnLoad' . $id . ' = window.onload;
        window.onload = formAddToOnload' . $id . ';
      }
      var formOldFunctionOnLoad' . $id . ' = null;
      formLoadBody' . $id . '();';
        if (isset($_POST["counter" . $id])) {
            $counter = esc_html($_POST["counter" . $id]);
        }
        $old_key = -1;
        if (isset($counter)) {
            foreach ($label_type as $key => $type) {
                switch ($type) {
                    case "type_text":
                    case "type_number":
                    case "type_submitter_mail":
                        $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n\t\tif(document.getElementById('" . $label_id[$key] . "_element" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').className='input_active';\n\t\t}\n\t";
                        break;
                    case "type_textarea":
                        $order = array("\r\n", "\n", "\r");
                        $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n\t\tif(document.getElementById('" . $label_id[$key] . "_element" . $id . "').title!='" . str_replace($order, '\\n', addslashes($_POST[$label_id[$key] . "_element" . $id])) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').innerHTML='" . str_replace($order, '\\n', addslashes($_POST[$label_id[$key] . "_element" . $id])) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').className='input_active';\n\t\t}\n\t";
                        break;
                    case "type_name":
                        $element_title = $_POST[$label_id[$key] . "_element_title" . $id];
                        if (isset($_POST[$label_id[$key] . "_element_title" . $id])) {
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "'))\n\t{\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_title" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_title" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_title" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_title" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_title" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_first" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_first" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_last" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_last" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_middle" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_middle" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_middle" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_middle" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_middle" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t}";
                        } else {
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "'))\n\t{\n\t\t\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_first" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_first" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_last" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_last" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t}";
                        }
                        break;
                    case "type_phone":
                        $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "'))\n\t{\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_first" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_first" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_first" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_first" . $id . "').className='input_active';\n\t\t}\n\t\t\n\t\tif(document.getElementById('" . $label_id[$key] . "_element_last" . $id . "').title!='" . addslashes($_POST[$label_id[$key] . "_element_last" . $id]) . "')\n\t\t{\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element_last" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element_last" . $id . "').className='input_active';\n\t\t}\n\t}";
                        break;
                    case "type_star_rating":
                        $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "')) {\n\t\t\t\t\t\tdocument.getElementById('" . $label_id[$key] . "_selected_star_amount" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_selected_star_amount" . $id]) . "';\t\n            if (document.getElementById('" . $label_id[$key] . "_selected_star_amount" . $id . "').value)\t\n              select_star_rating((document.getElementById('" . $label_id[$key] . "_selected_star_amount" . $id . "').value-1)," . $label_id[$key] . "," . $id . ");\t\n\t\t\t\t\t}";
                        break;
                    case "type_scale_rating":
                        $form_maker_front_end .= "for (k=0; k<100; k++) {\n\t\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k)) {\n\t\t\t\t\t\t\tdocument.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k).removeAttribute('checked');\n\t\t\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k).value=='" . $_POST[$label_id[$key] . "_scale_radio" . $id] . "')\n\t\t\t\t\t\t\t\tdocument.getElementById('" . $label_id[$key] . "_scale_radio" . $id . "_'+k).setAttribute('checked', 'checked');\n\t\t\t\t\t\t}\n\t\t\t\t\t}";
                        break;
                    case "type_spinner":
                        $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . "')) {\n            document.getElementById('" . $label_id[$key] . "_element" . $id . "').setAttribute('aria-valuenow','" . $_POST[$label_id[$key] . "_element" . $id] . "');\n          }";
                        break;
                    case "type_slider":
                        $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n            document.getElementById('" . $label_id[$key] . "_element" . $id . "').setAttribute('aria-valuenow','" . $_POST[$label_id[$key] . "_slider_value" . $id] . "');\n\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_slider_value" . $id . "'))\n            document.getElementById('" . $label_id[$key] . "_slider_value" . $id . "').value='" . $_POST[$label_id[$key] . "_slider_value" . $id] . "';\n\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_element_value" . $id . "'))\n            document.getElementById('" . $label_id[$key] . "_element_value" . $id . "').innerHTML='" . $_POST[$label_id[$key] . "_slider_value" . $id] . "';";
                        break;
                    case "type_range":
                        $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . "0'))\n              document.getElementById('" . $label_id[$key] . "_element" . $id . "0').setAttribute('aria-valuenow','" . $_POST[$label_id[$key] . "_element" . $id . "0"] . "');\n\t\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_element" . $id . "1'))\n              document.getElementById('" . $label_id[$key] . "_element" . $id . "1').setAttribute('aria-valuenow','" . $_POST[$label_id[$key] . "_element" . $id . "1"] . "');";
                        break;
                    case "type_grading":
                        for ($k = 0; $k < 100; $k++) {
                            $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_element" . $id . $k . "')) {\t\t\n              document.getElementById('" . $label_id[$key] . "_element" . $id . $k . "').value='" . $_POST[$label_id[$key] . "_element" . $id . $k] . "';}";
                        }
                        $form_maker_front_end .= "sum_grading_values(" . $label_id[$key] . "," . $id . ");";
                        break;
                    case "type_matrix":
                        $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'radio') {";
                        for ($k = 1; $k < 40; $k++) {
                            for ($l = 1; $l < 40; $l++) {
                                $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "')) {\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').removeAttribute('checked');\n                    if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').value=='" . $_POST[$label_id[$key] . "_input_element" . $id . $k] . "')\n                      document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').setAttribute('checked', 'checked');\n\t\t\t\t\t\t\t\t\t}";
                            }
                        }
                        $form_maker_front_end .= "}\t\n\t\t\t\t\telse\t\n            if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'checkbox') {";
                        for ($k = 1; $k < 40; $k++) {
                            for ($l = 1; $l < 40; $l++) {
                                $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "')) {\n\t\t\t\t\t\t\t\t\tdocument.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').removeAttribute('checked');\n\t\t\t\t\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').value=='" . $_POST[$label_id[$key] . "_input_element" . $id . $k . "_" . $l] . "')\t\t\n                    document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').setAttribute('checked', 'checked');\n\t\t\t\t\t\t\t\t}";
                            }
                        }
                        $form_maker_front_end .= "}\t\n\t\t\t\t\telse\t\n            if (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'text') {";
                        for ($k = 1; $k < 40; $k++) {
                            for ($l = 1; $l < 40; $l++) {
                                $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "'))\n                  document.getElementById('" . $label_id[$key] . "_input_element" . $id . $k . "_" . $l . "').value='" . $_POST[$label_id[$key] . "_input_element" . $id . $k . "_" . $l] . "';";
                            }
                        }
                        $form_maker_front_end .= "\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tif (document.getElementById('" . $label_id[$key] . "_input_type" . $id . "').value == 'select') {";
                        for ($k = 1; $k < 40; $k++) {
                            for ($l = 1; $l < 40; $l++) {
                                $form_maker_front_end .= "if (document.getElementById('" . $label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l . "'))\n                    document.getElementById('" . $label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l . "').value='" . $_POST[$label_id[$key] . "_select_yes_no" . $id . $k . "_" . $l] . "';";
                            }
                        }
                        $form_maker_front_end .= "}";
                        break;
                    case "type_address":
                        if ($key > $old_key) {
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_street1" . $id . "'))\n\t{\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_street1" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_street1" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_street2" . $id . "').value='" . addslashes($_POST[$label_id[$key + 1] . "_street2" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_city" . $id . "').value='" . addslashes($_POST[$label_id[$key + 2] . "_city" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_state" . $id . "').value='" . addslashes($_POST[$label_id[$key + 3] . "_state" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_postal" . $id . "').value='" . addslashes($_POST[$label_id[$key + 4] . "_postal" . $id]) . "';\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_country" . $id . "').value='" . addslashes($_POST[$label_id[$key + 5] . "_country" . $id]) . "';\n\t\t\n\t}";
                            $old_key = $key + 5;
                        }
                        break;
                    case "type_checkbox":
                        $is_other = FALSE;
                        if ($_POST[$label_id[$key] . "_allow_other" . $id] == "yes") {
                            $other_element = $_POST[$label_id[$key] . "_other_input" . $id];
                            $other_element_id = $_POST[$label_id[$key] . "_allow_other_num" . $id];
                            if (isset($_POST[$label_id[$key] . "_allow_other_num" . $id])) {
                                $is_other = TRUE;
                            }
                        }
                        $form_maker_front_end .= "\n\tif(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'))\n\t{\n\tdocument.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_br" . $id . "'));\n\tdocument.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'));\n\t}\n\tfor(k=0; k<30; k++)\n\t\tif(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n\t\telse break;\n\t";
                        for ($j = 0; $j < 100; $j++) {
                            $element = $_POST[$label_id[$key] . "_element" . $id . $j];
                            if (isset($_POST[$label_id[$key] . "_element" . $id . $j])) {
                                $form_maker_front_end .= "document.getElementById('" . $label_id[$key] . "_element" . $id . $j . "').setAttribute('checked', 'checked');\n\t";
                            }
                        }
                        if ($is_other) {
                            $form_maker_front_end .= "\n\t\tshow_other_input('" . $label_id[$key] . "','" . $id . "');\n\t\tdocument.getElementById('" . $label_id[$key] . "_other_input" . $id . "').value='" . $_POST[$label_id[$key] . "_other_input" . $id] . "';\n\t";
                        }
                        break;
                    case "type_radio":
                        $is_other = FALSE;
                        if ($_POST[$label_id[$key] . "_allow_other" . $id] == "yes") {
                            $other_element = $_POST[$label_id[$key] . "_other_input" . $id];
                            if (isset($_POST[$label_id[$key] . "_other_input" . $id])) {
                                $is_other = TRUE;
                            }
                        }
                        $form_maker_front_end .= "\n\tif(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'))\n\t{\n\tdocument.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_br" . $id . "'));\n\tdocument.getElementById('" . $label_id[$key] . "_other_input" . $id . "').parentNode.removeChild(document.getElementById('" . $label_id[$key] . "_other_input" . $id . "'));\n\t}\n\t\n\tfor(k=0; k<50; k++)\n\t\tif(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k))\n\t\t{\n\t\t\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).removeAttribute('checked');\n\t\t\tif(document.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).value=='" . addslashes($_POST[$label_id[$key] . "_element" . $id]) . "')\n\t\t\t{\n\t\t\t\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "'+k).setAttribute('checked', 'checked');\n\t\t\t\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t\telse break;\n\t";
                        if ($is_other) {
                            $form_maker_front_end .= "\n\t\tshow_other_input('" . $label_id[$key] . "','" . $id . "');\n\t\tdocument.getElementById('" . $label_id[$key] . "_other_input" . $id . "').value='" . $_POST[$label_id[$key] . "_other_input" . $id] . "';\n\t";
                        }
                        break;
                    case "type_time":
                        $ss = $_POST[$label_id[$key] . "_ss" . $id];
                        if (isset($_POST[$label_id[$key] . "_ss" . $id])) {
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_hh" . $id . "'))\n\t{\n\t\tdocument.getElementById('" . $label_id[$key] . "_hh" . $id . "').value='" . $_POST[$label_id[$key] . "_hh" . $id] . "';\n\t\tdocument.getElementById('" . $label_id[$key] . "_mm" . $id . "').value='" . $_POST[$label_id[$key] . "_mm" . $id] . "';\n\t\tdocument.getElementById('" . $label_id[$key] . "_ss" . $id . "').value='" . $_POST[$label_id[$key] . "_ss" . $id] . "';\n\t}";
                        } else {
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_hh" . $id . "'))\n\t{\n\t\tdocument.getElementById('" . $label_id[$key] . "_hh" . $id . "').value='" . $_POST[$label_id[$key] . "_hh" . $id] . "';\n\t\tdocument.getElementById('" . $label_id[$key] . "_mm" . $id . "').value='" . $_POST[$label_id[$key] . "_mm" . $id] . "';\n\t}";
                        }
                        $am_pm = $_POST[$label_id[$key] . "_am_pm" . $id];
                        if (isset($am_pm)) {
                            $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_am_pm" . $id . "'))\n\t\tdocument.getElementById('" . $label_id[$key] . "_am_pm" . $id . "').value='" . $_POST[$label_id[$key] . "_am_pm" . $id] . "';\n\t";
                        }
                        break;
                    case "type_date_fields":
                        // $date_fields = explode('-', $_POST[$label_id[$key] . "_element" . $id]);
                        $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_day" . $id . "'))\n\t{\n\t\tdocument.getElementById('" . $label_id[$key] . "_day" . $id . "').value='" . $_POST[$label_id[$key] . "_day" . $id] . "';\n\t\tdocument.getElementById('" . $label_id[$key] . "_month" . $id . "').value='" . $_POST[$label_id[$key] . "_month" . $id] . "';\n\t\tdocument.getElementById('" . $label_id[$key] . "_year" . $id . "').value='" . $_POST[$label_id[$key] . "_year" . $id] . "';\n\t}";
                        break;
                    case "type_date":
                    case "type_own_select":
                    case "type_country":
                        $form_maker_front_end .= "if(document.getElementById('" . $label_id[$key] . "_element" . $id . "'))\n\t\tdocument.getElementById('" . $label_id[$key] . "_element" . $id . "').value='" . addslashes($_POST[$label_id[$key] . "_element" . $id]) . "';\n\t";
                        break;
                    default:
                        break;
                }
            }
        }
        $form_maker_front_end .= '	form_view_count' . $id . '=0;
	for(i=1; i<=30; i++)
	{
		if(document.getElementById(\'' . $id . 'form_view\'+i))
		{
			form_view_count' . $id . '++;
			form_view_max' . $id . '=i;
			document.getElementById(\'' . $id . 'form_view\'+i).parentNode.removeAttribute(\'style\');
		}
	}	
	if(form_view_count' . $id . '>1)
	{
		for(i=1; i<=form_view_max' . $id . '; i++)
		{
			if(document.getElementById(\'' . $id . 'form_view\'+i))
			{
				first_form_view' . $id . '=i;
				break;
			}
		}		
		generate_page_nav(first_form_view' . $id . ', \'' . $id . '\', form_view_count' . $id . ', form_view_max' . $id . ');
	}
	var RecaptchaOptions = {
theme: "' . $row->recaptcha_theme . '"
};
</script>
</form></div>';
        if ($is_recaptcha) {
            $form_maker_front_end .= '<div id="main_recaptcha" style="display:none;">';
            // Get a key from https://www.google.com/recaptcha/admin/create
            if ($row->public_key) {
                $publickey = $row->public_key;
            } else {
                $publickey = '0';
            }
            $error = NULL;
            $form_maker_front_end .= recaptcha_get_html($publickey, $error);
            $form_maker_front_end .= '</div>
    <script>
	recaptcha_html = document.getElementById(\'main_recaptcha\').innerHTML.replace(\'Recaptcha.widget = Recaptcha.$("recaptcha_widget_div"); Recaptcha.challenge_callback();\',"");
	document.getElementById(\'main_recaptcha\').innerHTML="";
	if (document.getElementById(\'wd_recaptcha' . $id . '\')) {
    document.getElementById(\'wd_recaptcha' . $id . '\').innerHTML=recaptcha_html;
    Recaptcha.widget = Recaptcha.$("recaptcha_widget_div");
    Recaptcha.challenge_callback();
  }
    </script>';
        }
    } else {
        $form_maker_front_end .= '<div><script type="text/javascript">' . str_replace("\n", " ", $row->javascript) . '</script>';
        $form_maker_front_end .= '<style>' . str_replace('[SITE_ROOT]', plugins_url("", __FILE__), str_replace('.wdform_table1', '.form_view', str_replace("\n", " ", $form_theme))) . '</style>';
        $form_maker_front_end .= "<form name=\"form\" action=\"" . $_SERVER['REQUEST_URI'] . "\" method=\"post\" id=\"form\" enctype=\"multipart/form-data\">\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" id=\"counter\" value=\"" . $row->counter . "\" name=\"counter\" />";
        $captcha_url = plugins_url("wd_captcha.php", __FILE__) . '?digit=';
        $captcha_rep_url = plugins_url("wd_captcha.php", __FILE__) . '?r2=' . mt_rand(0, 1000) . '&digit=';
        $rep1 = array("<!--repstart-->Title<!--repend-->", "<!--repstart-->First<!--repend-->", "<!--repstart-->Last<!--repend-->", "<!--repstart-->Middle<!--repend-->", "<!--repstart-->January<!--repend-->", "<!--repstart-->February<!--repend-->", "<!--repstart-->March<!--repend-->", "<!--repstart-->April<!--repend-->", "<!--repstart-->May<!--repend-->", "<!--repstart-->June<!--repend-->", "<!--repstart-->July<!--repend-->", "<!--repstart-->August<!--repend-->", "<!--repstart-->September<!--repend-->", "<!--repstart-->October<!--repend-->", "<!--repstart-->November<!--repend-->", "<!--repstart-->December<!--repend-->", $captcha_url, 'class="captcha_img"', plugins_url('images/refresh.png', __FILE__), plugins_url('images/delete_el.png', __FILE__), plugins_url('images/up.png', __FILE__), plugins_url('images/down.png', __FILE__), plugins_url('images/left.png', __FILE__), plugins_url('images/right.png', __FILE__), plugins_url('images/edit.png', __FILE__));
        $rep2 = array(addslashes(__("Title", "form_maker")), addslashes(__("First", "form_maker")), addslashes(__("Last", "form_maker")), addslashes(__("Middle", "form_maker")), addslashes(__("January", "form_maker")), addslashes(__("February", "form_maker")), addslashes(__("March", "form_maker")), addslashes(__("April", "form_maker")), addslashes(__("May", "form_maker")), addslashes(__("June", "form_maker")), addslashes(__("July", "form_maker")), addslashes(__("August", "form_maker")), addslashes(__("September", "form_maker")), addslashes(__("October", "form_maker")), addslashes(__("November", "form_maker")), addslashes(__("December", "form_maker")), $captcha_rep_url, 'class="captcha_img" style="display:none"', plugins_url('images/refresh.png', __FILE__), '', '', '', '', '', '');
        $untilupload = str_replace($rep1, $rep2, $row->form);
        while (strpos($untilupload, "***destinationskizb") > 0) {
            $pos1 = strpos($untilupload, "***destinationskizb");
            $pos2 = strpos($untilupload, "***destinationverj");
            $untilupload = str_replace(substr($untilupload, $pos1, $pos2 - $pos1 + 22), "", $untilupload);
        }
        $form_maker_front_end .= $untilupload;
        $form_maker_front_end .= "<script type=\"text/javascript\">\n\t\t\t\t\t\t\tfunction formOnload()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(document.getElementById(\"wd_captcha_input\"))\n\t\t\t\t\t\t\t\t\tcaptcha_refresh('wd_captcha');\n\t\t\t\t\tfor(t=0; t<" . $row->counter . "; t++)\n\t\t\t\t\t\tif(document.getElementById(t+\"_type\"))\n\t\t\t\t\t\t\tif(document.getElementById(t+\"_type\").value==\"type_map\")\n\t\t\t\t\t\t\t\tif_gmap_init(t+\"_element\", false);\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction formAddToOnload()\n\t\t\t\t\t\t\t{ \n\t\t\t\t\t\t\t\tif(formOldFunctionOnLoad){ \n                formOldFunctionOnLoad();\n                }\n\t\t\t\t\t\t\t\tformOnload();\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction formLoadBody()\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tformOldFunctionOnLoad = window.onload;\n\t\t\t\t\t\t\t\twindow.onload = formAddToOnload;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar formOldFunctionOnLoad = null;\n\t\t\t\t\t\t\tformLoadBody();\n\t\t\t\t\t\t\t";
        if (isset($_POST["counter"])) {
            $counter = esc_html($_POST["counter"]);
        }
        if (isset($counter)) {
            if (isset($_POST["captcha_input"]) or is_numeric($ok)) {
                $captcha_input = esc_html($_POST["captcha_input"]);
                $session_wd_captcha_code = isset($_SESSION['wd_captcha_code']) ? $_SESSION['wd_captcha_code'] : '-';
                if ($captcha_input != $session_wd_captcha_code or is_numeric($ok)) {
                    for ($i = 0; $i < $counter; $i++) {
                        if (isset($_POST[$i . "_type"])) {
                            $type = $_POST[$i . "_type"];
                        }
                        if (isset($_POST[$i . "_type"])) {
                            switch ($type) {
                                case "type_text":
                                case "type_submitter_mail":
                                    $form_maker_front_end .= "if(document.getElementById('" . $i . "_element" . "').title!='" . addslashes($_POST[$i . "_element"]) . "')\n\t\t\t\t{\tdocument.getElementById('" . $i . "_element" . "').value='" . addslashes($_POST[$i . "_element"]) . "';\n\t\t\t\t\tdocument.getElementById('" . $i . "_element" . "').style.color='#000000';\n\t\t\t\t\tdocument.getElementById('" . $i . "_element" . "').style.fontStyle='normal !important';\n\t\t\t\t}\n\t\t\t\t";
                                    break;
                                case "type_textarea":
                                    $form_maker_front_end .= "if(document.getElementById('" . $i . "_element" . "').title!='" . addslashes($_POST[$i . "_element"]) . "')\n\t\t\t\t{\tdocument.getElementById('" . $i . "_element" . "').innerHTML='" . addslashes($_POST[$i . "_element"]) . "';\n\t\t\t\t\tdocument.getElementById('" . $i . "_element" . "').style.color='#000000';\n\t\t\t\t\tdocument.getElementById('" . $i . "_element" . "').style.fontStyle='normal';\n\t\t\t\t}\n\t\t\t\t";
                                    break;
                                case "type_password":
                                    $form_maker_front_end .= "document.getElementById('" . $i . "_element" . "').value='';\n\t\t\t\t";
                                    break;
                                case "type_name":
                                    if (isset($_POST[$i . "_element_title"])) {
                                        $form_maker_front_end .= "document.getElementById('" . $i . "_element_title" . "').value='" . addslashes($_POST[$i . "_element_title"]) . "';\n\t\t\t\tdocument.getElementById('" . $i . "_element_first" . "').value='" . addslashes($_POST[$i . "_element_first"]) . "';\n\t\t\t\tdocument.getElementById('" . $i . "_element_last" . "').value='" . addslashes($_POST[$i . "_element_last"]) . "';\n\t\t\t\tdocument.getElementById('" . $i . "_element_middle" . "').value='" . addslashes($_POST[$i . "_element_middle"]) . "';\n\t\t\t\t";
                                    } else {
                                        $form_maker_front_end .= "document.getElementById('" . $i . "_element_first" . "').value='" . addslashes($_POST[$i . "_element_first"]) . "';\n\t\t\t\tdocument.getElementById('" . $i . "_element_last" . "').value='" . addslashes($_POST[$i . "_element_last"]) . "';\n\t\t\t\t";
                                    }
                                    break;
                                case "type_checkbox":
                                    $form_maker_front_end .= "for(k=0; k<20; k++)\n\t\t\t\t\tif(document.getElementById('" . $i . "_element'+k))\n\t\t\t\t\t\tdocument.getElementById('" . $i . "_element'+k).removeAttribute('checked');\n\t\t\t\t\telse break;\t";
                                    for ($j = 0; $j < 100; $j++) {
                                        if (isset($_POST[$i . "_element" . $j])) {
                                            $form_maker_front_end .= "document.getElementById('" . $i . "_element" . $j . "').setAttribute('checked', 'checked');\n\t\t\t\t";
                                        }
                                    }
                                    break;
                                case "type_radio":
                                    $form_maker_front_end .= "for(k=0; k<100; k++)\n\t\t\t\t\tif(document.getElementById('" . $i . "_element'+k))\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('" . $i . "_element'+k).removeAttribute('checked');\n\t\t\t\t\t\tif(document.getElementById('" . $i . "_element'+k).value=='" . addslashes($_POST[$i . "_element"]) . "')\n\t\t\t\t\t\t\tdocument.getElementById('" . $i . "_element'+k).setAttribute('checked', 'checked');\n\t\t\t\t\t}\n\t\t\t\t\telse break;\n\t\t\t\t";
                                    break;
                                case "type_time":
                                    if (isset($_POST[$i . "_ss"])) {
                                        $form_maker_front_end .= "document.getElementById('" . $i . "_hh" . "').value='" . $_POST[$i . "_hh"] . "';\n\t\t\t\tdocument.getElementById('" . $i . "_mm" . "').value='" . $_POST[$i . "_mm"] . "';\n\t\t\t\tdocument.getElementById('" . $i . "_ss" . "').value='" . $_POST[$i . "_ss"] . "';\n\t\t\t\t";
                                    } else {
                                        $form_maker_front_end .= "document.getElementById('" . $i . "_hh" . "').value='" . $_POST[$i . "_hh"] . "';\n\t\t\t\tdocument.getElementById('" . $i . "_mm" . "').value='" . $_POST[$i . "_mm"] . "';\n\t\t\t\t";
                                    }
                                    if (isset($_POST[$i . "_am_pm"])) {
                                        $form_maker_front_end .= "document.getElementById('" . $i . "_am_pm').value='" . $_POST[$i . "_am_pm"] . "';\n\t\t\t\t";
                                    }
                                    break;
                                case "type_date":
                                    $form_maker_front_end .= "document.getElementById('" . $i . "_element" . "').value='" . $_POST[$i . "_element"] . "';\n\t\t\t\t";
                                    break;
                                case "type_date_fields":
                                    $date_fields = explode('-', $_POST[$i . "_element"]);
                                    $form_maker_front_end .= "document.getElementById('" . $i . "_day" . "').value='" . $date_fields[0] . "';\n\t\t\t\tdocument.getElementById('" . $i . "_month" . "').value='" . $date_fields[1] . "';\n\t\t\t\tdocument.getElementById('" . $i . "_year" . "').value='" . $date_fields[2] . "';\n\t\t\t\t";
                                    break;
                                case "type_country":
                                    $form_maker_front_end .= "document.getElementById('" . $i . "_element').value='" . addslashes($_POST[$i . "_element"]) . "';\n\t\t\t\t";
                                    break;
                                case "type_own_select":
                                    $form_maker_front_end .= "document.getElementById('" . $i . "_element').value='" . addslashes($_POST[$i . "_element"]) . "';\n\t\t\t\t";
                                    break;
                                case "type_file":
                                    break;
                            }
                        }
                    }
                }
            }
        }
        $form_maker_front_end .= "n=" . $row->counter . ";\n\tfor(i=0; i<n; i++)\n\t{\n\t\tif(document.getElementById(i))\n\t\t{\t\n\t\t\tfor(z=0; z<document.getElementById(i).childNodes.length; z++)\n\t\t\t\tif(document.getElementById(i).childNodes[z].nodeType==3)\n\t\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[z]);\t\t\n\t\t\tif(document.getElementById(i).childNodes[7])\n\t\t\t{\t\t\t\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[2]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[2]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[2]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[2]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[2]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[2]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[1]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[1]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[1]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[1]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[1]);\n\t\t\t\tdocument.getElementById(i).removeChild(document.getElementById(i).childNodes[1]);\n\t\t\t}\n\t\t}\n\t}\t\n\tfor(i=0; i<=n; i++)\n\t{\t\n\t\tif(document.getElementById(i))\n\t\t{\n\t\t\ttype=document.getElementById(i).getAttribute(\"type\");\n\t\t\t\tswitch(type)\n\t\t\t\t{\tcase \"type_text\":\n\t\t\t\t\tcase \"type_password\":\n\t\t\t\t\tcase \"type_submitter_mail\":\n\t\t\t\t\tcase \"type_own_select\":\n\t\t\t\t\tcase \"type_country\":\n\t\t\t\t\tcase \"type_hidden\":\n\t\t\t\t\tcase \"type_map\":\n\t\t\t\t\t{\n\t\t\t\t\t\tremove_add_(i+\"_element\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\tcase \"type_submit_reset\":\n\t\t\t\t\t{\n\t\t\t\t\t\tremove_add_(i+\"_element_submit\");\n\t\t\t\t\t\tif(document.getElementById(i+\"_element_reset\"))\n\t\t\t\t\t\t\tremove_add_(i+\"_element_reset\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\tcase \"type_captcha\":\n\t\t\t\t\t{\tremove_add_(\"wd_captcha\");\n\t\t\t\t\t\tremove_add_(\"element_refresh\");\n\t\t\t\t\t\tremove_add_(\"wd_captcha_input\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_file_upload\":\n\t\t\t\t\t\t{\tremove_add_(i+\"_element\");\n\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").value==\"\")\n\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\text_available=getfileextension(i);\n\t\t\t\t\t\t\tif(!ext_available)\n\t\t\t\t\t\t\t\tseted=false;\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_textarea\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\tremove_add_(i+\"_element\");\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").innerHTML==document.getElementById(i+\"_element\").title || document.getElementById(i+\"_element\").innerHTML==\"\")\n\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_name\":\n\t\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\tif(document.getElementById(i+\"_element_title\"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tremove_add_(i+\"_element_title\");\n\t\t\t\t\t\t\tremove_add_(i+\"_element_first\");\n\t\t\t\t\t\t\tremove_add_(i+\"_element_last\");\n\t\t\t\t\t\t\tremove_add_(i+\"_element_middle\");\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element_title\").value==\"\" || document.getElementById(i+\"_element_first\").value==\"\" || document.getElementById(i+\"_element_last\").value==\"\" || document.getElementById(i+\"_element_middle\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tremove_add_(i+\"_element_first\");\n\t\t\t\t\t\t\tremove_add_(i+\"_element_last\");\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element_first\").value==\"\" || document.getElementById(i+\"_element_last\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_checkbox\":\n\t\t\t\t\tcase \"type_radio\":\n\t\t\t\t\t\t{\tis=true;\n\t\t\t\t\t\t\tfor(j=0; j<100; j++)\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\"+j))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tremove_add_(i+\"_element\"+j);\n\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\"+j).checked)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tis=false;\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(is)\n\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_button\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(j=0; j<100; j++)\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\"+j))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tremove_add_(i+\"_element\"+j);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_time\":\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\tif(document.getElementById(i+\"_ss\"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tremove_add_(i+\"_ss\");\n\t\t\t\t\t\t\tremove_add_(i+\"_mm\");\n\t\t\t\t\t\t\tremove_add_(i+\"_hh\");\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_ss\").value==\"\" || document.getElementById(i+\"_mm\").value==\"\" || document.getElementById(i+\"_hh\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tremove_add_(i+\"_mm\");\n\t\t\t\t\t\t\tremove_add_(i+\"_hh\");\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_mm\").value==\"\" || document.getElementById(i+\"_hh\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tcase \"type_date\":\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\tremove_add_(i+\"_element\");\n\t\t\t\t\t\tremove_add_(i+\"_button\");\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").value==\"\")\n\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tcase \"type_date_fields\":\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\tremove_add_(i+\"_day\");\n\t\t\t\t\t\tremove_add_(i+\"_month\");\n\t\t\t\t\t\tremove_add_(i+\"_year\");\n\t\t\t\t\t\tif(document.getElementById(i+\"_day\").value==\"\" || document.getElementById(i+\"_month\").value==\"\" || document.getElementById(i+\"_year\").value==\"\")\n\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\t\t\n\t\t}\n\t}\t\nfunction check_year2(id)\n{\n\tyear=document.getElementById(id).value;\t\n\tfrom=parseFloat(document.getElementById(id).getAttribute('from'));\t\n\tyear=parseFloat(year);\t\n\tif(year<from)\n\t{\n\t\tdocument.getElementById(id).value='';\n\t\talert('" . addslashes(__('The value of year is not valid', 'form_maker')) . "');\n\t}\n}\t\nfunction remove_add_(id)\n{\nattr_name= new Array();\nattr_value= new Array();\nvar input = document.getElementById(id); \natr=input.attributes;\nfor(v=0;v<30;v++)\n\tif(atr[v] )\n\t{\n\t\tif(atr[v].name.indexOf(\"add_\")==0)\n\t\t{\n\t\t\tattr_name.push(atr[v].name.replace('add_',''));\n\t\t\tattr_value.push(atr[v].value);\n\t\t\tinput.removeAttribute(atr[v].name);\n\t\t\tv--;\n\t\t}\n\t}\nfor(v=0;v<attr_name.length; v++)\n{\n\tinput.setAttribute(attr_name[v],attr_value[v])\n}\n}\t\nfunction getfileextension(id) \n{ \n var fileinput = document.getElementById(id+\"_element\"); \n var filename = fileinput.value; \n if( filename.length == 0 ) \n return true; \n var dot = filename.lastIndexOf(\".\"); \n var extension = filename.substr(dot+1,filename.length); \n var exten = document.getElementById(id+\"_extension\").value.replace(\"***extensionverj\"+id+\"***\", \"\").replace(\"***extensionskizb\"+id+\"***\", \"\");\n exten=exten.split(','); \n for(x=0 ; x<exten.length; x++)\n {\n  exten[x]=exten[x].replace(/\\./g,'');\n  exten[x]=exten[x].replace(/ /g,'');\n  if(extension.toLowerCase()==exten[x].toLowerCase())\n  \treturn true;\n }\n return false; \n} \nfunction check_required(but_type)\n{\n\tif(but_type=='reset')\n\t{\n\twindow.location.reload( true );\n\treturn;\n\t}\t\n\tn=" . $row->counter . ";\n\text_available=true;\n\tseted=true;\n\tfor(i=0; i<=n; i++)\n\t{\t\n\t\tif(seted)\n\t\t{\t\t\n\t\t\tif(document.getElementById(i))\n\t\t\t    if(document.getElementById(i+\"_required\"))\n\t\t\t\tif(document.getElementById(i+\"_required\").value==\"yes\")\n\t\t\t\t{\n\t\t\t\t\ttype=document.getElementById(i).getAttribute(\"type\");\n\t\t\t\t\tswitch(type)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase \"type_text\":\n\t\t\t\t\t\tcase \"type_password\":\n\t\t\t\t\t\tcase \"type_submitter_mail\":\n\t\t\t\t\t\tcase \"type_own_select\":\n\t\t\t\t\t\tcase \"type_country\":\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").value==document.getElementById(i+\"_element\").title || document.getElementById(i+\"_element\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"type_file_upload\":\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").value==\"\")\n\t\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\text_available=getfileextension(i);\n\t\t\t\t\t\t\t\tif(!ext_available)\n\t\t\t\t\t\t\t\t\tseted=false;\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"type_textarea\":\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").innerHTML==document.getElementById(i+\"_element\").title || document.getElementById(i+\"_element\").innerHTML==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"type_name\":\n\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\tif(document.getElementById(i+\"_element_title\"))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element_title\").value==\"\" || document.getElementById(i+\"_element_first\").value==\"\" || document.getElementById(i+\"_element_last\").value==\"\" || document.getElementById(i+\"_element_middle\").value==\"\")\n\t\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element_first\").value==\"\" || document.getElementById(i+\"_element_last\").value==\"\")\n\t\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\t\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"type_checkbox\":\n\t\t\t\t\t\tcase \"type_radio\":\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tis=true;\n\t\t\t\t\t\t\t\tfor(j=0; j<100; j++)\n\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\"+j))\n\t\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\"+j).checked)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tis=false;\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(is)\n\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\tcase \"type_time\":\n\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\tif(document.getElementById(i+\"_ss\"))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_ss\").value==\"\" || document.getElementById(i+\"_mm\").value==\"\" || document.getElementById(i+\"_hh\").value==\"\")\n\t\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_mm\").value==\"\" || document.getElementById(i+\"_hh\").value==\"\")\n\t\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\t\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"type_date\":\n\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_element\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"type_date_fields\":\n\t\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t\tif(document.getElementById(i+\"_day\").value==\"\" || document.getElementById(i+\"_month\").value==\"\" || document.getElementById(i+\"_year\").value==\"\")\n\t\t\t\t\t\t\t\t\tseted=false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\t\n\t\t\t\t\ttype=document.getElementById(i).getAttribute(\"type\");\n\t\t\t\t\tif(type==\"type_file_upload\")\n\t\t\t\t\t\text_available=getfileextension(i);\n\t\t\t\t\t\t\tif(!ext_available)\n\t\t\t\t\t\t\tseted=false;\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t}\n\t\telse\n\t\t{\t\t\n\t\t\tif(!ext_available)\n\t\t\t\t{alert('" . addslashes(__('Sorry, you are not allowed to upload this type of file', 'form_maker')) . "');\n\t\t\t\tbreak;}\t\t\t\n\t\t\tx=document.getElementById(i-1+'_element_label');\n\t\t\twhile(x.firstChild)\n\t\t\t{\n\t\t\t\tx=x.firstChild;\n\t\t\t}\n\t\t\talert(x.nodeValue+' " . addslashes(__('field is required', 'form_maker')) . "');\n\t\t\tbreak;\n\t\t}\t\t\n\t}\n\tif(seted)\n\tfor(i=0; i<=n; i++)\n\t{\t\n\t\tif(document.getElementById(i))\n\t\t\tif(document.getElementById(i).getAttribute(\"type\")==\"type_submitter_mail\")\n\t\t\t\tif (document.getElementById(i+\"_element\").value!='')\tif(document.getElementById(i+\"_element\").value.search(/^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+\$/) == -1)\n\t\t\t\t{\t\talert( \"" . addslashes(__('This is not a valid email address', 'form_maker')) . "\" );\t\n\t\t\t\t\t\t\treturn;\n\t\t\t\t}\t\n\t}\n\tif(seted)\n\t\tcreate_headers();\n}\t\nfunction create_headers()\n{\tform_=document.getElementById('form');\n\tn=" . $row->counter . ";\n\tfor(i=0; i<n; i++)\n\t{\tif(document.getElementById(i))\n\t\t{if(document.getElementById(i).getAttribute(\"type\")!=\"type_map\")\n\t\tif(document.getElementById(i).getAttribute(\"type\")!=\"type_captcha\")\n\t\tif(document.getElementById(i).getAttribute(\"type\")!=\"type_submit_reset\")\n\t\tif(document.getElementById(i).getAttribute(\"type\")!=\"type_button\")\n\t\t\tif(document.getElementById(i+'_element_label'))\n\t\t\t{\tvar input = document.createElement('input');\n\t\t\t\tinput.setAttribute(\"type\", 'hidden');\n\t\t\t\tinput.setAttribute(\"name\", i+'_element_label');\n\t\t\t\tinput.value=i;\n\t\t\t\tform_.appendChild(input);\n\t\t\t\tif(document.getElementById(i).getAttribute(\"type\")==\"type_date_fields\")\n\t\t\t\t{\t\tvar input = document.createElement('input');\n\t\t\t\t\t\tinput.setAttribute(\"type\", 'hidden');\n\t\t\t\t\t\tinput.setAttribute(\"name\", i+'_element');\t\t\t\t\tinput.value=document.getElementById(i+'_day').value+'-'+document.getElementById(i+'_month').value+'-'+document.getElementById(i+'_year').value;\n\t\t\t\t\tform_.appendChild(input);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\nform_.submit();\n}\t\n</script>\n</form></div>";
    }
    return $form_maker_front_end;
}