[pLog-svn] r658 - in plog/trunk: . class/net/xmlrpc
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Jan 4 01:14:15 GMT 2005
Author: oscar
Date: 2005-01-04 01:14:14 +0000 (Tue, 04 Jan 2005)
New Revision: 658
Modified:
plog/trunk/class/net/xmlrpc/IXR_Library.lib.php
plog/trunk/xmlrpc.php
Log:
upgraded the version of the xmlrpc library and fixes the issue with post dates
Modified: plog/trunk/class/net/xmlrpc/IXR_Library.lib.php
===================================================================
--- plog/trunk/class/net/xmlrpc/IXR_Library.lib.php 2005-01-03 21:08:29 UTC (rev 657)
+++ plog/trunk/class/net/xmlrpc/IXR_Library.lib.php 2005-01-04 01:14:14 UTC (rev 658)
@@ -1,23 +1,18 @@
<?php
-include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
+/*
+ IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
+ Version 1.61 - Simon Willison, 11th July 2003 (htmlentities -> htmlspecialchars)
+ Site: http://scripts.incutio.com/xmlrpc/
+ Manual: http://scripts.incutio.com/xmlrpc/manual.php
+ Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
+*/
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Value extends Object {
+class IXR_Value {
var $data;
var $type;
function IXR_Value ($data, $type = false) {
- $this->Object();
$this->data = $data;
if (!$type) {
$type = $this->calculateType();
@@ -81,15 +76,7 @@
return '<double>'.$this->data.'</double>';
break;
case 'string':
- $val = $this->data;
- // -mhe encoding modified
- $val = str_replace('&', '&', $val);
- $val = str_replace("'", ''', $val);
- $val = str_replace('"', '"', $val);
- $val = str_replace('<', '<', $val);
- $val = str_replace('>', '>', $val);
- return '<string>'.$val.'</string>';
- // return '<string>'.htmlentities($this->data).'</string>';
+ return '<string>'.htmlspecialchars($this->data).'</string>';
break;
case 'array':
$return = '<array><data>'."\n";
@@ -129,17 +116,7 @@
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Message extends Object {
+class IXR_Message {
var $message;
var $messageType; // methodCall / methodResponse / fault
var $faultCode;
@@ -157,7 +134,6 @@
// The XML parser
var $_parser;
function IXR_Message ($message) {
- $this->Object();
$this->message = $message;
}
function parse() {
@@ -224,7 +200,7 @@
$valueFlag = true;
break;
case 'string':
- $value = (string)$this->_currentTagContents;
+ $value = (string)trim($this->_currentTagContents);
$this->_currentTagContents = '';
$valueFlag = true;
break;
@@ -272,9 +248,11 @@
break;
}
if ($valueFlag) {
- if (!is_array($value)) {
+ /*
+ if (!is_array($value) && !is_object($value)) {
$value = trim($value);
}
+ */
if (count($this->_arraystructs) > 0) {
// Add value to struct or array
if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') {
@@ -293,26 +271,13 @@
}
-
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Server extends Object {
+class IXR_Server {
var $data;
var $callbacks = array();
var $message;
var $capabilities;
- var $defencoding = "ISO-8859-1"; // -mhe added defencoding
-
+ var $defencoding = 'iso-8859-1';
function IXR_Server($callbacks = false, $data = false) {
- $this->Object();
$this->setCapabilities();
if ($callbacks) {
$this->callbacks = $callbacks;
@@ -397,8 +362,7 @@
$this->output($error->getXml());
}
function output($xml) {
- // -mhe added defencoding for xml header
- $xml = '<?xml version="1.0" encoding="' . $this->defencoding . '"?>'."\n".$xml;
+ $xml = '<?xml version="1.0" encoding="'.$this->defencoding.'"?>'."\n".$xml;
$length = strlen($xml);
header('Connection: close');
header('Content-Length: '.$length);
@@ -464,22 +428,11 @@
}
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Request extends Object {
+class IXR_Request {
var $method;
var $args;
var $xml;
function IXR_Request($method, $args) {
- $this->Object();
$this->method = $method;
$this->args = $args;
$this->xml = <<<EOD
@@ -506,17 +459,7 @@
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Client extends Object {
+class IXR_Client {
var $server;
var $port;
var $path;
@@ -527,7 +470,6 @@
// Storage place for an error message
var $error = false;
function IXR_Client($server, $path = false, $port = 80) {
- $this->Object();
if (!$path) {
// Assume we have been given a URL instead
$bits = parse_url($server);
@@ -560,9 +502,9 @@
$request .= $xml;
// Now send the request
if ($this->debug) {
- echo '<pre>'.htmlentities($request)."\n</pre>\n\n";
+ echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n";
}
- $fp = fsockopen($this->server, $this->port);
+ $fp = @fsockopen($this->server, $this->port);
if (!$fp) {
$this->error = new IXR_Error(-32300, 'transport error - could not open socket');
return false;
@@ -589,7 +531,7 @@
}
}
if ($this->debug) {
- echo '<pre>'.htmlentities($contents)."\n</pre>\n\n";
+ echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n";
}
// Now parse what we've got back
$this->message = new IXR_Message($contents);
@@ -622,21 +564,10 @@
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Error extends Object {
+class IXR_Error {
var $code;
var $message;
function IXR_Error($code, $message) {
- $this->Object();
$this->code = $code;
$this->message = $message;
}
@@ -665,17 +596,7 @@
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Date extends Object {
+class IXR_Date {
var $year;
var $month;
var $day;
@@ -683,16 +604,15 @@
var $minute;
var $second;
function IXR_Date($time) {
- $this->Object();
// $time can be a PHP timestamp or an ISO one
- if (is_int($time) == $time) {
+ if (is_numeric($time)) {
$this->parseTimestamp($time);
} else {
$this->parseIso($time);
}
}
function parseTimestamp($timestamp) {
- // -mhe corrected bug with 'Y''Y''Y' to 'Y''m''d'
+ // bug corrected here
$this->year = date('Y', $timestamp);
$this->month = date('m', $timestamp);
$this->day = date('d', $timestamp);
@@ -720,20 +640,9 @@
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
-class IXR_Base64 extends Object {
+class IXR_Base64 {
var $data;
function IXR_Base64($data) {
- $this->Object();
$this->data = $data;
}
function getXml() {
@@ -742,16 +651,6 @@
}
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
class IXR_IntrospectionServer extends IXR_Server {
var $signatures;
var $help;
@@ -897,17 +796,6 @@
}
-
-/**
- * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002
- * Beta 1.5 - Simon Willison, September 4th 2002
- * Site: http://scripts.incutio.com/xmlrpc/
- * Manual: http://scripts.incutio.com/xmlrpc/manual.php
- * Forum: http://forums.incutio.com/viewforum.php?forum=ixr
- * Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php
- *
- * Modified by Oscar 05-06-2003 to make it inherit from the Object object
- */
class IXR_ClientMulticall extends IXR_Client {
var $calls = array();
function IXR_ClientMulticall($server, $path = false, $port = 80) {
@@ -929,6 +817,4 @@
}
}
-
-
-?>
+?>
\ No newline at end of file
Modified: plog/trunk/xmlrpc.php
===================================================================
--- plog/trunk/xmlrpc.php 2005-01-03 21:08:29 UTC (rev 657)
+++ plog/trunk/xmlrpc.php 2005-01-04 01:14:14 UTC (rev 658)
@@ -135,11 +135,11 @@
function metaWeblogNewPost($args)
{
global $users, $articles, $category;
- $blogid = $args[0];
- $username = $args[1];
- $password = $args[2];
- $content = $args[3];
- $publish = $args[4]; // true post&publish | false post only
+ $blogid = $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $content = $args[3];
+ $publish = $args[4]; // true post&publish | false post only
/*
int postid
*/
@@ -170,7 +170,7 @@
// break;
//}
- $title = $content["title"];
+ $title = $content["title"];
$body = $content["description"];
$catList = $content["categories"];
$categoryName = NULL;
@@ -215,17 +215,19 @@
// that does not have a type or anyhting, but it still is an object... kinda weird. Anyway,
// clients like ecto do not allow to change the time an article is posted so this is not
// too annoying, *yet*
- /* if (!empty($dateCreated))
+ if (!empty($dateCreated))
{
// Convert the UTC time to local time, since articleDate is in local time
- $ar = localtime ( $dateCreated->getTimestamp() );
$ar[5] += 1900; $ar[4]++;
$localTimeStamp = gmmktime ( $ar[2], $ar[1], $ar[0], $ar[4], $ar[3], $ar[5], $ar[8] );
+ $ar = localtime ( $dateCreated->getTimestamp() );
+ $ar[5] += 1900; $ar[4]++;
+ $localTimeStamp = gmmktime ( $ar[2], $ar[1], $ar[0], $ar[4], $ar[3], $ar[5], $ar[8] );
$articleDate = date("YmdHis", $localTimeStamp);
} else
{
$articleDate = date("YmdHis");
}
- $article->setDate($articleDate);*/
+ $article->setDate($articleDate);
$postid = $articles->addArticle($article);
if ($postid != 0)
{
@@ -244,9 +246,9 @@
function metaWeblogGetCategories($args)
{
global $users, $category, $blogsG;
- $blogid = $args[0];
- $username = $args[1];
- $password = $args[2];
+ $blogid = $args[0];
+ $username = $args[1];
+ $password = $args[2];
/*
"description" =>
"htmlUrl" =>
@@ -330,7 +332,7 @@
global $users, $articles;
$postid = $args[0];
$username = $args[1];
- $password = $args[2];
+ $password = $args[2];
/*
"userid" =>
@@ -363,7 +365,7 @@
$dummy["userid"] = $item->_userInfo->_id;
$dummy["dateCreated"] = new IXR_Date($time);
$dummy["title"] = $item->_topic;
- $dummy["description"] = $item->_text;
+ $dummy["description"] = $item->_text;
$dummy["postid"] = $item->_id;
$dummy["link"] = $url->postLink( $item );
@@ -434,11 +436,11 @@
{
global $users, $articles, $category;
- $postid = $args[0];
- $username = $args[1];
- $password = $args[2];
- $content = $args[3];
- $publish = $args[4];
+ $postid = $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $content = $args[3];
+ $publish = $args[4];
/*
boolean, true or false
@@ -455,7 +457,7 @@
$status = POST_STATUS_DRAFT;
}
- $title = $content["title"];
+ $title = $content["title"];
$body = $content["description"];
$article = $articles->getUserArticle($postid);
@@ -625,7 +627,7 @@
$dummy["userid"] = $item->_userInfo->_id;
$dummy["dateCreated"] = new IXR_Date($time);
$dummy["title"] = $item->_topic;
- $dummy["description"] = $item->_text;
+ $dummy["description"] = $item->_text;
$dummy["postid"] = $item->_id;
$blogId = $item->getBlog();
More information about the pLog-svn
mailing list