function worldmapen_install() { if (!is_module_installed("cities")) { output("`b`^***** This module requires the Multiple Cities module to be installed. *****`b`7"); return false; } else { module_addhook("village"); module_addhook("villagenav"); module_addhook("mundanenav"); module_addhook("superuser"); module_addhook("pvpcount"); module_addhook("footer-gypsy"); module_addhook("count-travels"); module_addhook("changesetting"); module_addhook("boughtmount"); module_addhook("newday"); module_addhook("items-returnlinks"); } if (is_module_installed("staminasystem")) { require_once 'modules/staminasystem/lib/lib.php'; install_action("Travelling - Plains", array("maxcost" => 5000, "mincost" => 2500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 25, "class" => "Travelling")); install_action("Travelling - Jungle", array("maxcost" => 10000, "mincost" => 4000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 60, "class" => "Travelling")); install_action("Travelling - River", array("maxcost" => 15000, "mincost" => 5000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 100, "class" => "Travelling")); install_action("Travelling - Ocean", array("maxcost" => 25000, "mincost" => 7500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 175, "class" => "Travelling")); install_action("Travelling - Mountains", array("maxcost" => 20000, "mincost" => 6000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 140, "class" => "Travelling")); install_action("Travelling - Snow", array("maxcost" => 25000, "mincost" => 7500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 175, "class" => "Travelling")); install_action("Travelling - Beach", array("maxcost" => 5000, "mincost" => 2500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 25, "class" => "Travelling")); install_action("Travelling - Swamp", array("maxcost" => 12500, "mincost" => 5000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 75, "class" => "Travelling")); } return true; }
function hepzibah_runevent($type) { global $session; $from = "village.php?"; // Since there is no interaction here, don't even set this //$session['user']['specialinc'] = "module:Hepzibah"; $voucher = get_module_pref("voucher", "marquee"); $city = $session['user']['location']; $op = httpget('op'); // Since the text in both cases is mostly the same, make it common output("`7As you're walking around, admiring the sights, a wizened old woman approaches.`n`n"); output("Her greying hair stands out in shock, and her nose is hooked and gnarled."); output("It takes all your willpower not to run away from this ghastly sight.`n`n"); output("She smiles the most evil looking smile you have ever encountered.`n`n"); output("`&\"Hello, warrior!"); if (!is_module_installed("marquee") || $voucher) { output("Enjoying your visit?\"`n`n"); output("`7Before you can answer, she has wandered off towards another tourist.`n`n"); output("`7You shudder and head away quickly.`n`n"); } elseif ($op == "" && !$voucher) { output("For you, a gift!\"`n`n"); output("`7Before you can protest, she has grabbed your wrist, and placed a small voucher into your hand."); output("It reads, `Q\"One Free Pizza at the Marquee\".`n`n"); output("`&\"Enjoy your stay in {$city}, warrior!\" `7she says, before wandering off towards another tourist.`n`n"); set_module_pref("voucher", 1, "marquee"); } // Since we never set the special inc, we don't need to unset it. //if ($op != "") { // $session['user']['specialinc'] = ""; //} }
function scry_install() { if (!is_module_installed("cities")) { output("`\$This module requires the multiple villages mod to be installed before it is used.`0"); return false; } module_addhook("gypsy"); module_addhook("commentary"); return true; }
function marriage_lovedrinksrem() { if (is_module_installed('drinks')) { $ladd = array(); $ladd[] = "Love Brew"; $ladd[] = "Heart Mist"; foreach ($ladd as $val) { $sql = "DELETE FROM " . db_prefix("drinks") . " WHERE name='{$val}'"; db_query($sql); } } }
function install_module($module, $force = true) { global $mostrecentmodule, $session; $name = $session['user']['name']; if (!$name) { $name = '`@System`0'; } require_once "lib/sanitize.php"; if (modulename_sanitize($module) != $module) { output("Error, module file names can only contain alpha numeric characters and underscores before the trailing .php`n`nGood module names include 'testmodule.php', 'joesmodule2.php', while bad module names include, 'test.module.php' or 'joes module.php'`n"); return false; } else { // If we are forcing an install, then whack the old version. if ($force) { $sql = "DELETE FROM " . db_prefix("modules") . " WHERE modulename='{$module}'"; db_query($sql); } // We want to do the inject so that it auto-upgrades any installed // version correctly. if (injectmodule($module, true)) { // If we're not forcing and this is already installed, we are done if (!$force && is_module_installed($module)) { return true; } $info = get_module_info($module); //check installation requirements if (!module_check_requirements($info['requires'])) { output("`\$Module could not installed -- it did not meet its prerequisites.`n"); return false; } else { $keys = "|" . join(array_keys($info), "|") . "|"; $sql = "INSERT INTO " . db_prefix("modules") . " (modulename,formalname,moduleauthor,active,filename,installdate,installedby,category,infokeys,version,download,description) VALUES ('{$mostrecentmodule}','" . addslashes($info['name']) . "','" . addslashes($info['author']) . "',0,'{$mostrecentmodule}.php','" . date("Y-m-d H:i:s") . "','" . addslashes($name) . "','" . addslashes($info['category']) . "','{$keys}','" . addslashes($info['version']) . "','" . addslashes($info['download']) . "', '" . addslashes($info['description']) . "')"; db_query($sql); $fname = $mostrecentmodule . "_install"; if (isset($info['settings']) && count($info['settings']) > 0) { foreach ($info['settings'] as $key => $val) { if (is_array($val)) { $x = explode("|", $val[0]); } else { $x = explode("|", $val); } if (isset($x[1])) { $x[1] = trim($x[1]); set_module_setting($key, $x[1]); debug("Setting {$key} to default {$x[1]}"); } } } if ($fname() === false) { return false; } output("`^Module installed. It is not yet active.`n"); invalidatedatacache("inject-{$mostrecentmodule}"); massinvalidate("moduleprepare"); return true; } } else { output("`\$Module could not be injected."); output("Module not installed."); output("This is probably due to the module file having a parse error or not existing in the filesystem.`n"); return false; } } }
<?php if (is_module_installed('traductions')) { $this->load->helper('form'); ?> <div class="form-group"> <label>Langue</label> <?php echo form_dropdown(array('class' => 'form-control', 'id' => 'lang', 'name' => 'lang'), array('fr' => 'Français', 'en' => 'Anglais', 'ru' => 'Russe'), $lang); ?> <script type="text/javascript"> $('#lang').change(function(){ window.location = "<?php echo current_url(); ?> ?lang="+$(this).val(); }); </script> </div> <?php } ?> <div class="form-group"> <label>Titre</label> <input type="text" id="blog_add_message_title" name="title" value="<?php echo isset($blogpost_add_pop['title']) ? $blogpost_add_pop['title'] : ''; ?> "
function charrestore_run() { check_su_access(SU_EDIT_USERS); require_once "lib/superusernav.php"; page_header("Character Restore"); superusernav(); addnav("Functions"); addnav("Search", "runmodule.php?module=charrestore&op=list"); if (httpget("op") == "list") { output("Please note that only characters who have reached at least level %s in DK %s will have been saved!`n`n", get_module_setting("lvl_threshold"), get_module_setting("dk_threshold")); rawoutput("<form action='runmodule.php?module=charrestore&op=list' method='POST'>"); addnav("", "runmodule.php?module=charrestore&op=list"); output("Character Login: "******"<input name='login' value=\"" . htmlentities(stripslashes(httppost("login")), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\"><br>"); output("After date: "); rawoutput("<input name='start' value=\"" . htmlentities(stripslashes(httppost("start")), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\"><br>"); output("Before date: "); rawoutput("<input name='end' value=\"" . htmlentities(stripslashes(httppost("end")), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\"><br>"); $submit = translate_inline("Submit"); rawoutput("<input type='submit' value='{$submit}' class='button'>"); rawoutput("</form>"); //do the search. $login = httppost("login"); $start = httppost("start"); $end = httppost("end"); if ($start > "") { $start = strtotime($start); } if ($end > "") { $end = strtotime($end); } if ($login . $start . $end > "") { $path = charrestore_getstorepath(); debug($path); $d = dir($path); $count = 0; while (($entry = $d->read()) !== false) { $e = explode("|", $entry); if (count($e) < 2) { continue; } $name = str_replace("_", " ", $e[0]); $date = strtotime($e[1]); if ($login > "") { if (strpos(strtolower($name), strtolower($login)) === false) { continue; } } if ($start > "") { if ($date < $start) { continue; } } if ($end > "") { if ($date > $end) { continue; } } $count++; rawoutput("<a href='runmodule.php?module=charrestore&op=beginrestore&file=" . rawurlencode($entry) . "'>{$name}</a> (" . date("M d, Y", $date) . ")<br>"); addnav("", "runmodule.php?module=charrestore&op=beginrestore&file=" . rawurlencode($entry)); } if ($count == 0) { output("No characters matching the specified criteria were found."); } } } elseif (httpget("op") == "beginrestore") { $user = unserialize(join("", file(charrestore_getstorepath() . httpget("file")))); $sql = "SELECT count(*) AS c FROM " . db_prefix("accounts") . " WHERE login='******'account']['login']}'"; $result = db_query($sql); $row = db_fetch_assoc($result); rawoutput("<form action='runmodule.php?module=charrestore&op=finishrestore&file=" . rawurlencode(stripslashes(httpget("file"))) . "' method='POST'>"); addnav("", "runmodule.php?module=charrestore&op=finishrestore&file=" . rawurlencode(stripslashes(httpget("file")))); if ($row['c'] > 0) { output("`\$The user's login conflicts with an existing login in the system."); output("You will have to provide a new one, and you should probably think about giving them a new name after the restore.`n"); output("`^New Login: "******"<input name='newlogin'><br>"); } $yes = translate_inline("Do the restore"); rawoutput("<input type='submit' value='{$yes}' class='button'>"); output("`n`#Some user info:`0`n"); $vars = array("login" => "Login", "name" => "Name", "laston" => "Last On", "email" => "Email", "dragonkills" => "DKs", "level" => "Level", "gentimecount" => "Total hits"); while (list($key, $val) = each($vars)) { output("`^{$val}: `#%s`n", $user['account'][$key]); } rawoutput("<input type='submit' value='{$yes}' class='button'>"); rawoutput("</form>"); } elseif (httpget("op") == "finishrestore") { $user = unserialize(join("", file(charrestore_getstorepath() . httpget("file")))); $sql = "SELECT count(*) AS c FROM " . db_prefix("accounts") . " WHERE login='******'newlogin') > '' ? httppost('newlogin') : $user['account']['login']) . "'"; $result = db_query($sql); $row = db_fetch_assoc($result); if ($row['c'] > 0) { redirect("runmodule.php?module=charrestore&op=beginrestore&file=" . rawurlencode(stripslashes(httpget("file")))); } else { if (httppost("newlogin") > "") { $user['account']['login'] = httppost('newlogin'); } $sql = "DESCRIBE " . db_prefix("accounts"); $result = db_query($sql); $known_columns = array(); while ($row = db_fetch_assoc($result)) { $known_columns[$row['Field']] = true; } $keys = array(); $vals = array(); while (list($key, $val) = each($user['account'])) { if ($key == "laston") { array_push($keys, $key); array_push($vals, "'" . date("Y-m-d H:i:s", strtotime("-1 day")) . "'"); } elseif (!isset($known_columns[$key])) { output("`2Dropping the column `^%s`n", $key); } else { array_push($keys, $key); array_push($vals, "'" . addslashes($val) . "'"); } } $sql = "INSERT INTO " . db_prefix("accounts") . " (\n" . join("\t,\n", $keys) . ") VALUES (\n" . join("\t,\n", $vals) . ")"; db_query($sql); $id = db_insert_id(); if ($id > 0) { addnav("Edit the restored user", "user.php?op=edit&userid={$id}"); if ($id != $user['account']['acctid']) { output("`^The account was restored, though the account ID was not preserved; things such as news, mail, comments, debuglog, and other items associated with this account that were not stored as part of the snapshot have lost their association."); output("The original ID was `&%s`^, and the new ID is `&%s`^.", $user['account']['acctid'], $id); output("The most common cause of this problem is another account already present with the same ID."); output("Did you do a restore of an already existing account? If so, the existing account was not overwritten.`n"); } else { output("`#The account was restored.`n"); } output("`#Now working on module preferences.`n"); while (list($modulename, $values) = each($user['prefs'])) { output("`3Module: `2%s`3...`n", $modulename); if (is_module_installed($modulename)) { while (list($prefname, $value) = each($values)) { set_module_pref($prefname, $value, $modulename, $id); } } else { output("`\$Skipping prefs for module `^%s`\$ because this module is not currently installed.`n", $modulename); } } output("`#The preferences were restored.`n"); } else { output("`\$Something funky has happened, preventing this account from correctly being created."); output("I'm sorry, you may have to recreate this account by hand."); output("The SQL I tried was:`n"); rawoutput("<pre>" . htmlentities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "</pre>"); } } } page_footer(); }