[adv_board_disable] Advanced Board Disable Frage

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
UnPXrE
Mitglied
Beiträge: 1
Registriert: 03.03.2008 22:36

[adv_board_disable] Advanced Board Disable Frage

Beitrag von UnPXrE »

Betrifft MOD: [mod=adv_board_disable]Advanced Board Disable[/mod]

Hallo,

ich wollte diese/den MOD grade installieren... doch ich blicke ÜBERHAUPT nicht durch dir install.txt

Da ist alles kreuz und quest :( Könnte die vllt jmd mal ein bisschen ordentlicher machen ? :D

Wäre nett, danke


UnPXrE
LOLRainbow
Mitglied
Beiträge: 242
Registriert: 20.09.2007 12:13
Wohnort: Ebersbach an der Fils
Kontaktdaten:

Beitrag von LOLRainbow »

Code: Alles auswählen

#################################################################
## MOD Title: Advanced Board Disable
## MOD Author: S2B < mods@s2b-project.de > (S. Praetorius) http://www.s2b-project.de
## MOD Description: This MOD extends the "board disabled" function of phpBB. You can set a message
##                  in the ACP which will be shown when the board is disabled. You also can choose
##                  for which user levels the board will be disabled. Everybody else sees the disabled
##                  message in the header, but is still able to use the board's features.
## MOD Version: 2.0.2
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: admin/admin_board.php
##                includes/page_header.php
##                includes/functions_selects.php
##                includes/functions.php
##                language/lang_english/lang_admin.php
##                common.php
##                login.php
##                templates/subSilver/overall_header.tpl
##                templates/subSilver/admin/board_config_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.s2b-project.de for the
## latest version of this MOD.
#################################################################
##
## Author Notes:
##   You cannot update from v1.0.2 to v2.0.0. To install this new version of the mod, you have to
##   uninstall the old version. You don't have to undo the sql changes because they haven't changed
##   in v2.0.0.
##
#################################################################
##
## MOD History:
##   v2.0.2
##   - fixed a small bug when deselecting all groups in the admin panel
##
##   v2.0.1
##   - a tiny fix for those with a german language pack installed
##   - a small change on the install.txt (this file)
##
##   v2.0.0
##   - code rewrite
##   - individual user level selection
##   - to update from v1.0.2, read the Author Notes
##
##   v1.0.2
##   - disable board for guests only
##   - line breaks in the board disable message
##
##   v1.0.1
##   - error with groupcp.php and phpBB-modifications fixed
##
##   v1.0
##   - Initial release
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

#
#-----[ SQL ]----------------------------------------------------
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_mode', '-1,0');

#
#-----[ OPEN ]---------------------------------------------------
#
admin/admin_board.php

#
#-----[ FIND ]---------------------------------------------------
#
			$sql = "UPDATE " . CONFIG_TABLE . " SET

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
			if ($config_name == 'board_disable_mode' && is_array($new['board_disable_mode']))
			{
				$new[$config_name] = implode(',', $new[$config_name]);
			}

#
#-----[ FIND ]---------------------------------------------------
#
$disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
$disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";

#
#-----[ REPLACE WITH ]-------------------------------------------
# = delete
#


#
#-----[ FIND ]---------------------------------------------------
#
$template->set_filenames(array(
	"body" => "admin/board_config_body.tpl")

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
$board_disable_mode_select = disable_mode_select($new['board_disable_mode']);
$board_disable_yes = ($new['board_disable']) ? ' checked="checked"' : '';
$board_disable_no = (!$new['board_disable']) ? ' checked="checked"' : '';

#
#-----[ FIND ]---------------------------------------------------
#
	"L_DISABLE_BOARD" => $lang['Board_disable'], 
	"L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'], 

#
#-----[ REPLACE WITH ]-------------------------------------------
# = delete
#


#
#-----[ FIND ]---------------------------------------------------
#
	"S_DISABLE_BOARD_YES" => $disable_board_yes,
	"S_DISABLE_BOARD_NO" => $disable_board_no,

#
#-----[ REPLACE WITH ]-------------------------------------------
# = delete
#


#
#-----[ FIND ]---------------------------------------------------
#
	"COPPA_FAX" => $new['coppa_fax'])

#
#-----[ REPLACE WITH ]-------------------------------------------
#
	"COPPA_FAX" => $new['coppa_fax'],

	'L_BOARD_DISABLE' => $lang['Board_disable'],
	'L_BOARD_DISABLE_EXPLAIN' => $lang['Board_disable_explain'],
	'BOARD_DISABLE_YES' => $board_disable_yes,
	'BOARD_DISABLE_NO' => $board_disable_no,
	'L_BOARD_DISABLE_MODE' => $lang['Board_disable_mode'],
	'L_BOARD_DISABLE_MODE_EXPLAIN' => $lang['Board_disable_mode_explain'],
	'BOARD_DISABLE_MODE' => $board_disable_mode_select,
	'L_BOARD_DISABLE_MSG' => $lang['Board_disable_msg'],
	'L_BOARD_DISABLE_MSG_EXPLAIN' => $lang['Board_disable_msg_explain'],
	'BOARD_DISABLE_MSG' => htmlspecialchars($new['board_disable_msg']))

#
#-----[ OPEN ]---------------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]---------------------------------------------------
#
	//
	// Set up style
	//

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
	// Disable board if needed
	board_disable();

#
#-----[ FIND ]---------------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
//
// Disable board if needed
//
function board_disable()
{
	global $board_config, $lang, $userdata;

	// avoid multiple function calls
	static $called = false;
	if ($called == true)
	{
		return;
	}
	$called = true;

	if ($board_config['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN'))
	{
		$disable_mode = explode(',', $board_config['board_disable_mode']);
		$user_level = ($userdata['user_id'] == ANONYMOUS) ? ANONYMOUS : $userdata['user_level'];

		if (in_array($user_level, $disable_mode))
		{
			$disable_message = (!empty($board_config['board_disable_msg'])) ? 

htmlspecialchars($board_config['board_disable_msg']) : $lang['Board_disable'];
			message_die(GENERAL_MESSAGE, str_replace("\n", '<br />', $disable_message), 'Information');
		}
		else
		{
			define('BOARD_DISABLE', true);
		}
	}
}

#
#-----[ OPEN ]---------------------------------------------------
#
includes/functions_selects.php

#
#-----[ FIND ]---------------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
//
// Disable modes
//
function disable_mode_select($default, $select_name = 'board_disable_mode')
{
	global $lang;

	if (!is_array($default))
	{
		$default = explode(',', $default);
	}

	$disable_select = '<select name="' . $select_name . '[]" multiple="multiple">';
	foreach ($lang['Board_disable_mode_opt'] as $const => $name)
	{
		$selected = (in_array($const, $default)) ? ' selected="selected"' : '';
		$disable_select .= '<option value="' . $const . '"' . $selected . '>' . $name . '</option>';
	}
	$disable_select .= '</select>';

	return $disable_select;
}

#
#-----[ OPEN ]---------------------------------------------------
#
includes/page_header.php

#
#-----[ FIND ]---------------------------------------------------
#
		$template->assign_block_vars('switch_enable_pm_popup', array());
	}
}

#
#-----[ AFTER, ADD ]---------------------------------------------
#
//
// Show board disabled note
//
if (defined('BOARD_DISABLE'))
{
	$disable_message = (!empty($board_config['board_disable_msg'])) ? htmlspecialchars($board_config['board_disable_msg']) : 

$lang['Board_disable'];
	$template->assign_block_vars('board_disable', array(
		'MSG' => str_replace("\n", '<br />', $disable_message))
	);
}

#
#-----[ OPEN ]---------------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[ FIND ]---------------------------------------------------
#
$lang['Board_disable'] = 'Disable board';
$lang['Board_disable_explain'] = 'This will make the board unavailable to users. Administrators are able to access the 

Administration Panel while the board is disabled.';

#
#-----[ REPLACE WITH ]-------------------------------------------
# = delete
#


#
#-----[ FIND ]---------------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
//
// Advanced Board Disable
//
$lang['Board_disable'] = 'Disable board';
$lang['Board_disable_explain'] = 'This will deny access to the board for several user groups you can define below.';
$lang['Board_disable_mode'] = 'Disable board for...';
$lang['Board_disable_mode_explain'] = 'Here you can choose who isn\'t allowed to access the board when it\'s disabled. With Ctrl key 

pressed you can select more than one user group.';
$lang['Board_disable_mode_opt'] = array(ANONYMOUS => 'Guests', USER => 'Registered Users', MOD => 'Moderators', ADMIN => 

'Administrators');
$lang['Board_disable_msg'] = 'Board disabled message';
$lang['Board_disable_msg_explain'] = 'This message will be shown when the board is disabled (empty message = phpBB default 

message).';

#
#-----[ OPEN ]---------------------------------------------------
#
common.php

#
#-----[ FIND ]---------------------------------------------------
#
//
// Show 'Board is disabled' message if needed.
//
if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") )
{
	message_die(GENERAL_MESSAGE, 'Board_disable', 'Information');
}

#
#-----[ REPLACE WITH ]-------------------------------------------
# = delete
#


#
#-----[ OPEN ]---------------------------------------------------
#
login.php

#
#-----[ FIND ]---------------------------------------------------
#
			if( $row['user_level'] != ADMIN && $board_config['board_disable'] )

#
#-----[ REPLACE WITH ]-------------------------------------------
#
			$disable_mode = explode(',', $board_config['board_disable_mode']);
			if ($board_config['board_disable'] && $row['user_level'] != ADMIN && in_array($row['user_level'], 

$disable_mode))

#
#-----[ OPEN ]---------------------------------------------------
#
templates/subSilver/overall_header.tpl

#
#-----[ FIND ]---------------------------------------------------
#
				</table></td>
			</tr>
		</table>

		<br />

#
#-----[ AFTER, ADD ]---------------------------------------------
#
		<!-- BEGIN board_disable -->
		<div class="forumline" style="padding: 10px; margin: 5px 2px; text-align: center">
			<span class="gen">{board_disable.MSG}</span>
		</div>
		<!-- END board_disable -->

#
#-----[ OPEN ]---------------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]---------------------------------------------------
#
	<tr>
		<td class="row1">{L_DISABLE_BOARD}<br /><span class="gensmall">{L_DISABLE_BOARD_EXPLAIN}</span></td>
		<td class="row2"><input type="radio" name="board_disable" value="1" {S_DISABLE_BOARD_YES} /> 

{L_YES}&nbsp;&nbsp;<input type="radio" name="board_disable" value="0" {S_DISABLE_BOARD_NO} /> {L_NO}</td>
	</tr>

#
#-----[ REPLACE WITH ]-------------------------------------------
# = delete
#


#
#-----[ FIND ]---------------------------------------------------
#
	<tr>
		<th class="thHead" colspan="2">{L_COOKIE_SETTINGS}</th>
	</tr>

#
#-----[ BEFORE, ADD ]--------------------------------------------
#
	<tr>
		<th class="thHead" colspan="2">{L_BOARD_DISABLE}</th>
	</tr>
	<tr>
		<td class="row1">{L_BOARD_DISABLE}<br /><span class="gensmall">{L_BOARD_DISABLE_EXPLAIN}</span></td>
		<td class="row2">
			<input type="radio" name="board_disable" id="board_disable_1" value="1" {BOARD_DISABLE_YES} />
			<label for="board_disable_1">{L_YES}</label>&nbsp;&nbsp;
			<input type="radio" name="board_disable" id="board_disable_0" value="0" {BOARD_DISABLE_NO} />
			<label for="board_disable_0">{L_NO}</label>
		</td>
	</tr>
	<tr>
		<td class="row1" style="vertical-align: top">{L_BOARD_DISABLE_MODE}<br /><span 

class="gensmall">{L_BOARD_DISABLE_MODE_EXPLAIN}</span></td>
		<td class="row2">
			{BOARD_DISABLE_MODE}
		</td>
	</tr>
	<tr>
		<td class="row1" style="vertical-align: top">{L_BOARD_DISABLE_MSG}<br /><span 

class="gensmall">{L_BOARD_DISABLE_MSG_EXPLAIN}</span></td>
		<td class="row2">
			<textarea name="board_disable_msg" rows="3" cols="30" style="width: 100%">{BOARD_DISABLE_MSG}</textarea>
		</td>
	</tr>

#
#-----[ SAVE/CLOSE ALL FILES ]-----------------------------------
#
# EoM
Benutzeravatar
S2B
Ehemaliges Teammitglied
Beiträge: 3258
Registriert: 10.08.2004 22:48
Wohnort: Aachen
Kontaktdaten:

Beitrag von S2B »

Du hast zuviel Code gepostet, was das Thema unnötig in die Länge zieht und unübersichtlich macht.
Es wäre besser die Datei bzw. den Code als .txt Datei abzuspeichern und dann hier einen Link zu posten - siehe auch KB:datei .

Bitte passe deinen Beitrag an, lies Dir den phpBB.de-Knigge und den Hinweis zur Fragestellung und Rechtschreibung durch und beachte diese zukünftig.

@UnPXrE: Ich empfehle dir die Benutzung eines Editors, der auch mit UNIX-Zeilenumbrüchen zurecht kommt, dann wird die Datei nämlich korrekt dargestellt. Über die Forensuche findest du ein Thema, in dem verschiedene Editoren erwähnt werden.
Antworten

Zurück zu „phpBB 2.0: Mod Support“