51

(124 replies, posted in News)

Yea agree. Heard about this today. I would be affected greatly if punbb would "dissappear".
But yea Im happy aswell that you guys have some steady "income" if I didnt misunderstood it all.

*thumbs up*

My "spooky" things are that some user info isnt read. Like style sheets arnt applied but only showing the standard one. If someone is moderator you can't choose what forums the person is moderator over cause the forum seems not to notice that the member is moderator.

Well I went through my code and started to comment out some stuff (all of it basically). So I noticed that the "errors" dissappeared when I commented out the include for this file:

<?php
$result = $db->query('SELECT t.id 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.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

if($db->num_rows($result)) {
    $updated=true;
} else {
    $updated=false;
}
?>

Done this:

<?php
    require PUN_ROOT.'../global/footer.php';
?>

But doesnt work..

Heya ppl!

Sneaking past this forum now once in a while. Really excited about punbb 1.3 mmm.

Well anyway my problem. I have like many integrated my forum into my site through the template file. The problem with my site is that I have dynamic menus (right managements etc.) that requires php files (header.php, footer.php). These I have in a "global" dir (../global/ seen from forum dir).

So first step was that you can't use php in main.tpl.. but there exist "<pun_include..."!!
Woopa.. so I created two files in "/include/user/" that looks like this and include them to the main.tpl.

<?php
include "../global/header.php";
?>

But as fast as I include something out of "forum main dir" there starts to happen alot of "spooky" things on the forum...

Anyone that perhaps knows why this occurs?

Thanks alot!
I managed to trace the error thanks to you smartys..

But the error is kinda wierd. We have added a external header and footer php file to the forum so it slims into the rest of the webpage.

In the header we check for user permissions to view the different pages.
I have added a coloumn to the user table in the database that is called rights to the right.

So .. now the forum can't fetch user properties ... the list users works but all pages to edit profile and such is bugged.
Do you know something that could cause this Smarty?

Edit:
Oh and cause of this.. the forum believes everybody have "show images" in posts unchecked....

Edit2:
This is the code that is related to punbb in header.php:

define('PUN_ROOT', '../forum/');
define('PUN_QUIET_VISIT', 0);
require_once PUN_ROOT.'include/common.php';

Edit3:
I removed the code that I put up in edit2. And my code still works.. I was stupid to place it there in the first place.
Images, smilies and such works again wippi!

but.. I still have the problem with the settings on user profile page.
Example is that if I want to change ppls user group then it sais the standard group in the list. Whatever group he/her belong to. This is very annoying when you want to set the moderator status for different pages cause that never shows up.

Heya!

Well this strange thing appeared yesterday.. I dont know exactly when it happened but ... Im building a site to my group of friends with Punbb as backend .. yet we try to modify Punbb as little as possible to make updates so easy as possible..

But now the parser doesnt parser the images any longer. A link with the text "<image>" popups instead.
When making a post it sais that Img tag:on. soo.. I dont know where I made a change...settings?

Cheers Carl!

I tried to set it to '.example.com'.

It works for http://forum.example.com (the forum) but not for my http://www.example.com.

http://www.example.com/index.php:

<?php
define('PUN_ROOT', '../forum/');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';

echo $pun_user['username'];
?>

http://www.example.com still shows Guest.


EDIT:

its started to working ... didnt work with a certain domain that I only used for dev.. but worked fine for the real domain names.

Thanks alot!

Hey!

Sorry for the late reply but I thought I wouldnt get any responds..

Well Smartys its not the same domain address.. I discovered that it was the issue (why I searched up this post again)

So .. the forum is beneath http://forum.example.com and my file where I need the user info is located beneath http://news.example.com.

You said anything about cookie.. is it possible to fix on a good way without creating a security risk?

EDIT:

The path in config.php is set to '/'.

Cheers Carl!

I echo $pun_user['is_guest'] and get 1 and when I echo $pun_user['username'] I get Guest... so I get the guest account information ..but Im logged in on the forum..

Heya!

I have a external page that I want to protect with punbb user auth.
So I included the common.php and all.

But when I echo the info from the pun_user I get the guest user info all the time. I'm logged in on the forum but can't access my own info.

Cheers Carl!

Heya dudes!

I am trying to integrate phpraid into punbb. It works like the mediawiki addon so I think it should'nt be any problem. Well for me its still a mess to understand. So phpraid got support for phpbb, it checks against the usertable if the user exists and if he does he creates the user in phpraid database if he doesnt already exist.

So I thought only of replacing the code in the phpbb file to manipulate so phpraid thinks its phpbb he chats with. The existing file for phpbb:

<?php

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

 *                                 auth_phpbb.php

 *                            -------------------

 *   begin                : Saturday, Jan 16, 2005

 *   copyright            : (C) 2005 Kyle Spraggs

 *   email                : spiffyjr@gmail.com

 *

 *   $Id: mysql.php,v 1.16 2002/03/19 01:07:36 psotfx Exp $

 *

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



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

 *

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

 *

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

// define our auth type

if( isset( $_GET["phpbb_root_path"] ) || isset( $_POST["phpbb_root_path"]) )

    log_hack();

        

// check profile

// Specific to phpBB authentication only. Checks to see if a profile exists

// for phpBB user and if not, creates one.

function check_profile($userdata)

{

    global $db_raid, $phpraid_config;

    

    $email = $userdata['user_email'];

    

    $sql = "SELECT * FROM " . $phpraid_config['db_prefix'] . "profile WHERE email='$email'";

    $result = $db_raid->sql_query($sql) or print_error($sql, mysql_error(), 1);

    

    // if nothing returns we need to create profile

    // otherwise they have a profile so let's set their ID

    // we'll just use the phpBB user id as the profile ID to simplify things

    if($db_raid->sql_numrows($result) == 0 && $userdata['username'] != 'Anonymous')

    {

        $user_id = $userdata['user_id'];

        $username = $userdata['username'];

        

        if($phpraid_config['default_group'] != 'nil')

            $default = $phpraid_config['default_group'];

        else

            $default = '0';

        

        // nothing returned, create profile

        $sql = "INSERT INTO " . $phpraid_config['db_prefix'] . "profile (`profile_id`,`email`,`password`,`priv`,`username`)

                VALUES ('$user_id','$email','','$default','$username')";

        $db_raid->sql_query($sql) or print_error($sql, mysql_error(), 1);

    }

    

    return $userdata['user_id'];

}



// login function for phpBB

function phpraid_login()

{

    global $db, $user_ip;

    

    $username = isset($_POST['username']) ? phpbb_clean_username($_POST['username']) : '';

    $password = isset($_POST['password']) ? $_POST['password'] : '';

        $sql = "SELECT user_id, username, user_password, user_active, user_level

        FROM " . USERS_TABLE . "

        WHERE username = '" . str_replace("\\'", "''", $username) . "'";

        

    if ( !($result = $db->sql_query($sql)) )

        message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);

        

    if( $row = $db->sql_fetchrow($result) )

    {

        if( md5($password) == $row['user_password'] && $row['user_active'] )

        { 

            // success

            $autologin = ( isset($_POST['autologin']) ) ? TRUE : 0;

            $admin = (isset($_POST['admin'])) ? 1 : 0;

            $session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin);

            return 1;

        }

        else

        {

            // login failure

            return 0;

        }

    }

}



// logout function for phpBB

function phpraid_logout()

{

    global $userdata;

    

    session_end($userdata['session_id'], $userdata['user_id']);

    clear_session();

}



// database connection

$phpbb_prefix = $phpraid_config['phpbb_prefix'];



global $user_group_table;

$user_group_table = $phpbb_prefix . "user_group";



// setup phpBB user integration

define('IN_PHPBB', true);



$phpbb_root_path = $phpraid_config['phpbb_root_path'];

        

// set this as the path to your phpBB installation

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);

    

$userdata = session_pagestart($user_ip, PAGE_INDEX);

init_userprefs($userdata);



// set user variables

$_SESSION['username'] = $userdata['username'];

$_SESSION['session_logged_in'] = $userdata['session_logged_in'];



// check if they have a phpRaid profile yet

// if not, create one if so set profile_id to correct

$_SESSION['profile_id'] = check_profile($userdata);

?>

Thanks in advance and I think that more ppl would enjoy this!

It's Perfect!!!

Thanks a bunch!

It was exactly what I was after and it work's great.

The forum is private.. and I wanted a easy way to see the activity so we don't need language file's and so on.

Cheers Carl

I have edited my member list so it show's last visit instead of the registrated date....

but I want the list to show how many days ago and not the day they where in last.. so how do that work in php??

I have "1122029865" for example on one member...

Fetched the code....

<td class="tcr"><?php echo format_time($user_data['last_visit'], true) ?></td>

so.. are there any possibility that the thing can show...
"Today"
"Yesterday"
"1 Day ago"
"2 Days ago... and so on.."

Cheers Carl

Ok but how do I make a new page to get "into" the forum as the irc chat on your page?

Hey!

I have searched and searched....

How do you insert a new page into punbb?

I want a new item in the menu that I want to show up "in" punbb.
I would also want the option to lock the page to useronly for future pages and then also hide the menu link if none is logged in.


Cheers Carl

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.

I saw that this was the wrong place to post....
I continue the post in integration part.

http://punbb.org/forums/viewtopic.php?id=7573

you can close this thread.

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);

1. Copy all the files from the old to the new server.
2. Fix the File Permission on the new server
3. Save the database to file with a tool like phpmyadmin.
4. Restore the database on the new server with phpmyadmin
5. Go to options and set the new "Base URL"

if you want more instruction then please tell if its somekind of webhotel or something you are using...

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.


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:
Im trying to leech out the text from database now but I hope there are a easier solution.

EDIT2:
Well I noticed the posts is saved in BBCode and not in html.
And this made the thing a little more complicated cause Im not pro php.

Are there anyway to use punbbs own scipt for that?