Prevent page creation when showing image details

This commit is contained in:
Simon DELAGE 2016-02-20 09:09:16 +01:00
parent 6acd201e84
commit f88ba74523
2 changed files with 6 additions and 5 deletions

View file

@ -35,9 +35,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
} else { } else {
$dest = $this->getConf('templates_path'); $dest = $this->getConf('templates_path');
} }
//if ($event == "DETAIL_STARTED") { return false; }
$this->dataDir = $conf['savedir']; $this->dataDir = $conf['savedir'];
// CREATE PRIVATE NAMESPACE START PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in) // CREATE PRIVATE NAMESPACE START PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in and not showing image details page)
if (($this->getConf('create_private_ns')) && (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->userOk())) { if (($this->getConf('create_private_ns')) && (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->userOk()) && ($event != "DETAIL_STARTED")) {
// If a template exists in path as builded before 2015/05/14 version, use it as source to create userhomepage_private.txt in new templates_path // If a template exists in path as builded before 2015/05/14 version, use it as source to create userhomepage_private.txt in new templates_path
if ((is_file(DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->getConf('templatepath') != null)) { if ((is_file(DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->getConf('templatepath') != null)) {
$source = DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_private.txt'; $source = DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_private.txt';
@ -50,8 +51,8 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
} }
$this->copyFile($source, $dest, 'userhomepage_private.txt'); $this->copyFile($source, $dest, 'userhomepage_private.txt');
} }
// CREATE PUBLIC PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in) // CREATE PUBLIC PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in and not showing image details page)
if (($this->getConf('create_public_page')) and (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_public.txt')) and ($this->userOk())) { if (($this->getConf('create_public_page')) and (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_public.txt')) and ($this->userOk()) && ($event != "DETAIL_STARTED")) {
// If a template exists in path as builded before 2015/05/14 version, use it as source to create userhomepage_private.txt in new templates_path // If a template exists in path as builded before 2015/05/14 version, use it as source to create userhomepage_private.txt in new templates_path
if ((is_file(DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_public.txt')) && ($this->getConf('templatepath') != null)) { if ((is_file(DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_public.txt')) && ($this->getConf('templatepath') != null)) {
$source = DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_public.txt'; $source = DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_public.txt';

View file

@ -1,7 +1,7 @@
base userhomepage base userhomepage
author Simon Delage author Simon Delage
email simon.geekitude@gmail.com email simon.geekitude@gmail.com
date 2016-02-09 date 2016-02-20
name User Homepage name User Homepage
desc Automatically create user's private namespace and/or public page and redirects users to private namespace on login. desc Automatically create user's private namespace and/or public page and redirects users to private namespace on login.
url https://www.dokuwiki.org/plugin:userhomepage url https://www.dokuwiki.org/plugin:userhomepage