46 $xoTheme->addStylesheet( XOOPS_URL .
'/modules/system/css/admin.css' );
47 $xoTheme->addScript(
'browse.php?Frameworks/jquery/jquery.js');
48 $xoTheme->addScript(
'modules/system/js/admin.js');
58 $display_criteria = 1;
60 if (!empty(
$_POST[
'memberslist_id'])) {
61 $user_count = count(
$_POST[
'memberslist_id']);
63 for (
$i = 0;
$i < $user_count;
$i++ ) {
65 $form->addElement($uid_hidden);
70 $form->addElement($users_label);
71 $display_criteria = 0;
73 if ( !empty($display_criteria) ) {
74 $selected_groups = array();
78 $lastlog_min->setValue(
'');
80 $lastlog_max->setValue(
'');
83 $date->addElement($lastlog_min);
84 $date->addElement($lastlog_max);
90 $idle->addElement($idle_more);
91 $idle->addElement($idle_less);
94 $regd_min->setValue(
'');
96 $regd_max->setValue(
'');
99 $regdate->addElement($regd_min);
100 $regdate->addElement($regd_max);
106 $inactive_cbox->setExtra(
"onclick='javascript:disableElement(\"mail_lastlog_min\");disableElement(\"mail_lastlog_max\");disableElement(\"mail_idle_more\");disableElement(\"mail_idle_less\");disableElement(\"mail_to_group[]\");'");
109 $criteria_tray->addElement($group_select);
111 $criteria_tray->addElement(
$date);
113 $criteria_tray->addElement($idle);
115 $criteria_tray->addElement($regdate);
117 $criteria_tray->addElement($mailok_cbox);
118 $criteria_tray->addElement($inactive_cbox);
121 $form->addElement($criteria_tray);
127 $subject_text =
new XoopsFormText($subject_caption,
"mail_subject", 50, 255);
137 $form->addElement($fname_text);
138 $form->addElement($femail_text);
139 $form->addElement($subject_text);
140 $form->addElement($body_text);
141 $form->addElement($to_checkbox);
142 $form->addElement($op_hidden);
143 $form->addElement($start_hidden);
144 $form->addElement($submit_button);
145 $form->setRequired($subject_text);
146 $form->setRequired($body_text);
159 if (!empty(
$_POST[
'mail_send_to'])) {
164 if ( !empty(
$_POST[
'mail_inactive']) ) {
167 if (!empty(
$_POST[
'mail_mailok'])) {
170 if ( !empty(
$_POST[
'mail_lastlog_min']) ) {
171 $time = strtotime(trim(
$_POST[
'mail_lastlog_min']));
176 if ( !empty(
$_POST[
'mail_lastlog_max']) ) {
177 $time = strtotime(trim(
$_POST[
'mail_lastlog_max']));
182 if ( !empty(
$_POST[
'mail_idle_more']) && is_numeric(
$_POST[
'mail_idle_more']) ) {
183 $f_mail_idle_more = intval(trim(
$_POST[
'mail_idle_more']));
184 $time = 60 * 60 * 24 * $f_mail_idle_more;
190 if ( !empty(
$_POST[
'mail_idle_less']) && is_numeric(
$_POST[
'mail_idle_less']) ) {
191 $f_mail_idle_less = intval(trim(
$_POST[
'mail_idle_less']));
192 $time = 60 * 60 * 24 * $f_mail_idle_less;
199 if ( !empty(
$_POST[
'mail_regd_min']) ) {
205 if ( !empty(
$_POST[
'mail_regd_max']) ) {
213 $criteria_object->setStart( @
$_POST[
'mail_start'] );
214 $criteria_object->setLimit(
$limit );
216 list ($field,
$op, $value) = explode(
' ', $c);
219 $criteria_object->add($crit,
'AND');
222 $groups = empty(
$_POST[
'mail_to_group']) ? array() : array_map(
"intval",
$_POST[
'mail_to_group']);
226 if ( !in_array($getuser->getVar(
"uid"), $added_id) ) {
228 $added_id[] = $getuser->getVar(
"uid");
232 if ( !empty(
$_POST[
'mail_to_user']) ) {
233 foreach (
$_POST[
'mail_to_user'] as $to_user) {
234 if ( !in_array($to_user, $added_id) ) {
236 $added_id[] = $to_user;
240 $added_count = count($added);
243 if ( $added_count > 0 ) {
246 for (
$i = 0;
$i < $added_count;
$i++) {
247 $xoopsMailer->setToUsers($added[
$i]);
249 $xoopsMailer->setFromName(
$myts->stripSlashesGPC(
$_POST[
'mail_fromname']));
250 $xoopsMailer->setFromEmail(
$myts->stripSlashesGPC(
$_POST[
'mail_fromemail']));
251 $xoopsMailer->setSubject(
$myts->stripSlashesGPC(
$_POST[
'mail_subject']));
252 $xoopsMailer->setBody(
$myts->stripSlashesGPC(
$_POST[
'mail_body']));
253 if ( in_array(
"mail",
$_POST[
'mail_send_to']) ) {
254 $xoopsMailer->useMail();
256 if ( in_array(
"pm",
$_POST[
'mail_send_to']) && empty(
$_POST[
'mail_inactive']) ) {
257 $xoopsMailer->usePM();
259 $xoopsMailer->send(
true);
260 $xoopsTpl->assign(
'Sucess', $xoopsMailer->getSuccess());
261 $xoopsTpl->assign(
'Errors', $xoopsMailer->getErrors());
265 if ( $count_criteria >
$limit ) {
266 $form =
new XoopsThemeForm(_AM_SENDMTOUSERS,
"mailusers",
"admin.php?fct=mailusers",
'post',
true);
267 if ( !empty(
$_POST[
'mail_to_group']) ) {
268 foreach (
$_POST[
'mail_to_group'] as $mailgroup) {
270 $form->addElement($group_hidden);
289 $form->addElement($sent_label);
290 $form->addElement($inactive_hidden);
291 $form->addElement($lastlog_min_hidden);
292 $form->addElement($lastlog_max_hidden);
293 $form->addElement($regd_min_hidden);
294 $form->addElement($regd_max_hidden);
295 $form->addElement($idle_more_hidden);
296 $form->addElement($idle_less_hidden);
297 $form->addElement($fname_hidden);
298 $form->addElement($femail_hidden);
299 $form->addElement($subject_hidden);
300 $form->addElement($body_hidden);
301 $form->addElement($op_hidden);
302 $form->addElement($start_hidden);
303 $form->addElement($mail_mailok_hidden);
304 if (isset(
$_POST[
'mail_send_to']) && is_array(
$_POST[
'mail_send_to'])) {
305 foreach (
$_POST[
'mail_send_to'] as $v) {
310 $form->addElement($to_hidden);
312 $form->addElement($submit_button);
315 echo
"<h4>"._AM_SYSTEM_MAILUSERS_SENDCOMP.
"</h4>";
318 echo
"<h4>"._AM_SYSTEM_MAILUSERS_NOUSERMATCH.
"</h4>";