i want to save a content in the frontend with a snippet into in later version of modx i could do but now when i made a form to send the new content it strip the snippet and in my snippet don’t strip it ¿where are the new function who strip the snippets in postback.(is for use in the pageediter snippet)
i think is a dark post but any help is appreciated
hi
-
MODX Staff
- 10,725 Posts
This is an interesting problem. The new code is in index.php and cleanses the URL, preventing js, php, or MODx tags from being sent through any $_REQUEST variable, be it POST or GET. I’m aware of the issue and we are discussing/exploring solutions.
thanks for telling i surf in the index.php for delete this freature
y want now made a simple plugin who remplace some text whith the name of the snippet but it dont work and if plugin access is only by the manager why it dont parse this values i think is the easy way to made the things you coment but when plugin has the values [! ... dont parse it. Any oter way or sugestion? thanks for your help
i find a solution secure for made it... i start developing the idea is a plugin who remplace in document prerender the content of the id whith a button whth a left side whith a id who is a left secure key only for main administrator next the value of the botton whith the name of the snippet and right whith the 2 secure key who is the valuue of the class. From this manner the sistem could be more secure to the instalation and the snippets and plugins could be a good look. while writing this my head show more problems but i investigate if could be a way.hi
i made this plugin only send a value in the form hidden who go to the page you want to edit called allow, in the others pages whith allow="" the values principiodecodigo remplaces whith [! and in the second the values findecodigo remplaces whith !]
hi
$e = &$modx->Event;
switch ($e->name) {
case "OnParseDocument":
$allow = (isset($_POST[’allow’]))? $_POST[’allow’] : $_GET[’allow’];
if ($allow==""){
$content = $modx->documentOutput ;
$content = str_replace("principiodecodigo","[!",$content);
$content = str_replace("findecodigo","!]",$content);
$modx->documentOutput = $content;}
break;
default :
return; // stop here - this is very important.
break;
}
Javier, could you please explain better how to install this? I tried saving as a plugin called EncodeSnippet and set it to the following system events- Template Svc Event OnParseDocument, Snippets OnSnipFormSave, and Template Variables OnTVFormSave, and got no joy from it, still couldn’t save snippets from the admin area. I ended up using .htaccess to override mod-security, which worked, but is a temporary solution at best. If you could be a bit clearer on how this works, and how it’s set up, I think many of us will benefit. Thank you.
-
☆ A M B ☆
- 24,524 Posts
From the code, it looks like the system event is OnParseDocument.
yes its like you say on parse document and i think you need to call principodecodigonameofsnippetandparamsfindecodigo
or change the plugin whith the start end you want
hi