I'd actually have to go through all the css code to find the offending line but somehow a font-size of 11px is being applied to the body element and thus reducing the size of all the "em" sized text in the forum's css file.

At least that's what FireBug says.

Also, the forum is looking narrower because the #wrap div is set to 960px and the forum width is set to take up only 90% of that width.

To make the forum as wide as the banner, remove the

width: 90%;
and change
padding: 1.3em 2em; to padding: 1.3em 0;

in Oxygen.css and to fix the font size issue, change this

font:11px/18px Verdana, Arial, Helvetica, sans-serif;
to
font:1em/18px Verdana, Arial, Helvetica, sans-serif;

in your style.css file and it should be fixed.

27

(1 replies, posted in General discussion)

I've had the same problem. When I'm writing a response or several and then go back to check what other messages I need to read, they're gone in the unread list.

28

(22 replies, posted in PunBB 1.3 extensions)

I am still having the extension disappear. It's 4am CST and it's currently MIA.

Edit: Even after the timezone and XSS vulnerability fix.

29

(22 replies, posted in PunBB 1.3 extensions)

I think he's means you need to replace that with what's on line 67.

Before:

    $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.$ot_username.'</a>';

After:

   $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

Here's the whole thing:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/*
    Copyright (C) 2008 Garciat (Gabriel Garcia T.) <http://garciat.org/>
    Released under GPL license version 3 or any later version <http://www.gnu.org/licenses/gpl.html>
    
    This extension 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 3 of the License, or
    (at your option) any later version.

    This extension is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this extension.  If not, see <http://www.gnu.org/licenses/>.
*/
-->

<extension engine="1.0">
    <id>online_today</id>
    <title>Online Today</title>
    <version>1.0.0</version>
    <description>Shows today's online users on the forum index.</description>
    <author>Garciat</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.3.2</maxtestedon>
    
    <install>
        <![CDATA[

        ]]>
    </install>
    
    <uninstall>
        <![CDATA[

        ]]>
    </uninstall>
    
    <hooks>
        <hook id="in_new_online_data">
            <![CDATA[
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';

$todays_users_diff = ($forum_user['timezone'] + ($forum_user['dst']-1)) * 3600;
$todays_users_now = time();

$online_today_query = array(
    'SELECT'    =>    'id, username',
    'FROM'        =>    'users',
    'WHERE'    =>    'last_visit>"'.strtotime(gmdate('M d Y', $todays_users_now + $todays_users_diff)).'" and group_id>0',
    'ORDER BY'    =>    'username'
);

$online_today_result = $forum_db->query_build($online_today_query);

$online_today = array();
while(list($ot_id, $ot_username) = $forum_db->fetch_row($online_today_result))
    $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

if(!empty($online_today))
    echo '<h3 class="hn"><span>'.$lang_online_today['Online today'].': '.implode(', ', $online_today).'</span></h3>';
            ]]>
        </hook>
    </hooks>
</extension>

It'd be nice to have an extension that displays an excerpt of the message as the title of the link.

Specific, but useful. Thanks. smile

31

(7 replies, posted in PunBB 1.3 troubleshooting)

Thanks, Anatoly. smile Caught it about the exact same time you posted your response.

32

(7 replies, posted in PunBB 1.3 troubleshooting)

Okay, ignore my previous question... I was making the same mistake as when I first asked.
hmm

33

(7 replies, posted in PunBB 1.3 troubleshooting)

Okay, last question...

$jchat_query = array(
    'SELECT'    => 'g.g_id, g.g_title',
    'FROM'        => 'groups AS g'
);
$jchat_result = $forum_db->query_build($jchat_query) or error(__FILE__, __LINE__);
$jchat_query_row = $forum_db->fetch_row($jchat_result);

$jchat_group = array();
while ($cur_row = $forum_db->fetch_assoc($jchat_query_row))
  {
    $jchat_group[$cur_row['g_id']] = $cur_row['g_title'];
  };

I know this is like MySQL to PHP 101, but how do I get the result into the $jchat_group array();? I think I've been up too late working on this and my brain is fried.

For bonus points, where is the best place to put this so the $jchat_group result will be available on every page?

34

(7 replies, posted in PunBB 1.3 troubleshooting)

Alright... that was easy.

Thank you! smile

So, I'm trying to follow the faq on how to work with $forum_db-> results, but I can't seem to get it to return anything but the number of rows in the result (using $forum_db->num_rows($result);), or at least return it in a way I can use.

Here's what I've got so far:

$jchat_query = array(
    'SELECT'    => 'g.g_id, g.g_title',
    'FROM'        => 'groups AS g'
);
$jchat_result = $forum_db->query_build($jchat_query) or error(__FILE__, __LINE__);
$jchat_query_rows = $forum_db->fetch_row($jchat_query);
$jchat_group_id = $jchat_query_rows[0];
echo $jchat_group_id; // returns nothing
print_r($jchat_group_id); // also returns nothing

$rows = $forum_db->num_rows($jchat_result);
printf($rows); // returns 12, which is correct
print_r($jchat_query_rows); // returns nothing
print_r($jchat_query); // returns the proper query array as above
print_r($jchat_result); // returns mysqli_result Object ( )
echo $jchat_query_rows['Administrators']; // nothing
echo $jchat_query_rows['1']; // nada
echo $jchat_query_rows[1]; // zilch 

Can someone enlighten me on what I'm doing wrong?

36

(2 replies, posted in PunBB 1.3 troubleshooting)

I was ultimately trying to think of a way to add a hook into an already written and included javascript file, like say into an if-than statement, but I just decided to write the addon differently.

Thanks, though.

Thank you, that's exactly what I needed.

I'm working on another extension right now but when I get done, I was looking in to doing something slightly like this as well.

I'm getting this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/..removed../admin/settings.php(337) : eval()'d code on line 173

Catchable fatal error: Object of class mysqli_result could not be converted to string in /home/..removed../admin/settings.php(337) : eval()'d code on line 175

What am I missing? Did I format that incorrectly?

This might be a long shot but I'm looking all over the place for how PunBB does it's $forum_config variable and keeps it updated.

Anyone know where to look?

Right now I've got this in the <install> portion of the addon:

$jchat_group_query = array(
    'SELECT'    => 'g_id, g_title',
    'FROM'        => 'groups'
);
$jchat_config = $forum_db->query_build($jchat_group_query) or error(__FILE__, __LINE__);
$jchat_config = mysql_fetch_array($jchat_config);

Is that all I need and it'll stay usable as $jchat_config['group_id'] to display group names throughout the script?

Sorry if my question is somewhat naive, I'm learning as I go along.

41

(2 replies, posted in PunBB 1.3 troubleshooting)

I'm trying to think of a way to make this extension I'm working on a little bit more extensible, but the places I would like to add hooks are in a javascript file.

Is there any way of integrating a way to hook into a javascript file like you can with php? A way that will work with extensions in PunBB?

Thank you KeyDog. smile

Is there somewhere that has a reference on how to use those functions aside from looking through the source code at 10 different examples and trying to figure it out from there?

Okay, I think I've got it:

$dbhandle = mysql_connect($db_host, $db_username, $db_password) or print(mysql_error());
$selected = mysql_select_db($db_name,$dbhandle) or print(mysql_error());
$result = mysql_query('SELECT g_id, g_title FROM '.$db_prefix.'groups');
while ($row = mysql_fetch_array($result)) {
    print('ID:'.$row{'g_id'}.' Name:'.$row{'g_title'}.'<br />');
};

This is kind of a noobish question but, can I just query the database since it's already connected or do I have to pull the $db_username $db_password and all that to connect?

And if it's already connected, would this work?

$result = mysql_query('SELECT g_id, g_title FROM '.$db_prefix.'groups');
if (!$result) {
    print('Invalid query: ' . mysql_error());
}

So there is no way to print out a list of all the group ID's (not just the current user, which is what I'm getting from $forum_user['g_id']) and their associated group names?

So, basically, what's the command to list all of the user groups and their g_id's without having to query the SQL server for them?

48

(55 replies, posted in Supported extensions)

I don't notice any errors or change to my forum other than the addition of the admin portion for the Pun Tags:. I'm using v1.3.2.

I'm trying to work out a way to:

  1. Set up an Admin Panel

    1. List out all user groups on my extension's admin panel (separate from the group permissions admin panel).

    2. Put all the groups in to an array(); I think this would be the easiest way to work with them. Let me know if it isnt...

    3. Allow the user to assign groups to four different permission levels. Most likely using a text field(permission level) & Label(group name) field they can just type 1-4 on each of them to set it.

    4. Store each of the values into the $forum_config['values']... somehow... Can I do something like "'o_extensionname_groupperm_'.$id" or something?

    5. Each permission level (0-3) would start off at the most restrictive (only admins, but can be changed by the user), then a little less restrictive, while still keeping the previous groups in it. (ie: group[0] = 'admins'; group[1] = 'admins, mods, privuser'; group[2] = 'admins, mods, privuser, default users'; group[3] = 'admins, mods, privuser, default users, guests';)

  2. Next, pass along certain values to a javascript ui

    1. Send which group(0-3) the user's group falls into via $_POST to the javascript.

    2. The user will be able to pick (from the javascript ui) a group(0-3) level that they can send messages but they can't receive or send messages higher than what is set in the admin panel (option will be grayed out).

I know how to call the proper hook to make the admin panel, but I'm clueless on how to list out all the user groups and allow the admin the ability to assign them to my groups for chat privileges(group(0-3)). I think once I can get them assigned, they'll be easy to send to the javascript via $_POST. Does that sound correct or am I making this too complicated? If you haven't already realized it, this is for a javascript chat extension and I'm trying to have different permission levels that can be selected when sending messages (never higher than what permissions their group is given in the admin panel) and then they can only receive up to their permission level, and anything they can receive is shown in different colors (so admin messages are red, next level down is orange, next level is green, lowest public level that everyone can see is black).

I can do the javascript for what I need, I just need help to know which functions built into PunBB to use in php since I'm not that accustomed to it yet.

Can anyone throw any bit of insight (mainly how to list out all the groups and store them in $forum_config with the selected values in my extensions admin panel in a way that if the groups are ever modified or removed in punbb, it won't cause problems with my extension or the javascript ui)? I'm going cross-eyed trying to look through all the functions in admin/groups.php without knowing exactly what I'm looking for.

50

(22 replies, posted in PunBB 1.3 extensions)

Thank you for this extension, Garciat.