diff options
author | Zoddo <zoddo.ino@gmail.com> | 2015-09-12 17:00:39 +0200 |
---|---|---|
committer | Zoddo <zoddo.ino@gmail.com> | 2015-09-12 17:11:20 +0200 |
commit | 2f4fcee7e8ac5b4a440f43c691a68a024943e2b7 (patch) | |
tree | 29e4c9bd575fe2b83c7cd0ee6d733c4b103b7ace | |
parent | c166adf3c7e9e9bdb188c4b0eb434147fadb4c74 (diff) | |
download | forums-2f4fcee7e8ac5b4a440f43c691a68a024943e2b7.tar forums-2f4fcee7e8ac5b4a440f43c691a68a024943e2b7.tar.gz forums-2f4fcee7e8ac5b4a440f43c691a68a024943e2b7.tar.bz2 forums-2f4fcee7e8ac5b4a440f43c691a68a024943e2b7.tar.xz forums-2f4fcee7e8ac5b4a440f43c691a68a024943e2b7.zip |
[ticket/14159] Hide version info on ACP if we don't have the permission
This also hide a link to an unreachable module (Check phpBB version).
We could have simply remove the link to the module, but if the user hasn't
the permission to access to the phpBB version check module, I think that
he shouldn't view any version information about phpBB.
PHPBB3-14159
-rw-r--r-- | phpBB/adm/style/acp_main.html | 7 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_main.php | 29 |
2 files changed, 25 insertions, 11 deletions
diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index 065dd7ac4f..6e51e1fc70 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -141,19 +141,24 @@ <td>{L_GZIP_COMPRESSION}{L_COLON} </td> <td><strong>{GZIP_COMPRESSION}</strong></td> </tr> + <!-- IF S_TOTAL_ORPHAN or S_VERSIONCHECK --> <tr> + <!-- IF S_VERSIONCHECK --> <td>{L_BOARD_VERSION}{L_COLON} </td> <td> <strong><a href="{U_VERSIONCHECK}" <!-- IF S_VERSION_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF --> title="{L_MORE_INFORMATION}">{BOARD_VERSION}</a></strong> [ <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> ] </td> + <!-- ENDIF --> <!-- IF S_TOTAL_ORPHAN --> <td>{L_NUMBER_ORPHAN}{L_COLON} </td> <td><strong>{TOTAL_ORPHAN}</strong></td> - <!-- ELSE --> + <!-- ENDIF --> + <!-- IF not S_TOTAL_ORPHAN or not S_VERSIONCHECK --> <td> </td> <td> </td> <!-- ENDIF --> </tr> + <!-- ENDIF --> </tbody> </table> diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index f6d728ffed..afa0f1ea61 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -429,20 +429,28 @@ class acp_main )); } - $version_helper = $phpbb_container->get('version_helper'); - try + if ($auth->acl_get('a_board')) { - $recheck = $request->variable('versioncheck_force', false); - $updates_available = $version_helper->get_suggested_updates($recheck); + $version_helper = $phpbb_container->get('version_helper'); + try + { + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_suggested_updates($recheck); - $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available)); + $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available)); + } + catch (\RuntimeException $e) + { + $template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', + )); + } } - catch (\RuntimeException $e) + else { - $template->assign_vars(array( - 'S_VERSIONCHECK_FAIL' => true, - 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', - )); + // We set this template var to true, to not display an outdated version notice. + $template->assign_var('S_VERSION_UP_TO_DATE', true); } /** @@ -553,6 +561,7 @@ class acp_main 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'), + 'S_VERSIONCHECK' => ($auth->acl_get('a_board')) ? true : false, 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, ) |