IT NEWS PC REVUE PC FORUM FreeBSDInternet time: @014
Obsah fóra
Pravidlá  •  Kontakt  •  Prihlásenie  •  Registrácia

Dokonalosť v jednoduchosti

Wyse T10 – dokonalosť, na ktorú ste čakali. www.ts.avnet.com

Hľadáte CRM softvér?

SunSoft.CRM • množstvo funkcií • možnosť individuálnych úprav • výhodná cena crm.sunsoft.sk

Sprostredkovávajte hypotéky

Začnite sprostredkovávať hypotéky s úspešným hypotekárnym centrom! www.SprostredkovanieUverov.sk

Čerstvý a voňavý domov?

Testovali sme Ambi Pur. Pozrite sa na prekvapivé výsledky experimentu! youtube.com/AmbiPur_SK

Získajte bonus 50 €

Prejdite na ktorýkoľvek program s platbou na faktúru. Len cez e-shop. www.o2.sk

Shows topic of last made post on index

Zaslať odpoveď
AutorSpráva
JanoF
Správca fóra
Správca fóra

Založený: 01.05.2005
Príspevky: 8736
Bydlisko: Bratislava
Vek: 27

PríspevokZaslal: Pi 13.10.06 9:16Odpovedať s citátomNávrat hore

kód:
##############################################################
## Mod Title:   shows topic of last made post on index
## Mod Version: 1.4.0
## Author:      e-sven <sven@e-sven.net> http://www.e-sven.net
## Description: -adds lasts post topic to each forum on
##               the index page (based on read-access)
##      -word censorship is used
##      -topic title with more then 27 chars are cut off
##      -mouseover info displays the full title
##
## Installation Level:  easy
## Installation Time:   2-5 Minutes
## Files To Edit:       index.php
## Included Files:      index.php (pre-modded)
##############################################################
## History:
##         0.9 not released beta
##         1.0 first working release
##         1.1 optimized db access
##      1.2 made implementation easier
##          (only two replaces have to be made)
##         1.2a just a minor bug (thanks to Acid)
##         1.3 empty forums where not displayed correctly
##         1.4 optimized db-query
##############################################################
## Before Adding This MOD To Your Forum,
## You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------------
#
index.php

#
#-----[ ACTION Find ]-----------------------------------------
#
         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
            FROM (( " . FORUMS_TABLE . " f
            LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
            LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
            ORDER BY f.cat_id, f.forum_order";
         break;
   }
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
   }

   $forum_data = array();
   while( $row = $db->sql_fetchrow($result) )
   {
      $forum_data[] = $row;
   }

   if ( !($total_forums = count($forum_data)) )
   {
      message_die(GENERAL_MESSAGE, $lang['No_forums']);
   }

   //
   // Obtain a list of topic ids which contain


#
#-----[ REPLACE WITH ]----------------------------------------
#
       $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id " .
         " FROM ((( " . FORUMS_TABLE . " f " .
         " LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )" .
         " LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) " .
         " LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = p.post_id ) " .
         " ORDER BY f.cat_id, f.forum_order";
      break;
   }
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
   }

   $forum_data = array();
   $topic_last_ary = array();
   $i=0;
   while( $row = $db->sql_fetchrow($result) )
   {
      if (!in_array($row['topic_last_post_id'], $topic_last_ary) || $row['topic_last_post_id']==0) {
         $topic_last_ary[i]=$row['topic_last_post_id'];
         $i++;
         $forum_data[] = $row;
      }
   }
   unset($topic_last_ary);
   if ( !($total_forums = count($forum_data)) )
   {
      message_die(GENERAL_MESSAGE, $lang['No_forums']);
   }
   
   //
   // Filter topic_title not allowed to read
   //
   if ( !($userdata['user_level'] == ADMIN && $userdata['session_logged_in']) ) {
      $auth_read_all = array();
      $auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
      $auth_data = '';
      for($i=0; $i<count($forum_data); $i++)
      {
         if (!$auth_read_all[$forum_data[$i]['forum_id']]['auth_read']) {
            $forum_data[$i]['topic_title']='';
         }
      }
   }

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

   //
   // Obtain a list of topic ids which contain


#
#-----[ ACTION Find ]-----------------------------------------
#
   if ( $forum_data[$j]['forum_last_post_id'] )
   {
   ...
   }


#
#-----[ ACTION Replace With ]---------------------------------
#
   if ( $forum_data[$j]['forum_last_post_id'] )
   {
      $topic_title = $forum_data[$j]['topic_title'];
      $topic_title2 = $forum_data[$j]['topic_title'];
      
      //
      // Censor topic title
      //
      if ( count($orig_word) )
      {
         $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
         $topic_title2 = preg_replace($orig_word, $replacement_word, $topic_title2);
      }
                              
      if (strlen($topic_title)>27) {
         $topic_title = substr($topic_title,0,24) . '...';
      }

      $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
      $last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>';
      $last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a><br>' . $lang['by'] . '&nbsp;';
      $last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
   }

#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------
#

_________________
Skrinka: Nexus Morpho & Enermax UCTB12P | Zdroj: Enermax EMG800AWT 800W | Základná doska: Asus Rampage III Gene | Procesor: Intel Core i7 990X Extreme Edition 3.46 GHz & Scythe Susanoo SCSO-1000 | Pamäť: Kingston HyperX XMP 24 GB DDR3 1600 MHz | Grafická karta: Asus GeForce GT 440 1 GB DDR3 & Thermalright HR-03 | Pevný disk: Intel SSD 510 Series 250 GB & Hitachi Deskstar 5K4000 4000 GB | Optická mechanika: Plextor PX-820SA | Čítačka kariet: Akasa AK-ICR-11 | Klávesnica: Logitech G19 | Myš: Logitech G9x & Razer Kabuto | Monitor: 24" LCD Eizo FlexScan S2431WE | Reproduktory: Logitech Z-2300 | Operačný systém: Microsoft Windows 7 & FreeBSD 9 | Záložný zdroj: APC Back-UPS ES 700 | Spotreba: Idle - 200W / Burn - 400W | Mobil: Nokia N9 64 GB
Zobraziť informácie o autoroviOdoslať súkromnú správuOdoslať e-mailSkypeFacebookTwitterZobraziť autorove WWW stránky
Zobraziť príspevky z predchádzajúcich:    
Zaslať odpoveď
Nemôžete pridávať nové témy do tohto fóra.
Nemôžete odpovedať na témy v tomto fóre.
Nemôžete upravovať svoje príspevky v tomto fóre.
Nemôžete mazať svoje príspevky v tomto fóre.
Nemôžete hlasovať v tomto fóre.

Powered by phpBB 2.x.x © 2005 - 2012 PCforum, webhosting by WebSupport, edited by JanoF

SEO - optimalizácia pre vyhľadávače

Freebsd