Kroc / NoNonsenseForum

A free, open source, PHP-based simple discussion forum. It favours removing barriers to conversation rather than massaging egos. Download Here: https://github.com/Kroc/NoNonsenseForum/archive/master.zip
http://camendesign.com/nononsense_forum
Other
247 stars 34 forks source link

url function broken for ‘non-clean’ links. #169

Closed Zegnat closed 11 years ago

Zegnat commented 11 years ago

Sorry, I still haven’t learned to do pull requests. starbeamrainbowlab posted the following on the forum:

[NoNonsenseForum] sends me from the following url:

http://localhost/forums/

to this one:

http://localhost/forums/index.phppath=General%20Chat/

As you can see, there is a question mark missing in between "index.php" and "path=....".

I suggested adding a questionmark to line 37 and after doing some tests this seems to work for me. I also noticed a superfluous path variable added to the URL even when it wasn’t needed, and I propose we fix this in the same update. New lines 32–49 for functions.php:

    //if htaccess is off, fallback to real URLs:
    :   FORUM_PATH.
        //which page to point to; if a file is given, it's always a thread
        ($file ? 'thread.php' : 'index.php') . '?' .
        //concatenate a query string
        implode ('&', array_filter (array (
            //actions without an ID
            !$action_id && in_array ($action, array ('delete', 'lock', 'unlock')) ? $action : '',
            //append or delete post
            $action_id ? "$action=$action_id" : '',
            //sub-forum? for no-htaccess, all links must be made relative from the NNF folder root
            $path   ? "path=$path" : '',
            //if a file is specified (view thread, append, delete &c.)
            $file   ? "file=$file" : '',
            //page number
            $page   ? "page=$page" : ''
        )))
    ;
Kroc commented 11 years ago

Pull requests really wouldn't help, I never use the exact code provided, I always check for formatting style and where it can be refactored or improved according to my plans for NNF. Providing the relevant information in the issue as you've done is perfect for me, thanks.