201

(19 replies, posted in PunBB 1.2 discussion)

I got converted smile
So far is going as fast as ever.

My forums have about 2500 users and 6000 posts. According on sqlite.org, sqlite would handle all punbb forums i have seen so far.

sqlite.org wrote:

SQLite usually will work great as the database engine for low to medium traffic websites (which is to say, 99.9% of all websites). The amount of web traffic that SQLite can handle depends, of course, on how heavily the website uses its database. Generally speaking, any site that gets fewer than a 100000 hits/day should work fine with SQLite. The 100000 hits/day figure is a conservative estimate, not a hard upper bound. SQLite has been demonstrated to work with 10 times that amount of traffic.

My reasons:
It's simpler to back up, restore and carry arround
Sometimes the mysql server goes down or i reach the maximum allowded connections by my host.

lighttpd+php5(sqlite)+punbb
that souns really cool.

PS:my forums are not 100% swedish technology anymore, lol

202

(2 replies, posted in PunBB 1.2 show off)

Damn, that looks cool.
Still i would suggest you change a bit the forum header. Like... take away the title as you have it already in your webpage.

203

(5 replies, posted in PunBB 1.2 troubleshooting)

A few days ago i wrote a little script to migrate from phorum to punbb. It was not that much work. Migrating from DCforum should not be much more difficult ff you know a bit of sql. It took less than 300 lines of php.

204

(1 replies, posted in PunBB 1.2 discussion)

No comments on this? sad

I was expecting punbb gurus to comment this so i could know if there wassome bad  programming approach, bug, etc. on the code

i guessed it should be something like that, does sqlite has any find and replace solution?

206

(10 replies, posted in PunBB 1.2 discussion)

That's a cool database abstraction then.
I think it can be practical to use in other applications, that's what i meant

I migrated a forum from phorum to punbb with this script I wrote. It worked fine but some images show the bbcode instead of the images. If i edit the message and then submit again without any changes then the image shows.
I noticed that so far that happen only when the IMG tags are in capitals, but i am not sure about this yet.

Can anybody give a look on the script and tell me why am i having this problem?

First of all you would need to register that domain. Then  you should contact punbb-hosting.com in order to set up the dns correctly.

I dont remember who's running punbb-hosting but i dont think he/she have controll over dns services.

209

(1 replies, posted in PunBB 1.2 discussion)

Is not that code that you need to change.... you need to replace the file() or file_get_contents() function somewhere on the parser code.

http://wiki.dreamhost.com/index.php/CURL

I suggest though, you use magpie instead, it uses curl from the beginning.

210

(1 replies, posted in PunBB 1.2 discussion)

The code might be a bit bogus, i wrote this in a hurry, the important thing: it worked!
I migrated a forum from phorum!
It worked like a charm, though is not a somplete clean migration ( that would be impossible ) .
Currently i have only a major issue:
something when wrong with the "img" bbcode tag... the viewtopic shows the bbcode source and url insead of the image... strange... can anybody figure out why? on the other hand, the "code" tags work perfectly...

Now, there is a few things to keep in mind:
-I didnt use punbb db layer because i wanted this done quickly, so this will migrate to SQLITE ONLY.
-For those using php 4 or older this won't probably work as you likely don't have suport for sqlite.
-The two first users of your phorum forum will be overwriten by the new admin and the guest acount respectively.
In my case that was no problem as i had registered two accounts from the beginning. A way to solve this is adding user offset.
-No groups are kept, permissions should be set in the new installations
-the display order has to be adjusted manually.
-single quotes will be replaced by double quotes because of sqlite_escape string

I wont make any changes in this code, in case somebody takes the effort...

TODO:
-Add user offset
-Switch from native mysql library to punbb dblayer
-minor code improvements

<?php
/**************************************************************\
*    Phorum (mysql) -> Punbb 1.2 (sqlite)
*
*    coded by pedrotuga
*
* This script migrates your phorum forum to punbb.
* The destination database is a sqlite database, you will 
* no longer need a mysql database or server. The two first
* users in your phorum database will be replaced by the new 
* admin and the guest acount respectively.
* 
* For further information check punbb support forums at
*   http://forums.punbb.org
*
* For further information about SQLite check
*   http://sqlite.org
*
*    Instructions
*    1.Install punbb 1.2, chose sqlite as your database system
*    2.Delete the test category/forum/post
*    3.Set the variables below
*    4.upload this script and run it
*
* Released under punbb compatible license
*
\***************************************************************/


//original mysql database settings=============================================
$username = "";
$password = "";
$hostname = "";
$database = "";

//sqlite new database file name================================================

$sqlite_filename = "";

//if you use a table preffix on your phorum installation define it here========

$prefix = "";

//set $debug_mode to true to output the queries================================

$debug_mode = false;

//*****************************************************************************
//******                      Settings end                                *******
//*****************************************************************************

//database connections=========================================================
$dbh = mysql_connect($hostname, $username, $password) 
    or die("Unable to connect to MySQL server");
$selected = mysql_select_db($database) 
    or die("database error!!! Unable to use specified database");
    
$db = sqlite_open( $sqlite_filename , 0666, $sqliteerror);
        
//user migration===============================================================

$sql_get_users ="SELECT user_id, username,`password`,email,posts,date_added FROM ".$prefix."_users WHERE active=1 AND user_id > 2";

$result_users = mysql_query($sql_get_users);

$sql_insert_users = array();

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

    $escaped_username = sqlite_escape_string($row["username"]);
    $escaped_email    = sqlite_escape_string($row["email"]);
    
    $sql_insert_users[]="INSERT INTO users
                        (id,username,password, email,num_posts,registered)
                        VALUES
                        (".$row["user_id"].",'".$escaped_username."','".$row["password"]."','".$escaped_email."',".$row["posts"].",".$row["date_added"].")";
}


foreach ($sql_insert_users as $iterador){
    if ($debug_mode){
        echo $iterador."<br />";
        
    }
    sqlite_query ( $db, $iterador );
}


 
//categories migration==========================================================

$sql_get_categories = "SELECT forum_id, name FROM ".$prefix."_forums WHERE folder_flag=1";
 
$result_categories = mysql_query($sql_get_categories);

$sql_insert_categories = array();

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

    $escaped_catname = sqlite_escape_string($row["name"]);
    
    $sql_insert_categories[]="INSERT INTO categories
                        (id,cat_name)
                        VALUES
                        (".$row[forum_id].",'".$escaped_catname."')";
}

foreach ($sql_insert_categories as $iterador){
    if ($debug_mode){
        echo $iterador."<br />";
        
    }
    sqlite_query ( $db, $iterador );
}


//forums migration==========================================================

$sql_get_forums = "SELECT forum_id, name, description, parent_id, message_count, thread_count FROM ".$prefix."_forums WHERE folder_flag=0";

$result_forums = mysql_query($sql_get_forums);

$sql_insert_forums = array();

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

    $escaped_forumname = sqlite_escape_string($row["name"]);
    $escaped_forumdescription = sqlite_escape_string($row["description"]);
    
    $sql_insert_forums[]="INSERT INTO forums
                        (id,forum_name, forum_desc, cat_id, num_posts, num_topics)
                        VALUES
                        (".$row[forum_id].",'".$escaped_forumname."','".$escaped_forumdescription."',".$row["parent_id"].",".$row["message_count"].",".$row["thread_count"].")";
}

foreach ($sql_insert_forums as $iterador){
    if ($debug_mode){
        echo $iterador."<br />";
    }
    sqlite_query ( $db, $iterador );
    
}



//topics migration==========================================================

$sql_get_topics = "SELECT     message_id,
                            forum_id,
                            author,
                            subject,
                            datestamp,
                            viewcount,
                            thread_count
                    FROM
                            ".$prefix."_messages
                    WHERE
                            parent_id=0";


$result_topics = mysql_query($sql_get_topics);

$sql_insert_topics = array();

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

    $escaped_topicsubject = sqlite_escape_string($row["subject"]);
    $escaped_author = sqlite_escape_string($row["author"]);
    
    $sql_insert_topics[]="INSERT INTO topics
                        (id,forum_id,poster,subject,posted,num_views,num_replies)
                        VALUES
                        (".$row[message_id].",".$row["forum_id"].",'".$escaped_author."','".$escaped_topicsubject."',".$row["datestamp"].",".$row["viewcount"].",".$row["thread_count"].")";
}

foreach ($sql_insert_topics as $iterador){
    if ($debug_mode){
        echo $iterador."<br />";
    }
    sqlite_query ( $db, $iterador );

}


//topposts migration==========================================================

$sql_get_topposts= "SELECT  message_id,    
                            author,
                            body,
                            user_id,
                            datestamp,
                            modifystamp
                    FROM
                            ".$prefix."_messages
                    WHERE
                            parent_id=0";


$result_topposts = mysql_query($sql_get_topposts);

$sql_insert_topposts = array();

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

    $escaped_body = sqlite_escape_string($row["body"]);
    $escaped_author = sqlite_escape_string($row["author"]);
    
    $sql_insert_topposts[]="INSERT INTO posts
                        (id,topic_id,poster,message,poster_id,posted,edited,edited_by)
                        VALUES
                        (".$row[message_id].",".$row["message_id"].",'".$escaped_author."','".$escaped_body."',".$row["user_id"].",".$row["datestamp"].",".$row["modifystamp"].",'desconhecido')";
}

foreach ($sql_insert_topposts as $iterador){
    if ($debug_mode){
        echo $iterador."<br />";
    }
    sqlite_query ( $db, $iterador );
}

//non-topposts migration======================================================

$sql_get_posts= "SELECT   message_id,
                            parent_id,
                            author,
                            body,
                            user_id,
                            datestamp,
                            modifystamp
                    FROM
                            ".$prefix."_messages
                    WHERE
                            parent_id<>0";

echo $sql_get_posts;

$result_posts = mysql_query($sql_get_posts);

$sql_insert_posts = array();

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

    $escaped_body = sqlite_escape_string($row["body"]);
    $escaped_author = sqlite_escape_string($row["author"]);
    
    $sql_insert_posts[]="INSERT INTO posts
                        (id,topic_id,poster,message,poster_id,posted,edited,edited_by)
                        VALUES
                        (".$row["message_id"].",".$row["parent_id"].",'".$escaped_author."','".$escaped_body."',".$row["user_id"].",".$row["datestamp"].",".$row["modifystamp"].",'desconhecido')";
}

foreach ($sql_insert_posts as $iterador){
    if ($debug_mode){
        echo $iterador."<br />";
    }
    sqlite_query ( $db, $iterador );
}



//update the last post of each topic==========================================

$sql_get_alltopics= "SELECT id from topics";

$result_alltopics = sqlite_query($db, $sql_get_alltopics);

while ($row = sqlite_fetch_array($result_alltopics)){
    
    $sql_get_last_values     = "SELECT id, poster, posted FROM posts WHERE topic_id=".$row["id"]." ORDER BY posted DESC LIMIT 1";
    $result                 = sqlite_query($db, $sql_get_last_values);
    $last_values             = sqlite_fetch_array($result);
    $escaped_author         = sqlite_escape_string($last_values["poster"]);
    $sql_update_topics        = "UPDATE topics SET last_post=".$last_values["posted"].", last_post_id=".$last_values["id"].", last_poster='$escaped_author' WHERE id=".$row["id"];
    sqlite_query($db, $sql_update_topics);
    
    }
    

//update the last post of each forum==========================================

$sql_get_allforums= "SELECT id from forums";

$result_allforums = sqlite_query($db, $sql_get_allforums);

while ($row = sqlite_fetch_array($result_allforums)){
    
    $sql_get_last_values     = "SELECT p.id id, p.poster poster, p.posted posted FROM posts as p, topics as t WHERE p.topic_id=t.id AND t.forum_id=".$row["id"]." ORDER BY p.posted DESC LIMIT 1";
    $result                 = sqlite_query($db, $sql_get_last_values);
    $last_values             = sqlite_fetch_array($result);
    $escaped_author         = sqlite_escape_string($last_values["poster"]);
    $sql_update_forums        = "UPDATE forums SET last_post=".$last_values["posted"].", last_post_id=".$last_values["id"].", last_poster='$escaped_author' WHERE id=".$row["id"];
    sqlite_query($db, $sql_update_forums);
    
    }

?>

211

(10 replies, posted in PunBB 1.2 discussion)

Mmm.... i see.

php.net wrote:

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database  abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

Punbb already has such a feature. Rickard, I take the chance to ask, was it you writing punbb dblayer for punbb usage only? I think it could have been a good option to integrate in other applications before PDO.

212

(4 replies, posted in PunBB 1.2 discussion)

mmm... i see... thank you both for the quick replies.

So, if i got it right punbb is getting some changes in the markup so one could have even more flexibility from the css, did i got it right?

213

(10 replies, posted in PunBB 1.2 discussion)

I am currently writing a script to migrate phorum to punbb. I want to migrate to punbb and sqlite instead of phorum/mysql. Just wondering if i should go for sqlite3 or sqlite2? In the documentation page it says that it has only been tested up to version 2? anybody using sqlite3?

214

(4 replies, posted in PunBB 1.2 discussion)

From what i read out there in the forums this is a bit of a taboo, but allow me to be curious. Is there any work being done concerning a style guide?
I checked punres wiki and it had very little documentation on this. Somebody with good html/css knowledge could contribute with a complete style document for dummies with a few common style tweak examples.

Then... don't be to violent on me if you have answered these questions a thousand times before...

Will version 1.3 styles be compatible with current ones?
What is the difference beetwin a style and a template?

215

(0 replies, posted in Programming)

I want to write a small application to upload multiple pictures to those free image hosting providers out there like flickr, imageshack, photobucket, etc.

I thought about using xul to give it a try. The alternatives are wxwidgets or GTK. But i would really like to give a try to XUL.

Is anybody out there using it?
I haven't really understand how the application is packaged 100%. Does anybody knows if there is any gateway that allows me to use any language? i heard i could only use java or C/C++ . I still yet to understand where that hypothetical restriction would come from.

Any info or advice is appreciate.

216

(11 replies, posted in General discussion)

hcgtv wrote:
pedrotuga wrote:

I use magpie to fetch, it parses all kind of popular feeds like RSS and atom. Then i use punbb as the aggregator itself.  I think punbb is easily shapeable and felxible... you can hack viewforum.php to show a small description of every post for example. Then use viewtopic to allow post discussion.

Hey, this would make a nice mod that I could use on one of my boards and it would make a nice extension looking towards 1.3.

That's actually half done (or more) already.
check it out
http://punbb.org/forums/viewtopic.php?pid=79750#p79750

The original version uses php's mysql native library, read the topic through and you will find another version with punbb dblayer

217

(11 replies, posted in General discussion)

I use magpie to fetch, it parses all kind of popular feeds like RSS and atom. Then i use punbb as the aggregator itself.  I think punbb is easily shapeable and felxible... you can hack viewforum.php to show a small description of every post for example. Then use viewtopic to allow post discussion.

Some days ago i red about two aggreggators for wordpress. Google for "wordpress aggregator" and you should find them

Dr jeckyl, thats a simple and effective idea.  I had 3 spam messages so far, i think that'snothing. If i get a spam problem one of these days that's how i will solve it.

I mean the poster info in every post div.  It shows horizontally tilled with the content, i would like to give it a try tilling it vertically with the post.

I would like to give it a try. Is it to much work? My html/css skills are poor. Would it take more than some CSS tweaking?

221

(29 replies, posted in Programming)

mmmm... don't really know what to think. The words 'microsoft' and 'interesting' do not coexist in my brain.

222

(7 replies, posted in PunBB 1.2 discussion)

Would it work with all db flavors?
This is kind of cool... too many extensions required some sql hacking lately.
I hope the code don't get less and less simple, because that's one of the things i love in punbb.

MadHatter: lol wink

223

(8 replies, posted in PunBB 1.2 show off)

Wile E. Coyote is a good fellow!
I like it.
Just a minor dislike: I would pull all the content some centimeters up.

224

(5 replies, posted in General discussion)

another cool feature:
Punbb supports other DBMS than mysql.
I sugest sqlite.

Yet another reason: super simple clean code, all of it.

this was for my gf, she needed a webserver with asp.net. aparently asp.net is not asp... i dunno.
Anyway, we fixed an acount in a friends server.
thank you quaker