$output .= "短消息已删除。"; } break; case 'addblackls': $user = !empty($_GET['user']) ? $_GET['user'] : (!empty($_POST['user']) ? $_POST['user'] : ''); if(uc_pm_blackls_add($Example_uid, $user)) { $output .= $_GET['user']." 已加入黑名单。"; } break; case 'deleteblackls': if(uc_pm_blackls_delete($Example_uid, $_GET['user'])) { $output .= $_GET['user']." 已从黑名单中移除。"; } break; case 'viewblackls': $data = explode(',', uc_pm_blackls_get($Example_uid)); foreach($data as $ls) { $ls && $output .= "$ls <a href=\"$phpself&action=deleteblackls&user=$ls\">[移除]</a>"; } $output .= " <form method=\"post\" action=\"$phpself&action=addblackls\"> <input name=\"user\" value=\"\"> <input type=\"submit\"> </form> "; break; case 'send': if(!empty($_POST)) { if(!empty($_POST['touser'])) { $msgto = $_POST['touser']; $isusername = 1;
$pmid = empty($_GET['pmid']) ? 0 : floatval($_GET['pmid']); $touid = empty($_GET['touid']) ? 0 : intval($_GET['touid']); $daterange = empty($_GET['daterange']) ? 1 : intval($_GET['daterange']); if ($_GET['subop'] == 'view') { if ($touid) { $list = uc_pm_view($_G['uid'], 0, $touid, $daterange); $pmid = empty($list) ? 0 : $list[0]['pmid']; } elseif ($pmid) { $list = uc_pm_view($_G['uid'], $pmid); if (!empty($_G['gp_from']) && $_G['gp_from'] == 'privatepm') { dsetcookie('viewannouncepmid', $pmid, 31536000); } } $actives = array($daterange => ' class="a"'); } elseif ($_GET['subop'] == 'ignore') { $ignorelist = uc_pm_blackls_get($_G['uid']); $actives = array('ignore' => ' class="a"'); } else { $filter = in_array($_GET['filter'], array('newpm', 'privatepm', 'systempm', 'announcepm')) ? $_GET['filter'] : 'privatepm'; $perpage = 10; $perpage = mob_perpage($perpage); $page = empty($_GET['page']) ? 0 : intval($_GET['page']); if ($page < 1) { $page = 1; } $newannouncepm = array(); if ($filter == 'privatepm' && $page == 1) { $result = uc_pm_list($_G['uid'], 1, 1, 'inbox', 'announcepm', 100); if (!empty($result['data'][0]) && is_array($result['data'][0]) && $result['data'][0]['pmid'] != $_G['cookie']['viewannouncepmid']) { $newannouncepm = $result['data'][0]; }
} include_once S_ROOT . './uc_client/client.php'; $list = array(); $pmid = empty($_GET['pmid']) ? 0 : floatval($_GET['pmid']); $touid = empty($_GET['touid']) ? 0 : intval($_GET['touid']); $daterange = empty($_GET['daterange']) ? 1 : intval($_GET['daterange']); if ($_GET['subop'] == 'view') { if ($touid) { $list = uc_pm_view($_SGLOBAL['supe_uid'], 0, $touid, $daterange); $pmid = empty($list) ? 0 : $list[0]['pmid']; } elseif ($pmid) { $list = uc_pm_view($_SGLOBAL['supe_uid'], $pmid); } $actives = array($daterange => ' class="active"'); } elseif ($_GET['subop'] == 'ignore') { $ignorelist = uc_pm_blackls_get($_SGLOBAL['supe_uid']); $actives = array('ignore' => ' class="active"'); } else { $filter = in_array($_GET['filter'], array('newpm', 'privatepm', 'systempm', 'announcepm')) ? $_GET['filter'] : ($space['newpm'] ? 'newpm' : 'privatepm'); //分页 $perpage = 10; $perpage = mob_perpage($perpage); $page = empty($_GET['page']) ? 0 : intval($_GET['page']); if ($page < 1) { $page = 1; } $result = uc_pm_list($_SGLOBAL['supe_uid'], $page, $perpage, 'inbox', $filter, 100); $count = $result['count']; $list = $result['data']; $multi = multi($count, $perpage, $page, "space.php?do=pm&filter={$filter}"); if ($_SGLOBAL['member']['newpm']) {
function submenu_mail_box() { echo '<div class=wrap>'; echo '<h2>' . __('Mail Box', 'ucenter') . '</h2>'; global $current_user; wp_get_current_user(); list($uid, $_, $_) = uc_get_user($current_user->user_login); $timeoffset = get_option('gmt_offset'); $pm_per_page = 10; $max_msg_length = 100; $handler = $_SERVER['PHP_SELF'] . '?page=' . $_GET['page']; $current_handler = $handler . '&tab=' . $_GET['tab']; $action = !empty($_GET['action']) ? $_GET['action'] : ''; $_GET['tab'] = !empty($_GET['tab']) ? $_GET['tab'] : 'inbox'; $menu = array(array('inbox', '', __('Inbox', 'ucenter')), array('uread', 'filter=newpm', __('Unread Mail', 'ucenter')), array('announcepm', 'filter=announcepm', __('Public Message', 'ucenter')), array('systempm', 'filter=systempm', __('System Message', 'ucenter')), array('send', 'action=send', __('Send Message', 'ucenter')), array('blacklist', 'action=blacklist', __('Black List', 'ucenter'))); echo '<ul class="ucenter-ul">'; foreach ($menu as $item) { printf("<li><a href='{$handler}&tab={$item['0']}&{$item['1']}' %s>{$item['2']}</a></li>", $_GET['tab'] == $item[0] ? 'class="current"' : ''); } echo '</ul><br /><hr />'; switch ($action) { case '': $_GET['pageid'] = max(1, intval($_GET['pageid'])); $_GET['filter'] = !empty($_GET['filter']) ? $_GET['filter'] : ''; $data = uc_pm_list($uid, $_GET['pageid'], $pm_per_page, $_GET['folder'], $_GET['filter'], $max_msg_length); foreach ($data['data'] as $pm) { if ($_GET['filter'] == 'announcepm' || $_GET['filter'] == 'systempm') { $output .= "<li><a href='{$current_handler}&action=view&subtab=within3days&daterange=3&pmid={$pm['pmid']}'>{$pm['subject']}</a>"; $output .= '<br /> ' . __('Content:', 'ucenter') . $pm[message] . '</li>'; } else { $output .= "<li><a href='{$current_handler}&action=view&subtab=within3days&daterange=3&touid={$pm['touid']}'>[{$pm['msgfrom']}]</a> (" . gmdate('Y-m-d H:i:s', $pm['dateline'] + $timeoffset * 3600) . ')'; $pm['new'] && ($output .= " New! "); $output .= '<br /> ' . __('Content: ', 'ucenter') . $pm[message] . '</li>'; } } $page_n = $data['count'] / $pm_per_page; if ($page_n > 1) { $output .= '<hr / ><br />'; $output .= __('Page ', 'ucenter'); for ($i = 1; $i <= $page_n; $i++) { $output .= " <a href='{$current_handler}&pageid={$i}'>{$i}</a> "; } } break; case 'view': $pmid = !empty($_GET['pmid']) ? $_GET['pmid'] : ''; $daterange = !empty($_GET['daterange']) ? $_GET['daterange'] : '1'; $data = uc_pm_view($uid, $pmid, $_GET['touid'], $daterange); $dateranges = array(array('within3days', '3', __('Within 3 Days', 'ucenter')), array('within1week', '4', __('Within This Week', 'ucenter')), array('all', '5', __('All', 'ucenter'))); echo '<ul class="ucenter-ul">'; foreach ($dateranges as $item) { printf("<li><a href='{$current_handler}&action=view&touid={$_GET['touid']}&pmid={$pmid}&subtab={$item['0']}&daterange={$item['1']}' %s>{$item['2']}</a></li>", $_GET['subtab'] == $item[0] ? 'class="current"' : ''); } echo '</ul><br /><hr />'; foreach ($data as $pm) { $output .= "<b>{$pm['msgfrom']}</b>"; if ($_GET['touid'] == $pm['msgfromid']) { $output .= "<a href='{$current_handler}&action=addblacklist&user={$pm['msgfrom']}'>" . __(' [ Ban This User ] ', 'ucenter') . "</a>"; } $output .= ' ( ' . gmdate('Y-m-d H:i:s', $pm['dateline'] + $timeoffset * 3600) . ' ) '; $output .= "<br />{$pm['message']}<br /><br />"; } if (empty($_GET['pmid'])) { $output .= "\n\t\t\t\t\t\t<a href='{$current_handler}&action=delete&uid={$_GET['touid']}'>" . __('Delete All Message From This user', 'ucenter') . "</a><br />\n\t\t\t\t\t\tReply:\n\t\t\t\t\t\t<form method='post' action='{$current_handler}&action=send'>\n\t\t\t\t\t\t<input name='touid' type='hidden' value='{$_GET['touid']}'>\n\t\t\t\t\t\t<textarea name='message' cols='30' rows='5'></textarea><br />\n\t\t\t\t\t\t<input type='submit'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t\t"; } break; case 'delete': if (uc_pm_deleteuser($uid, array($_GET['uid']))) { $output .= __('Deleted', 'ucenter'); } break; case 'addblacklist': $user = !empty($_GET['user']) ? $_GET['user'] : (!empty($_POST['user']) ? $_POST['user'] : ''); if (uc_pm_blackls_add($uid, $user)) { $output .= $_GET['user'] . __('has been added to your black list', 'ucenter'); } break; case 'deleteblacklist': if (uc_pm_blackls_delete($uid, $_GET['user'])) { $output .= $_GET['user'] . __('has been removed from your black list', 'ucenter'); } break; case 'blacklist': $data = explode(',', uc_pm_blackls_get($uid)); foreach ($data as $ls) { $ls && ($output .= "{$ls} <a href='{$current_handler}&action=deleteblacklist&user={$ls}'>" . __('Remove', 'ucenter') . "</a>"); } $output .= "\n\t\t\t\t\t<form method='post' action='{$current_handler}&action=addblacklist'>\n\t\t\t\t\t<input type='input' name='user' value=''>\n\t\t\t\t\t<input type='submit'>\n\t\t\t\t\t</form>\n\t\t\t\t\t"; break; case 'send': if (!empty($_POST)) { if (!empty($_POST['touser'])) { $msgto = $_POST['touser']; $isusername = 1; } else { $msgto = $_POST['touid']; $isusername = 0; } if (uc_pm_send($uid, $msgto, $_POST['subject'], $_POST['message'], 1, 0, $isusername)) { $output .= __('Sended', 'ucenter'); } else { $output .= __('Failed', 'ucenter'); } } else { $output .= "\n\t\t\t\t\t\t<form method='post' action='{$current_handler}&action=send'>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr><td>" . __('to', 'ucenter') . ":</td><td><input name='touser' value='{$_GET['touser']}'></td></tr>\n\t\t\t\t\t\t<tr><td>" . __('subject', 'ucenter') . ":</td><td><input name='subject' value=''><br></td></tr>\n\t\t\t\t\t\t<tr><td>" . __('content', 'ucenter') . ":</td><td><textarea name='message' cols='30' rows='5'></textarea></td></tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<input type='submit'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t\t"; } break; } echo $output; echo '</div>'; }
$output .= "短消息已删除。"; } break; case 'addblackls': $user = !empty($_GET['user']) ? $_GET['user'] : (!empty($_POST['user']) ? $_POST['user'] : ''); if (uc_pm_blackls_add($Cta_uid, $user)) { $output .= $_GET['user'] . " 已加入黑名单。"; } break; case 'deleteblackls': if (uc_pm_blackls_delete($Cta_uid, $_GET['user'])) { $output .= $_GET['user'] . " 已从黑名单中移除。"; } break; case 'viewblackls': $data = explode(',', uc_pm_blackls_get($Cta_uid)); foreach ($data as $ls) { $ls && ($output .= "{$ls} <a href=\"{$phpself}&action=deleteblackls&user={$ls}\">[移除]</a>"); } $output .= "\r\n\t\t\t<form method=\"post\" action=\"{$phpself}&action=addblackls\">\r\n\t\t\t<input name=\"user\" value=\"\">\r\n\t\t\t<input type=\"submit\">\r\n\t\t\t</form>\r\n\t\t\t"; break; case 'send': if (!empty($_POST)) { if (!empty($_POST['touser'])) { $msgto = $_POST['touser']; $isusername = 1; } else { $msgto = $_POST['touid']; $isusername = 0; } if (uc_pm_send($Cta_uid, $msgto, $_POST['subject'], $_POST['message'], 1, 0, $isusername)) {
uc_pm_delete($discuz_uid, 'inbox', $pmid); } showmessage('pm_delete_succeed', "pm.php?filter={$filter}&page={$page}"); } else { uc_pm_readstatus($discuz_uid, $uid, $pmid, $readopt == 1 ? 0 : 1); showmessage($readopt == 1 ? 'pm_mark_read_succeed' : 'pm_mark_unread_succeed', "pm.php?filter={$filter}&page={$page}"); } } else { showmessage('pm_nonexistence', "pm.php?filter={$filter}&page={$page}"); } } elseif ($action == 'addblack') { if ($formhash != FORMHASH) { showmessage('undefined_action', NULL, 'HALTED'); } uc_pm_blackls_add($discuz_uid, $user); if ($user != '{ALL}') { showmessage('pm_addblack_succeed', 'pm.php?action=viewblack'); } else { showmessage('pm_addblackall_succeed', 'pm.php?action=viewblack'); } } elseif ($action == 'delblack') { if ($formhash != FORMHASH) { showmessage('undefined_action', NULL, 'HALTED'); } uc_pm_blackls_delete($discuz_uid, $user); showmessage('pm_delblack_succeed', 'pm.php?action=viewblack'); } elseif ($action == 'viewblack') { $blackls = explode(',', uc_pm_blackls_get($discuz_uid)); $blackall = in_array('{ALL}', $blackls); } include template('pm');
exit; } else { if (uc_pm_send($Example_uid, $_POST['msgto'], $_POST['subject'], $_POST['message'], 1, $_POST['replypmid'], 1)) { echo '<br />短消息已发送<br />'; } else { echo '<br />短消息发送失败,<a href="###" onclick="history.back()">返回</a><br />'; exit; } } } if (!empty($_GET['blackls'])) { if (!empty($_POST)) { uc_pm_blackls_set($Example_uid, $_POST['blackls']); echo '<br />黑名单已保存<br />'; } $blackls = uc_pm_blackls_get($Example_uid); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?example=pmlist&blackls=yes"> <textarea name="blackls" cols="40" rows="10" />' . htmlspecialchars($blackls) . '</textarea><br /> <input type="submit" value="发送" /></form>'; exit; } if (!empty($_GET['pmid'])) { $pms = uc_pm_view($Example_uid, $_GET['pmid']); echo '<br /><a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=' . $_GET['folder'] . '&filter=' . $_GET['filter'] . '">返回</a> '; foreach ($pms as $pm) { echo '<hr>标题:' . $pm['subject'] . ' ' . ($pm['new'] ? '<font color="red">New!</font>' : '') . '<br /> 发送日期:' . gmdate('Y-m-d H:i:s', $pm['dateline'] + $timeoffset * 3600) . '<br />发信人:' . $pm['msgfrom'] . '<br /><br />' . $pm['message']; } if ($pms[0]['msgfromid'] && $pms[0]['msgtoid']) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?example=pmlist&pmsend=yes"> <br /><input type="hidden" name="replypmid" value="' . $_GET['pmid'] . '" /><br />