| @@ -40,15 +40,29 @@ | ||
| 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 | 52 | ]; |
| 49 | - if (!empty($join)) $entityParams['join'] = $join; | |
| 50 | - if (!empty($columnsToDisplay)) $entityParams['columns'] = $columnsToDisplay; | |
| 53 | + if ($entity === 'list') { | |
| 54 | + $entityParams['status'] = 'active'; | |
| 55 | + } | |
| 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 | + } | |
| 51 | 65 | |
| 52 | 66 | if ('list' === $entity) { |
| 53 | 67 | $entityParams['columns'][] = 'description'; |
| 54 | 68 | } |
| @@ -57,9 +71,9 @@ | ||
| 57 | 71 | $entityParams['creator_id'] = acym_currentUserId(); |
| 58 | 72 | } |
| 59 | 73 | |
| 60 | 74 | $namespaceClass = 'AcyMailing\\Classes\\'.ucfirst($entity).'Class'; |
| 61 | - $entityClass = new $namespaceClass; | |
| 75 | + $entityClass = new $namespaceClass(); | |
| 62 | 76 | |
| 63 | 77 | $availableEntity = $entityClass->getMatchingElements($entityParams); |
| 64 | 78 | |
| 65 | 79 | $this->formatEntites($availableEntity, $entity); |
| @@ -72,15 +86,21 @@ | ||
| 72 | 86 | if ($entity === 'list') { |
| 73 | 87 | foreach ($availableEntity['elements'] as $key => $element) { |
| 74 | 88 | $availableEntity['elements'][$key]->color = '<i style="color: '.$element->color.'" class="acym_subscription acymicon-circle">'; |
| 75 | 89 | if (!empty($element->description)) { |
| 76 | - $availableEntity['elements'][$key]->name = $element->name.acym_info($element->description); | |
| 90 | + ob_start(); | |
| 91 | + acym_info(['textShownInTooltip' => $element->description]); | |
| 92 | + $tooltip = ob_get_clean(); | |
| 93 | + $availableEntity['elements'][$key]->name = $element->name.$tooltip; | |
| 77 | 94 | } |
| 78 | 95 | } |
| 79 | 96 | } elseif ($entity === 'user') { |
| 80 | 97 | foreach ($availableEntity['elements'] as $key => $element) { |
| 81 | - $availableEntity['elements'][$key]->email = $element->email.'<span class="acym__hover__user_info" data-id="'.$availableEntity['elements'][$key]->id.'"> | |
| 82 | - '.acym_info('<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.' | |
| 83 | 103 | </span>'; |
| 84 | 104 | } |
| 85 | 105 | } |
| 86 | 106 | } |