function privmsg_review($view_user_id, $privmsg_recip_id, $is_inline_review) { global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path; global $userdata, $user_ip; global $orig_word, $replacement_word; global $starttime; global $admin_level, $level_prior, $bbcode_parse; global $icones; include_once $phpbb_root_path . './includes/functions_messages.' . $phpEx; // fix parameters $privmsg_recip_id = intval($privmsg_recip_id); $view_user_id = intval($view_user_id); // check if exists and belongs to the user $sql = "SELECT privmsg_id\n FROM " . PRIVMSGA_RECIPS_TABLE . "\n WHERE privmsg_user_id = {$view_user_id}\n AND privmsg_recip_id = {$privmsg_recip_id}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain private message information', '', __LINE__, __FILE__, $sql); } if (!($row = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, 'No_post_id'); } $privmsg_id = intval($row['privmsg_id']); if (!$is_inline_review) { // // Start session management // $userdata = session_pagestart($user_ip, $forum_id); init_userprefs($userdata); // // End session management // $sql = "SELECT *\n FROM " . USERS_TABLE . "\n WHERE user_id = {$view_user_id}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not read user information', '', __LINE__, __FILE__, $sql); } if (!($view_userdata = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, 'User_not_exist'); } check_user($view_userdata); } // // Define censored word matches // if (empty($orig_word) && empty($replacement_word)) { $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); } // // Dump out the page header and load viewtopic body template // if (!$is_inline_review) { $gen_simple_header = true; $page_title = _lang('Topic_review'); include $phpbb_root_path . 'includes/page_header.' . $phpEx; } $template->set_filenames(array('reviewbody' => 'posting_topic_review.tpl')); // Read the message id $sql = "SELECT p.*, pa.*, u.username AS privmsg_from_username\n FROM " . PRIVMSGA_TABLE . " p, " . PRIVMSGA_RECIPS_TABLE . " pa, " . USERS_TABLE . " u\n WHERE p.privmsg_id = {$privmsg_id}\n AND pa.privmsg_id = p.privmsg_id AND pa.privmsg_direct = 0\n AND ( (pa.privmsg_user_id <> 0 AND u.user_id = pa.privmsg_user_id) OR (pa.privmsg_user_id = 0 AND u.user_id = " . ANONYMOUS . ") )"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain post/user information', '', __LINE__, __FILE__, $sql); } if ($row = $db->sql_fetchrow($result)) { $poster_id = $row['privmsg_user_id']; $poster = empty($poster_id) ? $board_config['sitename'] : $poster_id == ANONYMOUS ? _lang('Guest') : $row['privmsg_from_username']; $post_date = create_date($userdata['user_dateformat'], $row['privmsg_time'], $userdata['user_timezone']); $post_subject = empty($row['privmsg_subject']) ? '' : $row['privmsg_subject']; $message = $row['privmsg_text']; $bbcode_uid = $row['privmsg_bbcode_uid']; // // If the board has HTML off but the post has HTML // on then we process it, else leave it alone // if (!$board_config['allow_html'] && $row['privmsg_enable_html']) { $message = preg_replace('#(<)([\\/]?.*?)(>)#is', '<\\2>', $message); } if (!empty($bbcode_uid)) { $message = $board_config['allow_bbcode'] ? $bbcode_parse->bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message); } $message = $bbcode_parse->make_clickable($message); if (count($orig_word)) { $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); $message = preg_replace($orig_word, $replacement_word, $message); } if ($board_config['allow_smilies'] && $row['enable_smilies']) { $message = $bbcode_parse->smilies_pass($message); } $message = str_replace("\n", '<br />', $message); $message = $bbcode_parse->acronym_pass($message); $message = $bbcode_parse->smart_pass($message); if (function_exists('get_icon_title')) { $post_subject = get_icon_title($row['post_icon']) . ' ' . $post_subject; } // just for the template : no signification here $mini_post_img = _images('icon_minipost'); $mini_post_alt = _lang('Post'); // // Again this will be handled by the templating // code at some point // $color = true; $row_color = $color ? $theme['td_color1'] : $theme['td_color2']; $row_class = $color ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars('postrow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'MINI_POST_IMG' => $mini_post_img, 'POSTER_NAME' => $poster, 'POST_DATE' => $post_date, 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'L_MINI_POST_ALT' => $mini_post_alt)); } else { message_die(GENERAL_MESSAGE, 'No_post_id', '', __LINE__, __FILE__, $sql); } $template->assign_vars(array('L_AUTHOR' => _lang('Author'), 'L_MESSAGE' => _lang('Message'), 'L_POSTED' => _lang('Posted'), 'L_POST_SUBJECT' => _lang('Post_subject'), 'L_TOPIC_REVIEW' => _lang('Topic_review'))); if (!$is_inline_review) { $template->pparse('reviewbody'); include $phpbb_root_path . 'includes/page_tail.' . $phpEx; } }
function get_event_topics(&$events, &$number, $start_date, $end_date, $limit = false, $start = 0, $max_limit = -1, $fid = '') { global $tree, $template, $lang, $images, $user, $db, $cache, $config, $bbcode; if (!class_exists('bbcode')) { include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; } if (empty($bbcode)) { $bbcode = new bbcode(); } // get some parameter $topic_title_length = isset($config['calendar_title_length']) ? intval($config['calendar_title_length']) : 30; $topic_text_length = isset($config['calendar_text_length']) ? intval($config['calendar_text_length']) : 200; if ($max_limit < 0) { $max_limit = $config['topics_per_page']; } // get the forums authorized (compliency with categories hierarchy v2 mod) $cat_hierarchy = function_exists(get_auth_keys); $s_forums_ids = ''; if (!$cat_hierarchy) { // standard read $is_auth = array(); $is_auth = auth(AUTH_ALL, AUTH_LIST_ALL, $user->data); // forum or cat asked $is_ask = array(); if ($fid == 'Root' || $fid == POST_CAT_URL . 0) { $fid = ''; } if (!empty($fid)) { $type = substr($fid, 0, 1); $id = intval(substr($fid, 1)); if ($type == POST_CAT_URL) { $sql = "SELECT forum_id FROM " . FORUMS_TABLE . " WHERE parent_id = '" . $id . "'"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $is_ask[$row['forum_id']] = true; } $db->sql_freeresult($result); } elseif ($type == POST_FORUM_URL) { $is_ask[$id] = true; } else { return; } } // get the list of authorized forums while (list($forum_id, $forum_auth) = each($is_auth)) { if ($forum_auth['auth_read'] && (empty($fid) || isset($is_ask[$forum_id]))) { $s_forum_ids .= (empty($s_forum_ids) ? '' : ', ') . $forum_id; } } } else { if (empty($fid) || $fid == POST_CAT_URL . 0) { $fid = 'Root'; } // get auth key $keys = array(); $keys = get_auth_keys($fid, true, -1, -1, 'auth_read'); for ($i = 0; $i < sizeof($keys['id']); $i++) { if ($tree['type'][$keys['idx'][$i]] == POST_FORUM_URL && $tree['auth'][$keys['id'][$i]]['auth_read']) { $s_forum_ids .= (empty($s_forum_ids) ? '' : ', ') . $tree['id'][$keys['idx'][$i]]; } } } // no forums authed, return if (empty($s_forum_ids)) { return; } // select topics $sql_forums_field = ''; $sql_forums_file = ''; $sql_forums_match = ''; if (!$cat_hierarchy) { $sql_forums_field = ', f.forum_name'; $sql_forums_file = ', ' . FORUMS_TABLE . ' AS f'; $sql_forums_match = ' AND f.forum_id = t.forum_id'; } $sql = "SELECT\n\t\t\t\t\tt.*,\n\t\t\t\t\tp.poster_id, p.post_username, p.post_text, p.enable_bbcode, p.enable_html, p.enable_smilies,\n\t\t\t\t\tu.username, u.user_active, u.user_color,\n\t\t\t\t\tlp.poster_id AS lp_poster_id,\n\t\t\t\t\tlu.username AS lp_username,\n\t\t\t\t\tlp.post_username AS lp_post_username,\n\t\t\t\t\tlp.post_time AS lp_post_time\n\t\t\t\t\t{$sql_forums_field}\n\t\t\tFROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u, " . POSTS_TABLE . " AS lp, " . USERS_TABLE . " lu {$sql_forums_file}\n\t\t\tWHERE\n\t\t\t\tt.forum_id IN ({$s_forum_ids})\n\t\t\t\tAND p.post_id = t.topic_first_post_id\n\t\t\t\tAND u.user_id = p.poster_id\n\t\t\t\tAND lp.post_id = t.topic_last_post_id\n\t\t\t\tAND lu.user_id = lp.poster_id\n\t\t\t\tAND t.topic_calendar_time < {$end_date}\n\t\t\t\tAND (t.topic_calendar_time + t.topic_calendar_duration) >= {$start_date}\n\t\t\t\tAND t.topic_status <> " . TOPIC_MOVED . "\n\t\t\t\t{$sql_forums_match}\n\t\t\tORDER BY\n\t\t\t\tt.topic_calendar_time, t.topic_calendar_duration DESC, t.topic_last_post_id DESC"; $result = $db->sql_query($sql); // get the number of occurences $number = $db->sql_numrows($result); // if limit per page asked, limit the number of results if ($limit) { $db->sql_freeresult($result); $sql .= " LIMIT {$start}, {$max_limit}"; $result = $db->sql_query($sql); } $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? 1 : 0; $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? 1 : 0; $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? 1 : 0; // read the items while ($row = $db->sql_fetchrow($result)) { // prepare the message $topic_author_id = $row['poster_id']; $topic_author = $row['poster_id'] == ANONYMOUS ? $row['post_username'] : $row['username']; $topic_time = $row['topic_time']; $topic_last_author_id = $row['lp_poster_id']; $topic_last_author = $row['lp_poster_id'] == ANONYMOUS ? $row['lp_post_username'] : $row['lp_username']; $topic_last_time = $row['lp_post_time']; $topic_views = $row['topic_views']; $topic_replies = $row['topic_replies']; $topic_icon = $row['topic_icon']; $topic_title = $row['topic_title']; $message = htmlspecialchars($row['post_text']); $topic_calendar_time = $row['topic_calendar_time']; $topic_calendar_duration = $row['topic_calendar_duration']; $topic_link = append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $row['topic_id']); $topic_title = censor_text($topic_title); $message = censor_text($message); $short_title = strlen($topic_title) > $topic_title_length + 3 ? substr($topic_title, 0, $topic_title_length) . '...' : $topic_title; // Convert and clean special chars! $topic_title = htmlspecialchars_clean($topic_title); $short_title = htmlspecialchars_clean($short_title); // SMILEYS IN TITLE - BEGIN if ($config['smilies_topic_title'] && !$lofi) { $topic_title = $bbcode->parse_only_smilies($topic_title); $short_title = $bbcode->parse_only_smilies($short_title); } // SMILEYS IN TITLE - END $dsp_topic_icon = ''; if (function_exists('get_icon_title')) { $dsp_topic_icon = get_icon_title($topic_icon, 0, POST_CALENDAR); } // parse the message $message = substr($message, 0, $topic_text_length); // remove HTML if not allowed if (!$config['allow_html'] && $row['enable_html']) { $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $message); } $message = $bbcode->parse($message); // get the date format $fmt = $lang['DATE_FORMAT_CALENDAR']; if (!empty($topic_calendar_duration)) { $fmt = $config['default_dateformat']; } // replace \n with <br /> //$message = preg_replace("/[\n\r]{1,2}/", '<br />', $message); // build the overview $sav_tpl = $template->_tpldata; $det_handler = '_overview_topic_' . $row['topic_id']; $template->set_filenames(array($det_handler => 'calendar_overview_topic.tpl')); $nav_desc = ''; if ($cat_hierarchy) { $nav_desc = make_cat_nav_tree(POST_FORUM_URL . $row['forum_id'], '', '', 'gensmall'); } else { $nav_desc = '<a href="' . append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $row['forum_id']) . '" class="gensmall">' . $row['forum_name'] . '</a>'; } $template->assign_vars(array('L_CALENDAR_EVENT' => $lang['Calendar_event'], 'L_AUTHOR' => $lang['Author'], 'L_TOPIC_DATE' => $lang['Date'], 'L_FORUM' => $lang['Forum'], 'L_VIEWS' => $lang['Views'], 'L_REPLIES' => $lang['Replies'], 'TOPIC_TITLE' => $dsp_topic_icon . ' ' . $topic_title, 'CALENDAR_EVENT' => get_calendar_title_date($topic_calendar_time, $topic_calendar_duration), 'AUTHOR' => $topic_author, 'TOPIC_DATE' => create_date($user->data['user_dateformat'], $topic_time, $config['board_timezone']), 'NAV_DESC' => $nav_desc, 'CALENDAR_MESSAGE' => $message, 'VIEWS' => $topic_views, 'REPLIES' => $topic_replies)); $template->assign_var_from_handle('_calendar_overview', $det_handler); $message = $template->_tpldata['.'][0]['_calendar_overview']; $template->_tpldata = $sav_tpl; // remove \n remaining from the template $message = preg_replace("/[\n\r]{1,2}/", '', $message); // store only the new values $new_row = array(); $new_row['event_id'] = POST_TOPIC_URL . $row['topic_id']; $new_row['event_author_id'] = $topic_author_id; $new_row['event_author'] = $topic_author; $new_row['event_author_active'] = $row['user_active']; $new_row['event_author_color'] = $row['user_color']; $new_row['event_time'] = $topic_time; $new_row['event_last_author_id'] = $topic_last_author_id; $new_row['event_last_author'] = $topic_last_author; $new_row['event_last_time'] = $topic_last_time; $new_row['event_replies'] = $topic_replies; $new_row['event_views'] = $topic_views; $new_row['event_type'] = $row['topic_type']; $new_row['event_status'] = $row['topic_status']; $new_row['event_moved_id'] = $row['topic_moved_id']; $new_row['event_last_id'] = $row['topic_last_post_id']; $new_row['event_forum_id'] = $row['forum_id']; $new_row['event_forum_name'] = $row['forum_name']; $new_row['event_icon'] = $topic_icon; $new_row['event_title'] = $topic_title; $new_row['event_short_title'] = $short_title; $new_row['event_message'] = $message; $new_row['event_calendar_time'] = $topic_calendar_time; $new_row['event_calendar_duration'] = $topic_calendar_duration; $new_row['event_link'] = $topic_link; $new_row['event_birthday'] = false; $new_row['event_txt_class'] = 'genmed'; $new_row['event_type_icon'] = '<img src="' . $images['icon_tiny_topic'] . '" style="vertical-align: bottom;" alt="" hspace="2" />'; $events[] = $new_row; } $db->sql_freeresult($result); }
function topic_list($box, $tpl = '', $topic_rowset, $list_title = '', $split_type = false, $display_nav_tree = true, $footer = '', $inbox = true, $select_field = '', $select_type = 0, $select_formname = '', $select_values = array()) { global $db, $template, $board_config, $userdata, $phpEx, $lang, $images, $HTTP_COOKIE_VARS; global $tree, $bbcode_parse; static $box_id; // save template state $sav_tpl = $template->_tpldata; // init if (empty($tpl)) { $tpl = 'topics_list_box'; } if (empty($list_title)) { $list_title = $lang['Topics']; } if (!empty($select_values) && !is_array($select_values)) { $s_values = $select_values; $select_values = array(); $select_values[] = $s_values; } // selections $select_multi = false; $select_unique = false; if (!empty($select_field) && $select_type > 0 && !empty($select_formname)) { switch ($select_type) { case 1: $select_multi = true; break; case 2: $select_unique = true; break; } } if ($split_type) { // set in separate table $split_box = $inbox && (isset($board_config['split_topic_split']) ? intval($board_config['split_topic_split']) : false); // get split params $switch_split_global_announce = isset($board_config['split_global_announce']) ? intval($board_config['split_global_announce']) : false; $switch_split_announce = isset($board_config['split_announce']) ? intval($board_config['split_announce']) : false; $switch_split_sticky = isset($board_config['split_sticky']) ? intval($board_config['split_sticky']) : false; if (!$switch_split_global_announce && !$switch_split_announce && !$switch_split_sticky) { $split_box = $split_type = false; } } else { $split_box = $switch_split_global_announce = $switch_split_announce = $switch_split_sticky = false; } // Define censored word matches $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); //-- mod : keep unread ----------------------------------------------------------------------------- //-- delete // // read the user cookie // $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array(); // $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array(); // $tracking_all = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) ? intval($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) : NULL; //-- add // get last visit for guest if (!$userdata['session_logged_in']) { $userdata['user_lastvisit'] = $board_config['guest_lastvisit']; } //-- fin mod : keep unread ------------------------------------------------------------------------- // get a default title if (empty($list_title)) { $list_title = $lang['forum']; } // choose template $template->set_filenames(array($tpl => $tpl . '.tpl')); // check if user replied to the topics $user_topics = array(); $topic_rowset_count = count($topic_rowset); if ($userdata['user_id'] != ANONYMOUS) { // get all the topic ids to display $topic_ids = array(); for ($i = 0; $i < $topic_rowset_count; $i++) { $topic_item_type = substr($topic_rowset[$i]['topic_id'], 0, 1); $topic_id = intval(substr($topic_rowset[$i]['topic_id'], 1)); if ($topic_item_type == POST_TOPIC_URL) { $topic_ids[] = $topic_id; } } // check if the user replied to if (!empty($topic_ids)) { // check the posts $s_topic_ids = implode(', ', $topic_ids); $sql = 'SELECT DISTINCT topic_id FROM ' . POSTS_TABLE . "\n WHERE topic_id IN ({$s_topic_ids})\n AND poster_id = " . $userdata['user_id']; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain post information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $user_topics[POST_TOPIC_URL . $row['topic_id']] = true; } } } // initiate $template->assign_block_vars($tpl, array('FORMNAME' => $select_formname, 'FIELDNAME' => $select_field)); // spanning of the first column (list name) $span_left = 1; if ($topic_rowset_count > 0) { // add folder image $span_left++; } $span_left++; if ($select_unique) { // selection in front is asked $span_left++; } // spanning of the whole line (bottom row and/or empty list) $span_all = $span_left + 4; if ($select_multi && $topic_rowset_count > 0) { $span_all++; } // display topics $color = false; $prec_topic_type = ''; $header_sent = false; if (!isset($box_id)) { $box_id = -1; } for ($i = 0; $i < $topic_rowset_count; $i++) { $topic_item_type = substr($topic_rowset[$i]['topic_id'], 0, 1); $topic_id = intval(substr($topic_rowset[$i]['topic_id'], 1)); $topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title']; $replies = $topic_rowset[$i]['topic_replies']; $topic_type = $topic_rowset[$i]['topic_type']; $user_replied = !empty($user_topics) && isset($user_topics[$topic_rowset[$i]['topic_id']]); $force_type_display = false; $forum_id = $topic_rowset[$i]['forum_id']; if (defined('POST_BIRTHDAY') && $topic_type == POST_BIRTHDAY) { $topic_type = $lang['Birthday'] . ': '; } else { if ($topic_type == POST_GLOBAL_ANNOUNCE) { $topic_type = $lang['Topic_Global_Announcement'] . ' '; } else { if ($topic_type == POST_ANNOUNCE) { $topic_type = $lang['Topic_Announcement'] . ' '; } else { if ($topic_type == POST_STICKY) { $topic_type = $lang['Topic_Sticky'] . ' '; } else { $topic_type = ''; } } } } if ($topic_rowset[$i]['topic_vote']) { $topic_type .= $lang['Topic_Poll'] . ' '; $force_type_display = true; } if (defined('POST_BIRTHDAY') && $topic_rowset[$i]['topic_type'] == POST_BIRTHDAY) { $folder_image = $images['folder_birthday']; $folder_alt = $lang['Happy_birthday']; $newest_post_img = ''; } else { if ($topic_rowset[$i]['topic_status'] == TOPIC_MOVED) { $topic_type = $lang['Topic_Moved'] . ' '; $topic_id = $topic_rowset[$i]['topic_moved_id']; $folder_image = $images['folder']; $folder_alt = $lang['Topics_Moved']; $newest_post_img = ''; $force_type_display = true; } else { if (defined('POST_BIRTHDAY') && $topic_rowset[$i]['topic_type'] == POST_BIRTHDAY) { $folder = $images['folder_birthday']; $folder_new = $images['folder_birthday']; } else { if ($topic_rowset[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_global_announce_own'] : $images['folder_global_announce']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_global_announce_new_own'] : $images['folder_global_announce_new']; } else { if ($topic_rowset[$i]['topic_type'] == POST_ANNOUNCE) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_announce_own'] : $images['folder_announce']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_announce_new_own'] : $images['folder_announce_new']; } else { if ($topic_rowset[$i]['topic_type'] == POST_STICKY) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_sticky_own'] : $images['folder_sticky']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_sticky_new_own'] : $images['folder_sticky_new']; } else { if ($topic_rowset[$i]['topic_status'] == TOPIC_LOCKED) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_locked_own'] : $images['folder_locked']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_locked_new_own'] : $images['folder_locked_new']; } else { if ($replies >= $board_config['hot_threshold']) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_hot_own'] : $images['folder_hot']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_hot_new_own'] : $images['folder_hot_new']; } else { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_own'] : $images['folder']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['folder_new_own'] : $images['folder_new']; } } } } } } $newest_post_img = ''; //-- mod : keep unread ----------------------------------------------------------------------------- //-- delete // if ( $userdata['session_logged_in'] && ($topic_item_type == POST_TOPIC_URL) ) // { // if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] ) // { // if( !empty($tracking_topics) || !empty($tracking_forums) || !empty($tracking_all) ) // { // $unread_topics = true; // if( !empty($tracking_topics[$topic_id]) ) // { // if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] ) // { // $unread_topics = false; // } // } // if( !empty($tracking_forums[$forum_id]) ) // { // if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] ) // { // $unread_topics = false; // } // } // if( !empty($tracking_all) ) // { // if( $tracking_all >= $topic_rowset[$i]['post_time'] ) // { // $unread_topics = false; // } // } //-- add if ($topic_item_type == POST_TOPIC_URL) { // have we got a last visit time for this topic $topic_last_read = intval($board_config['tracking_unreads'][$topic_id]); if (!empty($board_config['tracking_all']) && $board_config['tracking_all'] > $topic_last_read) { $topic_last_read = $board_config['tracking_all']; } if (isset($board_config['tracking_forums'][$forum_id]) && $board_config['tracking_forums'][$forum_id] > $topic_last_read) { $topic_last_read = $board_config['tracking_forums'][$forum_id]; } if (isset($board_config['tracking_topics'][$topic_id]) && $board_config['tracking_topics'][$topic_id] > $topic_last_read) { $topic_last_read = $board_config['tracking_topics'][$topic_id]; } if (empty($topic_last_read)) { $topic_last_read = $userdata['user_lastvisit']; } // unread status ? $unread_topics = $topic_rowset[$i]['post_time'] > $topic_last_read; //-- fin mod : keep unread ------------------------------------------------------------------------- if ($unread_topics) { $folder_image = $folder_new; $folder_alt = $lang['New_posts']; $newest_post_img = '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else { $folder_image = $folder; $folder_alt = $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } //-- mod : keep unread ----------------------------------------------------------------------------- //-- delete // } // else // { // $folder_image = $folder_new; // $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts']; // $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; // } // } // else // { // $folder_image = $folder; // $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; // $newest_post_img = ''; // } // } // else // { // $folder_image = $folder; // $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; // $newest_post_img = ''; //-- fin mod : keep unread ------------------------------------------------------------------------- } } } // generate list of page for the topic $goto_page = ''; if ($replies + 1 > $board_config['posts_per_page']) { $total_pages = ceil(($replies + 1) / $board_config['posts_per_page']); $goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': '; $times = 1; for ($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) { $goto_page .= '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "=" . $topic_id . "&start={$j}") . '">' . $times . '</a>'; if ($times == 1 && $total_pages > 4) { $goto_page .= ' ... '; $times = $total_pages - 3; $j += ($total_pages - 4) * $board_config['posts_per_page']; } else { if ($times < $total_pages) { $goto_page .= ', '; } } $times++; } $goto_page .= ' ] '; } $topic_author = ''; $first_post_time = ''; $last_post_time = ''; $last_post_url = ''; $views = ''; switch ($topic_item_type) { case POST_USERS_URL: $view_topic_url = append_sid("profile.{$phpEx}?" . POST_USERS_URL . "={$topic_id}"); break; default: $view_topic_url = append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}"); $topic_author = $topic_rowset[$i]['user_id'] != ANONYMOUS ? '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : ''; $topic_author .= $topic_rowset[$i]['user_id'] != ANONYMOUS ? $topic_rowset[$i]['username'] : ($topic_rowset[$i]['post_username'] != '' ? $topic_rowset[$i]['post_username'] : $lang['Guest']); $topic_author .= $topic_rowset[$i]['user_id'] != ANONYMOUS ? '</a>' : ''; $first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']); $last_post_author = $topic_rowset[$i]['id2'] == ANONYMOUS ? $topic_rowset[$i]['post_username2'] != '' ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' : '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>'; $last_post_url = '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; $views = $topic_rowset[$i]['topic_views']; break; } // categories hierarchy v 2 compliancy $nav_tree = ''; if ($display_nav_tree && !empty($topic_rowset[$i]['forum_id'])) { if ($tree['auth'][POST_FORUM_URL . $topic_rowset[$i]['forum_id']]['tree.auth_view']) { $nav_tree = make_cat_nav_tree(POST_FORUM_URL . $topic_rowset[$i]['forum_id'], '', 'gensmall'); } } if (!empty($nav_tree)) { $nav_tree = '[ ' . $nav_tree . ' ]'; } // get the type for rupture $topic_real_type = $topic_rowset[$i]['topic_type']; // if no split between global and standard announcement, group them with standard announcement if (!$switch_split_global_announce && $topic_real_type == POST_GLOBAL_ANNOUNCE) { $topic_real_type = POST_ANNOUNCE; } // if no split between announce and sticky, group them with sticky if (!$switch_split_announce && $topic_real_type == POST_ANNOUNCE) { $topic_real_type = POST_STICKY; } // if no split between sticky and normal, group them with normal if (!$switch_split_sticky && $topic_real_type == POST_STICKY) { $topic_real_type = POST_NORMAL; } // check if rupture $rupt = false; // split if ($i == 0 || $split_type) { if ($i == 0) { $rupt = true; } // check the rupt if ($prec_topic_type != $topic_real_type) { $rupt = true; } } $prec_topic_type = $topic_real_type; // header if ($rupt) { // close the prec box if ($split_box && $i != 0) { // footer $template->assign_block_vars($tpl . '.row', array('COLSPAN' => $span_all)); // table closure $template->assign_block_vars($tpl . '.row.footer_table', array()); // spacing $template->assign_block_vars($tpl . '.row', array()); $template->assign_block_vars($tpl . '.row.spacer', array()); // unset header $header_sent = false; } // get box title $main_title = $list_title; $sub_title = $list_title; switch ($topic_real_type) { case POST_BIRTHDAY: $sub_title = $lang['Birthday']; break; case POST_GLOBAL_ANNOUNCE: $sub_title = $lang['Post_Global_Announcement']; break; case POST_ANNOUNCE: $sub_title = $lang['Post_Announcement']; break; case POST_STICKY: $sub_title = $lang['Post_Sticky']; break; case POST_CALENDAR: $sub_title = $lang['Calendar_event']; break; case POST_NORMAL: $sub_title = $lang['Topics']; break; } $template->assign_block_vars($tpl . '.row', array('L_TITLE' => !$split_box ? $main_title : $sub_title, 'L_REPLIES' => $lang['Replies'], 'L_AUTHOR' => $lang['Author'], 'L_VIEWS' => $lang['Views'], 'L_LASTPOST' => $lang['Last_Post'], 'COLSPAN' => $span_all)); // open a new box if ($split_box || $i == 0) { $box_id++; $template->assign_block_vars($tpl . '.row.header_table', array('COLSPAN' => $span_left, 'BOX_ID' => $box_id)); // selection fields if ($select_multi) { $template->assign_block_vars($tpl . '.row.header_table.multi_selection', array()); } // set header $header_sent = true; } // not in box, send a row title if ($split_type && !$split_box) { $template->assign_block_vars($tpl . '.row', array('L_TITLE' => $sub_title, 'COLSPAN' => $span_all)); $template->assign_block_vars($tpl . '.row.header_row', array()); } } // erase the type before the title if split if ($split_type && $topic_real_type == $topic_rowset[$i]['topic_type'] && !$force_type_display) { $topic_type = ''; } // get the announces dates $topic_announces_dates = ''; if (in_array($topic_rowset[$i]['topic_type'], array(POST_ANNOUNCE, POST_GLOBAL_ANNOUNCE))) { $topic_announces_dates = get_announces_title($topic_rowset[$i]['topic_time'], $topic_rowset[$i]['topic_announce_duration']); } // get the calendar dates /*** Remove Calander Stuff $topic_calendar_dates = ''; if (function_exists('get_calendar_title')) { $topic_calendar_dates = get_calendar_title($topic_rowset[$i]['topic_calendar_time'], $topic_rowset[$i]['topic_calendar_duration']); } ***/ // get the topic icons $icon = ''; $type = $topic_rowset[$i]['topic_type']; if ($type == POST_NORMAL) { /*** Remove Calander Code if ( defined('POST_CALENDAR') && !empty($topic_rowset[$i]['topic_calendar_time']) ) { $type = POST_CALENDAR; } ***/ if (defined('POST_PICTURE') && !empty($topic_rowset[$i]['topic_pic_url'])) { $type = POST_PICTURE; } $icon = get_icon_title($topic_rowset[$i]['topic_icon'], 1, $type); } //-- mod : topic description ----------------------------------------------------------------------- //-- add $topic_desc = $topic_rowset[$i]['topic_desc']; //-- end mod : topic description ------------------------------------------------------------------- // send topic to template $selected = !empty($select_values) && in_array($topic_rowset[$i]['topic_id'], $select_values); $color = !$color; $template->assign_block_vars($tpl . '.row', array('ROW_CLASS' => $color || !defined('TOPIC_ALTERNATE_ROW_CLASS') ? 'row1' : 'row2', 'ROW_FOLDER_CLASS' => $user_replied && defined('USER_REPLIED_CLASS') ? USER_REPLIED_CLASS : ($color || !defined('TOPIC_ALTERNATE_ROW_CLASS') ? 'row1' : 'row2'), 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'GOTO_PAGE' => !empty($goto_page) ? '<br />' . $goto_page : '', 'TOPIC_NAV_TREE' => !empty($nav_tree) ? (empty($goto_page) ? '<br />' : '') . $nav_tree : '', 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']), 'ICON' => $icon, 'TOPIC_TITLE' => $topic_title, 'TOPIC_DESCRIPTION' => $bbcode_parse->smilies_pass($topic_desc), 'L_TOPIC_DESCRIPTION' => $lang['Topic_description'], 'TOPIC_ANNOUNCES_DATES' => $topic_announces_dates, 'TOPIC_CALENDAR_DATES' => $topic_calendar_dates, 'TOPIC_TYPE' => $topic_type, 'VIEWS' => $views, 'FIRST_POST_TIME' => $first_post_time, 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_post_author, 'LAST_POST_IMG' => $last_post_url, 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'U_VIEW_TOPIC' => $view_topic_url, 'BOX_ID' => $box_id, 'FID' => $topic_rowset[$i]['topic_id'], 'L_SELECT' => $selected && ($select_multi || $select_unique) ? 'checked="checked"' : '')); $template->assign_block_vars($tpl . '.row.topic', array()); // selection fields if ($select_multi) { $template->assign_block_vars($tpl . '.row.topic.multi_selection', array()); } if ($select_unique) { $template->assign_block_vars($tpl . '.row.topic.single_selection', array()); } // icons $template->assign_block_vars($tpl . '.row.topic.icon', array()); //-- mod : topic description ----------------------------------------------------------------------- //-- add // topic description if (!empty($topic_desc)) { $template->assign_block_vars($tpl . '.row.topic.switch_topic_desc', array()); } //-- end mod : topic description ------------------------------------------------------------------- // nav tree asked if ($display_nav_tree && !empty($nav_tree)) { $template->assign_block_vars($tpl . '.row.topic.nav_tree', array()); } } // end for topic_rowset read // send a header if missing if (!$header_sent) { $template->assign_block_vars($tpl . '.row', array('L_TITLE' => $list_title, 'L_REPLIES' => $lang['Replies'], 'L_AUTHOR' => $lang['Author'], 'L_VIEWS' => $lang['Views'], 'L_LASTPOST' => $lang['Last_Post'], 'COLSPAN' => $span_all)); // open a new box $template->assign_block_vars($tpl . '.row.header_table', array('COLSPAN' => $span_left)); } // no data if ($topic_rowset_count == 0) { // send no topics notice $template->assign_block_vars($tpl . '.row', array('L_NO_TOPICS' => $lang['No_search_match'], 'COLSPAN' => $span_all)); $template->assign_block_vars($tpl . '.row.no_topics', array()); } // bottom line if (!empty($footer)) { $template->assign_block_vars($tpl . '.row', array('COLSPAN' => $span_all, 'FOOTER' => $footer)); $template->assign_block_vars($tpl . '.row.bottom', array()); } // table closure $template->assign_block_vars($tpl . '.row', array('COLSPAN' => $span_all)); $template->assign_block_vars($tpl . '.row.footer_table', array()); // spacing if (empty($footer)) { // spacing $template->assign_block_vars($tpl . '.row', array()); $template->assign_block_vars($tpl . '.row.spacer', array()); } // transfert to a var $template->assign_var_from_handle('_box', $tpl); $res = $template->vars['_box']; // restore template saved state $template->_tpldata = $sav_tpl; unset($sav_tpl); // Man that would be big :), can be do this elegently. // assign value to the main template $template->assign_vars(array($box => $res)); }
} if (!$found) { $post_icon = 0; } // send to template $template->assign_block_vars('switch_icon_checkbox', array()); $template->assign_vars(array('L_ICON_TITLE' => _lang('post_icon_title'))); // display the icons $nb_row = intval((count($icones_sort) - 1) / $icon_per_row) + 1; $offset = 0; for ($i = 0; $i < $nb_row; $i++) { $template->assign_block_vars('switch_icon_checkbox.row', array()); for ($j = 0; $j < $icon_per_row && $offset < count($icones_sort); $j++) { $icon_id = $icones_sort[$offset]; // send to cell or cell_none $template->assign_block_vars('switch_icon_checkbox.row.cell', array('ICON_ID' => $icones[$icon_id]['ind'], 'ICON_CHECKED' => $post_icon == $icones[$icon_id]['ind'] ? ' checked="checked"' : '', 'ICON_IMG' => get_icon_title($icones[$icon_id]['ind'], 2))); $offset++; } } } // system _hide(POST_USERS_URL, $view_user_id); _hide('pmmode', $pmmode); _hide('folder', $folder_id); _hide('start', $pm_start); if (!empty($privmsg_id)) { _hide(POST_POST_URL, $privmsg_recip_id); } $template->assign_vars(array('S_POST_ACTION' => append_sid($main_pgm), 'S_HIDDEN_FORM_FIELDS' => _hidden_get())); // send to browser privmsg_footer();
$total_posts = $total_posts + $row['count']; $row['post_icon'] = intval($row['post_icon']); if (isset($map_icon[$row['post_icon']])) { $icones[$map_icon[$row['post_icon']]]['usage'] = $icones[$map_icon[$row['post_icon']]]['usage'] + $row['count']; } } if ($total_posts <= 0) { $total_posts = 1; } // template $template->set_filenames(array('body' => 'admin_icons_body.tpl')); // header $template->assign_vars(array('L_TITLE' => $lang['Icons_settings'], 'L_TITLE_EXPLAIN' => $lang['Icons_settings_explain'], 'L_PERMISSIONS' => $lang['Icons_auth'], 'L_DEFAULT' => $lang['Icons_defaults'], 'L_USAGE' => $lang['Usage'], 'L_ACTION' => $lang['Action'], 'L_EDIT' => $lang['Edit'], 'L_DELETE' => $lang['Delete'], 'L_MOVEUP' => $lang['Move_up'], 'L_MOVEDW' => $lang['Move_down'], 'L_CREATE' => $lang['Create_new'])); // display icons for ($i = 0; $i < count($icones); $i++) { $template->assign_block_vars('row', array('ICON' => get_icon_title($icones[$i]['ind'], 1, -1, true), 'ICON_KEY' => $icones[$i]['img'], 'L_LANG' => isset($lang[$icones[$i]['alt']]) ? $lang[$icones[$i]['alt']] : $icones[$i]['alt'], 'LANG_KEY' => isset($lang[$icones[$i]['alt']]) ? '<br />(' . $icones[$i]['alt'] . ')' : '', 'L_AUTH' => $auths[$icones[$i]['auth']], 'USAGE' => intval($icones[$i]['usage']) > 0 ? $icones[$i]['usage'] . ' (' . round($icones[$i]['usage'] * 100 / $total_posts) . '%)' : '', 'U_EDIT' => append_sid("./admin_icons.{$phpEx}?mode=edit&icon=" . $icones[$i]['ind']), 'U_DELETE' => append_sid("./admin_icons.{$phpEx}?mode=del&icon=" . $icones[$i]['ind']), 'U_MOVEUP' => append_sid("./admin_icons.{$phpEx}?mode=up&icon=" . $icones[$i]['ind']), 'U_MOVEDW' => append_sid("./admin_icons.{$phpEx}?mode=dw&icon=" . $icones[$i]['ind']))); // list of default assignement @reset($icon_defined_special); while (list($key, $data) = @each($icon_defined_special)) { if ($data['icon'] == $icones[$i]['ind'] && isset($lang[$data['lang_key']])) { $template->assign_block_vars('row.default', array('L_DEFAULT' => $lang[$data['lang_key']])); } } } // system $s_hidden_fields = ''; $template->assign_vars(array('NAV_SEPARATOR' => $nav_separator, 'S_ACTION' => append_sid("./admin_icons.{$phpEx}"), 'S_HIDDEN_FIELDS' => $s_hidden_fields)); // footer $template->pparse('body'); include './page_footer_admin.' . $phpEx; }
function topic_list($box, $tpl = '', $topic_rowset, $list_title = '', $split_type = false, $display_nav_tree = true, $footer = '', $inbox = true, $select_field = '', $select_type = 0, $select_formname = '', $select_values = array()) { global $template, $db, $cache, $config, $user, $lang, $images, $theme; global $tree, $bbcode, $user; static $box_id; // save template state $sav_tpl = $template->_tpldata; // init if (empty($tpl)) { $tpl = 'topics_list_box'; } if (empty($list_title)) { $list_title = $lang['Topics']; } if (!empty($select_values) && !is_array($select_values)) { $s_values = $select_values; $select_values = array(); $select_values[] = $s_values; } // selections $select_multi = false; $select_unique = false; if (!empty($select_field) && $select_type > 0 && !empty($select_formname)) { switch ($select_type) { case 1: $select_multi = true; break; case 2: $select_unique = true; break; } } // get split params $switch_split_global_announce = isset($config['split_global_announce']) && isset($lang['Post_Global_Announcement']) ? intval($config['split_global_announce']) : false; $switch_split_announce = isset($config['split_announce']) ? intval($config['split_announce']) : false; $switch_split_sticky = isset($config['split_sticky']) ? intval($config['split_sticky']) : false; $switch_split_news = isset($config['split_news']) ? intval($config['split_news']) : false; // set in separate table $split_box = $inbox && (isset($config['split_topic_split']) ? intval($config['split_topic_split']) : false); // take care of the context if (!$split_type) { $split_box = false; $switch_split_global_announce = false; $switch_split_announce = false; $switch_split_sticky = false; $switch_split_news = false; } if (!$switch_split_global_announce && !$switch_split_announce && !$switch_split_sticky && !$switch_split_news) { $split_type = false; $split_box = false; } // read the user cookie $tracking_forums = isset($_COOKIE[$config['cookie_name'] . '_f']) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array(); $tracking_topics = isset($_COOKIE[$config['cookie_name'] . '_t']) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array(); $tracking_all = isset($_COOKIE[$config['cookie_name'] . '_f_all']) ? intval($_COOKIE[$config['cookie_name'] . '_f_all']) : NULL; // categories hierarchy v 2 compliancy $cat_hierarchy = function_exists('get_auth_keys'); if (!$cat_hierarchy) { // standard read $is_auth = array(); $is_auth = auth(AUTH_ALL, AUTH_LIST_ALL, $user->data); } // topic icon present $icon_installed = function_exists('get_icon_title'); // get a default title if (empty($list_title)) { $list_title = $lang['forum']; } // choose template $template->set_filenames(array($tpl => $tpl . '.tpl')); // check if user replied to the topic $user_topics = array(); if ($user->data['user_id'] != ANONYMOUS) { // get all the topic ids to display $topic_ids = array(); for ($i = 0; $i < sizeof($topic_rowset); $i++) { $topic_item_type = substr($topic_rowset[$i]['topic_id'], 0, 1); $topic_id = intval(substr($topic_rowset[$i]['topic_id'], 1)); if ($topic_item_type == POST_TOPIC_URL) { $topic_ids[] = $topic_id; } } // check if the user replied to if (!empty($topic_ids)) { // check the posts $s_topic_ids = implode(', ', $topic_ids); $sql = "SELECT DISTINCT topic_id FROM " . POSTS_TABLE . "\n\t\t\t\t\tWHERE topic_id IN ({$s_topic_ids})\n\t\t\t\t\t\tAND poster_id = " . $user->data['user_id']; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $user_topics[POST_TOPIC_URL . $row['topic_id']] = true; } } } // initiate $template->assign_block_vars($tpl, array('FORMNAME' => $select_formname, 'FIELDNAME' => $select_field)); // spanning of the first column (list name) $span_left = 1; if (sizeof($topic_rowset) > 0) { // add folder image $span_left++; } if ($icon_installed) { // add topic icon $span_left++; } if ($select_unique) { // selection in front is asked $span_left++; } // spanning of the whole line (bottom row and/or empty list) $span_all = $span_left + 4; if ($select_multi && sizeof($topic_rowset) > 0) { $span_all++; } // display topics $color = false; $prec_topic_type = ''; $header_sent = false; if (!isset($box_id)) { $box_id = -1; } for ($i = 0; $i < sizeof($topic_rowset); $i++) { $topic_item_type = substr($topic_rowset[$i]['topic_id'], 0, 1); $topic_id = intval(substr($topic_rowset[$i]['topic_id'], 1)); $topic_title = censor_text($topic_rowset[$i]['topic_title']); $replies = $topic_rowset[$i]['topic_replies']; $topic_type = $topic_rowset[$i]['topic_type']; $user_replied = !empty($user_topics) && isset($user_topics[$topic_rowset[$i]['topic_id']]); $force_type_display = false; $forum_id = $topic_rowset[$i]['forum_id']; if (defined('POST_BIRTHDAY') && $topic_type == POST_BIRTHDAY) { $topic_type = $lang['Birthday'] . ': '; } elseif ($topic_type == POST_NEWS) { $topic_type = $lang['News'] . ': '; } elseif ($topic_type == POST_GLOBAL_ANNOUNCE) { $topic_type = $lang['Topic_Global_Announcement'] . ' '; } elseif ($topic_type == POST_ANNOUNCE) { $topic_type = $lang['Topic_Announcement'] . ' '; } elseif ($topic_type == POST_STICKY) { $topic_type = $lang['Topic_Sticky'] . ' '; } else { $topic_type = ''; } if (!empty($topic_rowset[$i]['poll_start']) && $topic_rowset[$i]['topic_status'] != TOPIC_MOVED) { $topic_type .= $lang['Topic_Poll'] . ' '; $force_type_display = true; } if (defined('POST_BIRTHDAY') && $topic_rowset[$i]['topic_type'] == POST_BIRTHDAY) { $folder_image = $images['folder_birthday']; $folder_alt = $lang['HAPPY_BIRTHDAY']; $newest_post_img = ''; } elseif ($topic_rowset[$i]['topic_status'] == TOPIC_MOVED) { $topic_type = $lang['Topic_Moved'] . ' '; $topic_id = $topic_rowset[$i]['topic_moved_id']; $folder_image = $images['topic_nor_read']; $folder_alt = $lang['Topics_Moved']; $newest_post_img = ''; $force_type_display = true; } else { /* define('USER_REPLIED_ICON', true); $user_replied = true; */ if (defined('POST_BIRTHDAY') && $topic_rowset[$i]['topic_type'] == POST_BIRTHDAY) { $folder = $images['folder_birthday']; $folder_new = $images['folder_birthday']; } elseif ($topic_rowset[$i]['topic_type'] == POST_NEWS) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_nor_read_own'] : $images['topic_nor_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_nor_unread_own'] : $images['topic_nor_unread']; } elseif ($topic_rowset[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_glo_read_own'] : $images['topic_glo_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_glo_unread_own'] : $images['topic_glo_unread']; } elseif ($topic_rowset[$i]['topic_type'] == POST_ANNOUNCE) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_ann_read_own'] : $images['topic_ann_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_ann_unread_own'] : $images['topic_ann_unread']; } elseif ($topic_rowset[$i]['topic_type'] == POST_STICKY) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_imp_read_own'] : $images['topic_imp_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_imp_unread_own'] : $images['topic_imp_unread']; } elseif ($topic_rowset[$i]['topic_status'] == TOPIC_LOCKED) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_nor_locked_read_own'] : $images['topic_nor_locked_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_nor_locked_unread_own'] : $images['topic_nor_locked_unread']; } else { if ($replies >= $config['hot_threshold']) { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_hot_read_own'] : $images['topic_hot_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_hot_unread_own'] : $images['topic_hot_unread']; } else { $folder = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_nor_read_own'] : $images['topic_nor_read']; $folder_new = $user_replied && defined('USER_REPLIED_ICON') ? $images['topic_nor_unread_own'] : $images['topic_nor_unread']; } } $newest_post_img = ''; if ($user->data['session_logged_in'] && $topic_item_type == POST_TOPIC_URL) { // UPI2DB - BEGIN if (!$user->data['upi2db_access']) { // UPI2DB - END if ($topic_rowset[$i]['post_time'] > $user->data['user_lastvisit']) { if (!empty($tracking_topics) || !empty($tracking_forums) || !empty($tracking_all)) { $unread_topics = true; if (!empty($tracking_topics[$topic_id])) { if ($tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time']) { $unread_topics = false; } } if (!empty($tracking_forums[$forum_id])) { if ($tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time']) { $unread_topics = false; } } if (!empty($tracking_all)) { if ($tracking_all >= $topic_rowset[$i]['post_time']) { $unread_topics = false; } } if ($unread_topics) { $folder_image = $folder_new; $folder_alt = $lang['New_posts']; $newest_post_img = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . "?" . POST_TOPIC_URL . "={$topic_id}&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" /></a> '; } else { $folder_image = $folder; $folder_alt = $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_image = $folder_new; $folder_alt = $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['New_posts']; $newest_post_img = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . "?" . POST_TOPIC_URL . "={$topic_id}&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" /></a> '; } } else { $folder_image = $folder; $folder_alt = $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } // UPI2DB - BEGIN } else { viewforum_calc_unread($user->data['upi2db_unread'], $topic_id, $topic_rowset, $i, $folder_new, $folder, $folder_alt, $folder_image, $newest_post_img, $upi2db_status); } // UPI2DB - END } else { $folder_image = $folder; $folder_alt = $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } // generate list of page for the topic $topic_pagination = generate_topic_pagination($forum_id, $topic_id, $replies); $topic_author = ''; $first_post_time = ''; $last_post_time = ''; $last_post_url = ''; $views = ''; switch ($topic_item_type) { case POST_USERS_URL: $view_topic_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id); break; default: $view_topic_url = append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id); $topic_author = $topic_rowset[$i]['user_id'] != ANONYMOUS ? '<a href="' . append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : ''; $topic_author .= $topic_rowset[$i]['user_id'] != ANONYMOUS ? $topic_rowset[$i]['username'] : ($topic_rowset[$i]['post_username'] != '' ? $topic_rowset[$i]['post_username'] : $lang['Guest']); $topic_author .= $topic_rowset[$i]['user_id'] != ANONYMOUS ? '</a>' : ''; $first_post_time = create_date_ip($config['default_dateformat'], $topic_rowset[$i]['topic_time'], $config['board_timezone']); $last_post_time = create_date_ip($config['default_dateformat'], $topic_rowset[$i]['post_time'], $config['board_timezone']); $last_post_author = $topic_rowset[$i]['id2'] == ANONYMOUS ? $topic_rowset[$i]['post_username2'] != '' ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' : '<a href="' . append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>'; $last_post_url = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#p' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; $views = $topic_rowset[$i]['topic_views']; // BEGIN cmx_mod $news_label = $topic_rowset[$i]['news_id'] > 0 ? $lang['News'] . ':' : ''; // END cmx_mod break; } // categories hierarchy v 2 compliancy $nav_tree = ''; if ($display_nav_tree && !empty($topic_rowset[$i]['forum_id'])) { if ($cat_hierarchy) { if ($tree['auth'][POST_FORUM_URL . $topic_rowset[$i]['forum_id']]['tree.auth_view']) { $nav_tree = make_cat_nav_tree(POST_FORUM_URL . $topic_rowset[$i]['forum_id'], '', '', 'gensmall'); } } else { if ($is_auth[$topic_rowset[$i]['forum_id']]['auth_view']) { $nav_tree = '<a href="' . append_sid(CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $topic_rowset[$i]['forum_id']) . '" class="gensmall">' . $topic_rowset[$i]['forum_name'] . '</a>'; } } } if (!empty($nav_tree)) { $nav_tree = '[ ' . $nav_tree . ' ]'; } // get the type for rupture $topic_real_type = $topic_rowset[$i]['topic_type']; // if no split between global and standard announcement, group them with standard announcement if (!$switch_split_global_announce && $topic_real_type == POST_GLOBAL_ANNOUNCE) { $topic_real_type = POST_ANNOUNCE; } // if no split between announce and sticky, group them with sticky if (!$switch_split_announce && $topic_real_type == POST_ANNOUNCE) { $topic_real_type = POST_NEWS; } // if no split between news and global announcement, group them with normal if (!$switch_split_news && $topic_real_type == POST_NEWS) { $topic_real_type = POST_STICKY; } // if no split between sticky and normal, group them with normal if (!$switch_split_sticky && $topic_real_type == POST_STICKY) { $topic_real_type = POST_NORMAL; } // check if rupture $rupt = false; // split if ($i == 0 || $split_type) { if ($i == 0) { $rupt = true; } // check the rupt if ($prec_topic_type != $topic_real_type) { $rupt = true; } } $prec_topic_type = $topic_real_type; // header if ($rupt) { // close the prec box if ($split_box && $i != 0) { // footer $template->assign_block_vars($tpl . '.row', array('COLSPAN' => $span_all)); // table closure $template->assign_block_vars($tpl . '.row.footer_table', array()); // spacing $template->assign_block_vars($tpl . '.row', array()); $template->assign_block_vars($tpl . '.row.spacer', array()); // unset header $header_sent = false; } // get box title $main_title = $list_title; $sub_title = $list_title; switch ($topic_real_type) { case POST_BIRTHDAY: $sub_title = $lang['Birthday']; break; case POST_NEWS: $sub_title = $lang['News']; break; case POST_GLOBAL_ANNOUNCE: $sub_title = $lang['Post_Global_Announcement']; break; case POST_ANNOUNCE: $sub_title = $lang['Post_Announcement']; break; case POST_STICKY: $sub_title = $lang['Post_Sticky']; break; case POST_CALENDAR: $sub_title = $lang['Calendar_event']; break; case POST_NORMAL: $sub_title = $lang['Topics']; break; } $template->assign_block_vars($tpl . '.row', array('L_TITLE' => !$split_box ? $main_title : $sub_title, 'L_REPLIES' => $lang['Replies'], 'L_AUTHOR' => $lang['Author'], 'L_VIEWS' => $lang['Views'], 'L_LASTPOST' => $lang['Last_Post'], 'COLSPAN' => $span_all)); // open a new box if ($split_box || $i == 0) { $box_id++; $template->assign_block_vars($tpl . '.row.header_table', array('COLSPAN' => $span_left, 'BOX_ID' => $box_id)); // selection fields if ($select_multi) { $template->assign_block_vars($tpl . '.row.header_table.multi_selection', array()); } // set header $header_sent = true; } // not in box, send a row title if ($split_type && !$split_box) { $template->assign_block_vars($tpl . '.row', array('L_TITLE' => $sub_title, 'COLSPAN' => $span_all)); $template->assign_block_vars($tpl . '.row.header_row', array()); } } // erase the type before the title if split if ($split_type && $topic_real_type == $topic_rowset[$i]['topic_type'] && !$force_type_display) { $topic_type = ''; } // get the announces dates $topic_announces_dates = ''; // get the calendar dates $topic_calendar_dates = ''; if (function_exists(get_calendar_title)) { $topic_calendar_dates = get_calendar_title($topic_rowset[$i]['topic_calendar_time'], $topic_rowset[$i]['topic_calendar_duration']); } // get the topic icons $icon = ''; if ($icon_installed) { $type = $topic_rowset[$i]['topic_type']; if ($type == POST_NORMAL) { if (defined('POST_CALENDAR') && !empty($topic_rowset[$i]['topic_calendar_time'])) { $type = POST_CALENDAR; } if (defined('POST_PICTURE') && !empty($topic_rowset[$i]['topic_pic_url'])) { $type = POST_PICTURE; } } $icon = get_icon_title($topic_rowset[$i]['topic_icon'], 1, $type); } // UPI2DB - BEGIN if ($user->data['upi2db_access']) { $mark_always_read = mark_always_read($topic_rowset[$i]['topic_type'], $topic_id, $forum_id, 'viewforum', 'icon', $user->data['upi2db_unread'], $start, $folder_image); } else { $mark_always_read = '<img src="' . $folder_image . '" alt="' . $folder_alt . '" title="' . $folder_alt . '" />'; } // UPI2DB - END // send topic to template $selected = !empty($select_values) && in_array($topic_rowset[$i]['topic_id'], $select_values); $color = !$color; $template->assign_block_vars($tpl . '.row', array('ROW_CLASS' => $color || !defined('TOPIC_ALTERNATE_ROW_CLASS') ? $theme['td_class1'] : $theme['td_class2'], 'ROW_FOLDER_CLASS' => $user_replied && defined('USER_REPLIED_CLASS') ? USER_REPLIED_CLASS : ($color || !defined('TOPIC_ALTERNATE_ROW_CLASS') ? $theme['td_class1'] : $theme['td_class2']), 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'TOPIC_DESCRIPTION' => $topic_desc, 'GOTO_PAGE' => $topic_pagination['base'], 'GOTO_PAGE_FULL' => $topic_pagination['full'], 'TOPIC_NAV_TREE' => !empty($nav_tree) ? (empty($goto_page) ? '<br />' : '') . $nav_tree : '', 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']), 'ICON' => $icon, 'TOPIC_TITLE' => $topic_title, 'TOPIC_ANNOUNCES_DATES' => $topic_announces_dates, 'TOPIC_CALENDAR_DATES' => $topic_calendar_dates, 'TOPIC_TYPE' => $topic_type, 'VIEWS' => $views, 'FIRST_POST_TIME' => $first_post_time, 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_post_author, 'LAST_POST_IMG' => $last_post_url, 'L_NEWS' => $news_label, 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'U_VIEW_TOPIC' => $view_topic_url, 'BOX_ID' => $box_id, 'FID' => $topic_rowset[$i]['topic_id'], 'U_MARK_ALWAYS_READ' => $mark_always_read, 'L_SELECT' => $selected && ($select_multi || $select_unique) ? 'checked="checked"' : '')); $template->assign_block_vars($tpl . '.row.topic', array()); if (!empty($topic_rowset[$i]['topic_desc']) && $config['show_topic_description']) { $template->assign_block_vars($tpl . '.row.topic.switch_topic_desc', array()); } // selection fields if ($select_multi) { $template->assign_block_vars($tpl . '.row.topic.multi_selection', array()); } if ($select_unique) { $template->assign_block_vars($tpl . '.row.topic.single_selection', array()); } // icons if ($icon_installed) { $template->assign_block_vars($tpl . '.row.topic.icon', array()); } // nav tree asked if ($display_nav_tree && !empty($nav_tree)) { $template->assign_block_vars($tpl . '.row.topic.nav_tree', array()); } } // end for topic_rowset read // send an header if missing if (!$header_sent) { $template->assign_block_vars($tpl . '.row', array('L_TITLE' => $list_title, 'L_REPLIES' => $lang['Replies'], 'L_AUTHOR' => $lang['Author'], 'L_VIEWS' => $lang['Views'], 'L_LASTPOST' => $lang['Last_Post'], 'COLSPAN' => $span_all)); // open a new box $template->assign_block_vars($tpl . '.row.header_table', array('COLSPAN' => $span_left)); } // no data if (sizeof($topic_rowset) == 0) { // send no topics notice $template->assign_block_vars($tpl . '.row', array('L_NO_TOPICS' => $lang['No_search_match'], 'COLSPAN' => $span_all)); $template->assign_block_vars($tpl . '.row.no_topics', array()); } // bottom line if (!empty($footer)) { $template->assign_block_vars($tpl . '.row', array('COLSPAN' => $span_all, 'FOOTER' => $footer)); $template->assign_block_vars($tpl . '.row.bottom', array()); } // table closure $template->assign_block_vars($tpl . '.row', array('COLSPAN' => $span_all)); $template->assign_block_vars($tpl . '.row.footer_table', array()); // spacing if (empty($footer)) { // spacing $template->assign_block_vars($tpl . '.row', array()); $template->assign_block_vars($tpl . '.row.spacer', array()); } // transfert to a var $template->assign_var_from_handle('_box', $tpl); $res = $template->_tpldata['.'][0]['_box']; // restore template saved state $template->_tpldata = $sav_tpl; // assign value to the main template $template->assign_vars(array($box => $res)); }
function privmsg_list($privmsg_rowset, $recips, $folder_id, $select = false, $mark_ids = array(), $detailed = false) { global $template, $userdata; global $lang, $images, $board_config, $phpEx, $phpbb_root_path; global $folders; global $main_pgm, $from_to_separator; global $all_marked, $marked_on_this_page; global $msg_days; global $nav_separator; global $icones; // is the post icon mod installed ? $mod_post_icon = function_exists('get_icon_title'); // censor word $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // get main folder $folder_main = $folder_id; if (!empty($folders['main'][$folder_id])) { $folder_main = $folders['main'][$folder_id]; } // author/recip $from_to = ''; switch ($folder_main) { case INBOX: $from_to = _lang('From'); break; case OUTBOX: $from_to = _lang('To'); break; case SENTBOX: $from_to = _lang('To'); break; case SAVEBOX: $from_to = _lang('From') . $from_to_separator . _lang('To'); break; } // get save sub-folder list $s_move_folder = ''; if ($folder_main != SAVEBOX) { $s_move_folder = get_folders_list($folder_id); } $s_move_folder .= get_folders_list(SAVEBOX); // template name $template->set_filenames(array('privmsga_box' => 'privmsga_box.tpl')); $span = 4; if ($mod_post_icon) { $span++; } if ($select) { $span++; } // Header $template->assign_vars(array('L_DISPLAY_MESSAGES' => _lang('Display_messages'), 'S_SELECT_MSG_DAYS' => get_days_list($msg_days), 'L_GO' => _lang('Go'), 'L_CANCEL' => _lang('Cancel'), 'L_FLAG' => _lang('Flag'), 'L_SUBJECT' => $select ? _lang('Subject') : _lang('Private_Messages'), 'L_FROM_OR_TO' => $from_to, 'L_DATE' => _lang('Date'), 'L_MARK' => _lang('Mark'), 'L_NO_MESSAGES' => _lang('No_messages_folder'), 'L_DELETE_MARKED' => _lang('Delete_marked'), 'L_DELETE_ALL' => _lang('Delete_all'), 'L_MOVE_MARKED' => _lang('Move_marked'), 'L_SAVE_TO_MAIL' => _lang('Save_to_mail_message'), 'S_SELECT_MOVE' => $s_move_folder, 'SPAN_ALL' => $span, 'SPAN_SUBJECT' => $mod_post_icon ? 2 : 1)); // process the display $all_marked = !empty($privmsg_rowset); $marked_on_this_page = array(); $color = false; for ($i = 0; $i < count($privmsg_rowset); $i++) { $color = !$color; $privmsg_id = $privmsg_rowset[$i]['privmsg_id']; $privmsg_recip_id = $privmsg_rowset[$i]['selected_pm_id']; // get flag $read_icon_flag = _images('pm_readmsg'); $read_icon_flag_alt = _lang('Read_message'); $unread_icon_flag = _images('pm_unreadmsg'); $unread_icon_flag_alt = _lang('Unread_message'); $new_icon_flag = _images('pm_newmsg'); $new_icon_flag_alt = _lang('New_message'); // choose the good icon switch ($privmsg_rowset[$i]['selected_read']) { case NEW_MAIL: $icon_flag = $new_icon_flag; $icon_flag_alt = $new_icon_flag_alt; break; case UNREAD_MAIL: $icon_flag = $unread_icon_flag; $icon_flag_alt = $unread_icon_flag_alt; break; case READ_MAIL: $icon_flag = $read_icon_flag; $icon_flag_alt = $read_icon_flag_alt; break; } // get the status of the "select all" checkbox $marked = !empty($mark_ids) && in_array($privmsg_recip_id, $mark_ids); if (!$marked) { $all_marked = false; } else { $marked_on_this_page[] = $privmsg_recip_id; } // user display is the sender $a_in = true; $a_out = false; $w_from_to = array(); if ($detailed) { $w_from_to = array($a_in, $a_out); } else { switch ($folder_main) { case INBOX: $w_from_to = array($a_in); break; case OUTBOX: $w_from_to = array($a_out); break; case SENTBOX: $w_from_to = array($a_out); break; case SAVEBOX: $w_from_to = array($a_in, $a_out); break; default: message_die(GENERAL_ERROR, _lang('No_such_folder'), '', __LINE__, __FILE__); break; } } $s_username = ''; for ($k = 0; $k < count($w_from_to); $k++) { $from = $w_from_to[$k]; if ($from) { $temp_url = empty($privmsg_rowset[$i]['privmsg_user_id']) ? append_sid("./index.{$phpEx}") : append_sid("./profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . '=' . $privmsg_rowset[$i]['privmsg_user_id']); $temp_lib = empty($privmsg_rowset[$i]['privmsg_user_id']) ? $board_config['sitename'] : $privmsg_rowset[$i]['privmsg_from_username']; $s_username .= (empty($s_username) ? '' : ($j == 0 ? $from_to_separator : ', ')) . '<a href="' . $temp_url . '" class="' . $userclass . '">' . $temp_lib . '</a>'; } else { for ($j = 0; $j < count($recips['data'][$privmsg_id]); $j++) { $temp_url = empty($recips['data'][$privmsg_id][$j]['privmsg_user_id']) ? append_sid("./index.{$phpEx}") : append_sid("./profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . '=' . $recips['data'][$privmsg_id][$j]['privmsg_user_id']); $temp_lib = empty($recips['data'][$privmsg_id][$j]['privmsg_user_id']) ? $board_config['sitename'] : $recips['data'][$privmsg_id][$j]['privmsg_to_username']; $s_username .= (empty($s_username) ? '' : ($j == 0 ? $from_to_separator : ', ')) . '<a href="' . $temp_url . '" class="' . $userclass . '">' . $temp_lib . '</a>'; } } // add '...' if required if ($recips['over'][$privmsg_id]) { $s_username .= (empty($s_username) ? '' : ', ') . '...'; } } $subject = preg_replace($orig_word, $replacement_word, $privmsg_rowset[$i]['privmsg_subject']); // nav sentence if ($detailed) { $w_folder_id = $privmsg_rowset[$i]['privmsg_folder_id']; $w_folder_main = $w_folder_id; if (!empty($folders['main'][$w_folder_id])) { $w_folder_main = $folders['main'][$w_folder_id]; } $u_main = append_sid("{$main_pgm}&folder={$w_folder_main}"); $l_main = _lang($folders['data'][$w_folder_main]['folder_name']); $u_subf = append_sid("{$main_pgm}&folder={$w_folder_id}"); $l_subf = _lang($folders['data'][$w_folder_id]['folder_name']); if ($w_folder_main == $w_folder_id) { $u_main = $u_subf; $l_main = $l_subf; $u_subf = ''; $l_subf = ''; } } // post icons mod installed $post_icon = ''; if ($mod_post_icon) { $topic_type = POST_NORMAL; $post_icon = get_icon_title($privmsg_rowset[$i]['privmsg_icon'], 1, $topic_type); } // display $template->assign_block_vars('pm_row', array('COLOR' => $color ? 'row1' : 'row2', 'FOLDER_IMG' => $icon_flag, 'L_FOLDER_ALT' => $icon_flag_alt, 'ICON' => $post_icon, 'SUBJECT' => $subject, 'U_SUBJECT' => append_sid("{$main_pgm}&pmmode=view&start={$pm_start}&folder={$folder_id}&" . POST_POST_URL . "={$privmsg_recip_id}"), 'S_USERNAME' => $s_username, 'DATE' => create_date($userdata['user_dateformat'], $privmsg_rowset[$i]['privmsg_time'], $userdata['user_timezone']), 'CHECKED' => $marked ? 'checked="checked"' : '', 'S_MARK_ID' => $privmsg_recip_id, 'U_FOLDER' => $u_main, 'L_FOLDER' => $l_main, 'U_SUBFOLDER' => $u_subf, 'L_SUBFOLDER' => $l_subf)); // post icon mod installed if ($mod_post_icon) { $template->assign_block_vars('pm_row.switch_icon', array()); } else { $template->assign_block_vars('pm_row.switch_icon_no', array()); } // selection available if ($select) { $template->assign_block_vars('pm_row.privmsg_select', array()); } else { $template->assign_block_vars('pm_row.privmsg_no_select', array()); } // folder nav link asked if ($detailed) { $template->assign_block_vars('pm_row.detailed', array()); if (!empty($u_subf)) { $template->assign_block_vars('pm_row.detailed.sub', array()); } else { $template->assign_block_vars('pm_row.detailed.no_sub', array()); } } else { $template->assign_block_vars('pm_row.not_detailed', array()); } } // general marked $template->assign_vars(array('CHECKED' => $all_marked ? 'checked="checked"' : '')); // nothing to display if (count($privmsg_rowset) == 0) { $template->assign_block_vars('pm_empty', array()); } // post icon nod installed if ($mod_post_icon) { $template->assign_block_vars('switch_icon', array()); } else { $template->assign_block_vars('switch_icon_no', array()); } // selection of pms available if ($select) { $template->assign_block_vars('privmsg_select', array()); // save button : appears always for save box when we're not in savebox if ($folder_main != SAVEBOX || !empty($folders['sub'][$folder_main])) { $template->assign_block_vars('privmsg_select.switch_move', array()); } // delete button $template->assign_block_vars('privmsg_select.switch_delete', array()); // save to mail $template->assign_block_vars('privmsg_select.switch_savetomail', array()); } else { if ($detailed) { $template->assign_block_vars('switch_cancel', array()); } else { $template->assign_block_vars('privmsg_no_select', array()); } } $template->assign_var_from_handle('PRIVMSGA_BOX', 'privmsga_box'); }
// get the from panels $privmsg['privmsgs_id'] = $privmsg_recip_id; $from_panel = pcp_output_panel('PHPBB.privmsgs.left', $privmsg); $buttons_panel = pcp_output_panel('PHPBB.privmsgs.buttons', $privmsg); $from_ignore_panel = pcp_output_panel('PHPBB.privmsgs.left.ignore', $privmsg); $ignore_buttons = pcp_output_panel('PHPBB.privmsgs.buttons.ignore', $privmsg); // // Dump it to the templating engine // $template->assign_vars(array('AUTHOR_PANEL' => !$privmsg['user_my_ignore'] ? $from_panel : $from_ignore_panel, 'DEST_PANEL' => !$privmsg['user_my_ignore'] ? $to_panel : $to_ignore_panel, 'BUTTONS_PANEL' => !$privmsg['user_my_ignore'] ? $buttons_panel : $ignore_buttons)); } // post icons mod installed $post_icon = ''; if ($mod_post_icon) { $topic_type = POST_NORMAL; $post_icon = get_icon_title($privmsg['privmsg_icon'], 1, $topic_type); $post_subject = $post_icon . ' ' . $post_subject; } // // Dump it to the templating engine // $template->assign_vars(array('MESSAGE_FROM' => $s_user_from, 'MESSAGE_TO' => $s_user_to, 'POST_SUBJECT' => $post_subject, 'POST_DATE' => $post_date, 'MESSAGE' => $private_message, 'SIGNATURE' => $signature, 'QUOTE_PM_IMG' => $quote_img, 'QUOTE_PM' => $quote, 'EDIT_PM_IMG' => $editpm_img, 'EDIT_PM' => $editpm, 'DELETE_PM_IMG' => $delpm_img, 'DELETE_PM' => $delpm, 'FORWARD_PM_IMG' => $forward_img, 'FORWARD_PM' => $forward, 'SAVEMAIL_PM_IMG' => $savemail_img, 'SAVEMAIL_PM' => $savemail, 'S_MOVE_FOLDER' => $s_move_folder)); // system _hide(POST_POST_URL, $privmsg_recip_id); _hide('folder', $folder_id); _hide(POST_USERS_URL, $view_user_id); _hide('pmmode', $pmmode); _hide('start', $pm_start); $template->assign_vars(array('S_ACTION' => append_sid($main_pgm), 'S_HIDDEN_FIELDS' => _hidden_get())); } // send to browser