function includeNewsBlock() { global $template, $lang, $db, $board_config, $auction_config_data; global $orig_word, $replacement_word; include './extension.inc'; include './includes/bbcode.' . $phpEx; if ($auction_config_data['auction_block_display_news'] == 1) { $template->assign_block_vars('news_block', array('L_AUCTION_NEWS' => $lang['auction_news'])); $sql = "SELECT t.*,\r\n u.username,\r\n u.user_id,\r\n p.*,\r\n x.*\r\n FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " x\r\n WHERE t.forum_id = " . $auction_config_data['auction_news_forum_id'] . " AND\r\n t.topic_poster = u.user_id AND\r\n p.post_id = t.topic_first_post_id AND\r\n x.post_id = t.topic_first_post_id\r\n ORDER BY t.topic_first_post_id DESC\r\n LIMIT 0,3"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query news block information', '', __LINE__, __FILE__, $sql); } $total_topics = 0; while ($row = $db->sql_fetchrow($result)) { $topic_rowset[] = $row; $total_topics++; } $db->sql_freeresult($result); // Dump out the news if ($total_topics) { for ($i = 0; $i < $total_topics; $i++) { $topic_id = $topic_rowset[$i]['topic_id']; $post_subject = count($orig_word) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title']; $topic_poster_url = $topic_rowset[$i]['user_id'] != ANONYMOUS ? append_sid("profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . "=" . $topic_rowset[$i]['user_id']) : ''; $topic_poster = $topic_rowset[$i]['user_id'] != ANONYMOUS ? $topic_rowset[$i]['username'] : ($topic_rowset[$i]['post_username'] != "" ? $topic_rowset[$i]['post_username'] : $lang['Guest']); $topic_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']); $bbcode_uid = $topic_rowset[$i]['bbcode_uid']; // Format the message $message = $topic_rowset[$i]['post_text']; if (!$board_config['allow_html'] && $topic_rowset[$i]['enable_html']) { $message = preg_replace("#(<)([\\/]?.*?)(>)#is", "<\\2>", $message); } if ($board_config['allow_bbcode'] && $bbcode_uid != "") { $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\\:[0-9a-z\\:]+\\]/si", "]", $message); } $message = make_clickable($message); // Define censored word matches if (empty($orig_word) && empty($replacement_word)) { $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); } // Replace naughty words if (count($orig_word)) { $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); $message = preg_replace($orig_word, $replacement_word, $message); } // Parse smilies if ($board_config['allow_smilies']) { if ($topic_rowset[$i]['enable_smilies']) { $message = smilies_pass($message); } } // Replace newlines $message = str_replace("\n", "\n<br />\n", $message); $view_topic_url = append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}"); $template->assign_block_vars('news_block.content_block', array('TOPIC_TITLE' => $post_subject, 'POST_TEXT' => $message, 'TOPIC_POSTER' => $topic_poster, 'U_TOPIC_POSTER' => $topic_poster_url, 'TOPIC_TIME' => $no_date ? '' : $topic_time, 'L_VIEW_TOPIC' => $lang['auction_news_more'], 'U_VIEW_TOPIC' => $view_topic_url)); } } } }
function create_atom($file_path, $mode, $id, $title, $topics) { global $bb_cfg; $dir = dirname($file_path); if (!file_exists($dir)) { if (!bb_mkdir($dir)) { return false; } } foreach ($topics as $topic) { $last_time = $topic['topic_last_post_time']; if ($topic['topic_last_post_edit_time']) { $last_time = $topic['topic_last_post_edit_time']; } $date = bb_date($last_time, 'Y-m-d', 0); $time = bb_date($last_time, 'H:i:s', 0); break; } $atom = ""; $atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; $atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\">\n"; $atom .= "<title>{$title}</title>\n"; $atom .= "<updated>" . $date . "T{$time}+00:00</updated>\n"; $atom .= "<id>tag:rto.feed,2000:/{$mode}/{$id}</id>\n"; $atom .= "<link href=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\" />\n"; foreach ($topics as $topic) { $topic_id = $topic['topic_id']; $tor_size = ''; if (isset($topic['tor_size'])) { $tor_size = str_replace(' ', ' ', ' [' . humn_size($topic['tor_size']) . ']'); } $topic_title = $topic['topic_title']; $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); if (count($orig_word)) { $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); } $topic_title = wbr($topic_title); $author_name = $topic['first_username'] ? wbr($topic['first_username']) : 'Гость'; $last_time = $topic['topic_last_post_time']; if ($topic['topic_last_post_edit_time']) { $last_time = $topic['topic_last_post_edit_time']; } $date = bb_date($last_time, 'Y-m-d', 0); $time = bb_date($last_time, 'H:i:s', 0); $updated = ''; $checktime = TIMENOW - 604800; // неделя (week) if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) { $updated = '[Обновлено] '; } $atom .= "<entry>\n"; $atom .= "\t<title type=\"html\"><![CDATA[{$updated}{$topic_title}{$tor_size}]]></title>\n"; $atom .= "\t<author>\n"; $atom .= "\t\t<name>{$author_name}</name>\n"; $atom .= "\t</author>\n"; $atom .= "\t<updated>" . $date . "T{$time}+00:00</updated>\n"; $atom .= "\t<id>tag:rto.feed," . $date . ":/t/{$topic_id}</id>\n"; $atom .= "\t<link href=\"viewtopic.php?t={$topic_id}\" />\n"; $atom .= "</entry>\n"; } $atom .= "</feed>"; @unlink($file_path); $fp = fopen($file_path, "w"); fwrite($fp, $atom); fclose($fp); return true; }
function send_mail($type, $from_userdata, &$to_user_ids, &$recips, $subject, $message, $time = 0, $copy = true, $parsed_values = array()) { global $db, $board_config, $lang, $phpbb_root_path, $phpEx, $userdata; // fix some parameters $subject = trim($subject); $message = trim($message); // check we have a message and a subject if (empty($subject)) { return 'Empty_subject'; } if (empty($message)) { return 'Empty_message'; } // recipient is not an array, so make one if (!is_array($to_user_ids) && !empty($to_user_ids)) { $to_user_ids = array(intval($to_user_ids)); } // check if recipients if (empty($to_user_ids)) { return 'No_to_user'; } $s_to_user_ids = implode(', ', $to_user_ids); // censor words $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // process some cleaning $subject = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($subject)) : unprepare_message($subject); $message = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($message)) : unprepare_message($message); // clean any bbcode_uid $subject = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $subject); $message = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message); // clean HTML $subject = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $subject); $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $message); // from_user_id can be 0 for sys message (sent by the board) if (empty($from_userdata)) { $from_userdata['user_id'] = 0; $from_userdata['user_level'] = ADMIN; $from_userdata['username'] = $board_config['sitename']; } $from_user_id = intval($from_userdata['user_id']); // get the recipients $sql_where = "user_email <> '' AND user_email IS NOT NULL"; // this will require enhancement for the pcp ignore/friend list if (!$copy) { $sql_where .= " AND user_id <> " . intval($from_userdata['user_id']); } if ($userdata['user_level'] != ADMIN) { $sql_where .= " AND (user_viewemail = 1 OR user_id = " . intval($userdata['user_id']) . ")"; } // // Make sure user wánts the mail // $notify_sql = ''; $sql_notify = ''; if ($type == 'privmsg_notify') { $sql_notify = ', user_notify_pm'; $notify_sql = 'AND user_notify_pm != 0'; } // read the mail recipients $sql = "SELECT user_id, user_email, user_lang, username" . $sql_notify . "\n FROM " . USERS_TABLE . "\n WHERE user_id IN ({$s_to_user_ids})\n {$notify_sql}\n AND user_id NOT IN (0, " . ANONYMOUS . ")\n AND {$sql_where}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not read recipient mail list', '', __LINE__, __FILE__, $sql); } $count = 0; $bcc_list_ary = array(); while ($row = $db->sql_fetchrow($result)) { $count++; $bcc_list_ary[$row['user_lang']][] = array('user_id' => $row['user_id'], 'mail' => $row['user_email'], 'username' => $row['username']); } if ($count > 0) { // read the message recipients $msg_to = ''; if (!empty($recips)) { for ($i = 0; $i < count($recips); $i++) { $username = isset($recips[$i]['privmsg_to_username']) ? $recips[$i]['privmsg_to_username'] : $recips[$i]['username']; if (!empty($username)) { $msg_to .= (empty($msg_to) ? '' : ', ') . $username; } } } // // Let's do some checking to make sure that mass mail functions // are working in win32 versions of php. // if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) { $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var'; // We are running on windows, force delivery to use our smtp functions // since php's are broken by default $board_config['smtp_delivery'] = 1; $board_config['smtp_host'] = @$ini_val('SMTP'); } // init the mailer $emailer = new emailer($board_config['smtp_delivery']); // init server vars $server_name = trim($board_config['server_name']); $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://'; $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/'; // sender script $script_path = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path'])); $script_path = !empty($script_name) ? $server_protocol . $server_name . $server_port . $script_name . '/' : $server_protocol . $server_name . $server_port; // start the emailer data $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); // choose template switch ($type) { case 'privmsg_notify': $tpl = 'privmsg_notify'; $mail_subject = _lang('Notification_subject'); break; case 'save_to_mail': $tpl = 'admin_send_email'; $mail_subject = _lang('Save_to_mail_subject') . $subject; break; default: $tpl = 'admin_send_email'; $mail_subject = $subject; break; } // send message (coming partially from privmsgs.php) : one per lang @reset($bcc_list_ary); while (list($user_lang, $bcc_list) = each($bcc_list_ary)) { if ($count == 1) { $emailer->email_address($bcc_list[0]['mail']); } else { // affect users mail for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]['mail']); } } // remove {USERNAME} from the template if more than one recipient if ($count > 0) { $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg); } // build message $msg = _lang('Subject') . ': ' . $subject; $msg .= "\n" . _lang('From') . ': ' . $from_userdata['username']; if (!empty($msg_to)) { $msg .= "\n" . _lang('To') . ': ' . $msg_to; } if (!empty($time)) { $dformat = $board_config['default_dateformat']; $dtz = $board_config['board_timezone']; if (count($to_user_ids) == 1) { $dformat = $userdata['user_dateformat']; $dtz = $userdata['user_timezone']; } $post_date = create_date($dformat, $time, $dtz); $msg .= "\n" . _lang('Date') . ': ' . $post_date; } $msg .= "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" . $message; // generic values $parsed_values['SITENAME'] = $board_config['sitename']; $parsed_values['EMAIL_SIG'] = !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''; $parsed_values['MESSAGE'] = $msg; $parsed_values['FROM'] = $userdata['username']; $emailer->use_template($tpl, $user_lang); $emailer->set_subject($mail_subject); $emailer->assign_vars($parsed_values); // send $emailer->send(); $emailer->reset(); } } }
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)); }
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 topic_review($topic_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; if (!$is_inline_review) { if (!isset($topic_id)) { message_die(GENERAL_MESSAGE, 'Topic_not_exist'); } // // Get topic info ... // $sql = "SELECT t.topic_title, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments \n\t\t\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f \n\t\t\tWHERE t.topic_id = {$topic_id}\n\t\t\t\tAND f.forum_id = t.forum_id"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql); } if (!($forum_row = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); } $db->sql_freeresult($result); $forum_id = $forum_row['forum_id']; $topic_title = $forum_row['topic_title']; // // Start session management // $userdata = session_pagestart($user_ip, $forum_id); init_userprefs($userdata); // // End session management // $is_auth = array(); $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row); if (!$is_auth['auth_read']) { message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type'])); } } // // 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'] . ' - ' . $topic_title; include $phpbb_root_path . 'includes/page_header.' . $phpEx; $template->set_filenames(array('reviewbody' => 'posting_topic_review.tpl')); } // // Go ahead and pull all data for this topic // $sql = "SELECT u.username, u.user_id, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid\n\t\tFROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND p.poster_id = u.user_id\n\t\t\tAND p.post_id = pt.post_id\n\t\tORDER BY p.post_time DESC\n\t\tLIMIT " . $board_config['posts_per_page']; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain post/user information', '', __LINE__, __FILE__, $sql); } // // Okay, let's do the loop, yeah come on baby let's do the loop // and it goes like this ... // if ($row = $db->sql_fetchrow($result)) { $mini_post_img = $images['icon_minipost']; $mini_post_alt = $lang['Post']; $i = 0; do { $poster_id = $row['user_id']; $poster = $row['username']; $post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']); // // Handle anon users posting with usernames // if ($poster_id == ANONYMOUS && $row['post_username'] != '') { $poster = $row['post_username']; $poster_rank = $lang['Guest']; } elseif ($poster_id == ANONYMOUS) { $poster = $lang['Guest']; $poster_rank = ''; } $post_subject = $row['post_subject'] != '' ? $row['post_subject'] : ''; $message = $row['post_text']; $bbcode_uid = $row['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['enable_html']) { $message = preg_replace('#(<)([\\/]?.*?)(>)#is', '<\\2>', $message); } if ($bbcode_uid != "") { $message = $board_config['allow_bbcode'] ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message); } $message = 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 = smilies_pass($message); } $message = str_replace("\n", '<br />', $message); // // Again this will be handled by the templating // code at some point // $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2']; $row_class = !($i % 2) ? $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)); $i++; } while ($row = $db->sql_fetchrow($result)); } else { message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', '', __LINE__, __FILE__, $sql); } $db->sql_freeresult($result); $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 censor($passage) { $GLOBALS['wpUtdInt']->switch_db('TO_P'); if ('PHPBB2' == $this->ver) { // define censored word matches $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // censor text and title if (count($orig_word)) { $passage = preg_replace($orig_word, $replacement_word, $passage); } } else { $passage = censor_text($passage); } $GLOBALS['wpUtdInt']->switch_db('TO_W'); return $passage; }
function make_cat_nav_tree($cur, $pgm = '', $nav_class = 'nav', $topic_title = '', $forum_id = 0) { global $phpbb_root_path, $phpEx, $db; global $global_orig_word, $global_replacement_word; global $nav_separator; global $tree; // get topic or post level $type = substr($cur, 0, 1); $id = intval(substr($cur, 1)); $fcur = ''; switch ($type) { case POST_TOPIC_URL: if (empty($forum_id) || empty($topic_title)) { $sql = "SELECT forum_id, topic_title\n\t\t\t\t\t\t\tFROM " . TOPICS_TABLE . " WHERE topic_id = {$id}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query topics information', '', __LINE__, __FILE__, $sql); } if ($row = $db->sql_fetchrow($result)) { $topic_title = $row['topic_title']; $forum_id = $row['forum_id']; } } else { $row = array(); $row['topic_title'] = $topic_title; $row['forum_id'] = $forum_id; } if (!empty($forum_id)) { $fcur = POST_FORUM_URL . $row['forum_id']; $topic_title = $row['topic_title']; $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); if (count($orig_word)) { $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); } } break; case POST_POST_URL: if (empty($forum_id) || empty($topic_title)) { $sql = "SELECT t.forum_id, t.topic_title\n\t\t\t\t\t\t\tFROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t\n\t\t\t\t\t\t\tWHERE t.topic_id=p.topic_id AND post_id = {$id}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query posts information', '', __LINE__, __FILE__, $sql); } if (!($row = $db->sql_fetchrow($result))) { $row['forum_id'] = 0; $row['topic_title'] = ''; } } else { $row['forum_id'] = $forum_id; $row['topic_title'] = $topic_title; } if (!empty($forum_id) && !empty($topic_title)) { $fcur = POST_FORUM_URL . $row['forum_id']; $topic_title = $row['topic_title']; $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); if (count($orig_word)) { $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); } } break; } // keep the compliancy with prec versions if (!isset($tree['keys'][$cur])) { $cur = isset($tree['keys'][POST_CAT_URL . $cur]) ? POST_CAT_URL . $cur : $cur; } // find the object $this_key = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1; $res = ''; while ($this_key >= 0 || $fcur != '') { $type = substr($fcur, 0, 1) != '' ? substr($cur, 0, 1) : $tree['type'][$this_key]; switch ($type) { case POST_CAT_URL: $field_name = get_object_lang($cur, 'name'); $param_type = POST_CAT_URL; $param_value = $tree['id'][$this_key]; $pgm_name = "forum.{$phpEx}"; break; case POST_FORUM_URL: $field_name = get_object_lang($cur, 'name'); $param_type = POST_FORUM_URL; $param_value = $tree['id'][$this_key]; $pgm_name = "viewforum.{$phpEx}"; break; case POST_TOPIC_URL: $field_name = $topic_title; $param_type = POST_TOPIC_URL; $param_value = $id; $pgm_name = "viewtopic.{$phpEx}"; break; case POST_POST_URL: $field_name = $topic_title; $param_type = POST_POST_URL; $param_value = $id . '#' . $id; $pgm_name = "viewtopic.{$phpEx}"; break; default: $field_name = ''; $param_type = ''; $param_value = ''; $pgm_name = "index.{$phpEx}"; break; } if ($pgm != '') { $pgm_name = "{$pgm}.{$phpEx}"; } if (!empty($field_name)) { $res = '<a href="' . append_sid('./' . $pgm_name . ($field_name != '' ? "?{$param_type}={$param_value}" : '')) . '" class="' . $nav_class . '">' . $field_name . '</a>' . ($res != '' ? $nav_separator . $res : ''); } // find parent object if ($fcur != '') { $cur = $fcur; $pgm = ''; $fcur = ''; $topic_title = ''; } else { $cur = $tree['main'][$this_key]; } $this_key = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1; } return $res; }
function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$notify_user) { global $board_config, $lang, $db, $phpbb_root_path; global $userdata, $user_ip; $current_time = time(); if ($mode == 'delete') { $delete_sql = !$post_data['first_post'] && !$post_data['last_post'] ? " AND user_id = " . $userdata['user_id'] : ''; $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}" . $delete_sql; if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql); } } else { if ($mode == 'reply') { $sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql); } $user_id_sql = ''; while ($row = $db->sql_fetchrow($result)) { if (isset($row['ban_userid'])) { $user_id_sql = ', ' . $row['ban_userid']; } } $sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u \r\n\t\t\t\tWHERE tw.topic_id = {$topic_id} \r\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " ) \r\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " \r\n\t\t\t\t\tAND t.topic_id = tw.topic_id \r\n\t\t\t\t\tAND u.user_id = tw.user_id"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql); } $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); include $phpbb_root_path . 'includes/emailer.php'; $emailer = new emailer($board_config['smtp_delivery']); $script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path'])); $script_name = $script_name != '' ? $script_name . '/viewtopic.php' : 'viewtopic.php'; $server_name = trim($board_config['server_name']); $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://'; $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/'; $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n"; $update_watched_sql = ''; if ($row = $db->sql_fetchrow($result)) { @set_time_limit(120); $topic_title = preg_replace($orig_word, $replacement_word, unprepare_message($row['topic_title'])); do { if ($row['user_email'] != '') { $emailer->use_template('topic_notify', $row['user_lang']); $emailer->email_address($row['user_email']); $emailer->set_subject(); $emailer->extra_headers($email_headers); $emailer->assign_vars(array('EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'USERNAME' => $row['username'], 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic")); $emailer->send(); $emailer->reset(); $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id']; } } while ($row = $db->sql_fetchrow($result)); } if ($update_watched_sql != '') { $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})"; $db->sql_query($sql); } } $sql = "SELECT topic_id \r\n\t\t\tFROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\tAND user_id = " . $userdata['user_id']; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); if (!$notify_user && !empty($row['topic_id'])) { $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\tAND user_id = " . $userdata['user_id']; if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql); } } else { if ($notify_user && empty($row['topic_id'])) { $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\r\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)"; if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql); } } } } }
function censor_text($text) { global $_CLASS; if ($_CLASS['core_user']->is_user && !$_CLASS['core_user']->optionget('viewcensors')) { return $text; } $censors = obtain_word_list(); if (!empty($censors)) { return preg_replace($censors['match'], $censors['replace'], $text); } return $text; }
/** * Censoring */ function censor_text($str) { static $censors; if (!isset($censors) || !is_array($censors)) { $censors = array(); obtain_word_list($censors['match'], $censors['replace']); } return count($censors['match']) ? preg_replace($censors['match'], $censors['replace'], $str) : $str; }
function phpbb_fetch_thread($topic_id = null) { global $CFG, $userdata; if (!$topic_id) { phpbb_raise_error('no topic id specified', __FILE__, __LINE__); } $sql = 'SELECT p.*, pt.*, u.*'; if (!$CFG['posts_hide_ranks']) { $sql .= ', r.*'; } $sql .= ' FROM ' . USERS_TABLE . ' AS u, ' . POSTS_TEXT_TABLE . ' AS pt, ' . POSTS_TABLE . ' AS p'; if (!$CFG['posts_hide_ranks']) { $sql .= ', ' . RANKS_TABLE . ' AS r'; } $sql .= ' WHERE p.topic_id = ' . $topic_id . ' AND u.user_id = p.poster_id AND pt.post_id = p.post_id AND u.user_id = p.poster_id'; if (!$CFG['posts_hide_ranks']) { $sql .= ' AND r.rank_id = u.user_rank'; } if ($CFG['posts_search_string']) { $sql .= ' AND (' . $CFG['posts_search_string'] . ')'; } $sql .= ' ORDER BY ' . $CFG['posts_order']; if ($CFG['posts_span_pages']) { $CFG['posts_span_pages_numrows'] = phpbb_numrows(phpbb_query($sql)); if ($CFG['posts_span_pages_offset'] > $CFG['posts_span_pages_numrows']) { $CFG['posts_span_pages_offset'] = $CFG['posts_span_pages_numrows'] - 1; } $CFG['posts_offset'] = $CFG['posts_span_pages_offset']; } else { $CFG['posts_offset'] = 0; } if ($CFG['posts_limit'] != 0) { $sql .= ' LIMIT ' . $CFG['posts_offset'] . ',' . $CFG['posts_limit']; } $result = phpbb_fetch_rows($sql); if ($result) { if ($CFG['auth_check']) { phpbb_get_auth_list(); $authed = array(); for ($i = 0; $i < count($result); $i++) { if (in_array($result[$i]['forum_id'], $CFG['auth_list'])) { $authed[] = $result[$i]; } } $result = $authed; } $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); for ($i = 0; $i < count($result); $i++) { $result[$i]['post_time'] = $result[$i]['post_time'] + $CFG['time_zone']; $result[$i]['topic_time'] = $result[$i]['topic_time'] + $CFG['time_zone']; $result[$i]['post_edit_time'] = $result[$i]['post_edit_time'] + $CFG['time_zone']; $result[$i]['date'] = date($CFG['date_format'], $result[$i]['post_time']); $result[$i]['time'] = date($CFG['time_format'], $result[$i]['post_time']); $result[$i]['edit_date'] = date($CFG['date_format'], $result[$i]['post_edit_time']); $result[$i]['edit_time'] = date($CFG['time_format'], $result[$i]['post_edit_time']); $result[$i]['post_text'] = phpbb_parse_text($result[$i]['post_text'], $result[$i]['bbcode_uid'], $result[$i]['enable_smilies'], $CFG['posts_enable_bbcode'], $CFG['posts_enable_html'], $CFG['posts_hide_images'], $CFG['posts_replace_images']); if (count($orig_word)) { $result[$i]['topic_title'] = preg_replace($orig_word, $replacement_word, $result[$i]['topic_title']); $result[$i]['post_text'] = preg_replace($orig_word, $replacement_word, $result[$i]['post_text']); } $result[$i]['trimmed'] = false; phpbb_trim_text($result[$i]['post_text'], $result[$i]['trimmed'], $CFG['posts_trim_text_character'], $CFG['posts_trim_text_number'], $CFG['posts_trim_text_words']); $result[$i]['topic_trimmed'] = false; phpbb_trim_text($result[$i]['topic_title'], $result[$i]['topic_trimmed'], '', $CFG['posts_trim_topic_number'], ''); } if (is_array($topic_id)) { $sorted = array(); for ($i = 0; $i < count($topic_id); $i++) { for ($j = 0; $j < count($result); $j++) { if ($topic_id[$i] == $result[$j]['topic_id']) { $sorted[] = $result[$j]; } } } $result = $sorted; } } return $result; }
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'); }
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user) { global $board_config, $lang, $db, $phpbb_root_path, $MAIN_CFG; global $userdata; $current_time = time(); if ($mode == 'delete') { $delete_sql = !$post_data['first_post'] && !$post_data['last_post'] ? " AND user_id = " . $userdata['user_id'] : ''; $db->sql_query("DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}" . $delete_sql); } else { if ($mode == 'reply') { $result = $db->sql_query('SELECT user_id FROM ' . USERS_TABLE . ' WHERE user_level<1'); $user_id_sql = ''; while ($row = $db->sql_fetchrow($result)) { $user_id_sql .= ', ' . $row['user_id']; } $sql = "SELECT u.user_id, u.user_email, u.user_lang\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u\n\t\t\t\tWHERE tw.topic_id = {$topic_id}\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ")\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\tAND u.user_id = tw.user_id"; $result = $db->sql_query($sql); $update_watched_sql = ''; $bcc_list_ary = array(); if ($row = $db->sql_fetchrow($result)) { // Sixty second limit set_time_limit(0); do { if ($row['user_email'] != '') { $bcc_list_ary[$row['user_lang']][] = $row['user_email']; } $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id']; } while ($row = $db->sql_fetchrow($result)); if (sizeof($bcc_list_ary)) { include "includes/phpBB/emailer.php"; $emailer = new emailer(); $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); $topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, htmlunprepare($topic_title)) : htmlunprepare($topic_title); reset($bcc_list_ary); while (list($user_lang, $bcc_list) = each($bcc_list_ary)) { $emailer->use_template('topic_notify', $user_lang); for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]); } // The Topic_reply_notification lang string below will be used // if for some reason the mail template subject cannot be read // ... note it will not necessarily be in the posters own language! $emailer->set_subject($lang['Topic_reply_notification']); $emailer->assign_vars(array('EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => URL::index('&file=viewtopic&' . POST_POST_URL . "={$post_id}", true, true) . "#{$post_id}", 'U_STOP_WATCHING_TOPIC' => URL::index('&file=viewtopic&' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic", true, true))); $emailer->send(); $emailer->reset(); //send_mail($error, $message, false, $lang['Topic_reply_notification'], $to='', $to_name='') } } } $db->sql_freeresult($result); if ($update_watched_sql != '') { $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\t\tWHERE topic_id = {$topic_id} AND user_id IN ({$update_watched_sql})"; $db->sql_query($sql); } } $sql = "SELECT topic_id FROM " . TOPICS_WATCH_TABLE . "\n\t\t\tWHERE topic_id = {$topic_id} AND user_id = " . $userdata['user_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); if (!$notify_user && !empty($row['topic_id'])) { $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id} AND user_id = " . $userdata['user_id']; $db->sql_query($sql); } else { if ($notify_user && empty($row['topic_id'])) { $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\n\t\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)"; $db->sql_query($sql); } } } }
function bbcode2html($text) { global $bbcode; if (!isset($bbcode)) { $bbcode = new bbcode(); } $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); if (count($orig_word)) { $text = preg_replace($orig_word, $replacement_word, $text); } return $bbcode->bbcode2html($text); }
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$notify_user) { global $bb_cfg, $lang, $userdata; if (!$bb_cfg['topic_notify_enabled']) { return; } if ($mode != 'delete') { if ($mode == 'reply') { $update_watched_sql = $user_id_sql = array(); $sql = DB()->fetch_rowset("SELECT ban_userid FROM " . BB_BANLIST . " WHERE ban_userid != 0"); foreach ($sql as $row) { $user_id_sql[] = ',' . $row['ban_userid']; } $user_id_sql = join('', $user_id_sql); $watch_list = DB()->fetch_rowset("SELECT u.username, u.user_id, u.user_email, u.user_lang\n\t\t\t\tFROM " . BB_TOPICS_WATCH . " tw, " . BB_USERS . " u\n\t\t\t\tWHERE tw.topic_id = {$topic_id}\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . EXCLUDED_USERS_CSV . $user_id_sql . ")\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\t\tAND u.user_id = tw.user_id\n\t\t\t\t\tAND u.user_active = 1\n\t\t\t\tORDER BY u.user_id\n\t\t\t"); if ($watch_list) { require CLASS_DIR . 'emailer.php'; $emailer = new emailer($bb_cfg['smtp_delivery']); $orig_word = $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); if (count($orig_word)) { $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); } $u_topic = make_url(TOPIC_URL . $topic_id . '&view=newest#newest'); $unwatch_topic = make_url(TOPIC_URL . "{$topic_id}&unwatch=topic"); foreach ($watch_list as $row) { $emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>"); $emailer->email_address($row['username'] . " <{$row['user_email']}>"); $emailer->use_template('topic_notify', $row['user_lang']); $emailer->assign_vars(array('TOPIC_TITLE' => html_entity_decode($topic_title), 'SITENAME' => $bb_cfg['sitename'], 'USERNAME' => $row['username'], 'U_TOPIC' => $u_topic, 'U_STOP_WATCHING_TOPIC' => $unwatch_topic)); $emailer->send(); $emailer->reset(); $update_watched_sql[] = $row['user_id']; } $update_watched_sql = join(',', $update_watched_sql); } if ($update_watched_sql) { DB()->query("UPDATE " . BB_TOPICS_WATCH . "\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_UNNOTIFIED . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})\n\t\t\t\t"); } } $topic_watch = DB()->fetch_row("SELECT topic_id FROM " . BB_TOPICS_WATCH . " WHERE topic_id = {$topic_id} AND user_id = {$userdata['user_id']}", 'topic_id'); if (!$notify_user && !empty($topic_watch)) { DB()->query("DELETE FROM " . BB_TOPICS_WATCH . " WHERE topic_id = {$topic_id} AND user_id = {$userdata['user_id']}"); } else { if ($notify_user && empty($topic_watch)) { DB()->query("\n\t\t\t\tINSERT INTO " . BB_TOPICS_WATCH . " (user_id, topic_id, notify_status)\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, " . TOPIC_WATCH_NOTIFIED . ")\n\t\t\t"); } } } }
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user) { global $board_config, $lang, $db, $phpbb_root_path, $phpEx; global $userdata, $user_ip; $current_time = time(); if ($mode != 'delete') { if ($mode == 'reply') { $sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE; if (!($result = $db->sql_query($sql, false, true))) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql); } $user_id_sql = ''; while ($row = $db->sql_fetchrow($result)) { if (isset($row['ban_userid']) && !empty($row['ban_userid'])) { $user_id_sql .= ', ' . $row['ban_userid']; } } $sql = "SELECT u.user_id, u.user_email, u.user_lang \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u \r\n\t\t\t\tWHERE tw.topic_id = {$topic_id} \r\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ") \r\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " \r\n\t\t\t\t\tAND u.user_id = tw.user_id"; if (!($result = $db->sql_query($sql))) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql); } $update_watched_sql = ''; $bcc_list_ary = array(); if ($row = $db->sql_fetchrow($result)) { // Sixty second limit @set_time_limit(60); do { if ($row['user_email'] != '') { $bcc_list_ary[$row['user_lang']][] = $row['user_email']; } $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id']; } while ($row = $db->sql_fetchrow($result)); // // Let's do some checking to make sure that mass mail functions // are working in win32 versions of php. // if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) { $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var'; // We are running on windows, force delivery to use our smtp functions // since php's are broken by default $board_config['smtp_delivery'] = 1; $board_config['smtp_host'] = @$ini_val('SMTP'); } if (sizeof($bcc_list_ary)) { include $phpbb_root_path . 'includes/emailer.' . $phpEx; $emailer = new emailer($board_config['smtp_delivery']); $script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path'])); $script_name = $script_name != '' ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.' . $phpEx; $server_name = trim($board_config['server_name']); $server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://'; $server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/'; $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); $emailer->from($board_config['board_email']); $emailer->replyto($board_config['board_email']); $topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title); @reset($bcc_list_ary); while (list($user_lang, $bcc_list) = each($bcc_list_ary)) { $emailer->use_template('topic_notify', $user_lang); for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]); } // The Topic_reply_notification lang string below will be used // if for some reason the mail template subject cannot be read // ... note it will not necessarily be in the posters own language! $emailer->set_subject($lang['Topic_reply_notification']); // This is a nasty kludge to remove the username var ... till (if?) // translators update their templates $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg); $emailer->assign_vars(array('EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic")); $emailer->send(); $emailer->reset(); } } } $db->sql_freeresult($result); if ($update_watched_sql != '') { $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})"; $db->sql_query($sql); } } $sql = "SELECT topic_id \r\n\t\t\tFROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\tAND user_id = " . $userdata['user_id']; if (!($result = $db->sql_query($sql))) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); if (!$notify_user && !empty($row['topic_id'])) { $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\tAND user_id = " . $userdata['user_id']; if (!$db->sql_query($sql)) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql); } } else { if ($notify_user && empty($row['topic_id'])) { $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\r\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)"; if (!$db->sql_query($sql)) { $db->clear_cache('posts_'); message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql); } } } } $db->clear_cache('posts_'); }
function pcp_output_topics_stat($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; global $db; $txt = ''; $img = ''; $res = ''; if (!empty($view_userdata['user_posts']) && $view_userdata['user_id'] != ANONYMOUS) { $most_active_topic = -1; $most_active_topic_title = ''; $most_active_topic_posts = 0; $most_active_topic_posts_total = 0; $most_active_topic_posts_total_forum = 0; // get the value $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); $forum_ids = array(); while (list($forum_id, $auth) = @each($is_auth)) { if ($auth['auth_view']) { $forum_ids[] = $forum_id; } } if (!empty($forum_ids)) { $s_forum_ids = implode(', ', $forum_ids); // most active topic $sql = "SELECT p.topic_id, f.forum_posts, t.topic_title, t.topic_replies+1 AS topic_posts, count(p.post_id) AS posts_count\n FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f\n WHERE p.poster_id = " . $view_userdata['user_id'] . "\n AND t.topic_id = p.topic_id\n AND t.forum_id IN ({$s_forum_ids})\n AND f.forum_id = t.forum_id\n GROUP BY p.topic_id\n ORDER BY posts_count DESC\n LIMIT 0,1"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not get most active topic informations', '', __LINE__, __FILE__, $sql); } if ($row = $db->sql_fetchrow($result)) { // Define censored word matches $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // get the info $most_active_topic_id = $row['topic_id']; $most_active_topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, $row['topic_title']) : $row['topic_title']; $most_active_topic_posts = $row['posts_count']; $most_active_topic_posts_total = $row['topic_posts']; $most_active_topic_posts_total_forum = $row['forum_posts']; } // display if ($most_active_topic_id > -1) { // topic $temp_url = append_sid("./viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$most_active_topic_id}"); $txt = '<a href="' . $temp_url . '" class="topictitle">' . $most_active_topic_title . '</a>'; $txt .= '<br /><span class="genmed">' . sprintf('[' . $lang['Most_active_topic_stat'] . ']', $most_active_topic_posts, $most_active_topic_posts * 100 / $most_active_topic_posts_total, $most_active_topic_posts * 100 / $most_active_topic_posts_total_forum) . '</span>'; } } // result $res = pcp_output_format($field_name, $txt, $img, $map_name); } return $res; }
// $userdata['user_new_privmsg'] = 0; $userdata['user_unread_privmsg'] = $userdata['user_new_privmsg'] + $userdata['user_unread_privmsg']; // // Generate page // $page_title = $lang['Private_Messaging']; include $phpbb_root_path . 'includes/page_header.' . $phpEx; // // Load templates // $template->set_filenames(array('body' => 'privmsgs_body.tpl')); make_jumpbox('viewforum.' . $phpEx); $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // // New message // $post_new_mesg_url = '<a href="' . append_sid("privmsg.{$phpEx}?mode=post") . '"><img src="' . $images['post_new'] . '" alt="' . $lang['Send_a_new_message'] . '" border="0" /></a>'; // // General SQL to obtain messages // $sql_tot = "SELECT COUNT(privmsgs_id) AS total \r\n\tFROM " . PRIVMSGS_TABLE . " "; $sql = "SELECT pm.privmsgs_type, pm.privmsgs_id, pm.privmsgs_date, pm.privmsgs_subject, u.user_id, u.username \r\n\tFROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u "; //-- mod : rank color system --------------------------------------------------- //-- add $sql = str_replace(', u.user_id', ', u.user_id, u.user_level, u.user_color, u.user_group_id', $sql); //-- fin mod : rank color system ----------------------------------------------- switch ($folder) { case 'inbox':
function get_related_topics($topic_id) { global $board_config, $db, $lang, $template, $theme, $images, $phpEx; global $userdata, $HTTP_COOKIE_VARS; global $rcs, $qte; // // Fetch all words that appear in the title of $topic_id // $sql = 'SELECT m.word_id FROM ' . SEARCH_MATCH_TABLE . ' m, ' . TOPICS_TABLE . ' t WHERE m.post_id = t.topic_first_post_id AND t.topic_id = ' . intval($topic_id); if (!($result = $db->sql_query($sql, false, 'search_match_t' . intval($topic_id) . '_'))) { message_die(GENERAL_ERROR, 'Could not retrieve word matches', '', __LINE__, __FILE__, $sql); } $word_ids = array(0); while ($row = $db->sql_fetchrow($result)) { $word_ids[] = intval($row['word_id']); } $word_id_sql = implode(', ', $word_ids); // // Only search for related topics in the forums where the user has read access // $is_auth = array(); $is_auth = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); $forum_ids = array(0); while (list($forum_id, $forum_auth) = @each($is_auth)) { if ($forum_auth['auth_read']) { $forum_ids[] = $forum_id; } } $forum_id_sql = implode(', ', $forum_ids); $sql = 'SELECT DISTINCT(t.topic_id) FROM ' . SEARCH_MATCH_TABLE . ' m, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t WHERE t.topic_id <> ' . intval($topic_id) . ' AND t.topic_status <> ' . TOPIC_MOVED . ' AND p.topic_id = t.topic_id AND p.post_id = m.post_id AND p.forum_id IN (' . $forum_id_sql . ') AND m.title_match = 1 AND m.word_id IN (' . $word_id_sql . ') LIMIT 0, 5'; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not retrieve related topics information', '', __LINE__, __FILE__, $sql); } $topic_ids = array(); while ($row = $db->sql_fetchrow($result)) { $topic_ids[] = $row['topic_id']; } $topic_id_sql = implode(', ', $topic_ids); // // No topics? Exit // if (count($topic_ids) == 0) { return; } // // Output to page // $template->set_filenames(array('related_topics' => 'viewtopic_related_body.tpl')); $template->assign_vars(array('L_RELATED_TOPICS' => $lang['Related_topics'], 'L_AUTHOR' => $lang['Author'], 'L_TOPICS' => $lang['Topics'], 'L_REPLIES' => $lang['Replies'], 'L_VIEWS' => $lang['Views'], 'L_LASTPOST' => $lang['Last_Post'])); // // Define censored word matches // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // // Fetch all topic information // $sql = 'SELECT t.*, u.username, u.user_id, u.user_level, u.user_color, u.user_group_id, u2.username as user2, u2.user_id as id2, u2.user_level as level2, u2.user_color as color2, u2.user_group_id as group_id2, p.post_username, p2.post_username AS post_username2, p2.post_time FROM ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p, ' . POSTS_TABLE . ' p2, ' . USERS_TABLE . ' u2 WHERE t.topic_id IN (' . $topic_id_sql . ') AND t.topic_poster = u.user_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id ORDER BY t.topic_type DESC, t.topic_last_post_id DESC'; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not retrieve topic information', '', __LINE__, __FILE__, $sql); } $topic_row = array(); $topic_row = $db->sql_fetchrowset($result); $db->sql_freeresult($result); if (count($topic_row) == 0) { return; } $i = 0; foreach ($topic_row as $row) { $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; $topic_title = $row['topic_title']; $qte->attr($topic_title, $row['topic_attribute']); if (count($orig_word)) { $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); } $replies = $row['topic_replies']; $views = $row['topic_views']; $topic_type = topic_type_lang($row['topic_type']); if ($row['topic_vote']) { $topic_type .= $lang['Topic_Poll'] . ' '; } if ($row['topic_type'] == POST_ANNOUNCE) { $folder = $images['folder_announce']; $folder_new = $images['folder_announce_new']; } else { if ($row['topic_type'] == POST_STICKY) { $folder = $images['folder_sticky']; $folder_new = $images['folder_sticky_new']; } else { if ($row['topic_status'] == TOPIC_LOCKED) { $folder = $images['folder_locked']; $folder_new = $images['folder_locked_new']; } else { if ($replies >= $board_config['hot_threshold']) { $folder = $images['folder_hot']; $folder_new = $images['folder_hot_new']; } else { $folder = $images['folder']; $folder_new = $images['folder_new']; } } } } $newest_post_img = ''; $folder_image = pic_for_topic($row); $topic_author = $row['user_id'] != ANONYMOUS ? '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . '=' . $row['user_id']) . '">' : ''; $topic_author .= $row['user_id'] != ANONYMOUS ? $rcs->get_colors($row, $row['username']) : ($row['post_username'] != '' ? $row['post_username'] : $lang['Guest']); $topic_author .= $row['user_id'] != ANONYMOUS ? '</a>' : ''; $first_post_time = create_date($board_config['default_dateformat'], $row['topic_time'], $board_config['board_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']); $last_post_author = $row['id2'] == ANONYMOUS ? $row['post_username2'] != '' ? $row['post_username2'] . ' ' : $lang['Guest'] . ' ' : '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&" . POST_USERS_URL . '=' . $row['id2']) . '">' . $rcs->get_colors($row, $row['user2'], false, 'group_id2', 'color2', 'level2') . '</a>'; $last_post_url = '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_POST_URL . '=' . $row['topic_last_post_id']) . '#' . $row['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2']; $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars('topicrow', array('ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'U_VIEW_TOPIC' => append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . '=' . $row['topic_id']), 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_TITLE' => $topic_title, 'TOPIC_TYPE' => $topic_type, 'VIEWS' => $views, 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_post_author, 'LAST_POST_IMG' => $last_post_url)); $i++; } $template->assign_var_from_handle('RELATED_TOPICS', 'related_topics'); return; }