aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_ban.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-03-15 13:03:57 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-03-15 13:03:57 +0000
commitd907d066f2e0d7974766370b11dab69a59962f97 (patch)
tree146a203caa445298e084088c30311b959d00c9f1 /phpBB/includes/mcp/mcp_ban.php
parent8c3f94f9ae8a1333be8c01dd2e0be74dffc91831 (diff)
downloadforums-d907d066f2e0d7974766370b11dab69a59962f97.tar
forums-d907d066f2e0d7974766370b11dab69a59962f97.tar.gz
forums-d907d066f2e0d7974766370b11dab69a59962f97.tar.bz2
forums-d907d066f2e0d7974766370b11dab69a59962f97.tar.xz
forums-d907d066f2e0d7974766370b11dab69a59962f97.zip
- adding ability to assign moderator specific ban options
- fixing destroying of sql caches - fixing referencing of sql cached queries if more than one are active on one page - other fixes git-svn-id: file:///svn/phpbb/trunk@5633 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/mcp/mcp_ban.php')
-rw-r--r--phpBB/includes/mcp/mcp_ban.php140
1 files changed, 140 insertions, 0 deletions
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php
new file mode 100644
index 0000000000..2ae9710d03
--- /dev/null
+++ b/phpBB/includes/mcp/mcp_ban.php
@@ -0,0 +1,140 @@
+<?php
+/**
+*
+* @package mcp
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package mcp
+*/
+class mcp_ban
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ global $config, $db, $user, $auth, $template, $cache;
+ global $SID, $phpbb_root_path, $phpEx;
+
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+
+ // Include the admin banning interface...
+ include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx);
+
+ $bansubmit = (isset($_POST['bansubmit'])) ? true : false;
+ $unbansubmit= (isset($_POST['unbansubmit'])) ? true : false;
+ $current_time = time();
+
+ $user->add_lang('acp/ban');
+ $this->tpl_name = 'mcp_ban';
+
+ // Ban submitted?
+ if ($bansubmit)
+ {
+ // Grab the list of entries
+ $ban = request_var('ban', '');
+ $ban_len = request_var('banlength', 0);
+ $ban_len_other = request_var('banlengthother', '');
+ $ban_exclude = request_var('banexclude', 0);
+ $ban_reason = request_var('banreason', '');
+ $ban_give_reason = request_var('bangivereason', '');
+
+ user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
+
+ trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
+ }
+ else if ($unbansubmit)
+ {
+ $ban = request_var('unban', array(''));
+
+ user_unban($mode, $ban);
+
+ trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
+ }
+
+ // Ban length options
+ $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -&gt; ');
+
+ $ban_end_options = '';
+ foreach ($ban_end_text as $length => $text)
+ {
+ $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
+ }
+
+ // Define language vars
+ $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
+
+ $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
+ $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
+ $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
+ $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
+ $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
+
+ switch ($mode)
+ {
+ case 'user':
+ $l_ban_cell = $user->lang['USERNAME'];
+ break;
+
+ case 'ip':
+ $l_ban_cell = $user->lang['IP_HOSTNAME'];
+ break;
+
+ case 'email':
+ $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
+ break;
+ }
+
+ acp_ban::display_ban_options($mode);
+
+ $template->assign_vars(array(
+ 'L_TITLE' => $this->page_title,
+ 'L_EXPLAIN' => $l_ban_explain,
+ 'L_UNBAN_TITLE' => $l_unban_title,
+ 'L_UNBAN_EXPLAIN' => $l_unban_explain,
+ 'L_BAN_CELL' => $l_ban_cell,
+ 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain,
+ 'L_NO_BAN_CELL' => $l_no_ban_cell,
+
+ 'S_USERNAME_BAN' => ($mode == 'user') ? true : false,
+
+ 'U_ACTION' => $this->u_action,
+ 'U_FIND_USER' => $phpbb_root_path . "memberlist.$phpEx$SID&amp;mode=searchuser&amp;form=mcp_ban&amp;field=ban",
+ )
+ );
+ }
+}
+
+/**
+* @package module_install
+*/
+class mcp_ban_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'mcp_ban',
+ 'title' => 'MCP_BAN',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'email' => array('title' => 'MCP_BAN_EMAILS', 'auth' => 'acl_m_ban'),
+ 'ip' => array('title' => 'MCP_BAN_IPS', 'auth' => 'acl_m_ban'),
+ 'user' => array('title' => 'MCP_BAN_USERNAMES', 'auth' => 'acl_m_ban'),
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
+
+?> \ No newline at end of file