DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autostart

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
plugin:autostart [2023-12-15 09:01] einhirnplugin:autostart [2024-03-15 15:25] (current) – removed old stuff einhirn
Line 29: Line 29:
 ===== Source Code ===== ===== Source Code =====
  
-Create a directory ''autostart'' in ''/lib/plugins'' and save the code in a ''action.php'' file there.+See link above.
  
-<file php action.php> +I changed download link to gihtub repo into my account, when the author want it i will transfer to him account --- [[user>zaher|zaher]] //2020-11-15 17:38//
-<?php +
-/** +
- * Autostart Plugin: Redirects to the namespace's start page if available +
- * +
- * @author Jesús A. Álvarez <zydeco@namedfork.net> +
- */ +
-  +
-if (!defined('DOKU_INC')) die(); +
-if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); +
-require_once (DOKU_PLUGIN . 'action.php'); +
-  +
-class action_plugin_autostart extends DokuWiki_Action_Plugin +
-+
-    function getInfo() { +
-        return array ( +
-            'author' => 'Jesús A. Álvarez', +
-            'email' => 'zydeco@namedfork.net', +
-            'date' => '2008-04-28', +
-            'name' => 'Autostart Plugin', +
-            'desc' => "Redirect from the namespace's name to its start page", +
-            'url' => 'https://www.dokuwiki.org/plugin:autostart', +
-        ); +
-    } +
-     +
-    function page_exists($id) { +
-        if (function_exists('page_exists')) +
-            return page_exists($id); +
-        else +
-            return @file_exists(wikiFN($id)); +
-    } +
-     +
-    function register(Doku_Event_Handler $controller) { +
-        $controller->register_hook('ACTION_ACT_PREPROCESS', 'AFTER', $this, 'preprocess', array ()); +
-    } +
-     +
-    function preprocess(& $event, $param) { +
-        global $conf; +
-        global $ID; +
-        if (!$this->page_exists($ID) && $event->data == 'show'+
-        { +
-            if($this->page_exists($ID.':'.$conf['start'])) +
-                // start page inside namespace +
-                $id = $ID.':'.$conf['start']; +
-            elseif($this->page_exists($ID.':'.noNS(cleanID($ID)))) +
-                // page named like the NS inside the NS +
-                $id = $ID.':'.noNS(cleanID($ID)); +
-            if ($id) header('Location: ' . wl($id,'',true)); +
-        } +
-    } +
-  +
-+
-</file>+
  
-===== Discussion ===== 
  
-Great extension, been using for several years.  However, the current download URL returns 404 Not Found --- //Eric Searcy 2016-07-22// 
- 
----- 
- 
-Nice work! Thanks! - Jason Xun Xu <jasonxu.dev@gmail.com> 
- 
----- 
-\\ 
-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. 
- 
-<code> 
---- 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 
-</code> 
- 
-Andreas de Pretis <ad@25th-floor.com> 
- 
-> Thanks, I'm using the plugin with Andreas' patch on 2013-05-10a "Weatherwax" with no issues.  --- //[[open@carboxymoron.com|Justin K]] 2013-09-24// 
- 
-> This 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.  --- [[user>einhirn|einhirn]] //2023-12-15 09:01// 
----- 
- 
-I changed download link to gihtub repo into my account, when the author want it i will transfer to him account 
- 
-[[https://github.com/parmaja/autostart]] 
- 
- --- [[user>zaher|zaher]] //2020-11-15 17:38// 
plugin/autostart.txt · Last modified: 2024-03-15 15:25 by einhirn

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki