smf vs phpbb3

Started by adicrst, December 13, 2007, 07:22:45 PM

Previous topic - Next topic

Chose your option

Only smf
47 (28.5%)
Only phpbb
4 (2.4%)
smf is better
68 (41.2%)
phpbb3 is better
25 (15.2%)
smf much catch up with phpbb3
21 (12.7%)

Total Members Voted: 158

Grudge

The original definition of open source (As per the literal meaning) was that the source code for software was available to users "In the clear" so to speak. Open source has been more commonly associated with the OSI and specifically the GPL license which defines a specific set of criteria in addition to the literal meaning of the word. I don't think it's unreasonable of us to state that SMF is an open source product, we allow users to freely use the software, modify it for themselves, and release patches to enable others to modify it as they wish (i.e. mods) - it's actually entirely inkeeping with what open source originally meant. I agree however that it would not be correct for us to state that we have a GPL/OSI compatible license as that is not the case as we do not allow redistribution without prior consent - particularly of derived works.

I agree that it's irritating that lots of software is released under varying proprietary licenses. Unfortunately as it currently stands I'm not aware of any license freely available that bridges the gap between fully commercial licenses and those on the other side like GPL. I'm sure that Simple Machines aren't the only group out there who believe in the open source principle but wish to protect themselves and their users from "branches" of their product - something that continues to be the main sticking point for SMF not being GPL (I don't believe various forks of SMF would benefit either ourselves or our users).

The other thing I'd love to find a way of writing into a license is somehow guaranteeing the availability of the software in the event that the organisation behind it ceases to be. Whilst SMF continues to be actively developed (And I see no reason why that would ever stop) things are fine - but in the unlikely event that Simple Machines were to wind up there is no mechanism within the license to allow someone else to take up the software. Short of making some extremely complex wording such as "If there is no release of the software within xxx months the clause disallowing redistribution will cease to have effect" which I doubt holds any legal weight I have no idea how we could do such a thing.

At the end of the day I've never seem the big issue with what license something is released under as long as it is free. The fact is that unlike some software types it's a sinch to migrate to another forum software if you really want. If we were to stop developing SMF tomorrow people could easily convert to phpBB, vB, IPB etc. Similarly if phpBB stopped developing tomorrow I suspect most users would convert to a "proper" forum packages out there rather than pick one of the "forked" phpBB software which, from my experience - and only in general, tend to tarnish phpBB's reputation rather than improve it as they are often "phpBB on acid" and hence buggy, unsecure and lead to users unfairly associating them with phpBB.

Anyway, clearly this is not very much related to phpBB as per the topic starter.
I'm only a half geek really...

gemigene

Quote from: Alundra on December 31, 2007, 10:16:06 PM
Quote from: Motoko-chan on December 31, 2007, 08:54:46 PM
Quote from: gemigene on December 31, 2007, 08:29:02 PM
Quote from: Alundra on December 31, 2007, 08:21:50 PM
no it just pops up in my "unread messages" thingie...lol

Wish I could tell you, never got past the permissions system, designed for people who studied Quantum Physics.

I know that version 2.0.22 didn't have that glitch.

Cheers,
Gene


LOL! Must be a glitch, I get the same from a thread to which I unsubscribed to 4 or 5 months ago...

Unread posts shows all posts to which one posted in which haven't been read yet. As of right now, there is no way to remove topics you aren't interested in from this list.

* Alundra wonders if phpBB3 has it :P
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

arod

Quote from: Motoko-chan on December 31, 2007, 08:13:55 PM
SMF templating can be a mess, yes. It is very flexible and thus can become very complicated. We have recognized this issue and there are ongoing projects to see what we can do to help.

As for SMF not being compliant to XHTML, it is. Go validate a new install and it will pass as XHTML 1.0 Transitional. What you are thinking of is "semantic markup", a push to move presentation in CSS. There is no standard for this, it is just a style.
again, i don't want to be a pita, but please allow me a small comment:
smf "templating" system, as per the most common use of the word is no templating at all.
the objective of a templating system, (e.g. SMARTY) is to create a complete separation (or, at least, as complete as possible while still making sense) between the visual/appearance (aka "html") side, and the code.
smf "templates" are large pieces of php code. the only thing that makes them "templates" is the fact that most of this code is meant to generate html.
this, by most common use of the word, is not a "template system". i hope that with the next version, smf's templating system will be what's most people call a templating system.
(btw: if smf used gpl for it's license, i would have strongly recommend to take smarty "as is" and implant it as a part of smf. if you could do that, you would have leapfrogged phpbb, which took parts of smarty and parts of other projects, and mangled them into something significantly inferior to smarty, though still superior to what smf uses.)

as to compliance: my bad. the source of my mistake is that this page (  http://www.simplemachines.org/community/index.php?action=post;board=33.0 ) does not validate, so i assumed it's the forum software. i was wrong. from what i can see, the forum itself validates perfectly. please accept my apology for this wrong accusation.

Grudge

The template system in SMF is one of those things which I've often thought about how to improve and it's difficult to find a better system. The great thing about the SMF system is it's fast (Native PHP) and extremely flexible (As you're not constrained by another layer). I've used Smarty only briefly but didn't really think it's suitable - it's certainly not something we'd incorporate into the code - if we went in another direction with templates we'd write it ourselves to ensure it's optimised for SMF (Using a library is great for standalone websites but when you're making a product you can't afford to use something which more than likely has considerable superflorous features).

In my view if we do reengineer the template system in the future (And it certainly wouldn't make it in 2.0 as it's a huge task) we'd go for an XML based system, using HTML tags for display and dedicated xml tags for PHP constructs (<smf:for>, <smf:if> etc). We'd then compile these XML templates into PHP and cache them to ensure they run as fast as possible. Such a system would probably allow for both XML and traditional PHP type templates - although how we dealt with mods would be a challenge.

arod, I can assure you that we think and discuss about these things all the time as a team - the real challenge is knowing what to prioritise to ensuse we incorporate those elements that will benefit the majority of users the most.
I'm only a half geek really...

gemigene

I agree with the above but please keep in mind that some forum admins may want to "minimize" info (messenger services, website info, certain options, etc.) for boards of a very sensitive nature (drug dependency, mental illnesses, the handicapped, private institutional forums, etc.), phpBB 2.0.22 was quite accommodating in that respect, all you had to do was comment out the fields in the appropriate templates.

Cheers,
Gene
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Grudge

SMF 2.0 offers an admin interface for disabling ICQ, MSN, YIM, AOL, Location, Gender, Website and Posts - although this acts across the whole board (Not just no post display). You can of course also comment out the field in the templates if you wish but we thought an admin setting was a nice thing to have.
I'm only a half geek really...

gemigene

#86
Fantastic, can't wait for it to be released to the general public.

BTW, I'm putting together a new forum called "The Forum Software Discussion Board" for novice, intermediate and experienced forum software users alike to review and openly discuss the worthiness as well as the flaws of forum software packages in the hopes that this Forum will guide users to their software package of choice.

I'm using SMF for this community.

Cheers,
Gene
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Jade Elizabeth

Quote from: Grudge on January 01, 2008, 05:54:36 PM
SMF 2.0 offers an admin interface for disabling ICQ, MSN, YIM, AOL, Location, Gender, Website and Posts - although this acts across the whole board (Not just no post display). You can of course also comment out the field in the templates if you wish but we thought an admin setting was a nice thing to have.

thats for sure

(i just deleted it from the templates lol)
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Rudolf

#88
Quote from: arod on January 01, 2008, 05:05:08 PM
again, i don't want to be a pita, but please allow me a small comment:
smf "templating" system, as per the most common use of the word is no templating at all.
the objective of a templating system, (e.g. SMARTY) is to create a complete separation (or, at least, as complete as possible while still making sense) between the visual/appearance (aka "html") side, and the code.
smf "templates" are large pieces of php code. the only thing that makes them "templates" is the fact that most of this code is meant to generate html.
this, by most common use of the word, is not a "template system". i hope that with the next version, smf's templating system will be what's most people call a templating system.
(btw: if smf used gpl for it's license, i would have strongly recommend to take smarty "as is" and implant it as a part of smf. if you could do that, you would have leapfrogged phpbb, which took parts of smarty and parts of other projects, and mangled them into something significantly inferior to smarty, though still superior to what smf uses.)
For me the definition of the templating system is not this. A templating system is meant to be a thing to help separate the business logic from the presentation logic.
Smarty in no way does that. (people who use it could do it, but I haven't found such people yet) Smarty basically creates a simplified programming language to create HTML. Smarty has control structures, variables, functions (in the way of transformations) and whatnot. Smarty is meant to generate HTML pages just like PHP does.
In fact all Smarty does is to translate your Smarty(pants) code into native PHP code.
I've said many times before, and I'll reiterate. If someone can't understand some basic information about PHP, like the echo command, concatenating strings, what variables are, how to use them, they will not be able to understand Smarty either.
Believe me, I have direct contact with Smarty and people who use it. I am forced to interact with dozens of people (webmasters) using Smarty since years, and they still don't have a clue of what they are doing.

For what it worths, the templating system in SMF is one of the things that shouldn't be touched. There are always small tweaks to apply to make it more flexible, but mostly trivial changes that don't affect the structure.
I don't see what would be to gain from replacing loadTemplate('Profile'); with $Smarty->display('Profile.tpl');


Let's talk when you understood the difference between business logic and presentation logic.

Rant over.
And don't get me started.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

elfishtroll

#89
@Rudolf, thanks for saying so succinctly about Smarty what I^ve been swearing at me whole life!
@grudge
Quote from: Grudge on January 01, 2008, 01:10:43 PMThe original definition of open source (As per the literal meaning) was that the source code for software was available to users ~In the clear~ so to speak. Open source has been more commonly associated with the OSI and specifically the GPL license which defines a specific set of criteria in addition to the literal meaning of the word. I don^t think it^s unreasonable of us to state that SMF is an open source product, we allow users to freely use the software, modify it for themselves, and release patches to enable others to modify it as they wish (i.e. mods) - it^s actually entirely inkeeping with what open source originally meant.  I agree however that it would not be correct for us to state that we have a GPL/OSI compatible license  as that is not the case as we do not allow redistribution without prior consent  - particularly of derived works.  I agree that it^s irritating that lots of software is released under varying proprietary licenses.  Unfortunately as it currently stands I^m not aware of any license freely available that bridges  the gap between fully commercial licenses and those on the other side like GPL.  I^m sure that Simple Machines aren^t the only group out there who believe in the open source principle  but wish to protect themselves and their users from ~branches~ of their product -  something that continues to be the main sticking point for SMF not being GPL  (I don^t believe various forks of SMF would benefit either ourselves or our users).  *The other thing I^d love to find a way of writing into a license is somehow guaranteeing the availability of the software  in the event that the organisation behind it ceases to be. * Whilst SMF continues to be actively developed (And I see no reason why that would ever stop)  things are fine - but in the unlikely event that Simple Machines were to wind up  there is no mechanism within the license to allow someone else to take up the software.   Short of making some extremely complex wording such as ~If there is no release of the software  within xxx months the clause disallowing redistribution will cease to have effect~  which I doubt holds any legal weight I have no idea how we could do such a thing.  At the end of the day I^ve never seem the big issue with what license something is released under as long as it is free.  The fact is that unlike some software types it^s a sinch to migrate to another forum software if you really want.   If we were to stop developing SMF tomorrow people could easily convert to phpBB, vB, IPB etc.  Similarly if phpBB stopped developing tomorrow I suspect most users would convert to a ~proper~  forum packages out there rather than pick one of the ~forked~ phpBB software which, from my experience -  and only in general, tend to tarnish phpBB^s reputation rather than improve it as they are often ~phpBB on acid~  and hence buggy, unsecure and lead to users unfairly associating them with phpBB. * Anyway, clearly this is not very much related to phpBB as per the topic starter.

*Actually Grudge, I disagree with you, I feel your comments are VERY MUCH ON TOPIC!  There are many things that go into a purchasing decision (and I say purchase, for although both products are ostensibly free, there is a TCO  (total cost of Ownership) that wil exist for both, regardless.) I also dont feel that your license ^expiration^ clause is particularly onerous, complex nor impossible.  The SMF license protects SMF rights as an ongoing software development concern. The ~Ongoing development project~ can be defined by ~x # of updates releases per calendar year~   obviously, if people have ^bought^ SMF and the company goes away, then there should be a provision to allow them to take over where SMF left off. The real reason to NOT have a clause like you describe would be the idea of Simple Machine Forums being superseded some time in the future (as SMF superseded YABBSE) with a pay or otherwise commercial version built on the knowledge base (if not the codebase) of previous SMF development.In that case, the org would need to be able to transition ALL of the previous SMF base and wouldnt want it to remain behind with a splinter group.Personally, that wouldnt bother me in the slightest, I^ve compared SMF against VB and IPB in quite a few situations where COST IS NO OBJECT (@programmers: cost was an inherited class :P) and chose SMF each time. Some of those choices were not mine alone but part of a team via a decision matrix drawn up by people unfamiliar with forum software in general.the biggest part I have a problem with though is [quo*te]1) A**t the end of the day I^ve never seem the big issue with what license something is released under as long as it is free. 2) The fact is that unlike some software types its a cinch to migrate to another forum software if you really want.


The problem with 1) is... what is ~free~ and ~freedom~?Would you like a 52 inch flat screen tv, but the license stipulated that the ONLY use to which it could be put was watching  single 10 second loop of some video?The affero license indicates if you deploy a covered app on a website, EVERYONE who connects to your website app, is entitled to a copy of the code INCLUDING ANY MODS you^ve made. THAT would preclude me from using it, not just the disclosure issues of releasing code, but the *administrative overhead* of dealing with source code requests.It^s also not a CINCH by any means to convert forums of any reasonable size and/or user base. You see, the issues you face then aren^t just  code or mapping of field type to field type, but raw physical issues of a huge unwieldy database, different log in and posting behaviors, user interface, DIFFERENT SEMANTICS (you say ~DELETE POST~ I say ~expire text~.. when you ~delete~ it^s gone for good, my similarly named action only hides it, and so on)

Again, I see your perspective as a programmer, not as an end-user or site admin and I understand it.Respectively though, after um...~trolling~ this forum for over two years, I strongly believe that some *^cross disciplinary training* ^is DEFINITELY needed - staffers HAVE to walk in someone else^s shoes/wear other hats/roles for a while to better appreciate the issues the other party faces.
In that, I am convinced that the MOTM was not only useful, but ESSENTIAL no matter the cost as the benefits will be great.In fact, I predict a MAJOR SHIFT for SMF in 2008 as the cross-pollination bears fruit!  :

I think that SMF in the future will evolve to have TWO main extension mechanisms.  The existing source code delta based modification manager, and a plugin based type of code integration.like wordpress or joomla etc





(note: There\\\'s a big bug in the parser that TOTALLY MANGLES a post, inserting spurious BBC code etc, if the post has that escape/back quote character! (the one under the tilde ~ on most keyboards!)

Dannii

QuoteIn my view if we do reengineer the template system in the future (And it certainly wouldn't make it in 2.0 as it's a huge task) we'd go for an XML based system, using HTML tags for display and dedicated xml tags for PHP constructs (<smf:for>, <smf:if> etc). We'd then compile these XML templates into PHP and cache them to ensure they run as fast as possible. Such a system would probably allow for both XML and traditional PHP type templates - although how we dealt with mods would be a challenge.
Sounds great :)

elfishtroll, fix your quote please.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Ben_S

Quote from: Grudge on January 01, 2008, 05:25:47 PM
I've used Smarty only briefly but didn't really think it's suitable - it's certainly not something we'd incorporate into the code

Smarty is horribly complex (well not really) more so that simple php echo statements as SMF currently uses. I think most of the time people see a bit of php and automatically assume it must be hard. ::)
Liverpool FC Forum with 14 million+ posts.

motumbo

Quote from: Grudge on January 01, 2008, 01:10:43 PMI agree however that it would not be correct for us to state that we have a GPL/OSI compatible license as that is not the case as we do not allow redistribution without prior consent - particularly of derived works.

What is SMF afraid of?  :-\

I'll have to think about that one for...oh, about 1/10th a second.  I think:  SMF is afraid of losing control of the forum because they know that if they changed the licensing structure that someone would create an offshoot of SMF.

It's all about control.  Even if that control means that SMF continues to fall behind the competition.

karlbenson

#93
Control can work both ways.  Off-shoots/forking of projects can work both ways aswell.
IMO the GPL is overrated.

I still think SMF is comparable to vBulletin who I would describe as the 'market leader'.

I don't think PHPBB3 comes close to 1.1.x nevermind 2.0.
PHPBB3 has always been good at design, but bad at security. Although from the exploit sites I peruse, PHPBB3 has had fewer exploits than previous releases.

Bigguy

I really DON'T think we are falling behind anyone to tell you the truth. phpbb has always been a mess in my opinion and as for the rest; I think they are way over priced for what you get. SMF is the only way to go.

motumbo

I can understand you people's loyalty to SMF.  However, denying the fact that phpBB3 is nice isn't going to get you anywhere.  It is nice.  Very nice.

I will agree that phpBB2 was a mess.  That's why I chose SMF.  :)

I'll have to look into phpBB3's alleged security vulnerabilities.  phpBB2 was full of holes.  A couple of time I visited phpBB2 forums that got hacked.  From a webmaster's perspective, that has to be a terrible violation.  I would probably feel the same as if my house were burglarized. 

SMF does have a good record on security.  There is no denying that.




Bigguy

I like the template of the new phpbb3 but other than that I say it is still a mess and not nearly as easy to use or modify code in as SMF.

Gary

Quote from: motumbo on February 05, 2008, 09:37:35 PM
However, denying the fact that phpBB3 is nice isn't going to get you anywhere.  It is nice.  Very nice.

Nor is denying the fact that phpBB 3 to some people can be horrible going to get you anywhere. It's all a matter of opinion.

And at the moment, I remain unopinionated as I've not properly had a chance to use it yet.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

motumbo

#98
Quote from: Bigguy on February 05, 2008, 09:41:39 PM
I like the template of the new phpbb3 but other than that I say it is still a mess and not nearly as easy to use or modify code in as SMF.

You must be joking.

The phpBB3 code is beautiful.  The code is broken up to do small, discrete things.  SMF, by comparison, has everything including the kitchen sink in the same function.  And sometimes, you'll have essentially duplicate code in multiple places. 


// Show the board index!
function BoardIndex()
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $context, $settings;

// For wireless, we use the Wireless template...
if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex';
else
loadTemplate('BoardIndex');

// Remember the most recent topic for optimizing the recent posts feature.
$most_recent_topic = array(
'timestamp' => 0,
'ref' => null
);

// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
$result_boards = db_query("
SELECT
c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.description,
b.numPosts, b.numTopics, b.ID_PARENT, IFNULL(m.posterTime, 0) AS posterTime,
IFNULL(mem.memberName, m.posterName) AS posterName, m.subject, m.ID_TOPIC,
IFNULL(mem.realName, m.posterName) AS realName," . ($user_info['is_guest'] ? "
1 AS isRead, 0 AS new_from" : "
(IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED) AS isRead, IFNULL(lb.ID_MSG, -1) + 1 AS new_from,
c.canCollapse, IFNULL(cc.ID_MEMBER, 0) AS isCollapsed") . ",
IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,
IFNULL(mods_mem.ID_MEMBER, 0) AS ID_MODERATOR, mods_mem.realName AS modRealName
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}collapsed_categories AS cc ON (cc.ID_CAT = c.ID_CAT AND cc.ID_MEMBER = $ID_MEMBER)" : '') . "
LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = b.ID_BOARD)
LEFT JOIN {$db_prefix}members AS mods_mem ON (mods_mem.ID_MEMBER = mods.ID_MEMBER)
WHERE $user_info[query_see_board]" . (empty($modSettings['countChildPosts']) ? "
AND b.childLevel <= 1" : ''), __FILE__, __LINE__);

// Run through the categories and boards....
$context['categories'] = array();
while ($row_board = mysql_fetch_assoc($result_boards))
{
// Haven't set this category yet.
if (empty($context['categories'][$row_board['ID_CAT']]))
{
$context['categories'][$row_board['ID_CAT']] = array(
'id' => $row_board['ID_CAT'],
'name' => $row_board['catName'],
'is_collapsed' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1 && $row_board['isCollapsed'] > 0,
'can_collapse' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1,
'collapse_href' => isset($row_board['canCollapse']) ? $scripturl . '?action=collapse;c=' . $row_board['ID_CAT'] . ';sa=' . ($row_board['isCollapsed'] > 0 ? 'expand' : 'collapse;') . '#' . $row_board['ID_CAT'] : '',
'collapse_image' => isset($row_board['canCollapse']) ? '<img src="' . $settings['images_url'] . '/' . ($row_board['isCollapsed'] > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' border="0" />' : '',
'href' => $scripturl . '#' . $row_board['ID_CAT'],
'boards' => array(),
'new' => false
);
$context['categories'][$row_board['ID_CAT']]['link'] = '<a name="' . $row_board['ID_CAT'] . '" href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
}

// If this board has new posts in it (and isn't the recycle bin!) then the category is new.
if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['ID_BOARD'])
$context['categories'][$row_board['ID_CAT']]['new'] |= empty($row_board['isRead']) && $row_board['posterName'] != '';

// Collapsed category - don't do any of this.
if ($context['categories'][$row_board['ID_CAT']]['is_collapsed'])
continue;

// Let's save some typing.  Climbing the array might be slower, anyhow.
$this_category = &$context['categories'][$row_board['ID_CAT']]['boards'];

// This is a parent board.
if (empty($row_board['ID_PARENT']))
{
// Is this a new board, or just another moderator?
if (!isset($this_category[$row_board['ID_BOARD']]))
{
// Not a child.
$isChild = false;

$this_category[$row_board['ID_BOARD']] = array(
'new' => empty($row_board['isRead']),
'id' => $row_board['ID_BOARD'],
'name' => $row_board['boardName'],
'description' => $row_board['description'],
'moderators' => array(),
'link_moderators' => array(),
'children' => array(),
'link_children' => array(),
'children_new' => false,
'topics' => $row_board['numTopics'],
'posts' => $row_board['numPosts'],
'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['boardName'] . '</a>'
);
}
if (!empty($row_board['ID_MODERATOR']))
{
$this_category[$row_board['ID_BOARD']]['moderators'][$row_board['ID_MODERATOR']] = array(
'id' => $row_board['ID_MODERATOR'],
'name' => $row_board['modRealName'],
'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>'
);
$this_category[$row_board['ID_BOARD']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>';
}
}
// Found a child board.... make sure we've found its parent and the child hasn't been set already.
elseif (isset($this_category[$row_board['ID_PARENT']]['children']) && !isset($this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]))
{
// A valid child!
$isChild = true;

$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']] = array(
'id' => $row_board['ID_BOARD'],
'name' => $row_board['boardName'],
'description' => $row_board['description'],
'new' => empty($row_board['isRead']) && $row_board['posterName'] != '',
'topics' => $row_board['numTopics'],
'posts' => $row_board['numPosts'],
'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['boardName'] . '</a>'
);

// Counting child board posts is... slow :/.
if (!empty($modSettings['countChildPosts']))
{
$this_category[$row_board['ID_PARENT']]['posts'] += $row_board['numPosts'];
$this_category[$row_board['ID_PARENT']]['topics'] += $row_board['numTopics'];
}

// Does this board contain new boards?
$this_category[$row_board['ID_PARENT']]['children_new'] |= empty($row_board['isRead']);

// This is easier to use in many cases for the theme....
$this_category[$row_board['ID_PARENT']]['link_children'][] = &$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['link'];
}
// Child of a child... just add it on...
elseif (!empty($modSettings['countChildPosts']))
{
if (!isset($parent_map))
$parent_map = array();

if (!isset($parent_map[$row_board['ID_PARENT']]))
foreach ($this_category as $id => $board)
{
if (!isset($board['children'][$row_board['ID_PARENT']]))
continue;

$parent_map[$row_board['ID_PARENT']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]);
$parent_map[$row_board['ID_BOARD']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]);

break;
}

if (isset($parent_map[$row_board['ID_PARENT']]))
{
$parent_map[$row_board['ID_PARENT']][0]['posts'] += $row_board['numPosts'];
$parent_map[$row_board['ID_PARENT']][0]['topics'] += $row_board['numTopics'];
$parent_map[$row_board['ID_PARENT']][1]['posts'] += $row_board['numPosts'];
$parent_map[$row_board['ID_PARENT']][1]['topics'] += $row_board['numTopics'];

continue;
}

continue;
}
// Found a child of a child - skip.
else
continue;

// Prepare the subject, and make sure it's not too long.
censorText($row_board['subject']);
$row_board['short_subject'] = shorten_subject($row_board['subject'], 24);
$this_last_post = array(
'id' => $row_board['ID_MSG'],
'time' => $row_board['posterTime'] > 0 ? timeformat($row_board['posterTime']) : $txt[470],
'timestamp' => forum_time(true, $row_board['posterTime']),
'subject' => $row_board['short_subject'],
'member' => array(
'id' => $row_board['ID_MEMBER'],
'username' => $row_board['posterName'] != '' ? $row_board['posterName'] : $txt[470],
'name' => $row_board['realName'],
'href' => $row_board['posterName'] != '' && !empty($row_board['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] : '',
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : $row_board['realName']) : $txt[470],
),
'start' => 'msg' . $row_board['new_from'],
'topic' => $row_board['ID_TOPIC']
);

// Provide the href and link.
if ($row_board['subject'] != '')
{
$this_last_post['href'] = $scripturl . '?topic=' . $row_board['ID_TOPIC'] . '.msg' . ($user_info['is_guest'] ? $modSettings['maxMsgID'] : $row_board['new_from']) . (empty($row_board['isRead']) ? ';boardseen' : '') . '#new';
$this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . $row_board['subject'] . '">' . $row_board['short_subject'] . '</a>';
}
else
{
$this_last_post['href'] = '';
$this_last_post['link'] = $txt[470];
}

// Set the last post in the parent board.
if (empty($row_board['ID_PARENT']) || ($isChild && !empty($row_board['posterTime']) && $this_category[$row_board['ID_PARENT']]['last_post']['timestamp'] < forum_time(true, $row_board['posterTime'])))
$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'] = $this_last_post;
// Just in the child...?
if ($isChild)
{
$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['last_post'] = $this_last_post;

// If there are no posts in this board, it really can't be new...
$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['new'] &= $row_board['posterName'] != '';
}
// No last post for this board?  It's not new then, is it..?
elseif ($row_board['posterName'] == '')
$this_category[$row_board['ID_BOARD']]['new'] = false;

// Determine a global most recent topic.
if (!empty($row_board['posterTime']) && forum_time(true, $row_board['posterTime']) > $most_recent_topic['timestamp'])
$most_recent_topic = array(
'timestamp' => forum_time(true, $row_board['posterTime']),
'ref' => &$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'],
);
}
mysql_free_result($result_boards);

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_buddies'] = 0;
$context['num_users_hidden'] = 0;

$context['show_buddies'] = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
if (empty($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']) && !allowedTo('moderate_forum'))
{
$context['num_users_hidden']++;
continue;
}

// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

$is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
if ($is_buddy)
{
$context['num_buddies']++;
$link = '<b>' . $link . '</b>';
}

$context['users_online'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'is_buddy' => $is_buddy,
'hidden' => empty($row['showOnline']),
);

$context['list_users_online'][$row['logTime'] . $row['memberName']] = empty($row['showOnline']) ? '<i>' . $link . '</i>' : $link;

if (!isset($context['online_groups'][$row['ID_GROUP']]))
$context['online_groups'][$row['ID_GROUP']] = array(
'id' => $row['ID_GROUP'],
'name' => $row['groupName'],
'color' => $row['onlineColor']
);
}
mysql_free_result($result);

krsort($context['users_online']);
krsort($context['list_users_online']);
ksort($context['online_groups']);

$context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];

// Track most online statistics?
if (!empty($modSettings['trackStats']))
{
// Determine the most users online - both all time and per day.
$total_users = $context['num_guests'] + $context['num_users_online'];

// More members on now than ever were?  Update it!
if (!isset($modSettings['mostOnline']) || $total_users >= $modSettings['mostOnline'])
updateSettings(array('mostOnline' => $total_users, 'mostDate' => time()));

$date = strftime('%Y-%m-%d', forum_time(false));

// One or more stats are not up-to-date?
if (!isset($modSettings['mostOnlineUpdated']) || $modSettings['mostOnlineUpdated'] != $date)
{
$request = db_query("
SELECT mostOn
FROM {$db_prefix}log_activity
WHERE date = '$date'
LIMIT 1", __FILE__, __LINE__);

// The log_activity hasn't got an entry for today?
if (mysql_num_rows($request) == 0)
{
db_query("
INSERT IGNORE INTO {$db_prefix}log_activity
(date, mostOn)
VALUES ('$date', $total_users)", __FILE__, __LINE__);
}
// There's an entry in log_activity on today...
else
{
list ($modSettings['mostOnlineToday']) = mysql_fetch_row($request);

if ($total_users > $modSettings['mostOnlineToday'])
trackStats(array('mostOn' => $total_users));

$total_users = max($total_users, $modSettings['mostOnlineToday']);
}
mysql_free_result($request);

updateSettings(array('mostOnlineUpdated' => $date, 'mostOnlineToday' => $total_users));
}
// Highest number of users online today?
elseif ($total_users > $modSettings['mostOnlineToday'])
{
trackStats(array('mostOn' => $total_users));
updateSettings(array('mostOnlineUpdated' => $date, 'mostOnlineToday' => $total_users));
}
}

// Set the latest member.
$context['latest_member'] = &$context['common_stats']['latest_member'];

// Load the most recent post?
if ((!empty($settings['number_recent_posts']) && $settings['number_recent_posts'] == 1) || $settings['show_sp1_info'])
$context['latest_post'] = $most_recent_topic['ref'];

if (!empty($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1)
{
require_once($sourcedir . '/Recent.php');

if (($context['latest_posts'] = cache_get_data('boardindex-latest_posts:' . md5($user_info['query_see_board'] . $user_info['language']), 180)) == null)
{
$context['latest_posts'] = getLastPosts($settings['number_recent_posts']);
cache_put_data('boardindex-latest_posts:' . md5($user_info['query_see_board'] . $user_info['language']), $context['latest_posts'], 180);
}

// We have to clean up the cached data a bit.
foreach ($context['latest_posts'] as $k => $post)
{
$context['latest_posts'][$k]['time'] = timeformat($post['raw_timestamp']);
$context['latest_posts'][$k]['timestamp'] = forum_time(true, $post['raw_timestamp']);
}
}

$settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0;
$settings['show_member_bar'] &= allowedTo('view_mlist');
$context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']);
$context['show_member_list'] = allowedTo('view_mlist');
$context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']);

// Set some permission related settings.
$context['show_login_bar'] = $user_info['is_guest'] && !empty($modSettings['enableVBStyleLogin']);
$context['show_calendar'] = allowedTo('calendar_view') && !empty($modSettings['cal_enabled']);

// Load the calendar?
if ($context['show_calendar'])
$context['show_calendar'] = calendarDoIndex();

$context['page_title'] = $txt[18];
}


Is that pretty code?

Bigguy

Looks like it has changed A BIT since I last tried to modify code on a phpbb forum. I still stand by what I said though. As far as I am concerned (for me anyway) SMF is a lot easier.

Advertisement: