root/trackback/files/lib/system/event/listener/ThreadPageTrackbackListener.class.php @ 135

Revision 135, 1.5 kB (checked in by d0nut, 5 years ago)

trackbacks can only be added to the first posting

  • Property svn:executable set to *
Line 
1<?php
2// WCF includes
3require_once(WCF_DIR.'lib/system/event/EventListener.class.php');
4
5// Utils
6require_once(WBB_DIR.'lib/util/TrackbackUtil.class.php');
7
8/**
9 * Loads the trackback data for the Threadpage
10 *
11 * @author      Torben Brodt
12 * @package     de.easy-coding.wbb.trackback
13 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html>
14 */
15class ThreadPageTrackbackListener implements EventListener {
16
17        /**
18         * @see EventListener::execute()
19         * @param ThreadPage $eventObj
20         */
21        public function execute($eventObj, $className, $eventName) {
22                $postTrackbacks = array();
23                $check = array_filter($eventObj->postList->posts, create_function('$a', 'return $a->hasTrackback;'));
24
25                if(count($check) > 0) {
26                        // foreign trackbacks
27                        $sql = "SELECT          title,
28                                                excerpt,
29                                                url,
30                                                blog_name
31                                FROM            wbb".WBB_N."_trackback
32                                WHERE           postID IN (".$eventObj->postList->postIDs."); ";
33
34                        $rows = WBBCore::getDB()->sendQuery($sql);
35                        while ($row = WBBCore::getDB()->fetchArray($rows)) {
36                                $postTrackbacks[$row['postID']] = $row;
37                        }
38                       
39                        // fetch data
40                        $row = TrackbackUtil::getPost($eventObj->postList->postIDs);
41                        WBBCore::getTPL()->assign(array(
42                                'postTrackbacks' => $postTrackbacks,
43                                'postPermalink'=> $row['url'],
44                                'postID'=> $row['firstPostID'],
45                                'postTopic'=> $row['topic'],
46                                'postPreview'=> $row['firstPostPreview'],
47                                'postUsername'=> $row['username'],
48                                'postTime'=> $row['time'],
49                               
50                        ));
51                       
52                        WBBCore::getTPL()->append('specialStyles', WBBCore::getTPL()->fetch('postTrackback'));
53                }
54        }
55}
56?>
Note: See TracBrowser for help on using the browser.