From 2a959eb0d232e281e460de955fa1619725086f5c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 13 Jun 2014 09:22:45 +0000 Subject: [PATCH] moved fsck to filemanager_admin and get cancel button working with CSP --- .../inc/class.filemanager_admin.inc.php | 25 +++++++++++++ .../inc/class.filemanager_hooks.inc.php | 35 +------------------ 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/filemanager/inc/class.filemanager_admin.inc.php b/filemanager/inc/class.filemanager_admin.inc.php index 67909df797..9941f8ad71 100644 --- a/filemanager/inc/class.filemanager_admin.inc.php +++ b/filemanager/inc/class.filemanager_admin.inc.php @@ -22,6 +22,7 @@ class filemanager_admin extends filemanager_ui */ public $public_functions = array( 'index' => true, + 'fsck' => true, ); /** @@ -194,4 +195,28 @@ class filemanager_admin extends filemanager_ui $GLOBALS['egw_info']['flags']['app_header'] = lang('VFS mounts and versioning'); $tpl->exec('filemanager.filemanager_admin.index',$content,$sel_options,$readonlys); } + + /** + * Run fsck on sqlfs + */ + function fsck() + { + if ($_POST['cancel']) + { + egw_framework::redirect_link('/admin/index.php', null, 'admin'); + } + $check_only = !isset($_POST['fix']); + + if (!($msgs = sqlfs_utils::fsck($check_only))) + { + $msgs = lang('Filesystem check reported no problems.'); + } + $content = '

'.implode("

\n

", (array)$msgs)."

\n"; + + $content .= html::form('

'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):''). + html::submit_button('cancel', lang('Cancel')).'

', + '','/index.php',array('menuaction'=>'filemanager.filemanager_admin.fsck')); + + $GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true); + } } \ No newline at end of file diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php index aa0ac0e21d..0910188dff 100644 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -14,15 +14,6 @@ */ class filemanager_hooks { - /** - * Functions callable via menuaction - * - * @var unknown_type - */ - var $public_functions = array( - 'fsck' => true, - ); - static $appname = 'filemanager'; static $foldercount = 1; @@ -116,7 +107,7 @@ class filemanager_hooks $file = Array( 'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname='.self::$appname), 'Custom fields' => egw::link('/index.php','menuaction=admin.customfields.edit&appname='.self::$appname), - 'Check virtual filesystem' => egw::link('/index.php','menuaction=filemanager.filemanager_hooks.fsck'), + 'Check virtual filesystem' => egw::link('/index.php','menuaction=filemanager.filemanager_admin.fsck'), 'VFS mounts and versioning' => egw::link('/index.php', 'menuaction=filemanager.filemanager_admin.index'), ); if ($location == 'admin') @@ -265,30 +256,6 @@ class filemanager_hooks return $settings; } - /** - * Run fsck on sqlfs - */ - function fsck() - { - if (!isset($GLOBALS['egw_info']['user']['apps']['admin'])) - { - throw new egw_exception_no_permission_admin(); - } - $check_only = !isset($_POST['fix']); - - if (!($msgs = sqlfs_utils::fsck($check_only))) - { - $msgs = lang('Filesystem check reported no problems.'); - } - $content = '

'.implode("

\n

", (array)$msgs)."

\n"; - - $content .= html::form('

'.($check_only&&is_array($msgs)?html::submit_button('fix', lang('Fix reported problems')):''). - html::submit_button('cancel', lang('Cancel'), "window.location.href='".egw::link('/admin/index.php')."'; return false;").'

', - '','/index.php',array('menuaction'=>'filemanager.filemanager_hooks.fsck')); - - $GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true); - } - /** * Register filemanager as handler for directories *