public function pingback_ping($from_url, $to_url) { # Come on, buddy! Don't make me waste time with this kind of silliness... if (!(filter_var($from_url, FILTER_VALIDATE_URL) && preg_match('!^https?://!', $from_url))) { throw new Exception(__('No valid source URL provided? Try again!'), 0); } if (!(filter_var($to_url, FILTER_VALIDATE_URL) && preg_match('!^https?://!', $to_url))) { throw new Exception(__('No valid target URL provided? Try again!'), 0); } if (html::sanitizeURL(urldecode($from_url)) == html::sanitizeURL(urldecode($to_url))) { throw new Exception(__('LOL!'), 0); } # Time to get things done... $this->setBlog(true); $tb = new dcTrackback($this->core); return $tb->receive_pb($from_url, $to_url); }
# Check if post exists and is online $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : null; $post = null; $tb_excerpt = $tb_urls = ''; $auto_link = ''; $can_view_page = true; # Check if post exists if ($id !== null) { $params['post_id'] = $id; $params['post_status'] = 1; $post = $core->blog->getPosts($params); if ($post->isEmpty()) { $core->error->add(__('This entry does not exist or is not published')); $can_view_page = false; } else { $TB = new dcTrackback($core); $tb_excerpt = $post->post_excerpt_xhtml . ' ' . $post->post_content_xhtml; $post_title = $post->post_title; $post_url = $post->getURL(); } } else { $core->error->add(__('This entry does not exist.')); $can_view_page = false; } # Change excerpt if (!empty($_POST['tb_excerpt'])) { $tb_excerpt = $_POST['tb_excerpt']; } # Sanitize excerpt $tb_excerpt = html::clean($tb_excerpt); $tb_excerpt = html::decodeEntities($tb_excerpt);
public static function trackback($args) { if (!preg_match('/^[0-9]+$/', $args)) { # The specified trackback URL is not an number self::p404(); } else { $tb = new dcTrackback($GLOBALS['core']); $tb->receive($args); } }