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


PHP check_su_access函数代码示例

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


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

示例1: translationwizard_run

function translationwizard_run()
{
    global $session, $logd_version, $coding;
    check_su_access(SU_IS_TRANSLATOR);
    //check again Superuser Access
    $op = httpget('op');
    page_header("Translation Wizard");
    //get some standards
    $languageschema = get_module_pref("language", "translationwizard");
    //these lines grabbed the local scheme, in 1.1.0 there is a setting for it
    $coding = getsetting("charset", "ISO-8859-1");
    $viewsimple = get_module_pref("view", "translationwizard");
    $mode = httpget('mode');
    $namespace = httppost('ns');
    $from = httpget('from');
    $page = get_module_setting(page);
    if (httpget('ns') != "" && $namespace == "") {
        $namespace = httpget('ns');
    }
    //if there is no post then there is maybe something to get
    $trans = httppost("transtext");
    if (is_array($trans)) {
        $transintext = $trans;
    } else {
        if ($trans) {
            $transintext = array($trans);
        } else {
            $transintext = array();
        }
    }
    $trans = httppost("transtextout");
    if (is_array($trans)) {
        $transouttext = $trans;
    } else {
        if ($trans) {
            $transouttext = array($trans);
        } else {
            $transouttext = array();
        }
    }
    //end of the header
    if ($op == "") {
        $op = "default";
    }
    require "./modules/translationwizard/errorhandler.php";
    require "./modules/translationwizard/{$op}.php";
    require_once "lib/superusernav.php";
    superusernav();
    require "./modules/translationwizard/build_nav.php";
    page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:51,代码来源:translationwizard.php

示例2: check_su_access

<?php

// Initially written as a module by Chris Vorndran.
// Moved into core by JT Traub
require_once "common.php";
require_once "lib/http.php";
check_su_access(SU_EDIT_CREATURES);
tlschema("masters");
$op = httpget('op');
$id = (int) httpget('id');
$act = httpget('act');
page_header("Masters Editor");
require_once "lib/superusernav.php";
superusernav();
if ($op == "del") {
    $sql = "DELETE FROM " . db_prefix("masters") . " WHERE creatureid={$id}";
    db_query($sql);
    output("`^Master deleted.`0");
    $op = "";
    httpset("op", "");
} elseif ($op == "save") {
    $name = addslashes(httppost('name'));
    $weapon = addslashes(httppost('weapon'));
    $win = addslashes(httppost('win'));
    $lose = addslashes(httppost('lose'));
    $lev = (int) httppost('level');
    if ($id != 0) {
        $sql = "UPDATE " . db_prefix("masters") . " SET creaturelevel={$lev}, creaturename='{$name}', creatureweapon='{$weapon}',  creaturewin='{$win}', creaturelose='{$lose}' WHERE creatureid={$id}";
    } else {
        $atk = $lev * 2;
        $def = $lev * 2;
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:masters.php

示例3: check_su_access

<?php

// translator ready
// addnews ready
// mail ready
// Written by Christian Rutsch
require_once "common.php";
require_once "lib/http.php";
check_su_access(SU_EDIT_CONFIG);
tlschema("gamelog");
page_header("Game Log");
addnav("Navigation");
require_once "lib/superusernav.php";
superusernav();
$category = httpget('cat');
if ($category > "") {
    $cat = "&cat={$category}";
    $sqlcat = "WHERE " . db_prefix("gamelog") . ".category = '{$category}'";
} else {
    $cat = '';
    $sqlcat = '';
}
$sql = "SELECT count(logid) AS c FROM " . db_prefix("gamelog") . " {$sqlcat}";
$result = db_query($sql);
$row = db_fetch_assoc($result);
$max = $row['c'];
$start = (int) httpget('start');
$sql = "SELECT " . db_prefix("gamelog") . ".*, " . db_prefix("accounts") . ".name AS name FROM " . db_prefix("gamelog") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("gamelog") . ".who = " . db_prefix("accounts") . ".acctid {$sqlcat} LIMIT {$start},500";
$next = $start + 500;
$prev = $start - 500;
addnav("Operations");
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:gamelog.php

示例4: check_su_access

<?php

// addnews ready
// translator ready
// mail ready
require_once "common.php";
require_once "lib/http.php";
require_once "lib/sanitize.php";
check_su_access(SU_MANAGE_MODULES);
tlschema("modulemanage");
page_header("Module Manager");
require_once "lib/superusernav.php";
superusernav();
addnav("Module Categories");
addnav("", $REQUEST_URI);
$op = httpget('op');
$module = httpget('module');
if ($op == 'mass') {
    if (httppost("activate")) {
        $op = "activate";
    }
    if (httppost("deactivate")) {
        $op = "deactivate";
    }
    if (httppost("uninstall")) {
        $op = "uninstall";
    }
    if (httppost("reinstall")) {
        $op = "reinstall";
    }
    if (httppost("install")) {
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:modules.php

示例5: addcommentary

<?php

require_once "common.php";
require_once "lib/commentary.php";
require_once "lib/sanitize.php";
require_once "lib/http.php";
// tlschema("moderate");
addcommentary();
check_su_access(SU_EDIT_COMMENTS);
global $moderating;
$moderating = 1;
page_header("Comment Moderation");
// First, set up the left column navs. These don't change.
require_once "lib/superusernav.php";
superusernav();
addnav("B?Player Bios", "bios.php");
addnav("Overviews");
addnav("Recent Comments", "moderate.php");
addnav("Natters", "moderate.php?op=bio");
addnav("Lookups");
addnav("Dwellings", "moderate.php?op=dwell");
addnav("World Map", "moderate.php?op=map");
// addnav("Natters","moderate.php?op=bio");
// Get section and display names from other modules with chat spaces
$mods = array();
$mods = modulehook("moderate", $mods);
reset($mods);
// One of the outposts is "village" and the rest are from race modules
// Let's get them all into one array.
$cities = array();
$vname = getsetting("villagename", LOCATION_FIELDS);
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:moderate.php

示例6: check_su_access

<?php

// translator ready
// addnews ready
// mail ready
require_once "common.php";
require_once "lib/commentary.php";
require_once "lib/sanitize.php";
require_once "lib/http.php";
check_su_access(4294967295.0 & ~SU_DOESNT_GIVE_GROTTO);
addcommentary();
tlschema("superuser");
require_once "lib/superusernav.php";
superusernav();
$op = httpget('op');
if ($op == "keepalive") {
    $sql = "UPDATE " . db_prefix("accounts") . " SET laston='" . date("Y-m-d H:i:s") . "' WHERE acctid='{$session['user']['acctid']}'";
    db_query($sql);
    global $REQUEST_URI;
    echo '<html><meta http-equiv="Refresh" content="30;url=' . $REQUEST_URI . '"></html><body>' . date("Y-m-d H:i:s") . "</body></html>";
    exit;
} elseif ($op == "newsdelete") {
    $sql = "DELETE FROM " . db_prefix("news") . " WHERE newsid='" . httpget('newsid') . "'";
    db_query($sql);
    $return = httpget('return');
    $return = cmd_sanitize($return);
    $return = substr($return, strrpos($return, "/") + 1);
    redirect($return);
}
page_header("Superuser Grotto");
output("`^You duck into a secret cave that few know about. ");
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:superuser.php

示例7: define

<?php

// addnews ready
// translator ready
// mail ready
define("OVERRIDE_FORCED_NAV", true);
require_once "common.php";
tlschema("translatortool");
check_su_access(SU_IS_TRANSLATOR);
$op = httpget("op");
if ($op == "") {
    popup_header("Translator Tool");
    $uri = rawurldecode(httpget('u'));
    $text = stripslashes(rawurldecode(httpget('t')));
    $translation = translate_loadnamespace($uri);
    if (isset($translation[$text])) {
        $trans = $translation[$text];
    } else {
        $trans = "";
    }
    $namespace = translate_inline("Namespace:");
    $texta = translate_inline("Text:");
    $translation = translate_inline("Translation:");
    $saveclose = htmlentities(translate_inline("Save & Close"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
    $savenotclose = htmlentities(translate_inline("Save No Close"), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
    rawoutput("<form action='translatortool.php?op=save' method='POST'>");
    rawoutput("{$namespace} <input name='uri' value=\"" . htmlentities(stripslashes($uri), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\" readonly><br/>");
    rawoutput("{$texta}<br>");
    rawoutput("<textarea name='text' cols='60' rows='5' readonly>" . htmlentities($text, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "</textarea><br/>");
    rawoutput("{$translation}<br>");
    rawoutput("<textarea name='trans' cols='60' rows='5'>" . htmlentities(stripslashes($trans), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "</textarea><br/>");
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:translatortool.php

示例8: tlschema

<?php

// translator ready
// addnews ready
// mail ready
require_once "common.php";
require_once "lib/commentary.php";
require_once "lib/http.php";
tlschema("petition");
check_su_access(SU_EDIT_PETITIONS);
addcommentary();
//WHEN 0 THEN 2 WHEN 1 THEN 3 WHEN 2 THEN 7 WHEN 3 THEN 5 WHEN 4 THEN 1 WHEN 5 THEN 0 WHEN 6 THEN 4 WHEN 7 THEN 6
$statuses = array(5 => "`\$Top Level`0", 4 => "`^Escalated`0", 0 => "`bUnhandled`b", 1 => "In-Progress", 6 => "`%Bug`0", 7 => "`#Awaiting Points`0", 3 => "`!Informational`0", 2 => "`iClosed`i");
//$statuses = modulehook("petition-status", $status);
$statuses = translate_inline($statuses);
$op = httpget("op");
$id = httpget("id");
if (trim(httppost('insertcommentary')) != "") {
    /* Update the bug if someone adds comments as well */
    $sql = "UPDATE " . db_prefix("petitions") . " SET closeuserid='{$session['user']['acctid']}',closedate='" . date("Y-m-d H:i:s") . "' WHERE petitionid='{$id}'";
    db_query($sql);
}
// Eric decide he didn't want petitions to be manually deleted
//
//if ($op=="del"){
//  $sql = "DELETE FROM " . db_prefix("petitions") . " WHERE petitionid='$id'";
//  db_query($sql);
//  $sql = "DELETE FROM " . db_prefix("commentary") . " WHERE section='pet-$id'";
//  db_query($sql);
//  invalidatedatacache("petition_counts");
//  $op="";
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:viewpetition.php

示例9: check_su_access

<?php

// translator ready
// addnews ready
// mail ready
require_once "common.php";
require_once "lib/commentary.php";
require_once "lib/sanitize.php";
require_once "lib/http.php";
check_su_access(0xffffffff & ~SU_DOESNT_GIVE_GROTTO);
addcommentary();
tlschema("superuser");
require_once "lib/superusernav.php";
superusernav();
$op = httpget('op');
if ($op == "keepalive") {
    $sql = "UPDATE " . db_prefix("accounts") . " SET laston='" . date("Y-m-d H:i:s") . "' WHERE acctid='{$session['user']['acctid']}'";
    db_query($sql);
    global $REQUEST_URI;
    echo '<html><meta http-equiv="Refresh" content="30;url=' . $REQUEST_URI . '"></html><body>' . date("Y-m-d H:i:s") . "</body></html>";
    exit;
} elseif ($op == "newsdelete") {
    $sql = "DELETE FROM " . db_prefix("news") . " WHERE newsid='" . httpget('newsid') . "'";
    db_query($sql);
    $return = httpget('return');
    $return = cmd_sanitize($return);
    $return = substr($return, strrpos($return, "/") + 1);
    redirect($return);
}
page_header("Superuser Grotto");
output("`^You duck into a secret cave that few know about. ");
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:superuser.php

示例10: check_su_access

<?php

// translator ready
// addnews ready
// mail ready
require_once "common.php";
require_once "lib/http.php";
require_once "lib/systemmail.php";
check_su_access(SU_EDIT_DONATIONS);
tlschema("donation");
page_header("Donator's Page");
require_once "lib/superusernav.php";
superusernav();
$ret = httpget('ret');
$return = cmd_sanitize($ret);
$return = substr($return, strrpos($return, "/") + 1);
tlschema("nav");
addnav("Return whence you came", $return);
tlschema();
$add = translate_inline("Add Donation");
rawoutput("<form action='donators.php?op=add1&ret=" . rawurlencode($ret) . "' method='POST'>");
addnav("", "donators.php?op=add1&ret=" . rawurlencode($ret) . "");
$name = httppost("name");
if ($name == "") {
    $name = httpget("name");
}
$amt = httppost("amt");
if ($amt == "") {
    $amt = httpget("amt");
}
$reason = httppost("reason");
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:donators.php

示例11: jquerycommentary_run

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

示例12: charrestore_run

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: ");
        rawoutput("<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='{$user['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: ");
            rawoutput("<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='" . (httppost('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");
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:charrestore.php

示例13: drinks_editor

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");
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:misc_functions.php

示例14: riddles_editor

function riddles_editor()
{
    global $session;
    require_once "lib/nltoappon.php";
    if (!get_module_pref("canedit")) {
        check_su_access(SU_EDIT_RIDDLES);
    }
    $op = httpget('op');
    $id = httpget('id');
    page_header("Riddle Editor");
    require_once "lib/superusernav.php";
    superusernav();
    addnav("Riddle Editor");
    addnav("Riddle Editor Home", "runmodule.php?module=riddles&act=editor&admin=true");
    addnav("Add a riddle", "runmodule.php?module=riddles&act=editor&op=edit&admin=true");
    if ($op == "save") {
        $id = httppost('id');
        $riddle = trim(httppost('riddle'));
        $answer = trim(httppost('answer'));
        if ($id > "") {
            $sql = "UPDATE " . db_prefix("riddles") . " SET riddle='" . nltoappon($riddle) . "', answer='{$answer}' WHERE id='{$id}'";
        } else {
            $sql = "INSERT INTO " . db_prefix("riddles") . " (riddle,answer,author) VALUES('" . nltoappon($riddle) . "','{$answer}','{$session['user']['login']}')";
        }
        db_query($sql);
        if (db_affected_rows() > 0) {
            $op = "";
            httpset("op", "");
            output("Riddle saved.");
        } else {
            output("The query was not executed for some reason I can't fathom.");
            output("Perhaps you didn't actually make any changes to the riddle.");
        }
    } elseif ($op == "del") {
        $sql = "DELETE FROM " . db_prefix("riddles") . " WHERE id='{$id}'";
        db_query($sql);
        $op = "";
        httpset("op", "");
        output("Riddle deleted.");
    }
    if ($op == "") {
        $sql = "SELECT * FROM " . db_prefix("riddles");
        $result = db_query($sql);
        $i = translate_inline("Id");
        $ops = translate_inline("Ops");
        $rid = translate_inline("Riddle");
        $ans = translate_inline("Answer");
        $auth = translate_inline("Author");
        rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'><tr class='trhead'><td>{$i}</td><td>{$ops}</td><td>{$rid}</td><td>{$ans}</td><td>{$auth}</td></tr>");
        for ($i = 0; $i < db_num_rows($result); $i++) {
            $row = db_fetch_assoc($result);
            rawoutput("<tr class='" . ($i % 2 ? "trlight" : "trdark") . "'>");
            rawoutput("<td valign='top'>");
            output_notl("%s", $row['id']);
            rawoutput("</td><td valign='top'>");
            $conf = translate_inline("Are you sure you wish to delete this riddle?");
            $edit = translate_inline("Edit");
            $del = translate_inline("Delete");
            $elink = "runmodule.php?module=riddles&act=editor&op=edit&id=" . $row['id'] . "&admin=true";
            $dlink = "runmodule.php?module=riddles&act=editor&op=del&id=" . $row['id'] . "&admin=true";
            output_notl("[");
            rawoutput("<a href='{$elink}'>{$edit}</a>");
            output_notl("|");
            rawoutput("<a href='{$dlink}' onClick='return confirm(\"{$conf}\");'>{$del}</a>");
            output_notl("]");
            addnav("", $elink);
            addnav("", $dlink);
            rawoutput("</td><td valign='top'>");
            output_notl("`&%s`0", $row['riddle']);
            rawoutput("</td><td valign='top'>");
            output_notl("`#%s`0", $row['answer']);
            rawoutput("</td><td valign='top'>");
            output_notl("`^%s`0", $row['author']);
            rawoutput("</td></tr>");
        }
        rawoutput("</table>");
    } elseif ($op == "edit") {
        $sql = "SELECT * FROM " . db_prefix("riddles") . " WHERE id='{$id}'";
        $result = db_query($sql);
        rawoutput("<form action='runmodule.php?module=riddles&act=editor&op=save&admin=true' method='POST'>", true);
        addnav("", "runmodule.php?module=riddles&act=editor&op=save&admin=true");
        if ($row = db_fetch_assoc($result)) {
            output("`bEdit a riddle`b`n");
            $title = "Edit a riddle";
            $i = $row['id'];
            rawoutput("<input type='hidden' name='id' value='{$i}'>");
        } else {
            output("`bAdd a riddle`b`n");
            $title = "Add a riddle";
            $row = array("riddle" => "", "answer" => "", "author" => $session['user']['login']);
        }
        $form = array("Riddle,title", "riddle" => "Riddle text,textarea", "answer" => "Answer", "author" => "Author,viewonly");
        require_once "lib/showform.php";
        showform($form, $row);
        rawoutput("</form>");
        output("`^NOTE:`& Separate multiple correct answers with semicolons (;)`n`n");
        output("`7The following are ignored at the start of answers: `&a, an, and, the, my, your, someones, someone's, someone, his, hers`n");
        output("`7The following are ignored at the end of answers: `&s, ing, ed`0`n`n");
        output("`\$NOTE:  Riddles are displayed in the language they are stored in the database.");
        output("Similarly, answers are expected in the language stored in the database.");
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:riddles.php

示例15: httpget

<?php

$mode = httpget("mode");
require_once "lib/superusernav.php";
superusernav();
check_su_access(SU_AUDIT_MODERATION);
switch ($mode) {
    case "invalidate":
        $search = httppost('search');
        $who = httpget('who');
        if ($who == '') {
            $send = translate_inline("Search");
            output("Whose avatar do you want to invalidate?`n`n");
            rawoutput("<form method='POST' action='runmodule.php?module=avatar&op=validate&mode=invalidate'>");
            rawoutput("<input name='search' type='text' size='40' value={$search}>");
            rawoutput("<input type='submit' class='button' value={$send}>");
            rawoutput("</form>");
            addnav("", "runmodule.php?module=avatar&op=validate&mode=invalidate");
            output_notl("`n`n");
            if ($search) {
                $name = "%" . $search . "%";
                $sql = "SELECT u.userid AS acctid,k.name as name, k.login as login FROM " . db_prefix("module_userprefs") . " AS u INNER JOIN " . db_prefix("module_userprefs") . " AS t RIGHT JOIN " . db_prefix("accounts") . " as k ON u.userid=t.userid AND k.acctid=u.userid WHERE u.modulename='avatar' AND u.setting='avatar' AND u.value!='' AND t.modulename='avatar' AND t.setting='validated' AND t.value='1' AND (k.name LIKE '{$name}' OR k.login LIKE '{$name}');";
                $result = db_query($sql);
                if (db_num_rows($result) > 100) {
                    output("There are more than 100 matches. Please specify the user a bit more.");
                    addnav("runmodule.php?module=avatar&op=validate&mode=invalidate");
                    break;
                }
                if (db_num_rows($result) == 0) {
                    output("No user with a valid personal avatar found matching this criteria.");
                } else {
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:validate.php


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