Skip to content

Commit a8a1915

Browse files
committed
Introduced feature_disabled.php for better error description.
1 parent 2ffa361 commit a8a1915

12 files changed

Lines changed: 95 additions & 19 deletions

WEB-INF/resources/en.lang.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
'error.access_denied' => 'Access denied.',
7070
'error.sys' => 'System error.',
7171
'error.db' => 'Database error.',
72+
'error.feature_disabled' => 'Feature is disabled.',
7273
'error.field' => 'Incorrect "{0}" data.',
7374
'error.empty' => 'Field "{0}" is empty.',
7475
'error.not_equal' => 'Field "{0}" is not equal to field "{1}".',

admin_team_add.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@
8181
$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get('button.submit')));
8282

8383
if ($request->isPost()) {
84+
8485
/*
8586
* Note: creating a group by admin is pretty much the same as self-registration,
86-
* except that created_by gields for group and user must be set to admin account.
87+
* except that created_by fields for group and user must be set to admin account.
8788
* Therefore, we'll reuse ttRegistrator instance to create a group here
8889
* and override created_by fields using ttRegistrator::setCreatedBy() function.
8990
*/

cf_custom_field_add.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
if ($request->isPost()) {
4044
$cl_field_name = trim($request->getParameter('name'));

cf_custom_field_delete.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$id = $request->getParameter('id');
4044

cf_custom_field_edit.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$cl_id = $request->getParameter('id');
4044
$field = CustomFields::getField($cl_id);

cf_custom_fields.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$form = new Form('customFieldsForm');
4044

cf_dropdown_option_add.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$cl_field_id = $request->getParameter('field_id');
4044
$field = CustomFields::getField($cl_field_id);

cf_dropdown_option_delete.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$cl_id = $request->getParameter('id');
4044
$form = new Form('optionDeleteForm');

cf_dropdown_option_edit.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$cl_id = $request->getParameter('id');
4044
$cl_name = CustomFields::getOptionName($cl_id);

cf_dropdown_options.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
require_once('plugins/CustomFields.class.php');
3131
import('form.Form');
3232

33-
// Access check.
34-
if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) {
33+
// Access checks.
34+
if (!ttAccessAllowed('manage_custom_fields')) {
3535
header('Location: access_denied.php');
3636
exit();
3737
}
38+
if (!$user->isPluginEnabled('cf')) {
39+
header('Location: feature_disabled.php');
40+
exit();
41+
}
3842

3943
$field_id = $request->getParameter('field_id');
4044
$options = CustomFields::getOptions($field_id);

0 commit comments

Comments
 (0)