1 (edited by Loa 2005-05-20 17:40)

Topic: How to use PunBB as webpage editor?

Hey!

I got a forum for a group of people.
Now we wanted a small site with a bit of information about us, but I want that the members can change the information on the site "without noledge" about html and so on...

So I thought that I could create a part of the forum with a thread for every side on the page.

For example:

Forum
|- Site information
    |- Home page (thread with the startpage text)
    |- ext...

I want that only the thread Text is visible on the site, so not want to se the "Last edited by.." thing on the site.
I tried to make thread for the page and then leech out the text from database to the site, but the posts was formated in BBCode and not Html.
Are there any php script that I can use to only see the text with html formatting.
leech.php?postid=23 or whatever that I can include into the pages?

Well I hope you get my idea.
I have searched the forum now for an hour or so.. so I hope I havnt posted something that exists..

EDIT:
its only the first post that I want to show, the members got permission to edit.


EDIT2:

Well I have looked around little with my inexperienced eyes over the php code.
So the parser.php is the one who converts everything...
Well then the only problem is to get out the text out of the database then....

I still would like if anyone could write a short php file that do what I want...

EDIT3:
I got this far but it seems that I cannot get it to work with the parser...

THIS WORKS:

<?php

$db_user = "##";
$db_passwd = "##";
$db_name = "##";
$db_host = "##";

$link = mysql_connect($db_host, $db_user, $db_passwd) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select DB");

$query = "SELECT * FROM `posts`";
$query .= " WHERE id = '2'";

$result = mysql_query($query) or die(mysql_error());

while ( $row = mysql_fetch_assoc( $result ) )
{

print $row["message"];

}

?>

THIS DOESNT:

<?php

$db_user = "##";
$db_passwd = "##";
$db_name = "##";
$db_host = "##";

$link = mysql_connect($db_host, $db_user, $db_passwd) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select DB");

$query = "SELECT * FROM `posts`";
$query .= " WHERE id = '2'";

$result = mysql_query($query) or die(mysql_error());

require 'include/parser.php';

while ( $row = mysql_fetch_assoc( $result ) )
{

print parse_message($row['message'], $row['hide_smilies']);

}

?>

Are there somesort of protection or what am I doing wrong?

EDIT4:

as fast as I put in this

require 'include/parser.php';

my page goes blank.

why is that?
are there a protection?

EDIT5:
found the protection..

if (!defined('PUN'))
    exit;

are there anyway to get my leech.php accepted cause now or do I got to comment away this protection?
well Im continue with the protection off..

I have started to get a error in parser.php now.
Dont know if I can make this script cause my noledge in php is really smal.
it stops here:

    $text = pun_htmlspecialchars($text);

2 (edited by Loa 2005-05-20 18:19)

Re: How to use PunBB as webpage editor?

After sitting some and checked back and forth on some scripts I have managed to create my leech.php:

<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'include/parser.php';

$db_user = "##";
$db_passwd = "##";
$db_name = "##";
$db_host = "##";

$link = mysql_connect($db_host, $db_user, $db_passwd) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select DB");

$query = "SELECT * FROM `posts`";
$query .= " WHERE id = ".$_REQUEST['post'];

$result = mysql_query($query) or die(mysql_error());
while ( $row = mysql_fetch_assoc( $result ) )
{

//print parse_message($row['message'], $row['hide_smilies']);
print parse_message($row['message'], '1');

}

?>

But be carefull!
This is a security risk cause ANYONE can get ALL posts that have been written on the forum.