45 $op =
$system->cleanVars($_REQUEST,
'op',
'default',
'string');
50 $xoops->header(
'admin:system/system_users.tpl');
54 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
56 $xoops->theme()->addScript(
'modules/system/js/admin.js');
102 if (isset($_REQUEST[
'ok']) && $_REQUEST[
'ok'] == 1) {
103 if (!
$xoops->security()->check()) {
104 $xoops->redirect(
"admin.php?fct=users", 3, implode(
'<br />',
$xoops->security()->getErrors()));
108 if (in_array(FixedGroups::ADMIN,
$groups)) {
114 if (
$xoops->isActiveModule(
'notifications')) {
124 echo
$xoops->confirm(array(
125 'ok' => 1,
'uid' =>
$uid,
'op' =>
'users_delete'
132 if ((@isset($_REQUEST[
'memberslist_id']) || @$_REQUEST[
'memberslist_id'] !=
'')) {
135 foreach ($_REQUEST[
'memberslist_id'] as $del) {
139 if (in_array(FixedGroups::ADMIN,
$groups)) {
146 $xoops->getHandlerOnline()->destroy($del);
148 if (
$xoops->isActiveModule(
'notifications')) {
163 if (isset($_REQUEST[
'uid'])) {
165 if (!
$xoops->security()->check()) {
166 $xoops->redirect(
"admin.php?fct=users", 3, implode(
'<br />',
$xoops->security()->getErrors()));
169 $user_avatar = $theme = null;
170 if (!isset($_REQUEST[
'attachsig'])) {
173 if (!isset($_REQUEST[
'user_viewemail'])) {
178 if ($edituser->getVar(
'uname',
'n') != $_REQUEST[
'username'] &&
$member_handler->getUserCount(
new Criteria(
'uname',
$myts->addSlashes($_REQUEST[
'username']))) > 0) {
182 } elseif ($edituser->getVar(
'email',
'n') != $_REQUEST[
'email'] &&
$member_handler->getUserCount(
new Criteria(
'email',
$myts->addSlashes($_REQUEST[
'email']))) > 0) {
187 $edituser->setVar(
"name", $_REQUEST[
'name']);
188 $edituser->setVar(
"uname", $_REQUEST[
'username']);
189 $edituser->setVar(
"email", $_REQUEST[
'email']);
190 $url = isset($_REQUEST[
'url']) ?
$xoops->formatURL($_REQUEST[
'url']) :
'';
191 $edituser->setVar(
"url",
$url);
192 $edituser->setVar(
"user_icq", $_REQUEST[
'user_icq']);
193 $edituser->setVar(
"user_from", $_REQUEST[
'user_from']);
194 $edituser->setVar(
"user_sig", $_REQUEST[
'user_sig']);
195 $user_viewemail = (isset($_REQUEST[
'user_viewemail']) && $_REQUEST[
'user_viewemail'] == 1) ? 1 : 0;
197 $edituser->setVar(
"user_aim", $_REQUEST[
'user_aim']);
198 $edituser->setVar(
"user_yim", $_REQUEST[
'user_yim']);
199 $edituser->setVar(
"user_msnm", $_REQUEST[
'user_msnm']);
200 $attachsig = (isset($_REQUEST[
'attachsig']) && $_REQUEST[
'attachsig'] == 1) ? 1 : 0;
201 $edituser->setVar(
"attachsig", $attachsig);
202 $edituser->setVar(
"timezone_offset", $_REQUEST[
'timezone_offset']);
208 $edituser->setVar(
"bio", $_REQUEST[
'bio']);
209 $edituser->setVar(
"rank", $_REQUEST[
'rank']);
210 $edituser->setVar(
"user_occ", $_REQUEST[
'user_occ']);
211 $edituser->setVar(
"user_intrest", $_REQUEST[
'user_intrest']);
212 $edituser->setVar(
'user_mailok', $_REQUEST[
'user_mailok']);
213 if ($_REQUEST[
'pass2'] !=
"") {
214 if ($_REQUEST[
'password'] != $_REQUEST[
'pass2']) {
221 $edituser->setVar(
"pass", password_hash($_REQUEST[
'password'], PASSWORD_DEFAULT));
225 echo $edituser->getHtmlErrors();
228 if ($_REQUEST[
'groups'] != array()) {
229 $oldgroups = $edituser->getGroups();
231 if ($edituser->getVar(
'uid') ==
$xoops->user->getVar(
'uid') && (in_array(FixedGroups::ADMIN, $oldgroups)) && !(in_array(FixedGroups::ADMIN, $_REQUEST[
'groups']))) {
233 array_push($_REQUEST[
'groups'], FixedGroups::ADMIN);
236 foreach ($oldgroups as $groupid) {
237 $member_handler->removeUsersFromGroup($groupid, array($edituser->getVar(
'uid')));
239 foreach ($_REQUEST[
'groups'] as $groupid) {
249 if (!
$xoops->security()->check()) {
250 $xoops->redirect(
"admin.php?fct=users", 3, implode(
'<br />',
$xoops->security()->getErrors()));
252 if (!$_REQUEST[
'username'] || !$_REQUEST[
'email'] || !$_REQUEST[
'password']) {
258 $adduser_errormsg =
'User name ' . htmlspecialchars($_REQUEST[
'username']) .
' already exists';
262 $newuser->setVar(
"user_viewemail", $_REQUEST[
'user_viewemail']);
264 if (isset($attachsig)) {
265 $newuser->setVar(
"attachsig", $_REQUEST[
'attachsig']);
267 $newuser->setVar(
"name", $_REQUEST[
'name']);
268 $newuser->setVar(
"uname", $_REQUEST[
'username']);
269 $newuser->setVar(
"email", $_REQUEST[
'email']);
270 $newuser->setVar(
"url",
$xoops->formatURL($_REQUEST[
'url']));
271 $newuser->setVar(
"user_avatar",
'blank.gif');
272 $newuser->setVar(
'user_regdate', time());
273 $newuser->setVar(
"user_icq", $_REQUEST[
'user_icq']);
274 $newuser->setVar(
"user_from", $_REQUEST[
'user_from']);
275 $newuser->setVar(
"user_sig", $_REQUEST[
'user_sig']);
276 $newuser->setVar(
"user_aim", $_REQUEST[
'user_aim']);
277 $newuser->setVar(
"user_yim", $_REQUEST[
'user_yim']);
278 $newuser->setVar(
"user_msnm", $_REQUEST[
'user_msnm']);
279 if ($_REQUEST[
'pass2'] !=
"") {
280 if ($_REQUEST[
'password'] != $_REQUEST[
'pass2']) {
286 $newuser->setVar(
"pass", password_hash($_REQUEST[
'password'], PASSWORD_DEFAULT));
288 $newuser->setVar(
"timezone_offset", $_REQUEST[
'timezone_offset']);
294 $newuser->setVar(
"bio", $_REQUEST[
'bio']);
295 $newuser->setVar(
"rank", $_REQUEST[
'rank']);
296 $newuser->setVar(
"level", 1);
297 $newuser->setVar(
"user_occ", $_REQUEST[
'user_occ']);
298 $newuser->setVar(
"user_intrest", $_REQUEST[
'user_intrest']);
299 $newuser->setVar(
'user_mailok', $_REQUEST[
'user_mailok']);
303 $groups_failed = array();
304 foreach ($_REQUEST[
'groups'] as $group) {
305 $group = intval($group);
306 if (!
$member_handler->addUserToGroup($group, $newuser->getVar(
'uid'))) {
307 $groups_failed[] = $group;
310 if (!empty($groups_failed)) {
311 $group_names =
$member_handler->getGroupList(
new Criteria(
'groupid',
"(" . implode(
", ", $groups_failed) .
")",
'IN'));
321 echo
$xoops->alert(
'error', $adduser_errormsg);
328 $obj->setVar(
"level", 1);
332 echo $obj->getHtmlErrors();
336 case 'users_synchronize':
337 if (isset($_REQUEST[
'status']) && $_REQUEST[
'status'] == 1) {
340 if (isset($_REQUEST[
'status']) && $_REQUEST[
'status'] == 2) {
350 $xoops->theme()->addBaseScriptAssets(
'@jqueryui',
'modules/system/js/admin.js');
356 if (isset($_REQUEST[
'complet_search'])) {
367 $group_handler =
$xoops->getHandlerGroup();
368 $group_arr = $group_handler->getObjects();
369 $group_select->addOption(
"",
"--------------");
371 foreach ($group_arr as $group) {
372 if ($group->getVar(
"groupid") != 3) {
373 $group_select->addOption(
"" . $group->getVar(
"groupid") .
"",
"" . $group->getVar(
"name") .
"");
380 $uname_tray->addElement($uname_match);
381 $uname_tray->addElement($uname_text);
385 $name_tray->addElement($name_match);
386 $name_tray->addElement($name_text);
396 $icq_tray->addElement($icq_match);
397 $icq_tray->addElement($icq_text);
401 $aim_tray->addElement($aim_match);
402 $aim_tray->addElement($aim_text);
406 $yim_tray->addElement($yim_match);
407 $yim_tray->addElement($yim_text);
411 $msnm_tray->addElement($msnm_match);
412 $msnm_tray->addElement($msnm_text);
424 $mailok_radio->addOptionArray(array(
429 $type_radio->addOptionArray(array(
434 $sort_select->addOptionArray(array(
445 $form->addElement($uname_tray);
446 $form->addElement($name_tray);
448 $form->addElement($group_select);
449 $form->addElement($icq_tray);
450 $form->addElement($aim_tray);
451 $form->addElement($yim_tray);
452 $form->addElement($msnm_tray);
453 $form->addElement($url_text);
454 $form->addElement($location_text);
455 $form->addElement($occupation_text);
456 $form->addElement($interest_text);
457 $form->addElement($lastlog_more);
458 $form->addElement($lastlog_less);
459 $form->addElement($reg_more);
460 $form->addElement($reg_less);
461 $form->addElement($posts_more);
462 $form->addElement($posts_less);
463 $form->addElement($mailok_radio);
464 $form->addElement($type_radio);
465 $form->addElement($sort_select);
466 $form->addElement($order_select);
467 $form->addElement($limit_text);
470 if (!empty($_GET[
'group']) && intval($_GET[
'group']) > 0) {
472 $form->addElement($group_hidden);
474 $form->addElement($submit_button);
491 $requete_pagenav =
'';
495 $value = Request::getString(
'user_uname',
'');
496 if (!empty($value)) {
499 $requete_pagenav .=
'&user_uname=' . htmlspecialchars($value) .
'&user_uname_match=' . $match;
500 $requete_search .=
'uname : ' . $value .
' and user_uname_match=' . $match .
'<br />';
503 $value = Request::getString(
'user_name',
'');
504 if (!empty($value)) {
507 $requete_pagenav .=
'&user_name=' . htmlspecialchars($value) .
'&user_name_match=' . $match;
508 $requete_search .=
'name : ' . $value .
' and user_name_match=' . $match .
'<br />';
511 $value = Request::getString(
'user_email',
'');
512 if (!empty($value)) {
515 $requete_pagenav .=
'&user_email=' . htmlspecialchars($value) .
'&user_email_match=' . $match;
516 $requete_search .=
'email : ' . $value .
' and user_email_match=' . $match .
'<br />';
519 $value = Request::getString(
'user_url',
'');
520 if (!empty($value)) {
523 $requete_search .=
'url : ' . $value .
'<br />';
526 $value = (int) Request::getInt(
'user_icq', 0);
527 if (!empty($value)) {
530 $requete_pagenav .=
'&user_icq=' . $value .
'&user_icq_match=' . $match;
531 $requete_search .=
'icq : ' . $value .
' and user_icq_match=' . $match .
'<br />';
534 $value = Request::getString(
'user_aim',
'');
535 if (!empty($value)) {
538 $requete_pagenav .=
'&user_aim=' . htmlspecialchars($value) .
'&user_aim_match=' . $match;
539 $requete_search .=
'aim : ' . $value .
' and user_aim_match=' . $match .
'<br />';
542 $value = Request::getString(
'user_yim',
'');
543 if (!empty($value)) {
546 $requete_pagenav .=
'&user_yim=' . htmlspecialchars($value) .
'&user_yim_match=' . $match;
547 $requete_search .=
'yim : ' . $value .
' and user_yim_match=' . $match .
'<br />';
550 $value = Request::getString(
'user_msnm',
'');
551 if (!empty($value)) {
554 $requete_pagenav .=
'&user_msnm=' . htmlspecialchars($value) .
'&user_msnm_match=' . $match;
555 $requete_search .=
'msnm : ' . $value .
' and user_msnm_match=' . $match .
'<br />';
558 $value = Request::getString(
'user_from',
'');
559 if (!empty($value)) {
561 $requete_pagenav .=
'&user_from=' . htmlspecialchars($value);
562 $requete_search .=
'from : ' . $value .
'<br />';
565 $value = Request::getString(
'user_intrest',
'');
566 if (!empty($value)) {
568 $requete_pagenav .=
'&user_intrest=' . htmlspecialchars($value);
569 $requete_search .=
'interet : ' . $value .
'<br />';
572 $value = Request::getString(
'user_occ',
'');
573 if (!empty($value)) {
575 $requete_pagenav .=
'&user_occ=' . htmlspecialchars($value);
576 $requete_search .=
'location : ' . $value .
'<br />';
579 $value = (int) Request::getInt(
'user_lastlog_more', 0);
580 if (!empty($value)) {
581 $time = time() - (60 * 60 * 24 * $value);
584 $requete_pagenav .=
'&user_lastlog_more=' . $value;
585 $requete_search .=
'derniere connexion apres : ' . $value .
'<br />';
589 $value = (int) Request::getInt(
'user_lastlog_less', 0);
590 if (!empty($value)) {
591 $time = time() - (60 * 60 * 24 * $value);
594 $requete_pagenav .=
'&user_lastlog_less=' . $value;
595 $requete_search .=
'derniere connexion avant : ' . $value .
'<br />';
599 $value = (int) Request::getInt(
'user_reg_more', 0);
600 if (!empty($value)) {
601 $time = time() - (60 * 60 * 24 * $value);
604 $requete_pagenav .=
'&user_reg_more=' . $value;
605 $requete_search .=
'enregistre apres : ' . $value .
'<br />';
609 $value = (int) Request::getInt(
'user_reg_less', 0);
610 if (!empty($value)) {
611 $time = time() - (60 * 60 * 24 * $value);
614 $requete_pagenav .=
'&user_reg_less=' . $value;
615 $requete_search .=
'enregistre avant : ' . $value .
'<br />';
619 $value = (int) Request::getInt(
'user_posts_more', 0);
620 if (!empty($value)) {
622 $requete_pagenav .=
'&user_posts_more=' . $value;
623 $requete_search .=
'posts plus de : ' . $value .
'<br />';
626 $value = (int) Request::getInt(
'user_posts_less', 0);
627 if (!empty($value)) {
629 $requete_pagenav .=
'&user_posts_less=' . $value;
630 $requete_search .=
'post moins de : ' . $value .
'<br />';
633 $value = Request::getWord(
'user_mailok',
'');
634 if (!empty($value) && ($value !==
'both')) {
635 $ok = ($value ==
'mailok') ? 1 : 0;
637 $requete_pagenav .=
'&user_mailok=' . $value;
638 $requete_search .=
'accept email : ' . $value .
'<br />';
641 $user_type = Request::getWord(
'user_type',
'');
642 if (!empty($user_type) && ($user_type !==
'both')) {
643 if ($user_type ==
'inactv') {
645 } elseif ($user_type ==
"actv") {
648 $requete_search .=
'actif ou inactif : ' . $user_type .
'<br />';
649 $requete_pagenav .=
'&user_type=' . $user_type;
653 $validsort = array(
"uname",
"email",
"last_login",
"user_regdate",
"posts");
654 $sort = (string) Request::getWord(
'user_sort',
'user_regdate');
655 $sort = (!in_array($sort, $validsort)) ?
"user_regdate" : $sort;
656 $requete_pagenav .=
'&user_sort=' . $sort;
657 $requete_search .=
'order by : ' . $sort .
'<br />';
660 $order = (string) Request::getWord(
'user_order',
'DESC');
661 $requete_pagenav .=
'&user_order=' . $order;
662 $requete_search .=
'tris : ' . $order .
'<br />';
665 $user_limit =
$xoops->getModuleConfig(
'users_pager',
'system');
666 if (isset($_REQUEST[
'user_limit'])) {
667 $user_limit = $_REQUEST[
'user_limit'];
668 $requete_pagenav .=
'&user_limit=' . htmlspecialchars($_REQUEST[
'user_limit']);
669 $requete_search .=
'limit : ' . $user_limit .
'<br />';
671 $requete_pagenav .=
'&user_limit=' .
$xoops->getModuleConfig(
'users_pager',
'system');
672 $requete_search .=
'limit : ' . $user_limit .
'<br />';
675 $start = (!empty($_REQUEST[
'start'])) ? intval($_REQUEST[
'start']) : 0;
677 if (isset($_REQUEST[
'selgroups'])) {
678 if ($_REQUEST[
'selgroups'] != 0) {
679 if (count($_REQUEST[
'selgroups']) == 1) {
680 $groups = array(0 => $_REQUEST[
'selgroups']);
682 $groups = array_map(
"intval", $_REQUEST[
'selgroups']);
687 $requete_pagenav .=
'&selgroups=' . htmlspecialchars($_REQUEST[
'selgroups']);
694 $users_arr = array();
695 if (
$start < $users_count) {
705 $xoops->tpl()->assign(
'users_count', $users_count);
706 $xoops->tpl()->assign(
'users_display',
true);
714 $selgroups = (!isset($_REQUEST[
'selgroups'])) ?
'' : $_REQUEST[
'selgroups'];
716 $user_uname = (!isset($_REQUEST[
'user_uname'])) ?
'' : $_REQUEST[
'user_uname'];
718 $form =
'<form action="admin.php?fct=users" method="post">
720 <select name="selgroups">
722 $group_handler =
$xoops->getHandlerGroup();
723 $group_arr = $group_handler->getObjects();
725 foreach ($group_arr as $group) {
726 if ($group->getVar(
"groupid") != 3) {
727 $form .=
'<option value="' . $group->getVar(
"groupid") .
'" ' . ($selgroups == $group->getVar(
"groupid") ?
' selected="selected"' :
'') .
'>' . $group->getVar(
"name") .
'</option>';
731 $form .=
'</select>
732 <select name="user_type">
733 <option value="" ' . ($user_type ==
'' ?
' selected="selected"' :
'') .
'>' .
XoopsLocale::ALL_USERS .
'</option>
737 <select name="user_limit">
738 <option value="20" ' . ($user_limit == 20 ?
' selected="selected"' :
'') .
'>20</option>
739 <option value="50" ' . ($user_limit == 50 ?
' selected="selected"' :
'') .
'>50</option>
740 <option value="100" ' . ($user_limit == 100 ?
' selected="selected"' :
'') .
'>100</option>
742 <input type="hidden" name="user_uname_match" value="XOOPS_MATCH_START" />
748 $form_select_groups =
'<select name="selgroups" id="selgroups" style="display:none;"><option value="">---------</option>';
750 $group_handler =
$xoops->getHandlerGroup();
751 $group_arr = $group_handler->getObjects();
753 foreach ($group_arr as $group) {
754 if ($group->getVar(
"groupid") != 3) {
755 $form_select_groups .=
'<option value="' . $group->getVar(
"groupid") .
'" ' . ($selgroups == $group->getVar(
"groupid") ?
' selected="selected"' :
'') .
'>' . $group->getVar(
"name") .
'</option>';
759 $form_select_groups .=
'</select><input type="hidden" name="op" value="users_add_delete_group">';
762 $xoops->tpl()->assign(
'form_select_groups', $form_select_groups);
764 if ($users_count > 0) {
768 foreach ($users_arr as
$user) {
769 $users[
'uid'] = $user->getVar(
"uid");
771 if (in_array($users[
'uid'], $ListOfAdmins)) {
774 $users[
'checkbox_user'] =
false;
778 $users[
'checkbox_user'] =
true;
780 $users[
'name'] = $user->getVar(
"uid");
781 $users[
'name'] = $user->getVar(
"name");
782 $users[
'uname'] = $user->getVar(
"uname");
783 $users[
'email'] = $user->getVar(
"email");
784 $users[
'url'] = $user->getVar(
"url");
785 $avatar =
$xoops->service(
'avatar')->getAvatarUrl($user)->getValue();
788 if ($user->getVar(
"last_login") > 0) {
793 $users[
'user_level'] = $user->getVar(
"level");
794 $users[
'user_icq'] = $user->getVar(
"user_icq");
795 $users[
'user_aim'] = $user->getVar(
"user_aim");
796 $users[
'user_yim'] = $user->getVar(
"user_yim");
797 $users[
'user_msnm'] = $user->getVar(
"user_msnm");
799 $users[
'posts'] = $user->getVar(
"posts");
801 $xoops->tpl()->appendByRef(
'users', $users);
802 $xoops->tpl()->appendByRef(
'users_popup', $users);
803 unset($users, $user);
806 $xoops->tpl()->assign(
'users_no_found',
true);
809 if ($users_count > $user_limit) {
810 $nav =
new XoopsPageNav($users_count, $user_limit,
$start,
'start',
'fct=users&op=default' . $requete_pagenav);
811 $xoops->tpl()->assign(
'nav', $nav->renderNav());
835 $value = $value .
'%';
838 $value =
'%' . $value;
845 $value =
'%' . $value .
'%';
848 $criteria->
add(
new Criteria($column, $value, $relation));
const ONLY_USERS_THAT_DO_NOT_ACCEPT_EMAIL
const TYPE_OF_USERS_TO_SHOW
static formatTimestamp($time, $format= 'l', $timeoffset=null)
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
const ONLY_USERS_THAT_ACCEPT_EMAIL
const EF_CAN_NOT_DELETE_ADMIN_USER
if(!$xoops->isUser()||!$xoops->isModule()||!$xoops->user->isAdmin($xoops->module->mid())) if(!$xoops->getModuleConfig('active_users', 'system')) synchronize($uid, $type)
if(in_array($op, array('install', 'update', 'uninstall'))) $myts
system_adminVersion($version, $value= '')
const POSTS_NUMBER_LESS_THAN_X
const E_NEW_PASSWORDS_NOT_MATCH_TRY_AGAIN
const REGISTRATION_DATE_LESS_THAN_X
const REGISTRATION_DATE_GREATER_THAN_X
const E_USER_NOT_REGISTERED
static sendWelcome($user)
const OCCUPATION_CONTAINS
const EF_USER_NAME_ALREADY_EXISTS
const C_SEE_SEARCH_REQUEST
const XOOPS_MATCH_CONTAIN
add(CriteriaElement $criteriaElement, $condition= 'AND')
const EF_COULD_NOT_ADD_USER_TO_GROUPS
const LAST_LOGIN_LESS_THAN_X
const NUMBER_OF_RESULTS_PER_PAGE
const E_NO_ACCESS_PERMISSION
addCriteria(CriteriaCompo $criteria, $column, $value, $match)
const EF_EMAIL_ALREADY_EXISTS
const LAST_LOGIN_GREATER_THAN_X
static loadFile($file, $once=true)
const POSTS_NUMBER_GREATER_THAN_X
const E_YOU_MUST_COMPLETE_ALL_REQUIRED_FIELDS
const ONLY_INACTIVE_USERS
const EF_COULD_NOT_DELETE_USER