Hey bingiman, I saw your post on my site before I saw it here. A slight change to include/blog.php is the difference. You can download it here for now. Just overwrite the file and you won't have tags closed twice. It's a minor issue so I won't put it on punres until I get some other stuff done.
52 2007-04-22 18:49
Re: function to close tags works too well (3 replies, posted in Programming)
Never mind. Got it working. Now my blog mod is fully xhtml compliant
53 2007-04-22 16:37
Topic: function to close tags works too well (3 replies, posted in Programming)
I'm using a function based on this one to close open tags when truncating a post. It works great, too well in fact. It closes all tags, not just the ones which aren't closed.
The post if first parsed using the PunBB parse_message function then truncated to x characters and then close_tags is called.
This is beyond my understanding, if anyone can see why it's closing all tags, not just the open ones, it would be much appreciated.
function close_tags($string)
{
// match opened tags
if(preg_match_all('/<([a-z\:\-]+)[ >]/', $string, $start_tags))
{
$start_tags = $start_tags[1];
// match closed tags
if(preg_match_all('/<\/>([a-z]+)>/', $string, $end_tags))
{
$complete_tags = array();
$end_tags = $end_tags[1];
foreach($start_tags as $key => $val)
{
$posb = array_search($val, $end_tags);
if(is_integer($posb))
{
unset($end_tags[$posb]);
}
else
{
$complete_tags[] = $val;
}
}
}
else
{
$complete_tags = $start_tags;
}
$complete_tags = array_reverse($complete_tags);
for($i = 0; $i < count($complete_tags); $i++)
{
$string .= '</' . $complete_tags[$i] . '>';
}
}
// Removes the close tag for xhtml tags
$xhtml_tags = array("</img>", "</hr>", "</br>");
$string = str_replace($xhtml_tags, "", $string);
return $string;
}
54 2007-04-22 03:14
Re: Help in modifying this topic sort order hack (9 replies, posted in PunBB 1.2 discussion)
Soonotes, can I suggest that you submit your code to the punres wiki - I'm sure others will find it useful. I wouldn't want to take credit for your code.
Not familiar with the wiki but if you think others will find it useful go ahead and submit it. Doesn't really matter who does it, just that it's there for those who want it.
55 2007-04-21 19:01
Re: Help in modifying this topic sort order hack (9 replies, posted in PunBB 1.2 discussion)
Something like this
Open admin_forums.php, around line 283 find
<option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>>Last post</option>
<option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>>Topic start</option>
Replace with
<option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>>Last post</option>
<option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>>Topic start</option>
<option value="2"<?php if ($cur_forum['sort_by'] == '2') echo ' selected="selected"' ?>>Subject</option>
Now open viewforum.php and find around line 109
// Fetch list of topics to display on this page
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
{
// Without "the dot"
$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
}
else
{
// With "the dot"
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
break;
case 'sqlite':
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
break;
default:
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
break;
}
}
and replace with
if ($cur_forum['sort_by'] == 2)
{
$order = 'ASC';
$by = 'subject';
}
else if ($cur_forum['sort_by'] == 1)
{
$order = 'DESC';
$by = 'posted';
}
else
{
$order = 'DESC';
$by = 'last_post';
}
// Fetch list of topics to display on this page
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
{
// Without "the dot"
$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.$by.' '.$order.' LIMIT '.$start_from.', '.$pun_user['disp_topics'];
}
else
{
// With "the dot"
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.$by.' '.$order.' LIMIT '.$start_from.', '.$pun_user['disp_topics'];
break;
case 'sqlite':
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.$by.' '.$order.' LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, '.$by.' '.$order.'';
break;
default:
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.$by.' '.$order.' LIMIT '.$start_from.', '.$pun_user['disp_topics'];
break;
}
}
edited to correct as per smartys comment
Not sure about the sqlite query though
56 2007-04-21 17:53
Re: how to do that [Latest Topics] (9 replies, posted in PunBB 1.2 modifications, plugins and integrations)
That screen shot is from my site. That's done using a mod called PunBB Active Topics. I can't find the mod for some reason but I found a thread discussing it and it has the full code. http://punbb.org/forums/viewtopic.php?id=10017
57 2007-04-20 04:35
Re: Styling Issue (Firefox Only) - Not Sitting Correctly (3 replies, posted in PunBB 1.2 modifications, plugins and integrations)
You've closed more div's than you've opened
http://validator.w3.org/check?uri=http: … /index.php
That's probably all it is.
58 2007-04-18 03:49
Re: PBB User Blogs 1.2 (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Good idea. I'll have to do that.
59 2007-04-17 20:18
Re: PBB User Blogs 1.2 (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Yes, it's currently allowing guests to comment on blogs in the 'general' category and not allowing guests to create their own blog in any category. I may have to disable guests comments though as some idiot going by the name futzer first left a comment asking about span and then left another one, since removed, which was spam.
60 2007-04-17 19:36
Re: PBB User Blogs 1.2 (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Not sure how that's any different from a forum though. By default guests comments are not allowed.
61 2007-04-17 19:30
Re: PBB User Blogs 1.2 (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Glad to hear that bingiman. There's definately alot of steps to follow in the read me but copy and paste has never been a hard thing. A text editor with line numbers sure helps.
62 2007-04-17 01:34
Topic: PBB User Blogs 1.2 (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
##
##
## Mod title: User Blogs
##
## Mod version: 1.2
## Works on PunBB: 1.2.*
## Release date: 2007-04-16
## Author: TinyTim (tinytim@soonotes.com)
##
## Description: This mod alows users to create personal blogs.
##
## Affected files: index.php
## viewtopic.php
## profile.php
## userlist.php
## include/functions.php
## lang/English/profile.php
## lang/English/common.php
## lang/English/index.php
## profile.php
## style/imports/base.css
## style/*.css
##
## Affects DB: Yes
##
## Notes: This mod creates a blog system for users of your site.
## Users can create and manage their own blog.
## RSS feeds are included on a per user, per site and
## per category basis.
## Admins have full control over categories, can assign mods
## and posting permissions on a per category basis.
##
## Additional Notes: This mod uses a side block for navigation and has two sets
## of files included. One set includes the side block as part of
## the blog system. The second set uses a side block in the include/user
## directory and will integrate with portal style sites.
##
63 2007-04-16 07:14
Re: PBB User Blogs 1.0 Beta (2 replies, posted in PunBB 1.2 modifications, plugins and integrations)
That's Punny alright
64 2007-04-12 20:00
Re: Changing the administrator's password (oops...) (3 replies, posted in PunBB 1.2 troubleshooting)
So change the email address instead in PHPMyAdmin.
65 2007-04-12 18:23
Topic: PBB User Blogs 1.0 Beta (2 replies, posted in PunBB 1.2 modifications, plugins and integrations)
##
##
## Mod title: User Blogs (Beta)
##
## Mod version: 1.0 Beta
## Works on PunBB: 1.2.12, 1.2.13, 1.2.14
## Release date: 2007-04-12
## Author: TinyTim (tinytim@soonotes.com)
##
## Description: This mod alows users to create personal blogs.
##
## Affected files: index.php
## viewtopic.php
## profile.php
## userlist.php
## include/functions.php
## lang/English/profile.php
## lang/English/common.php
## lang/English/index.php
## profile.php
## style/imports/base.css
## style/*.css
##
## Affects DB: Yes
##
## Notes: This mod includes restore function for db.
## This has been tested on a fresh installation of PunBB 1.2.14
## using PHP 4.4.4 and MySQL 4.1.21-standard.
## This is a beta release and the code may be a bit sloppy or have some
## commented out queries and alot of the language stuff it still hard coded
## Most of the changes to existing files are either minor of will
## not affect the function of your forum, however the changes to
## profile.php are major so be absolutely sure to create a backup
## of that file.
##
## Additional Notes: In the 'extra' directory there are copies of all modified files.
## These are all based on PunBB 1.2.14. Only use these if you have
## PunBB installed with no modifications to any of these files.
##
66 2007-04-11 22:18
Re: User Blogs as a Mod (3 replies, posted in PunBB 1.2 discussion)
FYI finley, I have now installed this on my site will submit it as a mod later today. Just finishing up the readme and testing it on a fresh install of PunBB.
67 2007-04-08 02:09
Re: User Blogs as a Mod (3 replies, posted in PunBB 1.2 discussion)
I will soon, probably a few days. It's coming along pretty good. I have a couple of issues to deal with for navigation and a bug or two with being fully validating xhtml. Other than that I will be releasing a 'beta' very soon.
I'm trying to cover all bases and don't plan to release anything until I am sure the only needed to go from the beta release to a full version will be to overwrite a couple of files and I still have of db columns to add.
Anyway, please check it out and let me know of any suggestions you have or any issues you think may come up. You can click on the link in my signature. There's a couple of usernames you can login with. All have limited mod priveleges and you can check out the user blogs plugin (this will be an admin plugin but I currently a mod plugin so you can check it out).
Usernames are test/testuser/blogger and passwords match.
Most of the links work now and feedback would be very much appreciated.
68 2007-03-24 02:13
Re: php redirect (2 replies, posted in Programming)
<?php
header( 'Location: http://www.bydebrasdesigns.com/cms' ) ;
?>
69 2007-03-23 04:13
Topic: User Blogs as a Mod (3 replies, posted in PunBB 1.2 discussion)
Not sure if this is the right forum but it seems the best fit.
I'm working on a mod to allow each registered user to have their own blog. If this has been done please let me know
I've got the basics of it done but am having trouble with how to integrate it into the site. I want to leave the core files alone as much as possible and to work within the existing style of the forum.
To see what I have go to http://www.soonotes.com/test2/blogs.php
If anyone has suggestions please let me know.
70 2007-03-17 14:53
Re: i need help badly with messaging mod (4 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Just skip the step to run install_mod.php. The database columns/tables have already been created. Go on to the next step.
71 2007-03-17 03:52
Re: i need help badly with messaging mod (4 replies, posted in PunBB 1.2 modifications, plugins and integrations)
The column already exists, no need to create it again. Skip that step and follow the rest of the steps in the readme.
72 2007-03-16 17:06
Re: have a little problem with the private messaging mod (9 replies, posted in PunBB 1.2 modifications, plugins and integrations)
The requested URL /forums/message_send.php was not found on this server.
Did you forget to upload the file message_send.php by any chance?
73 2007-03-15 16:28
Re: Problems for Mod Hide User with extern.php (3 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Oh crap, forgot all about extern.php
I'll update later to include number of hidden users but for now:
In extern.php find
$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)
Replace with
$result = $db->query('SELECT user_id, ident, show_online 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 && $pun_user_online['show_online'] != 0)
74 2007-03-13 04:47
Topic: Hide User 1.1 (2 replies, posted in PunBB 1.2 modifications, plugins and integrations)
##
##
## Mod title: Hide User
##
## Mod version: 1.1
## Works on PunBB: 1.2.12, 1.2.13, 1.2.14
## Release date: 2007-03-13
## Author: TinyTim (tinytim@soonotes.com)
##
## Description: This mod alows users to choose whether they want
## to appear online or remain invisible. This version
## adds number of hidden users online an shows mods and
## admins who is hidden
##
## Affected files: index.php
## viewtopic.php
## profile.php
## include/functions.php
## style/include/base.css
## lang/English/profile.php
## lang/English/topic.php
## lang/English/index.php
##
## Affects DB: Yes
##
## Notes: This mod is based on a mod called Hide Me created by
## Gary Schilling (Gary13579@indocron.net)
## For lanquages other than English add the approptiate
## entry to your lang/Language/profile.php
##
## DISCLAIMER: Please note that "mods" are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
##
Added number of hidden users to whose online.
Added ability for mods and admins to see who is currently hidden.
Download: http://www.punres.org/files.php?pid=354
75 2007-03-06 22:55
Re: Adding Menu Bar Items? (2 replies, posted in PunBB 1.2 troubleshooting)
Remove the line break after 9 = <a