示例#1
0
} elseif ($err == 3) {
    $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);
示例#2
0
    $output .= '
	<h1><font class="error">' . $lang_realm['update_executed'] . '</font></h1>';
} elseif (4 == $err) {
    $output .= '
	<h1><font class="error">' . $lang_realm['update_err'] . '</font></h1>';
} 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);
示例#3
0
/**
 * Wrapper and actualiser to edit a realm. Does not return.
 *
 * @param  MEMBER		The member performing the action
 * @param  string		Name for the realm
 * @param  string		Name of the realm's troll
 * @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  ?MEMBER	The owner of the realm (NULL: same as $member_id)
 */
function edit_realm_wrap($member_id, $name, $troll_name, $qa, $private, $new_owner)
{
    if ($private != 1) {
        $private = 0;
    }
    if ($name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_NAME'), 'warn');
    }
    if (is_null($new_owner)) {
        $new_owner = $member_id;
    }
    if ($troll_name == '') {
        ocw_refresh_with_message(do_lang_tempcode('W_MISSING_TROLL_NAME'), 'warn');
    }
    $realm = $GLOBALS['SITE_DB']->query_value('w_members', 'location_realm', array('id' => $member_id));
    if (!has_specific_permission($member_id, 'administer_ocworld') && $GLOBALS['SITE_DB']->query_value('w_realms', 'owner', array('id' => $realm)) != $member_id) {
        ocw_refresh_with_message(do_lang_tempcode('ACCESS_DENIED__I_ERROR', $GLOBALS['FORUM_DRIVER']->get_username(get_member())), 'warn');
    }
    edit_realm($realm, $name, $troll_name, $qa, $private, $new_owner);
    ocw_refresh_with_message(do_lang_tempcode('SUCCESS'));
}