| @@ -40,8 +40,12 @@ | ||
| 40 | 40 | if (empty($entity) || (empty($offset) && 0 !== $offset) || empty($perCalls)) { |
| 41 | 41 | return ['error' => acym_translation('ACYM_MISSING_PARAMETERS')]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + if (!in_array($entity, ['list', 'user'])) { | |
| 45 | + return ['error' => acym_translation('ACYM_UNAUTHORIZED_ACCESS')]; | |
| 46 | + } | |
| 47 | + | |
| 44 | 48 | $entityParams = [ |
| 45 | 49 | 'offset' => $offset, |
| 46 | 50 | 'elementsPerPage' => $perCalls, |
| 47 | 51 | 'entitySelect' => true, |
| @@ -48,10 +52,17 @@ | ||
| 48 | 52 | ]; |
| 49 | 53 | if ($entity === 'list') { |
| 50 | 54 | $entityParams['status'] = 'active'; |
| 51 | 55 | } |
| 52 | - if (!empty($join)) $entityParams['join'] = $join; | |
| 53 | - if (!empty($columnsToDisplay)) $entityParams['columns'] = $columnsToDisplay; | |
| 56 | + if (!empty($join)) { | |
| 57 | + $entityParams['join'] = $join; | |
| 58 | + } | |
| 59 | + if (!empty($columnsToDisplay)) { | |
| 60 | + foreach ($columnsToDisplay as $column) { | |
| 61 | + acym_secureDBColumn($column); | |
| 62 | + } | |
| 63 | + $entityParams['columns'] = $columnsToDisplay; | |
| 64 | + } | |
| 54 | 65 | |
| 55 | 66 | if ('list' === $entity) { |
| 56 | 67 | $entityParams['columns'][] = 'description'; |
| 57 | 68 | } |
| @@ -75,15 +86,21 @@ | ||
| 75 | 86 | if ($entity === 'list') { |
| 76 | 87 | foreach ($availableEntity['elements'] as $key => $element) { |
| 77 | 88 | $availableEntity['elements'][$key]->color = '<i style="color: '.$element->color.'" class="acym_subscription acymicon-circle">'; |
| 78 | 89 | if (!empty($element->description)) { |
| 79 | - $availableEntity['elements'][$key]->name = $element->name.acym_info(['textShownInTooltip' => $element->description]); | |
| 90 | + ob_start(); | |
| 91 | + acym_info(['textShownInTooltip' => $element->description]); | |
| 92 | + $tooltip = ob_get_clean(); | |
| 93 | + $availableEntity['elements'][$key]->name = $element->name.$tooltip; | |
| 80 | 94 | } |
| 81 | 95 | } |
| 82 | 96 | } elseif ($entity === 'user') { |
| 83 | 97 | foreach ($availableEntity['elements'] as $key => $element) { |
| 84 | - $availableEntity['elements'][$key]->email = $element->email.'<span class="acym__hover__user_info" data-id="'.$availableEntity['elements'][$key]->id.'"> | |
| 85 | - '.acym_info(['textShownInTooltip' => '<i class="acymicon-circle-o-notch acymicon-spin"></i>']).' | |
| 98 | + ob_start(); | |
| 99 | + acym_info(['textShownInTooltip' => '<i class="acymicon-circle-o-notch acymicon-spin"></i>']); | |
| 100 | + $tooltip = ob_get_clean(); | |
| 101 | + $availableEntity['elements'][$key]->email = $element->email.'<span class="acym__hover__user_info" data-id="'.esc_attr($availableEntity['elements'][$key]->id).'"> | |
| 102 | + '.$tooltip.' | |
| 86 | 103 | </span>'; |
| 87 | 104 | } |
| 88 | 105 | } |
| 89 | 106 | } |