[gez]Forum topic-link naar textlink mod

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
Gebruikersavatar
AarClay
Berichten: 787
Lid geworden op: 10 feb 2005, 17:12

[gez]Forum topic-link naar textlink mod

Bericht door AarClay » 26 mei 2006, 10:59

Ik zoek een MOD die ervoor zorgt dat als je ene link zoals:

http://www.mijnforum.nl/viewtopic.php?t=1337 intypt, dat hij automatisch geconverteerd wordt naar:

Check deze babes

Heeft iemand zoiets?

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 26 mei 2006, 11:35

Code: Selecteer alles

############################################################## 
## MOD Title: Raw Url Converter 
## MOD Version: 0.9 
## MOD Author: Dimah; choinka@web.de; Gerard Choinka 
## MOD Description: This mod converts raw urls of topics or forums to urls with the topic or forum titel. 
## 
## Installation Level: easy 
## Installation Time: 5 Minutes 
## Files To Edit: bbcode.php 
## Included Files: 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
############################################################## 
## This program is free software; you can redistribute it and/or modify 
## it under the terms of the GNU General Public License as published by 
## the Free Software Foundation; either version 2 of the License, or 
## (at your option) any later version. 
############################################################## 
## Fixed version by Bij
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################  

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/bbcode.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

function make_clickable($text) 
{ 

   // pad it with a space so we can match things at the start of the 1st line. 
   $ret = ' ' . $text; 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

function get_topic_titel($id) 
{ 
    global $db;    
    $sql = "SELECT topic_title FROM " . TOPICS_TABLE . " WHERE topic_id = '$id'"; 
    if ( !($result = $db->sql_query($sql)) ) 
    { 
        message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql); 
    } 
    $titel = $db->sql_fetchrow();  
    return $titel['topic_title']; 
} 

function get_forum_titel($id) 
{ 
    global $db;    
    $sql = "SELECT forum_name FROM " . FORUMS_TABLE . " WHERE forum_id = '$id'"; 
    if ( !($result = $db->sql_query($sql)) ) 
    { 
        message_die(GENERAL_ERROR, "Could not obtain newer/older Forum information", '', __LINE__, __FILE__, $sql); 
    } 
    $titel = $db->sql_fetchrow(); 
    return $titel['forum_name']; 
} 

function preg_replace_callback_func_raw_url_to_url_with_titel($subpattern) 
{ 
    $url = $subpattern[2].$subpattern[3].$subpattern[4].$subpattern[5]; 
    if($subpattern[3] == "viewtopic.php?t=") 
        $titel = get_topic_titel($subpattern[4]); 
    else 
        $titel = get_forum_titel($subpattern[4]); 
    return $subpattern[1]."<a href=\"".$url."\" target=\"_blank\">".$titel."</a>"; 
} 

function raw_url_to_url_with_titel($ret) 
{ 
    $phpbb_url = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/"; 

    $ret = preg_replace_callback 
    ( 
        "#(\s)(".$phpbb_url.")(viewtopic\.php\?t=|viewforum\.php\?f=)(\d+)(\S*)([^ \"\n\r\t<]*)#i", 
        'preg_replace_callback_func_raw_url_to_url_with_titel', 
        $ret 
    ); 
    return $ret; 
} 

# 
#-----[ FIND ]------------------------------------------ 
# 

function make_clickable($text) 
{ 

   // pad it with a space so we can match things at the start of the 1st line. 
   $ret = ' ' . $text; 
    
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

    $ret = raw_url_to_url_with_titel($ret); 
    
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
... Maar ik modereer (nog) niet.

Gesloten