本文整理汇总了PHP中basic_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP basic_clean函数的具体用法?PHP basic_clean怎么用?PHP basic_clean使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了basic_clean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_contact_func
function get_contact_func($xmlrpc_params)
{
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $parser, $displaygroupfields;
$lang->load("member");
$input = Tapatalk_Input::filterXmlInput(array('user_id' => Tapatalk_Input::STRING), $xmlrpc_params);
if (isset($input['user_id']) && !empty($input['user_id'])) {
$uid = $input['user_id'];
} else {
$uid = $mybb->user['uid'];
}
if ($mybb->user['uid'] != $uid) {
$member = get_user($uid);
} else {
$member = $mybb->user;
}
if (!$member['uid']) {
error($lang->error_nomember);
}
// Guests or those without permission can't email other users
if ($mybb->usergroup['cansendemail'] == 0 || !$mybb->user['uid']) {
error_no_permission();
}
if ($member['hideemail'] != 0) {
error($lang->error_hideemail);
}
$user_info = array('result' => new xmlrpcval(true, 'boolean'), 'user_id' => new xmlrpcval($member['uid']), 'display_name' => new xmlrpcval(basic_clean($member['username']), 'base64'), 'enc_email' => new xmlrpcval(base64_encode(encrypt($member['email'], loadAPIKey()))));
$xmlrpc_user_info = new xmlrpcval($user_info, 'struct');
return new xmlrpcresp($xmlrpc_user_info);
}
示例2: search_user_func
function search_user_func()
{
global $user, $config, $auth, $db, $phpbb_root_path;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup(array('memberlist', 'groups'));
if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) {
if ($user->data['user_id'] != ANONYMOUS) {
trigger_error('NO_VIEW_USERS');
}
trigger_error('LOGIN_EXPLAIN_MEMBERLIST');
}
if ($config['load_search'] || $auth->acl_get('a_')) {
$username = request_var('username', '', true);
$email = strtolower(request_var('email', ''));
$sql_where .= $username ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
$sql_where .= $auth->acl_get('a_user') && $email ? ' OR u.user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
} else {
trigger_error('NO_VIEW_USERS');
}
$page = request_var('page', 1);
$per_page = request_var('perpage', 20);
$start = ($page - 1) * $per_page;
$default_key = 'c';
$sort_key = request_var('sk', $default_key);
$sort_dir = request_var('sd', 'a');
$sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber');
// Sorting and order
if (!isset($sort_key_sql[$sort_key])) {
$sort_key = $default_key;
}
$order_by .= $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'a' ? 'ASC' : 'DESC');
// Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly
if ($sort_key == 'm') {
$order_by .= ', u.user_posts DESC';
}
// Count the users ...
if ($sql_where) {
$sql = 'SELECT COUNT(u.user_id) AS total_users
FROM ' . USERS_TABLE . " u\r\r\n\t\t\tWHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")\r\r\n\t\t\t{$sql_where}";
$result = $db->sql_query($sql);
$total_users = (int) $db->sql_fetchfield('total_users');
$db->sql_freeresult($result);
} else {
$total_users = $config['num_users'];
}
// Get us some users :D
$sql = "SELECT u.*\r\r\n\t\tFROM " . USERS_TABLE . " u\r\r\n\t\tWHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")\r\r\n\t\t\t{$sql_where}\r\r\n\t\tORDER BY {$order_by}";
$result = $db->sql_query_limit($sql, $per_page, $start);
$user_list = array();
while ($row = $db->sql_fetchrow($result)) {
$return_user_lists[] = new xmlrpcval(array('username' => new xmlrpcval(basic_clean($row['username']), 'base64'), 'user_id' => new xmlrpcval($row['user_id'], 'string'), 'icon_url' => new xmlrpcval(get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']), 'string')), 'struct');
}
$db->sql_freeresult($result);
$suggested_users = new xmlrpcval(array('total' => new xmlrpcval($total_users, 'int'), 'list' => new xmlrpcval($return_user_lists, 'array')), 'struct');
return new xmlrpcresp($suggested_users);
}
示例3: get_recommended_user_func
function get_recommended_user_func()
{
global $mybb, $db, $lang, $users, $tapatalk_users;
$tapatalk_users = array();
$users = array();
// Load global language phrases
$lang->load("memberlist");
//get tapatalk users
if (isset($_POST['mode']) && $_POST['mode'] == 2) {
$sql = "SELECT userid FROM " . TABLE_PREFIX . "tapatalk_users";
$query = $db->query($sql);
while ($user = $db->fetch_array($query)) {
$tapatalk_users[] = $user['userid'];
}
}
// get pm users
$sql = "SELECT p.toid as uid\n\tFROM " . TABLE_PREFIX . "privatemessages p \n\tWHERE p.uid = " . $mybb->user['uid'] . "\n\tGROUP BY p.toid\n\tLIMIT 0,1000";
get_recommended_user_list($sql, 'contact');
// get pm me users
$sql = "SELECT p.uid as uid\n\tFROM " . TABLE_PREFIX . "privatemessages p \n\tWHERE p.toid = " . $mybb->user['uid'] . "\n\tGROUP BY p.uid\n\tLIMIT 0,1000";
get_recommended_user_list($sql, 'contact');
//get sub topic users
$sql = "SELECT t.uid as uid\n\tFROM " . TABLE_PREFIX . "threadsubscriptions ts \n\tLEFT JOIN " . TABLE_PREFIX . "threads t ON ts.tid = t.tid \n\tWHERE ts.uid = " . $mybb->user['uid'] . "\n\tGROUP BY t.uid\n\tLIMIT 0,1000";
get_recommended_user_list($sql, 'watch');
//get sub me topic users
$sql = "SELECT ts.uid as uid\n\tFROM " . TABLE_PREFIX . "threadsubscriptions ts \n\tRIGHT JOIN " . TABLE_PREFIX . "threads t ON ts.tid = t.tid \n\tWHERE t.uid = " . $mybb->user['uid'] . "\n\tGROUP BY ts.uid\n\tLIMIT 0,1000";
get_recommended_user_list($sql, 'watch');
//get like or thank users
$prefix = "g33k_thankyoulike_";
if (file_exists('thankyoulike.php') && $db->table_exists($prefix . 'thankyoulike')) {
$sql = "SELECT thl.puid as uid\n\t\tFROM " . TABLE_PREFIX . $prefix . "thankyoulike thl \n\t\tWHERE thl.uid = " . $mybb->user['uid'] . "\n\t\tGROUP BY thl.puid\n\t\tLIMIT 0,1000";
get_recommended_user_list($sql, 'like');
$sql = "SELECT thl.uid as uid\n\t\tFROM " . TABLE_PREFIX . $prefix . "thankyoulike thl \n\t\tWHERE thl.puid = " . $mybb->user['uid'] . "\n\t\tGROUP BY thl.uid\n\t\tLIMIT 0,1000";
get_recommended_user_list($sql, 'liked');
}
$page = intval($_POST['page']);
$perpage = intval($_POST['perpage']);
$start = ($page - 1) * $perpage;
$return_user_lists = array();
$users_rank = tapa_rank_users($users);
$total = count($users_rank);
$users_slice = array_slice($users_rank, $start, $perpage);
$user_id_str = implode(',', $users_slice);
$mobi_api_key = loadAPIKey();
if (!empty($user_id_str)) {
$sql = "SELECT uid,username,email,avatar FROM " . TABLE_PREFIX . "users WHERE uid IN({$user_id_str})";
$query = $db->query($sql);
while ($user = $db->fetch_array($query)) {
$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
if ($user['avatar'] != '') {
$user['avatar'] = absolute_url($user['avatar']);
}
$return_user_lists[] = new xmlrpcval(array('username' => new xmlrpcval(basic_clean($user['username']), 'base64'), 'user_id' => new xmlrpcval($user['uid'], 'string'), 'icon_url' => new xmlrpcval($user['avatar'], 'string'), 'type' => new xmlrpcval('', 'string'), 'enc_email' => new xmlrpcval(base64_encode(encrypt(trim($user['email']), $mobi_api_key)), 'string')), 'struct');
}
}
$suggested_users = new xmlrpcval(array('total' => new xmlrpcval($total, 'int'), 'list' => new xmlrpcval($return_user_lists, 'array')), 'struct');
return new xmlrpcresp($suggested_users);
}
示例4: prefetch_account_func
function prefetch_account_func()
{
global $db;
$user = tt_get_user_by_email(trim($_POST['email']));
if (empty($user['user_id'])) {
trigger_error("Can't find the user");
}
$result = array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'user_id' => new xmlrpcval($user['user_id'], 'string'), 'login_name' => new xmlrpcval(basic_clean($user['username']), 'base64'), 'display_name' => new xmlrpcval(basic_clean($user['username']), 'base64'), 'avatar' => new xmlrpcval(get_user_avatar_url($user['user_avatar'], $user['user_avatar_type']), 'string'));
return new xmlrpcresp(new xmlrpcval($result, 'struct'));
}
示例5: get_error
function get_error($err_str, $status = 0)
{
global $context;
@ob_clean();
$result = array('result' => new xmlrpcval(false, 'boolean'), 'result_text' => new xmlrpcval(basic_clean($err_str), 'base64'));
if ($status) {
$result['status'] = new xmlrpcval($status, 'string');
}
$response = new xmlrpcresp(new xmlrpcval($result, 'struct'));
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . $response->serialize('UTF-8');
exit;
}
示例6: get_subscribed_forum_func
function get_subscribed_forum_func($xmlrpc_params)
{
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
$lang->load("usercp");
if ($mybb->user['uid'] == 0 || $mybb->usergroup['canusercp'] == 0) {
return tt_no_permission();
}
$query = $db->simple_select("forumpermissions", "*", "gid='" . $db->escape_string($mybb->user['usergroup']) . "'");
while ($permissions = $db->fetch_array($query)) {
$permissioncache[$permissions['gid']][$permissions['fid']] = $permissions;
}
// Build a forum cache.
$query = $db->query("\n\t\tSELECT f.fid, fr.dateline AS lastread\n\t\tFROM " . TABLE_PREFIX . "forums f\n\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\tWHERE f.active != 0\n\t\tORDER BY pid, disporder\n\t");
while ($forum = $db->fetch_array($query)) {
if ($mybb->user['uid'] == 0) {
if ($forumsread[$forum['fid']]) {
$forum['lastread'] = $forumsread[$forum['fid']];
}
}
$readforums[$forum['fid']] = $forum['lastread'];
}
require_once MYBB_ROOT . "inc/functions_forumlist.php";
$fpermissions = forum_permissions();
$query = $db->query("\n\t\tSELECT fs.*, f.*, t.subject AS lastpostsubject, fr.dateline AS lastread\n\t\tFROM " . TABLE_PREFIX . "forumsubscriptions fs\n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid = fs.fid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid = f.lastposttid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\tWHERE f.type='f' AND fs.uid='" . $mybb->user['uid'] . "'\n\t\tORDER BY f.name ASC\n\t");
$forums = '';
$forum_list = array();
while ($forum = $db->fetch_array($query)) {
$forumpermissions = $fpermissions[$forum['fid']];
if ($forumpermissions['canview'] != 0) {
$lightbulb = get_forum_lightbulb(array('open' => $forum['open'], 'lastread' => $forum['lastread']), array('lastpost' => $forum['lastpost']));
$forum_list[] = new xmlrpcval(array('forum_id' => new xmlrpcval($forum['fid'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($forum['name']), 'base64'), 'is_protected' => new xmlrpcval(!empty($forum['password']), 'boolean'), 'new_post' => new xmlrpcval($lightbulb['folder'] == 'on', 'boolean')), 'struct');
}
}
$result = new xmlrpcval(array('total_forums_num' => new xmlrpcval(count($forum_list), 'int'), 'forums' => new xmlrpcval($forum_list, 'array')), 'struct');
return new xmlrpcresp($result);
}
示例7: addCustomField
function addCustomField($name, $value, &$list)
{
$name = preg_replace('/:$/', '', $name);
$list[] = new xmlrpcval(array('name' => new xmlrpcval(basic_clean($name), 'base64'), 'value' => new xmlrpcval(basic_clean($value), 'base64')), 'struct');
}
示例8: get_announcement_list
function get_announcement_list($foruminfo, $fid)
{
// Gather forum stats
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $time, $mybbgroups, $cache;
$has_announcements = $has_modtools = false;
$forum_stats = $cache->read("forumsdisplay");
$parser = new postParser();
if (is_array($forum_stats)) {
if (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$fid]['modtools'])) {
// Mod tools are specific to forums, not parents
$has_modtools = true;
}
if (!empty($forum_stats[-1]['announcements']) || !empty($forum_stats[$fid]['announcements'])) {
// Global or forum-specific announcements
$has_announcements = true;
}
}
$parentlist = $foruminfo['parentlist'];
$parentlistexploded = explode(",", $parentlist);
foreach ($parentlistexploded as $mfid) {
if (!empty($forum_stats[$mfid]['announcements'])) {
$has_announcements = true;
}
}
$announcementlist = $topic_list = array();
if ($has_announcements == true) {
$limit = '';
$announcements = '';
if ($mybb->settings['announcementlimit']) {
$limit = "LIMIT 0, " . $mybb->settings['announcementlimit'];
}
$sql = build_parent_list($fid, "fid", "OR", $parentlist);
$time = TIME_NOW;
$query = $db->query("\n\t\t\tSELECT a.*, u.username\n\t\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND ({$sql} OR fid='-1')\n\t\t\tORDER BY a.startdate DESC {$limit}\n\t\t");
// See if this announcement has been read in our announcement array
$cookie = array();
if (isset($mybb->cookies['mybb']['announcements'])) {
$cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
}
$announcementlist = '';
$bgcolor = alt_trow(true);
// Reset the trow colors
while ($announcement = $db->fetch_array($query)) {
if ($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) {
$new_class = ' class="subject_new"';
$folder = "newfolder";
} else {
$new_class = ' class="subject_old"';
$folder = "folder";
}
// Mmm, eat those announcement cookies if they're older than our last visit
if (isset($cookie[$announcement['aid']]) && $cookie[$announcement['aid']] < $mybb->user['lastvisit']) {
unset($cookie[$announcement['aid']]);
}
$announcement['announcementlink'] = get_announcement_link($announcement['aid']);
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$postdate = my_date('relative', $announcement['startdate']);
$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
$announcementlist[] = $announcement;
}
if (empty($cookie)) {
// Clean up cookie crumbs
my_setcookie('mybb[announcements]', 0, TIME_NOW - 60 * 60 * 24 * 365);
} else {
if (!empty($cookie)) {
my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);
}
}
foreach ($announcementlist as $announce) {
$user_info = get_user($announce['uid']);
$icon_url = absolute_url($user_info['avatar']);
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($fid, 'string'), 'topic_id' => new xmlrpcval('ann_' . $announce['aid'], 'string'), 'topic_title' => new xmlrpcval(basic_clean($announce['subject']), 'base64'), 'topic_author_id' => new xmlrpcval($announce['uid'], 'string'), 'topic_author_name' => new xmlrpcval(basic_clean($announce['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($icon_url), 'string'), 'reply_number' => new xmlrpcval(0, 'int'), 'view_number' => new xmlrpcval(0, 'int'), 'short_content' => new xmlrpcval(process_short_content($announce['message'], $parser), 'base64')), 'struct');
$topic_list[] = $xmlrpc_topic;
}
}
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval(count($announcementlist), 'int'), 'forum_id' => new xmlrpcval($fid), 'forum_name' => new xmlrpcval(basic_clean($foruminfo['name']), 'base64'), 'can_post' => new xmlrpcval(false, 'boolean'), 'can_upload' => new xmlrpcval(false, 'boolean'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例9: get_custom_fields
function get_custom_fields()
{
global $user, $template;
$custom_fields = array();
if ($template->_rootref['RANK_TITLE']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['RANK'], 'base64'), 'value' => new xmlrpcval(basic_clean($template->_rootref['RANK_TITLE']), 'base64')), 'struct');
}
if (!empty($template->_rootref['S_USER_INACTIVE'])) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['USER_IS_INACTIVE'], 'base64'), 'value' => new xmlrpcval($template->_rootref['USER_INACTIVE_REASON'], 'base64')), 'struct');
}
if ($template->_rootref['LOCATION']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['LOCATION'], 'base64'), 'value' => new xmlrpcval($template->_rootref['LOCATION'], 'base64')), 'struct');
}
if ($template->_rootref['AGE']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['AGE'], 'base64'), 'value' => new xmlrpcval($template->_rootref['AGE'], 'base64')), 'struct');
}
if ($template->_rootref['OCCUPATION']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['OCCUPATION'], 'base64'), 'value' => new xmlrpcval($template->_rootref['OCCUPATION'], 'base64')), 'struct');
}
if ($template->_rootref['INTERESTS']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['INTERESTS'], 'base64'), 'value' => new xmlrpcval($template->_rootref['INTERESTS'], 'base64')), 'struct');
}
if ($template->_rootref['S_GROUP_OPTIONS']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['USERGROUPS'], 'base64'), 'value' => new xmlrpcval($template->_rootref['S_GROUP_OPTIONS'], 'base64')), 'struct');
}
if ($template->_rootref['U_EMAIL']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['EMAIL_ADDRESS'], 'base64'), 'value' => new xmlrpcval($template->_rootref['U_EMAIL'], 'base64')), 'struct');
}
if ($template->_rootref['U_WWW']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['WEBSITE'], 'base64'), 'value' => new xmlrpcval($template->_rootref['U_WWW'], 'base64')), 'struct');
}
if ($template->_rootref['USER_MSN']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['MSNM'], 'base64'), 'value' => new xmlrpcval($template->_rootref['USER_MSN'], 'base64')), 'struct');
}
if ($template->_rootref['USER_YIM']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['YIM'], 'base64'), 'value' => new xmlrpcval($template->_rootref['USER_YIM'], 'base64')), 'struct');
}
if ($template->_rootref['USER_AIM']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['AIM'], 'base64'), 'value' => new xmlrpcval($template->_rootref['USER_AIM'], 'base64')), 'struct');
}
if ($template->_rootref['USER_ICQ']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['ICQ'], 'base64'), 'value' => new xmlrpcval($template->_rootref['USER_ICQ'], 'base64')), 'struct');
}
if ($template->_rootref['USER_JABBER']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['JABBER'], 'base64'), 'value' => new xmlrpcval($template->_rootref['USER_JABBER'], 'base64')), 'struct');
}
if ($template->_rootref['S_WARNINGS']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['WARNINGS'], 'base64'), 'value' => new xmlrpcval($template->_rootref['WARNINGS'], 'base64')), 'struct');
}
if ($template->_rootref['S_SHOW_ACTIVITY'] && $template->_rootref['POSTS']) {
if ($template->_rootref['ACTIVE_FORUM']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['ACTIVE_IN_FORUM'], 'base64'), 'value' => new xmlrpcval($template->_rootref['ACTIVE_FORUM'] . "\n(" . $template->_rootref['ACTIVE_FORUM_POSTS'] . ' / ' . $template->_rootref['ACTIVE_FORUM_PCT'] . ')', 'base64')), 'struct');
}
if ($template->_rootref['ACTIVE_TOPIC']) {
$custom_fields[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['ACTIVE_IN_TOPIC'], 'base64'), 'value' => new xmlrpcval($template->_rootref['ACTIVE_TOPIC'] . "\n(" . $template->_rootref['ACTIVE_TOPIC_POSTS'] . ' / ' . $template->_rootref['ACTIVE_TOPIC_PCT'] . ')', 'base64')), 'struct');
}
}
return $custom_fields;
}
示例10: search_func
function search_func()
{
global $search_data, $include_topic_num, $mybb;
$return_list = array();
foreach ($search_data['results'] as $item) {
$fid = $item['fid'];
if ($search_data['type'] == 'threads') {
$lastpost = $item['lastpost'];
$isbanned = $lastpost['isbanned'];
$return_thread = array('forum_id' => new xmlrpcval($item['fid'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($item['forumname']), 'base64'), 'topic_id' => new xmlrpcval($item['tid'], 'string'), 'topic_title' => new xmlrpcval(basic_clean($item['subject']), 'base64'), 'post_id' => new xmlrpcval($item['lastpost']['pid'], 'string'), 'post_author_id' => new xmlrpcval($lastpost ? $lastpost['uid'] : $item['lastposteruid'], 'string'), 'post_author_name' => new xmlrpcval(basic_clean($lastpost ? $lastpost['username'] : $item['lastposter']), 'base64'), 'last_reply_time' => new xmlrpcval(mobiquo_iso8601_encode($lastpost ? $lastpost['dateline'] : $item['lastpost']), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($lastpost ? $lastpost['dateline'] : $item['lastpost'], 'string'), 'icon_url' => new xmlrpcval(absolute_url($lastpost ? $lastpost['avatar'] : $item['avatar']), 'string'), 'short_content' => new xmlrpcval(basic_clean($lastpost ? $lastpost['prev'] : ''), 'base64'), 'last_reply_author_id' => new xmlrpcval($lastpost ? $lastpost['uid'] : $item['lastposteruid'], 'string'), 'last_reply_author_name' => new xmlrpcval(basic_clean($lastpost ? $lastpost['username'] : $item['lastposter']), 'base64'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($lastpost ? $lastpost['dateline'] : $item['lastpost']), 'dateTime.iso8601'), 'reply_number' => new xmlrpcval($item['replies'], 'int'), 'view_number' => new xmlrpcval($item['views'], 'int'), 'attachment' => new xmlrpcval($item['attachmentcount'], 'string'), 'can_subscribe' => new xmlrpcval(true, 'boolean'), 'is_approved' => new xmlrpcval($item['visible'], 'boolean'));
if ($item['threadprefix']) {
$return_thread['prefix'] = new xmlrpcval(basic_clean($item['threadprefix']), 'base64');
}
if (is_moderator($fid, "canopenclosethreads")) {
$return_thread['can_close'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "candeleteposts")) {
$return_thread['can_delete'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "canmanagethreads")) {
$return_thread['can_stick'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "canmanagethreads")) {
$return_thread['can_move'] = new xmlrpcval(true, 'boolean');
$return_thread['can_merge'] = new xmlrpcval(true, 'boolean');
$return_thread['can_merge_post'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "canopenclosethreads")) {
$return_thread['can_approve'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "caneditposts")) {
$return_thread['can_rename'] = new xmlrpcval(true, 'boolean');
}
if ($mybb->usergroup['canmodcp'] == 1) {
$return_thread['can_ban'] = new xmlrpcval(true, 'boolean');
}
if ($isbanned) {
$return_thread['is_ban'] = new xmlrpcval(true, 'boolean');
}
if ($item['unread']) {
$return_thread['new_post'] = new xmlrpcval(true, 'boolean');
}
if ($item['closed']) {
$return_thread['is_closed'] = new xmlrpcval(true, 'boolean');
}
if ($item['sticky']) {
$return_thread['is_sticky'] = new xmlrpcval(true, 'boolean');
}
if ($item['is_sub']) {
$return_thread['is_subscribed'] = new xmlrpcval(true, 'boolean');
}
$xmlrpc_thread = new xmlrpcval($return_thread, 'struct');
array_push($return_list, $xmlrpc_thread);
} else {
$return_post = array('forum_id' => new xmlrpcval($item['fid'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($item['forumname']), 'base64'), 'topic_id' => new xmlrpcval($item['tid'], 'string'), 'topic_title' => new xmlrpcval(basic_clean($item['thread_subject']), 'base64'), 'post_id' => new xmlrpcval($item['pid'], 'string'), 'post_title' => new xmlrpcval(basic_clean($item['subject']), 'base64'), 'post_author_id' => new xmlrpcval($item['uid'], 'string'), 'post_author_name' => new xmlrpcval(basic_clean($item['username']), 'base64'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($item['dateline']), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($item['dateline'], 'string'), 'reply_number' => new xmlrpcval($item['thread_replies'], 'int'), 'view_number' => new xmlrpcval($item['thread_views'], 'int'), 'icon_url' => new xmlrpcval(absolute_url($item['avatar']), 'string'), 'short_content' => new xmlrpcval(basic_clean($item['prev']), 'base64'), 'is_approved' => new xmlrpcval($item['visible'], 'boolean'));
if (is_moderator($fid, "canmanagethreads")) {
$return_post['can_approve'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "candeleteposts")) {
$return_post['can_delete'] = new xmlrpcval(true, 'boolean');
}
if (is_moderator($fid, "canmanagethreads")) {
$return_post['can_move'] = new xmlrpcval(true, 'boolean');
}
if ($mybb->usergroup['canmodcp'] == 1) {
$return_post['can_ban'] = new xmlrpcval(true, 'boolean');
}
if ($item['isbanned']) {
$return_post['is_ban'] = new xmlrpcval(true, 'boolean');
}
if ($item['unread']) {
$return_post['new_post'] = new xmlrpcval(true, 'boolean');
}
$xmlrpc_post = new xmlrpcval($return_post, 'struct');
array_push($return_list, $xmlrpc_post);
}
}
if ($include_topic_num) {
if ($search_data['type'] == 'threads') {
return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'search_id' => new xmlrpcval($search_data['sid'], 'string'), 'total_topic_num' => new xmlrpcval($search_data['total'], 'int'), 'topics' => new xmlrpcval($return_list, 'array')), 'struct'));
} else {
return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'search_id' => new xmlrpcval($search_data['sid'], 'string'), 'total_post_num' => new xmlrpcval($search_data['total'], 'int'), 'posts' => new xmlrpcval($return_list, 'array')), 'struct'));
}
} else {
return new xmlrpcresp(new xmlrpcval($return_list, 'array'));
}
}
示例11: get_subscribed_topic_func
//.........这里部分代码省略.........
$visible = "AND t.visible != 0";
if (is_moderator() == true) {
$visible = '';
}
// Do Multi Pages
$query = $db->query("\n\t\tSELECT COUNT(ts.tid) as threads\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions ts\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid = ts.tid)\n\t\tWHERE ts.uid = '" . $mybb->user['uid'] . "' {$visible}\n\t");
$threadcount = $db->fetch_field($query, "threads");
// Fetch subscriptions
$query = $db->query("\n\t\tSELECT s.*, t.*, t.username AS threadusername, u.username, u.username, u.avatar, if({$mybb->user['uid']} > 0 and s.uid = {$mybb->user['uid']}, 1, 0) as subscribed, po.message, f.name as forumname, IF(b.lifted > UNIX_TIMESTAMP() OR b.lifted = 0, 1, 0) as isbanned\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions s\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (s.tid=t.tid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid = t.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "banned b ON (b.uid = t.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "posts po ON (po.pid = t.firstpost)\n\t\tleft join " . TABLE_PREFIX . "forums f on f.fid = t.fid\n\t\tWHERE s.uid='" . $mybb->user['uid'] . "' {$visible}\n\t\tORDER BY t.lastpost DESC\n\t\tLIMIT {$start}, {$limit}\n\t");
while ($subscription = $db->fetch_array($query)) {
$forumpermissions = $fpermissions[$subscription['fid']];
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
// Hmm, you don't have permission to view this thread - unsubscribe!
$del_subscriptions[] = $subscription['tid'];
} else {
if ($subscription['tid']) {
$subscriptions[$subscription['tid']] = $subscription;
}
}
}
if (is_array($del_subscriptions)) {
$tids = implode(',', $del_subscriptions);
if ($tids) {
$db->delete_query("threadsubscriptions", "tid IN ({$tids}) AND uid='{$mybb->user['uid']}'");
}
}
$topic_list = array();
if (is_array($subscriptions)) {
$tids = implode(",", array_keys($subscriptions));
// Build a forum cache.
$query = $db->query("\n\t\t\tSELECT f.fid, fr.dateline AS lastread\n\t\t\tFROM " . TABLE_PREFIX . "forums f\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\t\tWHERE f.active != 0\n\t\t\tORDER BY pid, disporder\n\t\t");
while ($forum = $db->fetch_array($query)) {
if ($mybb->user['uid'] == 0) {
if ($forumsread[$forum['fid']]) {
$forum['lastread'] = $forumsread[$forum['fid']];
}
}
$readforums[$forum['fid']] = $forum['lastread'];
}
// Read threads
if ($mybb->settings['threadreadcut'] > 0) {
$query = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");
while ($readthread = $db->fetch_array($query)) {
$subscriptions[$readthread['tid']]['lastread'] = $readthread['dateline'];
}
}
// Now we can build our subscription list
foreach ($subscriptions as $thread) {
$bgcolor = alt_trow();
$folder = '';
$prefix = '';
// If this thread has a prefix, insert a space between prefix and subject
if ($thread['prefix'] != 0) {
$thread['threadprefix'] .= ' ';
}
// Sanitize
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;
$unreadpost = 0;
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
$forum_read = $readforums[$thread['fid']];
$read_cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($forum_read == 0 || $forum_read < $read_cutoff) {
$forum_read = $read_cutoff;
}
} else {
$forum_read = $forumsread[$thread['fid']];
}
if ($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read) {
$cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
}
if ($thread['lastpost'] > $cutoff) {
if ($thread['lastpost'] > $cutoff) {
if ($thread['lastread']) {
$lastread = $thread['lastread'];
} else {
$lastread = 1;
}
}
}
if (!$lastread) {
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if ($readcookie > $forum_read) {
$lastread = $readcookie;
} else {
$lastread = $forum_read;
}
}
if ($thread['lastpost'] > $lastread && $lastread) {
$unreadpost = 1;
}
$topic_list[] = new xmlrpcval(array('forum_id' => new xmlrpcval($thread['fid'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($thread['forumname']), 'base64'), 'topic_id' => new xmlrpcval($thread['tid'], 'string'), 'topic_title' => new xmlrpcval($thread['subject'], 'base64'), 'topic_author_id' => new xmlrpcval($thread['uid'], 'string'), 'post_author_name' => new xmlrpcval($thread['username'], 'base64'), 'can_subscribe' => new xmlrpcval(true, 'boolean'), 'is_subscribed' => new xmlrpcval((bool) $thread['subscribed'], 'boolean'), 'is_closed' => new xmlrpcval((bool) $thread['closed'], 'boolean'), 'short_content' => new xmlrpcval(process_short_content($thread['message'], $parser), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($thread['avatar']), 'string'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($thread['lastpost']), 'dateTime.iso8601'), 'reply_number' => new xmlrpcval($thread['replies'], 'int'), 'view_number' => new xmlrpcval($thread['views'], 'int'), 'new_post' => new xmlrpcval($unreadpost, 'boolean'), 'can_delete' => new xmlrpcval(is_moderator($thread['fid'], "candeleteposts"), 'boolean'), 'can_close' => new xmlrpcval(is_moderator($thread['fid'], "canopenclosethreads"), 'boolean'), 'can_approve' => new xmlrpcval(is_moderator($thread['fid'], "canopenclosethreads"), 'boolean'), 'can_stick' => new xmlrpcval(is_moderator($thread['fid'], "canmanagethreads"), 'boolean'), 'can_merge' => new xmlrpcval(is_moderator($thread['fid'], "canmanagethreads"), 'boolean'), 'can_merge_post' => new xmlrpcval(is_moderator($thread['fid'], "canmanagethreads"), 'boolean'), 'can_move' => new xmlrpcval(is_moderator($thread['fid'], "canmovetononmodforum"), 'boolean'), 'can_ban' => new xmlrpcval($mybb->usergroup['canmodcp'] == 1, 'boolean'), 'can_rename' => new xmlrpcval(false, 'boolean'), 'is_ban' => new xmlrpcval($thread['isbanned'], 'boolean'), 'is_sticky' => new xmlrpcval($thread['sticky'], 'boolean'), 'is_approved' => new xmlrpcval(!!$thread['visible'], 'boolean'), 'is_deleted' => new xmlrpcval(false, 'boolean')), 'struct');
}
}
$result = new xmlrpcval(array('total_topic_num' => new xmlrpcval($threadcount, 'int'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($result);
}
示例12: get_recommended_user_func
function get_recommended_user_func()
{
global $context, $smcFunc, $user_info, $profile, $user_profile, $settings, $scripturl;
$user_id = $user_info['id'];
if (!empty($user_id)) {
$return_user_lists = array();
$total = 0;
$user_lists = $context['recommend'];
$start = $_REQUEST['start'];
$end = $_REQUEST['end'];
$return_user_lists = array();
if (isset($user_lists[$user_id])) {
unset($user_lists[$user_id]);
}
if (!empty($user_lists)) {
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 2) {
$check_users = array_keys($user_lists);
$valid_users_result = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}tapatalk_users
WHERE userid IN ({array_int:check_users})', array('check_users' => $check_users));
while ($tapausers = $smcFunc['db_fetch_assoc']($valid_users_result)) {
unset($user_lists[$tapausers['userid']]);
}
if ($is_tapa_user) {
continue;
}
}
$total = count($user_lists);
arsort($user_lists);
$num_track = 0;
foreach ($user_lists as $uid => $score) {
if ($num_track > $start - 1 && $num_track < $end) {
loadMemberData($uid);
$profile = $user_profile[$uid];
if (!empty($settings['show_user_images']) && empty($profile['options']['show_no_avatars'])) {
$avatar = $profile['avatar'] == '' ? $profile['id_attach'] > 0 ? empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename'] : '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']);
} else {
$avatar = '';
}
if (!empty($profile)) {
$return_user_lists[] = new xmlrpcval(array('username' => new xmlrpcval(basic_clean($user_profile[$uid]['member_name']), 'base64'), 'user_id' => new xmlrpcval($user_profile[$uid]['id_member'], 'string'), 'icon_url' => new xmlrpcval($avatar, 'string')), 'struct');
}
$num_track++;
}
}
}
}
$suggested_users = new xmlrpcval(array('total' => new xmlrpcval($total, 'int'), 'list' => new xmlrpcval($return_user_lists, 'array')), 'struct');
return new xmlrpcresp($suggested_users);
}
示例13: get_forum_func
//.........这里部分代码省略.........
foreach ($forum_rows as $id => $value) {
if (!in_array($value['parent_id'], $fids)) {
unset($forum_rows[$id]);
} else {
if ($value['left_id'] > $value['right_id']) {
unset($forum_rows[$id]);
} else {
$fids[] = $id;
}
}
}
while (empty($forum_rows[$root_forum_id]['child']) && count($forum_rows) > 1) {
$current_parent_id = -1;
$leaves_forum = array();
foreach ($forum_rows as $row) {
$row_parent_id = $row['parent_id'];
if ($row_parent_id != $current_parent_id) {
if (isset($leaves_forum[$row_parent_id])) {
$leaves_forum[$row_parent_id] = array();
} else {
if (isset($leaves_forum[$forum_rows[$row_parent_id]['parent_id']])) {
$leaves_forum[$forum_rows[$row_parent_id]['parent_id']] = array();
}
$leaves_forum[$row_parent_id][] = $row['forum_id'];
}
$current_parent_id = $row_parent_id;
} else {
if ($row_parent_id == $current_parent_id) {
if (!empty($leaves_forum[$row_parent_id])) {
$leaves_forum[$row_parent_id][] = $row['forum_id'];
}
}
}
}
foreach ($leaves_forum as $node_forum_id => $leaves) {
foreach ($leaves as $forum_id) {
$forum =& $forum_rows[$forum_id];
if (function_exists('get_unread_topics')) {
$unread_count = count(get_unread_topics(false, "AND t.forum_id = {$forum_id}"));
} else {
$unread_count = count(tt_get_unread_topics(false, "AND t.forum_id = {$forum_id}"));
}
$forum['unread_count'] += $unread_count;
if ($forum['unread_count']) {
$forum_rows[$forum['parent_id']]['unread_count'] += $forum['unread_count'];
}
$forum_type = $forum['forum_link'] ? 'link' : ($forum['forum_type'] != FORUM_POST ? 'category' : 'forum');
if ($logo_icon_name = tp_get_forum_icon($forum_id, $forum_type, $forum['forum_status'], $forum['unread_count'])) {
$logo_url = $phpbb_home . $config['tapatalkdir'] . '/forum_icons/' . $logo_icon_name;
} else {
if ($forum['forum_image']) {
if (preg_match('#^https?://#i', $forum['forum_image'])) {
$logo_url = $forum['forum_image'];
} else {
$logo_url = $phpbb_home . $forum['forum_image'];
}
} else {
$logo_url = '';
}
}
$xmlrpc_forum = array('forum_id' => new xmlrpcval($forum_id), 'forum_name' => new xmlrpcval(basic_clean($forum['forum_name']), 'base64'), 'parent_id' => new xmlrpcval($node_forum_id), 'logo_url' => new xmlrpcval($logo_url), 'url' => new xmlrpcval($forum['forum_link']));
if ($forum['unread_count']) {
$xmlrpc_forum['unread_count'] = new xmlrpcval($forum['unread_count'], 'int');
}
if ($forum['unread_count']) {
$xmlrpc_forum['new_post'] = new xmlrpcval(true, 'boolean');
}
if ($forum['forum_password']) {
$xmlrpc_forum['is_protected'] = new xmlrpcval(true, 'boolean');
}
if (!empty($forum['can_subscribe'])) {
$xmlrpc_forum['can_subscribe'] = new xmlrpcval(true, 'boolean');
} else {
$xmlrpc_forum['can_subscribe'] = new xmlrpcval(false, 'boolean');
}
if (!empty($forum['is_subscribed'])) {
$xmlrpc_forum['is_subscribed'] = new xmlrpcval(true, 'boolean');
} else {
$xmlrpc_forum['is_subscribed'] = new xmlrpcval(false, 'boolean');
}
if ($forum['forum_type'] != FORUM_POST) {
$xmlrpc_forum['sub_only'] = new xmlrpcval(true, 'boolean');
}
if ($return_description) {
$description = smiley_text($forum['forum_desc'], true);
$description = generate_text_for_display($description, $forum['forum_desc_uid'], $forum['forum_desc_bitfield'], $forum['forum_desc_options']);
$description = preg_replace('/<br *?\\/?>/i', "\n", $description);
$xmlrpc_forum['description'] = new xmlrpcval(basic_clean($description), 'base64');
}
if (isset($forum['child'])) {
$xmlrpc_forum['child'] = new xmlrpcval($forum['child'], 'array');
}
$forum_rows[$node_forum_id]['child'][] = new xmlrpcval($xmlrpc_forum, 'struct');
unset($forum_rows[$forum_id]);
}
}
}
$response = new xmlrpcval($forum_rows[$root_forum_id]['child'], 'array');
return new xmlrpcresp($response);
}
示例14: m_get_moderate_post_func
function m_get_moderate_post_func($xmlrpc_params)
{
global $input, $post, $thread, $forum, $pid, $tid, $fid, $modlogdata, $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $moderation, $parser;
$input = Tapatalk_Input::filterXmlInput(array('start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT), $xmlrpc_params);
mod_setup();
list($start, $limit) = process_page($input['start_num'], $input['last_num']);
// Load global language phrases
$lang->load("modcp");
if ($mybb->user['uid'] == 0 || $mybb->usergroup['canmodcp'] != 1) {
return tt_no_permission();
}
$errors = '';
// SQL for fetching items only related to forums this user moderates
$moderated_forums = array();
if ($mybb->usergroup['issupermod'] != 1) {
$query = $db->simple_select("moderators", "*", "id='{$mybb->user['uid']}' AND isgroup = '0'");
while ($forum = $db->fetch_array($query)) {
$flist .= ",'{$forum['fid']}'";
$children = get_child_list($forum['fid']);
if (!empty($children)) {
$flist .= ",'" . implode("','", $children) . "'";
}
$moderated_forums[] = $forum['fid'];
}
if ($flist) {
$tflist = " AND t.fid IN (0{$flist})";
$flist = " AND fid IN (0{$flist})";
}
} else {
$flist = $tflist = '';
}
$forum_cache = $cache->read("forums");
$query = $db->query("\n SELECT COUNT(pid) AS unapprovedposts\n FROM " . TABLE_PREFIX . "posts p\n LEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n WHERE p.visible='0' {$tflist} AND t.firstpost != p.pid\n ");
$unapproved_posts = $db->fetch_field($query, "unapprovedposts");
$query = $db->query("\n SELECT p.pid, p.subject, p.message, t.subject AS threadsubject, t.tid, u.username, p.uid, t.fid, p.dateline, u.avatar, t.views, t.replies, IF(b.lifted > UNIX_TIMESTAMP() OR b.lifted = 0, 1, 0) as isbanned\n FROM " . TABLE_PREFIX . "posts p\n LEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n LEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\n LEFT JOIN " . TABLE_PREFIX . "banned b ON (b.uid = p.uid)\n left join " . TABLE_PREFIX . "forums f on f.fid = t.fid\n WHERE p.visible='0' {$tflist} AND t.firstpost != p.pid\n ORDER BY p.dateline DESC\n LIMIT {$start}, {$limit}\n ");
$forumcache = $cache->read("forums");
$post_list = array();
while ($post = $db->fetch_array($query)) {
$post['threadsubject'] = $parser->parse_badwords($post['threadsubject']);
$forumpermissions = forum_permissions($post['fid']);
$can_delete = 0;
if ($mybb->user['uid'] == $post['uid']) {
if ($forumpermissions['candeletethreads'] == 1 && $post['replies'] == 0) {
$can_delete = 1;
} else {
if ($forumpermissions['candeleteposts'] == 1 && $post['replies'] > 0) {
$can_delete = 1;
}
}
}
$can_delete = (is_moderator($post['fid'], "candeleteposts") || $can_delete == 1) && $mybb->user['uid'] != 0;
$post_list[] = new xmlrpcval(array('forum_id' => new xmlrpcval($post['fid'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($forumcache[$post['fid']]['name']), 'base64'), 'topic_id' => new xmlrpcval($post['tid'], 'string'), 'topic_title' => new xmlrpcval($post['threadsubject'], 'base64'), 'post_id' => new xmlrpcval($post['pid'], 'string'), 'post_title' => new xmlrpcval($post['subject'], 'base64'), 'post_author_name' => new xmlrpcval($post['username'], 'base64'), 'icon_url' => new xmlrpcval(absolute_url($post['avatar']), 'string'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($post['dateline']), 'dateTime.iso8601'), 'short_content' => new xmlrpcval(process_short_content($post['message'], $parser), 'base64'), 'reply_number' => new xmlrpcval($post['replies'], 'int'), 'view_number' => new xmlrpcval($post['views'], 'int'), 'can_delete' => new xmlrpcval($can_delete, 'boolean'), 'can_approve' => new xmlrpcval(is_moderator($post['fid'], "canmanagethreads"), 'boolean'), 'can_move' => new xmlrpcval(is_moderator($post['fid'], "canmovetononmodforum"), 'boolean'), 'can_ban' => new xmlrpcval($mybb->usergroup['canmodcp'] == 1, 'boolean'), 'is_ban' => new xmlrpcval($post['isbanned'], 'boolean'), 'is_approved' => new xmlrpcval(false, 'boolean'), 'is_deleted' => new xmlrpcval(false, 'boolean')), "struct");
}
$result = new xmlrpcval(array('total_post_num' => new xmlrpcval($unapproved_posts, 'int'), 'posts' => new xmlrpcval($post_list, 'array')), 'struct');
return new xmlrpcresp($result);
}
示例15: reply_post_func
//.........这里部分代码省略.........
$query = $db->simple_select("posts p", "p.pid, p.visible", "{$user_check} AND p.tid='{$thread['tid']}' AND p.subject='" . $db->escape_string($mybb->input['subject']) . "' AND p.message='" . $db->escape_string($mybb->input['message']) . "' AND p.posthash='" . $db->escape_string($mybb->input['posthash']) . "' AND p.visible != '-2'");
} else {
$query = $db->simple_select("posts p", "p.pid, p.visible", "{$user_check} AND p.tid='{$thread['tid']}' AND p.subject='" . $db->escape_string($mybb->get_input('subject')) . "' AND p.message='" . $db->escape_string($mybb->get_input('message')) . "' AND p.visible != '-2' AND p.dateline>" . (TIME_NOW - 600));
}
$duplicate_check = $db->fetch_field($query, "pid");
if ($duplicate_check) {
return xmlrespfalse($lang->error_post_already_submitted);
}
require_once MYBB_ROOT . "inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");
$post = array("tid" => $input['topic_id'], "replyto" => 0, "fid" => $thread['fid'], "subject" => $input['subject'], "icon" => 0, "uid" => $uid, "username" => $username, "message" => $input['text_body'], "ipaddress" => get_ip(), "posthash" => $posthash);
if ($mybb->input['pid']) {
$post['pid'] = $mybb->input['pid'];
}
$post['savedraft'] = 0;
// Set up the post options from the input.
$post['options'] = array("signature" => 1, "subscriptionmethod" => $mybb->user['subscriptionmethod'] == 0 ? '' : $mybb->user['subscriptionmethod'], "disablesmilies" => 0);
$post['modoptions']['stickthread'] = $thread['sticky'];
$post['modoptions']['closethread'] = $thread['closed'];
$posthandler->set_data($post);
// Now let the post handler do all the hard work.
$valid_post = $posthandler->validate_post();
$post_errors = array();
// Fetch friendly error messages if this is an invalid post
if (!$valid_post) {
$post_errors = $posthandler->get_friendly_errors();
}
// Mark thread as read
require_once MYBB_ROOT . "inc/functions_indicators.php";
mark_thread_read($tid, $fid);
// One or more errors returned, fetch error list and throw to newreply page
if (count($post_errors) > 0) {
return xmlrespfalse(implode(" :: ", $post_errors));
} else {
$postinfo = $posthandler->insert_post();
$pid = $postinfo['pid'];
$visible = $postinfo['visible'];
tapatalk_push_reply();
tapatalk_push_quote();
tapatalk_push_tag();
// Deciding the fate
if ($visible == -2) {
$state = 1;
} elseif ($visible == 1) {
$state = 0;
} else {
$state = 1;
}
}
$pid = intval($pid);
if (!empty($input['group_id_esc'])) {
$db->update_query("attachments", array("pid" => $pid), "posthash='{$input['group_id_esc']}'");
}
// update thread attachment account
if (count($input['attachment_id_array']) > 0) {
update_thread_counters($tid, array("attachmentcount" => "+" . count($input['attachment_id_array'])));
}
$post = get_post($pid);
$parser_options = array();
$parser_options['allow_html'] = false;
$parser_options['allow_mycode'] = true;
$parser_options['allow_smilies'] = false;
$parser_options['allow_imgcode'] = true;
$parser_options['allow_videocode'] = true;
$parser_options['nl2br'] = (bool) $input['return_html'];
$parser_options['filter_badwords'] = 1;
if (!$post['username']) {
$post['username'] = $lang->guest;
}
if ($post['userusername']) {
$parser_options['me_username'] = $post['userusername'];
} else {
$parser_options['me_username'] = $post['username'];
}
$post['message'] = post_bbcode_clean($post['message']);
$post['message'] = $parser->parse_message($post['message'], $parser_options);
global $attachcache;
$attachcache = array();
if ($thread['attachmentcount'] > 0) {
// Now lets fetch all of the attachments for these posts.
$query = $db->simple_select("attachments", "*", "pid='{$pid}'");
while ($attachment = $db->fetch_array($query)) {
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}
}
$attachment_list = process_post_attachments($post['pid'], $post);
$can_delete = 0;
if ($mybb->user['uid'] == $post['uid']) {
if ($forumpermissions['candeletethreads'] == 1 && $postcounter == 1) {
$can_delete = 1;
} else {
if ($forumpermissions['candeleteposts'] == 1 && $postcounter != 1) {
$can_delete = 1;
}
}
}
$can_delete = (is_moderator($fid, "candeleteposts") || $can_delete == 1) && $mybb->user['uid'] != 0;
$result = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'post_id' => new xmlrpcval($postinfo['pid'], 'string'), 'state' => new xmlrpcval($state, 'int'), 'post_author_id' => new xmlrpcval($mybb->user['uid'], 'string'), 'post_author_name' => new xmlrpcval(basic_clean($mybb->user['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($mybb->user['avatar']), 'string'), 'post_content' => new xmlrpcval(process_post($post['message'], $input['return_html']), 'base64'), 'can_edit' => new xmlrpcval(is_moderator($fid, "caneditposts") || $thread['closed'] == 0 && $forumpermissions['caneditposts'] == 1, 'boolean'), 'can_delete' => new xmlrpcval($can_delete, 'boolean'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode(TIME_NOW), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval(TIME_NOW, 'string'), 'attachments' => new xmlrpcval($attachment_list, 'array')), 'struct');
return new xmlrpcresp($result);
}