############################################################## ## MOD Title: MOD Translate_topic_urls ## MOD Author: Merlin Sythove < Merlin@silvercircle.org > www.pimpmyforum.nl ## MOD Description: This mod changes links into topic titles in posts. ## MOD Version: 0.9.0 ## ## Installation Level: (Easy) ## Installation Time: 5 Minutes ## Files To Edit: ## includes/functions.post.php ## posting.php, ## etc ## Included Files: ## 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 Notes: ## This mod will change links to topics in your own forum like ## http://www.domain.com/forum/viewtopic.php?t=1234 ## into proper [url=...]Title[/url] links with the correct topic title in it. ## ############################################################## ## MOD History: ## ## 2007-10-09 - Version 0.9.0 ## - version notes go here ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------------------ # posting.php # #-----[ FIND ]------------------------------------------ # partial line prepare_post($mode, # #-----[ BEFORE, ADD ]------------------------------------------ # //MOD Translate_topic_urls for saving message $message = xlat_topic_links($message); # #-----[ FIND ]------------------------------------------ # if( $preview ) # #-----[ BEFORE, ADD ]------------------------------------------ # //MOD Translate_topic_urls for saving message $message = xlat_topic_links($message); # #-----[ OPEN ]------------------------------------------ # includes/functions_post.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE ADD ]------------------------------------------ # //MOD Translate_topic_urls //Translate http://www.domain.com/forum/viewtopic.php?..... into url BBCode and topic title //Works with t=1234.... and p=1234..... function xlat_topic_links ($message) { global $phpEx, $db, $board_config; $valid_url = "\w\#$%&~/.\-;:=,?@+"; //from bbcode.php, but no square brackets $pattern = "(? 0) { $type = substr($url, $pos - 1, 1); //POST_TOPIC_URL or POST_POST_URL for ($i = $pos+1;$isql_query($sql) && $row = $db->sql_fetchrow($result)) ) { message_die(GENERAL_ERROR, "Cannot fetch topic title", '', __LINE__, __FILE__, $sql); } $topic_title = $row['topic_title']; $url = "[url=" . $url . "]" . $topic_title . "[/url]"; } return($url); } //END MOD Translate_topic_urls # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM