Brauche Erweiterung eines Mods

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
Benutzeravatar
Sujao
Mitglied
Beiträge: 296
Registriert: 25.12.2003 03:56
Wohnort: Stuttgart
Kontaktdaten:

Brauche Erweiterung eines Mods

Beitrag von Sujao »

Ich habe auf phpbbhacks.com einen Mod gefunden, der es Moderatoren verbietet Beiträge des Admin zu ändern oder zu löschen. Ich würde gerne noch die Option einbauen, dass Moderatoren auch keine Beiträge anderer Moderatoren ändern oder löschen können. Ich vermute, dass man nur ein paar Zeilen hinzufügen muß. Könnt ihr mir bitte sagen welche und wo ?

Hier ist der Mod

Code: Alles auswählen

###############################################
##	Hack Title:		Disallow editing/deleting administrator posts
##	Hack Version:	0.0.2
##	Author:			Freakin' Booty ;-P
##	Website:		http://www.freakingbooty.tk
##	Description:	Moderators cannot edit nor delete posts by administrators.
##	Compatibility:	2.0.3 - 2.0.6
##
##	Installation Level: Easy
##	Installation Time: 5
##
##	Files To Edit: 3
##		modcp.php
##		posting.php
##		language/lang_english/lang_main.php
##
##	Included Files:
##		None
##
##	History:
##      0.0.1:	Initial release.
##		0.0.2:	Confirmed to be compatible with 2.0.5 and 2.0.6.
##
##	Author Notes:
##		To upgrade from 0.0.1 to 0.0.2, you have to do... nothing :D. This release is only to confirm
##		compatibility with 2.0.5 and 2.0.6.
##
##	Support:		http://www.phpbbhacks.com/forums
##	Copyright:		2003 Disallow editing/deleting admin posts 0.0.2 - Freakin' Booty ;-P
##
###############################################
##	You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
##	Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
##	This hack is released under the GPL License.
##	This hack can be freely used, but not distributed, without permission.
##	Intellectual Property is retained by the hack author(s) listed above.
###############################################

#
#-----[ OPEN ]--------------------------------------------
#
modcp.php

#
#-----[ FIND ]--------------------------------------------
#
# 2.0.3
#
switch( $mode )
{
	case 'delete':

#
#-----[ FIND ]--------------------------------------------
#
# 2.0.4 - 2.0.6
#
	case 'delete':
		if (!$is_auth['auth_delete'])
		{
			message_die(MESSAGE, sprintf($lang['Sorry_auth_delete'], $is_auth['auth_delete_type']));
		}

#
#-----[ AFTER, ADD ]--------------------------------------
#
		if( $userdata['user_level'] != ADMIN )
		{
			$topics_sql = ( isset($HTTP_POST_VARS['topic_id_list']) ) ? implode(',', $HTTP_POST_VARS['topic_id_list']) : $topic_id;
			$sql = "SELECT t.topic_id
					FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
					WHERE u.user_id = t.topic_poster
						AND u.user_level = " . ADMIN . "
						AND t.topic_id IN ($topics_sql)";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not retrieve topics list', '', __LINE__, __FILE__, $sql);
			}

			if( $db->sql_numrows($result) > 0 )
			{
				message_die(GENERAL_MESSAGE, $lang['Not_auth_edit_delete_admin']);
			}
		}

#
#-----[ OPEN ]--------------------------------------------
#
posting.php

#
#-----[ FIND ]--------------------------------------------
#
		if ( empty($post_id) )
		{
			message_die(GENERAL_MESSAGE, $lang['No_post_id']);
		}

#
#-----[ AFTER, ADD ]--------------------------------------
#
		if( $userdata['user_level'] != ADMIN && ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete') )
		{
			$sql = "SELECT u.user_level
					FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
					WHERE p.post_id = $post_id
						AND p.poster_id = u.user_id
						AND u.user_level = " . ADMIN;
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not retrieve post information', '', __LINE__, __FILE__, $sql);
			}
			if( $row = $db->sql_fetchrow($result) )
			{
				message_die(GENERAL_MESSAGE, $lang['Not_auth_edit_delete_admin']);
			}
		}
#
#-----[ OPEN ]--------------------------------------------
#
# Make sure to edit this file for every language installed
#
language/lang_english/lang_main.php

#
#-----[ FIND ]--------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]-------------------------------------
#
//
// Disallow editing/deleting administrator posts
//
$lang['Not_auth_edit_delete_admin'] = 'You cannot edit/delete an administrator\'s posts, sorry.';

#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
There are no passangers on Spaceship Earth, we are all the crew !
PhilippK
Vorstand
Vorstand
Beiträge: 14662
Registriert: 13.08.2002 14:10
Wohnort: Stuttgart
Kontaktdaten:

Beitrag von PhilippK »

So ganz einfach wird's nicht, da du dann die Mods auch daran hinderst, ihre eigenen Beiträge zu ändern. Versuche mal folgendes: Im Code kommt zweimal

Code: Alles auswählen

                 AND u.user_level = " . ADMIN . "
vor. Ersetze das mal durch

Code: Alles auswählen

                 AND (u.user_level = " . ADMIN . " OR u.user_level = " . MOD . ")
                 AND u.user_id != " . $userdata['user_id'] . "
Ist ungetestet und sollte daher von dir getestet werden.

Gruß, Philipp
Kein Support per PN!
Der Sozialstaat ist [...] eine zivilisatorische Errungenschaft, auf die wir stolz sein können. Aber der Sozialstaat heutiger Prägung hat sich übernommen. Das ist bitter, aber wahr. (Horst Köhler)
Meine Mods
Antworten

Zurück zu „phpBB 2.0: Mod Support“