I went ahead and took the simple route. Rather than supporting other databases, I wrote it to just work with my specific database - eliminating the need for DB layer classes, and put all of the DB login info in the config file. It turned out to be a lot easier than I thought. Thanks though.
102 2005-01-12 23:16
Re: PunBB 1.2 (142 replies, posted in News)
My apologies to Paul. We talked about this a few months ago and I knew there were several of you involved with this project. Taking another look at the first post, I see that you credit Paul Sullivan for the semantically correct xhtml/css, and Bert Garcia for the documentation. Is it mainly the 3 of you or are there others?
>>> "Programming is like sex: one mistake and you have to support it for the rest of your life."
LOL. Great tagline.
Regarding upgrading from 1.1.5 --
Would it be just as easy if I make any needed changes to the old database, delete the forum files, and then do a basic install of 1.2? It won't be any trouble for me to have my forum down while doing that. Is doing a clean install of 1.2 (while saving the old database and modifying it via phpMyadmin) easier than following the upgrade procedure?
103 2005-01-12 23:00
Re: User Registration, Login script modeled after punbb 1.2 (4 replies, posted in Programming)
Thinking about it further (and not having studied the source code yet), it seems like what I want to do would be relatively easy:
* create a database table for 'users' - either manually with phpMyadmin or using the code from the install file
* then there's a registration page, login page, admin page, userlist page, etc
* there's some code in each page detecting whether I'm logged in or not - session id? cookies?
* that determines what links display: 'login', 'logout', 'register', etc.
* and it determines whether the user is allowed into certain directories or webpages
It sounds simple in concept. We'll see how it goes in theory.
104 2005-01-12 21:12
Topic: User Registration, Login script modeled after punbb 1.2 (4 replies, posted in Programming)
I want to put together a stripped down, stand-alone version of a user registration/login script. I have a basic understanding of PHP so I thought I'd use PunBB v1.2 as a model to work from. I'm planning to use it as a generic script for creating users that have access to secure webpages, to add a commenting feature later, etc. Just the usual except I'd like it to be a stand-alone script separate from the forum.
That's what this is, right?
>>> "- A proper user group system with global and forum specific permission settings."
How much is punbb's script integrated into the forum? Would it be simple enough to take the login part out of the forum and use it on it's own? I'll look at the code and start studying it to see.
Any tips, suggestions in the meantime would be appreciated.
105 2005-01-12 20:56
Re: PunBB 1.2 (142 replies, posted in News)
My vote:
==> Forget the Private Messages and Polls.
They waste space on my server. I like this forum because it's lean and mean, and I hope it stays that way.
Rickard, I just got news of the v1.2 release! Very cool, very exciting. I can't wait to install it and play with it. Thanks so much. I love that it's xhtml 1.0 strict - that's what I write with. You're the man!
106 2004-12-14 20:27
Topic: MySQL 101 - basics for the beginner (19 replies, posted in Programming)
I've decided to take the plunge and start using MySQL databases in my websites. (Other than for pre-packaged applications like PunBB - I'm already doing that.) I've read a couple tutorials and I have a basic beginner-level understanding.
The first step is to connect. I want to organize the files in a "proper" way, so I studied how PunBB does it:
index.php
> include/common.php
> > config.php
> > include/functions.php
> > include/dblayer/common_db.php
> > > include/dblayer/mysql.php
I think I understand everything except for what's going on in the last file. The 'common_db.php' points to another file depending on the type of database being used. Simple enough. So then you go to the 'mysql.php' file and there's about 100 lines of code that make no sense to me.
It looks like I need to, "Load the appropriate DB layer class." What's a simple way to do this? (as compared to the way it's done in the mysql.php file)
Here's an excerpt from mysql.php as a reminder of what it contains:
// Make sure we have built in support for MySQL
if (!function_exists('mysql_connect'))
exit('This PHP environment doesn\'t have MySQL support built in.');
//
// Return current timestamp (with microseconds) as a float.
//
if (defined('PUN_SHOW_QUERIES'))
{
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
}
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $row = array();
var $saved_queries = array();
var $num_queries = 0;
function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
{
$this->prefix = $db_prefix;
if ($p_connect)
$this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
else
$this->link_id = @mysql_connect($db_host, $db_username, $db_password);
if ($this->link_id)
{
if (@mysql_select_db($db_name, $this->link_id))
return $this->link_id;
else
error('Unable to select database. '.mysql_error(), __LINE__, __FILE__);
}
else
error('Unable to connect to MySQL server. '.mysql_error(), __LINE__, __FILE__);
}
function query($sql = '', $transaction = 0)
{
unset($this->query_result);
if ($sql != '')
{
if (defined('PUN_SHOW_QUERIES'))
$q_start = get_microtime();
$this->query_result = @mysql_query($sql, $this->link_id);
}
if ($this->query_result)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
++$this->num_queries;
unset($this->row[$this->query_result]);
return $this->query_result;
}
else
return ($transaction == PUN_TRANS_END) ? true : false;
}
function result($query_id = 0, $row = 0){}
function fetch_array($query_id = 0){}
function fetch_assoc($query_id = 0){}
function fetch_row($query_id = 0){}
function num_rows($query_id = 0){}
function affected_rows(){}
function insert_id(){}
function get_num_queries(){}
function get_saved_queries() {}
function free_result($query_id = false) {}
function error() {}
function close() {}
}
107 2004-12-06 03:04
Re: target="_blank" (21 replies, posted in Feature requests)
108 2004-12-06 02:54
Re: target="_blank" (21 replies, posted in Feature requests)
What happened to the thread that discussed this? The JavaScript code for opening links in new windows (XHTML compliant) was posted. Did you delete that thread? I can't find it.
109 2004-12-06 02:41
Re: Split & Merge Topics (17 replies, posted in Feature requests)
Louis: There's already a Split-Topic Mod - http://www.punres.org/files.php?pid=22
Just read the directions and install it yourself; it's easy.
Regarding 'Merging Topics', simply use your web host's control panel to access the database. Then, move posts one at a time to the new thread: go to the 'posts' table and edit the 'topic_id' for each post you want moved.
110 2004-11-11 02:17
Re: Home page of this site? (8 replies, posted in PunBB 1.2 discussion)
I figured it out and got it to work. Thanks for telling me about the extern.php file - that saved me a lot of time. I don't know much PHP/MySQL, so it was a lot easier to just figure out what was already written and add in a few values rather than getting all the database stuff, config file, common file, language file, etc to work together from scratch.
Rickard, thanks for setting up that extern.php file. Very helpful and thoughtful of you. I was having a heck of a time trying to figure out how to call to the database from a different subdomain. Your solution is so much easier.
The solution I came up with is at HiveMinds.info for anyone who's interested:
http://hiveminds.info/phpBB/viewtopic.php?t=2602
111 2004-11-11 00:13
Re: Home page of this site? (8 replies, posted in PunBB 1.2 discussion)
I worked with the extern.php file and got it to print the 15 recent posts with links. But I'd still like to add the poster and forum_name(linked) to the output like this:
subject(linked) : poster : forum_name(linked)
So while fetching from the database, I need the poster, forum_id, then the forum_name from the other table, and whatever is needed to link to the forum. Any suggestions would be appreciated.
Here's the code I'm working with:
--------
It's currently set up to display a list of the 15 most recent posts, with links to the posts:
subject(linked)
I want to do:
subject(linked) : poster : forum_name(linked)
//
// active2 (show recently active topics as 'subject(linked) : poster : forum_name(linked)') (HTML)
//
//
if ($_GET['action'] == 'active2')
{
$order_by = ($_GET['action'] == 'active2') ? 't.last_post' : 't.posted';
$forum_sql = '';
// Was a forum ID supplied?
if (isset($_GET['fid']))
{
$fid = intval($_GET['fid']);
if (!empty($fid))
$forum_sql = 'f.id='.$fid.' AND ';
}
// Should we output this as RSS?
// Code removed
// Output regular HTML
// else
// {
$show = intval($_GET['show']);
if ($show < 1 || $show > 50)
$show = 15;
// Fetch $show topics
$result = $db->query('SELECT t.id, t.subject FROM '.$db->prefix.'topics AS t INNER JOIN
'.$db->prefix.'forums AS f ON t.forum_id=f.id WHERE t.moved_to IS NULL AND
'.$forum_sql.'f.admmod_only=0 ORDER BY '.$order_by.' DESC LIMIT '.$show) or
error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
while ($cur_topic = $db->fetch_assoc($result))
{
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
if (pun_strlen($cur_topic['subject']) > $max_subject_length)
$subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
else
$subject_truncated = $cur_topic['subject'];
echo '<b>·</b> <a href="'.$pun_config['o_base_url'].'/viewtopic.php?
id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.
pun_htmlspecialchars($subject_truncated).'</a><br>'."\n";
}
// }
exit;
}
(I added some linebreaks to minimize the horizontal scrolling.)
112 2004-11-10 15:59
Re: Home page of this site? (8 replies, posted in PunBB 1.2 discussion)
I believe zaher's mod will post you favorite posts on your home page. If you just want the most recent posts, then look at extern.php that comes with punBB. Instructions are commented in the code.
So, if I want to print the 15 most recent posts, does extern.php tell me how?
I want to print it in this format:
subject, poster, forum_name
113 2004-09-26 15:29
Re: 1.2 Requests: using PunBB as mini-CMS (26 replies, posted in PunBB 1.2 modifications, plugins and integrations)
The problem with Scoop is that it isn't a good format for carrying on conversations - it doesn't work well as a forum. I don't think you'll be happy using Scoop as a forum.
PunBB 1.2 will make it possible to assign permissions to a specific forum so that users are only able to e.g. post new topics (and not replies). The opposite will also be possible, e.g. users can post replies, but not new topics (suitable for news and other articles).
That sounds perfect. (I like it, anyway.) Doesn't that do what you're asking for?
114 2004-09-26 15:20
Re: Possible solution to the e-mail harvester issue (21 replies, posted in PunBB 1.2 discussion)
Here are 2 links that may provide ideas:
----------------------------------------------
phpBBHacks.com -
"This hack makes it so that website links added to profiles or upon registering will not show up to guests or search engines. This will hopefully deter some spammers from registering accounts at your site."
http://www.phpbbhacks.com/viewhack.php?id=2959
phpBB.com -
Discussion on "Abuse: Random users with invalid emails and Russian URLs"
http://www.phpbb.com/phpBB/viewtopic.php?t=228041
Personally, I *really* like the internal email system punbb provides, and if left up to me, I would hide/mask all the other options in my install so the only way to send email is through the system, thus, not exposing any email addresses at all, unless of course the user sends email, which then would expose it.
I agree - let them send email through the form rather than a mailto link.
115 2004-09-25 17:05
Re: 1.2 Requests: using PunBB as mini-CMS (26 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Something like Scoop might be what he's looking for. I don't know. (Hope you don't mind my linking to it.)
116 2004-09-25 16:56
Re: Possible solution to the e-mail harvester issue (21 replies, posted in PunBB 1.2 discussion)
I won't speak for Rickard, but for me it doesn't add any value to let guests send email. I personally don't care if a guest can't send email - in fact they shouldn't be allowed to. If they want to send email they should register and login like everyone else - it only takes 2 or 3 minutes. If they don't want to register, why should I let them email members of the forum?
Back to the original question, "never displaying emails for guests" sounds like a good solution. It sounds simple too.
There's another related problem still. I've heard there are scripts (ie, not people) going around that automatically register themselves into php forums, then spam the site with links back to their sites. They also might harvest emails. The solution for that could be to do the bit with a generated image containing a random string that has to be entered by the user.
117 2004-09-25 16:17
Re: PunBB 1.2 (3 replies, posted in PunBB 1.2 discussion)
If you click on the Announcements category, you'll find 3 topics dedicated to version 1.2. The answer to your question has probably already been answered over there.
118 2004-09-25 11:14
Re: Possible solution to the e-mail harvester issue (21 replies, posted in PunBB 1.2 discussion)
How about keeping it that way, but never displaying any e-mail addresses for guests? That way, harvesters will not be able to catch them.
Not displaying emails for guests sounds good to me if it isn't too hard for you to do that.
What about munging the address? meATmysiteDOTcom, or some variation like that.
119 2004-09-25 10:54
Re: PunBB 1.2 - What's to come (300 replies, posted in PunBB 1.2 discussion)
I knew it. And ?
It's good that you knew. But your post didn't indicate it, so other people reading your post would have no way of knowing.
When I said, "in case you didn't know," the 'you' is addressing anyone reading the post. I'm telling them where they can go to read more about the script and learn how it works and how to use it. It's a helpful pointer for people needing instructions.
I haven't ever wrote "this is my script".
By not writing, "this is someone else's script," the implication is that it's yours. It's always a good idea - and a matter of courtesy - to give credit where credit is due. The standard method for doing this with JavaScript is to name the author in a comment at the beginning of the script.
120 2004-09-25 09:22
Re: PunBB 1.2 development source (277 replies, posted in PunBB 1.2 discussion)
But will it make coffee in the morning?
121 2004-09-25 05:59
Re: PunBB 1.2 development source (277 replies, posted in PunBB 1.2 discussion)
In 1.2, will there be a feature that allows you to move individual posts into another topic? If not I guess there will be a mod that can be added.
I like the idea of turning it into a browser, by the way. Heck, make it do word processing and image editing while you're at it.
122 2004-09-25 05:35
Re: PunBB 1.2 - What's to come (300 replies, posted in PunBB 1.2 discussion)
I use this code for my new XHTML site ...
in <head></head>
<script type="text/javascript"> <!-- function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank"; } } window.onload = externalLinks; --> </script>
When I want a link becomes NEW window (or if you use php) ...
simply add in your link
<a class="punBB" href="http://punbb.org" rel="external">PUNBB IS THE BEST FORUM EVER CREATED</a>
rel="external"
is used for future (see w3c web site)
That JavaScript was written by Kevin Yank and is explained in his article, New-Window Links in a Standards-Compliant World at SitePoint.com (in case you didn't know).
123 2004-09-17 23:13
Re: PunBB 1.2 development source (277 replies, posted in PunBB 1.2 discussion)
That's fine, I understand and I'm not in any rush. Thanks for the rough estimate.
I'm planning to set up a new forum that will get a lot of use, and I figured if 1.2 were expected to be finished really soon, then I might as well wait for it.
But since it will be a few more months then I'm probably better off starting now with 1.5 so I can get the word out that my new forum is in place.
124 2004-09-17 21:16
Re: PunBB 1.2 development source (277 replies, posted in PunBB 1.2 discussion)
Is the ETA for a stable release of v1.2 in the range of 2-4 weeks or 2-4 months?
125 2004-08-26 22:19
Re: Registration disable (14 replies, posted in General discussion)
I think you're trying to do too much. Just logon as an administrator, click 'Admin', 'Permissions', and next to 'Guest' set the 4 radio buttons to 'Yes'.