1
0

Also support "last X" REST interface

This commit is contained in:
Garvin Hicking
2006-08-02 10:07:34 +00:00
commit 80e14346a5
1775 changed files with 195589 additions and 0 deletions
bundled-libs
.current_version
Cache
HTTP
Net
Onyx
PEAR.php
Smarty
BUGSCOPYING.libChangeLogFAQINSTALLNEWSREADMERELEASE_NOTES
libs
Config_File.class.phpSmarty.class.phpSmarty_Compiler.class.phpdebug.tpl
internals
plugins
Text
BUNDLE_NOTICEWiki.php
Wiki
Parse.php
Parse
Render.php
Render
Rule.php
Rule
XML
YahooUI
create_release.sh
docs
dragdrop.jsimgedit.js
tests
comment.php
deployment
docs
exit.php
htmlarea
ChangeLogdialog.js
examples
htmlarea.csshtmlarea.js
images
index.html
lang
license.txt
plugins
popupdiv.js
popups
popupwin.jsreference.htmlrelease-notes.html
include
index.php
lang
UTF-8
addlang.shaddlang.txtappend.shplugin_lang.phpserendipity_lang_bg.inc.phpserendipity_lang_cn.inc.phpserendipity_lang_cs.inc.phpserendipity_lang_cz.inc.phpserendipity_lang_da.inc.phpserendipity_lang_de.inc.phpserendipity_lang_en.inc.phpserendipity_lang_es.inc.phpserendipity_lang_fa.inc.phpserendipity_lang_fi.inc.phpserendipity_lang_fr.inc.phpserendipity_lang_hu.inc.phpserendipity_lang_is.inc.phpserendipity_lang_it.inc.phpserendipity_lang_ja.inc.phpserendipity_lang_ko.inc.phpserendipity_lang_nl.inc.phpserendipity_lang_no.inc.phpserendipity_lang_pl.inc.phpserendipity_lang_pt.inc.phpserendipity_lang_pt_PT.inc.phpserendipity_lang_ro.inc.phpserendipity_lang_ru.inc.phpserendipity_lang_sa.inc.phpserendipity_lang_se.inc.phpserendipity_lang_ta.inc.phpserendipity_lang_tn.inc.phpserendipity_lang_tr.inc.phpserendipity_lang_tw.inc.phpserendipity_lang_zh.inc.php
plugins
serendipity_event_bbcode
serendipity_event_browsercompatibility
serendipity_event_contentrewrite
serendipity_event_creativecommons
serendipity_event_emoticate
serendipity_event_entryproperties
serendipity_event_karma
serendipity_event_livesearch
serendipity_event_mailer
serendipity_event_nl2br
serendipity_event_s9ymarkup
serendipity_event_searchhighlight
serendipity_event_spamblock
serendipity_event_spartacus
serendipity_event_statistics
serendipity_event_templatechooser
serendipity_event_textile
serendipity_event_textwiki
serendipity_event_trackexits
serendipity_event_weblogping
serendipity_event_xhtmlcleanup
serendipity_plugin_comments
serendipity_plugin_creativecommons
serendipity_plugin_entrylinks
serendipity_plugin_eventwrapper
serendipity_plugin_history
serendipity_plugin_recententries
serendipity_plugin_remoterss
serendipity_plugin_shoutbox
serendipity_plugin_templatedropdown
rss.phpserendipity.css.phpserendipity_admin.phpserendipity_admin_image_selector.phpserendipity_config.inc.phpserendipity_define.js.phpserendipity_editor.jsserendipity_xmlrpc.php
sql
db.sqldb_update_0.2_0.3_mysql.sqldb_update_0.2_0.3_postgres.sqldb_update_0.3_0.4_mysql.sqldb_update_0.3_0.4_postgres.sqldb_update_0.5.1_0.6_mysql.sqldb_update_0.5.1_0.6_postgres.sqldb_update_0.5_0.5.1_mysql.sqldb_update_0.5_0.5.1_postgres.sqldb_update_0.6.10_0.6.11_mysql.sqldb_update_0.6.10_0.6.11_postgres.sqldb_update_0.6.1_0.6.2_mysql.sqldb_update_0.6.1_0.6.2_postgres.sqldb_update_0.6.2_0.6.3_mysql.sqldb_update_0.6.2_0.6.3_postgres.sqldb_update_0.6.3_0.6.4_mysql.sqldb_update_0.6.3_0.6.4_postgres.sqldb_update_0.6.4_0.6.5_mysql.sqldb_update_0.6.4_0.6.5_postgres.sqldb_update_0.6.5_0.6.6_mysql.sqldb_update_0.6.5_0.6.6_postgres.sqldb_update_0.6.6_0.6.7_mysql.sqldb_update_0.6.6_0.6.7_postgres.sqldb_update_0.6.8_0.6.9_mysql.sqldb_update_0.6.8_0.6.9_postgres.sqldb_update_0.6.9_0.7.0_mysql.sqldb_update_0.6.9_0.7.0_postgresql.sqldb_update_0.6_0.6.1_mysql.sqldb_update_0.6_0.6.1_postgres.sqldb_update_0.8-alpha10_0.8-alpha11_mysql.sqldb_update_0.8-alpha11_0.8-alpha12_mysql.sqldb_update_0.8-alpha11_0.8-alpha12_postgres.sqldb_update_0.8-alpha11_0.8-alpha12_sqlite.sqldb_update_0.8-alpha12_0.8-alpha13_mysql.sqldb_update_0.8-alpha12_0.8-alpha13_postgres.sqldb_update_0.8-alpha12_0.8-alpha13_sqlite.sqldb_update_0.8-alpha1_0.8-alpha2_mysql.sqldb_update_0.8-alpha4_0.8-alpha5_mysql.sqldb_update_0.8-alpha4_0.8-alpha5_postgres.sqldb_update_0.8-alpha4_0.8-alpha5_sqlite.sqldb_update_0.8-alpha5_0.8-alpha6_mysql.sqldb_update_0.8-alpha5_0.8-alpha6_postgres.sqldb_update_0.8-alpha5_0.8-alpha6_sqlite.sqldb_update_0.8-beta3_0.8-beta4_mysql.sqldb_update_0.8-beta3_0.8-beta4_postgres.sqldb_update_0.8-beta3_0.8-beta4_sqlite.sqldb_update_0.8-beta5_0.8-beta6_mysql.sqldb_update_0.8-beta5_0.8-beta6_postgres.sqldb_update_0.8-beta5_0.8-beta6_sqlite.sqldb_update_0.9-alpha1_0.9-alpha2_mysql.sqldb_update_0.9-alpha1_0.9-alpha2_postgres.sqldb_update_0.9-alpha1_0.9-alpha2_sqlite.sqldb_update_0.9-alpha2_0.9-alpha3_mysql.sqldb_update_0.9-alpha3_0.9-alpha4_mysql.sqldb_update_0.9-alpha4_0.9-alpha5_mysql.sqldb_update_1.1-alpha1_1.1-alpha2_mysql.sqldb_update_1.1-alpha2_1.1-alpha3_mysql.sqldb_update_1.1-alpha3_1.1-alpha4_mysql.sqldb_update_1.1-alpha4_1.1-alpha5_mysql.sqldb_update_1.1-alpha4_1.1-alpha5_postgres.sqldb_update_1.1-alpha4_1.1-alpha5_sqlite.sqldb_update_1.1-alpha5_1.1-alpha6_mysql.sqldb_update_1.1-alpha5_1.1-alpha6_postgres.sqldb_update_1.1-alpha5_1.1-alpha6_sqlite.sql
templates
HOWTO
blue
carl_contest
competition
contest
default-php
default-rtl
default-xml
default
admin
atom.csscommentform.tplcommentpopup.tplcomments.tplcontent.tplentries.tplentries_archives.tplentries_summary.tplfeed_0.91.tplfeed_1.0.tplfeed_2.0.tplfeed_atom0.3.tplfeed_atom1.0.tplfeed_opml1.0.tplhtmlarea.css
img
index.tplinfo.txtplugin_calendar.tplplugin_categories.tplpreview.pngpreview_iframe.tplsidebar.tplstyle.csstrackbacks.tpl
treeview
idea
kubrick
moz-modern
mt-clean
mt-georgiablue
mt-gettysburg
mt-plainjane
mt-rusty
mt-stormy
mt-trendy
mt3-chalkboard
mt3-gettysburg
mt3-independence
mt3-squash
newspaper
wp
templates_c
uploads
wfwcomment.php

166
comment.php Normal file

@ -0,0 +1,166 @@
<?php # $Id$
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
include('serendipity_config.inc.php');
include S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
header('Content-Type: text/html; charset=' . LANG_CHARSET);
if (isset($serendipity['GET']['delete'], $serendipity['GET']['entry'], $serendipity['GET']['type'])) {
serendipity_deleteComment($serendipity['GET']['delete'], $serendipity['GET']['entry'], $serendipity['GET']['type']);
if (serendipity_isResponseClean($_SERVER['HTTP_REFERER'])) {
header('Location: '. $_SERVER['HTTP_REFERER']);
}
}
if (isset($serendipity['GET']['switch'], $serendipity['GET']['entry'])) {
serendipity_allowCommentsToggle($serendipity['GET']['entry'], $serendipity['GET']['switch']);
}
serendipity_rememberComment();
if (!($type = @$_REQUEST['type'])) {
$type = 'normal';
}
$tb_logging = false; // for developers: can be switched to true!
if ($type == 'trackback') {
if ($tb_logging) {
# PHP 4.2.2 way of doing things
ob_start();
print_r($_REQUEST);
$tmp = ob_get_contents();
ob_end_clean();
$fp = fopen('trackback2.log', 'a');
fwrite($fp, '[' . date('d.m.Y H:i') . '] RECEIVED TRACKBACK' . "\n");
fwrite($fp, '[' . date('d.m.Y H:i') . '] ' . $tmp . "\n");
}
$uri = $_SERVER['REQUEST_URI'];
if (isset($_REQUEST['entry_id'])) {
$id = (int)$_REQUEST['entry_id'];
} else if ($_REQUEST['amp;entry_id']) {
// For possible buggy variable transmission caused by an intermediate CVS-release of s9y
$id = (int)$_REQUEST['amp;entry_id'];
} else if (preg_match('@/(\d+)_[^/]*$@', $uri, $matches)) {
$id = (int)$matches[1];
}
if ($tb_logging) {
fwrite($fp, '[' . date('d.m.Y H:i') . '] Match on ' . $uri . "\n");
fwrite($fp, '[' . date('d.m.Y H:i') . '] ID: ' . $id . "\n");
fclose($fp);
}
if (add_trackback($id, $_REQUEST['title'], $_REQUEST['url'], $_REQUEST['blog_name'], $_REQUEST['excerpt'])) {
if ($tb_logging) {
$fp = fopen('trackback2.log', 'a');
fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK SUCCESS' . "\n");
}
report_trackback_success();
} else {
if ($tb_logging) {
$fp = fopen('trackback2.log', 'a');
fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK FAILURE' . "\n");
}
report_trackback_failure();
}
if ($tb_logging) {
fclose($fp);
}
} else if ($type == 'pingback') {
if (add_pingback($_REQUEST['entry_id'], $HTTP_RAW_POST_DATA)) {
report_pingback_success();
} else {
report_pingback_failure();
}
} else {
$id = (int)(!empty($serendipity['POST']['entry_id']) ? $serendipity['POST']['entry_id'] : $serendipity['GET']['entry_id']);
$serendipity['head_subtitle'] = COMMENTS;
$serendipity['smarty_file'] = 'commentpopup.tpl';
serendipity_smarty_init();
if ($id == 0) {
return false;
} else {
$serendipity['smarty']->assign('entry_id', $id);
}
if (isset($_GET['success']) && $_GET['success'] == 'true') {
$serendipity['smarty']->assign(
array(
'is_comment_added' => true,
'comment_url' => htmlspecialchars($_GET['url']) . '&amp;serendipity[entry_id]=' . $id,
'comment_string' => explode('%s', COMMENT_ADDED_CLICK)
)
);
} else if (!isset($serendipity['POST']['submit'])) {
if ($serendipity['GET']['type'] == 'trackbacks') {
$query = "SELECT title, timestamp FROM {$serendipity['dbPrefix']}entries WHERE id = '". $id ."'";
$entry = serendipity_db_query($query);
$entry = serendipity_archiveURL($id, $entry[0]['title'], 'baseURL', true, array('timestamp' => $entry[0]['timestamp']));
$serendipity['smarty']->assign(
array(
'is_showtrackbacks' => true,
'comment_url' => $serendipity['baseURL'] . 'comment.php?type=trackback&amp;entry_id=' . $id,
'comment_entryurl' => $entry
)
);
} else {
$query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $id . "'";
$ca = serendipity_db_query($query, true);
$comment_allowed = serendipity_db_bool($ca['allow_comments']) || !is_array($ca) ? true : false;
$serendipity['smarty']->assign(
array(
'is_showcomments' => true,
'is_comment_allowed' => $comment_allowed
)
);
if ($comment_allowed) {
serendipity_displayCommentForm($id, '?', NULL, $serendipity['POST'], true, serendipity_db_bool($ca['moderate_comments']), $ca);
}
}
} else {
$comment['url'] = $serendipity['POST']['url'];
$comment['comment'] = trim($serendipity['POST']['comment']);
$comment['name'] = $serendipity['POST']['name'];
$comment['email'] = $serendipity['POST']['email'];
$comment['subscribe'] = $serendipity['POST']['subscribe'];
$comment['parent_id'] = $serendipity['POST']['replyTo'];
if (!empty($comment['comment'])) {
if (serendipity_saveComment($id, $comment, 'NORMAL')) {
$sc_url = $serendipity['baseURL'] . 'comment.php?serendipity[entry_id]=' . $id . '&success=true&url=' . urlencode($_SERVER['HTTP_REFERER']);
if (serendipity_isResponseClean($sc_url)) {
header('Location: ' . $sc_url);
}
exit;
} else {
$serendipity['smarty']->assign(
array(
'is_comment_notadded' => true,
'comment_url' => htmlspecialchars($_SERVER['HTTP_REFERER']),
'comment_string' => explode('%s', COMMENT_NOT_ADDED_CLICK)
)
);
}
} else {
$serendipity['smarty']->assign(
array(
'is_comment_empty' => true,
'comment_url' => htmlspecialchars($_SERVER['HTTP_REFERER']),
'comment_string' => explode('%s', EMPTY_COMMENT)
)
);
}
}
$serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath'));
}
/* vim: set sts=4 ts=4 expandtab : */
?>