Refactoring - more usage of ttUser::isPluginEnabled().
authorNik Okuntseff <support@anuko.com>
Wed, 30 Mar 2016 18:59:22 +0000 (18:59 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 30 Mar 2016 18:59:22 +0000 (18:59 +0000)
21 files changed:
WEB-INF/templates/expense_edit.tpl
WEB-INF/templates/expenses.tpl
WEB-INF/templates/footer.tpl
WEB-INF/templates/header.tpl
WEB-INF/templates/mobile/time.tpl
WEB-INF/templates/mobile/time_edit.tpl
WEB-INF/templates/mobile/timer.tpl
WEB-INF/templates/reports.tpl
WEB-INF/templates/time.tpl
WEB-INF/templates/time_edit.tpl
charts.php
expense_edit.php
expenses.php
invoice_add.php
mobile/time.php
mobile/time_edit.php
mobile/timer.php
reports.php
time.php
time_edit.php
user_add.php

index 4c92129..41e3c2e 100644 (file)
@@ -78,7 +78,7 @@ function get_date() {
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
-      <td align="right">{$i18n.label.client} {if in_array('cm', explode(',', $user->plugins))}(*){/if}:</td>
+      <td align="right">{$i18n.label.client} {if $user->isPluginEnabled('cm')}(*){/if}:</td>
       <td>{$forms.expenseItemForm.client.control}</td>
     </tr>
 {/if}
index a64fbc2..12d9534 100644 (file)
@@ -81,7 +81,7 @@ function get_date() {
 {/if}
 {if $user->isPluginEnabled('cl')}
         <tr>
-          <td align="right">{$i18n.label.client}{if in_array('cm', explode(',', $user->plugins))} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
           <td>{$forms.expensesForm.client.control}</td>
         </tr>
 {/if}
index 6e45a43..b55bc06 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.9.20.3460 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.20.3461 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 4d08cfc..ce8e229 100644 (file)
@@ -105,12 +105,11 @@ With 101% height we essentially force the scrollbar to always appear. -->
             &middot; <a class="mainMenu" href="expenses.php">{$i18n.menu.expenses}</a>
     {/if}
             {if !$user->isClient()}&middot; {/if}<a class="mainMenu" href="reports.php">{$i18n.menu.reports}</a>
-    {if ($user->canManageTeam() || $user->isClient()) && in_array('iv', explode(',', $user->plugins))}
+    {if ($user->canManageTeam() || $user->isClient()) && $user->isPluginEnabled('iv')}
             &middot; <a class="mainMenu" href="invoices.php">{$i18n.title.invoices}</a>
     {/if}
-    {if (in_array('ch', explode(',', $user->plugins)) && !$user->isClient()) && ($smarty.const.MODE_PROJECTS == $user->tracking_mode
-      || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode
-      || in_array('cl', explode(',', $user->plugins)))}
+    {if ($user->isPluginEnabled('ch') && !$user->isClient()) && ($smarty.const.MODE_PROJECTS == $user->tracking_mode
+      || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode || $user->isPluginEnabled('cl'))}
             &middot; <a class="mainMenu" href="charts.php">{$i18n.menu.charts}</a>
     {/if}
     {if !$user->isClient() && ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
@@ -122,7 +121,7 @@ With 101% height we essentially force the scrollbar to always appear. -->
     {if !$user->isClient()}
             &middot; <a class="mainMenu" href="users.php">{$i18n.menu.users}</a>
     {/if}
-    {if $user->canManageTeam() && in_array('cl', explode(',', $user->plugins))}
+    {if $user->canManageTeam() && $user->isPluginEnabled('cl')}
             &middot; <a class="mainMenu" href="clients.php">{$i18n.menu.clients}</a>
     {/if}
     {if $user->isManager()}
index 4371be2..46d8a5e 100644 (file)
@@ -254,7 +254,7 @@ function get_date() {
     <tr><td>{$i18n.label.client}:</td></tr>
     <tr><td>{$forms.timeRecordForm.client.control}</td></tr>
 {/if}
-{if in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('iv')}
     <tr><td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td></tr>
 {/if}
 {if ($custom_fields && $custom_fields->fields[0])}
index 2dbd746..7d1e66f 100644 (file)
@@ -214,7 +214,7 @@ function get_date() {
     <tr><td>{$i18n.label.client}:</td></tr>
     <tr><td>{$forms.timeRecordForm.client.control}</td></tr>
 {/if}
-{if in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('iv')}
     <tr><td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td></tr>
 {/if}
 {if ($custom_fields && $custom_fields->fields[0])} 
index b32da74..5df54cb 100644 (file)
@@ -221,7 +221,7 @@ startTimer();
     <tr><td>{$i18n.label.client}:</td></tr>
     <tr><td>{$forms.timerRecordForm.client.control}</td></tr>
 {/if}
-{if in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('iv')}
     <tr><td><label>{$forms.timerRecordForm.billable.control}{$i18n.form.time.billable}</label></td></tr>
 {/if}
 {if ($custom_fields && $custom_fields->fields[0])}
index b5db6d3..bd5ab3f 100644 (file)
@@ -197,7 +197,7 @@ function handleCheckboxes() {
   {/if}
         </tr>
 {/if}
-{if in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('iv')}
         <tr>
           <td><b>{$i18n.form.time.billable}</b></td>
           <td>&nbsp;</td>
@@ -236,12 +236,12 @@ function handleCheckboxes() {
         <tr>
           <td colspan="3">
             <table border="0" width="100%">
-{if $user->isPluginEnabled('cl') || in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('cl') || $user->isPluginEnabled('iv')}
               <tr>
   {if $user->isPluginEnabled('cl')}
                 <td width="25%"><label>{$forms.reportForm.chclient.control}&nbsp;{$i18n.label.client}</label></td>
   {/if}
-  {if ($user->canManageTeam() || $user->isClient()) && in_array('iv', explode(',', $user->plugins))}
+  {if ($user->canManageTeam() || $user->isClient()) && $user->isPluginEnabled('iv')}
                 <td width="25%"><label>{$forms.reportForm.chinvoice.control}&nbsp;{$i18n.label.invoice}</label></td>
   {/if}
               </tr>
index d161011..089e57c 100644 (file)
@@ -223,13 +223,13 @@ function get_time() {
           <td>{$forms.timeRecordForm.onBehalfUser.control}</td>
         </tr>
 {/if}
-{if in_array('cl', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('cl')}
         <tr>
-          <td align="right">{$i18n.label.client}{if in_array('cm', explode(',', $user->plugins))} (*){/if}:</td>
+          <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
           <td>{$forms.timeRecordForm.client.control}</td>
         </tr>
 {/if}
-{if in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('iv')}
         <tr>
           <td align="right">&nbsp;</td>
           <td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td>
@@ -294,7 +294,7 @@ function get_time() {
 {if $time_records}
       <table border='0' cellpadding='3' cellspacing='1' width="100%">
       <tr>
-  {if in_array('cl', explode(',', $user->plugins))}
+  {if $user->isPluginEnabled('cl')}
         <td width="20%" class="tableHeader">{$i18n.label.client}</td>
   {/if}
   {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
@@ -313,7 +313,7 @@ function get_time() {
       </tr>
   {foreach $time_records as $record}
       <tr bgcolor="{cycle values="#f5f5f5,#ccccce"}" {if !$record.billable} class="not_billable" {/if}>
-    {if in_array('cl', explode(',', $user->plugins))}
+    {if $user->isPluginEnabled('cl')}
         <td valign='top'>{$record.client|escape:'html'}</td>
     {/if}
     {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
index 4a97fc9..03e0008 100644 (file)
@@ -205,13 +205,13 @@ function setNow(formField) {
   <tr>
     <td valign="top">
     <table border="0">
-{if in_array('cl', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('cl')}
     <tr>
-      <td align="right">{$i18n.label.client}{if in_array('cm', explode(',', $user->plugins))} (*){/if}:</td>
+      <td align="right">{$i18n.label.client}{if $user->isPluginEnabled('cm')} (*){/if}:</td>
       <td>{$forms.timeRecordForm.client.control}</td>
     </tr>
 {/if}
-{if in_array('iv', explode(',', $user->plugins))}
+{if $user->isPluginEnabled('iv')}
     <tr>
       <td align="right">&nbsp;</td>
       <td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td>
index 0883450..9dec840 100644 (file)
@@ -67,11 +67,11 @@ if (!$cl_type) {
   $cl_type = $sc->getValue(SYSC_CHART_TYPE);
 }
 if (MODE_TIME == $user->tracking_mode) {
-  if (in_array('cl', explode(',', $user->plugins)))
+  if ($user->isPluginEnabled('cl'))
     $cl_type = CHART_CLIENTS;
 } else {
   if ($cl_type == CHART_CLIENTS) {
-    if (!in_array('cl', explode(',', $user->plugins)))
+    if (!$user->isPluginEnabled('cl'))
       $cl_type = CHART_PROJECTS;       
   } elseif ($cl_type == CHART_TASKS) {
     if (MODE_PROJECTS_AND_TASKS != $user->tracking_mode)
@@ -154,15 +154,14 @@ $chart_form->addInput(array('type' => 'combobox',
 ));
 
 // Chart type options.
-$chart_selector = (MODE_PROJECTS_AND_TASKS == $user->tracking_mode
-  || in_array('cl', explode(',', $user->plugins)));
+$chart_selector = (MODE_PROJECTS_AND_TASKS == $user->tracking_mode || $user->isPluginEnabled('cl'));
 if ($chart_selector) {
   $types = array();
   if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
     $types[CHART_PROJECTS] = $i18n->getKey('dropdown.projects');
   if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
     $types[CHART_TASKS] = $i18n->getKey('dropdown.tasks');
-  if (in_array('cl', explode(',', $user->plugins)))
+  if ($user->isPluginEnabled('cl'))
     $types[CHART_CLIENTS] = $i18n->getKey('dropdown.clients');
 
   // Add chart type dropdown.
index abd5c39..16b9abb 100644 (file)
@@ -68,7 +68,7 @@ if ($request->isPost()) {
 $form = new Form('expenseItemForm');
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
   $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
   $form->addInput(array('type'=>'combobox',
     'onchange'=>'fillProjectDropdown(this.value);',
@@ -93,7 +93,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming. 
     foreach($project_list as $project)
@@ -131,7 +131,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getK
 
 if ($request->isPost()) {
   // Validate user input.
-  if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
     $err->add($i18n->getKey('error.client'));
   if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
     if (!$cl_project) $err->add($i18n->getKey('error.project'));
index 307c9c0..f1319e0 100644 (file)
@@ -75,7 +75,7 @@ if ($user->canManageTeam()) {
 }
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
@@ -101,7 +101,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming. 
     foreach($project_list as $project)
@@ -145,7 +145,7 @@ if ($lock_interval > 0) {
 if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
     // Validate user input.
-    if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
       $err->add($i18n->getKey('error.client'));
     if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
       if (!$cl_project) $err->add($i18n->getKey('error.project'));
index 0efc99e..f68753f 100644 (file)
@@ -50,7 +50,7 @@ $form = new Form('invoiceForm');
 $form->addInput(array('type'=>'datefield','name'=>'date','size'=>'20','value'=>$cl_date));
 
 // Dropdown for clients if the clients plugin is enabled.
-if (in_array('cl', explode(',', $user->plugins))) {
+if ($user->isPluginEnabled('cl')) {
   $clients = ttTeamHelper::getActiveClients($user->team_id);
   $form->addInput(array('type'=>'combobox','name'=>'client','style'=>'width: 250px;','data'=>$clients,'datakeys'=>array('id','name'),'value'=>$cl_client,'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 }
index 268bf9b..b7a26b6 100644 (file)
@@ -69,7 +69,7 @@ $cl_note = trim($request->getParameter('note'));
 $cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1'])));
 $_SESSION['cf_1'] = $cl_cf_1;
 $cl_billable = 1;
-if (in_array('iv', explode(',', $user->plugins))) {
+if ($user->isPluginEnabled('iv')) {
   if ($request->isPost()) {
     $cl_billable = $request->getParameter('billable');
     $_SESSION['billable'] = (int) $cl_billable;
@@ -88,7 +88,7 @@ $_SESSION['task'] = $cl_task;
 $form = new Form('timeRecordForm');
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
@@ -114,7 +114,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming. 
     foreach($project_list as $project)
@@ -164,7 +164,7 @@ if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READON
 if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
   $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');"));
 $form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 250px; height: 60px;','value'=>$cl_note));
-if (in_array('iv', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click.
 $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit')));
@@ -196,7 +196,7 @@ if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
-    if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
       $err->add($i18n->getKey('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
index dbba54a..f2083ee 100644 (file)
@@ -70,7 +70,7 @@ if ($request->isPost()) {
   $cl_project = $request->getParameter('project');
   $cl_task = $request->getParameter('task');
   $cl_billable = 1;
-  if (in_array('iv', explode(',', $user->plugins)))
+  if ($user->isPluginEnabled('iv'))
     $cl_billable = $request->getParameter('billable');
 } else {
   $cl_client = $time_rec['client_id'];
@@ -106,7 +106,7 @@ if ($request->isPost()) {
 $form = new Form('timeRecordForm');
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
@@ -132,7 +132,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming.
     foreach($project_list as $project)
@@ -201,7 +201,7 @@ if ($custom_fields && $custom_fields->fields[0]) {
 }
 // Hidden control for record id.
 $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
-if (in_array('iv', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_save click.
 $form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.save')));
@@ -210,7 +210,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getK
 if ($request->isPost()) {
 
   // Validate user input.
-  if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
     $err->add($i18n->getKey('error.client'));
   if ($custom_fields) {
     if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
index 7dfdc99..949d585 100644 (file)
@@ -64,7 +64,7 @@ $cl_finish = trim($request->getParameter('browser_time'));
 $cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1'])));
 $_SESSION['cf_1'] = $cl_cf_1;
 $cl_billable = 1;
-if (in_array('iv', explode(',', $user->plugins))) {
+if ($user->isPluginEnabled('iv')) {
   if ($request->isPost()) {
     $cl_billable = $request->getParameter('billable');
     $_SESSION['billable'] = (int) $cl_billable;
@@ -87,7 +87,7 @@ $enable_controls = ($uncompleted == null);
 $form = new Form('timerRecordForm');
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
@@ -115,7 +115,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming. 
     foreach($project_list as $project)
@@ -154,7 +154,7 @@ if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
     'datakeys'=>array('id','name'),
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 }
-if (in_array('iv', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable,'enable'=>$enable_controls));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on button click.
 $form->addInput(array('type'=>'hidden','name'=>'browser_time','value'=>''));  // User current time, which gets filled in on button click.
@@ -194,7 +194,7 @@ if ($request->isPost()) {
     $cl_finish = null;
 
     // Validate user input.
-    if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
       $err->add($i18n->getKey('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
index c8b34cc..4947e4d 100644 (file)
@@ -66,7 +66,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_generate','value'=>$i18n->ge
 $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete'),'onclick'=>"return confirm('".$i18n->getKey('form.reports.confirm_delete')."')"));
 
 // Dropdown for clients if the clients plugin is enabled.
-if (in_array('cl', explode(',', $user->plugins)) && !($user->isClient() && $user->client_id)) {
+if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id)) {
   if ($user->canManageTeam() || ($user->isClient() && !$user->client_id))
     $client_list = ttClientHelper::getClients($user->team_id);
   else
@@ -171,9 +171,9 @@ $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'start_date'
 $form->addInput(array('type'=>'datefield','maxlength'=>'20','name'=>'end_date'));
 
 // Add checkboxes for fields.
-if (in_array('cl', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('cl'))
   $form->addInput(array('type'=>'checkbox','name'=>'chclient','data'=>1));
-if (($user->canManageTeam() || $user->isClient()) && in_array('iv', explode(',', $user->plugins)))
+if (($user->canManageTeam() || $user->isClient()) && $user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'chinvoice','data'=>1));
 if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
   $form->addInput(array('type'=>'checkbox','name'=>'chproject','data'=>1));
@@ -196,7 +196,7 @@ $group_by_options['no_grouping'] = $i18n->getKey('form.reports.group_by_no');
 $group_by_options['date'] = $i18n->getKey('form.reports.group_by_date');
 if ($user->canManageTeam() || $user->isClient())
   $group_by_options['user'] = $i18n->getKey('form.reports.group_by_user');
-if (in_array('cl', explode(',', $user->plugins)) && !($user->isClient() && $user->client_id))
+if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id))
   $group_by_options['client'] = $i18n->getKey('form.reports.group_by_client');
 if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
   $group_by_options['project'] = $i18n->getKey('form.reports.group_by_project');
index 193f7a2..047556b 100644 (file)
--- a/time.php
+++ b/time.php
@@ -72,7 +72,7 @@ $cl_note = trim($request->getParameter('note'));
 $cl_cf_1 = trim($request->getParameter('cf_1', ($request->getMethod()=='POST'? null : @$_SESSION['cf_1'])));
 $_SESSION['cf_1'] = $cl_cf_1;
 $cl_billable = 1;
-if (in_array('iv', explode(',', $user->plugins))) {
+if ($user->isPluginEnabled('iv')) {
   if ($request->isPost()) {
     $cl_billable = $request->getParameter('billable');
     $_SESSION['billable'] = (int) $cl_billable;
@@ -106,7 +106,7 @@ if ($user->canManageTeam()) {
 }
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
   $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
   $form->addInput(array('type'=>'combobox',
     'onchange'=>'fillProjectDropdown(this.value);',
@@ -132,7 +132,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming. 
     foreach($project_list as $project)
@@ -185,7 +185,7 @@ if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
   $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');"));
 $form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 600px; height: 40px;','value'=>$cl_note));
 $form->addInput(array('type'=>'calendar','name'=>'date','value'=>$cl_date)); // calendar
-if (in_array('iv', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click.
 $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit')));
@@ -217,7 +217,7 @@ if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
-    if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
       $err->add($i18n->getKey('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
index 5dad555..18638b0 100644 (file)
@@ -70,7 +70,7 @@ if ($request->isPost()) {
   $cl_project = $request->getParameter('project');
   $cl_task = $request->getParameter('task');
   $cl_billable = 1;
-  if (in_array('iv', explode(',', $user->plugins)))
+  if ($user->isPluginEnabled('iv'))
     $cl_billable = $request->getParameter('billable');
 } else {
   $cl_client = $time_rec['client_id'];
@@ -106,7 +106,7 @@ if ($request->isPost()) {
 $form = new Form('timeRecordForm');
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
-if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
+if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) {
   $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
   $form->addInput(array('type'=>'combobox',
     'onchange'=>'fillProjectDropdown(this.value);',
@@ -132,7 +132,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
-  if (in_array('cl', explode(',', $user->plugins))) {
+  if ($user->isPluginEnabled('cl')) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
     // We need an array of assigned project ids to do some trimming.
     foreach($project_list as $project)
@@ -201,7 +201,7 @@ if ($custom_fields && $custom_fields->fields[0]) {
 }
 // Hidden control for record id.
 $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
-if (in_array('iv', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_save or btn_copy click.
 $form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.save')));
@@ -211,7 +211,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getK
 if ($request->isPost()) {
 
   // Validate user input.
-  if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
+  if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
     $err->add($i18n->getKey('error.client'));
   if ($custom_fields) {
     if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
index 5930085..403c6ca 100644 (file)
@@ -43,7 +43,7 @@ if (!ttAccessCheck(right_manage_team)) {
 // The "limit" plugin is not required for normal operation of the Time Tracker.
 @include('plugins/limit/user_add.php');
 
-if (in_array('cl', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('cl'))
   $clients = ttTeamHelper::getActiveClients($user->team_id);
 
 $assigned_projects = array();
@@ -84,10 +84,10 @@ $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','value'=
 
 $roles[ROLE_USER] = $i18n->getKey('label.user');
 $roles[ROLE_COMANAGER] = $i18n->getKey('form.users.comanager');
-if (in_array('cl', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('cl'))
   $roles[ROLE_CLIENT] = $i18n->getKey('label.client');
 $form->addInput(array('type'=>'combobox','onchange'=>'handleClientControl()','name'=>'role','value'=>$cl_role,'data'=>$roles));
-if (in_array('cl', explode(',', $user->plugins)))
+if ($user->isPluginEnabled('cl'))
   $form->addInput(array('type'=>'combobox','name'=>'client','value'=>$cl_client_id,'data'=>$clients,'datakeys'=>array('id', 'name'),'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
 $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate));