root/trackback/files/lib/util/TrackbackUtil.class.php @ 32

Revision 32, 2.1 kB (checked in by d0nut, 6 years ago)

updated trackback to 0.3.
new trackbacks are sent correctly, old trackbacks are not repeated.

Line 
1<?php
2// Utils
3require_once(WBB_DIR.'lib/util/Trackback.class.php');
4
5/**
6 * trackback util
7 *
8 * @author      Torben Brodt
9 * @package     de.easy-coding.wbb.trackback
10 * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 */
12class TrackbackUtil extends Trackback {
13
14        /**
15         * Produces XML response for trackbackers with ok/error message.
16         *
17         * @param boolean $success
18         * @param string $err_response
19         * @return boolean
20         */
21        public function receive($success = false, $err_response = ""){ 
22                return parent::recieve($cussess, $err_response);
23        }
24       
25        /**
26         * Sends a trackback ping to a specified trackback URL.
27         * allowing clients to auto-discover the TrackBack Ping URL.
28         *
29         * @param string $tb
30         * @param string $url
31         * @param string $title
32         * @param string $excerpt
33         * @return boolean
34         */
35        public function ping($tb, $url, $title = "", $excerpt = "") {
36                $target = parse_url($tb);
37                if(!array_key_exists('path', $target)) {
38                        $tb .= '/';
39                }
40               
41                @parent::ping($tb, $url, $title, $excerpt);
42        }
43       
44        /**
45         * @param postIDs
46         * @return array
47         */
48        public function getPost($postIDs) {
49                if(!is_array($postIDs))
50                        $postIDs = array($postIDs);
51       
52                // fetch thread data
53                $sql = "SELECT          thread.*
54                        FROM            wbb".WBB_N."_post post
55                        LEFT JOIN       wbb".WBB_N."_thread thread
56                        ON              (thread.threadID=post.threadID)
57                        WHERE           postID IN (".implode(',', $postIDs)."); ";
58
59                $row = WCF::getDB()->getFirstRow($sql);
60                               
61                // build thread url
62                if($row && defined('SEO_ENABLED') && SEO_ENABLED && defined('SEO_REWRITE_THREAD') && SEO_REWRITE_THREAD && file_exists(WCF_DIR.'lib/page/PublicSEORewriter.class.php')) {
63                        require_once(WCF_DIR.'lib/page/PublicSEORewriter.class.php');
64                        $rewriter = new PublicSEORewriter();
65                       
66                        // public seo rewriter: cache
67                        $rewriter->publicCacheThreads($row['threadID'], $row);
68                       
69                        // public seo rewriter use
70                        $row['url'] = $rewriter->publicParseThreadURLs($row['threadID'], '');
71                }
72                else if($row) {
73                        $row['url'] = sprintf('index.php?page=Thread&threadID=%d', $row['threadID']);
74                }
75               
76                return $row;
77        }
78} 
79
80?>
Note: See TracBrowser for help on using the browser.