1
kikov
Re: XMLRPC
  • 2004/6/10 17:02

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


I wanted to know if a Xoop developer plan to submit this to the CVS.
Anyway, I can prepare a patch, but since it's so easy...

Thx
BR




2
kikov
Re: XMLRPC
  • 2004/6/7 2:28

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Hi...

I have get it working with the following code in bloggerapi.php
function getUserInfo()
    {
        if (!
$this->_checkUser($this->params[1], $this->params[2])) {
            
$this->response->add(new XoopsXmlRpcFault(104));
        } else {
            
$arr = new XoopsXmlRpcArray();
            
$struct = new XoopsXmlRpcStruct();
            
$struct->add('nickname', new XoopsXmlRpcString($this->user->getVar('uname')));
            
$struct->add('userid', new XoopsXmlRpcString($this->user->getVar('uid')));
            
$struct->add('url', new XoopsXmlRpcString($this->user->getVar('url')));
            
$struct->add('email', new XoopsXmlRpcString($this->user->getVar('email')));
            
$struct->add('lastname', new XoopsXmlRpcString($this->user->getVar('')));
            
$struct->add('firstname', new XoopsXmlRpcString($this->user->getVar('name')));
            
$arr->add($struct);
            
$this->response->add($arr);
        }
    }

So if you think it's correct, and you can verify that it work with another clients in this way... this should be in the CVS ;)

Thx, and CU!



3
kikov
XMLRPC
  • 2004/6/7 1:50

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Hi!

I'm trying to develop a XMLRPC client for Xoops. Now I'm testing the BloggerApi Interface.

I have studying the code on the xmlrpc.php file and the class/xml/rpc/* files.
In special the *tag.php file and the bloggerapi file.
I don't get any response to the blogger.getUserInfo message.

Please, correct my thoughs:
I think that this is the behaviour of the XmlRPC system of Xoops.
1) First xmlrpc.php file is called.
2) mainfile.php is called in RPC mode ( I think this will prevent from loading headers and so... )
3) parser and tag clases are loaded
4) we choose the xmlrpc API with the first part of "method". My client is using blogger.getUserInfo, so it's blogger.
Quote:

case 'blogger':
include_once XOOPS_ROOT_PATH.'/class/xml/rpc/bloggerapi.php';
$rpc_api = new BloggerApi($parser->getParam(), $response, $module);


As we can see in the code, bloggerapi.php class is loaded, and rpc_api is filled with the class to proccess the thing.

Previously, the $response variable has been initialized with a new XoopsXmlRpcResponse object.

Then, $rpc_api->$method() is called ( $method is extracted from Methods[] array, that should contain getUserInfo... I have seen that is correct, with a dump ).

Then the render is called, and besides headers, the result is printed.

My client make a dump of everything that xmlrpc prints ( xml or plain text, whatever... )

Well.. playing with "echo" I can see how the getUserInfo from bloggerapi.php is called. The xmlRpcStruct is filled, and datas are extracted correctly from Db.

But, render function seems to not be called ( neither RpcDocument, nor RcpResponse ).

And besides that, no "echo" could be seen after the call of $rpc_api->$method().

What's wrong?

Thx for hearing me.



4
kikov
BloGTK and Xoops 2.0.x
  • 2004/5/17 1:09

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Hi!

I'm trying to use BloGTK (http://blogtk.sf.net ) to post news in XOOPS with the /xmlrpc.php interface.

I obtain strange XMLRPC errors. I can choose the kind of server: { Moveable, Blogger or MetaWeblog }.

If I choose Moveable I can see my Topics in the BloGTK program. But I can't post with any of the kind.

Anybody got it works?

Thx
BR



5
kikov
Re: [ code ] tags and URL
  • 2004/5/13 13:04

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Thx a lot...
Do you know if the version in CVS is fixed?



6
kikov
Re: [ code ] tags and URL
  • 2004/5/13 12:18

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Well...

Let see. The example is clear enough to see the problem

[ c o d e ]
Visit my page:https://xoops.org
I have written a URL, without tags... just this ( without spaces )
Visit my page: h t t p : / / w w w . x o o p s . o r g

[ / c o d e ]

What I get, it's a wrong thing

Visit my pagehttps://xoops.org



7
kikov
Re: [ code ] tags and URL
  • 2004/5/13 12:05

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Not.. see the First Message example...
IT APPEARS the < a ... > tag



8
kikov
Re: [ code ] tags and URL
  • 2004/5/13 12:01

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


By the way, I have tried disabling Enable HTML Box



9
kikov
[ code ] tags and URL
  • 2004/5/13 11:59

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Hi

Recently I was having a problem with [ code ] blocks...
I think it can be a bug, because the automatic translation into URL break things... an example

Hivisit https://xoops.org


Any solution to this?
I don't want to see the HTML tags there...I think it's a bug...

By the way, I'm using XOOPS 2.0.6 and here it seems to do the same.

BR.



10
kikov
Re: Automatic Email Interface for NEWS Insertion
  • 2003/11/3 0:52

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


It's a lot dirty!!!

But, it's only an idea...
--------------
just put this in the /etc/aliases file:
Quote:

xoops: "|/bin/parser"


parser.c file
-------------
Quote:

#include <stdio.h>

int main(void)
{
char mycad[1024];
char total[10000];
char *pos;
char XoopUser[1024], XoopPasswd[1024], XoopTitle[1024], XoopMessage[10000], XoopTopic[1024];
printf("Received parameters:\n");
while ( !feof(stdin) )
{
fscanf(stdin,"%[^\n]", mycad );
fgetc(stdin);
if ( strstr ( mycad, "XoopUser:" ) )
{
strcpy (XoopUser, strstr ( mycad, ":" ) + 1);
printf("->XoopUser:%s\n",XoopUser);
}
if ( strstr ( mycad, "XoopPasswd:" ) )
{
strcpy (XoopPasswd, strstr ( mycad, ":" ) + 1);
printf("->XoopPasswd:%s\n",XoopPasswd);
}
if ( strstr ( mycad, "XoopTitle:" ) )
{
strcpy (XoopTitle, strstr ( mycad, ":" ) + 1);
printf("->XoopTitle:%s\n",XoopTitle);
}
if ( strstr ( mycad, "XoopMessage:" ))
{
strcpy (XoopMessage, strstr ( mycad, ":" )+1);
printf("->XoopMessage:%s\n",XoopMessage);
}
if ( strstr ( mycad, "XoopTopic:" ) )
{
strcpy (XoopTopic, strstr ( mycad, ":" ) +1);
printf("->XoopTopic:%s\n",XoopTopic);
}
mycad[0]=0;
}
sprintf( total, "/usr/bin/php4 /usr/share/xoops/post_xoops %s %s %s %s %s", XoopUser, XoopPasswd, XoopTitle,
XoopMessage, XoopTopic, NULL );
printf("Executing %s\n", total);
system ( total );
return 0;
}

-----
Just compile it with gcc parser.c -o parser
Copy it to /bin ( or if your prefer /usr/local/bin and remember to change the path in the aliases file )

and at last... the post_xoops.php file ( it's dirty, dirty dirty... if some hacker from XOOPS could clean it... please!! ). Copy it to /usr/share/xoops/post_xoops
---------------
Quote:

<?php
$myargsKikoV=$GLOBALS['argv'];
$HTTP_SERVER_VARS['REQUEST_METHOD'] ='POST';
$HTTP_SERVER_VARS['HTTP_REFERER'] = 'http://your.url.org/modules/news/submit.php';
$nohtml = 1;
include '/path/to/xoops/mainfile.php';
include_once '/path/to/xoops/modules/news/class/class.newsstory.php';

$module_handler =& xoops_gethandler('module');
$xoopsModule =& $module_handler->getByDirname('news');
$nohtml_db = 1;
$xoopsModuleConfig =& $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid'));
echo "\n";
if (count ($myargsKikoV ) < 5)
{
echo "Usage: php4 ".$myargsKikoV[0]." UserName Password Title Message [Topic]\n";
exit(0);
}
$param_username=$myargsKikoV[1];
$param_password=$myargsKikoV[2];
$param_title=$myargsKikoV[3];
$param_message=$myargsKikoV[4];

if ( count($myargsKikoV) >= 6 )
{
$param_topic=$myargsKikoV[5];
$sql = 'SELECT topic_id FROM '. $xoopsDB->prefix("topics")." WHERE topic_title='".$param_topic."'";
$result = $xoopsDB->query('SELECT topic_id FROM '. $xoopsDB->prefix("topics")." WHERE topic_title='".$param_topic."'");
$topic = array();
$myts =& MyTextSanitizer::getInstance();
while ($myrow = $xoopsDB->fetchArray($result)) {
$topic_id= $myrow['topic_id'];
}
}
$member_handler =& xoops_gethandler('member');
$myts =& MyTextsanitizer::getInstance();
$user =& $member_handler->loginUser(addslashes($myts->stripSlashesGPC($param_username)), addslashes($myts->stripSlashesGPC($param_password)));
if ( ! $user )
{
echo "Login problem\n";
exit(1);
}
$luid=$user->getVar('uid');
$xoopsUser =& $member_handler->getUser($luid);
if ( $xoopsUser ) {
$uid = $xoopsUser->getVar('uid');
if ( $xoopsUser->isAdmin($xoopsModule->mid()) ) {
$nohtml_db = empty($nohtml) ? 0 : 1;
}
} else {
echo "xoopsModuleConfig:".$xoopsModuleConfig['anonpost'];
if ( $xoopsModuleConfig['anonpost'] == 1 ) {
$uid = 0;
} else {
redirect_header("index.php",3,_NOPERM);
exit();
}
}
$story = new NewsStory();
$story->setTitle($param_title);
$story->setHometext($param_message);
$story->setUid($uid['value']);
$story->setTopicId($topic_id);
$story->setHostname(xoops_getenv('REMOTE_ADDR'));
$story->setNohtml($nohtml_db);
$nosmiley = isset($nosmiley) ? intval($nosmiley) : 0;
$notifypub = isset($notifypub) ? intval($notifypub) : 0;
$story->setNosmiley($nosmiley);
$story->setNotifyPub($notifypub);
$story->setType('user');
if ( $xoopsModuleConfig['autoapprove'] == 1 ) {
$approve = 1;
$story->setApproved($approve);
$story->setPublished(time());
$story->setExpired(0);
$story->setTopicalign('R');
}
$result = $story->store();

?>


How it works?

It's quite simple...
When you send a message to xoops@your.host.org, it's passed through a filter ( parser.c ) that parse the email seeking the values.

For example:
Quote:

XoopUser:myuser
XoopPasswd:mypasswd
XoopTitle:This.is.my.news.sent.by.email
XoopMessage:Hi!This.is.my.first.NEWS.sent.by.email.
XoopTopic:Xoops



Then, the values are passed as argument to the php file, that call the functions of XOOPS to add a NEWS.

The stream is:
Email (Evolution,KMail,Outlook) -> MailServer -> Parser -> PostXoops -> Xoops

Yes, I know I have to fix the spaces thing... And let the XoopMessage be more than a line. But this is only a first version to know that it's possible... ( I made everything in just two hours.. )

Comments are welcome!

Thx and greeting




TopTop
(1) 2 »



Login

Who's Online

237 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 237


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits