Obsah fóra
PravidláRegistrovaťPrihlásenie




Odpovedať na tému [ Príspevok: 1 ] 
AutorSpráva
Offline

Prevádzkovateľ fóra
Prevádzkovateľ fóra
Last post info

Registrovaný: 01.05.05
Príspevky: 13349
Témy: 1496
Bydlisko: Bratislava
Príspevok NapísalOffline : 14.10.2006 14:54

Kód:
##############################################################
## MOD Title: Last post info
## MOD Author: fredol < fredol@lovewithsmg.com > (fredol) http://phpbb.lovewithsmg.com/
## MOD Description: Add "Last post made by user on date/time" in who's online stats
## MOD Version: 1.0.5
##
## Installation Level: Easy
## Installation Time: 1 Minute
## Files To Edit:   index.php
##         templates/subSilver/index_body.tpl
##         language/lang_english/lang_main.php
## Included Files:   n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##   the Get Viewable Forums part was made by zparta on one of his MOD, so thanks man! ;)
##############################################################
## MOD History:
##
##   2004-11-22 - Version 1.0.5
##   - Major speed improvements thanks to CADTutor, thanks again :)
##
##   2004-11-02 - Version 1.0.4
##   - Got sid back in place ;) but still working with #post
##
##   2004-10-29 - Version 1.0.3
##   - Removed getting $auth since it had already been done, should improve speed ;)
##   - Removed use of append_sid() to get #post working all the time
##
##   2004-09-03 - Version 1.0.2
##   - Added post title, which is now the link
##   - Fix: now shows the name for guests when available (and if not then Anonymous)
##
##   2004-07-02 - Version 1.0.1
##   - Fix: little bug if no post was made
##   - Fix: little bug if a guest (non-registered user) had made the last post
##
##   2004-06-30 - Version 1.0.0
##   - Submitted to the MOD-DB (no changes were made)
##
##   2004-06-02 - Version 0.0.2
##      - add link to the post (thanks CTCNetwork)
##
##   2004-06-02 - Version 0.0.1
##      - first version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]-----
#
index.php
#
#-----[ FIND ]-----
#
   //
   // Start output of page
   //
#
#-----[ BEFORE, ADD ]-----
#
   //BEGIN-MOD:Last post info
   // Get Viewable Forums - made by zparta
   if ( function_exists('get_auth_keys') ) {
      $keys = array();
      $keys = get_auth_keys('Root');
      $auth_view_forum_sql = '';
      for ($i=0; $i < count($keys['id']); $i++)
      {
         if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
         {
            $auth_view_forum_sql .= (($auth_view_forum_sql != '') ? ', ' : '') . $tree['id'][ $keys['idx'][$i] ];
         }
      }
      $auth_view_forum_sql = ($auth_view_forum_sql == '' ? '(0)' : '(' . $auth_view_forum_sql . ')');
   }
   else
   {
      $auth_view_forum_sql = '';
      for($i = 0; $i < $total_categories; $i++)
      {
         $cat_id = $category_rows[$i]['cat_id'];
         $display_forums = false;
         for($j = 0; $j < $total_forums; $j++)
         {
            if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
            {
               $display_forums = true;
               $auth_view_forum_sql .= ($auth_view_forum_sql == '' ? '' : ', ' ) . $forum_data[$j]['forum_id'];
            }
         }
      }
      $auth_view_forum_sql = ($auth_view_forum_sql == '' ? '(0)' : '(' . $auth_view_forum_sql . ')');
   }
   $sql = "SELECT p.post_id, p.post_username, pt.post_subject, p.post_time, u.user_id, u.username, t.topic_title
      FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt, " . TOPICS_TABLE . " t
      WHERE p.forum_id IN " . $auth_view_forum_sql . " AND p.poster_id = u.user_id
      AND pt.post_id = p.post_id AND t.topic_id = p.topic_id
      ORDER BY p.post_time DESC LIMIT 1";

   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query last post informations', '', __LINE__, __FILE__, $sql);
   }

   if ($row = $db->sql_fetchrowset($result))
   {
      $db->sql_freeresult($result);
      $append_sid = ( !empty($SID) && !preg_match('#sid=#', $url) ) ? $SID . '&' : '';
      if ($row[0]['user_id']>-1)
      {
         $last_post_info = sprintf($lang['last_post_info'], '<a href="profile.'.$phpEx.'?'.$append_sid.'mode=viewprofile&' . POST_USERS_URL . '=' . $row[0]['user_id'] . '">', $row[0]['username'], '</a>', create_date($board_config['default_dateformat'], $row[0]['post_time'], $board_config['board_timezone']), '<a href="viewtopic.'.$phpEx.'?'.$append_sid. POST_POST_URL . '=' . $row[0]['post_id'] . '#' . $row[0]['post_id'] . '">', ( (empty($row[0]['post_subject'])) ? 'Re: ' . $row[0]['topic_title'] : $row[0]['post_subject'] ), '</a>');
      }
      else
      {
         $last_post_info = sprintf($lang['last_post_info'], '', ( (empty($row[0]['post_username'])) ? $row[0]['username'] : $row[0]['post_username'] ), '', create_date($board_config['default_dateformat'], $row[0]['post_time'], $board_config['board_timezone']), '<a href="viewtopic.'.$phpEx.'?'.$append_sid . POST_POST_URL . '=' . $row[0]['post_id'] . '#' . $row[0]['post_id'] . '">', ( (empty($row[0]['post_subject'])) ? 'Re: ' . $row[0]['topic_title'] : $row[0]['post_subject'] ), '</a>');
      }
   }
   else
   {
      $last_post_info = '';
   }
   
   //END-MOD:Last post info

#
#-----[ FIND ]-----
#
   $template->assign_vars(array(
      'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
      'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
#
#-----[ BEFORE, ADD ]-----
#
   //MODIF-MOD:Last post info, add: LAST_POST
#
#-----[ FIND ]-----
#
      'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
#
#-----[ AFTER, ADD ]-----
#
      'LAST_POST' => $last_post_info,
#
#-----[ OPEN ]-----
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]-----
#
   <td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
#
#-----[ IN-LINE FIND ]-----
#
   {TOTAL_POSTS}
#
#-----[ IN-LINE AFTER, ADD ]-----
#
, {LAST_POST}
#
#-----[ OPEN ]-----
#
language/lang_english/lang_main.php
#
#-----[ FIND ]-----
#
$lang['Newest_user'] = 'The newest registered user is <b>%s%s%s</b>'; // a href, username, /a
#
#-----[ AFTER, ADD ]-----
#
$lang['last_post_info'] = 'Last post by <b>%s%s%s</b> on %s: %s%s%s'; // a href, usernname, /a, post_time, a href, subject/title, /a
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM







_________________
Streacom DA2 | SilverStone Titanium SX800-LTI 800W | ASRock X299E-ITX/ac | Intel Core i9-9980XE & be quiet! Dark Rock TF | Kingston HyperX Impact 64 GB DDR4 2666 MHz | NVIDIA Titan RTX 24 GB | Intel SSD Optane 905P 480 GB NVMe U.2 & Intel SSD 750 1,2 TB NVMe U.2 & Intel SSD 660p 2 TB NVMe M.2 & Seagate BackUp Plus Portable 56 TB USB | 55" 4K OLED Dell Alienware AW5520QF & 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech G603 | Logitech F710 | Harman Kardon Sabre SB 35 & Sennheiser RS 175 | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 | iPhone X 256 GB & Pitaka Aramid | SilverStone ML05B Milo | Corsair SF600 SFX 600W | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 & NOCTUA NH-L12S | Kingston HyperX Savage 32 GB DDR4 2400 MHz | NVIDIA GeForce GT 710 1 GB | Intel SSD Optane Memory 32 GB NVMe M.2 & Intel SSD 730 240 GB SATA | Ubuntu Server
Odpovedať na tému [ Príspevok: 1 ] 


Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy. Shows topic of last made post on index

v Redakčné systémy

0

1631

13.10.2006 9:16

JanoF Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. post funkcia a post pole

v PHP, ASP

15

999

28.05.2014 13:21

Kamahl Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Last visit

v Redakčné systémy

0

3175

13.10.2006 9:15

JanoF Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Last.fm

v Sieťové a internetové programy

0

1005

09.03.2006 14:59

Pekaboo Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Metro: Last Light

[ Choď na stránku:Choď na stránku: 1 ... 6, 7, 8 ]

v Počítačové hry

225

5338

08.11.2013 10:58

Ingenium Deerro Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. The Last Ninja

v Počítačové hry

2

663

07.02.2008 2:04

sergi80 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Metro: Last Light

v Počítačové hry

1

470

19.09.2011 6:32

patrikos68 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Last x hours registrations

v Redakčné systémy

2

569

23.10.2006 22:40

JanoF Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. K:Metro:Last Light Cz

v Kúpim

1

361

12.05.2013 15:25

Koroner Zobrazenie posledných príspevkov

Táto téma je zamknutá, nemôžete posielať nové príspevky alebo odpovedať na staršie. P/I: Metro: Last Light

v Predám

8

523

21.10.2013 18:48

Only Human Zobrazenie posledných príspevkov

Táto téma je zamknutá, nemôžete posielať nové príspevky alebo odpovedať na staršie. P: Metro Last Light (STEAM)

v Predám

19

971

16.05.2013 20:37

Rainmaker Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Posts in Last 24 Hours

v Redakčné systémy

0

553

14.10.2006 15:03

JanoF Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Pcforum group na last.fm

v Krčma

11

1566

18.01.2009 19:09

br4n0 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. METRO 2033: The Last Refuge

v Predám

0

289

19.06.2013 10:14

pedge Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. P:The Last of Us

v Predám

0

600

26.01.2014 14:13

backy6 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. P: Metro Last Light (kupon)

v Predám

10

601

04.06.2013 21:51

pipo137 Zobrazenie posledných príspevkov


Nemôžete zakladať nové témy v tomto fóre
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

Skočiť na:  

Powered by phpBB Jarvis © 2005 - 2024 PCforum, webhosting by WebSupport, secured by GeoTrust, edited by JanoF
Ako väčšina webových stránok aj my používame cookies. Zotrvaním na webovej stránke súhlasíte, že ich môžeme používať.
Všeobecné podmienky, spracovanie osobných údajov a pravidlá fóra