From: Nik Okuntseff Date: Sat, 24 Mar 2018 16:04:24 +0000 (+0000) Subject: Introduced feature_disabled.php for better error description. X-Git-Tag: timetracker_1.19-1~956 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a8a191541d6f05b08bd8331bdf409af5abfac896;p=timetracker.git Introduced feature_disabled.php for better error description. --- diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index bedc4f6a..732141a4 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -69,6 +69,7 @@ $i18n_key_words = array( 'error.access_denied' => 'Access denied.', 'error.sys' => 'System error.', 'error.db' => 'Database error.', +'error.feature_disabled' => 'Feature is disabled.', 'error.field' => 'Incorrect "{0}" data.', 'error.empty' => 'Field "{0}" is empty.', 'error.not_equal' => 'Field "{0}" is not equal to field "{1}".', diff --git a/admin_team_add.php b/admin_team_add.php index 6d5bc84f..6a8b05d5 100644 --- a/admin_team_add.php +++ b/admin_team_add.php @@ -81,9 +81,10 @@ $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'manager_email', $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.submit'))); if ($request->isPost()) { + /* * Note: creating a group by admin is pretty much the same as self-registration, - * except that created_by gields for group and user must be set to admin account. + * except that created_by fields for group and user must be set to admin account. * Therefore, we'll reuse ttRegistrator instance to create a group here * and override created_by fields using ttRegistrator::setCreatedBy() function. */ diff --git a/cf_custom_field_add.php b/cf_custom_field_add.php index 30c82a5a..922d83b7 100644 --- a/cf_custom_field_add.php +++ b/cf_custom_field_add.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} if ($request->isPost()) { $cl_field_name = trim($request->getParameter('name')); diff --git a/cf_custom_field_delete.php b/cf_custom_field_delete.php index f4de4809..86c10b1f 100644 --- a/cf_custom_field_delete.php +++ b/cf_custom_field_delete.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $id = $request->getParameter('id'); diff --git a/cf_custom_field_edit.php b/cf_custom_field_edit.php index 32ee3878..499f6d02 100644 --- a/cf_custom_field_edit.php +++ b/cf_custom_field_edit.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $cl_id = $request->getParameter('id'); $field = CustomFields::getField($cl_id); diff --git a/cf_custom_fields.php b/cf_custom_fields.php index 2b34fb76..53f80e40 100644 --- a/cf_custom_fields.php +++ b/cf_custom_fields.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $form = new Form('customFieldsForm'); diff --git a/cf_dropdown_option_add.php b/cf_dropdown_option_add.php index b9500833..7b49424e 100644 --- a/cf_dropdown_option_add.php +++ b/cf_dropdown_option_add.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $cl_field_id = $request->getParameter('field_id'); $field = CustomFields::getField($cl_field_id); diff --git a/cf_dropdown_option_delete.php b/cf_dropdown_option_delete.php index 0a1f25ba..4cb2aca8 100644 --- a/cf_dropdown_option_delete.php +++ b/cf_dropdown_option_delete.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $cl_id = $request->getParameter('id'); $form = new Form('optionDeleteForm'); diff --git a/cf_dropdown_option_edit.php b/cf_dropdown_option_edit.php index 5fc333d0..5522accf 100644 --- a/cf_dropdown_option_edit.php +++ b/cf_dropdown_option_edit.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $cl_id = $request->getParameter('id'); $cl_name = CustomFields::getOptionName($cl_id); diff --git a/cf_dropdown_options.php b/cf_dropdown_options.php index 02f59f56..1afce734 100644 --- a/cf_dropdown_options.php +++ b/cf_dropdown_options.php @@ -30,11 +30,15 @@ require_once('initialize.php'); require_once('plugins/CustomFields.class.php'); import('form.Form'); -// Access check. -if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { +// Access checks. +if (!ttAccessAllowed('manage_custom_fields')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('cf')) { + header('Location: feature_disabled.php'); + exit(); +} $field_id = $request->getParameter('field_id'); $options = CustomFields::getOptions($field_id); diff --git a/charts.php b/charts.php index 69997d87..959cfe36 100644 --- a/charts.php +++ b/charts.php @@ -37,11 +37,17 @@ import('PieChartEx'); import('ttUserHelper'); import('ttTeamHelper'); -// Access check. -if (!ttAccessAllowed('view_own_charts') || !$user->isPluginEnabled('ch')) { +// Access checks. +if (!ttAccessAllowed('view_own_charts')) { header('Location: access_denied.php'); exit(); } +if (!$user->isPluginEnabled('ch')) { + header('Location: feature_disabled.php'); + exit(); +} + + // Initialize and store date in session. $cl_date = $request->getParameter('date', @$_SESSION['date']); diff --git a/feature_disabled.php b/feature_disabled.php new file mode 100644 index 00000000..7f0bb81f --- /dev/null +++ b/feature_disabled.php @@ -0,0 +1,36 @@ +add($i18n->get('error.feature_disabled')); +if ($auth->isAuthenticated()) $smarty->assign('authenticated', true); // Used in header.tpl for menu display. + +$smarty->assign('title', $i18n->get('label.error')); +$smarty->assign('content_page_name', 'access_denied.tpl'); +$smarty->display('index.tpl');