Cum fac groupuri si sa le colorez ..
Cum schimb tema la forum ?
Astept raspunsuri .. va rog sa`mi raspundeti pas cu pas

Cod: Selectaţi tot
<php>= MAGIC_BAN_NUMBER)
{
$mode = 'ban';
}
else
{
$mode = 'warn';
}
}
elseif($HTTP_GET_VARS['mode'] == 'unwarn')
{
$profiledata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
if (!$profiledata)
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
if(!$profiledata['user_warnings'])
{
message_die(GENERAL_MESSAGE, $lang['User_has_no_warnings'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>'));
}
$mode = 'unwarn';
}
elseif($HTTP_GET_VARS['mode'] == 'unban')
{
$profiledata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
if (!$profiledata)
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$mode = 'unban';
}
else
{
// Go away, your not doing anything anyway.
redirect(append_sid("index.$phpEx"));
}
//
// Ok, Modes are set now - Lets play with them.
//
if($mode == 'ban')
{
$ban_config_rank = intval($board_config['warnmod_banrank']);
// Ok, Lets make them happy and change the rank... Lazy admins!
$sql = "UPDATE ". USERS_TABLE ." SET user_rank = '" . $ban_config_rank . "' WHERE user_id = '" . $profiledata['user_id'] . "'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update user rank", "Database Error", __LINE__, __FILE__, $sql);
}
// Change the warnings counter to show they are banned.
$sql = "UPDATE " . USERS_TABLE . " SET user_warnings = 4 WHERE user_id = " . $profiledata['user_id'];
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update warning count", "", __LINE__, __FILE__, $sql);
}
// Lets check the banlist...
$sql = "SELECT ban_userid FROM " . BANLIST_TABLE . " WHERE ban_userid = " . $profiledata['user_id'];
if(! $result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
}
if ($db->sql_fetchrowset($result))
{
message_die(GENERAL_MESSAGE, $lang['User_already_banned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>'));
}
// Lets ban this little bastard.
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) VALUES (" . $profiledata['user_id'] . ")";
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
}
// Tell them the good news!
$message = $lang['User_successfully_banned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>');
message_die(GENERAL_MESSAGE, $message, $lang['warnmod_title']);
}
elseif($mode == 'unban')
{
// This has to be a rare thing...
$unban_config_rank = intval($board_config['warnmod_unbanrank']);
// Ok, Lets make them happy and change the rank... Lazy admins!
$sql = "UPDATE ". USERS_TABLE ." SET user_rank = '" . $unban_config_rank . "' WHERE user_id = '" . $profiledata['user_id'] . "'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update user rank", "Database Error", __LINE__, __FILE__, $sql);
}
// Change the warnings counter to show they are unbanned.
$sql = "UPDATE " . USERS_TABLE . " SET user_warnings = 0 WHERE user_id = " . $profiledata['user_id'];
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update warning count", "", __LINE__, __FILE__, $sql);
}
// Lets check the banlist...
$sql = "SELECT ban_userid FROM " . BANLIST_TABLE . " WHERE ban_userid = " . $profiledata['user_id'];
if(! $result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
}
if (!$db->sql_fetchrowset($result))
{
message_die(GENERAL_MESSAGE, $lang['User_not_banned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>'));
}
// Lets unban this little bundle of joy.
$sql = "DELETE FROM " . BANLIST_TABLE . " WHERE ban_userid = " . $profiledata['user_id'] . " LIMIT 1";
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
}
// Tell them the good news!
$message = $lang['User_successfully_unbanned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>');
message_die(GENERAL_MESSAGE, $message, $lang['warnmod_title']);
}
elseif($mode == 'unwarn')
{
// Hmm, Looks like somebody has been good today
$newWarnlevel = intval($profiledata['user_warnings']);
$newWarnlevel--;
$sql = "UPDATE " . USERS_TABLE . " SET user_warnings = $newWarnlevel WHERE user_id = " . $profiledata['user_id'];
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update warning count", "", __LINE__, __FILE__, $sql);
}
$message = $lang['User_successfully_unwarned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>');
message_die(GENERAL_MESSAGE, $message, $lang['warnmod_title']);
}
elseif($mode == 'warn')
{
// Whats the point of warning a banned user...
$sql = "SELECT ban_userid FROM " . BANLIST_TABLE . " WHERE ban_userid = " . $profiledata['user_id'];
if(! $result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
}
if ($db->sql_fetchrowset($result))
{
message_die(GENERAL_MESSAGE, $lang['User_already_banned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>'));
}
// Oh noes! Somebody did something wrong!
$newWarnlevel = intval($profiledata['user_warnings']);
$newWarnlevel++;
$sql = "UPDATE " . USERS_TABLE . " SET user_warnings = $newWarnlevel WHERE user_id = " . $profiledata['user_id'];
if (!$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update warning count", "", __LINE__, __FILE__, $sql);
}
$message = $lang['User_successfully_warned_warnmod'] . '<br><br>' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(">', '</a>');
message_die(GENERAL_MESSAGE, $message, $lang['warnmod_title']);
}
else
{
// Hmm, Wtf did i do wrong to make it do this?
redirect(append_sid("index.$phpEx"));
}
//
// Output page and footer
//
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Cod: Selectaţi tot
#################################################################
## MOD Title: Simple Warning & Ban System
## MOD Version: 0.2.0
## MOD Author: Eminem_Fan <N> (Dean Oakes) http://www.phpbb.com
## MOD Description: This modification will allow you to warn your users and automaticly ban them on after the 3rd warning.
##
## Installation Level: Easy
## Installation Time: 20 Minutes
##
## Files To Edit: viewtopic.php
## language/lang_english/lang_main.php
## language/lang_english/lang_admin.php
## includes/usercp_viewprofile.php
## includes/constants.php
## admin/admin_board.php
## templates/subSilver/admin/board_config_body.tpl
## templates/subSilver/viewtopic_body.tpl
## templates/subSilver/profile_view_body.tpl
## Included Files: N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Note:
## Finaly, a simple way to warn your members and ban them if they persist!
##############################################################
## MOD History:
##
## 2005-22-12 - Version 0.1.0
## - Development started
##
## 2005-22-12 - Version 0.2.0
## - Stable Release
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_users ADD user_warnings tinyint(1) DEFAULT 0 NOT NULL;
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnmod_banrank', 0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnmod_unbanrank', 0);
#
#-----[ COPY ]------------------------------------------
#
copy root/warning.php to warning.php
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.username,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, u.user_allowsmile
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, u.user_warnings
#
#-----[ FIND ]------------------------------------------
#
if ( $poster_id != ANONYMOUS )
{
#
#-----[ REPLACE WITH ]------------------------------------------
#
$user_warnings = 0;
if ( $poster_id != ANONYMOUS )
{
$user_warnings = $postrow[$i]['user_warnings'];
#
#-----[ FIND ]------------------------------------------
#
$l_edited_by = '';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$warn_lnk = '';
if($userdata['user_level'] != USER)
{
if($user_warnings != MAGIC_NUMBER_BANNED)
{
$warn_lnk .= '<a class="gensmall" href="' . append_sid(" POST_USERS_URL=" . $postrow[$i]['user_id']) . '">' . $lang['warnmod_warn'] . '</a>';
}
else
{
$warn_lnk .= '<a class="gensmall" href="' . append_sid(" POST_USERS_URL=" . $postrow[$i]['user_id']) . '">' . $lang['warnmod_unban'] . '</a>';
}
if($user_warnings && $user_warnings != MAGIC_NUMBER_BANNED)
{
$warn_lnk .= ' || <a class="gensmall" href="' . append_sid(" POST_USERS_URL=" . $postrow[$i]['user_id']) . '">' . $lang['warnmod_unwarn'] . '</a>';;
}
}
if($warn_lnk)
{
$warn_lnk .= '<br>';
}
#
#-----[ FIND ]------------------------------------------
#
'EDITED_MESSAGE' => $l_edited_by,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'WARNINGS' => ($user_warnings && $userdata['user_level'] != USER && $user_warnings != MAGIC_NUMBER_BANNED) ? $lang['warnmod_vtitle'] . ': ' . $user_warnings . '<br>' : '',
'WARN_USER' => $warn_lnk,
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['warnmod_warn'] = 'Warn';
$lang['warnmod_unwarn'] = 'Unwarn';
$lang['warnmod_unban'] = 'Unban';
$lang['warnmod_title'] = 'Warnings System';
$lang['warnmod_vtitle'] = 'Warnings';
$lang['User_has_no_warnings'] = 'You cannot unwarn this user as they do not have any warnings.';
$lang['User_already_banned_warnmod'] = 'This user has already been banned.';
$lang['User_successfully_banned_warnmod'] = 'This user has been succesfully banned.';
$lang['User_successfully_warned_warnmod'] = 'This user has been succesfully warned.';
$lang['User_successfully_unwarned_warnmod'] = 'This user bas been unwarned successfully.';
$lang['User_successfully_unbanned_warnmod'] = 'This user has been succesfully unbanned.';
$lang['User_not_banned_warnmod'] = 'You cannot unban this user as they are not banned.';
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['warnmod_banrank'] = 'WarnMOD Banned Rank';
$lang['warnmod_banrank_explain'] = 'When somebody is banned using the WarnMOD system they will automaticly be given the rank id you specify';
$lang['warnmod_unbanrank'] = 'WarnMOD Unbanned Rank';
$lang['warnmod_unbanrank_explain'] = 'When somebody is unbanned using the WarnMOD system they will automaticly be given the rank id you specify';
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
if (!$profiledata)
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($profiledata['user_warnings'] && $userdata['user_level'] != USER && $profiledata['user_warnings'] != MAGIC_NUMBER_BANNED)
{
$template->assign_block_vars('switch_warning', array());
}
#
#-----[ FIND ]------------------------------------------
#
'POST_PERCENT_STATS' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
'WARNINGS' => $profiledata['user_warnings'],
#
#-----[ FIND ]------------------------------------------
#
'L_ABOUT_USER' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_WARNINGS' => $lang['warnmod_vtitle'],
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
define('MAGIC_BAN_NUMBER', 3);
define('MAGIC_NUMBER_BANNED', 4);
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------
#
"L_RESET" =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_BAN_RANK" => $lang['warnmod_banrank'],
"L_BAN_RANK_EXPLAIN" => $lang['warnmod_banrank_explain'],
"L_UNBAN_RANK" => $lang['warnmod_unbanrank'],
"L_UNBAN_RANK_EXPLAIN" => $lang['warnmod_unbanrank_explain'],
"BAN_RANK" => $new['warnmod_banrank'],
"UNBAN_RANK" => $new['warnmod_unbanrank'],
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td><input> {L_YES} <input> {L_NO}</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td>{L_BAN_RANK}<br><span>{L_BAN_RANK_EXPLAIN}</span></td>
<td><input></td>
</tr>
<tr>
<td>{L_UNBAN_RANK}<br><span>{L_UNBAN_RANK_EXPLAIN}</span></td>
<td><input></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{postrow.POSTER_RANK}<br>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_RANK}
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{postrow.WARNINGS}
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_FROM}
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<br><div>{postrow.WARN_USER}</div>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td><b><span>{JOINED}</span></b></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<BEGIN>
<tr>
<td><span>{L_WARNINGS}: </span></td>
<td><b><span>{WARNINGS}</span></b></td>
</tr>
<END>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 7 vizitatori