コード例 #1
0
ファイル: realm.php プロジェクト: xhaher/CoreManager
    $output .= '
            <h1><span class="error">' . lang("realm", "update_executed") . '</span></h1>';
} elseif ($err == 4) {
    $output .= '
            <h1><span class="error">' . lang("realm", "update_err") . '</span></h1>';
} else {
    $output .= '
            <h1>' . lang("realm", "realm_data") . '</h1>';
}
unset($err);
$output .= '
          </div>';
$action = isset($_GET["action"]) ? $_GET["action"] : NULL;
if ($action == "edit_realm") {
    edit_realm();
} elseif ($action == "doedit_realm") {
    doedit_realm();
} elseif ($action == "del_realm") {
    del_realm();
} elseif ($action == "dodel_realm") {
    dodel_realm();
} elseif ($action == "add_realm") {
    add_realm();
} elseif ($action == "set_def_realm") {
    set_def_realm();
} else {
    show_realm();
}
unset($action);
unset($action_permission);
require_once "footer.php";
コード例 #2
0
ファイル: realm.php プロジェクト: BACKUPLIB/Infinity_MaNGOS
} else {
    $output .= '
	<h1>' . $lang_realm['realm_data'] . '</h1>';
}
$output .= '
</div>';
// $_GET and SECURE
$action = isset($_GET['action']) ? $_GET['action'] : NULL;
// define functions to be called by actions
if ('edit_realm' === $action) {
    edit_realm($sqlr);
} elseif ('doedit_realm' === $action) {
    doedit_realm($sqlr);
} elseif ('del_realm' === $action) {
    del_realm($sqlr);
} elseif ('dodel_realm' === $action) {
    dodel_realm($sqlr);
} elseif ('add_realm' === $action) {
    add_realm($sqlr);
} elseif ('set_def_realm' === $action) {
    set_def_realm($sqlr);
} else {
    show_realm($sqlr);
}
// close whats not needed anymore
unset($err);
unset($action);
unset($action_permission);
unset($lang_realm);
// page footer
require_once 'footer.php';
コード例 #3
0
ファイル: ocworld_action.php プロジェクト: erico-deh/ocPortal
/**
 * Wrapper and actualiser to add a realm. Does not return.
 *
 * @param  ?MEMBER	The member performing the action (NULL: no member)
 * @param  string		Name for the realm
 * @param  string		Name of the realm's troll
 * @param  string		Name of the jail room
 * @param  string		Text for the jail room
 * @param  URLPATH	The picture for the jail room
 * @param  string		Name of the jail house room
 * @param  string		Text for the jail house room
 * @param  URLPATH	The picture for the jail house room
 * @param  string		Name of the lobby room
 * @param  string		Text for the lobby room
 * @param  URLPATH	The picture for the lobby room
 * @param  array		List of maps (holding 'q' and 'a') for the trolls questions and answers. Must consist of indices 1 to 30. Blank entries mean 'not set'.
 * @param  BINARY		Whether the realm is private
 * @param  boolean	Whether to redirect after
 */
function add_realm_wrap($member_id, $name, $troll_name, $jail_name, $jail_text, $jail_pic_url, $jail_house_name, $jail_house_text, $jail_house_pic_url, $lobby_name, $lobby_text, $lobby_pic_url, $qa, $private, $redirect = true)
{
    if ($private != 1) {
        $private = 0;
    }
    if ($name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_NAME'), 'warn');
    }
    if ($troll_name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_TROLL_NAME'), 'warn');
    }
    if ($jail_house_name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_SPECIAL_ROOM_NAME'), 'warn');
    }
    if ($lobby_name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_SPECIAL_ROOM_NAME'), 'warn');
    }
    if ($jail_name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_SPECIAL_ROOM_NAME'), 'warn');
    }
    // Charge them
    if (!is_null($member_id) && !has_specific_permission($member_id, 'administer_ocworld')) {
        // Have they been a member long enough for a new realm?
        $fortnights = (time() - $GLOBALS['FORUM_DRIVER']->get_member_join_timestamp($member_id)) / (60 * 60 * 24 * 7 * 2);
        $made = $GLOBALS['SITE_DB']->query_value('w_realms', 'COUNT(*)', array('owner' => $member_id));
        if ($fortnights < $made) {
            ocw_refresh_with_message(do_lang_tempcode('W_MEMBER_NOT_LONG_ENOUGH'), 'warn');
        }
        $price = get_price('mud_realm');
        if (available_points($member_id) < $price) {
            ocw_refresh_with_message(do_lang_tempcode('W_EXPENSIVE', integer_format($price)), 'warn');
        }
        require_code('points2');
        charge_member($member_id, $price, do_lang('W_MADE_REALM_OCWORLD', $name));
    }
    // Find the next available $realm
    $temp = $GLOBALS['SITE_DB']->query_value_null_ok('w_realms', 'id');
    if (is_null($temp)) {
        $realm = 0;
        // Our first realm
    } else {
        $temp = $GLOBALS['SITE_DB']->query_value('w_realms', 'MAX(id)');
        $realm = $temp + 1;
    }
    add_realm($realm, $name, $troll_name, $qa, $member_id, $private);
    // Add realms default rooms
    add_room($jail_name, $realm, 0, 2, $jail_text, '', '', '', '', 0, 1, 1, 1, $jail_pic_url, $member_id, 1);
    // Add jail
    add_room($jail_house_name, $realm, 0, 1, $jail_house_text, do_lang('W_DEFAULT_JAIL_TEXT'), 'yes', do_lang('W_DEFAULT_CANCEL'), 'BRIBE', 0, 0, 1, 1, $jail_house_pic_url, $member_id, 0);
    // Add jailhouse
    add_room($lobby_name, $realm, 0, 0, $lobby_text, '', '', '', '', 0, 0, 0, 0, $lobby_pic_url, $member_id, 1);
    // Add lobby
    // Add troll
    $troll_id = -$realm - 1;
    $GLOBALS['SITE_DB']->query_insert('w_members', array('id' => $troll_id, 'location_realm' => $realm, 'location_x' => 0, 'location_y' => 0, 'banned' => 0, 'health' => 1000, 'trolled' => 0, 'lastactive' => time()));
    if ($redirect) {
        ocw_refresh_with_message(do_lang_tempcode('W_REALM_CREATED', escape_html($name), strval($realm)));
    }
}