2 Mods kombinieren

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
ATARI
Mitglied
Beiträge: 1684
Registriert: 22.02.2004 16:51
Wohnort: Monaco Di Bavaria

2 Mods kombinieren

Beitrag von ATARI »

hi ich hab den always show "edited by" mod eingebaut, und würde nun noch gern den mod einbauen der anzeigt zu wieveil Prozent der text geändert wurde.
auf die herkömmliche art den zweiten einzubauen gtehts leider nicht, daher wollte ich fragen ob jemand ne idee hat wie man die beiden kombinieren könnte.


#1:

Code: Alles auswählen

############################################### 
## Before Adding This Hack To Your Forum, You Should Back Up All Files Related To This Hack 
############################################### 
##   Hack Title:   Display Edit Percent Hack
##   Hack Version:   1.0
##   Author:      Superdeboer (H.J. de Boer) 
##   Description:   This hack displays the amount that has been edited.
##   				The difference between the edited message and the original message will be 
##					displayed in a percentage.
##					Where it usually says:
##					'Last edited by me on 12 Oct 2001; edited 2 times in total'
##					it will now return:
##					'Last edited by me on 12 Oct 2001; edited 2 times in total (27 percent)'
##					
##	 Compatibility:   2.0.4
##
##   Installation Level: Moderate
##   Installation Time: 10 - 15 minutes
##   Files To Edit: 3 and a small SQL-query on the database
##      
##		includes/functions_post.php
##      language/lang_english/lang_main.php
##		viewtopic.php
##
##   
##   History:
##      None
##      
##
##   Author Notes:
##      Got the idea from the Parse React forum that is used by Tweakers.net 
##		on http://gathering.tweakers.net. 
##		Special thanks goes to "Thoul" from phpbbhacks.com for helping me
##      out with the worst part and being a great supporter for a first-time modwriter.
##
##		Maybe that I'll develop a few enhancements to this hack in the future.
##		I already have some ideas, but not enough time at the moment.
##
##   Support:      http://www.phpbbhacks.com/forums 
##   Copyright:      ©2003 Display Edit Percent Hack 1.0 - H.J. de Boer
##
###############################################
##   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.
###############################################

#
#-----[ SQL ]--------------------------------------------- 
#  
ALTER TABLE phpbb_posts ADD post_edit_percent SMALLINT(3) NOT NULL DEFAULT '0';

#
#-----[ OPEN ]--------------------------------------------
#
functions_post.php

# 
#-----[ FIND ]-------------------------------------------- 
# 
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
      }

      if ($mode == 'newtopic')
      {
         $topic_id = $db->sql_nextid();
      }
   } 

# 
#-----[ AFTER, ADD ]-------------------------------------- 
# 
		
		//Retrieve the original message from the database and put it into $originalmessage		
		//Special thanks to "Thoul" from phpbbhacks.com for this part
		$getoriginalmessage = $db->sql_query("SELECT post_text FROM " . POSTS_TEXT_TABLE . " WHERE post_id = '$post_id'") or message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
		$originalmessage = $db->sql_fetchrow($getoriginalmessage);
	
		$originalmessage = $originalmessage['post_text'];
		
    	//Calculate the similarity between original text and new message
		$similar_formula = similar_text($originalmessage, $post_message, $similarity);

		//Get percentage of difference
		$getdifference = 100 - $similarity;

		//Round result
		$percent_result = round ($getdifference,0);       

#
#-----[ FIND ]--------------------------------------------
#
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";

#
#-----[ REPLACE WITH ]------------------------------------
#			
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1, post_edit_percent = post_edit_percent + $percent_result " : "";

# 
#-----[ OPEN ]--------------------------------------------
#  
viewtopic.php

# 
#-----[ FIND ]--------------------------------------------
#
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']);

#
#-----[ REPLACE WITH ]------------------------------------
#		
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count'], $postrow[$i]['post_edit_percent']);

#
#-----[ OPEN ]--------------------------------------------
#
lang_main.php

#
#-----[ FIND ]--------------------------------------------
#
$lang['Edited_time_total'] = 'Last edited by %s on %s; edited %d time in total'; // Last edited by me on 12 Oct 2001; edited 1 time in total
$lang['Edited_times_total'] = 'Last edited by %s on %s; edited %d times in total'; // Last edited by me on 12 Oct 2001; edited 2 times in total

#
#-----[ REPLACE WITH ]------------------------------------
#	
$lang['Edited_time_total'] = 'Last edited by %s on %s; edited %d time in total. (%d percent)'; // Last edited by me on 12 Oct 2001; edited 1 time in total. (12 percent).
$lang['Edited_times_total'] = 'Last edited by %s on %s; edited %d times in total. (%d percent)'; // Last edited by me on 12 Oct 2001; edited 2 times in total. (12 percent).

#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
#End

#2:

Code: Alles auswählen

###############################################
##	Hack Title:		Always show 'edited by'
##	Hack Version:	0.0.3
##	Author:			Freakin' Booty ;-P
##	Website:		http://freakingbooty.no-ip.com
##	Description:	When a user edits a post, 'edited by' is always shown. Without this hack,
##					'edited by' is only shown after a reply has been posted.
##					Also shows what user has edited the post.
##	Compatibility:	2.0.4 - 2.0.11
##
##	Installation Level: Easy
##	Installation Time: 5-10 minutes
##	Files To Edit: 3
##		viewtopic.php
##		includes/constants.php
##		includes/functions_post.php
##
##	Included Files: 1
##		db_update.php
##
##	History:
##		0.0.3:	Fixed a bug where the data is input for the first time.
##		0.0.2:	Now shows who exactly has edited the post, and how many times. On top also shows what the last
##				post time was.
##		0.0.1:	Initial release
##
##	Author Notes:
##		0.0.2 is unreleased, so that is why there are no upgrade instructions or anything.
##
##	Support:		http://www.phpbbhacks.com/forums
##	Copyright:		©2003-04 Freakin' Booty ;-P - Always show 'edited by' 0.0.3
##
###############################################
##   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.
###############################################

#
#-----[ COPY ]--------------------------------------------
#
# Run this file once as an administrator and then delete it immediately
#
db_update.php		=> db_update.php

#
#-----[ OPEN ]--------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]--------------------------------------------
#
	if ( $postrow[$i]['post_edit_count'] )
	{
		$l_edit_time_total = ( $postrow[$i]['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total'];

		$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']);
	}
	else
	{
		$l_edited_by = '';
	}

#
#-----[ REPLACE WITH ]------------------------------------
#
	$sql = "SELECT pe.*, u.username
			FROM " . POSTS_EDIT_TABLE . " pe, " . USERS_TABLE . " u
			WHERE pe.post_id = " . $postrow[$i]['post_id'] . "
				AND pe.user_id = u.user_id
			ORDER BY pe.post_edit_time DESC";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain posts edit count information', '', __LINE__, __FILE__, $sql);
	}

	$l_edited_by = '';
	while ( $row = $db->sql_fetchrow($result) )
	{
		$l_edit_time_total = ( $row['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total'];
		$l_edited_by .= ( ($l_edited_by == '') ? '<br />' : '' ) . '<br />' . sprintf($l_edit_time_total, $row['username'], create_date($board_config['default_dateformat'], $row['post_edit_time'], $board_config['board_timezone']), $row['post_edit_count']);
	}

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

#
#-----[ FIND ]--------------------------------------------
#
define('POSTS_TABLE', $table_prefix.'posts');

#
#-----[ AFTER, ADD ]-------------------------------------
#
define('POSTS_EDIT_TABLE', $table_prefix.'posts_edit');

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

#
#-----[ FIND, DELETE ]------------------------------------
#
	$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";

#
#-----[ FIND ]--------------------------------------------
#
	$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";

#
#-----[ INLINE, FIND & DELETE ]---------------------------
#
" . $edited_sql . "

#
#-----[ FIND ]--------------------------------------------
#
	add_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject));

#
#-----[ BEFORE, ADD ]-------------------------------------
#
	if( $mode == 'editpost' )
	{
		$sql = "SELECT * FROM " . POSTS_EDIT_TABLE . "
				WHERE post_id = $post_id
					AND user_id = " . $userdata['user_id'];
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not retrieve post edit count information', '', __LINE__, __FILE__, $sql);
		}

		$sql = ( $row = $db->sql_fetchrow($result) ) ? "UPDATE " . POSTS_EDIT_TABLE . " SET post_edit_count = post_edit_count + 1, post_edit_time = $current_time WHERE post_id = $post_id AND user_id = " . $userdata['user_id'] : "INSERT INTO " . POSTS_EDIT_TABLE . " (post_id, user_id, post_edit_count, post_edit_time) VALUES ($post_id, " . $userdata['user_id'] . ", 1, $current_time)";
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not update post edit count information', '', __LINE__, __FILE__, $sql);
		}
	}

#
#----[ SAVE & CLOSE ALL FILES ]---------------------------
#
Man soll aufhören wenn´s am schönsten ist!

Servus phpBB! ;)
Antworten

Zurück zu „phpBB 2.0: Mod Support“