story
227 2006-09-18 23:03
Re: Error: unable to fetch online count (7 replies, posted in PunBB 1.2 troubleshooting)
Try this instead, where you see the "SEECT COUNT(x) FROM y WHERE x"
$result = $db->query("SELECT x FROM y WHERE x") or error("message");
// Now you should see something along the lines of this:
// $num_online = $db->result($result);
// Change to this:
$num_online = $db->num_rows($result);
Now there is the occational COUNT(x)-1 or SELECT COUNT(x), z FROM y... so yah... this is just a tip to get you in the right direction...
228 2006-09-18 22:32
Topic: Question about making my modification avalible (3 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Soes I've seen a few tools to make mod install guides and headers... (on windows, but they ~should~ run in wine)
But I'm wondering if anyone has a script to convert a "diff -ur <mymoddedinstall> <cleanPunBB>" to the standard install guide format...
I've got a few mods that traverse like 10 files and 200+ lines... so doing all that manually would be to much work for me ;p Deleting extra lines from a generated install.txt file wouldn't be to hard though
229 2006-09-18 21:27
Re: Error: unable to fetch online count (7 replies, posted in PunBB 1.2 troubleshooting)
Hurmm... "SELECT COUNT(x) FROM y" is used in a few places in punbb... you might want to grep through the code... I think it's used to find out the next valid topic id, post id, forum id, user id, etc...
230 2006-09-18 21:09
Re: Something simple: Being able to view one's Profile (8 replies, posted in Feature requests)
Woops forgot one more thing....
profile.php line 960ish
find:
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
?>
EDIT -- This section needed to be changed... (Admins didn't get the side menu)
replace with:
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
if ($pun_user['id'] == $id ||
(($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '1') &&
($pun_user['g_id'] == PUN_MOD && (! ($user['g_id'] < PUN_GUEST)))) ||
($pun_user['g_id'] == PUN_ADMIN))
{
generate_profile_menu('preview');
}
?>
There you go
231 2006-09-18 20:57
Re: Is it just me, or does punbb miss daylight saving time support? (27 replies, posted in PunBB 1.2 troubleshooting)
There's gonah be some additional problems with timezoning too...
The states just changed the date they go back/forward, and I ~think~ North america followed the states too. Dono about Europ or asia or what not though...
232 2006-09-18 20:53
Re: I can't upload any avatars in my site (60 replies, posted in PunBB 1.2 troubleshooting)
@Smartys My web server doesn't parse .htaccess, I have to do it hackishly
In that case I'm at a loss Meow... phpBB should fail just the same... Unless... what's your "max avatar size" set at? setting it to low will cause problems... or uploading a file that's to big (512Kb to 1Mb for my servr) could cause the stack to run out of room and crash.
EDIT --
I just registered as testyoucandelete and tried to upload a 997 Byte file... hurm... I'm at a loss meow (sorry for the account creation, just wanted to try with a uber small file... you can delete the account if you like)
233 2006-09-18 20:51
Re: Something simple: Being able to view one's Profile (8 replies, posted in Feature requests)
Hurm, this should be easy...
line 300ish in ./include/functions.php
find:
<ul>
?>">Preview</a></li>
<li<?php if ($page == 'essentials') echo ' class="isactive"'; ?>><a href="profile.php?section=essentials&id=<?php echo $id ?>"><?php echo $lang_profile['Section essentials'] ?></a></li>
<li<?php if ($page == 'personal') echo ' class="isactive"'; ?>><a href="profile.php?section=personal&id=<?php echo $id ?>"><?php echo $lang_profile['Section personal'] ?></a></li>
replace with:
<ul>
<li<?php if ($page == 'preview') echo ' class="isactive"'; ?>><a href="profile.php?section=preview&id=<?php echo $id ?>">Preview</a></li>
<li<?php if ($page == 'essentials') echo ' class="isactive"'; ?>><a href="profile.php?section=essentials&id=<?php echo $id ?>"><?php echo $lang_profile['Section essentials'] ?></a></li>
<li<?php if ($page == 'personal') echo ' class="isactive"'; ?>><a href="profile.php?section=personal&id=<?php echo $id ?>"><?php echo $lang_profile['Section personal'] ?></a></li>
Now profile.php line 910ish
find:
// View or edit?
if ($pun_user['id'] != $id &&
($pun_user['g_id'] > PUN_MOD ||
($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') ||
($pun_user['g_id'] == PUN_MOD && $user['g_id'] < PUN_GUEST)))
{
replace with:
// View or edit?
if (($pun_user['id'] != $id &&
($pun_user['g_id'] > PUN_MOD ||
($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') ||
($pun_user['g_id'] == PUN_MOD && $user['g_id'] < PUN_GUEST)))
|| (!$section || $section == 'preview'))
{
again in profile.php, around line 1050
find:
}
else
{
if (!$section || $section == 'essentials')
{
replace with:
}
else
{
if ($section == 'essentials')
{
Now you default to the preview, and still have all the admin, mod, and personal options
You can visit my website, and sign-up for an account to see this in action, great idea! This bugged me too
234 2006-09-18 18:47
Re: Mp3 Player page (6 replies, posted in PunBB 1.2 modifications, plugins and integrations)
If you get a chance, would be nice to also have the ability to set a time offset and length of time, that way I could play a "sample" from say viewforum.php and the whole song from viewtopic.php.
235 2006-09-18 18:45
Re: viewtopic.php show group names (2 replies, posted in PunBB 1.2 troubleshooting)
Well... It's not as easy as you think... depending...
$cur_post['g_title'] is the name of the group, as far as administrators are concirned (It's the first line that's displayed when you edit a group)
$cur_post['g_user_title'] is the description (or display name, or title) of the group (as long as ranks are disabled and the user title hasn't been set; second line in edit groups).
Just add ", g.g_title " after the first ", g.g_user_title" to get the group name. Then $cur_post['g_title'] will be set, and you can echo it wherever
Now if you want the title, of the group to display... well that's work, since sometimes g_user_title is NULL, and sometime users.title is NULL and sometimes ranks don't exists or are turned off...
236 2006-09-18 02:24
Re: I can't upload any avatars in my site (60 replies, posted in PunBB 1.2 troubleshooting)
Looks like your right Smartys... you'd have to use cgi Meowmeow, but with the cgi you ~could~ still access all them php objects by calling a php script from the cgi script and setting up the argvs ' with the raw multi-part form data... then the php script to access all them pun variables and functions to complete the upload... ;p
237 2006-09-18 01:24
Re: I can't upload any avatars in my site (60 replies, posted in PunBB 1.2 troubleshooting)
http://www.w3.org/TR/REC-html40/interac … ef-enctype
<form action="blah" method="post" enctype="multipart/form-data">
<!-- blah -->
<input type="file" ...>
That should upload the file in the post data, and not to a temporary location, as far as I know anyways... But I suppose I could be wrong... It be the first time lol
EDIT --
http://www.ietf.org/rfc/rfc2388.txt
Looks like the specs specify what the httpd app can do with that data... it has to go to the perl script in the same way that a multi-part e-mail message would show up in telnet. I'm unsure how php handles this, but i'm assuming it's the same thing. If something ends up in tmp, it's probably due to the way profile.php and/or php stores that data, and very litle to do with the w3 specs.
EDIT --
Hummm, found this:
http://www.thescripts.com/forum/thread925.html looks like php uses tmp for the FILES variable...
Might have to use something with power server side, like perl... I really wish php was just perl with ?> substituted as END; and <?php substituted as print <<END... but such is life...
Lemme see if there's a way to "bypass" the FILES variable...
EDIT --
php://input allows you to read raw POST data. It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives. php://input is not available with enctype="multipart/form-data"
Hurm... almost there... gimme a few more...
238 2006-09-17 20:43
Re: I can't upload any avatars in my site (60 replies, posted in PunBB 1.2 troubleshooting)
If people can "post data" you can set the avatar submission form to a certain type of data, I forget the name, but what is sent to the server ends up looking like an attachment from an e-mail. Then with a php function you decrypt it (At least I know perl has that ability, php should too). Finally, you send that data to the database. /tmp is never touched, unless the host has done some serious editing of their httpd servers source code.
239 2006-09-17 19:20
Re: Error of table in administration (4 replies, posted in PunBB 1.2 bug reports)
"Unable to fetch table status" is caused in admin_index.php and it happends when a mysql server doesn't return it's version information correctly. I suggest opening admin_index.php and remove these lines:
// Collect some additional info about MySQL
if ($db_type == 'mysql' || $db_type == 'mysqli')
{
$db_version = 'MySQL '.$db_version;
// Calculate total db size/row count
$result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
$total_records = $total_size = 0;
while ($status = $db->fetch_assoc($result))
{
$total_records += $status['Rows'];
$total_size += $status['Data_length'] + $status['Index_length'];
}
$total_size = $total_size / 1024;
if ($total_size > 1024)
$total_size = round($total_size / 1024, 2).' MB';
else
$total_size = round($total_size, 2).' KB';
}
PS I take no responsibility for what goes wrong, if something does ;p
240 2006-09-17 19:17
Re: Word Association Thread (1,382 replies, posted in General discussion)
Reptiles
241 2006-09-17 19:10
Re: How do i disable so moderators cant see ip adresses. (3 replies, posted in PunBB 1.2 troubleshooting)
242 2006-09-17 19:07
Re: I can't upload any avatars in my site (60 replies, posted in PunBB 1.2 troubleshooting)
If you know php/sql you ~could~ write a mod to upload the files to the database, and then a php script to return the data as an img
243 2006-09-17 18:52
Re: Mp3 Player page (6 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Can it do ogg? mp3s are to circled in copyrights for me... the ogg format is open to public.
244 2006-09-16 19:31
Re: PHP related question (8 replies, posted in PunBB 1.2 troubleshooting)
Humm found it.... and why I was getting some many problems, thanks for the help smartys
I keeped getting "" because there was no value for that select when I ran the test... ~.~ Gawd I need some sleep... or coffee
Originally it was the "or error(msg)" that cause the problem, so if it was a one liner I'd have to remove that or... Which could be where the garbage collector comes in... cause really what happend when the or error is expanded is ~something~ like this:
try {
$temp = $db->query('xxx');
// .. in $db->query();
if ($other_temp == 0) throw OrError
}
catch (OrError $e)
{
error(msg)
}
// We've left the scope of the try block, [b]even if there was no error thrown[/b] and now we hand off NULL to $db->fetch_row()
Unfortunatly something like this won't catch the error
print($db->fetch_row($db->query('SELECT uid, tid FROMasd posts_read WHERE uid='.$pun_user['id'].' AND tid='.$cur_topic['tid']))) or error ('blah', __FILE__, __LINE__, '');
price to pay, i guess....
245 2006-09-16 19:19
Re: What editor do you use for php? (114 replies, posted in Programming)
if your writing a forum system like punbb I dont think that using vi on the remote box is the best solution. having a local server / database, and using something like phpedit or zend studio (mmm debugger), or dreamweaver would be faster and more efficient than vi.
Well in my particular situation, ssh'in into my own box would be silly, hehe, but true nuff, if it's on a remote box, grab it locally... and if you want to, break out the big boys ;p
Meh, it's kindah like your story up above... Things that arn't "commercial product" quality, or size, don't require this, or that, to modify... You want to drive the car there, and get there first; drive the bike and come second, or walk the way and come last? Well when the distance is short, it doesn't matter
The being said, I couldn't see much use in vi (or the acompanying bach apps) for you, other then the special occation. For me, even with a large project, vi is the way to go. Remeber I'm running linux as a desktop, so I don't have ssh anywhere to get vi up and running, and I have as many v-terminals as I like. The simple fact is, I have more screen realestate then 10 of me could handle, and enough "do this" scripts in the home folder to accomplish anything a Windows app could do for me. Going back to windows, or using wine to run anything other then games would be like moving from a 10 acre house in the country to a bachlor in the heart of the city (Which is an odd analogy... I actually prefer my bachlors, in the city, lol).
246 2006-09-16 19:00
Re: PHP related question (8 replies, posted in PunBB 1.2 troubleshooting)
Mmm, actually, try this:
print($db->fetch_row($db->query('SELECT uid, tid FROM posts_read WHERE uid='.$pun_user['id'].' AND tid='.$cur_topic['tid']))); exit;
Nope, no go...
You'd think the guys who started php would make this the first thing on thier list of thing to do... ~.~ I must be doing something wrong with the $db->fetch_row declairation?
This works...
print($db->query('SELECT uid, tid FROM posts_read WHERE uid='.$pun_user['id'].' AND tid='.$cur_topic['tid']));
output:
"Object id #3"
But then again print isn't a member of a class... maybe that has something to do with it?
247 2006-09-16 18:13
Re: PHP related question (8 replies, posted in PunBB 1.2 troubleshooting)
Meh, it work in perl, or c/c++... heck I think even in java...
I was hoping I was just forget to cast it or add extra brackets or something...
248 2006-09-16 18:12
Re: SQL Statement optimization (4 replies, posted in Programming)
Sweet cause I got it working... had to track down a bug with topics that got moved more then once... but it's working on my site atm
When I get a chance I'll try to post it on punres, dono if there's gonah be an install_mod.php or not though ;p I am rather lazy
249 2006-09-16 17:31
Topic: PHP related question (8 replies, posted in PunBB 1.2 troubleshooting)
$temp = $db->query('SELECT uid, tid FROM posts_read WHERE uid='.$pun_user['id'].' AND tid='.$cur_topic['tid']) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
$atid = $db->fetch_row($temp);
print($atid);
exit();
output:
"Array"
print($db->fetch_row($db->query('SELECT uid, tid FROM posts_read WHERE uid='.$pun_user['id'].' AND tid='.$cur_topic['tid']) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error())));
exit;
output:
""
Why, why, why ~.~ I understand that in the end, $temp exists, but I don't want to have to type it, and worry about the other $temps in the same scope, etc... I thought php was supposed to be getting closer to c/c++...
250 2006-09-16 17:27
Re: What editor do you use for php? (114 replies, posted in Programming)
ummm... lol... not exactly the answer i was looking for...
I just use a cron job, and run a script that minors http sites. Add a line to the script and I get a new site.