Introduced feature_disabled.php for better error description.
authorNik Okuntseff <support@anuko.com>
Sat, 24 Mar 2018 16:04:24 +0000 (16:04 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 24 Mar 2018 16:04:24 +0000 (16:04 +0000)
12 files changed:
WEB-INF/resources/en.lang.php
admin_team_add.php
cf_custom_field_add.php
cf_custom_field_delete.php
cf_custom_field_edit.php
cf_custom_fields.php
cf_dropdown_option_add.php
cf_dropdown_option_delete.php
cf_dropdown_option_edit.php
cf_dropdown_options.php
charts.php
feature_disabled.php [new file with mode: 0644]

index bedc4f6..732141a 100644 (file)
@@ -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}".',
index 6d5bc84..6a8b05d 100644 (file)
@@ -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.
    */
index 30c82a5..922d83b 100644 (file)
@@ -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'));
index f4de480..86c10b1 100644 (file)
@@ -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');
 
index 32ee387..499f6d0 100644 (file)
@@ -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);
index 2b34fb7..53f80e4 100644 (file)
@@ -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');
 
index b950083..7b49424 100644 (file)
@@ -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);
index 0a1f25b..4cb2aca 100644 (file)
@@ -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');
index 5fc333d..5522acc 100644 (file)
@@ -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);
index 02f59f5..1afce73 100644 (file)
@@ -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);
index 69997d8..959cfe3 100644 (file)
@@ -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 (file)
index 0000000..7f0bb81
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------+
+// | Anuko Time Tracker
+// +----------------------------------------------------------------------+
+// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
+// +----------------------------------------------------------------------+
+// | LIBERAL FREEWARE LICENSE: This source code document may be used
+// | by anyone for any purpose, and freely redistributed alone or in
+// | combination with other software, provided that the license is obeyed.
+// |
+// | There are only two ways to violate the license:
+// |
+// | 1. To redistribute this code in source form, with the copyright
+// |    notice or license removed or altered. (Distributing in compiled
+// |    forms without embedded copyright notices is permitted).
+// |
+// | 2. To redistribute modified versions of this code in *any* form
+// |    that bears insufficient indications that the modifications are
+// |    not the work of the original author(s).
+// |
+// | This license applies to this document only, not any other software
+// | that it may be combined with.
+// |
+// +----------------------------------------------------------------------+
+// | Contributors:
+// | https://www.anuko.com/time_tracker/credits.htm
+// +----------------------------------------------------------------------+
+
+require_once('initialize.php');
+
+$err->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');