36 include_once XOOPS_ROOT_PATH .
"/modules/system/admin/users/users.php";
48 $xoTheme->addStylesheet( XOOPS_URL .
'/modules/system/css/admin.css');
51 $xoTheme->addScript(
'modules/system/js/admin.js');
82 if (!
$GLOBALS[
'xoopsSecurity']->check()) {
87 if (in_array(XOOPS_GROUP_ADMIN,
$groups)) {
93 $online_handler->destroy(
$uid);
113 foreach (
$_REQUEST[
'memberslist_id'] as $del)
118 if (in_array(XOOPS_GROUP_ADMIN,
$groups)) {
124 $online_handler->destroy($del);
144 if (!
$GLOBALS[
'xoopsSecurity']->check()) {
148 $user_avatar = $theme = null;
149 if ( !isset(
$_REQUEST[
'attachsig'] ) ) $attachsig = null;
162 $edituser->setVar(
"name",
$_REQUEST[
'name']);
163 $edituser->setVar(
"uname",
$_REQUEST[
'username']);
164 $edituser->setVar(
"email",
$_REQUEST[
'email']);
166 $edituser->setVar(
"url",
$url );
167 $edituser->setVar(
"user_icq",
$_REQUEST[
'user_icq']);
168 $edituser->setVar(
"user_from",
$_REQUEST[
'user_from']);
169 $edituser->setVar(
"user_sig",
$_REQUEST[
'user_sig']);
172 $edituser->setVar(
"user_aim",
$_REQUEST[
'user_aim']);
173 $edituser->setVar(
"user_yim",
$_REQUEST[
'user_yim']);
174 $edituser->setVar(
"user_msnm",
$_REQUEST[
'user_msnm']);
175 $attachsig = ( isset(
$_REQUEST[
'attachsig'] ) &&
$_REQUEST[
'attachsig'] == 1 ) ? 1 : 0;
176 $edituser->setVar(
"attachsig", $attachsig);
177 $edituser->setVar(
"timezone_offset",
$_REQUEST[
'timezone_offset']);
178 $edituser->setVar(
"uorder",
$_REQUEST[
'uorder']);
179 $edituser->setVar(
"umode",
$_REQUEST[
'umode']);
181 $edituser->setVar(
"notify_method",
$_REQUEST[
'notify_method']);
182 $edituser->setVar(
"notify_mode",
$_REQUEST[
'notify_mode']);
183 $edituser->setVar(
"bio",
$_REQUEST[
'bio']);
184 $edituser->setVar(
"rank",
$_REQUEST[
'rank']);
185 $edituser->setVar(
"user_occ",
$_REQUEST[
'user_occ']);
186 $edituser->setVar(
"user_intrest",
$_REQUEST[
'user_intrest']);
187 $edituser->setVar(
'user_mailok',
$_REQUEST[
'user_mailok']);
192 <strong>"._AM_SYSTEM_USERS_STNPDNM.
"</strong>";
196 $edituser->setVar(
"pass", md5(
$_REQUEST[
'password']));
200 echo $edituser->getHtmlErrors();
205 $oldgroups = $edituser->getGroups();
207 if ($edituser->getVar(
'uid') == $xoopsUser->getVar(
'uid') && (in_array(XOOPS_GROUP_ADMIN, $oldgroups)) && !(in_array(XOOPS_GROUP_ADMIN,
$_REQUEST[
'groups']))) {
209 array_push(
$_REQUEST[
'groups'], XOOPS_GROUP_ADMIN);
212 foreach ($oldgroups as $groupid) {
213 $member_handler->removeUsersFromGroup($groupid, array($edituser->getVar(
'uid')));
215 foreach (
$_REQUEST[
'groups'] as $groupid) {
225 if (!
$GLOBALS[
'xoopsSecurity']->check())
238 $adduser_errormsg =
'User name '. htmlspecialchars(
$_REQUEST[
'username']) .
' already exists';
244 $newuser->setVar(
"user_viewemail",
$_REQUEST[
'user_viewemail']);
246 if ( isset($attachsig) )
248 $newuser->setVar(
"attachsig",
$_REQUEST[
'attachsig']);
250 $newuser->setVar(
"name",
$_REQUEST[
'name']);
251 $newuser->setVar(
"uname",
$_REQUEST[
'username']);
252 $newuser->setVar(
"email",
$_REQUEST[
'email']);
254 $newuser->setVar(
"user_avatar",
'blank.gif');
255 $newuser->setVar(
'user_regdate', time());
256 $newuser->setVar(
"user_icq",
$_REQUEST[
'user_icq']);
257 $newuser->setVar(
"user_from",
$_REQUEST[
'user_from']);
258 $newuser->setVar(
"user_sig",
$_REQUEST[
'user_sig']);
259 $newuser->setVar(
"user_aim",
$_REQUEST[
'user_aim']);
260 $newuser->setVar(
"user_yim",
$_REQUEST[
'user_yim']);
261 $newuser->setVar(
"user_msnm",
$_REQUEST[
'user_msnm']);
271 $newuser->setVar(
"pass", md5(
$_REQUEST[
'password']));
273 $newuser->setVar(
"timezone_offset",
$_REQUEST[
'timezone_offset']);
274 $newuser->setVar(
"uorder",
$_REQUEST[
'uorder']);
275 $newuser->setVar(
"umode",
$_REQUEST[
'umode']);
277 $newuser->setVar(
"notify_method",
$_REQUEST[
'notify_method']);
278 $newuser->setVar(
"notify_mode",
$_REQUEST[
'notify_mode']);
279 $newuser->setVar(
"bio",
$_REQUEST[
'bio']);
280 $newuser->setVar(
"rank",
$_REQUEST[
'rank']);
281 $newuser->setVar(
"level", 1);
282 $newuser->setVar(
"user_occ",
$_REQUEST[
'user_occ']);
283 $newuser->setVar(
"user_intrest",
$_REQUEST[
'user_intrest']);
284 $newuser->setVar(
'user_mailok',
$_REQUEST[
'user_mailok']);
290 $groups_failed = array();
293 $group = intval($group);
296 $groups_failed[] = $group;
299 if (!empty($groups_failed))
301 $group_names =
$member_handler->getGroupList(
new Criteria(
'groupid',
"(".implode(
", ", $groups_failed).
")",
'IN'));
324 $obj->setVar(
"level", 1);
328 echo $obj->getHtmlErrors();
332 case 'users_synchronize':
344 $xoTheme->addScript(
'browse.php?Frameworks/jquery/jquery.js');
345 $xoTheme->addScript(
'browse.php?Frameworks/jquery/plugins/jquery.ui.js');
348 $xoTheme->addScript(
'modules/system/js/admin.js');
366 $group_arr = $group_handler->getObjects();
367 $group_select->addOption(
"",
"--------------");
368 foreach (array_keys($group_arr) as
$i)
370 if($group_arr[$i]->getVar(
"groupid") != 3)
371 $group_select->addOption(
"".$group_arr[$i]->getVar(
"groupid").
"",
"".$group_arr[$i]->getVar(
"name").
"");
378 $uname_tray->addElement($uname_match);
379 $uname_tray->addElement($uname_text);
383 $name_tray->addElement($name_match);
384 $name_tray->addElement($name_text);
394 $icq_tray->addElement($icq_match);
395 $icq_tray->addElement($icq_text);
399 $aim_tray->addElement($aim_match);
400 $aim_tray->addElement($aim_text);
404 $yim_tray->addElement($yim_match);
405 $yim_tray->addElement($yim_text);
409 $msnm_tray->addElement($msnm_match);
410 $msnm_tray->addElement($msnm_text);
433 $form->addElement($uname_tray);
434 $form->addElement($name_tray);
436 $form->addElement($group_select);
437 $form->addElement($icq_tray);
438 $form->addElement($aim_tray);
439 $form->addElement($yim_tray);
440 $form->addElement($msnm_tray);
441 $form->addElement($url_text);
442 $form->addElement($location_text);
443 $form->addElement($occupation_text);
444 $form->addElement($interest_text);
445 $form->addElement($lastlog_more);
446 $form->addElement($lastlog_less);
447 $form->addElement($reg_more);
448 $form->addElement($reg_less);
449 $form->addElement($posts_more);
450 $form->addElement($posts_less);
451 $form->addElement($mailok_radio);
452 $form->addElement($type_radio);
453 $form->addElement($sort_select);
454 $form->addElement($order_select);
455 $form->addElement($fct_hidden);
456 $form->addElement($limit_text);
457 $form->addElement($op_hidden);
460 if ( !empty(
$_GET[
'group']) && intval(
$_GET[
'group']) > 0 )
463 $form->addElement($group_hidden);
465 $form->addElement($submit_button);
474 $requete_search =
'<br /><br /><strong>See search request: </strong><br /><br />';
475 $requete_pagenav =
'';
494 $requete_pagenav .=
'&user_uname='. htmlspecialchars(
$_REQUEST[
"user_uname"]) .
'&user_uname_match='. htmlspecialchars(
$_REQUEST[
'user_uname_match']);
495 $requete_search .=
'uname : '.$_REQUEST[
'user_uname'].
' et user_uname_match='.
$_REQUEST[
'user_uname_match'].
'<br />';
513 $requete_pagenav .=
'&user_name='. htmlspecialchars(
$_REQUEST[
"user_name"]) .
'&user_name_match='. htmlspecialchars(
$_REQUEST[
'user_name_match']);
514 $requete_search .=
'name : '.$_REQUEST[
'user_name'].
' et user_name_match='.
$_REQUEST[
'user_name_match'].
'<br />';
532 $requete_pagenav .=
'&user_email='. htmlspecialchars(
$_REQUEST[
"user_email"]) .
'&user_email_match='. htmlspecialchars(
$_REQUEST[
'user_email_match']);
533 $requete_search .=
'email : '.$_REQUEST[
'user_email'].
' et user_email_match='.
$_REQUEST[
'user_email_match'].
'<br />';
538 $requete_pagenav .=
'&user_url='. htmlspecialchars(
$_REQUEST[
"user_url"]);
539 $requete_search .=
'url : '.$_REQUEST[
'user_url'].
'<br />';
557 $requete_pagenav .=
'&user_icq='. htmlspecialchars(
$_REQUEST[
"user_icq"]) .
'&user_icq_match='. htmlspecialchars(
$_REQUEST[
'user_icq_match']);
558 $requete_search .=
'icq : '.$_REQUEST[
'user_icq'].
' et user_icq_match='.
$_REQUEST[
'user_icq_match'].
'<br />';
576 $requete_pagenav .=
'&user_aim='. htmlspecialchars(
$_REQUEST[
"user_aim"]) .
'&user_aim_match='. htmlspecialchars(
$_REQUEST[
'user_aim_match']);
577 $requete_search .=
'aim : '.$_REQUEST[
'user_aim'].
' et user_aim_match='.
$_REQUEST[
'user_aim_match'].
'<br />';
595 $requete_pagenav .=
'&user_yim='. htmlspecialchars(
$_REQUEST[
"user_yim"]) .
'&user_yim_match='. htmlspecialchars(
$_REQUEST[
'user_yim_match']);
596 $requete_search .=
'yim : '.$_REQUEST[
'user_yim'].
' et user_yim_match='.
$_REQUEST[
'user_yim_match'].
'<br />';
614 $requete_pagenav .=
'&user_msnm='. htmlspecialchars(
$_REQUEST[
"user_msnm"]) .
'&user_msnm_match='. htmlspecialchars(
$_REQUEST[
'user_msnm_match']);
615 $requete_search .=
'msn : '.$_REQUEST[
'user_msnm'].
' et user_msnm_match='.
$_REQUEST[
'user_msnm_match'].
'<br />';
620 $requete_pagenav .=
'&user_from='. htmlspecialchars(
$_REQUEST[
"user_from"]);
621 $requete_search .=
'from : '.$_REQUEST[
'user_from'].
'<br />';
624 if ( !empty(
$_REQUEST[
'user_intrest']) ) {
626 $requete_pagenav .=
'&user_intrest='. htmlspecialchars(
$_REQUEST[
"user_intrest"]);
627 $requete_search .=
'interet : '.$_REQUEST[
'user_intrest'].
'<br />';
632 $requete_pagenav .=
'&user_occ='. htmlspecialchars(
$_REQUEST[
"user_occ"]);
633 $requete_search .=
'location : '.$_REQUEST[
'user_occ'].
'<br />';
636 if ( !empty(
$_REQUEST[
'user_lastlog_more']) && is_numeric(
$_REQUEST[
'user_lastlog_more']) ) {
637 $f_user_lastlog_more = intval(trim(
$_REQUEST[
'user_lastlog_more']));
638 $time = time() - (60 * 60 * 24 * $f_user_lastlog_more);
642 $requete_pagenav .=
'&user_lastlog_more='. htmlspecialchars(
$_REQUEST[
"user_lastlog_more"]);
643 $requete_search .=
'derniere connexion apres : '.$_REQUEST[
'user_lastlog_more'].
'<br />';
646 if ( !empty(
$_REQUEST[
'user_lastlog_less']) && is_numeric(
$_REQUEST[
'user_lastlog_less']) ) {
647 $f_user_lastlog_less = intval(trim(
$_REQUEST[
'user_lastlog_less']));
648 $time = time() - (60 * 60 * 24 * $f_user_lastlog_less);
652 $requete_pagenav .=
'&user_lastlog_less='. htmlspecialchars(
$_REQUEST[
"user_lastlog_less"]);
653 $requete_search .=
'derniere connexion avant : '.$_REQUEST[
'user_lastlog_less'].
'<br />';
657 $f_user_reg_more = intval(trim(
$_REQUEST[
'user_reg_more']));
658 $time = time() - (60 * 60 * 24 * $f_user_reg_more);
662 $requete_pagenav .=
'&user_regdate='. htmlspecialchars(
$_REQUEST[
"user_regdate"]);
663 $requete_search .=
'enregistre apres : '.$_REQUEST[
'user_reg_more'].
'<br />';
667 $f_user_reg_less = intval(
$_REQUEST[
'user_reg_less']);
668 $time = time() - (60 * 60 * 24 * $f_user_reg_less);
672 $requete_pagenav .=
'&user_reg_less='. htmlspecialchars(
$_REQUEST[
"user_reg_less"]);
673 $requete_search .=
'enregistre avant : '.$_REQUEST[
'user_reg_less'].
'<br />';
676 if ( !empty(
$_REQUEST[
'user_posts_more']) && is_numeric(
$_REQUEST[
'user_posts_more']) ) {
678 $requete_pagenav .=
'&user_posts_more='. htmlspecialchars(
$_REQUEST[
"user_posts_more"]);
679 $requete_search .=
'posts plus de : '.$_REQUEST[
'user_posts_more'].
'<br />';
682 if ( !empty(
$_REQUEST[
'user_posts_less']) && is_numeric(
$_REQUEST[
'user_posts_less']) ) {
684 $requete_pagenav .=
'&user_posts_less='. htmlspecialchars(
$_REQUEST[
"user_posts_less"]);
685 $requete_search .=
'post moins de : '.$_REQUEST[
'user_posts_less'].
'<br />';
689 if (
$_REQUEST[
'user_mailok'] ==
"mailng" ) {
691 } elseif (
$_REQUEST[
'user_mailok'] ==
"mailok" ) {
696 $requete_pagenav .=
'&user_mailok='. htmlspecialchars(
$_REQUEST[
"user_mailok"]);
697 $requete_search .=
'accept email : '.$_REQUEST[
'user_mailok'].
'<br />';
701 if (
$_REQUEST[
'user_type'] ==
'inactv' ) {
703 $user_type =
'inactv';
704 $requete_search .=
'actif ou inactif : inactif<br />';
705 } elseif (
$_REQUEST[
'user_type'] ==
"actv" ) {
708 $requete_search .=
'actif ou inactif : actif<br />';
710 $requete_pagenav .=
'&user_type='. htmlspecialchars(
$_REQUEST[
"user_type"]);
714 $requete_search .=
'actif ou inactif : admin et user<br />';
718 $validsort = array(
"uname",
"email",
"last_login",
"user_regdate",
"posts");
720 $sort = (!in_array(
$_REQUEST[
'user_sort'], $validsort)) ?
"user_regdate" :
$_REQUEST[
'user_sort'];
721 $requete_pagenav .=
'&user_sort='. htmlspecialchars(
$_REQUEST[
"user_sort"]);
722 $requete_search .=
'order by : '.$sort.
'<br />';
724 $sort =
"user_regdate";
725 $requete_pagenav .=
'&user_sort=user_regdate';
726 $requete_search .=
'order by : '.$sort.
'<br />';
731 $requete_pagenav .=
'&user_order=ASC';
732 $requete_search .=
'tris : '.$order.
'<br />';
735 $requete_pagenav .=
'&user_order=DESC';
736 $requete_search .=
'tris : '.$order.
'<br />';
742 $requete_pagenav .=
'&user_limit='. htmlspecialchars(
$_REQUEST[
'user_limit']);
743 $requete_search .=
'limit : '.$user_limit.
'<br />';
746 $requete_search .=
'limit : '.$user_limit.
'<br />';
753 if ( count(
$_REQUEST[
'selgroups']) == 1 ) {
761 $requete_pagenav .=
'&selgroups='. htmlspecialchars(
$_REQUEST[
'selgroups']);
773 if (
$start < $users_count ) {
783 $xoopsTpl->assign(
'users_count', $users_count );
784 $xoopsTpl->assign(
'users_display',
true );
796 $form =
'<form action="admin.php?fct=users" method="post">
797 '._AM_SYSTEM_USERS_SEARCH_USER.
'<input type="text" name="user_uname" value="'.
$myts->htmlSpecialChars($user_uname).
'" size="15">
798 <select name="selgroups">
801 $group_arr = $group_handler->getObjects();
802 foreach (array_keys($group_arr) as $i)
804 if($group_arr[$i]->getVar(
"groupid") != 3)
805 $form .=
'<option value="'.$group_arr[
$i]->getVar(
"groupid").
'" '.($selgroups == $group_arr[
$i]->getVar(
"groupid") ?
' selected="selected"' :
'').
'>'.$group_arr[$i]->getVar(
"name").
'</option>';
807 $form .=
'</select>
808 <select name="user_type">
813 <select name="user_limit">
814 <option value="20" '.($user_limit == 20 ?
' selected="selected"' :
'').
'>20</option>
815 <option value="50" '.($user_limit == 50 ?
' selected="selected"' :
'').
'>50</option>
816 <option value="100" '.($user_limit == 100 ?
' selected="selected"' :
'').
'>100</option>
818 <input type="hidden" name="user_uname_match" value="XOOPS_MATCH_START" />
824 $form_select_groups =
'<select name="selgroups" id="selgroups" style="display:none;"><option value="">---------</option>';
827 $group_arr = $group_handler->getObjects();
828 foreach (array_keys($group_arr) as $i)
830 if($group_arr[$i]->getVar(
"groupid") != 3)
831 $form_select_groups .=
'<option value="'.$group_arr[
$i]->getVar(
"groupid").
'" '.($selgroups == $group_arr[
$i]->getVar(
"groupid") ?
' selected="selected"' :
'').
'>'.$group_arr[$i]->getVar(
"name").
'</option>';
833 $form_select_groups .=
'</select><input type="hidden" name="op" value="users_add_delete_group">';
836 $xoopsTpl->assign(
'form_select_groups', $form_select_groups);
838 if ( $users_count > 0 )
841 foreach (array_keys($users_arr) as $i)
843 $users[
'uid'] = $users_arr[
$i]->getVar(
"uid");
845 $user_group =
$member_handler->getGroupsByUser($users_arr[$i]->getVar(
"uid"));
846 if(in_array (
"1", $user_group)) {
849 $users[
'checkbox_user'] =
false;
853 $users[
'checkbox_user'] =
true;
855 $users[
'name'] = $users_arr[
$i]->getVar(
"uid");
856 $users[
'name'] = $users_arr[
$i]->getVar(
"name");
857 $users[
'uname'] = $users_arr[
$i]->getVar(
"uname");
858 $users[
'email'] = $users_arr[
$i]->getVar(
"email");
859 $users[
'url'] = $users_arr[
$i]->getVar(
"url");
860 $users[
'user_avatar'] = ($users_arr[
$i]->getVar(
"user_avatar") ==
'blank.gif') ?
system_AdminIcons(
'anonymous.png') : XOOPS_URL.
'/uploads/'.$users_arr[
$i]->getVar(
"user_avatar");
861 $users[
'reg_date'] =
formatTimestamp($users_arr[$i]->getVar(
"user_regdate"),
"m");
862 if ($users_arr[$i]->getVar(
"last_login") > 0 ) {
863 $users[
'last_login'] =
formatTimestamp($users_arr[$i]->getVar(
"last_login"),
"m");
867 $users[
'user_level'] = $users_arr[
$i]->getVar(
"level");
868 $users[
'user_icq'] = $users_arr[
$i]->getVar(
"user_icq");
869 $users[
'user_aim'] = $users_arr[
$i]->getVar(
"user_aim");
870 $users[
'user_yim'] = $users_arr[
$i]->getVar(
"user_yim");
871 $users[
'user_msnm'] = $users_arr[
$i]->getVar(
"user_msnm");
873 $users[
'posts'] = $users_arr[
$i]->getVar(
"posts");
875 $xoopsTpl->append_by_ref(
'users', $users );
876 $xoopsTpl->append_by_ref(
'users_popup', $users );
880 $xoopsTpl->assign(
'users_no_found',
true );
883 if ($users_count > $user_limit) {
884 include_once XOOPS_ROOT_PATH.
'/class/pagenav.php';
885 $nav =
new XoopsPageNav($users_count, $user_limit,
$start,
'start',
'fct=users&op=default'.$requete_pagenav);