forked from Needlworks/Textcube
/
index.php
61 lines (60 loc) · 2.47 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/// Copyright (c) 2004-2012, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array(
'POST' => array(
'url' => array('url', 'default' => ''),
'title' => array('string', 'default' => ''),
'excerpt' => array('string', 'default' => ''),
'blog_name' => array('string', 'default' => '')
),
'SERVER' => array(
'CONTENT_TYPE' => array('string', 'default' => '')
)
);
require ROOT . '/library/preprocessor.php';
if(!Setting::getBlogSetting('acceptTrackbacks',1)) {
Respond::PrintResult(array('error' => 1, 'message' => 'The entry does not accept trackback'));
exit;
}
$url = $_POST['url'];
$title = !empty($_POST['title']) ? $_POST['title'] : '';
$excerpt = !empty($_POST['excerpt']) ? $_POST['excerpt'] : '';
$blog_name = !empty($_POST['blog_name']) ? $_POST['blog_name'] : '';
if (!empty($_SERVER["CONTENT_TYPE"]) && strpos($_SERVER["CONTENT_TYPE"], 'charset') > 0) {
$charsetPos = strpos($_SERVER["CONTENT_TYPE"], 'charset');
$charsetArray = explode('=', substr($_SERVER["CONTENT_TYPE"], $charsetPos));
$charset = $charsetArray[1];
$ary[] = trim($charset);
}
/*if(!isset($suri['id'])) $suri['id'] = getEntryIdBySlogan($blogid, $suri['value']);
if(empty($suri['id'])) {
Respond::PrintResult(array('error' => 1, 'message' => 'URL is not exist or invalid'));
exit;
}*/
$result = receiveTrackback($blogid, $suri['id'], $title, $url, $excerpt, $blog_name);
if ($result == 0) {
if($row = POD::queryRow("SELECT *
FROM {$database['prefix']}Entries
WHERE blogid = $blogid
AND id = {$suri['id']}
AND draft = 0
AND visibility = 3
AND acceptcomment = 1"))
sendTrackbackPing($suri['id'], $context->getProperty('uri.default')."/".($context->getProperty('blog.useSloganOnPost') ? "entry/{$row['slogan']}": $suri['id']), $url, $blog_name, $title);
Respond::ResultPage(0);
} else {
if ($result == 1) {
Respond::PrintResult(array('error' => 1, 'message' => 'Could not receive'));
} else if ($result == 2) {
Respond::PrintResult(array('error' => 1, 'message' => 'Could not receive'));
} else if ($result == 3) {
Respond::PrintResult(array('error' => 1, 'message' => 'The entry does not accept trackback'));
} else if ($result == 4) {
Respond::PrintResult(array('error' => 1, 'message' => 'already exists trackback'));
} else if ($result == 5) {
Respond::PrintResult(array('error' => 1, 'message' => 'URL is not exist or invalid'));
}
}
?>