Вопрос по Гланцу

Временное хранилище подлежащих удалению тем. Установлена авточистка (33 дня).

Вопрос по Гланцу

Сообщение ddd111 31.07.2008 14:36

Код: Выделить всё
<?php
/***************************************************************************
*                              glance.php
*                            -------------------
*   begin                : Monday, Jun 14, 2004
*   copyright            : Xpert
*   contact              : www.phpbbguru.net, xpert@phpbbguru.net
*   version              : 1.0.0
*
*   $Id: glance.php,v 1.0.0 2004/06/14 11:21 xpert Exp $
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/

/* Settings */

// Number of recent articles you wish to display
$glance_num_recent = 7;

// Old recent topic bullet
$glance_recent_bullet_old = '<span class="genmed"><b>&#155;</b>&nbsp;</span>'; // CAN ALSO BE AN IMAGE

// New recent topic bullet
$glance_recent_bullet_new = '<span class="genmed" style="color:#FFA34F"><b>&#155;</b>&nbsp;</span>'; // CAN ALSO BE AN IMAGE

// Change the bullet if a topic is new? (true / false)
$glance_show_new_bullets = true;

// Message tracking will track to see if a user has read the topic during their session (true / false)
$glance_track = true;

// IDs of forums you don't want to show at the recent list
// Zero ('0') if no such forums. If multiply forums write as the following: '2,6'
$glance_ignore = '0';

/* End of settings section */

if ( !defined('IN_PHPBB') )
{
        die("Hacking attempt");
}

// Get user last visit
$glance_last_visit = $userdata['user_lastvisit'];

// Message tracking
if ( !isset($tracking_topics) && $glance_track ) $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : '';

// Define censored word matches
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

// Getting forums auth settings

$unauthed_forums = array();

$sql = "SELECT forum_id, auth_view FROM " . FORUMS_TABLE;
$result = $db->sql_query($sql) or message_die(GENERAL_ERROR, "Could not query new topic information", "", __LINE__, __FILE__, $sql);

$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);

if ( $num_forums = count($is_auth_ary) )
{
   while ( list($forum_id, $auth_mod) = each($is_auth_ary) )
      {
         $unauthed = false;
            if ( !$auth_mod['auth_view'] )
            {
                $glance_ignore .= ', ' . $forum_id;
            }
      }
}

// Getting recent topics
$sql = 'SELECT t.topic_id, t.topic_title, t.topic_last_post_id, p.post_time FROM ' .
      TOPICS_TABLE . ' AS t, ' . POSTS_TABLE . ' AS p ' .
      'WHERE t.forum_id NOT IN (' . $glance_ignore . ') ' .
   'AND p.topic_id = t.topic_id ' .
      'AND p.post_id = t.topic_last_post_id ' .
//    AND t.topic_type <> " . POST_ANNOUNCE . "
      'AND t.topic_moved_id = 0 ' .
      'ORDER BY t.topic_last_post_id DESC ' .
      'LIMIT ' . $glance_num_recent;

$result = $db->sql_query($sql) or message_die(GENERAL_ERROR, "Could not query latest topic information", "", __LINE__, __FILE__, $sql);

$latest_topics = array();
while ( $topic_row = $db->sql_fetchrow($result) )
{
        $topic_row['topic_title'] = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_row['topic_title']) : $topic_row['topic_title'];
        $latest_topics[] = $topic_row;
}
$db->sql_freeresult($result);

// Output
$template->set_filenames(array(
        'glance_output' => 'glance_body.tpl')
);

$bullet_pre = 'glance_recent_bullet';

if ( !empty($latest_topics) )
{
        for ( $i = 0; $i < count($latest_topics); $i++ )
        {
                if ( $userdata['session_logged_in'] )
                {
                        $unread_topics = false;
                        $topic_id = $latest_topics[$i]['topic_id'];
                        if ( $latest_topics[$i]['post_time'] > $glance_last_visit )
                        {
                                $unread_topics = true;
                                if( !empty($tracking_topics[$topic_id]) && $glance_track )
                                {
                                        if( $tracking_topics[$topic_id] >= $latest_topics[$i]['post_time'] )
                                        {
                                                $unread_topics = false;
                                        }
                                }
                        }
                        $shownew = $unread_topics;
                }
                else
                {
                        $unread_topics = false;
                        $shownew = false;
                }

                $bullet_full = $bullet_pre . ( ( $shownew && $glance_show_new_bullets ) ? '_new' : '_old' );
                $newest_code = ( $unread_topics && $glance_show_new_bullets ) ? '&amp;view=newest' : '';
                $topic_link = 'viewtopic.php?t=' . $latest_topics[$i]['topic_id'] . $newest_code;

                $template->assign_block_vars('recent', array(
                        'BULLET' => $$bullet_full,
                        'TOPIC_LINK' => $topic_link,
                        'TOPIC_TITLE' => $latest_topics[$i]['topic_title'])
                );
        }
}
else
{
        $template->assign_block_vars('recent', array(
                'BULLET' => $glance_recent_bullet_old,
                'TOPIC_TITLE' => 'None')
        );
}

$template->assign_vars(array(
        'ANNO_HEADING' => $lang['Glance_anno_heading'],
        'ANNO_TEXT' => $lang['Glance_anno'],
        'RECENT_HEADING' => $lang['Glance_recent_heading'])
);

$template->assign_var_from_handle('GLANCE_OUTPUT', 'glance_output');

// end
?>


Где что исправить чтобы в "Последние обсуждения" по ссылкам кидало не на первый пост в теме, а на последнее сообщение ?

Заранее Спасибо
ddd111
phpBB 1.2.1
 
Сообщения: 29
Зарегистрирован: 08.04.2008 3:39


Re: Вопрос по Гланцу

Сообщение Kastaneda 31.07.2008 15:26

Во-первых, про гланц мне ничего не известно (это намёк на тупое название темы). Во-вторых, тема про «Glance» уже существует (это ещё один намёк на нарушение правил конференци).
Kastaneda
Модератор
Модератор
 
Сообщения: 718
Зарегистрирован: 06.10.2004 14:29


Вернуться в Корзина

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 0