From ea54dcea4491ab5a99db0cff3e950c77069ef85e Mon Sep 17 00:00:00 2001 From: vargenau Date: Tue, 18 May 2010 14:47:58 +0000 Subject: [PATCH] Lets's use the single global isActionPage() function git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@7404 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/CachedMarkup.php | 1 - lib/main.php | 21 +++++---------------- lib/plugin/RecentChanges.php | 2 +- lib/plugin/UserPreferences.php | 2 +- lib/upgrade.php | 15 ++------------- themes/MonoBook/templates/actionbar.tmpl | 2 +- themes/MonoBook/templates/info.tmpl | 2 +- themes/Sidebar/templates/actionbar.tmpl | 4 ++-- themes/default/templates/info.tmpl | 2 +- themes/default/templates/userprefs.tmpl | 2 +- themes/gforge/templates/actionbar.tmpl | 2 +- 11 files changed, 16 insertions(+), 39 deletions(-) diff --git a/lib/CachedMarkup.php b/lib/CachedMarkup.php index 3f1cfd482..24b19c8a0 100644 --- a/lib/CachedMarkup.php +++ b/lib/CachedMarkup.php @@ -751,7 +751,6 @@ class Cached_UserLink extends Cached_WikiLink { /** * 1.3.13: Previously stored was only _pi. * A fresh generated cache has now ->name and ->args also. - * main::isActionPage only checks the raw content. */ class Cached_PluginInvocation extends Cached_DynamicContent { diff --git a/lib/main.php b/lib/main.php index 5047ed0a0..befe7756f 100644 --- a/lib/main.php +++ b/lib/main.php @@ -916,7 +916,7 @@ class WikiRequest extends Request { return $action; // Allow for, e.g. action=LikePages - if ($this->isActionPage($action)) + if (isActionPage($action)) return $action; // Handle untranslated actionpages in non-english @@ -925,7 +925,7 @@ class WikiRequest extends Request { require_once("lib/plugin/_WikiTranslation.php"); $trans = new WikiPlugin__WikiTranslation(); $en_action = $trans->translate($action,'en',$GLOBALS['LANG']); - if ($this->isActionPage($en_action)) + if (isActionPage($en_action)) return $en_action; } @@ -985,13 +985,6 @@ class WikiRequest extends Request { return false; } - function _isActionPage ($pagename, $verbose = true) { - - global $AllActionPages; - - return (in_array($pagename, $AllActionPages)); - } - function findActionPage ($action) { static $cache; if (!$action) return false; @@ -1004,7 +997,7 @@ class WikiRequest extends Request { return $cache[$translation]; // check for cached translated version - if ($translation and $this->_isActionPage($translation, false)) + if ($translation and isActionPage($translation)) return $cache[$action] = $translation; // Allow for, e.g. action=LikePages @@ -1019,7 +1012,7 @@ class WikiRequest extends Request { $trans = new WikiPlugin__WikiTranslation(); $trans->lang = $LANG; $default = $trans->translate_to_en($action, $LANG); - if ($default and $this->_isActionPage($default, false)) + if ($default and isActionPage($default)) return $cache[$action] = $default; } else { $default = $translation; @@ -1027,7 +1020,7 @@ class WikiRequest extends Request { // check for english version if ($action != $translation and $action != $default) { - if ($this->_isActionPage($action)) + if (isActionPage($action)) return $cache[$action] = $action; } @@ -1035,10 +1028,6 @@ class WikiRequest extends Request { return $cache[$action] = false; } - function isActionPage ($pagename) { - return $this->findActionPage($pagename); - } - function action_browse () { $this->buffer_output(); include_once("lib/display.php"); diff --git a/lib/plugin/RecentChanges.php b/lib/plugin/RecentChanges.php index 634fa44a4..49d48c913 100644 --- a/lib/plugin/RecentChanges.php +++ b/lib/plugin/RecentChanges.php @@ -1213,7 +1213,7 @@ extends WikiPlugin $args = WikiPlugin::getArgs($argstr, $request, $defaults); $action = $request->getArg('action'); - if ($action != 'browse' && ! $request->isActionPage($action)) + if ($action != 'browse' && !isActionPage($action)) $args['format'] = false; // default -> HTML if ($args['format'] == 'rss' && empty($args['limit'])) diff --git a/lib/plugin/UserPreferences.php b/lib/plugin/UserPreferences.php index 33c413d60..1135d87ec 100644 --- a/lib/plugin/UserPreferences.php +++ b/lib/plugin/UserPreferences.php @@ -78,7 +78,7 @@ extends WikiPlugin _("Error: You are not logged in, cannot display UserPreferences.")); } } - if ((!$request->isActionPage($request->getArg('pagename')) + if ((!isActionPage($request->getArg('pagename')) and (!isset($user->_prefs->_method) or !in_array($user->_prefs->_method, array('ADODB','SQL','PDO')))) or (in_array($request->getArg('action'), array('zip','ziphtml','dumphtml'))) diff --git a/lib/upgrade.php b/lib/upgrade.php index a6d4ad9ea..4d91f86a8 100644 --- a/lib/upgrade.php +++ b/lib/upgrade.php @@ -114,17 +114,6 @@ class Upgrade { } } - /** - * If a matching pgsrc => pluginname exists - * Need the English filename (required precondition: urlencode == urldecode). - */ - function isActionPage($filename) { - - global $AllActionPages; - - return (in_array($filename, $AllActionPages)); - } - function CheckActionPageUpdate() { echo "

",sprintf(_("check for necessary %s updates"), _("ActionPage")),"

\n"; @@ -143,7 +132,7 @@ class Upgrade { if (substr($filename,-1,1) == '~') continue; if (substr($filename,-5,5) == '.orig') continue; $pagename = urldecode($filename); - if ($this->isActionPage($filename)) { + if (isActionPage($filename)) { $translation = gettext($pagename); if ($translation == $pagename) $this->doPgsrcUpdate($pagename, $path, $filename); @@ -169,7 +158,7 @@ class Upgrade { if (substr($filename,-1,1) == '~') continue; if (substr($filename,-5,5) == '.orig') continue; $pagename = urldecode($filename); - if (!$this->isActionPage($filename)) { + if (!isActionPage($filename)) { // There're a lot of now unneeded pages around. // At first rename the BlaPlugin pages to Help/ and then to the update. if ($this->db_version < 1030.12200612) { diff --git a/themes/MonoBook/templates/actionbar.tmpl b/themes/MonoBook/templates/actionbar.tmpl index f9611f1e7..1708e99eb 100644 --- a/themes/MonoBook/templates/actionbar.tmpl +++ b/themes/MonoBook/templates/actionbar.tmpl @@ -6,7 +6,7 @@ rcs_id('$Id$'); $dbh = $request->getDbh(); $isAdmin = $user->isAdmin(); $pagename = $page->getName(); - $isActionPage = $request->_isActionPage($pagename, false); + $isActionPage = isActionPage($pagename); $isBrowse = $request->getArg('action') == 'browse'; ?>
diff --git a/themes/MonoBook/templates/info.tmpl b/themes/MonoBook/templates/info.tmpl index e36b10c55..a2dbbd6c2 100644 --- a/themes/MonoBook/templates/info.tmpl +++ b/themes/MonoBook/templates/info.tmpl @@ -159,7 +159,7 @@ if (HOME_PAGE == $page->getName()) { if (0 && $page->isUserPage($include_empty=true)) { $pagetype []= _("User page"); } -if (@$request->isActionPage($page->getName())) { +if (isActionPage($page->getName())) { $pagetype []= _("Action page"); } if ($page->get('pagetype') == 'wikiblog') { diff --git a/themes/Sidebar/templates/actionbar.tmpl b/themes/Sidebar/templates/actionbar.tmpl index a3a3d8628..7d117d735 100644 --- a/themes/Sidebar/templates/actionbar.tmpl +++ b/themes/Sidebar/templates/actionbar.tmpl @@ -3,7 +3,7 @@ rcs_id('$Id$'); $dbh = $request->getDbh(); $isAdmin = $user->isAdmin(); $pagename = $page->getName(); - $isActionPage = $request->_isActionPage($pagename, false); + $isActionPage = isActionPage($pagename); $isBrowse = $request->getArg('action') == 'browse'; $mayEdit = mayAccessPage('edit', $pagename); $mayChange = mayAccessPage('change', $pagename); @@ -66,4 +66,4 @@ rcs_id('$Id$');
- \ No newline at end of file + diff --git a/themes/default/templates/info.tmpl b/themes/default/templates/info.tmpl index e6852af67..c6180eb44 100644 --- a/themes/default/templates/info.tmpl +++ b/themes/default/templates/info.tmpl @@ -151,7 +151,7 @@ if (HOME_PAGE == $page->getName()) { if ($page->isUserPage($include_empty=true)) { $pagetype []= _("User page"); } -if (@$request->isActionPage($page->getName())) { +if (isActionPage($page->getName())) { $pagetype []= _("Action page"); } if ($page->get('pagetype') == 'wikiblog') { diff --git a/themes/default/templates/userprefs.tmpl b/themes/default/templates/userprefs.tmpl index 46602d816..091aae8b8 100644 --- a/themes/default/templates/userprefs.tmpl +++ b/themes/default/templates/userprefs.tmpl @@ -9,7 +9,7 @@ foreach (explode(',','errmsg,isForm') as $var) { } $plugin = $request->getArg('pagename'); -if ($request->isActionPage($request->getArg('pagename')) +if (isActionPage($request->getArg('pagename')) and $isForm and $plugin == _("PreferencesInfo")) { $isForm = false; } diff --git a/themes/gforge/templates/actionbar.tmpl b/themes/gforge/templates/actionbar.tmpl index fb00139a8..c1e6d8035 100644 --- a/themes/gforge/templates/actionbar.tmpl +++ b/themes/gforge/templates/actionbar.tmpl @@ -7,7 +7,7 @@ $curuserprefs = $user->getPreferences(); $dbh = $request->getDbh(); $isAdmin = $user->isAdmin(); $pagename = $page->getName(); -$isActionPage = $request->_isActionPage($pagename, false); +$isActionPage = isActionPage($pagename); $isBrowse = $request->getArg('action') == 'browse'; ?> -- 2.45.0