Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2024-07-09 15:44:32

etc
Developer
Registered: 2010-11-11
Posts: 5,701
Website GitHub

Re: etc_post: post anything from the public side

Saving published articles looks a bit inconsistent: event="article" step="edit". But you also need to append at least two (hidden?) inputs to your form or the plugin: ID=## and save=something. Probably some other article fields are mandatory, I’m not sure. Try saving some article on the admin side and inspecting the request in the browsers console to see what is typically sent by txp.

Offline

#32 Today 14:35:07

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 312
Website GitHub Twitter

Re: etc_post: post anything from the public side

Hello, is this plugin still working in Textpattern 4.9.1? I updated recently an installation from 4.8.8 to 4.9.1, where a autoposting plugin was relying on etc_post.

I called in this plugin something like that.

$title = "test";	
$body	=	"This is a test.";
$excerpt =	"This is an excerpt.";
$keywords = "Test, Test2";
etc_post(
                array(
                      'user'  => 'newsrobot',
                      'event' => 'article',
                      'step' => 'save',
                ),
                '{"Title":"'. $title .'",
                      "Body":"'. $body .'",
                      "Excerpt":"'. $excerpt .'",
                      "Section":"autonews",
                      "Category1":"newsrobot",
                      "Status":"4",
                      "publish_now":"1",
                      "Keywords":"'. $keywords .'"
               }'
);

and that:

etc_post(
                array(
                      'user' => 'newsrobot',
                      'event' => 'image',
                      'step' => 'image_list'
                ),
                'import='.$working_dir.$title_dash.'.webp'
            );

No errors in log files. I tried it also on a special testing subpage inside <txp:php>...</txp:php> tags and with the etc_post function in my plugin itself, but it is running through without complainings or errors and posting nothing.

Any hint?

Offline

#33 Today 16:06:10

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,284
Website GitHub

Re: etc_post: post anything from the public side

Hmm, you’re using this in a plugin, right? Otherwise I would have pointed to this post.


TXP Builders – finely-crafted code, design and txp

Offline

#34 Today 16:43:29

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 312
Website GitHub Twitter

Re: etc_post: post anything from the public side

Yes, etc_post is called in a plugin, which receives the data via a curl post. So, the data is there in the right variables and passed over to the function etc_post, but nothing happens and there is no complaining or error.

Offline

#35 Today 17:23:33

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 312
Website GitHub Twitter

Re: etc_post: post anything from the public side

ok, I played a little bit around.

$res from this line

$res = file_get_contents(ahu.'index.php', false, stream_context_create($opts));

contained this warning:

I’m sorry. I’m afraid I can’t do that; article save is an unsafe operation.

So, the problem is certainly related to a security issue.

Offline

Board footer

Powered by FluxBB