parmaja / autostart

AutoStart dokuwiki plugin by Jesús A. Álvarez
1 stars 2 forks source link

Side effect from Andreas de Pretis' patch #3

Open einhirn opened 8 months ago

einhirn commented 8 months ago

This Patch https://github.com/parmaja/autostart/commit/6bd8af21e1756b077cc6dbb5e964ff216d625ce5 has has some side effects. They will only appear on rare conditions, but never the less: if you deleted the Page ID “wiki:test” and now have a page “wiki:test:start”, you won't be able to revisit “wiki:test” to look for old Versions etc.

A possible workaround would be to look into what happens under the conditions Andreas described originally to figure out what actions we need to redirect on in addition to show. Or we could just add a Flag to the URL &redirect=no like https://www.dokuwiki.org/plugin:redirect does:

https://github.com/splitbrain/dokuwiki-plugin-redirect/blob/661b3e4ef4b6be1b9063a3411bcc3c3e9061768b/action.php#L43 https://github.com/splitbrain/dokuwiki-plugin-redirect/blob/661b3e4ef4b6be1b9063a3411bcc3c3e9061768b/action.php#L46

This is in the event hook for "DOKUWIKI_STARTED", but since it's global $INPUT , this should work for us, too.

zaher commented 8 months ago

Ty, I am not in PHP mood this days, but if you can fix it, PR is welcome, or you can wait to switch to php projects.

einhirn commented 5 months ago

Just for completeness sake, here's what Andreas de Pretis wrote in the old discussion section of the plugin page:

Very handy plugin, great work! By the way: redirecting into a namespace (e.g. foobar -> foobar:start) only works if the user/group has at least read permissions for the underlying/root namespace. In certain setups, e.g. one namespace per customer, this can be very tedious to securely implement. By removing a condition for the HTTP redirect this works out and permissions are checked on the target page anyway.

This was his original patch:


--- lib/plugins/autostart/action.php.orig       2009-11-24 20:41:31.000000000 +0100
+++ lib/plugins/autostart/action.php    2009-11-24 20:42:58.000000000 +0100
@@ -36,7 +36,7 @@
     function preprocess(& $event, $param) {
         global $conf;
         global $ID;
-        if (!$this->page_exists($ID) && $event->data == 'show')
+        if (!$this->page_exists($ID))
         {
             if($this->page_exists($ID.':'.$conf['start']))
                 // start page inside namespace