rendered paste body<?php/**** @package events* @version $Id: action_forum_permissions.php,v 1.2 2005/12/25 00:09:26 davidmj Exp $* @copyright (c) 2005 phpBB Group* @license http://opensource.org/licenses/gpl-license.php GNU Public License**//*** Event action class for the forum_permissions action.* Its purpose is the generation of the ACP page. The class is only used statically.** @package acp*/class eva_forum_permissions_acp{ /** * Generates the contents for the ACP page showing event action options (create/edit event) * It uses a {@link acp_action_forum_permissions.html template} which is dynamically included */ function display($options, $provided_info) { global $template, $user, $db; $trigger_option = ($provided_data & EVT_DATA_FORUM) ? '<option value="-1"' . ((in_array(-1, $options['f_ids'])) ? ' selected="selected"': '') . '>' . $user->lang['TRIGGER_FORUM'] . '</option>' : ''; $f_ids = array(); foreach ($options['f_ids'] as $f_id => $void) { $f_ids[] = $f_id; } $s_forums = $trigger_option . make_forum_select($f_ids); $template->assign_var('S_FORUMS', $s_forums); // Grab the list of permission options $sql_founder = ($user->data['user_type'] == USER_FOUNDER) ? ' AND founder_only <> 1' : ''; $sql = "SELECT auth_option_id, auth_option FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option <> 'f_' $sql_founder"; $result = $db->sql_query($sql); // Output all permissions while ($row = $db->sql_fetchrow($result)) { $l_auth_option = (!empty($user->lang['acl_' . $row['auth_option']])) ? $user->lang['acl_' . $row['auth_option']] : $row['auth_option']; // Default to ignore if (!isset($options[$row['auth_option']])) { $options[$row['auth_option']] = '*'; } switch (strval($options[$row['auth_option']])) { case '*': $template->assign_block_vars('eva_options', array('S_IGNORE' => true)); break; case '1': $template->assign_block_vars('eva_options', array('S_YES' => true)); break; case '-1': $template->assign_block_vars('eva_options', array('S_UNSET' => true)); break; case '0': $template->assign_block_vars('eva_options', array('S_NO' => true)); break; } $template->alter_block_array('eva_options', array( 'L_OPTION' => $l_auth_option, 'OPTION' => $row['auth_option'] ), true, 'change'); } $db->sql_freeresult($result); // Return true since some output was generated return true; } /** * This function turns the request data into an array to store with the event. */ function retrieve_options($provided_info) { global $db, $user; // Grab the list of options ... $sql_founder = ($user->data['user_type'] == USER_FOUNDER) ? ' AND founder_only <> 1' : ''; $sql = "SELECT auth_option_id, auth_option FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option <> 'u_' $sql_founder"; $result = $db->sql_query($sql); $options = array(); while ($row = $db->sql_fetchrow($result)) { $val = request_var('eva_auth_' . $row['auth_option'], '*'); if ($val != '*') { $options[$row['auth_option']] = intval($val); } } $db->sql_freeresult($result); $options['f_ids'] = request_var('eva_f_ids', array(0 => 0)); if ($options['f_ids'] == array(0)) { return array(EVT_ERROR, $user->lang['SELECT_FORUM']); } if (!sizeof($options)) { return array(EVT_ERROR, $user->lang['SELECT_PERMISSION']); } return array(EVT_SUCCESS, $options); }}?>