Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Nesto oko novih postova na forumu

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
Garfield



Joined: 10 Sep 2003
Posts: 82
Location: Bjelovar

PostPosted: 29.05.2004 22:56    Post subject: Nesto oko novih postova na forumu Add user to your forum ignore list Reply with quote

Dakle stavio sam punBB i forum mi je odlican, totalno ga se moze srediti bez iakkve zajebancije (znam znam, sad ce se javiti netko i reci isto za phpBB, ali ovo mi je bolje). Dakle treba mi pomoc oko toga da prikazuje 2 ikone za postove sa lijeve strane, kada nema novih postova jednu, kada ima, da pokazuje drugu. Ovdje u codeu ima vec za prikazivanje slike kada ima novih postova, ali nema slike kada nema, to me jebe.

Code:
<?php
/***********************************************************************

  Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB 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.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


$pun_root = './';
require $pun_root.'include/common.php';


if ($cookie['is_guest'] && $pun_config['p_guests_read'] == '0')
   message($lang_common['Login required']);


// Load the index.php language file
require $pun_root.'lang/'.$language.'/'.$language.'_index.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
require $pun_root.'header.php';

?>
<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>

<table class="punmain" cellspacing="1" cellpadding="4">
   <tr class="punhead">
      <td class="punhead" style="width: 24px">&nbsp;</td>
      <td class="punhead" style="white-space: nowrap"><?php echo $lang_common['Forum'] ?></td>
      <td class="punheadcent" style="width: 6%; white-space: nowrap"><?php echo $lang_index['Topics'] ?></td>
      <td class="punheadcent" style="width: 6%; white-space: nowrap"><?php echo $lang_common['Posts'] ?></td>
      <td class="punheadcent" style="width: 18%; white-space: nowrap"><?php echo $lang_common['Last post'] ?></td>
      <td class="punheadcent" style="width: 18%; white-space: nowrap"><?php echo $lang_index['Moderators'] ?></td>
   </tr>
<?php


// Print the categories and forums
$extra_sql = ($cur_user['status'] < PUN_MOD) ? ' WHERE f.admmod_only=\'0\'' : '';

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.closed FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra_sql.' ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

while ($cur_forum = $db->fetch_assoc($result))
{
   if ($cur_forum['cid'] != $cur_category)   // A new category since last iteration?
   {

?>
   <tr>
      <td class="puncon3" colspan="6"><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></td>
   </tr>
<?php

      $cur_category = $cur_forum['cid'];
   }

   if ($cur_forum['closed'] != '1')
      $forum_field = '<span class="punheadline"><a href="viewforum.php?id='.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></span>';
   else
      $forum_field = '<span class="punheadline"><a class="punclosed" href="viewforum.php?id='.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></span>';

   if ($cur_forum['forum_desc'] != '')
      $forum_field .= '<br>'."\n\t\t\t".$cur_forum['forum_desc'];

   // If there is a last_post/last_poster.
   if ($cur_forum['last_post'] != '')
      $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a><br>'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']);
   else
      $last_post = '&nbsp;';

   if (!$cookie['is_guest'] && $cur_forum['last_post'] > $cur_user['last_visit'])
   {
      if ($cur_user['show_img'] == '1')
         $icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
      else
         $icon = '<span class="puntext"><b>•</b></span>';
   }
   else
      $icon = '&nbsp;';

   if ($cur_forum['moderators'] != '')
   {
      $mods_array = unserialize($cur_forum['moderators']);
      $moderators = array();

      while (list($mod_username, $mod_id) = @each($mods_array))
         $moderators[] = '<a href="profile.php?id='.$mod_id.'">'.pun_htmlspecialchars($mod_username).'</a>';

      $moderators = implode(', ', $moderators);
   }
   else
      $moderators = '&nbsp;';

?>
   <tr class="puncon1">
      <td class="puncent"><?php echo $icon ?></td>
      <td>
         <?php echo $forum_field."\n" ?>
      </td>
      <td class="puncent"><?php echo $cur_forum['num_topics'] ?></td>
      <td class="puncent"><?php echo $cur_forum['num_posts'] ?></td>
      <td class="puncent"><?php echo $last_post ?></td>
      <td class="puncent"><?php echo $moderators ?></td>
   </tr>
<?php

}

echo "</table>\n\n";


// Show what the current user can and cannot do
if ($cur_user['status'] > PUN_USER)
   $perms = $lang_index['You'].' <b>'.$lang_index['can'].'</b> '.$lang_index['post replies'].'<br>'.$lang_index['You'].' <b>'.$lang_index['can'].'</b> '.$lang_index['post topics'].'<br>'.$lang_index['You'].' <b>'.$lang_index['can'].'</b> '.$lang_index['edit posts'].'<br>'.$lang_index['You'].' <b>'.$lang_index['can'].'</b> '.$lang_index['delete posts'].'<br>'.$lang_index['You'].' <b>'.$lang_index['can'].'</b> '.$lang_index['delete topics']."\n";
else if (!$cookie['is_guest'])
{
   $perms = $lang_index['You'].' <b>'. (($pun_config['p_users_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post replies'].'<br>';
   $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($pun_config['p_users_post_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post topics'].'<br>';
   $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($pun_config['p_users_edit_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['edit posts'].'<br>';
   $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($pun_config['p_users_del_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['delete posts'].'<br>';
   $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($pun_config['p_users_del_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['delete topics'].'<br>'."\n";
}
else
{
   $perms = $lang_index['You'].' <b>'. (($pun_config['p_guests_post'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post replies'].'<br>';
   $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'. (($pun_config['p_guests_post_topic'] == '1') ? $lang_index['can'] : $lang_index['cannot']) .'</b> '.$lang_index['post topics'].'<br>';
   $perms .= "\n\t\t\t\t\t\t".$lang_index['You'].' <b>'.$lang_index['cannot'].'</b> '.$lang_index['edit posts'].'<br>'.$lang_index['You'].' <b>'.$lang_index['cannot'].'</b> '.$lang_index['delete posts'].'<br>'.$lang_index['You'].' <b>'.$lang_index['cannot'].'</b> '.$lang_index['delete topics']."\n";
}


// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result, 0);

$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);

$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);

?>
<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>

<table class="punmain" cellspacing="1" cellpadding="4">
   <tr>
      <td class="puncon1">
         <table class="punplain" cellspacing="0" cellpadding="0">
            <tr>
               <td class="puntop" style="margin-right: 40px">
                  <?php echo $lang_index['This forum has'].' '.$stats['total_users'].' '.(($stats['total_users'] <> 1) ? $lang_index['registered users'] : $lang_index['registered users']).', '.$stats['total_topics'].' '.(($stats['total_topics'] <> 1) ? $lang_index['topics'] : $lang_index['topic']).' '.$lang_index['and'].' '.$stats['total_posts'].' '.(($stats['total_posts'] <> 1) ? $lang_index['posts'] : $lang_index['post']) ?>.<br>
                  <?php echo $lang_index['Newest user'] ?> <a href="profile.php?id=<?php echo $stats['last_user']['id'] ?>"><?php echo pun_htmlspecialchars($stats['last_user']['username']) ?></a>.
<?php

if ($pun_config['o_users_online'] == '1')
{
   // Fetch users online info and generate strings for output
   $num_guests = 0;
   $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online ORDER BY ident') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

   while ($cur_user_online = $db->fetch_assoc($result))
   {
      if ($cur_user_online['user_id'] > 0)
         $users[] = '<a href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';
      else
         ++$num_guests;
   }

   $num_users = count($users);

   echo "\t\t\t\t\t\t".'<br>'.$lang_index['Currently serving'].' '.$num_users.' '.(($num_users <> 1) ? $lang_index['registered users'] : $lang_index['registered user']).' '.$lang_index['and'].' '.$num_guests.' '.(($num_guests <> 1) ? $lang_index['guests'] : $lang_index['guest']).'.';

   if ($num_users)
      echo '<br><br>'."\n\t\t\t\t\t\t".implode(', ', $users)."\n";
   else
      echo "\n";
}

?>
               </td>
               <td class="puntopright" style="white-space: nowrap">
                  <?php echo $perms ?>
               </td>
            </tr>
         </table>
      </td>
   </tr>
</table>

<table class="punspacer" cellspacing="1" cellpadding="4"><tr><td>&nbsp;</td></tr></table>
<?php

$footer_style = 'index';
require $pun_root.'footer.php';


Kod za prikazivanje je od 80 linije pa na dalje, dali ima tko kakvu ideju kako to sloziti?!

_________________
My software doesn`t have bugs, it just produces random features.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
che.UP
mi3.crew


Joined: 07 Sep 2003
Posts: 2320
Location: zagreb

PostPosted: 30.05.2004 15:37    Post subject: Add user to your forum ignore list Reply with quote

Code:
     if ($cur_user['show_img'] == '1')
         $icon = '<img src="img/'.$cur_user['style'].'_new.png" width="16" height="16" alt="">';
      else
         $icon = '<span class="puntext"><b>•</b></span>';
   }
   else
      $icon = '<img src="path/do/tvoje/slike/za/stari/post.png" alt="no new post">';


probaj ovo... obrati paznju na zadnji red, samo je on promijenjen...

_________________
UP | TypeTester | Accommodations App
Meni u Firefox-u ne radi AJAX
Back to top
View user's profile Send private message Visit poster's website
Garfield



Joined: 10 Sep 2003
Posts: 82
Location: Bjelovar

PostPosted: 30.05.2004 17:31    Post subject: Add user to your forum ignore list Reply with quote

Nasao sam gdje je problem, evo sad radi

Code:
if (!$cookie['is_guest'] && $cur_forum['last_post'] > $cur_user['last_visit'])
{
    if ($cur_user['show_img'] == '1')
        $icon = '<img src="img/'.$cur_user['style'].'_new_on.png" alt="">';
    else
        $icon = '<span class="puntext"><b>•</b></span>';
}
else
{
    if ($cur_user['show_img'] == '1' || $cookie['is_guest'])
        $icon = '<img src="img/'.$cur_user['style'].'_new_off.png" alt="">';
    else
        $icon = '&nbsp;';
}

_________________
My software doesn`t have bugs, it just produces random features.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group