To jest tylko wersja do druku, aby zobaczyć pełną wersję tematu, kliknij TUTAJ
phpBB2 by Przemo
Support forów phpBB2 modified by Przemo

1.12.7 i starsze - Last Popular Topics v1.31

geman - 03-05-2006, 20:05

Pewnie by dało, tylko że z SF nie miałem wiele do czynienia....
Crack - 03-05-2006, 20:11

Wystarczy że pokazywany adres przejdzie przez funkcję append_sid(), od tego momentu wkracza przepisywanie ze Spider Friendly.
geman - 03-05-2006, 20:11

Ok, to już poprawiam
Crack - 03-05-2006, 20:14

Dodam że każdy link wewnątrz forum powinien przechodzić przez append_sid() - inaczej użytkownik z wyłączonymi ciastkami (domyślne ustawienia IE 6) zostanie wylogowany.
geman - 03-05-2006, 20:39

Znajdź:
Kod:
//
   // Okay, let's build the topic recent and popular
   //
$auth_read = 0;
if ($userdata['session_logged_in']) $auth_read .= ',1';
if ($userdata['user_level'] == ADMIN ) $auth_read .= ',3';
   
$not_auth_view_sql = "SELECT forum_id FROM phpbb_forums WHERE auth_read IN ($auth_read)";
$not_auth_view = $db->sql_query($not_auth_view_sql);
while($row = mysql_fetch_row($not_auth_view))
{
  $id_forum .= $row[0].',';
}
$auth_view_sql = "SELECT DISTINCT c.forum_id FROM phpbb_forums a, phpbb_user_group b, phpbb_auth_access c
 WHERE b.user_id=$userdata[user_id] AND b.group_id=c.group_id";
$auth_view = $db->sql_query($auth_view_sql);
while($row = mysql_fetch_row($auth_view))
{
  $id_forum .= $row[0].',';
}
$id_forum = ereg_replace(",$", "", $id_forum);
   
$active_topics_sql="SELECT a.topic_id, a.topic_title, a.topic_replies,  a.topic_last_post_id, c.post_time
         FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d
         where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id
            and d.forum_id=a.forum_id
            AND d.forum_id IN ($id_forum)
         ORDER BY topic_last_post_id DESC
         LIMIT 5";
$active_topics = $db->sql_query($active_topics_sql);

$active_topics_sql2="SELECT a.topic_id,a.topic_title,  a.topic_replies,  a.topic_last_post_id, c.post_time
         FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d
         where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id
            and d.forum_id=a.forum_id
            AND d.forum_id IN ($id_forum)
         ORDER BY topic_replies DESC
         LIMIT 5";
$active_topics2 = $db->sql_query($active_topics_sql2);

$active_topics_sql3="SELECT a.topic_id,a.topic_title,  a.topic_views, a.topic_replies,  a.topic_last_post_id, c.post_time
         FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d
         where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id
            and d.forum_id=a.forum_id
            AND d.forum_id IN ($id_forum)
         ORDER BY topic_views DESC
         LIMIT 5";
$active_topics3 = $db->sql_query($active_topics_sql3);

   while (($line = mysql_fetch_array($active_topics)) and ($line2 = mysql_fetch_array($active_topics2)) and ($line3 = mysql_fetch_array($active_topics3)))
   {
      if (strlen($line['topic_title']) > 40)
      {
         $line_topic_title = substr($line['topic_title'], 0, 40)." ...";
      }
      else
      {
         $line_topic_title = $line['topic_title'];
      }
      if (strlen($line2['topic_title']) > 40)
      {
         $line_topic_title2 = substr($line2['topic_title'], 0, 40)." ...";
      }
      else
      {
         $line_topic_title2 = $line2['topic_title'];
      }
      if (strlen($line3['topic_title']) > 40)
      {
         $line_topic_title3 = substr($line3['topic_title'], 0, 40)." ...";
      }
      else
      {
         $line_topic_title3 = $line3['topic_title'];
      }
      $lastpost = "<a href=\"".$phpbb_root_path."viewtopic.php?t=" . $line['topic_id'] . "\" title=\"" . $line['topic_title'] ."\">" . $line_topic_title . "</a>";
      $poppost = "<a href=\"".$phpbb_root_path."viewtopic.php?t=" . $line2['topic_id'] . "\" title=\"" . $line2['topic_title'] ."\">" . $line_topic_title2 . "</a>";
      $poppostc = $line2['topic_replies'];
      $popviewpost = "<a href=\"".$phpbb_root_path."viewtopic.php?t=" . $line3['topic_id'] . "\" title=\"" . $line3['topic_title'] ."\">" . $line_topic_title3 . "</a>";
      $popviewpostc = $line3['topic_views'];
      $template->assign_block_vars('topicrecentpopular', array(
         'TOPICSPOPULAR' => $poppost,
         'TOPICSPOPULARC' => $poppostc,
         'TOPICSPOPULARVIEW' => $popviewpost,
         'TOPICSPOPULARVIEWC' => $popviewpostc,
         'TOPICSRECENT' => $lastpost)
      );
   }


Zamień na:
Kod:

   //
   // Okay, let's build the topic recent and popular
   //
$auth_read = 0;
if ($userdata['session_logged_in']) $auth_read .= ',1';
if ($userdata['user_level'] == ADMIN ) $auth_read .= ',3';
   
$not_auth_view_sql = "SELECT forum_id FROM " . FORUMS_TABLE . " WHERE auth_read IN ($auth_read)";
$not_auth_view = $db->sql_query($not_auth_view_sql);
while($row = mysql_fetch_row($not_auth_view))
{
  $id_forum .= $row[0].',';
}
$auth_view_sql = "SELECT DISTINCT c.forum_id FROM " . FORUMS_TABLE . " a, " . USER_GROUP_TABLE . "  b,
                 " . AUTH_ACCESS_TABLE . " c WHERE b.user_id=$userdata[user_id] AND b.group_id=c.group_id";
$auth_view = $db->sql_query($auth_view_sql);
while($row = mysql_fetch_row($auth_view))
{
  $id_forum .= $row[0].',';
}
$id_forum = ereg_replace(",$", "", $id_forum);
if (!empty($id_forum))
{   
    $active_topics_sql="SELECT a.topic_id, a.topic_title, a.topic_replies,  a.topic_last_post_id, c.post_time
             FROM " . TOPICS_TABLE . " a, " . USERS_TABLE . " b, " . POSTS_TABLE . " c, " . FORUMS_TABLE . " d
             where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id
                and d.forum_id=a.forum_id
                AND d.forum_id IN ($id_forum)
             ORDER BY a.topic_last_post_id DESC
             LIMIT 5";
    $active_topics = $db->sql_query($active_topics_sql);
   
    $active_topics_sql2="SELECT a.topic_id,a.topic_title,  a.topic_replies,  a.topic_last_post_id, c.post_time
             FROM " . TOPICS_TABLE . " a, " . USERS_TABLE . " b, " . POSTS_TABLE . " c, " . FORUMS_TABLE . " d
             where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id
                and d.forum_id=a.forum_id
                AND d.forum_id IN ($id_forum)
             ORDER BY a.topic_replies DESC
             LIMIT 5";
    $active_topics2 = $db->sql_query($active_topics_sql2);
   
    $active_topics_sql3="SELECT a.topic_id,a.topic_title,  a.topic_views, a.topic_replies,  a.topic_last_post_id, c.post_time
             FROM " . TOPICS_TABLE . " a, " . USERS_TABLE . " b, " . POSTS_TABLE . " c, " . FORUMS_TABLE . " d
             where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id
                and d.forum_id=a.forum_id
                AND d.forum_id IN ($id_forum)
             ORDER BY a.topic_views DESC
             LIMIT 5";
    $active_topics3 = $db->sql_query($active_topics_sql3);
   
       while (($line = mysql_fetch_array($active_topics)) and ($line2 = mysql_fetch_array($active_topics2)) and ($line3 = mysql_fetch_array($active_topics3)))
       {
          if (strlen($line['topic_title']) > 40)
          {
             $line_topic_title = substr($line['topic_title'], 0, 40)." ...";
          }
          else
          {
             $line_topic_title = $line['topic_title'];
          }
          if (strlen($line2['topic_title']) > 40)
          {
             $line_topic_title2 = substr($line2['topic_title'], 0, 40)." ...";
          }
          else
          {
             $line_topic_title2 = $line2['topic_title'];
          }
          if (strlen($line3['topic_title']) > 40)
          {
             $line_topic_title3 = substr($line3['topic_title'], 0, 40)." ...";
          }
          else
          {
             $line_topic_title3 = $line3['topic_title'];
          }
          $lastpost = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line['topic_id']) . '" title="' . $line['topic_title'] . '">' . $line_topic_title . '</a>';
          $poppost = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line2['topic_id']) . '" title="' . $line2['topic_title'] . '">' . $line_topic_title2 . '</a>';
          $poppostc = $line2['topic_replies'];
          $popviewpost = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line3['topic_id']) . '" title="' . $line3['topic_title'] . '">' . $line_topic_title3 . '</a>';
          $popviewpostc = $line3['topic_views'];
          $template->assign_block_vars('topicrecentpopular', array(
             'TOPICSPOPULAR' => $poppost,
             'TOPICSPOPULARC' => $poppostc,
             'TOPICSPOPULARVIEW' => $popviewpost,
             'TOPICSPOPULARVIEWC' => $popviewpostc,
             'TOPICSRECENT' => $lastpost)
          );
       }
}
else
    {
      $template->assign_block_vars('topicrecentpopular', array(
             'TOPICSPOPULAR' => 'Nie masz uprawnień',
             'TOPICSPOPULARC' => 'X',
             'TOPICSPOPULARVIEW' => 'Nie masz uprawnień',
             'TOPICSPOPULARVIEWC' => 'X',
             'TOPICSRECENT' => 'Nie masz uprawnień')
          );
    }

m@rcin... - 04-05-2006, 10:30

Kurcze, ale u mnie na forum nadal nie działa to poprawnie, przenosi do całkiem innego tematu :/
na tym forum: http://www.servisnet.pl/

geman - 04-05-2006, 11:16

Kurcze, nie wiem dlaczego, a jak zamienisz:
Kod:
AND d.forum_id IN ($id_forum)

na
Kod:
AND d.auth_view=0


to przenosi dobrze?

m@rcin... - 04-05-2006, 11:37

geman, nie, dalej przenosi całkiem gdzie indziej :/ załącze index.php - bo moze ja cos źle wyedytowałem?
geman - 04-05-2006, 11:43

Wygląda, że jest dobrze. Teraz w każdym razie mam pewność, że to nie przez moje modyfikacje ;) A bazę masz zsynchronizowaną?
m@rcin... - 04-05-2006, 11:48

geman napisał/a:
A bazę masz zsynchronizowaną?

Tak,


Więc jak to naprawić? :/

geman - 04-05-2006, 11:50

A ten plik?
m@rcin... - 04-05-2006, 11:57

geman napisał/a:
A ten plik?

Nic, dalej to samo...

geman - 04-05-2006, 11:59

A jak wyłączysz przepisywanie linków w SF?
m@rcin... - 04-05-2006, 12:04

geman napisał/a:
A jak wyłączysz przepisywanie linków w SF?

Dalej nic :| przenosi w inne tematy :/

geman - 04-05-2006, 12:08

Dobra, już chyba wiem, jednak to ja się walnąłem :/
Znajdź:
Kod:
"viewtopic.$phpEx?" . POST_POST_URL . '='


i zamień 3 razy na:
Kod:
"viewtopic.$phpEx?" . POST_TOPIC_URL . '='



Powered by phpBB modified by Przemo © 2003 phpBB Group