public function param() { if (!isset($_SESSION['login'])) { redirect('Admin/index'); } // Loading and initializing the user $this->load->model('user_model'); $user = $this->user_model->init_user($_SESSION['login']); $user->user_nomp = $this->user_model->nom_p($user->nom, $user->prenom); $user->user_score = $this->user_model->get_user_score($user->id); $user->user_rank = get_user_rank($user->user_score); if ($_POST) { $this->load->library('form_validation'); $this->form_validation->set_rules('nom', 'Nom', 'required|alpha'); $this->form_validation->set_rules('prenom', 'Prenom', 'required|alpha'); $this->form_validation->set_rules('classe', 'Classe', 'alpha_numeric|exact_length[5]'); if ($this->form_validation->run() !== false) { // passed $nom = $this->input->post('nom'); $prenom = $this->input->post('prenom'); $classe = $this->input->post('classe'); $user_info = array('nom' => $nom, 'prenom' => $prenom, 'classe' => $classe); $this->load->model('user_model'); if ($this->user_model->update($user, $user_info)) { $this->session->set_flashdata('error_msg', 'Votre profil à été mit à jour.'); redirect('Admin/param'); } else { $this->session->set_flashdata('error_msg', 'Not updated'); } } } $data = array('main_content' => 'param_view', 'page_title' => 'Paramètres', 'user' => $user, 'error_msg' => $this->session->flashdata('error_msg')); $this->load->view('includes/template_logged', $data); }
/** * */ public static function add_user_to_user_cache(&$user_cache, $row) { global $auth, $config, $user; $user_id = $row['user_id']; if ($user_id == ANONYMOUS) { $user_cache[$user_id] = array('joined' => '', 'posts' => '', 'from' => '', 'sig' => '', 'sig_bbcode_uid' => '', 'sig_bbcode_bitfield' => '', 'online' => false, 'avatar' => $user->optionget('viewavatars') ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'sig' => '', 'profile' => '', 'pm' => '', 'email' => '', 'www' => '', 'icq_status_img' => '', 'icq' => '', 'aim' => '', 'msn' => '', 'yim' => '', 'jabber' => '', 'search' => '', 'age' => '', 'gallery_album' => '', 'gallery_images' => '', 'gallery_search' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'warnings' => 0, 'allow_pm' => 0); get_user_rank($row['user_rank'], false, $user_cache[$user_id]['rank_title'], $user_cache[$user_id]['rank_image'], $user_cache[$user_id]['rank_image_src']); } else { $user_sig = ''; if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) { $user_sig = $row['user_sig']; } $id_cache[] = $user_id; $user_cache[$user_id] = array('joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => isset($row['user_warnings']) ? $row['user_warnings'] : 0, 'from' => !empty($row['user_from']) ? $row['user_from'] : '', 'sig' => $user_sig, 'sig_bbcode_uid' => !empty($row['user_sig_bbcode_uid']) ? $row['user_sig_bbcode_uid'] : '', 'sig_bbcode_bitfield' => !empty($row['user_sig_bbcode_bitfield']) ? $row['user_sig_bbcode_bitfield'] : '', 'viewonline' => $row['user_allow_viewonline'], 'allow_pm' => $row['user_allow_pm'], 'avatar' => $user->optionget('viewavatars') ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'age' => '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'user_id' => $row['user_id'], 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'online' => false, 'profile' => phpbb_gallery_url::append_sid('phpbb', 'memberlist', "mode=viewprofile&u={$user_id}"), 'www' => $row['user_website'], 'aim' => $row['user_aim'] && $auth->acl_get('u_sendim') ? phpbb_gallery_url::append_sid('phpbb', 'memberlist', "mode=contact&action=aim&u={$user_id}") : '', 'msn' => $row['user_msnm'] && $auth->acl_get('u_sendim') ? phpbb_gallery_url::append_sid('phpbb', 'memberlist', "mode=contact&action=msnm&u={$user_id}") : '', 'yim' => $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', 'jabber' => $row['user_jabber'] && $auth->acl_get('u_sendim') ? phpbb_gallery_url::append_sid('phpbb', 'memberlist', "mode=contact&action=jabber&u={$user_id}") : '', 'search' => $auth->acl_get('u_search') ? phpbb_gallery_url::append_sid('phpbb', 'search', "author_id={$user_id}&sr=posts") : '', 'gallery_album' => $row['personal_album_id'] && phpbb_gallery_config::get('viewtopic_icon') ? phpbb_gallery_url::append_sid('album', "album_id=" . $row['personal_album_id']) : '', 'gallery_images' => phpbb_gallery_config::get('viewtopic_images') ? $row['user_images'] : 0, 'gallery_search' => phpbb_gallery_config::get('viewtopic_images') && phpbb_gallery_config::get('viewtopic_link') && $row['user_images'] ? phpbb_gallery_url::append_sid('search', "user_id={$user_id}") : ''); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$user_id]['rank_title'], $user_cache[$user_id]['rank_image'], $user_cache[$user_id]['rank_image_src']); if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) { $user_cache[$user_id]['email'] = $config['board_email_form'] && $config['email_enable'] ? phpbb_gallery_url::append_sid('phpbb', 'memberlist', "mode=email&u={$user_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $row['user_email']); } else { $user_cache[$user_id]['email'] = ''; } if (!empty($row['user_icq'])) { $user_cache[$user_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq']; $user_cache[$user_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />'; } else { $user_cache[$user_id]['icq_status_img'] = ''; $user_cache[$user_id]['icq'] = ''; } if ($config['allow_birthdays'] && !empty($row['user_birthday'])) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); if ($bday_year) { $now = getdate(time() + $user->timezone + $user->dst - date('Z')); $diff = $now['mon'] - $bday_month; if ($diff == 0) { $diff = $now['mday'] - $bday_day < 0 ? 1 : 0; } else { $diff = $diff < 0 ? 1 : 0; } $user_cache[$user_id]['age'] = (int) ($now['year'] - $bday_year - $diff); } } } }
function pcp_output_rank_title($field_name, $view_userdata, $map_name = '') { global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata; global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields; if ($view_userdata['user_id'] != ANONYMOUS) { $rank = get_user_rank($view_userdata); $txt = $rank['rank_title']; $img = $rank['rank_image']; // // Custom Title MOD // // // Verify Custom Title Status // // Uncomment this section if you don't want custom title to appear even if it is defined but the user does not meet criteria $membertime = empty($mode) || $mode != 'register' ? time() - $userdata['user_regdate'] : 0; if ($view_userdata['user_custom_title_status'] == CUSTOM_TITLE_ENABLED || $view_userdata['user_custom_title_status'] == CUSTOM_TITLE_REGDATE && $membertime >= $board_config['custom_title_days'] * 86400 && $view_userdata['user_posts'] >= $board_config['custom_title_posts']) { if (!empty($view_userdata['user_custom_title'])) { switch ($board_config['custom_title_mode']) { case CUSTOM_TITLE_MODE_INDEPENDENT: $txt = $view_userdata['user_custom_title'] . "<br />" . $txt; break; case CUSTOM_TITLE_MODE_REPLACE_RANK: $txt = $view_userdata['user_custom_title']; break; case CUSTOM_TITLE_MODE_REPLACE_BOTH: $txt = $view_userdata['user_custom_title']; $img = ''; break; default: break; } } } // // Custom Title MOD End // // result $res = pcp_output_format($field_name, $txt, $img, $map_name); } return $res; }
/** * Assign template variables to display a vehicles comments * * @param int $vid vehicle id to fitler on * */ function display_guestbook($vid) { global $template, $garage_vehicle, $garage, $user, $phpEx, $auth, $phpbb_root_path, $config, $start, $garage_config, $mode, $garage_template, $db; //Set Required Values To Defaults If They Are Empty $start = empty($start) ? '0' : $start; $template->assign_block_vars('guestbook', array()); //Get Vehicle Data $vehicle_data = $garage_vehicle->get_vehicle($vid); //Get All Comments Data $comment_data = $this->get_vehicle_comments($vid, $start, $garage_config['cars_per_page']); $id_cache = array(); /* * First Loop Of Comments Is Just To Build User Cache So We Done Have to Recompute Reoccuring User Data */ for ($i = 0, $count = sizeof($comment_data); $i < $count; $i++) { $poster_id = $comment_data[$i]['author_id']; // Cache various user specific data ... so we don't have to recompute // this each time the same user appears on this page if (!isset($user_cache[$poster_id])) { if ($poster_id == ANONYMOUS) { $user_cache[$poster_id] = array('joined' => '', 'posts' => '', 'from' => '', 'sig' => '', 'sig_bbcode_uid' => '', 'sig_bbcode_bitfield' => '', 'online' => false, 'avatar' => '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'sig' => '', 'profile' => '', 'pm' => '', 'email' => '', 'www' => '', 'icq_status_img' => '', 'icq' => '', 'aim' => '', 'msn' => '', 'yim' => '', 'jabber' => '', 'search' => '', 'username' => $comment_data[$i]['username'], 'user_colour' => $comment_data[$i]['user_colour'], 'allow_pm' => 0); } else { $user_sig = ''; // We add the signature to every posters entry because enable_sig is post dependant if ($comment_data[$i]['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) { $user_sig = $comment_data[$i]['user_sig']; } $id_cache[] = $poster_id; $user_cache[$poster_id] = array('joined' => $user->format_date($comment_data[$i]['user_regdate']), 'posts' => $comment_data[$i]['user_posts'], 'from' => !empty($comment_data[$i]['user_from']) ? $comment_data[$i]['user_from'] : '', 'sig' => $user_sig, 'sig_bbcode_uid' => !empty($comment_data[$i]['user_sig_bbcode_uid']) ? $comment_data[$i]['user_sig_bbcode_uid'] : '', 'sig_bbcode_bitfield' => !empty($comment_data[$i]['user_sig_bbcode_bitfield']) ? $comment_data[$i]['user_sig_bbcode_bitfield'] : '', 'viewonline' => $comment_data[$i]['user_allow_viewonline'], 'allow_pm' => $comment_data[$i]['user_allow_pm'], 'avatar' => $user->optionget('viewavatars') ? get_user_avatar($comment_data[$i]['user_avatar'], $comment_data[$i]['user_avatar_type'], $comment_data[$i]['user_avatar_width'], $comment_data[$i]['user_avatar_height']) : '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'username' => $comment_data[$i]['username'], 'user_colour' => $comment_data[$i]['user_colour'], 'online' => false, 'profile' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u={$poster_id}"), 'www' => $comment_data[$i]['user_website'], 'aim' => $comment_data[$i]['user_aim'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=aim&u={$poster_id}") : '', 'msn' => $comment_data[$i]['user_msnm'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=msnm&u={$poster_id}") : '', 'yim' => $comment_data[$i]['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($comment_data[$i]['user_yim']) . '&.src=pg' : '', 'jabber' => $comment_data[$i]['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$poster_id}") : '', 'search' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", 'search_author=' . urlencode($comment_data[$i]['username']) . '&sr=posts') : ''); get_user_rank($comment_data[$i]['user_rank'], $comment_data[$i]['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); if (!empty($comment_data[$i]['user_allow_viewemail']) || $auth->acl_get('a_email')) { $user_cache[$poster_id]['email'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$poster_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $comment_data[$i]['user_email']); } else { $user_cache[$poster_id]['email'] = ''; } if (!empty($comment_data[$i]['user_icq'])) { $user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $comment_data[$i]['user_icq']; $user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $comment_data[$i]['user_icq'] . '&img=5" width="18" height="18" alt="" />'; } else { $user_cache[$poster_id]['icq_status_img'] = ''; $user_cache[$poster_id]['icq'] = ''; } } } } // Generate online information for user if ($config['load_onlinetrack'] && sizeof($id_cache)) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql); $update_time = $config['load_online_time'] * 60; while ($row = $db->sql_fetchrow($result)) { $user_cache[$row['session_user_id']]['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false; } $db->sql_freeresult($result); } unset($id_cache); /* * Second Loop Of Comments Is Just To Declare Contents To Template Engine */ for ($i = 0, $count = sizeof($comment_data); $i < $count; $i++) { $poster_id = $comment_data[$i]['author_id']; $comment_data[$i]['user_id'] = empty($comment_data[$i]['user_id']) ? ANONYMOUS : $comment_data[$i]['user_id']; $username = $comment_data[$i]['username']; $temp_url = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . $comment_data[$i]['user_id']); $poster = '<a href="' . $temp_url . '">' . $comment_data[$i]['username'] . '</a>'; $poster_id = $comment_data[$i]['author_id']; $poster_posts = $comment_data[$i]['user_id'] != ANONYMOUS ? $comment_data[$i]['user_posts'] : ''; $poster_from = $comment_data[$i]['user_from'] && $comment_data[$i]['user_id'] != ANONYMOUS ? $user->lang['LOCATION'] . ': ' . $comment_data[$i]['user_from'] : ''; $vehicle_id = $comment_data[$i]['vehicle_id']; $poster_car_year = $comment_data[$i]['made_year'] && $comment_data[$i]['user_id'] != ANONYMOUS ? ' ' . $comment_data[$i]['made_year'] : ''; $poster_car_mark = $comment_data[$i]['make'] && $comment_data[$i]['user_id'] != ANONYMOUS ? ' ' . $comment_data[$i]['make'] : ''; $poster_car_model = $comment_data[$i]['model'] && $comment_data[$i]['user_id'] != ANONYMOUS ? ' ' . $comment_data[$i]['model'] : ''; $poster_joined = $comment_data[$i]['user_id'] != ANONYMOUS ? $user->lang['JOINED'] . ': ' . $user->format_date($comment_data[$i]['user_regdate']) : ''; // Handle anon users posting with usernames //if ( $comment_data[$i]['user_id'] == ANONYMOUS && $comment_data[$i]['post_username'] != '' ) //{ // $poster = $comment_data[$i]['post_username']; // } $profile = '<a href="' . $temp_url . '">' . $user->lang['READ_PROFILE'] . '</a>'; $temp_url = append_sid("{$phpbb_root_path}privmsg.{$phpEx}", "mode=post&u=" . $comment_data[$i]['user_id']); $pm = '<a href="' . $temp_url . '">' . $user->lang['SEND_PRIVATE_MESSAGE'] . '</a>'; if (!empty($comment_data[$i]['user_viewemail']) || $auth->acl_get('m_')) { $email_uri = $config['board_email_form'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u=" . $comment_data[$i]['user_id']) : 'mailto:' . $comment_data[$i]['user_email']; $email = '<a href="' . $email_uri . '">' . $user->lang['SEND_EMAIL'] . '</a>'; } else { $email_img = ''; $email = ''; } //$www_img = ( $comment_data[$i]['user_website'] ) ? '<a href="' . $comment_data[$i]['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $user->lang['Visit_website'] . '" title="' . $user->lang['Visit_website'] . '" border="0" /></a>' : ''; $www_img = ''; //$www = ( $comment_data[$i]['user_website'] ) ? '<a href="' . $comment_data[$i]['user_website'] . '" target="_userwww">' . $user->lang['Visit_website'] . '</a>' : ''; $www = ''; $posted = '<a href="' . append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . $comment_data[$i]['user_id']) . '">' . $comment_data[$i]['username'] . '</a>'; $posted = $user->format_date($comment_data[$i]['post_date']); $post = generate_text_for_display($comment_data[$i]['post'], $comment_data[$i]['bbcode_uid'], $comment_data[$i]['bbcode_bitfield'], $comment_data[$i]['bbcode_options']); $post = make_clickable($post); // Parse smilies if ($config['allow_smilies']) { $post = smiley_text($post); } // Replace newlines (we use this rather than nl2br because // till recently it wasn't XHTML compliant) $post = str_replace("\n", "\n<br />\n", $post); $edit_img = ''; $edit = ''; $delpost_img = ''; $delpost = ''; if ($auth->acl_get('m_garage')) { $edit_img = $user->img('icon_post_edit', 'EDIT_POST'); $edit = '<a href="' . append_sid("{$phpbb_root_path}garage.{$phpEx}", "mode=edit_comment&VID={$vid}&comment_id=" . $comment_data[$i]['comment_id'] . "&sid=" . $user->data['session_id']) . '">' . $user->lang['EDIT_POST'] . '</a>'; $delpost_img = $user->img('icon_post_delete', 'DELETE_POST'); $delpost = '<a href="' . append_sid("{$phpbb_root_path}garage.{$phpEx}", "mode=delete_comment&VID={$vid}&comment_id=" . $comment_data[$i]['comment_id'] . "&sid=" . $user->data['session_id']) . '">' . $user->lang['DELETE_POST'] . '</a>'; } $comment_data[$i]['post_username'] = ''; $template->assign_block_vars('guestbook.comments', array('POST_AUTHOR' => $poster, 'POSTER_JOINED' => $poster_joined, 'POSTER_POSTS' => $poster_posts, 'POSTER_FROM' => $poster_from, 'POSTER_CAR_MARK' => $poster_car_mark, 'POSTER_CAR_MODEL' => $poster_car_model, 'POSTER_CAR_YEAR' => $poster_car_year, 'U_VEHICLE' => append_sid("{$phpbb_root_path}garage.{$phpEx}", "mode=view_vehicle&VID={$vehicle_id}"), 'POSTER_AVATAR' => $user->optionget('viewavatars') ? get_user_avatar($comment_data[$i]['user_avatar'], $comment_data[$i]['user_avatar_type'], $comment_data[$i]['user_avatar_width'], $comment_data[$i]['user_avatar_height']) : '', 'POST_AUTHOR_COLOUR' => get_username_string('colour', $comment_data[$i]['user_id'], $comment_data[$i]['username'], $comment_data[$i]['user_colour']), 'S_ONLINE' => $poster_id == ANONYMOUS || !$config['load_onlinetrack'] ? false : ($user_cache[$poster_id]['online'] ? true : false), 'U_PM' => $poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&mode=compose&u={$poster_id}") : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], 'U_WWW' => $user_cache[$poster_id]['www'], 'U_MSN' => $user_cache[$poster_id]['msn'], 'U_ICQ' => $user_cache[$poster_id]['icq'], 'U_YIM' => $user_cache[$poster_id]['yim'], 'U_AIM' => $user_cache[$poster_id]['aim'], 'U_JABBER' => $user_cache[$poster_id]['jabber'], 'U_DELETE' => $auth->acl_get('m_garage_delete') ? append_sid("{$phpbb_root_path}garage_guestbook.{$phpEx}", "mode=delete_comment&VID={$vid}&CMT_ID={$comment_data[$i]['comment_id']}") : '', 'U_EDIT' => $auth->acl_get('m_garage_edit') ? append_sid("{$phpbb_root_path}garage_guestbook.{$phpEx}", "mode=edit_comment&CMT_ID={$comment_data[$i]['comment_id']}") : '', 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $comment_data[$i]['username'], $comment_data[$i]['user_colour'], $comment_data[$i]['post_username']), 'POST_ID' => $comment_data[$i]['comment_id'], 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $comment_data[$i]['username'], $comment_data[$i]['user_colour'], $comment_data[$i]['post_username']), 'POST_DATE' => $user->format_date($comment_data[$i]['post_date']), 'MESSAGE' => $post, 'SIGNATURE' => $row['enable_sig'] ? $user_cache[$poster_id]['sig'] : '', 'POSTER_AVATAR' => $user->optionget('viewavatars') ? get_user_avatar($comment_data[$i]['user_avatar'], $comment_data[$i]['user_avatar_type'], $comment_data[$i]['user_avatar_width'], $comment_data[$i]['user_avatar_height']) : '', 'RANK_TITLE' => $user_cache[$poster_id]['rank_title'], 'RANK_IMG' => $user_cache[$poster_id]['rank_image'], 'POSTER_POSTS' => $user_cache[$poster_id]['posts'], 'POSTER_JOINED' => $user->format_date($comment_data[$i]['user_regdate']), 'POSTER_FROM' => !empty($row['user_from']) ? $comment_data[$i]['user_from'] : '', 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), 'PROFILE' => $profile, 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), 'PM' => $pm, 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), 'EMAIL' => $email, 'WWW_IMG' => $www_img, 'WWW' => $www, 'EDIT_IMG' => $edit_img, 'EDIT' => $edit, 'DELETE_IMG' => $delpost_img, 'DELETE' => $delpost, 'POSTER' => $poster)); } $count = $this->count_vehicle_comments($vid); $pagination = $garage_template->generate_pagination(append_sid("{$phpbb_root_path}garage_vehicle.php", "mode={$mode}&VID={$vid}"), 'guestbook', $count, $garage_config['cars_per_page'], $start); $template->assign_vars(array('PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($count, $garage_config['cars_per_page'], $start), 'TOTAL_COMMENTS' => $count == 1 ? $user->lang['VIEW_COMMENT_PAGE'] : sprintf($user->lang['VIEW_COMMENTS_PAGE'], $count), 'S_DISPLAY_LEAVE_COMMENT' => $auth->acl_get('u_garage_comment'), 'S_MODE_GUESTBOOK_ACTION' => append_sid("{$phpbb_root_path}garage_guestbook.{$phpEx}", "mode=insert_comment&VID={$vid}"))); }
public function main($mode, $author_id, $give) { $this->user->add_lang(array('memberlist', 'groups', 'search')); $this->user->add_lang_ext('gfksx/ThanksForPosts', 'thanks_mod'); // Grab data $row_number = $total_users = 0; $givens = $reseved = $rowsp = $rowsu = $words = $where = array(); $sthanks = false; $ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true)); $ex_fid_ary = sizeof($ex_fid_ary) ? $ex_fid_ary : false; if (!$this->auth->acl_gets('u_viewthanks')) { if ($this->user->data['user_id'] != ANONYMOUS) { trigger_error('NO_VIEW_USERS_THANKS'); } login_box('', isset($this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]) ? $this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $this->user->lang['LOGIN_EXPLAIN_MEMBERLIST']); } $top = $this->request->variable('top', 0); $start = $this->request->variable('start', 0); $submit = isset($_POST['submit']) ? true : false; $default_key = 'a'; $sort_key = $this->request->variable('sk', $default_key); $sort_dir = $this->request->variable('sd', 'd'); $topic_id = $this->request->variable('t', 0); $return_chars = $this->request->variable('ch', $topic_id ? -1 : 300); $order_by = ''; switch ($mode) { case 'givens': $per_page = $this->config['posts_per_page']; $total_match_count = 0; $page_title = $this->user->lang['SEARCH']; $template_html = 'thanks_results.html'; switch ($give) { case 'true': $u_search = $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $author_id, 'give' => 'true', 'tslash' => '')); $sql = 'SELECT COUNT(user_id) AS total_match_count FROM ' . $this->thanks_table . ' WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND user_id = ' . $author_id; $where = 'user_id'; break; case 'false': $u_search = $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $author_id, 'give' => 'false', 'tslash' => '')); $sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count FROM ' . $this->thanks_table . ' WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND poster_id = ' . $author_id; $where = 'poster_id'; break; } $result = $this->db->sql_query($sql); if (!($row = $this->db->sql_fetchrow($result))) { break; } else { $total_match_count = (int) $row['total_match_count']; $this->db->sql_freeresult($result); $sql_array = array('SELECT' => 'u.username, u.user_colour, p.poster_id, p.post_id, p.topic_id, p.forum_id, p.post_time, p.post_subject, p.post_text, p.post_username, p.bbcode_bitfield, p.bbcode_uid, p.post_attachment, p.enable_bbcode, p. enable_smilies, p.enable_magic_url', 'FROM' => array($this->thanks_table => 't'), 'WHERE' => '(' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0) AND t.' . $where . "= {$author_id}"); $sql_array['LEFT_JOIN'][] = array('FROM' => array($this->users_table => 'u'), 'ON' => 't.poster_id = u.user_id'); $sql_array['LEFT_JOIN'][] = array('FROM' => array(POSTS_TABLE => 'p'), 'ON' => 't.post_id = p.post_id'); $sql = $this->db->sql_build_query('SELECT_DISTINCT', $sql_array); $result = $this->db->sql_query_limit($sql, $per_page, $start); if (!($row = $this->db->sql_fetchrow($result))) { break; } else { $bbcode_bitfield = $text_only_message = ''; do { // We pre-process some variables here for later usage $row['post_text'] = censor_text($row['post_text']); $text_only_message = $row['post_text']; // make list items visible as such if ($row['bbcode_uid']) { // no BBCode in text only message strip_bbcode($text_only_message, $row['bbcode_uid']); } if ($return_chars == -1 || utf8_strlen($text_only_message) < $return_chars + 3) { $row['display_text_only'] = false; $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); // Does this post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) { $attach_list[$row['forum_id']][] = $row['post_id']; } } else { $row['post_text'] = $text_only_message; $row['display_text_only'] = true; } unset($text_only_message); if ($row['display_text_only']) { // limit the message length to return_chars value $row['post_text'] = get_context($row['post_text'], array(), $return_chars); $row['post_text'] = bbcode_nl2br($row['post_text']); } else { $flags = ($row['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($row['enable_magic_url'] ? OPTION_FLAG_LINKS : 0); $row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags); } $this->template->assign_block_vars('searchresults', array('POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_SUBJECT' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_subject'] : (!empty($row['forum_id']) ? '' : $row['post_subject']), 'POST_DATE' => !empty($row['post_time']) ? $this->user->format_date($row['post_time']) : '', 'MESSAGE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_text'] : (!empty($row['forum_id']) ? $this->user->lang['SORRY_AUTH_READ'] : $row['post_text']), 'FORUM_ID' => $row['forum_id'], 'TOPIC_ID' => $row['topic_id'], 'POST_ID' => $row['post_id'], 'U_VIEW_TOPIC' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 't=' . $row['topic_id']), 'U_VIEW_FORUM' => append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $row['forum_id']), 'U_VIEW_POST' => !empty($row['post_id']) ? append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "t=" . $row['topic_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'] : '')); } while ($row = $this->db->sql_fetchrow($result)); $this->db->sql_freeresult($result); } } if ($total_match_count > 1000) { $total_match_count--; $l_search_matches = $this->user->lang('FOUND_MORE_SEARCH_MATCHES', $total_match_count); } else { $l_search_matches = $this->user->lang('FOUND_SEARCH_MATCHES', $total_match_count); } $this->pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); $this->template->assign_vars(array('PAGE_NUMBER' => $this->pagination->on_page($total_match_count, $per_page, $start), 'TOTAL_MATCHES' => $total_match_count, 'SEARCH_MATCHES' => $l_search_matches, 'U_THANKS' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('tslash' => '')))); break; default: $page_title = $this->user->lang['THANKS_USER']; $template_html = 'thankslist_body.html'; // Grab relevant data thanks $sql = 'SELECT user_id, COUNT(user_id) AS tally FROM ' . $this->thanks_table . ' WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0 GROUP BY user_id'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $givens[$row['user_id']] = $row['tally']; } $this->db->sql_freeresult($result); $sql = 'SELECT poster_id, COUNT(user_id) AS tally FROM ' . $this->thanks_table . ' WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0 GROUP BY poster_id'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $reseved[$row['poster_id']] = $row['tally']; } $this->db->sql_freeresult($result); // Sorting $sort_key_text = array('a' => $this->user->lang['SORT_USERNAME'], 'b' => $this->user->lang['SORT_LOCATION'], 'c' => $this->user->lang['SORT_JOINED'], 'd' => $this->user->lang['SORT_POST_COUNT'], 'e' => 'R_THANKS', 'f' => 'G_THANKS'); $sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'count_thanks', 'f' => 'count_thanks'); $sort_dir_text = array('a' => $this->user->lang['ASCENDING'], 'd' => $this->user->lang['DESCENDING']); if ($this->auth->acl_get('u_viewonline')) { $sort_key_text['l'] = $this->user->lang['SORT_LAST_ACTIVE']; $sort_key_sql['l'] = 'u.user_lastvisit'; } $s_sort_key = ''; foreach ($sort_key_text as $key => $value) { $selected = $sort_key == $key ? ' selected="selected"' : ''; $s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } $s_sort_dir = ''; foreach ($sort_dir_text as $key => $value) { $selected = $sort_dir == $key ? ' selected="selected"' : ''; $s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } // 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'); // Build a relevant pagination_url $params = array(); $check_params = array('sk' => array('sk', $default_key), 'sd' => array('sd', 'a')); foreach ($check_params as $key => $call) { if (!isset($_REQUEST[$key])) { continue; } $param = call_user_func_array(array($this->request, 'variable'), $call); $param = is_string($param) ? urlencode($param) : $param; $params[$key] = $param; if ($key != 'sk' && $key != 'sd') { $sort_params[] = $param; } } $pagination_url = $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array_merge($params, array('tslash' => ''))); // Grab relevant data $sql = 'SELECT DISTINCT poster_id FROM ' . $this->thanks_table; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $rowsp[] = $row['poster_id']; } $sql = 'SELECT DISTINCT user_id FROM ' . $this->thanks_table; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $rowsu[] = $row['user_id']; } if ($sort_key == 'e') { $sortparam = 'poster'; $rows = $rowsp; } else { if ($sort_key == 'f') { $sortparam = 'user'; $rows = $rowsu; } else { $sortparam = ''; $rows = array_merge($rowsp, $rowsu); } } $total_users = count(array_unique($rows)); if (empty($rows)) { break; } $sql_array = array('SELECT' => 'u.*', 'FROM' => array($this->users_table => 'u'), 'ORDER_BY' => $order_by); if ($top) { $total_users = $top; $start = 0; $page_title = $this->user->lang['REPUT_TOPLIST']; } else { $top = $this->config['topics_per_page']; } if ($sortparam) { $sql_array['FROM'] = array($this->thanks_table => 't'); $sql_array['SELECT'] .= ', count(t.' . $sortparam . '_id) as count_thanks'; $sql_array['LEFT_JOIN'][] = array('FROM' => array($this->users_table => 'u'), 'ON' => 't.' . $sortparam . '_id = u.user_id'); $sql_array['GROUP_BY'] = 't.' . $sortparam . '_id'; } $where[] = $rows[0]; for ($i = 1, $end = sizeof($rows); $i < $end; ++$i) { $where[] = $rows[$i]; } $sql_array['WHERE'] = $this->db->sql_in_set('u.user_id', $where); $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query_limit($sql, $top, $start); if (!($row = $this->db->sql_fetchrow($result))) { trigger_error('NO_USER'); } else { $sql = 'SELECT session_user_id, MAX(session_time) AS session_time FROM ' . SESSIONS_TABLE . ' WHERE session_time >= ' . (time() - $this->config['session_length']) . ' AND ' . $this->db->sql_in_set('session_user_id', $where) . ' GROUP BY session_user_id'; $result_sessions = $this->db->sql_query($sql); $session_times = array(); while ($session = $this->db->sql_fetchrow($result_sessions)) { $session_times[$session['session_user_id']] = $session['session_time']; } $this->db->sql_freeresult($result_sessions); $user_list = array(); $id_cache = array(); do { $row['session_time'] = !empty($session_times[$session['user_id']]) ? $session_times[$session['user_id']] : 0; $row['last_visit'] = !empty($session['session_time']) ? $session['session_time'] : $session['user_lastvisit']; $user_list[] = (int) $row['user_id']; $id_cache[$row['user_id']] = $row; } while ($row = $this->db->sql_fetchrow($result)); $this->db->sql_freeresult($result); // Load custom profile fields if ($this->config['load_cpf_memberlist']) { $cp_row = $this->profilefields_manager->generate_profile_fields_template_headlines('field_show_on_ml'); foreach ($cp_row as $profile_field) { $this->template->assign_block_vars('custom_fields', $profile_field); } // Grab all profile fields from users in id cache for later use - similar to the poster cache $profile_fields_cache = $this->profilefields_manager->grab_profile_fields_data($user_list); // Filter the fields we don't want to show foreach ($profile_fields_cache as $user_id => $user_profile_fields) { foreach ($user_profile_fields as $field_ident => $profile_field) { if (!$profile_field['data']['field_show_on_ml']) { unset($profile_fields_cache[$user_id][$field_ident]); } } } } //do for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) { $user_id = $user_list[$i]; $row = $id_cache[$user_id]; $last_visit = $row['user_lastvisit']; $rank_title = $rank_img = $rank_img_src = ''; include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext; get_user_rank($row['user_rank'], $user_id == ANONYMOUS ? false : $row['user_posts'], $rank_title, $rank_img, $rank_img_src); $sthanks = true; // Custom Profile Fields $cp_row = array(); if ($this->config['load_cpf_memberlist']) { $cp_row = isset($profile_fields_cache[$user_id]) ? $this->profilefields_manager->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array(); } $memberrow = array_merge(phpbb_show_profile($row), array('ROW_NUMBER' => $row_number + ($start + 1), 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'GIVENS' => !isset($givens[$user_id]) ? 0 : $givens[$user_id], 'RECEIVED' => !isset($reseved[$user_id]) ? 0 : $reseved[$user_id], 'JOINED' => $this->user->format_date($row['user_regdate']), 'VISITED' => empty($last_visit) ? ' - ' : $this->user->format_date($last_visit), 'POSTS' => $row['user_posts'] ? $row['user_posts'] : 0, 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), 'U_SEARCH_USER' => $this->auth->acl_get('u_search') ? append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=posts") : '', 'U_SEARCH_USER_GIVENS' => $this->auth->acl_get('u_search') ? $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'true', 'tslash' => '')) : '', 'U_SEARCH_USER_RECEIVED' => $this->auth->acl_get('u_search') ? $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'false', 'tslash' => '')) : '', 'L_VIEWING_PROFILE' => sprintf($this->user->lang['VIEWING_PROFILE'], $row['username']), 'VISITED' => empty($last_visit) ? ' - ' : $this->user->format_date($last_visit), 'S_CUSTOM_FIELDS' => isset($cp_row['row']) && sizeof($cp_row['row']) ? true : false)); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { $memberrow = array_merge($memberrow, $cp_row['row']); } $this->template->assign_block_vars('memberrow', $memberrow); if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { $this->template->assign_block_vars('memberrow.custom_fields', $field_data); } } $row_number++; } $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $this->config['topics_per_page'], $start); $this->template->assign_vars(array('PAGE_NUMBER' => $this->pagination->on_page($total_users, $this->config['topics_per_page'], $start), 'U_SORT_POSTS' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'd', 'sd' => $sort_key == 'd' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_USERNAME' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'a', 'sd' => $sort_key == 'a' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_FROM' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'b', 'sd' => $sort_key == 'b' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_JOINED' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'c', 'sd' => $sort_key == 'c' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_THANKS_R' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'e', 'sd' => $sort_key == 'e' && $sort_dir == 'd' ? 'a' : 'd', 'tslash' => '')), 'U_SORT_THANKS_G' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'f', 'sd' => $sort_key == 'f' && $sort_dir == 'd' ? 'a' : 'd', 'tslash' => '')), 'U_SORT_ACTIVE' => $this->auth->acl_get('u_viewonline') ? $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'l', 'sd' => $sort_key == 'l' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')) : '')); } break; } // Output the page $this->template->assign_vars(array('TOTAL_USERS' => $this->user->lang('LIST_USERS', $total_users), 'U_THANKS' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('tslash' => '')), 'S_THANKS' => $sthanks)); page_header($page_title); $this->template->set_filenames(array('body' => $template_html)); make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}")); page_footer(); return new Response($this->template->return_display('body'), 200); }
} // Cache various user specific data ... so we don't have to recompute // this each time the same user appears on this page if (!isset($user_cache[$poster_id])) { if ($poster_id == ANONYMOUS) { $user_cache[$poster_id] = array('joined' => '', 'posts' => '', 'from' => '', 'sig' => '', 'sig_bbcode_uid' => '', 'sig_bbcode_bitfield' => '', 'online' => false, 'avatar' => $user->optionget('viewavatars') ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'sig' => '', 'profile' => '', 'pm' => '', 'email' => '', 'www' => '', 'icq_status_img' => '', 'icq' => '', 'aim' => '', 'msn' => '', 'yim' => '', 'jabber' => '', 'search' => '', 'age' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'warnings' => 0, 'allow_pm' => 0); get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); } else { $user_sig = ''; // We add the signature to every posters entry because enable_sig is post dependant if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) { $user_sig = $row['user_sig']; } $id_cache[] = $poster_id; $user_cache[$poster_id] = array('joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => isset($row['user_warnings']) ? $row['user_warnings'] : 0, 'from' => !empty($row['user_from']) ? $row['user_from'] : '', 'sig' => $user_sig, 'sig_bbcode_uid' => !empty($row['user_sig_bbcode_uid']) ? $row['user_sig_bbcode_uid'] : '', 'sig_bbcode_bitfield' => !empty($row['user_sig_bbcode_bitfield']) ? $row['user_sig_bbcode_bitfield'] : '', 'viewonline' => $row['user_allow_viewonline'], 'allow_pm' => $row['user_allow_pm'], 'avatar' => $user->optionget('viewavatars') ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'age' => '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'online' => false, 'profile' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u={$poster_id}"), 'www' => $row['user_website'], 'aim' => $row['user_aim'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=aim&u={$poster_id}") : '', 'msn' => $row['user_msnm'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=msnm&u={$poster_id}") : '', 'yim' => $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', 'jabber' => $row['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$poster_id}") : '', 'search' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$poster_id}&sr=posts") : ''); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) { $user_cache[$poster_id]['email'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$poster_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $row['user_email']); } else { $user_cache[$poster_id]['email'] = ''; } if (!empty($row['user_icq'])) { $user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq']; $user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />'; } else { $user_cache[$poster_id]['icq_status_img'] = ''; $user_cache[$poster_id]['icq'] = ''; } if ($config['allow_birthdays'] && !empty($row['user_birthday'])) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); if ($bday_year) {
/** * Prepare profile data */ function show_profile($data) { global $config, $auth, $template, $user, $phpEx, $phpbb_root_path; $username = $data['username']; $user_id = $data['user_id']; $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($data['user_rank'], $user_id == ANONYMOUS ? false : $data['user_posts'], $rank_title, $rank_img, $rank_img_src); if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_user')) { $email = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=email&u=' . $user_id) : ($config['board_hide_emails'] && !$auth->acl_get('a_user') ? '' : 'mailto:' . $data['user_email']); } else { $email = ''; } if ($config['load_onlinetrack']) { $update_time = $config['load_online_time'] * 60; $online = time() - $update_time < $data['session_time'] && (isset($data['session_viewonline']) && $data['session_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false; } else { $online = false; } if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) { $last_visit = !empty($data['session_time']) ? $data['session_time'] : $data['user_lastvisit']; } else { $last_visit = ''; } $age = ''; if ($config['allow_birthdays'] && $data['user_birthday']) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); if ($bday_year) { $now = getdate(time() + $user->timezone + $user->dst - date('Z')); $diff = $now['mon'] - $bday_month; if ($diff == 0) { $diff = $now['mday'] - $bday_day < 0 ? 1 : 0; } else { $diff = $diff < 0 ? 1 : 0; } $age = (int) ($now['year'] - $bday_year - $diff); } } // Dump it out to the template return array('AGE' => $age, 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($data['user_regdate']), 'VISITED' => empty($last_visit) ? ' - ' : $user->format_date($last_visit), 'POSTS' => $data['user_posts'] ? $data['user_posts'] : 0, 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), 'AVATAR_IMG' => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']), 'ONLINE_IMG' => !$config['load_onlinetrack'] ? '' : ($online ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => $config['load_onlinetrack'] && $online ? true : false, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'ICQ_STATUS_IMG' => !empty($data['user_icq']) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '', 'S_JABBER_ENABLED' => $config['jab_enable'] ? true : false, 'U_SEARCH_USER' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$user_id}&sr=posts") : '', 'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', 'U_WARN' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', 'U_PM' => $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => !empty($data['user_website']) ? $data['user_website'] : '', 'U_SHORT_WWW' => !empty($data['user_website']) ? strlen($data['user_website']) > 55 ? substr($data['user_website'], 0, 39) . ' ... ' . substr($data['user_website'], -10) : $data['user_website'] : '', 'U_ICQ' => $data['user_icq'] ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '', 'U_AIM' => $data['user_aim'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=aim&u=' . $user_id) : '', 'U_YIM' => $data['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&.src=pg' : '', 'U_MSN' => $data['user_msnm'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=msnm&u=' . $user_id) : '', 'U_JABBER' => $data['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=jabber&u=' . $user_id) : '', 'LOCATION' => $data['user_from'] ? $data['user_from'] : '', 'USER_ICQ' => $data['user_icq'], 'USER_AIM' => $data['user_aim'], 'USER_YIM' => $data['user_yim'], 'USER_MSN' => $data['user_msnm'], 'USER_JABBER' => $data['user_jabber'], 'USER_JABBER_IMG' => $data['user_jabber'] ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', 'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username)); }
/** * Get user data * * grabs the data on the user and places it in the self::$user array * * @param int|bool $id The user_id (or multiple user_ids if given an array) of the user we want to grab the data for * @param bool $user_queue If user_queue is true then we just grab the user_ids from the user_queue, otherwise we select data from $id. */ public function get_user_data($id, $user_queue = false, $username = false) { global $user, $db, $phpbb_root_path, $phpEx, $config, $auth, $cp; // if we are using the user_queue, set $user_id as that for consistency if ($user_queue) { $id = self::$user_queue; } blog_plugins::plugin_do('user_data_start'); // this holds the user_id's we will query $users_to_query = array(); // if the $user_id isn't an array, make it one for consistency if (!is_array($id)) { $id = array(intval($id)); } if ($username) { $sql = 'SELECT user_id FROM ' . USERS_TABLE . ' WHERE username_clean = \'' . $db->sql_escape(utf8_clean_string($username)) . '\''; $result = $db->sql_query($sql); $id[] = $db->sql_fetchfield('user_id', $result); $db->sql_freeresult($result); } if (!sizeof($id)) { return; } $id[] = 1; foreach ($id as $i) { if ($i && !isset(self::$user[$i]) && !in_array($i, $users_to_query)) { $users_to_query[] = (int) $i; } } if (!sizeof($users_to_query)) { return; } // Grab all profile fields from users in id cache for later use - similar to the poster cache if ($config['user_blog_custom_profile_enable']) { if (!class_exists('custom_profile')) { include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx; $cp = new custom_profile(); } $profile_fields_cache = $cp->generate_profile_fields_template('grab', $users_to_query); } // Grab user status information $status_data = array(); $sql = 'SELECT session_user_id, MAX(session_time) AS online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' WHERE ' . $db->sql_in_set('session_user_id', $users_to_query) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $status_data[$row['session_user_id']] = $row; } $db->sql_freeresult($result); $update_time = $config['load_online_time'] * 60; // Get the rest of the data on the users and parse everything we need $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $users_to_query); blog_plugins::plugin_do_ref('user_data_sql', $sql); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $user_id = $row['user_id']; blog_plugins::plugin_do_ref('user_data_while', $row); // view profile link $row['view_profile'] = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . $user_id); // Full username, with colour $row['username_full'] = get_username_string('full', $user_id, $row['username'], $row['user_colour']); // format the color correctly $row['user_colour'] = get_username_string('colour', $user_id, $row['username'], $row['user_colour']); // Avatar $row['avatar'] = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']); // Rank get_user_rank($row['user_rank'], $row['user_posts'], $row['rank_title'], $row['rank_img'], $row['rank_img_src']); if ($row['user_type'] != USER_IGNORE && $row['user_id'] != ANONYMOUS) { // Online/Offline Status $row['status'] = isset($status_data[$user_id]) && time() - $update_time < $status_data[$user_id]['online_time'] && ($status_data[$user_id]['viewonline'] && $row['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false; // IM Links $row['aim_url'] = $row['user_aim'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=aim&u={$user_id}") : ''; $row['icq_url'] = $row['user_icq'] ? 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'] : ''; $row['jabber_url'] = $row['user_jabber'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$user_id}") : ''; $row['msn_url'] = $row['user_msnm'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=msnm&u={$user_id}") : ''; $row['yim_url'] = $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg' : ''; // PM and email links $row['email_url'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$user_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $row['user_email']); $row['pm_url'] = $row['user_id'] != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&mode=compose&u={$user_id}") : ''; // get the custom profile fields if the admin wants them if ($config['user_blog_custom_profile_enable']) { $row['cp_row'] = isset($profile_fields_cache[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array(); } } else { $row = array_merge($row, array('status' => false, 'aim_url' => '', 'icq_url' => '', 'jabber_url' => '', 'msn_url' => '', 'yim_url' => '', 'email_url' => '', 'pm_url' => '')); } // now lets put everything in the user array self::$user[$user_id] = $row; } $db->sql_freeresult($result); unset($status_data, $row); // if we did use the user_queue, reset it if ($user_queue) { self::$user_queue = array(); } if ($username) { if (isset($user_id) && $user_id != ANONYMOUS) { // Grab all profile fields from users in id cache for later use - similar to the poster cache if ($config['user_blog_custom_profile_enable']) { if (!class_exists('custom_profile')) { include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx; $cp = new custom_profile(); } $profile_fields_cache = $cp->generate_profile_fields_template('grab', $user_id); } // Grab user status information $status_data = array(); $sql = 'SELECT session_user_id, MAX(session_time) AS online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . intval($user_id) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $status_data[$row['session_user_id']] = $row; } $db->sql_freeresult($result); $update_time = $config['load_online_time'] * 60; self::$user[$user_id]['status'] = isset($status_data[$user_id]) && time() - $update_time < $status_data[$user_id]['online_time'] && ($status_data[$user_id]['viewonline'] && $row['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false; unset($status_data); return $user_id; } else { return false; } } else { // replace any non-existing users with the anonymous user. foreach ($id as $i) { if ($i && !array_key_exists($i, self::$user)) { self::$user[$i] = self::$user[1]; } } } }
function get_my_comments($goods_id, $type = 0, $page = 1) { $res = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('goods_tag') . " WHERE goods_id = '{$goods_id}' AND state = 1"); foreach ($res as $v) { $tags[$v['tag_id']] = $v['tag_name']; } if ($type != 4) { if ($type == 1) { $where .= " AND c.comment_rank in (5,4)"; } if ($type == 2) { $where .= " AND c.comment_rank in (3,2)"; } if ($type == 3) { $where .= " AND c.comment_rank = 1"; } if ($type == 4) { $where .= " AND s.shaidan_id > 0"; } $count = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('comment') . " AS c \n\t\t\t\t\t\t\t\t\t\t LEFT JOIN " . $GLOBALS['ecs']->table('shaidan') . " AS s ON c.rec_id=s.rec_id\n\t\t\t\t\t\t\t\t\t\t WHERE c.id_value = '{$goods_id}' AND c.status = 1 AND c.comment_rank > 0 {$where}"); $size = 20; $page_count = $count > 0 ? intval(ceil($count / $size)) : 1; $sql = "SELECT c.*, s.shaidan_id, s.title, s.message as shaidan_message, s.status AS shaidan_status FROM " . $GLOBALS['ecs']->table('comment') . " AS c \n\t\t\t\tLEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON c.user_id=u.user_id\n\t\t\t\tLEFT JOIN " . $GLOBALS['ecs']->table('shaidan') . " AS s ON c.rec_id=s.rec_id\n\t\t\t\tWHERE c.id_value = '{$goods_id}' AND c.status = 1 AND c.comment_rank > 0 {$where} ORDER BY c.add_time DESC"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $points_list = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['add_time_str'] = date("Y-m-d", $row['add_time']); $row['buy_time_str'] = date("Y-m-d", $row['buy_time']); $row['user_rank'] = get_user_rank($row['user_id']); if ($row['shaidan_id'] > 0 && $row['shaidan_status'] == 1) { $row['shaidan_imgs'] = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('shaidan_img') . " WHERE shaidan_id = '{$row['shaidan_id']}'"); $row['shaidan_imgs_num'] = count($row['shaidan_imgs']); } if ($row['comment_tag']) { $comment_tag = explode(',', $row['comment_tag']); foreach ($comment_tag as $tag_id) { $row['tags'][] = $tags[$tag_id]; } } $parent_res = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('comment') . " WHERE parent_id = '" . $row['comment_id'] . "'"); $row['comment_reps'] = $parent_res; $item_list[] = $row; } $arr = array(); $arr['item_list'] = $item_list; $arr['page'] = $page; $arr['count'] = $count; $arr['size'] = $size; $arr['page_count'] = $page_count; $next = $page + 1; $prev = $page - 1; $arr['page_prev'] = "ShowMyComments({$goods_id},{$type},{$prev})"; $arr['page_next'] = "ShowMyComments({$goods_id},{$type},{$next})"; // for ($i = 1 ; $i <= $page_count ; $i ++) // { // $arr['page_number'][$i] = "ShowMyComments($goods_id,$type,$i)"; // } // return $arr; } else { $count = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('shaidan') . " AS s \n\t\t\t\t\t\t\t\t\t\t WHERE s.goods_id = '{$goods_id}' AND s.status = 1"); $size = 20; $page_count = $count > 0 ? intval(ceil($count / $size)) : 1; $sql = "SELECT s.*, u.user_name, c.comment_tag, c.comment_rank, c.comment_id FROM " . $GLOBALS['ecs']->table('shaidan') . " AS s \n\t\t\t\tLEFT JOIN " . $GLOBALS['ecs']->table('users') . " AS u ON s.user_id=u.user_id\n\t\t\t\tLEFT JOIN " . $GLOBALS['ecs']->table('comment') . " AS c ON c.rec_id=s.rec_id\n\t\t\t\tWHERE s.goods_id = '{$goods_id}' AND s.status = 1 ORDER BY s.add_time DESC"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $points_list = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['buy_time'] = $GLOBALS['db']->getOne("SELECT o.add_time FROM " . $GLOBALS['ecs']->table('order_info') . " AS o\n\t\t\t\t\t\t\t\t\t\t\t\t\t LEFT JOIN " . $GLOBALS['ecs']->table('order_goods') . " AS og ON o.order_id=og.order_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE og.rec_id = '{$row['rec_id']}'"); $row['add_time_str'] = date("Y-m-d", $row['add_time']); $row['buy_time_str'] = date("Y-m-d", $row['buy_time']); $row['user_rank'] = get_user_rank($row['user_id']); if ($row['shaidan_id'] > 0) { $row['shaidan_imgs'] = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('shaidan_img') . " WHERE shaidan_id = '{$row['shaidan_id']}'"); $row['shaidan_imgs_num'] = count($row['shaidan_imgs']); } if ($row['comment_tag']) { $comment_tag = explode(',', $row['comment_tag']); foreach ($comment_tag as $tag_id) { $row['tags'][] = $tags[$tag_id]; } } $row['content'] = $row['message']; $row['hide_gnum'] = 1; if ($row['comment_id'] > 0) { $parent_res = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('comment') . " WHERE parent_id = '{$row['comment_id']}'"); $row['comment_reps'] = $parent_res; } $item_list[] = $row; } $arr = array(); $arr['item_list'] = $item_list; $arr['page'] = $page; $arr['count'] = $count; $arr['size'] = $size; $arr['page_count'] = $page_count; for ($i = 1; $i <= $page_count; $i++) { $arr['page_number'][$i] = "ShowMyComments({$goods_id},{$type},{$i})"; } return $arr; } }
echo $json->encode($result); exit; } if ($_REQUEST['act'] == 'view') { $rec_id = intval($_REQUEST['id']); $cache_id = sprintf('%X', crc32($_REQUEST['id'] . 'goods_comment_view')); if (!$smarty->is_cached('goods_comment_view.dwt', $cache_id)) { $comment = $db->getRow("SELECT * FROM " . $ecs->table('comment') . " WHERE rec_id = '{$rec_id}'"); $goods_id = $comment['id_value']; $res = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('goods_tag') . " WHERE goods_id = '{$goods_id}'"); foreach ($res as $v) { $tags[$v['tag_id']] = $v['tag_name']; } $comment['add_time_str'] = date("Y-m-d", $comment['add_time']); $comment['buy_time_str'] = date("Y-m-d", $comment['buy_time']); $comment['user_rank'] = get_user_rank($comment['user_id']); if ($comment['shaidan_id'] > 0) { $comment['shaidan_imgs'] = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('shaidan_img') . " WHERE shaidan_id = '{$comment['shaidan_id']}'"); } if ($comment['comment_tag']) { $comment_tag = explode(',', $comment['comment_tag']); foreach ($comment_tag as $tag_id) { $comment['tags'][] = $tags[$tag_id]; } } $smarty->assign('comment', $comment); /* 获得商品的信息 */ $goods = get_goods_info($goods_id); if ($goods === false) { /* 如果没有找到任何记录则跳回到首页 */ ecs_header("Location: ./\n");
/** * Handles warning the user */ function mcp_warn_user_view($action) { global $phpEx, $phpbb_root_path, $config, $module; global $template, $db, $user, $auth, $request; $user_id = $request->variable('u', 0); $username = $request->variable('username', '', true); $notify = isset($_REQUEST['notify_user']) ? true : false; $warning = $request->variable('warning', '', true); $warn_len = $request->variable('warnlength', 0); $warn_len_other = $request->variable('warnlengthother', ''); $warn_type = $request->variable('warntype', WARNING); $warning_id = $request->variable('warn_id', 0); $sql_where = $user_id ? "user_id = {$user_id}" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $sql_where; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$user_row) { trigger_error('NO_USER'); } // Prevent someone from warning themselves if ($user_row['user_id'] == $user->data['user_id']) { trigger_error('CANNOT_WARN_SELF'); } // Prevent someone from warning founder if ($user_row['user_type'] == USER_FOUNDER) { trigger_error('CANNOT_WARN_FOUNDER'); } $user_id = $user_row['user_id']; $warning_edit = array(); if ($warning_id) { $sql = 'SELECT w.*, l.log_data FROM ' . WARNINGS_TABLE . ' w, ' . LOG_TABLE . " l \n\t\t\t\tWHERE w.warning_id = '{$warning_id}'\n\t\t\t\t\tAND l.log_id = w.log_id"; $result = $db->sql_query($sql); $warning_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$warning_row) { trigger_error('NO_WARNING'); } if (!$warning_row['warning_status']) { trigger_error('WARNING_EXPIRED'); } $warning_edit = unserialize($warning_row['log_data']); } if (strpos($this->u_action, "&u={$user_id}") === false) { $this->p_master->adjust_url('&u=' . $user_id); $this->u_action .= "&u={$user_id}"; } // Check if can send a notification if ($config['allow_privmsg']) { $auth2 = new \phpbb\auth\auth(); $auth2->acl($user_row); $s_can_notify = $auth2->acl_get('u_readpm') ? true : false; unset($auth2); } else { $s_can_notify = false; } // Prevent against clever people if ($notify && !$s_can_notify) { $notify = false; } if (!$warning_id && !$user_row['user_ban_id'] && $user_row['user_warnings'] + 1 == $config['warnings_for_ban']) { $warn_type = WARNING_BAN; $warning = $user->lang('WARNING_BAN', (int) $user_row['user_warnings'] + 1, $warning); } if ($warning && $action == 'add_warning') { if (check_form_key('mcp_warn')) { if (!function_exists('user_ban')) { include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx; } if ($warning_id) { $this->edit_warning($warning_row, $user_row, $warning, $warn_len, $warn_len_other, $warn_type); $msg = $user->lang['USER_WARNING_EDITED'] . ($warn_type == BAN ? '<br /><br />' . $user->lang['BAN_UPDATE_SUCCESSFUL'] : ''); $email_template = 'warning_edited'; } else { $this->add_warning($user_row, $warning, $warn_len, $warn_len_other, $warn_type, $notify); $msg = $user->lang['USER_WARNING_ADDED']; $email_template = 'warning_user'; if ($warn_type == BAN) { $ban = utf8_normalize_nfc($user_row['username']); user_ban('user', $ban, $warn_len, $warn_len_other, 0, $warning, $warning); $msg .= '<br /><br />' . $user->lang['BAN_UPDATE_SUCCESSFUL']; $email_template = 'warning_user_ban'; } else { if ($warn_type == WARNING_BAN) { $ban = utf8_normalize_nfc($user_row['username']); $user_ban_id = (int) user_ban('user', $ban, 0, 0, 0, $warning, $warning); if ($user_ban_id) { $sql = 'UPDATE ' . USERS_TABLE . "\tSET user_ban_id = {$user_ban_id}\n\t\t\t\t\t\t\t\tWHERE user_id = " . $user_row['user_id']; $db->sql_query($sql); $msg .= '<br /><br />' . $user->lang['BAN_UPDATE_SUCCESSFUL']; } $email_template = 'warning_ban_by_warning'; } } } // Notify user about warning/ban if ($notify) { $user->add_lang('acp/ban'); $length = $this->get_warning_end($warn_len, $warn_len_other); $assign_vars_array = array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'TO_USERNAME' => htmlspecialchars_decode($user_row['username']), 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), 'WARNINGS_COUNT' => htmlspecialchars_decode($config['warnings_for_ban']), 'WARNING' => htmlspecialchars_decode($warning), 'WARNING_POSTER' => htmlspecialchars_decode($user->data['username']), 'WARNING_LENGTH' => $length ? htmlspecialchars_decode($user->format_date($length, $user_row['user_dateformat'])) : htmlspecialchars_decode($user->lang['PERMANENT']), 'WARNING_TYPE' => $warn_type == BAN ? htmlspecialchars_decode($user->lang['BAN']) : htmlspecialchars_decode($user->lang['WARNING']), 'WARNING_TYPE_OLD' => $warning_id ? $warning_row['warning_type'] == BAN ? htmlspecialchars_decode($user->lang['BAN']) : htmlspecialchars_decode($user->lang['WARNING']) : '', 'WARNING_LENGTH_OLD' => $warning_id ? $warning_row['warning_end'] ? htmlspecialchars_decode($user->format_date($warning_row['warning_end'], $user_row['user_dateformat'])) : htmlspecialchars_decode($user->lang['PERMANENT']) : '', 'WARNING_OLD' => isset($warning_edit[0]) ? $warning_edit[0] : ''); $this->user_notify($email_template, $user_row, $assign_vars_array, "{$phpbb_root_path}ext/rxu/AdvancedWarnings/language/{$user_row['user_lang']}/email"); } } else { $msg = $user->lang['FORM_INVALID']; } $redirect = append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=notes&mode=user_notes&u={$user_id}"); meta_refresh(2, $redirect); trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); } // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) { include $phpbb_root_path . 'includes/functions.' . $phpEx; } if (!function_exists('get_user_rank')) { include $phpbb_root_path . 'includes/functions_display.' . $phpEx; } get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); $avatar_img = phpbb_get_user_avatar($user_row); if (isset($warning_row['warning_type'])) { $this->select_warn_type($warning_row['warning_type']); } else { $this->select_warn_type(); } if (isset($warning_row['warning_end']) && $warning_row['warning_end']) { $this->display_warn_options('-1'); } else { $this->display_warn_options(); } // OK, they didn't submit a warning so lets build the page for them to do so $template->assign_vars(array('U_POST_ACTION' => $this->u_action, 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => $user_row['user_posts'] ? $user_row['user_posts'] : 0, 'WARNINGS' => $user_row['user_warnings'] ? $user_row['user_warnings'] : 0, 'WARNING' => isset($warning_edit[0]) ? $warning_edit[0] : '', 'WARNING_ID' => isset($warning_row['warning_id']) ? $warning_row['warning_id'] : '', 'WARNING_END' => isset($warning_row['warning_end']) ? $warning_row['warning_end'] ? $user->format_date($warning_row['warning_end'], 'Y-m-d') : '' : '', 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $rank_img, 'S_CAN_NOTIFY' => $s_can_notify)); return $user_id; }
/** * Prepare profile data */ function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false) { global $config, $auth, $template, $user, $phpEx, $phpbb_root_path; $username = $data['username']; $user_id = $data['user_id']; $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src); // START needed for PBWoW $pbwow_config = obtain_pbwow_config(); $cfg_blizz_ranks = array(); $cfg_blizz_ranks = explode(',', $pbwow_config['pbwow_blizz_ranks']); $cfg_propass_ranks = array(); $cfg_propass_ranks = explode(',', $pbwow_config['pbwow_propass_ranks']); if(isset($cfg_blizz_ranks) && strlen($cfg_blizz_ranks > 0) && ($pbwow_config['pbwow_blizz_enable'])) { $rank_blizz = (in_array($data['user_rank'], $cfg_blizz_ranks)) ? true : false; } if(isset($cfg_propass_ranks) && strlen($cfg_propass_ranks > 0) && ($pbwow_config['pbwow_propass_enable']) && !($rank_blizz == true)) { $rank_propass = (in_array($data['user_rank'], $cfg_propass_ranks)) ? true : false; } // Just gonna copy the current 'primary' rank into the special one, so the current one can be overwritten without losing the previous one. $special_rank_title = $special_rank_img = $special_rank_img_src = ''; if(!empty($data['user_rank'])){ $special_rank_title = $rank_title; $special_rank_img = $rank_img; $special_rank_img_src = $rank_img_src; $rank_title = $rank_img = $rank_img_src = ''; } // Now we get all the 'secondary' ranks (based on post count etc.) and put them in the place of the user ranks. Switcharooh! get_user_additional_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src); // END needed for PBWoW if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_user')) { $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']); } else { $email = ''; } if ($config['load_onlinetrack']) { $update_time = $config['load_online_time'] * 60; $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; } else { $online = false; } if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) { $last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; } else { $last_visit = ''; } $age = ''; if ($config['allow_birthdays'] && $data['user_birthday']) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); if ($bday_year) { $now = getdate(time() + $user->timezone + $user->dst - date('Z')); $diff = $now['mon'] - $bday_month; if ($diff == 0) { $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; } else { $diff = ($diff < 0) ? 1 : 0; } $age = (int) ($now['year'] - $bday_year - $diff); } } // Dump it out to the template return array( 'AGE' => $age, 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($data['user_regdate']), 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), 'AVATAR_IMG' => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']), 'AVATAR_IMG_SRC' => get_user_avatar_src($data['user_avatar'], $data['user_avatar_type']), // for PBWoW 'SPECIAL_RANK_TITLE' => $special_rank_title, // for PBWoW 'SPECIAL_RANK_IMG' => $special_rank_img, // for PBWoW 'SPECIAL_RANK_IMG_SRC' => $special_rank_img_src, // for PBWoW 'RANK_BLIZZ' => $rank_blizz, // for PBWoW 'RANK_PROPASS' => $rank_propass, // for PBWoW 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '', 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '', 'U_SHORT_WWW' => (!empty($data['user_website'])) ? ((strlen($data['user_website']) > 55) ? substr($data['user_website'], 0, 39) . ' ... ' . substr($data['user_website'], -10) : $data['user_website']) : '', 'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '', 'U_AIM' => ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $user_id) : '', 'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&.src=pg' : '', 'U_MSN' => ($data['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $user_id) : '', 'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '', 'LOCATION' => ($data['user_from']) ? $data['user_from'] : '', 'USER_ICQ' => $data['user_icq'], 'USER_AIM' => $data['user_aim'], 'USER_YIM' => $data['user_yim'], 'USER_MSN' => $data['user_msnm'], 'USER_JABBER' => $data['user_jabber'], 'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', 'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username), ); }
/** * {@inheritdoc} */ public function get_template_side($module_id) { switch ($this->db->get_sql_layer()) { case 'postgres': $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . ' AND user_type <> ' . USER_INACTIVE . ' ORDER BY RANDOM()'; break; case 'mssql': case 'mssql_odbc': $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . ' AND user_type <> ' . USER_INACTIVE . ' ORDER BY NEWID()'; break; default: $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . ' AND user_type <> ' . USER_INACTIVE . ' ORDER BY RAND()'; break; } $result = $this->db->sql_query_limit($sql, 1); $row = $this->db->sql_fetchrow($result); $avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($row, 'user'), 'USER_AVATAR'); $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src); $username = $row['username']; $user_id = (int) $row['user_id']; $colour = $row['user_colour']; $this->template->assign_block_vars('random_member', array('USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour), 'USERNAME' => get_username_string('username', $user_id, $username, $colour), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour), 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'USER_POSTS' => (int) $row['user_posts'], 'AVATAR_IMG' => $avatar_img, 'JOINED' => $this->user->format_date($row['user_regdate']))); $this->db->sql_freeresult($result); return 'random_member_side.html'; }
/** * Prepare profile data */ function show_profile($data) { global $config, $auth, $template, $user, $phpEx, $phpbb_root_path; $username = $data['username']; $user_id = $data['user_id']; $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src); if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email')) { $email = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=email&u=' . $user_id) : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $data['user_email']); } else { $email = ''; } $last_visit = !empty($data['session_time']) ? $data['session_time'] : $data['user_lastvisit']; $update_time = $config['load_online_time'] * 60; $online = time() - $update_time < $data['session_time'] && (isset($data['session_viewonline']) && $data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false; // Dump it out to the template return array('USERNAME' => $username, 'USER_COLOR' => !empty($data['user_colour']) ? $data['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => $user->format_date($data['user_regdate']), 'VISITED' => empty($last_visit) ? ' - ' : $user->format_date($last_visit), 'POSTS' => $data['user_posts'] ? $data['user_posts'] : 0, 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, 'ONLINE_IMG' => $online ? $user->img('btn_online', 'ONLINE') : $user->img('btn_offline', 'OFFLINE'), 'S_ONLINE' => $online ? true : false, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'ICQ_STATUS_IMG' => !empty($data['user_icq']) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '', 'S_JABBER_ENABLED' => $config['jab_enable'] ? true : false, 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&u=' . $user_id), 'U_SEARCH_USER' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$user_id}&sr=posts") : '', 'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', 'U_WARN' => $auth->acl_getf_global('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', 'U_PM' => $auth->acl_get('u_sendpm') ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => !empty($data['user_website']) ? $data['user_website'] : '', 'U_ICQ' => $data['user_icq'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=icq&u=' . $user_id) : '', 'U_AIM' => $data['user_aim'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=aim&u=' . $user_id) : '', 'U_YIM' => $data['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $data['user_yim'] . '&.src=pg' : '', 'U_MSN' => $data['user_msnm'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=msnm&u=' . $user_id) : '', 'U_JABBER' => $data['user_jabber'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=jabber&u=' . $user_id) : '', 'LOCATION' => $data['user_from'] ? $data['user_from'] : '', 'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username), 'S_ONLINE' => $online ? true : false); }
* @license GNU General Public License, version 2 (GPL-2.0) * */ if (!defined('IN_PHPBB')) { exit; } global $k_config, $k_blocks, $template, $user; $this->template = $template; $this->user = $user; $total_queries = $queries = $cached_queries = 0; $rank_title = $rank_img = $rank_img_src = ''; if (!function_exists('get_user_rank')) { include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext; } foreach ($k_blocks as $blk) { if ($blk['html_file_name'] == 'block_user_information.html') { $block_cache_time = $blk['block_cache_time']; break; } } $block_cache_time = isset($block_cache_time) ? $block_cache_time : $k_config['k_block_cache_time_default']; get_user_rank($this->user->data['user_rank'], $this->user->data['user_id'] == ANONYMOUS ? false : $this->user->data['user_posts'], $rank_title, $rank_img, $rank_img_src); // Generate logged in/logged out status if ($this->user->data['user_id'] != ANONYMOUS) { $u_login_logout = append_sid("{$this->phpbb_root_path}ucp.{$phpEx}", 'mode=logout', true, $this->user->session_id); $l_login_logout = sprintf($this->user->lang['LOGOUT_USER'], $this->user->data['username']); } else { $u_login_logout = append_sid("{$this->phpbb_root_path}ucp.{$phpEx}", 'mode=login'); $l_login_logout = $this->user->lang['LOGIN']; } $this->template->assign_vars(array('AVATAR' => phpbb_get_user_avatar($this->user->data, $user->lang['USER_AVATAR'], false), 'WELCOME_SITE' => sprintf($this->user->lang['WELCOME_SITE'], $this->config['sitename']), 'USR_RANK_TITLE' => $rank_title, 'USR_RANK_IMG' => $rank_img, 'U_LOGIN_LOGOUT' => $u_login_logout, 'L_LOGIN_LOGOUT' => $l_login_logout, 'S_LOGIN_ACTION' => append_sid("{$this->phpbb_root_path}ucp.{$phpEx}", 'mode=login')));
$sql_array['WHERE'] = $db->sql_in_set('u.user_id', $where); $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query_limit($sql, $top, $start); if (!$row = $db->sql_fetchrow($result)) { trigger_error('NO_USER'); } else { do { $last_visit = $row['user_lastvisit']; $user_id = $row['user_id']; $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($row['user_rank'], (($user_id == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src); $sthanks = true; $template->assign_block_vars('memberrow', array( 'ROW_NUMBER' => $row_number + ($start + 1), 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'GIVENS' => (!isset($givens[$user_id])) ? 0 : $givens[$user_id], 'RECEIVED' => (!isset($reseved[$user_id])) ? 0 : $reseved[$user_id], 'JOINED' => $user->format_date($row['user_regdate']), 'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit), 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0, 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
public function youyi() { $widget['jquery-ui'] = true; $this->assign("widget", $widget); $this->position_id = get_position_id(); $this->user_rank = get_user_rank(); $this->flow = M('flow')->where('type = 90 ')->limit(6)->order('id desc')->select(); //begin 评优异 流程图 $flow1 = M('flow')->where('type = 90 ')->limit(1)->order('id desc')->select(); //and user_id='.get_user_id() if (!empty($flow1)) { $this->step1 = 1; //第一步 $this->flowid = $flow1[0]['id']; if ($flow1[0]['step'] == 40) { $this->step2 = 1; //第二步, 完成 } else { $this->step2 = 0; //第二步, 完成 } } // end $this->display(); }
/** * Assign user details * * @param int $user_id * @param string $prefix Prefix to assign to the user details * @param bool $output_to_template True to output the data to the template */ public static function assign_details($user_id, $prefix = '', $output_to_template = false) { $row = self::get_user($user_id); $user_id = $row['user_id']; // Re-assign properly...in case it gives us the anonymous user phpbb::_include('functions_display', 'get_user_rank'); // IT'S A HACK! global $phpbb_root_path; $phpbb_root_path = titania::$absolute_board; // Get user rank and avatar (need hacks for this) get_user_rank($row['user_rank'], $row['user_posts'], $row['rank_title'], $row['rank_image'], $row['rank_image_src']); // Undo $phpbb_root_path = PHPBB_ROOT_PATH; $output = array($prefix . 'USER_FULL' => self::get_user($user_id, '_full'), $prefix . 'USER_COLOUR' => self::get_user($user_id, '_colour'), $prefix . 'USERNAME' => self::get_user($user_id, '_username'), $prefix . 'RANK_TITLE' => $row['rank_title'], $prefix . 'RANK_IMG' => $row['rank_image'], $prefix . 'RANK_IMG_SRC' => $row['rank_image_src'], $prefix . 'USER_JOINED' => phpbb::$user->format_date($row['user_regdate']), $prefix . 'USER_POSTS' => $row['user_posts'], $prefix . 'USER_FROM' => $row['user_from'], $prefix . 'USER_AVATAR' => self::get_user($user_id, '_avatar'), $prefix . 'USER_WARNINGS' => $row['user_warnings'], $prefix . 'USER_SIG' => self::get_user($user_id, '_signature'), $prefix . 'ICQ_STATUS_IMG' => self::get_user($user_id, '_icq_status'), $prefix . 'ONLINE_IMG' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$user->img('icon_user_offline', 'OFFLINE') : '', $prefix . 'S_ONLINE' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] : false, $prefix . 'S_FRIEND' => isset($row['friend']) ? true : false, $prefix . 'S_FOE' => isset($row['foe']) ? true : false, $prefix . 'U_USER_PROFILE' => self::get_user($user_id, '_profile'), $prefix . 'U_SEARCH' => phpbb::$auth->acl_get('u_search') ? phpbb::append_sid('search', "author_id={$user_id}&sr=posts") : '', $prefix . 'U_PM' => self::get_user($user_id, '_u_pm'), $prefix . 'U_EMAIL' => self::get_user($user_id, '_u_email'), $prefix . 'U_WWW' => $row['user_website'], $prefix . 'U_ICQ' => self::get_user($user_id, '_icq'), $prefix . 'U_AIM' => self::get_user($user_id, '_aim'), $prefix . 'U_MSN' => self::get_user($user_id, '_msnm'), $prefix . 'U_YIM' => self::get_user($user_id, '_yim'), $prefix . 'U_JABBER' => self::get_user($user_id, '_jabber')); if ($output_to_template) { phpbb::$template->assign_vars($output); } return $output; }
)</a></div> <div class="tab_body p5"> <table class="cm_list" cellspacing="15"> <tbody> <?php $_from = $this->_var['comments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $this->push_vars('', 'comment'); if (count($_from)) { foreach ($_from as $this->_var['comment']) { ?> <tr> <td class="td1"><div class="img" style="padding-left:20px"><a class="red" target="_blank"><img src="themes/meilele/images/noavatar_middle<?php $_from = get_user_rank($GLOBALS[smarty]->_var[comment][username]); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $this->push_vars('', 'user_rank'); if (count($_from)) { foreach ($_from as $this->_var['user_rank']) { } } unset($_from); $this->pop_vars(); ?> .gif"></a></div> <div class="info c"><a class="red" target="_blank"><?php if ($this->_var['comment']['username']) { echo htmlspecialchars($this->_var['comment']['username']);
function main($id, $mode) { global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $filename; $template->assign_vars(array( 'S_GALLERY' => true, )); $template_root = 'gallery/'; $cat_id = request_var('c', 0); $gallery_id = request_var('g', 0); $user_id = request_var('u', 0); $username = request_var('un', '', true); $start = request_var('start', 0); $photo_id = request_var('p', 0); $submit = isset($_REQUEST['submit']) ? true : false; define('USER_GALLERIES', 1); define('GALLERY_UPLOAD', 1); //define the extensions we need to grab $sql = 'SELECT e.extension FROM ' . EXTENSIONS_TABLE . ' e LEFT JOIN ' . EXTENSION_GROUPS_TABLE . " eg ON (eg.group_id = e.group_id) WHERE eg.group_name = 'Images'"; $result = $db->sql_query($sql); $extensions = ''; while ($row = $db->sql_fetchrow($result)) { $extensions .= (!$extensions) ? "'{$row['extension']}'" : ", '{$row['extension']}'"; } $db->sql_freeresult($result); //set our multibyte to utf8 mb_internal_encoding("UTF-8"); // Set desired template $this->tpl_name = $template_root . $mode; $this->page_title = $user->lang['GALLERY_' . strtoupper($mode)] . ' ' . $user->lang['PHOTOS']; $template->assign_vars(array( 'WHOS_PHOTOS' => $user->lang['GALLERY_' . strtoupper($mode)] . ' ' . $user->lang['PHOTOS'], )); $this->u_action = str_replace("&mode=$mode", '', $this->u_action); switch ($mode) { case 'browse': //select information about the gallery we're in if (!$cat_id && !$gallery_id) { if ($gallery_id) { $sql = 'SELECT * FROM ' . GALLERY_TABLE . " WHERE gallery_id = $gallery_id"; } else if ($user_id) { $sql = 'SELECT * FROM ' . GALLERY_TABLE . " WHERE user_id = $user_id"; } else if ($username) { $sql = 'SELECT g.* FROM ' . GALLERY_TABLE . ' g, ' . USERS_TABLE . " u WHERE u.username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "' AND g.user_id = u.user_id"; } } else { $sql = 'SELECT * FROM ' . GALLERY_TABLE . " WHERE gallery_id = $cat_id"; } $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $gallery = array( 'gallery_id' => isset($row['gallery_id']) ? $row['gallery_id'] : 0, 'user_id' => isset($row['user_id']) ? $row['user_id'] : 0, 'parent_id' => isset($row['parent_id']) ? $row['parent_id'] : 0, 'left_id' => isset($row['left_id']) ? $row['left_id'] : 0, 'right_id' => isset($row['right_id']) ? $row['right_id'] : 0, 'gallery_name' => isset($row['gallery_name']) ? $row['gallery_name'] : 'gallery', 'gallery_desc' => isset($row['gallery_desc']) ? $row['gallery_desc'] : 'gallery', 'gallery_type' => isset($row['gallery_type']) ? $row['gallery_type'] : 0, 'gallery_last_update_time' => isset($row['gallery_last_update_time']) ? $row['gallery_last_update_time'] : 0, ); $db->sql_freeresult($result); //get list of categories under current category $sql = 'SELECT * FROM ' . GALLERY_TABLE . " WHERE parent_id = {$gallery['gallery_id']} ORDER BY left_id ASC"; //if this is a user galleries cat, grab a little differently if ($gallery['gallery_type'] == USER_GALLERIES) { $sql = 'SELECT g.*, u.username, u.user_colour FROM ' . GALLERY_TABLE . ' g, ' . USERS_TABLE .' u WHERE g.user_id <> 0 AND g.user_id = u.user_id ORDER BY u.username ASC'; } $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { if ($row['gallery_id'] != $gallery['gallery_id']) { $template->assign_block_vars('catrow', array( 'GALLERY_COMMENTS' => $row['gallery_comments'], 'GALLERY_DESC' => $row['gallery_desc'], 'GALLERY_IMAGE' => ($row['gallery_image']) ? $row['gallery_image'] : false, 'GALLERY_LAST_IMAGE_ID' => $row['gallery_last_image_id'], 'GALLERY_LAST_COMMENT_ID' => $row['gallery_last_comment_id'], 'GALLERY_LAST_UPLOADER_ID' => $row['gallery_last_uploader_id'], 'GALLERY_LAST_COMMENTOR_ID' => $row['gallery_last_comenter_id'], 'GALLERY_NAME' => $row['gallery_name'], 'GALLERY_PHOTOS' => $row['gallery_photos'], 'GALLERY_VIEWS' => $row['gallery_views'], 'U_GALLERY_LINK' => $this->u_action . "&mode=$mode&c={$row['gallery_id']}", )); } } $db->sql_freeresult($result); //if we're looking at a users gallery, grab their images $where = "a.gallery_id = {$gallery['gallery_id']}"; if ($gallery['user_id']) { $where = "a.poster_id = {$gallery['user_id']} AND a.gallery_id <> 0"; } //grab gallery information if ($gallery['gallery_id']) { //grab images for this gallery $sql = 'SELECT a.*, u.username, u.user_id, u.user_colour FROM ' . GALLERY_PHOTOS_TABLE . ' a LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = a.poster_id) WHERE $where AND a.extension IN ($extensions) ORDER BY a.filetime DESC"; $result = $db->sql_query_limit($sql, $config['images_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('imagerow', array( 'PHOTO_COMMENT' => ((mb_strlen($row['photo_comment']) > 20) ? mb_substr($row['photo_comment'], 0, 20) . '...' : $row['photo_comment']), 'PHOTO_MOUSEOVER' => (mb_strlen($row['photo_comment']) > 20) ? $row['photo_comment'] : '', 'PHOTO_NAME' => $row['photo_name'], 'COMMENT_FULL' => $row['photo_comment'], 'IMAGE_TIME' => $user->format_date($row['filetime']), 'IMAGE_VIEWS' => $row['download_count'], 'IMAGE_ID' => $row['photo_id'], 'TOPIC_ID' => ($row['thumbnail']) ? 1 : false, 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $user->lang['GUEST']), 'U_IMAGE_DOWNLOAD' => $this->u_action . "&mode=photo&p={$row['photo_id']}", 'U_IMAGE_THUMBNAIL' => append_sid("{$phpbb_root_path}photo.$phpEx", "id={$row['photo_id']}" . (($row['thumbnail']) ? '&t=1' : '')), )); $template->assign_vars(array( 'S_PHOTOS' => true, )); } //if we're looking at a users gallery, grab their images $where = "gallery_id = {$gallery['gallery_id']}"; if ($gallery['user_id']) { $where = "poster_id = {$gallery['user_id']} AND gallery_id <> 0"; } $update_photos = ''; if ($gallery['gallery_last_update_time'] < strtotime('-1 day', time()) && $gallery['gallery_id']) { //update number of images in gallery… this will be removed when this feature works properly $sql = 'SELECT COUNT(gallery_id) as total_photos FROM ' . GALLERY_PHOTOS_TABLE . " WHERE $where AND extension IN ($extensions)"; $result = $db->sql_query($sql); $gallery_photos = $db->sql_fetchfield('total_photos'); $db->sql_freeresult($result); $update_photos = ", gallery_photos = $gallery_photos, gallery_last_update_time = " . time(); } //increment the view number for this gallery $sql = 'UPDATE ' . GALLERY_TABLE . " SET gallery_views = gallery_views + 1 $update_photos WHERE gallery_id = {$gallery['gallery_id']}"; $db->sql_query($sql); } $template->assign_vars(array( 'GALLERY_NAME' => $gallery['gallery_name'], 'GALLERY_DESC' => $gallery['gallery_desc'], 'UPLOAD_ICON' => $user->img('icon_upload', 'REPLY_WITH_QUOTE'), )); break; case 'gallery': if (!$user->data['is_registered']) { // Can this user view profiles/memberlist? login_box('', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); } $sql = "SELECT * FROM " . GALLERY_PHOTOS_TABLE . " WHERE poster_id = {$user->data['user_id']} AND extension IN ($extensions) and gallery_id <> 0 ORDER BY filetime DESC"; $result = $db->sql_query_limit($sql, $config['images_per_page'], $start); $count = 0; while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('imagerow', array( 'PHOTO_COMMENT' => ((mb_strlen($row['photo_comment']) > 20) ? mb_substr($row['photo_comment'], 0, 20) . '...' : $row['photo_comment']), 'PHOTO_MOUSEOVER' => (mb_strlen($row['photo_comment']) > 20) ? $row['photo_comment'] : '', 'PHOTO_NAME' => $row['photo_name'], 'COMMENT_FULL' => $row['photo_comment'], 'IMAGE_TIME' => $user->format_date($row['filetime']), 'IMAGE_VIEWS' => $row['download_count'], 'IMAGE_ID' => $row['photo_id'], 'TOPIC_ID' => ($row['thumbnail']) ? 1 : false, 'USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour'], $user->lang['GUEST']), 'U_IMAGE_DOWNLOAD' => $this->u_action . "&mode=photo&p={$row['photo_id']}", 'U_IMAGE_THUMBNAIL' => append_sid("{$phpbb_root_path}photo.$phpEx", "id={$row['photo_id']}" . (($row['thumbnail']) ? '&t=1' : '')), )); $count++; } $total_pages = 1; if ($count == $config['images_per_page']) { $sql = "SELECT COUNT(photo_id) as total_images FROM " . GALLERY_PHOTOS_TABLE . " WHERE poster_id = {$user->data['user_id']} AND extension IN ($extensions)"; $result = $db->sql_query($sql); $total_pages = $db->sql_fetchfield('total_images') / ($config['images_per_page'] > 0) ? $config['images_per_page'] : 1; $db->sql_freeresult($result); } $template->assign_vars(array( 'WHOS_PHOTOS' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour'], $user->lang['GUEST']) . ' ' . $user->lang['PHOTOS'], 'USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour'], $user->lang['GUEST']), 'MAX_WIDTH' => $config['img_max_thumb_width'], 'MAX_HEIGHT' => $config['img_link_height'], 'PAGINATION' => generate_pagination($this->u_action . "&mode=$mode&un={$user->data['username']}", $total_pages, $config['images_per_page'], $start, true), 'U_UPLOAD' => $this->u_action . '&mode=upload', )); $this->page_title = $user->data['username'] . ' ' . $user->lang['PHOTOS']; break; case 'photo': if ($submit) { $rating = request_var('rating', 0); $comment = utf8_normalize_nfc(request_var('message', '', true)); //update the rating for this photo if ($rating) { $sql = 'SELECT * FROM ' . GALLERY_RATINGS_TABLE . " WHERE user_id = {$user->data['user_id']} AND photo_id = $photo_id"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_fetchrow($result); if ($row['photo_id']) { trigger_error('ALREADY_RATED'); } else { $sql_ary = array( 'photo_id' => $photo_id, 'user_id' => $user->data['user_id'], 'rating' => $rating, ); $sql = 'INSERT INTO ' . GALLERY_RATINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); $count = $rating = 0; $sql = 'SELECT rating FROM ' . GALLERY_RATINGS_TABLE . " WHERE photo_id = $photo_id"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $count++; $rating += $row['rating']; } $db->sql_freeresult($result); if ($count) { $rating = $rating / $count; $sql = 'UPDATE ' . GALLERY_PHOTOS_TABLE . " SET photo_rating = $rating WHERE photo_id = $photo_id"; $db->sql_query($sql); redirect(append_sid("./$filename", "i=$id&mode=$mode&p=$photo_id")); } } } //add a comment for this photo else if ($comment) { $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage $allow_bbcode = $allow_urls = $allow_smilies = true; generate_text_for_storage($comment, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies); $sql_ary = array( 'photo_id' => $photo_id, 'user_id' => $user->data['user_id'], 'comment_time' => time(), 'comment_text' => $comment, 'comment_bitfield' => $bitfield, 'comment_uid' => $uid, 'comment_options' => $options, ); $sql = 'INSERT INTO ' . GALLERY_COMMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); redirect(append_sid("./$filename", "i=$id&mode=$mode&p=$photo_id")); } } $where = "ORDER BY a.filetime DESC"; if ($photo_id) { $where = "AND a.photo_id = $photo_id"; } //generate smliies include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); generate_smilies('inline', 1); $sql = 'SELECT a.*, u.username, u.user_colour, g.rating FROM ' . GALLERY_PHOTOS_TABLE . ' a, ' . USERS_TABLE . ' u LEFT JOIN ' . GALLERY_RATINGS_TABLE . " g ON (g.photo_id = $photo_id) WHERE a.extension IN ($extensions) AND a.poster_id = u.user_id $where"; $result = $db->sql_query_limit($sql, 1); $photo = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$photo['rating']) { //setup rate photo $start = $config['photo_min_rating']; $stop = $config['photo_max_rating']; $photo_rate = '<select name="rating">'; $photo_rate .= '<option disabled="disabled" selected="selected">' . $user->lang['RATE_THIS'] . '</option>'; for ($i = $start; $i <= $stop; $i++) { $photo_rate .= '<option id="' . $i . '">' . $i . '</option>'; } $photo_rate .= '</select>'; } else { $photo_rate = "({$photo['rating']})"; } $template->assign_vars(array( 'PHOTO_BBCODE' => "[{$config['photo_bbcode']}]{$photo['photo_id']}[/{$config['photo_bbcode']}]", 'PHOTO_DESCRIPTION' => $photo['photo_comment'], 'PHOTO_DETAILS' => '', 'PHOTO_ID' => $photo['photo_id'], 'PHOTO_NAME' => $photo['photo_name'], 'PHOTO_POST_TIME' => $user->format_date($photo['filetime']), 'PHOTO_POSTER' => get_username_string('full', $photo['poster_id'], $photo['username'], $photo['user_colour']), 'PHOTO_RATE' => $photo_rate, 'PHOTO_RATED' => $photo['rating'], 'PHOTO_RATING' => round($photo['photo_rating'], 2), 'PHOTO_SIZE' => $photo['filesize'], 'PHOTO_TYPE' => $photo['extension'], 'PHOTO_VIEWS' => $photo['download_count'], 'I_PHOTO' => append_sid("{$phpbb_root_path}photo.$phpEx", "id={$photo['photo_id']}"), 'U_SUBMIT' => $this->u_action . "&mode=$mode&p=$photo_id", )); $now = getdate(time() + $user->timezone + $user->dst - date('Z')); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $id_cache = $user_cache = $message_cache = array(); $sql = 'SELECT g.*, u.* FROM ' . GALLERY_COMMENTS_TABLE . ' g LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = g.user_id) WHERE photo_id = $photo_id ORDER BY g.comment_time DESC"; $result = $db->sql_query_limit($sql, $config['comments_per_page']); while ($row = $db->sql_fetchrow($result)) { $poster_id = $row['user_id']; $id_cache[] = $poster_id; $message_cache[$row['comment_id']] = array( 'message' => generate_text_for_display($row['comment_text'], $row['comment_uid'], $row['comment_bitfield'], $row['comment_options']), 'user_id' => $row['user_id'], 'post_time' => $user->format_date($row['comment_time']), 'username' => $row['username'], 'user_colour' => $row['user_colour'], ); $user_cache[$poster_id] = array( 'joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => $row['user_warnings'], 'from' => $row['user_from'], 'viewonline' => $row['user_allow_viewonline'], 'allow_pm' => $row['user_allow_pm'], 'avatar' => ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'age' => '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'online' => false, 'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$poster_id"), 'www' => $row['user_website'], 'aim' => ($row['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=aim&u=$poster_id") : '', 'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '', 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg' : '', 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'search_author=' . urlencode($row['username']) .'&showresults=posts') : '', 'email' => '', 'icq' => ($row['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'] : '', 'icq_status_img' => ($row['user_icq']) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />' : '', ); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) { $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); } if ($row['user_birthday']) { list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); if ($bday_year) { $diff = $now['mon'] - $bday_month; if ($diff == 0) { $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; } else { $diff = ($diff < 0) ? 1 : 0; } $user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff); } } } $db->sql_freeresult($result); // Load custom profile fields if ($config['load_cpf_viewtopic']) { include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $cp = new custom_profile(); // Grab all profile fields from users in id cache for later use - similar to the poster cache $profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache); } // Generate online information for user if ($config['load_onlinetrack'] && sizeof($id_cache)) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql); $update_time = $config['load_online_time'] * 60; while ($row = $db->sql_fetchrow($result)) { $user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; } $db->sql_freeresult($result); } unset($id_cache); $cp_row = array(); foreach ($message_cache as $post_id => $row) { $poster_id = $row['user_id']; // if ($config['load_cpf_viewtopic']) { $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]) : array(); } $postrow = array( 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']), 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), 'RANK_TITLE' => $user_cache[$poster_id]['rank_title'], 'RANK_IMG' => $user_cache[$poster_id]['rank_image'], 'RANK_IMG_SRC' => $user_cache[$poster_id]['rank_image_src'], 'POSTER_JOINED' => $user_cache[$poster_id]['joined'], 'POSTER_POSTS' => $user_cache[$poster_id]['posts'], 'POSTER_FROM' => $user_cache[$poster_id]['from'], 'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'], 'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'], 'POSTER_AGE' => $user_cache[$poster_id]['age'], 'POST_DATE' => $user->format_date($row['post_time']), 'MESSAGE' => $row['message'], 'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'), 'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'], 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), //'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_')) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&p={$post_id}") : ''), //'U_DELETE' => ($auth->acl_get('m_')) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&p={$post_id}") : '', 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=compose") : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], 'U_WWW' => $user_cache[$poster_id]['www'], 'U_ICQ' => $user_cache[$poster_id]['icq'], 'U_AIM' => $user_cache[$poster_id]['aim'], 'U_MSN' => $user_cache[$poster_id]['msn'], 'U_YIM' => $user_cache[$poster_id]['yim'], 'U_JABBER' => $user_cache[$poster_id]['jabber'], 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post', true, $user->session_id) : '', 'POST_ID' => $post_id, 'POSTER_ID' => $poster_id, 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, 'S_TOPIC_POSTER' => ($user->data['user_id'] == $poster_id) ? true : false, ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { $postrow = array_merge($postrow, $cp_row['row']); } // Dump vars into template $template->assign_block_vars('postrow', $postrow); if (!empty($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { $template->assign_block_vars('postrow.custom_fields', $field_data); } } } break; case 'rating': case 'recent': $sql = "SELECT a.*, u.username, u.user_colour, u.user_id FROM " . GALLERY_PHOTOS_TABLE . ' a LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = a.poster_id) WHERE a.gallery_id <> 0 AND a.extension IN ($extensions) ORDER BY a.filetime DESC"; $result = $db->sql_query_limit($sql, $config['images_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('imagerow', array( 'PHOTO_COMMENT' => ((mb_strlen($row['photo_comment']) > 20) ? mb_substr($row['photo_comment'], 0, 20) . '...' : $row['photo_comment']), 'PHOTO_MOUSEOVER' => (mb_strlen($row['photo_comment']) > 20) ? $row['photo_comment'] : '', 'PHOTO_NAME' => $row['photo_name'], 'COMMENT_FULL' => $row['photo_comment'], 'IMAGE_TIME' => $user->format_date($row['filetime']), 'IMAGE_VIEWS' => $row['download_count'], 'IMAGE_ID' => $row['photo_id'], 'TOPIC_ID' => ($row['thumbnail']) ? 1 : false, 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $user->lang['GUEST']), 'U_IMAGE_DOWNLOAD' => $this->u_action . "&mode=photo&p={$row['photo_id']}", 'U_IMAGE_THUMBNAIL' => append_sid("{$phpbb_root_path}photo.$phpEx", "id={$row['photo_id']}" . (($row['thumbnail']) ? '&t=1' : '')), )); } $db->sql_freeresult($result); $template->assign_vars(array( 'MAX_WIDTH' => $config['img_max_thumb_width'], 'MAX_HEIGHT' => $config['img_link_height'], )); break; case 'upload': if (!$user->data['is_registered']) { // Can this user view profiles/memberlist? login_box('', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); } if ($submit) { include($phpbb_root_path . 'includes/functions_gallery.' . $phpEx); $filedata = upload_attachment(); if (!sizeof($filedata['error'])) { redirect(append_sid("./$filename", "i=$id&mode=$mode&p={$filedata['photo_id']}")); } $error_message = ''; foreach ($filedata['error'] as $error) { $error_message .= $error . '<br />'; } trigger_error($error); } $template->assign_vars(array( 'I_IMAGE_THUMBNAIL' => ($photo_id) ? append_sid("{$phpbb_root_path}photo.$phpEx", "id=$photo_id&t=1") : '', 'U_ACTION' => $this->u_action . "&mode=$mode", )); break; case 'views': $sql = "SELECT a.*, u.username, u.user_colour, u.user_id FROM " . GALLERY_PHOTOS_TABLE . ' a LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = a.poster_id) WHERE a.gallery_id <> 0 AND a.extension IN ($extensions) ORDER BY a.download_count DESC"; $result = $db->sql_query_limit($sql, $config['images_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('imagerow', array( 'PHOTO_COMMENT' => ((mb_strlen($row['photo_comment']) > 20) ? mb_substr($row['photo_comment'], 0, 20) . '...' : $row['photo_comment']), 'PHOTO_MOUSEOVER' => (mb_strlen($row['photo_comment']) > 20) ? $row['photo_comment'] : '', 'PHOTO_NAME' => $row['photo_name'], 'COMMENT_FULL' => $row['photo_comment'], 'IMAGE_TIME' => $user->format_date($row['filetime']), 'IMAGE_VIEWS' => $row['download_count'], 'IMAGE_ID' => $row['photo_id'], 'TOPIC_ID' => ($row['thumbnail']) ? 1 : false, 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $user->lang['GUEST']), 'U_IMAGE_DOWNLOAD' => $this->u_action . "&mode=photo&p={$row['photo_id']}", 'U_IMAGE_THUMBNAIL' => append_sid("{$phpbb_root_path}photo.$phpEx", "id={$row['photo_id']}" . (($row['thumbnail']) ? '&t=1' : '')), )); } $db->sql_freeresult($result); $template->assign_vars(array( 'MAX_WIDTH' => $config['img_max_thumb_width'], 'MAX_HEIGHT' => $config['img_link_height'], )); break; } $template->assign_vars(array( 'S_' . strtoupper($mode) => true, )); }
<th><?php echo $lang['POSTS']; ?></th> <th><?php echo $lang['INFORMATION']; ?></th> <th><?php echo $lang['JOINED']; ?></th> <th><?php echo $lang['LAST_ACTIVE']; ?></th> <th><?php echo $lang['ACTION']; ?></th> <th><?php echo $lang['NEW_USERNAME']; ?></th> </tr> </thead> <tbody> <?php foreach ($user_ids as $i => $user_id) { $row = $users[$user_id]; $rank_title = $rank_img = ''; get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src); $last_visit = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit']; $info = ''; switch ($row['user_type']) { case USER_INACTIVE: $info .= $lang['USER_INACTIVE']; break; case USER_IGNORE: $info .= $lang['BOT']; break; case USER_FOUNDER:
/** * Returns rank info for currently logged in, or specified, user. */ public function get_user_rank_info($userID = '') { global $db; $fStateChanged = $this->foreground(); if (!$userID) { if ($this->user_logged_in()) { $usrData = $this->get_userdata(); } } else { $sql = 'SELECT user_rank, user_posts FROM ' . USERS_TABLE . ' WHERE user_wpuint_id = ' . (int) $userID; if (!($result = $db->sql_query($sql))) { wp_die(__('Could not access the database.', 'wp-united')); } $usrData = $db->sql_fetchrow($result); } if ($usrData) { global $phpbb_root_path, $phpEx; if (!function_exists('get_user_rank')) { require_once $phpbb_root_path . 'includes/functions_display.php'; } $rank = array(); $rank['text'] = $rank['image_tag'] = $rank['image'] = ''; get_user_rank($usrData['user_rank'], $usrData['user_posts'], $rank['text'], $rank['image_tag'], $rank['image']); $this->restore_state($fStateChanged); return $rank; } $this->restore_state($fStateChanged); }
public function get_template_side($module_id) { global $config, $template, $db, $user; switch ($db->sql_layer) { case 'postgres': $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . ' AND user_type <> ' . USER_INACTIVE . ' ORDER BY RANDOM()'; break; case 'mssql': case 'mssql_odbc': $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . ' AND user_type <> ' . USER_INACTIVE . ' ORDER BY NEWID()'; break; default: $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . ' AND user_type <> ' . USER_INACTIVE . ' ORDER BY RAND()'; break; } $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $avatar_img = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']); $rank_title = $rank_img = ''; get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src); $username = $row['username']; $user_id = (int) $row['user_id']; $colour = $row['user_colour']; $template->assign_block_vars('random_member', array( 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour), 'USERNAME' => get_username_string('username', $user_id, $username, $colour), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour), 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'USER_POSTS' => (int) $row['user_posts'], 'AVATAR_IMG' => $avatar_img, 'JOINED' => $user->format_date($row['user_regdate'], 'd.M.Y'), 'USER_OCC' => censor_text($row['user_occ']), 'USER_FROM' => censor_text($row['user_from']), 'U_WWW' => censor_text($row['user_website']), )); $db->sql_freeresult($result); return 'random_member_side.html'; }
public function jiaoxuezongjie() { $emp_no = get_emp_no(); $flow = M('flow')->select(); $emp_no = get_emp_no(); $uid = get_user_id(); $this->position_id = get_position_id(); $this->user_rank = get_user_rank(); $task = M('task')->where('type = "9" ')->order('id desc')->select(); if (!empty($task)) { //dump($flow); $this->isfa = 1; //第一步 $this->taskId = $task[0]['id']; $taskId = $task[0]['id']; $this->lc = task_step_status($this->taskId, 1); $this->zr = task_step_status($this->taskId, 2); $this->js = task_step_status($this->taskId, 3); } //订教材 颜色判断 if ($this->isfa) { $this->btn1 = "btn-success"; //第二步开始 if ($this->lc) { $this->btn2 = "btn-success"; //第三步开始 if ($this->zr) { $this->btn3 = "btn-success"; //第四步开始 if ($this->js) { $this->btn4 = "btn-success"; } else { $this->btn4 = "btn-danger"; } //第四步结束 } else { $this->btn3 = "btn-danger"; } //第三步结束 } else { $this->btn2 = "btn-danger"; } //第二步开始 } else { $this->btn1 = "btn-danger"; } // 综合类 总结 $task = M('task')->where('type = "2092" ')->order('id desc')->select(); if (!empty($task)) { //dump($flow); $this->isfa202 = 1; //第一步 $this->taskId202 = $task[0]['id']; $taskId202 = $task[0]['id']; $this->lc202 = task_step_status($this->taskId202, 1); $this->zr202 = task_step_status($this->taskId202, 2); $this->js202 = task_step_status($this->taskId202, 3); } //订教材 颜色判断 if ($this->isfa202) { $this->btn2201 = "btn-success"; //第二步开始 if ($this->lc202) { $this->btn2202 = "btn-success"; //第三步开始 if ($this->zr202) { $this->btn2203 = "btn-success"; //第四步开始 if ($this->js202) { $this->btn2204 = "btn-success"; } else { $this->btn2204 = "btn-danger"; } //第四步结束 } else { $this->btn2203 = "btn-danger"; } //第三步结束 } else { $this->btn2202 = "btn-danger"; } //第二步开始 } else { $this->btn2201 = "btn-danger"; } // 教学总结 $task_type = "9,2092"; //任务类型 $flow_type = "77"; //流程类型 $this->todo = task_todo($task_type) . flow_todo($flow_type); // 未完成 $this->doing = task_ing($task_type) . flow_ing($flow_type); // 等待中 $this->done = task_done($task_type) . flow_done($flow_type); // 已完成 // 专业 $task = M('task')->where('type = "209" ')->order('id desc')->select(); if (!empty($task)) { //dump($flow); $this->isfa20 = 1; //第一步 $this->taskId20 = $task[0]['id']; $taskId20 = $task[0]['id']; $this->lc20 = task_step_status($this->taskId20, 1); $this->zr20 = task_step_status($this->taskId20, 2); $this->js20 = task_step_status($this->taskId20, 3); } //订教材 颜色判断 if ($this->isfa20) { $this->btn201 = "btn-success"; //第二步开始 if ($this->lc20) { $this->btn202 = "btn-success"; //第三步开始 if ($this->zr20) { $this->btn203 = "btn-success"; //第四步开始 if ($this->js20) { $this->btn204 = "btn-success"; } else { $this->btn204 = "btn-danger"; } //第四步结束 } else { $this->btn203 = "btn-danger"; } //第三步结束 } else { $this->btn202 = "btn-danger"; } //第二步开始 } else { $this->btn201 = "btn-danger"; } // 教学总结 $task_type20 = "209"; //任务类型 $flow_type20 = "89"; //流程类型 $this->todo20 = task_todo($task_type20) . flow_todo($flow_type20); // 未完成 $this->doing20 = task_ing($task_type20) . flow_ing($flow_type20); // 等待中 $this->done20 = task_done($task_type20) . flow_done($flow_type20); // 已完成 $this->display(); }
/** * Get user information (only for message display) */ function get_user_information($user_id, $user_row) { global $db, $auth, $user, $cache; global $phpbb_root_path, $phpEx, $config; if (!$user_id) { return array(); } if (empty($user_row)) { $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); } // Some standard values $user_row['online'] = false; $user_row['rank_title'] = $user_row['rank_image'] = $user_row['rank_image_src'] = $user_row['email'] = ''; // Generate online information for user if ($config['load_onlinetrack']) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . "\n\t\t\tWHERE session_user_id = {$user_id}\n\t\t\tGROUP BY session_user_id"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $update_time = $config['load_online_time'] * 60; if ($row) { $user_row['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false; } } if (!function_exists('get_user_avatar')) { include $phpbb_root_path . 'includes/functions_display.' . $phpEx; } $user_row['avatar'] = $user->optionget('viewavatars') ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : ''; get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); if (!empty($user_row['user_allow_viewemail']) || $auth->acl_get('a_email')) { $user_row['email'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$user_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') || empty($user_row['user_email']) ? '' : 'mailto:' . $user_row['user_email']); } return $user_row; }
function show_profile($data) { global $config, $_CORE_CONFIG, $_CLASS; $user_id = $data['user_id']; $rank_title = $rank_img = ''; get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img); if (!empty($data['user_allow_viewemail']) || $_CLASS['auth']->acl_get('a_email')) { $email = $config['board_email_form'] && $_CORE_CONFIG['email']['email_enable'] ? generate_link('Members_List&mode=email&u=' . $user_id) : ($config['board_hide_emails'] && !$_CLASS['auth']->acl_get('a_email') ? '' : 'mailto:' . $data['user_email']); } else { $email = ''; } $last_visit = $data['session_time'] ? $data['session_time'] : $data['user_last_visit']; $online = $data['session_time'] >= $_CLASS['core_user']->time - $config['load_online_time'] * 60; return array('USERNAME' => $data['username'], 'USER_COLOR' => $data['user_colour'] ? $data['user_colour'] : '', 'RANK_TITLE' => $rank_title, 'JOINED' => $_CLASS['core_user']->format_date($data['user_reg_date']), 'VISITED' => $last_visit ? ' - ' : $_CLASS['core_user']->format_date($last_visit), 'POSTS' => $data['user_posts'] ? $data['user_posts'] : 0, 'ONLINE_IMG' => $online ? $_CLASS['core_user']->img('btn_online', $_CLASS['core_user']->lang['USER_ONLINE']) : $_CLASS['core_user']->img('btn_offline', $_CLASS['core_user']->lang['USER_ONLINE']), 'RANK_IMG' => $rank_img, 'ICQ_STATUS_IMG' => $data['user_icq'] ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" border="0" />' : '', 'U_PROFILE' => generate_link('Members_List&mode=viewprofile&u=' . $user_id), 'U_SEARCH_USER' => $_CLASS['auth']->acl_get('u_search') ? generate_link('Forums&file=search&search_author=' . urlencode($data['username']) . '&show_results=posts') : '', 'U_PM' => $_CLASS['auth']->acl_get('u_sendpm') ? generate_link('Control_Panel&i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => $data['user_website'] ? $data['user_website'] : '', 'U_ICQ' => $data['user_icq'] ? generate_link('Members_List&mode=contact&action=icq&u=' . $user_id) : '', 'U_AIM' => $data['user_aim'] ? generate_link('Members_List&mode=contact&action=aim&u=' . $user_id) : '', 'U_YIM' => $data['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $data['user_yim'] . '&.src=pg' : '', 'U_MSN' => $data['user_msnm'] ? generate_link('Members_List&mode=contact&action=msnm&u=' . $user_id) : '', 'U_JABBER' => $data['user_jabber'] ? generate_link('Members_List&mode=contact&action=jabber&u=' . $user_id) : '', 'S_ONLINE' => $online); }
// Get user... $user_id = $user->data['user_id']; $username = $user->data['username']; $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id"); $result = $db->sql_query($sql); $member = $db->sql_fetchrow($result); $db->sql_freeresult($result); $avatar_img = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']); $rank_title = $rank_img = ''; get_user_rank($member['user_rank'], $member['user_posts'], $rank_title, $rank_img, $rank_img_src); $username = $member['username']; $user_id = (int) $member['user_id']; $colour = $member['user_colour']; // Assign specific vars $template->assign_vars(array( 'L_NEW_POSTS' => $user->lang['SEARCH_NEW'] . ' (' . $new_posts_count . ')', 'L_SELF_POSTS' => $user->lang['SEARCH_SELF'] . ' (' . $you_posts_count . ')', 'AVATAR_IMG' => $avatar_img, 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src,
public function get_template_side($module_id) { global $config, $template, $user, $auth, $db, $phpEx, $phpbb_root_path; if (!function_exists('display_forums')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } if ($user->data['is_registered']) { // // + new posts since last visit & you post number // $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); if ($auth->acl_get('m_approve')) { $m_approve_fid_ary = array(-1); $m_approve_fid_sql = ''; } else if ($auth->acl_getf_global('m_approve')) { $m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary); $m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')'; } else { $m_approve_fid_ary = array(); $m_approve_fid_sql = ' AND p.post_approved = 1'; } $sql = 'SELECT COUNT(distinct t.topic_id) as total FROM ' . TOPICS_TABLE . ' t WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' AND t.topic_moved_id = 0 ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); $result = $db->sql_query($sql); $new_posts_count = (int) $db->sql_fetchfield('total'); $db->sql_freeresult($result); // unread posts $sql_where = 'AND t.topic_moved_id = 0 ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); $unread_list = array(); $unread_list = get_unread_topics($user->data['user_id'], $sql_where, 'ORDER BY t.topic_id DESC'); $unread_posts_count = sizeof($unread_list); // Get user avatar and rank $user_id = $user->data['user_id']; $username = $user->data['username']; $colour = $user->data['user_colour']; $avatar_img = get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']); $rank_title = $rank_img = ''; get_user_rank($user->data['user_rank'], $user->data['user_posts'], $rank_title, $rank_img, $rank_img_src); // Assign specific vars $template->assign_vars(array( 'L_NEW_POSTS' => $user->lang['SEARCH_NEW'] . ' (' . $new_posts_count . ')', 'L_SELF_POSTS' => $user->lang['SEARCH_SELF'] . ' (' . $user->data['user_posts'] . ')', 'L_UNREAD_POSTS'=> $user->lang['SEARCH_UNREAD'] . ' (' . $unread_posts_count . ')', 'B3P_AVATAR_IMG' => $avatar_img, 'B3P_RANK_TITLE' => $rank_title, 'B3P_RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour), 'U_NEW_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), 'U_SELF_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), 'U_UNREAD_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), 'U_UM_BOOKMARKS' => ($config['allow_bookmarks']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=bookmarks') : '', 'U_UM_MAIN_SUBSCRIBED' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&mode=subscribed'), 'U_UM_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '', 'S_DISPLAY_SUBSCRIPTIONS' => ($config['allow_topic_notify'] || $config['allow_forum_notify']) ? true : false, )); return 'user_menu_side.html'; } else { // Assign specific vars $template->assign_vars(array( 'U_PORTAL' => append_sid("{$phpbb_root_path}portal.$phpEx"), 'S_DISPLAY_FULL_LOGIN' => true, 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), 'S_SHOW_REGISTER' => ($config['board3_user_menu_register_' . $module_id]) ? true : false, )); return 'login_box_side.html'; } }
/** * Transforms the returned DB object into something our mapped phpBB user class will accept * @access private */ private function transform_result_to_phpbb($dbResult) { global $user, $phpbbForum; $fStateChanged = $phpbbForum->foreground(); $arrToLoad = array('loginName' => $dbResult['username'], 'user_avatar' => $dbResult['user_avatar'], 'user_avatar_type' => $dbResult['user_avatar_type'], 'user_avatar_width' => $dbResult['user_avatar_width'], 'user_avatar_height' => $dbResult['user_avatar_height'], 'email' => $dbResult['user_email'], 'group' => isset($phpbbForum->lang['G_' . $dbResult['group_name']]) ? $phpbbForum->lang['G_' . $dbResult['group_name']] : $dbResult['group_name'], 'numposts' => (int) $dbResult['user_posts'], 'regdate' => $user->format_date($dbResult['user_regdate']), 'lastvisit' => !empty($dbResult['user_lastvisit']) ? $user->format_date($dbResult['user_lastvisit']) : __('n/a', 'wp-united')); $arrToLoad['rank'] = $arrToLoad['rank_image'] = $arrToLoad['rank_image_src'] = ''; // fills the last three variables get_user_rank($dbResult['user_rank'], $arrToLoad['numposts'], $arrToLoad['rank'], $arrToLoad['rank_image'], $arrToLoad['rank_image_src']); $arrToLoad['rank'] = isset($phpbbForum->lang[$arrToLoad['rank']]) ? $phpbbForum->lang[$arrToLoad['rank']] : $arrToLoad['rank']; $arrToLoad['rank'] = empty($arrToLoad['rank']) ? __('n/a', 'wp-united') : $arrToLoad['rank']; $phpbbForum->restore_state($fStateChanged); return $arrToLoad; }
/** * Get user's additional (normal) rank title and image if they have a special rank * * @param int $user_rank the current stored users rank id * @param int $user_posts the users number of posts * @param string &$rank_title the rank title will be stored here after execution * @param string &$rank_img the rank image as full img tag is stored here after execution * @param string &$rank_img_src the rank image source is stored here after execution * */ function get_user_additional_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) { if (!empty($user_rank)) { //Always pass 0 to save duplicating get_user_rank and getting the special rank back get_user_rank(0, $user_posts, $rank_title, $rank_img, $rank_img_src); } }