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


PHP build_hidden_fields函数代码示例

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


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

示例1: process_delete

    /**
     * Process Delete (confirmed)
     */
    function process_delete()
    {
        global $db, $user;
        // check mode
        if (confirm_box(true)) {
            $ownraidids = request_var('own_raid_id', array(0 => 0));
            $ownraidnames = utf8_normalize_nfc(request_var('own_raid_name', ' ', true));
            foreach ($ownraidids as $key => $ownraidid) {
                $sql = 'DELETE from ' . RT_OWN_RAIDS_TABLE . ' where own_raid_id = ' . $ownraidid;
                $result = $db->sql_query($sql);
            }
            // Append success message
            $success_message .= sprintf($user->lang['RT_OWN_RAID_SUCCESS_DELETE'], $ownraidnames) . '<br />';
            // Success message
            trigger_error($success_message . $this->Raidtrackerlink, E_USER_NOTICE);
        } else {
            if (isset($_POST['compare_ids'])) {
                $compare_ids = request_var('compare_ids', array(0 => 0));
                foreach ($compare_ids as $id) {
                    $sql = "SELECT own_raid_id , own_raid_name FROM " . RT_OWN_RAIDS_TABLE . '
	   						  where own_raid_id = ' . (int) $id;
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $own_raid_name[] = $row['own_raid_name'];
                    }
                }
                $own_raid_namelist = implode(', ', $own_raid_name);
            }
            $s_hidden_fields = build_hidden_fields(array('delete' => true, 'own_raid_id' => $compare_ids, 'own_raid_name' => $own_raid_namelist));
            confirm_box(false, $user->lang['RT_OWN_RAID_CONFIRM_DELETE'] . ' <br />  ' . $own_raid_namelist, $s_hidden_fields);
        }
    }
开发者ID:ZerGabriel,项目名称:Raidtracker,代码行数:35,代码来源:ownraids.php

示例2: display_confirm

 /**
  * Display confirm box
  *
  * @param	string $action Requested action
  * @return	null
  */
 public function display_confirm($action)
 {
     switch ($action) {
         case 'votes':
             $confirm = true;
             $confirm_lang = 'DIR_RESET_VOTES_CONFIRM';
             break;
         case 'comments':
             $confirm = true;
             $confirm_lang = 'DIR_RESET_COMMENTS_CONFIRM';
             break;
         case 'clicks':
             $confirm = true;
             $confirm_lang = 'DIR_RESET_CLICKS_CONFIRM';
             break;
         case 'orphans':
             $confirm = true;
             $confirm_lang = 'DIR_DELETE_ORPHANS';
             break;
         default:
             $confirm = false;
     }
     if ($confirm) {
         confirm_box(false, $this->user->lang[$confirm_lang], build_hidden_fields(array('action' => $action)));
     }
 }
开发者ID:rmcgirr83,项目名称:ext-phpbb-directory,代码行数:32,代码来源:main.php

示例3: main

    function main($id, $mode)
    {
        global $db, $user, $template, $auth, $phpbb_container;
        $forbidden_forums = $auth->acl_getf('!f_read', true);
        $forbidden_forums = array_unique(array_keys($forbidden_forums));
        $controller = $phpbb_container->get('sheer.postbookmark.helper');
        $controller->get_bookmarks(false, $forbidden_forums);
        if (isset($_POST['unbookmark'])) {
            $s_hidden_fields = array('unbookmark' => 1);
            $topics = isset($_POST['t']) ? array_keys(request_var('t', array(0 => 0))) : array();
            $url = $this->u_action;
            if (!sizeof($topics)) {
                trigger_error('NO_BOOKMARKS_SELECTED');
            }
            foreach ($topics as $topic_id) {
                $s_hidden_fields['t'][$topic_id] = 1;
            }
            if (confirm_box(true)) {
                $sql = 'DELETE FROM ' . POSTS_BOOKMARKS_TABLE . '
					WHERE user_id = ' . $user->data['user_id'] . '
						AND ' . $db->sql_in_set('post_id', $topics);
                $db->sql_query($sql);
                meta_refresh(3, $url);
                $message = $user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>');
                trigger_error($message);
            } else {
                confirm_box(false, 'REMOVE_SELECTED_BOOKMARKS', build_hidden_fields($s_hidden_fields));
            }
        }
        $template->assign_vars(array('S_HIDDEN_FIELDS' => isset($s_hidden_fields) ? $s_hidden_fields : '', 'S_UCP_ACTION' => $this->u_action));
        $this->tpl_name = 'ucp_postbookmark_body';
    }
开发者ID:AlexSheer,项目名称:phpbb3.1-PostBookmark,代码行数:32,代码来源:postbookmark_module.php

示例4: handle_gb_post_delete

/**
* Do the various checks required for removing posts as well as removing it
*/
function handle_gb_post_delete($post_id, &$post_data, &$guestbook)
{
    global $user, $db, $auth, $config;
    global $phpbb_root_path, $phpEx;
    // If moderator removing post or user itself removing post, present a confirmation screen
    if ($auth->acl_get('m_gb_delete') || $post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('u_gb_delete') && ($post_data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time'])) {
        $s_hidden_fields = build_hidden_fields(array('p' => $post_id, 'gbmode' => 'delete'));
        if (confirm_box(true)) {
            $data = array('post_time' => $post_data['post_time'], 'poster_id' => $post_data['poster_id']);
            $next_post_id = gb_delete_post($post_id, $data, $guestbook);
            $post_username = $post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username']) ? $post_data['post_username'] : $post_data['username'];
            add_log('mod', 0, 0, 'LOG_GB_DELETE_POST', $post_username);
            $member = $guestbook->getmember();
            $meta_info = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&amp;u=" . $member['user_id']);
            unset($member);
            $message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_PROFILE'], '<a href="' . $meta_info . '">', '</a>');
            meta_refresh(3, $meta_info);
            trigger_error($message);
        } else {
            confirm_box(false, 'DELETE_POST', $s_hidden_fields);
        }
        redirect(append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&amp;u=" . request_var('u', 0)));
    }
    // If we are here the user is not able to delete - present the correct error message
    if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('u_gb_delete')) {
        trigger_error('DELETE_OWN_POSTS');
    }
    trigger_error('USER_CANNOT_DELETE');
}
开发者ID:paul999,项目名称:profile-guestbook,代码行数:32,代码来源:functions_guestbook.php

示例5: display_options

    function display_options()
    {
        global $db, $template, $user, $cache;
        $off = request_var('off', false);
        page_header($user->lang['CLEAR_EXTENSIONS']);
        $no_composer = false;
        if ($off) {
            $uids = request_var('marked_name', array('', ''));
            if (empty($uids)) {
                $error[] = 'NO_EXT_SELECTED';
                trigger_error('NO_EXT_SELECTED', E_USER_WARNING);
            }
            if (confirm_box(true)) {
                $sql = 'UPDATE ' . EXT_TABLE . '
					SET ext_active = 0
					WHERE ' . $db->sql_in_set('ext_name', $uids, false);
                $db->sql_query($sql);
                $cache->purge();
                // Purge the cache
                trigger_error('OFF_EXT_SUCCESS');
            } else {
                $hidden = build_hidden_fields(array('marked_name' => $uids));
                confirm_box(false, 'EXT_OFF', $hidden, 'confirm_body.html', STK_DIR_NAME . '/index.' . PHP_EXT . '?c=admin&amp;t=clear_extensions&amp;off=' . true);
            }
        }
        $sql = 'SELECT *
			FROM ' . EXT_TABLE . '';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $path = explode('/', $row['ext_name']);
            $display_name = $root = $missing_path = '';
            foreach ($path as $key => $ext_path) {
                if ($dir = @opendir('' . PHPBB_ROOT_PATH . 'ext/' . $root . '' . $ext_path . '')) {
                    $file = readdir($dir);
                    $root = '' . $ext_path . '/';
                } else {
                    $missing_path = $ext_path;
                    break;
                }
            }
            if (!$missing_path) {
                if (file_exists('' . PHPBB_ROOT_PATH . 'ext/' . $row['ext_name'] . '/composer.json')) {
                    $buffer = file_get_contents('' . PHPBB_ROOT_PATH . 'ext/' . $row['ext_name'] . '/composer.json');
                    if ($buffer) {
                        $obj = json_decode($buffer);
                        $display_name = $obj->{'extra'}->{'display-name'};
                    }
                } else {
                    $no_composer = true;
                }
            }
            $template->assign_block_vars('row', array('EXT_NAME' => $row['ext_name'], 'MISSING_PATH' => $missing_path ? $missing_path : '', 'NO_COMPOSER' => $no_composer ? true : false, 'DISPLAY_NAME' => $display_name ? $display_name : sprintf($user->lang['NO_COMPOSER'], $row['ext_name']), 'NO_COMPOSER' => $display_name ? false : true, 'S_ACTIVE' => $row['ext_active'], 'EXT_MISSING_PATH' => $missing_path ? sprintf($user->lang['EXT_MISSING_PATH'], $row['ext_name']) : ''));
        }
        $db->sql_freeresult($result);
        $template->assign_vars(array('S_ACTION' => append_sid("" . STK_ROOT_PATH . "index." . PHP_EXT . "", 'c=admin&amp;t=clear_extensions')));
        $template->set_filenames(array('body' => 'tools/clear_extensions.html'));
        page_footer();
    }
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:58,代码来源:clear_extensions.php

示例6: main

 public function main($id, $mode)
 {
     global $config, $db, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
     $this->config = $config;
     $this->db = $db;
     $this->log = $phpbb_container->get('log');
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $phpEx;
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'acp_usermerge';
     // Set the page title for our ACP page
     $this->page_title = 'ACP_USER_MERGE';
     // Quick var-checking and var setup.
     $action = $this->request->variable('action', '');
     $merge = $action == 'merge' ? true : false;
     $errors = array();
     $old_username = $this->request->variable('old_username', '', true);
     $new_username = $this->request->variable('new_username', '', true);
     $form_key = 'acp_user_merge';
     add_form_key($form_key);
     // Hath we an invalid form key?
     if ($this->request->is_set_post('submit') && !check_form_key($form_key)) {
         $errors[] = $user->lang['FORM_INVALID'];
     }
     if ($this->request->is_set_post('submit') || $merge) {
         $old_user_id = $this->check_user($old_username, $errors, true);
         $new_user_id = $this->check_user($new_username, $errors, false);
     }
     // Make sure we have submitted the form, and that we do not have errors
     if (($this->request->is_set_post('submit') || $merge) && !sizeof($errors)) {
         if ($old_user_id == $new_user_id) {
             $warning = sprintf($this->user->lang['CANNOT_MERGE_SAME'], $old_username);
             trigger_error($warning . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Have we confirmed this change?
         if (confirm_box(true)) {
             // Let's roll!
             $this->user_merge($old_user_id, $new_user_id);
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_USERS_MERGED', time(), array($old_username . ' &raquo; ' . $new_username));
             trigger_error($this->user->lang['USERS_MERGED'] . adm_back_link($this->u_action));
         } else {
             $hidden_fields = array('i' => $id, 'mode' => $mode, 'old_username' => $old_username, 'new_username' => $new_username, 'action' => 'merge');
             // Be annoying.  Are you suuuuuuuuuuuure?  No, really, are you sure?
             $merge_users_confirm = sprintf($this->user->lang['MERGE_USERS_CONFIRM'], $old_username);
             confirm_box(false, $merge_users_confirm, build_hidden_fields($hidden_fields));
         }
     }
     $user_merge_version = !empty($this->config['usermerge_version']) ? $this->config['usermerge_version'] : '';
     // Assign template stuffs now.
     $this->page_title = $this->user->lang['ACP_USER_MERGE_TITLE'];
     $template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'USER_MERGE_VERSION' => $user_merge_version, 'U_FIND_OLD_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=user_merge&amp;field=old_username&amp;select_single=true'), 'U_FIND_NEW_USERNAME' => append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=user_merge&amp;field=new_username&amp;select_single=true'), 'OLD_USERNAME' => !empty($old_user_id) ? $old_username : '', 'NEW_USERNAME' => !empty($new_user_id) ? $new_username : '', 'L_TITLE' => $this->user->lang['ACP_USER_MERGE_TITLE'], 'L_EXPLAIN' => $this->user->lang['ACP_USER_MERGE_EXPLAIN'], 'USERMERGE_VERSION' => $user_merge_version, 'U_ACTION' => $this->u_action));
 }
开发者ID:phpbb-store,项目名称:OfficeForum,代码行数:55,代码来源:usermerge_module.php

示例7: main

    public function main($id, $mode)
    {
        global $config, $db, $user, $template, $table_prefix, $request;
        $user->add_lang_ext('tas2580/paypal', 'common');
        switch ($mode) {
            case 'settings':
                $this->tpl_name = 'acp_paypal_body';
                $this->page_title = $user->lang('ACP_PAYPAL_TITLE');
                add_form_key('acp_paypal');
                // delete amount
                if ($request->is_set('delete')) {
                    $id = $request->variable('delete', 0);
                    if (confirm_box(true)) {
                        $sql = 'DELETE FROM ' . $table_prefix . 'paypal_amount WHERE amount_id = ' . (int) $id;
                        $result = $db->sql_query($sql);
                        trigger_error($user->lang['AMOUNT_DELETED'] . adm_back_link($this->u_action));
                    } else {
                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('action' => 'delete', 'id' => $id)));
                    }
                }
                // Form is submitted
                if ($request->is_set_post('submit')) {
                    if (!check_form_key('acp_paypal')) {
                        trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
                    }
                    $config->set('paypal_email', $request->variable('paypal_email', ''));
                    $config->set('paypal_default_item', $request->variable('paypal_default_item', '', true));
                    $config->set('paypal_description', $request->variable('paypal_description', '', true));
                    $config->set('currency_code', $request->variable('currency_code', ''));
                    trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
                }
                // Form is submitted
                if ($request->is_set_post('submit_amount')) {
                    $add_amount = $request->variable('add_amount', 0);
                    $sql_data = array('amount_value' => $add_amount);
                    $sql = 'INSERT INTO ' . $table_prefix . 'paypal_amount
						' . $db->sql_build_array('INSERT', $sql_data);
                    $db->sql_query($sql);
                    trigger_error($user->lang('ACP_SAVED') . adm_back_link($this->u_action));
                }
                $sql = 'SELECT *
					FROM ' . $table_prefix . 'paypal_amount
					ORDER BY amount_value';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $template->assign_block_vars('amounts', array('AMOUNT' => number_format($row['amount_value'] / 100, 2), 'U_DELETE' => $this->u_action . '&delete=' . $row['amount_id']));
                }
                $template->assign_vars(array('U_ACTION' => $this->u_action, 'PAYPAL_EMAIL' => isset($config['paypal_email']) ? $config['paypal_email'] : '', 'PAYPAL_DEFAULT_ITEM' => isset($config['paypal_default_item']) ? $config['paypal_default_item'] : '', 'PAYPAL_DESCRIPTION' => isset($config['paypal_description']) ? $config['paypal_description'] : '', 'SEL_CURRENCY_CODE' => isset($config['currency_code']) ? $user->lang('DONATION_' . $config['currency_code']) : '', 'CURRENCY_CODE' => $this->currency_code_select($config['currency_code'])));
                break;
            case 'items':
                $this->tpl_name = 'acp_paypal_items_body';
                $this->page_title = $user->lang('ACP_PAYPAL_ITEMS');
                break;
        }
    }
开发者ID:joe80,项目名称:paypal,代码行数:55,代码来源:paypal_module.php

示例8: quick_reply

/**
 * This function will load everything needed for the evil quick reply
 *
 * @param int $topic_id
 * @param int $forum_id
 * @param array $topic_data
 */
function quick_reply($topic_id, $forum_id, &$topic_data)
{
    global $template, $user, $auth, $db;
    global $phpbb_root_path, $phpEx, $config;
    // Some little config for the quick reply, allows the admin to change these default values through the database.
    $qr_config = array('enabled' => true, 'display_subject' => true, 'hide_box' => false, 'resize' => false);
    // do evil_qr_ prefixed of the config values exist in $config
    // /me slaps highway of life
    foreach (array_keys($qr_config) as $key) {
        if (isset($config['evil_qr_' . $key])) {
            $qr_config[$key] = $config['evil_qr_' . $key];
        }
    }
    // Check if user has reply permissions for this forum or the topic is locked (thanks damnian)
    if (!$auth->acl_get('f_reply', $forum_id) || $topic_data['topic_status'] == ITEM_LOCKED && !$auth->acl_get('m_lock', $forum_id) || !$qr_config['enabled']) {
        return;
    }
    // Hidden fields
    $s_hidden_fields = array('t' => $topic_id, 'f' => $forum_id, 'mode' => 'reply', 'lastclick' => time(), 'icon' => 0);
    // Set preferences such as allow smilies, bbcode, attachsig
    $reply_prefs = array('disable_bbcode' => $config['allow_bbcode'] && $user->optionget('bbcode') ? false : true, 'disable_smilies' => $config['allow_smilies'] && $user->optionget('smilies') ? false : true, 'disable_magic_url' => false, 'attach_sig' => $config['allow_sig'] && $user->optionget('attachsig') ? true : false, 'notify' => $config['allow_topic_notify'] && ($user->data['user_notify'] || isset($topic_data['notify_status'])) ? true : false, 'lock_topic' => $topic_data['topic_status'] == ITEM_LOCKED && $auth->acl_get('m_lock', $forum_id) ? true : false);
    foreach ($reply_prefs as $name => $value) {
        if ($value) {
            $s_hidden_fields[$name] = 1;
        }
    }
    $subject = (strpos($topic_data['topic_title'], 'Re: ') !== 0 ? 'Re: ' : '') . censor_text($topic_data['topic_title']);
    if (!$qr_config['display_subject']) {
        // /me is a show-off
        list($s_hidden_fields['subject'], $subject) = array($subject, '');
    }
    // Confirmation code handling (stolen from posting.php)
    if ($config['enable_post_confirm'] && !$user->data['is_registered']) {
        // Show confirm image
        $sql = 'DELETE FROM ' . CONFIRM_TABLE . "\r\n\t\t\tWHERE session_id = '" . $db->sql_escape($user->session_id) . "'\r\n\t\t\t\tAND confirm_type = " . CONFIRM_POST;
        $db->sql_query($sql);
        // Generate code
        $code = gen_rand_string(mt_rand(5, 8));
        $confirm_id = md5(unique_id($user->ip));
        $seed = hexdec(substr(unique_id(), 4, 10));
        // compute $seed % 0x7fffffff
        $seed -= 0x7fffffff * floor($seed / 0x7fffffff);
        $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array('confirm_id' => (string) $confirm_id, 'session_id' => (string) $user->session_id, 'confirm_type' => (int) CONFIRM_POST, 'code' => (string) $code, 'seed' => (int) $seed));
        $db->sql_query($sql);
        $template->assign_vars(array('S_CONFIRM_CODE' => true, 'CONFIRM_ID' => $confirm_id, 'CONFIRM_IMAGE' => '<img src="' . append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=confirm&amp;id=' . $confirm_id . '&amp;type=' . CONFIRM_POST) . '" alt="" title="" />'));
    }
    // new RC6/RC7 stuff
    add_form_key('posting');
    // Page title & action URL, include session_id for security purpose
    $s_action = append_sid("{$phpbb_root_path}posting.{$phpEx}", false, true, $user->session_id);
    // Assign template variables
    $template->assign_vars(array('QR_SUBJECT' => $subject, 'S_QR_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), 'S_QR_POST_ACTION' => $s_action, 'S_QR_ENABLED' => $qr_config['enabled'], 'S_QR_SUBJECT' => $qr_config['display_subject'], 'S_QR_HIDE_BOX' => $qr_config['hide_box'], 'S_QR_RESIZE' => $qr_config['resize']));
}
开发者ID:sietf,项目名称:sietf.org,代码行数:60,代码来源:functions_quick_reply.php

示例9: main

 public function main($id, $mode)
 {
     global $cache, $phpbb_container, $request, $user;
     // Add the pages ACP lang file
     $user->add_lang_ext('phpbb/pages', 'pages_acp');
     // Get an instance of the admin controller
     $admin_controller = $phpbb_container->get('phpbb.pages.admin.controller');
     // Requests
     $action = $request->variable('action', '');
     $page_id = $request->variable('page_id', 0);
     // Make the $u_action url available in the admin controller
     $admin_controller->set_page_url($this->u_action);
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'manage_pages';
     // Set the page title for our ACP page
     $this->page_title = $user->lang('ACP_PAGES_MANAGE');
     // Perform any actions submitted by the user
     switch ($action) {
         case 'add':
             // Set the page title for our ACP page
             $this->page_title = $user->lang('ACP_PAGES_CREATE_PAGE');
             // Load the add page handle in the admin controller
             $admin_controller->add_page();
             // Return to stop execution of this script
             return;
             break;
         case 'edit':
             // Set the page title for our ACP page
             $this->page_title = $user->lang('ACP_PAGES_EDIT_PAGE');
             // Load the edit page handle in the admin controller
             $admin_controller->edit_page($page_id);
             // Return to stop execution of this script
             return;
             break;
         case 'delete':
             // Use a confirm box routine when deleting a page
             if (confirm_box(true)) {
                 // Delete page on confirmation from the user
                 $admin_controller->delete_page($page_id);
             } else {
                 // Request confirmation from the user to delete the page
                 confirm_box(false, $user->lang('ACP_PAGES_DELETE_CONFIRM'), build_hidden_fields(array('page_id' => $page_id, 'mode' => $mode, 'action' => $action)));
             }
             break;
         case 'purge_icons':
             // Purge icon cache
             $cache->destroy('_pages_icons');
             break;
     }
     // Display pages
     $admin_controller->display_pages();
 }
开发者ID:R3gi,项目名称:pages,代码行数:52,代码来源:pages_module.php

示例10: main

 function main($id, $mode)
 {
     global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $ultimate_points, $points_config, $points_values, $auth, $check_auth;
     $adm_points = request_var('adm_points', false);
     $u_id = request_var('user_id', 0);
     $post_id = request_var('post_id', 0);
     if (empty($u_id)) {
         $message = $user->lang['EDIT_NO_ID_SPECIFIED'] . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=bank_edit") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
         trigger_error($message);
     }
     $user_id = $u_id;
     add_form_key('bank_edit');
     if ($adm_points != false && ($auth->acl_get('a_points') || $auth->acl_get('m_chg_bank'))) {
         $template->assign_block_vars('administer_bank', array());
         if (isset($_POST['submit'])) {
             if (!check_form_key('bank_edit')) {
                 trigger_error('FORM_INVALID');
             }
             $new_points = round(request_var('points', 0.0), 2);
             set_bank($u_id, $new_points);
             $sql_array = array('SELECT' => 'user_id, username, user_points, user_colour', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . (int) $u_id);
             $sql = $db->sql_build_query('SELECT', $sql_array);
             $result = $db->sql_query($sql);
             $points_user = $db->sql_fetchrow($result);
             add_log('admin', 'LOG_MOD_BANK', $points_user['username']);
             $message = $post_id ? sprintf($user->lang['EDIT_P_RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "p=" . $post_id) . '">', '</a>') : sprintf($user->lang['EDIT_P_RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
             trigger_error(sprintf($user->lang['EDIT_POINTS_SET'], $config['points_name']) . $message);
         } else {
             $sql_array = array('SELECT' => 'u.user_id, u.username, u.user_points, u.user_colour, b.holding', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array(POINTS_BANK_TABLE => 'b'), 'ON' => 'u.user_id = b.user_id')), 'WHERE' => 'u.user_id = ' . (int) $u_id);
             $sql = $db->sql_build_query('SELECT', $sql_array);
             $result = $db->sql_query($sql);
             $row = $db->sql_fetchrow($result);
             if (empty($u_id)) {
                 $message = $user->lang['EDIT_USER_NOT_EXIST'] . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=bank_edit") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
                 trigger_error($message);
             }
             $hidden_fields = build_hidden_fields(array('user_id' => $u_id, 'post_id' => $post_id));
             $template->assign_vars(array('USER_NAME' => get_username_string('full', $u_id, $row['username'], $row['user_colour']), 'BANK_POINTS' => sprintf(number_format_points($row['holding'])), 'POINTS_NAME' => $config['points_name'], 'CURRENT_VALUE' => $row['holding'], 'L_POINTS_MODIFY' => sprintf($user->lang['EDIT_BANK_MODIFY'], $config['points_name']), 'L_P_BANK_TITLE' => sprintf($user->lang['EDIT_P_BANK_TITLE'], $config['points_name']), 'L_USERNAME' => $user->lang['USERNAME'], 'L_SET_AMOUNT' => $user->lang['EDIT_SET_AMOUNT'], 'U_USER_LINK' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&amp;u=" . $u_id), 'S_ACTION' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=bank_edit&amp;adm_points=1"), 'S_HIDDEN_FIELDS' => $hidden_fields));
         }
     } else {
         $message = $user->lang['NOT_AUTHORISED'];
         trigger_error($message);
     }
     // Generate the page
     page_header($user->lang['EDIT_POINTS_ADMIN']);
     // Generate the page template
     $template->set_filenames(array('body' => 'points/points_bank_edit.html'));
     page_footer();
 }
开发者ID:FifoF,项目名称:phpbb3.1_ultimate_points,代码行数:49,代码来源:points_bank_edit.php

示例11: main

 public function main($id, $mode)
 {
     global $phpbb_container, $request, $user;
     // Add the auto groups ACP lang file
     $user->add_lang_ext('phpbb/autogroups', 'autogroups_acp');
     // Get an instance of the admin controller
     $admin_controller = $phpbb_container->get('phpbb.autogroups.admin_controller');
     // Requests
     $action = $request->variable('action', '');
     $autogroups_id = $request->variable('autogroups_id', 0);
     // Make the $u_action url available in the admin controller
     $admin_controller->set_page_url($this->u_action);
     // Load a template from adm/style for our ACP auto groups
     $this->tpl_name = 'manage_autogroups';
     // Set the page title for our ACP auto groups
     $this->page_title = $user->lang('ACP_AUTOGROUPS_MANAGE');
     // Quick-submit settings from the general options form
     if ($request->is_set_post('generalsubmit')) {
         $admin_controller->submit_autogroups_options();
     }
     // Perform any actions submitted by the user
     switch ($action) {
         case 'add':
         case 'edit':
             // Set the page title for our ACP auto groups
             $this->page_title = $user->lang(strtoupper("ACP_AUTOGROUPS_{$action}"));
             // Load the save auto group handle in the admin controller
             $admin_controller->save_autogroup_rule($autogroups_id);
             // Return to stop execution of this script
             return;
             break;
         case 'sync':
             // Resync applies an auto group check against all users
             $admin_controller->resync_autogroup_rule($autogroups_id);
             break;
         case 'delete':
             // Use a confirm box routine when deleting an auto group rule
             if (confirm_box(true)) {
                 // Delete auto group rule on confirmation from the user
                 $admin_controller->delete_autogroup_rule($autogroups_id);
             } else {
                 // Request confirmation from the user to delete the auto group rule
                 confirm_box(false, $user->lang('ACP_AUTOGROUPS_DELETE_CONFIRM'), build_hidden_fields(array('autogroups_id' => $autogroups_id, 'mode' => $mode, 'action' => $action)));
             }
             break;
     }
     // Display auto group rules
     $admin_controller->display_autogroups();
 }
开发者ID:Nicofuma,项目名称:autogroups,代码行数:49,代码来源:autogroups_module.php

示例12: delete

    /**
     * Delete a version of an article
     *
     * @param	string	$id	Id of the version to delete
     * @return	object
     */
    public function delete($id)
    {
        if (!$this->auth->acl_get('u_wiki_delete')) {
            trigger_error('NOT_AUTHORISED');
        }
        if (confirm_box(true)) {
            $sql = 'DELETE FROM ' . $this->table_article . '
				WHERE article_id = ' . (int) $id;
            $this->db->sql_query($sql);
            //return $helper->message('DELETE_VERSION_SUCCESS', array());
            trigger_error($this->user->lang['DELETE_VERSION_SUCCESS'] . '<br /><br /><a href="' . $this->helper->route('tas2580_wiki_index', array()) . '">' . $this->user->lang['BACK_TO_WIKI'] . '</a>');
        } else {
            $s_hidden_fields = build_hidden_fields(array('id' => $id));
            confirm_box(false, $this->user->lang['CONFIRM_DELETE_VERSION'], $s_hidden_fields);
        }
    }
开发者ID:TWEagle,项目名称:wiki,代码行数:22,代码来源:edit.php

示例13: delete

 /**
  * Delete action (deletes an idea via confirm dialog)
  *
  * @return null
  * @access public
  */
 public function delete()
 {
     if ($this->is_mod()) {
         if (confirm_box(true)) {
             include $this->root_path . 'includes/functions_admin.' . $this->php_ext;
             $this->ideas->delete($this->data['idea_id'], $this->data['topic_id']);
             $redirect = $this->helper->route('phpbb_ideas_index_controller');
             $message = $this->language->lang('IDEA_DELETED') . '<br /><br />' . $this->language->lang('RETURN_IDEAS', '<a href="' . $redirect . '">', '</a>');
             meta_refresh(3, $redirect);
             trigger_error($message);
             // trigger error needed for data-ajax
         } else {
             confirm_box(false, $this->language->lang('CONFIRM_OPERATION'), build_hidden_fields(array('idea_id' => $this->data['idea_id'], 'mode' => 'delete')), 'confirm_body.html', $this->helper->route('phpbb_ideas_idea_controller', array('idea_id' => $this->data['idea_id'], 'mode' => 'delete'), true, false, UrlGeneratorInterface::ABSOLUTE_URL));
         }
     }
 }
开发者ID:melvingb,项目名称:phpbb-ideas,代码行数:22,代码来源:idea_controller.php

示例14: main

    function main($id, $mode)
    {
        global $db, $request, $user, $template, $phpbb_container;
        $this->tpl_name = 'acp_thanks_truncate';
        $this->page_title = 'ACP_THANKS_TRUNCATE';
        $all_posts_thanks = $all_thanks = $del_thanks = $del_uposts = $del_posts = 0;
        $thanks_table = $phpbb_container->getParameter('tables.thanks');
        $sql = 'SELECT COUNT(post_id) as total_match_count
			FROM ' . $thanks_table;
        $result = $db->sql_query($sql);
        $all_thanks = $end_thanks = $del_thanks = $db->sql_fetchfield('total_match_count');
        $db->sql_freeresult($result);
        $sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count
			FROM ' . $thanks_table;
        $result = $db->sql_query($sql);
        $all_posts_thanks = $del_posts = $end_posts_thanks = $db->sql_fetchfield('total_match_count');
        $db->sql_freeresult($result);
        $sql = 'SELECT COUNT(DISTINCT user_id) as total_match_count
			FROM ' . $thanks_table;
        $result = $db->sql_query($sql);
        $all_users_thanks = $del_uposts = $end_users_thanks = $db->sql_fetchfield('total_match_count');
        $db->sql_freeresult($result);
        $truncate = $request->variable('truncate', false);
        if ($truncate) {
            // check mode
            if (confirm_box(true)) {
                $sql = 'TRUNCATE TABLE ' . $thanks_table;
                $result = $db->sql_query($sql);
                $db->sql_freeresult($result);
                $sql = 'SELECT COUNT(post_id) as total_match_count
					FROM ' . $thanks_table;
                $result = $db->sql_query($sql);
                $end_thanks = $db->sql_fetchfield('total_match_count');
                $db->sql_freeresult($result);
                $end_posts_thanks = $all_posts_thanks - $del_posts;
                $end_users_thanks = $all_users_thanks - $del_uposts;
                $del_thanks = $all_thanks - $end_thanks;
            } else {
                $s_hidden_fields = build_hidden_fields(array('truncate' => true));
                //display mode
                confirm_box(false, 'TRUNCATE_THANKS', $s_hidden_fields);
                trigger_error($user->lang['TRUNCATE_NO_THANKS'] . adm_back_link($this->u_action));
            }
        }
        $template->assign_vars(array('ALLTHANKS' => $all_thanks, 'POSTSTHANKS' => $all_posts_thanks, 'USERSTHANKS' => $all_users_thanks, 'POSTSEND' => $end_posts_thanks, 'USERSEND' => $end_users_thanks, 'THANKSEND' => $end_thanks, 'S_TRUNCATE' => $truncate));
    }
开发者ID:borgesjoaquim,项目名称:thanks_for_posts,代码行数:46,代码来源:acp_thanks_truncate_module.php

示例15: main

 function main($id, $mode)
 {
     global $config, $db, $user, $auth, $template;
     global $phpbb_root_path, $phpEx;
     // Quick var-checking and var setup.
     $submit = isset($_POST['submit']) ? true : false;
     $action = request_var('action', '');
     $errors = array();
     $merge = $action == 'merge' ? true : false;
     $old_username = utf8_normalize_nfc(request_var('old_username', '', true));
     $new_username = utf8_normalize_nfc(request_var('new_username', '', true));
     // Setup some things for the module.
     $user->add_lang(array('mods/info_acp_user_merge', 'mods/lang_user_merge'));
     $this->tpl_name = 'acp_user_merge';
     $form_key = 'acp_user_merge';
     add_form_key($form_key);
     // Hath we an invalid form key?
     if ($submit && !check_form_key($form_key)) {
         $errors[] = $user->lang['FORM_INVALID'];
     }
     if ($submit || $merge) {
         $old_user_id = $this->check_user($old_username, $errors, true);
         $new_user_id = $this->check_user($new_username, $errors, false);
     }
     // Make sure we have submitted the form, and that we do not have errors
     if (($submit || $merge) && !sizeof($errors)) {
         // Have we confirmed this change?
         if (confirm_box(true)) {
             // Let's roll!
             user_merge($old_user_id, $new_user_id);
             add_log('admin', 'LOG_USERS_MERGED', $old_username . ' &raquo; ' . $new_username);
             trigger_error($user->lang['USERS_MERGED'] . adm_back_link($this->u_action));
         } else {
             $hidden_fields = array('i' => $id, 'mode' => $mode, 'old_username' => $old_username, 'new_username' => $new_username, 'action' => 'merge');
             // Be annoying.  Are you suuuuuuuuuuuure?  No, really, are you sure?
             confirm_box(false, $user->lang['MERGE_USERS_CONFIRM'], build_hidden_fields($hidden_fields));
         }
     }
     $user_merge_version = !empty($config['user_merge_version']) ? $config['user_merge_version'] : '';
     // Assign template stuffs now.
     $this->page_title = $user->lang['ACP_USER_MERGE_TITLE'];
     $template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'USER_MERGE_VERSION' => $user_merge_version, 'U_FIND_OLD_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=user_merge&amp;field=old_username&amp;select_single=true'), 'U_FIND_NEW_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=user_merge&amp;field=new_username&amp;select_single=true'), 'OLD_USERNAME' => !empty($old_user_id) ? $old_username : '', 'NEW_USERNAME' => !empty($new_user_id) ? $new_username : '', 'L_TITLE' => $user->lang['ACP_USER_MERGE_TITLE'], 'L_EXPLAIN' => $user->lang['ACP_USER_MERGE_EXPLAIN'], 'U_ACTION' => $this->u_action));
 }
开发者ID:phpbbmodders-30x-mods,项目名称:user_merge,代码行数:43,代码来源:acp_user_merge.php


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