11
kikov
Re: Automatic Email Interface for NEWS Insertion
  • 2003/10/22 11:13

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


I finally got this...
The filter to parse a email, and the post_news.php command-line script to put something into the DB.

If somebody wanna the code I have it here...

BR



12
kikov
Re: Automatic Email Interface for NEWS Insertion
  • 2003/10/20 14:57

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


Well...

My first idea is making a PHP script to call the Submit code from the shell...
Quote:

include '/www/docs/os4os.org/mainfile.php';
include_once '/www/docs/os4os.org/modules/news/class/class.newsstory.php';

$module_handler =& xoops_gethandler('module');
$xoopsModule =& $module_handler->getByDirname('news');
$nohtml_db = 1;
echo "XoopsUser:".$xoopsUser."\n";
echo "xoopsModule:".$xoopsModule."\n";
var_dump($xoopsModule);
if ( $xoopsUser ) {
$uid = $xoopsUser->getVar('1');
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();
}
}
echo "Antes de NEWSSTORY";
$story = new NewsStory();
$story->setTitle("Probando");
$story->setHometext("Mensaje");
$story->setUid(1);
$story->setTopicId(1);
$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();

Now, I'm trying to modify this code to be executable from command line... I have to put some vars before including mainfile such as an unreal URL. xoopsModuleConfig doesn't work at the moment.

I have to improve the users managemente :)... just parametrizing it... but at the moment I only want to test if I am able to post a NEWS from shell... The rest is easy...

A filter in the mbox of the xoops@localhost.org user, that parse a text ( simple commands and so ) and then, call the php with their parameters: FROM_USER, NEWS, TOPIC, and so...

BR.




13
kikov
Automatic Email Interface for NEWS Insertion
  • 2003/10/20 13:53

  • kikov

  • Just popping in

  • Posts: 13

  • Since: 2003/10/2


I am interesting in developing an email interface to insert data into Xoops. (NEWS).
I want to know if it's done so I don't duplicate code.
If it's, I want to know where can I find information about it.

I am talking about an interface to do something like this:

------ Header of the email ------
to: xoops_engine@site.org
from: user@mysite.org
----- Content of the email -----
passwd: xxxxxxxx
type: NEWS
action: add
section: general
title: A NEWS posted by email
content: Hi!, This is my NEWS!
----------------------------------

And when the message is received in the site.org, it is automatically proccessed and a new NEWS is set into the page.

Thx for paying attention
BR.




TopTop
« 1 (2)



Login

Who's Online

165 user(s) are online (100 user(s) are browsing Support Forums)


Members: 0


Guests: 165


more...

Donat-O-Meter

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

Latest GitHub Commits