本文整理汇总了PHP中get_user_avatar_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_avatar_url函数的具体用法?PHP get_user_avatar_url怎么用?PHP get_user_avatar_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_avatar_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_subscribed_topic_func
function get_subscribed_topic_func()
{
global $config, $db, $user, $auth, $mobiquo_config;
// Only registered users can go beyond this point
if (!$user->data['is_registered']) {
return get_error(9);
}
$topic_list = array();
if ($config['allow_topic_notify']) {
$forbidden_forums = $auth->acl_getf('!f_read', true);
$forbidden_forums = array_unique(array_keys($forbidden_forums));
if (isset($mobiquo_config['hide_forum_id'])) {
$forbidden_forums = array_unique(array_merge($forbidden_forums, $mobiquo_config['hide_forum_id']));
}
$sql_array = array('SELECT' => 't.*,
f.forum_name,
u.user_avatar,
u.user_avatar_type', 'FROM' => array(TOPICS_WATCH_TABLE => 'tw', TOPICS_TABLE => 't', USERS_TABLE => 'u'), 'WHERE' => 'tw.user_id = ' . $user->data['user_id'] . '
AND t.topic_id = tw.topic_id
AND u.user_id = t.topic_last_poster_id
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC');
$sql_array['LEFT_JOIN'] = array();
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
if ($config['allow_bookmarks']) {
$sql_array['SELECT'] .= ', bm.topic_id as bookmarked';
$sql_array['LEFT_JOIN'][] = array('FROM' => array(BOOKMARKS_TABLE => 'bm'), 'ON' => 'bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id');
}
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, 20);
$topic_list = array();
while ($row = $db->sql_fetchrow($result)) {
$forum_id = $row['forum_id'];
$topic_id = isset($row['b_topic_id']) ? $row['b_topic_id'] : $row['topic_id'];
// Replies
$replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id'])) {
$topic_id = $row['topic_moved_id'];
}
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
$short_content = get_short_content($row['topic_last_post_id']);
if ($forum_id) {
$topic_tracking = get_complete_topic_tracking($forum_id, $topic_id);
$new_post = $topic_tracking[$topic_id] < $row['topic_last_post_time'] ? true : false;
} else {
$new_post = false;
}
$user_avatar_url = get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']);
$allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'] ? true : false;
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($forum_id), 'forum_name' => new xmlrpcval(html_entity_decode($row['forum_name']), 'base64'), 'topic_id' => new xmlrpcval($topic_id), 'topic_title' => new xmlrpcval(html_entity_decode(strip_tags(censor_text($row['topic_title']))), 'base64'), 'reply_number' => new xmlrpcval(intval($replies), 'int'), 'view_number' => new xmlrpcval(intval($row['topic_views']), 'int'), 'short_content' => new xmlrpcval($short_content, 'base64'), 'post_author_id' => new xmlrpcval($row['topic_last_poster_id']), 'post_author_name' => new xmlrpcval(html_entity_decode($row['topic_last_poster_name']), 'base64'), 'new_post' => new xmlrpcval($new_post, 'boolean'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($row['topic_last_post_time']), 'dateTime.iso8601'), 'icon_url' => new xmlrpcval($user_avatar_url), 'can_delete' => new xmlrpcval($auth->acl_get('m_delete', $forum_id), 'boolean'), 'can_bookmark' => new xmlrpcval($user->data['is_registered'] && $config['allow_bookmarks'], 'boolean'), 'isbookmarked' => new xmlrpcval($row['bookmarked'] ? true : false, 'boolean'), 'can_close' => new xmlrpcval($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'], 'boolean'), 'is_closed' => new xmlrpcval($row['topic_status'] == ITEM_LOCKED, 'boolean'), 'can_stick' => new xmlrpcval($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $row['topic_type'] != POST_STICKY, 'boolean')), 'struct');
$topic_list[] = $xmlrpc_topic;
}
$db->sql_freeresult($result);
}
$topic_num = count($topic_list);
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval($topic_num, 'int'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例2: login_func
function login_func($xmlrpc_params)
{
global $auth, $user, $config, $db, $phpbb_root_path, $phpEx;
$params = php_xmlrpc_decode($xmlrpc_params);
$user->setup('ucp');
$username = $params[0];
$password = $params[1];
$viewonline = isset($params[2]) ? !$params[2] : 1;
set_var($username, $username, 'string', true);
set_var($password, $password, 'string', true);
header('Set-Cookie: mobiquo_a=0');
header('Set-Cookie: mobiquo_b=0');
header('Set-Cookie: mobiquo_c=0');
$login_result = $auth->login($username, $password, true, $viewonline);
$usergroup_id = array();
if ($login_result['status'] == LOGIN_SUCCESS) {
$auth->acl($user->data);
//add tapatalk_users here,for push service
if ($params[3] == '1' && push_table_exists()) {
global $table_prefix;
$sql = "SELECT * FROM " . $table_prefix . "tapatalk_users where userid = '" . $user->data['user_id'] . "'";
$result = $db->sql_query($sql);
$userInfo = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$time = time();
if (empty($userInfo)) {
$sql_data[$table_prefix . "tapatalk_users"]['sql'] = array('userid' => $user->data['user_id'], 'announcement' => 1, 'pm' => 1, 'subscribe' => 1, 'quote' => 1, 'tag' => 1, 'newtopic' => 1, 'updated' => time());
$sql = 'INSERT INTO ' . $table_prefix . "tapatalk_users" . ' ' . $db->sql_build_array('INSERT', $sql_data[$table_prefix . "tapatalk_users"]['sql']);
$db->sql_query($sql);
} else {
$sql = "UPDATE " . $table_prefix . "tapatalk_users \n\t \tSET updated= '" . time() . "' WHERE userid='" . $user->data['user_id'] . "'";
$db->sql_query($sql);
}
}
// Compatibility with mod NV who was here
if (file_exists($phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx)) {
include_once $phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx;
if (class_exists('phpbb_mods_who_was_here') && method_exists('phpbb_mods_who_was_here', 'update_session')) {
@phpbb_mods_who_was_here::update_session();
}
}
} else {
$error_msg = str_replace('%s', '', strip_tags($user->lang[$login_result['error_msg']]));
return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(false, 'boolean'), 'result_text' => new xmlrpcval($error_msg, 'base64')), 'struct'));
}
if ($config['max_attachments'] == 0) {
$config['max_attachments'] = 100;
}
$usergroup_id[] = new xmlrpcval($user->data['group_id']);
$can_readpm = $config['allow_privmsg'] && $auth->acl_get('u_readpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
$can_sendpm = $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
$can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && (function_exists('phpbb_is_writable') ? phpbb_is_writable($phpbb_root_path . $config['avatar_path']) : 1) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
$can_search = $auth->acl_get('u_search') && $auth->acl_getf_global('f_search') && $config['load_search'];
$can_whosonline = $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel');
$max_filesize = $config['max_filesize'] === '0' || $config['max_filesize'] > 10485760 ? 10485760 : $config['max_filesize'];
$response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'user_id' => new xmlrpcval($user->data['user_id'], 'string'), 'username' => new xmlrpcval($user->data['username'], 'base64'), 'usergroup_id' => new xmlrpcval($usergroup_id, 'array'), 'icon_url' => new xmlrpcval(get_user_avatar_url($user->data['user_avatar'], $user->data['user_avatar_type']), 'string'), 'post_count' => new xmlrpcval($user->data['user_posts'], 'int'), 'can_pm' => new xmlrpcval($can_readpm, 'boolean'), 'can_send_pm' => new xmlrpcval($can_sendpm, 'boolean'), 'can_moderate' => new xmlrpcval($auth->acl_get('m_') || $auth->acl_getf_global('m_'), 'boolean'), 'max_attachment' => new xmlrpcval($config['max_attachments'], 'int'), 'max_png_size' => new xmlrpcval($max_filesize, 'int'), 'max_jpg_size' => new xmlrpcval($max_filesize, 'int'), 'can_search' => new xmlrpcval($can_search, 'boolean'), 'can_whosonline' => new xmlrpcval($can_whosonline, 'boolean'), 'can_upload_avatar' => new xmlrpcval($can_upload, 'boolean')), 'struct');
return new xmlrpcresp($response);
}
示例3: 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);
}
示例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: build_evobar_menu
//.........这里部分代码省略.........
$debug_text .= 'do index';
}
$entries['tools']['entries']['noindex'] = array('text' => $debug_text, 'disabled' => true);
$entries['tools']['entries'][''] = array('separator' => true);
}
if ($current_User->check_perm('users', 'view')) {
// Users:
$entries['tools']['disabled'] = false;
$entries['tools']['entries']['users'] = array('text' => T_('Users') . '…', 'href' => $admin_url . '?ctrl=users');
}
// PLACE HOLDER FOR MESSAGING MODULE:
$entries['tools']['entries']['messaging'] = NULL;
// PLACE HOLDER FOR FILES MODULE:
$entries['tools']['entries']['files'] = NULL;
$perm_spam = $current_User->check_perm('spamblacklist', 'view');
$perm_options = $current_User->check_perm('options', 'view');
$perm_emails = $current_User->check_perm('emails', 'view');
$perm_slugs = $current_User->check_perm('slugs', 'view');
$perm_maintenance = $current_User->check_perm('perm_maintenance', 'upgrade');
if ($perm_spam || $perm_options || $perm_slugs || $perm_maintenance) {
if ($perm_emails) {
$entries['tools']['entries']['email'] = array('text' => T_('Emails'), 'href' => $admin_url . '?ctrl=email', 'entries' => array('blocked' => array('text' => T_('Addresses') . '…', 'href' => $admin_url . '?ctrl=email'), 'sent' => array('text' => T_('Sent') . '…', 'href' => $admin_url . '?ctrl=email&tab=sent'), 'return' => array('text' => T_('Returned') . '…', 'href' => $admin_url . '?ctrl=email&tab=return'), 'settings' => array('text' => T_('Settings') . '…', 'href' => $admin_url . '?ctrl=email&tab=settings')));
}
$entries['tools']['disabled'] = false;
$entries['tools']['entries']['tools_sep'] = array('separator' => true);
if ($perm_options) {
$entries['tools']['entries']['status'] = array('text' => T_('System status') . '…', 'href' => $admin_url . '?ctrl=system');
}
if ($perm_options) {
$entries['tools']['entries']['crontab'] = array('text' => T_('Scheduler') . '…', 'href' => $admin_url . '?ctrl=crontab');
}
if ($perm_spam) {
$entries['tools']['entries']['antispam'] = array('text' => T_('Antispam'), 'href' => $admin_url . '?ctrl=antispam', 'entries' => array('blacklist' => array('text' => T_('Blacklist') . '…', 'href' => $admin_url . '?ctrl=antispam')));
if ($perm_options) {
// If we have access to options, then we add a submenu:
$entries['tools']['entries']['antispam']['entries']['ipranges'] = array('text' => T_('IP Ranges') . '…', 'href' => $admin_url . '?ctrl=antispam&tab3=ipranges');
$entries['tools']['entries']['antispam']['entries']['settings'] = array('text' => T_('Settings') . '…', 'href' => $admin_url . '?ctrl=antispam&tab3=settings');
if ($current_User->check_perm('options', 'edit')) {
$entries['tools']['entries']['antispam']['entries']['tools'] = array('text' => T_('Tools') . '…', 'href' => $admin_url . '?ctrl=antispam&tab3=tools');
}
}
}
if ($perm_slugs) {
$entries['tools']['entries']['slugs'] = array('text' => T_('Slugs') . '…', 'href' => $admin_url . '?ctrl=slugs');
}
}
if ($perm_options) {
// Global settings:
$entries['tools']['entries']['general'] = array('text' => T_('General') . '…', 'href' => $admin_url . '?ctrl=gensettings');
$entries['tools']['entries']['regional'] = array('text' => T_('Regional'), 'href' => $admin_url . '?ctrl=regional', 'entries' => array('locales' => array('text' => T_('Locales') . '…', 'href' => $admin_url . '?ctrl=locales'), 'time' => array('text' => T_('Time') . '…', 'href' => $admin_url . '?ctrl=time'), 'countries' => array('text' => T_('Countries') . '…', 'href' => $admin_url . '?ctrl=countries'), 'regions' => array('text' => T_('Regions') . '…', 'href' => $admin_url . '?ctrl=regions'), 'subregions' => array('text' => T_('Sub-regions') . '…', 'href' => $admin_url . '?ctrl=subregions'), 'cities' => array('text' => T_('Cities') . '…', 'href' => $admin_url . '?ctrl=cities'), 'currencies' => array('text' => T_('Currencies') . '…', 'href' => $admin_url . '?ctrl=currencies')));
$entries['tools']['entries']['plugins'] = array('text' => T_('Plugins') . '…', 'href' => $admin_url . '?ctrl=plugins');
$entries['tools']['entries']['remote'] = array('text' => T_('Remote publishing') . '…', 'href' => $admin_url . '?ctrl=remotepublish');
$entries['tools']['entries']['maintenance'] = array('text' => T_('Maintenance'), 'href' => $admin_url . '?ctrl=tools', 'entries' => array('tools' => array('text' => T_('Tools') . '…', 'href' => $admin_url . '?ctrl=tools'), 'import' => array('text' => T_('Import') . '…', 'href' => $admin_url . '?ctrl=tools&tab3=import'), 'test' => array('text' => T_('Testing') . '…', 'href' => $admin_url . '?ctrl=tools&tab3=test'), 'backup' => array('text' => T_('Backup') . '…', 'href' => $admin_url . '?ctrl=backup'), 'upgrade' => array('text' => T_('Check for updates') . '…', 'href' => $admin_url . '?ctrl=upgrade')));
}
}
global $debug, $debug_jslog;
if ($debug || $debug_jslog) {
// Show JS log menu if debug is enabled
$entries['jslog'] = array('text' => T_('JS log'), 'title' => T_('JS log'), 'class' => 'jslog_switcher');
}
if ($entries !== NULL) {
$topleft_Menu->add_menu_entries(NULL, $entries);
}
// ---------------------------------------------------------------------------
/*
* RIGHT MENU
*/
global $localtimenow, $is_admin_page;
$entries = array('userprefs' => array('text' => $current_User->get_avatar_imgtag('crop-top-15x15', '', 'top') . ' <strong>' . $current_User->get_colored_login() . '</strong>', 'href' => get_user_profile_url(), 'entries' => array('profile' => array('text' => T_('Edit your profile') . '…', 'href' => get_user_profile_url()), 'avatar' => array('text' => T_('Your profile picture') . '…', 'href' => get_user_avatar_url()), 'pwdchange' => array('text' => T_('Change password') . '…', 'href' => get_user_pwdchange_url()), 'userprefs' => array('text' => T_('Preferences') . '…', 'href' => get_user_preferences_url()), 'subs' => array('text' => T_('Notifications') . '…', 'href' => get_user_subs_url()))), 'time' => array('text' => date(locale_shorttimefmt(), $localtimenow), 'disabled' => true, 'class' => 'noborder'));
// ADMIN SKINS:
if ($is_admin_page) {
$admin_skins = get_admin_skins();
if (count($admin_skins) > 1) {
// We have several admin skins available: display switcher:
$entries['userprefs']['entries']['admskins_sep'] = array('separator' => true);
$entries['userprefs']['entries']['admskins'] = array('text' => T_('Admin skin'));
$redirect_to = rawurlencode(regenerate_url('', '', '', '&'));
foreach ($admin_skins as $admin_skin) {
$entries['userprefs']['entries']['admskins']['entries'][$admin_skin] = array('text' => $admin_skin, 'href' => $dispatcher . '?ctrl=users&action=change_admin_skin&new_admin_skin=' . rawurlencode($admin_skin) . '&redirect_to=' . $redirect_to);
}
}
}
$entries['userprefs']['entries']['logout_sep'] = array('separator' => true);
$entries['userprefs']['entries']['logout'] = array('text' => T_('Logout'), 'href' => get_user_logout_url());
// AB switch:
if ($perm_admin_normal) {
// User must have permission to access admin...
if ($is_admin_page) {
if (!empty($Blog)) {
$entries['abswitch'] = array('text' => T_('Blog') . ' ' . get_icon('switch-to-blog'), 'href' => $Blog->get('url'));
} else {
$entries['abswitch'] = array('text' => T_('Home') . ' ' . get_icon('switch-to-blog'), 'href' => $home_url);
}
} else {
$entries['abswitch'] = array('text' => T_('Admin') . ' ' . get_icon('switch-to-admin'), 'href' => $admin_url);
}
}
$topright_Menu->add_menu_entries(NULL, $entries);
$topright_Menu->add_menu_entries(NULL, array('logout' => array('text' => T_('Logout') . ' ' . get_icon('close'), 'class' => 'rollover_sprite', 'href' => get_user_logout_url())));
}
示例6: reply_post_func
//.........这里部分代码省略.........
trigger_error(sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]));
}
}
// Store message, sync counters
$data = array('topic_title' => empty($post_data['topic_title']) ? $post_data['post_subject'] : $post_data['topic_title'], 'topic_first_post_id' => isset($post_data['topic_first_post_id']) ? (int) $post_data['topic_first_post_id'] : 0, 'topic_last_post_id' => isset($post_data['topic_last_post_id']) ? (int) $post_data['topic_last_post_id'] : 0, 'topic_time_limit' => (int) $post_data['topic_time_limit'], 'topic_attachment' => isset($post_data['topic_attachment']) ? (int) $post_data['topic_attachment'] : 0, 'post_id' => 0, 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'icon_id' => (int) $post_data['icon_id'], 'poster_id' => (int) $post_data['poster_id'], 'enable_sig' => (bool) $post_data['enable_sig'], 'enable_bbcode' => (bool) $post_data['enable_bbcode'], 'enable_smilies' => (bool) $post_data['enable_smilies'], 'enable_urls' => (bool) $post_data['enable_urls'], 'enable_indexing' => (bool) $post_data['enable_indexing'], 'message_md5' => (string) $message_md5, 'post_time' => isset($post_data['post_time']) ? (int) $post_data['post_time'] : $current_time, 'post_checksum' => isset($post_data['post_checksum']) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => isset($post_data['post_edit_user']) ? (int) $post_data['post_edit_user'] : 0, 'forum_parents' => $post_data['forum_parents'], 'forum_name' => $post_data['forum_name'], 'notify' => $notify, 'notify_set' => $post_data['notify_set'], 'poster_ip' => isset($post_data['poster_ip']) ? $post_data['poster_ip'] : $user->ip, 'post_edit_locked' => (int) $post_data['post_edit_locked'], 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'topic_approved' => isset($post_data['topic_approved']) ? $post_data['topic_approved'] : false, 'post_approved' => isset($post_data['post_approved']) ? $post_data['post_approved'] : false, 'post_expire_time' => -1);
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$update_message = true;
$cwd = getcwd();
chdir('../');
$phpbb_root_path_tmp = $phpbb_root_path;
$phpbb_root_path = './';
$redirect_url = submit_post('reply', $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message);
chdir($cwd);
$phpbb_root_path = $phpbb_root_path_tmp;
// Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected.
$approved = true;
if (($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts'] || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) {
$approved = false;
}
$reply_success = false;
$post_id = '';
if ($redirect_url) {
preg_match('/&p=(\\d+)/', $redirect_url, $matches);
$post_id = $matches[1];
$reply_success = true;
// get new post_content
$message = censor_text($data['message']);
$quote_wrote_string = $user->lang['WROTE'];
$message = str_replace('[/quote:' . $data['bbcode_uid'] . ']', '[/quote]', $message);
$message = preg_replace('/\\[quote(?:="(.*?)")?:' . $data['bbcode_uid'] . '\\]/ise', "'[quote]' . ('\$1' ? '\$1' . ' {$quote_wrote_string}:\n' : '\n')", $message);
$blocks = preg_split('/(\\[\\/?quote\\])/i', $message, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$quote_level = 0;
$message = '';
foreach ($blocks as $block) {
if ($block == '[quote]') {
if ($quote_level == 0) {
$message .= $block;
}
$quote_level++;
} else {
if ($block == '[/quote]') {
if ($quote_level <= 1) {
$message .= $block;
}
if ($quote_level >= 1) {
$quote_level--;
}
} else {
if ($quote_level <= 1) {
$message .= $block;
}
}
}
}
$message = preg_replace('/\\[(youtube|video|googlevideo|gvideo):' . $data['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $data['bbcode_uid'] . '\\]/sie', "video_bbcode_format('\$1', '\$2')", $message);
$message = preg_replace('/\\[(BBvideo)[\\d, ]+:' . $row['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $row['bbcode_uid'] . '\\]/si', "[url=\$2]YouTube Video[/url]", $message);
$message = preg_replace('/\\[(spoil|spoiler):' . $row['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $row['bbcode_uid'] . '\\]/si', "[spoiler]\$2[/spoiler]", $message);
$message = preg_replace('/\\[b:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/b:' . $data['bbcode_uid'] . '\\]/si', '[b]$1[/b]', $message);
$message = preg_replace('/\\[i:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/i:' . $data['bbcode_uid'] . '\\]/si', '[i]$1[/i]', $message);
$message = preg_replace('/\\[u:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/u:' . $data['bbcode_uid'] . '\\]/si', '[u]$1[/u]', $message);
$message = preg_replace('/\\[color=#(\\w{6}):' . $data['bbcode_uid'] . '\\](.*?)\\[\\/color:' . $data['bbcode_uid'] . '\\]/si', '[color=#$1]$2[/color]', $message);
// Second parse bbcode here
if ($data['bbcode_bitfield']) {
$bbcode = new bbcode(base64_encode($data['bbcode_bitfield']));
$bbcode->bbcode_second_pass($message, $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
if (!empty($data['attachment_data'])) {
parse_attachments($forum_id, $message, $data['attachment_data'], $update_count);
}
$updated_post_title = html_entity_decode(strip_tags(censor_text($data['topic_title'])), ENT_QUOTES, 'UTF-8');
$edit_allowed = $auth->acl_get('m_edit', $forum_id) || $auth->acl_get('f_edit', $forum_id) && !$data['post_edit_locked'] && ($data['post_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time']);
$delete_allowed = $auth->acl_get('m_delete', $forum_id) || $auth->acl_get('f_delete', $forum_id) && ($data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time']) && !$data['post_edit_locked'];
$attachments = array();
if (sizeof($attach_list) && sizeof($data['attachment_data'])) {
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('attach_id', $attach_list) . '
AND in_message = 0
ORDER BY filetime DESC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachment_by_id[$row['attach_id']] = $row;
}
$db->sql_freeresult($result);
foreach ($data['attachment_data'] as $attachment) {
if (preg_match('/<img src=\\".*?(\\/download\\/file.php\\?id=(\\d+).*?)\\"/is', $attachment, $matches)) {
$file_url = html_entity_decode($phpbb_home . $matches[1]);
$attach_id = $matches[2];
unset($matches);
$xmlrpc_attachment = new xmlrpcval(array('filename' => new xmlrpcval($attachment_by_id[$attach_id]['real_filename'], 'base64'), 'filesize' => new xmlrpcval($attachment_by_id[$attach_id]['filesize'], 'int'), 'content_type' => new xmlrpcval('image'), 'thumbnail_url' => new xmlrpcval(''), 'url' => new xmlrpcval($file_url)), 'struct');
$attachments[] = $xmlrpc_attachment;
}
}
}
}
$xmlrpc_reply_topic = new xmlrpcval(array('result' => new xmlrpcval($reply_success, 'boolean'), 'post_id' => new xmlrpcval($post_id, 'string'), 'state' => new xmlrpcval($approved ? 0 : 1, 'int'), 'post_title' => new xmlrpcval($updated_post_title, 'base64'), 'post_content' => new xmlrpcval(post_html_clean($message), 'base64'), 'post_author_name' => new xmlrpcval(html_entity_decode($user->data['username']), 'base64'), 'is_online' => new xmlrpcval(true, 'boolean'), 'can_edit' => new xmlrpcval($edit_allowed, 'boolean'), 'icon_url' => new xmlrpcval($user->optionget('viewavatars') ? get_user_avatar_url($user->data['user_avatar'], $user->data['user_avatar_type']) : ''), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($current_time), 'dateTime.iso8601'), 'can_delete' => new xmlrpcval($delete_allowed, 'boolean'), 'allow_smilies' => new xmlrpcval($data['enable_smilies'] ? true : false, 'boolean'), 'attachments' => new xmlrpcval($attachments, 'array')), 'struct');
return new xmlrpcresp($xmlrpc_reply_topic);
}
示例7: build_evobar_menu
//.........这里部分代码省略.........
$perm_maintenance = $current_User->check_perm('perm_maintenance', 'upgrade');
if ($perm_spam || $perm_options || $perm_maintenance) {
$entries['tools']['entries'][] = array('separator' => true);
if ($perm_emails) {
$entries['tools']['entries']['email'] = array('text' => T_('Emails'), 'href' => $admin_url . '?ctrl=campaigns', 'entries' => array('campaigns' => array('text' => T_('Campaigns') . '…', 'href' => $admin_url . '?ctrl=campaigns'), 'blocked' => array('text' => T_('Addresses') . '…', 'href' => $admin_url . '?ctrl=email'), 'sent' => array('text' => T_('Sent') . '…', 'href' => $admin_url . '?ctrl=email&tab=sent'), 'return' => array('text' => T_('Returned') . '…', 'href' => $admin_url . '?ctrl=email&tab=return'), 'settings' => array('text' => T_('Settings') . '…', 'href' => $admin_url . '?ctrl=email&tab=settings')));
}
$entries['tools']['disabled'] = false;
$entries['tools']['entries']['system'] = array('text' => T_('System'), 'href' => $admin_url . '?ctrl=system');
if ($perm_options) {
$entries['tools']['entries']['system']['entries']['status'] = array('text' => T_('Status') . '…', 'href' => $admin_url . '?ctrl=system');
}
if ($perm_options) {
$entries['tools']['entries']['system']['entries']['crontab'] = array('text' => T_('Scheduler') . '…', 'href' => $admin_url . '?ctrl=crontab');
}
if ($perm_spam) {
$entries['tools']['entries']['system']['entries']['antispam'] = array('text' => T_('Antispam') . '…', 'href' => $admin_url . '?ctrl=antispam');
}
}
if ($perm_options) {
// Global settings:
$entries['tools']['entries']['system']['entries']['regional'] = array('text' => T_('Regional') . '…', 'href' => $admin_url . '?ctrl=regional');
$entries['tools']['entries']['system']['entries']['skins'] = array('text' => T_('Skins') . '…', 'href' => $admin_url . '?ctrl=skins&tab=system');
$entries['tools']['entries']['system']['entries']['plugins'] = array('text' => T_('Plugins') . '…', 'href' => $admin_url . '?ctrl=plugins');
$entries['tools']['entries']['system']['entries']['remote'] = array('text' => T_('Remote publishing') . '…', 'href' => $admin_url . '?ctrl=remotepublish');
$entries['tools']['entries']['system']['entries']['maintenance'] = array('text' => T_('Maintenance') . '…', 'href' => $admin_url . '?ctrl=tools');
$entries['tools']['entries']['system']['entries']['syslog'] = array('text' => T_('System log'), 'href' => '?ctrl=syslog');
}
}
if ($entries !== NULL) {
$topleft_Menu->add_menu_entries(NULL, $entries);
}
// ---------------------------------------------------------------------------
/*
* RIGHT MENU
*/
global $localtimenow, $is_admin_page;
$entries = array();
// Dev menu:
global $debug_jslog;
if ($debug || $debug_jslog) {
// Show JS log menu if debug is enabled
$dev_entries[] = array('separator' => true);
$dev_entries['jslog'] = array('text' => T_('JS log'), 'title' => T_('JS log'), 'class' => 'jslog_switcher');
}
if (!empty($dev_entries)) {
// Add Dev menu if at least one entry is should be displayed
$entries['dev'] = array('href' => $admin_url . '#', 'text' => '<span class="fa fa-wrench"></span> Dev', 'entries' => $dev_entries);
}
// User menu:
$current_user_Group = $current_User->get_Group();
$userprefs_entries = array('name' => array('text' => $current_User->get_avatar_imgtag('crop-top-32x32', '', 'left') . ' ' . $current_User->get_preferred_name() . '<br /> <span class="note">' . $current_user_Group->get_name() . '</span>', 'href' => get_user_profile_url()));
$userprefs_entries[] = array('separator' => true);
$user_profile_url = get_user_profile_url();
if (!empty($user_profile_url)) {
// Display this menu item only when url is available to current user
$userprefs_entries['profile'] = array('text' => T_('Edit your profile') . '…', 'href' => $user_profile_url);
}
$user_avatar_url = get_user_avatar_url();
if (!empty($user_avatar_url)) {
// Display this menu item only when url is available to current user
$userprefs_entries['avatar'] = array('text' => T_('Your profile picture') . '…', 'href' => $user_avatar_url);
}
$user_pwdchange_url = get_user_pwdchange_url();
if (!empty($user_pwdchange_url)) {
// Display this menu item only when url is available to current user
$userprefs_entries['pwdchange'] = array('text' => T_('Change password') . '…', 'href' => $user_pwdchange_url);
}
$user_preferences_url = get_user_preferences_url();
if (!empty($user_preferences_url)) {
// Display this menu item only when url is available to current user
$userprefs_entries['userprefs'] = array('text' => T_('Preferences') . '…', 'href' => $user_preferences_url);
}
$user_subs_url = get_user_subs_url();
if (!empty($user_subs_url)) {
// Display this menu item only when url is available to current user
$userprefs_entries['subs'] = array('text' => T_('Notifications') . '…', 'href' => $user_subs_url);
}
$entries['userprefs'] = array('text' => '<strong>' . $current_User->get_colored_login(array('login_text' => 'name')) . '</strong>', 'href' => get_user_profile_url(), 'entries' => $userprefs_entries);
$entries['time'] = array('text' => date(locale_shorttimefmt(), $localtimenow), 'disabled' => true, 'entry_class' => 'rwdhide');
if ($current_User->check_perm('admin', 'normal') && $current_User->check_perm('options', 'view')) {
// Make time as link to Timezone settings if permission
$entries['time']['disabled'] = false;
$entries['time']['href'] = $admin_url . '?ctrl=time';
}
// ADMIN SKINS:
if ($is_admin_page) {
$admin_skins = get_admin_skins();
if (count($admin_skins) > 1) {
// We have several admin skins available: display switcher:
$entries['userprefs']['entries']['admskins'] = array('text' => T_('Admin skin'));
$redirect_to = rawurlencode(regenerate_url('', '', '', '&'));
foreach ($admin_skins as $admin_skin) {
$entries['userprefs']['entries']['admskins']['entries'][$admin_skin] = array('text' => $admin_skin, 'href' => $admin_url . '?ctrl=users&action=change_admin_skin&new_admin_skin=' . rawurlencode($admin_skin) . '&redirect_to=' . $redirect_to);
}
}
}
$entries['userprefs']['entries'][] = array('separator' => true);
$entries['userprefs']['entries']['logout'] = array('text' => T_('Log out!'), 'href' => get_user_logout_url());
$topright_Menu->add_menu_entries(NULL, $entries);
}
示例8: get_online_users_func
//.........这里部分代码省略.........
$forum_id = $row['session_forum_id'];
if ($forum_id && $auth->acl_get('f_list', $forum_id)) {
$location = '';
$location_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
if ($forum_data[$forum_id]['forum_type'] == FORUM_LINK) {
$location = sprintf($user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']);
break;
}
switch ($on_page[1]) {
case 'posting':
preg_match('#mode=([a-z]+)#', $row['session_page'], $on_page);
$posting_mode = !empty($on_page[1]) ? $on_page[1] : '';
switch ($posting_mode) {
case 'reply':
case 'quote':
$location = sprintf($user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]['forum_name']);
break;
default:
$location = sprintf($user->lang['POSTING_MESSAGE'], $forum_data[$forum_id]['forum_name']);
break;
}
break;
case 'viewtopic':
$location = sprintf($user->lang['READING_TOPIC'], $forum_data[$forum_id]['forum_name']);
break;
case 'viewforum':
$location = sprintf($user->lang['READING_FORUM'], $forum_data[$forum_id]['forum_name']);
break;
}
} else {
$location = $user->lang['INDEX'];
$location_url = append_sid("{$phpbb_root_path}index.{$phpEx}");
}
break;
case 'search':
$location = $user->lang['SEARCHING_FORUMS'];
$location_url = append_sid("{$phpbb_root_path}search.{$phpEx}");
break;
case 'faq':
$location = $user->lang['VIEWING_FAQ'];
$location_url = append_sid("{$phpbb_root_path}faq.{$phpEx}");
break;
case 'viewonline':
$location = $user->lang['VIEWING_ONLINE'];
$location_url = append_sid("{$phpbb_root_path}viewonline.{$phpEx}");
break;
case 'memberlist':
$location = strpos($row['session_page'], 'mode=viewprofile') !== false ? $user->lang['VIEWING_MEMBER_PROFILE'] : $user->lang['VIEWING_MEMBERS'];
$location_url = append_sid("{$phpbb_root_path}memberlist.{$phpEx}");
break;
case 'mcp':
$location = $user->lang['VIEWING_MCP'];
$location_url = append_sid("{$phpbb_root_path}index.{$phpEx}");
break;
case 'ucp':
$location = $user->lang['VIEWING_UCP'];
// Grab some common modules
$url_params = array('mode=register' => 'VIEWING_REGISTER', 'i=pm&mode=compose' => 'POSTING_PRIVATE_MESSAGE', 'i=pm&' => 'VIEWING_PRIVATE_MESSAGES', 'i=profile&' => 'CHANGING_PROFILE', 'i=prefs&' => 'CHANGING_PREFERENCES');
foreach ($url_params as $param => $lang) {
if (strpos($row['session_page'], $param) !== false) {
$location = $user->lang[$lang];
break;
}
}
$location_url = append_sid("{$phpbb_root_path}index.{$phpEx}");
break;
case 'download/file':
$location = $user->lang['DOWNLOADING_FILE'];
$location_url = append_sid("{$phpbb_root_path}index.{$phpEx}");
break;
case 'report':
$location = $user->lang['REPORTING_POST'];
$location_url = append_sid("{$phpbb_root_path}index.{$phpEx}");
break;
default:
$location = $user->lang['INDEX'];
$location_url = append_sid("{$phpbb_root_path}index.{$phpEx}");
break;
}
$user_avatar_url = get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']);
$row['from'] = 'broswer';
if (!empty($row['is_tapatalk'])) {
$row['from'] = 'tapatalk';
} else {
if (!empty($row['is_byo'])) {
$row['from'] = 'byo';
} else {
if (strpos($row['session_browser'], 'Android') !== false || strpos($row['session_browser'], 'iPhone') !== false || strpos($row['session_browser'], 'BlackBerry') !== false) {
$row['from'] = 'mobile';
}
}
}
$user_list[] = new xmlrpcval(array('user_id' => new xmlrpcval($row['user_id'], 'string'), 'username' => new xmlrpcval(basic_clean($row['username']), 'base64'), 'from' => new xmlrpcval($row['from'], 'string'), 'user_type' => check_return_user_type($row['username']), 'user_name' => new xmlrpcval($row['username'], 'base64'), 'icon_url' => new xmlrpcval($user_avatar_url), 'display_text' => new xmlrpcval($location, 'base64')), 'struct');
}
$db->sql_freeresult($result);
unset($prev_id, $prev_ip);
$online_users = array('member_count' => new xmlrpcval($logged_visible_online, 'int'), 'guest_count' => new xmlrpcval($guest_counter, 'int'), 'list' => new xmlrpcval($user_list, 'array'));
$response = new xmlrpcval($online_users, 'struct');
return new xmlrpcresp($response);
}
示例9: get_user_info_func
//.........这里部分代码省略.........
$inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
switch ($member['user_inactive_reason']) {
case INACTIVE_REGISTER:
$inactive_reason = $user->lang['INACTIVE_REASON_REGISTER'];
break;
case INACTIVE_PROFILE:
$inactive_reason = $user->lang['INACTIVE_REASON_PROFILE'];
break;
case INACTIVE_MANUAL:
$inactive_reason = $user->lang['INACTIVE_REASON_MANUAL'];
break;
case INACTIVE_REMIND:
$inactive_reason = $user->lang['INACTIVE_REASON_REMIND'];
break;
}
$template->assign_vars(array('S_USER_INACTIVE' => true, 'USER_INACTIVE_REASON' => $inactive_reason));
}
$custom_fields_list = get_custom_fields();
if (!empty($member['user_sig'])) {
$custom_fields_list[] = new xmlrpcval(array('name' => new xmlrpcval($user->lang['SIGNATURE'], 'base64'), 'value' => new xmlrpcval(basic_clean($member['user_sig']), 'base64')), 'struct');
}
if ($member['user_id'] == $user->data['user_id'] && push_table_exists()) {
$sql = "SELECT * FROM " . $table_prefix . "tapatalk_users WHERE userid = '" . $member['user_id'] . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if (!empty($row)) {
array_push($custom_fields_list, new xmlrpcval(array('name' => new xmlrpcval('Notification - Message', 'base64'), 'value' => new xmlrpcval($row['pm'] ? 'On' : 'Off', 'base64')), 'struct'));
array_push($custom_fields_list, new xmlrpcval(array('name' => new xmlrpcval('Notification - Quoted', 'base64'), 'value' => new xmlrpcval($row['quote'] ? 'On' : 'Off', 'base64')), 'struct'));
array_push($custom_fields_list, new xmlrpcval(array('name' => new xmlrpcval('Notification - Mentioned', 'base64'), 'value' => new xmlrpcval($row['tag'] ? 'On' : 'Off', 'base64')), 'struct'));
array_push($custom_fields_list, new xmlrpcval(array('name' => new xmlrpcval('Notification - New Topic', 'base64'), 'value' => new xmlrpcval($row['newtopic'] ? 'On' : 'Off', 'base64')), 'struct'));
array_push($custom_fields_list, new xmlrpcval(array('name' => new xmlrpcval('Notification - Replies', 'base64'), 'value' => new xmlrpcval($row['subscribe'] ? 'On' : 'Off', 'base64')), 'struct'));
}
}
$user_avatar_url = get_user_avatar_url($member['user_avatar'], $member['user_avatar_type']);
// Forum info
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql, 600);
$forum_data = array();
while ($row = $db->sql_fetchrow($result)) {
$forum_data[$row['forum_id']] = $row;
}
$db->sql_freeresult($result);
// get user current activity
preg_match('#^([a-z0-9/_-]+)#i', $member['session_page'], $on_page);
if (!sizeof($on_page)) {
$on_page[1] = '';
}
switch ($on_page[1]) {
case 'index':
$location = $user->lang['INDEX'];
break;
case 'adm/index':
$location = $user->lang['ACP'];
break;
case 'posting':
case 'viewforum':
case 'viewtopic':
$forum_id = $member['session_forum_id'];
if ($forum_id && $auth->acl_get('f_list', $forum_id)) {
$location = '';
if ($forum_data[$forum_id]['forum_type'] == FORUM_LINK) {
$location = sprintf($user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']);
break;
}
示例10: tt_login_success
function tt_login_success()
{
global $config, $db, $user, $phpbb_root_path, $phpEx, $user_info, $auth, $register;
header('Set-Cookie: mobiquo_a=0');
header('Set-Cookie: mobiquo_b=0');
header('Set-Cookie: mobiquo_c=0');
$result = $user->session_create($user_info['user_id'], 0, true, 1);
if ($result) {
$usergroup_id = array();
$auth->acl($user->data);
//add tapatalk_users here,for push service
if (push_table_exists()) {
global $table_prefix;
$sql = "SELECT * FROM " . $table_prefix . "tapatalk_users where userid = '" . $user->data['user_id'] . "'";
$result = $db->sql_query($sql);
$userInfo = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$time = time();
if (empty($userInfo)) {
$sql_data[$table_prefix . "tapatalk_users"]['sql'] = array('userid' => $user->data['user_id'], 'announcement' => 1, 'pm' => 1, 'subscribe' => 1, 'quote' => 1, 'tag' => 1, 'newtopic' => 1, 'updated' => time());
$sql = 'INSERT INTO ' . $table_prefix . "tapatalk_users" . ' ' . $db->sql_build_array('INSERT', $sql_data[$table_prefix . "tapatalk_users"]['sql']);
$db->sql_query($sql);
}
}
// Compatibility with mod NV who was here
if (file_exists($phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx)) {
include_once $phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx;
if (class_exists('phpbb_mods_who_was_here') && method_exists('phpbb_mods_who_was_here', 'update_session')) {
@phpbb_mods_who_was_here::update_session();
}
}
if ($config['max_attachments'] == 0) {
$config['max_attachments'] = 100;
}
$usergroup_id[] = new xmlrpcval($user->data['group_id']);
$can_readpm = $config['allow_privmsg'] && $auth->acl_get('u_readpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
$can_sendpm = $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
$can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && (function_exists('phpbb_is_writable') ? phpbb_is_writable($phpbb_root_path . $config['avatar_path']) : 1) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
$can_search = $auth->acl_get('u_search') && $auth->acl_getf_global('f_search') && $config['load_search'];
$can_whosonline = $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel');
$max_filesize = $config['max_filesize'] === '0' || $config['max_filesize'] > 10485760 ? 10485760 : $config['max_filesize'];
$userPushType = array('pm' => 1, 'newtopic' => 1, 'sub' => 1, 'tag' => 1, 'quote' => 1);
$push_type = array();
foreach ($userPushType as $name => $value) {
$push_type[] = new xmlrpcval(array('name' => new xmlrpcval($name, 'string'), 'value' => new xmlrpcval($value, 'boolean')), 'struct');
}
$response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'user_id' => new xmlrpcval($user->data['user_id'], 'string'), 'username' => new xmlrpcval(basic_clean($user->data['username']), 'base64'), 'email' => new xmlrpcval($user->data['user_email'], 'base64'), 'user_type' => check_return_user_type($user->data['username']), 'usergroup_id' => new xmlrpcval($usergroup_id, 'array'), 'ignored_uids' => new xmlrpcval(implode(',', tt_get_ignore_users($user->data['user_id'])), 'string'), 'icon_url' => new xmlrpcval(get_user_avatar_url($user->data['user_avatar'], $user->data['user_avatar_type']), 'string'), 'post_count' => new xmlrpcval($user->data['user_posts'], 'int'), 'can_pm' => new xmlrpcval($can_readpm, 'boolean'), 'can_send_pm' => new xmlrpcval($can_sendpm, 'boolean'), 'can_moderate' => new xmlrpcval($auth->acl_get('m_') || $auth->acl_getf_global('m_'), 'boolean'), 'max_attachment' => new xmlrpcval($config['max_attachments'], 'int'), 'max_png_size' => new xmlrpcval($max_filesize, 'int'), 'max_jpg_size' => new xmlrpcval($max_filesize, 'int'), 'can_search' => new xmlrpcval($can_search, 'boolean'), 'can_whosonline' => new xmlrpcval($can_whosonline, 'boolean'), 'can_upload_avatar' => new xmlrpcval($can_upload, 'boolean'), 'register' => new xmlrpcval($register, "boolean"), 'push_type' => new xmlrpcval($push_type, 'array')), 'struct');
return new xmlrpcresp($response);
}
}
示例11: display
//.........这里部分代码省略.........
if (!($url = get_user_register_url(NULL, 'menu link'))) {
return false;
}
if (isset($this->BlockCache)) {
// Do NOT cache because some of these links are using a redirect_to param, which makes it page dependent.
// Note: also beware of the source param.
// so this will be cached by the PageCache; there is no added benefit to cache it in the BlockCache
// (which could have been shared between several pages):
$this->BlockCache->abort_collect();
}
$text = T_('Register');
// Is this the current display?
if ($disp == 'register') {
// Let's display the link as selected
$link_class = $this->disp_params['link_selected_class'];
}
break;
case 'profile':
if (!is_logged_in()) {
return false;
}
$url = get_user_profile_url();
$text = T_('Edit profile');
// Is this the current display? (Edit my Profile)
if (in_array($disp, array('profile', 'avatar', 'pwdchange', 'userprefs', 'subs'))) {
// Let's display the link as selected
$link_class = $this->disp_params['link_selected_class'];
}
break;
case 'avatar':
if (!is_logged_in()) {
return false;
}
$url = get_user_avatar_url();
$text = T_('Profile picture');
// Note: we never highlight this, it will always highlight 'profile' instead
break;
case 'users':
global $Settings;
if (!is_logged_in() && !$Settings->get('allow_anonymous_user_list')) {
// Don't allow anonymous users to see users list
return false;
}
$url = $Blog->get('usersurl');
$text = T_('User directory');
// Is this the current display?
// Note: If $user_ID is not set, it means we are viewing "My Profile" instead
global $user_ID;
if ($disp == 'users' || $disp == 'user' && !empty($user_ID)) {
// Let's display the link as selected
// Note: we also highlight this for any user profile that is displayed
$link_class = $this->disp_params['link_selected_class'];
}
break;
case 'item':
$ItemCache =& get_ItemCache();
/**
* @var Item
*/
$item_ID = (int) $this->disp_params['item_ID'];
$disp_Item =& $ItemCache->get_by_ID($item_ID, false, false);
if (empty($disp_Item)) {
// Item not found
return false;
}
$url = $disp_Item->get_permanent_url();
示例12: get_topic_func
//.........这里部分代码省略.........
// get total number of unread announce topics number
$sql = 'SELECT t.topic_id, t.topic_last_post_time
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id IN (' . $forum_id . ', 0)
AND t.topic_type IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ') ' . $sql_shadow_out . ' ' . $sql_approved;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if (empty($forum_id) || empty($row['topic_id'])) {
continue;
}
$topic_tracking = get_complete_topic_tracking($forum_id, $row['topic_id']);
if (isset($topic_tracking[$row['topic_id']]) && $topic_tracking[$row['topic_id']] < $row['topic_last_post_time']) {
$unread_announce_count++;
}
}
$db->sql_freeresult($result);
}
// get total number of normal topics
$sql = 'SELECT count(t.topic_id) AS num_topics
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_type = ' . POST_NORMAL . ' ' . $sql_shadow_out . ' ' . $sql_approved;
$result = $db->sql_query($sql);
$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);
if ($start > $topics_count / 2) {
$store_reverse = true;
if ($start + $sql_limit > $topics_count) {
$sql_limit = min($sql_limit, max(1, $topics_count - $start));
}
// Select the sort order
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . ($sort_dir == 'd' ? 'ASC' : 'DESC');
$start = max(0, $topics_count - $sql_limit - $start);
}
$sql = 'SELECT t.*, u.user_avatar, u.user_avatar_type,bm.topic_id as bookmarked
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . USERS_TABLE . ' u ON (t.topic_poster = u.user_id)
LEFT JOIN ' . BOOKMARKS_TABLE . ' bm ON (bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id)
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_type = ' . POST_NORMAL . ' ' . $sql_shadow_out . ' ' . $sql_approved . '
ORDER BY ' . $sql_sort_order;
$result = $db->sql_query_limit($sql, $sql_limit, $start);
}
$tids = array();
$rowset = array();
while ($row = $db->sql_fetchrow($result)) {
$rowset[] = $row;
$tids[] = $row['topic_moved_id'] ? $row['topic_moved_id'] : $row['topic_id'];
}
$db->sql_freeresult($result);
// get participated users of each topic
// get_participated_user_avatars($tids);
// global $topic_users, $user_avatar;
$topic_list = array();
foreach ($rowset as $row) {
$replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
$short_content = get_short_content($row['topic_first_post_id']);
$user_avatar_url = get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']);
$new_post = false;
if ($user->data['user_id'] != ANONYMOUS) {
if (empty($forum_id) || empty($row['topic_id'])) {
continue;
}
$topic_tracking = get_complete_topic_tracking($forum_id, $row['topic_id']);
$new_post = $topic_tracking[$row['topic_id']] < $row['topic_last_post_time'] ? true : false;
}
$allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'] ? true : false;
$topic_id = $row['topic_moved_id'] ? $row['topic_moved_id'] : $row['topic_id'];
// $icon_urls = array();
// foreach($topic_users[$topic_id] as $posterid){
// $icon_urls[] = new xmlrpcval($user_avatar[$posterid], 'string');
// }
$can_rename = $user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || $user->data['user_id'] == $row['topic_poster'] && $auth->acl_get('f_edit', $forum_id) && ($row['topic_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time']));
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($forum_id), 'topic_id' => new xmlrpcval($row['topic_moved_id'] ? $row['topic_moved_id'] : $row['topic_id']), 'topic_title' => new xmlrpcval(html_entity_decode(strip_tags(censor_text($row['topic_title'])), ENT_QUOTES, 'UTF-8'), 'base64'), 'topic_author_id' => new xmlrpcval($row['topic_first_post_id'], 'string'), 'topic_author_name' => new xmlrpcval(html_entity_decode($row['topic_first_poster_name']), 'base64'), 'last_reply_time' => new xmlrpcval(mobiquo_iso8601_encode($row['topic_last_post_time']), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($row['topic_last_post_time'], 'string'), 'reply_number' => new xmlrpcval($replies, 'int'), 'view_number' => new xmlrpcval($row['topic_views'], 'int'), 'short_content' => new xmlrpcval($short_content, 'base64'), 'new_post' => new xmlrpcval($new_post, 'boolean'), 'icon_url' => new xmlrpcval($user_avatar_url), 'attachment' => new xmlrpcval($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment'] ? 1 : 0, 'string'), 'can_delete' => new xmlrpcval($auth->acl_get('m_delete', $forum_id), 'boolean'), 'can_move' => new xmlrpcval($auth->acl_get('m_move', $forum_id), 'boolean'), 'can_subscribe' => new xmlrpcval(($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered'], 'boolean'), 'is_subscribed' => new xmlrpcval(isset($user_watch_row[$topic_id]) ? true : false, 'boolean'), 'can_close' => new xmlrpcval($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'], 'boolean'), 'is_closed' => new xmlrpcval($row['topic_status'] == ITEM_LOCKED, 'boolean'), 'can_stick' => new xmlrpcval($allow_change_type && $auth->acl_get('f_sticky', $forum_id), 'boolean'), 'is_sticky' => new xmlrpcval($row['topic_type'] == POST_STICKY, 'boolean'), 'can_approve' => new xmlrpcval($auth->acl_get('m_approve', $forum_id) && !$row['topic_approved'], 'boolean'), 'is_approved' => new xmlrpcval($row['topic_approved'] ? true : false, 'boolean'), 'can_rename' => new xmlrpcval($can_rename, 'boolean')), 'struct');
$topic_list[] = $xmlrpc_topic;
unset($xmlrpc_topic);
}
if ($store_reverse) {
$topic_list = array_reverse($topic_list);
}
if (!empty($topic_type)) {
$topic_num = count($topic_list);
} else {
$topic_num = $topics_count;
}
$allowed = $config['max_attachments'] && $auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && @ini_get('file_uploads') != '0' && strtolower(@ini_get('file_uploads')) != 'off';
$max_attachment = $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ? 99 : ($allowed ? $config['max_attachments'] : 0);
$max_png_size = $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ? 10485760 : ($allowed ? $config['max_filesize'] === '0' ? 10485760 : $config['max_filesize'] : 0);
$max_jpg_size = $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ? 10485760 : ($allowed ? $config['max_filesize'] === '0' ? 10485760 : $config['max_filesize'] : 0);
$read_only_forums = explode(",", $config['tapatalk_forum_read_only']);
$can_post = true;
if (empty($read_only_forums) || !is_array($read_only_forums)) {
$read_only_forums = array();
}
if (!$auth->acl_get('f_post', $forum_id) || in_array($forum_id, $read_only_forums)) {
$can_post = false;
}
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval($topic_num, 'int'), 'unread_sticky_count' => new xmlrpcval($unread_sticky_num, 'int'), 'unread_announce_count' => new xmlrpcval($unread_announce_count, 'int'), 'forum_id' => new xmlrpcval($forum_id, 'string'), 'forum_name' => new xmlrpcval(html_entity_decode($forum_data['forum_name']), 'base64'), 'can_post' => new xmlrpcval($can_post, 'boolean'), 'can_upload' => new xmlrpcval($allowed, 'boolean'), 'max_attachment' => new xmlrpcval($max_attachment, 'int'), 'max_png_size' => new xmlrpcval($max_png_size, 'int'), 'max_jpg_size' => new xmlrpcval($max_jpg_size, 'int'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例13: get_user_avatars
function get_user_avatars($users, $is_username = false)
{
global $db;
if (empty($users)) {
return array();
}
if (!is_array($users)) {
$users = array($users);
}
if ($is_username) {
foreach ($users as $key => $username) {
$users[$key] = $db->sql_escape(utf8_clean_string($username));
}
}
$sql = 'SELECT user_id, username, user_avatar, user_avatar_type
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set($is_username ? 'username_clean' : 'user_id', $users);
$result = $db->sql_query($sql);
$user_avatar = array();
$user_key = $is_username ? 'username' : 'user_id';
while ($row = $db->sql_fetchrow($result)) {
$user_avatar[$row[$user_key]] = get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']);
}
$db->sql_freeresult($result);
return $user_avatar;
}
示例14: get_topic_func
function get_topic_func($xmlrpc_params)
{
$params = php_xmlrpc_decode($xmlrpc_params);
$forum_id = isset($params[0]) ? intval($params[0]) : 0;
if (!$forum_id) {
return get_error(3);
}
$offset = 0;
$limit = 20;
$topic_type = '0,1,2';
switch (count($params)) {
case 4:
$offset = intval($params[1]);
// start_num
$limit = intval($params[2]);
// end_num
$topic_type = $params[3] == 'TOP' ? '1' : ($params[3] == 'ANN' ? '2' : $topic_type);
break;
case 3:
$offset = intval($params[1]);
$limit = intval($params[2]);
break;
case 2:
$topic_type = $params[1] == 'TOP' ? '1' : ($params[1] == 'ANN' ? '2' : $topic_type);
}
if ($offset > $limit) {
# check if topic index is out of range
return get_error(5);
} else {
if ($limit - $offset >= 50) {
# return at most 50 topics
$limit = 50;
} else {
if (0 === $offset && 0 === $limit) {
# if both are present and are set to 0, return the first topic only
$limit = 1;
} else {
if ($offset || $limit) {
$limit = 1 + $limit - $offset;
}
}
}
}
global $db, $prefix;
$forum = mobi_forums($forum_id);
$forum = !empty($forum[0]) ? $forum[0] : 0;
if (!$forum) {
return get_error(3);
}
if (!$forum['auth_read']) {
get_error(7);
}
if (isset($forum['subforums'])) {
unset($forum['subforums']);
}
if (FORUM_LINK == $forum['forum_type']) {
return get_error(4);
}
$result = $db->sql_query("SELECT t.*, u.username, u.user_avatar, u.user_avatar_type, u.user_allowavatar\n\t\tFROM {$prefix}_bbtopics t\n\t\tLEFT JOIN {$prefix}_users u\n\t\tON t.topic_poster=u.user_id\n\t\tWHERE t.forum_id = {$forum_id}\n\t\tAND t.topic_type IN ({$topic_type})\n\t\tORDER BY t.topic_id DESC\n\t\tLIMIT {$limit} OFFSET {$offset}");
$topic_list = array();
$unread_sticky_num = $unread_announce_count = 0;
while ($row = $db->sql_fetchrow($result, SQL_ASSOC)) {
if (is_user()) {
if (POST_ANNOUNCE == $row['type']) {
++$unread_announce_count;
} elseif (POST_STICKY == $row['type']) {
++$unread_sticky_num;
}
}
$short_content = get_short_content($row['topic_first_post_id']);
$user_avatar_url = $row['user_allowavatar'] ? get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']) : '';
$rpc = array('forum_id' => new xmlrpcval($forum_id), 'topic_id' => new xmlrpcval($row['topic_moved_id'] ?: $row['topic_id']), 'topic_title' => new xmlrpcval(html_entity_decode(strip_tags($row['topic_title']), ENT_QUOTES, 'UTF-8'), 'base64'), 'topic_author_id' => new xmlrpcval($row['topic_poster']), 'topic_author_name' => new xmlrpcval(html_entity_decode($row['username']), 'base64'), 'is_subscribed' => new xmlrpcval($forum['auth_read'] && !empty($_SESSION['CPG_SESS']['Forums']['track_topics'][$row['topic_id']]), 'boolean'), 'can_subscribe' => new xmlrpcval($forum['auth_read'], 'boolean'), 'is_closed' => new xmlrpcval(TOPIC_LOCKED == $row['topic_status'], 'boolean'), 'last_reply_time' => new xmlrpcval(mobiquo_iso8601_encode($row['topic_time']), 'dateTime.iso8601'), 'reply_number' => new xmlrpcval($row['topic_replies'], 'int'), 'new_post' => new xmlrpcval(false, 'boolean'), 'view_number' => new xmlrpcval($row['topic_views'], 'int'), 'short_content' => new xmlrpcval(get_short_content($row['topic_first_post_id']), 'base64'));
if ($user_avatar_url) {
$rpc['icon_url'] = new xmlrpcval($user_avatar_url);
}
$topic_list[] = new xmlrpcval($rpc, 'struct');
}
$db->sql_freeresult($result);
$rpc = array('total_topic_num' => new xmlrpcval($forum['forum_topics'], 'int'), 'forum_id' => new xmlrpcval($forum['forum_id'], 'string'), 'forum_name' => new xmlrpcval(html_entity_decode($forum['forum_name']), 'base64'), 'can_post' => new xmlrpcval($forum['auth_post'], 'boolean'), 'unread_sticky_count' => new xmlrpcval($unread_sticky_num, 'int'), 'unread_announce_count' => new xmlrpcval($unread_announce_count, 'int'), 'can_subscribe' => new xmlrpcval($forum['auth_read'], 'boolean'), 'is_subscribed' => new xmlrpcval($forum['auth_read'] && !empty($_SESSION['CPG_SESS']['Forums']['track_forums'][$forum['forum_id']]), 'boolean'), 'require_prefix' => new xmlrpcval(false, 'boolean'), 'prefixes' => new xmlrpcval(array(), 'array'));
if ($topic_list) {
$rpc['topics'] = new xmlrpcval($topic_list, 'array');
}
return new xmlrpcresp(new xmlrpcval($rpc, 'struct'));
}
示例15: display
//.........这里部分代码省略.........
if (!($url = get_user_register_url(NULL, 'menu link', false, '&', $current_Blog->ID))) {
return false;
}
if (isset($this->BlockCache)) {
// Do NOT cache because some of these links are using a redirect_to param, which makes it page dependent.
// Note: also beware of the source param.
// so this will be cached by the PageCache; there is no added benefit to cache it in the BlockCache
// (which could have been shared between several pages):
$this->BlockCache->abort_collect();
}
$text = T_('Register');
// Is this the current display?
if ($disp == 'register') {
// Let's display the link as selected
$link_class = $this->disp_params['link_selected_class'];
}
break;
case 'profile':
if (!is_logged_in()) {
return false;
}
$url = get_user_profile_url($current_Blog->ID);
$text = T_('Edit profile');
// Is this the current display? (Edit my Profile)
if (in_array($disp, array('profile', 'avatar', 'pwdchange', 'userprefs', 'subs'))) {
// Let's display the link as selected
$link_class = $this->disp_params['link_selected_class'];
}
break;
case 'avatar':
if (!is_logged_in()) {
return false;
}
$url = get_user_avatar_url($current_Blog->ID);
$text = T_('Profile picture');
// Note: we never highlight this, it will always highlight 'profile' instead
break;
case 'users':
global $Settings;
if (!is_logged_in() && !$Settings->get('allow_anonymous_user_list')) {
// Don't allow anonymous users to see users list
return false;
}
$url = $current_Blog->get('usersurl');
$text = T_('User directory');
// Is this the current display?
// Note: If $user_ID is not set, it means we are viewing "My Profile" instead
global $user_ID;
if ($disp == 'users' || $disp == 'user' && !empty($user_ID)) {
// Let's display the link as selected
// Note: we also highlight this for any user profile that is displayed
$link_class = $this->disp_params['link_selected_class'];
}
break;
case 'item':
$ItemCache =& get_ItemCache();
/**
* @var Item
*/
$item_ID = intval($this->disp_params['item_ID']);
$disp_Item =& $ItemCache->get_by_ID($item_ID, false, false);
if (empty($disp_Item)) {
// Item not found
return false;
}
$url = $disp_Item->get_permanent_url();