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


PHP group_select_options函数代码示例

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


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

示例1: display_options

 /**
  * Display the options a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_options()
 {
     // Create a form key for preventing CSRF attacks
     $form_key = 'login_redirect';
     add_form_key($form_key);
     // Is the form being submitted
     if ($this->request->is_set_post('submit')) {
         // Is the submitted form is valid
         if (!check_form_key($form_key)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Check that the entered topics are valid
         $this->topic_valid($this->request->variable('redirect_announce_topic_id', ''), $this->user->lang('INVALID_ANNOUNCEMENT_TOPIC'));
         $this->topic_valid($this->request->variable('redirect_welcome_topic_id', ''), $this->user->lang('INVALID_WELCOME_TOPIC'));
         $this->topic_valid($this->request->variable('redirect_group_topic_id', ''), $this->user->lang('INVALID_GROUP_TOPIC'));
         // If no errors, process the form data
         // Set the options the user configured
         $this->set_options();
         // Add option settings change action to the admin log
         $phpbb_log = $this->container->get('log');
         $phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_LOGIN_REDIRECT');
         // Option settings have been updated and logged
         // Confirm this to the user and provide link back to previous page
         trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     // Set output vars for display in the template
     $this->template->assign_vars(array('REDIRECT_ANNOUNCE' => isset($this->config['redirect_announce']) ? $this->config['redirect_announce'] : '', 'REDIRECT_ANNOUNCE_PRIORITY' => isset($this->config['redirect_announce_priority']) ? $this->config['redirect_announce_priority'] : '', 'REDIRECT_ANNOUNCE_REFRESH' => isset($this->config['redirect_announce_refresh']) ? $this->config['redirect_announce_refresh'] : '', 'REDIRECT_ANNOUNCE_TOPIC_ID' => isset($this->config['redirect_announce_topic_id']) ? $this->config['redirect_announce_topic_id'] : '', 'REDIRECT_ANY_ANNOUNCE' => isset($this->config['redirect_any_announce']) ? $this->config['redirect_any_announce'] : '', 'REDIRECT_ENABLED' => isset($this->config['redirect_enabled']) ? $this->config['redirect_enabled'] : '', 'REDIRECT_GROUP' => isset($this->config['redirect_group']) ? $this->config['redirect_group'] : '', 'REDIRECT_GROUP_ALL' => isset($this->config['redirect_group_all']) ? $this->config['redirect_group_all'] : '', 'REDIRECT_GROUP_REFRESH' => isset($this->config['redirect_group_refresh']) ? $this->config['redirect_group_refresh'] : '', 'REDIRECT_GROUP_TOPIC_ID' => isset($this->config['redirect_group_topic_id']) ? $this->config['redirect_group_topic_id'] : '', 'REDIRECT_WELCOME' => isset($this->config['redirect_welcome']) ? $this->config['redirect_welcome'] : '', 'REDIRECT_WELCOME_REFRESH' => isset($this->config['redirect_welcome_refresh']) ? $this->config['redirect_welcome_refresh'] : '', 'REDIRECT_WELCOME_TOPIC_ID' => isset($this->config['redirect_welcome_topic_id']) ? $this->config['redirect_welcome_topic_id'] : '', 'S_REDIRECT_GROUP_OPTIONS' => group_select_options($this->config['redirect_group_id'], false, false), 'U_ACTION' => $this->u_action));
 }
开发者ID:Galixte,项目名称:david63-loginredirect,代码行数:34,代码来源:admin_controller.php

示例2: display_settings

 /**
  * Display the general settings a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_settings()
 {
     // Define the name of the form for use as a form key
     add_form_key('ppde_settings');
     // Create an array to collect errors that will be output to the user
     $errors = array();
     $this->submit_settings();
     // Set output vars for display in the template
     $this->template->assign_vars(array('S_ERROR' => $this->check_config(sizeof($errors)), 'ERROR_MSG' => sizeof($errors) ? implode('<br />', $errors) : '', 'U_ACTION' => $this->u_action, 'PPDE_ACCOUNT_ID' => $this->check_config($this->config['ppde_account_id'], 'string', ''), 'PPDE_DEFAULT_CURRENCY' => $this->container->get('skouat.ppde.controller')->build_currency_select_menu($this->config['ppde_default_currency']), 'PPDE_DEFAULT_VALUE' => $this->check_config($this->config['ppde_default_value'], 'integer', 0), 'PPDE_DROPBOX_VALUE' => $this->check_config($this->config['ppde_dropbox_value'], 'string', '1,2,3,4,5,10,20,25,50,100'), 'S_PPDE_DROPBOX_ENABLE' => $this->check_config($this->config['ppde_dropbox_enable']), 'S_PPDE_ENABLE' => $this->check_config($this->config['ppde_enable']), 'S_PPDE_HEADER_LINK' => $this->check_config($this->config['ppde_header_link']), 'S_PPDE_IPN_AG_ENABLE' => $this->check_config($this->config['ppde_ipn_autogroup_enable']), 'S_PPDE_IPN_AG_GROUP_AS_DEFAULT' => $this->check_config($this->config['ppde_ipn_group_as_default']), 'S_PPDE_IPN_ENABLE' => $this->check_config($this->config['ppde_ipn_enable']), 'S_PPDE_IPN_GROUP_OPTIONS' => group_select_options($this->config['ppde_ipn_group_id']), 'S_PPDE_IPN_LOGGING' => $this->check_config($this->config['ppde_ipn_logging']), 'PPDE_SANDBOX_ADDRESS' => $this->check_config($this->config['ppde_sandbox_address'], 'string', ''), 'S_PPDE_SANDBOX_ENABLE' => $this->check_config($this->config['ppde_sandbox_enable']), 'S_PPDE_SANDBOX_FOUNDER_ENABLE' => $this->check_config($this->config['ppde_sandbox_founder_enable']), 'PPDE_RAISED' => $this->check_config($this->config['ppde_raised'], 'float', 0), 'PPDE_GOAL' => $this->check_config($this->config['ppde_goal'], 'float', 0), 'PPDE_USED' => $this->check_config($this->config['ppde_used'], 'float', 0), 'S_PPDE_STATS_INDEX_ENABLE' => $this->check_config($this->config['ppde_stats_index_enable']), 'S_PPDE_RAISED_ENABLE' => $this->check_config($this->config['ppde_raised_enable']), 'S_PPDE_GOAL_ENABLE' => $this->check_config($this->config['ppde_goal_enable']), 'S_PPDE_USED_ENABLE' => $this->check_config($this->config['ppde_used_enable'])));
 }
开发者ID:3D-I,项目名称:ext_paypal_donation,代码行数:16,代码来源:admin_settings_controller.php

示例3: main

 function main($id, $mode)
 {
     global $user, $template, $phpbb_root_path, $phpbb_admin_path, $table_prefix, $db;
     global $phpbb_container;
     $controller = $phpbb_container->get('alg.adminnotifications.adminnotifications_handler');
     $this->tpl_name = 'acp_adminnotifications';
     $this->page_title = 'ACP_ADMINNOTIFICATIONS_SETTINGS';
     $user->add_lang('acp/permissions');
     $form_key = 'acp_adminnotifications';
     add_form_key($form_key);
     $sql = "SELECT * from " . $table_prefix . "adminnotifications ORDER BY create_time DESC";
     $result = $db->sql_query($sql);
     if (is_array($result) || is_object($result)) {
         foreach ($result as $row) {
             $template->assign_block_vars('notysaved', array('NOTY_ID' => $row['noty_id'], 'NOTY_TITLE' => $row['noty_title'], 'NOTY_CONTENT' => $row['noty_content'], 'NOTY_TOOLTIP' => $controller->character_limit($row['noty_content'], 60), 'CREATE_TIME' => $row['create_time'] ? $user->format_date($row['create_time'], "d/m/Y H:i") : 0, 'PARSE_TYPE' => $row['parse_type']));
         }
         $db->sql_freeresult($result);
     }
     $exclude_guests = array();
     $exclude_ids[] = acp_adminnotifications_module::GUESTS;
     $exclude_ids[] = acp_adminnotifications_module::BOTS;
     $template->assign_vars(array('S_ADMINNOTIFICATIONS_PAGE' => true, 'S_GROUP_OPTIONS' => group_select_options(false, $exclude_ids, false), 'U_ADMINNOTIFICATIONS_PATH' => './../adminnotifications/'));
 }
开发者ID:alg5,项目名称:adminnotifications,代码行数:23,代码来源:acp_adminnotifications_module.php

示例4: main


//.........这里部分代码省略.........
						        OR b.ban_exclude = 1)';
                        $sql_ary['LEFT_JOIN'] = array(array('FROM' => array(BANLIST_TABLE => 'b'), 'ON' => 'u.user_id = b.ban_userid'));
                    }
                    $sql = $db->sql_build_query('SELECT', $sql_ary);
                }
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                if (!$row) {
                    $db->sql_freeresult($result);
                    trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
                }
                $i = $j = 0;
                // Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
                $max_chunk_size = 50;
                $email_list = array();
                $old_lang = $row['user_lang'];
                $old_notify_type = $row['user_notify_type'];
                do {
                    if ($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email'] || $row['user_notify_type'] == NOTIFY_IM && $row['user_jabber'] || $row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])) {
                        if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) {
                            $i = 0;
                            if (sizeof($email_list)) {
                                $j++;
                            }
                            $old_lang = $row['user_lang'];
                            $old_notify_type = $row['user_notify_type'];
                        }
                        $email_list[$j][$i]['lang'] = $row['user_lang'];
                        $email_list[$j][$i]['method'] = $row['user_notify_type'];
                        $email_list[$j][$i]['email'] = $row['user_email'];
                        $email_list[$j][$i]['name'] = $row['username'];
                        $email_list[$j][$i]['jabber'] = $row['user_jabber'];
                        $i++;
                    }
                } while ($row = $db->sql_fetchrow($result));
                $db->sql_freeresult($result);
                // Send the messages
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $messenger = new messenger($use_queue);
                $errored = false;
                for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) {
                    $used_lang = $email_list[$i][0]['lang'];
                    $used_method = $email_list[$i][0]['method'];
                    for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) {
                        $email_row = $email_list[$i][$j];
                        $messenger->{sizeof($email_list[$i]) == 1 ? 'to' : 'bcc'}($email_row['email'], $email_row['name']);
                        $messenger->im($email_row['jabber'], $email_row['name']);
                    }
                    $messenger->template('admin_send_email', $used_lang);
                    $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
                    $messenger->subject(htmlspecialchars_decode($subject));
                    $messenger->set_mail_priority($priority);
                    $messenger->assign_vars(array('CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => htmlspecialchars_decode($message)));
                    if (!$messenger->send($used_method)) {
                        $errored = true;
                    }
                }
                unset($email_list);
                $messenger->save_queue();
                if ($usernames) {
                    $usernames = explode("\n", $usernames);
                    add_log('admin', 'LOG_MASS_EMAIL', implode(', ', utf8_normalize_nfc($usernames)));
                } else {
                    if ($group_id) {
                        $group_name = get_group_name($group_id);
                    } else {
                        // Not great but the logging routine doesn't cope well with localising on the fly
                        $group_name = $user->lang['ALL_USERS'];
                    }
                    add_log('admin', 'LOG_MASS_EMAIL', $group_name);
                }
                if (!$errored) {
                    $message = $use_queue ? $user->lang['EMAIL_SENT_QUEUE'] : $user->lang['EMAIL_SENT'];
                    trigger_error($message . adm_back_link($this->u_action));
                } else {
                    $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=logs&amp;mode=critical') . '">', '</a>');
                    trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
                }
            }
        }
        // Exclude bots and guests...
        $sql = 'SELECT group_id
			FROM ' . GROUPS_TABLE . "\n\t\t\tWHERE group_name IN ('BOTS', 'GUESTS')";
        $result = $db->sql_query($sql);
        $exclude = array();
        while ($row = $db->sql_fetchrow($result)) {
            $exclude[] = $row['group_id'];
        }
        $db->sql_freeresult($result);
        $select_list = '<option value="0"' . (!$group_id ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
        $select_list .= group_select_options($group_id, $exclude);
        $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
        $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
        $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
        $template->assign_vars(array('S_WARNING' => sizeof($error) ? true : false, 'WARNING_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => $usernames, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=acp_email&amp;field=usernames'), 'SUBJECT' => $subject, 'MESSAGE' => $message, 'S_PRIORITY_OPTIONS' => $s_priority_options));
    }
开发者ID:noprom,项目名称:cryptdb,代码行数:101,代码来源:acp_email.php

示例5: main


//.........这里部分代码省略.........
                $type_free = $group_type == GROUP_FREE ? ' checked="checked"' : '';
                $type_open = $group_type == GROUP_OPEN ? ' checked="checked"' : '';
                $type_closed = $group_type == GROUP_CLOSED ? ' checked="checked"' : '';
                $type_hidden = $group_type == GROUP_HIDDEN ? ' checked="checked"' : '';
                // Load up stuff for avatars
                if ($config['allow_avatar']) {
                    $avatars_enabled = false;
                    $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type']));
                    foreach ($avatar_drivers as $current_driver) {
                        $driver = $phpbb_avatar_manager->get_driver($current_driver);
                        $avatars_enabled = true;
                        $template->set_filenames(array('avatar' => $driver->get_acp_template_name()));
                        if ($driver->prepare_form($request, $template, $user, $avatar_data, $avatar_error)) {
                            $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver);
                            $driver_upper = strtoupper($driver_name);
                            $template->assign_block_vars('avatar_drivers', array('L_TITLE' => $user->lang($driver_upper . '_TITLE'), 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), 'DRIVER' => $driver_name, 'SELECTED' => $current_driver == $selected_driver, 'OUTPUT' => $template->assign_display('avatar')));
                        }
                    }
                }
                $avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);
                if (isset($phpbb_avatar_manager) && !$update) {
                    // Merge any avatar errors into the primary error array
                    $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
                }
                $back_link = $request->variable('back_link', '');
                switch ($back_link) {
                    case 'acp_users_groups':
                        $u_back = append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=users&amp;mode=groups&amp;u=' . $request->variable('u', 0));
                        break;
                    default:
                        $u_back = $this->u_action;
                        break;
                }
                $template->assign_vars(array('S_EDIT' => true, 'S_ADD_GROUP' => $action == 'add' ? true : false, 'S_GROUP_PERM' => $action == 'add' && $auth->acl_get('a_authgroups') && $auth->acl_gets('a_aauth', 'a_fauth', 'a_mauth', 'a_uauth') ? true : false, 'S_INCLUDE_SWATCH' => true, 'S_ERROR' => sizeof($error) ? true : false, 'S_SPECIAL_GROUP' => $group_type == GROUP_SPECIAL ? true : false, 'S_USER_FOUNDER' => $user->data['user_type'] == USER_FOUNDER ? true : false, 'S_AVATARS_ENABLED' => $config['allow_avatar'] && $avatars_enabled, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'GROUP_NAME' => $group_helper->get_name($group_name), 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], 'GROUP_RECEIVE_PM' => isset($group_row['group_receive_pm']) && $group_row['group_receive_pm'] ? ' checked="checked"' : '', 'GROUP_FOUNDER_MANAGE' => isset($group_row['group_founder_manage']) && $group_row['group_founder_manage'] ? ' checked="checked"' : '', 'GROUP_LEGEND' => isset($group_row['group_legend']) && $group_row['group_legend'] ? ' checked="checked"' : '', 'GROUP_TEAMPAGE' => isset($group_row['group_teampage']) && $group_row['group_teampage'] ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => isset($group_row['group_message_limit']) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => isset($group_row['group_max_recipients']) ? $group_row['group_max_recipients'] : 0, 'GROUP_COLOUR' => isset($group_row['group_colour']) ? $group_row['group_colour'] : '', 'GROUP_SKIP_AUTH' => !empty($group_row['group_skip_auth']) ? ' checked="checked"' : '', 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], 'S_DESC_SMILIES_CHECKED' => $group_desc_data['allow_smilies'], 'S_RANK_OPTIONS' => $rank_options, 'S_GROUP_OPTIONS' => group_select_options(false, false, $user->data['user_type'] == USER_FOUNDER ? false : 0), 'AVATAR' => empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar, 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], 'AVATAR_WIDTH' => isset($group_row['group_avatar_width']) ? $group_row['group_avatar_width'] : '', 'AVATAR_HEIGHT' => isset($group_row['group_avatar_height']) ? $group_row['group_avatar_height'] : '', 'GROUP_TYPE_FREE' => GROUP_FREE, 'GROUP_TYPE_OPEN' => GROUP_OPEN, 'GROUP_TYPE_CLOSED' => GROUP_CLOSED, 'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN, 'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL, 'GROUP_FREE' => $type_free, 'GROUP_OPEN' => $type_open, 'GROUP_CLOSED' => $type_closed, 'GROUP_HIDDEN' => $type_hidden, 'U_BACK' => $u_back, 'U_ACTION' => "{$this->u_action}&amp;action={$action}&amp;g={$group_id}", 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string()));
                /**
                 * Modify group template data before we display the form
                 *
                 * @event core.acp_manage_group_display_form
                 * @var	string	action				Type of the action: add|edit
                 * @var	bool	update				Do we display the form only
                 *							or did the user press submit
                 * @var	int		group_id			The group id
                 * @var	array	group_row			Array with new group data
                 * @var	string	group_name			The group name
                 * @var	int		group_type			The group type
                 * @var	array	group_desc_data		The group description data
                 * @var	string	group_rank			The group rank
                 * @var	string	rank_options		The rank options
                 * @var	array	error				Array of errors, if you add errors
                 *							ensure to update the template variables
                 *							S_ERROR and ERROR_MSG to display it
                 * @since 3.1.0-b5
                 */
                $vars = array('action', 'update', 'group_id', 'group_row', 'group_desc_data', 'group_name', 'group_type', 'group_rank', 'rank_options', 'error');
                extract($phpbb_dispatcher->trigger_event('core.acp_manage_group_display_form', compact($vars)));
                return;
                break;
            case 'list':
                if (!$group_id) {
                    trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
                }
                /* @var $pagination \phpbb\pagination */
                $pagination = $phpbb_container->get('pagination');
                $this->page_title = 'GROUP_MEMBERS';
                // Grab the leaders - always, on every page...
                $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
开发者ID:bruninoit,项目名称:phpbb,代码行数:67,代码来源:acp_groups.php

示例6: main


//.........这里部分代码省略.........
                    if (sizeof($forum_id)) {
                        $this->check_existence('forum', $forum_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_FORUM' => true, 'S_FORUM_OPTIONS' => make_forum_select(false, false, true, false, false)));
                    break;
                case 'forums':
                    if (sizeof($forum_id)) {
                        $this->check_existence('forum', $forum_id);
                        continue 2;
                    }
                    $forum_list = make_forum_select(false, false, true, false, false, false, true);
                    // Build forum options
                    $s_forum_options = '';
                    foreach ($forum_list as $f_id => $f_row) {
                        $s_forum_options .= '<option value="' . $f_id . '"' . ($f_row['selected'] ? ' selected="selected"' : '') . ($f_row['disabled'] ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
                    }
                    // Build subforum options
                    $s_subforum_options = $this->build_subforum_options($forum_list);
                    $template->assign_vars(array('S_SELECT_FORUM' => true, 'S_FORUM_OPTIONS' => $s_forum_options, 'S_SUBFORUM_OPTIONS' => $s_subforum_options, 'S_FORUM_ALL' => true, 'S_FORUM_MULTIPLE' => true));
                    break;
                case 'user':
                    if (sizeof($user_id)) {
                        $this->check_existence('user', $user_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=select_victim&amp;field=username&amp;select_single=true')));
                    break;
                case 'group':
                    if (sizeof($group_id)) {
                        $this->check_existence('group', $group_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_GROUP' => true, 'S_GROUP_OPTIONS' => group_select_options(false, false, false)));
                    break;
                case 'usergroup':
                case 'usergroup_view':
                    $all_users = isset($_POST['all_users']) ? true : false;
                    $all_groups = isset($_POST['all_groups']) ? true : false;
                    if (sizeof($user_id) && !$all_users || sizeof($group_id) && !$all_groups) {
                        if (sizeof($user_id)) {
                            $this->check_existence('user', $user_id);
                        }
                        if (sizeof($group_id)) {
                            $this->check_existence('group', $group_id);
                        }
                        continue 2;
                    }
                    // Now we check the users... because the "all"-selection is different here (all defined users/groups)
                    $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type);
                    if ($all_users && sizeof($items['user_ids'])) {
                        $user_id = $items['user_ids'];
                        continue 2;
                    }
                    if ($all_groups && sizeof($items['group_ids'])) {
                        $group_id = $items['group_ids'];
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_USERGROUP' => $victim == 'usergroup' ? true : false, 'S_SELECT_USERGROUP_VIEW' => $victim == 'usergroup_view' ? true : false, 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], false), 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=add_user&amp;field=username&amp;select_single=true')));
                    break;
            }
            // The S_ALLOW_SELECT parameter below is a measure to lower memory usage.
            // If there are more than 5 forums selected the admin is not able to select all users/groups too.
            // We need to see if the number of forums can be increased or need to be decreased.
            // Setting permissions screen
            $s_hidden_fields = build_hidden_fields(array('user_id' => $user_id, 'group_id' => $group_id, 'forum_id' => $forum_id, 'type' => $permission_type));
开发者ID:phpbb,项目名称:phpbb,代码行数:67,代码来源:acp_permissions.php

示例7: main


//.........这里部分代码省略.........
                        $email_list[$j][$i]['name'] = $row['username'];
                        $email_list[$j][$i]['jabber'] = $row['user_jabber'];
                        $i++;
                    }
                } while ($row = $db->sql_fetchrow($result));
                $db->sql_freeresult($result);
                // Send the messages
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $messenger = new messenger($use_queue);
                $errored = false;
                $email_template = 'admin_send_email';
                $template_data = array('CONTACT_EMAIL' => phpbb_get_board_contact($config, $phpEx), 'MESSAGE' => htmlspecialchars_decode($message));
                $generate_log_entry = true;
                /**
                 * Modify email template data before the emails are sent
                 *
                 * @event core.acp_email_send_before
                 * @var	string	email_template		The template to be used for sending the email
                 * @var	string	subject				The subject of the email
                 * @var	array	template_data		Array with template data assigned to email template
                 * @var	bool	generate_log_entry	If false, no log entry will be created
                 * @var	array	usernames			Usernames which will be displayed in log entry, if it will be created
                 * @var	int		group_id			The group this email will be sent to
                 * @var	bool	use_queue			If true, email queue will be used for sending
                 * @var	int		priority			Priority of sent emails
                 * @since 3.1.3-RC1
                 */
                $vars = array('email_template', 'subject', 'template_data', 'generate_log_entry', 'usernames', 'group_id', 'use_queue', 'priority');
                extract($phpbb_dispatcher->trigger_event('core.acp_email_send_before', compact($vars)));
                for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) {
                    $used_lang = $email_list[$i][0]['lang'];
                    $used_method = $email_list[$i][0]['method'];
                    for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) {
                        $email_row = $email_list[$i][$j];
                        $messenger->{sizeof($email_list[$i]) == 1 ? 'to' : 'bcc'}($email_row['email'], $email_row['name']);
                        $messenger->im($email_row['jabber'], $email_row['name']);
                    }
                    $messenger->template($email_template, $used_lang);
                    $messenger->anti_abuse_headers($config, $user);
                    $messenger->subject(htmlspecialchars_decode($subject));
                    $messenger->set_mail_priority($priority);
                    $messenger->assign_vars($template_data);
                    if (!$messenger->send($used_method)) {
                        $errored = true;
                    }
                }
                unset($email_list);
                $messenger->save_queue();
                if ($generate_log_entry) {
                    if (!empty($usernames)) {
                        $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MASS_EMAIL', false, array(implode(', ', utf8_normalize_nfc($usernames))));
                    } else {
                        if ($group_id) {
                            $group_name = get_group_name($group_id);
                        } else {
                            // Not great but the logging routine doesn't cope well with localising on the fly
                            $group_name = $user->lang['ALL_USERS'];
                        }
                        $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MASS_EMAIL', false, array($group_name));
                    }
                }
                if (!$errored) {
                    $message = $use_queue ? $user->lang['EMAIL_SENT_QUEUE'] : $user->lang['EMAIL_SENT'];
                    trigger_error($message . adm_back_link($this->u_action));
                } else {
                    $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=logs&amp;mode=critical') . '">', '</a>');
                    trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
                }
            }
        }
        // Exclude bots and guests...
        $sql = 'SELECT group_id
			FROM ' . GROUPS_TABLE . "\n\t\t\tWHERE group_name IN ('BOTS', 'GUESTS')";
        $result = $db->sql_query($sql);
        $exclude = array();
        while ($row = $db->sql_fetchrow($result)) {
            $exclude[] = $row['group_id'];
        }
        $db->sql_freeresult($result);
        $select_list = '<option value="0"' . (!$group_id ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
        $select_list .= group_select_options($group_id, $exclude);
        $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
        $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
        $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
        $template_data = array('S_WARNING' => sizeof($error) ? true : false, 'WARNING_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => implode("\n", $usernames), 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=acp_email&amp;field=usernames'), 'SUBJECT' => $subject, 'MESSAGE' => $message, 'S_PRIORITY_OPTIONS' => $s_priority_options);
        /**
         * Modify custom email template data before we display the form
         *
         * @event core.acp_email_display
         * @var	array	template_data		Array with template data assigned to email template
         * @var	array	exclude				Array with groups which are excluded from group selection
         * @var	array	usernames			Usernames which will be displayed in form
         *
         * @since 3.1.4-RC1
         */
        $vars = array('template_data', 'exclude', 'usernames');
        extract($phpbb_dispatcher->trigger_event('core.acp_email_display', compact($vars)));
        $template->assign_vars($template_data);
    }
开发者ID:hgchen,项目名称:phpbb,代码行数:101,代码来源:acp_email.php

示例8: main


//.........这里部分代码省略.........
                }
                $db->sql_freeresult($result);
                $type_free = $group_type == GROUP_FREE ? ' checked="checked"' : '';
                $type_open = $group_type == GROUP_OPEN ? ' checked="checked"' : '';
                $type_closed = $group_type == GROUP_CLOSED ? ' checked="checked"' : '';
                $type_hidden = $group_type == GROUP_HIDDEN ? ' checked="checked"' : '';
                if (isset($group_row['group_avatar']) && $group_row['group_avatar']) {
                    switch ($group_row['group_avatar_type']) {
                        case AVATAR_UPLOAD:
                            $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
                            break;
                        case AVATAR_GALLERY:
                            $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
                            break;
                    }
                    $avatar_img .= $group_row['group_avatar'];
                    $avatar_img = '<img src="' . $avatar_img . '" width="' . $group_row['group_avatar_width'] . '" height="' . $group_row['group_avatar_height'] . '" alt="" />';
                } else {
                    $avatar_img = '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
                }
                $display_gallery = isset($_POST['display_gallery']) ? true : false;
                if ($config['allow_avatar_local'] && $display_gallery) {
                    avatar_gallery($category, $avatar_select, 4);
                }
                $back_link = request_var('back_link', '');
                switch ($back_link) {
                    case 'acp_users_groups':
                        $u_back = append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=users&amp;mode=groups&amp;u=' . request_var('u', 0));
                        break;
                    default:
                        $u_back = $this->u_action;
                        break;
                }
                $template->assign_vars(array('S_EDIT' => true, 'S_ADD_GROUP' => $action == 'add' ? true : false, 'S_INCLUDE_SWATCH' => true, 'S_CAN_UPLOAD' => $can_upload, 'S_ERROR' => sizeof($error) ? true : false, 'S_SPECIAL_GROUP' => $group_type == GROUP_SPECIAL ? true : false, 'S_DISPLAY_GALLERY' => $config['allow_avatar_local'] && !$display_gallery ? true : false, 'S_IN_GALLERY' => $config['allow_avatar_local'] && $display_gallery ? true : false, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'GROUP_NAME' => $group_type == GROUP_SPECIAL ? $user->lang['G_' . $group_name] : $group_name, 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], 'GROUP_RECEIVE_PM' => isset($group_row['group_receive_pm']) && $group_row['group_receive_pm'] ? ' checked="checked"' : '', 'GROUP_LEGEND' => isset($group_row['group_legend']) && $group_row['group_legend'] ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => isset($group_row['group_message_limit']) ? $group_row['group_message_limit'] : 0, 'GROUP_COLOUR' => isset($group_row['group_colour']) ? $group_row['group_colour'] : '', 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], 'S_DESC_SMILIES_CHECKED' => $group_desc_data['allow_smilies'], 'S_RANK_OPTIONS' => $rank_options, 'S_GROUP_OPTIONS' => group_select_options(0), 'AVATAR_IMAGE' => $avatar_img, 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], 'GROUP_AVATAR_WIDTH' => isset($group_row['group_avatar_width']) ? $group_row['group_avatar_width'] : '', 'GROUP_AVATAR_HEIGHT' => isset($group_row['group_avatar_height']) ? $group_row['group_avatar_height'] : '', 'GROUP_TYPE_FREE' => GROUP_FREE, 'GROUP_TYPE_OPEN' => GROUP_OPEN, 'GROUP_TYPE_CLOSED' => GROUP_CLOSED, 'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN, 'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL, 'GROUP_FREE' => $type_free, 'GROUP_OPEN' => $type_open, 'GROUP_CLOSED' => $type_closed, 'GROUP_HIDDEN' => $type_hidden, 'U_BACK' => $u_back, 'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.{$phpEx}", 'form=settings&amp;name=group_colour'), 'UA_SWATCH' => append_sid("{$phpbb_admin_path}swatch.{$phpEx}", 'form=settings&name=group_colour', false), 'U_ACTION' => "{$this->u_action}&amp;action={$action}&amp;g={$group_id}", 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))));
                return;
                break;
            case 'list':
                if (!$group_id) {
                    trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action));
                }
                $this->page_title = 'GROUP_MEMBERS';
                // Total number of group leaders
                $sql = 'SELECT COUNT(user_id) AS total_leaders 
					FROM ' . USER_GROUP_TABLE . " \n\t\t\t\t\tWHERE group_id = {$group_id} \n\t\t\t\t\t\tAND group_leader = 1";
                $result = $db->sql_query($sql);
                $total_leaders = (int) $db->sql_fetchfield('total_leaders');
                $db->sql_freeresult($result);
                // Total number of group members (non-leaders)
                $sql = 'SELECT COUNT(user_id) AS total_members 
					FROM ' . USER_GROUP_TABLE . " \n\t\t\t\t\tWHERE group_id = {$group_id} \n\t\t\t\t\t\tAND group_leader <> 1";
                $result = $db->sql_query($sql);
                $total_members = (int) $db->sql_fetchfield('total_members');
                $db->sql_freeresult($result);
                // Grab the members
                $sql = 'SELECT u.user_id, u.username, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending 
					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug \n\t\t\t\t\tWHERE ug.group_id = {$group_id} \n\t\t\t\t\t\tAND u.user_id = ug.user_id \n\t\t\t\t\tORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username";
                $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                $leader = $member = 0;
                $group_data = array('leader' => array(), 'member' => array());
                while ($row = $db->sql_fetchrow($result)) {
                    $type = $row['group_leader'] ? 'leader' : 'member';
                    $group_data[$type][${$type}]['user_id'] = $row['user_id'];
                    $group_data[$type][${$type}]['group_id'] = $row['group_id'];
                    $group_data[$type][${$type}]['username'] = $row['username'];
                    $group_data[$type][${$type}]['user_regdate'] = $row['user_regdate'];
                    $group_data[$type][${$type}]['user_posts'] = $row['user_posts'];
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_groups.php

示例9: main


//.........这里部分代码省略.........
                    $usernames = implode(', ', preg_replace('#^[\\s]*?(.*?)[\\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", explode("\n", $usernames)));
                    $sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang 
						FROM ' . USERS_TABLE . " \n\t\t\t\t\t\tWHERE username IN ({$usernames})\n\t\t\t\t\t\t\tAND user_allow_massemail = 1\n\t\t\t\t\t\tORDER BY user_lang, user_notify_type";
                    // , SUBSTRING(user_email FROM INSTR(user_email, '@'))
                } else {
                    if ($group_id) {
                        $sql = 'SELECT u.user_email, u.username, u.user_lang, u.user_jabber, u.user_notify_type 
							FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug \n\t\t\t\t\t\t\tWHERE ug.group_id = {$group_id} \n\t\t\t\t\t\t\t\tAND ug.user_pending = 0\n\t\t\t\t\t\t\t\tAND u.user_id = ug.user_id \n\t\t\t\t\t\t\t\tAND u.user_allow_massemail = 1\n\t\t\t\t\t\t\tORDER BY u.user_lang, u.user_notify_type";
                    } else {
                        $sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang 
							FROM ' . USERS_TABLE . '
							WHERE user_allow_massemail = 1
							ORDER BY user_lang, user_notify_type';
                    }
                }
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!$row) {
                    trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action));
                }
                $i = $j = 0;
                // Send with BCC, no more than 50 recipients for one mail (to not exceed the limit)
                $max_chunk_size = 50;
                $email_list = array();
                $old_lang = $row['user_lang'];
                $old_notify_type = $row['user_notify_type'];
                do {
                    if ($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email'] || $row['user_notify_type'] == NOTIFY_IM && $row['user_jabber'] || $row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']) {
                        if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) {
                            $i = 0;
                            $j++;
                            $old_lang = $row['user_lang'];
                            $old_notify_type = $row['user_notify_type'];
                        }
                        $email_list[$j][$i]['lang'] = $row['user_lang'];
                        $email_list[$j][$i]['method'] = $row['user_notify_type'];
                        $email_list[$j][$i]['email'] = $row['user_email'];
                        $email_list[$j][$i]['name'] = $row['username'];
                        $email_list[$j][$i]['jabber'] = $row['user_jabber'];
                        $i++;
                    }
                } while ($row = $db->sql_fetchrow($result));
                $db->sql_freeresult($result);
                // Send the messages
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $messenger = new messenger($use_queue);
                $errored = false;
                for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) {
                    $used_lang = $email_list[$i][0]['lang'];
                    $used_method = $email_list[$i][0]['method'];
                    for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) {
                        $email_row = $email_list[$i][$j];
                        $messenger->{sizeof($email_list[$i]) == 1 ? 'to' : 'bcc'}($email_row['email'], $email_row['name']);
                        $messenger->im($email_row['jabber'], $email_row['name']);
                    }
                    $messenger->template('admin_send_email', $used_lang);
                    $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
                    $messenger->subject(html_entity_decode($subject));
                    $messenger->replyto($config['board_email']);
                    $messenger->set_mail_priority($priority);
                    $messenger->assign_vars(array('SITENAME' => $config['sitename'], 'CONTACT_EMAIL' => $config['board_contact'], 'MESSAGE' => html_entity_decode($message)));
                    if (!$messenger->send($used_method)) {
                        $errored = true;
                    }
                }
                unset($email_list);
                $messenger->save_queue();
                if ($group_id) {
                    $group_name = get_group_name($group_id);
                } else {
                    // Not great but the logging routine doesn't cope well with localising on the fly
                    $group_name = $user->lang['ALL_USERS'];
                }
                add_log('admin', 'LOG_MASS_EMAIL', $group_name);
                if (!$errored) {
                    $message = $use_queue ? $user->lang['EMAIL_SENT_QUEUE'] : $user->lang['EMAIL_SENT'];
                } else {
                    $message = sprintf($user->lang['EMAIL_SEND_ERROR'], '<a href="' . append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=logs&amp;mode=critical') . '">', '</a>');
                }
                trigger_error($message . adm_back_link($this->u_action));
            }
        }
        // Exclude bots...
        $sql = 'SELECT group_id
			FROM ' . GROUPS_TABLE . "\n\t\t\tWHERE group_name = 'BOTS'";
        $result = $db->sql_query($sql);
        $bot_group_id = (int) $db->sql_fetchfield('group_id');
        $db->sql_freeresult($result);
        $select_list = '<option value="0"' . (!$group_id ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
        $select_list .= group_select_options($group_id, array($bot_group_id));
        $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
        $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
        $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $user->lang['MAIL_HIGH_PRIORITY'] . '</option>';
        $template->assign_vars(array('S_WARNING' => sizeof($error) ? true : false, 'WARNING_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => $usernames, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=acp_email&amp;field=usernames'), 'SUBJECT' => $subject, 'MESSAGE' => $message, 'S_PRIORITY_OPTIONS' => $s_priority_options));
    }
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:acp_email.php

示例10: main


//.........这里部分代码省略.........
                        $group_type = $group_row['group_type'];
                        $group_rank = $group_row['group_rank'];
                    }
                }
                $sql = 'SELECT *
					FROM ' . RANKS_TABLE . '
					WHERE rank_special = 1
					ORDER BY rank_title';
                $result = $db->sql_query($sql);
                $rank_options = '<option value="0"' . (!$group_rank ? ' selected="selected"' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>';
                while ($row = $db->sql_fetchrow($result)) {
                    $selected = $group_rank && $row['rank_id'] == $group_rank ? ' selected="selected"' : '';
                    $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
                }
                $db->sql_freeresult($result);
                $type_free = $group_type == GROUP_FREE ? ' checked="checked"' : '';
                $type_open = $group_type == GROUP_OPEN ? ' checked="checked"' : '';
                $type_closed = $group_type == GROUP_CLOSED ? ' checked="checked"' : '';
                $type_hidden = $group_type == GROUP_HIDDEN ? ' checked="checked"' : '';
                $avatar_img = !empty($group_row['group_avatar']) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
                $display_gallery = isset($_POST['display_gallery']) ? true : false;
                if ($config['allow_avatar_local'] && $display_gallery) {
                    avatar_gallery($category, $avatar_select, 4);
                }
                $back_link = request_var('back_link', '');
                switch ($back_link) {
                    case 'acp_users_groups':
                        $u_back = append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=users&amp;mode=groups&amp;u=' . request_var('u', 0));
                        break;
                    default:
                        $u_back = $this->u_action;
                        break;
                }
                $template->assign_vars(array('S_EDIT' => true, 'S_ADD_GROUP' => $action == 'add' ? true : false, 'S_GROUP_PERM' => $action == 'add' && $auth->acl_get('a_authgroups') && $auth->acl_gets('a_aauth', 'a_fauth', 'a_mauth', 'a_uauth') ? true : false, 'S_INCLUDE_SWATCH' => true, 'S_CAN_UPLOAD' => $can_upload, 'S_ERROR' => sizeof($error) ? true : false, 'S_SPECIAL_GROUP' => $group_type == GROUP_SPECIAL ? true : false, 'S_DISPLAY_GALLERY' => $config['allow_avatar_local'] && !$display_gallery ? true : false, 'S_IN_GALLERY' => $config['allow_avatar_local'] && $display_gallery ? true : false, 'S_USER_FOUNDER' => $user->data['user_type'] == USER_FOUNDER ? true : false, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'GROUP_NAME' => $group_type == GROUP_SPECIAL ? $user->lang['G_' . $group_name] : $group_name, 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], 'GROUP_RECEIVE_PM' => isset($group_row['group_receive_pm']) && $group_row['group_receive_pm'] ? ' checked="checked"' : '', 'GROUP_FOUNDER_MANAGE' => isset($group_row['group_founder_manage']) && $group_row['group_founder_manage'] ? ' checked="checked"' : '', 'GROUP_LEGEND' => isset($group_row['group_legend']) && $group_row['group_legend'] ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => isset($group_row['group_message_limit']) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => isset($group_row['group_max_recipients']) ? $group_row['group_max_recipients'] : 0, 'GROUP_COLOUR' => isset($group_row['group_colour']) ? $group_row['group_colour'] : '', 'GROUP_SKIP_AUTH' => !empty($group_row['group_skip_auth']) ? ' checked="checked"' : '', 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], 'S_DESC_SMILIES_CHECKED' => $group_desc_data['allow_smilies'], 'S_RANK_OPTIONS' => $rank_options, 'S_GROUP_OPTIONS' => group_select_options(false, false, $user->data['user_type'] == USER_FOUNDER ? false : 0), 'AVATAR' => $avatar_img, 'AVATAR_IMAGE' => $avatar_img, 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], 'AVATAR_WIDTH' => isset($group_row['group_avatar_width']) ? $group_row['group_avatar_width'] : '', 'AVATAR_HEIGHT' => isset($group_row['group_avatar_height']) ? $group_row['group_avatar_height'] : '', 'GROUP_TYPE_FREE' => GROUP_FREE, 'GROUP_TYPE_OPEN' => GROUP_OPEN, 'GROUP_TYPE_CLOSED' => GROUP_CLOSED, 'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN, 'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL, 'GROUP_FREE' => $type_free, 'GROUP_OPEN' => $type_open, 'GROUP_CLOSED' => $type_closed, 'GROUP_HIDDEN' => $type_hidden, 'U_BACK' => $u_back, 'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.{$phpEx}", 'form=settings&amp;name=group_colour'), 'U_ACTION' => "{$this->u_action}&amp;action={$action}&amp;g={$group_id}", 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))));
                return;
                break;
            case 'list':
                if (!$group_id) {
                    trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
                }
                $this->page_title = 'GROUP_MEMBERS';
                // Grab the leaders - always, on every page...
                $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug\n\t\t\t\t\tWHERE ug.group_id = {$group_id}\n\t\t\t\t\t\tAND u.user_id = ug.user_id\n\t\t\t\t\t\tAND ug.group_leader = 1\n\t\t\t\t\tORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $template->assign_block_vars('leader', array('U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=users&amp;action=edit&amp;u={$row['user_id']}"), 'USERNAME' => $row['username'], 'USERNAME_COLOUR' => $row['user_colour'], 'S_GROUP_DEFAULT' => $row['group_id'] == $group_id ? true : false, 'JOINED' => $row['user_regdate'] ? $user->format_date($row['user_regdate']) : ' - ', 'USER_POSTS' => $row['user_posts'], 'USER_ID' => $row['user_id']));
                }
                $db->sql_freeresult($result);
                // Total number of group members (non-leaders)
                $sql = 'SELECT COUNT(user_id) AS total_members
					FROM ' . USER_GROUP_TABLE . "\n\t\t\t\t\tWHERE group_id = {$group_id}\n\t\t\t\t\t\tAND group_leader = 0";
                $result = $db->sql_query($sql);
                $total_members = (int) $db->sql_fetchfield('total_members');
                $db->sql_freeresult($result);
                $s_action_options = '';
                $options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'demote' => 'DEMOTE', 'promote' => 'PROMOTE', 'deleteusers' => 'DELETE');
                foreach ($options as $option => $lang) {
                    $s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';
                }
                $template->assign_vars(array('S_LIST' => true, 'S_GROUP_SPECIAL' => $group_row['group_type'] == GROUP_SPECIAL ? true : false, 'S_ACTION_OPTIONS' => $s_action_options, 'S_ON_PAGE' => on_page($total_members, $config['topics_per_page'], $start), 'PAGINATION' => generate_pagination($this->u_action . "&amp;action={$action}&amp;g={$group_id}", $total_members, $config['topics_per_page'], $start, true), 'GROUP_NAME' => $group_row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'U_ACTION' => $this->u_action . "&amp;g={$group_id}", 'U_BACK' => $this->u_action, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=list&amp;field=usernames'), 'U_DEFAULT_ALL' => "{$this->u_action}&amp;action=default&amp;g={$group_id}"));
                // Grab the members
                $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug\n\t\t\t\t\tWHERE ug.group_id = {$group_id}\n\t\t\t\t\t\tAND u.user_id = ug.user_id\n\t\t\t\t\t\tAND ug.group_leader = 0\n\t\t\t\t\tORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";
                $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
                $pending = false;
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_groups.php

示例11: main


//.........这里部分代码省略.........
                     $s_hidden_fields = build_hidden_fields(array('action_points_logs' => true));
                     // Display mode
                     confirm_box(false, $user->lang['RESYNC_POINTSLOGS_CONFIRM'], $s_hidden_fields);
                 }
             }
             // Delete all userpoints
             $reset_points_user = isset($_POST['action_points']) ? true : false;
             if ($reset_points_user) {
                 if (confirm_box(true)) {
                     if (!$auth->acl_get('a_points')) {
                         trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
                     }
                     $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_points = 0');
                     add_log('admin', 'LOG_RESYNC_POINTSCOUNTS');
                     trigger_error($user->lang['LOG_RESYNC_POINTSCOUNTS'] . adm_back_link($this->u_action));
                 } else {
                     $s_hidden_fields = build_hidden_fields(array('action_points' => true));
                     // Display mode
                     confirm_box(false, $user->lang['RESYNC_POINTS_CONFIRM'], $s_hidden_fields);
                 }
             }
             // Transfer or set points for groups
             $group_transfer = isset($_POST['group_transfer']) ? true : false;
             $group_transfer_points = request_var('group_transfer_points', 0.0);
             $func = request_var('func', '');
             $group_id = request_var('group_id', 0);
             $pm_subject = utf8_normalize_nfc(request_var('pm_subject', '', true));
             $pm_text = utf8_normalize_nfc(request_var('pm_text', '', true));
             $sql_array = array('SELECT' => 'group_id, group_name, group_type', 'FROM' => array(GROUPS_TABLE => 'g'), 'ORDER_BY' => 'group_name');
             $sql = $db->sql_build_query('SELECT', $sql_array);
             $result = $db->sql_query($sql);
             $total_groups = $db->sql_affectedrows($result);
             $db->sql_freeresult($result);
             $template->assign_vars(array('U_SMILIES' => append_sid("{$phpbb_root_path}posting.{$phpEx}", 'mode=smilies'), 'S_GROUP_OPTIONS' => group_select_options($total_groups), 'U_ACTION' => $this->u_action));
             // Update the points
             if ($group_transfer) {
                 if (!check_form_key('acp_points')) {
                     // trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 $sql_array = array('SELECT' => 'group_type, group_name', 'FROM' => array(GROUPS_TABLE => 'g'), 'WHERE' => 'group_id = ' . (int) $group_id);
                 $sql = $db->sql_build_query('SELECT', $sql_array);
                 $result = $db->sql_query($sql);
                 $row = $db->sql_fetchrow($result);
                 $db->sql_freeresult($result);
                 $group_name = $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
                 // Check if we try transfering to BOTS or GUESTS
                 if ($row['group_name'] == 'BOTS' || $row['group_name'] == 'GUESTS') {
                     trigger_error($user->lang['POINTS_GROUP_TRANSFER_SEL_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 $sql_array = array('SELECT' => 'user_id', 'FROM' => array(USER_GROUP_TABLE => 'g'), 'WHERE' => 'user_pending <> ' . TRUE . '
           AND group_id = ' . (int) $group_id);
                 $sql = $db->sql_build_query('SELECT', $sql_array);
                 $result = $db->sql_query($sql);
                 $user_ids = array();
                 while ($row = $db->sql_fetchrow($result)) {
                     $user_ids[] = $row['user_id'];
                 }
                 $db->sql_freeresult($result);
                 if (sizeof($user_ids)) {
                     if ($func == 'add') {
                         $sql = "UPDATE " . USERS_TABLE . "\n                SET user_points = user_points + {$group_transfer_points}\n                WHERE " . $db->sql_in_set('user_id', $user_ids);
                         add_log('admin', 'LOG_GROUP_TRANSFER_ADD');
                     }
                     if ($func == 'substract') {
                         $sql = "UPDATE " . USERS_TABLE . "\n                SET user_points = user_points - {$group_transfer_points}\n                WHERE " . $db->sql_in_set('user_id', $user_ids);
                         add_log('admin', 'LOG_GROUP_TRANSFER_ADD');
开发者ID:FifoF,项目名称:phpbb3.1_ultimate_points,代码行数:67,代码来源:points_module.php

示例12: main


//.........这里部分代码省略.........
                    if (sizeof($forum_id)) {
                        $this->check_existence('forum', $forum_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_FORUM' => true, 'S_FORUM_OPTIONS' => make_forum_select(false, false, true, false, false)));
                    break;
                case 'forums':
                    if (sizeof($forum_id)) {
                        $this->check_existence('forum', $forum_id);
                        continue 2;
                    }
                    $forum_list = make_forum_select(false, false, true, false, false, true);
                    // Build forum options
                    $s_forum_options = '';
                    foreach ($forum_list as $f_id => $f_row) {
                        $s_forum_options .= '<option value="' . $f_id . '"' . $f_row['selected'] . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
                    }
                    // Build subforum options
                    $s_subforum_options = $this->build_subforum_options($forum_list);
                    $template->assign_vars(array('S_SELECT_FORUM' => true, 'S_FORUM_OPTIONS' => $s_forum_options, 'S_SUBFORUM_OPTIONS' => $s_subforum_options, 'S_FORUM_ALL' => true, 'S_FORUM_MULTIPLE' => true));
                    break;
                case 'user':
                    if (sizeof($user_id)) {
                        $this->check_existence('user', $user_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&amp;form=select_victim&amp;field=username')));
                    break;
                case 'group':
                    if (sizeof($group_id)) {
                        $this->check_existence('group', $group_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_GROUP' => true, 'S_GROUP_OPTIONS' => group_select_options(false)));
                    break;
                case 'usergroup':
                case 'usergroup_view':
                    if (sizeof($user_id) || sizeof($group_id)) {
                        if (sizeof($user_id)) {
                            $this->check_existence('user', $user_id);
                        }
                        if (sizeof($group_id)) {
                            $this->check_existence('group', $group_id);
                        }
                        continue 2;
                    }
                    $sql_forum_id = $permission_scope == 'global' ? 'AND a.forum_id = 0' : (sizeof($forum_id) ? 'AND a.forum_id IN (' . implode(', ', $forum_id) . ')' : 'AND a.forum_id <> 0');
                    $sql_permission_option = "AND o.auth_option LIKE '" . $db->sql_escape($permission_type) . "%'";
                    $sql = $db->sql_build_query('SELECT_DISTINCT', array('SELECT' => 'u.username, u.user_regdate, u.user_id', 'FROM' => array(USERS_TABLE => 'u', ACL_OPTIONS_TABLE => 'o', ACL_USERS_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), 'ON' => 'a.auth_role_id = r.role_id')), 'WHERE' => "(a.auth_option_id = o.auth_option_id OR r.auth_option_id = o.auth_option_id)\n\t\t\t\t\t\t\t{$sql_permission_option}\n\t\t\t\t\t\t\t{$sql_forum_id}\n\t\t\t\t\t\t\tAND u.user_id = a.user_id", 'ORDER_BY' => 'u.username, u.user_regdate ASC'));
                    $result = $db->sql_query($sql);
                    $s_defined_user_options = '';
                    $defined_user_ids = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $s_defined_user_options .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
                        $defined_user_ids[] = $row['user_id'];
                    }
                    $db->sql_freeresult($result);
                    $sql = $db->sql_build_query('SELECT_DISTINCT', array('SELECT' => 'g.group_type, g.group_name, g.group_id', 'FROM' => array(GROUPS_TABLE => 'g', ACL_OPTIONS_TABLE => 'o', ACL_GROUPS_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), 'ON' => 'a.auth_role_id = r.role_id')), 'WHERE' => "(a.auth_option_id = o.auth_option_id OR r.auth_option_id = o.auth_option_id)\n\t\t\t\t\t\t\t{$sql_permission_option}\n\t\t\t\t\t\t\t{$sql_forum_id}\n\t\t\t\t\t\t\tAND g.group_id = a.group_id", 'ORDER_BY' => 'g.group_type DESC, g.group_name ASC'));
                    $result = $db->sql_query($sql);
                    $s_defined_group_options = '';
                    $defined_group_ids = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $s_defined_group_options .= '<option' . ($row['group_type'] == GROUP_SPECIAL ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . ($row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
                        $defined_group_ids[] = $row['group_id'];
                    }
                    $db->sql_freeresult($result);
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_permissions.php

示例13: main


//.........这里部分代码省略.........
            case 'settings':
            case 'referral_settings':
                $this->page_title = $mode == 'referral_settings' ? 'ACP_REFERRAL_SETTINGS' : 'ACP_INVITE_SETTINGS';
                $this->tpl_name = $mode == 'referral_settings' ? 'acp_invite_referral' : 'acp_invite';
                $queue_time_m = request_var('queue_time_m', floor($invite->config['queue_time'] / 60));
                $queue_time_s = request_var('queue_time_s', $invite->config['queue_time'] % 60);
                if (!$invite->config['enable_invitation'] && $mode == 'settings') {
                    $error[] = $user->lang['ACP_INVITATION_DISABLED'];
                }
                if (!$invite->config['enable_referral'] && $mode == 'referral_settings') {
                    $error[] = $user->lang['ACP_REFERRAL_DISABLED'];
                }
                if ($submit) {
                    $new_config['queue_time'] = $queue_time_s + $queue_time_m * 60;
                    $check_ary = array('queue_time' => array('num', true, 1, 9999999999), 'message_min_chars' => array('num', true, 1, 9999), 'message_max_chars' => array('num', false, 1, 9999), 'subject_min_chars' => array('num', false, 1, 999), 'subject_max_chars' => array('num', false, 1, 999));
                    $error = validate_data($new_config, $check_ary);
                    if (!check_form_key($form_key)) {
                        $error[] = $user->lang['FORM_INVALID'];
                    }
                    // No errors.. continue!
                    if (!sizeof($error)) {
                        foreach ($new_config as $k => $v) {
                            $invite->set_config($k, $v);
                        }
                        add_log('admin', 'LOG_INVITE_SETTINGS_UPDATED');
                        trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
                }
                foreach ($new_config as $k => $v) {
                    $template->assign_vars(array('S_' . strtoupper($k) => $v));
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? array_pop($error) : '', 'S_VALUE_EMAIL' => EMAIL, 'S_VALUE_PM' => PM, 'S_VALUE_OPTIONAL' => OPTIONAL, 'S_GROUP_SELECT' => group_select_options($new_config['key_group'], false, 0), 'S_EMAIL_ENABLE' => $config['email_enable'] ? true : false, 'S_SELECT_LANGUAGE' => $this->build_select('language', '', $new_config['invite_language_select']), 'S_SELECT_PROFILE_LOCATION' => $this->build_select('profile_location'), 'S_SELECT_PROFILE_TYPE' => $this->build_select('profile_type'), 'S_SELECT_REFERRAL_PROFILE_LOCATION' => $this->build_select('referral_profile_location'), 'S_SELECT_REFERRAL_PROFILE_TYPE' => $this->build_select('referral_profile_type'), 'S_PRIORITY_OPTIONS' => $this->build_select('priority', '', $new_config['invite_priority_flag']), 'S_QUEUE_TIME_M' => $queue_time_m, 'S_QUEUE_TIME_S' => $queue_time_s, 'U_ACTION' => $this->u_action));
                if ($invite->ultimate_points_installed()) {
                    $template->assign_vars(array('S_ULTIMATE_POINTS_INSTALLED' => true));
                }
                if ($invite->cash_installed()) {
                    global $cash;
                    $template->assign_vars(array('S_CASH_INSTALLED' => true, 'S_CASH_CURRENCY_INVITE' => $cash->get_currencies($invite->config['cash_id_invite'], true), 'S_CASH_CURRENCY_REGISTER' => $cash->get_currencies($invite->config['cash_id_register'], true)));
                }
                break;
            case 'templates':
                $this->page_title = 'ACP_INVITE_TEMPLATES';
                $this->tpl_name = 'acp_invite_templates';
                $select = isset($_POST['select']) ? true : false;
                $tpl_type = request_var('template_type', '', true);
                $tpl_lang = request_var('template_language', $user->data['user_lang'], true);
                $tpl_subject = $select ? $invite->get_template("{$tpl_type}_subject.txt", $tpl_lang) : '';
                $tpl_message = $select ? $invite->get_template("{$tpl_type}_message.txt", $tpl_lang) : '';
                if ($submit) {
                    $tpl_subject = request_var('template_subject', $invite->get_template("{$tpl_type}_subject.txt", $tpl_lang), true);
                    $tpl_message = request_var('template_message', $invite->get_template("{$tpl_type}_message.txt", $tpl_lang), true);
                    if (!check_form_key($form_key)) {
                        $error[] = $user->lang['FORM_INVALID'];
                    }
                    // No errors.. continue!
                    if (!sizeof($error)) {
                        $invite->set_template($tpl_subject, "{$tpl_type}_subject.txt", $tpl_lang);
                        $invite->set_template($tpl_message, "{$tpl_type}_message.txt", $tpl_lang);
                        add_log('admin', 'LOG_INVITE_TEMPLATES_UPDATED');
                        trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
                    }
                }
                // Output wildcard tables
                $wildcards['general'] = $this->print_wildcard_array($invite, 'general');
开发者ID:janukobytsch,项目名称:invite-a-friend,代码行数:67,代码来源:acp_invite.php

示例14: main


//.........这里部分代码省略.........
        $s_hidden_fields = build_hidden_fields($s_hidden_fields_array);
        $s_hidden_fields_extra = true;
        // Go through the screens/options needed and present them in correct order
        foreach ($permission_victim as $victim) {
            switch ($victim) {
                case 'cms':
                    if (sizeof($forum_id)) {
                        $this->check_existence($this->id_type, $forum_id);
                        continue 2;
                    }
                    // We don't have anything selected, so we need to unset these types, because they will be set properly in template...
                    $s_hidden_fields_extra = false;
                    unset($s_hidden_fields_array['id_type']);
                    unset($s_hidden_fields_array['type']);
                    $ids = array();
                    $ids_data = array();
                    $types_array = array('l' => 'layout', 's' => 'layout_special', 'b' => 'block');
                    foreach ($types_array as $type_key => $type_value) {
                        $s_options = '';
                        $ids_data = $this->check_existence($type_value, $ids, true);
                        foreach ($ids_data as $id_data) {
                            $option_name = $id_data['name'];
                            if ($type_key == 's') {
                                $option_name = isset($lang['auth_view_' . strtolower($option_name)]) ? $lang['auth_view_' . strtolower($option_name)] : (isset($lang['cms_page_name_' . strtolower($option_name)]) ? $lang['cms_page_name_' . strtolower($option_name)] : ucfirst($option_name));
                            }
                            $s_options .= '<option value="' . (int) $id_data['id'] . '">' . $option_name . ' [' . (int) $id_data['id'] . ']' . '</option>';
                        }
                        $template->assign_vars(array('S_CMS_' . strtoupper($type_key) . '_OPTIONS' => $s_options));
                    }
                    $template->assign_vars(array('S_SELECT_CMS' => true));
                    break;
                case 'user':
                case 'group':
                    if (sizeof($user_id)) {
                        $this->check_existence('user', $user_id);
                        continue 2;
                    }
                    if (sizeof($group_id)) {
                        $this->check_existence('group', $group_id);
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_USER' => true, 'S_SELECT_GROUP' => true, 'U_FIND_USERNAME' => append_sid(IP_ROOT_PATH . CMS_PAGE_SEARCH . '?mode=searchuser'), 'S_GROUP_OPTIONS' => group_select_options(false, false, false)));
                    break;
                case 'usergroup':
                case 'usergroup_view':
                    $all_users = isset($_POST['all_users']) ? true : false;
                    $all_groups = isset($_POST['all_groups']) ? true : false;
                    if (sizeof($user_id) && !$all_users || sizeof($group_id) && !$all_groups) {
                        if (sizeof($user_id)) {
                            $this->check_existence('user', $user_id);
                        }
                        if (sizeof($group_id)) {
                            $this->check_existence('group', $group_id);
                        }
                        continue 2;
                    }
                    // Now we check the users... because the "all"-selection is different here (all defined users/groups)
                    $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type);
                    if ($all_users && sizeof($items['user_ids'])) {
                        $user_id = $items['user_ids'];
                        continue 2;
                    }
                    if ($all_groups && sizeof($items['group_ids'])) {
                        $group_id = $items['group_ids'];
                        continue 2;
                    }
                    $template->assign_vars(array('S_SELECT_USERGROUP' => $victim == 'usergroup' ? true : false, 'S_SELECT_USERGROUP_VIEW' => $victim == 'usergroup_view' ? true : false, 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], false), 'U_FIND_USERNAME' => append_sid(IP_ROOT_PATH . CMS_PAGE_SEARCH . '?mode=searchuser')));
                    break;
            }
            // Let the item names being displayed
            if (sizeof($forum_id)) {
                $ids_data = $this->check_existence($this->id_type, $forum_id);
                $forum_names = array();
                foreach ($ids_data as $id_data) {
                    $forum_names[] = $id_data['name'];
                }
                $template->assign_vars(array('S_FORUM_NAMES' => sizeof($forum_names) ? true : false, 'FORUM_NAMES' => implode(', ', $forum_names)));
            }
            if (!empty($s_hidden_fields_extra)) {
                // Setting other hidden fields
                $s_hidden_fields_array = array('id_type' => $this->id_type, 'type' => $permission_type);
                $s_hidden_fields .= build_hidden_fields($s_hidden_fields_array);
            }
            // The S_ALLOW_SELECT parameter below is a measure to lower memory usage.
            // If there are more than 5 forums selected the admin is not able to select all users/groups too.
            // We need to see if the number of forums can be increased or need to be decreased.
            $template->assign_vars(array('U_ACTION' => $this->u_action, 'U_ACTION_USERS' => str_replace('_group_global', '_user_global', $this->u_action), 'U_ACTION_GROUPS' => str_replace('_user_global', '_group_global', $this->u_action), 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_VICTIM' => true, 'S_ALLOW_ALL_SELECT' => false, 'S_CAN_SELECT_USER' => true, 'S_CAN_SELECT_GROUP' => true, 'S_HIDDEN_FIELDS' => $s_hidden_fields));
            return;
        }
        $template->assign_vars(array('S_PERMISSION_DROPDOWN' => sizeof($this->permission_dropdown) > 1 ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, 'L_PERMISSION_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields));
        if (strpos($mode, 'setting_') === 0) {
            $template->assign_vars(array('S_SETTING_PERMISSIONS' => true));
            $hold_ary = $auth_admin->get_mask('set', sizeof($user_id) ? $user_id : false, sizeof($group_id) ? $group_id : false, sizeof($forum_id) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO);
            $auth_admin->display_mask('set', $permission_type, $hold_ary, sizeof($user_id) ? 'user' : 'group', $permission_scope == 'local' ? true : false);
        } else {
            $template->assign_vars(array('S_VIEWING_PERMISSIONS' => true));
            $hold_ary = $auth_admin->get_mask('view', sizeof($user_id) ? $user_id : false, sizeof($group_id) ? $group_id : false, sizeof($forum_id) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER);
            $auth_admin->display_mask('view', $permission_type, $hold_ary, sizeof($user_id) ? 'user' : 'group', $permission_scope == 'local' ? true : false);
        }
    }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:101,代码来源:class_cms_permissions.php

示例15: display_points


//.........这里部分代码省略.........
                $s_hidden_fields = build_hidden_fields(array('action_points_logs' => true));
                // Display mode
                confirm_box(false, $this->user->lang['RESYNC_POINTSLOGS_CONFIRM'], $s_hidden_fields);
            }
        }
        // Delete all userpoints
        $reset_points_user = isset($_POST['action_points']) ? true : false;
        if ($reset_points_user) {
            if (confirm_box(true)) {
                if (!$this->auth->acl_get('a_points')) {
                    trigger_error($this->user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
                }
                $this->db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_points = 0');
                $this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_RESYNC_POINTSCOUNTS');
                trigger_error($this->user->lang['LOG_RESYNC_POINTSCOUNTS'] . adm_back_link($this->u_action));
            } else {
                $s_hidden_fields = build_hidden_fields(array('action_points' => true));
                // Display mode
                confirm_box(false, $this->user->lang['RESYNC_POINTS_CONFIRM'], $s_hidden_fields);
            }
        }
        // Transfer or set points for groups
        $group_transfer = isset($_POST['group_transfer']) ? true : false;
        $group_transfer_points = $this->request->variable('group_transfer_points', 0.0);
        $func = $this->request->variable('func', '');
        $group_id = $this->request->variable('group_id', 0);
        $pm_subject = $this->request->variable('pm_subject', '', true);
        $pm_text = $this->request->variable('pm_text', '', true);
        $sql_array = array('SELECT' => 'group_id, group_name, group_type', 'FROM' => array(GROUPS_TABLE => 'g'), 'ORDER_BY' => 'group_name');
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        $total_groups = $this->db->sql_affectedrows($result);
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('U_SMILIES' => append_sid("{$this->phpbb_root_path}posting.{$this->phpEx}", 'mode=smilies'), 'S_GROUP_OPTIONS' => group_select_options($total_groups), 'U_ACTION' => $this->u_action));
        // Update the points
        if ($group_transfer) {
            if (!check_form_key('acp_points')) {
                trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
            $sql_array = array('SELECT' => 'group_type, group_name', 'FROM' => array(GROUPS_TABLE => 'g'), 'WHERE' => 'group_id = ' . (int) $group_id);
            $sql = $this->db->sql_build_query('SELECT', $sql_array);
            $result = $this->db->sql_query($sql);
            $row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            $group_name = $row['group_type'] == GROUP_SPECIAL ? $this->user->lang['G_' . $row['group_name']] : $row['group_name'];
            // Check if we try transfering to BOTS or GUESTS
            if ($row['group_name'] == 'BOTS' || $row['group_name'] == 'GUESTS') {
                trigger_error($this->user->lang['POINTS_GROUP_TRANSFER_SEL_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
            $sql_array = array('SELECT' => 'user_id', 'FROM' => array(USER_GROUP_TABLE => 'g'), 'WHERE' => 'user_pending <> ' . true . '
					AND group_id = ' . (int) $group_id);
            $sql = $this->db->sql_build_query('SELECT', $sql_array);
            $result = $this->db->sql_query($sql);
            $user_ids = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                $user_ids[] = $row['user_id'];
            }
            $this->db->sql_freeresult($result);
            if (sizeof($user_ids)) {
                $userdata_group = implode(', ', $user_ids);
                if ($func == 'add') {
                    $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\tSET user_points = user_points + {$group_transfer_points}\n\t\t\t\t\t\tWHERE user_id IN ({$userdata_group})";
                    $this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_GROUP_TRANSFER_ADD');
                }
                if ($func == 'substract') {
                    $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\tSET user_points = user_points - {$group_transfer_points}\n\t\t\t\t\t\tWHERE user_id IN ({$userdata_group})";
开发者ID:rampmaster,项目名称:Ultimate-Points-Extension,代码行数:67,代码来源:admin_controller.php


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