diff --git a/lhc_web/modules/lhabstract/copyautoresponder.php b/lhc_web/modules/lhabstract/copyautoresponder.php index 4a7a48bddb..57ab6be094 100644 --- a/lhc_web/modules/lhabstract/copyautoresponder.php +++ b/lhc_web/modules/lhabstract/copyautoresponder.php @@ -6,14 +6,14 @@ if (isset($_POST['CopyAction'])) { - $definition = array( + $definition = [ 'CopyDepartments' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'int', null, FILTER_REQUIRE_ARRAY ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( !$form->hasValidData( 'CopyDepartments' ) || empty($form->CopyDepartments)) { @@ -43,5 +43,3 @@ $Result['content'] = $tpl->fetch(); $Result['pagelayout'] = 'popup'; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhabstract/delete.php b/lhc_web/modules/lhabstract/delete.php index ac60d71bdc..83b222dea2 100644 --- a/lhc_web/modules/lhabstract/delete.php +++ b/lhc_web/modules/lhabstract/delete.php @@ -1,6 +1,6 @@ dispatch('abstract.delete_'.strtolower($Params['user_parameters']['identifier']).'_general', array()); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.delete_'.strtolower($Params['user_parameters']['identifier']).'_general', []); if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) { die('Invalid CSFR Token'); @@ -62,15 +62,15 @@ $ObjectData->removeThis(); -erLhcoreClassLog::logObjectChange(array( +erLhcoreClassLog::logObjectChange([ 'object' => $ObjectData, 'check_log' => true, 'action' => 'Delete', - 'msg' => array( + 'msg' => [ 'delete' => $ObjectData->getState(), 'user_id' => $currentUser->getUserID() - ) -)); + ] +]); $cache = CSCacheAPC::getMem(); $cache->increaseCacheVersion('site_attributes_version'); @@ -82,5 +82,3 @@ erLhcoreClassModule::redirect('abstract/list','/'.$Params['user_parameters']['identifier'] . $extension); } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhabstract/edit.php b/lhc_web/modules/lhabstract/edit.php index 8446beb778..626eca49f5 100644 --- a/lhc_web/modules/lhabstract/edit.php +++ b/lhc_web/modules/lhabstract/edit.php @@ -1,6 +1,6 @@ dispatch('abstract.edit_'.strtolower($Params['user_parameters']['identifier']).'_general', array()); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.edit_'.strtolower($Params['user_parameters']['identifier']).'_general', []); $tpl = erLhcoreClassTemplate::getInstance('lhabstract/edit.tpl.php'); @@ -84,15 +84,15 @@ $currentState = $ObjectData->getState(); - erLhcoreClassLog::logObjectChange(array( + erLhcoreClassLog::logObjectChange([ 'object' => $ObjectData, 'check_log' => true, - 'msg' => array( + 'msg' => [ 'prev' => $previousState, 'curr' => $currentState, 'user_id' => $currentUser->getUserID() - ) - )); + ] + ]); if (isset($_POST['SaveClient'])){ erLhcoreClassModule::redirect('abstract/list','/'.$Params['user_parameters']['identifier'] . $extension); @@ -141,13 +141,14 @@ } else { $Result['path'] = $object_trans['path']; } - $Result['path'][] = array('url' => erLhcoreClassDesign::baseurl('abstract/list').'/'.$Params['user_parameters']['identifier'] . $extension, 'title' => $object_trans['name']); - $Result['path'][] = array('title' =>erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons','Edit')); + $Result['path'][] = ['url' => erLhcoreClassDesign::baseurl('abstract/list') . '/' . $Params['user_parameters']['identifier'] . $extension, 'title' => $object_trans['name']]; + $Result['path'][] = ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons', 'Edit')]; } else { - $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode','System configuration')), - array('url' => erLhcoreClassDesign::baseurl('abstract/list').'/'.$Params['user_parameters']['identifier'] . $extension, 'title' => $object_trans['name']), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons','Edit')) - ); + $Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('abstract/list') . '/' . $Params['user_parameters']['identifier'] . $extension, 'title' => $object_trans['name']], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons', 'Edit')] + ]; } -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.edit_'.strtolower($Params['user_parameters']['identifier']).'_path', array('result' => & $Result)); \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.edit_'.strtolower($Params['user_parameters']['identifier']).'_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhabstract/list.php b/lhc_web/modules/lhabstract/list.php index 3ec666e3ed..f72d94209d 100644 --- a/lhc_web/modules/lhabstract/list.php +++ b/lhc_web/modules/lhabstract/list.php @@ -1,6 +1,6 @@ dispatch('abstract.list_'.strtolower($Params['user_parameters']['identifier']).'_general', array()); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.list_'.strtolower($Params['user_parameters']['identifier']).'_general', []); $tpl = erLhcoreClassTemplate::getInstance( 'lhabstract/list.tpl.php'); $tpl->set('extension',''); @@ -26,15 +26,15 @@ } $append = ''; -$filterParams['filter'] = array(); +$filterParams['filter'] = []; if ( isset($objectData->has_filter) && $objectData->has_filter === true ) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'abstract', 'module_file' => $objectData->filter_name, 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'abstract', 'module_file' => $objectData->filter_name, 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']); $tpl->set('filter', $objectData->filter_name); } -$filterObject = array(); +$filterObject = []; if ( method_exists($objectData,'getFilter') ) { $filterObject = $objectData->getFilter($filterParams['input_form']); } @@ -192,13 +192,13 @@ $Result['path'] = $object_trans['path']; } - $Result['path'][] = array('title' => $object_trans['name']); + $Result['path'][] = ['title' => $object_trans['name']]; } else { - $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode','System configuration')), - array('title' => $object_trans['name']) - ); + $Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')], + ['title' => $object_trans['name']] + ]; }; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.list_'.strtolower($Params['user_parameters']['identifier']).'_path', array('result' => & $Result)); -?> \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.list_'.strtolower($Params['user_parameters']['identifier']).'_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhabstract/module.php b/lhc_web/modules/lhabstract/module.php index 970c788778..648ad81e8c 100644 --- a/lhc_web/modules/lhabstract/module.php +++ b/lhc_web/modules/lhabstract/module.php @@ -1,68 +1,48 @@ "Abstract module"); - -$ViewList = array(); - -$ViewList['new'] = array( - 'functions' => array( 'use' ), - 'params' => array('identifier'), - 'uparams' => array('extension') -); - -$ViewList['list'] = array( - 'functions' => array( 'use' ), - 'params' => array('identifier'), - 'uparams' => array( - 'extension', - 'name', - 'pinned', - 'internal', - 'object_id', - 'user_id', - 'category', - 'source', - 'message', - 'timefrom','timefrom_hours','timefrom_seconds','timefrom_minutes', - 'timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours', - 'action','csfr','include_archive','dep_id','object_identifier' - ), - 'multiple_arguments' => array('dep_id') -); - -$ViewList['downloadbinnary'] = array( - 'functions' => array( 'use' ), - 'params' => array('identifier','object_id') -); - -$ViewList['copyautoresponder'] = array( - 'functions' => array( 'use' ), - 'params' => array('id') -); - -$ViewList['edit'] = array( - 'functions' => array( 'use' ), - 'params' => array('identifier','object_id'), - 'uparams' => array('extension','action','csfr') -); - -$ViewList['delete'] = array( - 'functions' => array( 'use' ), - 'params' => array('identifier','object_id'), - 'uparams' => array('csfr','extension') -); - -$ViewList['index'] = array( - 'functions' => array( 'use' ), - 'params' => array() -); - -$ViewList['testmasking'] = array( - 'functions' => array( 'use' ), - 'params' => array() -); - -$FunctionList = array(); -$FunctionList['use'] = array('explain' => 'Allow to use abstract module'); - -?> \ No newline at end of file +$Module = ['name' => 'Abstract module']; +$default = ['functions' => ['use']]; + +$ViewList = [ + 'new' => $default + [ + 'params' => ['identifier'], + 'uparams' => ['extension'], + ], + 'list' => $default + [ + 'params' => ['identifier'], + 'uparams' => [ + 'extension', 'name', 'pinned', 'internal', + 'object_id', 'user_id', 'category', 'source', + 'message', 'timefrom', 'timefrom_hours', + 'timefrom_seconds', 'timefrom_minutes', + 'timeto', 'timeto_minutes', 'timeto_seconds', + 'timeto_hours', 'action', 'csfr', 'include_archive', + 'dep_id', 'object_identifier', + ], + 'multiple_arguments' => ['dep_id'], + ], + 'downloadbinnary' => $default + [ + 'params' => ['identifier', 'object_id'], + ], + 'copyautoresponder' => $default + [ + 'params' => ['id'], + ], + 'edit' => $default + [ + 'params' => ['identifier', 'object_id'], + 'uparams' => ['extension', 'action', 'csfr'], + ], + 'delete' => $default + [ + 'params' => ['identifier', 'object_id'], + 'uparams' => ['csfr', 'extension'], + ], + 'index' => $default + [ + 'params' => [], + ], + 'testmasking' => $default + [ + 'params' => [], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow to use abstract module'], +]; diff --git a/lhc_web/modules/lhabstract/new.php b/lhc_web/modules/lhabstract/new.php index a7352c24a6..3b95afd42a 100644 --- a/lhc_web/modules/lhabstract/new.php +++ b/lhc_web/modules/lhabstract/new.php @@ -1,6 +1,6 @@ dispatch('abstract.new_'.strtolower($Params['user_parameters']['identifier']).'_general', array()); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.new_'.strtolower($Params['user_parameters']['identifier']).'_general', []); $tpl = erLhcoreClassTemplate::getInstance('lhabstract/new.tpl.php'); $extension = ''; @@ -42,7 +42,7 @@ $Errors = erLhcoreClassAbstract::validateInput($objectData); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.before_created.'.strtolower($objectClass),array('object' => & $objectData, 'errors' => & $Errors)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.before_created.'.strtolower($objectClass), ['object' => & $objectData, 'errors' => & $Errors]); if (count($Errors) == 0) { @@ -57,16 +57,16 @@ erLhcoreClassAbstract::getSession()->update($objectData); } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.created.'.strtolower($objectClass),array('object' => & $objectData)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.created.'.strtolower($objectClass), ['object' => & $objectData]); - erLhcoreClassLog::logObjectChange(array( + erLhcoreClassLog::logObjectChange([ 'object' => $objectData, 'check_log' => true, - 'msg' => array( + 'msg' => [ 'new' => $objectData->getState(), 'user_id' => $currentUser->getUserID() - ) - )); + ] + ]); if ( isset($_POST['SaveClient']) ) { erLhcoreClassModule::redirect('abstract/list','/'.$Params['user_parameters']['identifier'] . $extension); @@ -116,13 +116,14 @@ } else { $Result['path'] = $object_trans['path']; } - $Result['path'][] = array('url' => erLhcoreClassDesign::baseurl('abstract/list').'/'.$Params['user_parameters']['identifier'], 'title' => $object_trans['name']); - $Result['path'][] = array('title' =>erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons','New')); + $Result['path'][] = ['url' => erLhcoreClassDesign::baseurl('abstract/list') . '/' . $Params['user_parameters']['identifier'], 'title' => $object_trans['name']]; + $Result['path'][] = ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons', 'New')]; } else { - $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode','System configuration')), - array('url' => erLhcoreClassDesign::baseurl('abstract/list').'/'.$Params['user_parameters']['identifier'], 'title' => $object_trans['name']), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons','New')) - ); + $Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('abstract/list') . '/' . $Params['user_parameters']['identifier'], 'title' => $object_trans['name']], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons', 'New')] + ]; } -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.new_'.strtolower($Params['user_parameters']['identifier']).'_path', array('result' => & $Result)); \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('abstract.new_'.strtolower($Params['user_parameters']['identifier']).'_path', ['result' => & $Result]); \ No newline at end of file diff --git a/lhc_web/modules/lhaudit/configuration.php b/lhc_web/modules/lhaudit/configuration.php index 539dffebfe..d191fd0eb6 100644 --- a/lhc_web/modules/lhaudit/configuration.php +++ b/lhc_web/modules/lhaudit/configuration.php @@ -18,7 +18,7 @@ $data = (array)$auditOptions->data; if ( isset($_POST['ReloadOperatorsBackOffice']) ) { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.reload_backoffice',array()); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.reload_backoffice',[]); } if ( isset($_POST['StoreOptions']) ) { @@ -28,7 +28,7 @@ exit; } - $definition = array( + $definition = [ 'days_log' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'log_js' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'log_user' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), @@ -37,10 +37,10 @@ 'log_routing' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'log_custom_reply' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'log_objects' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw',null,FILTER_REQUIRE_ARRAY), - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( $form->hasValidData( 'days_log' )) { $data['days_log'] = $form->days_log ; @@ -51,7 +51,7 @@ if ( $form->hasValidData( 'log_objects' )) { $data['log_objects'] = $form->log_objects ; } else { - $data['log_objects'] = array(); + $data['log_objects'] = []; } if ( $form->hasValidData( 'log_js' )) { @@ -104,11 +104,9 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','System configuration')), - array( +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit', 'System configuration')], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('audit/options', 'Options') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhaudit/copycurl.php b/lhc_web/modules/lhaudit/copycurl.php index 4c383b565e..47772fe695 100644 --- a/lhc_web/modules/lhaudit/copycurl.php +++ b/lhc_web/modules/lhaudit/copycurl.php @@ -112,7 +112,7 @@ function constructCurlCommandFromJson(string $jsonInput): string } if ($method !== null) { - $headers = array(); + $headers = []; // Add custom headers from method configuration if (isset($method['header']) && !empty($method['header'])) { @@ -312,4 +312,3 @@ function constructCurlCommandFromJson(string $jsonInput): string echo $tpl->fetch(); exit; -?> \ No newline at end of file diff --git a/lhc_web/modules/lhaudit/module.php b/lhc_web/modules/lhaudit/module.php index 48f2405ecc..315dc9a160 100644 --- a/lhc_web/modules/lhaudit/module.php +++ b/lhc_web/modules/lhaudit/module.php @@ -1,62 +1,54 @@ "Audit", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['configuration'] = array( - 'params' => array(), - 'uparams' => array('csfr','action','id'), - 'functions' => array( 'use' ), -); - -$ViewList['loginhistory'] = array( - 'params' => array(), - 'uparams' => array('user_id'), - 'functions' => array( 'use' ), -); - -$ViewList['debuginvitation'] = array( - 'params' => array('ouser_id','invitation_id','tag'), - 'uparams' => array('action'), - 'functions' => array( 'use' ), -); - -$ViewList['logrecord'] = array( - 'params' => array('id'), - 'functions' => array( 'log_preview' ), -); - -$ViewList['logjserror'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( ), -); - -$ViewList['test'] = array( - 'params' => array(), - 'uparams' => array() -); - -$ViewList['copycurl'] = array( - 'params' => array('id','scope'), - 'uparams' => array(), - 'functions' => array( 'see_audit_system' ), -); - -$ViewList['previewmessages'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'preview_messages' ), -); - -$FunctionList['use'] = array('explain' => 'Allow operator to configure audit module'); -$FunctionList['log_preview'] = array('explain' => 'Allow operator to preview log record'); -$FunctionList['see_system'] = array('explain' => 'Allow operator to see system status'); -$FunctionList['see_audit_system'] = array('explain' => 'Allow operator to see audit system messages'); -$FunctionList['ignore_view_actions'] = array('explain' => 'Do not log view actions from operator'); -$FunctionList['see_op_actions'] = array('explain' => 'Allow operator to see other operator logged actions'); -$FunctionList['preview_messages'] = array('explain' => 'Allow operator to preview chat messages as visitor'); - -?> \ No newline at end of file +$Module = ['name' => 'Audit', 'variable_params' => true]; + +$ViewList = [ + 'configuration' => [ + 'params' => [], + 'uparams' => ['csfr', 'action', 'id'], + 'functions' => ['use'], + ], + 'loginhistory' => [ + 'params' => [], + 'uparams' => ['user_id'], + 'functions' => ['use'], + ], + 'debuginvitation' => [ + 'params' => ['ouser_id', 'invitation_id', 'tag'], + 'uparams' => ['action'], + 'functions' => ['use'], + ], + 'logrecord' => [ + 'params' => ['id'], + 'functions' => ['log_preview'], + ], + 'logjserror' => [ + 'params' => [], + 'uparams' => [], + 'functions' => [], + ], + 'test' => [ + 'params' => [], + 'uparams' => [], + ], + 'copycurl' => [ + 'params' => ['id', 'scope'], + 'uparams' => [], + 'functions' => ['see_audit_system'], + ], + 'previewmessages' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['preview_messages'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow operator to configure audit module'], + 'log_preview' => ['explain' => 'Allow operator to preview log record'], + 'see_system' => ['explain' => 'Allow operator to see system status'], + 'see_audit_system' => ['explain' => 'Allow operator to see audit system messages'], + 'ignore_view_actions' => ['explain' => 'Do not log view actions from operator'], + 'see_op_actions' => ['explain' => 'Allow operator to see other operator logged actions'], + 'preview_messages' => ['explain' => 'Allow operator to preview chat messages as visitor'], +]; diff --git a/lhc_web/modules/lhautoresponder/module.php b/lhc_web/modules/lhautoresponder/module.php index f347eac33f..06914bada5 100644 --- a/lhc_web/modules/lhautoresponder/module.php +++ b/lhc_web/modules/lhautoresponder/module.php @@ -1,10 +1,10 @@ "Auto responder"); +$Module = ['name' => 'Auto responder']; -$ViewList = array(); -$FunctionList['see_global'] = array('explain' => 'Allow operator to see global auto responders'); -$FunctionList['exploreautoresponder'] = array('explain' =>'Allow operator to explore auto responder messages. They will see auto responders messages based on departments they are a member of.'); -$FunctionList['exploreautoresponder_all'] = array('explain' =>'Allow operator to explore auto responder messages. They will see all department\'s auto responders.'); - -?> \ No newline at end of file +$ViewList = []; +$FunctionList = [ + 'see_global' => ['explain' => 'Allow operator to see global auto responders'], + 'exploreautoresponder' => ['explain' =>'Allow operator to explore auto responder messages. They will see auto responders messages based on departments they are a member of.'], + 'exploreautoresponder_all' => ['explain' =>'Allow operator to explore auto responder messages. They will see all department\'s auto responders.'] +]; diff --git a/lhc_web/modules/lhbrowseoffer/htmlcode.php b/lhc_web/modules/lhbrowseoffer/htmlcode.php index e0ccaf69cf..33f95ad6f5 100644 --- a/lhc_web/modules/lhbrowseoffer/htmlcode.php +++ b/lhc_web/modules/lhbrowseoffer/htmlcode.php @@ -1,6 +1,6 @@ dispatch('browseoffer.htmlcode', array()); +$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('browseoffer.htmlcode', []); $tpl = erLhcoreClassTemplate::getInstance( 'lhbrowseoffer/htmlcode.tpl.php'); @@ -8,8 +8,7 @@ $tpl->set('locales',$cfgSite->getSetting( 'site', 'available_site_access' )); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('browseoffer/index'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('browseoffer/index','Browse offers')), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode','HTML code'))) - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('browseoffer/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('browseoffer/index', 'Browse offers')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'HTML code')] +]; diff --git a/lhc_web/modules/lhbrowseoffer/index.php b/lhc_web/modules/lhbrowseoffer/index.php index 520f5af77d..a01cdc031f 100644 --- a/lhc_web/modules/lhbrowseoffer/index.php +++ b/lhc_web/modules/lhbrowseoffer/index.php @@ -1,10 +1,8 @@ dispatch('browseoffer.index', array()); +$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('browseoffer.index', []); $tpl = erLhcoreClassTemplate::getInstance( 'lhbrowseoffer/index.tpl.php'); $Result['content'] = $tpl->fetch(); -$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('browseoffer/index','Browse offers'))); - -?> \ No newline at end of file +$Result['path'] = [['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('browseoffer/index','Browse offers')]]; diff --git a/lhc_web/modules/lhbrowseoffer/module.php b/lhc_web/modules/lhbrowseoffer/module.php index 19980a2d4e..ff5de56828 100644 --- a/lhc_web/modules/lhbrowseoffer/module.php +++ b/lhc_web/modules/lhbrowseoffer/module.php @@ -1,47 +1,41 @@ - "Browse offers"); - -$ViewList = array(); - -$ViewList['getstatus'] = array( - 'script' => 'getstatus.php', - 'params' => array(), - 'functions' => array( ), - 'uparams' => array('size','units','identifier','height','canreopen','showoverlay','timeout') -); - -$ViewList['htmlcode'] = array( - 'script' => 'htmlcode.php', - 'params' => array(), - 'functions' => array( 'manage_bo' ) -); - -$ViewList['index'] = array( - 'script' => 'index.php', - 'params' => array(), - 'functions' => array( 'manage_bo' ) -); - -$ViewList['widget'] = array( - 'script' => 'widget.php', - 'params' => array('hash'), - 'functions' => array( ) -); - -$ViewList['widgetclosed'] = array( - 'script' => 'widgetclosed.php', - 'params' => array('id'), - 'functions' => array( ) -); - -$ViewList['addhit'] = array( - 'script' => 'addhit.php', - 'params' => array('hash'), - 'functions' => array( ) -); - -$FunctionList = array(); -$FunctionList['manage_bo'] = array('explain' => 'Allow user to manage browse offers'); - -?> \ No newline at end of file + 'Browse offers']; + +$ViewList = [ + 'getstatus' => [ + 'script' => 'getstatus.php', + 'params' => [], + 'functions' => [], + 'uparams' => ['size', 'units', 'identifier', 'height', 'canreopen', 'showoverlay', 'timeout'], + ], + 'htmlcode' => [ + 'script' => 'htmlcode.php', + 'params' => [], + 'functions' => ['manage_bo'], + ], + 'index' => [ + 'script' => 'index.php', + 'params' => [], + 'functions' => ['manage_bo'], + ], + 'widget' => [ + 'script' => 'widget.php', + 'params' => ['hash'], + 'functions' => [], + ], + 'widgetclosed' => [ + 'script' => 'widgetclosed.php', + 'params' => ['id'], + 'functions' => [], + ], + 'addhit' => [ + 'script' => 'addhit.php', + 'params' => ['hash'], + 'functions' => [], + ], +]; + +$FunctionList = [ + 'manage_bo' => ['explain' => 'Allow user to manage browse offers'], +]; diff --git a/lhc_web/modules/lhcannedmsg/filter.php b/lhc_web/modules/lhcannedmsg/filter.php index c9a68cd19a..8b2663bda3 100644 --- a/lhc_web/modules/lhcannedmsg/filter.php +++ b/lhc_web/modules/lhcannedmsg/filter.php @@ -16,11 +16,11 @@ $q = (isset($_GET['q']) ? $_GET['q'] : ''); -$canned_options = erLhcoreClassModelCannedMsg::groupItems(erLhcoreClassModelCannedMsg::getCannedMessages($chat->dep_id, erLhcoreClassUser::instance()->getUserID(), array( +$canned_options = erLhcoreClassModelCannedMsg::groupItems(erLhcoreClassModelCannedMsg::getCannedMessages($chat->dep_id, erLhcoreClassUser::instance()->getUserID(), [ 'q' => $q -)), $chat, erLhcoreClassUser::instance()->getUserData(true)); +]), $chat, erLhcoreClassUser::instance()->getUserData(true)); -$cannedMessagesFormated = array(); +$cannedMessagesFormated = []; $itemSelected = false; $expandAll = $q != ''; @@ -40,34 +40,33 @@ $typeTitle = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat', 'Global'); } - $items = array(); + $items = []; foreach ($group as $item) { $selected = $itemSelected == false; $itemSelected = true; - $items[] = array( + $items[] = [ 'msg' => $item->msg_to_user, 'delay' => $item->delay, 'message_title' => $item->message_title, 'id' => $item->id, 'subject_ids' => (is_array($item->subjects_ids) ? implode(',',$item->subjects_ids) : null), 'current' => $selected - ); + ]; } - $cannedMessagesFormated[] = array( + $cannedMessagesFormated[] = [ 'messages' => $items, 'title' => $typeTitle, 'expanded' => ($expandAll || $expandedDefault == false) - ); + ]; $expandedDefault = true; } -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('cannedmsg.filter',array('q' => $q, 'cannedmessages' => & $cannedMessagesFormated, 'chat' => & $chat)); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('cannedmsg.filter', ['q' => $q, 'cannedmessages' => & $cannedMessagesFormated, 'chat' => & $chat]); echo json_encode($cannedMessagesFormated); exit; -?> \ No newline at end of file diff --git a/lhc_web/modules/lhcannedmsg/import.php b/lhc_web/modules/lhcannedmsg/import.php index 91b71ccbc8..3012c8dee0 100644 --- a/lhc_web/modules/lhcannedmsg/import.php +++ b/lhc_web/modules/lhcannedmsg/import.php @@ -13,21 +13,21 @@ $errors = []; - if (!erLhcoreClassSearchHandler::isFile('files',array('csv')) || !mb_check_encoding(file_get_contents($_FILES['files']["tmp_name"]), 'UTF-8')) { + if (!erLhcoreClassSearchHandler::isFile('files',['csv']) || !mb_check_encoding(file_get_contents($_FILES['files']["tmp_name"]), 'UTF-8')) { $errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('canned/import','File is not UTF-8 encoded!'); } if (empty($errors)) { $dir = 'var/tmpfiles/'; - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('theme.temppath', array('dir' => & $dir)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('theme.temppath', ['dir' => & $dir]); erLhcoreClassFileUpload::mkdirRecursive( $dir ); $filename = erLhcoreClassSearchHandler::moveUploadedFile('files', $dir); $header = NULL; - $data = array(); + $data = []; if (($handle = fopen($dir . $filename, 'r')) !== FALSE) { @@ -48,16 +48,16 @@ $canned[] = 'tags_plain'; $canned[] = 'department_ids_front'; - $stats = array( + $stats = [ 'updated' => 0, 'imported' => 0, 'removed' => 0, - ); + ]; if ($canned === $header) { if (isset($_POST['remove_old']) && $_POST['remove_old'] == true) { - foreach (erLhcoreClassModelCannedMsg::getList(array('limit' => false)) as $oldCanned) { + foreach (erLhcoreClassModelCannedMsg::getList(['limit' => false]) as $oldCanned) { $oldCanned->removeThis(); $stats['removed']++; } @@ -68,7 +68,7 @@ $cannedMessage = null; if (!empty($item['unique_id'])) { - $cannedMessage = erLhcoreClassModelCannedMsg::findOne(array('filter' => array('unique_id' => $item['unique_id']))); + $cannedMessage = erLhcoreClassModelCannedMsg::findOne(['filter' => ['unique_id' => $item['unique_id']]]); } if (!($cannedMessage instanceof erLhcoreClassModelCannedMsg)) { @@ -101,7 +101,7 @@ $subjectsPlain[$subjectIndex] = trim($subject); } - $subjects = erLhAbstractModelSubject::getList(array('limit' => false, 'filterin' => array('name' => $subjectsPlain))); + $subjects = erLhAbstractModelSubject::getList(['limit' => false, 'filterin' => ['name' => $subjectsPlain]]); foreach ($subjects as $subject) { $cannedSubject = new erLhcoreClassModelCannedMsgSubject(); $cannedSubject->canned_id = $cannedMessage->id; @@ -124,5 +124,3 @@ $Result['content'] = $tpl->fetch(); $Result['pagelayout'] = 'popup'; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhcannedmsg/listreplace.php b/lhc_web/modules/lhcannedmsg/listreplace.php index 376b02ab56..40cdf6d362 100644 --- a/lhc_web/modules/lhcannedmsg/listreplace.php +++ b/lhc_web/modules/lhcannedmsg/listreplace.php @@ -3,10 +3,10 @@ $tpl = erLhcoreClassTemplate::getInstance( 'lhcannedmsg/listreplace.tpl.php'); if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'departament','module_file' => 'dep_list','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'departament','module_file' => 'dep_list','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'departament','module_file' => 'dep_list','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'departament','module_file' => 'dep_list','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = false; } @@ -18,9 +18,9 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelCannedMsgReplace::getList(array_merge($filterParams['filter'],array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'identifier ASC, id ASC'))); + $items = erLhcoreClassModelCannedMsgReplace::getList(array_merge($filterParams['filter'],['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'identifier ASC, id ASC'])); } $tpl->set('items',$items); @@ -31,8 +31,7 @@ $tpl->set('input',$filterParams['input_form']); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','System configuration')), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','Replaceable variables'))); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Replaceable variables')] +]; diff --git a/lhc_web/modules/lhcannedmsg/module.php b/lhc_web/modules/lhcannedmsg/module.php index 4c06e191e0..3970c330ee 100644 --- a/lhc_web/modules/lhcannedmsg/module.php +++ b/lhc_web/modules/lhcannedmsg/module.php @@ -1,73 +1,64 @@ "Canned Messages"); +$Module = ['name' => 'Canned Messages']; -$ViewList = array(); +$ViewList = [ + 'showsuggester' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'subject' => [ + 'params' => ['canned_id'], + 'uparams' => ['subject', 'status'], + 'functions' => ['use'], + ], + 'clonereplace' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_replace'], + ], + 'filter' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'listreplace' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_replace'], + ], + 'newreplace' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_replace'], + ], + 'editreplace' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_replace'], + ], + 'deletereplace' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_replace'], + ], + 'import' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_import'], + ], + 'suggesterconfiguration' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['suggesterconfig'], + ], +]; -$ViewList['showsuggester'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['subject'] = array( - 'params' => array('canned_id'), - 'uparams' => array('subject','status'), - 'functions' => array( 'use' ), -); - -$ViewList['clonereplace'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_replace' ), -); - -$ViewList['filter'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['listreplace'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_replace' ), -); - -$ViewList['newreplace'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_replace' ), -); - -$ViewList['editreplace'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_replace' ), -); - -$ViewList['deletereplace'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_replace' ), -); - -$ViewList['import'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_import' ), -); - -$ViewList['suggesterconfiguration'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'suggesterconfig' ), -); - -$FunctionList['use'] = array('explain' => 'General permission to use canned messages module'); -$FunctionList['see_global'] = array('explain' => 'Allow operator to see global canned messages'); -$FunctionList['use_import'] = array('explain' => 'Allow operator to import canned messages'); -$FunctionList['use_replace'] = array('explain' => 'Allow operator manage replaceable variables'); -$FunctionList['suggesterconfig'] = array('explain' => 'Allow operator configure canned messages suggester'); - -?> \ No newline at end of file +$FunctionList = [ + 'use' => ['explain' => 'General permission to use canned messages module'], + 'see_global' => ['explain' => 'Allow operator to see global canned messages'], + 'use_import' => ['explain' => 'Allow operator to import canned messages'], + 'use_replace' => ['explain' => 'Allow operator manage replaceable variables'], + 'suggesterconfig' => ['explain' => 'Allow operator configure canned messages suggester'], +]; diff --git a/lhc_web/modules/lhcannedmsg/subject.php b/lhc_web/modules/lhcannedmsg/subject.php index 39e1b6e8c1..ec607df8ad 100644 --- a/lhc_web/modules/lhcannedmsg/subject.php +++ b/lhc_web/modules/lhcannedmsg/subject.php @@ -8,15 +8,15 @@ if (ezcInputForm::hasPostData()) { if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) { - $response = array('error' => true, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Invalid CSRF token')); + $response = ['error' => true, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Invalid CSRF token')]; } $db = ezcDbInstance::get(); $db->beginTransaction(); - $response = array(); + $response = []; if (is_numeric($Params['user_parameters_unordered']['subject'])) { if ($Params['user_parameters_unordered']['status'] == 'true') { - $subjectChat = erLhcoreClassModelCannedMsgSubject::findOne(array('filter' => array('canned_id' => $canned->id, 'subject_id' => $Params['user_parameters_unordered']['subject']))); + $subjectChat = erLhcoreClassModelCannedMsgSubject::findOne(['filter' => ['canned_id' => $canned->id, 'subject_id' => $Params['user_parameters_unordered']['subject']]]); if (!($subjectChat instanceof erLhcoreClassModelCannedMsgSubject)) { $subjectChat = new erLhcoreClassModelCannedMsgSubject(); @@ -26,19 +26,19 @@ $subjectChat->subject_id = $Params['user_parameters_unordered']['subject']; $subjectChat->saveThis(); - $response = array('error' => false, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Subject selected!')); + $response = ['error' => false, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Subject selected!')]; } else { - $subjectChat = erLhcoreClassModelCannedMsgSubject::findOne(array('filter' => array('canned_id' => $canned->id, 'subject_id' => $Params['user_parameters_unordered']['subject']))); + $subjectChat = erLhcoreClassModelCannedMsgSubject::findOne(['filter' => ['canned_id' => $canned->id, 'subject_id' => $Params['user_parameters_unordered']['subject']]]); if ($subjectChat instanceof erLhcoreClassModelCannedMsgSubject) { $subjectChat->removeThis(); } - $response = array('error' => false, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Subject unselected!')); + $response = ['error' => false, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Subject unselected!')]; } } else { - $response = array('error' => false, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Please choose a subject')); + $response = ['error' => false, 'message' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Please choose a subject')]; } $db->commit(); @@ -67,5 +67,3 @@ } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhcannedmsg/suggesterconfiguration.php b/lhc_web/modules/lhcannedmsg/suggesterconfiguration.php index e566854f68..b8a417afd6 100644 --- a/lhc_web/modules/lhcannedmsg/suggesterconfiguration.php +++ b/lhc_web/modules/lhcannedmsg/suggesterconfiguration.php @@ -12,23 +12,23 @@ exit; } - $definition = array( + $definition = [ 'first_n_letters' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1, 'max_range' => 5) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 1, 'max_range' => 5] ), 'min_percentage' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0,'max_range' => 90) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0,'max_range' => 90] ), 'top_n_match' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1,'max_range' => 5) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 1,'max_range' => 5] ), 'max_result' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 50, 'max_range' => 5000) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 50, 'max_range' => 5000] ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ($form->hasValidData( 'first_n_letters' )) { $data['first_n_letters'] = $form->first_n_letters; @@ -66,8 +66,7 @@ $tpl->set('sc_options',$data); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','System configuration')), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','Canned messages suggester configuration'))); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'System configuration')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Canned messages suggester configuration')] +]; diff --git a/lhc_web/modules/lhcaptcha/module.php b/lhc_web/modules/lhcaptcha/module.php index 74acacc180..abbcb7f070 100644 --- a/lhc_web/modules/lhcaptcha/module.php +++ b/lhc_web/modules/lhcaptcha/module.php @@ -1,18 +1,14 @@ "Captcha module", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['captchastring'] = array( - 'params' => array('captcha_name','timets') -); - -$ViewList['test'] = array( - 'params' => array() -); - -$FunctionList = array(); - -?> \ No newline at end of file +$Module = ['name' => 'Captcha module', 'variable_params' => true]; + +$ViewList = [ + 'captchastring' => [ + 'params' => ['captcha_name', 'timets'], + ], + 'test' => [ + 'params' => [], + ], +]; + +$FunctionList = []; diff --git a/lhc_web/modules/lhchat/addoperation.php b/lhc_web/modules/lhchat/addoperation.php index 51e1a76bb4..7b67608891 100644 --- a/lhc_web/modules/lhchat/addoperation.php +++ b/lhc_web/modules/lhchat/addoperation.php @@ -3,11 +3,11 @@ /** * These operations are executed directly in an iframe. Most of the time it's postMessage * */ -$definition = array( +$definition = [ 'operation' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw' ) -); +]; $form = new ezcInputForm( INPUT_POST, $definition ); @@ -17,14 +17,14 @@ $db->beginTransaction(); $Chat = erLhcoreClassChat::getSession()->load( 'erLhcoreClassModelChat', $Params['user_parameters']['chat_id']); - $errors = array(); + $errors = []; switch ($form->operation) { case 'lhc_screenshot': - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.before_screenshot_addoperacion',array('chat' => & $Chat, 'errors' => & $errors)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.before_screenshot_addoperacion',['chat' => & $Chat, 'errors' => & $errors]); break; case (preg_match('/^lhc_cobrowse/', $form->operation) ? true : false): - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('cobrowse.before_started',array('chat' => & $Chat, 'errors' => & $errors)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('cobrowse.before_started',['chat' => & $Chat, 'errors' => & $errors]); break; } @@ -34,26 +34,24 @@ $currentUser = erLhcoreClassUser::instance(); if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) { - echo json_encode(array('error' => 'true', 'result' => 'Invalid CSRF Token')); + echo json_encode(['error' => 'true', 'result' => 'Invalid CSRF Token']); exit; } $Chat->operation .= $form->operation . "\n"; - $Chat->updateThis(array('update' => array('operation'))); + $Chat->updateThis(['update' => ['operation']]); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.added_operation',array('chat' => & $Chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.added_operation',['chat' => & $Chat]); - echo json_encode(array('error' => 'false')); + echo json_encode(['error' => 'false']); } } else { - echo json_encode(array('error' => 'true', 'errors' => $errors )); + echo json_encode(['error' => 'true', 'errors' => $errors ]); } $db->commit(); } else { - echo json_encode(array('error' => 'true')); + echo json_encode(['error' => 'true']); } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhchat/cannedmsg.php b/lhc_web/modules/lhchat/cannedmsg.php index 05eacef664..83b32769f9 100644 --- a/lhc_web/modules/lhchat/cannedmsg.php +++ b/lhc_web/modules/lhchat/cannedmsg.php @@ -1,6 +1,6 @@ dispatch('chat.cannedmsg', array()); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.cannedmsg', []); if (isset($_POST['DeleteSelected']) && !empty($_POST['canned_id']) && $currentUser->hasAccessTo('lhchat','administratecannedmsg')) { if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) { @@ -83,7 +83,7 @@ $tpl->set('messsages_skipped',$messagesSkipped); } -$validTabs = array('cannedmsg','statistic'); +$validTabs = ['cannedmsg','statistic']; $tab = isset($Params['user_parameters_unordered']['tab']) && in_array($Params['user_parameters_unordered']['tab'],$validTabs) ? $Params['user_parameters_unordered']['tab'] : 'cannedmsg'; $tpl->set('tab',$tab); @@ -92,7 +92,7 @@ /** * Append user departments filter * */ - $departmentParams = array(); + $departmentParams = []; $userDepartments = true; @@ -120,18 +120,18 @@ $Msg = erLhcoreClassChat::getSession()->load( 'erLhcoreClassModelCannedMsg', (int)$Params['user_parameters_unordered']['id']); if ($userDepartments === true || empty(array_diff($Msg->department_ids_front, $userDepartments))) { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.cannedmsg_before_remove',array('msg' => & $Msg)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.cannedmsg_before_remove', ['msg' => & $Msg]); $Msg->removeThis(); - erLhcoreClassLog::logObjectChange(array( + erLhcoreClassLog::logObjectChange([ 'object' => $Msg, 'check_log' => true, 'action' => 'Delete', - 'msg' => array( + 'msg' => [ 'delete' => $Msg->getState(), 'user_id' => $currentUser->getUserID() - ) - )); + ] + ]); } } catch (Exception $e) { @@ -148,22 +148,22 @@ } if (isset($_GET['doSearch']) || isset($_POST['DeleteSelected'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('use_post' => isset($_POST['DeleteSelected']), 'module' => 'chat','module_file' => 'canned_search','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['use_post' => isset($_POST['DeleteSelected']), 'module' => 'chat','module_file' => 'canned_search','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'canned_search','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'canned_search','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = false; } erLhcoreClassChatStatistic::formatUserFilter($filterParams); if (is_array($filterParams['input_form']->department_id) && !empty($filterParams['input_form']->department_id)) { - $filterParams['filter']['innerjoin']['lh_canned_msg_dep'] = array('`lh_canned_msg_dep`.`canned_id`','`lh_canned_msg` . `id`'); + $filterParams['filter']['innerjoin']['lh_canned_msg_dep'] = ['`lh_canned_msg_dep`.`canned_id`','`lh_canned_msg` . `id`']; $filterParams['filter']['filterin']['`lh_canned_msg_dep`.`dep_id`'] = $filterParams['input_form']->department_id; } if (is_array($filterParams['input_form']->subject_id) && !empty($filterParams['input_form']->subject_id)) { - $filterParams['filter']['innerjoin']['lh_canned_msg_subject'] = array('`lh_canned_msg_subject`.`canned_id`','`lh_canned_msg`.`id`'); + $filterParams['filter']['innerjoin']['lh_canned_msg_subject'] = ['`lh_canned_msg_subject`.`canned_id`','`lh_canned_msg`.`id`']; $filterParams['filter']['filterin']['`lh_canned_msg_subject`.`subject_id`'] = $filterParams['input_form']->subject_id; } @@ -172,13 +172,13 @@ if ($filterParams['input_form']->used_freq === 0) { // Zero usage $filterParams['filter']['customfilter'][] = '`lh_canned_msg`.`id` NOT IN (SELECT `lh_canned_msg_use`.`canned_id` FROM `lh_canned_msg_use` WHERE `lh_canned_msg_use`.`ctime` > '. (time() - 31*3600*24) . ')'; } elseif ($filterParams['input_form']->used_freq === 1) { // Once - $filterParams['filter']['innerjoin']['lh_canned_msg_use'] = array('`lh_canned_msg_use`.`canned_id`', '`lh_canned_msg`.`id`'); + $filterParams['filter']['innerjoin']['lh_canned_msg_use'] = ['`lh_canned_msg_use`.`canned_id`', '`lh_canned_msg`.`id`']; $filterParams['filter']['filtergt']['`lh_canned_msg_use`.`ctime`'] = time() - 31*24*3600; $filterParams['filter']['having'] = 'count(`lh_canned_msg`.`id`) = 1'; $filterParams['filter']['group'] = '`lh_canned_msg`.`id`'; $countAlias = true; } elseif ($filterParams['input_form']->used_freq === 2) { // One or more - $filterParams['filter']['innerjoin']['lh_canned_msg_use'] = array('`lh_canned_msg_use`.`canned_id`', '`lh_canned_msg`.`id`'); + $filterParams['filter']['innerjoin']['lh_canned_msg_use'] = ['`lh_canned_msg_use`.`canned_id`', '`lh_canned_msg`.`id`']; $filterParams['filter']['filtergt']['`lh_canned_msg_use`.`ctime`'] = time() - 31*24*3600; $filterParams['filter']['group'] = '`lh_canned_msg`.`id`'; $countAlias = true; @@ -188,19 +188,19 @@ $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']); if (isset($_GET['export'])) { - erLhcoreClassChatExport::exportCannedMessages(erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'],array('offset' => 0, 'limit' => false),$departmentParams))); + erLhcoreClassChatExport::exportCannedMessages(erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'], ['offset' => 0, 'limit' => false],$departmentParams))); } if ($currentUser->hasAccessTo('lhchat','administratecannedmsg') && isset($_GET['quick_action'])) { $tpl = erLhcoreClassTemplate::getInstance('lhchat/cannedmsg/quick_actions.tpl.php'); $tpl->set('action_url', erLhcoreClassDesign::baseurl('chat/cannedmsg') . erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form'])); - $tpl->set('update_records',erLhcoreClassModelCannedMsg::getCount(array_merge_recursive($filterParams['filter'],array('offset' => 0, 'limit' => false),$departmentParams), 'count',false,false,true,false,false, $countAlias)); + $tpl->set('update_records',erLhcoreClassModelCannedMsg::getCount(array_merge_recursive($filterParams['filter'], ['offset' => 0, 'limit' => false],$departmentParams), 'count',false,false,true,false,false, $countAlias)); if (ezcInputForm::hasPostData()) { if ((isset($_POST['disable_canned']) && $_POST['disable_canned'] == 'on') || (isset($_POST['enable_canned']) && $_POST['enable_canned'] == 'on') ) { - foreach (erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'],array('offset' => 0, 'limit' => false),$departmentParams)) as $cannedMessage) { + foreach (erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'], ['offset' => 0, 'limit' => false],$departmentParams)) as $cannedMessage) { $cannedMessage->disabled = (isset($_POST['disable_canned']) && $_POST['disable_canned'] == 'on' ? 1 : 0); $cannedMessage->updateThis(['update' => ['disabled']]); } @@ -209,7 +209,7 @@ if (isset($_POST['dep_id_remove']) && is_numeric($_POST['dep_id_remove']) && (int)$_POST['dep_id_remove'] > 0) { $values = []; $db = ezcDbInstance::get(); - foreach (erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'],array('offset' => 0, 'limit' => false),$departmentParams)) as $cannedMessage) { + foreach (erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'], ['offset' => 0, 'limit' => false],$departmentParams)) as $cannedMessage) { $db = ezcDbInstance::get(); $stmt = $db->prepare('DELETE FROM `lh_canned_msg_dep` WHERE `canned_id` = :canned_id AND `dep_id` = :dep_id'); $stmt->bindValue(':canned_id', $cannedMessage->id,PDO::PARAM_INT); @@ -221,7 +221,7 @@ if (isset($_POST['dep_id']) && is_numeric($_POST['dep_id']) && (int)$_POST['dep_id'] > 0) { $values = []; $db = ezcDbInstance::get(); - foreach (erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'],array('offset' => 0, 'limit' => false),$departmentParams)) as $cannedMessage) { + foreach (erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'], ['offset' => 0, 'limit' => false],$departmentParams)) as $cannedMessage) { $stmt = $db->prepare('SELECT COUNT(`id`) FROM `lh_canned_msg_dep` WHERE `canned_id` = :canned_id AND `dep_id` = :dep_id'); $stmt->bindValue(':canned_id', $cannedMessage->id,PDO::PARAM_INT); $stmt->bindValue(':dep_id', (int)$_POST['dep_id'],PDO::PARAM_INT); @@ -276,9 +276,9 @@ $pages->setItemsPerPage(20); $pages->paginate(); - $items = array(); + $items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'],array('offset' => $pages->low, 'limit' => $pages->items_per_page),$departmentParams)); + $items = erLhcoreClassModelCannedMsg::getList(array_merge_recursive($filterParams['filter'], ['offset' => $pages->low, 'limit' => $pages->items_per_page],$departmentParams)); } $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('chat/cannedmsg'); @@ -291,7 +291,7 @@ /** * Append user departments filter * */ - $departmentParams = array(); + $departmentParams = []; $userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID(), $currentUser->cache_version); if ($userDepartments !== true){ $departmentParams['filterin']['department_id'] = $userDepartments; @@ -302,10 +302,10 @@ } if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'canned_search_statistic', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'canned_search_statistic', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'canned_search_statistic', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'canned_search_statistic', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = false; } @@ -314,7 +314,7 @@ if ( is_array($filterParams['input_form']->department_id) && !empty($filterParams['input_form']->department_id) || is_array($filterParams['input_form']->department_group_ids) && !empty($filterParams['input_form']->department_group_ids)) { - $filterParams['filter']['innerjoin']['lh_canned_msg_dep'] = array('`lh_canned_msg_dep`.`canned_id`','`lh_canned_msg_use`.`canned_id`'); + $filterParams['filter']['innerjoin']['lh_canned_msg_dep'] = ['`lh_canned_msg_dep`.`canned_id`','`lh_canned_msg_use`.`canned_id`']; } if (is_array($filterParams['input_form']->department_id) && !empty($filterParams['input_form']->department_id)) { @@ -345,10 +345,9 @@ } $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','System configuration')), -array('url' => erLhcoreClassDesign::baseurl('chat/cannedmsg'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','Canned messages'))); +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('chat/cannedmsg'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Canned messages')] +]; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.cannedmsg_path',array('result' => & $Result)); - -?> \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.cannedmsg_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhchat/chatwidget.php b/lhc_web/modules/lhchat/chatwidget.php index 80b33cf89d..f0656e5486 100644 --- a/lhc_web/modules/lhchat/chatwidget.php +++ b/lhc_web/modules/lhchat/chatwidget.php @@ -68,10 +68,10 @@ $modeAppendTheme .= '/(survey)/' . $Params['user_parameters_unordered']['survey']; }; - $paidChatSettings = erLhcoreClassChatPaid::paidChatWorkflow(array( + $paidChatSettings = erLhcoreClassChatPaid::paidChatWorkflow([ 'uparams' => $Params['user_parameters_unordered'], 'append_mode' => $modeAppend . $modeAppendTheme . $sound - )); + ]); if (isset($paidChatSettings['need_store']) && $paidChatSettings['need_store'] == true) { $modeAppendTheme .= '/(phash)/'.htmlspecialchars($Params['user_parameters_unordered']['phash']).'/(pvhash)/'.htmlspecialchars($Params['user_parameters_unordered']['pvhash']); @@ -133,7 +133,7 @@ $parametersDepartment = erLhcoreClassChat::extractDepartment($Params['user_parameters_unordered']['department']); $Params['user_parameters_unordered']['department'] = $parametersDepartment['system']; - $departments = erLhcoreClassModelDepartament::getList(array('filterin' => array('id' => $Params['user_parameters_unordered']['department']))); + $departments = erLhcoreClassModelDepartament::getList(['filterin' => ['id' => $Params['user_parameters_unordered']['department']]]); $disabledAll = true; foreach ($departments as $department){ @@ -169,7 +169,7 @@ $inputData->departament_id = 0; } -if (is_numeric($inputData->departament_id) && $inputData->departament_id > 0 && ($startDataDepartment = erLhcoreClassModelChatStartSettings::findOne(array('customfilter' => array("((`dep_ids` != '' AND JSON_CONTAINS(`dep_ids`,'" . (int)$inputData->departament_id . "','$')) OR department_id = " . (int)$inputData->departament_id . ")" )))) !== false) { +if (is_numeric($inputData->departament_id) && $inputData->departament_id > 0 && ($startDataDepartment = erLhcoreClassModelChatStartSettings::findOne(['customfilter' => ["((`dep_ids` != '' AND JSON_CONTAINS(`dep_ids`,'" . (int)$inputData->departament_id . "','$')) OR department_id = " . (int)$inputData->departament_id . ")" ]])) !== false) { $startDataFields = $startDataDepartment->data_array; } else { // Start chat field options @@ -178,7 +178,7 @@ } // Allow extension override start chat fields -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chatwidget_data_field',array('data_fields' => & $startDataFields, 'params' => $Params)); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chatwidget_data_field', ['data_fields' => & $startDataFields, 'params' => $Params]); if (is_array($Params['user_parameters_unordered']['department'])) { $parametersDepartment = erLhcoreClassChat::extractDepartment($Params['user_parameters_unordered']['department']); @@ -238,15 +238,15 @@ $inputData->email = isset($_GET['prefill']['email']) ? (string)$_GET['prefill']['email'] : $inputData->email; $inputData->phone = isset($_GET['prefill']['phone']) ? (string)$_GET['prefill']['phone'] : $inputData->phone; $inputData->validate_start_chat = false; -$inputData->name_items = array(); -$inputData->value_items = array(); -$inputData->value_sizes = array(); -$inputData->value_types = array(); -$inputData->value_items_admin = array(); // These variables get's filled from start chat form settings -$inputData->hattr = array(); -$inputData->jsvar = array(); -$inputData->encattr = array(); -$inputData->via_encrypted = array(); +$inputData->name_items = []; +$inputData->value_items = []; +$inputData->value_sizes = []; +$inputData->value_types = []; +$inputData->value_items_admin = []; // These variables get's filled from start chat form settings +$inputData->hattr = []; +$inputData->jsvar = []; +$inputData->encattr = []; +$inputData->via_encrypted = []; $inputData->ua = $Params['user_parameters_unordered']['ua']; $inputData->priority = is_numeric($Params['user_parameters_unordered']['priority']) ? (int)$Params['user_parameters_unordered']['priority'] : false; $inputData->only_bot_online = isset($_POST['onlyBotOnline']) ? (int)$_POST['onlyBotOnline'] : 0; @@ -268,7 +268,7 @@ } // Reopen chat automatically if possible -if ( erLhcoreClassModelChatConfig::fetch('automatically_reopen_chat')->current_value == 1 && erLhcoreClassModelChatConfig::fetch('reopen_chat_enabled')->current_value == 1 && ($reopenData = erLhcoreClassChat::canReopenDirectly(array('reopen_closed' => erLhcoreClassModelChatConfig::fetch('allow_reopen_closed')->current_value))) !== false ) { +if ( erLhcoreClassModelChatConfig::fetch('automatically_reopen_chat')->current_value == 1 && erLhcoreClassModelChatConfig::fetch('reopen_chat_enabled')->current_value == 1 && ($reopenData = erLhcoreClassChat::canReopenDirectly(['reopen_closed' => erLhcoreClassModelChatConfig::fetch('allow_reopen_closed')->current_value])) !== false ) { $sound = is_numeric($Params['user_parameters_unordered']['sound']) ? '/(sound)/'.$Params['user_parameters_unordered']['sound'] : ''; erLhcoreClassModule::redirect('chat/reopen','/' . $reopenData['id'] . '/' . $reopenData['hash'] . '/(mode)/widget' . $modeAppendDisplay . $modeAppendTheme . $sound ); exit; @@ -288,7 +288,7 @@ $leaveamessage = ((string)$Params['user_parameters_unordered']['leaveamessage'] == 'true' || (isset($startDataFields['force_leave_a_message']) && $startDataFields['force_leave_a_message'] == true)) ? true : false; $tpl->set('forceoffline',false); -$additionalParams = array(); +$additionalParams = []; if ((string)$Params['user_parameters_unordered']['offline'] == 'true' && $leaveamessage == true) { $additionalParams['offline'] = true; $tpl->set('forceoffline',true); @@ -304,7 +304,7 @@ if ( erLhcoreClassModelChatConfig::fetch('track_online_visitors')->current_value == 1 ) { // To track online users - $userInstance = erLhcoreClassModelChatOnlineUser::handleRequest(array('check_message_operator' => true, 'message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'vid' => $Params['user_parameters_unordered']['vid'])); + $userInstance = erLhcoreClassModelChatOnlineUser::handleRequest(['check_message_operator' => true, 'message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'vid' => $Params['user_parameters_unordered']['vid']]); } if (empty($Errors) && isset($startDataFields['pre_conditions']) && !empty($startDataFields['pre_conditions'])) { @@ -333,7 +333,7 @@ erLhcoreClassModelChatConfig::fetch('track_online_visitors')->current_value == 1 && ($chat->nick == 'Visitor' || empty($chat->nick)) && isset($inputData->vid) && !empty($inputData->vid) && ($onlineUser = erLhcoreClassModelChatOnlineUser::fetchByVid($inputData->vid)) instanceof erLhcoreClassModelChatOnlineUser && $onlineUser->nick && - $onlineUser->has_nick && erLhcoreClassModelChatBlockedUser::isBlocked(array('ip' => $chat->ip, 'dep_id' => $chat->dep_id, 'nick' => $onlineUser->nick)) + $onlineUser->has_nick && erLhcoreClassModelChatBlockedUser::isBlocked(['ip' => $chat->ip, 'dep_id' => $chat->dep_id, 'nick' => $onlineUser->nick]) ) { $Errors['blocked_user'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','At this moment you can contact us via email only. Sorry for the inconveniences.'); } @@ -342,7 +342,7 @@ $Errors['blocked_user'] = $outcome['message']; } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_chat_started', array('chat' => & $chat, 'errors' => & $Errors, 'offline' => (isset($additionalParams['offline']) && $additionalParams['offline'] == true))); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_chat_started', ['chat' => & $chat, 'errors' => & $Errors, 'offline' => (isset($additionalParams['offline']) && $additionalParams['offline'] == true)]); if (count($Errors) == 0 && !isset($_POST['switchLang'])) { @@ -359,34 +359,36 @@ if ((isset($additionalParams['offline']) && $additionalParams['offline'] == true) || $statusGeoAdjustment['status'] == 'offline') { - $attributePresend = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request_presend',array( - 'input_data' => $inputData, - 'chat' => $chat, - 'prefill' => array('chatprefill' => isset($chatPrefill) ? $chatPrefill : false))); + $attributePresend = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request_presend', [ + 'input_data' => $inputData, + 'chat' => $chat, + 'prefill' => ['chatprefill' => isset($chatPrefill) ? $chatPrefill : false] + ]); if (!isset($attributePresend['status']) || $attributePresend['status'] !== erLhcoreClassChatEventDispatcher::STOP_WORKFLOW) { - erLhcoreClassChatMail::sendMailRequest($inputData, $chat, array('chatprefill' => isset($chatPrefill) ? $chatPrefill : false)); + erLhcoreClassChatMail::sendMailRequest($inputData, $chat, ['chatprefill' => isset($chatPrefill) ? $chatPrefill : false]); } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request',array( - 'input_data' => $inputData, - 'chat' => $chat, - 'prefill' => array('chatprefill' => isset($chatPrefill) ? $chatPrefill : false))); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request', [ + 'input_data' => $inputData, + 'chat' => $chat, + 'prefill' => ['chatprefill' => isset($chatPrefill) ? $chatPrefill : false] + ]); try { $db = ezcDbInstance::get(); $db->beginTransaction(); - $requestSaved = erLhcoreClassChatValidator::saveOfflineRequest(array('chat' => & $chat, 'question' => $inputData->question, 'chatprefill' => (isset($chatPrefill) ? $chatPrefill : false))); + $requestSaved = erLhcoreClassChatValidator::saveOfflineRequest(['chat' => & $chat, 'question' => $inputData->question, 'chatprefill' => (isset($chatPrefill) ? $chatPrefill : false)]); $db->commit(); // Remove out of transaction scope // Same as start chat workflow if ($requestSaved === true) { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request_saved', array( + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request_saved', [ 'chat' => & $chat - )); + ]); } } catch (Exception $e) { @@ -420,7 +422,7 @@ // Assign chat to user if ( erLhcoreClassModelChatConfig::fetch('track_online_visitors')->current_value == 1 ) { // To track online users - $userInstance = isset($userInstance) ? $userInstance : erLhcoreClassModelChatOnlineUser::handleRequest(array('check_message_operator' => true, 'message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'vid' => $Params['user_parameters_unordered']['vid'])); + $userInstance = isset($userInstance) ? $userInstance : erLhcoreClassModelChatOnlineUser::handleRequest(['check_message_operator' => true, 'message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'vid' => $Params['user_parameters_unordered']['vid']]); if ($userInstance !== false) { $userInstance->chat_id = $chat->id; @@ -456,7 +458,7 @@ $messageInitial = false; - $paramsExecution = array(); + $paramsExecution = []; // Store message if required if (isset($startDataFields['message_visible_in_page_widget']) && $startDataFields['message_visible_in_page_widget'] == true) { @@ -473,7 +475,7 @@ $chat->unanswered_chat = 1; $chat->last_msg_id = $msg->id; - $chat->updateThis(array('update' => array('unanswered_chat','last_msg_id'))); + $chat->updateThis(['update' => ['unanswered_chat','last_msg_id']]); } } @@ -492,8 +494,8 @@ $responder = erLhAbstractModelAutoResponder::processAutoResponder($chat); if ($responder instanceof erLhAbstractModelAutoResponder) { - $beforeAutoResponderErrors = array(); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_triggered',array('chat' => & $chat, 'errors' => & $beforeAutoResponderErrors)); + $beforeAutoResponderErrors = []; + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_triggered', ['chat' => & $chat, 'errors' => & $beforeAutoResponderErrors]); if (empty($beforeAutoResponderErrors)) { @@ -505,15 +507,15 @@ $chat->auto_responder_id = $responderChat->id; - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_message',array('chat' => & $chat, 'responder' => & $responder)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_auto_responder_message', ['chat' => & $chat, 'responder' => & $responder]); if ($chat->status !== erLhcoreClassModelChat::STATUS_BOT_CHAT) { $messageText = ''; - if ($responder->offline_message != '' && !erLhcoreClassChat::isOnline($chat->dep_id, false, array( + if ($responder->offline_message != '' && !erLhcoreClassChat::isOnline($chat->dep_id, false, [ 'online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout'], 'ignore_user_status' => false - ))) { + ])) { $messageText = $responder->offline_message; } else { $messageText = $responder->wait_message; @@ -537,7 +539,7 @@ $chat->saveThis(); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.auto_responder_triggered', array('chat' => & $chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.auto_responder_triggered', ['chat' => & $chat]); } else { $msg = new erLhcoreClassModelmsg(); $msg->msg = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat','Auto responder got error').': '.implode('; ', $beforeAutoResponderErrors); @@ -561,15 +563,15 @@ // Paid chat settings if (isset($paidChatSettings)) { - erLhcoreClassChatPaid::processPaidChatWorkflow(array( + erLhcoreClassChatPaid::processPaidChatWorkflow([ 'chat' => $chat, 'paid_chat_params' => $paidChatSettings, - )); + ]); } $db->commit(); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_started',array('chat' => & $chat, 'msg' => $messageInitial)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_started', ['chat' => & $chat, 'msg' => $messageInitial]); } catch (Exception $e) { $db->rollback(); @@ -582,7 +584,7 @@ if ($Params['user_parameters_unordered']['ajaxmode'] == 'true') { header ( 'content-type: application/json; charset=utf-8' ); - echo json_encode(array('location' => erLhcoreClassDesign::baseurl('chat/chatwidgetchat') . '/' . $chat->id . '/' . $chat->hash . $modeAppend . $modeAppendTheme . '/(cstarted)/online_chat_started_cb')); + echo json_encode(['location' => erLhcoreClassDesign::baseurl('chat/chatwidgetchat') . '/' . $chat->id . '/' . $chat->hash . $modeAppend . $modeAppendTheme . '/(cstarted)/online_chat_started_cb']); exit; } else { // Redirect user @@ -603,7 +605,7 @@ $tpl->set('start_data_fields',$startDataFields); -$definition = array( +$definition = [ 'name' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, @@ -664,7 +666,7 @@ null, FILTER_REQUIRE_ARRAY ), -); +]; $form = new ezcInputForm( INPUT_GET, $definition ); @@ -757,7 +759,7 @@ if (!isset($additionalParams['offline'])) { // Auto start chat - $autoStartResult = erLhcoreClassChatValidator::validateAutoStart(array( + $autoStartResult = erLhcoreClassChatValidator::validateAutoStart([ 'params' => $Params, 'inputData' => $inputData, 'chat' => $chat, @@ -765,7 +767,7 @@ 'modeAppend' => $modeAppend, 'modeAppendTheme' => $modeAppendTheme, 'bot_id' => $inputData->bot_id - )); + ]); if ($autoStartResult !== false) { $Result = $autoStartResult; @@ -774,7 +776,7 @@ } -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chatwidget',array('result' => & $Result, 'tpl' => & $tpl, 'params' => & $Params, 'inputData' => & $inputData)); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chatwidget',['result' => & $Result, 'tpl' => & $tpl, 'params' => & $Params, 'inputData' => & $inputData]); if (isset($Params['user_parameters_unordered']['sdemo']) && (int)$Params['user_parameters_unordered']['sdemo'] == 'true') { $tpl->set('show_demo',true); @@ -795,7 +797,7 @@ $Result['dynamic_height_message'] = 'lhc_sizing_chat'; $Result['pagelayout_css_append'] = 'widget-chat'; -$chatInitData = array(); +$chatInitData = []; if (isset($inputData->vid) && !empty($inputData->vid)) { $chatInitData['vid'] = $inputData->vid; @@ -821,6 +823,3 @@ $Result['dynamic_height_message'] = 'lhc_sizing_chat_page'; $Result['pagelayout_css_append'] = 'embed-widget'; } - - -?> diff --git a/lhc_web/modules/lhchat/geoconfiguration.php b/lhc_web/modules/lhchat/geoconfiguration.php index fcb6321efe..c6ea91a6ed 100644 --- a/lhc_web/modules/lhchat/geoconfiguration.php +++ b/lhc_web/modules/lhchat/geoconfiguration.php @@ -1,6 +1,6 @@ dispatch('chat.geoconfiguration', array()); +$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.geoconfiguration', []); $tpl = erLhcoreClassTemplate::getInstance( 'lhchat/geoconfiguration.tpl.php'); @@ -28,25 +28,25 @@ } if ( isset($_POST['store_map']) ) { - $definition = array( - 'zoom' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int',array('min_range' => 1) - ), - 'lat' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'float' - ), - 'lng' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'float' - ), - 'gmaps_api_key' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' - ) - ); - - $Errors = array(); + $definition = [ + 'zoom' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 1] + ), + 'lat' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'float' + ), + 'lng' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'float' + ), + 'gmaps_api_key' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' + ) + ]; + + $Errors = []; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) { erLhcoreClassModule::redirect('chat/geoconfiguration'); @@ -86,7 +86,7 @@ if ( isset($_POST['StoreGeoIPConfiguration']) ) { - $definition = array( + $definition = [ 'UseGeoIP' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), @@ -132,12 +132,12 @@ 'abstractapi_key' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ) - ); + ]; - $Errors = array(); + $Errors = []; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( $form->hasValidData( 'GeoDetectionEnabled' ) && $form->GeoDetectionEnabled == true ) { $data['geo_detection_enabled'] = 1; @@ -222,7 +222,7 @@ } if (empty($Errors)) { - $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('max_mind','94.23.200.91',array('city_file' => $data['max_mind_city_location'],'detection_type' => $data['max_mind_detection_type'])); + $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('max_mind','94.23.200.91',['city_file' => $data['max_mind_city_location'],'detection_type' => $data['max_mind_detection_type']]); if ( $responseDetection == false || !isset($responseDetection->country_code) || !isset($responseDetection->country_name) ) { $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Setting service provider failed, please check that MaxMind database files exists!'); } @@ -255,7 +255,7 @@ } if ($filledAPIData == true) { - $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('locatorhq',erLhcoreClassIPDetect::getServerAddress(),array('ip' => $data['locatorhqip'], 'username' => $data['locatorhqusername'], 'api_key' => $data['locatorhq_api_key'])); + $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('locatorhq',erLhcoreClassIPDetect::getServerAddress(), ['ip' => $data['locatorhqip'], 'username' => $data['locatorhqusername'], 'api_key' => $data['locatorhq_api_key']]); if ($responseDetection == false || !isset($responseDetection->country_code)){ $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Setting service provider failed, please check that your service provider allows you to make requests to remote pages and your API key and username is correct!'); } @@ -273,7 +273,7 @@ } if ($filledAPIData == true) { - $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('ipinfodbcom',erLhcoreClassIPDetect::getServerAddress(),array('api_key' => $data['ipinfodbcom_api_key'])); + $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('ipinfodbcom',erLhcoreClassIPDetect::getServerAddress(), ['api_key' => $data['ipinfodbcom_api_key']]); if ($responseDetection == false || !isset($responseDetection->country_code)){ $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Setting service provider failed, please check that your service provider allows you to make requests to remote pages and your API key is correct!'); } @@ -309,7 +309,7 @@ $data['abstractapi_key'] = ''; } - $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('abstractapi','8.8.8.8', array('abstractapi_key' => $data['abstractapi_key'])); + $responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('abstractapi','8.8.8.8', ['abstractapi_key' => $data['abstractapi_key']]); if ($responseDetection == false || !isset($responseDetection->country_code)){ $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Setting service provider failed, please check that your service provider allows you to make requests to remote pages and your API key is correct!'); @@ -336,9 +336,7 @@ $tpl->set('geo_location_data',$dataLocation); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('chat/onlineusers'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','Online users')), -array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers','GEO detection configuration'))); - - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('chat/onlineusers'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Online users')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'GEO detection configuration')] +]; diff --git a/lhc_web/modules/lhchat/jsononlineusers.php b/lhc_web/modules/lhchat/jsononlineusers.php index 26ccae3665..a4ead4ac7c 100644 --- a/lhc_web/modules/lhchat/jsononlineusers.php +++ b/lhc_web/modules/lhchat/jsononlineusers.php @@ -1,6 +1,7 @@ 0, 'limit' => (int)$Params['user_parameters_unordered']['maxrows'],'sort' => 'last_visit DESC'); +$filter = ['offset' => 0, 'limit' => (int)$Params['user_parameters_unordered']['maxrows'],'sort' => 'last_visit DESC']; $department = isset($Params['user_parameters_unordered']['department']) && is_array($Params['user_parameters_unordered']['department']) && !empty($Params['user_parameters_unordered']['department']) ? $Params['user_parameters_unordered']['department'] : false; if ($department !== false) { @@ -16,7 +17,7 @@ /** * Append user departments filter * */ -$departmentParams = array(); +$departmentParams = []; $userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID(), $currentUser->cache_version); if ($userDepartments !== true){ $departmentParams['filterin']['id'] = $userDepartments; @@ -41,7 +42,7 @@ } } -$statusDispatch = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.online_users_get_list', array('filter' => $filter)); +$statusDispatch = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.online_users_get_list', ['filter' => $filter]); if ($statusDispatch === false) { $items = erLhcoreClassModelChatOnlineUser::getList($filter); @@ -49,7 +50,7 @@ $items = $statusDispatch['list']; } -$returnItems = array(); +$returnItems = []; foreach ($items as $item) { if ($item->lat != 0 && $item->lon != 0) { @@ -62,6 +63,6 @@ } } -echo erLhcoreClassChat::safe_json_encode(array('result' => $returnItems)); +echo erLhcoreClassChat::safe_json_encode(['result' => $returnItems]); exit(); \ No newline at end of file diff --git a/lhc_web/modules/lhchat/list.php b/lhc_web/modules/lhchat/list.php index 92ab6b6253..be9edb2cf6 100644 --- a/lhc_web/modules/lhchat/list.php +++ b/lhc_web/modules/lhchat/list.php @@ -11,24 +11,24 @@ exit; } - $definition = array( + $definition = [ 'ChatID' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'int', null, FILTER_REQUIRE_ARRAY ), - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; $stats = ['selected' =>0, 'deleted' => 0]; if ( $form->hasValidData( 'ChatID' ) && !empty($form->ChatID) ) { - $chats = erLhcoreClassModelChat::getList(array('limit' => false, 'filterin' => array('id' => $form->ChatID))); + $chats = erLhcoreClassModelChat::getList(['limit' => false, 'filterin' => ['id' => $form->ChatID]]); $stats['selected'] = count($chats); foreach ($chats as $chatToDelete) { if (erLhcoreClassChat::hasAccessToWrite($chatToDelete) && ($currentUser->hasAccessTo('lhchat','deleteglobalchat') || ($currentUser->hasAccessTo('lhchat','deletechat') && $chatToDelete->user_id == $currentUser->getUserID()))) { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.delete', array('chat' => & $chatToDelete, 'user' => $currentUser)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.delete', ['chat' => & $chatToDelete, 'user' => $currentUser]); $chatToDelete->removeThis(); $stats['deleted']++; } @@ -43,50 +43,50 @@ exit; } - $definition = array( + $definition = [ 'ChatID' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'int', null, FILTER_REQUIRE_ARRAY ), - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( $form->hasValidData( 'ChatID' ) && !empty($form->ChatID) ) { - $chats = erLhcoreClassModelChat::getList(array('limit' => false, 'filterin' => array('id' => $form->ChatID))); + $chats = erLhcoreClassModelChat::getList(['limit' => false, 'filterin' => ['id' => $form->ChatID]]); $userData = $currentUser->getUserData(true); foreach ($chats as $chatToClose) { if (($chatToClose->user_id == $currentUser->getUserID() || $currentUser->hasAccessTo('lhchat','allowcloseremote')) && erLhcoreClassChat::hasAccessToWrite($chatToClose)) { - erLhcoreClassChatHelper::closeChat(array( + erLhcoreClassChatHelper::closeChat([ 'user' => $userData, 'chat' => $chatToClose, - )); + ]); } } } } if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'chat_search','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'chat_search','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'chat_search','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'chat_search','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = false; } if (!$currentUser->hasAccessTo('lhaudit','ignore_view_actions') && count($filterParams['filter']) > 1) { // One element is always a sort. We want at-leat one real filter. erLhcoreClassLog::write(erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']), ezcLog::SUCCESS_AUDIT, - array( + [ 'source' => 'lhc', 'category' => 'chat_search', 'line' => __LINE__, 'file' => __FILE__, 'object_id' => 0, 'user_id' => $currentUser->getUserID() - ) + ] ); } @@ -111,7 +111,7 @@ if (is_array($filterParams['input_form']->subject_id) && !empty($filterParams['input_form']->subject_id)) { erLhcoreClassChat::validateFilterIn($filterParams['input_form']->subject_id); - $filterParams['filter']['innerjoin']['lh_abstract_subject_chat'] = array('`lh_abstract_subject_chat`.`chat_id`','`lh_chat` . `id`'); + $filterParams['filter']['innerjoin']['lh_abstract_subject_chat'] = ['`lh_abstract_subject_chat`.`chat_id`','`lh_chat` . `id`']; $filterParams['filter']['filterin']['`lh_abstract_subject_chat`.`subject_id`'] = $filterParams['input_form']->subject_id; } @@ -185,11 +185,11 @@ $filterParams['filter']['customfilter'][] = '1 = -1'; } -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.list_filter',array('filter' => & $filterParams, 'uparams' => $Params['user_parameters_unordered'])); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.list_filter', ['filter' => & $filterParams, 'uparams' => $Params['user_parameters_unordered']]); if ($Params['user_parameters_unordered']['print'] == 1) { $tpl = erLhcoreClassTemplate::getInstance('lhchat/printchats.tpl.php'); - $items = erLhcoreClassModelChat::getList(array_merge($filterParams['filter'],array('limit' => 100000,'offset' => 0))); + $items = erLhcoreClassModelChat::getList(array_merge($filterParams['filter'], ['limit' => 100000,'offset' => 0])); $tpl->set('items',$items); $Result['content'] = $tpl->fetch(); $Result['pagelayout'] = 'print'; @@ -202,20 +202,20 @@ if (!$currentUser->hasAccessTo('lhaudit','ignore_view_actions') && count($filterParams['filter']) > 1) { // One element is always a sort. We want at-least one real filter. erLhcoreClassLog::write(erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']), ezcLog::SUCCESS_AUDIT, - array( + [ 'source' => 'lhc', 'category' => 'chat_export', 'line' => __LINE__, 'file' => __FILE__, 'object_id' => 0, 'user_id' => $currentUser->getUserID() - ) + ] ); } $ignoreFields = (new erLhcoreClassModelChat)->getState(); unset($ignoreFields['id']); $ignoreFields = array_keys($ignoreFields); - erLhcoreClassChatExport::chatListExportXLS(erLhcoreClassModelChat::getList(array_merge($filterParams['filter'], array('limit' => 100000, 'offset' => 0, 'ignore_fields' => $ignoreFields))), array('csv' => isset($_POST['CSV']), 'type' => (isset($_POST['exportOptions']) ? $_POST['exportOptions'] : []))); + erLhcoreClassChatExport::chatListExportXLS(erLhcoreClassModelChat::getList(array_merge($filterParams['filter'], ['limit' => 100000, 'offset' => 0, 'ignore_fields' => $ignoreFields])), ['csv' => isset($_POST['CSV']), 'type' => (isset($_POST['exportOptions']) ? $_POST['exportOptions'] : [])]); exit; } else { $tpl = erLhcoreClassTemplate::getInstance('lhchat/export_config.tpl.php'); @@ -242,7 +242,7 @@ if (ezcInputForm::hasPostData()) { - $Errors = erLhcoreClassAdminChatValidatorHelper::validateSavedSearch($savedSearch, array('filter' => $filterParams['filter'], 'input_form' => $filterParams['input_form'])); + $Errors = erLhcoreClassAdminChatValidatorHelper::validateSavedSearch($savedSearch, ['filter' => $filterParams['filter'], 'input_form' => $filterParams['input_form']]); if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) { $Errors[] = 'Invalid CSRF token!'; @@ -272,7 +272,7 @@ $filterParams['filter']['offset'] = 0; foreach (erLhcoreClassModelChat::getList($filterParams['filter']) as $item){ - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.delete', array('chat' => & $item, 'user' => $currentUser)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.delete', ['chat' => & $item, 'user' => $currentUser]); $item->removeThis(); } @@ -341,28 +341,28 @@ $tpl->set('pages',$pages); if ($pages->items_total > 0) { - $listExtraParams = array('limit' => $pages->items_per_page, 'offset' => $pages->low); + $listExtraParams = ['limit' => $pages->items_per_page, 'offset' => $pages->low]; if ($showMsgCount) { $listExtraParams['select_columns'] = $allMsgCountQuery . ' as msg_all_count'; } $items = erLhcoreClassModelChat::getList(array_merge($filterParams['filter'], $listExtraParams)); - $iconsAdditional = erLhAbstractModelChatColumn::getList(array('ignore_fields' => array('position','conditions','column_identifier','enabled'), 'sort' => false, 'filter' => array('icon_mode' => 1, 'enabled' => 1, 'chat_enabled' => 1))); - $iconsAdditionalColumn = erLhAbstractModelChatColumn::getList(array('ignore_fields' => array('position','conditions','column_identifier','enabled'), 'sort' => 'position ASC, id ASC','filter' => array('enabled' => 1, 'icon_mode' => 0, 'chat_list_enabled' => 1))); + $iconsAdditional = erLhAbstractModelChatColumn::getList(['ignore_fields' => ['position','conditions','column_identifier','enabled'], 'sort' => false, 'filter' => ['icon_mode' => 1, 'enabled' => 1, 'chat_enabled' => 1]]); + $iconsAdditionalColumn = erLhAbstractModelChatColumn::getList(['ignore_fields' => ['position','conditions','column_identifier','enabled'], 'sort' => 'position ASC, id ASC','filter' => ['enabled' => 1, 'icon_mode' => 0, 'chat_list_enabled' => 1]]); - erLhcoreClassChat::prefillGetAttributes($items, array(), array(), array('additional_columns' => ($iconsAdditional + $iconsAdditionalColumn), 'do_not_clean' => true)); + erLhcoreClassChat::prefillGetAttributes($items, [], [], ['additional_columns' => ($iconsAdditional + $iconsAdditionalColumn), 'do_not_clean' => true]); $tpl->set('icons_additional',$iconsAdditional); $tpl->set('additional_chat_columns',$iconsAdditionalColumn); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.list_items',array('filter' => & $items, 'uparams' => $Params['user_parameters_unordered'])); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.list_items', ['filter' => & $items, 'uparams' => $Params['user_parameters_unordered']]); - $subjectsChats = erLhAbstractModelSubjectChat::getList(array('filterin' => array('chat_id' => array_keys($items)))); - erLhcoreClassChat::prefillObjects($subjectsChats, array( - array( + $subjectsChats = erLhAbstractModelSubjectChat::getList(['filterin' => ['chat_id' => array_keys($items)]]); + erLhcoreClassChat::prefillObjects($subjectsChats, [ + [ 'subject_id', 'subject', 'erLhAbstractModelSubject::getList' - ), - )); + ], + ]); foreach ($subjectsChats as $chatSubject) { if (!is_array($items[$chatSubject->chat_id]->subjects)) { $items[$chatSubject->chat_id]->subjects = []; @@ -395,5 +395,4 @@ $Result['content'] = $tpl->fetch(); -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.list_path',array('result' => & $Result)); -?> +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.list_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhchat/module.php b/lhc_web/modules/lhchat/module.php index b4410153e5..37e118be73 100644 --- a/lhc_web/modules/lhchat/module.php +++ b/lhc_web/modules/lhchat/module.php @@ -1,844 +1,680 @@ "Chat"); - -$ViewList = array(); - -$ViewList['adminchat'] = array( - 'params' => array('chat_id'), - 'uparams' => array('remember','arg','ol'), - 'functions' => array( 'use' ), - 'multiple_arguments' => array('arg','ol') -); - -$ViewList['getchatdata'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['verifytoken'] = array( - 'params' => array(), - 'uparams' => array() -); - -$ViewList['icondetailed'] = array( - 'params' => array('chat_id','column_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['relatedactions'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['chathistory'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['sendmassmessage'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['singleaction'] = array( - 'params' => array('chat_id','action'), - 'uparams' => array(), - 'functions' => array( 'use' ), -); - -$ViewList['subjectwidget'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'subject_chats_options' ), -); - -$ViewList['loadoperatorjs'] = array( - 'params' => array(), - 'uparams' => array('type','id'), - 'functions' => array( 'use' ), -); - -$ViewList['loadmaindata'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['loadpreviousmessages'] = array( - 'params' => array('chat_id','message_id'), - 'uparams' => array('initial','original'), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['subject'] = array( - 'params' => array('chat_id'), - 'uparams' => array('subject','status'), - 'functions' => array( 'setsubject' ) -); - -$ViewList['getnotificationsdata'] = array( - 'params' => array(), - 'uparams' => array('id'), - 'ajax' => true, - 'functions' => array( 'use' ), - 'multiple_arguments' => array ( 'id') -); - -$ViewList['getcannedfiltered'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['holdaction'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'holduse' ) -); - -$ViewList['copymessages'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['updateattribute'] = array( - 'params' => array(), - 'uparams' => array('hash','hash_resume','vid'), -); - -$ViewList['updatejsvars'] = array( - 'params' => array(), - 'uparams' => array('hash','hash_resume','vid','userinit','encrypted'), -); - -$ViewList['logevent'] = array( - 'params' => array(), - 'uparams' => array('hash','hash_resume','vid'), -); - -$ViewList['setnewvid'] = array( - 'params' => array(), - 'uparams' => array(), -); - -$ViewList['redirectcontact'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'redirectcontact' ) -); - -$ViewList['changestatus'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'canchangechatstatus' ) -); - -$ViewList['editprevious'] = array( - 'params' => array('chat_id','msg_id'), - 'uparams' => array(), - 'functions' => array( 'editprevious' ) -); - -$ViewList['deletemsg'] = array( - 'params' => array('chat_id','msg_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['quotemessage'] = array( - 'params' => array('id'), - 'uparams' => array('type'), - 'functions' => array( 'use' ) -); - -$ViewList['updatemsg'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['updatemessagedata'] = array( - 'params' => array('chat_id', 'hash', 'msg_id'), - 'uparams' => array(), - 'functions' => array( ) -); - -$ViewList['printchatadmin'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['loadactivechats'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['previewchat'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['previewmessage'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['closechatadmin'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['abstractclick'] = array( - 'params' => array('msg_id','payload'), - 'functions' => array( 'use' ) -); - -$ViewList['setsubstatus'] = array( - 'params' => array('chat_id','substatus'), - 'functions' => array( 'use' ) -); - -$ViewList['notificationsettings'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['startchatwithoperator'] = array( - 'params' => array('user_id'), - 'uparams' => array('mode'), - 'functions' => array( 'use' ) -); - -$ViewList['closechat'] = array( - 'params' => array('chat_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['sendmail'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'sendmail' ) -); - -$ViewList['modifychat'] = array( - 'params' => array('chat_id'), - 'uparams' => array('pos'), - 'functions' => array( 'modifychat' ) -); - -$ViewList['transferchat'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'allowtransfer' ) -); - -$ViewList['accepttransfer'] = array( - 'params' => array('transfer_id'), - 'uparams' => array('postaction','mode','scope'), - 'functions' => array( 'use' ) -); - -$ViewList['deletechatadmin'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'deletechat' ) -); - -$ViewList['delete'] = array( - 'params' => array('chat_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'deletechat' ) -); - -$ViewList['syncadmininterface'] = array( - 'params' => array(), - 'uparams' => array( - 'on_opf', - 'mmd', - 'mmdgroups', - 'limitmm', - 'bcs', - 'oopu', - 'oopugroups', - 'subjectd', - 'limits', - 'sdgroups', - 'subjectdprod', - 'subjectu', - 'sugroups', - 'limitam','pmd','pendingmu','pendingmd','pmug','amd','activemu','limitalm','activemd','almd','almug','limitpm','amug','alarmmd','alarmmu','hsub','lda','bdgroups','botdprod','w','clcs','limitgc','limitb','botd','odpgroups','ddgroups','udgroups','mdgroups', 'cdgroups', 'pdgroups','adgroups','pugroups','augroups','onop', 'acs', 'mcd', 'limitmc', 'mcdprod','activeu','pendingu','topen','departmentd','operatord','actived','pendingd','closedd','unreadd','limita','limitp','limitc','limitu','limito','limitd','activedprod','unreaddprod','pendingdprod','closeddprod','psort'), - 'ajax' => true, - 'functions' => array( 'use' ), - 'multiple_arguments' => array ( - 'mmd', - 'mmdgroups', - 'oopu', - 'oopugroups', - 'subjectd', - 'sdgroups', - 'subjectdprod', - 'subjectu', - 'sugroups', - 'pmd','pendingmu','pendingmd','pmug','amd','activemu','activemd','almd','almug','amug','alarmmd','alarmmu','hsub','bdgroups','botdprod','botd','w','odpgroups','ddgroups','udgroups','mdgroups', 'cdgroups', 'pdgroups', 'adgroups', 'pugroups','augroups','mcd','operatord','mcdprod', 'activeu', 'pendingu', 'actived', 'closedd' , 'pendingd', 'unreadd','departmentd','activedprod','unreaddprod','pendingdprod','closeddprod') -); - -$ViewList['loadinitialdata'] = array( - 'params' => array(), - 'uparams' => array('chatopen','chatgopen','chatmopen'), - 'ajax' => true, - 'functions' => array( 'use' ), - 'multiple_arguments' => array('chatopen','chatgopen','chatmopen') -); - -$ViewList['list'] = array( - 'params' => array(), - 'uparams' => array('cls_time','sortby','timefrom_type','timefromts','transfer_happened','phone','not_invitation','proactive_chat','view','dropped_chat','abandoned_chat','country_ids','has_unread_op_messages','cls_us','export','chat_status_ids','cf','with_bot','no_operator','has_operator','without_bot','bot_ids','ip','department_ids','department_group_ids','user_ids','group_ids','subject_id','anonymized','una','chat_duration_from','chat_duration_till','wait_time_from','wait_time_till','chat_id','nick','email','timefrom','timeto','department_id','user_id','print','xls','fbst','chat_status','hum','product_id','timefrom','timefrom_seconds','timefrom_minutes','timefrom_hours','timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours', 'department_group_id', 'group_id', 'invitation_id', - 'country_ids', - 'region', - 'iwh_ids', - 'theme_ids', - 'frt_from', - 'frt_till', - 'mart_from', - 'mart_till', - 'aart_till', - 'aart_from', - 'priority_from', - 'priority_till', - 'ipp', - 'op_msg_count', - 'vi_msg_count', - 'bot_msg_count', - 'all_msg_count', - 'all_msg_count_till', - 'as_participant', - 'participant_not_owner' - ), - 'functions' => array( 'use' ), - 'multiple_arguments' => array( - 'department_ids', - 'department_group_ids', - 'user_ids', - 'group_ids', - 'bot_ids', - 'subject_id', - 'country_ids', - 'chat_status_ids', - 'cf', - 'country_ids', - 'iwh_ids', - 'theme_ids' - ) -); - -$ViewList['dashboardwidgets'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['chattabs'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'allowchattabs' ) - ); - -$ViewList['chattabschrome'] = array( - 'params' => array(), - 'uparams' => array('mode'), - 'functions' => array( ) -); - -$ViewList['single'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'singlechatwindow' ) -); - -$ViewList['chatfootprint'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['refreshonlineinfo'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['checkscreenshot'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['checkscreenshotonline'] = array( - 'params' => array('online_id'), - 'functions' => array( 'use' ) -); - -$ViewList['operatortyping'] = array( - 'params' => array('chat_id','status'), - 'functions' => array( 'use' ) -); - -$ViewList['syncadmin'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['addmsgadmin'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['reactmodal'] = array( - 'params' => array('msg_id'), - 'functions' => array( 'use' ) -); - -$ViewList['updatechatstatus'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['addoperation'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['refreshcustomfields'] = array( - 'params' => array(), - 'uparams' => array('vid','hash','hash_resume'), -); - -$ViewList['addonlineoperation'] = array( - 'params' => array('online_user_id'), - 'functions' => array( 'use' ) -); - -$ViewList['addonlineoperationiframe'] = array( - 'params' => array('online_user_id'), - 'functions' => array( 'use' ) -); - -$ViewList['saveremarks'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['reaction'] = array( - 'params' => array('msg_id'), - 'functions' => array( 'use' ) -); - -$ViewList['saveonlinenotes'] = array( - 'params' => array('online_user_id'), - 'functions' => array( 'use' ) -); - -/* Anonymous functions */ -$ViewList['addmsguser'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mode'), -); - -$ViewList['editprevioususer'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array(), -); - -$ViewList['updatemsguser'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mode'), -); - -$ViewList['getmessage'] = array( - 'params' => array('chat_id','hash','msgid'), - 'uparams' => array('mode'), -); - -$ViewList['getmessageadmin'] = array( - 'params' => array('chat_id','msgid'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['voteaction'] = array( - 'params' => array('chat_id','hash','type'), - 'uparams' => array(), -); - -$ViewList['syncuser'] = array( - 'params' => array('chat_id','message_id','hash'), - 'uparams' => array('mode','ot','theme','modeembed') -); - -$ViewList['transfertohuman'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array() -); - -$ViewList['editnick'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array() -); - -$ViewList['usertyping'] = array( - 'params' => array('chat_id','hash','status'), - 'uparams' => array() -); - -$ViewList['checkchatstatus'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mode','theme','dot') -); - -$ViewList['transferuser'] = array( - 'params' => array('chat_id','item_id'), - 'functions' => array( 'allowtransfer' ) - ); - -$ViewList['blockuser'] = array( - 'params' => array('chat_id'), - 'functions' => array( 'allowblockusers' ) -); - -$ViewList['blockedusers'] = array( - 'params' => array(), - 'uparams' => array('remove_block','csfr','ip','nick'), - 'functions' => array( 'allowblockusers' ) -); - -$ViewList['getstatus'] = array( - 'params' => array(), - 'uparams' => array('fresh','ua','ma','operator','theme','priority','disable_pro_active','click','position','hide_offline','check_operator_messages','top','units','leaveamessage','department','identifier','survey','dot','bot_id'), - 'multiple_arguments' => array ( 'department', 'ua' ) -); - -$ViewList['htmlsnippet'] = array( - 'params' => array('id','type','sub_id'), - 'uparams' => array('hash'), - 'multiple_arguments' => array ( 'department', 'ua' ) -); - -$ViewList['chatcheckstatus'] = array( - 'params' => array(), - 'uparams' => array('status','department','vid','uactiv','wopen','uaction','hash','hash_resume','dot','hide_offline','isproactive'), - 'multiple_arguments' => array ( 'department' ) -); - -$ViewList['getstatusembed'] = array ( - 'params' => array(), - 'uparams' => array('fresh','ua','operator','theme','hide_offline','leaveamessage','department','priority','survey','bot_id'), - 'multiple_arguments' => array ( 'department','ua' ) -); - -$ViewList['startchat'] = array ( - 'params' => array(), - 'uparams' => array('ua','switchform','operator','theme','er','vid','hash_resume','sound','hash','offline','leaveamessage','department','priority','chatprefill','survey','prod','phash','pvhash','ajaxmode'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['start'] = array ( - 'params' => array(), - 'uparams' => array('sound','id','hash','department','theme','mobile','vid','identifier','inv','survey','priority','operator','leaveamessage','mode','bot','scope','fs','trigger','encrypted'), - 'multiple_arguments' => array('department') -); - -$ViewList['begin'] = array ( - 'params' => array(), - 'uparams' => array('sound','id','hash','department','theme','mobile','vid','identifier','inv','survey','priority','operator','leaveamessage','mode','bot','scope','fs','trigger','encrypted'), - 'multiple_arguments' => array('department') -); - -$ViewList['modal'] = array ( - 'params' => array(), - 'uparams' => array('sound','id','hash','department','theme','mobile','vid','identifier','inv','survey','priority','operator','leaveamessage','mode','bot','scope','fs','trigger','encrypted'), - 'multiple_arguments' => array('department') -); - -$ViewList['demo'] = array ( - 'params' => array(), - 'uparams' => array('sound','id','hash','department','theme','mobile','vid','identifier','inv','survey','priority','operator','leaveamessage','mode','bot','scope','fs','trigger','encrypted','debug'), - 'multiple_arguments' => array('department'), - 'functions' => array( 'use' ), -); - -$ViewList['chatwidget'] = array ( - 'params' => array(), - 'uparams' => array('mobile','bot_id','ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','sdemo','prod','phash','pvhash','fullheight','ajaxmode'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['reopen'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mode','embedmode','theme','fullheight'), -); - -$ViewList['readoperatormessage'] = array( - 'params' => array(), - 'uparams' => array('operator','theme','priority','vid','department','playsound','ua','survey','fullheight','inv','tag'), - 'multiple_arguments' => array ( 'department', 'ua' ) -); - -$ViewList['chatcheckoperatormessage'] = array( - 'params' => array(), - 'uparams' => array('tz','operator','theme','priority','vid','count_page','identifier','department','ua','survey','uactiv','wopen','fullheight','dyn'), - 'multiple_arguments' => array ( 'department','ua','dyn' ) -); - -$ViewList['extendcookie'] = array( - 'params' => array('vid'), - 'uparams' => array() -); - -$ViewList['logpageview'] = array( - 'params' => array(), - 'uparams' => array('tz','vid','identifier','department','ua','uactiv','wopen'), - 'multiple_arguments' => array ( 'department','ua' ) -); - -$ViewList['chatwidgetclosed'] = array( - 'params' => array(), - 'uparams' => array('vid','hash','eclose','close','conversion'), -); - -$ViewList['chat'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('theme','er','survey','cstarted') -); - -$ViewList['printchat'] = array( - 'params' => array('chat_id','hash') -); - -$ViewList['downloadtxt'] = array( - 'params' => array('chat_id','hash') -); - -$ViewList['readchatmail'] = array( - 'params' => array('chat_id','hash') -); - -$ViewList['chatpreview'] = array( - 'params' => array('chat_id','hash') -); - -$ViewList['bbcodeinsert'] = array( - 'params' => array('chat_id'), - 'uparams' => array('mode') -); - -$ViewList['chatwidgetchat'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mobile','sound','mode','theme','cstarted','survey','pchat','fullheight') -); - -$ViewList['userclosechat'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('eclose'), -); - -$ViewList['onlineusers'] = array( - 'params' => array(), - 'ajax' => true, - 'uparams' => array('clear_list','method','deletevisitor','timeout','csfr','department','maxrows','country','timeonsite','department_dpgroups','nochat'), - 'functions' => array( 'use_onlineusers' ), - 'multiple_arguments' => array( - 'department', - 'department_dpgroups' - ) -); - -$ViewList['jsononlineusers'] = array( - 'params' => array(), - 'uparams' => array('department','maxrows','timeout','department_dpgroups'), - 'functions' => array( 'use_onlineusers' ), - 'multiple_arguments' => array( - 'department', - 'department_dpgroups' - ) -); - -$ViewList['getonlineuserinfo'] = array( - 'params' => array('id'), - 'uparams' => array('tab','chat_id'), - 'functions' => array( 'use' ) -); - -$ViewList['sendnotice'] = array( - 'params' => array('online_id'), - 'functions' => array( 'use' ) -); - -$ViewList['geoconfiguration'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'administrategeoconfig' ) -); - -$ViewList['listchatconfig'] = array( - 'params' => array(), - 'functions' => array( 'administrateconfig' ) -); - -$ViewList['editchatconfig'] = array( - 'params' => array('config_id'), - 'functions' => array( 'administrateconfig' ) -); - -$ViewList['syncandsoundesetting'] = array( - 'params' => array(), - 'functions' => array( 'administratesyncsound' ) -); - -$ViewList['cannedmsg'] = array( - 'params' => array(), - 'uparams' => array('action','id','csfr','message','title','fmsg','department_id','subject_id','tab','user_id','timefrom','timeto','sortby','export','used_freq','group_ids','user_ids','department_group_ids','department_ids'), - 'functions' => array( 'explorecannedmsg' ), - 'multiple_arguments' => array( - 'department_id', - 'subject_id', - 'user_id', - 'department_ids', - 'department_group_ids', - 'user_ids', - 'group_ids', - ) -); - -$ViewList['maintenance'] = array( - 'params' => array(), - 'uparams' => array('csfr','action'), - 'functions' => array( 'maintenance' ) -); - -$ViewList['newcannedmsg'] = array( - 'params' => array(), - 'functions' => array( 'administratecannedmsg' ) -); - -$ViewList['cannedmsgedit'] = array( - 'params' => array('id'), - 'functions' => array( 'explorecannedmsg' ) -); - -$ViewList['geoadjustment'] = array( - 'params' => array(), - 'functions' => array( 'geoadjustment' ) -); - -$ViewList['accept'] = array( - 'params' => array('hash','validation_hash','email') -); - -$ViewList['confirmleave'] = array( - 'params' => array('chat_id','hash') -); - -$ViewList['reacttomessagemodal'] = array( - 'params' => array('message_id'), - 'uparams' => array('theme') -); - -$ViewList['sendchat'] = array( - 'params' => array('chat_id','hash') -); - -$ViewList['transferchatrefilter'] = array( - 'params' => array('chat_id'), - 'uparams' => array('mode','obj'), - 'functions' => array( 'use' ) -); - -$ViewList['searchprovider'] = array( - 'params' => array('scope'), - 'functions' => array( 'use' ) -); - -$FunctionList['use'] = array('explain' => 'General permission to use chat module'); -$FunctionList['open_all'] = array('explain' => 'Allow operator to open all pending chats, not only assigned to him'); -$FunctionList['changeowner'] = array('explain' => 'Allow operator to change chat owner'); -$FunctionList['singlechatwindow'] = array('explain' =>'Allow operator to use single chat window functionality'); -$FunctionList['allowchattabs'] = array('explain' =>'Allow operator to user chat rooms functionality'); -$FunctionList['deletechat'] = array('explain' =>'Allow operator to delete their own chats'); -$FunctionList['deleteglobalchat'] = array('explain' =>'Allow to delete all chats'); -$FunctionList['allowtransfer'] = array('explain' =>'Allow user to transfer chat to another user/department'); -$FunctionList['allowcloseremote'] = array('explain' =>'Allow operator to close another operator chat'); -$FunctionList['allowblockusers'] = array('explain' =>'Allow operator to block visitors'); -$FunctionList['administrateconfig'] = array('explain' =>'Allow to change chat config'); -$FunctionList['allowclearonlinelist'] = array('explain' =>'Allow operator to clean online users list'); -$FunctionList['administratecannedmsg'] = array('explain' =>'Allow operator change canned messages'); -$FunctionList['explorecannedmsg'] = array('explain' =>'Allow operator to explore canned messages. They will see canned messages based on departments they are a member of.'); -$FunctionList['explorecannedmsg_all'] = array('explain' =>'Allow operator to explore canned messages. They will see all departments canned messages.'); -$FunctionList['allowopenremotechat'] = array('explain' =>'Allow operator to open other operators chats from same department'); -$FunctionList['writeremotechat'] = array('explain' =>'Allow operator to write to another operator chat'); -$FunctionList['allowreopenremote'] = array('explain' =>'Allow operator to reopen other operators chats'); -$FunctionList['allowtransfertoanyuser'] = array('explain' =>'Allow operator to transfer chat to any online operator, not only their own department users'); -$FunctionList['allowtransferdirectly'] = array('explain' =>'Allow operator to transfer chat directly to other operator'); -$FunctionList['use_onlineusers'] = array('explain' =>'Allow operator to view online visitors'); -$FunctionList['chattabschrome'] = array('explain' =>'Allow operator to use chrome extension'); -$FunctionList['canchangechatstatus'] = array('explain' =>'Allow operator to change chat status'); -$FunctionList['administrateinvitations'] = array('explain' =>'Allow operator to change pro active invitations'); -$FunctionList['administratecampaigs'] = array('explain' =>'Allow operator to change pro active campaigns'); -$FunctionList['administratechatevents'] = array('explain' =>'Allow operator to change pro active chat events'); -$FunctionList['administratechatvariables'] = array('explain' =>'Allow operator to change pro active chat variables'); -$FunctionList['administrateresponder'] = array('explain' =>'Allow operator to change auto responder'); -$FunctionList['maintenance'] = array('explain' =>'Allow operator to run maintenance'); -$FunctionList['sees_all_online_visitors'] = array('explain' =>'Operator can see all online visitors, not only their department'); -$FunctionList['geoadjustment'] = array('explain' => 'Allow operator to edit geo adjustment for chat status'); -$FunctionList['take_screenshot'] = array('explain' => 'Allow operator to take visitor browser page screenshots'); -$FunctionList['modifychat'] = array('explain' => 'Allow operator modify main chat information'); -$FunctionList['allowredirect'] = array('explain' => 'Allow operator to redirect user to another page'); -$FunctionList['administrategeoconfig'] = array('explain' => 'Allow operator to edit geo detection configuration'); -$FunctionList['manage_product'] = array('explain' => 'Allow operator to manage products'); -$FunctionList['administratesubject'] = array('explain' => 'Allow operator to manage subjects'); -$FunctionList['modifychatcore'] = array('explain' => 'Allow operator to change chat core attributes'); -$FunctionList['sendmail'] = array('explain' => 'Allow operator to send e-mail to visitor from chat window'); -$FunctionList['redirectcontact'] = array('explain' => 'Allow operator to redirect visitor to contact form'); -$FunctionList['holduse'] = array('explain' => 'Allow operator to use hold/unhold functionality'); -$FunctionList['setsubject'] = array('explain' => 'Allow operator to use set chat subject'); -$FunctionList['administratecolumn'] = array('explain' => 'Allow operator to configure chat columns'); -$FunctionList['administratechatvariable'] = array('explain' => 'Allow operator to configure chat custom variables'); -$FunctionList['administratechatpriority'] = array('explain' => 'Allow operator to configure chat priority by custom variables'); -$FunctionList['administratesyncsound'] = array('explain' => 'Allow operator to configure chat sound and sync settings'); -$FunctionList['voicemessages'] = array('explain' => 'Allow operator to send voice messages'); -$FunctionList['chatdebug'] = array('explain' => 'Allow operator to see raw chat details in chat edit window'); -$FunctionList['administrate_alert_icon'] = array('explain' => 'Allow operator to manage alert icons list'); -$FunctionList['prev_chats'] = array('explain' => 'Allow operator to see previous chats from visitor'); -$FunctionList['changedepartment'] = array('explain' => 'Allow operator to change chat department'); -$FunctionList['subject_chats'] = array('explain' => 'Allow operator see subject filtered chats'); -$FunctionList['subject_chats_options'] = array('explain' => 'Allow operator to choose what subjects should be applied as filter'); -$FunctionList['export_chats'] = array('explain' => 'Allow operator to export filtered chats'); -$FunctionList['htmlbbcodeenabled'] = array('explain' => 'Allow operator to use [html] bbcode.'); -$FunctionList['metamsgenabled'] = array('explain' => 'Allow operator to use meta_msg in message add interface.'); -$FunctionList['seeip'] = array('explain' => 'Allow operator to see full IP'); -$FunctionList['editprevious'] = array('explain' => 'Allow operator to edit their previous message.'); -$FunctionList['editpreviousop'] = array('explain' => 'Allow operator to edit other operators previous messages'); -$FunctionList['editpreviouvis'] = array('explain' => 'Allow operator to edit visitors previous messages'); -$FunctionList['editpreviousall'] = array('explain' => 'Allow operator to edit all their previous messages.'); -$FunctionList['impersonate'] = array('explain' => 'Allow operator to impersonate another operator on joining chat window'); -$FunctionList['whispermode'] = array('explain' => 'Allow operator to use whisper mode'); -$FunctionList['allowtransfertoanydep'] = array('explain' => 'Allow operator to transfer chat to any department.'); -$FunctionList['list_all_chats'] = array('explain' => 'Allow operator to list all chats independently of operator and status.'); -$FunctionList['list_my_chats'] = array('explain' => 'Allow operator to list chats they are owner of'); -$FunctionList['list_pending_chats'] = array('explain' => 'Allow operator to list chats without an owner and in status pending.'); -$FunctionList['use_unhidden_phone'] = array('explain' => 'Allow operator to see full phone number'); -$FunctionList['chat_see_email'] = array('explain' => 'Allow operator to see e-mail of the visitor'); -$FunctionList['chat_see_unhidden_email'] = array('explain' => 'Allow operator to see full e-mail address of the visitor'); -$FunctionList['chat_export_email'] = array('explain' => 'Allow operator to see e-mail address in exported file'); -$FunctionList['chat_export_phone'] = array('explain' => 'Allow operator to see phone in exported file'); -$FunctionList['see_sensitive_information'] = array('explain' => 'Allow operator to see sensitive information in the messages'); -$FunctionList['my_chats_filter'] = array('explain' => 'Allow operator to see department filter for my active pending chats widget'); -$FunctionList['allowopenclosedchats'] = array('explain' => 'Allow operator to open closed chats'); -$FunctionList['removemsgop'] = array('explain' => 'Allow to remove operator any operator message'); -$FunctionList['removemsgvi'] = array('explain' => 'Allow to remove operator any visitor message'); -$FunctionList['no_edit_history'] = array('explain' => 'Do not store message edit history if edited by chat owner'); -$FunctionList['see_operator_name'] = array('explain' => 'Allow operator to see chat message real operator name'); -$FunctionList['open_unassigned_chat'] = array('explain' => 'Allow operator to open unassigned pending chat and become an owner of it.') - -?> \ No newline at end of file +$Module = ['name' => 'Chat']; + +$ViewList = [ + 'adminchat' => [ + 'params' => ['chat_id'], + 'uparams' => ['remember', 'arg', 'ol'], + 'functions' => ['use'], + 'multiple_arguments' => ['arg', 'ol'], + ], + 'getchatdata' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'verifytoken' => [ + 'params' => [], + 'uparams' => [], + ], + 'icondetailed' => [ + 'params' => ['chat_id', 'column_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'relatedactions' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'chathistory' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'sendmassmessage' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'singleaction' => [ + 'params' => ['chat_id', 'action'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'subjectwidget' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['subject_chats_options'], + ], + 'loadoperatorjs' => [ + 'params' => [], + 'uparams' => ['type', 'id'], + 'functions' => ['use'], + ], + 'loadmaindata' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'loadpreviousmessages' => [ + 'params' => ['chat_id', 'message_id'], + 'uparams' => ['initial', 'original'], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'subject' => [ + 'params' => ['chat_id'], + 'uparams' => ['subject', 'status'], + 'functions' => ['setsubject'], + ], + 'getnotificationsdata' => [ + 'params' => [], + 'uparams' => ['id'], + 'ajax' => true, + 'functions' => ['use'], + 'multiple_arguments' => ['id'], + ], + 'getcannedfiltered' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'holdaction' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['holduse'], + ], + 'copymessages' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'updateattribute' => [ + 'params' => [], + 'uparams' => ['hash', 'hash_resume', 'vid'], + ], + 'updatejsvars' => [ + 'params' => [], + 'uparams' => ['hash', 'hash_resume', 'vid', 'userinit', 'encrypted'], + ], + 'logevent' => [ + 'params' => [], + 'uparams' => ['hash', 'hash_resume', 'vid'], + ], + 'setnewvid' => [ + 'params' => [], + 'uparams' => [], + ], + 'redirectcontact' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['redirectcontact'], + ], + 'changestatus' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['canchangechatstatus'], + ], + 'editprevious' => [ + 'params' => ['chat_id', 'msg_id'], + 'uparams' => [], + 'functions' => ['editprevious'], + ], + 'deletemsg' => [ + 'params' => ['chat_id', 'msg_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'quotemessage' => [ + 'params' => ['id'], + 'uparams' => ['type'], + 'functions' => ['use'], + ], + 'updatemsg' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'updatemessagedata' => [ + 'params' => ['chat_id', 'hash', 'msg_id'], + 'uparams' => [], + 'functions' => [], + ], + 'printchatadmin' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'loadactivechats' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'previewchat' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'previewmessage' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'closechatadmin' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'abstractclick' => [ + 'params' => ['msg_id', 'payload'], + 'functions' => ['use'], + ], + 'setsubstatus' => [ + 'params' => ['chat_id', 'substatus'], + 'functions' => ['use'], + ], + 'notificationsettings' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'startchatwithoperator' => [ + 'params' => ['user_id'], + 'uparams' => ['mode'], + 'functions' => ['use'], + ], + 'closechat' => [ + 'params' => ['chat_id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'sendmail' => [ + 'params' => ['chat_id'], + 'functions' => ['sendmail'], + ], + 'modifychat' => [ + 'params' => ['chat_id'], + 'uparams' => ['pos'], + 'functions' => ['modifychat'], + ], + 'transferchat' => [ + 'params' => ['chat_id'], + 'functions' => ['allowtransfer'], + ], + 'accepttransfer' => [ + 'params' => ['transfer_id'], + 'uparams' => ['postaction', 'mode', 'scope'], + 'functions' => ['use'], + ], + 'deletechatadmin' => [ + 'params' => ['chat_id'], + 'functions' => ['deletechat'], + ], + 'delete' => [ + 'params' => ['chat_id'], + 'uparams' => ['csfr'], + 'functions' => ['deletechat'], + ], + 'syncadmininterface' => [ + 'params' => [], + 'uparams' => [ + 'on_opf', 'mmd', 'mmdgroups', 'limitmm', 'bcs', 'oopu', 'oopugroups', 'subjectd', 'limits', 'sdgroups', + 'subjectdprod', 'subjectu', 'sugroups', 'limitam', 'pmd', 'pendingmu', 'pendingmd', 'pmug', 'amd', + 'activemu', 'limitalm', 'activemd', 'almd', 'almug', 'limitpm', 'amug', 'alarmmd', 'alarmmu', 'hsub', + 'lda', 'bdgroups', 'botdprod', 'w', 'clcs', 'limitgc', 'limitb', 'botd', 'odpgroups', 'ddgroups', + 'udgroups', 'mdgroups', 'cdgroups', 'pdgroups', 'adgroups', 'pugroups', 'augroups', 'onop', 'acs', + 'mcd', 'limitmc', 'mcdprod', 'activeu', 'pendingu', 'topen', 'departmentd', 'operatord', 'actived', + 'pendingd', 'closedd', 'unreadd', 'limita', 'limitp', 'limitc', 'limitu', 'limito', 'limitd', + 'activedprod', 'unreaddprod', 'pendingdprod', 'closeddprod', 'psort', + ], + 'ajax' => true, + 'functions' => ['use'], + 'multiple_arguments' => [ + 'mmd', 'mmdgroups', 'oopu', 'oopugroups', 'subjectd', 'sdgroups', 'subjectdprod', 'subjectu', + 'sugroups', 'pmd', 'pendingmu', 'pendingmd', 'pmug', 'amd', 'activemu', 'activemd', 'almd', 'almug', + 'amug', 'alarmmd', 'alarmmu', 'hsub', 'bdgroups', 'botdprod', 'botd', 'w', 'odpgroups', 'ddgroups', + 'udgroups', 'mdgroups', 'cdgroups', 'pdgroups', 'adgroups', 'pugroups', 'augroups', 'mcd', 'operatord', + 'mcdprod', 'activeu', 'pendingu', 'actived', 'closedd', 'pendingd', 'unreadd', 'departmentd', + 'activedprod', 'unreaddprod', 'pendingdprod', 'closeddprod', + ], + ], + 'loadinitialdata' => [ + 'params' => [], + 'uparams' => ['chatopen', 'chatgopen', 'chatmopen'], + 'ajax' => true, + 'functions' => ['use'], + 'multiple_arguments' => ['chatopen', 'chatgopen', 'chatmopen'], + ], + 'list' => [ + 'params' => [], + 'uparams' => [ + 'cls_time', 'sortby', 'timefrom_type', 'timefromts', 'transfer_happened', 'phone', 'not_invitation', + 'proactive_chat', 'view', 'dropped_chat', 'abandoned_chat', 'country_ids', 'has_unread_op_messages', + 'cls_us', 'export', 'chat_status_ids', 'cf', 'with_bot', 'no_operator', 'has_operator', 'without_bot', + 'bot_ids', 'ip', 'department_ids', 'department_group_ids', 'user_ids', 'group_ids', 'subject_id', + 'anonymized', 'una', 'chat_duration_from', 'chat_duration_till', 'wait_time_from', 'wait_time_till', + 'chat_id', 'nick', 'email', 'timefrom', 'timeto', 'department_id', 'user_id', 'print', 'xls', 'fbst', + 'chat_status', 'hum', 'product_id', 'timefrom', 'timefrom_seconds', 'timefrom_minutes', 'timefrom_hours', + 'timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours', 'department_group_id', 'group_id', + 'invitation_id', 'country_ids', 'region', 'iwh_ids', 'theme_ids', 'frt_from', 'frt_till', 'mart_from', + 'mart_till', 'aart_till', 'aart_from', 'priority_from', 'priority_till', 'ipp', 'op_msg_count', + 'vi_msg_count', 'bot_msg_count', 'all_msg_count', 'all_msg_count_till', 'as_participant', + 'participant_not_owner', + ], + 'functions' => ['use'], + 'multiple_arguments' => [ + 'department_ids', 'department_group_ids', 'user_ids', 'group_ids', 'bot_ids', 'subject_id', + 'country_ids', 'chat_status_ids', 'cf', 'country_ids', 'iwh_ids', 'theme_ids', + ], + ], + 'dashboardwidgets' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'chattabs' => [ + 'params' => ['chat_id'], + 'functions' => ['allowchattabs'], + ], + 'chattabschrome' => [ + 'params' => [], + 'uparams' => ['mode'], + 'functions' => [], + ], + 'single' => [ + 'params' => ['chat_id'], + 'functions' => ['singlechatwindow'], + ], + 'chatfootprint' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'refreshonlineinfo' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'checkscreenshot' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'checkscreenshotonline' => [ + 'params' => ['online_id'], + 'functions' => ['use'], + ], + 'operatortyping' => [ + 'params' => ['chat_id', 'status'], + 'functions' => ['use'], + ], + 'syncadmin' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'addmsgadmin' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'reactmodal' => [ + 'params' => ['msg_id'], + 'functions' => ['use'], + ], + 'updatechatstatus' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'addoperation' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'refreshcustomfields' => [ + 'params' => [], + 'uparams' => ['vid', 'hash', 'hash_resume'], + ], + 'addonlineoperation' => [ + 'params' => ['online_user_id'], + 'functions' => ['use'], + ], + 'addonlineoperationiframe' => [ + 'params' => ['online_user_id'], + 'functions' => ['use'], + ], + 'saveremarks' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + ], + 'reaction' => [ + 'params' => ['msg_id'], + 'functions' => ['use'], + ], + 'saveonlinenotes' => [ + 'params' => ['online_user_id'], + 'functions' => ['use'], + ], + 'addmsguser' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode'], + ], + 'editprevioususer' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => [], + ], + 'updatemsguser' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode'], + ], + 'getmessage' => [ + 'params' => ['chat_id', 'hash', 'msgid'], + 'uparams' => ['mode'], + ], + 'getmessageadmin' => [ + 'params' => ['chat_id', 'msgid'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'voteaction' => [ + 'params' => ['chat_id', 'hash', 'type'], + 'uparams' => [], + ], + 'syncuser' => [ + 'params' => ['chat_id', 'message_id', 'hash'], + 'uparams' => ['mode', 'ot', 'theme', 'modeembed'], + ], + 'transfertohuman' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => [], + ], + 'editnick' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => [], + ], + 'usertyping' => [ + 'params' => ['chat_id', 'hash', 'status'], + 'uparams' => [], + ], + 'checkchatstatus' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode', 'theme', 'dot'], + ], + 'transferuser' => [ + 'params' => ['chat_id', 'item_id'], + 'functions' => ['allowtransfer'], + ], + 'blockuser' => [ + 'params' => ['chat_id'], + 'functions' => ['allowblockusers'], + ], + 'blockedusers' => [ + 'params' => [], + 'uparams' => ['remove_block', 'csfr', 'ip', 'nick'], + 'functions' => ['allowblockusers'], + ], + 'getstatus' => [ + 'params' => [], + 'uparams' => ['fresh', 'ua', 'ma', 'operator', 'theme', 'priority', 'disable_pro_active', 'click', 'position', 'hide_offline', 'check_operator_messages', 'top', 'units', 'leaveamessage', 'department', 'identifier', 'survey', 'dot', 'bot_id'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'htmlsnippet' => [ + 'params' => ['id', 'type', 'sub_id'], + 'uparams' => ['hash'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'chatcheckstatus' => [ + 'params' => [], + 'uparams' => ['status', 'department', 'vid', 'uactiv', 'wopen', 'uaction', 'hash', 'hash_resume', 'dot', 'hide_offline', 'isproactive'], + 'multiple_arguments' => ['department'], + ], + 'getstatusembed' => [ + 'params' => [], + 'uparams' => ['fresh', 'ua', 'operator', 'theme', 'hide_offline', 'leaveamessage', 'department', 'priority', 'survey', 'bot_id'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'startchat' => [ + 'params' => [], + 'uparams' => ['ua', 'switchform', 'operator', 'theme', 'er', 'vid', 'hash_resume', 'sound', 'hash', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'prod', 'phash', 'pvhash', 'ajaxmode'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'start' => [ + 'params' => [], + 'uparams' => ['sound', 'id', 'hash', 'department', 'theme', 'mobile', 'vid', 'identifier', 'inv', 'survey', 'priority', 'operator', 'leaveamessage', 'mode', 'bot', 'scope', 'fs', 'trigger', 'encrypted'], + 'multiple_arguments' => ['department'], + ], + 'begin' => [ + 'params' => [], + 'uparams' => ['sound', 'id', 'hash', 'department', 'theme', 'mobile', 'vid', 'identifier', 'inv', 'survey', 'priority', 'operator', 'leaveamessage', 'mode', 'bot', 'scope', 'fs', 'trigger', 'encrypted'], + 'multiple_arguments' => ['department'], + ], + 'modal' => [ + 'params' => [], + 'uparams' => ['sound', 'id', 'hash', 'department', 'theme', 'mobile', 'vid', 'identifier', 'inv', 'survey', 'priority', 'operator', 'leaveamessage', 'mode', 'bot', 'scope', 'fs', 'trigger', 'encrypted'], + 'multiple_arguments' => ['department'], + ], + 'demo' => [ + 'params' => [], + 'uparams' => ['sound', 'id', 'hash', 'department', 'theme', 'mobile', 'vid', 'identifier', 'inv', 'survey', 'priority', 'operator', 'leaveamessage', 'mode', 'bot', 'scope', 'fs', 'trigger', 'encrypted', 'debug'], + 'multiple_arguments' => ['department'], + 'functions' => ['use'], + ], + 'chatwidget' => [ + 'params' => [], + 'uparams' => ['mobile', 'bot_id', 'ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'sdemo', 'prod', 'phash', 'pvhash', 'fullheight', 'ajaxmode'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'reopen' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode', 'embedmode', 'theme', 'fullheight'], + ], + 'readoperatormessage' => [ + 'params' => [], + 'uparams' => ['operator', 'theme', 'priority', 'vid', 'department', 'playsound', 'ua', 'survey', 'fullheight', 'inv', 'tag'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'chatcheckoperatormessage' => [ + 'params' => [], + 'uparams' => ['tz', 'operator', 'theme', 'priority', 'vid', 'count_page', 'identifier', 'department', 'ua', 'survey', 'uactiv', 'wopen', 'fullheight', 'dyn'], + 'multiple_arguments' => ['department', 'ua', 'dyn'], + ], + 'extendcookie' => [ + 'params' => ['vid'], + 'uparams' => [], + ], + 'logpageview' => [ + 'params' => [], + 'uparams' => ['tz', 'vid', 'identifier', 'department', 'ua', 'uactiv', 'wopen'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'chatwidgetclosed' => [ + 'params' => [], + 'uparams' => ['vid', 'hash', 'eclose', 'close', 'conversion'], + ], + 'chat' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['theme', 'er', 'survey', 'cstarted'], + ], + 'printchat' => [ + 'params' => ['chat_id', 'hash'], + ], + 'downloadtxt' => [ + 'params' => ['chat_id', 'hash'], + ], + 'readchatmail' => [ + 'params' => ['chat_id', 'hash'], + ], + 'chatpreview' => [ + 'params' => ['chat_id', 'hash'], + ], + 'bbcodeinsert' => [ + 'params' => ['chat_id'], + 'uparams' => ['mode'], + ], + 'chatwidgetchat' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mobile', 'sound', 'mode', 'theme', 'cstarted', 'survey', 'pchat', 'fullheight'], + ], + 'userclosechat' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['eclose'], + ], + 'onlineusers' => [ + 'params' => [], + 'ajax' => true, + 'uparams' => ['clear_list', 'method', 'deletevisitor', 'timeout', 'csfr', 'department', 'maxrows', 'country', 'timeonsite', 'department_dpgroups', 'nochat'], + 'functions' => ['use_onlineusers'], + 'multiple_arguments' => ['department', 'department_dpgroups'], + ], + 'jsononlineusers' => [ + 'params' => [], + 'uparams' => ['department', 'maxrows', 'timeout', 'department_dpgroups'], + 'functions' => ['use_onlineusers'], + 'multiple_arguments' => ['department', 'department_dpgroups'], + ], + 'getonlineuserinfo' => [ + 'params' => ['id'], + 'uparams' => ['tab', 'chat_id'], + 'functions' => ['use'], + ], + 'sendnotice' => [ + 'params' => ['online_id'], + 'functions' => ['use'], + ], + 'geoconfiguration' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['administrategeoconfig'], + ], + 'listchatconfig' => [ + 'params' => [], + 'functions' => ['administrateconfig'], + ], + 'editchatconfig' => [ + 'params' => ['config_id'], + 'functions' => ['administrateconfig'], + ], + 'syncandsoundesetting' => [ + 'params' => [], + 'functions' => ['administratesyncsound'], + ], + 'cannedmsg' => [ + 'params' => [], + 'uparams' => ['action', 'id', 'csfr', 'message', 'title', 'fmsg', 'department_id', 'subject_id', 'tab', 'user_id', 'timefrom', 'timeto', 'sortby', 'export', 'used_freq', 'group_ids', 'user_ids', 'department_group_ids', 'department_ids'], + 'functions' => ['explorecannedmsg'], + 'multiple_arguments' => ['department_id', 'subject_id', 'user_id', 'department_ids', 'department_group_ids', 'user_ids', 'group_ids'], + ], + 'maintenance' => [ + 'params' => [], + 'uparams' => ['csfr', 'action'], + 'functions' => ['maintenance'], + ], + 'newcannedmsg' => [ + 'params' => [], + 'functions' => ['administratecannedmsg'], + ], + 'cannedmsgedit' => [ + 'params' => ['id'], + 'functions' => ['explorecannedmsg'], + ], + 'geoadjustment' => [ + 'params' => [], + 'functions' => ['geoadjustment'], + ], + 'accept' => [ + 'params' => ['hash', 'validation_hash', 'email'], + ], + 'confirmleave' => [ + 'params' => ['chat_id', 'hash'], + ], + 'reacttomessagemodal' => [ + 'params' => ['message_id'], + 'uparams' => ['theme'], + ], + 'sendchat' => [ + 'params' => ['chat_id', 'hash'], + ], + 'transferchatrefilter' => [ + 'params' => ['chat_id'], + 'uparams' => ['mode', 'obj'], + 'functions' => ['use'], + ], + 'searchprovider' => [ + 'params' => ['scope'], + 'functions' => ['use'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'General permission to use chat module'], + 'open_all' => ['explain' => 'Allow operator to open all pending chats, not only assigned to him'], + 'changeowner' => ['explain' => 'Allow operator to change chat owner'], + 'singlechatwindow' => ['explain' => 'Allow operator to use single chat window functionality'], + 'allowchattabs' => ['explain' => 'Allow operator to user chat rooms functionality'], + 'deletechat' => ['explain' => 'Allow operator to delete their own chats'], + 'deleteglobalchat' => ['explain' => 'Allow to delete all chats'], + 'allowtransfer' => ['explain' => 'Allow user to transfer chat to another user/department'], + 'allowcloseremote' => ['explain' => 'Allow operator to close another operator chat'], + 'allowblockusers' => ['explain' => 'Allow operator to block visitors'], + 'administrateconfig' => ['explain' => 'Allow to change chat config'], + 'allowclearonlinelist' => ['explain' => 'Allow operator to clean online users list'], + 'administratecannedmsg' => ['explain' => 'Allow operator change canned messages'], + 'explorecannedmsg' => ['explain' => 'Allow operator to explore canned messages. They will see canned messages based on departments they are a member of.'], + 'explorecannedmsg_all' => ['explain' => 'Allow operator to explore canned messages. They will see all departments canned messages.'], + 'allowopenremotechat' => ['explain' => 'Allow operator to open other operators chats from same department'], + 'writeremotechat' => ['explain' => 'Allow operator to write to another operator chat'], + 'allowreopenremote' => ['explain' => 'Allow operator to reopen other operators chats'], + 'allowtransfertoanyuser' => ['explain' => 'Allow operator to transfer chat to any online operator, not only their own department users'], + 'allowtransferdirectly' => ['explain' => 'Allow operator to transfer chat directly to other operator'], + 'use_onlineusers' => ['explain' => 'Allow operator to view online visitors'], + 'chattabschrome' => ['explain' => 'Allow operator to use chrome extension'], + 'canchangechatstatus' => ['explain' => 'Allow operator to change chat status'], + 'administrateinvitations' => ['explain' => 'Allow operator to change pro active invitations'], + 'administratecampaigs' => ['explain' => 'Allow operator to change pro active campaigns'], + 'administratechatevents' => ['explain' => 'Allow operator to change pro active chat events'], + 'administratechatvariables' => ['explain' => 'Allow operator to change pro active chat variables'], + 'administrateresponder' => ['explain' => 'Allow operator to change auto responder'], + 'maintenance' => ['explain' => 'Allow operator to run maintenance'], + 'sees_all_online_visitors' => ['explain' => 'Operator can see all online visitors, not only their department'], + 'geoadjustment' => ['explain' => 'Allow operator to edit geo adjustment for chat status'], + 'take_screenshot' => ['explain' => 'Allow operator to take visitor browser page screenshots'], + 'modifychat' => ['explain' => 'Allow operator modify main chat information'], + 'allowredirect' => ['explain' => 'Allow operator to redirect user to another page'], + 'administrategeoconfig' => ['explain' => 'Allow operator to edit geo detection configuration'], + 'manage_product' => ['explain' => 'Allow operator to manage products'], + 'administratesubject' => ['explain' => 'Allow operator to manage subjects'], + 'modifychatcore' => ['explain' => 'Allow operator to change chat core attributes'], + 'sendmail' => ['explain' => 'Allow operator to send e-mail to visitor from chat window'], + 'redirectcontact' => ['explain' => 'Allow operator to redirect visitor to contact form'], + 'holduse' => ['explain' => 'Allow operator to use hold/unhold functionality'], + 'setsubject' => ['explain' => 'Allow operator to use set chat subject'], + 'administratecolumn' => ['explain' => 'Allow operator to configure chat columns'], + 'administratechatvariable' => ['explain' => 'Allow operator to configure chat custom variables'], + 'administratechatpriority' => ['explain' => 'Allow operator to configure chat priority by custom variables'], + 'administratesyncsound' => ['explain' => 'Allow operator to configure chat sound and sync settings'], + 'voicemessages' => ['explain' => 'Allow operator to send voice messages'], + 'chatdebug' => ['explain' => 'Allow operator to see raw chat details in chat edit window'], + 'administrate_alert_icon' => ['explain' => 'Allow operator to manage alert icons list'], + 'prev_chats' => ['explain' => 'Allow operator to see previous chats from visitor'], + 'changedepartment' => ['explain' => 'Allow operator to change chat department'], + 'subject_chats' => ['explain' => 'Allow operator see subject filtered chats'], + 'subject_chats_options' => ['explain' => 'Allow operator to choose what subjects should be applied as filter'], + 'export_chats' => ['explain' => 'Allow operator to export filtered chats'], + 'htmlbbcodeenabled' => ['explain' => 'Allow operator to use [html] bbcode.'], + 'metamsgenabled' => ['explain' => 'Allow operator to use meta_msg in message add interface.'], + 'seeip' => ['explain' => 'Allow operator to see full IP'], + 'editprevious' => ['explain' => 'Allow operator to edit their previous message.'], + 'editpreviousop' => ['explain' => 'Allow operator to edit other operators previous messages'], + 'editpreviouvis' => ['explain' => 'Allow operator to edit visitors previous messages'], + 'editpreviousall' => ['explain' => 'Allow operator to edit all their previous messages.'], + 'impersonate' => ['explain' => 'Allow operator to impersonate another operator on joining chat window'], + 'whispermode' => ['explain' => 'Allow operator to use whisper mode'], + 'allowtransfertoanydep' => ['explain' => 'Allow operator to transfer chat to any department.'], + 'list_all_chats' => ['explain' => 'Allow operator to list all chats independently of operator and status.'], + 'list_my_chats' => ['explain' => 'Allow operator to list chats they are owner of'], + 'list_pending_chats' => ['explain' => 'Allow operator to list chats without an owner and in status pending.'], + 'use_unhidden_phone' => ['explain' => 'Allow operator to see full phone number'], + 'chat_see_email' => ['explain' => 'Allow operator to see e-mail of the visitor'], + 'chat_see_unhidden_email' => ['explain' => 'Allow operator to see full e-mail address of the visitor'], + 'chat_export_email' => ['explain' => 'Allow operator to see e-mail address in exported file'], + 'chat_export_phone' => ['explain' => 'Allow operator to see phone in exported file'], + 'see_sensitive_information' => ['explain' => 'Allow operator to see sensitive information in the messages'], + 'my_chats_filter' => ['explain' => 'Allow operator to see department filter for my active pending chats widget'], + 'allowopenclosedchats' => ['explain' => 'Allow operator to open closed chats'], + 'removemsgop' => ['explain' => 'Allow to remove operator any operator message'], + 'removemsgvi' => ['explain' => 'Allow to remove operator any visitor message'], + 'no_edit_history' => ['explain' => 'Do not store message edit history if edited by chat owner'], + 'see_operator_name' => ['explain' => 'Allow operator to see chat message real operator name'], + 'open_unassigned_chat' => ['explain' => 'Allow operator to open unassigned pending chat and become an owner of it.'], +]; diff --git a/lhc_web/modules/lhchat/printchat.php b/lhc_web/modules/lhchat/printchat.php index b56bd14b34..a2d25d1bc4 100644 --- a/lhc_web/modules/lhchat/printchat.php +++ b/lhc_web/modules/lhchat/printchat.php @@ -9,8 +9,8 @@ try { $chat = erLhcoreClassChat::getSession()->load( 'erLhcoreClassModelChat', $Params['user_parameters']['chat_id']); if ($chat->hash == $Params['user_parameters']['hash'] && ($chat->status == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT || erLhcoreClassChat::canReopen($chat,true) || ($chat->status == erLhcoreClassModelChat::STATUS_CLOSED_CHAT && $chat->time > time()-1800))) { - $errors = array(); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_print',array('chat' => & $chat, 'errors' => & $errors)); + $errors = []; + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_print', ['chat' => & $chat, 'errors' => & $errors]); if(empty($errors)) { erLhcoreClassChat::setTimeZoneByChat($chat); @@ -30,5 +30,3 @@ $Result['content'] = $tpl->fetch(); $Result['pagelayout'] = 'print'; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhchat/start.php b/lhc_web/modules/lhchat/start.php index 491461a163..5f9ef622e6 100644 --- a/lhc_web/modules/lhchat/start.php +++ b/lhc_web/modules/lhchat/start.php @@ -21,7 +21,7 @@ if (is_array($dep) && !empty($dep) && count($dep) == 1) { $dep_id = $dep[0]; - $startDataDepartment = erLhcoreClassModelChatStartSettings::findOne(array('customfilter' => array("((`dep_ids` != '' AND JSON_CONTAINS(`dep_ids`,'" . (int)$dep_id . "','$')) OR department_id = " . (int)$dep_id . ")" ))); + $startDataDepartment = erLhcoreClassModelChatStartSettings::findOne(['customfilter' => ["((`dep_ids` != '' AND JSON_CONTAINS(`dep_ids`,'" . (int)$dep_id . "','$')) OR department_id = " . (int)$dep_id . ")" ]]); if ($startDataDepartment instanceof erLhcoreClassModelChatStartSettings) { $startDataFields = $startDataDepartment->data_array; } @@ -77,7 +77,7 @@ } setcookie("lhc_vid", $vid, time()+60*60*24*365, '/', '', erLhcoreClassSystem::$httpsMode, true); - $userInstance = erLhcoreClassModelChatOnlineUser::handleRequest(array('tag' => isset($_GET['tag']) ? $_GET['tag'] : false, 'uactiv' => 1, 'wopen' => 0, 'tpl' => & $tpl, 'tz' => (isset($_GET['tz']) ? $_GET['tz'] : null), 'message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'department' =>( is_array($Params['user_parameters_unordered']['department']) ? $Params['user_parameters_unordered']['department'] : array()), 'identifier' => (isset($_GET['idnt']) ? (string)$_GET['idnt'] : ''), 'pages_count' => true, 'vid' => $vid, 'check_message_operator' => false, 'pro_active_limitation' => erLhcoreClassModelChatConfig::fetch('pro_active_limitation')->current_value, 'pro_active_invite' => false)); + $userInstance = erLhcoreClassModelChatOnlineUser::handleRequest(['tag' => isset($_GET['tag']) ? $_GET['tag'] : false, 'uactiv' => 1, 'wopen' => 0, 'tpl' => & $tpl, 'tz' => (isset($_GET['tz']) ? $_GET['tz'] : null), 'message_seen_timeout' => erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, 'department' =>( is_array($Params['user_parameters_unordered']['department']) ? $Params['user_parameters_unordered']['department'] : []), 'identifier' => (isset($_GET['idnt']) ? (string)$_GET['idnt'] : ''), 'pages_count' => true, 'vid' => $vid, 'check_message_operator' => false, 'pro_active_limitation' => erLhcoreClassModelChatConfig::fetch('pro_active_limitation')->current_value, 'pro_active_invite' => false]); } elseif (!empty($vid)) { $userInstance = erLhcoreClassModelChatOnlineUser::fetchByVid($vid); } @@ -153,14 +153,14 @@ } } -$online = erLhcoreClassChat::isOnline($dep, false, array( +$online = erLhcoreClassChat::isOnline($dep, false, [ 'online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout'], 'ignore_user_status' => (int)erLhcoreClassModelChatConfig::fetch('ignore_user_status')->current_value -)); +]); $leaveamessage = $Params['user_parameters_unordered']['leaveamessage'] === 'true' || (isset($startDataFields['force_leave_a_message']) && $startDataFields['force_leave_a_message'] == true); $tpl->set('leaveamessage',$leaveamessage); -$tpl->set('department',is_array($Params['user_parameters_unordered']['department']) ? $parametersDepartment['argument'] : array()); +$tpl->set('department',is_array($Params['user_parameters_unordered']['department']) ? $parametersDepartment['argument'] : []); $tpl->set('id',$Params['user_parameters_unordered']['id'] > 0 ? (int)$Params['user_parameters_unordered']['id'] : null); $tpl->set('hash',$Params['user_parameters_unordered']['hash'] != '' ? $Params['user_parameters_unordered']['hash'] : null); $detect = new Mobile_Detect; @@ -188,10 +188,10 @@ } $ts = time(); -$tpl->set('captcha',array( +$tpl->set('captcha',[ 'hash' => sha1(erLhcoreClassIPDetect::getIP() . $ts . erConfigClassLhConfig::getInstance()->getSetting( 'site', 'secrethash' )), 'ts' => $ts -)); +]); $referrer = erLhcoreClassModelChatOnlineUser::getReferer(); @@ -206,33 +206,33 @@ // Prefill by get if (isset($_GET['prefill']) && is_array($_GET['prefill']) && !empty($_GET['prefill'])) { - $prefillOptions = array(); + $prefillOptions = []; foreach ($_GET['prefill'] as $field => $value) { if ($field == 'email') { - $prefillOptions[] = array('Email' => $value); + $prefillOptions[] = ['Email' => $value]; } else if ($field == 'username') { - $prefillOptions[] = array('Username' => $value); + $prefillOptions[] = ['Username' => $value]; }else if ($field == 'phone') { - $prefillOptions[] = array('Phone' => $value); + $prefillOptions[] = ['Phone' => $value]; } else if ($field == 'question') { - $prefillOptions[] = array('Question' => $value); + $prefillOptions[] = ['Question' => $value]; } } $tpl->set('prefill',$prefillOptions); } if (isset($_GET['value_items_admin']) && is_array($_GET['value_items_admin']) && !empty($_GET['value_items_admin'])) { - $options = array(); + $options = []; foreach ($_GET['value_items_admin'] as $field => $value) { - $options[] = array('index' => $field, 'value' => $value); + $options[] = ['index' => $field, 'value' => $value]; } $tpl->set('prefill_admin',$options); } if (isset($_GET['name']) && is_array($_GET['name']) && !empty($_GET['name'])) { - $attributes = array(); + $attributes = []; foreach ($_GET['name'] as $index => $value) { - $attributes[] = array( + $attributes[] = [ 'show' => (((isset($_GET['sh'][$index]) && ($_GET['sh'][$index] == 'on' || $_GET['sh'][$index] == 'off')) ? $_GET['sh'][$index] : 'b')), 'value' => $_GET['value'][$index], 'index' => $index, @@ -245,7 +245,7 @@ 'encrypted' => (isset($_GET['encattr'][$index]) && $_GET['encattr'][$index] === 't'), 'required' => (isset($_GET['req'][$index]) && $_GET['req'][$index] === 't'), 'label' => $value, - ); + ]; } $tpl->set('custom_fields',$attributes); @@ -294,6 +294,3 @@ if (isset($pagelayoutOverride)) { $Result['pagelayout'] = $pagelayoutOverride; } - - -?> diff --git a/lhc_web/modules/lhchatarchive/list.php b/lhc_web/modules/lhchatarchive/list.php index c1186e03f8..77fb6b3663 100644 --- a/lhc_web/modules/lhchatarchive/list.php +++ b/lhc_web/modules/lhchatarchive/list.php @@ -4,13 +4,13 @@ $pages = new lhPaginator(); $pages->serverURL = erLhcoreClassDesign::baseurl('chatarchive/list'); -$pages->items_total = erLhcoreClassChat::getCount(array(),'lh_chat_archive_range','count(id)'); +$pages->items_total = erLhcoreClassChat::getCount([],'lh_chat_archive_range','count(id)'); $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassChat::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC'),'erLhcoreClassModelChatArchiveRange','lh_chat_archive_range'); + $items = erLhcoreClassChat::getList(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC'],'erLhcoreClassModelChatArchiveRange','lh_chat_archive_range'); } $tpl->set('items',$items); @@ -18,9 +18,8 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','System configuration')), - array('url' => erLhcoreClassDesign::baseurl('chatarchive/archive'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/archive','Chat archive'))); -$Result['path'][] = array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/list','Archives list')); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('chatarchive/archive'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/archive', 'Chat archive')] +]; +$Result['path'][] = ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/list', 'Archives list')]; diff --git a/lhc_web/modules/lhchatarchive/module.php b/lhc_web/modules/lhchatarchive/module.php index 54b808f0bc..0e397bc0a0 100644 --- a/lhc_web/modules/lhchatarchive/module.php +++ b/lhc_web/modules/lhchatarchive/module.php @@ -1,83 +1,70 @@ "Chat archive module"); - -$ViewList = array(); - -$ViewList['archive'] = array( - 'params' => array(), - 'functions' => array( 'archive' ) -); - -$ViewList['newarchive'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['configuration'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['startarchive'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['archivechats'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['list'] = array( - 'params' => array(), - 'functions' => array( 'archive' ) -); - -$ViewList['listarchivechats'] = array( - 'params' => array('id'), - 'uparams' => array('chat_duration_from','chat_duration_till','wait_time_from','wait_time_till','chat_id','nick','email','timefrom','timeto','department_id','user_id','print','xls','fbst','chat_status','hum','product_id','timefrom','timefrom_minutes','timefrom_hours','timeto','timeto_minutes','timeto_hours'), - 'functions' => array( 'archive' ) -); - -$ViewList['edit'] = array( - 'params' => array('id'), - 'functions' => array( 'configuration' ) -); - -$ViewList['viewarchivedchat'] = array( - 'params' => array('archive_id','chat_id'), - 'uparams' => array('mode'), - 'functions' => array( 'archive' ) -); - -$ViewList['previewchat'] = array( - 'params' => array('archive_id','chat_id'), - 'functions' => array( 'archive' ) -); - -$ViewList['printchatadmin'] = array( - 'params' => array('archive_id','chat_id'), - 'functions' => array( 'archive' ) -); - -$ViewList['sendmail'] = array( - 'params' => array('archive_id','chat_id'), - 'functions' => array( 'archive' ) -); - -$ViewList['deletearchivechat'] = array( - 'params' => array('archive_id','chat_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'configuration' ) -); - -$ViewList['process'] = array( - 'params' => array('id'), - 'functions' => array( 'configuration' ) -); - -$FunctionList['archive'] = array('explain' => 'Allow user to use archive functionality'); -$FunctionList['configuration'] = array('explain' => 'Allow user to configure archive'); - -?> \ No newline at end of file +$Module = ['name' => 'Chat archive module']; + +$ViewList = [ + 'archive' => [ + 'params' => [], + 'functions' => ['archive'], + ], + 'newarchive' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'configuration' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'startarchive' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'archivechats' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'list' => [ + 'params' => [], + 'functions' => ['archive'], + ], + 'listarchivechats' => [ + 'params' => ['id'], + 'uparams' => ['chat_duration_from', 'chat_duration_till', 'wait_time_from', 'wait_time_till', 'chat_id', 'nick', 'email', 'timefrom', 'timeto', 'department_id', 'user_id', 'print', 'xls', 'fbst', 'chat_status', 'hum', 'product_id', 'timefrom', 'timefrom_minutes', 'timefrom_hours', 'timeto', 'timeto_minutes', 'timeto_hours'], + 'functions' => ['archive'], + ], + 'edit' => [ + 'params' => ['id'], + 'functions' => ['configuration'], + ], + 'viewarchivedchat' => [ + 'params' => ['archive_id', 'chat_id'], + 'uparams' => ['mode'], + 'functions' => ['archive'], + ], + 'previewchat' => [ + 'params' => ['archive_id', 'chat_id'], + 'functions' => ['archive'], + ], + 'printchatadmin' => [ + 'params' => ['archive_id', 'chat_id'], + 'functions' => ['archive'], + ], + 'sendmail' => [ + 'params' => ['archive_id', 'chat_id'], + 'functions' => ['archive'], + ], + 'deletearchivechat' => [ + 'params' => ['archive_id', 'chat_id'], + 'uparams' => ['csfr'], + 'functions' => ['configuration'], + ], + 'process' => [ + 'params' => ['id'], + 'functions' => ['configuration'], + ], +]; + +$FunctionList = [ + 'archive' => ['explain' => 'Allow user to use archive functionality'], + 'configuration' => ['explain' => 'Allow user to configure archive'], +]; diff --git a/lhc_web/modules/lhchatarchive/newarchive.php b/lhc_web/modules/lhchatarchive/newarchive.php index 8338fb49dd..da72be34bf 100644 --- a/lhc_web/modules/lhchatarchive/newarchive.php +++ b/lhc_web/modules/lhchatarchive/newarchive.php @@ -11,17 +11,17 @@ if (isset($_POST['Save_archive'])) { - $definition = array( + $definition = [ 'RangeFrom' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), 'RangeTo' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( !$form->hasValidData( 'RangeFrom' ) || $form->RangeFrom == '' ) { @@ -65,9 +65,8 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','System configuration')), - array('url' => erLhcoreClassDesign::baseurl('chatarchive/archive'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/archive','Chat archive'))); -$Result['path'][] = array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/newarchive','New archive')); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('chatarchive/archive'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/archive', 'Chat archive')] +]; +$Result['path'][] = ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/newarchive', 'New archive')]; diff --git a/lhc_web/modules/lhchatarchive/startarchive.php b/lhc_web/modules/lhchatarchive/startarchive.php index 9b29d4544c..82f43ad0ed 100644 --- a/lhc_web/modules/lhchatarchive/startarchive.php +++ b/lhc_web/modules/lhchatarchive/startarchive.php @@ -1,23 +1,23 @@ validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) { - echo json_encode(array('error' => 'true', 'result' => 'Invalid CSFR Token' )); + echo json_encode(['error' => 'true', 'result' => 'Invalid CSFR Token']); exit; } $archive = new erLhcoreClassModelChatArchiveRange(); -$definition = array( +$definition = [ 'RangeFrom' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), 'RangeTo' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ) -); +]; $form = new ezcInputForm( INPUT_POST, $definition ); -$Errors = array(); +$Errors = []; if ( !$form->hasValidData( 'RangeFrom' ) || $form->RangeFrom == '' ) { @@ -46,12 +46,10 @@ if (count($Errors) == 0) { try { - echo json_encode(array('error' => 'false','id' => $archive->createArchive())); + echo json_encode(['error' => 'false','id' => $archive->createArchive()]); } catch (Exception $e) { - echo json_encode(array('error' => 'true','msg' => $e->getMessage())); + echo json_encode(['error' => 'true','msg' => $e->getMessage()]); } } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhchatbox/list.php b/lhc_web/modules/lhchatbox/list.php index 4c52288432..eee8c0b52a 100644 --- a/lhc_web/modules/lhchatbox/list.php +++ b/lhc_web/modules/lhchatbox/list.php @@ -1,8 +1,8 @@ dispatch('chatbox.list', array()); +$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chatbox.list', []); -$tpl = erLhcoreClassTemplate::getInstance( 'lhchatbox/list.tpl.php'); +$tpl = erLhcoreClassTemplate::getInstance('lhchatbox/list.tpl.php'); $pages = new lhPaginator(); $pages->items_total = erLhcoreClassChatbox::getCount(); @@ -12,8 +12,7 @@ $tpl->set('pages',$pages); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' =>erLhcoreClassDesign::baseurl('chatbox/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatbox/configuration','Chatbox')), -array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatbox/list','Chatbox list'))); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('chatbox/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatbox/configuration', 'Chatbox')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatbox/list', 'Chatbox list')] +]; diff --git a/lhc_web/modules/lhchatbox/module.php b/lhc_web/modules/lhchatbox/module.php index c18c2d812d..ae036e39e0 100644 --- a/lhc_web/modules/lhchatbox/module.php +++ b/lhc_web/modules/lhchatbox/module.php @@ -1,110 +1,82 @@ "Chatbox"); - -$ViewList = array(); - -$ViewList['list'] = array( - 'script' => 'list.php', - 'params' => array(), - 'functions' => array( 'manage_chatbox' ) -); - -$ViewList['delete'] = array( - 'script' => 'delete.php', - 'params' => array('id'), - 'functions' => array( 'manage_chatbox' ) -); - -$ViewList['syncuser'] = array( - 'script' => 'syncuser.php', - 'params' => array('chat_id','message_id','hash'), - 'uparams' => array('mode','ot') -); - -$ViewList['addmsguser'] = array( - 'script' => 'addmsguser.php', - 'params' => array('chat_id','hash'), - 'uparams' => array('mode','render'), -); - -$ViewList['view'] = array( - 'script' => 'view.php', - 'params' => array('id'), - 'functions' => array( 'manage_chatbox' ) -); - -$ViewList['new'] = array( - 'script' => 'new.php', - 'params' => array('id'), - 'functions' => array( 'manage_chatbox' ) -); - -$ViewList['chatwidget'] = array( - 'script' => 'chatwidget.php', - 'params' => array(), - 'uparams' => array('theme','sound','mode','identifier','chat_height','hashchatbox'), -); - -$ViewList['getstatus'] = array( - 'script' => 'getstatus.php', - 'params' => array(), - 'functions' => array(), - 'uparams' => array('theme','noresponse','position','top','units','width','height','chat_height','sc','scm','dmn') -); - -$ViewList['embed'] = array( - 'script' => 'embed.php', - 'params' => array(), - 'uparams' => array('theme','chat_height'), - 'functions' => array() -); - -$ViewList['embedcode'] = array( - 'script' => 'embedcode.php', - 'params' => array(), - 'functions' => array('manage_chatbox') -); - -$ViewList['edit'] = array( - 'script' => 'edit.php', - 'params' => array('id'), - 'functions' => array('manage_chatbox') -); - -$ViewList['delete'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array('manage_chatbox') -); - -$ViewList['generalsettings'] = array( - 'params' => array('id'), - 'functions' => array('manage_chatbox') -); - -$ViewList['new'] = array( - 'params' => array('id'), - 'functions' => array('manage_chatbox') -); - -$ViewList['htmlcode'] = array( - 'script' => 'htmlcode.php', - 'params' => array(), - 'functions' => array( 'manage_chatbox' ) -); - -$ViewList['chatwidgetclosed'] = array( - 'script' => 'chatwidgetclosed.php', - 'params' => array() -); - -$ViewList['configuration'] = array( - 'script' => 'configuration.php', - 'params' => array() -); - -$FunctionList = array(); -$FunctionList['manage_chatbox'] = array('explain' => 'Allow user to manage Chatbox module'); - -?> \ No newline at end of file +$Module = ['name' => 'Chatbox']; + +$ViewList = [ + 'list' => [ + 'script' => 'list.php', + 'params' => [], + 'functions' => ['manage_chatbox'], + ], + 'syncuser' => [ + 'script' => 'syncuser.php', + 'params' => ['chat_id', 'message_id', 'hash'], + 'uparams' => ['mode', 'ot'], + ], + 'addmsguser' => [ + 'script' => 'addmsguser.php', + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode', 'render'], + ], + 'view' => [ + 'script' => 'view.php', + 'params' => ['id'], + 'functions' => ['manage_chatbox'], + ], + 'chatwidget' => [ + 'script' => 'chatwidget.php', + 'params' => [], + 'uparams' => ['theme', 'sound', 'mode', 'identifier', 'chat_height', 'hashchatbox'], + ], + 'getstatus' => [ + 'script' => 'getstatus.php', + 'params' => [], + 'functions' => [], + 'uparams' => ['theme', 'noresponse', 'position', 'top', 'units', 'width', 'height', 'chat_height', 'sc', 'scm', 'dmn'], + ], + 'embed' => [ + 'script' => 'embed.php', + 'params' => [], + 'uparams' => ['theme', 'chat_height'], + 'functions' => [], + ], + 'embedcode' => [ + 'script' => 'embedcode.php', + 'params' => [], + 'functions' => ['manage_chatbox'], + ], + 'edit' => [ + 'params' => ['id'], + 'functions' => ['manage_chatbox'], + ], + 'delete' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage_chatbox'], + ], + 'generalsettings' => [ + 'params' => ['id'], + 'functions' => ['manage_chatbox'], + ], + 'new' => [ + 'params' => ['id'], + 'functions' => ['manage_chatbox'], + ], + 'htmlcode' => [ + 'script' => 'htmlcode.php', + 'params' => [], + 'functions' => ['manage_chatbox'], + ], + 'chatwidgetclosed' => [ + 'script' => 'chatwidgetclosed.php', + 'params' => [], + ], + 'configuration' => [ + 'script' => 'configuration.php', + 'params' => [], + ], +]; + +$FunctionList = [ + 'manage_chatbox' => ['explain' => 'Allow user to manage Chatbox module'], +]; diff --git a/lhc_web/modules/lhchatcommand/command.php b/lhc_web/modules/lhchatcommand/command.php index aca99df559..bcbc01a1ca 100644 --- a/lhc_web/modules/lhchatcommand/command.php +++ b/lhc_web/modules/lhchatcommand/command.php @@ -12,14 +12,14 @@ if ( ezcInputForm::hasPostData() ) { - $validationFields = array(); + $validationFields = []; foreach ($command->fields_array as $fieldIndex => $field) { $validationFields['field_' . $fieldIndex] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'); } $form = new ezcInputForm(INPUT_POST, $validationFields); - $Errors = array(); + $Errors = []; $commandArguments = []; @@ -54,5 +54,3 @@ } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhchatcommand/module.php b/lhc_web/modules/lhchatcommand/module.php index b639b5e0ee..0e220444a1 100644 --- a/lhc_web/modules/lhchatcommand/module.php +++ b/lhc_web/modules/lhchatcommand/module.php @@ -1,16 +1,15 @@ "Chat commands", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['command'] = array( - 'params' => array('chat_id','command_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$FunctionList['use'] = array('explain' => 'Allow operator to use chat commands defined in bot commands section'); - -?> \ No newline at end of file +$Module = ['name' => 'Chat commands', 'variable_params' => true]; + +$ViewList = [ + 'command' => [ + 'params' => ['chat_id', 'command_id'], + 'uparams' => [], + 'functions' => ['use'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow operator to use chat commands defined in bot commands section'], +]; diff --git a/lhc_web/modules/lhchatsettings/eventlist.php b/lhc_web/modules/lhchatsettings/eventlist.php index 633cbcae53..59c1eca83f 100644 --- a/lhc_web/modules/lhchatsettings/eventlist.php +++ b/lhc_web/modules/lhchatsettings/eventlist.php @@ -3,21 +3,21 @@ $tpl = erLhcoreClassTemplate::getInstance('lhchatsettings/eventlist.tpl.php'); if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array( + $filterParams = erLhcoreClassSearchHandler::getParams([ 'module' => 'chat', 'module_file' => 'event_list', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'] - )); + ]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array( + $filterParams = erLhcoreClassSearchHandler::getParams([ 'module' => 'chat', 'module_file' => 'event_list', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered'] - )); + ]); $filterParams['is_search'] = false; } @@ -27,13 +27,13 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelChatEventTrack::getList(array_merge($filterParams['filter'], array( + $items = erLhcoreClassModelChatEventTrack::getList(array_merge($filterParams['filter'], [ 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC' - ))); + ])); } $tpl->set('items', $items); @@ -44,17 +44,16 @@ $tpl->set('input', $filterParams['input_form']); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array( +$Result['path'] = [ + [ 'url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration') - ), - array( + ], + [ 'url' => erLhcoreClassDesign::baseurl('chatsettings/eventindex'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/etracking', 'Events tracking') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/etracking', 'Events tracking by department') - ) -); -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhchatsettings/module.php b/lhc_web/modules/lhchatsettings/module.php index c8526d4874..c5de5434bc 100644 --- a/lhc_web/modules/lhchatsettings/module.php +++ b/lhc_web/modules/lhchatsettings/module.php @@ -1,79 +1,66 @@ "Chat settings", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['startsettingslist'] = array( - 'params' => array(), - 'functions' => array( 'administrate' ) -); - -$ViewList['newstartsettings'] = array( - 'params' => array(), - 'functions' => array( 'administrate' ) -); - -$ViewList['copyfrom'] = array( - 'params' => array('from'), - 'uparams' => array('csfr'), - 'functions' => array( 'administrate' ) -); - -$ViewList['editstartsettings'] = array( - 'params' => array('id'), - 'functions' => array( 'administrate' ) -); - -$ViewList['deletestartsettings'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'administrate' ) -); - -$ViewList['startchatformsettings'] = array( - 'params' => array(), - 'functions' => array( 'administrate' ) -); - -$ViewList['startchatformsettingsindex'] = array( - 'params' => array(), - 'functions' => array( 'administrate' ) -); - -$ViewList['testencryption'] = array( - 'params' => array(), - 'functions' => array( 'administrate' ) -); - -$ViewList['editeventsettings'] = array( - 'params' => array('id'), - 'functions' => array( 'events' ) -); - -$ViewList['eventlist'] = array( - 'params' => array(), - 'functions' => array( 'events' ) -); - -$ViewList['neweventsettings'] = array( - 'params' => array(), - 'functions' => array( 'events' ) -); - -$ViewList['eventindex'] = array( - 'params' => array(), - 'functions' => array( 'events' ) -); - -$ViewList['deleteevent'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'administrate' ) -); - -$FunctionList['administrate'] = array('explain' => 'Allow to configure chat start form'); -$FunctionList['events'] = array('explain' => 'Allow to configure events tracking'); - -?> \ No newline at end of file +$Module = ['name' => 'Chat settings', 'variable_params' => true]; + +$ViewList = [ + 'startsettingslist' => [ + 'params' => [], + 'functions' => ['administrate'], + ], + 'newstartsettings' => [ + 'params' => [], + 'functions' => ['administrate'], + ], + 'copyfrom' => [ + 'params' => ['from'], + 'uparams' => ['csfr'], + 'functions' => ['administrate'], + ], + 'editstartsettings' => [ + 'params' => ['id'], + 'functions' => ['administrate'], + ], + 'deletestartsettings' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['administrate'], + ], + 'startchatformsettings' => [ + 'params' => [], + 'functions' => ['administrate'], + ], + 'startchatformsettingsindex' => [ + 'params' => [], + 'functions' => ['administrate'], + ], + 'testencryption' => [ + 'params' => [], + 'functions' => ['administrate'], + ], + 'editeventsettings' => [ + 'params' => ['id'], + 'functions' => ['events'], + ], + 'eventlist' => [ + 'params' => [], + 'functions' => ['events'], + ], + 'neweventsettings' => [ + 'params' => [], + 'functions' => ['events'], + ], + 'eventindex' => [ + 'params' => [], + 'functions' => ['events'], + ], + 'deleteevent' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['administrate'], + ], +]; + +$FunctionList = [ + 'administrate' => ['explain' => 'Allow to configure chat start form'], + 'events' => ['explain' => 'Allow to configure events tracking'], +]; diff --git a/lhc_web/modules/lhchatsettings/startsettingslist.php b/lhc_web/modules/lhchatsettings/startsettingslist.php index 07805eb972..358876ecad 100644 --- a/lhc_web/modules/lhchatsettings/startsettingslist.php +++ b/lhc_web/modules/lhchatsettings/startsettingslist.php @@ -3,21 +3,21 @@ $tpl = erLhcoreClassTemplate::getInstance('lhchatsettings/startsettingslist.tpl.php'); if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array( + $filterParams = erLhcoreClassSearchHandler::getParams([ 'module' => 'chat', 'module_file' => 'start_list', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'] - )); + ]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array( + $filterParams = erLhcoreClassSearchHandler::getParams([ 'module' => 'chat', 'module_file' => 'start_list', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered'] - )); + ]); $filterParams['is_search'] = false; } @@ -27,13 +27,13 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelChatStartSettings::getList(array_merge($filterParams['filter'], array( + $items = erLhcoreClassModelChatStartSettings::getList(array_merge($filterParams['filter'], [ 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC' - ))); + ])); } $tpl->set('items', $items); @@ -44,17 +44,16 @@ $tpl->set('input', $filterParams['input_form']); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array( +$Result['path'] = [ + [ 'url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration') - ), - array( + ], + [ 'url' => erLhcoreClassDesign::baseurl('chatsettings/startchatformsettingsindex'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('lhchatsettings/startchat', 'Start chat form settings') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('lhchatsettings/startchat', 'Start chat settings list') - ) -); -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhcobrowse/module.php b/lhc_web/modules/lhcobrowse/module.php index e6afb5d841..8880904f49 100644 --- a/lhc_web/modules/lhcobrowse/module.php +++ b/lhc_web/modules/lhcobrowse/module.php @@ -1,50 +1,43 @@ - "CO Browse module"); - -$ViewList = array(); - -$ViewList['browse'] = array( - 'params' => array('chat_id'), - 'functions' => array('browse'), - 'uparams' => array() -); - -$ViewList['mirror'] = array( - 'params' => array(), - 'functions' => array('browse'), - 'uparams' => array() -); - -$ViewList['checkmirrorchanges'] = array( - 'params' => array('chat_id'), - 'functions' => array('browse'), - 'uparams' => array('cobrowsemode') -); - -$ViewList['checkinitializer'] = array( - 'params' => array('chat_id'), - 'functions' => array('browse'), - 'uparams' => array() -); - -$ViewList['storenodemap'] = array( - 'params' => array(), - 'uparams' => array('vid','hash','hash_resume','sharemode') -); - -$ViewList['finishsession'] = array( - 'params' => array(), - 'uparams' => array('vid','hash','hash_resume','sharemode') -); - -$ViewList['proxycss'] = array( - 'params' => array('chat_id'), - 'functions' => array('browse'), - 'uparams' => array('cobrowsemode') -); - -$FunctionList = array(); -$FunctionList['browse'] = array('explain' => 'Allow operator to use co-browse functionality'); - -?> + 'CO Browse module']; + +$ViewList = [ + 'browse' => [ + 'params' => ['chat_id'], + 'functions' => ['browse'], + 'uparams' => [], + ], + 'mirror' => [ + 'params' => [], + 'functions' => ['browse'], + 'uparams' => [], + ], + 'checkmirrorchanges' => [ + 'params' => ['chat_id'], + 'functions' => ['browse'], + 'uparams' => ['cobrowsemode'], + ], + 'checkinitializer' => [ + 'params' => ['chat_id'], + 'functions' => ['browse'], + 'uparams' => [], + ], + 'storenodemap' => [ + 'params' => [], + 'uparams' => ['vid', 'hash', 'hash_resume', 'sharemode'], + ], + 'finishsession' => [ + 'params' => [], + 'uparams' => ['vid', 'hash', 'hash_resume', 'sharemode'], + ], + 'proxycss' => [ + 'params' => ['chat_id'], + 'functions' => ['browse'], + 'uparams' => ['cobrowsemode'], + ], +]; + +$FunctionList = [ + 'browse' => ['explain' => 'Allow operator to use co-browse functionality'], +]; diff --git a/lhc_web/modules/lhdepartment/group.php b/lhc_web/modules/lhdepartment/group.php index 55cef5dec6..ac7c952277 100644 --- a/lhc_web/modules/lhdepartment/group.php +++ b/lhc_web/modules/lhdepartment/group.php @@ -2,7 +2,7 @@ $tpl = erLhcoreClassTemplate::getInstance( 'lhdepartment/group.tpl.php'); -$departmentParams = array(); +$departmentParams = []; $pages = new lhPaginator(); $pages->serverURL = erLhcoreClassDesign::baseurl('department/group'); @@ -10,19 +10,17 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelDepartamentGroup::getList(array_merge($departmentParams,array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'))); + $items = erLhcoreClassModelDepartamentGroup::getList(array_merge($departmentParams, ['offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'])); } $tpl->set('items',$items); $tpl->set('pages',$pages); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','System configuration')), -array('url' => erLhcoreClassDesign::baseurl('department/index'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','Departments')), -array('url' => erLhcoreClassDesign::baseurl('department/departments'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','Departments groups')) -) - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('department/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments')], + ['url' => erLhcoreClassDesign::baseurl('department/departments'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments groups')] +]; diff --git a/lhc_web/modules/lhdepartment/module.php b/lhc_web/modules/lhdepartment/module.php index 105f87132e..4f74fb79c1 100644 --- a/lhc_web/modules/lhdepartment/module.php +++ b/lhc_web/modules/lhdepartment/module.php @@ -1,114 +1,97 @@ "Departments configuration"); - -$ViewList = array(); - -$ViewList['departments'] = array( - 'params' => array(), - 'uparams' => array('visible_if_online','hidden','disabled','name','export','alias','identifier','empty_alias','empty_identifier'), - 'functions' => array( 'list' ) - ); - -$ViewList['new'] = array( - 'params' => array(), - 'functions' => array( 'create' ) -); - -$ViewList['edit'] = array( - 'params' => array('departament_id'), - 'uparams' => array('action'), - 'functions' => array( 'edit' ) -); - -$ViewList['clone'] = array( - 'params' => array('departament_id'), - 'functions' => array( 'edit' ), - 'uparams' => array('csfr'), -); - -$ViewList['index'] = array( - 'params' => array(), - 'functions' => array( 'list' ) -); - -$ViewList['brands'] = array( - 'params' => array(), - 'functions' => array( 'managebrands' ) -); - -$ViewList['newbrand'] = array( - 'params' => array(), - 'functions' => array( 'managebrands' ) -); - -$ViewList['editbrand'] = array( - 'params' => array('id'), - 'functions' => array( 'managebrands' ) -); - -$ViewList['group'] = array( - 'params' => array(), - 'functions' => array( 'managegroups' ) -); - -$ViewList['limitgroup'] = array( - 'params' => array(), - 'functions' => array( 'managegroups' ) -); - -$ViewList['newgroup'] = array( - 'params' => array(), - 'functions' => array( 'managegroups' ) -); - -$ViewList['newlimitgroup'] = array( - 'params' => array(), - 'functions' => array( 'managegroups' ) -); - -$ViewList['editlimitgroup'] = array( - 'params' => array('id'), - 'functions' => array( 'managegroups' ) -); - -$ViewList['editgroup'] = array( - 'params' => array('id'), - 'uparams' => array('action'), - 'functions' => array( 'managegroups' ) -); - -$ViewList['deletegroup'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'managegroups' ) -); - -$ViewList['deletebrand'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'managebrands' ) -); - -$ViewList['deletelimitgroup'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'managegroups' ) -); - -$FunctionList['list'] = array('explain' => 'Access to list departments'); -$FunctionList['create'] = array('explain' => 'Permission to create a new department'); -$FunctionList['edit'] = array('explain' => 'Permission to edit department'); -$FunctionList['delete'] = array('explain' => 'Permission to delete department'); -$FunctionList['see_all'] = array('explain' => 'Allow user to see all departments. Even if they do not have permission to see chats.'); -$FunctionList['actworkflow'] = array('explain' => 'Allow user to change transfer workflow'); -$FunctionList['actautoassignment'] = array('explain' => 'Allow user to change auto assignment'); -$FunctionList['manageall'] = array('explain' => 'Allow user to manage all departments, not only assigned to him'); -$FunctionList['managegroups'] = array('explain' => 'Allow user to manage all department groups, not only assigned to him'); -$FunctionList['managesurvey'] = array('explain' => 'Allow operator to change department surveys'); -$FunctionList['managealias'] = array('explain' => 'Allow operator to change department alias'); -$FunctionList['managedesign'] = array('explain' => 'Allow operator to change design section'); -$FunctionList['managebrands'] = array('explain' => 'Allow operator to manage brands'); - - -?> \ No newline at end of file +$Module = ['name' => 'Departments configuration']; + +$ViewList = [ + 'departments' => [ + 'params' => [], + 'uparams' => ['visible_if_online', 'hidden', 'disabled', 'name', 'export', 'alias', 'identifier', 'empty_alias', 'empty_identifier'], + 'functions' => ['list'], + ], + 'new' => [ + 'params' => [], + 'functions' => ['create'], + ], + 'edit' => [ + 'params' => ['departament_id'], + 'uparams' => ['action'], + 'functions' => ['edit'], + ], + 'clone' => [ + 'params' => ['departament_id'], + 'functions' => ['edit'], + 'uparams' => ['csfr'], + ], + 'index' => [ + 'params' => [], + 'functions' => ['list'], + ], + 'brands' => [ + 'params' => [], + 'functions' => ['managebrands'], + ], + 'newbrand' => [ + 'params' => [], + 'functions' => ['managebrands'], + ], + 'editbrand' => [ + 'params' => ['id'], + 'functions' => ['managebrands'], + ], + 'group' => [ + 'params' => [], + 'functions' => ['managegroups'], + ], + 'limitgroup' => [ + 'params' => [], + 'functions' => ['managegroups'], + ], + 'newgroup' => [ + 'params' => [], + 'functions' => ['managegroups'], + ], + 'newlimitgroup' => [ + 'params' => [], + 'functions' => ['managegroups'], + ], + 'editlimitgroup' => [ + 'params' => ['id'], + 'functions' => ['managegroups'], + ], + 'editgroup' => [ + 'params' => ['id'], + 'uparams' => ['action'], + 'functions' => ['managegroups'], + ], + 'deletegroup' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['managegroups'], + ], + 'deletebrand' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['managebrands'], + ], + 'deletelimitgroup' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['managegroups'], + ], +]; + +$FunctionList = [ + 'list' => ['explain' => 'Access to list departments'], + 'create' => ['explain' => 'Permission to create a new department'], + 'edit' => ['explain' => 'Permission to edit department'], + 'delete' => ['explain' => 'Permission to delete department'], + 'see_all' => ['explain' => 'Allow user to see all departments. Even if they do not have permission to see chats.'], + 'actworkflow' => ['explain' => 'Allow user to change transfer workflow'], + 'actautoassignment' => ['explain' => 'Allow user to change auto assignment'], + 'manageall' => ['explain' => 'Allow user to manage all departments, not only assigned to him'], + 'managegroups' => ['explain' => 'Allow user to manage all department groups, not only assigned to him'], + 'managesurvey' => ['explain' => 'Allow operator to change department surveys'], + 'managealias' => ['explain' => 'Allow operator to change department alias'], + 'managedesign' => ['explain' => 'Allow operator to change design section'], + 'managebrands' => ['explain' => 'Allow operator to manage brands'], +]; diff --git a/lhc_web/modules/lhdepartment/new.php b/lhc_web/modules/lhdepartment/new.php index 3910ea32a5..0367c143ee 100644 --- a/lhc_web/modules/lhdepartment/new.php +++ b/lhc_web/modules/lhdepartment/new.php @@ -34,7 +34,7 @@ erLhcoreClassDepartament::validateDepartmentProducts($Departament); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('department.modified',array('department' => $Departament)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('department.modified',['department' => $Departament]); erLhcoreClassAdminChatValidatorHelper::clearUsersCache(); @@ -51,17 +51,15 @@ } $tpl->set('departament',$Departament); -$tpl->set('departamentCustomWorkHours', json_encode(array(), JSON_HEX_APOS)); -$tpl->set('limitDepartments',$userDepartments !== true ? array('filterin' => array('id' => $userDepartments)) : array()); +$tpl->set('departamentCustomWorkHours', json_encode([], JSON_HEX_APOS)); +$tpl->set('limitDepartments',$userDepartments !== true ? ['filterin' => ['id' => $userDepartments]] : []); $Result['content'] = $tpl->fetch(); $Result['additional_footer_js'] = ''; -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/new','System configuration')), -array('url' => erLhcoreClassDesign::baseurl('department/index'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','Departments')), -array('url' => erLhcoreClassDesign::baseurl('department/departments'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','Departments list')), -array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/new','New department')), -) - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/new', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('department/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments')], + ['url' => erLhcoreClassDesign::baseurl('department/departments'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments list')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/new', 'New department')], +]; diff --git a/lhc_web/modules/lhexport/getcount.php b/lhc_web/modules/lhexport/getcount.php index 09edfe0438..3d6803cf00 100644 --- a/lhc_web/modules/lhexport/getcount.php +++ b/lhc_web/modules/lhexport/getcount.php @@ -13,7 +13,7 @@ if ( sha1('getcount'.$hashSecret) == $hash ) { - $filter = array(); + $filter = []; if (is_array($Params['user_parameters_unordered']['status'])){ foreach ($Params['user_parameters_unordered']['status'] as $status) { @@ -25,7 +25,7 @@ if ($format =='json') { header('Content-type: application/json'); - echo json_encode(array('count' => $totalChats)); + echo json_encode(['count' => $totalChats]); exit; } else { header('Content-type: text/xml'); @@ -41,7 +41,7 @@ if ($format =='json') { header('Content-type: application/json'); - echo json_encode(array('error' => $e->getMessage())); + echo json_encode(['error' => $e->getMessage()]); exit; } else { header('Content-type: text/xml'); @@ -51,5 +51,3 @@ } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhexport/getlist.php b/lhc_web/modules/lhexport/getlist.php index ee5d2418e1..66a63737db 100644 --- a/lhc_web/modules/lhexport/getlist.php +++ b/lhc_web/modules/lhexport/getlist.php @@ -13,7 +13,7 @@ if ( sha1('getlist'.$hashSecret) == $hash ) { - $filter = array(); + $filter = []; if (is_array($Params['user_parameters_unordered']['status'])){ foreach ($Params['user_parameters_unordered']['status'] as $status) { @@ -28,11 +28,11 @@ $pages->setItemsPerPage(is_numeric($Params['user_parameters_unordered']['limit']) ? (int)$Params['user_parameters_unordered']['limit'] : 100); $pages->paginate(); - $list = erLhcoreClassChat::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id DESC'),$filter)); + $list = erLhcoreClassChat::getList(array_merge(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id DESC'],$filter)); if ($format =='json') { header('Content-type: application/json'); - echo json_encode(array('list' => array_keys($list))); + echo json_encode(['list' => array_keys($list)]); exit; } else { header('Content-type: text/xml'); @@ -52,7 +52,7 @@ if ($format =='json') { header('Content-type: application/json'); - echo json_encode(array('error' => $e->getMessage())); + echo json_encode(['error' => $e->getMessage()]); exit; } else { header('Content-type: text/xml'); @@ -62,5 +62,3 @@ } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhexport/module.php b/lhc_web/modules/lhexport/module.php index 5d567b0a1d..26507eca30 100644 --- a/lhc_web/modules/lhexport/module.php +++ b/lhc_web/modules/lhexport/module.php @@ -1,28 +1,24 @@ - "Chats export module"); - -$ViewList = array(); - -$ViewList['getchat'] = array( - 'params' => array('hash','chat_id'), - 'uparams' => array('format') -); - -$ViewList['getcount'] = array( - 'script' => 'getcount.php', - 'params' => array('hash'), - 'multiple_arguments' => array('status'), - 'uparams' => array('format','status') -); - -$ViewList['getlist'] = array( - 'params' => array('hash'), - 'uparams' => array('limit','format','status'), - 'functions' => array(), - 'multiple_arguments' => array('status') -); - -$FunctionList = array(); - -?> \ No newline at end of file + 'Chats export module']; + +$ViewList = [ + 'getchat' => [ + 'params' => ['hash', 'chat_id'], + 'uparams' => ['format'], + ], + 'getcount' => [ + 'script' => 'getcount.php', + 'params' => ['hash'], + 'multiple_arguments' => ['status'], + 'uparams' => ['format', 'status'], + ], + 'getlist' => [ + 'params' => ['hash'], + 'uparams' => ['limit', 'format', 'status'], + 'functions' => [], + 'multiple_arguments' => ['status'], + ], +]; + +$FunctionList = []; diff --git a/lhc_web/modules/lhfaq/faqwidget.php b/lhc_web/modules/lhfaq/faqwidget.php index f8aa43cedd..ff7bc77f7a 100644 --- a/lhc_web/modules/lhfaq/faqwidget.php +++ b/lhc_web/modules/lhfaq/faqwidget.php @@ -104,7 +104,7 @@ $q = $session->database->createSelectQuery(); $q->select( "COUNT(id)" )->from( "lh_faq" ); -$whereConditions = array(); +$whereConditions = []; $whereConditions[] = $q->expr->eq( 'active', 1 ); $whereConditions[] = $q->expr->lOr( $q->expr->eq( 'url', $q->bindValue('') ), @@ -137,7 +137,7 @@ $dynamic_url_append .= '/(search)/'.rawurlencode($searchString); } -$tpl->set('keyword', str_replace(array('}}','{{'),'',$keywordSearch)); +$tpl->set('keyword', str_replace(['}}','{{'],'',$keywordSearch)); $q->where($whereConditions); @@ -152,11 +152,11 @@ $pages->items_total = $result; $pages->setItemsPerPage(5); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { $q = $session->createFindQuery( 'erLhcoreClassModelFaq' ); - $whereConditions = array(); + $whereConditions = []; $whereConditions[] = $q->expr->eq( 'active', 1 ); $whereConditions[] = $q->expr->lOr( $q->expr->eq( 'url', $q->bindValue('') ), @@ -187,14 +187,14 @@ if ( isset($_POST['send']) ) { - $definition = array( + $definition = [ 'question' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'email' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'url' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw') - ); + ]; if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) { // Start session if required only @@ -209,7 +209,7 @@ $definition[$nameField] = new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ); $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( !$form->hasValidData( 'question' ) || $form->question == '') { $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('faq/faqwidget','Please enter a question!'); @@ -247,7 +247,7 @@ $item_new->url = $dynamic_url; } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.before_filled_by_user', array('faq' => & $item_new, 'errors' => & $Errors)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.before_filled_by_user', ['faq' => & $item_new, 'errors' => & $Errors]); if (count($Errors) == 0) { $item_new->active = 0; @@ -256,7 +256,7 @@ $item_new = new erLhcoreClassFaq(); $tpl->set('success',true); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.filled_by_user', array('faq' => & $item_new)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.filled_by_user', ['faq' => & $item_new]); if (isset($_SESSION[erLhcoreClassIPDetect::getIP()]['form'])) { unset($_SESSION[erLhcoreClassIPDetect::getIP()]['form']); @@ -283,4 +283,3 @@ $Result['dynamic_height_message'] = 'lhc_sizing_faq_embed'; $Result['pagelayout_css_append'] = 'embed-widget embed-fixed'; } - diff --git a/lhc_web/modules/lhfaq/list.php b/lhc_web/modules/lhfaq/list.php index ab25bc8618..81110d8329 100644 --- a/lhc_web/modules/lhfaq/list.php +++ b/lhc_web/modules/lhfaq/list.php @@ -2,7 +2,7 @@ $tpl = erLhcoreClassTemplate::getInstance( 'lhfaq/list.tpl.php'); -$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.list', array('tpl' => & $tpl)); +$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('faq.list', ['tpl' => & $tpl]); $pages = new lhPaginator(); $pages->serverURL = erLhcoreClassDesign::baseurl('faq/list'); @@ -10,15 +10,13 @@ $pages->setItemsPerPage(10); $pages->paginate(); -$items = array(); -if ($pages->items_total > 0) { - $items = erLhcoreClassModelFaq::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id DESC')); -} - -$tpl->set('items',$items); +$items = []; +if ($pages->items_total > 0) { + $items = erLhcoreClassModelFaq::getList(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id DESC']); +} + +$tpl->set('items',$items); $tpl->set('pages',$pages); $Result['content'] = $tpl->fetch(); -$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('faq/list'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('faq/list','FAQ'))); - -?> \ No newline at end of file +$Result['path'] = [['url' => erLhcoreClassDesign::baseurl('faq/list'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('faq/list','FAQ')]]; diff --git a/lhc_web/modules/lhfaq/module.php b/lhc_web/modules/lhfaq/module.php index 4149fe97ab..4078a0c5c5 100644 --- a/lhc_web/modules/lhfaq/module.php +++ b/lhc_web/modules/lhfaq/module.php @@ -1,58 +1,49 @@ - "FAQ"); - -$ViewList = array(); - -$ViewList['list'] = array( - 'params' => array(), - 'functions' => array( 'manage_faq' ) -); - -$ViewList['delete'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage_faq' ) -); - -$ViewList['view'] = array( - 'params' => array('id'), - 'functions' => array( 'manage_faq' ) -); - -$ViewList['new'] = array( - 'params' => array('id'), - 'functions' => array( 'manage_faq' ) -); - -$ViewList['faqwidget'] = array( - 'params' => array(), - 'uparams' => array('theme','url','mode','identifier','search'), -); - -$ViewList['getstatus'] = array( - 'params' => array(), - 'functions' => array( ), - 'uparams' => array('theme','noresponse','position','top','units') -); - -$ViewList['embed'] = array( - 'params' => array(), - 'uparams' => array('theme'), - 'functions' => array() -); - -$ViewList['embedcode'] = array( - 'params' => array(), - 'functions' => array('manage_faq') -); - -$ViewList['htmlcode'] = array( - 'params' => array(), - 'functions' => array( 'manage_faq' ) -); - -$FunctionList = array(); -$FunctionList['manage_faq'] = array('explain' => 'Allow user to manage FAQ'); - -?> \ No newline at end of file + 'FAQ']; + +$ViewList = [ + 'list' => [ + 'params' => [], + 'functions' => ['manage_faq'], + ], + 'delete' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage_faq'], + ], + 'view' => [ + 'params' => ['id'], + 'functions' => ['manage_faq'], + ], + 'new' => [ + 'params' => ['id'], + 'functions' => ['manage_faq'], + ], + 'faqwidget' => [ + 'params' => [], + 'uparams' => ['theme', 'url', 'mode', 'identifier', 'search'], + ], + 'getstatus' => [ + 'params' => [], + 'functions' => [], + 'uparams' => ['theme', 'noresponse', 'position', 'top', 'units'], + ], + 'embed' => [ + 'params' => [], + 'uparams' => ['theme'], + 'functions' => [], + ], + 'embedcode' => [ + 'params' => [], + 'functions' => ['manage_faq'], + ], + 'htmlcode' => [ + 'params' => [], + 'functions' => ['manage_faq'], + ], +]; + +$FunctionList = [ + 'manage_faq' => ['explain' => 'Allow user to manage FAQ'], +]; diff --git a/lhc_web/modules/lhfile/list.php b/lhc_web/modules/lhfile/list.php index 6e46066f48..91f35c64b3 100644 --- a/lhc_web/modules/lhfile/list.php +++ b/lhc_web/modules/lhfile/list.php @@ -3,10 +3,10 @@ $tpl = erLhcoreClassTemplate::getInstance( 'lhfile/list.tpl.php'); if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'filelist','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'filelist','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'filelist','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'filelist','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = false; } @@ -26,9 +26,9 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelChatFile::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id DESC'),$filterParams['filter'])); + $items = erLhcoreClassModelChatFile::getList(array_merge(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id DESC'],$filterParams['filter'])); } $tpl->set('items',$items); @@ -38,10 +38,8 @@ $tpl->set('input',$filterParams['input_form']); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','System configuration')), -array('url' => erLhcoreClassDesign::baseurl('file/list'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','List of chat files'))); +$Result['path'] = [ +['url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','System configuration')], +['url' => erLhcoreClassDesign::baseurl('file/list'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','List of chat files')]]; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.list_path', array('result' => & $Result)); - -?> \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('file.list_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhfile/module.php b/lhc_web/modules/lhfile/module.php index 1eff79bc4e..0839767465 100644 --- a/lhc_web/modules/lhfile/module.php +++ b/lhc_web/modules/lhfile/module.php @@ -1,151 +1,127 @@ "Files module"); - -$ViewList = array(); - -$ViewList['configuration'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['uploadfile'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array(), -); - -$ViewList['fileoptions'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array(), -); - -$ViewList['uploadfileonline'] = array( - 'params' => array('vid'), - 'uparams' => array(), -); - -$ViewList['chatfileslist'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$ViewList['onlinefileslist'] = array( - 'params' => array('online_user_id'), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$ViewList['useronlinefileslist'] = array( - 'params' => array('vid'), - 'uparams' => array(), - 'functions' => array( ) -); - -$ViewList['removepreview'] = array( - 'params' => array(), - 'uparams' => array(), -); - -$ViewList['downloadfile'] = array( - 'params' => array('file_id','hash'), - 'uparams' => array('inline','vhash','vts'), -); - -$ViewList['verifyaccess'] = array( - 'params' => array('file_id','hash'), - 'uparams' => array('reverify'), - 'functions' => array('verify_file') -); - -$ViewList['uploadfileadmin'] = array( - 'params' => array('chat_id'), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$ViewList['uploadfileadminonlineuser'] = array( - 'params' => array('online_user_id'), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$ViewList['new'] = array( - 'params' => array(), - 'uparams' => array('mode','persistent'), - 'functions' => array( 'upload_new_file' ) -); - -$ViewList['attatchfile'] = array( - 'params' => array('chat_id'), - 'uparams' => array('user_id'), - 'functions' => array( 'use_operator' ) -); - -$ViewList['attatchfileimg'] = array( - 'params' => array(), - 'uparams' => array('persistent','user_id','visitor','upload_name','replace','file_id'), - 'functions' => array( 'use_operator' ) -); - -$ViewList['attatchfilemail'] = array( - 'params' => array(), - 'uparams' => array('mode','user_id'), - 'functions' => array( 'use_operator' ) -); - -$ViewList['list'] = array( - 'params' => array(), - 'uparams' => array('chat_id', 'user_ids', 'user_id', 'visitor', 'persistent', 'upload_name'), - 'functions' => array( 'file_list' ), - 'multiple_arguments' => array( - 'user_ids' - ) -); - -$ViewList['listmail'] = array( - 'params' => array(), - 'uparams' => array('conversation_id', 'message_id', 'user_id', 'visitor', 'persistent','upload_name'), - 'functions' => array( 'file_list_mail' ) -); - -$ViewList['editmail'] = array( - 'params' => array('file_id'), - 'functions' => array( 'file_list_mail' ) -); - -$ViewList['delete'] = array( - 'params' => array('file_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'file_delete' ) -); - -$ViewList['edit'] = array( - 'params' => array('file_id'), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$ViewList['deletechatfile'] = array( - 'params' => array('file_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'file_delete_chat' ) -); - -$ViewList['storescreenshot'] = array( - 'params' => array(), - 'uparams' => array('vid','hash','hash_resume'), -); - -$FunctionList['use'] = array('explain' => 'Allow user to configure files upload'); -$FunctionList['use_operator'] = array('explain' => 'Allow operators to send files to visitor'); -$FunctionList['upload_new_file'] = array('explain' => 'Allow operator to upload new file'); -$FunctionList['file_list'] = array('explain' => 'Allow operators to list all uploaded files'); -$FunctionList['file_delete'] = array('explain' => 'Allow operators to delete all files'); -$FunctionList['file_delete_chat'] = array('explain' => 'Allow operators to delete their chat files'); -$FunctionList['download_unverified'] = array('explain' => 'Allow operators to download unverified files'); -$FunctionList['download_verified'] = array('explain' => 'Allow operators to download verified, but sensitive files'); -$FunctionList['verify_file'] = array('explain' => 'Allow to verify access to files'); -$FunctionList['file_list_mail'] = array('explain' => 'Allow to list mail messages files'); - -?> \ No newline at end of file +$Module = ['name' => 'Files module']; + +$ViewList = [ + 'configuration' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'uploadfile' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => [], + ], + 'fileoptions' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => [], + ], + 'uploadfileonline' => [ + 'params' => ['vid'], + 'uparams' => [], + ], + 'chatfileslist' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use_operator'], + ], + 'onlinefileslist' => [ + 'params' => ['online_user_id'], + 'uparams' => [], + 'functions' => ['use_operator'], + ], + 'useronlinefileslist' => [ + 'params' => ['vid'], + 'uparams' => [], + 'functions' => [], + ], + 'removepreview' => [ + 'params' => [], + 'uparams' => [], + ], + 'downloadfile' => [ + 'params' => ['file_id', 'hash'], + 'uparams' => ['inline', 'vhash', 'vts'], + ], + 'verifyaccess' => [ + 'params' => ['file_id', 'hash'], + 'uparams' => ['reverify'], + 'functions' => ['verify_file'], + ], + 'uploadfileadmin' => [ + 'params' => ['chat_id'], + 'uparams' => [], + 'functions' => ['use_operator'], + ], + 'uploadfileadminonlineuser' => [ + 'params' => ['online_user_id'], + 'uparams' => [], + 'functions' => ['use_operator'], + ], + 'new' => [ + 'params' => [], + 'uparams' => ['mode', 'persistent'], + 'functions' => ['upload_new_file'], + ], + 'attatchfile' => [ + 'params' => ['chat_id'], + 'uparams' => ['user_id'], + 'functions' => ['use_operator'], + ], + 'attatchfileimg' => [ + 'params' => [], + 'uparams' => ['persistent', 'user_id', 'visitor', 'upload_name', 'replace', 'file_id'], + 'functions' => ['use_operator'], + ], + 'attatchfilemail' => [ + 'params' => [], + 'uparams' => ['mode', 'user_id'], + 'functions' => ['use_operator'], + ], + 'list' => [ + 'params' => [], + 'uparams' => ['chat_id', 'user_ids', 'user_id', 'visitor', 'persistent', 'upload_name'], + 'functions' => ['file_list'], + 'multiple_arguments' => ['user_ids'], + ], + 'listmail' => [ + 'params' => [], + 'uparams' => ['conversation_id', 'message_id', 'user_id', 'visitor', 'persistent', 'upload_name'], + 'functions' => ['file_list_mail'], + ], + 'editmail' => [ + 'params' => ['file_id'], + 'functions' => ['file_list_mail'], + ], + 'delete' => [ + 'params' => ['file_id'], + 'uparams' => ['csfr'], + 'functions' => ['file_delete'], + ], + 'edit' => [ + 'params' => ['file_id'], + 'uparams' => [], + 'functions' => ['use_operator'], + ], + 'deletechatfile' => [ + 'params' => ['file_id'], + 'uparams' => ['csfr'], + 'functions' => ['file_delete_chat'], + ], + 'storescreenshot' => [ + 'params' => [], + 'uparams' => ['vid', 'hash', 'hash_resume'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow user to configure files upload'], + 'use_operator' => ['explain' => 'Allow operators to send files to visitor'], + 'upload_new_file' => ['explain' => 'Allow operator to upload new file'], + 'file_list' => ['explain' => 'Allow operators to list all uploaded files'], + 'file_delete' => ['explain' => 'Allow operators to delete all files'], + 'file_delete_chat' => ['explain' => 'Allow operators to delete their chat files'], + 'download_unverified' => ['explain' => 'Allow operators to download unverified files'], + 'download_verified' => ['explain' => 'Allow operators to download verified, but sensitive files'], + 'verify_file' => ['explain' => 'Allow to verify access to files'], + 'file_list_mail' => ['explain' => 'Allow to list mail messages files'], +]; diff --git a/lhc_web/modules/lhform/module.php b/lhc_web/modules/lhform/module.php index 9e7ec0fbc5..59d747e702 100644 --- a/lhc_web/modules/lhform/module.php +++ b/lhc_web/modules/lhform/module.php @@ -1,72 +1,52 @@ - "Forms module"); - -$ViewList = array(); - -$ViewList['index'] = array( - 'params' => array(), - 'functions' => array( 'manage_fm' ) -); - -$ViewList['fill'] = array( - 'params' => array('form_id'), - 'functions' => array( ) -); - -$ViewList['collected'] = array( - 'params' => array('form_id'), - 'uparams' => array('action','id','csfr'), - 'functions' => array( 'manage_fm' ) -); - -$ViewList['viewcollected'] = array( - 'params' => array('collected_id'), - 'functions' => array( 'manage_fm' ) -); - -$ViewList['embedcode'] = array( - 'params' => array(), - 'functions' => array('generate_js') -); - -/* - * XLS file with all files -* -* */ -$ViewList['downloadcollected'] = array( - 'params' => array('form_id'), - 'functions' => array( 'manage_fm' ) -); - -/* - * zip file with XLS file and documents - * - * */ -$ViewList['downloaditem'] = array( - 'params' => array('collected_id'), - 'functions' => array('manage_fm') -); - -/* - * single attribute download - * - * */ -$ViewList['download'] = array( - 'params' => array('collected_id','attr_name'), - 'functions' => array('manage_fm') -); - -$ViewList['embed'] = array( - 'params' => array('form_id'), - 'functions' => array() -); - -$ViewList['formwidget'] = array( - 'params' => array('form_id') -); - -$FunctionList = array(); -$FunctionList['manage_fm'] = array('explain' => 'Allow user to manage form module'); -$FunctionList['delete_fm'] = array('explain' => 'Allow user to delete forms'); -$FunctionList['generate_js'] = array('explain' => 'Allow user to generate page embed js'); + 'Forms module']; + +$ViewList = [ + 'index' => [ + 'params' => [], + 'functions' => ['manage_fm'], + ], + 'fill' => [ + 'params' => ['form_id'], + 'functions' => [], + ], + 'collected' => [ + 'params' => ['form_id'], + 'uparams' => ['action', 'id', 'csfr'], + 'functions' => ['manage_fm'], + ], + 'viewcollected' => [ + 'params' => ['collected_id'], + 'functions' => ['manage_fm'], + ], + 'embedcode' => [ + 'params' => [], + 'functions' => ['generate_js'], + ], + 'downloadcollected' => [ + 'params' => ['form_id'], + 'functions' => ['manage_fm'], + ], + 'downloaditem' => [ + 'params' => ['collected_id'], + 'functions' => ['manage_fm'], + ], + 'download' => [ + 'params' => ['collected_id', 'attr_name'], + 'functions' => ['manage_fm'], + ], + 'embed' => [ + 'params' => ['form_id'], + 'functions' => [], + ], + 'formwidget' => [ + 'params' => ['form_id'], + ], +]; + +$FunctionList = [ + 'manage_fm' => ['explain' => 'Allow user to manage form module'], + 'delete_fm' => ['explain' => 'Allow user to delete forms'], + 'generate_js' => ['explain' => 'Allow user to generate page embed js'], +]; diff --git a/lhc_web/modules/lhfront/default.php b/lhc_web/modules/lhfront/default.php index df077e8f53..5ace8765b9 100644 --- a/lhc_web/modules/lhfront/default.php +++ b/lhc_web/modules/lhfront/default.php @@ -7,7 +7,7 @@ /** * Append user departments filter * */ -$departmentParams = array(); +$departmentParams = []; $userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID(), $currentUser->cache_version); if ($userDepartments !== true) { $departmentParams['filterin']['id'] = $userDepartments; @@ -32,5 +32,3 @@ /*$Result['additional_footer_js'] = '';*/ $Result['additional_footer_js'] = ''; $Result['additional_footer_js'] .= ''; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhfront/module.php b/lhc_web/modules/lhfront/module.php index d4ccd95e76..9b7beaad62 100644 --- a/lhc_web/modules/lhfront/module.php +++ b/lhc_web/modules/lhfront/module.php @@ -1,35 +1,32 @@ "Frontpage"); +$Module = ['name' => 'Frontpage']; -$ViewList = array(); - -$ViewList['default'] = array( - 'params' => array(), - 'uparams' => array('cid','mid'), - 'functions' => array( 'use' ) -); +$ViewList = [ + 'default' => [ + 'params' => [], + 'uparams' => ['cid', 'mid'], + 'functions' => ['use'], + ], + 'settings' => [ + 'params' => [], + 'uparams' => ['action', 'csfr'], + 'functions' => ['use'], + ], + 'tabs' => [ + 'params' => [], + 'uparams' => ['id', 'idmail'], + 'functions' => ['use'], + 'multiple_arguments' => ['id', 'idmail'], + ], + 'switchdashboard' => [ + 'params' => [], + 'uparams' => ['action', 'csfr'], + 'functions' => ['use'], + ], +]; -$ViewList['settings'] = array( - 'params' => array(), - 'uparams' => array('action','csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['tabs'] = array( - 'params' => array(), - 'uparams' => array('id','idmail'), - 'functions' => array('use'), - 'multiple_arguments' => array('id','idmail') -); - -$ViewList['switchdashboard'] = array( - 'params' => array(), - 'uparams' => array('action','csfr'), - 'functions' => array('use') -); - -$FunctionList['use'] = array('explain' => 'General frontpage use permission'); -$FunctionList['switch_dashboard'] = array('explain' => 'Allow operator to switch between new/old dashboards'); - -?> \ No newline at end of file +$FunctionList = [ + 'use' => ['explain' => 'General frontpage use permission'], + 'switch_dashboard' => ['explain' => 'Allow operator to switch between new/old dashboards'], +]; diff --git a/lhc_web/modules/lhfront/tabs.php b/lhc_web/modules/lhfront/tabs.php index 34400eb730..556570c69a 100644 --- a/lhc_web/modules/lhfront/tabs.php +++ b/lhc_web/modules/lhfront/tabs.php @@ -8,21 +8,21 @@ erLhcoreClassChat::validateFilterIn($id); } -$response = array(); +$response = []; $scope = 'chats'; $chats = []; if (!empty($id)) { - $icons_additional = erLhAbstractModelChatColumn::getList(array('ignore_fields' => array('position', 'conditions', 'column_identifier', 'enabled'), 'sort' => false, 'filter' => array('icon_mode' => 1, 'enabled' => 1, 'chat_enabled' => 1))); + $icons_additional = erLhAbstractModelChatColumn::getList(['ignore_fields' => ['position', 'conditions', 'column_identifier', 'enabled'], 'sort' => false, 'filter' => ['icon_mode' => 1, 'enabled' => 1, 'chat_enabled' => 1]]); - $chats = erLhcoreClassModelChat::getList(array('sort' => 'id ASC', 'filterin' => array('id' => $id))); + $chats = erLhcoreClassModelChat::getList(['sort' => 'id ASC', 'filterin' => ['id' => $id]]); if (!empty($icons_additional)) { - erLhcoreClassChat::prefillGetAttributes($chats, array(), array(), array('additional_columns' => $icons_additional, 'do_not_clean' => true)); + erLhcoreClassChat::prefillGetAttributes($chats, [], [], ['additional_columns' => $icons_additional, 'do_not_clean' => true]); } - if (!((int)erLhcoreClassModelUserSetting::getSetting('admin_theme_enabled', 0) == 1 && ($personalAdminTheme = erLhAbstractModelAdminTheme::findOne(array('filter' => array('user_id' => erLhcoreClassUser::instance()->getUserID())))) instanceof erLhAbstractModelAdminTheme)) { + if (!((int)erLhcoreClassModelUserSetting::getSetting('admin_theme_enabled', 0) == 1 && ($personalAdminTheme = erLhAbstractModelAdminTheme::findOne(['filter' => ['user_id' => erLhcoreClassUser::instance()->getUserID()]])) instanceof erLhAbstractModelAdminTheme)) { $adminThemeId = erLhcoreClassModelChatConfig::fetch('default_admin_theme_id')->current_value; if ($adminThemeId > 0) { $personalAdminTheme = erLhAbstractModelAdminTheme::fetch($adminThemeId); @@ -33,16 +33,16 @@ $msgVisitor = erLhcoreClassChat::getGetLastChatMessagePending($chat->id, true, 3, ' » '); if ((int)erLhcoreClassModelChatConfig::fetch('guardrails_enabled')->current_value == 1 && !$currentUser->hasAccessTo('lhchat','see_sensitive_information')) { - $msgVisitor = \LiveHelperChat\Models\LHCAbstract\ChatMessagesGhosting::maskMessage($msgVisitor, array('dep_id' => $chat->dep_id)); + $msgVisitor = \LiveHelperChat\Models\LHCAbstract\ChatMessagesGhosting::maskMessage($msgVisitor, ['dep_id' => $chat->dep_id]); } $nick = $chat->nick; if ($personalAdminTheme instanceof erLhAbstractModelAdminTheme && !empty($personalAdminTheme->css_attributes_array['nick_template'])) { - $nick = erLhcoreClassGenericBotWorkflow::translateMessage($personalAdminTheme->css_attributes_array['nick_template'], array('chat' => $chat, 'args' => ['chat' => $chat])); + $nick = erLhcoreClassGenericBotWorkflow::translateMessage($personalAdminTheme->css_attributes_array['nick_template'], ['chat' => $chat, 'args' => ['chat' => $chat]]); } - $item = array( + $item = [ 'id' => $chat->id, 'nick' => $nick, 'cs' => $chat->status, @@ -57,7 +57,7 @@ 'cc' => ($chat->country_code != '' ? erLhcoreClassDesign::design('images/flags') . '/' . (string)$chat->country_code . '.png' : ''), 'msg' => $msgVisitor, 'vwa' => ($chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT && $chat->last_user_msg_time > ($chat->last_op_msg_time > 0 ? $chat->last_op_msg_time : $chat->pnd_time) && (time() - $chat->last_user_msg_time > (int)erLhcoreClassModelChatConfig::fetchCache('vwait_to_long')->current_value) ? erLhcoreClassChat::formatSeconds(time() - $chat->last_user_msg_time) : null) - ); + ]; $chatIcons = []; foreach ($icons_additional as $iconAdditional) { @@ -96,7 +96,7 @@ erLhcoreClassChat::validateFilterIn($id); if (!empty($id)) { - $chats = erLhcoreClassModelMailconvConversation::getList(array('sort' => 'id DESC', 'filterin' => array('id' => $id))); + $chats = erLhcoreClassModelMailconvConversation::getList(['sort' => 'id DESC', 'filterin' => ['id' => $id]]); $sensitive = false; if (!erLhcoreClassUser::instance()->hasAccessTo('lhmailconv','mail_see_unhidden_email')) { @@ -105,7 +105,7 @@ $idFound = []; foreach ($chats as $chat) { - $item = array( + $item = [ 'id' => $chat->id, 'from_name' => $chat->from_name, 'from_address' => ($sensitive === true ? \LiveHelperChat\Helpers\Anonymizer::maskEmail($chat->from_address) : $chat->from_address), @@ -113,7 +113,7 @@ 'cs' => $chat->status, 'co' => $chat->user_id, 'dep' => (string)$chat->department - ); + ]; $response[] = $item; $idFound[] = $chat->id; } @@ -123,7 +123,7 @@ if (!in_array($idMail, $idFound)) { $mailData = \LiveHelperChat\mailConv\Archive\Archive::fetchMailById($idMail); if (isset($mailData['mail'])) { - $item = array( + $item = [ 'id' => $mailData['mail']->id, 'from_name' => $mailData['mail']->from_name, 'from_address' => ($sensitive === true ? \LiveHelperChat\Helpers\Anonymizer::maskEmail($mailData['mail']->from_address) : $mailData['mail']->from_address), @@ -131,7 +131,7 @@ 'cs' => $mailData['mail']->status, 'co' => $mailData['mail']->user_id, 'dep' => (string)$mailData['mail']->department - ); + ]; $response[] = $item; } } @@ -139,9 +139,8 @@ } } -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.front_tabs',array('scope' => $scope, 'items' => & $response, 'objects' => $chats)); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.front_tabs',['scope' => $scope, 'items' => & $response, 'objects' => $chats]); echo json_encode($response); exit; -?> \ No newline at end of file diff --git a/lhc_web/modules/lhgenericbot/module.php b/lhc_web/modules/lhgenericbot/module.php index 77226dfccc..87f7c6d0c6 100644 --- a/lhc_web/modules/lhgenericbot/module.php +++ b/lhc_web/modules/lhgenericbot/module.php @@ -1,434 +1,364 @@ "Generic Bot", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['bot'] = array( - 'params' => array('id'), - 'uparams' => array('type'), - 'functions' => array( 'use' ) -); - -$ViewList['initbot'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['testpattern'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'test_pattern' ) -); - -$ViewList['commands'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['newcommand'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['triggersearch'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['usecases'] = array( - 'params' => array('type','id'), - 'uparams' => array('arg1','arg2'), - 'functions' => array( 'use_cases' ) -); - -$ViewList['editcommand'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['help'] = array( - 'params' => array('context'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['addpayload'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['loadusecases'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['downloadbot'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['downloadbotgroup'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['import'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['botimportgroup'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['triggersbybot'] = array( - 'params' => array('id','trigger_id'), - 'uparams' => array('preview','element','asarg'), - 'functions' => array( 'use_operator' ) -); - -$ViewList['getpayloads'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['argumenttemplates'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['nodegroups'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['list'] = array( - 'params' => array(), - 'uparams' => array('name'), - 'functions' => array( 'use' ) -); - -$ViewList['listrestapi'] = array( - 'params' => array(), - 'uparams' => array('name'), - 'functions' => array( 'use' ) -); - -$ViewList['restapimethods'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['listexceptions'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['listtranslations'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['listtranslationsitems'] = array( - 'params' => array(), - 'uparams' => array('group_id'), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['new'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['newrestapi'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['newexception'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['newtrgroup'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['newtritem'] = array( - 'params' => array(), - 'uparams' => array('group_id'), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['edittrgroup'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['edittritem'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['editrestapi'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['editexception'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['edit'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['delete'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['deletecommand'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['deleterestapi'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['deleteexception'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['deletetritem'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['deletetrgroup'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_individualization' ) -); - -$ViewList['nodegrouptriggers'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['addgroup'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['updategroup'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['updatetrigger'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['savetrigger'] = array( - 'params' => array(), - 'uparams' => array('method'), - 'functions' => array( 'use' ) -); - -$ViewList['addtrigger'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['addtriggerevent'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['deletetriggerevent'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['deletegroup'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['updatetriggerevent'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['removetrigger'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['maketriggercopy'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['setdefaulttrigger'] = array( - 'params' => array('id','default'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['setinprogresstrigger'] = array( - 'params' => array('id','default'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['settriggerposition'] = array( - 'params' => array('id','pos'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['setasargument'] = array( - 'params' => array('id','default'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['settriggergroup'] = array( - 'params' => array('id','group_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['setdefaultunknowntrigger'] = array( - 'params' => array('id','default'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['setdefaultunknownbtntrigger'] = array( - 'params' => array('id','default'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['setdefaultalwaystrigger'] = array( - 'params' => array('id','default'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['nodetriggeractions'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['notifications'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$ViewList['buttonclicked'] = array( - 'params' => array('chat_id', 'hash' ), - 'uparams' => array('type','theme') -); - -$ViewList['updatebuttonclicked'] = array( - 'params' => array('chat_id', 'hash'), - 'uparams' => array() -); - -$ViewList['chatactions'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'see_actions' ) -); - -$ViewList['conditions'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'manage_conditions' ) -); - -$ViewList['newcondition'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'manage_conditions' ) -); - -$ViewList['editcondition'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'manage_conditions' ) -); - -$ViewList['deletecondition'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage_conditions' ) -); - -$FunctionList['use'] = array('explain' => 'General permission to use generic bot module'); -$FunctionList['use_operator'] = array('explain' => 'Allow operator to change bot notifications settings'); -$FunctionList['see_actions'] = array('explain' => 'Allow operator to see chat actions'); -$FunctionList['use_individualization'] = array('explain' => 'Allow operator to change bot individualisation'); -$FunctionList['manage_conditions'] = array('explain' => 'Allow operator to manage conditions templates'); -$FunctionList['use_cases'] = array('explain' => 'Allow operator see use cases of the object'); -$FunctionList['test_pattern'] = array('explain' => 'Allow operator see use cases of the object'); - -?> \ No newline at end of file +$Module = ['name' => 'Generic Bot', 'variable_params' => true]; + +$ViewList = [ + 'bot' => [ + 'params' => ['id'], + 'uparams' => ['type'], + 'functions' => ['use'], + ], + 'initbot' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'testpattern' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['test_pattern'], + ], + 'commands' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'newcommand' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'triggersearch' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'usecases' => [ + 'params' => ['type', 'id'], + 'uparams' => ['arg1', 'arg2'], + 'functions' => ['use_cases'], + ], + 'editcommand' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'help' => [ + 'params' => ['context'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'addpayload' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'loadusecases' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'downloadbot' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'downloadbotgroup' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'import' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'botimportgroup' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'triggersbybot' => [ + 'params' => ['id', 'trigger_id'], + 'uparams' => ['preview', 'element', 'asarg'], + 'functions' => ['use_operator'], + ], + 'getpayloads' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'argumenttemplates' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'nodegroups' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'list' => [ + 'params' => [], + 'uparams' => ['name'], + 'functions' => ['use'], + ], + 'listrestapi' => [ + 'params' => [], + 'uparams' => ['name'], + 'functions' => ['use'], + ], + 'restapimethods' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'listexceptions' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'listtranslations' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_individualization'], + ], + 'listtranslationsitems' => [ + 'params' => [], + 'uparams' => ['group_id'], + 'functions' => ['use_individualization'], + ], + 'new' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'newrestapi' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'newexception' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'newtrgroup' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_individualization'], + ], + 'newtritem' => [ + 'params' => [], + 'uparams' => ['group_id'], + 'functions' => ['use_individualization'], + ], + 'edittrgroup' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_individualization'], + ], + 'edittritem' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_individualization'], + ], + 'editrestapi' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'editexception' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'edit' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'delete' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'deletecommand' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'deleterestapi' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'deleteexception' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'deletetritem' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_individualization'], + ], + 'deletetrgroup' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_individualization'], + ], + 'nodegrouptriggers' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'addgroup' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'updategroup' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'updatetrigger' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'savetrigger' => [ + 'params' => [], + 'uparams' => ['method'], + 'functions' => ['use'], + ], + 'addtrigger' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'addtriggerevent' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'deletetriggerevent' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'deletegroup' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'updatetriggerevent' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'removetrigger' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'maketriggercopy' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'setdefaulttrigger' => [ + 'params' => ['id', 'default'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'setinprogresstrigger' => [ + 'params' => ['id', 'default'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'settriggerposition' => [ + 'params' => ['id', 'pos'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'setasargument' => [ + 'params' => ['id', 'default'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'settriggergroup' => [ + 'params' => ['id', 'group_id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'setdefaultunknowntrigger' => [ + 'params' => ['id', 'default'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'setdefaultunknownbtntrigger' => [ + 'params' => ['id', 'default'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'setdefaultalwaystrigger' => [ + 'params' => ['id', 'default'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'nodetriggeractions' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'notifications' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_operator'], + ], + 'buttonclicked' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['type', 'theme'], + ], + 'updatebuttonclicked' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => [], + ], + 'chatactions' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['see_actions'], + ], + 'conditions' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['manage_conditions'], + ], + 'newcondition' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['manage_conditions'], + ], + 'editcondition' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['manage_conditions'], + ], + 'deletecondition' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage_conditions'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'General permission to use generic bot module'], + 'use_operator' => ['explain' => 'Allow operator to change bot notifications settings'], + 'see_actions' => ['explain' => 'Allow operator to see chat actions'], + 'use_individualization' => ['explain' => 'Allow operator to change bot individualisation'], + 'manage_conditions' => ['explain' => 'Allow operator to manage conditions templates'], + 'use_cases' => ['explain' => 'Allow operator see use cases of the object'], + 'test_pattern' => ['explain' => 'Allow operator see use cases of the object'], +]; diff --git a/lhc_web/modules/lhgroupchat/module.php b/lhc_web/modules/lhgroupchat/module.php index 0951ae1444..718325485c 100644 --- a/lhc_web/modules/lhgroupchat/module.php +++ b/lhc_web/modules/lhgroupchat/module.php @@ -1,120 +1,98 @@ "Group chats module", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['loadgroupchat'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['loadpublichat'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['loadpreviousmessages'] = array( - 'params' => array('id','msg_id'), - 'uparams' => array('initial'), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['inviteoperator'] = array( - 'params' => array('id','op_id'), - 'uparams' => array(), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['startchatwithoperator'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['leave'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ), - 'multiple_arguments' => array() -); - -$ViewList['addmessage'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'multiple_arguments' => array() -); - -$ViewList['sync'] = array( - 'params' => array(), - 'uparams' => array('opt'), - 'multiple_arguments' => array() -); - -$ViewList['list'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'manage' ) -); - -$ViewList['options'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'manage' ) -); - -$ViewList['edit'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'manage' ) -); - -$ViewList['edit'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage' ) -); - -$ViewList['delete'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage' ) -); - -$ViewList['new'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'manage' ) -); - -$ViewList['newgroupajax'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['searchoperator'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['cancelinvite'] = array( - 'params' => array('id','op_id'), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$FunctionList['use'] = array('explain' => 'Allow operator to use private/public groups'); -$FunctionList['manage'] = array('explain' => 'Permission to manage group chat module'); -$FunctionList['public_chat'] = array('explain' => 'Allow operator to create a public group chat'); - -?> \ No newline at end of file +$Module = ['name' => 'Group chats module', 'variable_params' => true]; + +$ViewList = [ + 'loadgroupchat' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'loadpublichat' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'loadpreviousmessages' => [ + 'params' => ['id', 'msg_id'], + 'uparams' => ['initial'], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'inviteoperator' => [ + 'params' => ['id', 'op_id'], + 'uparams' => [], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'startchatwithoperator' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'leave' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + 'multiple_arguments' => [], + ], + 'addmessage' => [ + 'params' => ['id'], + 'uparams' => [], + 'multiple_arguments' => [], + ], + 'sync' => [ + 'params' => [], + 'uparams' => ['opt'], + 'multiple_arguments' => [], + ], + 'list' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['manage'], + ], + 'options' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['manage'], + ], + 'edit' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage'], + ], + 'delete' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage'], + ], + 'new' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['manage'], + ], + 'newgroupajax' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'searchoperator' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use'], + ], + 'cancelinvite' => [ + 'params' => ['id', 'op_id'], + 'uparams' => [], + 'functions' => ['use'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow operator to use private/public groups'], + 'manage' => ['explain' => 'Permission to manage group chat module'], + 'public_chat' => ['explain' => 'Allow operator to create a public group chat'], +]; diff --git a/lhc_web/modules/lhinstall/install.php b/lhc_web/modules/lhinstall/install.php index 2a887097f2..821631bfad 100644 --- a/lhc_web/modules/lhinstall/install.php +++ b/lhc_web/modules/lhinstall/install.php @@ -4,13 +4,13 @@ $cfgSite = erConfigClassLhConfig::getInstance(); - if ($cfgSite->getSetting( 'site', 'installed' ) == true) + if ($cfgSite->getSetting('site', 'installed') == true) { - $Params['module']['functions'] = array('install'); + $Params['module']['functions'] = ['install']; include_once('modules/lhkernel/nopermission.php'); $Result['pagelayout'] = 'install'; - $Result['path'] = array(array('title' => 'Live helper chat installation')); + $Result['path'] = [['title' => 'Live helper chat installation']]; return $Result; exit; @@ -19,16 +19,16 @@ $instance = erLhcoreClassSystem::instance(); if ($instance->SiteAccess != 'site_admin') { - header('Location: ' .erLhcoreClassDesign::baseurldirect('site_admin/install/install') ); + header('Location: ' .erLhcoreClassDesign::baseurldirect('site_admin/install/install')); exit; } - $tpl = new erLhcoreClassTemplate( 'lhinstall/install1.tpl.php'); + $tpl = new erLhcoreClassTemplate('lhinstall/install1.tpl.php'); switch ((int)$Params['user_parameters']['step_id']) { case '1': - $Errors = array(); + $Errors = []; if (!is_writable("cache/cacheconfig")) $Errors[] = "cache/cacheconfig is not writable"; @@ -99,9 +99,9 @@ break; case '2': - $Errors = array(); + $Errors = []; - $definition = array( + $definition = [ 'DatabaseUsername' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw' ), @@ -117,7 +117,7 @@ 'DatabaseDatabaseName' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::REQUIRED, 'string' ), - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); @@ -183,11 +183,11 @@ case '3': - $Errors = array(); + $Errors = []; if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $definition = array( + $definition = [ 'AdminUsername' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw' ), @@ -209,7 +209,7 @@ 'DefaultDepartament' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::REQUIRED, 'string' ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); @@ -2951,73 +2951,73 @@ erLhcoreClassRole::getSession()->save($RoleFunction); // Operators rules and functions - $permissionsArray = array( - array('module' => 'lhuser', 'function' => 'selfedit'), - array('module' => 'lhuser', 'function' => 'change_chat_nickname'), - array('module' => 'lhuser', 'function' => 'changephoto'), - array('module' => 'lhuser', 'function' => 'change_job_title'), - array('module' => 'lhuser', 'function' => 'change_core_attributes'), - array('module' => 'lhuser', 'function' => 'change_name_surname'), - array('module' => 'lhuser', 'function' => 'selfedit'), - array('module' => 'lhuser', 'function' => 'changeonlinestatus'), - array('module' => 'lhuser', 'function' => 'changeskypenick'), - array('module' => 'lhuser', 'function' => 'personalcannedmsg'), - array('module' => 'lhuser', 'function' => 'change_visibility_list'), - array('module' => 'lhuser', 'function' => 'see_assigned_departments'), - array('module' => 'lhuser', 'function' => 'canseedepartmentstats'), - array('module' => 'lhchat', 'function' => 'use'), - array('module' => 'lhchat', 'function' => 'open_all'), - array('module' => 'lhchat', 'function' => 'chattabschrome'), - array('module' => 'lhchat', 'function' => 'singlechatwindow'), - array('module' => 'lhchat', 'function' => 'allowopenremotechat'), - array('module' => 'lhchat', 'function' => 'writeremotechat'), - array('module' => 'lhchat', 'function' => 'allowchattabs'), - array('module' => 'lhchat', 'function' => 'use_onlineusers'), - array('module' => 'lhchat', 'function' => 'take_screenshot'), - array('module' => 'lhchat', 'function' => 'editprevious'), - array('module' => 'lhfront', 'function' => 'use'), - array('module' => 'lhsystem','function' => 'use'), - array('module' => 'lhtranslation','function' => 'use'), - array('module' => 'lhchat', 'function' => 'allowblockusers'), - array('module' => 'lhsystem','function' => 'generatejs'), - array('module' => 'lhsystem','function' => 'changelanguage'), - array('module' => 'lhchat', 'function' => 'allowredirect'), - array('module' => 'lhchat', 'function' => 'allowtransfer'), - array('module' => 'lhchat', 'function' => 'allowtransferdirectly'), - array('module' => 'lhchat', 'function' => 'administratecannedmsg'), - array('module' => 'lhchat', 'function' => 'explorecannedmsg'), - array('module' => 'lhchat', 'function' => 'sees_all_online_visitors'), - array('module' => 'lhchat', 'function' => 'list_all_chats'), - array('module' => 'lhchat', 'function' => 'use_unhidden_phone'), - array('module' => 'lhchat', 'function' => 'chat_see_email'), - array('module' => 'lhchat', 'function' => 'chat_see_unhidden_email'), - array('module' => 'lhchat', 'function' => 'see_sensitive_information'), - array('module' => 'lhchat', 'function' => 'whispermode'), - array('module' => 'lhpermission', 'function' => 'see_permissions'), - array('module' => 'lhquestionary', 'function' => 'manage_questionary'), - array('module' => 'lhfaq', 'function' => 'manage_faq'), - array('module' => 'lhchatbox', 'function' => 'manage_chatbox'), - array('module' => 'lhbrowseoffer', 'function' => 'manage_bo'), - array('module' => 'lhxml', 'function' => '*'), - array('module' => 'lhcobrowse', 'function' => 'browse'), - array('module' => 'lhfile', 'function' => 'use_operator'), - array('module' => 'lhfile', 'function' => 'file_delete_chat'), - array('module' => 'lhstatistic', 'function' => 'use'), - array('module' => 'lhspeech', 'function' => 'changedefaultlanguage'), - array('module' => 'lhspeech', 'function' => 'use'), - array('module' => 'lhcannedmsg', 'function' => 'use'), - array('module' => 'lhcannedmsg', 'function' => 'see_global'), - array('module' => 'lhchat', 'function' => 'prev_chats'), - array('module' => 'lhchat', 'function' => 'allowopenclosedchats'), - array('module' => 'lhtheme', 'function' => 'personaltheme'), - array('module' => 'lhuser', 'function' => 'userlistonline'), - array('module' => 'lhspeech', 'function' => 'change_chat_recognition'), - array('module' => 'lhgroupchat', 'function' => 'use'), - array('module' => 'lhuser', 'function' => 'see_all_group_users'), - array('module' => 'lhvoicevideo', 'function' => 'use'), - array('module' => 'lhtheme', 'function' => 'use_operator'), - array('module' => 'lhgenericbot', 'function' => 'use_operator'), - ); + $permissionsArray = [ + ['module' => 'lhuser', 'function' => 'selfedit'], + ['module' => 'lhuser', 'function' => 'change_chat_nickname'], + ['module' => 'lhuser', 'function' => 'changephoto'], + ['module' => 'lhuser', 'function' => 'change_job_title'], + ['module' => 'lhuser', 'function' => 'change_core_attributes'], + ['module' => 'lhuser', 'function' => 'change_name_surname'], + ['module' => 'lhuser', 'function' => 'selfedit'], + ['module' => 'lhuser', 'function' => 'changeonlinestatus'], + ['module' => 'lhuser', 'function' => 'changeskypenick'], + ['module' => 'lhuser', 'function' => 'personalcannedmsg'], + ['module' => 'lhuser', 'function' => 'change_visibility_list'], + ['module' => 'lhuser', 'function' => 'see_assigned_departments'], + ['module' => 'lhuser', 'function' => 'canseedepartmentstats'], + ['module' => 'lhchat', 'function' => 'use'], + ['module' => 'lhchat', 'function' => 'open_all'], + ['module' => 'lhchat', 'function' => 'chattabschrome'], + ['module' => 'lhchat', 'function' => 'singlechatwindow'], + ['module' => 'lhchat', 'function' => 'allowopenremotechat'], + ['module' => 'lhchat', 'function' => 'writeremotechat'], + ['module' => 'lhchat', 'function' => 'allowchattabs'], + ['module' => 'lhchat', 'function' => 'use_onlineusers'], + ['module' => 'lhchat', 'function' => 'take_screenshot'], + ['module' => 'lhchat', 'function' => 'editprevious'], + ['module' => 'lhfront', 'function' => 'use'], + ['module' => 'lhsystem', 'function' => 'use'], + ['module' => 'lhtranslation', 'function' => 'use'], + ['module' => 'lhchat', 'function' => 'allowblockusers'], + ['module' => 'lhsystem', 'function' => 'generatejs'], + ['module' => 'lhsystem', 'function' => 'changelanguage'], + ['module' => 'lhchat', 'function' => 'allowredirect'], + ['module' => 'lhchat', 'function' => 'allowtransfer'], + ['module' => 'lhchat', 'function' => 'allowtransferdirectly'], + ['module' => 'lhchat', 'function' => 'administratecannedmsg'], + ['module' => 'lhchat', 'function' => 'explorecannedmsg'], + ['module' => 'lhchat', 'function' => 'sees_all_online_visitors'], + ['module' => 'lhchat', 'function' => 'list_all_chats'], + ['module' => 'lhchat', 'function' => 'use_unhidden_phone'], + ['module' => 'lhchat', 'function' => 'chat_see_email'], + ['module' => 'lhchat', 'function' => 'chat_see_unhidden_email'], + ['module' => 'lhchat', 'function' => 'see_sensitive_information'], + ['module' => 'lhchat', 'function' => 'whispermode'], + ['module' => 'lhpermission', 'function' => 'see_permissions'], + ['module' => 'lhquestionary', 'function' => 'manage_questionary'], + ['module' => 'lhfaq', 'function' => 'manage_faq'], + ['module' => 'lhchatbox', 'function' => 'manage_chatbox'], + ['module' => 'lhbrowseoffer', 'function' => 'manage_bo'], + ['module' => 'lhxml', 'function' => '*'], + ['module' => 'lhcobrowse', 'function' => 'browse'], + ['module' => 'lhfile', 'function' => 'use_operator'], + ['module' => 'lhfile', 'function' => 'file_delete_chat'], + ['module' => 'lhstatistic', 'function' => 'use'], + ['module' => 'lhspeech', 'function' => 'changedefaultlanguage'], + ['module' => 'lhspeech', 'function' => 'use'], + ['module' => 'lhcannedmsg', 'function' => 'use'], + ['module' => 'lhcannedmsg', 'function' => 'see_global'], + ['module' => 'lhchat', 'function' => 'prev_chats'], + ['module' => 'lhchat', 'function' => 'allowopenclosedchats'], + ['module' => 'lhtheme', 'function' => 'personaltheme'], + ['module' => 'lhuser', 'function' => 'userlistonline'], + ['module' => 'lhspeech', 'function' => 'change_chat_recognition'], + ['module' => 'lhgroupchat', 'function' => 'use'], + ['module' => 'lhuser', 'function' => 'see_all_group_users'], + ['module' => 'lhvoicevideo', 'function' => 'use'], + ['module' => 'lhtheme', 'function' => 'use_operator'], + ['module' => 'lhgenericbot', 'function' => 'use_operator'], + ]; foreach ($permissionsArray as $paramsPermission) { $RoleFunctionOperator = new erLhcoreClassModelRoleFunction(); @@ -3066,7 +3066,7 @@ $Result['content'] = $tpl->fetch(); $Result['pagelayout'] = 'install'; - $Result['path'] = array(array('title' => 'Live helper chat installation')); + $Result['path'] = [['title' => 'Live helper chat installation']]; } catch (Exception $e) { echo "Make sure that "cache/*" is writable and then try again"; @@ -3076,4 +3076,3 @@ echo ""; exit; } -?> diff --git a/lhc_web/modules/lhinstall/module.php b/lhc_web/modules/lhinstall/module.php index b723351b3f..126a993de0 100644 --- a/lhc_web/modules/lhinstall/module.php +++ b/lhc_web/modules/lhinstall/module.php @@ -1,14 +1,12 @@ "Live helper Chat installer"); +$Module = ['name' => 'Live helper Chat installer']; -$ViewList = array(); +$ViewList = [ + 'install' => [ + 'script' => 'install.php', + 'params' => ['step_id'], + ], +]; -$ViewList['install'] = array( - 'script' => 'install.php', - 'params' => array('step_id') -); - -$FunctionList = array(); - -?> \ No newline at end of file +$FunctionList = []; diff --git a/lhc_web/modules/lhmailarchive/list.php b/lhc_web/modules/lhmailarchive/list.php index 7562ed1e4b..972593e4a3 100644 --- a/lhc_web/modules/lhmailarchive/list.php +++ b/lhc_web/modules/lhmailarchive/list.php @@ -8,9 +8,9 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = \LiveHelperChat\Models\mailConv\Archive\Range::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC')); + $items = \LiveHelperChat\Models\mailConv\Archive\Range::getList(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC']); } $tpl->set('items',$items); @@ -18,9 +18,8 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments','System configuration')), - array('url' => erLhcoreClassDesign::baseurl('mailarchive/archive'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/archive','Mail archive'))); -$Result['path'][] = array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/list','Archives list')); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')], + ['url' => erLhcoreClassDesign::baseurl('mailarchive/archive'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/archive', 'Mail archive')] +]; +$Result['path'][] = ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatarchive/list', 'Archives list')]; diff --git a/lhc_web/modules/lhmailarchive/module.php b/lhc_web/modules/lhmailarchive/module.php index 44c0645c14..8097f8971b 100644 --- a/lhc_web/modules/lhmailarchive/module.php +++ b/lhc_web/modules/lhmailarchive/module.php @@ -1,78 +1,58 @@ "Mail archive module"); - -$ViewList = array(); - -$ViewList['archive'] = array( - 'params' => array(), - 'functions' => array( 'archive' ) -); - -$ViewList['newarchive'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['configuration'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['list'] = array( - 'params' => array(), - 'functions' => array( 'archive' ) -); - -$ViewList['scheduledpurge'] = array( - 'params' => array(), - 'functions' => array( 'archive' ) -); - -$ViewList['scheduledpurgedelete'] = array( - 'params' => array('schedule', 'class'), - 'uparams' => array('csfr'), - 'functions' => array( 'archive' ) -); - -$ViewList['listarchivemails'] = array( - 'params' => array('id'), - 'uparams' => array('is_external','ipp','timefromts','opened','phone','lang_ids','is_followup','sortby','conversation_status_ids','undelivered','view','has_attachment','mailbox_ids','conversation_id','subject','department_ids','department_group_ids','user_ids','group_ids','subject_id','wait_time_from','wait_time_till','conversation_id','nick','email','timefrom','timeto','user_id','export','conversation_status','hum','product_id','timefrom','timefrom_minutes','timefrom_hours','timeto', 'timeto_minutes', 'timeto_hours', 'department_group_id', 'group_id'), - 'functions' => array( 'archive' ), - 'multiple_arguments' => array( - 'department_ids', - 'department_group_ids', - 'user_ids', - 'group_ids', - 'bot_ids', - 'mailbox_ids', - 'conversation_status_ids', - 'lang_ids', - 'subject_id' - ) -); - -$ViewList['edit'] = array( - 'params' => array('id'), - 'functions' => array( 'configuration' ) -); - -$ViewList['process'] = array( - 'params' => array('id'), - 'functions' => array( 'configuration' ) -); - -$ViewList['startarchive'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$ViewList['archivechats'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$FunctionList['archive'] = array('explain' => 'Allow user to use archive functionality'); -$FunctionList['configuration'] = array('explain' => 'Allow user to configure archive'); - -?> \ No newline at end of file +$Module = ['name' => 'Mail archive module']; + +$ViewList = [ + 'archive' => [ + 'params' => [], + 'functions' => ['archive'], + ], + 'newarchive' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'configuration' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'list' => [ + 'params' => [], + 'functions' => ['archive'], + ], + 'scheduledpurge' => [ + 'params' => [], + 'functions' => ['archive'], + ], + 'scheduledpurgedelete' => [ + 'params' => ['schedule', 'class'], + 'uparams' => ['csfr'], + 'functions' => ['archive'], + ], + 'listarchivemails' => [ + 'params' => ['id'], + 'uparams' => ['is_external', 'ipp', 'timefromts', 'opened', 'phone', 'lang_ids', 'is_followup', 'sortby', 'conversation_status_ids', 'undelivered', 'view', 'has_attachment', 'mailbox_ids', 'conversation_id', 'subject', 'department_ids', 'department_group_ids', 'user_ids', 'group_ids', 'subject_id', 'wait_time_from', 'wait_time_till', 'conversation_id', 'nick', 'email', 'timefrom', 'timeto', 'user_id', 'export', 'conversation_status', 'hum', 'product_id', 'timefrom', 'timefrom_minutes', 'timefrom_hours', 'timeto', 'timeto_minutes', 'timeto_hours', 'department_group_id', 'group_id'], + 'functions' => ['archive'], + 'multiple_arguments' => ['department_ids', 'department_group_ids', 'user_ids', 'group_ids', 'bot_ids', 'mailbox_ids', 'conversation_status_ids', 'lang_ids', 'subject_id'], + ], + 'edit' => [ + 'params' => ['id'], + 'functions' => ['configuration'], + ], + 'process' => [ + 'params' => ['id'], + 'functions' => ['configuration'], + ], + 'startarchive' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'archivechats' => [ + 'params' => [], + 'functions' => ['configuration'], + ], +]; + +$FunctionList = [ + 'archive' => ['explain' => 'Allow user to use archive functionality'], + 'configuration' => ['explain' => 'Allow user to configure archive'], +]; diff --git a/lhc_web/modules/lhmailconv/module.php b/lhc_web/modules/lhmailconv/module.php index 27975ddf8c..9a08a87a09 100644 --- a/lhc_web/modules/lhmailconv/module.php +++ b/lhc_web/modules/lhmailconv/module.php @@ -1,445 +1,364 @@ "Mail conversation module"); - -$ViewList = array(); - -$ViewList['index'] = array( - 'params' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['uploadimage'] = array( - 'params' => array(), - 'uparams' => array('csrf'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['tpx'] = array( - 'params' => array('id') -); - -$ViewList['sendemail'] = array( - 'params' => array(), - 'uparams' => array('chat_id','layout','var1','var2','var3','var4'), - 'functions' => array( 'send_mail' ) -); - -$ViewList['geticketbymessageid'] = array( - 'params' => array(), - 'functions' => array( 'send_mail' ) -); - -$ViewList['getsignature'] = array( - 'params' => array(), - 'functions' => array( 'send_mail' ) -); - -$ViewList['uploadfile'] = array( - 'params' => array(), - 'uparams' => array('csrf'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['attatchfiledata'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['mailbox'] = array( - 'params' => array(), - 'uparams' => array('mail','failed','sync_status','active','csfr','resetstatus'), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['personalmailboxgroups'] = array( - 'params' => array(), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['newpersonalmailboxgroup'] = array( - 'params' => array(), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['editpersonalmailboxgroup'] = array( - 'params' => array('id'), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['inlinedownload'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['manualimport'] = array( - 'params' => array(), - 'uparams' => array('id', 'action', 'csfr'), - 'functions' => array('use_admin') -); - -$ViewList['inlinedownloadmodal'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['verifyaccess'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['previewmail'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['transfermail'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['changemailbox'] = array( - 'params' => array('id'), - 'functions' => array( 'change_mailbox' ) -); - -$ViewList['merge'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['blocksender'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apiunmerge'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apimaildownload'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'can_download' ) -); - -$ViewList['apisendreply'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apifetchmails'] = array( - 'params' => array('id','ts'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['attatchfile'] = array( - 'params' => array(), - 'uparams' => array('persistent','user_id','visitor','upload_name','attachment'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['insertfile'] = array( - 'params' => array('id'), - 'uparams' => array('mode'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['searchtemplate'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['attachtemplate'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['getreplydata'] = array( - 'params' => array('id','mode'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['mailprint'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['downloadrfc822'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['mailprintcovnersation'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['view'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['single'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apinoreplyrequired'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['loadmessagebody'] = array( - 'params' => array('id','id_conv'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apilabelmessage'] = array( - 'params' => array('id'), - 'uparams' => array('subject','status'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apigetlabels'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apicloseconversation'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apichangestatus'] = array( - 'params' => array('id','status'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['apideleteconversation'] = array( - 'params' => array('id'), - 'functions' => array( 'delete_conversation' ) -); - -$ViewList['loadmainconv'] = array( - 'params' => array('id'), - 'uparams' => array('mode'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['saveremarks'] = array( - 'params' => array('id'), - 'uparams' => array('type'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['mailhistory'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['conversations'] = array( - 'params' => array(), - 'uparams' => array( - 'group_conv','timefrom_type','ids','is_external','ipp','timefromts','opened','phone','lang_ids','is_followup','sortby','conversation_status_ids','undelivered','view', - 'has_attachment','mailbox_ids','conversation_id','subject','department_ids','department_group_ids','user_ids','group_ids','subject_id','wait_time_from','wait_time_till', - 'nick','email','timefrom','timeto','user_id','export','conversation_status','hum','product_id','timefrom','timefrom_minutes','timefrom_hours','timefrom_seconds','timeto', - 'timeto_minutes','timeto_hours','timeto_seconds','department_group_id','group_id','message_id' - ), - 'functions' => array( 'use_admin' ), - 'multiple_arguments' => array( - 'department_ids', - 'department_group_ids', - 'user_ids', - 'group_ids', - 'bot_ids', - 'mailbox_ids', - 'conversation_status_ids', - 'lang_ids', - 'subject_id', - 'ids' - ) -); - -$ViewList['newmailbox'] = array( - 'params' => array(), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['syncmailbox'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['matchingrules'] = array( - 'params' => array(), - 'uparams' => array('department_ids','department_group_ids','mailbox_ids','from_name','from_mail','subject_contains'), - 'functions' => array( 'mrules_manage' ), - 'multiple_arguments' => array( - 'department_ids', - 'department_group_ids', - 'mailbox_ids' - ) -); - -$ViewList['newmatchrule'] = array( - 'params' => array(), - 'functions' => array( 'mrules_manage' ) -); - -$ViewList['editmailbox'] = array( - 'params' => array('id'), - 'uparams' => array('action'), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['editmatchrule'] = array( - 'params' => array('id'), - 'functions' => array( 'mrules_manage' ) -); - -$ViewList['deletemailbox'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['deleteconversation'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['deleteresponsetemplate'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'rtemplates_manage' ) -); - -$ViewList['deletematchingrule'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'mrules_manage' ) -); - -$ViewList['responsetemplates'] = array( - 'params' => array(), - 'uparams' => array('name','template_plain','template','dep_id','subject_id'), - 'functions' => array( 'rtemplates_see' ), - 'multiple_arguments' => array( - 'dep_id', - 'subject_id' - ) -); - -$ViewList['pendingimport'] = array( - 'params' => array(), - 'uparams' => array('mailbox_id','uid','status'), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['subject'] = array( - 'params' => array('id'), - 'uparams' => array('subject','status'), - 'functions' => array( 'use_admin' ), -); - -$ViewList['addsubjectbytemplate'] = array( - 'params' => array('message_id', 'template_id'), - 'uparams' => array(), - 'functions' => array( 'use_admin' ), -); - -$ViewList['apiresponsetemplates'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['newresponsetemplate'] = array( - 'params' => array(), - 'functions' => array( 'rtemplates_manage' ) -); - -$ViewList['editresponsetemplate'] = array( - 'params' => array('id'), - 'functions' => array( 'rtemplates_manage' ) -); - -$ViewList['previewresponsetemplate'] = array( - 'params' => array('id'), - 'functions' => array( 'rtemplates_see' ) -); - -$ViewList['notifications'] = array( - 'params' => array(), - 'functions' => array( 'use_alarms' ) -); - -$ViewList['options'] = array( - 'params' => array(), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['optionsgeneral'] = array( - 'params' => array(), - 'functions' => array( 'mailbox_manage' ) -); - -$ViewList['importtemplate'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_import' ), -); - -$ViewList['relatedtickets'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'closerelated' ), -); - -$FunctionList = array(); -$FunctionList['use_admin'] = array('explain' => 'Permission to use mail conversation module'); -$FunctionList['mailbox_manage'] = array('explain' => 'Permission to manage mailbox'); -$FunctionList['mrules_manage'] = array('explain' => 'Permission to manage matching rules'); -$FunctionList['rtemplates_manage'] = array('explain' => 'Permission to manage response templates'); -$FunctionList['rtemplates_see'] = array('explain' => 'Permission to see response templates'); -$FunctionList['use_alarms'] = array('explain' => 'Permission to use alarm widget'); -$FunctionList['delete_conversation'] = array('explain' => 'Permission to delete conversation'); -$FunctionList['close_all_conversation'] = array('explain' => 'Permission to close conversation even if operator is not an owner of it'); -$FunctionList['send_mail'] = array('explain' => 'Allow operator to send an e-mail'); -$FunctionList['allow_attach_files'] = array('explain' => 'Allow operator to attach files'); -$FunctionList['manage_reply_recipients'] = array('explain' => 'Allow operator to change recipient'); -$FunctionList['changedepartment'] = array('explain' => 'Allow operator to change department'); -$FunctionList['changeowner'] = array('explain' => 'Allow operator to change owner of the e-mail'); -$FunctionList['allowtransfer'] = array('explain' =>'Allow user to transfer chat to another user/department'); -$FunctionList['use_import'] = array('explain' =>'Allow user import response templates'); -$FunctionList['send_as_new'] = array('explain' =>'Allow user to reply an email as SEnd as New'); -$FunctionList['export_mails'] = array('explain' => 'Allow operator to export filtered mails'); -$FunctionList['quick_actions'] = array('explain' => 'Allow operator to user quick actions module'); -$FunctionList['change_mailbox'] = array('explain' => 'Allow operator to change mail mailbox'); -$FunctionList['include_images'] = array('explain' => 'Allow operator include images from the original e-mail'); -$FunctionList['closerelated'] = array('explain' => 'Allow operator to close related e-mail tickets based on e-mail'); -$FunctionList['use_pmailsw'] = array('explain' => 'Allow operator to use pending mails widget.'); -$FunctionList['list_all_mails'] = array('explain' => 'Allow operator to list all mails independently of operator and status.'); -$FunctionList['list_my_mails'] = array('explain' => 'Allow operator to list mails they are owner of'); -$FunctionList['list_pending_mails'] = array('explain' => 'Allow operator to list mails without an owner and in status pending.'); -$FunctionList['mail_see_unhidden_email'] = array('explain' => 'Allow operator to see full e-mail address.'); -$FunctionList['phone_see_unhidden'] = array('explain' => 'Allow operator to see full phone number.'); -$FunctionList['have_phone_link'] = array('explain' => 'Allow operator to click phone number as a link. Phone number will be exposed.'); -$FunctionList['mail_export'] = array('explain' => 'Allow operator to see e-mail address in exported file'); -$FunctionList['phone_export'] = array('explain' => 'Allow operator to see phone in exported file'); -$FunctionList['send_as_forward'] = array('explain' => 'Allow operator to forward mail message.'); -$FunctionList['can_download'] = array('explain' => 'Allow operator to download raw mail message.'); -$FunctionList['export_variables'] = array('explain' => 'Allow operator export mail variable.'); -$FunctionList['open_all'] = array('explain' => 'Allow operator to open all pending mails, not only assigned to him'); -$FunctionList['open_unassigned_mail'] = array('explain' => 'Allow operator to open unassigned pending mail'); -$FunctionList['download_unverified'] = array('explain' => 'Allow operators to download unverified files'); -$FunctionList['download_verified'] = array('explain' => 'Allow operators to download verified, but sensitive files'); -$FunctionList['download_restricted'] = array('explain' => 'Allow operators to download restricted file types'); -$FunctionList['reply_to_all'] = array('explain' => 'Allow operators to set `Reply To` to any mail in new mail form. Otherwise configured mailbox will be required.'); -$FunctionList['merge_cross_departments'] = array('explain' => 'Allow operators to merge mails across different departments.'); - -?> \ No newline at end of file +$Module = ['name' => 'Mail conversation module']; + +$ViewList = [ + 'index' => [ + 'params' => [], + 'functions' => ['use_admin'], + ], + 'uploadimage' => [ + 'params' => [], + 'uparams' => ['csrf'], + 'functions' => ['use_admin'], + ], + 'tpx' => [ + 'params' => ['id'], + ], + 'sendemail' => [ + 'params' => [], + 'uparams' => ['chat_id', 'layout', 'var1', 'var2', 'var3', 'var4'], + 'functions' => ['send_mail'], + ], + 'geticketbymessageid' => [ + 'params' => [], + 'functions' => ['send_mail'], + ], + 'getsignature' => [ + 'params' => [], + 'functions' => ['send_mail'], + ], + 'uploadfile' => [ + 'params' => [], + 'uparams' => ['csrf'], + 'functions' => ['use_admin'], + ], + 'attatchfiledata' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'mailbox' => [ + 'params' => [], + 'uparams' => ['mail', 'failed', 'sync_status', 'active', 'csfr', 'resetstatus'], + 'functions' => ['mailbox_manage'], + ], + 'personalmailboxgroups' => [ + 'params' => [], + 'functions' => ['mailbox_manage'], + ], + 'newpersonalmailboxgroup' => [ + 'params' => [], + 'functions' => ['mailbox_manage'], + ], + 'editpersonalmailboxgroup' => [ + 'params' => ['id'], + 'functions' => ['mailbox_manage'], + ], + 'inlinedownload' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['use_admin'], + ], + 'manualimport' => [ + 'params' => [], + 'uparams' => ['id', 'action', 'csfr'], + 'functions' => ['use_admin'], + ], + 'inlinedownloadmodal' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['use_admin'], + ], + 'verifyaccess' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['use_admin'], + ], + 'previewmail' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'transfermail' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'changemailbox' => [ + 'params' => ['id'], + 'functions' => ['change_mailbox'], + ], + 'merge' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'blocksender' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'apiunmerge' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'apimaildownload' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['can_download'], + ], + 'apisendreply' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'apifetchmails' => [ + 'params' => ['id', 'ts'], + 'functions' => ['use_admin'], + ], + 'attatchfile' => [ + 'params' => [], + 'uparams' => ['persistent', 'user_id', 'visitor', 'upload_name', 'attachment'], + 'functions' => ['use_admin'], + ], + 'insertfile' => [ + 'params' => ['id'], + 'uparams' => ['mode'], + 'functions' => ['use_admin'], + ], + 'searchtemplate' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'attachtemplate' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'getreplydata' => [ + 'params' => ['id', 'mode'], + 'functions' => ['use_admin'], + ], + 'mailprint' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['use_admin'], + ], + 'downloadrfc822' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['use_admin'], + ], + 'mailprintcovnersation' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'view' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'single' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'apinoreplyrequired' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'loadmessagebody' => [ + 'params' => ['id', 'id_conv'], + 'functions' => ['use_admin'], + ], + 'apilabelmessage' => [ + 'params' => ['id'], + 'uparams' => ['subject', 'status'], + 'functions' => ['use_admin'], + ], + 'apigetlabels' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'apicloseconversation' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'apichangestatus' => [ + 'params' => ['id', 'status'], + 'functions' => ['use_admin'], + ], + 'apideleteconversation' => [ + 'params' => ['id'], + 'functions' => ['delete_conversation'], + ], + 'loadmainconv' => [ + 'params' => ['id'], + 'uparams' => ['mode'], + 'functions' => ['use_admin'], + ], + 'saveremarks' => [ + 'params' => ['id'], + 'uparams' => ['type'], + 'functions' => ['use_admin'], + ], + 'mailhistory' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'conversations' => [ + 'params' => [], + 'uparams' => [ + 'group_conv', 'timefrom_type', 'ids', 'is_external', 'ipp', 'timefromts', 'opened', 'phone', 'lang_ids', + 'is_followup', 'sortby', 'conversation_status_ids', 'undelivered', 'view', 'has_attachment', 'mailbox_ids', + 'conversation_id', 'subject', 'department_ids', 'department_group_ids', 'user_ids', 'group_ids', + 'subject_id', 'wait_time_from', 'wait_time_till', 'nick', 'email', 'timefrom', 'timeto', 'user_id', + 'export', 'conversation_status', 'hum', 'product_id', 'timefrom', 'timefrom_minutes', 'timefrom_hours', + 'timefrom_seconds', 'timeto', 'timeto_minutes', 'timeto_hours', 'timeto_seconds', 'department_group_id', + 'group_id', 'message_id', + ], + 'functions' => ['use_admin'], + 'multiple_arguments' => [ + 'department_ids', 'department_group_ids', 'user_ids', 'group_ids', 'bot_ids', 'mailbox_ids', + 'conversation_status_ids', 'lang_ids', 'subject_id', 'ids', + ], + ], + 'newmailbox' => [ + 'params' => [], + 'functions' => ['mailbox_manage'], + ], + 'syncmailbox' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'matchingrules' => [ + 'params' => [], + 'uparams' => ['department_ids', 'department_group_ids', 'mailbox_ids', 'from_name', 'from_mail', 'subject_contains'], + 'functions' => ['mrules_manage'], + 'multiple_arguments' => ['department_ids', 'department_group_ids', 'mailbox_ids'], + ], + 'newmatchrule' => [ + 'params' => [], + 'functions' => ['mrules_manage'], + ], + 'editmailbox' => [ + 'params' => ['id'], + 'uparams' => ['action'], + 'functions' => ['mailbox_manage'], + ], + 'editmatchrule' => [ + 'params' => ['id'], + 'functions' => ['mrules_manage'], + ], + 'deletemailbox' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['mailbox_manage'], + ], + 'deleteconversation' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_admin'], + ], + 'deleteresponsetemplate' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['rtemplates_manage'], + ], + 'deletematchingrule' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['mrules_manage'], + ], + 'responsetemplates' => [ + 'params' => [], + 'uparams' => ['name', 'template_plain', 'template', 'dep_id', 'subject_id'], + 'functions' => ['rtemplates_see'], + 'multiple_arguments' => ['dep_id', 'subject_id'], + ], + 'pendingimport' => [ + 'params' => [], + 'uparams' => ['mailbox_id', 'uid', 'status'], + 'functions' => ['mailbox_manage'], + ], + 'subject' => [ + 'params' => ['id'], + 'uparams' => ['subject', 'status'], + 'functions' => ['use_admin'], + ], + 'addsubjectbytemplate' => [ + 'params' => ['message_id', 'template_id'], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'apiresponsetemplates' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'newresponsetemplate' => [ + 'params' => [], + 'functions' => ['rtemplates_manage'], + ], + 'editresponsetemplate' => [ + 'params' => ['id'], + 'functions' => ['rtemplates_manage'], + ], + 'previewresponsetemplate' => [ + 'params' => ['id'], + 'functions' => ['rtemplates_see'], + ], + 'notifications' => [ + 'params' => [], + 'functions' => ['use_alarms'], + ], + 'options' => [ + 'params' => [], + 'functions' => ['mailbox_manage'], + ], + 'optionsgeneral' => [ + 'params' => [], + 'functions' => ['mailbox_manage'], + ], + 'importtemplate' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_import'], + ], + 'relatedtickets' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['closerelated'], + ], +]; + +$FunctionList = [ + 'use_admin' => ['explain' => 'Permission to use mail conversation module'], + 'mailbox_manage' => ['explain' => 'Permission to manage mailbox'], + 'mrules_manage' => ['explain' => 'Permission to manage matching rules'], + 'rtemplates_manage' => ['explain' => 'Permission to manage response templates'], + 'rtemplates_see' => ['explain' => 'Permission to see response templates'], + 'use_alarms' => ['explain' => 'Permission to use alarm widget'], + 'delete_conversation' => ['explain' => 'Permission to delete conversation'], + 'close_all_conversation' => ['explain' => 'Permission to close conversation even if operator is not an owner of it'], + 'send_mail' => ['explain' => 'Allow operator to send an e-mail'], + 'allow_attach_files' => ['explain' => 'Allow operator to attach files'], + 'manage_reply_recipients' => ['explain' => 'Allow operator to change recipient'], + 'changedepartment' => ['explain' => 'Allow operator to change department'], + 'changeowner' => ['explain' => 'Allow operator to change owner of the e-mail'], + 'allowtransfer' => ['explain' => 'Allow user to transfer chat to another user/department'], + 'use_import' => ['explain' => 'Allow user import response templates'], + 'send_as_new' => ['explain' => 'Allow user to reply an email as SEnd as New'], + 'export_mails' => ['explain' => 'Allow operator to export filtered mails'], + 'quick_actions' => ['explain' => 'Allow operator to user quick actions module'], + 'change_mailbox' => ['explain' => 'Allow operator to change mail mailbox'], + 'include_images' => ['explain' => 'Allow operator include images from the original e-mail'], + 'closerelated' => ['explain' => 'Allow operator to close related e-mail tickets based on e-mail'], + 'use_pmailsw' => ['explain' => 'Allow operator to use pending mails widget.'], + 'list_all_mails' => ['explain' => 'Allow operator to list all mails independently of operator and status.'], + 'list_my_mails' => ['explain' => 'Allow operator to list mails they are owner of'], + 'list_pending_mails' => ['explain' => 'Allow operator to list mails without an owner and in status pending.'], + 'mail_see_unhidden_email' => ['explain' => 'Allow operator to see full e-mail address.'], + 'phone_see_unhidden' => ['explain' => 'Allow operator to see full phone number.'], + 'have_phone_link' => ['explain' => 'Allow operator to click phone number as a link. Phone number will be exposed.'], + 'mail_export' => ['explain' => 'Allow operator to see e-mail address in exported file'], + 'phone_export' => ['explain' => 'Allow operator to see phone in exported file'], + 'send_as_forward' => ['explain' => 'Allow operator to forward mail message.'], + 'can_download' => ['explain' => 'Allow operator to download raw mail message.'], + 'export_variables' => ['explain' => 'Allow operator export mail variable.'], + 'open_all' => ['explain' => 'Allow operator to open all pending mails, not only assigned to him'], + 'open_unassigned_mail' => ['explain' => 'Allow operator to open unassigned pending mail'], + 'download_unverified' => ['explain' => 'Allow operators to download unverified files'], + 'download_verified' => ['explain' => 'Allow operators to download verified, but sensitive files'], + 'download_restricted' => ['explain' => 'Allow operators to download restricted file types'], + 'reply_to_all' => ['explain' => 'Allow operators to set `Reply To` to any mail in new mail form. Otherwise configured mailbox will be required.'], + 'merge_cross_departments' => ['explain' => 'Allow operators to merge mails across different departments.'], +]; diff --git a/lhc_web/modules/lhmailconvoauth/module.php b/lhc_web/modules/lhmailconvoauth/module.php index acd2f16e1a..c029b98ebe 100644 --- a/lhc_web/modules/lhmailconvoauth/module.php +++ b/lhc_web/modules/lhmailconvoauth/module.php @@ -1,25 +1,22 @@ "Mail conversation OAuth module"); +$Module = ['name' => 'Mail conversation OAuth module']; -$ViewList = array(); +$ViewList = [ + 'mslogin' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'options' => [ + 'params' => [], + 'functions' => ['manage_oauth'], + ], + 'msoauth' => [ + 'params' => [], + ], +]; -$ViewList['mslogin'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['options'] = array( - 'params' => array(), - 'functions' => array( 'manage_oauth' ) -); - -$ViewList['msoauth'] = array( - 'params' => array() -); - -$FunctionList = array(); -$FunctionList['use_admin'] = array('explain' => 'Permission to use mail conversation OAuth module'); -$FunctionList['manage_oauth'] = array('explain' => 'Permission to use mail conversation OAuth module'); - -?> \ No newline at end of file +$FunctionList = [ + 'use_admin' => ['explain' => 'Permission to use mail conversation OAuth module'], + 'manage_oauth' => ['explain' => 'Permission to use mail conversation OAuth module'], +]; diff --git a/lhc_web/modules/lhmailconvoauth/options.php b/lhc_web/modules/lhmailconvoauth/options.php index fff004c183..1c4f506ae2 100644 --- a/lhc_web/modules/lhmailconvoauth/options.php +++ b/lhc_web/modules/lhmailconvoauth/options.php @@ -3,16 +3,16 @@ $tpl = erLhcoreClassTemplate::getInstance('lhmailconvoauth/options.tpl.php'); $ms_options = erLhcoreClassModelChatConfig::fetch('mailconv_oauth_options'); -$data = (array)$ms_options->data; +$data = (array) $ms_options->data; -if ( isset($_POST['StoreOptions']) ) { +if (isset($_POST['StoreOptions'])) { if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) { erLhcoreClassModule::redirect('mailconv/optionsgeneral'); exit; } - $definition = array( + $definition = [ 'ms_tenant_id' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ), @@ -22,24 +22,24 @@ 'ms_secret' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ) - ); + ]; - $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $form = new ezcInputForm(INPUT_POST, $definition); + $Errors = []; - if ( $form->hasValidData( 'ms_tenant_id' ) ) { + if ($form->hasValidData('ms_tenant_id')) { $data['ms_tenant_id'] = $form->ms_tenant_id; } else { $data['ms_tenant_id'] = ''; } - if ( $form->hasValidData( 'ms_client_id' )) { + if ($form->hasValidData('ms_client_id')) { $data['ms_client_id'] = $form->ms_client_id; } else { $data['ms_client_id'] = ''; } - if ( $form->hasValidData( 'ms_secret' )) { + if ($form->hasValidData('ms_secret')) { $data['ms_secret'] = $form->ms_secret; } else { $data['ms_secret'] = ''; @@ -59,14 +59,12 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array( +$Result['path'] = [ + [ 'url' => erLhcoreClassDesign::baseurl('system/configuration') . '#!#mailconv', 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('lhelasticsearch/module', 'System configuration') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('lhelasticsearch/module', 'Options') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhmailing/module.php b/lhc_web/modules/lhmailing/module.php index a572f4f87b..acba121d23 100644 --- a/lhc_web/modules/lhmailing/module.php +++ b/lhc_web/modules/lhmailing/module.php @@ -1,127 +1,107 @@ "Mailing module"); - -$ViewList = array(); - -$ViewList['mailinglist'] = array( - 'params' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['mailingrecipient'] = array( - 'params' => array(), - 'uparams' => array('ml'), - 'functions' => array( 'use_admin' ), - 'multiple_arguments' => array('ml') -); - -$ViewList['campaign'] = array( - 'params' => array(), - 'uparams' => array('id','action'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['newcampaign'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['newcampaignrecipient'] = array( - 'params' => array('id','recipient_id'), - 'uparams' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['campaignrecipient'] = array( - 'params' => array(), - 'uparams' => array('campaign','export','status','opened'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['deleterecipient'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['newmailingrecipient'] = array( - 'params' => array(), - 'uparams' => array('ml'), - 'functions' => array( 'use_admin' ), - 'multiple_arguments' => array('ml') -); - -$ViewList['editmailingrecipient'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['newmailinglist'] = array( - 'params' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['editmailinglist'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['editcampaign'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['importfrommailinglist'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['deletemailinglist'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['deletecampaign'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['deletecampaignrecipient'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['detailssend'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['sendtestemail'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_admin' ) -); - -$ViewList['import'] = array( - 'params' => array(), - 'uparams' => array('ml'), - 'functions' => array( 'use_admin' ), - 'multiple_arguments' => array('ml') -); - -$ViewList['importcampaign'] = array( - 'params' => array('id'), - 'functions' => array( 'use_admin' ) -); - -$FunctionList = array(); -$FunctionList['use_admin'] = array('explain' => 'Permission to use mailing module'); -$FunctionList['all_campaigns'] = array('explain' => 'Operator can see all campaigns'); -$FunctionList['all_mailing_list'] = array('explain' => 'Operator can see all mailing list'); - -?> \ No newline at end of file +$Module = ['name' => 'Mailing module']; + +$ViewList = [ + 'mailinglist' => [ + 'params' => [], + 'functions' => ['use_admin'], + ], + 'mailingrecipient' => [ + 'params' => [], + 'uparams' => ['ml'], + 'functions' => ['use_admin'], + 'multiple_arguments' => ['ml'], + ], + 'campaign' => [ + 'params' => [], + 'uparams' => ['id', 'action'], + 'functions' => ['use_admin'], + ], + 'newcampaign' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'newcampaignrecipient' => [ + 'params' => ['id', 'recipient_id'], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'campaignrecipient' => [ + 'params' => [], + 'uparams' => ['campaign', 'export', 'status', 'opened'], + 'functions' => ['use_admin'], + ], + 'deleterecipient' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_admin'], + ], + 'newmailingrecipient' => [ + 'params' => [], + 'uparams' => ['ml'], + 'functions' => ['use_admin'], + 'multiple_arguments' => ['ml'], + ], + 'editmailingrecipient' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'newmailinglist' => [ + 'params' => [], + 'functions' => ['use_admin'], + ], + 'editmailinglist' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'editcampaign' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'importfrommailinglist' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'deletemailinglist' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_admin'], + ], + 'deletecampaign' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_admin'], + ], + 'deletecampaignrecipient' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_admin'], + ], + 'detailssend' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], + 'sendtestemail' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_admin'], + ], + 'import' => [ + 'params' => [], + 'uparams' => ['ml'], + 'functions' => ['use_admin'], + 'multiple_arguments' => ['ml'], + ], + 'importcampaign' => [ + 'params' => ['id'], + 'functions' => ['use_admin'], + ], +]; + +$FunctionList = [ + 'use_admin' => ['explain' => 'Permission to use mailing module'], + 'all_campaigns' => ['explain' => 'Operator can see all campaigns'], + 'all_mailing_list' => ['explain' => 'Operator can see all mailing list'], +]; diff --git a/lhc_web/modules/lhmobile/module.php b/lhc_web/modules/lhmobile/module.php index 6dde3906b9..5445913304 100644 --- a/lhc_web/modules/lhmobile/module.php +++ b/lhc_web/modules/lhmobile/module.php @@ -1,30 +1,27 @@ "Mobile configuration"); - -$ViewList = array(); - -$ViewList['settings'] = array( - 'params' => array(), - 'functions' => array( 'manage' ) -); - -$ViewList['sessions'] = array( - 'params' => array(), - 'functions' => array( 'manage' ) -); - -$ViewList['editsession'] = array( - 'params' => array('id'), - 'functions' => array( 'manage' ) -); - -$ViewList['deletesession'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage' ) -); - -$FunctionList['manage'] = array('explain' => 'Allow operator to manage online sessions'); - -?> \ No newline at end of file +$Module = ['name' => 'Mobile configuration']; + +$ViewList = [ + 'settings' => [ + 'params' => [], + 'functions' => ['manage'], + ], + 'sessions' => [ + 'params' => [], + 'functions' => ['manage'], + ], + 'editsession' => [ + 'params' => ['id'], + 'functions' => ['manage'], + ], + 'deletesession' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage'], + ], +]; + +$FunctionList = [ + 'manage' => ['explain' => 'Allow operator to manage online sessions'], +]; diff --git a/lhc_web/modules/lhmobile/settings.php b/lhc_web/modules/lhmobile/settings.php index abf7717148..f3b1ffc98a 100644 --- a/lhc_web/modules/lhmobile/settings.php +++ b/lhc_web/modules/lhmobile/settings.php @@ -3,16 +3,16 @@ $tpl = erLhcoreClassTemplate::getInstance('lhmobile/settings.tpl.php'); $mbOptions = erLhcoreClassModelChatConfig::fetch('mobile_options'); -$data = (array)$mbOptions->data; +$data = (array) $mbOptions->data; -if ( isset($_POST['StoreOptions']) ) { +if (isset($_POST['StoreOptions'])) { if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) { erLhcoreClassModule::redirect('mobile/settings'); exit; } - $definition = array( + $definition = [ 'fcm_key' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ), @@ -23,41 +23,41 @@ ezcInputFormDefinitionElement::OPTIONAL, 'boolean' ), 'limit_p' => new ezcInputFormDefinitionElement( // Pending chats - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0] ), 'limit_a' => new ezcInputFormDefinitionElement( // Active chats - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0] ), 'limit_c' => new ezcInputFormDefinitionElement( // Closed chats - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0] ), 'limit_b' => new ezcInputFormDefinitionElement( // Bot chats - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0] ), 'limit_ov' => new ezcInputFormDefinitionElement( // Online visitors - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0] ), 'limit_op' => new ezcInputFormDefinitionElement( // Online operators - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0] ) - ); + ]; - $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $form = new ezcInputForm(INPUT_POST, $definition); + $Errors = []; - if ( $form->hasValidData( 'notifications' ) && $form->notifications == true ) { + if ($form->hasValidData('notifications') && $form->notifications == true) { $data['notifications'] = 1; } else { $data['notifications'] = 0; } - if ( $form->hasValidData( 'fcm_key' )) { - $data['fcm_key'] = $form->fcm_key ; + if ($form->hasValidData('fcm_key')) { + $data['fcm_key'] = $form->fcm_key; } else { $data['fcm_key'] = ''; } - if ( $form->hasValidData( 'use_local_service_file' ) && $form->use_local_service_file == true ) { + if ($form->hasValidData('use_local_service_file') && $form->use_local_service_file == true) { if ($data['use_local_service_file'] != 1) { // Reset FCM key so we generate it next time $data['fcm_key'] = ''; } @@ -70,7 +70,7 @@ } foreach (['limit_p','limit_a','limit_c','limit_b','limit_ov','limit_op'] as $field) { - if ( $form->hasValidData( $field )) { + if ( $form->hasValidData($field)) { $data[$field] = $form->$field ; } elseif (isset($data[$field])) { unset($data[$field]); @@ -87,21 +87,19 @@ $CacheManager = erConfigClassLhCacheConfig::getInstance(); $CacheManager->expireCache(true); - $tpl->set('updated','done'); + $tpl->set('updated', 'done'); } -$tpl->set('mb_options',$data); +$tpl->set('mb_options', $data); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array( +$Result['path'] = [ + [ 'url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('mobile/settings', 'Settings') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('mobile/settings', 'Mobile') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhnotifications/module.php b/lhc_web/modules/lhnotifications/module.php index 95ad25f32c..0b8ac5e07a 100644 --- a/lhc_web/modules/lhnotifications/module.php +++ b/lhc_web/modules/lhnotifications/module.php @@ -1,106 +1,89 @@ - "Notifications" ); - -$ViewList = array(); - -$ViewList['subscribe'] = array( - 'params' => array(), - 'uparams' => array('hash','vid','hash_resume','theme','action') -); - -$ViewList['subscribeop'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['list'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['oplist'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['index'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['read'] = array( - 'params' => array(), - 'uparams' => array('id','hash','theme','mode','hashread'), -); - -$ViewList['editsubscriber'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['editsubscriberop'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['downloadworker'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['downloadworkerop'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['settings'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['opsettings'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['deletesubscriber'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['opdeletesubscriber'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use' ) -); - -$ViewList['serviceworkerop'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['opdeletesubscribermy'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_operator' ) -); - -$ViewList['sendtest'] = array( - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'use_operator' ) -); - -$ViewList['loadsubscriptions'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_operator' ) -); - -$FunctionList['use'] = array('explain' => 'Notifications module'); -$FunctionList['use_operator'] = array('explain' => 'Allow operator to use push notifications'); - -?> \ No newline at end of file + 'Notifications']; + +$ViewList = [ + 'subscribe' => [ + 'params' => [], + 'uparams' => ['hash', 'vid', 'hash_resume', 'theme', 'action'], + ], + 'subscribeop' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'list' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'oplist' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'index' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'read' => [ + 'params' => [], + 'uparams' => ['id', 'hash', 'theme', 'mode', 'hashread'], + ], + 'editsubscriber' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'editsubscriberop' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'downloadworker' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'downloadworkerop' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'settings' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'opsettings' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'deletesubscriber' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'opdeletesubscriber' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use'], + ], + 'serviceworkerop' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use'], + ], + 'opdeletesubscribermy' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_operator'], + ], + 'sendtest' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['use_operator'], + ], + 'loadsubscriptions' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_operator'], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Notifications module'], + 'use_operator' => ['explain' => 'Allow operator to use push notifications'], +]; diff --git a/lhc_web/modules/lhnotifications/opsettings.php b/lhc_web/modules/lhnotifications/opsettings.php index fd92be9f41..05fbb653b6 100644 --- a/lhc_web/modules/lhnotifications/opsettings.php +++ b/lhc_web/modules/lhnotifications/opsettings.php @@ -12,7 +12,7 @@ exit; } - $definition = array( + $definition = [ 'enabled' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'boolean' ), @@ -43,10 +43,10 @@ 'private_key' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( $form->hasValidData( 'enabled' ) && $form->enabled == true ) { $data['enabled'] = 1; @@ -124,15 +124,13 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','System configuration')), - array( +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration', 'System configuration')], + [ 'url' => erLhcoreClassDesign::baseurl('notifications/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('notifications/index', 'Notifications') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('notifications/index', 'Operators settings') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhnotifications/settings.php b/lhc_web/modules/lhnotifications/settings.php index 2f9ee25233..47033d1c83 100644 --- a/lhc_web/modules/lhnotifications/settings.php +++ b/lhc_web/modules/lhnotifications/settings.php @@ -12,7 +12,7 @@ exit; } - $definition = array( + $definition = [ 'enabled' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'boolean' ), @@ -43,10 +43,10 @@ 'private_key' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( $form->hasValidData( 'enabled' ) && $form->enabled == true ) { $data['enabled'] = 1; @@ -124,15 +124,13 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','System configuration')), - array( +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','System configuration')], + [ 'url' => erLhcoreClassDesign::baseurl('notifications/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('notifications/index', 'Notifications') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('notifications/index', 'Settings') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhpaidchat/module.php b/lhc_web/modules/lhpaidchat/module.php index 1350b51d78..1592421eed 100644 --- a/lhc_web/modules/lhpaidchat/module.php +++ b/lhc_web/modules/lhpaidchat/module.php @@ -1,31 +1,27 @@ "Paid chats module", - 'variable_params' => true ); - -$ViewList = array(); - -$ViewList['settings'] = array ( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['expiredchat'] = array ( - 'params' => array('pchat'), - 'uparams' => array() -); - -$ViewList['removedpaidchat'] = array ( - 'params' => array('pchat'), - 'uparams' => array() -); - -$ViewList['invalidhash'] = array ( - 'params' => array('pchat'), - 'uparams' => array() -); - -$FunctionList['use_admin'] = array('explain' => 'General permission to configure paid chats module'); - -?> \ No newline at end of file +$Module = ['name' => 'Paid chats module', 'variable_params' => true]; + +$ViewList = [ + 'settings' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['use_admin'], + ], + 'expiredchat' => [ + 'params' => ['pchat'], + 'uparams' => [], + ], + 'removedpaidchat' => [ + 'params' => ['pchat'], + 'uparams' => [], + ], + 'invalidhash' => [ + 'params' => ['pchat'], + 'uparams' => [], + ], +]; + +$FunctionList = [ + 'use_admin' => ['explain' => 'General permission to configure paid chats module'], +]; diff --git a/lhc_web/modules/lhpaidchat/settings.php b/lhc_web/modules/lhpaidchat/settings.php index be6aba8936..5b7b839b70 100644 --- a/lhc_web/modules/lhpaidchat/settings.php +++ b/lhc_web/modules/lhpaidchat/settings.php @@ -1,45 +1,45 @@ data; +$data = (array) $paidchatData->data; -if ( isset($_POST['StoreChatboxSettings']) ) { +if (isset($_POST['StoreChatboxSettings'])) { - $definition = array( - 'SecretHash' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'string' - ), - 'PaidEnabled' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'boolean' - ), - 'ClosedReadDenied' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'boolean' - ) - ); + $definition = [ + 'SecretHash' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'string' + ), + 'PaidEnabled' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'boolean' + ), + 'ClosedReadDenied' => new ezcInputFormDefinitionElement( + ezcInputFormDefinitionElement::OPTIONAL, 'boolean' + ) + ]; - $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $form = new ezcInputForm(INPUT_POST, $definition); + $Errors = []; if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) { erLhcoreClassModule::redirect(); exit; } - if ( $form->hasValidData( 'PaidEnabled' ) && $form->PaidEnabled == true ) { + if ($form->hasValidData('PaidEnabled') && $form->PaidEnabled == true) { $data['paidchat_enabled'] = 1; } else { $data['paidchat_enabled'] = 0; } - if ( $form->hasValidData( 'ClosedReadDenied' ) && $form->ClosedReadDenied == true ) { + if ($form->hasValidData('ClosedReadDenied') && $form->ClosedReadDenied == true) { $data['paidchat_read_denied'] = 1; } else { $data['paidchat_read_denied'] = 0; } - if ( $form->hasValidData( 'SecretHash' ) ) { + if ($form->hasValidData('SecretHash')) { $data['paidchat_secret_hash'] = $form->SecretHash; } else { $data['paidchat_secret_hash'] = ''; @@ -48,16 +48,15 @@ $paidchatData->value = serialize($data); $paidchatData->saveThis(); - $tpl->set('updated','done'); + $tpl->set('updated', 'done'); } -$tpl->set('paidchat_data',$data); +$tpl->set('paidchat_data', $data); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode','System configuration')), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatbox/generalsettings','Paid chat settings'))); +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chatbox/generalsettings', 'Paid chat settings')] +]; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('paidchat.settings_path',array('result' => & $Result)); - -?> \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('paidchat.settings_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhpermission/module.php b/lhc_web/modules/lhpermission/module.php index d6311f22a0..7d865c52ed 100644 --- a/lhc_web/modules/lhpermission/module.php +++ b/lhc_web/modules/lhpermission/module.php @@ -1,84 +1,72 @@ "Permissions configuration"); - -$ViewList = array(); - -$ViewList['roles'] = array( - 'params' => array(), - 'functions' => array( 'list' ) -); - -$ViewList['newrole'] = array( - 'script' => 'newrole.php', - 'params' => array(), - 'functions' => array( 'new' ) -); - -$ViewList['editrole'] = array( - 'params' => array('role_id'), - 'functions' => array( 'edit' ) -); - -$ViewList['clonerole'] = array( - 'params' => array('role_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'edit' ) -); - -$ViewList['editfunction'] = array( - 'params' => array('function_id'), - 'functions' => array( 'edit' ) -); - -$ViewList['getpermissionsummary'] = array( - 'params' => array('user_id'), - 'functions' => array( 'see_permissions' ) -); - -$ViewList['request'] = array( - 'params' => array('permissions'), - 'functions' => array( 'see_permissions' ) -); - -$ViewList['modulefunctions'] = array( - 'params' => array('module_path'), - 'functions' => array( 'edit' ) -); - -$ViewList['deleterole'] = array( - 'params' => array('role_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'delete' ) -); - -$ViewList['groupassignrole'] = array( - 'params' => array('group_id'), - 'functions' => array( 'delete' ) -); - -$ViewList['roleassigngroup'] = array( - 'params' => array('role_id'), - 'functions' => array( 'delete' ) -); - -$ViewList['explorer'] = array( - 'params' => array(), - 'uparams' => array('action'), - 'functions' => array( 'explorer' ) -); - -$ViewList['whogrants'] = array( - 'params' => array('user_id','module_check','function_check'), - 'functions' => array( 'list' ) -); - -$FunctionList['edit'] = array('explain' => 'Access to edit role'); -$FunctionList['delete'] = array('explain' => 'Access to delete role'); -$FunctionList['list'] = array('explain' => 'Access to list roles'); -$FunctionList['new'] = array('explain' => 'Access to create new role'); -$FunctionList['see_permissions'] = array('explain' => 'Allow operator to see their permissions'); -$FunctionList['see_permissions_users'] = array('explain' => 'Allow operator to see all users permissions'); -$FunctionList['explorer'] = array('explain' => 'Permissions explorer'); - -?> \ No newline at end of file +$Module = ['name' => 'Permissions configuration']; + +$ViewList = [ + 'roles' => [ + 'params' => [], + 'functions' => ['list'], + ], + 'newrole' => [ + 'script' => 'newrole.php', + 'params' => [], + 'functions' => ['new'], + ], + 'editrole' => [ + 'params' => ['role_id'], + 'functions' => ['edit'], + ], + 'clonerole' => [ + 'params' => ['role_id'], + 'uparams' => ['csfr'], + 'functions' => ['edit'], + ], + 'editfunction' => [ + 'params' => ['function_id'], + 'functions' => ['edit'], + ], + 'getpermissionsummary' => [ + 'params' => ['user_id'], + 'functions' => ['see_permissions'], + ], + 'request' => [ + 'params' => ['permissions'], + 'functions' => ['see_permissions'], + ], + 'modulefunctions' => [ + 'params' => ['module_path'], + 'functions' => ['edit'], + ], + 'deleterole' => [ + 'params' => ['role_id'], + 'uparams' => ['csfr'], + 'functions' => ['delete'], + ], + 'groupassignrole' => [ + 'params' => ['group_id'], + 'functions' => ['delete'], + ], + 'roleassigngroup' => [ + 'params' => ['role_id'], + 'functions' => ['delete'], + ], + 'explorer' => [ + 'params' => [], + 'uparams' => ['action'], + 'functions' => ['explorer'], + ], + 'whogrants' => [ + 'params' => ['user_id', 'module_check', 'function_check'], + 'functions' => ['list'], + ], +]; + +$FunctionList = [ + 'edit' => ['explain' => 'Access to edit role'], + 'delete' => ['explain' => 'Access to delete role'], + 'list' => ['explain' => 'Access to list roles'], + 'new' => ['explain' => 'Access to create new role'], + 'see_permissions' => ['explain' => 'Allow operator to see their permissions'], + 'see_permissions_users' => ['explain' => 'Allow operator to see all users permissions'], + 'explorer' => ['explain' => 'Permissions explorer'], +]; diff --git a/lhc_web/modules/lhproduct/getproducts.php b/lhc_web/modules/lhproduct/getproducts.php index 5a509c7d0d..179cba75ca 100644 --- a/lhc_web/modules/lhproduct/getproducts.php +++ b/lhc_web/modules/lhproduct/getproducts.php @@ -4,18 +4,18 @@ if (isset($departament->product_configuration_array['products_enabled']) && $departament->product_configuration_array['products_enabled'] == 1) { - $items = erLhAbstractModelProductDepartament::getList(array('filter' => array('departament_id' => $departament->id))); + $items = erLhAbstractModelProductDepartament::getList(['filter' => ['departament_id' => $departament->id]]); // Collect products id's - $productsIds = array(); + $productsIds = []; foreach ($items as $item) { $productsIds[] = $item->product_id; } - $products = array(); + $products = []; if (!empty($productsIds)) { - $products = erLhAbstractModelProduct::getList(array('sort' => 'priority ASC, name ASC', 'filter' => array('disabled' => 0), 'filterin' => array('id' => $productsIds))); + $products = erLhAbstractModelProduct::getList(['sort' => 'priority ASC, name ASC', 'filter' => ['disabled' => 0], 'filterin' => ['id' => $productsIds]]); } $tpl = erLhcoreClassTemplate::getInstance('lhproduct/getproducts.tpl.php'); @@ -23,14 +23,10 @@ $tpl->set('product_id', (int)$Params['user_parameters']['product_id']); $tpl->set('required',isset($departament->product_configuration_array['products_required']) && $departament->product_configuration_array['products_required'] == 1); - echo json_encode(array('result' => $tpl->fetch())); + echo json_encode(['result' => $tpl->fetch()]); } else { - echo json_encode(array('result' => '')); + echo json_encode(['result' => '']); } - - exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhproduct/index.php b/lhc_web/modules/lhproduct/index.php index 1285495417..3d90ea5a16 100644 --- a/lhc_web/modules/lhproduct/index.php +++ b/lhc_web/modules/lhproduct/index.php @@ -7,18 +7,18 @@ if ( ezcInputForm::hasPostData() ) { - $definition = array( + $definition = [ 'product_enabled_moduleValueParam' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'boolean' ), 'product_show_departamentValueParam' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'boolean' ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( $form->hasValidData( 'product_enabled_moduleValueParam' ) && $form->product_enabled_moduleValueParam == true ) { $attr->value = 1; @@ -41,6 +41,4 @@ } $Result['content'] = $tpl->fetch(); -$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('theme/index','Products'))); - -?> \ No newline at end of file +$Result['path'] = [['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('theme/index', 'Products')]]; diff --git a/lhc_web/modules/lhproduct/module.php b/lhc_web/modules/lhproduct/module.php index 4c779625fe..75678ae2e1 100644 --- a/lhc_web/modules/lhproduct/module.php +++ b/lhc_web/modules/lhproduct/module.php @@ -1,19 +1,17 @@ "Product", - 'variable_params' => true ); +$Module = ['name' => 'Product', 'variable_params' => true]; -$ViewList = array(); +$ViewList = [ + 'index' => [ + 'params' => [], + 'functions' => ['manage_product'], + ], + 'getproducts' => [ + 'params' => ['id', 'product_id'], + ], +]; -$ViewList['index'] = array( - 'params' => array(), - 'functions' => array( 'manage_product' ) -); - -$ViewList['getproducts'] = array( - 'params' => array('id','product_id') -); - -$FunctionList['manage_product'] = array('explain' =>'Allow users to maintain themes'); - -?> \ No newline at end of file +$FunctionList = [ + 'manage_product' => ['explain' => 'Allow users to maintain themes'], +]; diff --git a/lhc_web/modules/lhquestionary/module.php b/lhc_web/modules/lhquestionary/module.php index af7a1583de..ddbc0a2ca7 100644 --- a/lhc_web/modules/lhquestionary/module.php +++ b/lhc_web/modules/lhquestionary/module.php @@ -1,94 +1,82 @@ - "Questionary/Voting"); - -$ViewList = array(); - -$ViewList['newquestion'] = array( - 'script' => 'newquestion.php', - 'params' => array(), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['list'] = array( - 'script' => 'list.php', - 'params' => array(), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['delete'] = array( - 'script' => 'delete.php', - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['deleteanswer'] = array( - 'script' => 'deleteanswer.php', - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['deleteoption'] = array( - 'script' => 'deleteoption.php', - 'params' => array('id'), - 'uparams' => array('csfr'), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['htmlcode'] = array( - 'script' => 'htmlcode.php', - 'params' => array(), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['getstatus'] = array( - 'script' => 'getstatus.php', - 'params' => array(), - 'functions' => array( ), - 'uparams' => array('theme','noresponse','position','expand','top','units','width','height') -); - -$ViewList['votingwidget'] = array( - 'script' => 'votingwidget.php', - 'params' => array(), - 'uparams' => array('theme','mode'), - 'functions' => array() -); - -$ViewList['votingwidgetclosed'] = array( - 'script' => 'votingwidgetclosed.php', - 'params' => array(), - 'functions' => array( ) -); - -$ViewList['previewanswer'] = array( - 'script' => 'previewanswer.php', - 'params' => array('id'), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['edit'] = array( - 'script' => 'edit.php', - 'params' => array('id',), - 'uparams' => array('tab','option_id'), - 'functions' => array( 'manage_questionary' ) -); - -$ViewList['embed'] = array( - 'script' => 'embed.php', - 'params' => array(), - 'uparams' => array('theme'), - 'functions' => array() -); - -$ViewList['embedcode'] = array( - 'script' => 'embedcode.php', - 'params' => array(), - 'functions' => array('manage_questionary') -); - -$FunctionList['manage_questionary'] = array('explain' => 'Allow user to manage questionary'); - -?> \ No newline at end of file + 'Questionary/Voting']; + +$ViewList = [ + 'newquestion' => [ + 'script' => 'newquestion.php', + 'params' => [], + 'functions' => ['manage_questionary'], + ], + 'list' => [ + 'script' => 'list.php', + 'params' => [], + 'functions' => ['manage_questionary'], + ], + 'delete' => [ + 'script' => 'delete.php', + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage_questionary'], + ], + 'deleteanswer' => [ + 'script' => 'deleteanswer.php', + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage_questionary'], + ], + 'deleteoption' => [ + 'script' => 'deleteoption.php', + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['manage_questionary'], + ], + 'htmlcode' => [ + 'script' => 'htmlcode.php', + 'params' => [], + 'functions' => ['manage_questionary'], + ], + 'getstatus' => [ + 'script' => 'getstatus.php', + 'params' => [], + 'functions' => [], + 'uparams' => ['theme', 'noresponse', 'position', 'expand', 'top', 'units', 'width', 'height'], + ], + 'votingwidget' => [ + 'script' => 'votingwidget.php', + 'params' => [], + 'uparams' => ['theme', 'mode'], + 'functions' => [], + ], + 'votingwidgetclosed' => [ + 'script' => 'votingwidgetclosed.php', + 'params' => [], + 'functions' => [], + ], + 'previewanswer' => [ + 'script' => 'previewanswer.php', + 'params' => ['id'], + 'functions' => ['manage_questionary'], + ], + 'edit' => [ + 'script' => 'edit.php', + 'params' => ['id'], + 'uparams' => ['tab', 'option_id'], + 'functions' => ['manage_questionary'], + ], + 'embed' => [ + 'script' => 'embed.php', + 'params' => [], + 'uparams' => ['theme'], + 'functions' => [], + ], + 'embedcode' => [ + 'script' => 'embedcode.php', + 'params' => [], + 'functions' => ['manage_questionary'], + ], +]; + +$FunctionList = [ + 'manage_questionary' => ['explain' => 'Allow user to manage questionary'], +]; diff --git a/lhc_web/modules/lhrestapi/module.php b/lhc_web/modules/lhrestapi/module.php index 3cbba853ce..7b8e84bccf 100644 --- a/lhc_web/modules/lhrestapi/module.php +++ b/lhc_web/modules/lhrestapi/module.php @@ -1,247 +1,185 @@ "Live helper Chat REST API service"); - -$ViewList = array(); - -$ViewList['index'] = array( - 'params' => array(), - 'functions' => array( 'use_admin' ) -); - -$ViewList['chat'] = array( - 'params' => array('id') -); - -$ViewList['chats'] = array( - 'params' => array() -); - -$ViewList['conversations'] = array( - 'params' => array() -); - -$ViewList['onlineimage'] = array( - 'params' => array(), - 'uparams' => array('user_id','department'), - 'multiple_arguments' => array ( 'department' ) -); - -$ViewList['extensions'] = array( - 'params' => array() -); - -$ViewList['chatscount'] = array( - 'params' => array() -); - -$ViewList['updatelastactivity'] = array( - 'params' => array('user_id') -); - -$ViewList['fetchchat'] = array( - 'params' => array() -); - -$ViewList['editwebhook'] = array( - 'params' => array(), -); - -$ViewList['fetchchatmessages'] = array( - 'params' => array() -); - -$ViewList['getmessages'] = array( - 'params' => array() -); - -$ViewList['departaments'] = array( - 'params' => array() -); - -$ViewList['isonlineuser'] = array( - 'params' => array('user_id') -); - -$ViewList['isonlinechat'] = array( - 'params' => array('chat_id') -); - -$ViewList['setoperatorstatus'] = array( - 'params' => array() -); - -$ViewList['setinvisibilitystatus'] = array( - 'params' => array() -); - -$ViewList['setonlinestatus'] = array( - 'params' => array('user_id','online') -); - -$ViewList['isonline'] = array( - 'params' => array() -); - -$ViewList['isonlinedepartment'] = array( - 'params' => array('department_id') -); - -$ViewList['getusers'] = array( - 'params' => array() -); - -$ViewList['onlineusers'] = array( - 'params' => array() -); - -$ViewList['startchatwithoperator'] = array( - 'params' => array('id','initiator_user_id') -); - -$ViewList['groupsbyobject'] = array( - 'params' => array('object_id','type') -); - -$ViewList['groupsidbyobject'] = array( - 'params' => array('object_id','type') -); - -$ViewList['listofobjectid'] = array( - 'params' => array('user_id','type') -); - -$ViewList['bots'] = array( - 'params' => array() -); - -$ViewList['user'] = array( - 'params' => array('id') -); - -$ViewList['notifications'] = array( - 'params' => array('token') -); - -$ViewList['user_departments'] = array( - 'params' => array() -); - -$ViewList['lang'] = array( - 'params' => array('ns') -); - -$ViewList['bot'] = array( - 'params' => array('id') -); - -$ViewList['departments'] = array( - 'params' => array() -); - -$ViewList['department'] = array( - 'params' => array('id') -); - -$ViewList['getuser'] = array( - 'params' => array() -); - -$ViewList['login'] = array( - 'params' => array() -); - -$ViewList['loginbytoken'] = array( - 'params' => array() -); - -$ViewList['logout'] = array( - 'params' => array() -); - -$ViewList['generateautologin'] = array( - 'params' => array() -); - -$ViewList['swagger'] = array( - 'params' => array() -); - -$ViewList['agentstatistic'] = array( - 'params' => array() -); - -/** - * Calls dedicated to users - * */ -// Starts chat and returns chat data including chat id and hash -$ViewList['startchat'] = array( - 'params' => array(), - 'uparams' => array('ua','operator','er','vid','hash_resume','sound','hash','offline','leaveamessage','department','priority','chatprefill','survey','prod','phash','pvhash'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['addmsguser'] = array( - 'params' => array() -); - -$ViewList['addmsgadmin'] = array( - 'params' => array() -); - -$ViewList['file'] = array( - 'params' => array('id') -); - -$ViewList['setchatstatus'] = array( - 'params' => array() -); - -$ViewList['campaignsconversions'] = array( - 'params' => array() -); - -$ViewList['setnewvid'] = array( - 'params' => array() -); - -// Checks is there any pending messages for online visitor and if there is return action what to do next -$ViewList['chatcheckoperatormessage'] = array( - 'params' => array(), - 'uparams' => array('tz','operator','theme','priority','vid','count_page','identifier','department','ua','survey','uactiv','wopen'), - 'multiple_arguments' => array ( 'department','ua' ) -); - -// Updates additional chat attributes -$ViewList['updatechatattributes'] = array( - 'params' => array() -); - -// Closes chat from visitor perspective -$ViewList['closechatasvisitor'] = array( - 'params' => array() -); - -$ViewList['checkchatstatus'] = array( - 'params' => array(), - 'uparams' => array('mode','theme','dot') -); - -$ViewList['surveychat'] = array( - 'params' => array('chat_id','survey_id'), - 'uparams' => array() -); - -$FunctionList = array(); -$FunctionList['use_admin'] = array('explain' => 'Allow operator to manage REST API'); -$FunctionList['use_direct_logins'] = array('explain' => 'Allow operator use api directly with their username and password'); - -// Objects API -$FunctionList['object_api'] = array('explain' => 'Allow operator to user objects api'); -$FunctionList['updatelastactivity'] = array('explain' => 'Allow operator update other operator last activity'); -$FunctionList['file_download'] = array('explain' => 'Allow operator to download file'); -$FunctionList['list_extensions'] = array('explain' => 'Allow operator to list extensions'); -$FunctionList['survey'] = array('explain' => 'Allow operator to work with survey'); -$FunctionList['generateautologinall'] = array('explain' => 'Allow operator to generate auto login for any account'); - -?> \ No newline at end of file +$Module = ['name' => 'Live helper Chat REST API service']; + +$ViewList = [ + 'index' => [ + 'params' => [], + 'functions' => ['use_admin'], + ], + 'chat' => [ + 'params' => ['id'], + ], + 'chats' => [ + 'params' => [], + ], + 'conversations' => [ + 'params' => [], + ], + 'onlineimage' => [ + 'params' => [], + 'uparams' => ['user_id', 'department'], + 'multiple_arguments' => ['department'], + ], + 'extensions' => [ + 'params' => [], + ], + 'chatscount' => [ + 'params' => [], + ], + 'updatelastactivity' => [ + 'params' => ['user_id'], + ], + 'fetchchat' => [ + 'params' => [], + ], + 'editwebhook' => [ + 'params' => [], + ], + 'fetchchatmessages' => [ + 'params' => [], + ], + 'getmessages' => [ + 'params' => [], + ], + 'departaments' => [ + 'params' => [], + ], + 'isonlineuser' => [ + 'params' => ['user_id'], + ], + 'isonlinechat' => [ + 'params' => ['chat_id'], + ], + 'setoperatorstatus' => [ + 'params' => [], + ], + 'setinvisibilitystatus' => [ + 'params' => [], + ], + 'setonlinestatus' => [ + 'params' => ['user_id', 'online'], + ], + 'isonline' => [ + 'params' => [], + ], + 'isonlinedepartment' => [ + 'params' => ['department_id'], + ], + 'getusers' => [ + 'params' => [], + ], + 'onlineusers' => [ + 'params' => [], + ], + 'startchatwithoperator' => [ + 'params' => ['id', 'initiator_user_id'], + ], + 'groupsbyobject' => [ + 'params' => ['object_id', 'type'], + ], + 'groupsidbyobject' => [ + 'params' => ['object_id', 'type'], + ], + 'listofobjectid' => [ + 'params' => ['user_id', 'type'], + ], + 'bots' => [ + 'params' => [], + ], + 'user' => [ + 'params' => ['id'], + ], + 'notifications' => [ + 'params' => ['token'], + ], + 'user_departments' => [ + 'params' => [], + ], + 'lang' => [ + 'params' => ['ns'], + ], + 'bot' => [ + 'params' => ['id'], + ], + 'departments' => [ + 'params' => [], + ], + 'department' => [ + 'params' => ['id'], + ], + 'getuser' => [ + 'params' => [], + ], + 'login' => [ + 'params' => [], + ], + 'loginbytoken' => [ + 'params' => [], + ], + 'logout' => [ + 'params' => [], + ], + 'generateautologin' => [ + 'params' => [], + ], + 'swagger' => [ + 'params' => [], + ], + 'agentstatistic' => [ + 'params' => [], + ], + 'startchat' => [ + 'params' => [], + 'uparams' => ['ua', 'operator', 'er', 'vid', 'hash_resume', 'sound', 'hash', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'prod', 'phash', 'pvhash'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'addmsguser' => [ + 'params' => [], + ], + 'addmsgadmin' => [ + 'params' => [], + ], + 'file' => [ + 'params' => ['id'], + ], + 'setchatstatus' => [ + 'params' => [], + ], + 'campaignsconversions' => [ + 'params' => [], + ], + 'setnewvid' => [ + 'params' => [], + ], + 'chatcheckoperatormessage' => [ + 'params' => [], + 'uparams' => ['tz', 'operator', 'theme', 'priority', 'vid', 'count_page', 'identifier', 'department', 'ua', 'survey', 'uactiv', 'wopen'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'updatechatattributes' => [ + 'params' => [], + ], + 'closechatasvisitor' => [ + 'params' => [], + ], + 'checkchatstatus' => [ + 'params' => [], + 'uparams' => ['mode', 'theme', 'dot'], + ], + 'surveychat' => [ + 'params' => ['chat_id', 'survey_id'], + 'uparams' => [], + ], +]; + +$FunctionList = [ + 'use_admin' => ['explain' => 'Allow operator to manage REST API'], + 'use_direct_logins' => ['explain' => 'Allow operator use api directly with their username and password'], + 'object_api' => ['explain' => 'Allow operator to user objects api'], + 'updatelastactivity' => ['explain' => 'Allow operator update other operator last activity'], + 'file_download' => ['explain' => 'Allow operator to download file'], + 'list_extensions' => ['explain' => 'Allow operator to list extensions'], + 'survey' => ['explain' => 'Allow operator to work with survey'], + 'generateautologinall' => ['explain' => 'Allow operator to generate auto login for any account'], +]; diff --git a/lhc_web/modules/lhspeech/dialects.php b/lhc_web/modules/lhspeech/dialects.php index f0dd4060b7..0b992c6062 100644 --- a/lhc_web/modules/lhspeech/dialects.php +++ b/lhc_web/modules/lhspeech/dialects.php @@ -8,17 +8,16 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelSpeechLanguageDialect::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC'),array())); + $items = erLhcoreClassModelSpeechLanguageDialect::getList(array_merge(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC'],[])); } $tpl->set('items',$items); $tpl->set('pages',$pages); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','System configuration')), - array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','Dialects'))); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'System configuration')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Dialects')] +]; diff --git a/lhc_web/modules/lhspeech/getchatdialect.php b/lhc_web/modules/lhspeech/getchatdialect.php index 6e058b2967..5fcd6c24ec 100644 --- a/lhc_web/modules/lhspeech/getchatdialect.php +++ b/lhc_web/modules/lhspeech/getchatdialect.php @@ -4,26 +4,24 @@ { $chat = erLhcoreClassChat::getSession()->load( 'erLhcoreClassModelChat', $Params['user_parameters']['chat_id']); - $errors = array(); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('speech.before_getchatdialect',array('chat' => & $chat, 'errors' => & $errors)); + $errors = []; + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('speech.before_getchatdialect',['chat' => & $chat, 'errors' => & $errors]); if(empty($errors)) { if ( erLhcoreClassChat::hasAccessToRead($chat) ) { $chatSpeech = erLhcoreClassSpeech::getSpeechInstance($chat); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('speech.getchatdialect',array('chat' => & $chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('speech.getchatdialect',['chat' => & $chat]); - echo json_encode(array('error' => false, 'dialect' => $chatSpeech->dialect)); + echo json_encode(['error' => false, 'dialect' => $chatSpeech->dialect]); } else { - echo json_encode(array('error' => true, 'result' => 'No permission')); + echo json_encode(['error' => true, 'result' => 'No permission']); } } else { - echo json_encode(array('error' => true, 'result' => implode(PHP_EOL, $errors))); + echo json_encode(['error' => true, 'result' => implode(PHP_EOL, $errors)]); } } exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhspeech/languages.php b/lhc_web/modules/lhspeech/languages.php index 240af05f84..c0e39ce665 100644 --- a/lhc_web/modules/lhspeech/languages.php +++ b/lhc_web/modules/lhspeech/languages.php @@ -8,17 +8,16 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhcoreClassModelSpeechLanguage::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC'),array())); + $items = erLhcoreClassModelSpeechLanguage::getList(array_merge(['offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'id ASC'],[])); } $tpl->set('items',$items); $tpl->set('pages',$pages); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','System configuration')), -array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','Languages'))); - -?> \ No newline at end of file +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'System configuration')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Languages')] +]; diff --git a/lhc_web/modules/lhspeech/module.php b/lhc_web/modules/lhspeech/module.php index f96a8653e8..a9946cfba1 100644 --- a/lhc_web/modules/lhspeech/module.php +++ b/lhc_web/modules/lhspeech/module.php @@ -1,79 +1,68 @@ - "Speech module"); - -$ViewList = array(); - -$ViewList['setchatspeechlanguage'] = array( - 'params' => array('chat_id'), - 'functions' => array('change_chat_recognition'), - 'uparams' => array() -); - -$ViewList['getchatdialect'] = array( - 'params' => array('chat_id'), - 'functions' => array('use'), - 'uparams' => array() -); - -$ViewList['getdialect'] = array( - 'params' => array('language'), - 'functions' => array('use'), - 'uparams' => array() -); - -$ViewList['defaultlanguage'] = array( - 'params' => array(), - 'functions' => array('manage'), - 'uparams' => array() -); - -$ViewList['languages'] = array ( - 'params' => array(), - 'functions' => array('manage'), - 'uparams' => array() -); - -$ViewList['dialects'] = array ( - 'params' => array(), - 'functions' => array('manage'), - 'uparams' => array() -); - -$ViewList['deletedialect'] = array ( - 'params' => array('id'), - 'functions' => array('manage'), - 'uparams' => array('csfr') -); - -$ViewList['editdialect'] = array ( - 'params' => array('id'), - 'functions' => array('manage'), - 'uparams' => array() -); - -$ViewList['editlanguage'] = array ( - 'params' => array('id'), - 'functions' => array('manage'), - 'uparams' => array() -); - -$ViewList['newdialect'] = array ( - 'params' => array(), - 'functions' => array('manage'), - 'uparams' => array() -); - -$ViewList['newlanguage'] = array ( - 'params' => array(), - 'functions' => array('manage'), - 'uparams' => array() -); - -$FunctionList = array(); -$FunctionList['use'] = array('explain' => 'Allow operator to use speech recognition module'); -$FunctionList['manage'] = array('explain' => 'Allow user to set application default speech recognition language'); -$FunctionList['changedefaultlanguage'] = array('explain' => 'Allow user to change their personal speech recognition language'); -$FunctionList['change_chat_recognition'] = array('explain' => 'Allow operator to change chat recognition language'); - -?> \ No newline at end of file + 'Speech module']; + +$ViewList = [ + 'setchatspeechlanguage' => [ + 'params' => ['chat_id'], + 'functions' => ['change_chat_recognition'], + 'uparams' => [], + ], + 'getchatdialect' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + 'uparams' => [], + ], + 'getdialect' => [ + 'params' => ['language'], + 'functions' => ['use'], + 'uparams' => [], + ], + 'defaultlanguage' => [ + 'params' => [], + 'functions' => ['manage'], + 'uparams' => [], + ], + 'languages' => [ + 'params' => [], + 'functions' => ['manage'], + 'uparams' => [], + ], + 'dialects' => [ + 'params' => [], + 'functions' => ['manage'], + 'uparams' => [], + ], + 'deletedialect' => [ + 'params' => ['id'], + 'functions' => ['manage'], + 'uparams' => ['csfr'], + ], + 'editdialect' => [ + 'params' => ['id'], + 'functions' => ['manage'], + 'uparams' => [], + ], + 'editlanguage' => [ + 'params' => ['id'], + 'functions' => ['manage'], + 'uparams' => [], + ], + 'newdialect' => [ + 'params' => [], + 'functions' => ['manage'], + 'uparams' => [], + ], + 'newlanguage' => [ + 'params' => [], + 'functions' => ['manage'], + 'uparams' => [], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow operator to use speech recognition module'], + 'manage' => ['explain' => 'Allow user to set application default speech recognition language'], + 'changedefaultlanguage' => ['explain' => 'Allow user to change their personal speech recognition language'], + 'change_chat_recognition' => ['explain' => 'Allow operator to change chat recognition language'], +]; diff --git a/lhc_web/modules/lhstatistic/departmentstatusxls.php b/lhc_web/modules/lhstatistic/departmentstatusxls.php index 5237eb6722..83da1a37a1 100644 --- a/lhc_web/modules/lhstatistic/departmentstatusxls.php +++ b/lhc_web/modules/lhstatistic/departmentstatusxls.php @@ -1,6 +1,6 @@ getUserID(), $currentUser->cache_version); if ($userDepartments !== true){ $departmentParams['filterin']['id'] = $userDepartments; @@ -14,5 +14,3 @@ erLhcoreClassChatExport::exportDepartmentStats(erLhcoreClassModelDepartament::getList($departmentParams)); exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhstatistic/module.php b/lhc_web/modules/lhstatistic/module.php index d11a64b852..96a09f981d 100644 --- a/lhc_web/modules/lhstatistic/module.php +++ b/lhc_web/modules/lhstatistic/module.php @@ -1,155 +1,144 @@ "Statistic module", - 'variable_params' => true ); +$Module = ['name' => 'Statistic module', 'variable_params' => true]; -$ViewList = array(); +$ViewList = [ + 'departmentstatusxls' => [ + 'params' => [], + 'functions' => ['exportxls'], + 'uparams' => [], + ], + 'statistic' => [ + 'params' => [], + 'uparams' => [ + 0 => 'timeto_include_hours', + 1 => 'timefrom_include_hours', + 2 => 'invitation_id', + 3 => 'group_chart_type', + 4 => 'group_limit', + 5 => 'chart_type', + 6 => 'group_field', + 7 => 'groupby', + 8 => 'export', + 9 => 'report', + 10 => 'transfer_happened', + 11 => 'invitation_ids', + 12 => 'wait_time_till', + 13 => 'wait_time_from', + 14 => 'subject_ids', + 15 => 'department_ids', + 16 => 'department_group_ids', + 17 => 'group_ids', + 18 => 'user_ids', + 19 => 'timeintervalto_hours', + 20 => 'timeintervalfrom_hours', + 21 => 'group_by', + 22 => 'xls', + 23 => 'tab', + 24 => 'timefrom', + 25 => 'timeto', + 26 => 'department_id', + 27 => 'user_id', + 28 => 'group_id', + 29 => 'department_group_id', + 30 => 'timefrom_seconds', + 31 => 'timefrom_minutes', + 32 => 'timefrom_hours', + 33 => 'timeto_hours', + 34 => 'timeto_minutes', + 35 => 'timeto_seconds', + 36 => 'exclude_offline', + 37 => 'with_bot', + 38 => 'dropped_chat', + 39 => 'online_offline', + 40 => 'without_bot', + 41 => 'proactive_chat', + 42 => 'no_operator', + 43 => 'has_unread_messages', + 44 => 'not_invitation', + 45 => 'has_operator', + 46 => 'abandoned_chat', + 47 => 'bot_ids', + 48 => 'cls_us', + 49 => 'has_unread_op_messages', + 51 => 'opened', + 52 => 'country_ids', + 53 => 'region', + 54 => 'frt_from', + 55 => 'frt_till', + 56 => 'mart_from', + 57 => 'mart_till', + 58 => 'aart_till', + 59 => 'aart_from', + 60 => 'reporthash', + 61 => 'reportts', + 62 => 'reportverified', + 63 => 'r', + 64 => 'is_external', + 65 => 'has_attachment', + 66 => 'has_online_hours', + 67 => 'exclude_deactivated', + 68 => 'mail_conv_user', + 69 => 'attr_int_1_multi', + 70 => 'op_msg_count', + 71 => 'vi_msg_count', + 72 => 'bot_msg_count', + 73 => 'all_msg_count', + 74 => 'all_msg_count_till', + ], + 'functions' => ['viewstatistic'], + 'multiple_arguments' => ['bot_ids', 'subject_ids', 'department_ids', 'group_ids', 'user_ids', 'department_group_ids', 'invitation_ids', 'chart_type', 'country_ids', 'attr_int_1_multi'], + ], + 'loadreport' => [ + 'params' => ['report_id'], + 'functions' => ['viewstatistic'], + ], + 'deletereport' => [ + 'params' => ['report_id'], + 'uparams' => ['csfr'], + 'functions' => ['viewstatistic'], + ], + 'copyreport' => [ + 'params' => ['report_id'], + 'uparams' => ['csfr'], + 'functions' => ['viewstatistic'], + ], + 'reportrange' => [ + 'params' => [], + 'functions' => ['viewstatistic'], + ], + 'campaignmodal' => [ + 'params' => ['invitation_id'], + 'uparams' => [], + 'functions' => ['viewstatistic'], + ], + 'abstatistic' => [ + 'params' => ['campaign_id'], + 'uparams' => [], + 'functions' => ['viewstatistic'], + ], + 'departmentstats' => [ + 'params' => ['id'], + 'uparams' => ['type', 'tab'], + 'functions' => ['statisticdep'], + ], + 'userstats' => [ + 'params' => ['id'], + 'uparams' => ['action'], + 'functions' => ['userstats'], + ], + 'onlinehours' => [ + 'params' => [], + 'uparams' => ['group_by', 'xls', 'timefrom', 'timeto', 'user_id', 'timefrom_minutes', 'timefrom_hours', 'timeto_hours', 'timeto_minutes', 'export'], + 'functions' => ['viewstatistic'], + 'multiple_arguments' => ['user_id'], + ], +]; -$ViewList['departmentstatusxls'] = array( - 'params' => array(), - 'functions' => array( 'exportxls' ), - 'uparams' => array() -); - -$ViewList['statistic'] = array( - 'params' => array(), - 'uparams' => array ( - 0 => 'timeto_include_hours', - 1 => 'timefrom_include_hours', - 2 => 'invitation_id', - 3 => 'group_chart_type', - 4 => 'group_limit', - 5 => 'chart_type', - 6 => 'group_field', - 7 => 'groupby', - 8 => 'export', - 9 => 'report', - 10 => 'transfer_happened', - 11 => 'invitation_ids', - 12 => 'wait_time_till', - 13 => 'wait_time_from', - 14 => 'subject_ids', - 15 => 'department_ids', - 16 => 'department_group_ids', - 17 => 'group_ids', - 18 => 'user_ids', - 19 => 'timeintervalto_hours', - 20 => 'timeintervalfrom_hours', - 21 => 'group_by', - 22 => 'xls', - 23 => 'tab', - 24 => 'timefrom', - 25 => 'timeto', - 26 => 'department_id', - 27 => 'user_id', - 28 => 'group_id', - 29 => 'department_group_id', - 30 => 'timefrom_seconds', - 31 => 'timefrom_minutes', - 32 => 'timefrom_hours', - 33 => 'timeto_hours', - 34 => 'timeto_minutes', - 35 => 'timeto_seconds', - 36 => 'exclude_offline', - 37 => 'with_bot', - 38 => 'dropped_chat', - 39 => 'online_offline', - 40 => 'without_bot', - 41 => 'proactive_chat', - 42 => 'no_operator', - 43 => 'has_unread_messages', - 44 => 'not_invitation', - 45 => 'has_operator', - 46 => 'abandoned_chat', - 47 => 'bot_ids', - 48 => 'cls_us', - 49 => 'has_unread_op_messages', - 51 => 'opened', - 52 => 'country_ids', - 53 => 'region', - 54 => 'frt_from', - 55 => 'frt_till', - 56 => 'mart_from', - 57 => 'mart_till', - 58 => 'aart_till', - 59 => 'aart_from', - 60 => 'reporthash', - 61 => 'reportts', - 62 => 'reportverified', - 63 => 'r', - 64 => 'is_external', - 65 => 'has_attachment', - 66 => 'has_online_hours', - 67 => 'exclude_deactivated', - 68 => 'mail_conv_user', - 69 => 'attr_int_1_multi', - 70 => 'op_msg_count', - 71 => 'vi_msg_count', - 72 => 'bot_msg_count', - 73 => 'all_msg_count', - 74 => 'all_msg_count_till' - ), - 'functions' => array( 'viewstatistic' ), - 'multiple_arguments' => array('bot_ids','subject_ids','department_ids','group_ids','user_ids','department_group_ids','invitation_ids','chart_type','country_ids','attr_int_1_multi') -); - -$ViewList['loadreport'] = array( - 'params' => array('report_id'), - 'functions' => array( 'viewstatistic' ), -); - -$ViewList['deletereport'] = array( - 'params' => array('report_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'viewstatistic' ), -); - -$ViewList['copyreport'] = array( - 'params' => array('report_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'viewstatistic' ), -); - -$ViewList['reportrange'] = array( - 'params' => array(), - 'functions' => array( 'viewstatistic' ), -); - -$ViewList['campaignmodal'] = array( - 'params' => array('invitation_id'), - 'uparams' => array(), - 'functions' => array( 'viewstatistic' ) -); - -$ViewList['abstatistic'] = array( - 'params' => array('campaign_id'), - 'uparams' => array(), - 'functions' => array( 'viewstatistic' ) -); - -$ViewList['departmentstats'] = array( - 'params' => array('id'), - 'uparams' => array('type','tab'), - 'functions' => array( 'statisticdep' ) -); - -$ViewList['userstats'] = array( - 'params' => array('id'), - 'uparams' => array('action'), - 'functions' => array( 'userstats' ) -); - -$ViewList['onlinehours'] = array( - 'params' => array(), - 'uparams' => array('group_by','xls','timefrom','timeto','user_id','timefrom_minutes','timefrom_hours','timeto_hours','timeto_minutes','export'), - 'functions' => array( 'viewstatistic' ), - 'multiple_arguments' => array('user_id') -); - -$FunctionList['exportxls'] = array('explain' => 'Allow to operator to export departments statistic in XLS'); -$FunctionList['viewstatistic'] = array('explain' =>'Allow operator to view statistic'); -$FunctionList['configuration'] = array('explain' =>'Allow operator to configure statistic'); -$FunctionList['statisticdep'] = array('explain' =>'Allow operator to see departments/departments groups statistic in modal window'); -$FunctionList['userstats'] = array('explain' =>'Allow operator to see operator statistic in modal window'); - -?> \ No newline at end of file +$FunctionList = [ + 'exportxls' => ['explain' => 'Allow to operator to export departments statistic in XLS'], + 'viewstatistic' => ['explain' => 'Allow operator to view statistic'], + 'configuration' => ['explain' => 'Allow operator to configure statistic'], + 'statisticdep' => ['explain' => 'Allow operator to see departments/departments groups statistic in modal window'], + 'userstats' => ['explain' => 'Allow operator to see operator statistic in modal window'], +]; diff --git a/lhc_web/modules/lhstatistic/statistic.php b/lhc_web/modules/lhstatistic/statistic.php index 1313c90973..69382ae82a 100644 --- a/lhc_web/modules/lhstatistic/statistic.php +++ b/lhc_web/modules/lhstatistic/statistic.php @@ -42,7 +42,7 @@ erLhcoreClassChat::updateActiveChats($user->id); - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_status_changed', array('user' => & $user, 'reason' => 'user_action')); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_status_changed', ['user' => & $user, 'reason' => 'user_action']); } else { @@ -65,10 +65,10 @@ * This is optional if some extension AH decides to block usage of this module function completely * We don't do redirect here * */ -$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.statistic', array()); +$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.statistic', []); // Custom Unordered Parameters -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.uparams_append',array('uparams' => & $Params['user_parameters_unordered'])); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.uparams_append',['uparams' => & $Params['user_parameters_unordered']]); try { $dt = new DateTime(); @@ -112,11 +112,11 @@ $tpl = erLhcoreClassTemplate::getInstance( 'lhstatistic/statistic.tpl.php'); -$validTabs = array('visitors','active','last24','chatsstatistic','agentstatistic','performance','departments','configuration','mail'); +$validTabs = ['visitors','active','last24','chatsstatistic','agentstatistic','performance','departments','configuration','mail']; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.valid_tabs', array( +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.valid_tabs', [ 'valid_tabs' => & $validTabs -)); +]); $tab = isset($Params['user_parameters_unordered']['tab']) && in_array($Params['user_parameters_unordered']['tab'],$validTabs) ? $Params['user_parameters_unordered']['tab'] : 'active'; @@ -144,10 +144,13 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { $tpl->set('action_url', erLhcoreClassDesign::baseurl('statistic/statistic').'/(tab)/'. $tab . erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form'])); if (ezcInputForm::hasPostData()) { - $Errors = \LiveHelperChat\Validators\ReportValidator::validateReport($savedSearch, array( + $Errors = \LiveHelperChat\Validators\ReportValidator::validateReport( + $savedSearch, + [ 'filter' => $filterParams['filter'], 'tab' => $tab, - 'input_form' => $filterParams['input_form']) + 'input_form' => $filterParams['input_form'] + ] ); if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) { @@ -166,10 +169,10 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } } elseif ($savedSearch->id === null) { - $savedSearch->params = json_encode(array( + $savedSearch->params = json_encode([ 'filter' => $filterParams['filter'], 'tab' => 'active', - 'input_form' => $filterParams['input_form']) + 'input_form' => $filterParams['input_form']] ); } @@ -183,11 +186,11 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { $configuration = (array)erLhcoreClassModelChatConfig::fetch('statistic_options')->data; if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'activestatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'activestatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'activestatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'activestatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); if (empty($filterParams['input_form']->chart_type)) { - $filterParams['input_form']->chart_type = isset($configuration['statistic']) ? $configuration['statistic'] : array(); + $filterParams['input_form']->chart_type = isset($configuration['statistic']) ? $configuration['statistic'] : []; } } @@ -203,7 +206,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($filterParams['filter']['filterin']['lh_chat.dep_id'])) { $filterParams['filter']['filterin']['lh_chat.dep_id'] = array_values(array_intersect($filterParams['filter']['filterin']['lh_chat.dep_id'],$departmentFilter['filterin']['id'])); if (empty($filterParams['filter']['filterin']['lh_chat.dep_id'])) { - $filterParams['filter']['filterin']['lh_chat.dep_id'] = array(-1); + $filterParams['filter']['filterin']['lh_chat.dep_id'] = [-1]; } } else { $filterParams['filter']['filterin']['lh_chat.dep_id'] = array_values($departmentFilter['filterin']['id']); @@ -221,7 +224,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.active_filter',array('filter' => & $filterParams, 'uparams' => $Params['user_parameters_unordered'])); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.active_filter',['filter' => & $filterParams, 'uparams' => $Params['user_parameters_unordered']]); if ($filterParams['input_form']->op_msg_count !== false && is_numeric($filterParams['input_form']->op_msg_count)) { $n = (int)$filterParams['input_form']->op_msg_count; @@ -266,16 +269,16 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($_GET['doSearch'])) { - $activeStats = array( - 'userStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('thumbs',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getRatingByUser(30,$filterParams['filter']) : array()), - 'countryStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('country',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getTopChatsByCountry(30,$filterParams['filter']) : array()), - 'userChatsStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbyuser',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByUser(30,$filterParams['filter']) : array()), - 'userChatsParticipantStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbyuserparticipant',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByUserParticipant(30,$filterParams['filter']) : array()), + $activeStats = [ + 'userStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('thumbs',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getRatingByUser(30,$filterParams['filter']) : []), + 'countryStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('country',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getTopChatsByCountry(30,$filterParams['filter']) : []), + 'userChatsStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbyuser',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByUser(30,$filterParams['filter']) : []), + 'userChatsParticipantStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbyuserparticipant',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByUserParticipant(30,$filterParams['filter']) : []), - 'userTransferChatsStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbytransferuser',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByUser(30,$filterParams['filter'],'transfer_uid') : array()), - 'depChatsStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbydep',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByDepartment(30,$filterParams['filter']) : array()), - 'userChatsAverageStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('avgdurationop',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::averageOfChatsDialogsByUser(30,$filterParams['filter']) : array()), - 'userWaitTimeByOperator' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitbyoperator',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::avgWaitTimeyUser(30,$filterParams['filter']) : array()), + 'userTransferChatsStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbytransferuser',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByUser(30,$filterParams['filter'],'transfer_uid') : []), + 'depChatsStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('chatbydep',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfChatsDialogsByDepartment(30,$filterParams['filter']) : []), + 'userChatsAverageStats' => ((is_array($filterParams['input_form']->chart_type) && in_array('avgdurationop',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::averageOfChatsDialogsByUser(30,$filterParams['filter']) : []), + 'userWaitTimeByOperator' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitbyoperator',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::avgWaitTimeyUser(30,$filterParams['filter']) : []), 'numberOfChatsPerMonth' => ( (is_array($filterParams['input_form']->chart_type) && ( @@ -287,25 +290,25 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { in_array('msgdelbot',$filterParams['input_form']->chart_type) || in_array('devicetype',$filterParams['input_form']->chart_type) ) - ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerMonth($filterParams['filter'], array('charttypes' => $filterParams['input_form']->chart_type, 'comparetopast' => $filterParams['input']->comparetopast)) : array()), + ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerMonth($filterParams['filter'], ['charttypes' => $filterParams['input_form']->chart_type, 'comparetopast' => $filterParams['input']->comparetopast]) : []), - 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTime($filterParams['filter']) : array()), - 'numberOfChatsPerHour' => ((is_array($filterParams['input_form']->chart_type) && in_array('avgduration',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getWorkLoadStatistic(30, $filterParams['filter']) : array()), - 'averageChatTime' => ((is_array($filterParams['input_form']->chart_type) && in_array('avgduration',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getAverageChatduration(30,$filterParams['filter']) : array()), - 'numberOfMsgByUser' => ((is_array($filterParams['input_form']->chart_type) && in_array('usermsg',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfMessagesByUser(30,$filterParams['filter']) : array()), - 'subjectsStatistic' => ((is_array($filterParams['input_form']->chart_type) && in_array('subject',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::subjectsStatistic(30,$filterParams['filter']) : array()), - 'cannedStatistic' => ((is_array($filterParams['input_form']->chart_type) && in_array('canned',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::cannedStatistic(30,$filterParams['filter']) : array()), + 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTime($filterParams['filter']) : []), + 'numberOfChatsPerHour' => ((is_array($filterParams['input_form']->chart_type) && in_array('avgduration',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getWorkLoadStatistic(30, $filterParams['filter']) : []), + 'averageChatTime' => ((is_array($filterParams['input_form']->chart_type) && in_array('avgduration',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getAverageChatduration(30,$filterParams['filter']) : []), + 'numberOfMsgByUser' => ((is_array($filterParams['input_form']->chart_type) && in_array('usermsg',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::numberOfMessagesByUser(30,$filterParams['filter']) : []), + 'subjectsStatistic' => ((is_array($filterParams['input_form']->chart_type) && in_array('subject',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::subjectsStatistic(30,$filterParams['filter']) : []), + 'cannedStatistic' => ((is_array($filterParams['input_form']->chart_type) && in_array('canned',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::cannedStatistic(30,$filterParams['filter']) : []), - 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDate(30,$filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), - 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNick(30,$filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), + 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDate(30,$filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), + 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNick(30,$filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - ); + ]; - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.process_active_tab', array( + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.process_active_tab', [ 'active_stats' => & $activeStats, 'filter_params' => $filterParams - )); + ]); if (isset($_GET['reportType']) && $_GET['reportType'] != 'live') { erLhcoreClassChatStatistic::exportCSV($activeStats, $_GET['reportType']); @@ -318,12 +321,12 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } elseif ($tab == 'mail') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'mailconv','module_file' => 'mailstatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'mailconv','module_file' => 'mailstatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'mailconv','module_file' => 'mailstatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'mailconv','module_file' => 'mailstatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); if (empty($filterParams['input_form']->chart_type)) { $configuration = (array)erLhcoreClassModelChatConfig::fetch('statistic_options')->data; - $filterParams['input_form']->chart_type = isset($configuration['chat_statistic']) ? $configuration['chat_statistic'] : array(); + $filterParams['input_form']->chart_type = isset($configuration['chat_statistic']) ? $configuration['chat_statistic'] : []; } } @@ -342,7 +345,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'])) { $filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'] = array_intersect($filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'],$departmentFilter['filterin']['id']); if (empty($filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'])) { - $filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'] = array(-1); + $filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'] = [-1]; } } else { $filterParams['filter']['filterin']['lhc_mailconv_msg.dep_id'] = $departmentFilter['filterin']['id']; @@ -394,7 +397,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (is_array($filterParams['input_form']->subject_ids) && !empty($filterParams['input_form']->subject_ids)) { erLhcoreClassChat::validateFilterIn($filterParams['input_form']->subject_ids); - $filterParams['filter']['innerjoin']['lhc_mailconv_msg_subject'] = array('`lhc_mailconv_msg_subject`.`message_id`','`lhc_mailconv_msg` . `id`'); + $filterParams['filter']['innerjoin']['lhc_mailconv_msg_subject'] = ['`lhc_mailconv_msg_subject`.`message_id`','`lhc_mailconv_msg` . `id`']; $filterParams['filter']['filterin']['`lhc_mailconv_msg_subject`.`subject_id`'] = $filterParams['input_form']->subject_ids; } @@ -406,39 +409,39 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } if (isset($_GET['doSearch'])) { - $activeStats = array( + $activeStats = [ 'mmsgperinterval' => ((is_array($filterParams['input_form']->chart_type) && (in_array('mmsgperinterval',$filterParams['input_form']->chart_type) || in_array('mavgwaittime',$filterParams['input_form']->chart_type))) ? erLhcoreClassMailconvStatistic::messagesPerInterval($filterParams['filter'], [ 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), - 'group_by' => $filterParams['input_form']->groupby]) : array() + 'group_by' => $filterParams['input_form']->groupby]) : [] ), 'mmsgperuser' => ((is_array($filterParams['input_form']->chart_type) && in_array('mmsgperuser',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::messagesPerUser($filterParams['filter'], [ 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), - 'group_by' => $filterParams['input_form']->groupby]) : array() + 'group_by' => $filterParams['input_form']->groupby]) : [] ), 'mmsgperdep' => ((is_array($filterParams['input_form']->chart_type) && in_array('mmsgperdep',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::messagesPerDep($filterParams['filter'], [ 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), 'group_by' => $filterParams['input_form']->groupby - ]) : array()), + ]) : []), 'mmintperdep' => ((is_array($filterParams['input_form']->chart_type) && in_array('mmintperdep',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::avgInteractionPerDep($filterParams['filter'], [ 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), 'group_by' => $filterParams['input_form']->groupby - ]) : array()), + ]) : []), 'mmintperuser' => ((is_array($filterParams['input_form']->chart_type) && in_array('mmintperuser',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::avgInteractionPerUser($filterParams['filter'], [ 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), 'group_by' => $filterParams['input_form']->groupby - ]) : array()), - 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('mattrgroup',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::attrByPerInterval($filterParams['filter'], array( + ]) : []), + 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('mattrgroup',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::attrByPerInterval($filterParams['filter'], [ 'group_by' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field, 'group_limit' => $filterParams['input']->group_limit, 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), - )) : array()), + ]) : []), 'msgperhour' => ((is_array($filterParams['input_form']->chart_type) && in_array('msgperhour',$filterParams['input_form']->chart_type)) ? erLhcoreClassMailconvStatistic::messagesPerHour($filterParams['filter'], [ 'chart_type' => (is_array($filterParams['input_form']->chart_type) ? $filterParams['input_form']->chart_type : []), 'group_by' => $filterParams['input_form']->groupby - ]) : array()), + ]) : []), 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - ); + ]; if (isset($_GET['reportType']) && $_GET['reportType'] != 'live') { erLhcoreClassMailconvStatistic::exportCSV($activeStats, $_GET['reportType']); @@ -451,12 +454,12 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } elseif ($tab == 'chatsstatistic') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'chatsstatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'chatsstatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'chatsstatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'chatsstatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); if (empty($filterParams['input_form']->chart_type)) { $configuration = (array)erLhcoreClassModelChatConfig::fetch('statistic_options')->data; - $filterParams['input_form']->chart_type = isset($configuration['chat_statistic']) ? $configuration['chat_statistic'] : array(); + $filterParams['input_form']->chart_type = isset($configuration['chat_statistic']) ? $configuration['chat_statistic'] : []; } } @@ -469,7 +472,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($filterParams['filter']['filterin']['lh_chat.dep_id'])) { $filterParams['filter']['filterin']['lh_chat.dep_id'] = array_values(array_intersect($filterParams['filter']['filterin']['lh_chat.dep_id'],$departmentFilter['filterin']['id'])); if (empty($filterParams['filter']['filterin']['lh_chat.dep_id'])) { - $filterParams['filter']['filterin']['lh_chat.dep_id'] = array(-1); + $filterParams['filter']['filterin']['lh_chat.dep_id'] = [-1]; } } else { $filterParams['filter']['filterin']['lh_chat.dep_id'] = array_values($departmentFilter['filterin']['id']); @@ -487,7 +490,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.chatsstatistic_filter',array('filter' => & $filterParams, 'uparams' => $Params['user_parameters_unordered'])); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.chatsstatistic_filter',['filter' => & $filterParams, 'uparams' => $Params['user_parameters_unordered']]); if ($filterParams['input_form']->op_msg_count !== false && is_numeric($filterParams['input_form']->op_msg_count)) { $n = (int)$filterParams['input_form']->op_msg_count; @@ -529,7 +532,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($_GET['doSearch'])) { if ($filterParams['input_form']->groupby == 1) { - $activeStats = array( + $activeStats = [ 'numberOfChatsPerMonth' => ( (is_array($filterParams['input_form']->chart_type) && ( in_array('active',$filterParams['input_form']->chart_type) || @@ -540,17 +543,17 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { in_array('msgdelop',$filterParams['input_form']->chart_type) || in_array('msgdelbot',$filterParams['input_form']->chart_type) ) - ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerDay($filterParams['filter'], array('charttypes' => $filterParams['input_form']->chart_type)) : array()), - 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTimePerDay($filterParams['filter']): array()), + ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerDay($filterParams['filter'], ['charttypes' => $filterParams['input_form']->chart_type]) : []), + 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTimePerDay($filterParams['filter']): []), - 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateDay($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), - 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNickDay($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), - 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field)) : array()), + 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateDay($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), + 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNickDay($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), + 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field]) : []), 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - ); + ]; } elseif ($filterParams['input_form']->groupby == 2) { - $activeStats = array( - 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field)) : array()), + $activeStats = [ + 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field]) : []), 'numberOfChatsPerMonth' => ( (is_array($filterParams['input_form']->chart_type) && ( in_array('active',$filterParams['input_form']->chart_type) || @@ -561,17 +564,17 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { in_array('msgdelop',$filterParams['input_form']->chart_type) || in_array('msgdelbot',$filterParams['input_form']->chart_type) ) - ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerWeek($filterParams['filter'], array('charttypes' => $filterParams['input_form']->chart_type)): array()), - 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTimePerWeek($filterParams['filter']): array()), + ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerWeek($filterParams['filter'], ['charttypes' => $filterParams['input_form']->chart_type]): []), + 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTimePerWeek($filterParams['filter']): []), - 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateWeek($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), - 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNickWeek($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), + 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateWeek($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), + 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNickWeek($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - ); + ]; } elseif ($filterParams['input_form']->groupby == 3) { - $activeStats = array( - 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field)) : array()), + $activeStats = [ + 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field]) : []), 'numberOfChatsPerMonth' => ( (is_array($filterParams['input_form']->chart_type) && ( in_array('active',$filterParams['input_form']->chart_type) || @@ -582,17 +585,17 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { in_array('msgdelop',$filterParams['input_form']->chart_type) || in_array('msgdelbot',$filterParams['input_form']->chart_type) ) - ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerWeekDay($filterParams['filter'], array('charttypes' => $filterParams['input_form']->chart_type)): array()), - 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTimePerWeekDay($filterParams['filter']): array()), + ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerWeekDay($filterParams['filter'], ['charttypes' => $filterParams['input_form']->chart_type]): []), + 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTimePerWeekDay($filterParams['filter']): []), - 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateWeekDay($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), - 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNickWeekDay($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), + 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateWeekDay($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), + 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNickWeekDay($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - ); + ]; } else { - $activeStats = array( - 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field)) : array()), + $activeStats = [ + 'by_channel' => ((is_array($filterParams['input_form']->chart_type) && in_array('by_channel',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::byChannel($filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'groupby' => $filterParams['input_form']->groupby, 'group_field' => $filterParams['input']->group_field]) : []), 'numberOfChatsPerMonth' => ( (is_array($filterParams['input_form']->chart_type) && ( in_array('active',$filterParams['input_form']->chart_type) || @@ -603,14 +606,14 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { in_array('msgdelop',$filterParams['input_form']->chart_type) || in_array('msgdelbot',$filterParams['input_form']->chart_type) ) - ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerMonth($filterParams['filter'], array('charttypes' => $filterParams['input_form']->chart_type)) : array()), - 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTime($filterParams['filter']) : array()), + ) ? erLhcoreClassChatStatistic::getNumberOfChatsPerMonth($filterParams['filter'], ['charttypes' => $filterParams['input_form']->chart_type]) : []), + 'numberOfChatsPerWaitTimeMonth' => ((is_array($filterParams['input_form']->chart_type) && in_array('waitmonth',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::getNumberOfChatsWaitTime($filterParams['filter']) : []), - 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDate(30,$filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), - 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNick(30,$filterParams['filter'], array('group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field)) : array()), + 'nickgroupingdate' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdate',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDate(30,$filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), + 'nickgroupingdatenick' => ((is_array($filterParams['input_form']->chart_type) && in_array('nickgroupingdatenick',$filterParams['input_form']->chart_type)) ? erLhcoreClassChatStatistic::nickGroupingDateNick(30,$filterParams['filter'], ['group_limit' => $filterParams['input']->group_limit, 'group_field' => $filterParams['input']->group_field]) : []), 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - ); + ]; } if (isset($_GET['reportType']) && $_GET['reportType'] != 'live') { @@ -624,15 +627,15 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } else if ($tab == 'last24') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'last24statistic','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'last24statistic','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'last24statistic','format_filter' => true, 'uparams' => array())); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'last24statistic','format_filter' => true, 'uparams' => []]); } erLhcoreClassChatStatistic::formatUserFilter($filterParams); if (empty($filterParams['filter'])) { - $filter24 = array('filtergte' => array('time' => (time()-(24*3600)))); + $filter24 = ['filtergte' => ['time' => (time()-(24*3600))]]; } else { $filter24 = $filterParams['filter']; } @@ -643,7 +646,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($filter24['filterin']['lh_chat.dep_id'])) { $filter24['filterin']['lh_chat.dep_id'] = array_values(array_intersect($filter24['filterin']['lh_chat.dep_id'],$departmentFilter['filterin']['id'])); if (empty($filter24['filterin']['lh_chat.dep_id'])) { - $filter24['filterin']['lh_chat.dep_id'] = array(-1); + $filter24['filterin']['lh_chat.dep_id'] = [-1]; } } else { $filter24['filterin']['lh_chat.dep_id'] = array_values($departmentFilter['filterin']['id']); @@ -673,9 +676,9 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } else if ($tab == 'agentstatistic') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'agent_statistic','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'agent_statistic','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'agent_statistic','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'agent_statistic','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); } $userFilterDefault = erLhcoreClassGroupUser::getConditionalUserFilter(); @@ -700,7 +703,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($_GET['doSearch'])) { $agentStatistic = erLhcoreClassChatStatistic::getAgentStatistic(30, $filterParams['filter'], $filterParams['input']); } else { - $agentStatistic = array(); + $agentStatistic = []; } $tpl->set('input',$filterParams['input_form']); @@ -711,9 +714,9 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } else if ($tab == 'performance') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'performance_statistic', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat', 'module_file' => 'performance_statistic', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat', 'module_file' => 'performance_statistic', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat', 'module_file' => 'performance_statistic', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); } erLhcoreClassChatStatistic::formatUserFilter($filterParams); @@ -731,7 +734,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($_GET['doSearch'])) { $performanceStatistic = erLhcoreClassChatStatistic::getPerformanceStatistic(30, $filterParams['filter'], $filterParams); } else { - $performanceStatistic = array(); + $performanceStatistic = []; } $tpl->set('input', $filterParams['input_form']); @@ -740,9 +743,9 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } else if ($tab == 'departments') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'departments_statistic','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'departments_statistic','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'departments_statistic','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'departments_statistic','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); } erLhcoreClassChatStatistic::formatUserFilter($filterParams, 'lh_departament_availability'); @@ -758,7 +761,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($_GET['doSearch']) || $Params['user_parameters_unordered']['xls'] == 1) { $departmentstats = erLhcoreClassChatStatistic::getDepartmentsStatistic(30, $filterParams['filter'], $filterParams); } else { - $departmentstats = array(); + $departmentstats = []; } if ($Params['user_parameters_unordered']['xls'] == 1) { @@ -777,11 +780,11 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { $statisticOptions = erLhcoreClassModelChatConfig::fetch('statistic_options'); $configuration = (array)$statisticOptions->data; if (!isset($configuration['statistic'])) { - $configuration['statistic'] = array(); + $configuration['statistic'] = []; } if (!isset($configuration['chat_statistic'])) { - $configuration['chat_statistic'] = array(); + $configuration['chat_statistic'] = []; } if (!isset($configuration['work_hours_starts'])) { @@ -799,7 +802,7 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { exit; } - $definition = array( + $definition = [ 'chart_type' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string', null,FILTER_REQUIRE_ARRAY ), @@ -810,21 +813,21 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { ezcInputFormDefinitionElement::OPTIONAL, 'string',null,FILTER_REQUIRE_ARRAY ), 'work_hours_starts' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'max_range' => 23) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0, 'max_range' => 23] ), 'work_hours_ends' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 0, 'max_range' => 23) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 0, 'max_range' => 23] ), 'avg_wait_time' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5*60, 'max_range' => 4*7*24*3600) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 5*60, 'max_range' => 4*7*24*3600] ), 'avg_chat_duration' => new ezcInputFormDefinitionElement( - ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 5*60, 'max_range' => 4*7*24*3600) + ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 5*60, 'max_range' => 4*7*24*3600] ) - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ($form->hasValidData('chart_type')) { $configuration['statistic'] = $form->chart_type; @@ -879,11 +882,11 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { } else if ($tab == 'visitors') { if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'visitorsstatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'visitorsstatistic_tab','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'chat','module_file' => 'visitorsstatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'chat','module_file' => 'visitorsstatistic_tab','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $configuration = (array)erLhcoreClassModelChatConfig::fetch('statistic_options')->data; - $filterParams['input_form']->chart_type = isset($configuration['chat_statistic']) ? $configuration['chat_statistic'] : array(); + $filterParams['input_form']->chart_type = isset($configuration['chat_statistic']) ? $configuration['chat_statistic'] : []; } erLhcoreClassChatStatistic::formatUserFilter($filterParams,'lh_chat_online_user'); @@ -899,30 +902,29 @@ function reportModal($filterParams, $Params, $tab, $currentUser) { if (isset($_GET['doSearch'])) { - $visitors_statistic = erLhcoreClassChatStatistic::getVisitorsStatistic($filterParams['filter'], array('groupby' => $filterParams['input_form']->groupby,'charttypes' => $filterParams['input_form']->chart_type)); + $visitors_statistic = erLhcoreClassChatStatistic::getVisitorsStatistic($filterParams['filter'], ['groupby' => $filterParams['input_form']->groupby,'charttypes' => $filterParams['input_form']->chart_type]); if (isset($_GET['reportType']) && $_GET['reportType'] != 'live') { erLhcoreClassChatStatistic::exportCSV($visitors_statistic, $_GET['reportType']); exit; } - $tpl->setArray(array( + $tpl->setArray([ 'visitors_statistic' => $visitors_statistic, 'urlappend' => erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']) - )); + ]); } } else { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.process_tab', array( + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.process_tab', [ 'tpl' => & $tpl, 'params' => $Params - )); + ]); } $tpl->set('tab',$tab); $Result['content'] = $tpl->fetch(); -$Result['path'] = array(array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/statistic','Statistic'))); -$Result['additional_header_js'] = ''; +$Result['path'] = [['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/statistic', 'Statistic')]]; +$Result['additional_header_js'] = ''; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.statistic_path',array('result' => & $Result)); -?> \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.statistic_path',['result' => & $Result]); diff --git a/lhc_web/modules/lhsurvey/collected.php b/lhc_web/modules/lhsurvey/collected.php index 8e2f5c4b0e..82401a66f9 100644 --- a/lhc_web/modules/lhsurvey/collected.php +++ b/lhc_web/modules/lhsurvey/collected.php @@ -26,10 +26,10 @@ } if (isset($_GET['doSearch'])) { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'survey','module_file' => 'survey_search','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'survey','module_file' => 'survey_search','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = true; } else { - $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'survey','module_file' => 'survey_search','format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); + $filterParams = erLhcoreClassSearchHandler::getParams(['module' => 'survey','module_file' => 'survey_search','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']]); $filterParams['is_search'] = false; } @@ -53,7 +53,7 @@ if ($filterParams['input_form']->group_results == true) { $filterSearch['group'] = 'user_id'; $filterSearch['sort'] = 'total_stars DESC'; - $filterSearch['select_columns'] = array('count(id) as chats_number','SUM(max_stars_1) as total_stars'); + $filterSearch['select_columns'] = ['count(id) as chats_number','SUM(max_stars_1) as total_stars']; if (is_numeric($filterParams['input_form']->minimum_chats) && $filterParams['input_form']->minimum_chats > 0) { $filterSearch['having'] = 'count(id) > ' . (int)$filterParams['input_form']->minimum_chats ; @@ -61,33 +61,33 @@ } if ($Params['user_parameters_unordered']['xls'] == 1) { - erLhcoreClassSurveyExporter::exportXLS(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,array('offset' => 0, 'limit' => 100000)))); + erLhcoreClassSurveyExporter::exportXLS(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,['offset' => 0, 'limit' => 100000]))); exit; } if ($Params['user_parameters_unordered']['csvlist'] == 1) { - erLhcoreClassSurveyExporter::exportCSV(array_merge($filterSearch,array('offset' => 0, 'limit' => 100000)), $survey); + erLhcoreClassSurveyExporter::exportCSV(array_merge($filterSearch,['offset' => 0, 'limit' => 100000]), $survey); exit; } if ($Params['user_parameters_unordered']['xlslist'] == 1) { - erLhcoreClassSurveyExporter::exportXLSList(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,array('offset' => 0, 'limit' => 100000))),$survey); + erLhcoreClassSurveyExporter::exportXLSList(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,['offset' => 0, 'limit' => 100000])),$survey); exit; } if ($Params['user_parameters_unordered']['json'] == 1) { - erLhcoreClassSurveyExporter::exportJSON(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,array('offset' => 0, 'limit' => 100000))),$survey); + erLhcoreClassSurveyExporter::exportJSON(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,['offset' => 0, 'limit' => 100000])),$survey); exit; } if ($Params['user_parameters_unordered']['xml'] == 1) { - erLhcoreClassSurveyExporter::exportJSON(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,array('offset' => 0, 'limit' => 100000))),$survey,'xml'); + erLhcoreClassSurveyExporter::exportJSON(erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,['offset' => 0, 'limit' => 100000])),$survey,'xml'); exit; } if ($Params['user_parameters_unordered']['print'] == 1) { $tpl = erLhcoreClassTemplate::getInstance('lhsurvey/printsurvey.tpl.php'); - $items = erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,array('offset' => 0, 'limit' => 100000))); + $items = erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,['offset' => 0, 'limit' => 100000])); $tpl->set('items',$items); $tpl->set('survey',$survey); $Result['content'] = $tpl->fetch(); @@ -109,9 +109,9 @@ $pages->setItemsPerPage(20); $pages->paginate(); -$items = array(); +$items = []; if ($pages->items_total > 0) { - $items = erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,array('offset' => $pages->low, 'limit' => $pages->items_per_page))); + $items = erLhAbstractModelSurveyItem::getList(array_merge($filterSearch,['offset' => $pages->low, 'limit' => $pages->items_per_page])); } $tpl->set('items',$items); @@ -131,7 +131,5 @@ $object_trans = $survey->getModuleTranslations(); -$Result['path'][] = array('url' => erLhcoreClassDesign::baseurl('abstract/list').'/Survey','title' => $object_trans['name']); -$Result['path'][] = array('title' => (string)$survey); - -?> \ No newline at end of file +$Result['path'][] = ['url' => erLhcoreClassDesign::baseurl('abstract/list').'/Survey','title' => $object_trans['name']]; +$Result['path'][] = ['title' => (string)$survey]; diff --git a/lhc_web/modules/lhsurvey/module.php b/lhc_web/modules/lhsurvey/module.php index 8165222095..f7ad3ddcfb 100644 --- a/lhc_web/modules/lhsurvey/module.php +++ b/lhc_web/modules/lhsurvey/module.php @@ -1,87 +1,54 @@ "Survey"); - -$ViewList = array(); - -$ViewList['fillwidget'] = array( - 'params' => array(), - 'uparams' => array('chatid','ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','eclose') -); - -$ViewList['fill'] = array( - 'params' => array(), - 'uparams' => array('chatid','ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','eclose') -); - -$ViewList['fillinline'] = array( - 'params' => array(), - 'uparams' => array() -); - -$ViewList['backtochat'] = array( - 'params' => array('chat_id','hash','survey'), - 'uparams' => array() -); - -$ViewList['themesurvey'] = array( - 'params' => array('theme'), - 'uparams' => array() -); - -$ViewList['isfilled'] = array( - 'params' => array('chat_id','hash','survey'), - 'uparams' => array() -); - -$ViewList['choosesurvey'] = array( - 'params' => array('chat_id','survey_id'), - 'uparams' => array(), - 'functions' => array( 'redirect_to_survey' ) -); - -$ViewList['collected'] = array( - 'params' => array('survey_id'), - 'uparams' => array('timefrom','timeto','department_id','user_id','print','xls','xlslist','xml','json','group_results','minimum_chats', - 'max_stars_1', - 'max_stars_2', - 'max_stars_3', - 'max_stars_4', - 'max_stars_5', - 'question_options_1', - 'question_options_2', - 'question_options_3', - 'question_options_4', - 'question_options_5', - 'department_ids', - 'department_group_ids', - 'user_ids', - 'group_ids', - 'csvlist', - 'action', - 'id', - 'csfr' - ), - 'functions' => array( 'list_survey' ), - 'multiple_arguments' => array('max_stars_1','max_stars_2','max_stars_3','max_stars_4','max_stars_5', - 'department_ids', - 'department_group_ids', - 'user_ids', - 'group_ids', - ) -); - -$ViewList['collecteditem'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'list_survey' ) -); - -$FunctionList = array(); -$FunctionList['list_survey'] = array('explain' => 'Allow operator to view survey statistic'); -$FunctionList['manage_survey'] = array('explain' => 'Allow operator to edit survey'); -$FunctionList['delete_survey'] = array('explain' => 'Allow operator to delete survey'); -$FunctionList['delete_collected'] = array('explain' => 'Allow operator to delete collected items'); -$FunctionList['redirect_to_survey'] = array('explain' => 'Allow operator to redirect visitor to survey'); - -?> \ No newline at end of file +$Module = ['name' => 'Survey']; + +$ViewList = [ + 'fillwidget' => [ + 'params' => [], + 'uparams' => ['chatid', 'ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'eclose'], + ], + 'fill' => [ + 'params' => [], + 'uparams' => ['chatid', 'ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'eclose'], + ], + 'fillinline' => [ + 'params' => [], + 'uparams' => [], + ], + 'backtochat' => [ + 'params' => ['chat_id', 'hash', 'survey'], + 'uparams' => [], + ], + 'themesurvey' => [ + 'params' => ['theme'], + 'uparams' => [], + ], + 'isfilled' => [ + 'params' => ['chat_id', 'hash', 'survey'], + 'uparams' => [], + ], + 'choosesurvey' => [ + 'params' => ['chat_id', 'survey_id'], + 'uparams' => [], + 'functions' => ['redirect_to_survey'], + ], + 'collected' => [ + 'params' => ['survey_id'], + 'uparams' => ['timefrom', 'timeto', 'department_id', 'user_id', 'print', 'xls', 'xlslist', 'xml', 'json', 'group_results', 'minimum_chats', 'max_stars_1', 'max_stars_2', 'max_stars_3', 'max_stars_4', 'max_stars_5', 'question_options_1', 'question_options_2', 'question_options_3', 'question_options_4', 'question_options_5', 'department_ids', 'department_group_ids', 'user_ids', 'group_ids', 'csvlist', 'action', 'id', 'csfr'], + 'functions' => ['list_survey'], + 'multiple_arguments' => ['max_stars_1', 'max_stars_2', 'max_stars_3', 'max_stars_4', 'max_stars_5', 'department_ids', 'department_group_ids', 'user_ids', 'group_ids'], + ], + 'collecteditem' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['list_survey'], + ], +]; + +$FunctionList = [ + 'list_survey' => ['explain' => 'Allow operator to view survey statistic'], + 'manage_survey' => ['explain' => 'Allow operator to edit survey'], + 'delete_survey' => ['explain' => 'Allow operator to delete survey'], + 'delete_collected' => ['explain' => 'Allow operator to delete collected items'], + 'redirect_to_survey' => ['explain' => 'Allow operator to redirect visitor to survey'], +]; diff --git a/lhc_web/modules/lhsystem/bbcode.php b/lhc_web/modules/lhsystem/bbcode.php index 26e1c26bda..f04c6f6236 100644 --- a/lhc_web/modules/lhsystem/bbcode.php +++ b/lhc_web/modules/lhsystem/bbcode.php @@ -20,14 +20,14 @@ exit; } - $definition = array( + $definition = [ 'enabled_visitor' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null,FILTER_REQUIRE_ARRAY), 'enabled_operator' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null,FILTER_REQUIRE_ARRAY), 'url_whitelist' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), - ); + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ($form->hasValidData('enabled_visitor')) { $data['div'] = $form->enabled_visitor; @@ -63,14 +63,12 @@ $tpl->set('bbcode_options',$data); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array( +$Result['path'] = [ + [ 'url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/settings', 'System configuration') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/etracking', 'BBCode configuration') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhsystem/ga.php b/lhc_web/modules/lhsystem/ga.php index f475ccfae7..015f2d9b81 100644 --- a/lhc_web/modules/lhsystem/ga.php +++ b/lhc_web/modules/lhsystem/ga.php @@ -12,7 +12,7 @@ exit; } - $definition = array( + $definition = [ 'ga' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'boolean' ), @@ -25,10 +25,10 @@ 'js_static' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ), - 'ga_dep' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int',array('min_range' => 1),FILTER_REQUIRE_ARRAY) - ); + 'ga_dep' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 1], FILTER_REQUIRE_ARRAY) + ]; - $optionsEvents = array( + $optionsEvents = [ 'showWidget', 'closeWidget', 'openPopup', @@ -46,7 +46,7 @@ 'readInvitation', 'clickAction', 'botTrigger', - ); + ]; foreach ($optionsEvents as $event){ $definition[$event . '_category'] = new ezcInputFormDefinitionElement( @@ -64,7 +64,7 @@ } $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ($form->hasValidData( 'ga' ) && $form->ga == true ) { $data['ga_enabled'] = 1; @@ -135,18 +135,16 @@ $Result['content'] = $tpl->fetch(); -$Result['path'] = array( - array( +$Result['path'] = [ + [ 'url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/settings', 'System configuration') - ), - array( + ], + [ 'url' => erLhcoreClassDesign::baseurl('chatsettings/eventindex'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/etracking', 'Events tracking') - ), - array( + ], + [ 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/etracking', 'Default settings') - ) -); - -?> \ No newline at end of file + ] +]; diff --git a/lhc_web/modules/lhsystem/module.php b/lhc_web/modules/lhsystem/module.php index 47742dc9db..614c9ad64d 100644 --- a/lhc_web/modules/lhsystem/module.php +++ b/lhc_web/modules/lhsystem/module.php @@ -1,130 +1,112 @@ "System configuration"); - -$ViewList = array(); - -$ViewList['htmlcode'] = array( - 'params' => array(), - 'functions' => array( 'generatejs' ) -); - -$ViewList['htmlcodebeta'] = array( - 'params' => array(), - 'functions' => array( 'generatejs' ) -); - -$ViewList['embedcode'] = array( - 'params' => array(), - 'functions' => array( 'generatejs' ) -); - -$ViewList['configuration'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['offlinesettings'] = array( - 'params' => array(), - 'functions' => array( 'offlinesettings' ) -); - -$ViewList['usersactions'] = array( - 'params' => array(), - 'functions' => array( 'usersactions' ) -); - -$ViewList['expirecache'] = array( - 'params' => array(), - 'functions' => array( 'expirecache' ), - 'uparams' => array('csfr') -); - -$ViewList['smtp'] = array( - 'params' => array(), - 'functions' => array( 'configuresmtp' ) -); - -$ViewList['recaptcha'] = array( - 'params' => array(), - 'functions' => array( 'configurerecaptcha' ) -); - -$ViewList['timezone'] = array( - 'params' => array(), - 'functions' => array( 'timezone' ) -); - -$ViewList['languages'] = array( - 'params' => array(), - 'uparams' => array('updated','sa'), - 'functions' => array( 'changelanguage' ) -); - -$ViewList['update'] = array( - 'params' => array(), - 'uparams' => array('action','scope'), - 'functions' => array( 'performupdate' ) -); - -$ViewList['ga'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'ga_configuration' ) -); - -$ViewList['transferconfiguration'] = array( - 'params' => array(), - 'uparams' => array('action'), - 'functions' => array( 'transferconfiguration' ) -); - -$ViewList['autodbupdate'] = array( - 'params' => array('hash'), - 'uparams' => array() -); - -$ViewList['singlesetting'] = array( - 'params' => array('identifier'), - 'uparams' => array(), - 'functions' => array( 'singlesetting' ) -); - -$ViewList['bbcode'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'messagecontentprotection' ) -); - -$ViewList['notice'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'notice' ) -); - -$ViewList['confirmdialog'] = array( - 'params' => array(), - 'uparams' => array() -); - -$FunctionList['use'] = array('explain' => 'Allow user to see configuration links'); -$FunctionList['expirecache'] = array('explain' => 'Allow user to clear cache'); -$FunctionList['generatejs'] = array('explain' => 'Allow user to access HTML generation'); -$FunctionList['configuresmtp'] = array('explain' => 'Allow user to configure SMTP'); -$FunctionList['configurelanguages'] = array('explain' => 'Allow user to configure languages'); -$FunctionList['changelanguage'] = array('explain' => 'Allow user to change their languages'); -$FunctionList['timezone'] = array('explain' => 'Allow user to change global time zone'); -$FunctionList['performupdate'] = array('explain' => 'Allow user to update Live Helper Chat'); -$FunctionList['changetemplates'] = array('explain' => 'Allow user to change e-mail templates'); -$FunctionList['generate_js_tab'] = array('explain' => 'User can see embed code tab'); -$FunctionList['transferconfiguration'] = array('explain' => 'User can configure transfer options'); -$FunctionList['offlinesettings'] = array('explain' => 'Allow user to change offline settings'); -$FunctionList['configurerecaptcha'] = array('explain' => 'Allow user to configure recaptcha'); -$FunctionList['auditlog'] = array('explain' => 'Allow user to see audit log'); -$FunctionList['usersactions'] = array('explain' => 'Allow user to see operators real time chats statistic'); -$FunctionList['ga_configuration'] = array('explain' => 'Allow user to configure Events Tracking'); -$FunctionList['singlesetting'] = array('explain' => 'Allow user to change app settings'); -$FunctionList['messagecontentprotection'] = array('explain' => 'Allow user to configure message content protection'); -$FunctionList['notice'] = array('explain' => 'Allow operator to configure static notice message'); - -?> \ No newline at end of file +$Module = ['name' => 'System configuration']; + +$ViewList = [ + 'htmlcode' => [ + 'params' => [], + 'functions' => ['generatejs'], + ], + 'htmlcodebeta' => [ + 'params' => [], + 'functions' => ['generatejs'], + ], + 'embedcode' => [ + 'params' => [], + 'functions' => ['generatejs'], + ], + 'configuration' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'offlinesettings' => [ + 'params' => [], + 'functions' => ['offlinesettings'], + ], + 'usersactions' => [ + 'params' => [], + 'functions' => ['usersactions'], + ], + 'expirecache' => [ + 'params' => [], + 'functions' => ['expirecache'], + 'uparams' => ['csfr'], + ], + 'smtp' => [ + 'params' => [], + 'functions' => ['configuresmtp'], + ], + 'recaptcha' => [ + 'params' => [], + 'functions' => ['configurerecaptcha'], + ], + 'timezone' => [ + 'params' => [], + 'functions' => ['timezone'], + ], + 'languages' => [ + 'params' => [], + 'uparams' => ['updated', 'sa'], + 'functions' => ['changelanguage'], + ], + 'update' => [ + 'params' => [], + 'uparams' => ['action', 'scope'], + 'functions' => ['performupdate'], + ], + 'ga' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['ga_configuration'], + ], + 'transferconfiguration' => [ + 'params' => [], + 'uparams' => ['action'], + 'functions' => ['transferconfiguration'], + ], + 'autodbupdate' => [ + 'params' => ['hash'], + 'uparams' => [], + ], + 'singlesetting' => [ + 'params' => ['identifier'], + 'uparams' => [], + 'functions' => ['singlesetting'], + ], + 'bbcode' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['messagecontentprotection'], + ], + 'notice' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['notice'], + ], + 'confirmdialog' => [ + 'params' => [], + 'uparams' => [], + ], +]; + +$FunctionList = [ + 'use' => ['explain' => 'Allow user to see configuration links'], + 'expirecache' => ['explain' => 'Allow user to clear cache'], + 'generatejs' => ['explain' => 'Allow user to access HTML generation'], + 'configuresmtp' => ['explain' => 'Allow user to configure SMTP'], + 'configurelanguages' => ['explain' => 'Allow user to configure languages'], + 'changelanguage' => ['explain' => 'Allow user to change their languages'], + 'timezone' => ['explain' => 'Allow user to change global time zone'], + 'performupdate' => ['explain' => 'Allow user to update Live Helper Chat'], + 'changetemplates' => ['explain' => 'Allow user to change e-mail templates'], + 'generate_js_tab' => ['explain' => 'User can see embed code tab'], + 'transferconfiguration' => ['explain' => 'User can configure transfer options'], + 'offlinesettings' => ['explain' => 'Allow user to change offline settings'], + 'configurerecaptcha' => ['explain' => 'Allow user to configure recaptcha'], + 'auditlog' => ['explain' => 'Allow user to see audit log'], + 'usersactions' => ['explain' => 'Allow user to see operators real time chats statistic'], + 'ga_configuration' => ['explain' => 'Allow user to configure Events Tracking'], + 'singlesetting' => ['explain' => 'Allow user to change app settings'], + 'messagecontentprotection' => ['explain' => 'Allow user to configure message content protection'], + 'notice' => ['explain' => 'Allow operator to configure static notice message'], +]; diff --git a/lhc_web/modules/lhtheme/module.php b/lhc_web/modules/lhtheme/module.php index bebaa8abb9..f613ec030e 100644 --- a/lhc_web/modules/lhtheme/module.php +++ b/lhc_web/modules/lhtheme/module.php @@ -2,78 +2,70 @@ $Module = ['name' => 'Theme', 'variable_params' => true]; -$ViewList = []; - -$ViewList['export'] = [ - 'params' => ['theme'], - 'functions' => ['administratethemes'] -]; - -$ViewList['import'] = [ - 'params' => [], - 'functions' => ['administratethemes'] -]; - -$ViewList['index'] = [ - 'params' => [], - 'functions' => ['administratethemes'] -]; - -$ViewList['default'] = [ - 'params' => [], - 'functions' => ['administratethemes'] -]; - -$ViewList['editthemebydepgroup'] = [ - 'params' => ['id'], - 'functions' => ['administratethemes'] -]; - -$ViewList['defaultadmintheme'] = [ - 'params' => [], - 'functions' => ['administratethemes'] -]; - -$ViewList['adminthemes'] = [ - 'params' => [], - 'functions' => ['administratethemes'] +$ViewList = [ + 'export' => [ + 'params' => ['theme'], + 'functions' => ['administratethemes'], + ], + 'import' => [ + 'params' => [], + 'functions' => ['administratethemes'], + ], + 'index' => [ + 'params' => [], + 'functions' => ['administratethemes'], + ], + 'default' => [ + 'params' => [], + 'functions' => ['administratethemes'], + ], + 'editthemebydepgroup' => [ + 'params' => ['id'], + 'functions' => ['administratethemes'], + ], + 'defaultadmintheme' => [ + 'params' => [], + 'functions' => ['administratethemes'], + ], + 'adminthemes' => [ + 'params' => [], + 'functions' => ['administratethemes'], + ], + 'personaltheme' => [ + 'params' => [], + 'functions' => ['personaltheme'], + ], + 'renderpreview' => [ + 'params' => ['id'], + 'functions' => ['use_operator'], + ], + 'admincss' => [ + 'params' => ['id'], + ], + 'adminnewtheme' => [ + 'params' => [], + 'functions' => ['administratethemes'], + ], + 'adminthemedelete' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['administratethemes'], + ], + 'adminthemeedit' => [ + 'params' => ['id'], + 'functions' => ['administratethemes'], + ], + 'deleteresource' => [ + 'params' => ['id', 'context', 'hash'], + 'functions' => ['administratethemes'], + ], + 'gethash' => [ + 'params' => [], + ], ]; -$ViewList['personaltheme'] = [ - 'params' => [], - 'functions' => ['personaltheme'] +$FunctionList = [ + 'administratethemes' => ['explain' => 'Allow users to maintain themes'], + 'personaltheme' => ['explain' => 'Allow operators have their own personal back office theme'], + 'use_operator' => ['explain' => 'Allow operator to preview trigger'], ]; - -$ViewList['renderpreview'] = [ - 'params' => ['id'], - 'functions' => ['use_operator'] -]; - -$ViewList['admincss'] = ['params' => ['id']]; - -$ViewList['adminnewtheme'] = [ - 'params' => [], - 'functions' => ['administratethemes'] -]; - -$ViewList['adminthemedelete'] = [ - 'params' => ['id'], - 'uparams' => ['csfr'], - 'functions' => ['administratethemes'], -]; - -$ViewList['adminthemeedit'] = [ - 'params' => ['id'], - 'functions' => ['administratethemes'] -]; - -$ViewList['deleteresource'] = [ - 'params' => ['id', 'context', 'hash'], - 'functions' => ['administratethemes'], -]; - -$ViewList['gethash'] = ['params' => []]; - -$FunctionList['administratethemes'] = ['explain' =>'Allow users to maintain themes']; -$FunctionList['personaltheme'] = ['explain' =>'Allow operators have their own personal back office theme']; -$FunctionList['use_operator'] = ['explain' =>'Allow operator to preview trigger']; diff --git a/lhc_web/modules/lhtranslation/module.php b/lhc_web/modules/lhtranslation/module.php index b7684125bb..e768e320dd 100644 --- a/lhc_web/modules/lhtranslation/module.php +++ b/lhc_web/modules/lhtranslation/module.php @@ -1,33 +1,31 @@ - 'Translation module']; - -$ViewList = []; - -$ViewList['configuration'] = [ - 'params' => [], - 'functions' => ['configuration'], - 'uparams' => ['csfr', 'action'] -]; - -$ViewList['starttranslation'] = [ - 'params' => ['chat_id', 'visitor_language', 'operator_language'], - 'functions' => ['use'], - 'uparams' => [] -]; - -$ViewList['translateoperatormessage'] = [ - 'params' => ['chat_id'], - 'functions' => ['use'], - 'uparams' => [] -]; - -$ViewList['translatevisitormessage'] = [ - 'params' => ['chat_id', 'msg_id'], - 'functions' => ['use'], - 'uparams' => [] -]; - -$FunctionList = []; -$FunctionList['configuration'] = ['explain' => 'Allow operator to configure automatic translations module']; -$FunctionList['use'] = ['explain' => 'Allow operator to use automatic translations']; + 'Translation module']; + +$ViewList = [ + 'configuration' => [ + 'params' => [], + 'functions' => ['configuration'], + 'uparams' => ['csfr', 'action'], + ], + 'starttranslation' => [ + 'params' => ['chat_id', 'visitor_language', 'operator_language'], + 'functions' => ['use'], + 'uparams' => [], + ], + 'translateoperatormessage' => [ + 'params' => ['chat_id'], + 'functions' => ['use'], + 'uparams' => [], + ], + 'translatevisitormessage' => [ + 'params' => ['chat_id', 'msg_id'], + 'functions' => ['use'], + 'uparams' => [], + ], +]; + +$FunctionList = [ + 'configuration' => ['explain' => 'Allow operator to configure automatic translations module'], + 'use' => ['explain' => 'Allow operator to use automatic translations'], +]; diff --git a/lhc_web/modules/lhuser/grouplist.php b/lhc_web/modules/lhuser/grouplist.php index a4a34a0eb2..f389eca14d 100644 --- a/lhc_web/modules/lhuser/grouplist.php +++ b/lhc_web/modules/lhuser/grouplist.php @@ -11,18 +11,17 @@ $tpl->set('pages',$pages); if ($pages->items_total > 0) { - $tpl->set('groups',erLhcoreClassModelGroup::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page ))); + $tpl->set('groups',erLhcoreClassModelGroup::getList(['offset' => $pages->low, 'limit' => $pages->items_per_page])); } else { - $tpl->set('groups',array()); + $tpl->set('groups',[]); } $tpl->set('currentUser',$currentUser); $Result['content'] = $tpl->fetch(); -$Result['path'] = array( -array('url' => erLhcoreClassDesign::baseurl('system/configuration'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/grouplist','System configuration')), -array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/grouplist','Groups')) -); +$Result['path'] = [ + ['url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/grouplist', 'System configuration')], + ['title' => erTranslationClassLhTranslation::getInstance()->getTranslation('user/grouplist', 'Groups')] +]; -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.grouplist_path', array('result' => & $Result)); -?> \ No newline at end of file +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.grouplist_path', ['result' => & $Result]); diff --git a/lhc_web/modules/lhuser/module.php b/lhc_web/modules/lhuser/module.php index 56b4d2e8d5..c8ca57d07a 100644 --- a/lhc_web/modules/lhuser/module.php +++ b/lhc_web/modules/lhuser/module.php @@ -1,274 +1,224 @@ "Users, groups management"); - -$ViewList = array(); - -$ViewList['login'] = array( - 'params' => array(), - 'uparams' => array('r','external_request','noaccess'), -); - -$ViewList['autologin'] = array( - 'params' => array('hash'), - 'uparams' => array('r','u','l','t'), -); - -$ViewList['autologinuser'] = array( - 'params' => array('hash'), - 'uparams' => array(), -); - -$ViewList['logout'] = array( - 'params' => array(), - 'uparams' => array('csfr') -); - -$ViewList['loginas'] = array( - 'params' => array('id'), - 'functions' => array( 'loginas' ) -); - -$ViewList['loginasuser'] = array( - 'params' => array('id'), - 'uparams' => array('hash', 'ts', 'showlogin') -); - -$ViewList['account'] = array( - 'params' => array(), - 'uparams' => array('msg','action','csfr','tab','title','message','fmsg'), - 'functions' => array( 'selfedit' ) -); - -$ViewList['editdepartment'] = array( - 'params' => array('user_id','dep_id'), - 'uparams' => array('csfr','action','mode','editor'), - 'functions' => array( 'selfedit' ) -); - -$ViewList['newdepartment'] = array( - 'params' => array('user_id'), - 'uparams' => array('csfr','mode','editor'), - 'functions' => array( 'selfedit' ) -); - -$ViewList['userdepartments'] = array( - 'params' => array('user_id'), - 'uparams' => array('editor'), - 'functions' => array( 'selfedit' ) -); - -$ViewList['avatarbuilder'] = array( - 'params' => array('id'), - 'uparams' => array(), - 'functions' => array( 'selfedit' ) -); - -$ViewList['userlist'] = array( - 'params' => array(), - 'uparams' => array('email' , 'name' , 'username' , 'surname', 'group_ids', 'disabled', 'export','timefrom','timeto','timefrom_minutes','timefrom_hours','timeto_hours','timeto_minutes','department_ids','department_group_ids'), - 'functions' => array( 'userlist' ), - 'multiple_arguments' => array('group_ids','department_ids','department_group_ids') -); - -$ViewList['grouplist'] = array( - 'params' => array(), - 'functions' => array( 'grouplist' ) -); - -$ViewList['edit'] = array( - 'params' => array('user_id'), - 'uparams' => array('tab', 'category', - 'timefrom','timefrom_hours','timefrom_seconds','timefrom_minutes', - 'timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours' - ), - 'functions' => array( 'edituser' ), - 'multiple_arguments' => array('category') -); - -$ViewList['delete'] = array( - 'params' => array('user_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'deleteuser' ) -); - -$ViewList['clone'] = array( - 'params' => array('user_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'clone' ) -); - -$ViewList['new'] = array( - 'params' => array(), - 'uparams' => array('tab'), - 'functions' => array( 'createuser' ) -); - -$ViewList['import'] = array( - 'params' => array(), - 'uparams' => array(), - 'functions' => array( 'import' ) -); - -$ViewList['newgroup'] = array( - 'params' => array(), - 'functions' => array( 'creategroup', 'editgroup' ) -); - -$ViewList['editgroup'] = array( - 'params' => array('group_id'), - 'functions' => array( 'editgroup' ) - ); - -$ViewList['clonegroup'] = array( - 'params' => array('group_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'editgroup' ) -); - -$ViewList['groupassignuser'] = array( - 'params' => array('group_id'), - 'functions' => array( 'groupassignuser' ) - ); - -$ViewList['deletegroup'] = array( - 'params' => array('group_id'), - 'uparams' => array('csfr'), - 'functions' => array( 'deletegroup' ) - ); - -$ViewList['forgotpassword'] = array( - 'params' => array(), -); - -$ViewList['remindpassword'] = array( - 'params' => array('hash'), -); - -$ViewList['setsetting'] = array ( - 'params' => array('identifier','value'), - 'uparams' => array('csfr') -); - -$ViewList['setsettingajax'] = array ( - 'params' => array('identifier','value'), - 'uparams' => array('indifferent') -); - -$ViewList['setsettingajaxraw'] = array ( - 'params' => array('identifier') -); - -$ViewList['setoffline'] = array ( - 'functions' => array( 'changeonlinestatus' ), - 'params' => array('status') -); - -$ViewList['setalwaysonline'] = array ( - 'functions' => array( 'changealwaysonline' ), - 'params' => array('status') -); - -$ViewList['setinactive'] = array ( - 'functions' => array( 'changeonlinestatus' ), - 'params' => array('status') -); - -$ViewList['wentinactive'] = array ( - 'functions' => array( 'changeonlinestatus' ), - 'params' => array() -); - -$ViewList['setinvisible'] = array ( - 'functions' => array( 'changevisibility' ), - 'params' => array('status') -); - -$ViewList['autologinconfig'] = array( - 'params' => array(), - 'uparams' => array('csfr'), - 'functions' => array( 'userautologinconfig' ) -); - -$ViewList['passwordrequirements'] = array( - 'params' => array(), - 'uparams' => array('csfr'), - 'functions' => array( 'pswdsecurity' ) -); - -$ViewList['updatepassword'] = array( - 'params' => array('user_id','ts','hash'), - 'uparams' => array('csfr'), - 'functions' => array( ) -); - -$ViewList['setopstatus'] = array( - 'params' => array('user_id'), - 'functions' => array('setopstatus' ) -); - -$FunctionList['groupassignuser'] = array('explain' => 'Allow user to assign user to group'); -$FunctionList['editgroup'] = array('explain' => 'Allow user to edit group'); -$FunctionList['creategroup'] = array('explain' => 'Allow user to create group'); -$FunctionList['deletegroup'] = array('explain' => 'Allow user to delete group'); -$FunctionList['createuser'] = array('explain' => 'Allow user to create another user'); -$FunctionList['deleteuser'] = array('explain' => 'Allow user to delete another user'); -$FunctionList['edituser'] = array('explain' => 'Allow user to edit another user'); -$FunctionList['editusergroupall'] = array('explain' => 'Allow user to edit other user groups even if they are not a member of it.'); -$FunctionList['grouplist'] = array('explain' => 'Allow user to list group'); -$FunctionList['userlist'] = array('explain' => 'Allow user to list users'); -$FunctionList['selfedit'] = array('explain' => 'Allow user to edit their own data'); - - -// All department option -$FunctionList['self_all_departments'] = array('explain' => 'Allow user to assign themself to all departments option'); -$FunctionList['edit_all_departments'] = array('explain' => 'Allow user to assign other users to all departments option'); - -// Edit mode user -$FunctionList['assign_all_department_individual'] = array('explain' => 'Allow user edit other users all individual departments'); -$FunctionList['assign_all_department_group'] = array('explain' => 'Allow user to assign other users to all department groups'); - -$FunctionList['assign_to_own_department_individual'] = array('explain' => 'Allow user to change other users individual departments (only if operator belong to them)'); -$FunctionList['assign_to_own_department_group'] = array('explain' => 'Allow user to change other users departments groups (only if operator belong to them)'); - -$FunctionList['see_user_assigned_departments'] = array('explain' => 'Allow user to see to other user assigned departments'); -$FunctionList['see_user_assigned_departments_groups'] = array('explain' => 'Allow user to see to other user assigned departments groups'); - -// Self account -$FunctionList['see_assigned_departments'] = array('explain' => 'Allow user to see departments assigned to them'); -$FunctionList['see_assigned_departments_groups'] = array('explain' => 'Allow user to see departments groups assigned to them'); -$FunctionList['editdepartaments'] = array('explain' => 'Allow user to edit their own responsible departments/departments groups'); - - -$FunctionList['userlistonline'] = array('explain' => 'Allow user to see logged operators list, only from their department'); -$FunctionList['userlistonlineall'] = array('explain' => 'Allow user to see logged operators list, not only from their department'); -$FunctionList['changeonlinestatus'] = array('explain' => 'Allow user to change their online status'); -$FunctionList['changeskypenick'] = array('explain' => 'Allow user to change/enter their skype nick'); -$FunctionList['personalcannedmsg'] = array('explain' => 'Allow user to have personal canned messages'); -$FunctionList['personalautoresponder'] = array('explain' => 'Allow user to have personal auto responder messages'); -$FunctionList['changevisibility'] = array('explain' => 'Allow user to change their visibility mode'); -$FunctionList['change_visibility_list'] = array('explain' => 'Allow user to choose what list should be visible to them, pending/active/unread/closed'); -$FunctionList['allowtochoosependingmode'] = array('explain' => 'Allow user to choose what pending chats they can see, only assigned to them or all.'); -$FunctionList['receivepermissionrequest'] = array('explain' => 'Allow user to choose should if they should receive other operator\'s permission requests'); -$FunctionList['userautologin'] = array('explain' => 'Allow user to use autologin'); -$FunctionList['userautologinconfig'] = array('explain' => 'Allow user to configure autologin'); -$FunctionList['canseedepartmentstats'] = array('explain' => 'Allow user to see departments statistic'); -$FunctionList['canseealldepartmentstats'] = array('explain' => 'Allow user to see all departments statistic, not only from their departments'); -$FunctionList['import'] = array('explain' => 'Allow user to import users'); -$FunctionList['loginas'] = array('explain' => 'Allow user to login as other user'); -$FunctionList['passwordsecurity'] = array('explain' => 'Allow user to set password security requirements'); -$FunctionList['see_all'] = array('explain' => 'Allow user see all users/groups not only from their group/groups'); -$FunctionList['see_all_group_users'] = array('explain' => 'Allow user see all group users they belongs to.'); // should this be "user groups" rather than "group users"? -$FunctionList['changealwaysonline'] = array('explain' => 'Allow user to change always online mode'); -$FunctionList['setopstatus'] = array('explain' => 'Allow user to change other user online status from online operators widget'); -$FunctionList['change_chat_nickname'] = array('explain' => 'Allow user to change their own chat nickname'); -$FunctionList['changephoto'] = array('explain' => 'Allow user to change their own photo/avatar'); -$FunctionList['change_job_title'] = array('explain' => 'Allow user to change their own job title'); -$FunctionList['change_core_attributes'] = array('explain' => 'Allow user to change their own username/password/e-mail/XMPP Usernautoame'); -$FunctionList['change_name_surname'] = array('explain' => 'Allow user to change their own name/surname'); -$FunctionList['change_password'] = array('explain' => 'Allow user to change their password'); -$FunctionList['pswdsecurity'] = array('explain' => 'Allow user to manage password requirements'); -$FunctionList['largeactivitytimeout'] = array('explain' => 'Allow user to choose a large inactivity timeout'); -$FunctionList['clone'] = array('explain' => 'Allow user to clone other user and his settings'); - -?> +$Module = ['name' => 'Users, groups management']; + +$ViewList = [ + 'login' => [ + 'params' => [], + 'uparams' => ['r', 'external_request', 'noaccess'], + ], + 'autologin' => [ + 'params' => ['hash'], + 'uparams' => ['r', 'u', 'l', 't'], + ], + 'autologinuser' => [ + 'params' => ['hash'], + 'uparams' => [], + ], + 'logout' => [ + 'params' => [], + 'uparams' => ['csfr'], + ], + 'loginas' => [ + 'params' => ['id'], + 'functions' => ['loginas'], + ], + 'loginasuser' => [ + 'params' => ['id'], + 'uparams' => ['hash', 'ts', 'showlogin'], + ], + 'account' => [ + 'params' => [], + 'uparams' => ['msg', 'action', 'csfr', 'tab', 'title', 'message', 'fmsg'], + 'functions' => ['selfedit'], + ], + 'editdepartment' => [ + 'params' => ['user_id', 'dep_id'], + 'uparams' => ['csfr', 'action', 'mode', 'editor'], + 'functions' => ['selfedit'], + ], + 'newdepartment' => [ + 'params' => ['user_id'], + 'uparams' => ['csfr', 'mode', 'editor'], + 'functions' => ['selfedit'], + ], + 'userdepartments' => [ + 'params' => ['user_id'], + 'uparams' => ['editor'], + 'functions' => ['selfedit'], + ], + 'avatarbuilder' => [ + 'params' => ['id'], + 'uparams' => [], + 'functions' => ['selfedit'], + ], + 'userlist' => [ + 'params' => [], + 'uparams' => ['email', 'name', 'username', 'surname', 'group_ids', 'disabled', 'export', 'timefrom', 'timeto', 'timefrom_minutes', 'timefrom_hours', 'timeto_hours', 'timeto_minutes', 'department_ids', 'department_group_ids'], + 'functions' => ['userlist'], + 'multiple_arguments' => ['group_ids', 'department_ids', 'department_group_ids'], + ], + 'grouplist' => [ + 'params' => [], + 'functions' => ['grouplist'], + ], + 'edit' => [ + 'params' => ['user_id'], + 'uparams' => ['tab', 'category', 'timefrom', 'timefrom_hours', 'timefrom_seconds', 'timefrom_minutes', 'timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours'], + 'functions' => ['edituser'], + 'multiple_arguments' => ['category'], + ], + 'delete' => [ + 'params' => ['user_id'], + 'uparams' => ['csfr'], + 'functions' => ['deleteuser'], + ], + 'clone' => [ + 'params' => ['user_id'], + 'uparams' => ['csfr'], + 'functions' => ['clone'], + ], + 'new' => [ + 'params' => [], + 'uparams' => ['tab'], + 'functions' => ['createuser'], + ], + 'import' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['import'], + ], + 'newgroup' => [ + 'params' => [], + 'functions' => ['creategroup', 'editgroup'], + ], + 'editgroup' => [ + 'params' => ['group_id'], + 'functions' => ['editgroup'], + ], + 'clonegroup' => [ + 'params' => ['group_id'], + 'uparams' => ['csfr'], + 'functions' => ['editgroup'], + ], + 'groupassignuser' => [ + 'params' => ['group_id'], + 'functions' => ['groupassignuser'], + ], + 'deletegroup' => [ + 'params' => ['group_id'], + 'uparams' => ['csfr'], + 'functions' => ['deletegroup'], + ], + 'forgotpassword' => [ + 'params' => [], + ], + 'remindpassword' => [ + 'params' => ['hash'], + ], + 'setsetting' => [ + 'params' => ['identifier', 'value'], + 'uparams' => ['csfr'], + ], + 'setsettingajax' => [ + 'params' => ['identifier', 'value'], + 'uparams' => ['indifferent'], + ], + 'setsettingajaxraw' => [ + 'params' => ['identifier'], + ], + 'setoffline' => [ + 'functions' => ['changeonlinestatus'], + 'params' => ['status'], + ], + 'setalwaysonline' => [ + 'functions' => ['changealwaysonline'], + 'params' => ['status'], + ], + 'setinactive' => [ + 'functions' => ['changeonlinestatus'], + 'params' => ['status'], + ], + 'wentinactive' => [ + 'functions' => ['changeonlinestatus'], + 'params' => [], + ], + 'setinvisible' => [ + 'functions' => ['changevisibility'], + 'params' => ['status'], + ], + 'autologinconfig' => [ + 'params' => [], + 'uparams' => ['csfr'], + 'functions' => ['userautologinconfig'], + ], + 'passwordrequirements' => [ + 'params' => [], + 'uparams' => ['csfr'], + 'functions' => ['pswdsecurity'], + ], + 'updatepassword' => [ + 'params' => ['user_id', 'ts', 'hash'], + 'uparams' => ['csfr'], + 'functions' => [], + ], + 'setopstatus' => [ + 'params' => ['user_id'], + 'functions' => ['setopstatus'], + ], +]; + +$FunctionList = [ + 'groupassignuser' => ['explain' => 'Allow user to assign user to group'], + 'editgroup' => ['explain' => 'Allow user to edit group'], + 'creategroup' => ['explain' => 'Allow user to create group'], + 'deletegroup' => ['explain' => 'Allow user to delete group'], + 'createuser' => ['explain' => 'Allow user to create another user'], + 'deleteuser' => ['explain' => 'Allow user to delete another user'], + 'edituser' => ['explain' => 'Allow user to edit another user'], + 'editusergroupall' => ['explain' => 'Allow user to edit other user groups even if they are not a member of it.'], + 'grouplist' => ['explain' => 'Allow user to list group'], + 'userlist' => ['explain' => 'Allow user to list users'], + 'selfedit' => ['explain' => 'Allow user to edit their own data'], + 'self_all_departments' => ['explain' => 'Allow user to assign themself to all departments option'], + 'edit_all_departments' => ['explain' => 'Allow user to assign other users to all departments option'], + 'assign_all_department_individual' => ['explain' => 'Allow user edit other users all individual departments'], + 'assign_all_department_group' => ['explain' => 'Allow user to assign other users to all department groups'], + 'assign_to_own_department_individual' => ['explain' => 'Allow user to change other users individual departments (only if operator belong to them)'], + 'assign_to_own_department_group' => ['explain' => 'Allow user to change other users departments groups (only if operator belong to them)'], + 'see_user_assigned_departments' => ['explain' => 'Allow user to see to other user assigned departments'], + 'see_user_assigned_departments_groups' => ['explain' => 'Allow user to see to other user assigned departments groups'], + 'see_assigned_departments' => ['explain' => 'Allow user to see departments assigned to them'], + 'see_assigned_departments_groups' => ['explain' => 'Allow user to see departments groups assigned to them'], + 'editdepartaments' => ['explain' => 'Allow user to edit their own responsible departments/departments groups'], + 'userlistonline' => ['explain' => 'Allow user to see logged operators list, only from their department'], + 'userlistonlineall' => ['explain' => 'Allow user to see logged operators list, not only from their department'], + 'changeonlinestatus' => ['explain' => 'Allow user to change their online status'], + 'changeskypenick' => ['explain' => 'Allow user to change/enter their skype nick'], + 'personalcannedmsg' => ['explain' => 'Allow user to have personal canned messages'], + 'personalautoresponder' => ['explain' => 'Allow user to have personal auto responder messages'], + 'changevisibility' => ['explain' => 'Allow user to change their visibility mode'], + 'change_visibility_list' => ['explain' => 'Allow user to choose what list should be visible to them, pending/active/unread/closed'], + 'allowtochoosependingmode' => ['explain' => 'Allow user to choose what pending chats they can see, only assigned to them or all.'], + 'receivepermissionrequest' => ['explain' => 'Allow user to choose should if they should receive other operator\'s permission requests'], + 'userautologin' => ['explain' => 'Allow user to use autologin'], + 'userautologinconfig' => ['explain' => 'Allow user to configure autologin'], + 'canseedepartmentstats' => ['explain' => 'Allow user to see departments statistic'], + 'canseealldepartmentstats' => ['explain' => 'Allow user to see all departments statistic, not only from their departments'], + 'import' => ['explain' => 'Allow user to import users'], + 'loginas' => ['explain' => 'Allow user to login as other user'], + 'passwordsecurity' => ['explain' => 'Allow user to set password security requirements'], + 'see_all' => ['explain' => 'Allow user see all users/groups not only from their group/groups'], + 'see_all_group_users' => ['explain' => 'Allow user see all group users they belongs to.'], + 'changealwaysonline' => ['explain' => 'Allow user to change always online mode'], + 'setopstatus' => ['explain' => 'Allow user to change other user online status from online operators widget'], + 'change_chat_nickname' => ['explain' => 'Allow user to change their own chat nickname'], + 'changephoto' => ['explain' => 'Allow user to change their own photo/avatar'], + 'change_job_title' => ['explain' => 'Allow user to change their own job title'], + 'change_core_attributes' => ['explain' => 'Allow user to change their own username/password/e-mail/XMPP Usernautoame'], + 'change_name_surname' => ['explain' => 'Allow user to change their own name/surname'], + 'change_password' => ['explain' => 'Allow user to change their password'], + 'pswdsecurity' => ['explain' => 'Allow user to manage password requirements'], + 'largeactivitytimeout' => ['explain' => 'Allow user to choose a large inactivity timeout'], + 'clone' => ['explain' => 'Allow user to clone other user and his settings'], +]; diff --git a/lhc_web/modules/lhuser/setopstatus.php b/lhc_web/modules/lhuser/setopstatus.php index 054e068c7a..74330c1169 100644 --- a/lhc_web/modules/lhuser/setopstatus.php +++ b/lhc_web/modules/lhuser/setopstatus.php @@ -1,16 +1,17 @@ new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int') - ); + ]; $form = new ezcInputForm(INPUT_POST, $definition); - $Errors = array(); + $Errors = []; if ($form->hasValidData('onlineStatus') && $form->onlineStatus == 1) { $status = 0; @@ -37,7 +38,7 @@ $currentUser->updateLastVisit(time(), $user->hide_online == 1 ? 2 : 1, $user->id); // Went offline OR went online - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_status_changed',array('user' => & $user, 'reason' => 'user_action')); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.operator_status_changed', ['user' => & $user, 'reason' => 'user_action']); $db->commit(); @@ -49,11 +50,9 @@ } } -$tpl->setArray(array( +$tpl->setArray([ 'user' => $user -)); +]); echo $tpl->fetch(); exit(); - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhviews/loadinitialdata.php b/lhc_web/modules/lhviews/loadinitialdata.php index 0624b1e437..a34034335b 100644 --- a/lhc_web/modules/lhviews/loadinitialdata.php +++ b/lhc_web/modules/lhviews/loadinitialdata.php @@ -4,17 +4,13 @@ $views = erLhAbstractModelSavedSearch::getList(['limit' => false, 'filter' => ['status' => erLhAbstractModelSavedSearch::ACTIVE, 'user_id' => erLhcoreClassUser::instance()->getUserID()]]); -erLhcoreClassChat::prefillGetAttributes($views, array('id', 'passive', 'name', 'scope', 'total_records', 'updated_ago'), array(), array('remove_all' => true)); +erLhcoreClassChat::prefillGetAttributes($views, ['id', 'passive', 'name', 'scope', 'total_records', 'updated_ago'], [], ['remove_all' => true]); $response = [ 'views' => array_values($views), 'invites' => (int)erLhAbstractModelSavedSearch::getCount(['limit' => false, 'filter' => ['status' => erLhAbstractModelSavedSearch::INVITE, 'user_id' => erLhcoreClassUser::instance()->getUserID()]]) ]; - - echo json_encode($response); exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhviews/loadview.php b/lhc_web/modules/lhviews/loadview.php index ad041b0d18..83e2bf7f6d 100644 --- a/lhc_web/modules/lhviews/loadview.php +++ b/lhc_web/modules/lhviews/loadview.php @@ -37,21 +37,21 @@ $pages->serverURL = erLhcoreClassDesign::baseurl('views/loadview').'/'.$search->id; $pages->paginate(); $tpl->set('pages',$pages); - $filter = array_merge_recursive($filterSearch, array('limit' => $pages->items_per_page, 'offset' => $pages->low)); + $filter = array_merge_recursive($filterSearch, ['limit' => $pages->items_per_page, 'offset' => $pages->low]); $items = erLhcoreClassModelChat::getList($filter); - $iconsAdditional = erLhAbstractModelChatColumn::getList(array('ignore_fields' => array('position','conditions','column_identifier','enabled'), 'sort' => false, 'filter' => array('icon_mode' => 1, 'enabled' => 1, 'chat_enabled' => 1))); - erLhcoreClassChat::prefillGetAttributes($items, array(), array(), array('additional_columns' => $iconsAdditional, 'do_not_clean' => true)); + $iconsAdditional = erLhAbstractModelChatColumn::getList(['ignore_fields' => ['position','conditions','column_identifier','enabled'], 'sort' => false, 'filter' => ['icon_mode' => 1, 'enabled' => 1, 'chat_enabled' => 1]]); + erLhcoreClassChat::prefillGetAttributes($items, [], [], ['additional_columns' => $iconsAdditional, 'do_not_clean' => true]); $tpl->set('icons_additional',$iconsAdditional); if (!empty($items)) { - $subjectsChats = erLhAbstractModelSubjectChat::getList(array('filterin' => array('chat_id' => array_keys($items)))); - erLhcoreClassChat::prefillObjects($subjectsChats, array( - array( + $subjectsChats = erLhAbstractModelSubjectChat::getList(['filterin' => ['chat_id' => array_keys($items)]]); + erLhcoreClassChat::prefillObjects($subjectsChats, [ + [ 'subject_id', 'subject', 'erLhAbstractModelSubject::getList' - ), - )); + ], + ]); foreach ($subjectsChats as $chatSubject) { if (!is_array($items[$chatSubject->chat_id]->subjects)) { $items[$chatSubject->chat_id]->subjects = []; @@ -96,18 +96,18 @@ $pages->serverURL = erLhcoreClassDesign::baseurl('views/loadview').'/'.$search->id; $pages->paginate(); $tpl->set('pages', $pages); - $filter = array_merge_recursive($filterSearch, array('limit' => $pages->items_per_page, 'offset' => $pages->low)); + $filter = array_merge_recursive($filterSearch, ['limit' => $pages->items_per_page, 'offset' => $pages->low]); $items = erLhcoreClassModelMailconvConversation::getList($filter); if (!empty($items)) { - $subjectsChats = erLhcoreClassModelMailconvMessageSubject::getList(array('filterin' => array('conversation_id' => array_keys($items)))); - erLhcoreClassChat::prefillObjects($subjectsChats, array( - array( + $subjectsChats = erLhcoreClassModelMailconvMessageSubject::getList(['filterin' => ['conversation_id' => array_keys($items)]]); + erLhcoreClassChat::prefillObjects($subjectsChats, [ + [ 'subject_id', 'subject', 'erLhAbstractModelSubject::getList' - ), - )); + ], + ]); foreach ($subjectsChats as $chatSubject) { if (!is_array($items[$chatSubject->conversation_id]->subjects)) { $items[$chatSubject->conversation_id]->subjects = []; @@ -128,12 +128,12 @@ $content = $tpl->fetch(); } else { - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('views.loadview', array( + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('views.loadview', [ 'total_records' => & $totalRecords, 'content' => & $content, 'search' => $search, 'uparams' => $Params['user_parameters_unordered'] - )); + ]); } echo json_encode(['body' => $content, 'view_id' => $search->id, 'total_records' => (int)$totalRecords]); @@ -141,5 +141,3 @@ erLhcoreClassModule::logSlowRequest($startTimeRequest, microtime(), $currentUser->getUserID(), ['loadview' => $Params['user_parameters']['id']]); exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhviews/module.php b/lhc_web/modules/lhviews/module.php index 60ce789fb0..d011c06fe7 100644 --- a/lhc_web/modules/lhviews/module.php +++ b/lhc_web/modules/lhviews/module.php @@ -1,69 +1,59 @@ "Views module" ); - -$ViewList = array(); - -$ViewList['home'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['loadinitialdata'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['acceptinvites'] = array( - 'params' => array(), - 'uparams' => array('view'), - 'functions' => array( 'use' ) -); - -$ViewList['shareview'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['updatepassivemode'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['loadview'] = array( - 'params' => array('id'), - 'uparams' => array('mode'), - 'functions' => array( 'use' ) -); - -$ViewList['updateviews'] = array( - 'params' => array(), - 'functions' => array( 'use' ) -); - -$ViewList['edit'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['exportview'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['deleteview'] = array( - 'params' => array('id'), - 'functions' => array( 'use' ) -); - -$ViewList['view'] = array( - 'params' => array(), - 'functions' => array( 'configuration' ) -); - -$FunctionList['configuration'] = array('explain' => 'Allow operator to configure views'); -$FunctionList['use'] = array('explain' => 'Allow operator to use views'); -$FunctionList['use_chat'] = array('explain' => 'Allow operator to use views for chats'); -$FunctionList['use_mail'] = array('explain' => 'Allow operator to use views for mails'); - -?> \ No newline at end of file +$Module = ['name' => 'Views module']; + +$ViewList = [ + 'home' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'loadinitialdata' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'acceptinvites' => [ + 'params' => [], + 'uparams' => ['view'], + 'functions' => ['use'], + ], + 'shareview' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'updatepassivemode' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'loadview' => [ + 'params' => ['id'], + 'uparams' => ['mode'], + 'functions' => ['use'], + ], + 'updateviews' => [ + 'params' => [], + 'functions' => ['use'], + ], + 'edit' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'exportview' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'deleteview' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], + 'view' => [ + 'params' => [], + 'functions' => ['configuration'], + ], +]; + +$FunctionList = [ + 'configuration' => ['explain' => 'Allow operator to configure views'], + 'use' => ['explain' => 'Allow operator to use views'], + 'use_chat' => ['explain' => 'Allow operator to use views for chats'], + 'use_mail' => ['explain' => 'Allow operator to use views for mails'], +]; diff --git a/lhc_web/modules/lhviews/shareview.php b/lhc_web/modules/lhviews/shareview.php index b0f48b87ab..4825307845 100644 --- a/lhc_web/modules/lhviews/shareview.php +++ b/lhc_web/modules/lhviews/shareview.php @@ -12,18 +12,18 @@ exit; } - $definition = array( + $definition = [ 'name' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ), 'description' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw' ), - 'user_ids' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int',array('min_range' => 1),FILTER_REQUIRE_ARRAY) - ); + 'user_ids' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', ['min_range' => 1],FILTER_REQUIRE_ARRAY) + ]; $form = new ezcInputForm( INPUT_POST, $definition ); - $Errors = array(); + $Errors = []; if ( !$form->hasValidData( 'name' ) || $form->name == '' ) { $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg','Please enter a name'); @@ -63,4 +63,4 @@ $tpl->set('user_id', $user_id); echo $tpl->fetch(); -exit; \ No newline at end of file +exit; diff --git a/lhc_web/modules/lhviews/updateviews.php b/lhc_web/modules/lhviews/updateviews.php index 569a176527..e8a1fc8e8b 100644 --- a/lhc_web/modules/lhviews/updateviews.php +++ b/lhc_web/modules/lhviews/updateviews.php @@ -15,14 +15,15 @@ $views = erLhAbstractModelSavedSearch::getList(['limit' => false, 'filter' => ['status' => erLhAbstractModelSavedSearch::ACTIVE, 'user_id' => erLhcoreClassUser::instance()->getUserID()]]); -erLhcoreClassChat::prefillGetAttributes($views, array( +erLhcoreClassChat::prefillGetAttributes($views, [ 'id', 'name', 'description', 'scope', 'passive', 'total_records', - 'updated_ago'), array(), array('remove_all' => true)); + 'updated_ago' +], [], ['remove_all' => true]); $response = [ 'views' => array_values($views), @@ -32,5 +33,3 @@ echo json_encode($response); exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhvoicevideo/module.php b/lhc_web/modules/lhvoicevideo/module.php index 8617650627..85a23f8821 100644 --- a/lhc_web/modules/lhvoicevideo/module.php +++ b/lhc_web/modules/lhvoicevideo/module.php @@ -2,37 +2,34 @@ $Module = ['name' => 'Voice & Video & ScreenShare']; -$ViewList = []; - -$ViewList['configuration'] = [ - 'params' => [], - 'functions' => ['configuration'] -]; - -$ViewList['sessions'] = [ - 'params' => [], - 'functions' => ['configuration'] -]; - -$ViewList['call'] = [ - 'params' => ['id', 'hash'] +$ViewList = [ + 'configuration' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'sessions' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'call' => [ + 'params' => ['id', 'hash'], + ], + 'join' => [ + 'params' => ['id', 'hash'], + 'uparams' => ['action'], + ], + 'joinop' => [ + 'params' => ['id'], + 'uparams' => ['action'], + 'functions' => ['use'], + ], + 'joinoperator' => [ + 'params' => ['id'], + 'functions' => ['use'], + ], ]; -$ViewList['join'] = [ - 'params' => ['id', 'hash'], - 'uparams' => ['action'], +$FunctionList = [ + 'configuration' => ['explain' => 'Voice & Video & ScreenShare module configuration'], + 'use' => ['explain' => 'Allow operator to use Voice & Video & ScreenShare calls'], ]; - -$ViewList['joinop'] = [ - 'params' => ['id'], - 'uparams' => ['action'], - 'functions' => ['use'] -]; - -$ViewList['joinoperator'] = [ - 'params' => ['id'], - 'functions' => ['use'] -]; - -$FunctionList['configuration'] = ['explain' => 'Voice & Video & ScreenShare module configuration']; -$FunctionList['use'] = ['explain' => 'Allow operator to use Voice & Video & ScreenShare calls']; diff --git a/lhc_web/modules/lhwebhooks/module.php b/lhc_web/modules/lhwebhooks/module.php index fc0fcaed20..2e8794d5c3 100644 --- a/lhc_web/modules/lhwebhooks/module.php +++ b/lhc_web/modules/lhwebhooks/module.php @@ -2,66 +2,58 @@ $Module = ['name' => 'Webhooks']; -$ViewList = []; - -$ViewList['configuration'] = [ - 'params' => [], - 'uparams' => ['name','enabled','event'], - 'functions' => ['configuration'] -]; - -$ViewList['pushchat'] = [ - 'params' => [], - 'functions' => ['configuration'] -]; - -$ViewList['new'] = [ - 'params' => [], - 'functions' => ['configuration'] -]; - -$ViewList['newincoming'] = [ - 'params' => [], - 'functions' => ['configuration'] -]; - -$ViewList['editincoming'] = [ - 'params' => ['id'], - 'functions' => ['configuration'] -]; - -$ViewList['incoming'] = [ - 'params' => ['identifier'], +$ViewList = [ + 'configuration' => [ + 'params' => [], + 'uparams' => ['name', 'enabled', 'event'], + 'functions' => ['configuration'], + ], + 'pushchat' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'new' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'newincoming' => [ + 'params' => [], + 'functions' => ['configuration'], + ], + 'editincoming' => [ + 'params' => ['id'], + 'functions' => ['configuration'], + ], + 'incoming' => [ + 'params' => ['identifier'], + ], + 'edit' => [ + 'params' => ['id'], + 'uparams' => ['action', 'csfr'], + 'functions' => ['configuration'], + ], + 'delete' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['configuration'], + ], + 'deleteincoming' => [ + 'params' => ['id'], + 'uparams' => ['csfr'], + 'functions' => ['configuration'], + ], + 'incomingwebhooks' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['configuration'], + ], + 'dispatch' => [ + 'params' => [], + 'uparams' => [], + 'functions' => ['configuration'], + ], +]; + +$FunctionList = [ + 'configuration' => ['explain' => 'Webhooks module configuration'], ]; - -$ViewList['edit'] = [ - 'params' => ['id'], - 'uparams' => ['action','csfr'], - 'functions' => ['configuration'] -]; - -$ViewList['delete'] = [ - 'params' => ['id'], - 'uparams' => ['csfr'], - 'functions' => ['configuration'] -]; - -$ViewList['deleteincoming'] = [ - 'params' => ['id'], - 'uparams' => ['csfr'], - 'functions' => ['configuration'] -]; - -$ViewList['incomingwebhooks'] = [ - 'params' => [], - 'uparams' => [], - 'functions' => ['configuration'] -]; - -$ViewList['dispatch'] = [ - 'params' => [], - 'uparams' => [], - 'functions' => ['configuration'] -]; - -$FunctionList['configuration'] = ['explain' => 'Webhooks module configuration']; diff --git a/lhc_web/modules/lhwidgetrestapi/getproducts.php b/lhc_web/modules/lhwidgetrestapi/getproducts.php index 8adc3c3db1..dac6b09c04 100644 --- a/lhc_web/modules/lhwidgetrestapi/getproducts.php +++ b/lhc_web/modules/lhwidgetrestapi/getproducts.php @@ -6,40 +6,36 @@ if (isset($departament->product_configuration_array['products_enabled']) && $departament->product_configuration_array['products_enabled'] == 1) { - $items = erLhAbstractModelProductDepartament::getList(array('filter' => array('departament_id' => $departament->id))); + $items = erLhAbstractModelProductDepartament::getList(['filter' => ['departament_id' => $departament->id]]); // Collect products id's - $productsIds = array(); + $productsIds = []; foreach ($items as $item) { $productsIds[] = $item->product_id; } - $products = array(); + $products = []; if (!empty($productsIds)) { - $products = erLhAbstractModelProduct::getList(array('sort' => 'priority ASC, name ASC', 'filter' => array('disabled' => 0), 'filterin' => array('id' => $productsIds))); + $products = erLhAbstractModelProduct::getList(['sort' => 'priority ASC, name ASC', 'filter' => ['disabled' => 0], 'filterin' => ['id' => $productsIds]]); } - $returnProduct = array(); + $returnProduct = []; foreach ($products as $product) { - $returnProduct[] = array( + $returnProduct[] = [ 'value' => $product->id, 'name' => $product->name - ); + ]; } - echo json_encode(array( + echo json_encode([ 'required' => (isset($departament->product_configuration_array['products_required']) && $departament->product_configuration_array['products_required'] == 1), 'products' => $returnProduct - )); + ]); } else { - echo json_encode(array('products' => [])); + echo json_encode(['products' => []]); } - - exit; - -?> \ No newline at end of file diff --git a/lhc_web/modules/lhwidgetrestapi/module.php b/lhc_web/modules/lhwidgetrestapi/module.php index 6bfd490112..90123bfc2e 100644 --- a/lhc_web/modules/lhwidgetrestapi/module.php +++ b/lhc_web/modules/lhwidgetrestapi/module.php @@ -1,174 +1,143 @@ "Live helper Chat REST API service"); - -$ViewList = array(); - -$ViewList['chooselanguage'] = array( - 'params' => array(), - 'uparams' => array('id','hash') -); - -$ViewList['setsiteaccess'] = array( - 'params' => array(), - 'uparams' => array('id','hash','vid') -); - -$ViewList['getproducts'] = array( - 'params' => array('id','product_id') -); - -$ViewList['avatar'] = array( - 'params' => array('id') -); - -$ViewList['settings'] = array( - 'params' => array(), - 'uparams' => array('department','ua','identifier'), - 'multiple_arguments' => array ( 'department', 'ua' ) -); - -$ViewList['offlinesettings'] = array( - 'params' => array(), - 'uparams' => array('ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','sdemo','prod','phash','pvhash','fullheight','ajaxmode'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['updatejs'] = array( - 'params' => array(), - 'uparams' => array(), - 'multiple_arguments' => array () -); - -$ViewList['lang'] = array( - 'params' => array(), - 'uparams' => array(), - 'multiple_arguments' => array () -); - -$ViewList['onlinesettings'] = array( - 'params' => array(), - 'uparams' => array('ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','sdemo','prod','phash','pvhash','fullheight','ajaxmode'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['submitoffline'] = array( - 'params' => array(), - 'uparams' => array('ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','sdemo','prod','phash','pvhash','fullheight','ajaxmode'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['submitonline'] = array( - 'params' => array(), - 'uparams' => array('ua','switchform','operator','theme','vid','sound','hash','hash_resume','mode','offline','leaveamessage','department','priority','chatprefill','survey','sdemo','prod','phash','pvhash','fullheight','ajaxmode'), - 'multiple_arguments' => array ( 'department', 'ua', 'prod' ) -); - -$ViewList['initchat'] = array( - 'params' => array(), - 'uparams' => array(), - 'multiple_arguments' => array () -); - -$ViewList['uisettings'] = array( - 'params' => array(), - 'uparams' => array(), - 'multiple_arguments' => array () -); - -$ViewList['fetchmessages'] = array( - 'params' => array(), - 'uparams' => array(), -); - -$ViewList['getmessagesnippet'] = array( - 'params' => array(), - 'uparams' => array(), -); - -$ViewList['fetchmessage'] = array( - 'params' => array(), - 'uparams' => array(), -); - -$ViewList['logconversions'] = array( - 'params' => array(), - 'uparams' => array('vid'), -); - -$ViewList['addmsguser'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mode'), -); - -$ViewList['sendmailsettings'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('action'), -); - -$ViewList['chatcheckstatus'] = array( - 'params' => array(), - 'uparams' => array('status','department','vid','uactiv','wopen','uaction','hash','hash_resume','dot','hide_offline','isproactive'), - 'multiple_arguments' => array ( 'department' ) -); - -$ViewList['checkchatstatus'] = array( - 'params' => array('chat_id','hash'), - 'uparams' => array('mode','theme','dot') -); - -$ViewList['loadsound'] = array( - 'params' => array('sound'), - 'uparams' => array() -); - -$ViewList['themepage'] = array( - 'params' => array('theme'), - 'uparams' => array() -); - -$ViewList['themeneedhelp'] = array( - 'params' => array('theme'), - 'uparams' => array() -); - -$ViewList['theme'] = array( - 'params' => array('theme'), - 'uparams' => array('p') -); - -$ViewList['themestatus'] = array( - 'params' => array('theme'), - 'uparams' => array() -); - -$ViewList['checkinvitation'] = array( - 'params' => array(), - 'uparams' => array() -); - -$ViewList['getinvitation'] = array( - 'params' => array(), - 'uparams' => array() -); - -$ViewList['proactiveonclick'] = array( - 'params' => array('id'), - 'uparams' => array() -); - -$ViewList['screensharesettings'] = array( - 'params' => array(), - 'uparams' => array() -); - -$ViewList['executejs'] = array( - 'params' => array(), - 'uparams' => array('id','hash','ext','dep'), - 'multiple_arguments' => array ( 'dep' ) -); - -$FunctionList = array(); -$FunctionList['use_admin'] = array('explain' => 'Allow operator to manage REST API'); - -?> \ No newline at end of file +$Module = ['name' => 'Live helper Chat REST API service']; + +$ViewList = [ + 'chooselanguage' => [ + 'params' => [], + 'uparams' => ['id', 'hash'], + ], + 'setsiteaccess' => [ + 'params' => [], + 'uparams' => ['id', 'hash', 'vid'], + ], + 'getproducts' => [ + 'params' => ['id', 'product_id'], + ], + 'avatar' => [ + 'params' => ['id'], + ], + 'settings' => [ + 'params' => [], + 'uparams' => ['department', 'ua', 'identifier'], + 'multiple_arguments' => ['department', 'ua'], + ], + 'offlinesettings' => [ + 'params' => [], + 'uparams' => ['ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'sdemo', 'prod', 'phash', 'pvhash', 'fullheight', 'ajaxmode'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'updatejs' => [ + 'params' => [], + 'uparams' => [], + 'multiple_arguments' => [], + ], + 'lang' => [ + 'params' => [], + 'uparams' => [], + 'multiple_arguments' => [], + ], + 'onlinesettings' => [ + 'params' => [], + 'uparams' => ['ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'sdemo', 'prod', 'phash', 'pvhash', 'fullheight', 'ajaxmode'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'submitoffline' => [ + 'params' => [], + 'uparams' => ['ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'sdemo', 'prod', 'phash', 'pvhash', 'fullheight', 'ajaxmode'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'submitonline' => [ + 'params' => [], + 'uparams' => ['ua', 'switchform', 'operator', 'theme', 'vid', 'sound', 'hash', 'hash_resume', 'mode', 'offline', 'leaveamessage', 'department', 'priority', 'chatprefill', 'survey', 'sdemo', 'prod', 'phash', 'pvhash', 'fullheight', 'ajaxmode'], + 'multiple_arguments' => ['department', 'ua', 'prod'], + ], + 'initchat' => [ + 'params' => [], + 'uparams' => [], + 'multiple_arguments' => [], + ], + 'uisettings' => [ + 'params' => [], + 'uparams' => [], + 'multiple_arguments' => [], + ], + 'fetchmessages' => [ + 'params' => [], + 'uparams' => [], + ], + 'getmessagesnippet' => [ + 'params' => [], + 'uparams' => [], + ], + 'fetchmessage' => [ + 'params' => [], + 'uparams' => [], + ], + 'logconversions' => [ + 'params' => [], + 'uparams' => ['vid'], + ], + 'addmsguser' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode'], + ], + 'sendmailsettings' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['action'], + ], + 'chatcheckstatus' => [ + 'params' => [], + 'uparams' => ['status', 'department', 'vid', 'uactiv', 'wopen', 'uaction', 'hash', 'hash_resume', 'dot', 'hide_offline', 'isproactive'], + 'multiple_arguments' => ['department'], + ], + 'checkchatstatus' => [ + 'params' => ['chat_id', 'hash'], + 'uparams' => ['mode', 'theme', 'dot'], + ], + 'loadsound' => [ + 'params' => ['sound'], + 'uparams' => [], + ], + 'themepage' => [ + 'params' => ['theme'], + 'uparams' => [], + ], + 'themeneedhelp' => [ + 'params' => ['theme'], + 'uparams' => [], + ], + 'theme' => [ + 'params' => ['theme'], + 'uparams' => ['p'], + ], + 'themestatus' => [ + 'params' => ['theme'], + 'uparams' => [], + ], + 'checkinvitation' => [ + 'params' => [], + 'uparams' => [], + ], + 'getinvitation' => [ + 'params' => [], + 'uparams' => [], + ], + 'proactiveonclick' => [ + 'params' => ['id'], + 'uparams' => [], + ], + 'screensharesettings' => [ + 'params' => [], + 'uparams' => [], + ], + 'executejs' => [ + 'params' => [], + 'uparams' => ['id', 'hash', 'ext', 'dep'], + 'multiple_arguments' => ['dep'], + ], +]; + +$FunctionList = [ + 'use_admin' => ['explain' => 'Allow operator to manage REST API'], +]; diff --git a/lhc_web/modules/lhwidgetrestapi/setsiteaccess.php b/lhc_web/modules/lhwidgetrestapi/setsiteaccess.php index decfb491d7..53fa0c4144 100644 --- a/lhc_web/modules/lhwidgetrestapi/setsiteaccess.php +++ b/lhc_web/modules/lhwidgetrestapi/setsiteaccess.php @@ -4,24 +4,22 @@ $payload = json_decode(file_get_contents('php://input'),true); -$validStatuses = array( +$validStatuses = [ erLhcoreClassModelChat::STATUS_PENDING_CHAT, erLhcoreClassModelChat::STATUS_ACTIVE_CHAT, erLhcoreClassModelChat::STATUS_BOT_CHAT, -); +]; $chat = erLhcoreClassModelChat::fetch($payload['id']); -erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validstatus_chat',array('chat' => & $chat, 'valid_statuses' => & $validStatuses)); +erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validstatus_chat', ['chat' => & $chat, 'valid_statuses' => & $validStatuses]); -if ($chat->hash === $payload['hash'] && (in_array($chat->status,$validStatuses)) && isset($payload['lng']) && in_array($payload['lng'],erConfigClassLhConfig::getInstance()->getSetting( 'site', 'available_site_access' ))) +if ($chat->hash === $payload['hash'] && (in_array($chat->status,$validStatuses)) && isset($payload['lng']) && in_array($payload['lng'], erConfigClassLhConfig::getInstance()->getSetting('site', 'available_site_access'))) { - $settings = erConfigClassLhConfig::getInstance()->getSetting( 'site_access_options', $payload['lng']); + $settings = erConfigClassLhConfig::getInstance()->getSetting('site_access_options', $payload['lng']); $chat->chat_locale = $settings['content_language']; // So internal translations will work out of the box - $chat->updateThis(array('update' => array('chat_locale'))); + $chat->updateThis(['update' => ['chat_locale']]); } -echo erLhcoreClassChat::safe_json_encode(array('error' => false)); +echo erLhcoreClassChat::safe_json_encode(['error' => false]); exit; - -?> diff --git a/lhc_web/modules/lhwidgetrestapi/uisettings.php b/lhc_web/modules/lhwidgetrestapi/uisettings.php index 8951f6b984..13f2c7da2e 100644 --- a/lhc_web/modules/lhwidgetrestapi/uisettings.php +++ b/lhc_web/modules/lhwidgetrestapi/uisettings.php @@ -29,11 +29,11 @@ if ($chat->hash === $requestPayload['hash']) { - $outputResponse = array( + $outputResponse = [ 'operator' => 'operator', - 'chat_ui' => array(), - 'chat_ui_remove' => array(), - ); + 'chat_ui' => [], + 'chat_ui_remove' => [], + ]; $fileData = (array)erLhcoreClassModelChatConfig::fetch('file_configuration')->data; @@ -41,10 +41,10 @@ if ((isset($fileData['active_user_upload']) && $fileData['active_user_upload'] == true) || (isset($chatVariables['lhc_fu']) && $chatVariables['lhc_fu'] == 1)) { $outputResponse['chat_ui']['file'] = true; - $outputResponse['chat_ui']['file_options'] = array( + $outputResponse['chat_ui']['file_options'] = [ 'fs' => $fileData['fs_max']*1024, 'ft_us' => $fileData['ft_us'], - ); + ]; if (isset($fileData['one_file_upload']) && $fileData['one_file_upload'] == true) { $outputResponse['chat_ui']['file_options']['one_file_upload'] = true; @@ -63,7 +63,7 @@ $outputResponse['chat_ui_remove'][] = ['chat_ui','file_options']; } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('widgetrestapi.uisettings', array('output' => & $outputResponse, 'chat' => $chat)); + erLhcoreClassChatEventDispatcher::getInstance()->dispatch('widgetrestapi.uisettings', ['output' => & $outputResponse, 'chat' => $chat]); echo erLhcoreClassRestAPIHandler::outputResponse($outputResponse); } @@ -72,6 +72,4 @@ $db->rollback(); } -exit; - -?> \ No newline at end of file +exit; \ No newline at end of file diff --git a/lhc_web/modules/lhxml/module.php b/lhc_web/modules/lhxml/module.php index 502aeac435..9de6b29a8e 100644 --- a/lhc_web/modules/lhxml/module.php +++ b/lhc_web/modules/lhxml/module.php @@ -2,74 +2,59 @@ $Module = ['name' => 'Live helper Chat XML service']; -$ViewList = []; - -$ViewList['checklogin'] = [ - 'script' => 'checklogin.php', - 'params' => [] -]; - -$ViewList['closedchats'] = [ - 'script' => 'closedchats.php', - 'params' => [] -]; - -$ViewList['lists'] = [ - 'script' => 'lists.php', - 'params' => [] -]; - -$ViewList['getuseronlinestatus'] = [ - 'script' => 'getuseronlinestatus.php', - 'params' => [] -]; - -$ViewList['setonlinestatus'] = [ - 'params' => ['status'] -]; - -$ViewList['deletechat'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['chatdata'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['cannedresponses'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['chatssynchro'] = [ - 'params' => [] -]; - -$ViewList['closechat'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['addmsgadmin'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['transferchat'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['transferuser'] = [ - 'params' => ['chat_id','user_id'] -]; - -$ViewList['accepttransfer'] = [ - 'params' => ['transfer_id'] -]; - -$ViewList['accepttransferbychat'] = [ - 'params' => ['chat_id'] -]; - -$ViewList['sendnotice'] = [ - 'params' => ['online_id'] +$ViewList = [ + 'checklogin' => [ + 'script' => 'checklogin.php', + 'params' => [], + ], + 'closedchats' => [ + 'script' => 'closedchats.php', + 'params' => [], + ], + 'lists' => [ + 'script' => 'lists.php', + 'params' => [], + ], + 'getuseronlinestatus' => [ + 'script' => 'getuseronlinestatus.php', + 'params' => [], + ], + 'setonlinestatus' => [ + 'params' => ['status'], + ], + 'deletechat' => [ + 'params' => ['chat_id'], + ], + 'chatdata' => [ + 'params' => ['chat_id'], + ], + 'cannedresponses' => [ + 'params' => ['chat_id'], + ], + 'chatssynchro' => [ + 'params' => [], + ], + 'closechat' => [ + 'params' => ['chat_id'], + ], + 'addmsgadmin' => [ + 'params' => ['chat_id'], + ], + 'transferchat' => [ + 'params' => ['chat_id'], + ], + 'transferuser' => [ + 'params' => ['chat_id', 'user_id'], + ], + 'accepttransfer' => [ + 'params' => ['transfer_id'], + ], + 'accepttransferbychat' => [ + 'params' => ['chat_id'], + ], + 'sendnotice' => [ + 'params' => ['online_id'], + ], ]; $FunctionList = []; diff --git a/lhc_web/modules/lhxmp/module.php b/lhc_web/modules/lhxmp/module.php index 9597b2f0e6..e952207b74 100644 --- a/lhc_web/modules/lhxmp/module.php +++ b/lhc_web/modules/lhxmp/module.php @@ -1,14 +1,15 @@ - "XMPP module configuration"]; - -$ViewList = []; - -$ViewList['configuration'] = [ - 'params' => [], - 'uparams' => ['gtalkoauth'], - 'functions' => ['configurexmp'] -]; - -$FunctionList = []; -$FunctionList['configurexmp'] = ['explain' => 'Allow user to configure XMPP']; + 'XMPP module configuration']; + +$ViewList = [ + 'configuration' => [ + 'params' => [], + 'uparams' => ['gtalkoauth'], + 'functions' => ['configurexmp'], + ], +]; + +$FunctionList = [ + 'configurexmp' => ['explain' => 'Allow user to configure XMPP'], +];