I *love* this mod, in fact, I wrote Rickard two days ago about making it myself, but now I see I do not have to :-) This should definitely become 1.3.x standard feature!

even better, download it here, as this forum will convert unicode decimals characters into their utf-8 equivalents..

http://cvs.sourceforge.net/viewcvs.py/* … hp?rev=1.5

PS: tested on 1.2dev *only*

I found extern.php not very useful for people, as most do not want just topics, but last X posts..

Just save this as rss.php:

<?php
/**
  * BLOG:CMS: PHP/MySQL Personal Content Management System 
  * http://blogcms.com/
  * http://forum.blogcms.com/
  *
  * 2003-2004, (c) Radek HULAN 
  * http://hulan.info/
  *
  * This program 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.
**/

$pun_root = './';
@include $pun_root.'config.php';

// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
    exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');

// Disable error reporting for uninitialized variables
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);


// Load the functions script
require $pun_root.'include/functions.php';
require $pun_root.'include/parser.php';

// Load DB abstraction layer and try to connect
require $pun_root.'include/dblayer/common_db.php';

// Get the forum config
$result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
    $pun_config[$cur_config_item[0]] = $cur_config_item[1];

// Make sure we (guests) have permission to read the forums
$result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
if ($db->result($result) == '0')
    exit('No permission');


// Attempt to load the common language file
@include $pun_root.'lang/'.$pun_config['o_default_lang'].'/common.php';
if (!isset($lang_common)) exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.');

// parse RSS
ob_start();

// make feed
putHeader();
$result = $db->query(
    "select p.id as id, p.message as message, p.posted as postposted, t.subject as subject ".
    "from ".$db->prefix."posts as p, ".$db->prefix."topics as t ".
    "where p.topic_id=t.id ".
    "order by postposted desc ".
    "limit 0,15") 
    or error('Unable to fetch forum posts', __FILE__, __LINE__, $db->error());;
while ($cur = $db->fetch_assoc($result)) putPost($cur);
putEnd();

// get feed into $feed
$feed = ob_get_contents();
ob_end_clean();

// create ETAG (hash of feed)
$eTag = '"'.md5($feed).'"';
header('Etag: '.$eTag);

// compare Etag to what we got
if ($eTag == $_SERVER['HTTP_IF_NONE_MATCH']) {    
    header("HTTP/1.0 304 Not Modified");
    header('Content-Length: 0');
} else {
    // dump feed
    header ("Content-type: text/xml");
    echo $feed;
}

/* entity to unicode decimal value */
function entity_to_decimal_value($string){
    static $entities_dec = false;
    if (!is_array($entities_dec)) {
        $entities_named       = array(" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","­","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","ƒ","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","•","…","?","?","?","?","?","?","?","™","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",""","&","<",">","Œ","œ","Š","š","Ÿ","ˆ","˜","?","?","?","?","?","?","?","–","—","‘","’","‚","“","”","„","†","‡","‰","‹","›","€","&apos;");
        $entities_decimal     = array(" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","­","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","ƒ","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","•","…","?","?","?","?","?","?","?","™","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",""","&","<",">","Œ","œ","Š","š","Ÿ","ˆ","˜","?","?","?","?","?","?","?","–","—","‘","’","‚","“","”","„","†","‡","‰","‹","›","€","'");
        if (function_exists('array_combine')) 
            $entities_dec=array_combine($entities_named,$entities_decimal);
        else {
            $i=0;
            foreach ($entities_named as $_entities_named) $entities_dec[$_entities_named]=$entities_decimal[$i++];
        }
    }
    return preg_replace( "/&[A-Za-z]+;/", " ", strtr($string,$entities_dec) );
}

function encode_xml($data){
    // line breaks
    $data=str_replace('<br />',"\n",$data);
    // ending html tags into line breaks
    $data=preg_replace("/<\/(pre|ul|li|p|table|tr)>/","\n",$data);
    // remove other html tags
    $data=preg_replace("/<(.*?)>/","",$data);
    // remove multiple newlines
    $data=preg_replace("/\n\n+/","\n\n",$data);
    return entity_to_decimal_value($data);
}

function putHeader() {   
    global $lang_common,$pun_config;
    echo '<'.'?xml version="1.0" encoding="'.$lang_common['lang_encoding'].'"?'.'>'."\n";
    echo "<rss version=\"2.0\">\n";
    echo "<channel>\n";
    echo "<title>".entity_to_decimal_value(htmlspecialchars($pun_config['o_board_title']))."</title>\n";
    echo "<link>".$pun_config['o_base_url']."</link>\n";
    echo "<description>".entity_to_decimal_value(htmlspecialchars($rss_description.' '.$pun_config['o_board_title']))."</description>\n";
    echo "<language>en</language>\n";
    echo "<docs>http://backend.userland.com/rss</docs>\n";
} 

function putPost($cur) {
    global $pun_config;
    echo "<item>\n";
    echo "<title>".entity_to_decimal_value(htmlspecialchars($cur['subject']))."</title>\n";
    $link = $pun_config['o_base_url'].'/viewtopic.php?pid='.strval($cur['id']).'#'.strval($cur['id']);
    echo "<link>".entity_to_decimal_value(htmlspecialchars($link))."</link>\n";
    $data = "Topic: ".parse_message($cur['subject'],0)."\n\nMessage: ".parse_message($cur['message'],0);
    echo "<description>".encode_xml($data)."</description>\n";
    echo "<pubDate>".strval(date("r",$cur['postposted']))."</pubDate>\n";
    echo "</item>\n";
}


function putEnd() {
    echo "</channel>\n";
    echo "</rss>\n";
} 

?>

Rickard, there is a bug in email.php@pun_mail(), if Forum name is, e.g., "BLOG:CMS FORUM", the mail() function will fail because of ":".

Solution?

$from = str_replace(":",'\:',$from);

Rickard,

could you add ?> to end of every script? The thing is, if you use some PHP parser, it will complain about this.. I use JEdit for source code editing, with PHP parser, and/or PHPEclispe, and both have problem with this..

3061519 wrote:

Thank you all. I will wait and see. I will temporarily use phpMyAdmin to backup/restore for now.
I have downloaded PunBB v1.2 to test. I cannot find the Preview button anywhere, Rickard. However, it's fine. It's not essential.

PunBB BLOG:CMS Edition mod has  backup/restore feature integrated, you may get it here:

http://forum.blogcms.com/viewtopic.php?id=226

Try Opera 7.60, way faster and way more productive than (otherwise excellent) Firefox :-)
Opera=The Fastest Browser on Earth

http://www.opera.com/

I second that Paul, tables are definitely the best way, and most accesible, to present tabular data.. Some people just think tables are evil, but.. NO!!! When using properly TH, TD, TBODY, THEAD, TFOOT tags, tables are the very best solution to display, ehm, tables wink

you can always get PunBB BLOG:CMS Edition release 1.1.15

http://forum.blogcms.com/viewtopic.php?id=226

it is XHTML 1.0 STRICT valid, and has MANY mods included...

10

(6 replies, posted in PunBB 1.2 show off)

zaher wrote:

and what language you are talk? smile

what do you mean? http://forum.blogcms.com/ is in English, both interface, and posts..

11

(6 replies, posted in PunBB 1.2 show off)

well, the forum's in English as far as I can see smile

12

(16 replies, posted in PunBB 1.2 discussion)

no, what do you think is better and more accesible?

This?

<table>
<tr><th>A</th><th>B</th></tr>
<tr><td>content 1</td><td>content 2</td></tr>
</table>

Or this?

<div class='table'>
<div class='header'>
<div class='item'>A</div>
<div class='item'>B</div>
</div>
<div class='rows'>
<div class='item'>content 1</div>
<div class='item'>content 2</div>
</div>
</div>

Well, of cource the first thing is preferred wink Tables are bad for layout, but they are GREAT, designed for, to display, ehm, .. tables. smile

13

(16 replies, posted in PunBB 1.2 discussion)

ext wrote:

Nice piece of code wink

I'd like to make the code of my Punbb look like that... I really prefer making "fake tables" with div's than playing with real tables, for one main reason : if you use divs, code is much more easy to read, and easier to "skin" from CSS imho...

Back to work, there's still a long way to make it...
Note for myself : don't forget to test under IE...


This is what I did: http://forum.blogcms.com - XHTML 1.0 STRICT valid. Looking at http://forums.proxywiregen.com/ makes me sick, in fact, tabular data SHOULD be represented in tablesm using <th>, <td>, <tbody>, <thead> tags, not substituted for 5-6 <divs>! That forum has WAY MORE markup than my custom PunBB BLOG:CMS Edition mod.. wink

hcgtv wrote:

I've looked into Iframe and that might be the way to go. If it's only Opera issues that would keep it from happening then we can write an email to Oslo smile

Opera supports CSS better than latest Firefox 0.9.2, you don't need to worry about this wink (I use latest Opera 7.52 on a daily basis, purchased for $39)

15

(12 replies, posted in PunBB 1.2 show off)

Why anobody wants to mimic phpBB? Hey, PunBB is, thank your Rickard, WAY faster smile

PS: And PunBB BLOG:CMS Edition even faster and XHTML 1.0 STRICT valid smile

here you, PunBB (BLOG:CMS Edition) based forum, about WIFi, GSM, CDMA, and such:

http://www.marigold.cz/forum/

Integrates with site design:
http://www.marigold.cz

17

(0 replies, posted in PunBB 1.2 show off)

I needed a place to discuss some of my weblog articles, so have created XHTML 1.0 STRICT valid forum that matches my site design.

Forum:
http://hulan.info/forum/

Site:
http://hulan.info/blog/

after quite a few emails exchanged with Rickard, I think 1.2 will be pretty much the same as my current mod, better in some areas, so, with 1.2 there will be no "forks". With 1.1.4, this simply was NOT possible..

middleground wrote:

No offense, but this is really starting to seem like a BLOG:CMS thread, approaching advertisement?,  and while it is nice, I'm here for punBB.
{....just IMHO.....}


well, no offence either, but within last 3 days, this is what I have added to PunBB code:


* ALL, and I mean ALL, files have been *heavily* modified for markup, but not only to achieve XHTML 1.0 STRICT validity, but also to make A LOT of changes to CSS and layout. Old one was VERY inefficient. Now, CSS classes like pun* are not used at all. CSS is a lot simpler. The whole layout was redesigned. Nested tables removed.

* parser.php now works differently for [ img ], [ code ], [ quote ] and [ url ] tags, not only to be XHTML valid, but also way more simple, and no tables, again

* backup / restore functions have been added, though only for MySQL, I will fix this ASAP (I do not use DB layer, rather, direct DB access; have to get more familiar with your scripts)

* whole admin interface has been redone in new style

* install script has been redone in new style

* rss 2.0 export of posts (rss.php) have been added

* simple CSS toolbar and smilies support, with JavaScript, mod has been added to post.php, edit.php and quick post; now, it does NOT use images, and MANY users love this feature, while still being compatible with PunBB philosophy - KISS (keep it simple)

* templates, header.php and footer.php have been redesigned

* several (reported) bugs have been fixed

--

* NP_PunBB plugin has been created, which allows to insert items into users, forums, topics and posts tables

Now, see this:
http://hulan.info/blog/

And this:
http://hulan.info/forum/viewtopic.php?id=2

This is a great, and automatic, connection between CMS and FORUM smile Maybe you do NOT like it, but I am pretty sure A LOT of users will.

Paul wrote:
Rickard wrote:

Yes, but I don't like Sourceforge all that much. There are times when it's sloooooooow.

Too right. The download system is somewhat hit and miss as well. Yesterday it took me 10 minutes to download a 250k file and that was on broadband.

Well, yes, download is troublesome sometimes. But the rest is, surprisingly, just fine. CVS, Bug Tracker, etc., immediate response, and.. secure (use PuTTY, WinCVS).

Paul wrote:

It's nice to have big ideas. Me, I would be happy if I could just get Divs to stop jumping about in Opera.

Opera's no problem, with CSS3 support wink Old crappy MSIE is 8)

aha, I see. Anyway, all this has sourceforge.net to offer, and for free. CVS, bug tracker, downloads, mirrors, forums, different modules, etc., etc.

and you do not have to configure anything, just subscribe...

Rickard, if you need, i can setup CVS at BLOG:CMS (sourceforge.net) for PunBB right now. I think there is quite a need to see latest and greatest code wink

Or, register PunBB at sf.net, it takes about 24 hours to get approved.

Rickard wrote:

We've discussed the opening of links in new windows before. I leaning towards opening all links in the same window and thereby putting the control in the hands of the user.

I have the same opinion, but, since you provide option to set this in user profile, I open new windows only when user wishes so in his/her profile.

The thing is, you might want to think about changing the default behaviour (links in new windows ON)

well, simply because if window.open() will fail (in case there is a popup blocker), not JAvaScript, neither href="" will open the window wink

this would be ok:

<a href="..." onclick="return !window.open(this.href, '')">Website</a>

but.. it is always preferable to use a function..