showtablerow('', 'class="lineheight"', $lang['members_search_nonexistence']); } else { showtablerow('class="first"', array('class="th11"'), array(cplang($Plang['smstong_members_sendsms_members']), cplang('members_search_result', array('membernum' => $membernum)) . "<a href=\"###\" onclick=\"\$('searchmembers').style.display='';\$('sendsms').style.display='none';\$('step1').className='current';\$('step2').className='';\" class=\"act\">{$lang['research']}</a> <strong>{$Plang['smstong_members_sendsms_notice1']}</strong>")); showtagheader('tbody', 'messagebody', TRUE); showsendsms(); showtagfooter('tbody'); $search_condition = serialize($search_condition); showsubmit('sendsmssubmit', 'submit', 'td', '<input type="hidden" name="conditions" value=\'' . $search_condition . '\' />'); } showtablefooter(); showformfooter(); showtagfooter('div'); } } else { $search_condition = unserialize(stripslashes($_POST['conditions'])); $membernum = countmembers($search_condition); notifymembers('sendsms', 'sendsms'); } function showsearchform($operation = '') { global $_G, $lang; $groupselect = array(); $usergroupid = isset($_G['gp_usergroupid']) && is_array($_G['gp_usergroupid']) ? $_G['gp_usergroupid'] : array(); $query = DB::query("SELECT type, groupid, grouptitle, radminid FROM " . DB::table('common_usergroup') . " WHERE groupid NOT IN ('6', '7') ORDER BY (creditshigher<>'0' || creditslower<>'0'), creditslower, groupid"); while ($group = DB::fetch($query)) { $group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type']; $groupselect[$group['type']] .= "<option value=\"{$group['groupid']}\" " . (in_array($group['groupid'], $usergroupid) ? 'selected' : '') . ">{$group['grouptitle']}</option>\n"; } $groupselect = '<optgroup label="' . $lang['usergroups_member'] . '">' . $groupselect['member'] . '</optgroup>' . ($groupselect['special'] ? '<optgroup label="' . $lang['usergroups_special'] . '">' . $groupselect['special'] . '</optgroup>' : '') . ($groupselect['specialadmin'] ? '<optgroup label="' . $lang['usergroups_specialadmin'] . '">' . $groupselect['specialadmin'] . '</optgroup>' : '') . '<optgroup label="' . $lang['usergroups_system'] . '">' . $groupselect['system'] . '</optgroup>'; showtagheader('div', 'searchmembers', !$_G['gp_submit']); echo '<script src="static/js/calendar.js" type="text/javascript"></script>';
function notifymembers($operation, $variable) { global $_G, $lang, $urladd, $conditions, $search_condition; if (!empty($_GET['current'])) { $subject = $message = ''; if ($settings = C::t('common_setting')->fetch($variable, true)) { $subject = $settings['subject']; $message = $settings['message']; } $setarr = array(); foreach ($_G['setting']['extcredits'] as $id => $value) { if (isset($_GET['extcredits' . $id])) { if ($_GET['updatecredittype'] == 0) { $setarr['extcredits' . $id] = $_GET['extcredits' . $id]; } else { $setarr[] = 'extcredits' . $id; } } } } else { $current = 0; $subject = $_GET['subject']; $message = $_GET['message']; $subject = trim($subject); $message = trim(str_replace("\t", ' ', $message)); $addmsg = ''; if ($_GET['notifymembers'] && $_GET['notifymember'] && !($subject && $message)) { cpmsg('members_newsletter_sm_invalid', '', 'error'); } if ($operation == 'reward') { $serarr = array(); if ($_GET['updatecredittype'] == 0) { if (is_array($_GET['addextcredits']) && !empty($_GET['addextcredits'])) { foreach ($_GET['addextcredits'] as $key => $value) { $value = intval($value); if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) { $setarr['extcredits' . $key] = $value; $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ": " . ($value > 0 ? '<em class="xi1">+' : '<em class="xg1">') . "{$value}</em> " . $_G['setting']['extcredits'][$key]['unit'] . ' '; } } } } else { if (is_array($_GET['resetextcredits']) && !empty($_GET['resetextcredits'])) { foreach ($_GET['resetextcredits'] as $key => $value) { $value = intval($value); if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) { $setarr[] = 'extcredits' . $key; $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ': <em class="xg1">' . cplang('members_reward_clean') . '</em> '; } } } } if ($addmsg) { $addmsg = ' <br /><br /><b>' . cplang('members_reward_affect') . ':</b><br \\>' . $addmsg; } if (!empty($setarr)) { $limit = 2000; set_time_limit(0); $i = 0; while (true) { $uids = searchmembers($search_condition, $limit, $i * $limit); $allcount = C::t('common_member_count')->fetch_all($uids); $insertmember = array_diff($uids, array_keys($allcount)); foreach ($insertmember as $uid) { C::t('common_member_count')->insert(array('uid' => $uid)); } if ($_GET['updatecredittype'] == 0) { C::t('common_member_count')->increase($uids, $setarr); } else { C::t('common_member_count')->clear_extcredits($uids, $setarr); } if (count($uids) < $limit) { break; } $i++; } } else { cpmsg('members_reward_invalid', '', 'error'); } if (!$_GET['notifymembers']) { cpmsg('members_reward_succeed', '', 'succeed'); } } elseif ($operation == 'confermedal') { $medals = $_GET['medals']; if (!empty($medals)) { $medalids = array(); foreach ($medals as $key => $medalid) { $medalids[] = $key; } $medalsnew = $comma = ''; $medalsnewarray = $medalidarray = array(); foreach (C::t('forum_medal')->fetch_all_by_id($medalids) as $medal) { $medal['status'] = empty($medal['expiration']) ? 0 : 1; $medal['expiration'] = empty($medal['expiration']) ? 0 : TIMESTAMP + $medal['expiration'] * 86400; $medal['medal'] = $medal['medalid'] . (empty($medal['expiration']) ? '' : '|' . $medal['expiration']); $medalsnew .= $comma . $medal['medal']; $medalsnewarray[] = $medal; $medalidarray[] = $medal['medalid']; $comma = "\t"; } $uids = searchmembers($search_condition); if ($uids) { foreach (C::t('common_member_field_forum')->fetch_all($uids) as $uid => $medalnew) { $usermedal = array(); $addmedalnew = ''; if (empty($medalnew['medals'])) { $addmedalnew = $medalsnew; } else { foreach ($medalidarray as $medalid) { $usermedal_arr = explode("\t", $medalnew['medals']); foreach ($usermedal_arr as $key => $medalval) { list($usermedalid, ) = explode("|", $medalval); $usermedal[] = $usermedalid; } if (!in_array($medalid, $usermedal)) { $addmedalnew .= $medalid . "\t"; } } $addmedalnew .= $medalnew['medals']; } C::t('common_member_field_forum')->update($medalnew['uid'], array('medals' => $addmedalnew), true); foreach ($medalsnewarray as $medalnewarray) { $data = array('uid' => $medalnew['uid'], 'medalid' => $medalnewarray['medalid'], 'type' => 0, 'dateline' => $_G['timestamp'], 'expiration' => $medalnewarray['expiration'], 'status' => $medalnewarray['status']); C::t('forum_medallog')->insert($data); C::t('common_member_medal')->insert(array('uid' => $medalnew['uid'], 'medalid' => $medalnewarray['medalid']), 0, 1); } } } } if (!$_GET['notifymember']) { cpmsg('members_confermedal_succeed', '', 'succeed'); } } elseif ($operation == 'confermagic') { $magics = $_GET['magic']; $magicnum = $_GET['magicnum']; if ($magics) { require_once libfile('function/magic'); $limit = 200; set_time_limit(0); for ($i = 0; $i > -1; $i++) { $uids = searchmembers($search_condition, $limit, $i * $limit); foreach ($magics as $magicid) { $uparray = $insarray = array(); if (empty($magicnum[$magicid])) { continue; } $query = C::t('common_member_magic')->fetch_all($uids ? $uids : -1, $magicid); foreach ($query as $row) { $uparray[] = $row['uid']; } if ($uparray) { C::t('common_member_magic')->increase($uparray, $magicid, array('num' => $magicnum[$magicid])); } $insarray = array_diff($uids, $uparray); if ($insarray) { $sqls = array(); foreach ($insarray as $uid) { C::t('common_member_magic')->insert(array('uid' => $uid, 'magicid' => $magicid, 'num' => $magicnum[$magicid])); } } foreach ($uids as $uid) { updatemagiclog($magicid, '3', $magicnum[$magicid], '', $uid); } } if (count($uids) < $limit) { break; } } } } C::t('common_setting')->update($variable, array('subject' => $subject, 'message' => $message)); } $pertask = intval($_GET['pertask']); $current = $_GET['current'] ? intval($_GET['current']) : 0; $continue = FALSE; if (!function_exists('sendmail')) { include libfile('function/mail'); } if ($_GET['notifymember'] && in_array($_GET['notifymembers'], array('pm', 'notice', 'email', 'mobile'))) { $uids = searchmembers($search_condition, $pertask, $current); require_once libfile('function/discuzcode'); $message = in_array($_GET['notifymembers'], array('email', 'notice')) && $_GET['posttype'] ? discuzcode($message, 1, 0, 1, '', '', '', 1) : discuzcode($message, 1, 0); $pmuids = array(); if ($_GET['notifymembers'] == 'pm') { $membernum = countmembers($search_condition, $urladd); $gpmid = $_GET['gpmid']; if (!$gpmid) { $pmdata = array('authorid' => $_G['uid'], 'author' => !$_GET['system'] ? $_G['member']['username'] : '', 'dateline' => TIMESTAMP, 'message' => ($subject ? '<b>' . $subject . '</b><br /> ' : '') . $message . $addmsg, 'numbers' => $membernum); $gpmid = C::t('common_grouppm')->insert($pmdata, true); } $urladd .= '&gpmid=' . $gpmid; } $members = C::t('common_member')->fetch_all($uids); if ($_GET['notifymembers'] == 'mobile') { $toUids = array_keys($members); if ($_G['setting']['cloud_status'] && !empty($toUids)) { try { $noticeService = Cloud::loadClass('Service_Client_Notification'); $fromType = $_GET['system'] ? 1 : 2; $noticeService->addSiteMasterUserNotify($toUids, $subject, $message, $_G['uid'], $_G['username'], $fromType, TIMESTAMP); } catch (Cloud_Service_Client_RestfulException $e) { cpmsg('[' . $e->getCode() . ']' . $e->getMessage(), '', 'error'); } } } else { foreach ($members as $member) { if ($_GET['notifymembers'] == 'pm') { C::t('common_member_grouppm')->insert(array('uid' => $member['uid'], 'gpmid' => $gpmid, 'status' => 0), false, true); $newpm = setstatus(2, 1, $member['newpm']); C::t('common_member')->update($member['uid'], array('newpm' => $newpm)); } elseif ($_GET['notifymembers'] == 'notice') { notification_add($member['uid'], 'system', 'system_notice', array('subject' => $subject, 'message' => $message . $addmsg, 'from_id' => 0, 'from_idtype' => 'sendnotice'), 1); } elseif ($_GET['notifymembers'] == 'email') { if (!sendmail("{$member['username']} <{$member['email']}>", $subject, $message . $addmsg)) { runlog('sendmail', "{$member['email']} sendmail failed."); } } $log = array(); if ($_GET['updatecredittype'] == 0) { foreach ($setarr as $key => $val) { if (empty($val)) { continue; } $val = intval($val); $id = intval($key); $id = !$id && substr($key, 0, -1) == 'extcredits' ? intval(substr($key, -1, 1)) : $id; if (0 < $id && $id < 9) { $log['extcredits' . $id] = $val; } } $logtype = 'RPR'; } else { foreach ($setarr as $val) { if (empty($val)) { continue; } $id = intval($val); $id = !$id && substr($val, 0, -1) == 'extcredits' ? intval(substr($val, -1, 1)) : $id; if (0 < $id && $id < 9) { $log['extcredits' . $id] = '-1'; } } $logtype = 'RPZ'; } include_once libfile('function/credit'); credit_log($member['uid'], $logtype, $member['uid'], $log); $continue = TRUE; } } } $newsletter_detail = array(); if ($continue) { $next = $current + $pertask; $newsletter_detail = array('uid' => $_G['uid'], 'current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition), 'action' => "action=members&operation={$operation}&{$operation}submit=yes¤t={$next}&pertask={$pertask}&system={$_GET['system']}&posttype={$_GET['posttype']}¬ifymember={$_GET['notifymember']}¬ifymembers=" . rawurlencode($_GET['notifymembers']) . $urladd); save_newsletter('newsletter_detail', $newsletter_detail); $logaddurl = ''; foreach ($setarr as $k => $v) { if ($_GET['updatecredittype'] == 0) { $logaddurl .= '&' . $k . '=' . $v; } else { $logaddurl .= '&' . $v . '=-1'; } } $logaddurl .= '&updatecredittype=' . $_GET['updatecredittype']; cpmsg("{$lang['members_newsletter_send']}: " . cplang('members_newsletter_processing', array('current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition))), "action=members&operation={$operation}&{$operation}submit=yes¤t={$next}&pertask={$pertask}&system={$_GET['system']}&posttype={$_GET['posttype']}¬ifymember={$_GET['notifymember']}¬ifymembers=" . rawurlencode($_GET['notifymembers']) . $urladd . $logaddurl, 'loadingform'); } else { del_newsletter('newsletter_detail'); if ($operation == 'reward' && $_GET['notifymembers'] == 'pm') { $message = ''; } else { $message = '_notify'; } cpmsg('members' . ($operation ? '_' . $operation : '') . $message . '_succeed', '', 'succeed'); } }
showtableheader('', 'noborder'); showsubtitle(array('medals_grant', 'medals_image', 'name')); echo $medals; showtablefooter(); echo '</td></tr>'; showtagheader('tbody', 'messagebody'); shownewsletter(); showtagfooter('tbody'); showsubmit('confermedalsubmit', 'submit', 'td', '<input class="checkbox" type="checkbox" name="notifymembers" value="1" onclick="$(\'messagebody\').style.display = this.checked ? \'\' : \'none\'" id="grant_notify"/><label for="grant_notify">' . lang('medals_grant_notify') . '</label>'); } showtablefooter(); showformfooter(); showtagfooter('div'); } } else { countmembers(); notifymembers('confermedal', 'medalletter'); } } elseif ($operation == 'add') { if (!submitcheck('addsubmit')) { $groupselect = array(); $query = $db->query("SELECT groupid, type, grouptitle, creditshigher, radminid FROM {$tablepre}usergroups WHERE type='member' AND creditshigher='0' OR (groupid NOT IN ('5', '6', '7') AND radminid<>'1' AND type<>'member') ORDER BY (creditshigher<>'0' || creditslower<>'0'), creditslower, groupid"); while ($group = $db->fetch_array($query)) { $group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type']; if ($group['type'] == 'member' && $group['creditshigher'] == 0) { $groupselect[$group['type']] .= "<option value=\"{$group['groupid']}\" selected>{$group['grouptitle']}</option>\n"; } else { $groupselect[$group['type']] .= "<option value=\"{$group['groupid']}\">{$group['grouptitle']}</option>\n"; } } $groupselect = '<optgroup label="' . $lang['usergroups_member'] . '">' . $groupselect['member'] . '</optgroup>' . ($groupselect['special'] ? '<optgroup label="' . $lang['usergroups_special'] . '">' . $groupselect['special'] . '</optgroup>' : '') . ($groupselect['specialadmin'] ? '<optgroup label="' . $lang['usergroups_specialadmin'] . '">' . $groupselect['specialadmin'] . '</optgroup>' : '') . '<optgroup label="' . $lang['usergroups_system'] . '">' . $groupselect['system'] . '</optgroup>';
function notifymembers($operation, $variable) { global $_G, $lang, $urladd, $conditions, $search_condition; if (!empty($_G['gp_current'])) { $subject = $message = ''; if ($settings = DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='{$variable}'")) { $settings = unserialize($settings); $subject = $settings['subject']; $message = $settings['message']; } } else { $current = 0; $subject = $_G['gp_subject']; $message = $_G['gp_message']; $subject = trim($subject); $message = trim(str_replace("\t", ' ', $message)); $message = stripslashes($message); $addmsg = ''; if ($_G['gp_notifymembers'] && $_G['gp_notifymember'] && !($subject && $message)) { cpmsg('members_newsletter_sm_invalid', '', 'error'); } if ($operation == 'reward') { $updatesql = ''; if ($_G['gp_updatecredittype'] == 0) { if (is_array($_G['gp_addextcredits']) && !empty($_G['gp_addextcredits'])) { foreach ($_G['gp_addextcredits'] as $key => $value) { $value = intval($value); if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) { $updatesql .= ", extcredits{$key}=extcredits{$key}+({$value})"; $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ": " . ($value > 0 ? '<em class="xi1">+' : '<em class="xg1">') . "{$value}</em> " . $_G['setting']['extcredits'][$key]['unit'] . ' '; } } } } else { if (is_array($_G['gp_resetextcredits']) && !empty($_G['gp_resetextcredits'])) { foreach ($_G['gp_resetextcredits'] as $key => $value) { $value = intval($value); if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) { $updatesql .= ", extcredits{$key}=0"; $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ': <em class="xg1">' . cplang('members_reward_clean') . '</em> '; } } } } if ($addmsg) { $addmsg = ' <br /><br /><b>' . cplang('members_reward_affect') . ':</b><br \\>' . $addmsg; } if (!empty($updatesql)) { $limit = 2000; set_time_limit(0); for ($i = 0; $i > -1; $i++) { $uids = searchmembers($search_condition, $limit, $i * $limit); $conditions = $uids ? 'm.uid IN (' . dimplode($uids) . ')' : '0'; $uids_query = DB::query("SELECT m.uid AS m_uid, mc.uid AS mc_uid FROM " . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_count') . " mc ON m.uid=mc.uid WHERE {$conditions}"); while ($uid_tmp = DB::fetch($uids_query)) { if (empty($uid_tmp['mc_uid'])) { DB::insert('common_member_count', array('uid' => $uid_tmp['m_uid'])); } } $uids_conditions = dimplode($uids); DB::query("UPDATE " . DB::table('common_member_count') . " SET uid=uid {$updatesql} WHERE uid IN ({$uids_conditions})", 'UNBUFFTERED'); if (count($uids) < $limit) { break; } } } else { cpmsg('members_reward_invalid', '', 'error'); } if (!$_G['gp_notifymembers']) { cpmsg('members_reward_succeed', '', 'succeed'); } } elseif ($operation == 'confermedal') { $medals = $_G['gp_medals']; if (!empty($medals)) { $medalids = $comma = ''; foreach ($medals as $key => $medalid) { $medalids .= "{$comma}'{$key}'"; $comma = ','; } $medalsnew = $comma = ''; $medalsnewarray = $medalidarray = array(); $query = DB::query("SELECT medalid, expiration FROM " . DB::table('forum_medal') . " WHERE medalid IN ({$medalids}) ORDER BY displayorder"); while ($medal = DB::fetch($query)) { $medal['status'] = empty($medal['expiration']) ? 0 : 1; $medal['expiration'] = empty($medal['expiration']) ? 0 : TIMESTAMP + $medal['expiration'] * 86400; $medal['medal'] = $medal['medalid'] . (empty($medal['expiration']) ? '' : '|' . $medal['expiration']); $medalsnew .= $comma . $medal['medal']; $medalsnewarray[] = $medal; $medalidarray[] = $medal['medalid']; $comma = "\t"; } $uids = searchmembers($search_condition); if ($uids) { $query = DB::query("SELECT uid, medals FROM " . DB::table('common_member_field_forum') . " WHERE uid IN (" . dimplode($uids) . ")"); while ($medalnew = DB::fetch($query)) { $usermedal = array(); $addmedalnew = ''; if (empty($medalnew['medals'])) { $addmedalnew = $medalsnew; } else { foreach ($medalidarray as $medalid) { $usermedal_arr = explode("\t", $medalnew['medals']); foreach ($usermedal_arr as $key => $medalval) { list($usermedalid, ) = explode("|", $medalval); $usermedal[] = $usermedalid; } if (!in_array($medalid, $usermedal)) { $addmedalnew .= $medalid . "\t"; } } $addmedalnew .= $medalnew['medals']; } DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET medals='" . $addmedalnew . "' WHERE uid='" . $medalnew['uid'] . "'", 'UNBUFFTERED'); foreach ($medalsnewarray as $medalnewarray) { $data = array('uid' => $medalnew['uid'], 'medalid' => $medalnewarray['medalid'], 'type' => 0, 'dateline' => $_G['timestamp'], 'expiration' => $medalnewarray['expiration'], 'status' => $medalnewarray['status']); DB::insert('forum_medallog', $data); } } } } if (!$_G['gp_notifymembers']) { cpmsg('members_confermedal_succeed', '', 'succeed'); } } elseif ($operation == 'confermagic') { $magics = $_G['gp_magic']; $magicnum = $_G['gp_magicnum']; if ($magics) { require_once libfile('function/magic'); $limit = 200; set_time_limit(0); for ($i = 0; $i > -1; $i++) { $uids = searchmembers($search_condition, $limit, $i * $limit); $conditions = $uids ? 'uid IN (' . dimplode($uids) . ')' : '0'; foreach ($magics as $magicid) { $uparray = $insarray = array(); if (empty($magicnum[$magicid])) { continue; } $query = DB::query("SELECT uid, magicid FROM " . DB::table('common_member_magic') . " WHERE {$conditions} AND magicid='{$magicid}'"); while ($row = DB::fetch($query)) { $uparray[] = $row['uid']; } if ($uparray) { DB::query("UPDATE " . DB::table('common_member_magic') . " SET num=num+{$magicnum[$magicid]} WHERE uid IN (" . dimplode($uparray) . ") AND magicid='{$magicid}'"); } $insarray = array_diff($uids, $uparray); if ($insarray) { $sqls = array(); $sql = "INSERT INTO " . DB::table('common_member_magic') . " (uid, magicid, num) VALUES "; foreach ($insarray as $uid) { $sqls[] = "('{$uid}', '{$magicid}', '{$magicnum[$magicid]}')"; } $sql .= implode(',', $sqls); DB::query($sql); } foreach ($uids as $uid) { updatemagiclog($magicid, '3', $magicnum[$magicid], '', $uid); } } if (count($uids) < $limit) { break; } } } } DB::query("REPLACE INTO " . DB::table('common_setting') . " (skey, svalue) VALUES ('{$variable}', '" . addslashes(serialize(array('subject' => $subject, 'message' => $message))) . "')"); } $pertask = intval($_G['gp_pertask']); $current = $_G['gp_current'] ? intval($_G['gp_current']) : 0; $continue = FALSE; if (!function_exists('sendmail')) { include libfile('function/mail'); } if ($_G['gp_notifymember'] && in_array($_G['gp_notifymembers'], array('pm', 'notice', 'email'))) { $uids = searchmembers($search_condition, $pertask, $current); $conditions = $uids ? 'uid IN (' . dimplode($uids) . ')' : '0'; require_once libfile('function/discuzcode'); $message = $_G['gp_notifymembers'] == 'email' && $_G['gp_posttype'] ? discuzcode($message, 1, 0, 1, '', '', '', 1) : discuzcode($message, 1, 0); $pmuids = array(); if ($_G['gp_notifymembers'] == 'pm') { $membernum = countmembers($search_condition, $urladd); $gpmid = empty($_G['gp_gpmid']) ? DB::insert('common_grouppm', array('authorid' => $_G['uid'], 'author' => !$_G['gp_system'] ? $_G['member']['username'] : '', 'dateline' => TIMESTAMP, 'message' => ($subject ? '<b>' . $subject . '</b><br /> ' : '') . addslashes($message) . $addmsg, 'numbers' => $membernum), true) : $_G['gp_gpmid']; $urladd .= '&gpmid=' . $gpmid; } $query = DB::query("SELECT uid, username, groupid, email, newpm FROM " . DB::table('common_member') . " m WHERE {$conditions}"); while ($member = DB::fetch($query)) { if ($_G['gp_notifymembers'] == 'pm') { DB::insert('common_member_grouppm', array('uid' => $member['uid'], 'gpmid' => $gpmid, 'status' => 0), false, true); $newpm = setstatus(2, 1, $member['newpm']); DB::query("UPDATE " . DB::table('common_member') . " SET newpm='{$newpm}' WHERE uid='{$member['uid']}'"); } elseif ($_G['gp_notifymembers'] == 'notice') { notification_add($member['uid'], 'system', 'system_notice', array('subject' => $subject, 'message' => $message . $addmsg), 1); } elseif ($_G['gp_notifymembers'] == 'email') { sendmail("{$member['username']} <{$member['email']}>", $subject, $message . $addmsg); } $continue = TRUE; } } $newsletter_detail = array(); if ($continue) { $next = $current + $pertask; $newsletter_detail = array('uid' => $_G['uid'], 'current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition), 'action' => "action=members&operation={$operation}&{$operation}submit=yes¤t={$next}&pertask={$pertask}¬ifymember={$_G['gp_notifymember']}¬ifymembers=" . rawurlencode($_G['gp_notifymembers']) . $urladd); save_newsletter('newsletter_detail', $newsletter_detail); cpmsg("{$lang['members_newsletter_send']}: " . cplang('members_newsletter_processing', array('current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition))), "action=members&operation={$operation}&{$operation}submit=yes¤t={$next}&pertask={$pertask}¬ifymember={$_G['gp_notifymember']}¬ifymembers=" . rawurlencode($_G['gp_notifymembers']) . $urladd, 'loadingform'); } else { del_newsletter('newsletter_detail'); if ($operation == 'reward' && $_G['gp_notifymembers'] == 'pm') { $message = ''; } else { $message = '_notify'; } cpmsg('members' . ($operation ? '_' . $operation : '') . $message . '_succeed', '', 'succeed'); } }
showtableheader('', 'noborder'); showsubtitle(array('medals_grant', 'medals_image', 'name')); echo $medals; showtablefooter(); echo '</td></tr>'; showtagheader('tbody', 'messagebody'); shownewsletter(); showtagfooter('tbody'); showsubmit('confermedalsubmit', 'submit', 'td', '<input class="checkbox" type="checkbox" name="notifymember" value="1" onclick="$(\'messagebody\').style.display = this.checked ? \'\' : \'none\'" id="grant_notify"/><label for="grant_notify">' . cplang('medals_grant_notify') . '</label>'); } showtablefooter(); showformfooter(); showtagfooter('div'); } } else { $membernum = countmembers($search_condition, $urladd); notifymembers('confermedal', 'medalletter'); } function showsearchform($operation = '') { global $_G, $lang; $groupselect = array(); $usergroupid = isset($_G['gp_usergroupid']) && is_array($_G['gp_usergroupid']) ? $_G['gp_usergroupid'] : array(); $query = DB::query("SELECT type, groupid, grouptitle, radminid FROM " . DB::table('common_usergroup') . " WHERE groupid NOT IN ('6', '7') ORDER BY (creditshigher<>'0' || creditslower<>'0'), creditslower, groupid"); while ($group = DB::fetch($query)) { $group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type']; $groupselect[$group['type']] .= "<option value=\"{$group['groupid']}\" " . (in_array($group['groupid'], $usergroupid) ? 'selected' : '') . ">{$group['grouptitle']}</option>\n"; } $groupselect = '<optgroup label="' . $lang['usergroups_member'] . '">' . $groupselect['member'] . '</optgroup>' . ($groupselect['special'] ? '<optgroup label="' . $lang['usergroups_special'] . '">' . $groupselect['special'] . '</optgroup>' : '') . ($groupselect['specialadmin'] ? '<optgroup label="' . $lang['usergroups_specialadmin'] . '">' . $groupselect['specialadmin'] . '</optgroup>' : '') . '<optgroup label="' . $lang['usergroups_system'] . '">' . $groupselect['system'] . '</optgroup>'; showtagheader('div', 'searchmembers', !$_G['gp_submit']); echo '<script src="static/js/calendar.js" type="text/javascript"></script>';