Beispiel #1
0
                 $topic_check_status = '<span style="color:green;">&radic;</span>';
                 break;
             case 3:
                 $topic_check_status = '<span style="color:#E6C506;">&#8776;</span>';
                 break;
             case 4:
                 $topic_check_status = '<span style="color:red;">&#8800;</span>';
                 break;
             case 5:
                 $topic_check_status = '<span style="color:blue;">&#8734;</span>';
                 break;
             default:
                 $topic_check_status = '<span style="color:red;">?</span>';
         }
     }
     $template->assign_block_vars('topicrow', array('ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'GOTO_PAGE' => $goto_page, 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']), 'TOPIC_TITLE' => $topic_title, '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, 'TOPIC_CHECK_STATUS' => isset($topic_tor[$topic_id]) ? $topic_check_status . " &#183; " : "", 'TOPICS_SEPARATOR' => $topics_separator, 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'U_VIEW_TOPIC' => $view_topic_url));
     //bt
     if (isset($topic_tor[$topic_id])) {
         $seeds = isset($topic_tor[$topic_id]['seeders']) ? $topic_tor[$topic_id]['seeders'] : 0;
         $leechs = isset($topic_tor[$topic_id]['leechers']) ? $topic_tor[$topic_id]['leechers'] : 0;
         $s_last = $topic_tor[$topic_id]['seeder_last_seen'];
         $compl = $topic_tor[$topic_id]['complete_count'];
         $att_id = $topic_tor[$topic_id]['attach_id'];
         $size = $topic_tor[$topic_id]['size'];
         $template->assign_block_vars('topicrow.tor', array('SEEDERS' => $seeds ? $seeds : 0, 'SEEDERS_TITLE' => $seeds ? 'Seeders' : " Seeder last seen: \n " . ($s_last ? create_date($ft_cfg['default_dateformat'], $s_last, $ft_cfg['board_timezone']) : 'Never'), 'LEECHERS' => $leechs ? $leechs : 0, 'TORRENT_SIZE' => humn_size($size), 'DL_TORRENT_HREF' => append_sid("download.php?id=" . $att_id)));
     }
     $template->assign_block_vars('topicrow.compl', array('COMPLETED' => isset($compl) ? $compl : ''));
     unset($compl);
     //bt end
 }
 ////	$topics_count -= $total_announcements;
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}&amp;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&amp;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 . "&amp;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&amp;" . 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&amp;" . 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));
}
Beispiel #3
0
				'TOPIC_TYPE_ICON' => $topic_link['icon'],
				'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']),
				'CLASS_NEW' => $topic_link['class_new'],
				'NEWEST_POST_IMG' => $topic_link['newest_post_img'],
				'GOTO_PAGE' => $topic_pagination['base'],
				'GOTO_PAGE_FULL' => $topic_pagination['full'],
				'REPLIES' => $replies,
				'VIEWS' => $topic_rowset[$i]['topic_views'],
				'FIRST_POST_URL' => $first_post_url,
				'FIRST_POST_TIME' => $first_post_time,
				'FIRST_POST_AUTHOR' => $first_post_author,
				'LAST_POST_TIME' => $last_post_time,
				'LAST_POST_AUTHOR' => $last_post_author,
				'LAST_POST_URL' => $last_post_url,
				'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
				'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']),
				)
			);
		}

		$template->assign_vars(array(
			'PAGINATION' => generate_pagination('modcp.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $forum_id . '&amp;sid=' . $user->data['session_id'], $forum_topics, $config['topics_per_page'], $start),
			'PAGE_NUMBER' => sprintf($lang['Page_of'], (floor($start / $config['topics_per_page']) + 1), ceil($forum_topics / $config['topics_per_page'])),
			'L_GOTO_PAGE' => $lang['Goto_page']
			)
		);
		$template->pparse('body');
		break;
}

page_footer(true, '', true);
Beispiel #4
0
                        $topic_type = $lang['Topic_Sticky'] . ' ';
                    } else {
                        if ($topic_type == POST_COMMEND) {
                            $topic_type = $lang['Topic_Commend'] . ' ';
                        } else {
                            if ($topic_status == TOPIC_MOVED) {
                                $topic_type = $lang['Topic_Moved'] . ' ';
                            } else {
                                $topic_type = '';
                            }
                        }
                    }
                }
            }
            if ($row['topic_vote']) {
                $topic_type .= $lang['Topic_Poll'] . ' ';
            }
            $topic_title = $row['topic_title'];
            if (count($orig_word)) {
                $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
            }
            $u_view_topic = "modcp.{$phpEx}?mode=split&amp;" . POST_TOPIC_URL . "={$topic_id}&amp;sid=" . $userdata['session_id'];
            $topic_replies = $row['topic_replies'];
            $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
            $template->assign_block_vars('topicrow', array('U_VIEW_TOPIC' => $u_view_topic, 'TOPIC_FOLDER_IMG' => $folder_img, 'TOPIC_TYPE' => $topic_type, 'TOPIC_TITLE' => $topic_title, 'REPLIES' => $topic_replies, 'LAST_POST_TIME' => $last_post_time, 'TOPIC_ID' => $topic_id, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($row['topic_attachment']), 'L_TOPIC_FOLDER_ALT' => $folder_alt));
        }
        $template->assign_vars(array('PAGINATION' => generate_pagination("modcp.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}&amp;sid=" . $userdata['session_id'], $forum_topics, $board_config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($forum_topics / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page']));
        $template->pparse('body');
        break;
}
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
            $s_table = '<tr><td class="row2" colspan="6"><span class="gensmall">' . $s_table_lang . '</span></td></tr>';
        } else {
            $s_table = '';
        }
        if ($topic_type_table != 0 && $topic_rowset[$i]['topic_type'] == 4) {
            $s_table = '<tr><td class="row2" colspan="6"><span class="gensmall">' . $lang['Topics'] . '</span></td></tr>';
            $topic_type_table = 0;
        } else {
            if ($topic_rowset[$i]['topic_type'] == POST_COMMEND) {
                $s_table = '';
                $topic_type_table = 0;
            } else {
                $topic_type_table = $topic_rowset[$i]['topic_type'];
            }
        }
        $template->assign_block_vars('topicrow', array('ROW_COLOR' => $row_color, 'ROW_CLASS' => $row_class, 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'GOTO_PAGE' => $goto_page, 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']), 'TOPIC_TITLE' => $topic_title, 'S_TABLE' => $s_table, '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));
    }
    $topics_count -= $total_announcements;
    $template->assign_vars(array('PAGINATION' => generate_pagination("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}&amp;topicdays={$topic_days}", $topics_count, $board_config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($topics_count / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page']));
} else {
    //
    // No topics
    //
    $no_topics_msg = $forum_row['forum_status'] == FORUM_LOCKED ? $lang['Forum_locked'] : $lang['No_topics_post_one'];
    $template->assign_vars(array('L_NO_TOPICS' => $no_topics_msg));
    $template->assign_block_vars('switch_no_topics', array());
}
//
// Parse the page and print
//
$template->pparse('body');
Beispiel #6
0
					'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $searchset[$i]['forum_id'], 'name'),
					'FORUM_ID' => $forum_id,
					'TOPIC_ID' => $topic_id,

					'TOPIC_FOLDER_IMG' => $topic_link['image'],
					'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
					'TOPIC_AUTHOR' => $topic_author,
					'TOPIC_TITLE' => $topic_title,
					'TOPIC_TITLE_PLAIN' => $topic_title_plain,
					'TOPIC_TYPE' => $topic_link['type'],
					'TOPIC_TYPE_ICON' => $topic_link['icon'],
					'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']),
					'CLASS_NEW' => $topic_link['class_new'],
					'NEWEST_POST_IMG' => $topic_link['newest_post_img'],
					'L_NEWS' => $news_label,
					'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($searchset[$i]['topic_attachment']),

					// Event Registration - BEGIN
					'REG_OPTIONS' => $regoptions,
					'REG_USER_OWN_REG' => $reg_user_own_reg,
					// Event Registration - END
					'GOTO_PAGE' => $topic_pagination['base'],
					'GOTO_PAGE_FULL' => $topic_pagination['full'],
					'REPLIES' => $replies,
					'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,
// UPI2DB - BEGIN
					'NO_AGM' => ($mark_read_forbid || (isset($s2) && ($s2 == 'perm'))) ? 'disabled' : '',
Beispiel #7
0
	$template->assign_block_vars('recent', array(
		'ROW_CLASS' => (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'],

		'TOPIC_ID' => $topic_id,
		'TOPIC_FOLDER_IMG' => $topic_link['image'],
		'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
		'TOPIC_TITLE' => $topic_title,
		'TOPIC_TITLE_PLAIN' => $topic_title_plain,
		'TOPIC_TYPE' => $topic_link['type'],
		'TOPIC_TYPE_ICON' => $topic_link['icon'],
		'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']),
		'CLASS_NEW' => $topic_link['class_new'],
		'NEWEST_POST_IMG' => $topic_link['newest_post_img'],
		'L_NEWS' => $news_label,
		'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($line[$i]['topic_attachment']),
		'GOTO_PAGE' => $topic_pagination['base'],
		'GOTO_PAGE_FULL' => $topic_pagination['full'],
		'L_VIEWS' => $lang['Views'],
		'VIEWS' => $views,

		'L_REPLIES' => $lang['Replies'],
		'REPLIES' => $replies,
		//'FIRST_POST_TIME' => sprintf($lang['Recent_first'], $first_time),
		'FIRST_POST_TIME' => $first_time,
		'FIRST_AUTHOR' => $first_author,
		'LAST_POST_TIME' => $last_time,
		'LAST_AUTHOR' => $last_author,
		'LAST_URL' => $last_url,
		'FORUM_NAME' => $line[$i]['forum_name'],
		'U_VIEW_FORUM' => $forum_url,
Beispiel #8
0
 $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']);
 // Begin PNphpBB2 Module
 //		$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&amp;" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';
 $last_post_author = $topic_rowset[$i]['id2'] == ANONYMOUS ? $topic_rowset[$i]['post_username2'] != '' ? DataUtil::formatForDisplay($topic_rowset[$i]['post_username2']) . ' ' : $lang['Guest'] . ' ' : '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . DataUtil::formatForDisplay($topic_rowset[$i]['user2']) . '</a>';
 // End PNphpBB2 Module
 $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'];
 // Begin PNphpBB2 Module
 //		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
 //		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
 $row_color = !($i % 2) ? $phpbb_theme['td_color1'] : $phpbb_theme['td_color2'];
 $row_class = !($i % 2) ? $phpbb_theme['td_class1'] : $phpbb_theme['td_class2'];
 // End PNphpBB2 Module
 $template->assign_block_vars('topicrow', array('ICON' => $topic_rowset[$i]['topic_icon'] == 0 ? "&nbsp" : "<img " . $board_config['posticons_size'] . " src=\"" . $board_config['path_posticons'] . "/image_" . $topic_rowset[$i]['topic_icon'] . ".gif\" alt=\"" . $topic_rowset[$i]['topic_icon'] . "\" border=\"0\">", 'ROW_COLOR' => $row_color, 'ROW_CLASS' => $row_class, 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'GOTO_PAGE' => $goto_page, 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_ATTACHMENT_IMG' => !intval($attach_config['disable_mod']) ? topic_attachment_image($topic_rowset[$i]['topic_attachment']) : '', 'TOPIC_TITLE' => $topic_title_status . $topic_title, '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));
 // Begin PNphpBB2 Module (Split Annouce/Sticky)
 $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 prec type
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}&amp;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}&amp;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&amp;' . 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&amp;' . 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));
}
Beispiel #10
0
			$row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'];
			$template->assign_block_vars('topic_watch_row', array(
				'ROW_CLASS' => $row_class,

				'TOPIC_ID' => $topic_id,
				'TOPIC_FOLDER_IMG' => $topic_link['image'],
				'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
				'TOPIC_AUTHOR' => $topic_poster,
				'TOPIC_TITLE' => $watch_rows[$i]['topic_title'],
				'TOPIC_TYPE' => $topic_link['type'],
				'TOPIC_TYPE_ICON' => $topic_link['icon'],
				'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']),
				'CLASS_NEW' => $topic_link['class_new'],
				'NEWEST_POST_IMG' => $topic_link['newest_post_img'],
				'L_NEWS' => $news_label,
				'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($watch_rows[$i]['topic_attachment']),
				'FORUM_NAME' => $watch_rows[$i]['forum_name'],
				'REPLIES' => $replies,
				'VIEWS' => $views,
				'FIRST_POST_TIME' => create_date_ip($config['default_dateformat'], $watch_rows[$i]['topic_time'], $config['board_timezone']),
				'LAST_POST_TIME' => create_date_ip($config['default_dateformat'], $watch_rows[$i]['post_time'], $config['board_timezone']),
				'LAST_POST_AUTHOR' => $last_poster,
				'GOTO_PAGE' => $topic_pagination['base'],
				'GOTO_PAGE_FULL' => $topic_pagination['full'],

				// gratuitous name changes
				'S_WATCHED_TOPIC_ID' => $watch_rows[$i]['topic_id'],
				'S_WATCHED_TOPIC' => $watch_rows[$i]['topic_title'],
				'S_WATCHED_TOPIC_REPLIES' => $replies,
				'S_WATCHED_TOPIC_VIEWS' => $views,
				'S_WATCHED_TOPIC_START' => create_date_ip($config['default_dateformat'], $watch_rows[$i]['topic_time'], $config['board_timezone']),
Beispiel #11
0
            //-- fin mod : quick title edition ---------------------------------------------
            if (count($orig_word)) {
                $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
            }
            $u_view_topic = "modcp.{$phpEx}?mode=split&amp;" . POST_TOPIC_URL . "={$topic_id}&amp;sid=" . $userdata['session_id'];
            $topic_replies = $row['topic_replies'];
            //-- mod : rank color system ---------------------------------------------------
            //-- add
            $topic_author_color = $rcs->get_colors($row);
            $topic_author = $row['user_id'] != ANONYMOUS ? '<a href="' . $get->url('userlist', array('mode' => 'viewprofile', POST_USERS_URL => $row['user_id']), true) . '"' . $topic_author_color . '>' : '';
            $topic_author .= $row['user_id'] != ANONYMOUS ? $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_author_color = $rcs->get_colors($row, '', false, 'group_id2', 'color2', 'level2');
            $last_post_author = $row['id2'] == ANONYMOUS ? $row['post_username2'] != '' ? $row['post_username2'] : $lang['Guest'] : '<a href="' . $get->url('userlist', array('mode' => 'viewprofile', POST_USERS_URL => $row['id2']), true) . '"' . $last_post_author_color . '>' . $row['user2'] . '</a>';
            $last_post_url = '<a href="' . $get->url('viewtopic', array(POST_POST_URL => $row['topic_last_post_id']), true, $row['topic_last_post_id']) . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
            $views = $row['topic_views'];
            //-- fin mod : rank color system -----------------------------------------------
            $last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
            // Start Smilies Invasion Mod
            if ($board_config['allow_smilies']) {
                $topic_title = smilies_pass($topic_title);
            }
            // End Smilies Invasion Mod
            $template->assign_block_vars('topicrow', array('U_VIEW_TOPIC' => $u_view_topic, 'TOPIC_FOLDER_IMG' => $folder_img, 'HYPERCELL_CLASS' => get_hypercell_class($row['topic_status'], false, $row['topic_type']), 'TOPIC_TYPE' => $topic_type, 'TOPIC_TITLE' => $topic_title, 'REPLIES' => $topic_replies, 'TOPIC_AUTHOR' => $topic_author, '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, 'LAST_POST_TIME' => $last_post_time, 'TOPIC_ID' => $topic_id, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($row['topic_attachment']), 'L_TOPIC_FOLDER_ALT' => $folder_alt));
        }
        $template->assign_vars(array('PAGINATION' => generate_pagination("modcp.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}&amp;sid=" . $userdata['session_id'], $forum_topics, $board_config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($forum_topics / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page']));
        $template->pparse('body');
        break;
}
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
Beispiel #12
0
                        $goto_page .= ', ';
                    }
                }
                $times++;
            }
            $goto_page .= ' ] ';
        } else {
            $goto_page = '';
        }
        $view_topic_url = URL::index("&amp;file=viewtopic&amp;" . POST_TOPIC_URL . "={$topic_id}");
        $topic_author = $topic_rowset[$i]['user_id'] != ANONYMOUS ? '<a href="' . URL::index("Your_Account&amp;profile=" . $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>' : '';
        $row_color = !($i % 2) ? $bgcolor2 : $bgcolor1;
        $row_class = !($i % 2) ? 'row1' : 'row2';
        $template->assign_block_vars('topicrow', array('L_HEADER' => $topics_header, 'ROW_COLOR' => $row_color, 'ROW_CLASS' => $row_class, 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'GOTO_PAGE' => $goto_page, 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']), 'TOPIC_TITLE' => $topic_title, 'TOPIC_TYPE' => $topic_type, 'VIEWS' => $topic_rowset[$i]['topic_views'], 'FIRST_POST_TIME' => create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time']), 'LAST_POST_TIME' => create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time']), 'LAST_POST_AUTHOR' => $topic_rowset[$i]['id2'] == ANONYMOUS ? $topic_rowset[$i]['post_username2'] != '' ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' : '<a href="' . URL::index("Your_Account&amp;profile=" . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>', 'LAST_POST_IMG' => '<a href="' . URL::index("&amp;file=viewtopic&amp;" . 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'] . '" /></a>', 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'TOPIC_ICON' => $topic_icon_source, 'U_VIEW_TOPIC' => $view_topic_url));
    }
    if ($topics_count > $total_announcements) {
        $topics_count -= $total_announcements;
    }
    $template->assign_vars(array('PAGINATION' => generate_pagination("&amp;file=viewforum&amp;" . POST_FORUM_URL . "={$forum_id}&amp;topicdays={$topic_days}", $topics_count, $board_config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($topics_count / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page']));
} else {
    //
    // No topics
    //
    $template->assign_vars(array('L_NO_TOPICS' => $forum_row['forum_status'] == FORUM_LOCKED ? $lang['Forum_locked'] : $lang['No_topics_post_one']));
    $template->assign_block_vars('switch_no_topics', array());
}
//
// Parse the page and print
//