Tante Google hat geholfen  
 
 
Code: Alles auswählen
   1. ##############################################################
   2. ## MOD Title: Raw Url Converter
   3. ## MOD Version: 0.9
   4. ## MOD Author: Dimah; Gerard Choinka
   5. ## MOD Description: This mod converts raw urls of topics or forums to urls with the topic or forum titel.
   6. ##
   7. ## Installation Level: easy
   8. ## Installation Time: 5 Minutes
   9. ## Files To Edit: bbcode.php
  10. ## Included Files:
  11. ##############################################################
  12. ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
  13. ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
  14. ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
  15. ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
  16. ##############################################################
  17. ## This program is free software; you can redistribute it and/or modify
  18. ## it under the terms of the GNU General Public License as published by
  19. ## the Free Software Foundation; either version 2 of the License, or
  20. ## (at your option) any later version.
  21. ##############################################################
  22. ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
  23. ############################################################## 
  24.
  25. #
  26. #-----[ OPEN ]------------------------------------------
  27. #
  28.
  29. includes/bbcode.php
  30.
  31. #
  32. #-----[ FIND ]------------------------------------------
  33. #
  34.
  35. if ( !defined('IN_PHPBB') )
  36. {
  37.    die("Hacking attempt");
  38. }
  39.
  40. #
  41. #-----[ AFTER, ADD ]------------------------------------------
  42. #
  43.
  44. include "./extension.inc";
  45. include "./config.".$phpEx;
  46. include "./includes/db.".$phpEx;
  47.
  48. #
  49. #-----[ FIND ]------------------------------------------
  50. #
  51.
  52. function make_clickable($text)
  53. {
  54.
  55.    // pad it with a space so we can match things at the start of the 1st line.
  56.    $ret = ' ' . $text;
  57.
  58. #
  59. #-----[ BEFORE, ADD ]------------------------------------------
  60. #
  61.
  62. function get_topic_titel($id)
  63. {
  64.     global $db;   
  65.     $sql = "SELECT topic_title FROM " . TOPICS_TABLE . " WHERE topic_id = '$id'";
  66.     if ( !($result = $db->sql_query($sql)) )
  67.     {
  68.         message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql);
  69.     }
  70.     $titel = $db->sql_fetchrow(); 
  71.     return $titel['topic_title'];
  72. }
  73.
  74. function get_forum_titel($id)
  75. {
  76.     global $db;   
  77.     $sql = "SELECT forum_name FROM " . FORUMS_TABLE . " WHERE forum_id = '$id'";
  78.     if ( !($result = $db->sql_query($sql)) )
  79.     {
  80.         message_die(GENERAL_ERROR, "Could not obtain newer/older Forum information", '', __LINE__, __FILE__, $sql);
  81.     }
  82.     $titel = $db->sql_fetchrow();
  83.     return $titel['forum_name'];
  84. }
  85.
  86. function preg_replace_callback_func_raw_url_to_url_with_titel($subpattern)
  87. {
  88.     $url = $subpattern[2].$subpattern[3].$subpattern[4].$subpattern[5];
  89.     if($subpattern[3] == "viewtopic.php?t=")
  90.         $titel = get_topic_titel($subpattern[4]);
  91.     else
  92.         $titel = get_forum_titel($subpattern[4]);
  93.     return $subpattern[1]."<a href=\"".$url."\" target=\"_blank\">".$titel."</a>";
  94. }
  95.
  96. function raw_url_to_url_with_titel($ret)
  97. {
  98.     $phpbb_url = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/";
  99.
 100.     $ret = preg_replace_callback
 101.     (
 102.         "#(\s)(".$phpbb_url.")(viewtopic\.php\?t=|viewforum\.php\?f=)(\d+)(\S*)([^ \"\n\r\t<]*)#i",
 103.         'preg_replace_callback_func_raw_url_to_url_with_titel',
 104.         $ret
 105.     );
 106.     return $ret;
 107. }
 108.
 109. #
 110. #-----[ FIND ]------------------------------------------
 111. #
 112.
 113. function make_clickable($text)
 114. {
 115.
 116.    // pad it with a space so we can match things at the start of the 1st line.
 117.    $ret = ' ' . $text;
 118.    
 119. #
 120. #-----[ AFTER, ADD ]------------------------------------------
 121. #
 122.
 123.     $ret = raw_url_to_url_with_titel($ret);
 124.    
 125. #
 126. #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
 127. #
 128. # EoM
Wobei noch geschrieben wurde dass man
Code: Alles auswählen
32. #-----[ FIND ]------------------------------------------
  33. #
  34.
  35. if ( !defined('IN_PHPBB') )
  36. {
  37.    die("Hacking attempt");
  38. }
  39.
  40. #
  41. #-----[ AFTER, ADD ]------------------------------------------
  42. #
  43.
  44. include "./extension.inc";
  45. include "./config.".$phpEx;
  46. include "./includes/db.".$phpEx;
  47.
weglassen soll da die bbcode.php bereits includiert wird!
Ein Bugfix; 
http://www.amigalink.de/phpbb2/viewtopic.php?t=226