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


PHP FormContainer::end方法代码示例

本文整理汇总了PHP中FormContainer::end方法的典型用法代码示例。如果您正苦于以下问题:PHP FormContainer::end方法的具体用法?PHP FormContainer::end怎么用?PHP FormContainer::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormContainer的用法示例。


在下文中一共展示了FormContainer::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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:10,代码来源:cloudflare_ipv46.php

示例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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:10,代码来源:cloudflare_cache_lvl.php

示例3: main_page

function main_page()
{
    $form = new Form("index.php?module=cloudflare-whitelist&action=run", "post");
    $form_container = new FormContainer("Whitelist an IP");
    $form_container->output_row("IP Address", "The IP address you would like to whitelist", $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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:11,代码来源:cloudflare_whitelist.php

示例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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:11,代码来源:cloudflare_challenge.php

示例5: 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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:11,代码来源:cloudflare_purge_cache.php

示例6: 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&amp;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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:14,代码来源:cloudflare_dev_mode.php

示例7: main_page

function main_page($current_setting)
{
    global $security_levels;
    $form = new Form('index.php?module=cloudflare-security_lvl&amp;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();
}
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:20,代码来源:cloudflare_security_lvl.php

示例8: tslink_admin

function tslink_admin()
{
    global $db, $lang, $mybb, $page, $run_module, $action_file, $plugins, $cache;
    $lang->load('tslink');
    if ($run_module == 'user' && $action_file == 'tslink') {
        $page->add_breadcrumb_item($lang->tslink_plugin_name, 'index.php?module=tslink');
        if ($mybb->input['action'] == 'tslink_changestatus') {
            $mybb_uid = intval($mybb->input['uid']);
            $changeto = intval($mybb->input['changeto']);
            $db->query('UPDATE ' . TABLE_PREFIX . "users SET memberstatus= '" . $changeto . "' WHERE uid='" . $mybb_uid . "'");
            $queryUser = $db->simple_select('users', 'username, lastip', "uid='{$mybb_uid}'");
            $bin_ip_in_db = $db->fetch_field($queryUser, 'lastip');
            $givenip = my_inet_ntop($db->unescape_binary($bin_ip_in_db));
            $forUser = $db->fetch_field($queryUser, 'username');
            // If there's an ip of the user in de database, update the unique id's in the database
            if (!empty($givenip)) {
                tslink_log("=============================================================\n=================== " . date('d-m-Y H:i:s') . " =====================\n=============================================================\n", $forUser);
                tslink_log('Started on AdminCP by ' . $mybb->user['username'] . ' - IP address of user available (' . $givenip . ') - doing tslink_update_uids & tslink_update_groups', $forUser);
                $tslink_update_uids_results = tslink_update_uids($givenip);
                tslink_log($tslink_update_uids_results, $forUser);
                $message = $lang->tslink_status_changed;
            }
            // If there's no lastip of the user in the database - dont try to update the unique id's in the database
            if (empty($givenip)) {
                tslink_log("=============================================================\n=================== " . date('d-m-Y H:i:s') . " =====================\n=============================================================\n", $forUser);
                tslink_log('Started on AdminCP ' . $mybb->user['username'] . ' - IP address of user NOT available - only doing tslink_update_groups to update previously registered TS uids', $forUser);
                $tslink_update_groups_results = tslink_update_groups($mybb_uid);
                tslink_log($tslink_update_groups_results, $forUser);
                $message = $lang->tslink_status_changed;
            }
            admin_redirect('index.php?module=user-tslink');
        }
        if (!$mybb->input['action'] || $mybb->input['action'] == 'conntest') {
            $page->output_header($lang->tslink);
            $sub_tabs['tslink'] = ['title' => $lang->tslink_tab_home, 'link' => 'index.php?module=user-tslink', 'description' => $lang->tslink_admin_tab_home_desc];
            $sub_tabs['tslink-conntest'] = ['title' => $lang->tslink_admin_tsinfo_title, 'link' => 'index.php?module=user-tslink&action=conntest', 'description' => $lang->tslink_admin_tsinfo_desc];
        }
        if ($mybb->input['action'] == 'conntest') {
            require __DIR__ . '/config.php';
            $page->output_nav_tabs($sub_tabs, 'tslink-conntest');
            //build a new ts3admin object
            $ts3 = new ts3admin($ts3_server, $ts3_query_port);
            if ($ts3->getElement('success', $ts3->connect())) {
                //login as serveradmin
                $ts3->login($ts3_username, $ts3_password);
                //select teamspeakserver
                $ts3->selectServer($ts3_server_port);
                // Set displayed name in TS to given
                $ts3->setName($ts3_nickname);
                $form = new Form('index.php?module=user-tslink&action=conntest', 'post');
                $form_container = new FormContainer($lang->tslink_admin_tsinfo_full_title);
                $form_container->output_row($lang->tslink_admin_server_version, $ts3->version()['data']['version']);
                $form_container->output_row($lang->tslink_admin_server_platform, $ts3->version()['data']['platform']);
                $form_container->output_row($lang->tslink_admin_server_online_clients, $ts3->serverInfo()['data']['virtualserver_clientsonline'] . '/' . $ts3->serverInfo()['data']['virtualserver_maxclients']);
                $form_container->end();
                $form->end();
            } else {
                echo 'Connection could not be established.';
            }
            /*
             * This code retuns all errors from the debugLog
             */
            if (count($ts3->getDebugLog()) > 0) {
                foreach ($ts3->getDebugLog() as $logEntry) {
                    echo '<script>alert("' . $logEntry . '");</script>';
                }
            }
            $page->output_footer();
        }
        if (!$mybb->input['action']) {
            $page->output_nav_tabs($sub_tabs, 'tslink');
            $form = new Form('index.php?module=user-tslink', 'post');
            $form_container = new FormContainer($lang->tslink_admin_table_heading_users);
            $form_container->output_row_header($lang->tslink_admin_row_username, ['class' => 'align_left', width => '50%']);
            $form_container->output_row_header($lang->tslink_admin_row_status, ['class' => 'align_center']);
            $form_container->output_row_header($lang->tslink_admin_row_options, ['class' => 'align_center']);
            $form_container->output_row_header($lang->tslink_admin_row_options, ['class' => 'align_center']);
            $query = $db->simple_select('users', 'uid, username, memberstatus', '', ['order_by' => 'username', 'order_dir' => 'ASC']);
            while ($users = $db->fetch_array($query)) {
                $form_container->output_cell("<div style=\"\"><strong>{$users['username']}</strong></div>");
                if ($users['memberstatus'] == '0') {
                    $form_container->output_cell('<div style=""><strong>Member</strong></div>', ['class' => 'align_center']);
                    $form_container->output_cell("<a href=\"index.php?module=user-tslink&amp;action=tslink_changestatus&amp;uid={$users['uid']}&amp;changeto=1\">{$lang->tslink_admin_row_changestatus1}</a>", ['class' => 'align_center']);
                    $form_container->output_cell("<a href=\"index.php?module=user-tslink&amp;action=tslink_changestatus&amp;uid={$users['uid']}&amp;changeto=2\">{$lang->tslink_admin_row_changestatus2}</a>", ['class' => 'align_center']);
                } elseif ($users['memberstatus'] == '1') {
                    $form_container->output_cell('<div style=""><strong>Donating Member</strong></div>', ['class' => 'align_center']);
                    $form_container->output_cell("<a href=\"index.php?module=user-tslink&amp;action=tslink_changestatus&amp;uid={$users['uid']}&amp;changeto=0\">{$lang->tslink_admin_row_changestatus0}</a>", ['class' => 'align_center']);
                    $form_container->output_cell("<a href=\"index.php?module=user-tslink&amp;action=tslink_changestatus&amp;uid={$users['uid']}&amp;changeto=2\">{$lang->tslink_admin_row_changestatus2}</a>", ['class' => 'align_center']);
                } elseif ($users['memberstatus'] == '2') {
                    $form_container->output_cell('<div style=""><strong>VIP Member</strong></div>', ['class' => 'align_center']);
                    $form_container->output_cell("<a href=\"index.php?module=user-tslink&amp;action=tslink_changestatus&amp;uid={$users['uid']}&amp;changeto=0\">{$lang->tslink_admin_row_changestatus0}</a>", ['class' => 'align_center']);
                    $form_container->output_cell("<a href=\"index.php?module=user-tslink&amp;action=tslink_changestatus&amp;uid={$users['uid']}&amp;changeto=1\">{$lang->tslink_admin_row_changestatus1}</a>", ['class' => 'align_center']);
                }
                $form_container->construct_row();
            }
            $form_container->end();
            $form->end();
            $page->output_footer();
        }
    }
//.........这里部分代码省略.........
开发者ID:f0nt4,项目名称:TSLink,代码行数:101,代码来源:tslinkfunctions.php

示例9: array

    $form_container->output_row($lang->copy_thread . " <em>*</em>", '', $actions);
    $form_container->output_row($lang->delete_thread . " <em>*</em>", '', $form->generate_yes_no_radio('deletethread', $mybb->input['deletethread']));
    $query = $db->simple_select('threadprefixes', 'pid, prefix');
    if ($db->num_rows($query) > 0) {
        $thread_prefixes = array('-1' => $lang->no_change, '0' => $lang->no_prefix);
        while ($prefix = $db->fetch_array($query)) {
            $thread_prefixes[$prefix['pid']] = $prefix['prefix'];
        }
        $form_container->output_row($lang->apply_thread_prefix . " <em>*</em>", '', $form->generate_select_box('threadprefix', $thread_prefixes, $mybb->input['threadprefix'], array('id' => 'threadprefix')), 'threadprefix');
    }
    $form_container->output_row($lang->new_subject . " <em>*</em>", $lang->new_subject_desc, $form->generate_text_box('newsubject', $mybb->input['newsubject']));
    $form_container->end();
    $form_container = new FormContainer($lang->add_new_reply);
    $form_container->output_row($lang->add_new_reply, $lang->add_new_reply_desc, $form->generate_text_area('newreply', $mybb->input['newreply'], array('id' => 'newreply')), 'newreply');
    $form_container->output_row($lang->reply_subject, $lang->reply_subject_desc, $form->generate_text_box('newreplysubject', $mybb->input['newreplysubject'], array('id' => 'newreplysubject')), 'newreplysubject');
    $form_container->end();
    $buttons[] = $form->generate_submit_button($lang->save_post_tool);
    $form->output_submit_wrapper($buttons);
    $form->end();
    $page->output_footer();
}
if (!$mybb->input['action']) {
    $plugins->run_hooks("admin_config_mod_tools_start");
    $page->output_header($lang->mod_tools . " - " . $lang->thread_tools);
    $sub_tabs['thread_tools'] = array('title' => $lang->thread_tools, 'link' => "index.php?module=config-mod_tools", 'description' => $lang->thread_tools_desc);
    $sub_tabs['add_thread_tool'] = array('title' => $lang->add_new_thread_tool, 'link' => "index.php?module=config-mod_tools&amp;action=add_thread_tool");
    $sub_tabs['post_tools'] = array('title' => $lang->post_tools, 'link' => "index.php?module=config-mod_tools&amp;action=post_tools");
    $sub_tabs['add_post_tool'] = array('title' => $lang->add_new_post_tool, 'link' => "index.php?module=config-mod_tools&amp;action=add_post_tool");
    $page->output_nav_tabs($sub_tabs, 'thread_tools');
    $table = new Table();
    $table->construct_header($lang->title);
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:mod_tools.php

示例10: user_search_conditions

function user_search_conditions($input = array(), &$form)
{
    global $mybb, $db, $lang;
    if (!$input) {
        $input = $mybb->input;
    }
    if (!is_array($input['conditions'])) {
        $input['conditions'] = unserialize($input['conditions']);
    }
    if (!is_array($input['profile_fields'])) {
        $input['profile_fields'] = unserialize($input['profile_fields']);
    }
    if (!is_array($input['fields'])) {
        $input['fields'] = unserialize($input['fields']);
    }
    $form_container = new FormContainer($lang->find_users_where);
    $form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', $input['conditions']['username'], array('id' => 'username')), 'username');
    $form_container->output_row($lang->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');
    $options = array();
    $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
    while ($usergroup = $db->fetch_array($query)) {
        $options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
    }
    $form_container->output_row($lang->is_member_of_groups, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');
    $form_container->output_row($lang->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website')) . " {$lang->or} " . $form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website');
    $form_container->output_row($lang->icq_number_contains, "", $form->generate_text_box('conditions[icq]', $input['conditions']['icq'], array('id' => 'icq')) . " {$lang->or} " . $form->generate_check_box('conditions[icq_blank]', 1, $lang->is_not_blank, array('id' => 'icq_blank', 'checked' => $input['conditions']['icq_blank'])), 'icq');
    $form_container->output_row($lang->aim_handle_contains, "", $form->generate_text_box('conditions[aim]', $input['conditions']['aim'], array('id' => 'aim')) . " {$lang->or} " . $form->generate_check_box('conditions[aim_blank]', 1, $lang->is_not_blank, array('id' => 'aim_blank', 'checked' => $input['conditions']['aim_blank'])), 'aim');
    $form_container->output_row($lang->yahoo_contains, "", $form->generate_text_box('conditions[yahoo]', $input['conditions']['yahoo'], array('id' => 'yahoo')) . " {$lang->or} " . $form->generate_check_box('conditions[yahoo_blank]', 1, $lang->is_not_blank, array('id' => 'yahoo_blank', 'checked' => $input['conditions']['yahoo_blank'])), 'yahoo');
    $form_container->output_row($lang->msn_contains, "", $form->generate_text_box('conditions[msn]', $input['conditions']['msn'], array('id' => 'msn')) . " {$lang->or} " . $form->generate_check_box('conditions[msn_blank]', 1, $lang->is_not_blank, array('id' => 'msn_blank', 'checked' => $input['conditions']['msn_blank'])), 'msn');
    $form_container->output_row($lang->signature_contains, "", $form->generate_text_box('conditions[signature]', $input['conditions']['signature'], array('id' => 'signature')) . " {$lang->or} " . $form->generate_check_box('conditions[signature_blank]', 1, $lang->is_not_blank, array('id' => 'signature_blank', 'checked' => $input['conditions']['signature_blank'])), 'signature');
    $form_container->output_row($lang->user_title_contains, "", $form->generate_text_box('conditions[usertitle]', $input['conditions']['usertitle'], array('id' => 'usertitle')) . " {$lang->or} " . $form->generate_check_box('conditions[usertitle_blank]', 1, $lang->is_not_blank, array('id' => 'usertitle_blank', 'checked' => $input['conditions']['usertitle_blank'])), 'usertitle');
    $greater_options = array("greater_than" => $lang->greater_than, "is_exactly" => $lang->is_exactly, "less_than" => $lang->less_than);
    $form_container->output_row($lang->post_count_is, "", $form->generate_select_box('conditions[postnum_dir]', $greater_options, $input['conditions']['postnum_dir'], array('id' => 'numposts_dir')) . " " . $form->generate_text_box('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'numposts')), 'numposts');
    $form_container->output_row($lang->reg_in_x_days, '', $form->generate_text_box('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate')) . ' ' . $lang->days, 'regdate');
    $form_container->output_row($lang->reg_ip_matches, $lang->wildcard, $form->generate_text_box('conditions[regip]', $input['conditions']['regip'], array('id' => 'regip')), 'regip');
    $form_container->output_row($lang->last_known_ip, $lang->wildcard, $form->generate_text_box('conditions[lastip]', $input['conditions']['lastip'], array('id' => 'lastip')), 'lastip');
    $form_container->output_row($lang->posted_with_ip, $lang->wildcard, $form->generate_text_box('conditions[postip]', $input['conditions']['postip'], array('id' => 'postip')), 'postip');
    $form_container->end();
    // Custom profile fields go here
    $form_container = new FormContainer($lang->custom_profile_fields_match);
    // Fetch custom profile fields
    $query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
    while ($profile_field = $db->fetch_array($query)) {
        if ($profile_field['required'] == 1) {
            $profile_fields['required'][] = $profile_field;
        } else {
            $profile_fields['optional'][] = $profile_field;
        }
    }
    output_custom_profile_fields($profile_fields['required'], $input['profile_fields'], $form_container, $form, true);
    output_custom_profile_fields($profile_fields['optional'], $input['profile_fields'], $form_container, $form, true);
    $form_container->end();
    // Autocompletion for usernames
    echo '
	<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>
	<script type="text/javascript">
	<!--
		new autoComplete("username", "../xmlhttp.php?action=get_users", {valueSpan: "username"});
	// -->
	</script>';
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:61,代码来源:users.php

示例11: view_manager

/**
 * Builds the "view management" interface allowing administrators to edit their custom designed "views"
 *
 * @param string The base URL to this instance of the view manager
 * @param string The internal type identifier for this view
 * @param array Array of fields this view supports
 * @param array Array of possible sort options this view supports if any
 * @param string Optional callback function which generates list of "conditions" for this view
 */
function view_manager($base_url, $type, $fields, $sort_options = array(), $conditions_callback = "")
{
    global $mybb, $db, $page, $lang;
    $sub_tabs['views'] = array('title' => $lang->views, 'link' => "{$base_url}&amp;action=views", 'description' => $lang->views_desc);
    $sub_tabs['create_view'] = array('title' => $lang->create_new_view, 'link' => "{$base_url}&amp;action=views&amp;do=add", 'description' => $lang->create_new_view_desc);
    $page->add_breadcrumb_item($lang->view_manager, 'index.php?module=user-users&amp;action=views');
    // Lang strings should be in global lang file
    if ($mybb->input['do'] == "set_default") {
        $query = $db->simple_select("adminviews", "vid, uid, visibility", "vid='" . $mybb->get_input('vid', MyBB::INPUT_INT) . "'");
        $admin_view = $db->fetch_array($query);
        if (!$admin_view['vid'] || $admin_view['visibility'] == 1 && $mybb->user['uid'] != $admin_view['uid']) {
            flash_message($lang->error_invalid_admin_view, 'error');
            admin_redirect($base_url . "&action=views");
        }
        set_default_view($type, $admin_view['vid']);
        flash_message($lang->succuss_view_set_as_default, 'success');
        admin_redirect($base_url . "&action=views");
    }
    if ($mybb->input['do'] == "add") {
        if ($mybb->request_method == "post") {
            if (!trim($mybb->input['title'])) {
                $errors[] = $lang->error_missing_view_title;
            }
            if ($mybb->input['fields_js']) {
                $mybb->input['fields'] = explode(",", $mybb->input['fields_js']);
            }
            if (count($mybb->input['fields']) <= 0) {
                $errors[] = $lang->error_no_view_fields;
            }
            if ($mybb->get_input('perpage', MyBB::INPUT_INT) <= 0) {
                $errors[] = $lang->error_invalid_view_perpage;
            }
            if (!in_array($mybb->input['sortby'], array_keys($sort_options))) {
                $errors[] = $lang->error_invalid_view_sortby;
            }
            if ($mybb->input['sortorder'] != "asc" && $mybb->input['sortorder'] != "desc") {
                $errors[] = $lang->error_invalid_view_sortorder;
            }
            if ($mybb->input['visibility'] == 0) {
                $mybb->input['visibility'] = 2;
            }
            if (!$errors) {
                $new_view = array("uid" => $mybb->user['uid'], "title" => $db->escape_string($mybb->input['title']), "type" => $type, "visibility" => $mybb->get_input('visibility', MyBB::INPUT_INT), "fields" => $db->escape_string(my_serialize($mybb->input['fields'])), "conditions" => $db->escape_string(my_serialize($mybb->input['conditions'])), "custom_profile_fields" => $db->escape_string(my_serialize($mybb->input['profile_fields'])), "sortby" => $db->escape_string($mybb->input['sortby']), "sortorder" => $db->escape_string($mybb->input['sortorder']), "perpage" => $mybb->get_input('perpage', MyBB::INPUT_INT), "view_type" => $db->escape_string($mybb->input['view_type']));
                $vid = $db->insert_query("adminviews", $new_view);
                if ($mybb->input['isdefault']) {
                    set_default_view($type, $vid);
                }
                flash_message($lang->success_view_created, "success");
                admin_redirect($base_url . "&vid={$vid}");
            }
        } else {
            $mybb->input = array_merge($mybb->input, array('perpage' => 20));
        }
        // Write in our JS based field selector
        $page->extra_header .= "<script src=\"jscripts/view_manager.js\" type=\"text/javascript\"></script>\n";
        $page->add_breadcrumb_item($lang->create_new_view);
        $page->output_header($lang->create_new_view);
        $form = new Form($base_url . "&amp;action=views&amp;do=add", "post");
        $page->output_nav_tabs($sub_tabs, 'create_view');
        // If we have any error messages, show them
        if ($errors) {
            $page->output_inline_error($errors);
        }
        $form_container = new FormContainer($lang->create_new_view);
        $form_container->output_row($lang->title . " <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
        if ($mybb->input['visibility'] == 2) {
            $visibility_public_checked = true;
        } else {
            $visibility_private_checked = true;
        }
        $visibility_options = array($form->generate_radio_button("visibility", "1", "<strong>{$lang->private}</strong> - {$lang->private_desc}", array("checked" => $visibility_private_checked)), $form->generate_radio_button("visibility", "2", "<strong>{$lang->public}</strong> - {$lang->public_desc}", array("checked" => $visibility_public_checked)));
        $form_container->output_row($lang->visibility, "", implode("<br />", $visibility_options));
        $form_container->output_row($lang->set_as_default_view, "", $form->generate_yes_no_radio("isdefault", $mybb->input['isdefault'], array('yes' => 1, 'no' => 0)));
        if (count($sort_options) > 0) {
            $sort_directions = array("asc" => $lang->ascending, "desc" => $lang->descending);
            $form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby')) . " {$lang->in} " . $form->generate_select_box('sortorder', $sort_directions, $mybb->input['sortorder'], array('id' => 'sortorder')), 'sortby');
        }
        $form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');
        if ($type == "user") {
            $form_container->output_row($lang->display_results_as, "", $form->generate_radio_button('view_type', 'table', $lang->table, array('checked' => $mybb->input['view_type'] != "card" ? true : false)) . "<br />" . $form->generate_radio_button('view_type', 'card', $lang->business_card, array('checked' => $mybb->input['view_type'] == "card" ? true : false)));
        }
        $form_container->end();
        $field_select .= "<div class=\"view_fields\">\n";
        $field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled\">\n";
        if (is_array($mybb->input['fields'])) {
            foreach ($mybb->input['fields'] as $field) {
                if ($fields[$field]) {
                    $field_select .= "<li id=\"field-{$field}\">&#149; {$fields[$field]['title']}</li>";
                    $active[$field] = 1;
                }
            }
//.........这里部分代码省略.........
开发者ID:olada,项目名称:mybbintegrator,代码行数:101,代码来源:functions_view_manager.php

示例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&amp;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);
//.........这里部分代码省略.........
开发者ID:ambsalinas,项目名称:anima,代码行数:101,代码来源:newpoints_shop.php

示例13: user_search_conditions

/**
 * @param array $input
 * @param DefaultForm $form
 */
function user_search_conditions($input = array(), &$form)
{
    global $mybb, $db, $lang;
    if (!$input) {
        $input = $mybb->input;
    }
    if (!is_array($input['conditions'])) {
        $input['conditions'] = my_unserialize($input['conditions']);
    }
    if (!is_array($input['profile_fields'])) {
        $input['profile_fields'] = my_unserialize($input['profile_fields']);
    }
    if (!is_array($input['fields'])) {
        $input['fields'] = my_unserialize($input['fields']);
    }
    $form_container = new FormContainer($lang->find_users_where);
    $form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', $input['conditions']['username'], array('id' => 'username')), 'username');
    $form_container->output_row($lang->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');
    $options = array();
    $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
    while ($usergroup = $db->fetch_array($query)) {
        $options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
    }
    $form_container->output_row($lang->is_member_of_groups, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');
    $form_container->output_row($lang->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website')) . " {$lang->or} " . $form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website');
    $form_container->output_row($lang->icq_number_contains, "", $form->generate_text_box('conditions[icq]', $input['conditions']['icq'], array('id' => 'icq')) . " {$lang->or} " . $form->generate_check_box('conditions[icq_blank]', 1, $lang->is_not_blank, array('id' => 'icq_blank', 'checked' => $input['conditions']['icq_blank'])), 'icq');
    $form_container->output_row($lang->aim_handle_contains, "", $form->generate_text_box('conditions[aim]', $input['conditions']['aim'], array('id' => 'aim')) . " {$lang->or} " . $form->generate_check_box('conditions[aim_blank]', 1, $lang->is_not_blank, array('id' => 'aim_blank', 'checked' => $input['conditions']['aim_blank'])), 'aim');
    $form_container->output_row($lang->yahoo_contains, "", $form->generate_text_box('conditions[yahoo]', $input['conditions']['yahoo'], array('id' => 'yahoo')) . " {$lang->or} " . $form->generate_check_box('conditions[yahoo_blank]', 1, $lang->is_not_blank, array('id' => 'yahoo_blank', 'checked' => $input['conditions']['yahoo_blank'])), 'yahoo');
    $form_container->output_row($lang->skype_contains, "", $form->generate_text_box('conditions[skype]', $input['conditions']['skype'], array('id' => 'skype')) . " {$lang->or} " . $form->generate_check_box('conditions[skype_blank]', 1, $lang->is_not_blank, array('id' => 'skype_blank', 'checked' => $input['conditions']['skype_blank'])), 'skype');
    $form_container->output_row($lang->google_contains, "", $form->generate_text_box('conditions[google]', $input['conditions']['google'], array('id' => 'google')) . " {$lang->or} " . $form->generate_check_box('conditions[google_blank]', 1, $lang->is_not_blank, array('id' => 'google_blank', 'checked' => $input['conditions']['google_blank'])), 'google');
    $form_container->output_row($lang->signature_contains, "", $form->generate_text_box('conditions[signature]', $input['conditions']['signature'], array('id' => 'signature')) . " {$lang->or} " . $form->generate_check_box('conditions[signature_blank]', 1, $lang->is_not_blank, array('id' => 'signature_blank', 'checked' => $input['conditions']['signature_blank'])), 'signature');
    $form_container->output_row($lang->user_title_contains, "", $form->generate_text_box('conditions[usertitle]', $input['conditions']['usertitle'], array('id' => 'usertitle')) . " {$lang->or} " . $form->generate_check_box('conditions[usertitle_blank]', 1, $lang->is_not_blank, array('id' => 'usertitle_blank', 'checked' => $input['conditions']['usertitle_blank'])), 'usertitle');
    $greater_options = array("greater_than" => $lang->greater_than, "is_exactly" => $lang->is_exactly, "less_than" => $lang->less_than);
    $form_container->output_row($lang->post_count_is, "", $form->generate_select_box('conditions[postnum_dir]', $greater_options, $input['conditions']['postnum_dir'], array('id' => 'numposts_dir')) . " " . $form->generate_text_box('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'numposts')), 'numposts');
    $form_container->output_row($lang->thread_count_is, "", $form->generate_select_box('conditions[threadnum_dir]', $greater_options, $input['conditions']['threadnum_dir'], array('id' => 'numthreads_dir')) . " " . $form->generate_text_box('conditions[threadnum]', $input['conditions']['threadnum'], array('id' => 'numthreads')), 'numthreads');
    $form_container->output_row($lang->reg_in_x_days, '', $form->generate_text_box('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate')) . ' ' . $lang->days, 'regdate');
    $form_container->output_row($lang->reg_ip_matches, $lang->wildcard, $form->generate_text_box('conditions[regip]', $input['conditions']['regip'], array('id' => 'regip')), 'regip');
    $form_container->output_row($lang->last_known_ip, $lang->wildcard, $form->generate_text_box('conditions[lastip]', $input['conditions']['lastip'], array('id' => 'lastip')), 'lastip');
    $form_container->output_row($lang->posted_with_ip, $lang->wildcard, $form->generate_text_box('conditions[postip]', $input['conditions']['postip'], array('id' => 'postip')), 'postip');
    $form_container->end();
    // Custom profile fields go here
    $form_container = new FormContainer($lang->custom_profile_fields_match);
    // Fetch custom profile fields
    $query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
    $profile_fields = array();
    while ($profile_field = $db->fetch_array($query)) {
        if ($profile_field['required'] == 1) {
            $profile_fields['required'][] = $profile_field;
        } else {
            $profile_fields['optional'][] = $profile_field;
        }
    }
    output_custom_profile_fields($profile_fields['required'], $input['profile_fields'], $form_container, $form, true);
    output_custom_profile_fields($profile_fields['optional'], $input['profile_fields'], $form_container, $form, true);
    $form_container->end();
    // Autocompletion for usernames
    echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">
<script type="text/javascript" src="../jscripts/select2/select2.min.js?ver=1804"></script>
<script type="text/javascript">
<!--
$("#username").select2({
	placeholder: "' . $lang->search_for_a_user . '",
	minimumInputLength: 3,
	maximumSelectionSize: 3,
	multiple: false,
	ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
		url: "../xmlhttp.php?action=get_users",
		dataType: \'json\',
		data: function (term, page) {
			return {
				query: term // search term
			};
		},
		results: function (data, page) { // parse the results into the format expected by Select2.
			// since we are using custom formatting functions we do not need to alter remote JSON data
			return {results: data};
		}
	},
	initSelection: function(element, callback) {
		var query = $(element).val();
		if (query !== "") {
			$.ajax("../xmlhttp.php?action=get_users&getone=1", {
				data: {
					query: query
				},
				dataType: "json"
			}).done(function(data) { callback(data); });
		}
	}
});
// -->
</script>';
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:98,代码来源:users.php

示例14: 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 . "&amp;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 . "&amp;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&amp;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&amp;action=manage-keys");
                        } else {
                            $keyset = $result->fetch_array();
                            $form = new Form("index.php?module=config-" . RESTFULAPI_URL . "&amp;action=manage-keys&amp;do=edit&amp;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&amp;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&amp;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%"));
//.........这里部分代码省略.........
开发者ID:Shade-,项目名称:MyBB-RESTful-API-System,代码行数:101,代码来源:restfulapi.php

示例15: user_search_conditions

function user_search_conditions($input = array(), &$form)
{
    global $mybb, $db, $lang;
    if (!$input) {
        $input = $mybb->input;
    }
    if (!is_array($input['conditions'])) {
        $input['conditions'] = unserialize($input['conditions']);
    }
    if (!is_array($input['fields'])) {
        $input['fields'] = unserialize($input['fields']);
    }
    $form_container = new FormContainer($lang->find_users_where);
    $form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', $input['conditions']['username'], array('id' => 'username')), 'username');
    $form_container->output_row($lang->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');
    $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
    while ($usergroup = $db->fetch_array($query)) {
        $options[$usergroup['gid']] = $usergroup['title'];
    }
    $form_container->output_row($lang->is_member_of_groups, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');
    $form_container->output_row($lang->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website')), 'website');
    $form_container->output_row($lang->icq_number_contains, "", $form->generate_text_box('conditions[icq]', $input['conditions']['icq'], array('id' => 'icq')), 'icq');
    $form_container->output_row($lang->aim_handle_contains, "", $form->generate_text_box('conditions[aim]', $input['conditions']['aim'], array('id' => 'aim')), 'aim');
    $form_container->output_row($lang->yahoo_contains, "", $form->generate_text_box('conditions[yahoo]', $input['conditions']['yahoo'], array('id' => 'yahoo')), 'yahoo');
    $form_container->output_row($lang->msn_contains, "", $form->generate_text_box('conditions[msn]', $input['conditions']['msn'], array('id' => 'msn')), 'msn');
    $form_container->output_row($lang->signature_contains, "", $form->generate_text_box('conditions[signature]', $input['conditions']['signature'], array('id' => 'signature')), 'signature');
    $form_container->output_row($lang->user_title_contains, "", $form->generate_text_box('conditions[usertitle]', $input['conditions']['usertitle'], array('id' => 'usertitle')), 'usertitle');
    $greater_options = array("greater_than" => $lang->greater_than, "is_exactly" => $lang->is_exactly, "less_than" => $lang->less_than);
    $form_container->output_row($lang->post_count_is, "", $form->generate_select_box('conditions[postnum_dir]', $greater_options, $input['conditions']['postnum_dir'], array('id' => 'numposts_dir')) . " " . $form->generate_text_box('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'numposts')), 'numposts');
    $form_container->output_row($lang->reg_ip_matches, $lang->wildcard, $form->generate_text_box('conditions[regip]', $input['conditions']['regip'], array('id' => 'regip')), 'regip');
    $form_container->output_row($lang->last_known_ip, $lang->wildcard, $form->generate_text_box('conditions[lastip]', $input['conditions']['lastip'], array('id' => 'lastip')), 'lastip');
    $form_container->output_row($lang->posted_with_ip, $lang->wildcard, $form->generate_text_box('conditions[postip]', $input['conditions']['postip'], array('id' => 'postip')), 'postip');
    $form_container->end();
    // Custom profile fields go here
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:35,代码来源:users.php


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