• [Snippet] FlexSearchForm. Modified to hide private docs and add weblink feature.#

  • modx@mindspill.net Reply #1, 6 years ago

    Reply
    Update 05//02/2007: Fixed two problems whereby php complained that a function was being declared twice or didn't exist.

    Update 11/07/2006: I've replaced the attached zip file with 3 new ones - a zip, a gzip and a txt - because people were having problems unzipping the original.

    Hi all.

    I've modified the FlexSearchForm snippet to support the following:

      [list]
    • Access control, i.e. hide private documents if the user doesn't have permission to view them. This functionality uses code lifted from the MODx getDocumentObject method in document.parser.class.inc.php.
    • Added better support for weblinks.
    [/list]

    The new parameters are as follows:

    &useWeblink - [ true | false ] If true and the doc is of type 'reference', link to the doc's weblink (it's 'content' field) rather than to the doc itself. Defaults to false.

    &weblinkClass - [ string ] CSS class for a weblink's anchor. Defaults to "weblink".

    Note that the code I modified was that of MadeMyDay's (posted on the MODx forums at http://modxcms.com/forums/index.php/topic,2762.0.html) which added support for showing an extract of the context with highlighted search terms. The display of content extracts makes it particularly important to prevent private documents being listed to those without permission to view them.

    Steph


  • 0ad Reply #2, 5 years, 10 months ago

    Reply
    Hi

    Thanks for sharing, but the zip seems to corrupt when i download it, is it a problem for anyone else?

    Cheers

    0


  • modx@mindspill.net Reply #3, 5 years, 10 months ago

    Reply
    Just tried downloading and unzipping. Worked fine for me. Can you try a different zip program?


  • 0ad Reply #4, 5 years, 10 months ago

    Reply
    no joy for me with winrar or winxp's own zip uncompress thing, i'll PM you my email address.

    cheers

    0


  • rodsor Reply #5, 5 years, 10 months ago

    Reply
    Same error with me. I´m using 7-zip.


  • doze Reply #6, 5 years, 10 months ago

    Reply
    Opens ok with winrar though..


  • rodsor Reply #7, 5 years, 10 months ago

    Reply
    Doze, can you post the snippet code here? I still can´t open the file...

    Thx.


  • modx@mindspill.net Reply #8, 5 years, 10 months ago

    Reply
    Done. See original post.


  • rodsor Reply #9, 5 years, 10 months ago

    Reply
    Thanks guys. Now I can view the snippet (only the txt). But after changing the snippet code, the following error ocurrs:

    Fatal error: Cannot redeclare preparesearchcontent() (previously declared in C:\Apache2\htdocs\manager\includes\document.parser.class.inc.php(705) : eval()'d code:466) in C:\Apache2\htdocs\manager\includes\document.parser.class.inc.php(705) : eval()'d code on line 475

    How to correct this?


  • modx@mindspill.net Reply #10, 5 years, 10 months ago

    Reply
    Function PrepareSearchContent is being declared (aka defined) twice. Are you using two different versions of the FlexSearchForm at the same time?