From e0c26282a603881e8d2f839d94c28dbbfc57d71b Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 03:34:17 +0200 Subject: scrutinizer documentations issues --- inc/actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index ef09a0dc7..2b819a0d6 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -394,7 +394,7 @@ function act_save($act){ return 'conflict'; //save it - saveWikiText($ID,con($PRE,$TEXT,$SUF,1),$SUM,$INPUT->bool('minor')); //use pretty mode for con + saveWikiText($ID,con($PRE,$TEXT,$SUF,true),$SUM,$INPUT->bool('minor')); //use pretty mode for con //unlock it unlock($ID); -- cgit v1.2.3 From 59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 21:45:27 +0200 Subject: more scrutinizer issue improvements --- inc/actions.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index 2b819a0d6..5cf63a6ca 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -600,7 +600,6 @@ function act_export($act){ $pre = ''; $post = ''; - $output = ''; $headers = array(); // search engines: never cache exported docs! (Google only currently) -- cgit v1.2.3 From 42ea7f447f39fbc2f79eaaec31f8c10ede59c5d0 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 1 Oct 2014 11:30:27 +0200 Subject: Many PHPDocs, some unused and dyn declared vars many PHPDocs some unused variables some dynamically declared variables declared --- inc/actions.php | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index 5cf63a6ca..68b71a36a 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -221,6 +221,9 @@ function act_sendheaders($headers) { * Sanitize the action command * * @author Andreas Gohr + * + * @param array|string $act + * @return string */ function act_clean($act){ // check if the action was given as array key @@ -245,6 +248,9 @@ function act_clean($act){ * Add all allowed commands here. * * @author Andreas Gohr + * + * @param array|string $act + * @return string */ function act_validate($act) { global $conf; @@ -284,10 +290,12 @@ function act_validate($act) { * Run permissionchecks * * @author Andreas Gohr + * + * @param string $act action command + * @return string action command */ function act_permcheck($act){ global $INFO; - global $conf; if(in_array($act,array('save','preview','edit','recover'))){ if($INFO['exists']){ @@ -330,6 +338,9 @@ function act_permcheck($act){ * Handle 'draftdel' * * Deletes the draft for the current page and user + * + * @param string $act action command + * @return string action command */ function act_draftdel($act){ global $INFO; @@ -342,6 +353,9 @@ function act_draftdel($act){ * Saves a draft on preview * * @todo this currently duplicates code from ajax.php :-/ + * + * @param string $act action command + * @return string action command */ function act_draftsave($act){ global $INFO; @@ -372,6 +386,9 @@ function act_draftsave($act){ * returns a new action. * * @author Andreas Gohr + * + * @param string $act action command + * @return string action command */ function act_save($act){ global $ID; @@ -410,6 +427,9 @@ function act_save($act){ * Revert to a certain revision * * @author Andreas Gohr + * + * @param string $act action command + * @return string action command */ function act_revert($act){ global $ID; @@ -457,6 +477,9 @@ function act_revert($act){ * Do a redirect after receiving post data * * Tries to add the section id as hash mark after section editing + * + * @param string $id page id + * @param string $preact action command before redirect */ function act_redirect($id,$preact){ global $PRE; @@ -478,7 +501,7 @@ function act_redirect($id,$preact){ /** * Execute the redirect * - * @param array $opts id and fragment for the redirect + * @param array $opts id and fragment for the redirect and the preact */ function act_redirect_execute($opts){ $go = wl($opts['id'],'',true); @@ -492,6 +515,9 @@ function act_redirect_execute($opts){ * Handle 'login', 'logout' * * @author Andreas Gohr + * + * @param string $act action command + * @return string action command */ function act_auth($act){ global $ID; @@ -527,6 +553,9 @@ function act_auth($act){ * Handle 'edit', 'preview', 'recover' * * @author Andreas Gohr + * + * @param string $act action command + * @return string action command */ function act_edit($act){ global $ID; @@ -591,6 +620,9 @@ function act_edit($act){ * * @author Andreas Gohr * @author Michael Klier + * + * @param string $act action command + * @return string action command */ function act_export($act){ global $ID; @@ -671,6 +703,8 @@ function act_export($act){ * Handle sitemap delivery * * @author Michael Hamann + * + * @param string $act action command */ function act_sitemap($act) { global $conf; @@ -719,6 +753,10 @@ function act_sitemap($act) { * Throws exception on error. * * @author Adrian Lang + * + * @param string $act action command + * @return string action command + * @throws Exception if (un)subscribing fails */ function act_subscription($act){ global $lang; @@ -778,6 +816,9 @@ function act_subscription($act){ * default action for the event ACTION_HANDLE_SUBSCRIBE. * * @author Adrian Lang + * + * @param array &$params the parameters: target, style and action + * @throws Exception */ function subscription_handle_post(&$params) { global $INFO; -- cgit v1.2.3 From 1cc82e5c76ae7fcd646e448404afdc0fd458bf55 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Fri, 3 Oct 2014 15:56:15 +0200 Subject: scrutiner issues --- inc/actions.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index 68b71a36a..766c3cd0b 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -200,6 +200,7 @@ function act_dispatch(){ global $license; //call template FIXME: all needed vars available? + $headers = array(); $headers[] = 'Content-Type: text/html; charset=utf-8'; trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders'); -- cgit v1.2.3 From b814e978ddb3bb9f05058fb684e2394dd2bf8eb5 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 3 Dec 2014 00:08:14 +0100 Subject: provide also $ID in other export modes to renderer Simplifies modifying the cache via an action plugin --- inc/actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index ef09a0dc7..2953c0e79 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -644,7 +644,7 @@ function act_export($act){ $output = p_wiki_xhtml($ID,$REV,false); break; default: - $output = p_cached_output(wikiFN($ID,$REV), $mode); + $output = p_cached_output(wikiFN($ID,$REV), $mode, $ID); $headers = p_get_metadata($ID,"format $mode"); break; } -- cgit v1.2.3 From a61966c55d9d0ac4b800d65cfc6ee1aea44899b5 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 16 May 2015 19:07:23 +0200 Subject: Provide a function to return admin plugin for the page request. This was previously carried out in three separate places. Refactor that code to use the new function. Update tpl_pageTitle test to use a manager level admin plugin. --- inc/actions.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'inc/actions.php') diff --git a/inc/actions.php b/inc/actions.php index 709c19ddd..b0753b22e 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -162,20 +162,9 @@ function act_dispatch(){ if($ACT == 'admin'){ // retrieve admin plugin name from $_REQUEST['page'] if (($page = $INPUT->str('page', '', true)) != '') { - $pluginlist = plugin_list('admin'); - if (in_array($page, $pluginlist)) { - // attempt to load the plugin - - if (($plugin = plugin_load('admin',$page)) !== null){ - /** @var DokuWiki_Admin_Plugin $plugin */ - if($plugin->forAdminOnly() && !$INFO['isadmin']){ - // a manager tried to load a plugin that's for admins only - $INPUT->remove('page'); - msg('For admins only',-1); - }else{ - $plugin->handle(); - } - } + /** @var $plugin DokuWiki_Admin_Plugin */ + if ($plugin = plugin_getRequestAdminPlugin()){ + $plugin->handle(); } } } -- cgit v1.2.3