diff options
| -rwxr-xr-x | includes/footer.php | 9 | ||||
| -rwxr-xr-x | includes/functions.php | 4 | ||||
| -rwxr-xr-x | index.php | 2 | ||||
| -rwxr-xr-x | pages/blog.php | 21 | ||||
| -rwxr-xr-x | theme/comments.tpl | 4 | ||||
| -rwxr-xr-x | theme/pingbacks.tpl | 14 | ||||
| -rwxr-xr-x | theme/related.tpl | 2 | ||||
| -rwxr-xr-x | xmlrpc.php | 32 |
8 files changed, 49 insertions, 39 deletions
| diff --git a/includes/footer.php b/includes/footer.php index 8cb0f2d..204aaf5 100755 --- a/includes/footer.php +++ b/includes/footer.php | |||
| @@ -176,12 +176,9 @@ if (!isset($noRightbar)) | |||
| 176 | break; | 176 | break; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | if ($name != 'Pingback') | 179 | $template->adds_block('TOP', array( 'USERNAME' => $name, |
| 180 | { | 180 | 'COUNT' => $count)); |
| 181 | $template->adds_block('TOP', array( 'USERNAME' => $name, | 181 | $i++; |
| 182 | 'COUNT' => $count)); | ||
| 183 | $i++; | ||
| 184 | } | ||
| 185 | } | 182 | } |
| 186 | 183 | ||
| 187 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; | 184 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; |
| diff --git a/includes/functions.php b/includes/functions.php index 3e9382a..ee19391 100755 --- a/includes/functions.php +++ b/includes/functions.php | |||
| @@ -166,12 +166,12 @@ function recalcPop($id) | |||
| 166 | $popularity += ($getpost3['views']*2); | 166 | $popularity += ($getpost3['views']*2); |
| 167 | $popularity += ($getpost3['rating']*5); | 167 | $popularity += ($getpost3['rating']*5); |
| 168 | 168 | ||
| 169 | $getcomments = "SELECT COUNT(*) FROM comments WHERE page_id = \"updates-" . $id . "\" AND username <> \"Pingback\""; | 169 | $getcomments = "SELECT COUNT(*) FROM comments WHERE page_id = \"updates-" . $id . "\""; |
| 170 | $getcomments2 = mysql_query($getcomments); | 170 | $getcomments2 = mysql_query($getcomments); |
| 171 | $getcomments3 = mysql_fetch_array($getcomments2); | 171 | $getcomments3 = mysql_fetch_array($getcomments2); |
| 172 | $popularity += ($getcomments3[0] * 10); | 172 | $popularity += ($getcomments3[0] * 10); |
| 173 | 173 | ||
| 174 | $getpings = "SELECT COUNT(*) FROM comments WHERE page_id = \"updates-" . $id . "\" AND username = \"Pingback\""; | 174 | $getpings = "SELECT COUNT(*) FROM pingbacks WHERE post_id = " . $id; |
| 175 | $getpings2 = mysql_query($getpings); | 175 | $getpings2 = mysql_query($getpings); |
| 176 | $getpings3 = mysql_fetch_array($getpings2); | 176 | $getpings3 = mysql_fetch_array($getpings2); |
| 177 | $popularity += ($getpings3[0] * 25); | 177 | $popularity += ($getpings3[0] * 25); |
| diff --git a/index.php b/index.php index 12ba2ab..c7e6d5b 100755 --- a/index.php +++ b/index.php | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | require('headerproc.php'); | 21 | require('headerproc.php'); |
| 22 | 22 | ||
| 23 | header('X-Pingback: http://www.fourisland.com/xmlrpc.php'); | 23 | header('X-Pingback: http://fourisland.com/xmlrpc.php'); |
| 24 | 24 | ||
| 25 | include('../security/config.php'); | 25 | include('../security/config.php'); |
| 26 | include('includes/db.php'); | 26 | include('includes/db.php'); |
| diff --git a/pages/blog.php b/pages/blog.php index c3f656b..ab198a0 100755 --- a/pages/blog.php +++ b/pages/blog.php | |||
| @@ -105,6 +105,27 @@ if (isset($_GET['post'])) | |||
| 105 | { | 105 | { |
| 106 | $template->display(); | 106 | $template->display(); |
| 107 | } | 107 | } |
| 108 | |||
| 109 | $getpings = "SELECT * FROM pingbacks WHERE post_id = " . $getpost3['id']; | ||
| 110 | $getpings2 = mysql_query($getpings); | ||
| 111 | $i=0; | ||
| 112 | while ($getpings3[$i] = mysql_fetch_array($getpings2)) | ||
| 113 | { | ||
| 114 | if ($i==0) | ||
| 115 | { | ||
| 116 | $template = new FITemplate('pingbacks'); | ||
| 117 | } | ||
| 118 | |||
| 119 | $template->adds_block('PINGBACK', array( 'TITLE' => $getpings3[$i]['title'], | ||
| 120 | 'URL' => $getpings3[$i]['url'], | ||
| 121 | 'DATE' => date('F d<\S\U\P>S</\S\U\P> Y', strtotime($getpings3[$i]['pubDate'])))); | ||
| 122 | $i++; | ||
| 123 | } | ||
| 124 | |||
| 125 | if ($i > 0) | ||
| 126 | { | ||
| 127 | $template->display(); | ||
| 128 | } | ||
| 108 | } else { | 129 | } else { |
| 109 | generateError('404'); | 130 | generateError('404'); |
| 110 | } | 131 | } |
| diff --git a/theme/comments.tpl b/theme/comments.tpl index 341d933..d814292 100755 --- a/theme/comments.tpl +++ b/theme/comments.tpl | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | <A NAME="comments" /> | 1 | <A NAME="comments"></A> |
| 2 | 2 | ||
| 3 | <!--BEGIN COMMENTS--> | 3 | <!--BEGIN COMMENTS--> |
| 4 | <A NAME="comment-<!--COMMENTS.ID-->" /> | 4 | <A NAME="comment-<!--COMMENTS.ID-->"></A> |
| 5 | 5 | ||
| 6 | <DIV CLASS="bubble"> | 6 | <DIV CLASS="bubble"> |
| 7 | <BLOCKQUOTE> | 7 | <BLOCKQUOTE> |
| diff --git a/theme/pingbacks.tpl b/theme/pingbacks.tpl new file mode 100755 index 0000000..0414fdb --- /dev/null +++ b/theme/pingbacks.tpl | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | <BR BREAK="both" /> | ||
| 2 | |||
| 3 | <DIV CLASS="bubble"> | ||
| 4 | <DIV CLASS="rounded"> | ||
| 5 | <BLOCKQUOTE> | ||
| 6 | <DIV> | ||
| 7 | <!--BEGIN PINGBACK--> | ||
| 8 | <A HREF="<!--PINGBACK.URL-->"><!--PINGBACK.TITLE--></A> on <!--PINGBACK.DATE--><BR> | ||
| 9 | <!--END PINGBACK--> | ||
| 10 | </DIV> | ||
| 11 | </BLOCKQUOTE> | ||
| 12 | </DIV> | ||
| 13 | <CITE CLASS="rounded"><STRONG>Pingbacks</STRONG></CITE> | ||
| 14 | </DIV> | ||
| diff --git a/theme/related.tpl b/theme/related.tpl index c070359..5875f3c 100755 --- a/theme/related.tpl +++ b/theme/related.tpl | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | <BR BREAK="both" /> | ||
| 2 | |||
| 1 | <DIV CLASS="bubble"> | 3 | <DIV CLASS="bubble"> |
| 2 | <DIV CLASS="rounded"> | 4 | <DIV CLASS="rounded"> |
| 3 | <BLOCKQUOTE> | 5 | <BLOCKQUOTE> |
| diff --git a/xmlrpc.php b/xmlrpc.php index 69990da..9ca47c4 100755 --- a/xmlrpc.php +++ b/xmlrpc.php | |||
| @@ -58,33 +58,15 @@ function ping($xmlrpcmsg) | |||
| 58 | $title = $from; | 58 | $title = $from; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | preg_match_all('/HREF="([^"]+)">([^>]+)<\/A>/i',$page_data,$matches); | 61 | $getping = "SELECT * FROM pingbacks WHERE post_id = " . $getpost3['id'] . " AND url = \"" . mysql_real_escape_string($from) . "\""; |
| 62 | for ($i=0;$i<count($matches[1]);$i++) | ||
| 63 | { | ||
| 64 | if ($matches[1][$i] == $to) | ||
| 65 | { | ||
| 66 | $find = $matches[2][$i]; | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | $text = strip_tags($page_data); | ||
| 71 | $text = substr($text,(stripos($text,$find)-300),700); | ||
| 72 | $text = str_ireplace('<BR>',"\n",$text); | ||
| 73 | $text = str_ireplace('<BR />',"\n",$text); | ||
| 74 | $text = str_replace("\t", ' ', $text); | ||
| 75 | $text = preg_replace('/' . "\n" . '([ ]*)' . "\n" . '/i', '', $text); | ||
| 76 | |||
| 77 | $commentText = "[url=" . $from . "]" . $title . "[/url]\n\n[....] " . $text . " [....]"; | ||
| 78 | |||
| 79 | $getping = "SELECT * FROM comments WHERE page_id = \"updates-" . $getpost3['id'] . "\" AND comment = \"" . addslashes($commentText) . "\""; | ||
| 80 | $getping2 = mysql_query($getping); | 62 | $getping2 = mysql_query($getping); |
| 81 | $getping3 = mysql_fetch_array($getping2); | 63 | $getping3 = mysql_fetch_array($getping2); |
| 82 | 64 | ||
| 83 | if ($getping3['comment'] == $commentText) | 65 | if ($getping3['url'] == $from) |
| 84 | { | 66 | { |
| 85 | return new xmlrpcresp(0, 48, "Target uri cannot be used as target"); | 67 | return new xmlrpcresp(0, 48, "Target uri cannot be used as target"); |
| 86 | } else { | 68 | } else { |
| 87 | $insping = "INSERT INTO comments (page_id,username,comment) VALUES (\"updates-" . $getpost3['id'] . "\",\"Pingback\",\"" . $commentText . "\")"; | 69 | $insping = "INSERT INTO pingbacks (post_id,title,url) VALUES (" . $getpost3['id'] . ",\"" . mysql_real_escape_string($title) . "\",\"" . mysql_real_escape_string($from) . "\")"; |
| 88 | $insping2 = mysql_query($insping); | 70 | $insping2 = mysql_query($insping); |
| 89 | recalcPop($getpost3['id']); | 71 | recalcPop($getpost3['id']); |
| 90 | 72 | ||
| @@ -101,13 +83,7 @@ function ping($xmlrpcmsg) | |||
| 101 | } | 83 | } |
| 102 | } | 84 | } |
| 103 | 85 | ||
| 104 | function rr($xmlrpcmsg) | ||
| 105 | { | ||
| 106 | return new xmlrpcresp(new xmlrpcval(0, "int")); | ||
| 107 | } | ||
| 108 | |||
| 109 | $s = new xmlrpc_server(array( | 86 | $s = new xmlrpc_server(array( |
| 110 | "pingback.ping" => array("function" => "ping"), | 87 | "pingback.ping" => array("function" => "ping"))); |
| 111 | "InstaDisc.checkRegistration" => array("function" => "rr"))); | ||
| 112 | 88 | ||
| 113 | ?> | 89 | ?> |
