public function trackback() { require_once 'class.mt_trackback.php'; $trackback = new Trackback(); $loaded = $trackback->Load("trackback_category_id = " . $this->category_id); if (!$loaded) { $trackback = null; } return $trackback; }
/** * @see TrackbackAdapter::receive() */ public function ping($objectID, $trackbackURL) { require_once WCF_DIR . 'lib/data/contest/ViewableContest.class.php'; $entry = new ViewableContest($objectID); if (!$entry->contestID) { throw new IllegalLinkException(); } $trackback = new Trackback('easy coding contest', $entry->getOwner()->getName()); $trackback->ping($trackbackURL, PAGE_URL . '/index.php?page=Contest&contestID=' . $objectID, $entry->subject, $entry->getExcerpt()); }
public function trackback() { $col_name = "tbping_tb_id"; ${$tb} = null; if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) { $tb_id = $this->{$col_name}; require_once 'class.mt_trackback.php'; $tb = new Trackback(); $tb->Load("trackback_id = {$tb_id}"); } return $tb; }
/** * @EventListener::execute() */ public function execute($eventObj, $className, $eventName) { // read the trackbacks $this->readTrackbacks($eventObj); // absolute url $permalink = PAGE_URL . '/index.php?page=Contest&contestID=' . $eventObj->contestID; $socialBookmarks = null; if (MODULE_SOCIAL_BOOKMARK) { $socialBookmarks = SocialBookmarks::getInstance()->getSocialBookmarks($permalink, $eventObj->entry->subject); } // assign data to template WCF::getTPL()->assign(array('trackback' => $this->trackback, 'trackbacks' => $this->trackbacks, 'socialBookmarks' => $socialBookmarks)); $objectPackageID = WCF::getPackageID('de.easy-coding.wcf.contest.socialBookmarks'); // get rdf code if ($this->trackback) { $tmp = $this->trackback->getRdfAutoDiscover($eventObj->entry->subject, $permalink, $eventObj->contestID, 'contestEntry', $objectPackageID); WCF::getTPL()->append('additionalContent3', $tmp); } WCF::getTPL()->append('additionalContent3', WCF::getTPL()->fetch('contestTrackbacks')); WCF::getTPL()->append('additionalButtonBar', WCF::getTPL()->fetch('contestSocialBookmarks')); }
function pingback_ping($args) { global $db, $globals; $pagelinkedfrom = clean_input_string($args[0]); //$pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); $pagelinkedto = clean_input_string($args[1]); $title = ''; $urlfrom = parse_url($pagelinkedfrom); $urltest = parse_url($pagelinkedto); if (!$urlfrom || !$urltest) { return new IXR_Error(0, 'Is there no link to us?'); } if ($urltest['host'] != get_server_name()) { return new IXR_Error(0, 'Is there no link to us?'); } $base_uri = preg_quote($globals['base_url'] . $globals['base_story_url'], '/'); $uri = preg_replace("/^{$base_uri}/", '', $urltest[path]); if (check_ban($globals['user_ip'], 'ip')) { syslog(LOG_NOTICE, "Meneame: pingback, IP is banned ({$globals['user_ip']}): {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(33, 'IP is banned.'); } // Antispam of sites like xxx.yyy-zzz.info/archives/xxx.php if (preg_match('/http:\\/\\/[a-z0-9]\\.[a-z0-9]+-[^\\/]+\\.info\\/archives\\/.+\\.php$/', $pagelinkedfrom)) { return new IXR_Error(33, 'Host not allowed.'); } if (check_ban($urlfrom[host], 'hostname', false)) { syslog(LOG_NOTICE, "Meneame: pingback, site is banned: {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(33, 'Site is banned.'); } $link = new Link(); $link->uri = preg_replace('/#[\\w\\-\\_]+$/', '', $uri); if (empty($uri) || !$link->read('uri')) { syslog(LOG_NOTICE, "Meneame: pingback, story does not exist: {$pagelinkedto}"); return new IXR_Error(33, 'Story doesn\'t exist.'); } if ($link->get_permalink() == $pagelinkedfrom) { syslog(LOG_NOTICE, "Meneame: pingback, points to the same post: {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(48, 'The pingback points to the same post.'); } if ($link->date < time() - 86400 * 15) { syslog(LOG_NOTICE, "Meneame: pingback, story is too old: {$pagelinkedto}"); return new IXR_Error(33, 'Story is too old for pingbacks.'); } $trackres = new Trackback(); $trackres->link_id = $link->id; $trackres->type = 'in'; $trackres->link = $pagelinkedfrom; $trackres->url = $pagelinkedfrom; if ($trackres->abuse()) { return new IXR_Error(33, 'Don\'t send so many pings.'); } $dupe = $trackres->read(); if ($dupe) { syslog(LOG_NOTICE, "Meneame: pingback, we already have a ping from that URI for this post: {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(48, 'The pingback has already been registered.'); } // very stupid, but gives time to the 'from' server to publish ! sleep(1); // Let's check the remote site if (version_compare(phpversion(), '5.1.0') >= 0) { $contents = @file_get_contents($pagelinkedfrom, FALSE, NULL, 0, 100000); } else { $contents = @file_get_contents($pagelinkedfrom); } if (!$contents) { syslog(LOG_NOTICE, "Meneame: pingback, the provided URL does not seem to work: {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(16, 'The source URL does not exist.'); } if (preg_match('/charset=([a-zA-Z0-9-_]+)/i', $contents, $matches)) { $this->encoding = trim($matches[1]); if (strcasecmp($this->encoding, 'utf-8') != 0) { $contents = iconv($this->encoding, 'UTF-8//IGNORE', $contents); } } // Check is links back to us $permalink = $link->get_permalink(); $permalink_q = preg_quote($permalink, '/'); $pattern = "/<\\s*a[^>]+href=[\"']" . $permalink_q . "[#\\/0-9a-z\\-]*[\"'][^>]*>/i"; if (!preg_match($pattern, $contents)) { syslog(LOG_NOTICE, "Meneame: pingback, the provided URL does not have a link back to us: {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.'); } // Search Title if (preg_match('/<title[^<>]*>([^<>]*)<\\/title>/si', $contents, $matches)) { $url_title = clean_text($matches[1]); if (mb_strlen($url_title) > 3) { $title = $url_title; } } if (empty($title)) { syslog(LOG_NOTICE, "Meneame: pingback, cannot find a title on that page: {$pagelinkedfrom} - {$pagelinkedto}"); return new IXR_Error(32, 'We cannot find a title on that page.'); } $title = mb_strlen($title) > 120 ? mb_substr($title, 0, 120) . '...' : $title; $trackres->title = $title; $trackres->status = 'ok'; $trackres->store(); syslog(LOG_NOTICE, "Meneame: pingback ok: {$pagelinkedfrom} - {$pagelinkedto}"); return "Pingback from registered. Keep the web talking! :-)"; }
function do_trackbacks() { global $db, $globals; echo '<div id="trackback">'; echo '<h2><a href="' . get_trackback($globals['link_id']) . '" title="' . _('URI para trackbacks') . '">trackbacks</a></h2>'; $id = $globals['link_id']; $trackbacks = $db->get_col("SELECT trackback_id FROM trackbacks WHERE trackback_link_id={$id} AND trackback_type='in' ORDER BY trackback_date DESC"); echo '<ul>'; if ($trackbacks) { require_once mnminclude . 'trackback.php'; $trackback = new Trackback(); foreach ($trackbacks as $trackback_id) { $trackback->id = $trackback_id; $trackback->read(); echo '<li><a href="' . $trackback->url . '" title="' . $trackback->content . '">' . $trackback->title . '</a></li>'; } } else { echo '<li>' . _('(sin trackbacks)') . '</li>'; } echo '<li><img src="img/favicons/technorati.png" alt="' . _('enlaces technorati') . '" width="16" height="16"/> <a href="http://technorati.com/search/' . urlencode(get_permalink($globals['link_id'])) . '">' . _('según Technorati') . '</a></li>'; echo "</ul>\n"; echo '</div><!--html1:do_trackbacks-->'; }
function do_submit3() { global $db, $current_user; $linkres=new Link; $linkres->id=$link_id = intval($_POST['id']); $linkres->read(); // Check it is not in the queue already if($linkres->votes == 0 && $linkres->status != 'queued') { $linkres->status='queued'; $linkres->date=time(); $linkres->store_basic(); $linkres->insert_vote($current_user->user_id); $db->query("delete from links where link_author = $linkres->author and link_status='discard' and link_votes=0"); if(!empty($_POST['trackback'])) { require_once(mnminclude.'trackback.php'); $trackres = new Trackback; $trackres->url=preg_replace('/ /', '+', trim($_POST['trackback'])); $trackres->link=$linkres->id; $trackres->title=$linkres->title; $trackres->author=$linkres->author; $trackres->content=$linkres->content; $res = $trackres->send(); } } header("Location: ./shakeit.php"); die; }
/** ----------------------------------- /** Parse Forms that Cannot Be Cached /** -----------------------------------*/ function parse_nocache($str) { global $FNS; if (!stristr($str, '{NOCACHE')) { return $str; } /** ----------------------------------- /** Generate Comment Form if needed /** -----------------------------------*/ // In order for the comment form not to cache the "save info" // data we need to generate dynamically if necessary if (preg_match_all("#{NOCACHE_(\\S+)_FORM=\"(.*?)\"}(.+?){/NOCACHE_FORM}#s", $str, $match)) { for ($i = 0, $s = sizeof($match['0']); $i < $s; $i++) { $class = $FNS->filename_security(strtolower($match['1'][$i])); if (!class_exists($class)) { require PATH_MOD . $class . '/mod.' . $class . EXT; } $this->tagdata = $match['3'][$i]; $vars = $FNS->assign_variables($match['3'][$i], '/'); $this->var_single = $vars['var_single']; $this->var_pair = $vars['var_pair']; $this->tagparams = $FNS->assign_parameters($match['2'][$i]); $this->var_cond = $FNS->assign_conditional_variables($match['3'][$i], '/', LD, RD); // Assign sites for the tag $this->_fetch_site_ids(); if ($class == 'gallery') { $str = str_replace($match['0'][$i], Gallery::comment_form(TRUE, $FNS->cached_captcha), $str); } elseif ($class == 'comment') { $str = str_replace($match['0'][$i], Comment::form(TRUE, $FNS->cached_captcha), $str); } $str = str_replace('{PREVIEW_TEMPLATE}', $match['2'][$i], $str); } } /** ----------------------------------- /** Generate Stand-alone Publish form /** -----------------------------------*/ if (preg_match_all("#{{NOCACHE_WEBLOG_FORM(.*?)}}(.+?){{/NOCACHE_FORM}}#s", $str, $match)) { for ($i = 0, $s = sizeof($match['0']); $i < $s; $i++) { if (!class_exists('Weblog')) { require PATH_MOD . 'weblog/mod.weblog' . EXT; } $this->tagdata = $match['2'][$i]; $vars = $FNS->assign_variables($match['2'][$i], '/'); $this->var_single = $vars['var_single']; $this->var_pair = $vars['var_pair']; $this->tagparams = $FNS->assign_parameters($match['1'][$i]); // Assign sites for the tag $this->_fetch_site_ids(); $XX = new Weblog(); $str = str_replace($match['0'][$i], $XX->entry_form(TRUE, $FNS->cached_captcha), $str); $str = str_replace('{PREVIEW_TEMPLATE}', isset($_POST['PRV']) ? $_POST['PRV'] : $this->fetch_param('preview'), $str); } } /** ----------------------------------- /** Generate Trackback hash if needed /** -----------------------------------*/ if (preg_match("#{NOCACHE_TRACKBACK_HASH}#s", $str, $match)) { if (!class_exists('Trackback')) { require PATH_MOD . 'trackback/mod.trackback' . EXT; } $str = str_replace($match['0'], Trackback::url(TRUE, $FNS->random('alpha', 8)), $str); } return $str; }
function importer($path, $node, $line) { global $blogid, $migrational, $items, $item; switch ($path) { case '/blog/setting': setProgress($item++ / $items * 100, _t('블로그 설정을 복원하고 있습니다.')); $setting = new BlogSetting(); if (isset($node['title'][0]['.value'])) { $setting->title = $node['title'][0]['.value']; } if (isset($node['description'][0]['.value'])) { $setting->description = $node['description'][0]['.value']; } if (isset($node['banner'][0]['name'][0]['.value'])) { $setting->banner = $node['banner'][0]['name'][0]['.value']; } if (isset($node['useSloganOnPost'][0]['.value'])) { $setting->useSloganOnPost = $node['useSloganOnPost'][0]['.value']; } if (isset($node['postsOnPage'][0]['.value'])) { $setting->postsOnPage = $node['postsOnPage'][0]['.value']; } if (isset($node['postsOnList'][0]['.value'])) { $setting->postsOnList = $node['postsOnList'][0]['.value']; } if (isset($node['postsOnFeed'][0]['.value'])) { $setting->postsOnFeed = $node['postsOnFeed'][0]['.value']; } if (isset($node['publishWholeOnFeed'][0]['.value'])) { $setting->publishWholeOnFeed = $node['publishWholeOnFeed'][0]['.value']; } if (isset($node['acceptGuestComment'][0]['.value'])) { $setting->acceptGuestComment = $node['acceptGuestComment'][0]['.value']; } if (isset($node['acceptcommentOnGuestComment'][0]['.value'])) { $setting->acceptcommentOnGuestComment = $node['acceptcommentOnGuestComment'][0]['.value']; } if (isset($node['language'][0]['.value'])) { $setting->language = $node['language'][0]['.value']; } if (isset($node['timezone'][0]['.value'])) { $setting->timezone = $node['timezone'][0]['.value']; } if (!$setting->save()) { user_error(__LINE__ . $setting->error); } if (!empty($setting->banner) && !empty($node['banner'][0]['content'][0]['.stream'])) { Attachment::confirmFolder(); Utils_Base64Stream::decode($node['banner'][0]['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $setting->banner)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $setting->banner)); fclose($node['banner'][0]['content'][0]['.stream']); unset($node['banner'][0]['content'][0]['.stream']); } return true; case '/blog/category': setProgress($item++ / $items * 100, _t('분류를 복원하고 있습니다.')); $category = new Category(); $category->name = $node['name'][0]['.value']; $category->priority = $node['priority'][0]['.value']; if (isset($node['root'][0]['.value'])) { $category->id = 0; } if (!$category->add()) { user_error(__LINE__ . $category->error); } if (isset($node['category'])) { for ($i = 0; $i < count($node['category']); $i++) { $childCategory = new Category(); $childCategory->parent = $category->id; $cursor =& $node['category'][$i]; $childCategory->name = $cursor['name'][0]['.value']; $childCategory->priority = $cursor['priority'][0]['.value']; if (!$childCategory->add()) { user_error(__LINE__ . $childCategory->error); } } } return true; case '/blog/post': setProgress($item++ / $items * 100, _t('글을 복원하고 있습니다.')); $post = new Post(); $post->id = $node['id'][0]['.value']; $post->slogan = @$node['.attributes']['slogan']; $post->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $post->starred = $node['starred'][0]['.value']; } else { $post->starred = 0; } $post->title = $node['title'][0]['.value']; $post->content = $node['content'][0]['.value']; $post->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : 'ttml'; $post->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : 'modern'; $post->location = $node['location'][0]['.value']; $post->password = isset($node['password'][0]['.value']) ? $node['password'][0]['.value'] : null; $post->acceptcomment = $node['acceptComment'][0]['.value']; $post->accepttrackback = $node['acceptTrackback'][0]['.value']; $post->published = $node['published'][0]['.value']; if (isset($node['longitude'][0]['.value'])) { $post->longitude = $node['longitude'][0]['.value']; } if (isset($node['latitude'][0]['.value'])) { $post->latitude = $node['latitude'][0]['.value']; } $post->created = @$node['created'][0]['.value']; $post->modified = @$node['modified'][0]['.value']; if ($post->visibility == 'private' && intval($post->published) > $_SERVER['REQUEST_TIME'] || !empty($node['appointed'][0]['.value']) && $node['appointed'][0]['.value'] == 'true') { // for compatibility of appointed entries $post->visibility = 'appointed'; } if ($post->slogan == '') { $post->slogan = 'Untitled' . $post->id; } if (!empty($node['category'][0]['.value'])) { $post->category = Category::getId($node['category'][0]['.value']); } if (isset($node['tag'])) { $post->tags = array(); for ($i = 0; $i < count($node['tag']); $i++) { if (!empty($node['tag'][$i]['.value'])) { array_push($post->tags, $node['tag'][$i]['.value']); } } } if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $post->content = nl2brWithHTML($post->content); } if (!$post->add()) { user_error(__LINE__ . $post->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $post->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } else { if ($cursor['name'][0]['.value'] != $attachment->name) { $post2 = new Post(); if ($post2->open($post->id, 'id, content')) { $post2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $post2->content); $post2->loadTags(); $post2->update(); $post2->close(); } unset($post2); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } if (isset($node['comment'])) { for ($i = 0; $i < count($node['comment']); $i++) { $comment = new Comment(); $comment->entry = $post->id; $cursor =& $node['comment'][$i]; $comment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['id'][0]['.value'])) { $comment->id = $cursor['id'][0]['.value']; } if (!empty($cursor['commenter'][0]['.attributes']['id'])) { $comment->commenter = $cursor['commenter'][0]['.attributes']['id']; } if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) { $comment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; } if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) { $comment->ip = $cursor['commenter'][0]['ip'][0]['.value']; } if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) { $comment->openid = $cursor['commenter'][0]['openid'][0]['.value']; } $comment->password = $cursor['password'][0]['.value']; $comment->secret = $cursor['secret'][0]['.value']; $comment->written = $cursor['written'][0]['.value']; if (isset($cursor['longitude'][0]['.value'])) { $comment->longitude = $cursor['longitude'][0]['.value']; } if (isset($cursor['latitude'][0]['.value'])) { $comment->latitude = $cursor['latitude'][0]['.value']; } $comment->content = $cursor['content'][0]['.value']; if (!empty($cursor['isFiltered'][0]['.value'])) { $comment->isfiltered = $cursor['isFiltered'][0]['.value']; } if (!$comment->add()) { user_error(__LINE__ . $comment->error); } if (isset($node['comment'][$i]['comment'])) { for ($j = 0; $j < count($node['comment'][$i]['comment']); $j++) { $childComment = new Comment(); $childComment->entry = $post->id; $childComment->parent = $comment->id; $cursor =& $node['comment'][$i]['comment'][$j]; if (!empty($cursor['id'][0]['.value'])) { $childComment->id = $cursor['id'][0]['.value']; } if (!empty($cursor['commenter'][0]['.attributes']['id'])) { $childComment->commenter = $cursor['commenter'][0]['.attributes']['id']; } $childComment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) { $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; } if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) { $childComment->ip = $cursor['commenter'][0]['ip'][0]['.value']; } if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) { $childComment->openid = $cursor['commenter'][0]['openid'][0]['.value']; } $childComment->password = $cursor['password'][0]['.value']; $childComment->secret = $cursor['secret'][0]['.value']; $childComment->written = $cursor['written'][0]['.value']; if (isset($cursor['longitude'][0]['.value'])) { $comment->longitude = $cursor['longitude'][0]['.value']; } if (isset($cursor['latitude'][0]['.value'])) { $comment->latitude = $cursor['latitude'][0]['.value']; } $childComment->content = $cursor['content'][0]['.value']; if (!empty($cursor['isFiltered'][0]['.value'])) { $childComment->isfiltered = $cursor['isFiltered'][0]['.value']; } if (!$childComment->add()) { user_error(__LINE__ . $childComment->error); } } } } } if (isset($node['trackback'])) { for ($i = 0; $i < count($node['trackback']); $i++) { $trackback = new Trackback(); $trackback->entry = $post->id; $cursor =& $node['trackback'][$i]; $trackback->url = $cursor['url'][0]['.value']; $trackback->site = $cursor['site'][0]['.value']; $trackback->title = $cursor['title'][0]['.value']; $trackback->excerpt = @$cursor['excerpt'][0]['.value']; if (!empty($cursor['ip'][0]['.value'])) { $trackback->ip = $cursor['ip'][0]['.value']; } if (!empty($cursor['received'][0]['.value'])) { $trackback->received = $cursor['received'][0]['.value']; } if (!empty($cursor['isFiltered'][0]['.value'])) { $trackback->isFiltered = $cursor['isFiltered'][0]['.value']; } if (!$trackback->add()) { user_error(__LINE__ . $trackback->error); } } } if (isset($node['logs'][0]['trackback'])) { for ($i = 0; $i < count($node['logs'][0]['trackback']); $i++) { $log = new TrackbackLog(); $log->entry = $post->id; $cursor =& $node['logs'][0]['trackback'][$i]; $log->url = $cursor['url'][0]['.value']; if (!empty($cursor['sent'][0]['.value'])) { $log->sent = $cursor['sent'][0]['.value']; } if (!$log->add()) { user_error(__LINE__ . $log->error); } } } return true; case '/blog/page': setProgress($item++ / $items * 100, _t('페이지를 복원하고 있습니다.')); $page = new Page(); $page->id = $node['id'][0]['.value']; $page->slogan = @$node['.attributes']['slogan']; $page->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $page->starred = $node['starred'][0]['.value']; } else { $page->starred = 0; } $page->title = $node['title'][0]['.value']; $page->content = $node['content'][0]['.value']; $page->contentformatter = isset($node['content']['.attributes']['formatter']) ? $node['content']['.attributes']['formatter'] : getDefaultFormatter(); $page->contenteditor = isset($node['content']['.attributes']['editor']) ? $node['content']['.attributes']['editor'] : getDefaultEditor(); $page->published = $node['published'][0]['.value']; $page->created = @$node['created'][0]['.value']; $page->modified = @$node['modified'][0]['.value']; if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $page->content = nl2brWithHTML($page->content); } if (!$page->add()) { user_error(__LINE__ . $page->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $page->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (Attachment::doesExist($attachment->name)) { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } $page2 = new Page(); if ($page2->open($page->id, 'id, content')) { $page2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $page2->content); $page2->update(); $page2->close(); } unset($page2); } else { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } return true; case '/blog/notice': setProgress($item++ / $items * 100, _t('공지를 복원하고 있습니다.')); $notice = new Notice(); $notice->id = $node['id'][0]['.value']; $notice->slogan = @$node['.attributes']['slogan']; $notice->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $notice->starred = $node['starred'][0]['.value']; } else { $notice->starred = 0; } $notice->title = $node['title'][0]['.value']; $notice->content = $node['content'][0]['.value']; $notice->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : getDefaultFormatter(); $notice->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : getDefaultEditor(); $notice->published = intval($node['published'][0]['.value']); $notice->created = @$node['created'][0]['.value']; $notice->modified = @$node['modified'][0]['.value']; if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $notice->content = nl2brWithHTML($notice->content); } if (!$notice->add()) { user_error(__LINE__ . $notice->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $notice->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (Attachment::doesExist($attachment->name)) { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } $notice2 = new Notice(); if ($notice2->open($notice->id, 'id, content')) { $notice2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $notice2->content); $notice2->update(); $notice2->close(); } unset($notice2); } else { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } return true; case '/blog/keyword': setProgress($item++ / $items * 100, _t('키워드를 복원하고 있습니다.')); $keyword = new Keyword(); $keyword->id = $node['id'][0]['.value']; $keyword->visibility = $node['visibility'][0]['.value']; if (isset($node['starred'][0]['.value'])) { $keyword->starred = $node['starred'][0]['.value']; } else { $keyword->starred = 0; } $keyword->name = $node['name'][0]['.value']; $keyword->description = $node['description'][0]['.value']; $keyword->descriptionEditor = isset($node['description'][0]['.attributes']['editor']) ? $node['description'][0]['.attributes']['editor'] : getDefaultEditor(); $keyword->descriptionFormatter = isset($node['description'][0]['.attributes']['formatter']) ? $node['description'][0]['.attributes']['formatter'] : getDefaultFormatter(); $keyword->published = intval($node['published'][0]['.value']); $keyword->created = @$node['created'][0]['.value']; $keyword->modified = @$node['modified'][0]['.value']; if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) { $keyword->description = nl2brWithHTML($keyword->description); } if (!$keyword->add()) { user_error(__LINE__ . $keyword->error); } if (isset($node['attachment'])) { for ($i = 0; $i < count($node['attachment']); $i++) { $attachment = new Attachment(); $attachment->parent = $keyword->id; $cursor =& $node['attachment'][$i]; $attachment->name = $cursor['name'][0]['.value']; $attachment->label = $cursor['label'][0]['.value']; $attachment->mime = @$cursor['.attributes']['mime']; $attachment->size = $cursor['.attributes']['size']; $attachment->width = $cursor['.attributes']['width']; $attachment->height = $cursor['.attributes']['height']; $attachment->enclosure = @$cursor['enclosure'][0]['.value']; $attachment->attached = $cursor['attached'][0]['.value']; $attachment->downloads = @$cursor['downloads'][0]['.value']; if (Attachment::doesExist($attachment->name)) { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } $keyword2 = new Keyword(); if ($keyword2->open($keyword->id, 'id, content')) { $keyword2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $keyword2->content); $keyword2->update(); $keyword2->close(); } unset($keyword2); } else { if (!$attachment->add()) { user_error(__LINE__ . $attachment->error); } } if (!empty($cursor['content'][0]['.stream'])) { Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name)); Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name)); fclose($cursor['content'][0]['.stream']); unset($cursor['content'][0]['.stream']); } } } return true; case '/blog/linkCategories': setProgress($item++ / $items * 100, _t('링크 카테고리를 복원하고 있습니다.')); $linkCategory = new LinkCategories(); $linkCategory->name = $node['name'][0]['.value']; $linkCategory->priority = $node['priority'][0]['.value']; $linkCategory->visibility = !isset($node['visibility'][0]['.value']) || empty($node['visibility'][0]['.value']) ? 2 : $node['visibility'][0]['.value']; $linkCategory->id = LinkCategories::getId($linkCategory->name); if ($linkCategory->id) { if (!$linkCategory->update()) { user_error(__LINE__ . $linkCategory->error); } } else { if (!$linkCategory->add()) { user_error(__LINE__ . $linkCategory->error); } } return true; case '/blog/link': setProgress($item++ / $items * 100, _t('링크를 복원하고 있습니다.')); $link = new Link(); $link->category = empty($node['category'][0]['.value']) ? 0 : $node['category'][0]['.value']; $link->url = $node['url'][0]['.value']; $link->title = $node['title'][0]['.value']; if (!empty($node['feed'][0]['.value'])) { $link->feed = $node['feed'][0]['.value']; } if (!empty($node['registered'][0]['.value'])) { $link->registered = $node['registered'][0]['.value']; } if (!empty($node['xfn'][0]['.value'])) { $link->xfn = $node['xfn'][0]['.value']; } $link->id = Link::getId($link->url); if ($link->id) { if (!$link->update()) { user_error(__LINE__ . $link->error); } } else { if (!$link->add()) { user_error(__LINE__ . $link->error); } } return true; case '/blog/logs/referer': setProgress($item++ / $items * 100, _t('리퍼러 로그를 복원하고 있습니다.')); $log = new RefererLog(); if (isset($node['path'][0]['.value'])) { $log->url = $node['path'][0]['.value']; } else { $log->url = $node['url'][0]['.value']; } $log->referred = $node['referred'][0]['.value']; if (!$log->add(false)) { user_error(__LINE__ . $log->error); } return true; case '/blog/commentsNotified/comment': setProgress($item++ / $items * 100, _t('댓글 알리미 내용을 복원하고 있습니다.')); $cmtNotified = new CommentNotified(); $cmtNotified->id = $node['id'][0]['.value']; $cursor =& $node['commenter'][0]; $cmtNotified->name = $cursor['name'][0]['.value']; $cmtNotified->homepage = $cursor['homepage'][0]['.value']; $cmtNotified->ip = $cursor['ip'][0]['.value']; $cmtNotified->entry = $node['entry'][0]['.value']; $cmtNotified->password = $node['password'][0]['.value']; $cmtNotified->content = $node['content'][0]['.value']; $cmtNotified->parent = $node['parent'][0]['.value']; $cmtNotified->secret = $node['secret'][0]['.value']; $cmtNotified->written = $node['written'][0]['.value']; $cmtNotified->modified = $node['modified'][0]['.value']; $cmtNotified->url = $node['url'][0]['.value']; $cmtNotified->isnew = $node['isNew'][0]['.value']; $site = new CommentNotifiedSiteInfo(); if (!$site->open("url = '{$node['site'][0]['.value']}'")) { $site->title = ''; $site->name = ''; $site->modified = 31536000; $site->url = $node['site'][0]['.value']; $site->add(); } $cmtNotified->siteid = $site->id; $site->close(); $cmtNotified->remoteid = $node['remoteId'][0]['.value']; $cmtNotified->entrytitle = !isset($node['entryTitle'][0]['.value']) || empty($node['entryTitle'][0]['.value']) ? 'No title' : $node['entryTitle'][0]['.value']; $cmtNotified->entryurl = $node['entryUrl'][0]['.value']; if (!$cmtNotified->add()) { user_error(__LINE__ . $cmtNotified->error); } return true; case '/blog/commentsNotifiedSiteInfo/site': setProgress($item++ / $items * 100, _t('댓글 알리미 내용을 복원하고 있습니다.')); $cmtNotifiedSite = new CommentNotifiedSiteInfo(); if ($cmtNotifiedSite->open("url = '{$node['url'][0]['.value']}'")) { if (intval($node['modified'][0]['.value']) > intval($cmtNotifiedSite->modified)) { $cmtNotifiedSite->title = $node['title'][0]['.value']; $cmtNotifiedSite->name = $node['name'][0]['.value']; $cmtNotifiedSite->modified = $node['modified'][0]['.value']; } if (!$cmtNotifiedSite->update()) { user_error(__LINE__ . $cmtNotifiedSite->error); } } else { $cmtNotifiedSite->url = $node['url'][0]['.value']; $cmtNotifiedSite->title = $node['title'][0]['.value']; $cmtNotifiedSite->name = $node['name'][0]['.value']; $cmtNotifiedSite->modified = $node['modified'][0]['.value']; if (!$cmtNotifiedSite->add()) { user_error(__LINE__ . $cmtNotifiedSite->error); } } return true; case '/blog/statistics/referer': setProgress($item++ / $items * 100, _t('리퍼러 통계를 복원하고 있습니다.')); $statistics = new RefererStatistics(); $statistics->host = $node['host'][0]['.value']; $statistics->count = $node['count'][0]['.value']; if (!$statistics->add()) { user_error(__LINE__ . $statistics->error); } return true; case '/blog/statistics/visits': setProgress($item++ / $items * 100, _t('블로그 통계 정보를 복원하고 있습니다.')); $statistics = new BlogStatistics(); $statistics->visits = $node['.value']; if (!$statistics->add()) { user_error(__LINE__ . $statistics->error); } return true; case '/blog/statistics/daily': setProgress($item++ / $items * 100, _t('일별 통계 정보를 복원하고 있습니다.')); $statistics = new DailyStatistics(); $statistics->date = $node['date'][0]['.value']; $statistics->visits = $node['visits'][0]['.value']; if (!$statistics->add()) { user_error(__LINE__ . $statistics->error); } return true; case '/blog/skin': setProgress($item++ / $items * 100, _t('스킨 설정을 복원하고 있습니다.')); $setting = new SkinSetting(); if (false) { $setting->skin = $node['name'][0]['.value']; if (!$setting->save()) { user_error(__LINE__ . $setting->error); } $setting->skin = null; } $setting->entriesOnRecent = $node['entriesOnRecent'][0]['.value']; $setting->commentsOnRecent = $node['commentsOnRecent'][0]['.value']; $setting->trackbacksOnRecent = $node['trackbacksOnRecent'][0]['.value']; $setting->commentsOnGuestbook = $node['commentsOnGuestbook'][0]['.value']; $setting->tagsOnTagbox = $node['tagsOnTagbox'][0]['.value']; $setting->alignOnTagbox = $node['alignOnTagbox'][0]['.value']; $setting->expandComment = $node['expandComment'][0]['.value']; $setting->expandTrackback = $node['expandTrackback'][0]['.value']; if (!empty($node['recentNoticeLength'][0]['.value'])) { $setting->recentNoticeLength = $node['recentNoticeLength'][0]['.value']; } $setting->recentEntryLength = $node['recentEntryLength'][0]['.value']; $setting->recentTrackbackLength = $node['recentTrackbackLength'][0]['.value']; $setting->linkLength = $node['linkLength'][0]['.value']; $setting->showListOnCategory = $node['showListOnCategory'][0]['.value']; $setting->showListOnArchive = $node['showListOnArchive'][0]['.value']; if (isset($node['tree'])) { $cursor =& $node['tree'][0]; $setting->tree = $cursor['name'][0]['.value']; $setting->colorOnTree = $cursor['color'][0]['.value']; $setting->bgcolorOnTree = $cursor['bgColor'][0]['.value']; $setting->activecolorOnTree = $cursor['activeColor'][0]['.value']; $setting->activebgcolorOnTree = $cursor['activeBgColor'][0]['.value']; $setting->labelLengthOnTree = $cursor['labelLength'][0]['.value']; $setting->showValueOnTree = $cursor['showValue'][0]['.value']; } if (!$setting->save()) { user_error(__LINE__ . $setting->error); } return true; case '/blog/plugin': // setProgress($item++ / $items * 100, _t('플러그인 설정을 복원하고 있습니다.')); // $setting = new PluginSetting(); // $setting->name = $node['name'][0]['.value']; // $setting->setting = $node['setting'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); return true; case '/blog/personalization': // setProgress($item++ / $items * 100, _t('사용자 편의 설정을 복원하고 있습니다.')); // $setting = new UserSetting(); // $setting->name = 'rowsPerPage'; // $setting->value = $node['rowsPerPage'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); // $setting->name = 'readerPannelVisibility'; // $setting->value = $node['readerPannelVisibility'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); // $setting->name = 'readerPannelHeight'; // $setting->value = $node['readerPannelHeight'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); // $setting->name = 'lastVisitNotifiedPage'; // $setting->value = $node['lastVisitNotifiedPage'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); return true; case '/blog/userSetting': // setProgress($item++ / $items * 100, _t('사용자 편의 설정을 복원하고 있습니다')); // $setting = new UserSetting(); // $setting->name = $node['name'][0]['.value']; // $setting->value = $node['value'][0]['.value']; // if (!$setting->add()) // user_error(__LINE__ . $setting->error); return true; case '/blog/guestbook/comment': setProgress($item++ / $items * 100, _t('방명록을 복원하고 있습니다.')); $comment = new GuestComment(); $comment->name = $node['commenter'][0]['name'][0]['.value']; if (!empty($node['id'][0]['.value'])) { $comment->id = $node['id'][0]['.value']; } if (!empty($node['commenter'][0]['.attributes']['id'])) { $comment->commenter = $node['commenter'][0]['.attributes']['id']; } if (!empty($node['commenter'][0]['homepage'][0]['.value'])) { $comment->homepage = $node['commenter'][0]['homepage'][0]['.value']; } if (!empty($node['commenter'][0]['ip'][0]['.value'])) { $comment->ip = $node['commenter'][0]['ip'][0]['.value']; } if (!empty($node['commenter'][0]['openid'][0]['.value'])) { $comment->openid = $node['commenter'][0]['openid'][0]['.value']; } $comment->password = $node['password'][0]['.value']; $comment->secret = @$node['secret'][0]['.value']; $comment->written = $node['written'][0]['.value']; $comment->content = $node['content'][0]['.value']; if (!$comment->add()) { user_error(__LINE__ . $comment->error); } if (isset($node['comment'])) { for ($j = 0; $j < count($node['comment']); $j++) { $childComment = new GuestComment(); $childComment->parent = $comment->id; $cursor =& $node['comment'][$j]; $childComment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['id'][0]['.value'])) { $comment->id = $cursor['id'][0]['.value']; } if (!empty($cursor['commenter'][0]['.attributes']['id'])) { $childComment->commenter = $cursor['commenter'][0]['.attributes']['id']; } if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) { $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; } if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) { $childComment->ip = $cursor['commenter'][0]['ip'][0]['.value']; } if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) { $childComment->openid = $cursor['commenter'][0]['openid'][0]['.value']; } $childComment->password = $cursor['password'][0]['.value']; $childComment->secret = @$cursor['secret'][0]['.value']; $childComment->written = $cursor['written'][0]['.value']; $childComment->content = $cursor['content'][0]['.value']; if (!$childComment->add()) { user_error(__LINE__ . $childComment->error); } } } return true; case '/blog/filter': setProgress($item++ / $items * 100, _t('필터 설정을 복원하고 있습니다.')); $filter = new Filter(); $filter->type = $node['.attributes']['type']; $filter->pattern = $node['pattern'][0]['.value']; if (!$filter->add()) { user_error(__LINE__ . $filter->error); } return true; case '/blog/feed': setProgress($item++ / $items * 100, _t('리더 데이터를 복원하고 있습니다.')); $feed = new Feed(); if (!empty($node['group'][0]['.value'])) { $feed->group = FeedGroup::getId($node['group'][0]['.value'], true); } $feed->url = $node['url'][0]['.value']; if (!$feed->add()) { user_error(__LINE__ . $feed->error); } return true; case '/blog/line': setProgress($item++ / $items * 100, _t('라인을 복원하고 있습니다.')); $line = Model_Line::getInstance(); $line->reset(); if (!empty($node['author'][0]['.value'])) { $line->author = $node['author'][0]['.value']; } if (!empty($node['category'][0]['.value'])) { $line->category = $node['category'][0]['.value']; } if (!empty($node['root'][0]['.value'])) { $line->root = $node['root'][0]['.value']; } if (!empty($node['permalink'][0]['.value'])) { $line->permalink = $node['permalink'][0]['.value']; } if (!empty($node['content'][0]['.value'])) { $line->content = $node['content'][0]['.value']; } if (!empty($node['created'][0]['.value'])) { $line->created = intval($node['created'][0]['.value']); } if ($line->add()) { return true; } else { user_error(__LINE__ . $line->_error); } } }
function do_submit3() { global $db; $linkres = new Link(); $linkres->id = sanitize($_POST['id'], 3); if (!is_numeric($linkres->id)) { die; } $linkres->read(); totals_adjust_count($linkres->status, -1); totals_adjust_count('queued', 1); $linkres->status = 'queued'; $vars = array('linkres' => $linkres); check_actions('do_submit3', $vars); $linkres->store_basic(); $linkres->check_should_publish(); if (isset($_POST['trackback']) && sanitize($_POST['trackback'], 3) != '') { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = sanitize($_POST['trackback'], 3); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send(); } if ($linkres->link_group_id == 0) { header("Location: " . getmyurl('upcoming')); die; } else { $redirect = getmyurl("group_story", $linkres->link_group_id); header("Location: {$redirect}"); die; } }
$tb_id = strip_tags($_GET['id']); if (!is_numeric($tb_id)) { trackback_response(1, 'I really need an ID for this to work.'); } if (empty($title) && empty($tb_url) && empty($blog_name)) { // If it doesn't look like a trackback at all... header('Location: ' . getmyFullurl("story", $tb_id)); exit; } if (!empty($tb_url) && !empty($title) && !empty($tb_url)) { header('Content-Type: text/xml; charset=UTF-8'); $title = htmlspecialchars(strip_tags($title)); $title = strlen($title) > 150 ? substr($title, 0, 150) . '...' : $title; $excerpt = strip_tags($excerpt); $excerpt = strlen($excerpt) > 200 ? substr($excerpt, 0, 200) . '...' : $excerpt; $trackres = new Trackback(); $trackres->link = $tb_id; $trackres->type = 'in'; $trackres->url = $tb_url; $dupe = $trackres->read(); if ($dupe) { trackback_response(1, $main_smarty->get_config_vars('PLIGG_Visual_Trackback_AlreadyPing')); } $contents = @file_get_contents($tb_url); if (!$contents) { trackback_response(1, $main_smarty->get_config_vars('PLIGG_Visual_Trackback_BadURL')); } $permalink = get_permalink($tb_id); $permalink_q = preg_quote($permalink, '/'); $pattern = "/<\\s*a.*href\\s*=[\"'\\s]*" . $permalink_q . "[\"'\\s]*.*>.*<\\s*\\/\\s*a\\s*>/i"; if (!preg_match($pattern, $contents)) {
function do_submit3() { global $db; $linkres = new Link(); $linkres->id = sanitize($_POST['id'], 3); if (!is_numeric($linkres->id)) { die; } if (!Submit_Complete_Step2 && $_SESSION['step'] != 2) { die('Wrong step'); } $linkres->read(); totals_adjust_count($linkres->status, -1); totals_adjust_count('queued', 1); $linkres->status = 'queued'; $vars = array('linkres' => &$linkres); check_actions('do_submit3', $vars); if ($vars['linkres']->status == 'discard') { $vars = array('link_id' => $linkres->id); check_actions('story_discard', $vars); } elseif ($vars['linkres']->status == 'spam') { $vars = array('link_id' => $linkres->id); check_actions('story_spam', $vars); } $linkres->store_basic(); $linkres->check_should_publish(); if (isset($_POST['trackback']) && sanitize($_POST['trackback'], 3) != '') { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = sanitize($_POST['trackback'], 3); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send(); } $vars = array('linkres' => $linkres); check_actions('submit_pre_redirect', $vars); if ($vars['redirect']) { header('Location: ' . $vars['redirect']); } elseif ($linkres->link_group_id == 0) { header("Location: " . getmyurl('upcoming')); } else { $redirect = getmyurl("group_story", $linkres->link_group_id); header("Location: {$redirect}"); } die; }
function do_submit3() { global $db, $current_user; $linkres = new Link(); $linkres->id = $link_id = intval($_POST['id']); $linkres->read(); // Check it is not in the queue already if ($linkres->votes == 0 && $linkres->status != 'queued') { $linkres->status = 'queued'; $linkres->date = time(); $linkres->get_uri(); $linkres->store(); $linkres->insert_vote($current_user->user_id, $current_user->user_karma); // Add the new link log/event require_once mnminclude . 'log.php'; log_conditional_insert('link_new', $linkres->id, $linkres->author); $db->query("delete from links where link_author = {$linkres->author} and link_status='discard' and link_votes=0"); if (!empty($_POST['trackback'])) { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = clean_input_url($_POST['trackback']); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send($linkres); } } header("Location: shakeit.php"); die; }
function admin_blog_new() { $message = ""; $this->set("categories", $this->Category->find('list')); if (!empty($this->data)) { $this->Article->create($this->data); $this->Article->validates(); $validationResult = $this->Article->validationErrors; if (empty($validationResult)) { $trackback_urls = trim($this->data['Article']['trackback']); unset($this->data['Article']['trackback']); $this->data['Article']['created'] = date("Y-m-d H:i:s"); $this->data['Article']['type'] = 1; if ($this->Article->save($this->data)) { $message .= "新規記事を保存しました。\n"; } else { $message .= "記事の保存に失敗しました。\n"; } // get information for trackback and ping $blog_name = $this->Setting->getValue('blog.name'); $blog_author = $this->Setting->getValue('blog.author'); $permalink = HOST . $this->base . '/blog/entry/' . $this->data['Article']['url']; $rss_link = HOST . $this->base . '/blog/rss'; // send trackback if (!empty($trackback_urls)) { //load trackback class App::import('Vendor', 'trackback', array('file' => 'trackback.php')); $urls = explode("\n", $trackback_urls); $content = strip_tags($this->data['Article']['content']); $content = mb_substr($content, 0, 100); if (count($urls) > 0) { $trackback = new Trackback($blog_name, $blog_author, Configure::read('App.encoding')); foreach ($urls as $url) { if ($trackback->ping($url, $permalink, $this->data['Article']['title'], $content)) { $message .= "{$url}にトラックバックを送信しました。\n"; } else { $message .= "{$url}にトラックバックは送信できませんでした。\n"; } } } } $pings = explode("\n", $this->Setting->getValue('blog.pings')); if (!empty($pings)) { App::import('Vendor', 'weblog_pinger', array('file' => 'weblog_pinger.php')); App::import('Vendor', 'xmlrpc', array('file' => 'xmlrpc.inc')); foreach ($pings as $url) { if (!empty($url)) { $pinger = new Weblog_Pinger(); $blog_name = urlencode($blog_name); //メジャーな所に送っておく。 $ping_result = $pinger->ping_all(trim($url), $blog_name, $permalink); $this->log("ping result : \n" . var_export($ping_result, true), LOG_DEBUG); $ping_result = $pinger->simplePing(trim($url), $blog_name, $permalink, "", "", $rss_link); $this->log("ping result : \n" . var_export($ping_result, true), LOG_DEBUG); if (!is_array($ping_result)) { $message .= "{$url}にPingを送信しました。<br />\n"; } else { $message .= "{$url}にPing送信に失敗しました。<br />\n"; } } } } $this->Session->write("message", $message); $this->redirect(array('controller' => 'operation', 'action' => 'blog_list')); } } }
/** * Prepares and calls functions to send a trackback * Uses $h->post->id */ public function sendTrackback() { $trackback = Trackback::instance(); return $trackback->sendTrackback($this); }
function do_trackbacks() { global $db; $id = $_REQUEST['id']; echo '<div id="blogged" style="z-index: 10;">'; echo '<h2>' . PLIGG_Visual_Trackback . '</h2>'; $trackbacks = $db->get_col("SELECT trackback_id FROM " . table_trackbacks . " WHERE trackback_link_id={$id} AND trackback_type='in' ORDER BY trackback_date DESC"); if ($trackbacks) { echo '<ul>'; require_once mnminclude . 'trackback.php'; $trackback = new Trackback(); foreach ($trackbacks as $trackback_id) { $trackback->id = $trackback_id; $trackback->read(); echo '<li><a href="' . $trackback->url . '" title="' . htmlspecialchars($trackback->content) . '">' . $trackback->title . '</a></li>'; } echo "</ul>\n"; } echo '<br /></div>'; }
function do_submit3() { global $db, $current_user; $linkres = new Link(); $linkres->id = $link_id = intval($_POST['id']); if (!check_link_key() || !$linkres->read()) { die; } // Check it is not in the queue already if ($linkres->votes == 0 && $linkres->status != 'queued') { $linkres->status = 'queued'; $linkres->sent_date = $linkres->date = time(); $linkres->get_uri(); $linkres->store(); $linkres->insert_vote($current_user->user_id, $current_user->user_karma); // Add the new link log/event require_once mnminclude . 'log.php'; log_conditional_insert('link_new', $linkres->id, $linkres->author); $db->query("delete from links where link_author = {$linkres->author} and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0"); if (!empty($_POST['trackback'])) { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = clean_input_url($_POST['trackback']); $trackres->link_id = $linkres->id; $trackres->link = $linkres->url; //$trackres->title=$linkres->title; $trackres->author = $linkres->author; //$trackres->content=$linkres->content; $res = $trackres->send($linkres); } fork("backend/send_pingbacks.php?id={$linkres->id}"); } header('Location: ' . $linkres->get_permalink()); die; }
function getTrackbacks() { if (!Validator::number($this->id, 1)) { return $this->_error('id'); } $trackback = new Trackback(); if ($trackback->open('entry = ' . $this->id)) { return $trackback; } }
/** * Prepares and calls functions to send a trackback * Uses $h->post->id */ public function sendTrackback() { require_once LIBS . 'Trackback.php'; $trackback = new Trackback(); return $trackback->sendTrackback($this); }
header('Location: ' . $link->get_permalink()); exit; } // Antispam, avoid trackbacks in old articles if ($link->date < time() - 86400 * 7) { //syslog(LOG_NOTICE, "Meneame: Too old: $tb_url -> " . $link->get_permalink()); die; } if (!empty($tb_url) && !empty($title) && !empty($excerpt)) { header('Content-Type: text/xml; charset=UTF-8'); $title = clean_text($title); $excerpt = clean_text($excerpt); $blog_name = clean_text($blog_name); $title = mb_strlen($title) > 120 ? mb_substr($title, 0, 120) . '...' : $title; $excerpt = mb_strlen($excerpt) > 200 ? mb_substr($excerpt, 0, 200) . '...' : $excerpt; $trackres = new Trackback(); $trackres->link_id = $tb_id; $trackres->type = 'in'; $trackres->link = $tb_url; $trackres->url = $tb_url; if ($trackres->abuse()) { trackback_response(1, 'Dont abuse.'); } $dupe = $trackres->read(); if ($dupe) { syslog(LOG_NOTICE, "Meneame: We already have a ping from that URI for this post: {$tb_url} - {$permalink}"); trackback_response(1, 'We already have a ping from that URI for this post.'); } $response = get_url($tb_url); if (!$response || empty($result['content'])) { syslog(LOG_NOTICE, "Meneame: The provided URL does not seem to work: {$tb_url}");
function enqueue() { global $db, $globals, $current_user; // Check this one was not already queued if ($this->votes == 0 && $this->author == $current_user->user_id && $this->status != 'queued') { $this->status = 'queued'; $this->sent_date = $this->date = time(); $this->get_uri(); $db->transaction(); if (!$this->store()) { $db->rollback(); return false; } $this->insert_vote($current_user->user_karma); // Add the new link log/event Log::conditional_insert('link_new', $this->id, $this->author); $db->query("delete from links where link_author = {$this->author} and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0"); if (!empty($_POST['trackback'])) { $trackres = new Trackback(); $trackres->url = clean_input_url($_POST['trackback']); $trackres->link_id = $this->id; $trackres->link = $this->url; $trackres->author = $this->author; $trackres->status = 'pendent'; $trackres->store(); } $db->commit(); fork("backend/send_pingbacks.php?id={$this->id}"); } }
function receiveTrackback($blogid, $entry, $title, $url, $excerpt, $site) { global $database, $blog, $defaultURL; if (empty($url)) { return 5; } $post = new Post(); if (!$post->doesAcceptTrackback($entry)) { return 3; } $filtered = 0; if (!Filter::isAllowed($url)) { if (Filter::isFiltered('ip', $_SERVER['REMOTE_ADDR']) || Filter::isFiltered('url', $url)) { $filtered = 1; } else { if (Filter::isFiltered('content', $excerpt)) { $filtered = 1; } else { if (!fireEvent('AddingTrackback', true, array('entry' => $entry, 'url' => $url, 'site' => $site, 'title' => $title, 'excerpt' => $excerpt))) { $filtered = 1; } } } } $title = correctTTForXmlText($title); $excerpt = correctTTForXmlText($excerpt); $url = UTF8::lessenAsEncoding($url); $site = UTF8::lessenAsEncoding($site); $title = UTF8::lessenAsEncoding($title); $excerpt = UTF8::lessenAsEncoding($excerpt); $trackback = new Trackback(); $trackback->entry = $entry; $trackback->url = $url; $trackback->site = $site; $trackback->title = $title; $trackback->excerpt = $excerpt; if ($filtered > 0) { $trackback->isfiltered = true; } if ($trackback->add()) { if ($filtered == 0) { CacheControl::flushDBCache('trackback'); } return $filtered == 0 ? 0 : 3; } else { return 4; } return 0; }
function blog_trackback_send($ping_urls, $blogentry_id, $blogentry_title, &$blogentry_body) { global $database, $user, $url, $setting; // Trackback class $trackback = new Trackback($user->user_displayname . "'s Blog", $user->user_displayname, "UTF-8"); // Prepare data $blogentry_excerpt = strlen($blogentry_body) > 255 ? substr($blogentry_body, 0, 254) : $blogentry_body; $blogentry_url = $url->url_create('blog_entry', $user->user_info['user_username'], $blogentry_id); // Allow multiple trackbacks if (!is_array($ping_urls)) { $ping_urls = array($ping_urls); } // Detect trackbacks if ($user->level_info['level_blog_trackbacks_detect']) { $detected_trackback_urls = $trackback->auto_discovery($blogentry_body); $ping_urls = array_merge($ping_urls, $detected_trackback_urls); } $ping_urls = array_unique(array_filter($ping_urls)); // Ping the trackback urls (and generate ping log query) $sql = "INSERT INTO se_blogpings (blogping_blogentry_id, blogping_target_url, blogping_source_url, blogping_status, blogping_type, blogping_ip) VALUES "; $isFirst = TRUE; $trackback_results = array(); foreach ($ping_urls as $ping_url) { $tb_result = $trackback->ping($ping_url, $blogentry_url, $blogentry_title, $blogentry_excerpt); if ($tb_result == "1") { $trackback_results[$ping_url] = "Could not connect"; } elseif ($tb_result == "2") { $trackback_results[$ping_url] = "Success"; } elseif ($tb_result == "3") { $trackback_results[$ping_url] = "An error occurred"; } else { $trackback_results[$ping_url] = "An unknown error has occurred"; } if (!$isFirst) { $sql .= ','; } $sql .= "('{$blogentry_id}', '" . $database->database_real_escape_string($ping_url) . "', '" . $database->database_real_escape_string($_SERVER['REQUEST_URI']) . "', 1, 1, '{$_SERVER['REMOTE_ADDR']}')"; $isFirst = FALSE; } if (!$isFirst) { $resource = $database->database_query($sql); } return array('result' => TRUE, 'trackback_results' => $results); }
} // ignore_user_abort(); //run script in background // Send the trackback for the main link if ($tbs = $db->get_col("select trackback_id from trackbacks where trackback_link_id = {$link->id} and trackback_status='pendent'")) { foreach ($tbs as $tb_id) { $tb = new Trackback(); $tb->id = $tb_id; if ($tb->read()) { $res = $tb->send($link); } } } // Send pingbacks for link inside the text preg_match_all('/([\\(\\[:\\.\\s]|^)(https*:\\/\\/[^ \\t\\n\\r\\]\\(\\)\\&]{5,70}[^ \\t\\n\\r\\]\\(\\)]*[^ .\\t,\\n\\r\\(\\)\\"\'\\]\\?])/i', $link->content, $matches); foreach ($matches[2] as $match) { $tb = new Trackback(); $tb->link = clean_input_url($match); $tb->link_id = $link->id; $tb->author = $link->author; if (!$tb->read()) { $tmp = new Link(); if (!$tmp->get($match, 2000, false)) { echo "couldn't get {$match}\n"; next; } if (!$tmp->pingback()) { echo "couldn't get pingback {$match}\n"; next; } $tb->link = clean_input_url($match); $tb->url = clean_input_url($tmp->trackback);
function do_submit3() { global $db, $current_user; $linkres=new Link; $linkres->id=$link_id = intval($_POST['id']); if(!check_link_key() || !$linkres->read()) die; // Check it is not in the queue already if ($linkres->duplicates($linkres->url)) { // Write headers, they were not printed yet do_header(_("enviar noticia"), "post"); echo '<div id="singlewrap">' . "\n"; report_dupe($linkres->url); return; } // Check this one was not already queued if($linkres->votes == 0 && $linkres->status != 'queued') { $db->transaction(); $linkres->status='queued'; $linkres->sent_date = $linkres->date=time(); $linkres->get_uri(); $linkres->store(); $linkres->insert_vote($current_user->user_karma); $db->commit(); // Add the new link log/event require_once(mnminclude.'log.php'); log_conditional_insert('link_new', $linkres->id, $linkres->author); $db->query("delete from links where link_author = $linkres->author and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0"); if(!empty($_POST['trackback'])) { $trackres = new Trackback; $trackres->url=clean_input_url($_POST['trackback']); $trackres->link_id=$linkres->id; $trackres->link=$linkres->url; $trackres->author=$linkres->author; $trackres->status = 'pendent'; $trackres->store(); } fork("backend/send_pingbacks.php?id=$linkres->id"); } header('Location: '. $linkres->get_permalink()); die; }
echo '</div>'; echo '<script type="text/javascript">$(function(){start_link_sneak()});</script>' . "\n"; break; case 7: // Show trackback echo '<div class="voters" id="voters">'; // AdSense do_banner_story(); print_story_tabs($tab_option); echo '<a href="' . $link->get_trackback() . '" title="' . _('URI para trackbacks') . '" class="tab-trackback-url"><img src="' . $globals['base_url'] . 'img/common/permalink.gif" alt="' . _('enlace trackback') . '" width="16" height="9"/> ' . _('dirección de trackback') . '</a>' . "\n"; echo '<fieldset><legend>' . _('lugares que enlazan esta noticia') . '</legend>'; echo '<ul class="tab-trackback">'; $trackbacks = $db->get_col("SELECT trackback_id FROM trackbacks WHERE trackback_link_id={$link->id} AND trackback_type='in' and trackback_status = 'ok' ORDER BY trackback_date DESC limit 50"); if ($trackbacks) { require_once mnminclude . 'trackback.php'; $trackback = new Trackback(); foreach ($trackbacks as $trackback_id) { $trackback->id = $trackback_id; $trackback->read(); echo '<li class="tab-trackback-entry"><a href="' . $trackback->url . '" rel="nofollow">' . $trackback->title . '</a> [' . preg_replace('/https*:\\/\\/([^\\/]+).*/', "\$1", $trackback->url) . ']</li>' . "\n"; } } echo '<li class="tab-trackback-technorati"><a href="http://technorati.com/search/' . urlencode($globals['link_permalink']) . '">' . _('Technorati') . '</a></li>' . "\n"; echo '<li class="tab-trackback-google"><a href="http://blogsearch.google.com/blogsearch?hl=es&q=link%3A' . urlencode($globals['link_permalink']) . '">' . _('Google') . '</a></li>' . "\n"; echo '<li class="tab-trackback-askcom"><a href="http://es.ask.com/blogsearch?q=' . urlencode($globals['link_permalink']) . '&t=a&search=Buscar&qsrc=2101&bql=any">' . _('Ask.com') . '</a></li>' . "\n"; echo '</ul>'; echo '</fieldset>'; echo '</div>'; break; } // echo '<div class="story-vertical-completion"> </div>';
function do_submit3() { global $db; $linkres = new Link(); $linkres->id = $link_id = strip_tags($_POST['id']); $linkres->read(); //if (link_errors($linkres)) { // echo '<form id="thisform">'; // echo '<input type=button onclick="window.history.go(-2)" value="'._(PLIGG_Visual_Submit_Step3_Modify).'">'; // return; //} $linkres->status = 'queued'; $linkres->store_basic(); $linkres->check_should_publish(); if (!empty($_POST['trackback'])) { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = trim($_POST['trackback']); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send(); } header("Location: " . getmyurl('upcoming')); die; }