8 require_once(
'base/Ego_Store.php');
43 public function __construct($params = array(), $query = array()) {
44 parent::__construct($params, $query);
46 $this->name = str_replace(
49 (
string) $_REQUEST[
'name']
51 $this->value = (string) (isset($_REQUEST[
'value']) ? $_REQUEST[
'value'] : $_REQUEST[
'ref']);
52 $this->data = $_REQUEST[
'data'];
62 switch ($this->data) {
66 if (trim(trim($this->name,
'%')) !=
'') {
67 $query = [
'username' => str_replace(
'%',
'', $this->name)];
68 } elseif ($this->value) {
72 require_once
'base/Ego_User_Search_Factory.php';
75 $users = $search->searchUsers(array_merge($query, [
76 'user_inactive' => $this->params[
'user_active'] ? 1 : 0,
78 ]), $this->limit === 0 ? -1 : $this->limit,
'',
false,
true,
true, 0,
false, [], $this->params[
'rights'] ??
'');
80 foreach ($users as $user) {
82 $this->params[
'liveserver']
83 && $GLOBALS[
'egotec_conf'][
'liveserver']
84 && !$user->field[
'no_admin']
85 && !$user->extra[
'liveserver']
91 $icon = $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/sitemap_img/';
92 if ($user->extra[
'gender'] ===
'female') {
93 $icon .=
'user_female.png';
95 $icon .=
'user_male.png';
99 self::IDENTIFIER => $user->field[
'user_id'],
100 'name' => $user->getFullname(),
109 $db = new_db_connection();
110 if (empty($this->value)) {
111 if (trim($this->name,
'%') !=
'') {
113 if (!$this->isValidSearch($this->name)) {
118 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
120 $groups = $GLOBALS[
'auth']->user->getAllGroups();
121 $group_ids = array();
122 foreach ($groups as $group) {
123 $group_ids[] = $group->field[
'group_id'];
125 $where =
"group_id IN ('" . implode(
"','", $group_ids) .
"') AND ";
129 'table' =>
'egotec_group',
130 'where' => $where .
'LOWER(group_name) LIKE :group_name',
131 'order' =>
'links ASC',
133 'group_name' => mb_strtolower($this->name)
136 if ($this->limit > 0) {
137 $query[
'limit'] =
"{$this->start},{$this->limit}";
139 $db->select($this->buildQuery($query));
142 require_once(
'rights/Group_SQL.php');
143 $parent =
new Group_SQL($GLOBALS[
'egotec_conf'][
'superuser'][
'group']);
145 $group_ids = array();
146 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
148 $groups = $GLOBALS[
'auth']->user->getAllGroups();
149 foreach ($groups as $group) {
150 $group_ids[] = $group->field[
'group_id'];
155 if ($this->params[
'all_group']) {
156 $this->addItem(array(
157 self::IDENTIFIER =>
'*',
158 'name' =>
'(' . $GLOBALS[
'auth']->translate(
'Alle') .
')',
159 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/user-unknown2.png',
164 $this->getNS($parent, $group_ids,
'group_id',
'group_name',
'groups.png');
168 $db->select($this->buildQuery(array(
169 'table' =>
'egotec_group',
170 'where' =>
'group_id = :group_id',
172 'group_id' => $this->value
176 while ($db->nextRecord()) {
177 $group =
new Group_SQL($db->Record[
'group_id'], $db->Record);
178 $name = $db->Record[
'group_name'];
179 $this->addItem(array(
180 self::IDENTIFIER => $db->Record[
'group_id'],
182 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/groups.png',
183 'indent' => $db->Record[
'tiefe'],
184 'hover' => ltrim($group->getPath(
true).
'/'.
$name,
'/')
191 $db = new_db_connection();
192 if (empty($this->value)) {
193 if (trim($this->name,
'%') !=
'') {
195 if (!$this->isValidSearch($this->name)) {
200 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
202 $roles = $GLOBALS[
'auth']->user->getAllRoles();
204 foreach ($roles as $role) {
205 $role_ids[] = $role->field[
'role_id'];
207 $where =
"role_id IN ('".implode(
"','", $role_ids).
"') AND ";
211 'table' =>
'egotec_role',
212 'where' => $where.
'LOWER(role_name) LIKE :role_name',
213 'order' =>
'links ASC',
215 'role_name' => mb_strtolower($this->name)
218 if ($this->limit > 0) {
219 $query[
'limit'] =
"{$this->start},{$this->limit}";
221 $db->select($this->buildQuery($query));
224 require_once(
'rights/Role_SQL.php');
225 $parent =
new Role_SQL($GLOBALS[
'egotec_conf'][
'superuser'][
'role']);
228 if (!$GLOBALS[
'auth']->hasSuperuserPermission()) {
230 $roles = $GLOBALS[
'auth']->user->getAllRoles();
232 foreach ($roles as $role) {
233 $role_ids[] = $role->field[
'role_id'];
237 $this->getNS($parent, $role_ids,
'role_id',
'role_name',
'roles.png');
241 $db->select($this->buildQuery(array(
242 'table' =>
'egotec_role',
243 'where' =>
'role_id = :role_id',
245 'role_id' => $this->value
249 while ($db->nextRecord()) {
250 $role =
new Role_SQL($db->Record[
'role_id'], $db->Record);
251 $name = $db->Record[
'role_name'];
252 $this->addItem(array(
253 self::IDENTIFIER => $db->Record[
'role_id'],
255 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/roles.png',
256 'indent' => $db->Record[
'tiefe'],
257 'hover' => ltrim($role->getPath(
true).
'/'.
$name,
'/')
265 $search = str_replace(array(
'*',
'%'),
'', $this->name);
268 if (!empty($this->value)) {
269 if ($site->name == $this->value) {
271 self::IDENTIFIER => $site->name,
272 'name' => $site->site[
'title']
281 if (empty($search)) {
283 if (($this->params[0] && (($site->admin[
'keyword_register_own_site'] && $site->admin[
'keywords'][
'site'] == $site->name) || $site->name == $this->site->name))
284 || empty($this->params[0])) {
286 self::IDENTIFIER => $site->name,
287 'name' => $site->site[
'title']
292 if ((mb_stripos($site->site[
'title'], $search) !==
false || mb_stripos($site->name, $search) !==
false)
293 && ($this->params[0] && (($site->admin[
'keyword_register_own_site'] && $site->admin[
'keywords'][
'site'] == $site->name) || $site->name == $this->site->name))
294 || empty($this->params[0])) {
296 self::IDENTIFIER => $site->name,
297 'name' => $site->site[
'title']
307 if (empty($this->value)) {
308 if (!$this->isValidSearch($this->name)) {
312 if (!isset($this->params[
'query'])) {
313 $this->params[
'query'] = array();
315 if (!isset($this->params[
'query'][
'bind'])) {
316 $this->params[
'query'][
'bind'] = array();
318 if (!isset($this->params[
'param'])) {
319 $this->params[
'param'] = array();
321 if ($this->limit > 0) {
322 $this->params[
'query'][
'limit'] =
"{$this->start},{$this->limit}";
324 $this->params[
'query'][
'where'] = ($this->params[
'query'][
'where']
325 ? $this->params[
'query'][
'where'] .
' AND '
326 :
'').
"LOWER(name) LIKE :name";
327 $this->params[
'query'][
'bind'][
'name'] = mb_strtolower($this->name);
328 $this->site->setRights(array(
'edit',
'view'));
329 if ($parent = $this->site->getPage($this->params[
'id'])) {
330 $pages = $parent->getChildren(
331 $this->buildQuery($this->params[
'query']),
332 $this->params[
'param']
340 foreach ($pages as $page) {
342 $this->addItem(array(
343 self::IDENTIFIER => ltrim($page->getUrl(array(
'nonactive' =>
false)), $GLOBALS[
'egotec_conf'][
'url_dir']),
344 'name' => $page->field[
'name'],
345 'icon' => $page->getIconUrl()
353 $search = str_replace(array(
'*',
'%'),
'', $this->name);
354 $site = $this->params[
'from'] ?
new Site($this->params[
'from']) : ($this->site ? $this->site :
new Site());
355 $types = $this->params[
'type_list'] ? $this->params[
'type_list'] : $site->getTypes();
356 foreach ($types as $type) {
358 $site->admin[
'enabled_types'][$type[
'type']]
363 if ($type[
'hidden']) {
365 } elseif (empty($this->value)) {
368 && (empty($type[
'active'])
369 || mb_stripos($type[
'fullname'], $search) ===
false)
373 } elseif ($type[
'type'] != $this->value) {
377 $this->addItem(array(
378 self::IDENTIFIER => $type[
'type'],
381 'icon' => $this->page && $this->page->field[
'type'] == $type[
'type']
382 ? $this->page->getIconUrl(
false,
false,
false)
385 : $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/'
386 .($type[
'type'] ==
'multimedia/category'
390 'disabled' => empty($type[
'active']) && $this->page->canChangeType(),
391 'indent' => empty($search) ? $type[
'depth'] : 0
393 if (!empty($this->value)) {
411 private function getNS($parent, $ids, $id_key, $name_key, $icon) {
412 if (empty($ids) || in_array($parent->field[$id_key], $ids)) {
413 $this->addItem(array(
414 self::IDENTIFIER => $parent->field[$id_key],
415 'name' => $parent->field[$name_key],
416 'icon' => $GLOBALS[
'egotec_conf'][
'url_dir'].
'bin/admin_skin/egotec/img/16x16/'.$icon,
417 'indent' => $parent->field[
'tiefe'],
418 'hover' => ltrim($parent->getPath(
true).
'/'.$parent->field[$name_key],
'/')
422 foreach ($parent->getChildren() as $child) {
423 $this->getNS($child, $ids, $id_key, $name_key, $icon);
static filterNonUtf8($s, $substitute="", $strict=false)
static urltopage($url, $params=array(), $only_site=false, $error_page=false, $commit_params=false)
static getAllSites($username='', $perm='', $table=false, $type='')
static start(string $table='egotec_user', array $param=[], bool $checkHealthy=false)