Index: trunk/extensions/phpbbData/phpbbData.php |
— | — | @@ -49,11 +49,19 @@ |
50 | 50 | return true; |
51 | 51 | } |
52 | 52 | |
53 | | -function efPhpbbData_makeTopicWikiLink($display_text, $forum_id, $topic_id) { |
| 53 | +function efPhpbbData_makeTopicWikiLink($display_text='', $forum_id=null, $topic_id=null, $post_id=null) { |
54 | 54 | global $wgPhpbbDataRootPath; |
55 | 55 | |
56 | | - $urlText = "https://" . $_SERVER['SERVER_ADDR'] . |
57 | | - "/{$wgPhpbbDataRootPath}viewtopic.php?f={$forum_id}&t={$topic_id}"; |
| 56 | + if (!empty($post_id)) { |
| 57 | + $urlText = "https://" . $_SERVER['SERVER_ADDR'] . |
| 58 | + "/{$wgPhpbbDataRootPath}viewpost.php?p={$post_id}"; |
| 59 | + } elseif (!empty($topic_id)) { |
| 60 | + $urlText = "https://" . $_SERVER['SERVER_ADDR'] . |
| 61 | + "/{$wgPhpbbDataRootPath}viewtopic.php?t={$topic_id}"; |
| 62 | + } elseif (!empty($forum_id)) { |
| 63 | + $urlText = "https://" . $_SERVER['SERVER_ADDR'] . |
| 64 | + "/{$wgPhpbbDataRootPath}viewforum.php?t={$forum_id}"; |
| 65 | + } |
58 | 66 | |
59 | 67 | if ($display_text != '') |
60 | 68 | $display_text = ' ' . $display_text; |
— | — | @@ -63,27 +71,17 @@ |
64 | 72 | return "<span class='plainlinks'>[{$urlText}{$display_text}]</span>"; |
65 | 73 | } |
66 | 74 | |
67 | | -function efPhpbbData_RenderLink( &$parser, $linktype, $options='none', $text='') { |
68 | | - $optsTemp = explode(',', $options); |
69 | | - $opts = array(); |
| 75 | +function efPhpbbData_RenderLink( &$parser, $linktype, $id, $text='', $options = 'none') { |
70 | 76 | |
71 | | - foreach ($optsTemp as $opt) { |
72 | | - $optArr = explode('=',$opt); |
73 | | - if (isset($optArr[1])) { |
74 | | - $opts[$optArr[0]] = $optArr[1]; |
75 | | - } |
76 | | - } |
77 | | - |
78 | 77 | switch ($linktype) { |
79 | 78 | case 'topic': |
80 | | - if ( isset($opts['forum']) && isset($opts['topic'] ) ) { |
81 | | - $fid = intval($opts['forum']); |
82 | | - $tid = intval($opts['topic']); |
| 79 | + if ( isset($id) ) { |
| 80 | + $id = intval($id); |
83 | 81 | $text = htmlspecialchars($text); |
84 | 82 | |
85 | | - return efPhpbbData_makeTopicWikiLink($text, $fid, $tid); |
| 83 | + return efPhpbbData_makeTopicWikiLink($text, null, $id); |
86 | 84 | } else { |
87 | | - return "Bad options"; |
| 85 | + return "Bad ID"; |
88 | 86 | } |
89 | 87 | break; |
90 | 88 | default: |