Пример #1
0
 }
 $user_data['user_id'] = empty($user_data['user_id']) ? !empty($user_id) ? $user_id : 0 : $user_data['user_id'];
 $user_data['user_type'] = empty($user_data['user_type']) ? 'C' : $user_data['user_type'];
 $user_type = !empty($_REQUEST['user_type']) ? $_REQUEST['user_type'] : $user_data['user_type'];
 $usergroups = fn_get_usergroups(fn_check_user_type_admin_area($user_type) ? array('status' => array('A', 'H')) : array('type' => 'C', 'status' => array('A', 'H')), CART_LANGUAGE);
 $auth['is_root'] = isset($auth['is_root']) ? $auth['is_root'] : '';
 $navigation = array('general' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true));
 if (!fn_allowed_for('ULTIMATE:FREE')) {
     if ($mode == 'update' && (!fn_check_user_type_admin_area($user_type) && !Registry::get('runtime.company_id') || fn_check_user_type_admin_area($user_type) && !Registry::get('runtime.company_id') && $auth['is_root'] == 'Y' && (!empty($user_data['company_id']) || empty($user_data['company_id']) && (!empty($user_data['is_root']) && $user_data['is_root'] != 'Y')) || $user_data['user_type'] == 'V' && Registry::get('runtime.company_id') && $auth['is_root'] == 'Y' && $user_data['user_id'] != $auth['user_id'] && $user_data['company_id'] == Registry::get('runtime.company_id'))) {
         $navigation['usergroups'] = array('title' => __('usergroups'), 'js' => true);
     } else {
         $usergroups = array();
     }
 }
 if (empty($user_data['api_key'])) {
     Tygh::$app['view']->assign('new_api_key', Api::generateKey());
 }
 /**
  * Only admin can set the api key.
  */
 if (fn_check_user_type_admin_area($user_data) && !empty($user_data['user_id']) && ($auth['user_type'] == 'A' || $user_data['api_key'])) {
     $navigation['api'] = array('title' => __('api_access'), 'js' => true);
     Tygh::$app['view']->assign('show_api_tab', true);
     if ($auth['user_type'] != 'A') {
         Tygh::$app['view']->assign('hide_api_checkbox', true);
     }
 }
 Registry::set('navigation.tabs', $navigation);
 Tygh::$app['view']->assign('usergroups', $usergroups);
 Tygh::$app['view']->assign('hide_inputs', !fn_check_editable_permissions($auth, $user_data));
 $profile_fields = fn_get_profile_fields($user_type);
Пример #2
0
 }
 $user_data['user_id'] = empty($user_data['user_id']) ? !empty($user_id) ? $user_id : 0 : $user_data['user_id'];
 $user_data['user_type'] = empty($user_data['user_type']) ? 'C' : $user_data['user_type'];
 $user_type = !empty($_REQUEST['user_type']) ? $_REQUEST['user_type'] : $user_data['user_type'];
 $usergroups = fn_get_usergroups(fn_check_user_type_admin_area($user_type) ? 'F' : 'C', CART_LANGUAGE);
 $auth['is_root'] = isset($auth['is_root']) ? $auth['is_root'] : '';
 $navigation = array('general' => array('title' => __('general'), 'js' => true), 'addons' => array('title' => __('addons'), 'js' => true));
 if (!fn_allowed_for('ULTIMATE:FREE')) {
     if ($mode == 'update' && (!fn_check_user_type_admin_area($user_type) && !Registry::get('runtime.company_id') || fn_check_user_type_admin_area($user_type) && !Registry::get('runtime.company_id') && $auth['is_root'] == 'Y' && (!empty($user_data['company_id']) || empty($user_data['company_id']) && (!empty($user_data['is_root']) && $user_data['is_root'] != 'Y')) || $user_data['user_type'] == 'V' && Registry::get('runtime.company_id') && $auth['is_root'] == 'Y' && $user_data['user_id'] != $auth['user_id'] && $user_data['company_id'] == Registry::get('runtime.company_id'))) {
         $navigation['usergroups'] = array('title' => __('usergroups'), 'js' => true);
     } else {
         $usergroups = array();
     }
 }
 if (empty($user_data['api_key'])) {
     Registry::get('view')->assign('new_api_key', Api::generateKey());
 }
 /**
  * Only admin can set the api key.
  */
 if (fn_check_user_type_admin_area($user_data) && !empty($user_data['user_id']) && ($auth['user_type'] == 'A' || $user_data['api_key'])) {
     $navigation['api'] = array('title' => __('api_access'), 'js' => true);
     Registry::get('view')->assign('show_api_tab', true);
     if ($auth['user_type'] != 'A') {
         Registry::get('view')->assign('hide_api_checkbox', true);
     }
 }
 Registry::set('navigation.tabs', $navigation);
 Registry::get('view')->assign('usergroups', $usergroups);
 $profile_fields = fn_get_profile_fields($user_type);
 Registry::get('view')->assign('user_type', $user_type);