diff --git a/serendipity_event_xmlrpc/UTF-8/lang_de.inc.php b/serendipity_event_xmlrpc/UTF-8/lang_de.inc.php index 3c7f981a..c2dfc353 100644 --- a/serendipity_event_xmlrpc/UTF-8/lang_de.inc.php +++ b/serendipity_event_xmlrpc/UTF-8/lang_de.inc.php @@ -16,3 +16,5 @@ @define('PLUGIN_EVENT_XMLRPC_WPFAKEVERSION', 'WordPress Version vortäuschen'); @define('PLUGIN_EVENT_XMLRPC_WPFAKEVERSION_DESC', 'Die XML-RPC Schnittlstelle kann auf WordPress Aufrufe reagieren. Wenn sie nach der installierten Software Version gefragt wird, antwortet sie normaler Weise mit Serendipity ' . $serendipity['version'] .'. Wenn Du hier eine Version einträgst, dann wird sie mit WordPress (angegebene Version) antworten. Einige Clients könnten auf eine minimale WordPress Version testen, eine Version wie 3.2 erscheint dann okay.'); +@define('PLUGIN_EVENT_XMLRPC_HTMLCONVERT', 'Text Artikel nach HTML konvertieren'); +@define('PLUGIN_EVENT_XMLRPC_HTMLCONVERT_DESC', 'Das Plugin versucht zu erkennen, ob Artikel als reine Texte oder als HTML übermittelt werden. Bei reinem Text wird es Zeilenumbrüche in HTML umwandeln. Wenn Du z.B: ein Textile oder das NL2BR Plugin für Artikel benutzt, solltest Du diese Option ausschalten.'); \ No newline at end of file diff --git a/serendipity_event_xmlrpc/lang_de.inc.php b/serendipity_event_xmlrpc/lang_de.inc.php index d7da1f54..535075f1 100644 --- a/serendipity_event_xmlrpc/lang_de.inc.php +++ b/serendipity_event_xmlrpc/lang_de.inc.php @@ -16,3 +16,5 @@ @define('PLUGIN_EVENT_XMLRPC_WPFAKEVERSION', 'WordPress Version vortäuschen'); @define('PLUGIN_EVENT_XMLRPC_WPFAKEVERSION_DESC', 'Die XML-RPC Schnittlstelle kann auf WordPress Aufrufe reagieren. Wenn sie nach der installierten Software Version gefragt wird, antwortet sie normaler Weise mit Serendipity ' . $serendipity['version'] .'. Wenn Du hier eine Version einträgst, dann wird sie mit WordPress (angegebene Version) antworten. Einige Clients könnten auf eine minimale WordPress Version testen, eine Version wie 3.2 erscheint dann okay.'); +@define('PLUGIN_EVENT_XMLRPC_HTMLCONVERT', 'Text Artikel nach HTML konvertieren'); +@define('PLUGIN_EVENT_XMLRPC_HTMLCONVERT_DESC', 'Das Plugin versucht zu erkennen, ob Artikel als reine Texte oder als HTML übermittelt werden. Bei reinem Text wird es Zeilenumbrüche in HTML umwandeln. Wenn Du z.B: ein Textile oder das NL2BR Plugin für Artikel benutzt, solltest Du diese Option ausschalten.'); \ No newline at end of file diff --git a/serendipity_event_xmlrpc/lang_en.inc.php b/serendipity_event_xmlrpc/lang_en.inc.php index 9ec7e9c9..5ce20fcd 100644 --- a/serendipity_event_xmlrpc/lang_en.inc.php +++ b/serendipity_event_xmlrpc/lang_en.inc.php @@ -22,3 +22,5 @@ @define('PLUGIN_EVENT_XMLRPC_WPFAKEVERSION', 'Fake WordPress version'); @define('PLUGIN_EVENT_XMLRPC_WPFAKEVERSION_DESC', 'This XML-RPC interface is able to respond to WordPress type calls. Normally, if asked for the software used, it answers with Serendipity ' . $serendipity['version'] .'. But if you enter a version here, it will response as WordPress (version entered). Some clients might check, if the WP version is high enough, so a version like 3.2 would be okay here.'); +@define('PLUGIN_EVENT_XMLRPC_HTMLCONVERT', 'Convert plaintext articles to HTML'); +@define('PLUGIN_EVENT_XMLRPC_HTMLCONVERT_DESC', 'The plugin tries to detect plain text delivered as article body and if detected converts its linefeeds to HTML. If you use plugins like the textile or nl2br textformats for articles you should disable this.'); \ No newline at end of file diff --git a/serendipity_event_xmlrpc/serendipity_event_xmlrpc.php b/serendipity_event_xmlrpc/serendipity_event_xmlrpc.php index 3160196b..4f026151 100644 --- a/serendipity_event_xmlrpc/serendipity_event_xmlrpc.php +++ b/serendipity_event_xmlrpc/serendipity_event_xmlrpc.php @@ -36,7 +36,7 @@ class serendipity_event_xmlrpc extends serendipity_event 'frontend_header' => true )); $propbag->add('configuration', - array('doc_rpclink','category', 'gmt', 'debuglog', 'wpfakeversion') + array('doc_rpclink','category', 'gmt', 'htmlconvert', 'wpfakeversion', 'debuglog') ); $propbag->add('groups', array('FRONTEND_FULL_MODS', 'FRONTEND_EXTERNAL_SERVICES')); } @@ -92,7 +92,12 @@ class serendipity_event_xmlrpc extends serendipity_event $propbag->add('description', ''); $propbag->add('default', false); break; - + case 'htmlconvert': + $propbag->add('type', 'boolean'); + $propbag->add('name', PLUGIN_EVENT_XMLRPC_HTMLCONVERT); + $propbag->add('description', PLUGIN_EVENT_XMLRPC_HTMLCONVERT_DESC); + $propbag->add('default', true); + break; case 'wpfakeversion' : $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_EVENT_XMLRPC_WPFAKEVERSION); @@ -164,6 +169,7 @@ class serendipity_event_xmlrpc extends serendipity_event $serendipity['xmlrpc_default_category'] = $this->get_config('category'); $serendipity['xmlrpc_debuglog'] = $this->get_config('debuglog','none'); $serendipity['xmlrpc_wpfakeversion'] = $this->get_config('wpfakeversion',''); + $serendipity['xmlrpc_htmlconvert'] = $this->get_config('htmlconvert',true); @define('SERENDIPITY_IS_XMLRPC', true); $serendipity['XMLRPC_GMT'] = serendipity_db_bool($this->get_config('gmt')); diff --git a/serendipity_event_xmlrpc/serendipity_xmlrpc.inc.php b/serendipity_event_xmlrpc/serendipity_xmlrpc.inc.php index b073fb4b..6d1195de 100644 --- a/serendipity_event_xmlrpc/serendipity_xmlrpc.inc.php +++ b/serendipity_event_xmlrpc/serendipity_xmlrpc.inc.php @@ -938,8 +938,10 @@ function metaWeblog_newPost($message) { $serendipity['POST']['properties']['microblogging_tagList'] = $post_array['mt_keywords']; } - if (isset($post_array['dateCreated'])) { - $entry['timestamp'] = XML_RPC_iso8601_decode($post_array['dateCreated'],($post_array['dateCreated']{strlen($post_array['dateCreated'])-1} == "Z")); + if (isset($post_array['dateCreated']) || isset($post_array['date_created_gmt'])) { + if (isset($post_array['date_created_gmt'])) $timestamp = XML_RPC_iso8601_decode($post_array['date_created_gmt'],1); + else $timestamp = XML_RPC_iso8601_decode($post_array['dateCreated'], ($post_array['dateCreated']{strlen($post_array['dateCreated'])-1} == "Z")); + $entry['timestamp'] = $timestamp; } ob_start(); @@ -954,8 +956,8 @@ function metaWeblog_newPost($message) { $id = universal_updertEntry($entry); // Apply password has to be after serendipity_updertEntry, else it will override it empty! - universal_save_entrypassword($id, $post_array['wp_password']); - + universal_save_entrypassword($postid, isset($post_array['wp_password'])?$post_array['wp_password']:null); + if ($id) { if (!$entry['id']) { $entry['id']=$id; @@ -1031,8 +1033,11 @@ function metaWeblog_editPost($message) { $post_array = $val->getval(); } - $val = $message->params[4]; - $publish = $val->getval(); + $publish = 0; + if (count($message->params)>4) { // Some clients don't even send this! + $val = $message->params[4]; + $publish = $val->getval(); + } if (XMLRPC_WP_COMPATIBLE) { if ($post_array['post_status'] == 'draft') $publish = 0; else if ($post_array['post_status'] == 'publish') $publish = 1; @@ -1065,9 +1070,10 @@ function metaWeblog_editPost($message) { $old_geo_lat = $entry_properties['geo_lat']; } - if (isset($post_array['dateCreated'])) { - $entry['timestamp'] = XML_RPC_iso8601_decode($post_array['dateCreated'], ($post_array['dateCreated']{strlen($post_array['dateCreated'])-1} == "Z")); - universal_debug("Handed date created: " . $post_array['dateCreated']); + if (isset($post_array['dateCreated']) || isset($post_array['date_created_gmt'])) { + if (isset($post_array['date_created_gmt'])) $timestamp = XML_RPC_iso8601_decode($post_array['date_created_gmt'],1); + else $timestamp = XML_RPC_iso8601_decode($post_array['dateCreated'], ($post_array['dateCreated']{strlen($post_array['dateCreated'])-1} == "Z")); + $entry['timestamp'] = $timestamp; } else { // Get the original date, if no new date was defined $oldEntry = serendipity_fetchEntry('id', $postid, true, 'true'); @@ -1082,7 +1088,7 @@ function metaWeblog_editPost($message) { } // Apply password has to be after serendipity_updertEntry, else it will override it empty! - universal_save_entrypassword($postid, $post_array['wp_password']); + universal_save_entrypassword($postid, isset($post_array['wp_password'])?$post_array['wp_password']:null); //if plugins want to manage it, let's instantiate all non managed meta @@ -1480,6 +1486,8 @@ function universal_debug($message) { */ function universal_autohtml(&$text) { if (empty($text)) return $text; + $text = trim($text); + if (!serendipity_db_bool($serendipity['xmlrpc_htmlconvert'])) return $text; // if no p or br formatting is found, add it. if (!preg_match('@@Usi', $text) && !preg_match('@

@Usi', $text) && !preg_match('@
@Usi', $text)) { $text = nl2p($text);