本文整理汇总了PHP中Form::end方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::end方法的具体用法?PHP Form::end怎么用?PHP Form::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main_page
function main_page($enabled)
{
$form = new Form('index.php?module=cloudflare-ipv46&action=change', 'post');
$form_container = new FormContainer("IPv6 Support");
$form_container->output_row('IPv6 Support', 'Enable IPv6 support and gateway', $form->generate_yes_no_radio('enable_ipv6', $enabled ? "1" : "0"));
$form_container->end();
$buttons[] = $form->generate_submit_button('Submit');
$form->output_submit_wrapper($buttons);
$form->end();
}
示例2: main_page
function main_page($current_cache_level, $modified_on)
{
$form = new Form('index.php?module=cloudflare-cache_lvl&action=change', 'post');
$form_container = new FormContainer('Modify Cache Level');
$form_container->output_row('Cache Level', "Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript). The simplified setting will ignore the query string when delivering a cached resource. The aggressive setting will cache all static resources, including ones with a query string. ", $form->generate_select_box('cache_level', array('basic' => 'Basic', 'simplified' => 'Simplified', 'aggressive' => 'Aggressive'), $current_cache_level));
$form_container->end();
$buttons[] = $form->generate_submit_button('Submit');
$form->output_submit_wrapper($buttons);
$form->end();
}
示例3: request
protected function request()
{
$f = new Form();
$f->start($_POST);
$f->radio('dest', 'Screen', 'screen');
$f->hspace(2);
$f->radio('dest', 'PDF', 'pdf', false);
$f->button('action_report', 'Report');
$f->end();
}
示例4: main_page
function main_page()
{
$form = new Form("index.php?module=cloudflare-challenge&action=add_ip", "post");
$form_container = new FormContainer("Challenge an IP");
$form_container->output_row("IP Address", "The IP address won't be able to access your site until they have completed the captcha successfully or you have removed them from the challenge list.", $form->generate_text_box('ip_address'));
$form_container->output_row("Notes", "Any notes you would like to add", $form->generate_text_box('notes'));
$form_container->end();
$buttons[] = $form->generate_submit_button("Submit");
$form->output_submit_wrapper($buttons);
$form->end();
}
示例5: main_page
function main_page()
{
$form = new Form("index.php?module=cloudflare-blacklist&action=run", "post");
$form_container = new FormContainer("Blacklist an IP");
$form_container->output_row("IP Address", "The IP address you would like to blacklist<br /><b>Only a single IP is currently supported!</b>", $form->generate_text_box('ip_address'));
$form_container->output_row("Notes", "Any notes you would like to add", $form->generate_text_box('notes'));
$form_container->end();
$buttons[] = $form->generate_submit_button("Submit");
$form->output_submit_wrapper($buttons);
$form->end();
}
示例6: myalerts_acp_manage_alert_types
function myalerts_acp_manage_alert_types()
{
global $mybb, $lang, $page, $db, $cache;
$alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
$alertTypes = $alertTypeManager->getAlertTypes();
if (strtolower($mybb->request_method) == 'post') {
if (!verify_post_check($mybb->get_input('my_post_key'))) {
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=config-myalerts_alert_types");
}
$enabledAlertTypes = $mybb->get_input('alert_types_enabled', MyBB::INPUT_ARRAY);
$canBeUserDisabled = $mybb->get_input('alert_types_can_be_user_disabled', MyBB::INPUT_ARRAY);
$enabledAlertTypes = array_map('intval', array_keys($enabledAlertTypes));
$canBeUserDisabled = array_map('intval', array_keys($canBeUserDisabled));
$updateArray = array();
foreach ($alertTypes as $alertType) {
$type = MybbStuff_MyAlerts_Entity_AlertType::unserialize($alertType);
$type->setEnabled(in_array($type->getId(), $enabledAlertTypes));
$type->setCanBeUserDisabled(in_array($type->getId(), $canBeUserDisabled));
$updateArray[] = $type;
}
$alertTypeManager->updateAlertTypes($updateArray);
flash_message($lang->myalerts_alert_types_updated, 'success');
admin_redirect("index.php?module=config-myalerts_alert_types");
} else {
$page->output_header($lang->myalerts_alert_types);
$form = new Form('index.php?module=config-myalerts_alert_types', 'post');
$table = new Table();
$table->construct_header($lang->myalerts_alert_type_code);
$table->construct_header($lang->myalerts_alert_type_enabled, array('width' => '5%', 'class' => 'align_center'));
$table->construct_header($lang->myalerts_alert_type_can_be_user_disabled, array('width' => '10%', 'class' => 'align_center'));
$noResults = false;
if (!empty($alertTypes)) {
foreach ($alertTypes as $type) {
$alertCode = htmlspecialchars_uni($type['code']);
$table->construct_cell($alertCode);
$table->construct_cell($form->generate_check_box('alert_types_enabled[' . $type['id'] . ']', '', '', array('checked' => $type['enabled'])));
$table->construct_cell($form->generate_check_box('alert_types_can_be_user_disabled[' . $type['id'] . ']', '', '', array('checked' => $type['can_be_user_disabled'])));
$table->construct_row();
}
} else {
$table->construct_cell($lang->myalerts_no_alert_types, array('colspan' => 2));
$table->construct_row();
$noResults = true;
}
$table->output($lang->myalerts_alert_types);
if (!$noResults) {
$buttons[] = $form->generate_submit_button($lang->myalerts_update_alert_types);
$form->output_submit_wrapper($buttons);
}
$form->end();
$page->output_footer();
}
}
示例7: main_page
function main_page()
{
$form = new Form('index.php?module=cloudflare-purge_cache&action=purge', 'post');
$form_container = new FormContainer('Purge Cache');
$form_container->output_row('Purge Entire Cache', 'Remove ALL files from CloudFlare\'s cache. This will include javascript, stylesheets and images. CloudFlare can take up to 3 hours to recache resources again<br /><b>Note: </b>This may have dramatic affects on your origin server load after performing this action.', $form->generate_yes_no_radio('purge_input', 0));
$form_container->output_row('Purge by URL', 'Granularly remove one or more files from CloudFlare\'s cache either by specifying the URL<br /><b>Note: </b><u>One</u> URL per line (max: 30)', $form->generate_text_area('urls'));
$form_container->end();
$buttons[] = $form->generate_submit_button('Submit');
$form->output_submit_wrapper($buttons);
$form->end();
}
示例8: request
protected function request()
{
$f = new Form();
$f->start($_POST);
$f->radio('dest', 'Screen', 'screen');
$f->hspace(2);
$f->radio('dest', 'PDF', 'pdf', false);
$f->hspace(2);
$f->radio('dest', 'CSV', 'csv', false);
$f->text('year', 'Year:', 30, 'YYYY');
$f->button('action_report', 'Report', false);
$f->end();
}
示例9: main_page
function main_page($in_dev_mode, $time_remaining = 0)
{
global $page;
if ($in_dev_mode) {
$page->output_alert("CloudFlare is currently in development mode. This will expire in " . gmdate("H:i:s", $time_remaining));
}
$form = new Form('index.php?module=cloudflare-dev_mode&action=change', 'post');
$form_container = new FormContainer('Change development mode');
$form_container->output_row('Development Mode', "This will bypass CloudFlare's accelerated cache and slow down your site, but is useful if you are making changes to cacheable content (like images, css, or JavaScript) and would like to see those changes right away.", $form->generate_on_off_radio('dev_mode', $in_dev_mode ? 1 : 0));
$form_container->end();
$buttons[] = $form->generate_submit_button('Submit');
$form->output_submit_wrapper($buttons);
$form->end();
}
示例10: main_page
function main_page($current_setting)
{
global $security_levels;
$form = new Form('index.php?module=cloudflare-security_lvl&action=change_security_level', 'post');
$form_container = new FormContainer('Modify Security Level');
$form_container->output_row('Security Level', 'The Security Level you choose will determine which visitors will be presented with a challenge page<br />
<ul>
<li><b>Essentially Off:</b> Challenges only the most grievous offenders</li>
<li><b>Low:</b> Challenges only the most threatening visitors</li>
<li><b>Medium:</b> Challenges both moderate threat visitors and the most threatening visitors</li>
<li><b>High:</b> Challenges all visitors that have exhibited threatening behavior within the last 14 days</li>
<li><b>I\'m Under Attack!:</b> Should only be used if your website is under a DDoS attack</li>
<ul><li>Visitors will receive an interstitial page while we analyze their traffic and behavior to make sure they are a legitimate human visitor trying to access your website</li></ul>
</li>
</ul>', $form->generate_select_box('sec_level', $security_levels, $current_setting));
$form_container->end();
$buttons[] = $form->generate_submit_button('Submit');
$form->output_submit_wrapper($buttons);
$form->end();
}
示例11: threadfields_add_edit_handler
//.........这里部分代码省略.........
$form_container->output_row($lang->threadfields_forums, $lang->threadfields_forums_desc, $form->generate_forum_select('forums[]', $data['forums'], array('multiple' => true, 'size' => 5)), 'forums');
$hidefield_boxes = '';
foreach (array('input' => XTHREADS_HIDE_INPUT, 'thread' => XTHREADS_HIDE_THREAD) as $k => $v) {
$l = 'threadfields_hidefield_' . $k;
$ld = 'threadfields_hidefield_' . $k . '_desc';
$hidefield_boxes .= $form->generate_check_box('hidefield_' . $k, '1', $lang->{$l}, array('checked' => (bool) ($data['hidefield'] & $v))) . '<div style="margin-left: 2.25em;" class="description">' . $lang->{$ld} . '</div>';
}
$form_container->output_row($lang->threadfields_hidefield, $lang->threadfields_hidefield_desc, $hidefield_boxes, 'hidefield');
$inputtypes = array(XTHREADS_INPUT_TEXT => $lang->threadfields_inputtype_text, XTHREADS_INPUT_TEXTAREA => $lang->threadfields_inputtype_textarea, XTHREADS_INPUT_SELECT => $lang->threadfields_inputtype_select, XTHREADS_INPUT_RADIO => $lang->threadfields_inputtype_radio, XTHREADS_INPUT_CHECKBOX => $lang->threadfields_inputtype_checkbox, XTHREADS_INPUT_FILE => $lang->threadfields_inputtype_file);
if ($update) {
// disable some conversions as they are not possible
if (isset($errors['error_invalid_inputtype'])) {
// but if invalid type is supplied, don't lock the user in either
$inputtype = $oldfield['inputtype'];
} else {
$inputtype = $data['inputtype'];
}
if ($inputtype == XTHREADS_INPUT_FILE || $inputtype == XTHREADS_INPUT_FILE_URL) {
foreach ($inputtypes as $k => &$v) {
if ($k != $inputtype) {
unset($inputtypes[$k]);
}
}
} else {
unset($inputtypes[XTHREADS_INPUT_FILE], $inputtypes[XTHREADS_INPUT_FILE_URL]);
}
}
// TODO: weird issue where inputtype isn't being set...
if (!ini_get('file_uploads')) {
$lang->threadfields_file_name_info .= '<div style="color: red; font-style: italic;">' . $lang->threadfields_file_upload_disabled_warning . '</div>';
}
make_form_row('inputtype', 'select_box', $inputtypes, '<div id="inputtype_file_explain" style="font-size: 0.95em; margin-top: 1em;">' . $lang->threadfields_file_name_info . '</div>');
make_form_row('disporder', 'text_box');
$form_container->end();
unset($GLOBALS['form_container']);
global $form_container;
$form_container = new FormContainer($lang->threadfields_cat_input);
if ($data['editable_gids'] && !is_array($data['editable_gids'])) {
$data['editable_gids'] = array_map('intval', array_map('trim', explode(',', $data['editable_gids'])));
}
if (!empty($data['editable_gids'])) {
$data['editable'] = 99;
}
make_form_row('editable', 'select_box', array(XTHREADS_EDITABLE_ALL => $lang->threadfields_editable_everyone, XTHREADS_EDITABLE_REQ => $lang->threadfields_editable_requied, XTHREADS_EDITABLE_MOD => $lang->threadfields_editable_mod, XTHREADS_EDITABLE_ADMIN => $lang->threadfields_editable_admin, XTHREADS_EDITABLE_NONE => $lang->threadfields_editable_none, 99 => $lang->threadfields_editable_bygroup));
$form_container->output_row($lang->threadfields_editable_gids, $lang->threadfields_editable_gids_desc, xt_generate_group_select('editable_gids[]', $data['editable_gids'], array('multiple' => true, 'size' => 5)), 'editable_gids', array(), array('id' => 'row_editable_gids'));
make_form_row('maxlen', 'text_box');
make_form_row('vallist', 'text_area');
make_form_row('fileexts', 'text_box');
if (!is_int(2147483648)) {
// detect 32-bit PHP
$lang->threadfields_filemaxsize_desc .= $lang->threadfields_filemaxsize_desc_2gbwarn;
}
// PHP upload limits
$upload_max_filesize = @ini_get('upload_max_filesize');
$post_max_size = @ini_get('post_max_size');
// TODO: maybe also pull in [ file_uploads, max_file_uploads, max_input_time ] ?
if ($upload_max_filesize || $post_max_size) {
$lang->threadfields_filemaxsize_desc .= '<br /><br />' . $lang->threadfields_filemaxsize_desc_phplimit;
if (!$lang->limit_upload_max_filesize) {
$lang->load('config_attachment_types');
}
if ($upload_max_filesize) {
$lang->threadfields_filemaxsize_desc .= '<br />' . $lang->sprintf($lang->limit_upload_max_filesize, $upload_max_filesize);
}
if ($post_max_size) {
$lang->threadfields_filemaxsize_desc .= '<br />' . $lang->sprintf($lang->limit_post_max_size, $post_max_size);
示例12: newpoints_shop_admin
function newpoints_shop_admin()
{
global $db, $lang, $mybb, $page, $run_module, $action_file, $mybbadmin, $plugins;
newpoints_lang_load('newpoints_shop');
if ($run_module == 'newpoints' && $action_file == 'newpoints_shop') {
if ($mybb->request_method == "post") {
switch ($mybb->input['action']) {
case 'do_addcat':
if ($mybb->input['name'] == '') {
newpoints_shop_messageredirect($lang->newpoints_shop_missing_field, 1);
}
$name = $db->escape_string($mybb->input['name']);
$description = $db->escape_string($mybb->input['description']);
// get visible to user groups options
if (is_array($mybb->input['usergroups'])) {
foreach ($mybb->input['usergroups'] as $gid) {
if ($gid == $mybb->input['usergroups']) {
unset($mybb->input['usergroups'][$gid]);
}
}
$usergroups = implode(",", $mybb->input['usergroups']);
} else {
$usergroups = '';
}
$usergroups = $db->escape_string($usergroups);
$visible = intval($mybb->input['visible']);
$icon = $db->escape_string($mybb->input['icon']);
$disporder = intval($mybb->input['disporder']);
$expanded = intval($mybb->input['expanded']);
$insert_query = array('name' => $name, 'description' => $description, 'usergroups' => $usergroups, 'visible' => $visible, 'disporder' => $disporder, 'icon' => $icon, 'expanded' => $expanded);
$db->insert_query('newpoints_shop_categories', $insert_query);
newpoints_shop_messageredirect($lang->newpoints_shop_cat_added);
break;
case 'do_editcat':
$cid = intval($mybb->input['cid']);
if ($cid <= 0 || !($cat = $db->fetch_array($db->simple_select('newpoints_shop_categories', '*', "cid = {$cid}")))) {
newpoints_shop_messageredirect($lang->newpoints_shop_invalid_cat, 1);
}
if ($mybb->input['name'] == '') {
newpoints_shop_messageredirect($lang->newpoints_shop_missing_field, 1);
}
$name = $db->escape_string($mybb->input['name']);
$description = $db->escape_string($mybb->input['description']);
// get visible to user groups options
if (is_array($mybb->input['usergroups'])) {
foreach ($mybb->input['usergroups'] as $gid) {
if ($gid == $mybb->input['usergroups']) {
unset($mybb->input['usergroups'][$gid]);
}
}
$usergroups = implode(",", $mybb->input['usergroups']);
} else {
$usergroups = '';
}
$usergroups = $db->escape_string($usergroups);
$visible = intval($mybb->input['visible']);
$icon = $db->escape_string($mybb->input['icon']);
$disporder = intval($mybb->input['disporder']);
$expanded = intval($mybb->input['expanded']);
$update_query = array('name' => $name, 'description' => $description, 'usergroups' => $usergroups, 'visible' => $visible, 'disporder' => $disporder, 'icon' => $icon, 'expanded' => $expanded);
$db->update_query('newpoints_shop_categories', $update_query, 'cid=\'' . $cid . '\'');
newpoints_shop_messageredirect($lang->newpoints_shop_cat_edited);
break;
case 'do_additem':
if ($mybb->input['name'] == '' || $mybb->input['cid'] == '') {
newpoints_shop_messageredirect($lang->newpoints_shop_missing_field, 1);
}
$name = $db->escape_string($mybb->input['name']);
$description = $db->escape_string($mybb->input['description']);
$icon = $db->escape_string($mybb->input['icon']);
$pm = $db->escape_string($mybb->input['pm']);
$price = floatval($mybb->input['price']);
$infinite = intval($mybb->input['infinite']);
if ($infinite == 1) {
$stock = 0;
} else {
$stock = intval($mybb->input['stock']);
}
$limit = intval($mybb->input['limit']);
$visible = intval($mybb->input['visible']);
$disporder = intval($mybb->input['disporder']);
$sendable = intval($mybb->input['sendable']);
$sellable = intval($mybb->input['sellable']);
$cid = intval($mybb->input['cid']);
if ($cid <= 0 || !($cat = $db->fetch_array($db->simple_select('newpoints_shop_categories', '*', "cid = {$cid}")))) {
newpoints_shop_messageredirect($lang->newpoints_shop_invalid_cat, 1);
}
$insert_array = array('name' => $name, 'description' => $description, 'icon' => $icon, 'visible' => $visible, 'disporder' => $disporder, 'price' => $price, 'infinite' => $infinite, 'stock' => $stock, 'limit' => $limit, 'sendable' => $sendable, 'sellable' => $sellable, 'cid' => $cid, 'pm' => $pm);
$plugins->run_hooks("newpoints_shop_commit", $insert_array);
$db->insert_query('newpoints_shop_items', $insert_array);
$db->write_query('UPDATE ' . TABLE_PREFIX . 'newpoints_shop_categories SET items = items+1 WHERE cid=\'' . $cid . '\'');
newpoints_shop_messageredirect($lang->newpoints_shop_item_added, 0, "items&cid=" . $cid);
break;
case 'do_edititem':
$iid = intval($mybb->input['iid']);
if ($iid <= 0 || !($item = $db->fetch_array($db->simple_select('newpoints_shop_items', '*', "iid = {$iid}")))) {
newpoints_shop_messageredirect($lang->newpoints_shop_invalid_item, 1, 'items');
}
if ($mybb->input['name'] == '' || $mybb->input['cid'] == '') {
newpoints_shop_messageredirect($lang->newpoints_shop_missing_field, 1);
//.........这里部分代码省略.........
示例13: restfulapi_admin_load
function restfulapi_admin_load()
{
global $mybb, $db, $page, $lang, $cache;
if ($page->active_action == RESTFULAPI_URL) {
$page->add_breadcrumb_item($lang->restfulapi_title);
$page->output_header($lang->restfulapi_title);
$result = $db->simple_select("apisettings");
$action = "config";
if (isset($mybb->input["action"]) && in_array($mybb->input["action"], array("manage-keys", "add-key"))) {
$action = $mybb->input["action"];
}
$navs = array("config" => array("link" => "index.php?module=config-" . RESTFULAPI_URL, "title" => $lang->restfulapi_config, "description" => $lang->restfulapi_config_description), "manage-keys" => array("link" => "index.php?module=config-" . RESTFULAPI_URL . "&action=manage-keys", "title" => $lang->restfulapi_manage_api_keys, "description" => $lang->restfulapi_manage_api_keys_description), "add-key" => array("link" => "index.php?module=config-" . RESTFULAPI_URL . "&action=add-key", "title" => $lang->restfulapi_add_api_key, "description" => $lang->restfulapi_add_api_key_description));
$page->output_nav_tabs($navs, $action);
switch ($action) {
case "manage-keys":
if (isset($mybb->input["do"]) && in_array($mybb->input["do"], array("regenerate", "edit", "delete"))) {
$do = $mybb->input["do"];
if ($do == "edit" && isset($mybb->input["key_id"]) && is_string($mybb->input["key_id"])) {
$key_id = (int) $db->escape_string($mybb->input["key_id"]);
$result = $db->simple_select("apikeys", "*", "id='{$key_id}'");
if ($result->num_rows != 1) {
flash_message($lang->restfulapi_key_not_found, "error");
admin_redirect("index.php?module=config-restfulapi&action=manage-keys");
exit;
}
if ($mybb->request_method == "post" && isset($mybb->input["apicustomer"]) && is_string($mybb->input["apicustomer"]) && isset($mybb->input["apicomment"]) && is_string($mybb->input["apicomment"]) && isset($mybb->input["maxreq"]) && is_numeric($mybb->input["maxreq"]) && isset($mybb->input["maxreqrate"]) && in_array($mybb->input["maxreqrate"], array("m", "w", "d", "h"))) {
$update = array("apicustomer" => $db->escape_string(htmlspecialchars_uni($mybb->input["apicustomer"])), "apicomment" => $db->escape_string(htmlspecialchars_uni($mybb->input["apicomment"])), "maxreq" => (int) $mybb->input["maxreq"], "maxreqrate" => $db->escape_string(htmlspecialchars_uni($mybb->input["maxreqrate"])));
$db->update_query("apikeys", $update, "id='{$key_id}'");
$db->delete_query("apipermissions", "apikey='{$key_id}'");
if (isset($mybb->input["apinames"]) && is_array($mybb->input["apinames"])) {
$insert_allowed = array();
foreach ($mybb->input["apinames"] as $apiname) {
$insert_allowed[] = array("apikey" => $key_id, "apiname" => $db->escape_string($apiname));
}
$db->insert_query_multiple("apipermissions", $insert_allowed);
}
restfulapi_cache_rebuild();
flash_message($lang->restfulapi_key_edited_successfully, "success");
admin_redirect("index.php?module=config-restfulapi&action=manage-keys");
} else {
$keyset = $result->fetch_array();
$form = new Form("index.php?module=config-" . RESTFULAPI_URL . "&action=manage-keys&do=edit&key_id={$key_id}", "post", "edit");
$form_container = new FormContainer($lang->restfulapi_edit_api_key);
$form_container->output_row($lang->restfulapi_customer_name . " <em>*</em>", $lang->restfulapi_customer_name_description, $form->generate_text_box('apicustomer', htmlspecialchars_uni($keyset["apicustomer"]), array('id' => 'apicustomer')), 'apicustomer');
$rate_types = array("h" => $lang->restfulapi_per_hour, "d" => $lang->restfulapi_per_day, "w" => $lang->restfulapi_per_week, "m" => $lang->restfulapi_per_month);
$form_container->output_row($lang->restfulapi_max_requests . " <em>*</em>", $lang->restfulapi_max_requests_description, $form->generate_text_box('maxreq', htmlspecialchars_uni($keyset["maxreq"]), array('id' => 'maxreq')) . " " . $form->generate_select_box('maxreqrate', $rate_types, htmlspecialchars_uni($keyset["maxreqrate"]), array('id' => 'maxreqrate')), 'maxreq');
$form_container->output_row($lang->restfulapi_comment, $lang->restfulapi_comment_description, $form->generate_text_area('apicomment', htmlspecialchars_uni($keyset["apicomment"]), array('id' => 'apicomment')), 'apicomment');
$apis = glob(RESTFULAPI_PATH . "api/*api.class.php");
$presentable_apis = array();
foreach ($apis as $key => $value) {
$value = htmlspecialchars_uni(str_replace(array(RESTFULAPI_PATH . "api/", "api.class.php"), "", $value));
$presentable_apis[$value] = $value;
}
$selected = array();
// reminder, $key_id has already been escaped!
$result = $db->simple_select("apipermissions", "*", "apikey='{$key_id}'");
while ($apipermission = $db->fetch_array($result)) {
$selected[] = $apipermission["apiname"];
}
$form_container->output_row($lang->restfulapi_select_allowed_apis, $lang->restfulapi_select_allowed_apis_description, $form->generate_select_box('apinames[]', $presentable_apis, $selected, array('id' => 'apinames', 'multiple' => true, 'size' => 10)), 'apinames');
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->restfulapi_edit_api_key);
$form->output_submit_wrapper($buttons);
$form->end();
}
} elseif ($do == "delete" && isset($mybb->input["key_id"]) && isset($mybb->input["my_post_key"]) && verify_post_check($mybb->input["my_post_key"])) {
$key_id = $db->escape_string($mybb->input["key_id"]);
if ($db->simple_select("apikeys", "*", "id='{$key_id}'")->num_rows == 1) {
$db->delete_query("apipermissions", "apikey='{$key_id}'");
$db->delete_query("apikeys", "id='{$key_id}'");
restfulapi_cache_rebuild();
flash_message($lang->restfulapi_key_deleted_successfully, "success");
} else {
flash_message($lang->restfulapi_key_not_found, "error");
}
admin_redirect("index.php?module=config-restfulapi&action=manage-keys");
} elseif ($do == "regenerate" && isset($mybb->input["key_id"]) && isset($mybb->input["my_post_key"]) && verify_post_check($mybb->input["my_post_key"])) {
$key_id = $db->escape_string($mybb->input["key_id"]);
if ($db->simple_select("apikeys", "*", "id='{$key_id}'")->num_rows == 1) {
$apikey = restfulapi_generate_key();
/* can't figure out a better way to generate a random yet never-generated-before API key than this one */
while ($db->simple_select("apikeys", "*", "apikey='{$apikey}'")->num_rows != 0) {
$apikey = restfulapi_generate_key();
}
$update = array("apikey" => $db->escape_string(htmlspecialchars_uni($apikey)));
$db->update_query("apikeys", $update, "id='{$key_id}'");
restfulapi_cache_rebuild();
flash_message($lang->restfulapi_key_regenerated_successfully, "success");
} else {
flash_message($lang->restfulapi_key_not_found, "error");
}
admin_redirect("index.php?module=config-restfulapi&action=manage-keys");
}
} else {
$restfulapi_cache = $cache->read("restfulapi");
$apikeysets = $restfulapi_cache["keys"];
$table = new Table();
$table->construct_header($lang->restfulapi_customer, array("width" => "15%"));
$table->construct_header($lang->restfulapi_api_key, array("class" => "align_center", "width" => "29%"));
$table->construct_header($lang->restfulapi_comment, array("class" => "align_center", "width" => "30%"));
//.........这里部分代码省略.........
示例14: asb_build_filter_selector
function asb_build_filter_selector($filter)
{
global $all_scripts;
// if there are active scripts . . .
if (!is_array($all_scripts) || empty($all_scripts)) {
return;
}
global $lang, $html;
$options = array_merge(array("" => 'no filter'), $all_scripts);
$form = new Form($html->url(), 'post', 'script_filter', 0, 'script_filter');
echo $form->generate_select_box('page', $options, $filter);
echo $form->generate_submit_button('Filter', array('name' => 'filter'));
return $form->end();
}
示例15:
<div class="content">
<?php
Html::block('Регистрация новой компании', 'Мы рады, что Вы решили зарегистрироваться в нашем каталоге!<br>
Введите свой e-mail и придумайте новый пароль. Пароль не должен быть короче шести символов.');
Form::create('registration', 'login_form');
Form::input('Введите ваш e-mail', 'email', Request::post('email', ''));
Form::password('Придумайте Пароль для входа', 'pass1');
Form::password('Повторите Пароль', 'pass2');
Form::submit('Дальше');
Form::end();
Html::end_block();
?>
</div>