guardian34 wrote:elbekko wrote:Would be better to just get rid of them all.
And put them in an extension.
I agree
Agreed.
You are not logged in. Please login or register.
PunBB Forums → Posts by Tjalve
guardian34 wrote:elbekko wrote:Would be better to just get rid of them all.
And put them in an extension.
I agree
Agreed.
The biggest and most annoying prob that I found was that the margins/padding changed after you logged out, specially if you had a % padding on each side off .punwrap{}
The sides was easy but the middle part didn't what to stand still.
I tried with rounded edges on punbb last year but didn't get them 100% right so I deleted them.
Had problem aligning them in all browsers.
But i used 100% css and html.
HTML
<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b>
CSS
.xb51, .xb52, .xb53, .xb54 {display:block; overflow:hidden;}
.xb51, .xb52, .xb53 {height:1px;}
.xb52, .xb53, .xb54 {background:#383838; border-left:1px solid #565656; border-right:1px solid #565656;}
.xb51 {margin:0 5px; background:#565656;}
.xb52 {margin:0 3px; border-width:0 2px;}
.xb53 {margin:0 2px;}
.xb54 {height:2px; margin:0 1px;}
MySQL 4.1.22-standard-log
mysql-5.1.22 (not production env ofc)
MySQL 5.0.45
I'm running 1226.
it works fine on my test server.
lighttpd-1.4.18
http://developer.valvesoftware.com/wiki/Valve_Time
happy new year!
Did you read this?
Important: In order for most URL schemes to work, you need to copy/upload the file .htaccess from the extras directory into the forum root directory. Furthermore, the server that hosts the forums must be configured with mod_rewrite support and must allow the use of .htaccess files
Took me a time too find it too
You'r fix didn't work, but I noticed that the
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
also looked in deleted posted.. so I just added "AND deleted= 0", silly me.
Nop never deleted a user, but everything works fine if I set the viewtopic post count to 20. at least it's a temp fix.
viewtopic.php:
<?php
/***********************************************************************
Copyright (C) 2002-2005 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
************************************************************************/
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view']);
$action = isset($_GET['action']) ? $_GET['action'] : null;
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0;
if ($id < 1 && $pid < 1)
message($lang_common['Bad request']);
// Load the viewtopic.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
// Load poll language file
if(file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/polls.php'))
require PUN_ROOT.'lang/'.$pun_user['language'].'/polls.php';
else
require PUN_ROOT.'lang/English/polls.php';
// If a post ID is specified we determine topic ID and page number so we can redirect to the correct message
if ($pid)
{
$result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$id = $db->result($result);
// Determine on what page the post is located (depending on $pun_user['disp_posts'])
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$num_posts = $db->num_rows($result);
for ($i = 0; $i < $num_posts; ++$i)
{
$cur_id = $db->result($result, $i);
if ($cur_id == $pid)
break;
}
++$i; // we started at 0
$_GET['p'] = ceil($i / $pun_user['disp_posts']);
}
// If action=new, we redirect to the first new post (if any)
else if ($action == 'new' && !$pun_user['is_guest'])
{
// MOD: MARK TOPICS AS READ - 5 LINES NEW CODE FOLLOW
if(!empty($pun_user['read_topic']['t'][$id])) {
$last_read = $pun_user['read_topic']['t'][$id];
} else { // if the user hasn't read the topic
$last_read = $pun_user['last_visit'];
}
// MOD: MARK TOPICS AS READ - 1 LINE MODIFIED CODE FOLLOWS
$result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted>'.$last_read) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$first_new_post_id = $db->result($result);
if ($first_new_post_id)
header('Location: viewtopic.php?pid='.$first_new_post_id.'#p'.$first_new_post_id);
else // If there is no new post, we go to the last post
header('Location: viewtopic.php?id='.$id.'&action=last');
exit;
}
// If action=last, we redirect to the last post
else if ($action == 'last')
{
$result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$last_post_id = $db->result($result);
if ($last_post_id)
{
header('Location: viewtopic.php?pid='.$last_post_id.'#p'.$last_post_id);
exit;
}
}
// Fetch some info about the topic
if (!$pun_user['is_guest'])
// MOD: MARK TOPICS AS READ - 1 LINE MODIFIED CODE FOLLOWS
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.last_post, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
$cur_topic = $db->fetch_assoc($result);
// MOD: MARK TOPICS AS READ - 1 LINE NEW CODE FOLLOWS
if (!$pun_user['is_guest']) mark_topic_read($id, $cur_topic['forum_id'], $cur_topic['last_post']);
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_topic['moderators'] != '') ? unserialize($cur_topic['moderators']) : array();
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
// Can we or can we not post replies?
if ($cur_topic['closed'] == '0')
{
if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $is_admmod)
$post_link = '<a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
else
$post_link = ' ';
}
else
{
$post_link = $lang_topic['Topic closed'];
if ($is_admmod)
$post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
}
// Determine the post offset (based on $_GET['p'])
$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
$start_from = $pun_user['disp_posts'] * ($p - 1);
// Generate paging links
$paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewtopic.php?id='.$id);
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
$quickpost = false;
if ($pun_config['o_quickpost'] == '1' &&
!$pun_user['is_guest'] &&
($cur_topic['post_replies'] == '1' || ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1')) &&
($cur_topic['closed'] == '0' || $is_admmod))
{
$required_fields = array('req_message' => $lang_common['Message']);
$quickpost = true;
}
if (!$pun_user['is_guest'] && $pun_config['o_subscriptions'] == '1')
{
if ($cur_topic['is_subscribed'])
// I apologize for the variable naming here. It's a mix of subscription and action I guess :-)
$subscraction = '<p class="subscribelink clearb">'.$lang_topic['Is subscribed'].' - <a href="misc.php?unsubscribe='.$id.'">'.$lang_topic['Unsubscribe'].'</a></p>'."\n";
else
$subscraction = '<p class="subscribelink clearb"><a href="misc.php?subscribe='.$id.'">'.$lang_topic['Subscribe'].'</a></p>'."\n";
}
else
$subscraction = '<div class="clearer"></div>'."\n";
$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.$cur_topic['subject']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
?>
<div class="linkst">
<div class="inbox">
<p class="pagelink conl"><?php echo $paging_links ?></p>
<p class="postlink conr"><?php echo $post_link ?></p>
<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li> » <a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li> » <?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
<div class="clearer"></div>
</div>
</div>
<?php
require PUN_ROOT.'include/parser.php';
$bg_switch = true; // Used for switching background color in posts
$post_count = 0; // Keep track of post numbers
// Retrieve the posts (and their respective poster/online status)
$result = $db->query('SELECT u.id AS uid, u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, e.value, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'profile_field_entries AS e ON e.u_id = u.id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' AND p.deleted=0 ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], false) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
while ($cur_post = $db->fetch_assoc($result))
{
$post_count++;
$user_avatar = '';
$user_info = array();
$user_contacts = array();
$post_actions = array();
$is_online = '';
$signature = '';
// If the poster is a registered user.
if ($cur_post['poster_id'] > 1)
{
$username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';
$user_title = get_title($cur_post);
if ($pun_config['o_censoring'] == '1')
$user_title = censor_words($user_title);
// Format the online indicator
$is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : $lang_topic['Offline'];
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' alt="" />';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' alt="" />';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt="" />';
}
else
$user_avatar = '';
// We only show location, register date, post count and the contact links if "Show user info" is enabled
if ($pun_config['o_show_user_info'] == '1')
{
if ($cur_post['location'] != '')
{
if ($pun_config['o_censoring'] == '1')
$cur_post['location'] = censor_words($cur_post['location']);
$user_info[] = '<dd>'.$lang_topic['From'].': '.pun_htmlspecialchars($cur_post['location']);
}
$user_info[] = '<dd>'.$lang_common['Registered'].': '.date($pun_config['o_date_format'], $cur_post['registered']);
if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
$user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'];
// Now let's deal with the contact links (E-mail and URL)
if (($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) || $pun_user['g_id'] < PUN_GUEST)
$user_contacts[] = '<a href="mailto:'.$cur_post['email'].'">'.$lang_common['E-mail'].'</a>';
else if ($cur_post['email_setting'] == '1' && !$pun_user['is_guest'])
$user_contacts[] = '<a href="misc.php?email='.$cur_post['poster_id'].'">'.$lang_common['E-mail'].'</a>';
if ($cur_post['url'] != '')
$user_contacts[] = '<a href="'.pun_htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a>';
}
if ($pun_user['g_id'] < PUN_GUEST)
{
$user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
if ($cur_post['admin_note'] != '')
$user_info[] = '<dd>'.$lang_topic['Note'].': <strong>'.pun_htmlspecialchars($cur_post['admin_note']).'</strong>';
}
}
// If the poster is a guest (or a user that has been deleted)
else
{
$username = pun_htmlspecialchars($cur_post['username']);
$user_title = get_title($cur_post);
if ($pun_user['g_id'] < PUN_GUEST)
$user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'])
$user_contacts[] = '<a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['E-mail'].'</a>';
}
// Generation post action array (quote, edit, delete etc.)
if (!$is_admmod)
{
if (!$pun_user['is_guest'])
$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';
if ($cur_topic['closed'] == '0')
{
if ($cur_post['poster_id'] == $pun_user['id'])
{
if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
$post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
if ($pun_user['g_edit_posts'] == '1')
$post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
}
if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
$post_actions[] = '<li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
}
}
else
$post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_topic['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_topic['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_topic['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
// Switch the background color for every message.
$bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true;
$vtbg = ($bg_switch) ? ' roweven' : ' rowodd';
// Perform the main parsing of the message (BBCode, smilies, censor words etc)
if ($cur_post['g_id'] == 1 || $cur_post['g_id'] == 6 || $cur_post['g_id'] == 2 || $cur_post['g_id'] == 5 ) { //Mod or admin
$cur_post['message'] = parse_admin_message($cur_post['message'], $cur_post['hide_smilies']);
}
else
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
}
// Do signature parsing/caching
if ($cur_post['signature'] != '' && $pun_user['show_sig'] != '0')
{
if (isset($signature_cache[$cur_post['poster_id']]))
$signature = $signature_cache[$cur_post['poster_id']];
else
{
$signature = parse_signature($cur_post['signature']);
$signature_cache[$cur_post['poster_id']] = $signature;
}
}
$wowchar = '';
$array = explode(',', $cur_post['value']);
if ($cur_post['value'] > '') $wowchar='<dd><a href="http://eu.wowarmory.com/character-sheet.xml?r=Xavius&n='.$array[0].'">Armory</a></dd><dd>'.$array[1].' | '.$array[2].'</dd>';
if ($pun_user['style'] == 'Mercury_horizontal'){
include('horizontal_layout.php');
}else{
include('normal_layout.php');
}
}
?>
<div class="postlinksb">
<div class="inbox">
<p class="postlink conr"><?php echo $post_link ?></p>
<p class="pagelink conl"><?php echo $paging_links ?></p>
<ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li> » <a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li> » <?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
<?php echo $subscraction ?>
</div>
</div>
<?php
// Display quick post if enabled
if ($quickpost)
{
?>
<div class="blockform">
<h2><span><?php echo $lang_topic['Quick post'] ?></span></h2>
<div class="box">
<form id="post" method="post" name="qpost" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
<div class="inform">
<fieldset>
<legend><?php echo $lang_common['Write message legend'] ?></legend>
<div class="infldset txtarea">
<input type="hidden" name="form_sent" value="1" />
<input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
<?php require PUN_ROOT.'mod_modern_bbcode.php'; ?>
<label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
<ul class="bblinks">
<li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
<li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
<li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
</ul>
</div>
</fieldset>
</div>
<p><input type="submit" name="submit" tabindex="2" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
</form>
</div>
</div>
<?php
}
// Increment "num_views" for topic
$low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
$db->query('UPDATE '.$low_prio.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
$forum_id = $cur_topic['forum_id'];
$footer_style = 'viewtopic';
require PUN_ROOT.'footer.php';
Got a strange problem...
If I click on the "Last post" link on index it goes to the front page BUT it only happens after about half a page is filled(20 posts, before that it works fine) AND it only happens on only one topic.
The Off-topic thread
15 mins ago - by Azog
Any idea?
my index.php
<?php
/***********************************************************************
Copyright (C) 2002-2005 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
************************************************************************/
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view']);
// Load the index.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
// MOD: MARK TOPICS AS READ - 1 LINE NEW CODE FOLLOWS
$new_topics = get_all_new_topics();
// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.parent_forum_id, t.subject, t.question FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'topics AS t ON f.last_post_id=t.last_post_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND (f.parent_forum_id IS NULL OR f.parent_forum_id=0) ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
$cur_category = 0;
$cat_count = 0;
while ($cur_forum = $db->fetch_assoc($result))
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
if ($cur_category != 0)
echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
++$cat_count;
?>
<div id="idx<?php echo $cat_count ?>" class="blocktable">
<h2><span><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></span></h2>
<div class="box">
<div class="inbox">
<table cellspacing="0">
<thead>
<tr>
<th class="tcl" scope="col"> <?php echo $lang_common['Forum'] ?></th>
<th class="tc2" scope="col"><?php echo $lang_index['Topics'] ?></th>
<th class="tc3" scope="col"><?php echo $lang_common['Posts'] ?></th>
<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
</tr>
</thead>
<tbody>
<?php
$cur_category = $cur_forum['cid'];
}
$item_status = '';
$icon_text = $lang_common['Normal icon'];
$icon_type = 'icon';
// Are there new posts?
// MOD: MARK TOPICS AS READ - 1 LINE MODIFIED CODE FOLLOWS
if (!$pun_user['is_guest'] && forum_is_new($cur_forum['fid'], $cur_forum['last_post']))
{
$item_status = 'inew';
$icon_text = $lang_common['New icon'];
$icon_type = 'icon inew';
}
// Is this a redirect forum?
$forum_field = '<h3><a href="viewforum.php?id='.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
$num_topics = $cur_forum['num_topics'];
$num_posts = $cur_forum['num_posts'];
if ($cur_forum['forum_desc'] != '')
$forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];
// If there is a last_post/last_poster.
if ($cur_forum['last_post'] != '')
{
if ($cur_forum['question'] != '')
$last_post = '<a href="viewpoll.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">Poll: '.$cur_forum['subject'].'</a> <span class="byuser">'.format_time($cur_forum['last_post']).' - '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
else
$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.$cur_forum['subject'].'</a> <span class="byuser">'.format_time($cur_forum['last_post']).' - '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>'; }
else
$last_post = ' ';
?>
<tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
<td class="tcl">
<div class="intd">
<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>
<div class="tclcon">
<?php echo $forum_field?>
</div>
</div>
</td>
<td class="tc2"><?php echo $num_topics ?></td>
<td class="tc3"><?php echo $num_posts ?></td>
<td class="tcr"><?php echo $last_post ?></td>
</tr>
<?php
}
// Did we output any categories and forums?
if ($cur_category > 0)
echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
else
echo '<div id="idx0" class="block"><div class="box"><div class="inbox"><p>'.$lang_index['Empty board'].'</p></div></div></div>';
// 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);
$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 MAX(id) FROM '.$db->prefix.'topics ORDER BY id DESC LIMIT 1') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics']) = $db->fetch_row($result);
$result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts ORDER BY id DESC LIMIT 1') or error('Unable to fetch post count', __FILE__, __LINE__, $db->error());
list($stats['total_posts']) = $db->fetch_row($result);
?>
<div id="brdstats" class="block">
<h2><span><?php echo $lang_index['Board info'] ?></span></h2>
<div class="box">
<div class="inbox">
<dl class="conr">
<dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
<dd><?php echo $lang_index['No of users'].': <strong>'. $stats['total_users'] ?></strong></dd>
<dd><?php echo $lang_index['No of topics'].': <strong>'.$stats['total_topics'] ?></strong></dd>
<dd><?php echo $lang_index['No of posts'].': <strong>'.$stats['total_posts'] ?></strong></dd>
</dl>
<dl class="conl">
<dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
<dd><?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></dd>
<?php
if ($pun_config['o_users_online'] == '1')
{
// Fetch users online info and generate strings for output
$num_guests = 0;
$users = array();
$result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
while ($pun_user_online = $db->fetch_assoc($result))
{
if ($pun_user_online['user_id'] > 1)
$users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';
else
++$num_guests;
}
$num_users = count($users);
echo "\t\t\t\t".'<dd>'. $lang_index['Users online'].': <strong>'.$num_users.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Guests online'].': <strong>'.$num_guests.'</strong></dd>'."\n\t\t\t".'</dl>'."\n";
if ($num_users > 0)
echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
else
echo "\t\t\t".'<div class="clearer"></div>'."\n";
}
else
echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";
?>
</div>
</div>
</div>
<?php
$footer_style = 'index';
require PUN_ROOT.'footer.php';
Arch linux forums...
The "prev_url" column is missing from a clean install. (only in the update.php file), so you can only get it working on an 1.2.x that is upgraded
Disclaimer: No I wasn't posting a bug, just stating the facts
But it's starting too take shape now I see, good job.
yeah, look sooo forward too the beta release !
So we can really start test this baby!
Don't know... works fine here. Haven't seen any thing wrong with today/yesterday.
I can't figure it out.
elseif($hours > 23)
to
elseif($days == 1)
Can't find any thing but try this...
function format_time($timestamp, $date_only = false)
{
global $pun_config, $lang_common, $pun_user;
if (!$date_only)
{
$over_a_week = date("d-m-y", $timestamp);
$diff = time() - $timestamp;
$rest = ($diff % 3600);
$restdays = ($diff % 86400);
$restweeks = ($diff % 604800);
$weeks = ($diff - $restweeks) / 604800;
$days = ($diff - $restdays) / 86400;
$hours = ($diff - $rest) / 3600;
$seconds = ($rest % 60);
$minutes = ($rest - $seconds) / 60;
if ($timestamp == '')
return $lang_common['Never'];
if($weeks > 1)
return $over_a_week;
elseif($days > 1)
return $date."$days days ago";
elseif($days == 1)
return "Yesterday, $hours hours ago";
elseif($hours > 1)
return "Today, $date $hours hours ago";
elseif ($hours == 1)
return "Today, $date 1 hour, $minutes mins ago";
elseif ($minutes == 0)
return "Today, $date $seconds seconds ago";
elseif ($minutes == 1)
return "Today, $date 1 minute ago";
elseif ($seconds < 60)
return "Today, $date $minutes mins ago";
}
else{
$diff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
$timestamp += $diff;
$now = time();
$date = date($pun_config['o_date_format'], $timestamp);
$today = date($pun_config['o_date_format'], $now+$diff);
$yesterday = date($pun_config['o_date_format'], $now+$diff-86400);
return $date;
}
}
Can you change too this one fast, and see if it's wrong or not...
function format_time($timestamp, $date_only = false)
{
global $pun_config, $lang_common, $pun_user;
if ($timestamp == '')
return $lang_common['Never'];
$diff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
$timestamp += $diff;
$now = time();
$date = date("d-m-y", $timestamp);
$today = date($pun_config['o_date_format'], $now+$diff);
$yesterday = date($pun_config['o_date_format'], $now+$diff-86400);
if ($date == $today)
$date = $lang_common['Today'];
else if ($date == $yesterday)
$date = $lang_common['Yesterday'];
if (!$date_only)
return $date.' '.date($pun_config['o_time_format'], $timestamp);
else
return $date;
}
This should show:
Today, 23 seconds ago by x
Today, 2 mins ago by x
Today, 4 hours ago by x
Yesterday, 35 hours ago by x
3 days ago by x
11-10-07 by x
Haven't tested it fully
function format_time($timestamp, $date_only = false)
{
global $pun_config, $lang_common, $pun_user;
if (!$date_only)
{
$over_a_week = date("d-m-y", $timestamp);
$diff = time() - $timestamp;
$rest = ($diff % 3600);
$restdays = ($diff % 86400);
$restweeks = ($diff % 604800);
$weeks = ($diff - $restweeks) / 604800;
$days = ($diff - $restdays) / 86400;
$hours = ($diff - $rest) / 3600;
$seconds = ($rest % 60);
$minutes = ($rest - $seconds) / 60;
if ($timestamp == '')
return $lang_common['Never'];
if($weeks > 1)
return $over_a_week;
elseif($days > 1)
return $date."$days days ago";
elseif($hours > 23)
return "Yesterday, $hours hours ago";
elseif($hours > 1)
return "Today, $date $hours hours ago";
elseif ($hours == 1)
return "Today, $date 1 hour, $minutes mins ago";
elseif ($minutes == 0)
return "Today, $date $seconds seconds ago";
elseif ($minutes == 1)
return "Today, $date 1 minute ago";
elseif ($seconds < 60)
return "Today, $date $minutes mins ago";
}
else{
$diff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
$timestamp += $diff;
$now = time();
$date = date($pun_config['o_date_format'], $timestamp);
$today = date($pun_config['o_date_format'], $now+$diff);
$yesterday = date($pun_config['o_date_format'], $now+$diff-86400);
return $date;
}
}
Open include/functions.php
find:
function format_time($timestamp, $date_only = false)
{
global $pun_config, $lang_common, $pun_user;
if ($timestamp == '')
return $lang_common['Never'];
$diff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
$timestamp += $diff;
$now = time();
$date = date("d-m-y", $timestamp);
$today = date($pun_config['o_date_format'], $now+$diff);
$yesterday = date($pun_config['o_date_format'], $now+$diff-86400);
if ($date == $today)
$date = $lang_common['Today'];
else if ($date == $yesterday)
$date = $lang_common['Yesterday'];
if (!$date_only)
return $date.' '.date($pun_config['o_time_format'], $timestamp);
else
return $date;
}
REPLACE WITH:
function format_time($timestamp, $date_only = false)
{
global $pun_config, $lang_common, $pun_user;
if (!$date_only)
{
$diff = time() - $timestamp;
$rest = ($diff % 3600);
$restdays = ($diff % 86400);
$restweeks = ($diff % 604800);
$weeks = ($diff - $restweeks) / 604800;
$days = ($diff - $restdays) / 86400;
$hours = ($diff - $rest) / 3600;
$seconds = ($rest % 60);
$minutes = ($rest - $seconds) / 60;
if ($timestamp == '')
return $lang_common['Never'];
if($weeks > 1)
return $date."$weeks weeks ago";
elseif($days > 1)
return $date."$days days ago";
elseif($hours > 1)
return $date."$hours hours ago";
elseif ($hours == 1)
return $date."1 hour, $minutes mins ago";
elseif ($minutes == 0)
return $date."$seconds seconds ago";
elseif ($minutes == 1)
return $date."1 minute ago";
elseif ($seconds < 60)
return $date."$minutes mins ago";
}
else{
$diff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
$timestamp += $diff;
$now = time();
$date = date($pun_config['o_date_format'], $timestamp);
$today = date($pun_config['o_date_format'], $now+$diff);
$yesterday = date($pun_config['o_date_format'], $now+$diff-86400);
return $date;
}
}
Can't find the original post... sorry.
Wallpaper gallery:
http://www.epixplx.com/punbb/Wallpapers/
Hope you don't mind that I used you html template from the video tutorials site, Dr.Jeckyl.
Don't know if it's just me or what.. but the last few I made ( http://www.epixplx.com/images/galleries … normal.png ) ,when I look at them I can't stop thinking off phpbb...Don't know why.
oh yeah.. if anyone want any of the wallpapers I made resized please just say so and I'll upload it in the size you want.
PunBB Forums → Posts by Tjalve
Powered by PunBB, supported by Informer Technologies, Inc.