Changeset 141 for trackback/files/lib/util/TrackbackUtil.class.php
- Timestamp:
- 12/25/07 18:07:52 (5 years ago)
- Files:
-
- 1 modified
-
trackback/files/lib/util/TrackbackUtil.class.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trackback/files/lib/util/TrackbackUtil.class.php
r138 r141 1 1 <?php 2 2 // import seorewriter 3 require_once(WCF_DIR.'lib/util/StringUtil.class.php'); 3 4 require_once(WCF_DIR.'lib/page/PublicSEORewriter.class.php'); 4 5 require_once(WCF_DIR.'lib/util/FileUtil.class.php'); … … 12 13 */ 13 14 class TrackbackUtil { 14 p rotected static $agent = 'Woltlab Burning BoardTrackback Mod';15 public static $agent = 'WBB Trackback Mod'; 15 16 protected static $timeout_bytes = 51200; 16 17 … … 39 40 40 41 // public seo rewriter use 41 $row['url'] = $rewriter->publicParseThreadURLs($row['threadID'], '');42 $row['url'] = StringUtil::decodeHTML(FileUtil::addTrailingSlash(PAGE_URL).$rewriter->publicParseThreadURLs($row['threadID'], '')); 42 43 43 44 return $row; … … 54 55 */ 55 56 public static function getRDF($postPermalink, $postID, $postTopic, $postPreview, $postUsername, $postTime) { 56 $postPermalink = html_entity_decode($postPermalink);57 $postPermalink = StringUtil::decodeHTML($postPermalink); 57 58 $page_url = FileUtil::addTrailingSlash(PAGE_URL); 58 59 return '<link rel="pingback" href="'.$page_url.'index.php?action=Pingback" /> … … 133 134 // send pingbacks 134 135 foreach($pingbacks as $pingbackurl) { 135 self::send_pingback($alienurl, $pingbackurl, $page_title, $url); 136 self::save_log($postID, $alienurl); 136 if(self::send_pingback($alienurl, $pingbackurl, $url)) { 137 self::save_log($postID, $alienurl); 138 } 137 139 } 138 140 139 141 // send trackbacks 140 142 foreach($trackbacks as $trackbackurl) { 141 self::send_trackback($trackbackurl, $page_title, $author, $url, $title, $excerpt); 142 self::save_log($postID, $alienurl); 143 if(self::send_trackback($trackbackurl, $page_title, $author, $url, $title, $excerpt)) { 144 self::save_log($postID, $alienurl); 145 } 143 146 } 144 147 } … … 247 250 } 248 251 $byte_count += strlen($line); 249 if ( $byte_count > $timeout_bytes ) {252 if ( $byte_count > self::$timeout_bytes ) { 250 253 // It's no use going further, there probably isn't any pingback 251 254 // server to find in this file. (Prevents loading large files.) … … 293 296 * @param pingbackurl -> the pingback url from the destination site 294 297 * @param url -> the own url 298 * @return true if success 295 299 */ 296 300 protected static function send_pingback($alienurl, $pingbackurl, $url) { 297 301 require_once(WBB_DIR.'lib/util/IXR.class.php'); 302 extract(parse_url($pingbackurl), EXTR_SKIP); 303 304 if ( !isset($host) ) // Not an URL. This should never happen. 305 return false; 306 307 $path = ( !isset($path) ) ? '/' : $path; 308 $path .= ( isset($query) ) ? '?' . $query : ''; 309 $port = ( isset($port) ) ? $port : 80; 298 310 299 311 // using a timeout of 3 seconds should be enough to cover slow servers 300 $client = new IXR_Client($ pingbackurl);312 $client = new IXR_Client($host, $path); 301 313 $client->timeout = 3; 302 314 $client->useragent = self::$agent; … … 306 318 307 319 // Already registered 308 if ($client->query('pingback.ping', $url, $alienurl) || (isset($client->error->code) && 48 == $client->error->code)) { 309 add_ping($post_ID, $alienurl); 310 } 320 return $client->query('pingback.ping', $url, $alienurl) || (isset($client->error->code) && 48 == $client->error->code); 311 321 } 312 322 … … 340 350 @fputs($fs, $http_request); 341 351 @fclose($fs); 352 353 return $fs; 342 354 } 343 355
