1
JackJ
rehashed wfsections Spaw and xoops text sanitizer
  • 2004/2/15 11:44

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


A friend of mine is looking for a facility where users can submit and edit there own content for pupils in a School. He loves Xoops, but the XOOPS editor he does not like. Weblog can do this to an extent, but wfsections is better.

I managed to rehash wfsections using a mix-mash of hacks to allow users to edit and manage there own content with an article manager etc. I integrated "Spaw" for users submit using Catswolfs module, and managed to get spaw fit in the page usings Chapi's Spaw theme and toolbars for Tiny Content.

I have spent hours trying to get spaw to bypass the text sanitizer which adds spaces/linebreaks and makes the HTML output a mess when users submit HTML. I studied Chapie's Code and the XFsections method, but still no joy. I know I can edit module.textsanitizer like this:



/**
* Convert linebreaks to
tags
*
* @param string $text
*
* @return string
*/
function &nl2Br($text)
{
return preg_replace("/(\015\012)|(\015)|(\012)/","
",$text);

And change it to this:

function &nl2Br($text)
{
return $text;

This works, but all the other modules like newbb forum have no linebreaks

I know you can put it all in one line or use a compressor but that is not a solution.


Can anyone who know wfsections point me in the right direction coding wise?

See this mess
Here

He is thinking about Postnuke which has great wysiwg's, I was hoping XOOPS could do the job

Please no, this will be included a future version etc, I need this yesterday..

2
Catzwolf
Re: rehashed wfsections and xoops text sanitizer
  • 2004/2/15 14:09

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Open class/wfsarticle.php

Look for:

function maintext($format = "S", $page = -1)

and scroll down to 'Case "S"

You will see a line like this:
$maintext = $myts -> displayTarea($maintext, $html, $smiley, $xcodes, 0, $breaks);

change to:

$maintext = $myts -> displayTarea($maintext, $html, $smiley, $xcodes, 0, 0);

Hope that help

Also you may want to remove all other area's of the html that are not between the < body > and tags

By using something like this:

$body = '/\/i';
$maintext = str_replace($body, "", $maintext);
$maintext = $myts -> displayTarea($maintext, $html, $smiley, $xcodes, 0, 0);

Let me know how you get on?

ATB

Catz

3
JackJ
Re: rehashed wfsections and xoops text sanitizer
  • 2004/2/15 17:28

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


thanks catswolf,

I tried this:

switch($format){
case "S":
case "Show":
$maintext = str_replace($body, "", $maintext);
$maintext = $myts->makeTareaData4Show($maintext,$html,$smiley,$xcodes,0,0);

and this:

$body = '/\/i';
$maintext = str_replace($body, "", $maintext);
$maintext = $myts->makeTareaData4Show($maintext,$html,$smiley,$xcodes,0,0);


but no change I am afraid. I tried it in both the wfsarticle.files I have one for wysiwyg submit also. This does not work for the oridinary XOOPS editor submit either which I have no extra code in

I have put the file on my server
Here

It uses a stripped down version of the admin article submit, and has some bits of code I have been trying from elsewhere like:

var $nobr=1; /add
var $enaamp=0; // add

that does not work anyway (just in case you are wondering where its from}

If you manage to fix this I will marry you..

thanks for pointing me in another direction, I will struggle on, this is my last hurdle

I am regularly attending the "Xoops text sanitizer hate group", helps with my anger management..

4
JackJ
Re: rehashed wfsections and xoops text sanitizer
  • 2004/2/15 19:01

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


this works..

Edit: when a user submits with xfsections using spaw its displaying the html code rather than the wysiwyg result, back to the drawing board.

Edit: Looks like a problem in xfsections, admins can submit and output is correct, ordinary users submit and output is HTML code with autoaprove activated, this happens using the Xooops editor?

anyway this is not your area of concern..

I tried it in a fresh Xfsections to see if it was the mix-match I was using, working fine.

With Xf-sections users can edit their own articles, so this might do my friend. Edit: not with this HTML problem for ord users

But I will upload a fresh Wfsections and try it with that and let you know the results

thanks again.. (my hero)

5
carnuke
Re: rehashed wfsections and xoops text sanitizer
  • 2004/2/15 19:09

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


WOW! what a gentleman...

This may seem like a fairly trivial help-out amongst developers, BUT NO, this is what the spirit of XOOPS is all about ... unselfish co-operation at it's very best.

I'm impressed

Richard

6
JackJ
Re: rehashed wfsections and xoops text sanitizer
  • 2004/2/15 23:11

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


what else do you expect from Scots Carnuke..

Catswolf Update:

I managed to get your code working with the admin backend editor that comes with wfsection, so users can use that and --it bypasses the sanitizor using your code. The only problem is the tables dont work in that editor, it look for a "Addtable.htm" file.

trying to get it to work with spaw now..

regards

7
JackJ
Re: rehashed wfsections and xoops text sanitizer (success)
  • 2004/2/16 0:31

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


Success..:)

It is now bypassing the sanitizor, no unwanted linebreaks..

I now have a wfsections where users can use "Spaw" and edit/delete/manage their own articles.

Looks pretty good actually, users can upload images directly, or even drag images from explorer, drag smileys in from the XOOPS smileys folder etc.

I am very pleased with the results, and learned a lot more about XOOPS in the process, (and lost some hair)

A bit of tidying up to do, but I will make it available for anyone who wants it asap.

This is also a bugfix appled wfsections, with your own fixes and other forum fixes applied from around..

Thanks Catswolf, if you were a girl I would kiss you..:)

Cheers

8
JackJ
Re: rehashed wfsections and xoops text sanitizer (success)
  • 2004/2/16 1:59

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


Another problem

plain text with HTML disabled shows no linebreaks? In Netscape when the ordinary XOOPS editor takes over--also no linebreaks?

hmmmmm, what to do?





9
Catzwolf
Re: rehashed wfsections and xoops text sanitizer (success)
  • 2004/2/16 4:15

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Let me see what you have done m8 and I will try to solve that problem for you.

10
risto
Re: rehashed wfsections and xoops text sanitizer (success)
  • 2005/1/7 12:28

  • risto

  • Not too shy to talk

  • Posts: 159

  • Since: 2003/4/16


I have the same issue with the news module. any thoghts?

Login

Who's Online

266 user(s) are online (55 user(s) are browsing Support Forums)


Members: 0


Guests: 266


more...

Donat-O-Meter

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

Latest GitHub Commits